TeX in C
Explore TeX with modern c compiler.
PART 26: Basic scanning subroutines

宏定义

#define OCTAL_TOKEN   (othertoken + '\'')
 [#438] apostrophe, indicates an octal constant. 更多...
 
#define HEX_TOKEN   (othertoken + '"')
 [#438] double quote, indicates a hex constant. 更多...
 
#define ALPHA_TOKEN   (othertoken + '`')
 [#438] reverse apostrophe, precedes alpha constants. 更多...
 
#define POINT_TOKEN   (othertoken + '.')
 [#438] decimal point. 更多...
 
#define CONTINENTAL_POINT_TOKEN   (othertoken + ',')
 [#438] decimal point, Eurostyle. 更多...
 
#define INFINITY   2147483647L
 [#445] the largest positive value that \( \rm\TeX\ \) knows. 更多...
 
#define A_TOKEN   (lettertoken + 'A')
 [#445] the smallest special hex digit. 更多...
 
#define OTHER_A_TOKEN   (othertoken + 'A')
 [#445] special hex digit of type otherchar. 更多...
 
#define DEFAULT_RULE   26214
 [#463] 0.4 pt. 更多...
 
#define INPUT_LINE_NO_CODE   (GLUE_VAL + 1)
 [#416] \inputlineno 更多...
 
#define BADNESS_CODE   (GLUE_VAL + 2)
 [#416] \badness 更多...
 
#define MAX_DIMEN   1073741823L
 [#421] \( 2^{30}-1 \) 更多...
 
#define ZERO_TOKEN   (othertoken + '0')
 [#445] zero, the smallest digit 更多...
 
#define SCAN_NORMAL_DIMEN()   scan_dimen(false, false, false)
 [#448] 更多...
 

枚举

enum  TokenLevel {
  INT_VAL , DIMEN_VAL , GLUE_VAL , MU_VAL ,
  IDENT_VAL , TOK_VAL
}
 [#410] 更多...
 

函数

void scan_init ()
 [#439] 更多...
 
void skip_spaces (void)
 [#406] Get the next non-blank non-call token. 更多...
 
void skip_spaces_or_relax (void)
 [#404] Get the next non-blank non-relax non-call token. 更多...
 
void scan_left_brace (void)
 [#403] when a left brace is supposed to be the next non-blank token. 更多...
 
void scan_optional_equals (void)
 [#405] looks for an optional = sign preceded by optional spaces. 更多...
 
Boolean scankeyword (StrNumber s)
 [#407] look for a given string. 更多...
 
static void mu_error (void)
 [#408] sounds an alarm when mu and non-mu units are being switched. 更多...
 
void scan_something_internal (SmallNumber level, Boolean negative)
 [#413] fetch an internal parameter. 更多...
 
void scan_eight_bit_int (void)
 [#433] scan register code = [0, 255], use scan_int. 更多...
 
void scan_char_num (void)
 [#434] scan character code = [0, 255], use scan_int. 更多...
 
void scan_four_bit_int (void)
 [#435] scan number = [0, 15], use scan_int. 更多...
 
void scan_fifteen_bit_int (void)
 [#436] scan mathchar = [0, 23767], use scan_int. 更多...
 
void scan_twenty_seven_bit_int (void)
 [#437] scan mathchar = \( [0, 2^{27}−1] \), use scan_int. 更多...
 
void scan_int (void)
 [#440] sets cur_val to an integer. 更多...
 
void scan_dimen (Boolean mu, Boolean inf, Boolean shortcut)
 [#448] sets cur_val to a dimension. 更多...
 
void scan_glue (SmallNumber level)
 [#461] sets cur_val to a glue spec pointer. 更多...
 
HalfWord scan_rule_spec (void)
 [#463] returns a pointer to a rule node. 更多...
 

变量

Integer cur_val
 [#410] value returned by numeric scanners. 更多...
 
SmallNumber cur_val_level
 [#410] the "level" of this value. 更多...
 
SmallNumber radix
 [#438] scan_int sets this to 8, 10, 16, or zero. 更多...
 
GlueOrd cur_order
 [#447] order of INFINITY found by scan_dimen. 更多...
 

详细描述

宏定义说明

◆ A_TOKEN

#define A_TOKEN   (lettertoken + 'A')

[#445] the smallest special hex digit.

◆ ALPHA_TOKEN

#define ALPHA_TOKEN   (othertoken + '`')

[#438] reverse apostrophe, precedes alpha constants.

◆ BADNESS_CODE

#define BADNESS_CODE   (GLUE_VAL + 2)

[#416] \badness

◆ CONTINENTAL_POINT_TOKEN

#define CONTINENTAL_POINT_TOKEN   (othertoken + ',')

[#438] decimal point, Eurostyle.

◆ DEFAULT_RULE

#define DEFAULT_RULE   26214

[#463] 0.4 pt.

◆ HEX_TOKEN

#define HEX_TOKEN   (othertoken + '"')

[#438] double quote, indicates a hex constant.

◆ INFINITY

#define INFINITY   2147483647L

[#445] the largest positive value that \( \rm\TeX\ \) knows.

◆ INPUT_LINE_NO_CODE

#define INPUT_LINE_NO_CODE   (GLUE_VAL + 1)

[#416] \inputlineno

◆ MAX_DIMEN

#define MAX_DIMEN   1073741823L

[#421] \( 2^{30}-1 \)

◆ OCTAL_TOKEN

#define OCTAL_TOKEN   (othertoken + '\'')

[#438] apostrophe, indicates an octal constant.

◆ OTHER_A_TOKEN

#define OTHER_A_TOKEN   (othertoken + 'A')

[#445] special hex digit of type otherchar.

◆ POINT_TOKEN

#define POINT_TOKEN   (othertoken + '.')

[#438] decimal point.

◆ SCAN_NORMAL_DIMEN

#define SCAN_NORMAL_DIMEN ( )    scan_dimen(false, false, false)

[#448]

◆ ZERO_TOKEN

#define ZERO_TOKEN   (othertoken + '0')

[#445] zero, the smallest digit

枚举类型说明

◆ TokenLevel

enum TokenLevel

[#410]

枚举值
INT_VAL 

integer values

DIMEN_VAL 

dimension values

GLUE_VAL 

glue specifications

MU_VAL 

math glue specifications

IDENT_VAL 

font identifier

TOK_VAL 

token lists

函数说明

◆ mu_error()

static void mu_error ( void  )
static

[#408] sounds an alarm when mu and non-mu units are being switched.

◆ scan_char_num()

void scan_char_num ( void  )

[#434] scan character code = [0, 255], use scan_int.

xref[10]: 414, 935, 1030, 1038, 1123, 1124, 1151, 1154, 1224, 1232

◆ scan_dimen()

void scan_dimen ( Boolean  mu,
Boolean  inf,
Boolean  shortcut 
)

[#448] sets cur_val to a dimension.

xref[6]: 410, 440, 447, 461, 462, 1061

< should the answer be negated?

< numerator of a fraction whose denominator is 2^16.

[#450] Local variables for dimension calculations

[#441] Get the next non-blank non-sign token; set negative appropriately

[#449] Fetch an internal dimension and goto attach sign, or fetch an internal integer

[#451] Coerce glue to a dimension.

[#452]

[#451]

[#453] Scan units and set cur_val to x · (cur val + f/2^16) where there are x sp per unit; goto attach sign if the units are internal

[#454] Scan for fil units; goto attach_fraction if found

[#455] Scan for units that are internal dimensions; goto attach sign with cur val set if found.

[#451] Coerce glue to a dimension.

[#558] The em width for cur_font.

[#559] The x-height for cur_font.

[#456] Scan for mu units and goto attach fraction.

[#443] Scan an optional space.

◆ scan_eight_bit_int()

void scan_eight_bit_int ( void  )

[#433] scan register code = [0, 255], use scan_int.

xref[15]: 415, 420, 427, 505, 1079, 1082, 1099, 1110, 1224, 1226, 1227, 1237, 1241, 1247, 1296

◆ scan_fifteen_bit_int()

void scan_fifteen_bit_int ( void  )

[#436] scan mathchar = [0, 23767], use scan_int.

xref[4]: 1151, 1154, 1165, 1224

◆ scan_four_bit_int()

void scan_four_bit_int ( void  )

[#435] scan number = [0, 15], use scan_int.

xref[5]: 501, 577, 1234, 1275, 1350

◆ scan_glue()

void scan_glue ( SmallNumber  level)

[#461] sets cur_val to a glue spec pointer.

xref[5]: 410, 782, 1060, 1228, 1238

◆ scan_init()

void scan_init ( )

[#439]

◆ scan_int()

void scan_int ( void  )

[#440] sets cur_val to an integer.

xref[31]: 409, 410, 432, 433, 434, 435, 436, 437, 438, 447, 448, 461, 471, 503, 504, 509, 578, 1103, 1225, 1228, 1232, 1238, 1240, 1243, 1244, 1246, 1248, 1253, 1258, 1350, 1377

◆ scan_left_brace()

void scan_left_brace ( void  )

[#403] when a left brace is supposed to be the next non-blank token.

xref[12]: 473, 645, 785, 934, 960, 1025, 1099, 1117, 1119, 1153, 1172, 1174

◆ scan_optional_equals()

void scan_optional_equals ( void  )

[#405] looks for an optional = sign preceded by optional spaces.

\relax is not ignored here.

xerf[19]: 782, 1224, 1226, 1228, 1232, 1234, 1236, 1241, 1243, 1244, 1245, 1246, 1247, 1248, 1253, 1257, 1275, 1351

◆ scan_rule_spec()

HalfWord scan_rule_spec ( void  )

[#463] returns a pointer to a rule node.

This routine is called just after \( \rm\TeX\ \) has seen \hrule or \vrule; therefore cur cmd will be either hrule or vrule. The idea is to store the default rule dimensions in the node, then to override them if height or width or depth specifications are found (in any order).

xref[2]: 1056, 1084

◆ scan_something_internal()

void scan_something_internal ( SmallNumber  level,
Boolean  negative 
)

[#413] fetch an internal parameter.

xref[9]: 409, 410, 432, 440, 449, 451, 455, 461, 465

◆ scan_twenty_seven_bit_int()

void scan_twenty_seven_bit_int ( void  )

[#437] scan mathchar = \( [0, 2^{27}−1] \), use scan_int.

xref[3]: 1151, 1154, 1160

◆ scankeyword()

Boolean scankeyword ( StrNumber  s)

[#407] look for a given string.

checks to see whether the next tokens of input match this string.

If a match is found, the characters are effectively removed from the input and true is returned. Otherwise false is returned, and the input is left essentially unchanged (except for the fact that some macros may have been expanded, etc.).

◆ skip_spaces()

void skip_spaces ( void  )

[#406] Get the next non-blank non-call token.

used in sections 405, 441, 455, 503, 526, 577, 785, 791, and 1045.

◆ skip_spaces_or_relax()

void skip_spaces_or_relax ( void  )

[#404] Get the next non-blank non-relax non-call token.

\( \rm\TeX\ \) allows \relax to appear before the left brace. used in sections 403, 1078, 1084, 1151, 1160, 1211, 1226, and 1270.

变量说明

◆ cur_order

GlueOrd cur_order

[#447] order of INFINITY found by scan_dimen.

◆ cur_val

Integer cur_val

[#410] value returned by numeric scanners.

◆ cur_val_level

SmallNumber cur_val_level

[#410] the "level" of this value.

[INT_VAL=0, TOK_VAL=5]

◆ radix

SmallNumber radix

[#438] scan_int sets this to 8, 10, 16, or zero.