Date: Wed, 31 Dec 2008 15:47:22 GMT From: Ed Schouten <ed@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 155511 for review Message-ID: <200812311547.mBVFlMvC020440@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=155511 Change 155511 by ed@ed_dull on 2008/12/31 15:46:33 Small cleanup fixes: - Make CUP/HPA/VPA use the `n' argument type. This means we don't need teken_clamp() anymore. - Because we don't use default initialisers anymore, convert all escape sequences to use `r' for regular escape sequence arguments. Affected files ... .. //depot/projects/mpsafetty/sys/dev/syscons/teken/gensequences#4 edit .. //depot/projects/mpsafetty/sys/dev/syscons/teken/sequences#7 edit .. //depot/projects/mpsafetty/sys/dev/syscons/teken/teken.c#11 edit .. //depot/projects/mpsafetty/sys/dev/syscons/teken/teken_subr.h#23 edit Differences ... ==== //depot/projects/mpsafetty/sys/dev/syscons/teken/gensequences#4 (text+ko) ==== @@ -112,7 +112,7 @@ print "\tcase '" cchar(l_cmd_suffix[c]) "': /* " l_cmd_abbr[c] ": " l_cmd_name[c] " */"; - if (l_cmd_args[c] == "variable") { + if (l_cmd_args[c] == "v") { print "\t\t" l_cmd_c_name[c] "(t, t->t_curnum, t->t_nums);"; } else { printf "\t\t%s(t", l_cmd_c_name[c]; @@ -120,8 +120,10 @@ for (a = 1; args[a] != ""; a++) { if (args[a] == "n") printf ", (t->t_curnum < %d || t->t_nums[%d] == 0) ? 1 : t->t_nums[%d]", a, (a - 1), (a - 1); + else if (args[a] == "r") + printf ", t->t_curnum < %d ? 0 : t->t_nums[%d]", a, (a - 1); else - printf ", t->t_curnum < %d ? %d : t->t_nums[%d]", a, args[a], (a - 1); + die("Invalid argument type: " args[a]); } print ");"; } ==== //depot/projects/mpsafetty/sys/dev/syscons/teken/sequences#7 (text+ko) ==== @@ -30,25 +30,26 @@ # Name Sequence name (will be converted to C function name) # Sequence Bytes that form the sequence # Arguments Standard value of arguments passed to this sequence -# - `variable' means a variable number of arguments -# - `n' converts 0 to 1 +# - `n' non-zero number (0 gets converted to 1) +# - `r' regular numeric argument +# - `v' means a variable number of arguments # Abbr Name Sequence Arguments CBT Cursor Backward Tabulation ^[ [ Z n CHT Cursor Forward Tabulation ^[ [ I n CNL Cursor Next Line ^[ [ E n CPL Cursor Previous Line ^[ [ F n -CPR Cursor Position Report ^[ [ n 0 +CPR Cursor Position Report ^[ [ n r CUB Cursor Backward ^[ [ D n CUD Cursor Down ^[ [ B n CUD Cursor Down ^[ [ e n CUF Cursor Forward ^[ [ C n CUF Cursor Forward ^[ [ a n -CUP Cursor Position ^[ [ H 1 1 -CUP Cursor Position ^[ [ f 1 1 +CUP Cursor Position ^[ [ H n n +CUP Cursor Position ^[ [ f n n CUU Cursor Up ^[ [ A n -DA1 Primary Device Attributes ^[ [ c 0 -DA2 Secondary Device Attributes ^[ [ > c 0 +DA1 Primary Device Attributes ^[ [ c r +DA2 Secondary Device Attributes ^[ [ > c r DC Delete character ^[ [ P n DCS Device Control String ^[ P DECALN Alignment test ^[ # 8 @@ -59,19 +60,19 @@ DECKPNM Keypad numeric mode ^[ > DECRC Restore cursor ^[ 8 DECRC Restore cursor ^[ [ u -DECRM Reset DEC mode ^[ [ ? l 0 +DECRM Reset DEC mode ^[ [ ? l r DECSC Save cursor ^[ 7 DECSC Save cursor ^[ [ s -DECSM Set DEC mode ^[ [ ? h 0 -DECSTBM Set top and bottom margins ^[ [ r 0 0 +DECSM Set DEC mode ^[ [ ? h r +DECSTBM Set top and bottom margins ^[ [ r r r DECSWL Single Height Single Width Line ^[ # 5 DL Delete line ^[ [ M n -DSR Device Status Report ^[ [ ? n 0 +DSR Device Status Report ^[ [ ? n r ECH Erase character ^[ [ X n -ED Erase display ^[ [ J 0 -EL Erase line ^[ [ K 0 -HPA Horizontal Position Absolute ^[ [ G 1 -HPA Horizontal Position Absolute ^[ [ ` 1 +ED Erase display ^[ [ J r +EL Erase line ^[ [ K r +HPA Horizontal Position Absolute ^[ [ G n +HPA Horizontal Position Absolute ^[ [ ` n HTS Horizontal Tab Set ^[ H ICH Insert character ^[ [ @ n IL Insert line ^[ [ L n @@ -79,7 +80,7 @@ NEL Next line ^[ E RI Reverse index ^[ M RIS Reset to Initial State ^[ c -RM Reset Mode ^[ [ l 0 +RM Reset Mode ^[ [ l r SCS SCS ^[ ( 0 SCS SCS ^[ ( 1 SCS SCS ^[ ( 2 @@ -91,16 +92,16 @@ SCS SCS ^[ ) A SCS SCS ^[ ) B SD Pan Up ^[ [ T n -SGR Set Graphic Rendition ^[ [ m variable -SM Set Mode ^[ [ h 0 +SGR Set Graphic Rendition ^[ [ m v +SM Set Mode ^[ [ h r ST String Terminator ^[ \\ SU Pan Down ^[ [ S n -TBC Tab Clear ^[ [ g 0 -VPA Vertical Position Absolute ^[ [ d 1 +TBC Tab Clear ^[ [ g r +VPA Vertical Position Absolute ^[ [ d n # Cons25 compatibility sequences -C25CURS Cons25 set cursor type ^[ [ = S 0 -C25VTSW Cons25 switch virtual terminal ^[ [ z 0 +C25CURS Cons25 set cursor type ^[ [ = S r +C25VTSW Cons25 switch virtual terminal ^[ [ z r # VT52 compatibility #DECID VT52 DECID ^[ Z ==== //depot/projects/mpsafetty/sys/dev/syscons/teken/teken.c#11 (text+ko) ==== @@ -60,8 +60,6 @@ } #endif /* TEKEN_UTF8 */ -#define teken_clamp(x,low,high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) - /* Private flags for teken_format_t. */ #define TF_REVERSE 0x08 ==== //depot/projects/mpsafetty/sys/dev/syscons/teken/teken_subr.h#23 (text+ko) ==== @@ -306,9 +306,14 @@ teken_subr_cursor_position(teken_t *t, unsigned int row, unsigned int col) { - t->t_cursor.tp_row = teken_clamp(row + t->t_originreg.ts_begin, - 1, t->t_originreg.ts_end) - 1; - t->t_cursor.tp_col = teken_clamp(col, 1, t->t_winsize.tp_col) - 1; + t->t_cursor.tp_row = t->t_originreg.ts_begin + row - 1; + if (row >= t->t_originreg.ts_end) + t->t_cursor.tp_row = t->t_originreg.ts_end - 1; + + t->t_cursor.tp_col = col - 1; + if (t->t_cursor.tp_col >= t->t_winsize.tp_col) + t->t_cursor.tp_col = t->t_winsize.tp_col - 1; + t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); } @@ -512,7 +517,10 @@ teken_subr_horizontal_position_absolute(teken_t *t, unsigned int col) { - t->t_cursor.tp_col = teken_clamp(col, 1, t->t_winsize.tp_col) - 1; + t->t_cursor.tp_col = col - 1; + if (t->t_cursor.tp_col >= t->t_winsize.tp_col) + t->t_cursor.tp_col = t->t_winsize.tp_col - 1; + t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); } @@ -1089,8 +1097,11 @@ teken_subr_vertical_position_absolute(teken_t *t, unsigned int row) { - t->t_cursor.tp_row = teken_clamp(row + t->t_originreg.ts_begin, - 1, t->t_originreg.ts_end) - 1; + t->t_cursor.tp_row = t->t_originreg.ts_begin + row - 1; + if (row >= t->t_originreg.ts_end) + t->t_cursor.tp_row = t->t_originreg.ts_end - 1; + + t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812311547.mBVFlMvC020440>