2 Copyright © 2010-2014, The AROS Development Team. All rights reserved.
5 Desc: Code for CONU_CHARMAP console units.
10 #include <proto/exec.h>
13 struct charmap_line
*charmap_dispose_line(struct charmap_line
*line
)
15 struct charmap_line
*next
= NULL
;
22 FreeMem(line
->text
, line
->size
);
24 FreeMem(line
->fgpen
, line
->size
);
26 FreeMem(line
->bgpen
, line
->size
);
28 FreeMem(line
, sizeof(struct charmap_line
));
33 VOID
charmap_dispose_lines(struct charmap_line
*line
)
35 while ((line
= charmap_dispose_line(line
)));
38 struct charmap_line
*charmap_newline(struct charmap_line
*next
,
39 struct charmap_line
*prev
)
41 struct charmap_line
*newline
=
42 (struct charmap_line
*)AllocMem(sizeof(struct charmap_line
),
59 // FIXME: **much** faster if add capacity to charmap_line and allocate
60 // a few characters at a time
61 VOID
charmap_resize(struct charmap_line
*line
, ULONG newsize
)
63 char *text
= line
->text
;
64 BYTE
*fgpen
= line
->fgpen
;
65 BYTE
*bgpen
= line
->bgpen
;
66 BYTE
*flags
= line
->flags
;
67 ULONG size
= line
->size
;
71 line
->text
= (char *)AllocMem(newsize
, MEMF_ANY
);
73 memset(line
->text
, 0, newsize
);
74 line
->fgpen
= (BYTE
*) AllocMem(newsize
, MEMF_ANY
);
76 memset(line
->fgpen
, 0, newsize
);
77 line
->bgpen
= (BYTE
*) AllocMem(newsize
, MEMF_ANY
);
79 memset(line
->bgpen
, 0, newsize
);
80 line
->flags
= (BYTE
*) AllocMem(newsize
, MEMF_ANY
);
82 memset(line
->flags
, 0, newsize
);
94 if (text
&& line
->text
)
95 memcpy(line
->text
, text
, size
);
96 if (fgpen
&& line
->fgpen
)
97 memcpy(line
->fgpen
, fgpen
, size
);
98 if (bgpen
&& line
->bgpen
)
99 memcpy(line
->bgpen
, bgpen
, size
);
100 if (flags
&& line
->flags
)
101 memcpy(line
->flags
, flags
, size
);
106 FreeMem(fgpen
, size
);
108 FreeMem(bgpen
, size
);
110 FreeMem(flags
, size
);