2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 #ifdef VERBOSE_REV_INFO
25 static char rcs_id[] = "$TOG: TermBuffer.c /main/2 1997/04/17 18:04:41 samborn $";
26 #endif /* VERBOSE_REV_INFO */
30 * (c) Copyright 1993, 1994, 1996 Hewlett-Packard Company *
31 * (c) Copyright 1993, 1994, 1996 International Business Machines Corp. *
32 * (c) Copyright 1993, 1994, 1996 Sun Microsystems, Inc. *
33 * (c) Copyright 1993, 1994, 1996 Novell, Inc. *
34 * (c) Copyright 1996 Digital Equipment Corporation. *
35 * (c) Copyright 1996 FUJITSU LIMITED. *
36 * (c) Copyright 1996 Hitachi. *
39 #define USE_MEMCPY /* use memcpy for line movement... */
43 #include "TermHeader.h" /* for MIN/MAX */
44 #include "TermBufferP.h"
45 #include "TermEnhance.h"
48 ** clear "count" enhancements starting at startCol
77 _DtTermClearEnhancements
101 enhValue **enhancements,
103 const countSpec countWhich
107 _DtTermGetCharacterPointer
115 _DtTermInsertEnhancements
121 const Boolean insertFlag
125 _DtTermBufferCreateEnhancement
141 _DtTermDeleteEnhancement
157 Boolean insertFlag, /* if TRUE, insert, else overwrite */
158 termChar **returnChars, /* pointer to overflow buffer */
159 short *returnCount /* count of characters in overflow buffer */
185 #if (defined(TEST) || defined(__CODECENTER__) || defined(VALIDATE_ENH))
192 # define VALIDATE_ENHANCEMENTS(tb, row) validateEnhancements((tb), (row))
194 # define VALIDATE_ENHANCEMENTS(tb, row)
195 #endif /* TEST || __CODECENTER__ || VALIDATE_ENH */
198 ** A blank enhancement structure, it will come in handy.
200 static DtTermEnhPart blankEnh = {0, 0, 0, 0, 0};
203 ** Create and initialize the Dt-specific parts of the term buffer.
206 _DtTermBufferCreateBuffer
211 const short sizeOfBuffer,
212 const short sizeOfLine,
213 const short sizeOfEnh
220 newTB = _DtTermPrimBufferCreateBuffer(w, rows, cols,
221 sizeOfBuffer, sizeOfLine, sizeOfEnh);
226 VALUE_LIST(newTB) = (enhValues) malloc(NUM_ENHANCEMENT_FIELDS *
229 if (!VALUE_LIST(newTB))
231 _DtTermPrimBufferFreeBuffer(newTB);
232 return((TermBuffer) NULL);
235 NUM_ENH_FIELDS(newTB) = NUM_ENHANCEMENT_FIELDS;
236 for (lines = DT_LINES(newTB);
237 lines < DT_LINES(newTB) + ROWS(newTB);
240 DT_ENH(*lines) = (DtEnh) NULL;
242 DT_ENH_STATE(newTB) = blankEnh;
243 DT_ENH_DIRTY(newTB) = 0;
244 ENH_PROC(newTB) = _DtTermEnhProc;
245 BUFFER_CREATE(newTB) = _DtTermBufferCreateBuffer;
246 BUFFER_FREE(newTB) = _DtTermBufferFreeBuffer;
247 BUFFER_RESIZE(newTB) = _DtTermBufferResize;
248 CLEAR_ENH(newTB) = _DtTermClearEnhancements;
249 INSERT_ENH(newTB) = _DtTermInsertEnhancements;
250 DELETE_ENH(newTB) = _DtTermDeleteEnhancement;
251 SET_ENH(newTB) = _DtTermSetEnhancement;
252 GET_ENH(newTB) = _DtTermGetEnhancement;
253 SET_LINE_LENGTH(newTB) = _DtTermSetLineLength;
254 CLEAR_LINE(newTB) = _DtTermClearLine;
260 ** Resize buffer, this is a helper function, if malloc fails, then the
261 ** appropriate dimensions are forced to the current maximums
276 ** make any necessary width adjustments first...
279 ** We do not take any action if the new column width is less
280 ** than the current column width. It is the responsibility of
281 ** the rendering code to make sure that two column characters
282 ** are handled properly if the second column falls past the last
283 ** column in the window.
285 if (*newCols > MAX_COLS(tb))
287 termChar *newLineBuffer;
290 ** now extend the line buffers and enhancements for all lines,
291 ** (even lines that are not being used at the moment
292 ** (ROWS < MAX_ROWS))...
294 lines = DT_LINES(tb);
295 for (i = 0; i < MAX_ROWS(tb); i++)
298 ** only copy the enhancement information when it exists
300 if (DT_ENH(lines[i]))
302 enh = (DtEnh) malloc(*newCols * sizeof(DtTermEnhPart));
307 ** copy the enhancment info for all characters on
308 ** the line, zero out the rest
310 (void) memcpy(enh, DT_ENH(lines[i]),
311 WIDTH(lines[i]) * sizeof(DtTermEnhPart));
312 (void) memset(&enh[WIDTH(lines[i])], 0,
313 (*newCols - WIDTH(lines[i])) *
314 sizeof(DtTermEnhPart));
315 free(DT_ENH(lines[i]));
316 DT_ENH(lines[i]) = enh;
321 ** the malloc failed, revert back to MAX_COLS
323 *newCols = MAX_COLS(tb);
324 *newRows = MIN(*newRows, MAX_ROWS(tb));
328 newLineBuffer = (termChar *) malloc((unsigned)
329 *newCols * BYTES_PER_CHAR(tb));
331 if (newLineBuffer == NULL)
334 ** line buffer malloc failed, we can only increase the
335 ** width to the current maximum...
337 *newCols = MAX_COLS(tb);
338 *newRows = MIN(*newRows, MAX_ROWS(tb));
341 memcpy(newLineBuffer, BUFFER(lines[i]), LENGTH(lines[i]) *
343 free(BUFFER(lines[i]));
344 BUFFER(lines[i]) = newLineBuffer;
345 WRAPPED(lines[i]) = False;
347 MAX_COLS(tb) = *newCols;
352 ** now adjust the length of the buffer as necessary...
354 if (*newRows > MAX_ROWS(tb))
357 ** the number of rows is increasing
359 lines = (DtLine *) malloc((unsigned) *newRows * sizeof(DtLine));
363 ** the malloc succeeded, copy the old information, and then
366 memcpy(lines, DT_LINES(tb), sizeof(DtLine) * MAX_ROWS(tb));
368 LINES(tb) = (TermLine *)lines;
371 ** now initialize the new lines...
374 ** If we are unable to malloc any part of a line, adjust
375 ** "newRows" and break.
377 for (i = MAX_ROWS(tb); i < *newRows; i++)
379 lines[i] = (DtLine) malloc(SIZE_OF_LINE(tb));
382 DT_ENH(lines[i]) = NULL;
383 BUFFER(lines[i]) = (termChar *) malloc((unsigned) COLS(tb) *
385 if (BUFFER(lines[i]))
387 LENGTH(lines[i]) = 0;
389 WRAPPED(lines[i]) = False;
394 ** the line buffer malloc failed...
403 ** we couldn't malloc this line...
409 MAX_ROWS(tb) = *newRows;
414 ** the malloc for the row buffer failed, revert back to MAX_ROWS
416 *newRows = MAX_ROWS(tb);
425 ** NOTE: This is a helper function, and should only be called by
426 ** TermPrimBufferFreeBuffer.
429 _DtTermBufferFreeBuffer
437 ** Free the Dt-specific buffer info...
439 for (lines = DT_LINES(tb); lines < DT_LINES(tb) + ROWS(tb); lines++)
443 (void) free(DT_ENH(*lines));
448 (void) free(VALUE_LIST(tb));
453 ** clear all the enhancements from startCol through stopCol
468 enh = DT_ENH(DT_LINE_OF_TBUF(tb, row));
473 for(i = 0; i < count; i++)
476 ** Clear all of the enhancement information.
485 ** Clear "count" enhancement blocks, starting at the specified row and column.
488 _DtTermClearEnhancements
496 clearEnhancements(tb, row, col, count);
500 ** Insert the desired number of enhancements at the specified
504 ** We depend on the calling function to insure that insertCount
505 ** has been properly clipped to insure that we don't go out of
507 ** Results are undefined if this function is called when the specified
508 ** column is at the end of the line.
511 _DtTermInsertEnhancements
517 const Boolean insertFlag
521 DtTermEnhPart fillEnh;
527 line = DT_LINE_OF_TBUF(tb, row);
531 ** There's nothing to do if we're past the end of the line or
532 ** the dirty bit is clear and there are no ehancements on
535 if ((col < WIDTH(line)) && ((DT_ENH_DIRTY(tb)) || (enh != NULL)))
540 ** there are currently no enhancements on this line,
541 ** allocate an enhancement buffer, and reset 'enh'...
543 _DtTermBufferCreateEnhancement(tb, row, col);
548 ** get a copy of the current enhancement (we'll insert 'copyCount'
549 ** copies of it into the enhancement buffer)
551 fillEnh = DT_ENH_STATE(tb);
556 ** we're in insert mode, move any existing enhancements...
558 copyCount = MIN((WIDTH(line) - col),
559 (COLS(tb) - col - insertCount));
560 copyCount = MAX(0, copyCount);
561 memmove(enh + col + insertCount, enh + col,
562 copyCount * sizeof(DtTermEnhPart));
567 ** insert insertCount copies of fillEnh into the enhancement buffer
568 ** starting at line->enh[col + 1]...
571 for (i = 0; i < insertCount; i++)
578 ** insert insertCount copies of fillEnh into the enhancement buffer
579 ** starting at line->enh[col + 1]...
582 for (i = 0; i < insertCount; i++)
598 short *count /* number of columns to delete */
601 _DtTermPrimBufferDelete(tb, row, col, count, NULL, NULL);
605 ** delete the desired enhancements starting the specified position...
608 _DtTermDeleteEnhancement
617 DtTermEnhPart fillEnh;
621 line = DT_LINE_OF_TBUF(tb, row);
624 if ((enh == NULL) || (WIDTH(line) <= col))
627 ** no enhancements, or at (or past) the end of the line, return
633 ** get a copy of the current enhancement
638 ** move all of the enhancement blocks between col + width and and the
639 ** end of the line to col
641 copyCount = WIDTH(line) - (col + width);
642 memcpy(enh + col , enh + col + width,
643 copyCount * sizeof(DtTermEnhPart));
649 ** Create an enhancement block at the specified row and column.
651 ** NOTE: For the time being, we simply allocate an entire row's worth
652 ** of enhancement blocks if it doesn't exist already. We may
653 ** get smarter later on.
657 _DtTermBufferCreateEnhancement
667 if (!VALID_ROW(tb, row) || !VALID_COL(tb, col))
672 line = DT_LINE_OF_TBUF(tb, row);
673 enh = &(DT_ENH(line));
676 ** If this row already has enhancement blocks allocated, return.
681 ** Otherwise, allocate and initialize a row of enhancement blocks.
683 *enh = (DtEnh) malloc(MAX_COLS(tb) * sizeof(DtTermEnhPart));
690 ** Clear all the enhancements...
692 (void) memset(*enh, 0, MAX_COLS(tb) * sizeof(DtTermEnhPart));
698 ** Free the enhancement block at the specified row and column.
700 ** NOTE: We may get smarter later on.
703 _DtTermBufferFreeEnhancement
714 ** Set the desired enhancement.
716 ** This function does the right thing (as far as I can tell regarding
717 ** propagating enhancements).
720 ** -1 : the enhancement was not set
721 ** >= 0 : the number of characters (as opposed to character positions)
722 ** that the enhancement affects
725 _DtTermSetEnhancement
737 enhState = (DtEnh) &(DT_ENH_STATE(tb));
745 enhState->video = (value &= VIDEO_MASK);
748 enhState->field = (value &= FIELD_MASK);
751 enhState->fgColor = (value &= COLOR_MASK);
754 enhState->bgColor = (value &= COLOR_MASK);
757 enhState->font = (value &= FONT_MASK);
764 ** We've set the value, now decide if this anything but the blank
767 DT_ENH_DIRTY(tb) = ((enhState->video != blankEnh.video ) ||
768 (enhState->field != blankEnh.field ) ||
769 (enhState->fgColor != blankEnh.fgColor) ||
770 (enhState->bgColor != blankEnh.bgColor) ||
771 (enhState->font != blankEnh.font ));
773 ** return the correct count (which in this case will always be 0)
779 ** Get the enhancements for the desired row and column.
782 ** a pointer to an array of the current enhancement values
785 ** the number of columns for which the enhancements are
786 ** valid, or the number of columns until the enhancements
787 ** were modified by an escape sequence (see 'countWhich' below)
790 ** if 'countWhich' is countAll then count until any enhancement value
792 ** if 'countAll' is countNew then count until a new enhancement value
793 ** starts (regardless of whether it is the same or not).
796 ** True if row and col are valid
799 _DtTermGetEnhancement
806 const countSpec countWhich
810 ** store the current enhancement values here
817 ** First we do some simple bounds checking
819 VALIDATE_ENHANCEMENTS(tb, row);
820 if (!VALID_ROW(tb, row) || !VALID_COL(tb, col))
824 line = DT_LINE_OF_TBUF(tb, row);
827 ** point to the correct enhancement chunk.
829 if (DT_ENH(line) == NULL || (WIDTH(line) <= col))
832 ** There are either no enhancements allocated for this line,
833 ** or we're past the end of the line, in either case return
834 ** a blank enhancement.
841 ** We're in the line get the current enhancement values
843 enh = &(DT_ENH(line)[col]);
847 ** Shove the enhancement values into their correct locations...
849 *values = (VALUE_LIST(tb));
850 (*values)[(int)enhVideo ] = (enh->video & VIDEO_MASK);
851 (*values)[(int)enhField ] = (enh->field & FIELD_MASK);
852 (*values)[(int)enhFgColor] = (enh->fgColor & COLOR_MASK);
853 (*values)[(int)enhBgColor] = (enh->bgColor & COLOR_MASK);
854 (*values)[(int)enhFont ] = (enh->font & FONT_MASK );
857 ** Now count how many characters are affected by the enhancements.
859 if (DT_ENH(line) == NULL)
862 ** There no enhancements allocated for this line, the default
863 ** enhancement is active for the remainder of the line.
864 ** NOTE: Make sure count >= 0.
866 *count = MAX(0, WIDTH(line) - col);
868 else if (WIDTH(line) <= col)
871 ** We're past the end of the line, count will always == 0;
878 ** We're in the line, determine the number of characters that
879 ** these enhancements apply to.
885 ** For Vt220 emulation, countNew is the same as countAll...
890 ** count until an enhancement value changes
892 for (i = 0; i < (WIDTH(line) - col); i++)
894 if (((*values)[(int)enhVideo ] != (enh->video & VIDEO_MASK))||
895 ((*values)[(int)enhField ] != (enh->field & FIELD_MASK))||
896 ((*values)[(int)enhFgColor] != (enh->fgColor & COLOR_MASK))||
897 ((*values)[(int)enhBgColor] != (enh->bgColor & COLOR_MASK))||
898 ((*values)[(int)enhFont ] != (enh->font & FONT_MASK )) )
901 ** the enhancements differ; break out
909 VALIDATE_ENHANCEMENTS(tb, row);
914 VALIDATE_ENHANCEMENTS(tb, row);
919 ** This is a vt-specific helper function for setting the line length.
920 ** By the time the function is called, termBufferSetLineLength()
921 ** as already validated the newLength, the row, and insured that the
922 ** new length is > the current length
924 ** This function propagates the correct enhancement to the new end of line.
938 ** _DtTermPrimBufferClearLine will reset the line width, this is
939 ** our chance to clear any enhancements that may exist on this line...
952 line = DT_LINE_OF_TBUF(tb, row);
958 ** We have enhancements, clear all those between the current
959 ** and the new length...
962 (void) memset(&enh[newWidth], 0,
963 (WIDTH(line) - newWidth) * sizeof(DtTermEnhPart));
969 ** Erase characters on the specified row (and clear the enhancements) with
970 ** the appropriate semantics. For VT class emulators, there are several
971 ** ways to erase characters:
972 ** - from the active position to the end of line
973 ** - erase the specified number of characters starting at the current
975 ** - from the start of the line to the active position
976 ** - erase the entire line
977 ** - from the active position to the end of the buffer
978 ** - erase the specified number of lines starting at the current
980 ** - from the start of the buffer to the active position
981 ** - erase the entire buffer
990 DtEraseMode eraseSwitch
1000 ** erase from col 0 to the current cursor position
1003 lastCol = MIN(col, WIDTH(DT_LINE_OF_TBUF(tb, row)) - 1);
1006 case eraseCharCount:
1008 ** erase "count" characters from the current cursor position
1011 lastCol = MIN(col + count - 1, WIDTH(DT_LINE_OF_TBUF(tb, row)) - 1);
1014 case eraseLineCount:
1018 case eraseFromRow0Col0:
1021 ** These cases should have been handled by _DtTermFuncErase()
1026 _DtTermPrimBufferErase(tb, row, startCol, lastCol);
1028 ** now clear the corresponding enhancements...
1030 clearEnhancements(tb, row, startCol, lastCol - startCol + 1);
1033 #if (defined(TEST) || defined(__CODECENTER__) || defined(VALIDATE_ENH))
1035 _DtTermValidateEnhancements
1041 DtTermEnhPart refEnh;
1045 Boolean validatePassed;
1047 validatePassed = True;
1049 thisLine = DT_LINE_OF_TBUF(tb, row);
1050 if (DT_ENH(thisLine))
1053 ** Initialize the reference enhancement
1056 refEnh.videoStart = 0;
1057 refEnh.fieldStart = 0;
1058 refEnh.colorStart = 0;
1059 refEnh.fontStart = 0;
1061 for(col = 0, thisEnh = DT_ENH(thisLine);
1062 col < WIDTH(thisLine) +
1063 (DANGLE(thisLine) >= 0 ? 1 : 0);
1066 if (thisEnh->videoStart)
1068 refEnh.video = thisEnh->video;
1070 else if (refEnh.video != thisEnh->video)
1072 fprintf(stderr, "Video enhancements don't match:");
1073 fprintf(stderr, " row : %3.3d, col : %3.3d\n", row, col);
1074 fprintf(stderr, " refEnh.video : %d\n", (int)(refEnh.video & VIDEO_MASK));
1075 fprintf(stderr, " thisEnh->video: %d\n", (int)(thisEnh->video & VIDEO_MASK));
1076 validatePassed = False;
1079 if (thisEnh->fieldStart)
1081 refEnh.field = thisEnh->field;
1083 else if (refEnh.field != thisEnh->field)
1085 fprintf(stderr, "Field enhancements don't match:");
1086 fprintf(stderr, " row : %3.3d, col : %3.3d\n", row, col);
1087 fprintf(stderr, " refEnh.field : %d\n", (int)(refEnh.field & FIELD_MASK));
1088 fprintf(stderr, " thisEnh->field: %d\n", (int)(thisEnh->field & FIELD_MASK));
1089 validatePassed = False;
1091 if (thisEnh->colorStart)
1093 refEnh.color = thisEnh->color;
1095 else if (refEnh.color != thisEnh->color)
1097 fprintf(stderr, "Color enhancements don't match:");
1098 fprintf(stderr, " row : %3.3d, col : %3.3d\n", row, col);
1099 fprintf(stderr, " refEnh.color : %d\n", (int)(refEnh.color & COLOR_MASK));
1100 fprintf(stderr, " thisEnh->color: %d\n", (int)(thisEnh->color & COLOR_MASK));
1101 validatePassed = False;
1103 if (thisEnh->font <= 2)
1105 if (thisEnh->fontStart)
1107 refEnh.font = thisEnh->font;
1109 else if (refEnh.font != thisEnh->font)
1111 fprintf(stderr, "Font enhancements don't match:");
1112 fprintf(stderr, " row : %3.3d, col : %3.3d\n", row, col);
1113 fprintf(stderr, " refEnh.font : %d\n", (int)(refEnh.font & FONT_MASK));
1114 fprintf(stderr, " thisEnh->font: %d\n", (int)(thisEnh->font & FONT_MASK));
1115 validatePassed = False;
1120 fprintf(stderr, "Font enhancement out of range:");
1121 fprintf(stderr, " row : %3.3d, col : %3.3d\n", row, col);
1122 fprintf(stderr, " thisEnh->font: %d\n", (int)(thisEnh->font & FONT_MASK));
1123 validatePassed = False;
1127 if (validatePassed == False)
1129 fprintf(stderr, "validateEnhancement failed\n");
1132 #endif /* TEST || __CODECENTER__ || DEBUG || VALIDATE_ENH */
1134 #if (defined(TEST) || defined(__CODECENTER__) || defined(DEBUG))
1147 printf("Line: %d\n", row);
1149 line = tb->lines[row];
1150 printf(" length: %3d\n", line->length);
1151 if (line->length > 0)
1153 printf(" buffer: <");
1154 pChar = line->buffer;
1155 for (j = 0; j < line->length; j++)
1157 printf("%X", *pChar++);
1164 _DtTermPrintEnhancement
1171 enhValue enhancements[NUM_ENHANCEMENT_FIELDS];
1175 _DtTermPrimBufferGetEnhancement(tb, row, col, enhancements, &enhCount, countNew);
1176 printf(" col : %d\n", col);
1177 printf(" Count: %d\n", enhCount);
1178 printf(" Video: '_");
1179 printf("%s", IS_BOLD(enhancements[enhVideo]) != 0 ? "B":"b");
1181 printf("%s", IS_SECURE(enhancements[enhVideo]) != 0 ? "S":"s");
1183 printf("%s", IS_HALF_BRIGHT(enhancements[enhVideo]) != 0 ? "H":"h");
1185 printf("%s", IS_UNDERLINE(enhancements[enhVideo]) != 0 ? "U":"u");
1187 printf("%s", IS_INVERSE(enhancements[enhVideo]) != 0 ? "I":"i");
1189 printf("%s", IS_BLINK(enhancements[enhVideo]) != 0 ? "B":"b");
1196 switch (enhancements[enhField])
1201 case FIELD_UNPROTECT:
1202 printf("UNPROTECT");
1204 case FIELD_TRANSMIT:
1216 printf(" Color: %1d\n", enhancements[enhFont]);
1222 switch (enhancements[enhFont])
1242 printf(" video : %d\n", enh->video);
1243 printf(" field : %d\n", enh->field);
1244 printf(" fgColor: %d\n", enh->fgColor);
1245 printf(" bgColor: %d\n", enh->bgColor);
1246 printf(" font : %d\n", enh->font);
1250 ** Print the contents of the TermBuffer.
1263 printf("TermBuffer has been freed.\n");
1267 printf("TermBuffer dimensions:\n");
1268 printf(" rows: %d\n", ROWS(tb));
1269 printf(" cols: %d\n", COLS(tb));
1270 printf(" enhDirty: %d\n", DT_ENH_DIRTY(tb));
1271 printf(" enhState:\n");
1272 printEnh(&(DT_ENH_STATE(tb)));
1274 for (i = 0; i < ROWS(tb); i++)
1280 k = _termBufferPrintEnhancement(tb, i, j);
1286 } while (j < COLS(tb));
1290 #endif /* (defined(TEST) || defined(__CODECENTER__)) */
1294 ** Some simple tests of the termBuffer.
1296 /* the following is to allow for a single main function in the code... */
1297 #define termBufMain main
1302 printf("Sizeof DtTermEnhPart : %d\n", sizeof(struct _DtTermEnhPart));
1303 printf("Sizeof termBufferRec : %d\n", sizeof(struct _TermBufferRec));
1305 myTB = _DtTermPrimBufferCreateBuffer(12, 80);
1306 _termBufferPrintBuffer(myTB);
1308 printf("[0,0] %d\n", _DtTermPrimBufferSetEnhancement(myTB, 0, 0, enhVideo, BLINK));
1309 _termBufferPrintEnhancement(myTB, 0, 0);
1310 printf("[0,1] %d\n", _DtTermPrimBufferSetEnhancement(myTB, 0, 1, enhVideo, INVERSE));
1311 _termBufferPrintEnhancement(myTB, 0, 0);
1312 _termBufferPrintEnhancement(myTB, 0, 1);
1313 printf("[0,9] %d\n", _DtTermPrimBufferSetEnhancement(myTB, 0, 9, enhVideo, UNDERLINE));
1314 _termBufferPrintEnhancement(myTB, 0, 0);
1315 _termBufferPrintEnhancement(myTB, 0, 1);
1316 _termBufferPrintEnhancement(myTB, 0, 9);
1317 printf("[0,6] %d\n", _DtTermPrimBufferSetEnhancement(myTB, 0, 6, enhVideo, HALF_BRIGHT));
1318 _termBufferPrintEnhancement(myTB, 0, 0);
1319 _termBufferPrintEnhancement(myTB, 0, 1);
1320 _termBufferPrintEnhancement(myTB, 0, 6);
1321 _termBufferPrintEnhancement(myTB, 0, 9);
1322 _termBufferPrintBuffer(myTB);
1324 _DtTermPrimBufferSetEnhancement(myTB, 10, 10, enhVideo, BLINK);
1325 _DtTermPrimBufferSetEnhancement(myTB, 10, 20, enhColor, 3);
1326 _termBufferPrintBuffer(myTB);
1328 _DtTermPrimBufferResizeBuffer(&myTB, 6, 40);
1329 _termBufferPrintBuffer(myTB);
1331 _DtTermPrimBufferSetEnhancement(myTB, 10, 10, enhVideo, BLINK);
1332 _DtTermPrimBufferResizeBuffer(&myTB, 12, 80);
1333 _termBufferPrintBuffer(myTB);
1335 _DtTermPrimBufferFreeBuffer(myTB);