TeX in C
Explore TeX with modern c compiler.
PART 10: Data structures for boxes and their friends

宏定义

#define type(x)   (mem[(x)].hh.UU.U2.b0)
 [p50#133] -> QuarterWord; identifies what kind of node this is. 更多...
 
#define subtype(x)   (mem[(x)].hh.UU.U2.b1)
 [p50#133] -> QuarterWord; secondary identification in some cases. 更多...
 
#define is_char_node(x)   ((x) >= hi_mem_min)
 [p50#134] does the argument point to a char node? 更多...
 
#define font(x)   link(x + 1)
 [50#134] -> HalfWord; the font code in a charnode. 更多...
 
#define character(x)   subtype(x)
 [50#134] -> QuarterWord; the character code in a charnode. 更多...
 
#define CHAR_NODE_SIZE   2
 
#define font_ligchar(x)   type(ligchar(x))
 
#define character_ligchar(x)   subtype(ligchar(x))
 
#define boxnodesize   7
 [p51#135] number of words to allocate for a box node. 更多...
 
#define widthoffset   1
 [p51#135] position of width field in a box node. 更多...
 
#define depthoffset   2
 [p51#135] position of depth field in a box node. 更多...
 
#define heightoffset   3
 [p51#135] position of height field in a box node. 更多...
 
#define width(x)   mem[x + widthoffset].sc
 [p51#135] width of the box, in sp. 更多...
 
#define depth(x)   mem[x + depthoffset].sc
 [p51#135] depth of the box, in sp. 更多...
 
#define height(x)   mem[x + heightoffset].sc
 [p51#135] height of the box, in sp. 更多...
 
#define shiftamount(x)   mem[x + 4].sc
 [p51#135] repositioning distance, in sp. 更多...
 
#define listoffset   5
 [p51#135] position of list ptr field in a box node. 更多...
 
#define listptr(x)   link(x + listoffset)
 [p51#135] beginning of the list inside the box. 更多...
 
#define glueorder(x)   subtype(x + listoffset)
 [p51#135] applicable order of INFINITY. 更多...
 
#define gluesign(x)   type(x + listoffset)
 [p51#135] stretching or shrinking. 更多...
 
#define NORMAL   0
 [p51#135] the most common case when several cases are named. 更多...
 
#define stretching   1
 [p51#135] glue setting applies to the stretch components. 更多...
 
#define shrinking   2
 [p51#135] glue setting applies to the shrink components. 更多...
 
#define glueoffset   6
 [p51#135] position of glueset in a box node. 更多...
 
#define glueset(x)   mem[x + glueoffset].gr
 [p51#135] a word of type |glueratio| for glue setting. 更多...
 
#define rulenodesize   4
 [#138]: number of words to allocate for a rule node 更多...
 
#define nullflag   (-1073741824L)
 [#138]: -(2^30) signifies a missing item 更多...
 
#define isrunning(x)   ((x) == nullflag)
 [p51#138] tests for a running dimension. 更多...
 
#define insnodesize   5
 [p52#140]: number of words to allocate for an insertion 更多...
 
#define floatcost(x)   mem[x + 1].int_
 [p52#140] the |floatingpenalty| to be used. 更多...
 
#define insptr(x)   info(x + 4)
 [p52#140] the vertical list to be inserted. 更多...
 
#define splittopptr(x)   link(x + 4)
 [p52#140] the |splittopskip| to be used. 更多...
 
#define smallnodesize   2
 [#141]: number of words to allocate for most node types 更多...
 
#define markptr(x)   mem[x + 1].int_
 [p52#141] head of the token list for a mark. 更多...
 
#define adjustptr   markptr
 [p52#142] vertical list to be moved out of horizontal list. 更多...
 
#define ligchar(x)   ((x) + 1)
 [p52#143] the word where the ligature is to be found. 更多...
 
#define ligptr(x)   link(ligchar(x))
 [p52#143] the list of characters. 更多...
 
#define replacecount   subtype
 [p53#145] how many subsequent nodes to replace. 更多...
 
#define prebreak   llink
 [p53#145] text that precedes a discretionary break. 更多...
 
#define postbreak   rlink
 [p53#145] text that follows a discretionary break. 更多...
 
#define before   0
 [#147]: subtype for math node that introduces a formula 更多...
 
#define after   1
 [#147]: subtype for math node that winds up a formula 更多...
 
#define precedesbreak(x)   (type(x) < MATH_NODE)
 [p54#148] 更多...
 
#define nondiscardable(x)   (type(x) < MATH_NODE)
 [p54#148] 更多...
 
#define condmathglue   98
 [p54#149] special subtype to suppress glue in the next node. 更多...
 
#define muglue   99
 [p54#149] subtype for math glue. 更多...
 
#define aleaders   100
 [p54#149] subtype for aligned leaders. 更多...
 
#define cleaders   101
 [p54#149] subtype for centered leaders. 更多...
 
#define xleaders   102
 [p54#149] subtype for expanded leaders. 更多...
 
#define glueptr   llink
 [p54#149] pointer to a glue specification. 更多...
 
#define leaderptr   rlink
 [p54#149] pointer to box or rule node for leaders. 更多...
 
#define gluespecsize   4
 [#150]: number of words to allocate for a glue specification 更多...
 
#define gluerefcount(x)   link(x)
 [p55#150] reference count of a glue specification. 更多...
 
#define stretch(x)   mem[x + 2].sc
 [p55#150] the stretchability of this glob of glue. 更多...
 
#define shrink(x)   mem[x + 3].sc
 [p55#150] the shrinkability of this glob of glue. 更多...
 
#define stretchorder(x)   type(x)
 [p55#150] order of INFINITY for stretching. 更多...
 
#define shrinkorder(x)   subtype(x)
 [p55#150] order of INFINITY for shrinking. 更多...
 
#define explicit   1
 [#155]: subtype of kern nodes from \kern and \/ 更多...
 
#define acckern   2
 [#155]: subtype of kern nodes from accents 更多...
 
#define INF_PENALTY   INF_BAD
 [#157]: "infinite" penalty value 更多...
 
#define EJECT_PENALTY   (-INF_PENALTY)
 [#157]: "negatively infinite penalty value 更多...
 
#define penalty(x)   mem[x + 1].int_
 [p56#157] the added cost of breaking a list here. 更多...
 
#define gluestretch(x)   mem[x + glueoffset].sc
 [p57#159] total stretch in an unset node. 更多...
 
#define glueshrink   shiftamount
 [p57#159] total shrink in an unset node. 更多...
 
#define spancount   subtype
 [p57#159] indicates the number of spanned columns. 更多...
 

枚举

enum  NodeType {
  HLIST_NODE , VLIST_NODE , RULE_NODE , INS_NODE ,
  MARK_NODE , ADJUST_NODE , LIGATURE_NODE , DISC_NODE ,
  WHATSIT_NODE , MATH_NODE , GLUE_NODE , KERN_NODE ,
  PENALTY_NODE , UNSET_NODE
}
 
enum  InfinityOrder { FIL = 1 , FILL , FILLL }
 [#150]: the orders of INFINITY (normal, fil, fill, or filll) corresponding to the stretch and shrink values. 更多...
 

函数

Pointer new_null_box (void)
 [#136] creates a new box node. 更多...
 
Pointer new_rule (void)
 [#139] 更多...
 
Pointer new_ligature (QuarterWord f, QuarterWord c, Pointer q)
 [#144] creates a ligature node having given contents of the font, character, and lig_ptr fields. 更多...
 
Pointer new_lig_item (QuarterWord c)
 [#144] returns a two-word node having a given character field. 更多...
 
Pointer new_disc (void)
 [#145] creates an empty disc node. 更多...
 
Pointer new_math (Scaled w, SmallNumber s)
 [#147] A math node, which occurs only in horizontal lists, appears before and after mathematical formulas. 更多...
 
Pointer new_spec (Pointer p)
 [#151] duplicates a glue specification. 更多...
 
Pointer new_param_glue (SmallNumber n)
 [#152] creates a glue node for a given parameter identified by its code number; 更多...
 
Pointer new_glue (Pointer q)
 [#153] argument points to a glue specification. 更多...
 
Pointer new_skip_param (SmallNumber n)
 [#154] creates a glue node for one of the current glue parameters. 更多...
 
Pointer new_kern (long w)
 [#156] creates a kern node having a given width. 更多...
 
Pointer new_penalty (long m)
 [#158] 更多...
 

详细描述

宏定义说明

◆ acckern

#define acckern   2

[#155]: subtype of kern nodes from accents

◆ adjustptr

#define adjustptr   markptr

[p52#142] vertical list to be moved out of horizontal list.

◆ after

#define after   1

[#147]: subtype for math node that winds up a formula

◆ aleaders

#define aleaders   100

[p54#149] subtype for aligned leaders.

◆ before

#define before   0

[#147]: subtype for math node that introduces a formula

◆ boxnodesize

#define boxnodesize   7

[p51#135] number of words to allocate for a box node.

◆ CHAR_NODE_SIZE

#define CHAR_NODE_SIZE   2

◆ character

#define character (   x)    subtype(x)

[50#134] -> QuarterWord; the character code in a charnode.

◆ character_ligchar

#define character_ligchar (   x)    subtype(ligchar(x))

◆ cleaders

#define cleaders   101

[p54#149] subtype for centered leaders.

◆ condmathglue

#define condmathglue   98

[p54#149] special subtype to suppress glue in the next node.

◆ depth

#define depth (   x)    mem[x + depthoffset].sc

[p51#135] depth of the box, in sp.

◆ depthoffset

#define depthoffset   2

[p51#135] position of depth field in a box node.

◆ EJECT_PENALTY

#define EJECT_PENALTY   (-INF_PENALTY)

[#157]: "negatively infinite penalty value

◆ explicit

#define explicit   1

[#155]: subtype of kern nodes from \kern and \/

◆ floatcost

#define floatcost (   x)    mem[x + 1].int_

[p52#140] the |floatingpenalty| to be used.

◆ font

#define font (   x)    link(x + 1)

[50#134] -> HalfWord; the font code in a charnode.

◆ font_ligchar

#define font_ligchar (   x)    type(ligchar(x))

◆ glueoffset

#define glueoffset   6

[p51#135] position of glueset in a box node.

◆ glueorder

#define glueorder (   x)    subtype(x + listoffset)

[p51#135] applicable order of INFINITY.

◆ glueptr

#define glueptr   llink

[p54#149] pointer to a glue specification.

◆ gluerefcount

#define gluerefcount (   x)    link(x)

[p55#150] reference count of a glue specification.

◆ glueset

#define glueset (   x)    mem[x + glueoffset].gr

[p51#135] a word of type |glueratio| for glue setting.

◆ glueshrink

#define glueshrink   shiftamount

[p57#159] total shrink in an unset node.

◆ gluesign

#define gluesign (   x)    type(x + listoffset)

[p51#135] stretching or shrinking.

◆ gluespecsize

#define gluespecsize   4

[#150]: number of words to allocate for a glue specification

◆ gluestretch

#define gluestretch (   x)    mem[x + glueoffset].sc

[p57#159] total stretch in an unset node.

◆ height

#define height (   x)    mem[x + heightoffset].sc

[p51#135] height of the box, in sp.

◆ heightoffset

#define heightoffset   3

[p51#135] position of height field in a box node.

◆ INF_PENALTY

#define INF_PENALTY   INF_BAD

[#157]: "infinite" penalty value

◆ insnodesize

#define insnodesize   5

[p52#140]: number of words to allocate for an insertion

◆ insptr

#define insptr (   x)    info(x + 4)

[p52#140] the vertical list to be inserted.

◆ is_char_node

#define is_char_node (   x)    ((x) >= hi_mem_min)

[p50#134] does the argument point to a char node?

◆ isrunning

#define isrunning (   x)    ((x) == nullflag)

[p51#138] tests for a running dimension.

◆ leaderptr

#define leaderptr   rlink

[p54#149] pointer to box or rule node for leaders.

◆ ligchar

#define ligchar (   x)    ((x) + 1)

[p52#143] the word where the ligature is to be found.

◆ ligptr

#define ligptr (   x)    link(ligchar(x))

[p52#143] the list of characters.

◆ listoffset

#define listoffset   5

[p51#135] position of list ptr field in a box node.

◆ listptr

#define listptr (   x)    link(x + listoffset)

[p51#135] beginning of the list inside the box.

◆ markptr

#define markptr (   x)    mem[x + 1].int_

[p52#141] head of the token list for a mark.

◆ muglue

#define muglue   99

[p54#149] subtype for math glue.

◆ nondiscardable

#define nondiscardable (   x)    (type(x) < MATH_NODE)

[p54#148]

◆ NORMAL

#define NORMAL   0

[p51#135] the most common case when several cases are named.

◆ nullflag

#define nullflag   (-1073741824L)

[#138]: -(2^30) signifies a missing item

◆ penalty

#define penalty (   x)    mem[x + 1].int_

[p56#157] the added cost of breaking a list here.

◆ postbreak

#define postbreak   rlink

[p53#145] text that follows a discretionary break.

◆ prebreak

#define prebreak   llink

[p53#145] text that precedes a discretionary break.

◆ precedesbreak

#define precedesbreak (   x)    (type(x) < MATH_NODE)

[p54#148]

◆ replacecount

#define replacecount   subtype

[p53#145] how many subsequent nodes to replace.

◆ rulenodesize

#define rulenodesize   4

[#138]: number of words to allocate for a rule node

◆ shiftamount

#define shiftamount (   x)    mem[x + 4].sc

[p51#135] repositioning distance, in sp.

◆ shrink

#define shrink (   x)    mem[x + 3].sc

[p55#150] the shrinkability of this glob of glue.

◆ shrinking

#define shrinking   2

[p51#135] glue setting applies to the shrink components.

◆ shrinkorder

#define shrinkorder (   x)    subtype(x)

[p55#150] order of INFINITY for shrinking.

◆ smallnodesize

#define smallnodesize   2

[#141]: number of words to allocate for most node types

◆ spancount

#define spancount   subtype

[p57#159] indicates the number of spanned columns.

◆ splittopptr

#define splittopptr (   x)    link(x + 4)

[p52#140] the |splittopskip| to be used.

◆ stretch

#define stretch (   x)    mem[x + 2].sc

[p55#150] the stretchability of this glob of glue.

◆ stretching

#define stretching   1

[p51#135] glue setting applies to the stretch components.

◆ stretchorder

#define stretchorder (   x)    type(x)

[p55#150] order of INFINITY for stretching.

◆ subtype

#define subtype (   x)    (mem[(x)].hh.UU.U2.b1)

[p50#133] -> QuarterWord; secondary identification in some cases.

◆ type

#define type (   x)    (mem[(x)].hh.UU.U2.b0)

[p50#133] -> QuarterWord; identifies what kind of node this is.

◆ width

#define width (   x)    mem[x + widthoffset].sc

[p51#135] width of the box, in sp.

◆ widthoffset

#define widthoffset   1

[p51#135] position of width field in a box node.

◆ xleaders

#define xleaders   102

[p54#149] subtype for expanded leaders.

枚举类型说明

◆ InfinityOrder

[#150]: the orders of INFINITY (normal, fil, fill, or filll) corresponding to the stretch and shrink values.

枚举值
FIL 

first-order INFINITY

FILL 

second-order INFINITY

FILLL 

third-order INFINITY

◆ NodeType

enum NodeType
枚举值
HLIST_NODE 

#135: type of hlist nodes

VLIST_NODE 

#137: type of vlist nodes

RULE_NODE 

#138: type of rule nodes

INS_NODE 

#140: type of insertion nodes

MARK_NODE 

#141: type of a mark node

ADJUST_NODE 

#142: type of an adjust node

LIGATURE_NODE 

#143: type of a ligature node

DISC_NODE 

#145: type of a discretionary node

WHATSIT_NODE 

#146: type of special extension nodes

MATH_NODE 

#147: type of a math node

GLUE_NODE 

#150: number of words to allocate for a glue specification

KERN_NODE 

#155: type of a kern node

PENALTY_NODE 

#157: type of a penalty node

UNSET_NODE 

#159: type for an unset node

函数说明

◆ new_disc()

Pointer new_disc ( void  )

[#145] creates an empty disc node.

◆ new_glue()

Pointer new_glue ( Pointer  q)

[#153] argument points to a glue specification.

◆ new_kern()

Pointer new_kern ( long  w)

[#156] creates a kern node having a given width.

◆ new_lig_item()

Pointer new_lig_item ( QuarterWord  c)

[#144] returns a two-word node having a given character field.

Such nodes are used for temporary processing as ligatures are being created.

◆ new_ligature()

Pointer new_ligature ( QuarterWord  f,
QuarterWord  c,
Pointer  q 
)

[#144] creates a ligature node having given contents of the font, character, and lig_ptr fields.

◆ new_math()

Pointer new_math ( Scaled  w,
SmallNumber  s 
)

[#147] A math node, which occurs only in horizontal lists, appears before and after mathematical formulas.

The subtype field is before before the formula and after after it. There is a width field, which represents the amount of surrounding space inserted by \mathsurround.

◆ new_null_box()

Pointer new_null_box ( void  )

[#136] creates a new box node.

The new_null_box function returns a pointer to an hlist_node in which all subfields have the values corresponding to ‘\hbox{}’. The subtype field is set to MIN_QUARTER_WORD, since that’s the desired span count value if this hlist_node is changed to an unset_node.

◆ new_param_glue()

Pointer new_param_glue ( SmallNumber  n)

[#152] creates a glue node for a given parameter identified by its code number;

◆ new_penalty()

Pointer new_penalty ( long  m)

[#158]

◆ new_rule()

Pointer new_rule ( void  )

[#139]

◆ new_skip_param()

Pointer new_skip_param ( SmallNumber  n)

[#154] creates a glue node for one of the current glue parameters.

but it makes a fresh copy of the glue specification, since that specification will probably be subject to change, while the parameter will stay put.

[#224] Current mem equivalent of glue parameter number n.

◆ new_spec()

Pointer new_spec ( Pointer  p)

[#151] duplicates a glue specification.