TeX in C
Explore TeX with modern c compiler.
PART 32: Shipping pages out

结构体

struct  MovePtr
 

宏定义

#define ID_BYTE   2
 [#587]: identifies the kind of DVI files described here 更多...
 
#define MOVEMENT_NODE_SIZE   3
 [#605]: number of words per entry in the down and right stacks 更多...
 
#define vetglue(x)
 [p223#605] DVI byte number for a movement command 更多...
 
#define LOCATION(x)   ((x)->locationf)
 DVI byte number for a movement command 更多...
 
#define WIDTH(x)   ((x)->widthf)
 
#define LINK(x)   ((x)->linkf)
 
#define INFO(x)   ((x)->infof)
 
#define FREE_NODE(x, y)   free(x)
 
#define synchh()
 [p229#619] label not_use 更多...
 
#define synchv()
 

类型定义

typedef Pointer DVI_Index
 [#594]: an index into the output buffer. 更多...
 

枚举

enum  DVISetting {
  Y_HERE = 1 , Z_HERE , YZ_OK , Y_OK ,
  Z_OK , D_FIXED
}
 p224#608 更多...
 
enum  StackState { NONE_SEEN = 0 , Y_SEEN = 6 , Z_SEEN = 12 }
 P226#611 更多...
 

函数

void dviout_init (void)
 [#593, #596, #606] 初始化 dviout 内部变量 更多...
 
static void write_dvi (DVI_Index a, DVI_Index b)
 [#597]: The actual output of dvi_buf[a,b] to dvi file. 更多...
 
static void dvi_swap (void)
 [#598]: outputs half of the buffer. 更多...
 
void dviout (int x)
 [#598] 更多...
 
void dvi_four (Integer x)
 [#600]: outputs four bytes in two’s complement notation, without risking arithmetic overflow. 更多...
 
void dvi_pop (Integer l)
 [#601] 更多...
 
void dviout_helper (ASCIICode c)
 
void dvi_font_def (InternalFontNumber f)
 [#602] 更多...
 
static MovePtr get_move_node (void)
 
static void movement (Scaled w, enum DVICommands dvicmd)
 [p224#607] produces a DVI command for some specified downward or rightward motion. 更多...
 
void prune_movements (Integer l)
 [p227#615]: delete movement nodes with LOCATION ≥ l. 更多...
 
Scaled synch_h (Scaled cur_h, Scaled dvi_h)
 [#616] 返回 cur_h 在 tex.c 中通过赋值更新 dvi_h. 更多...
 
Scaled synch_v (Scaled cur_v, Scaled dvi_v)
 
void hlistout (void)
 
void vlistout (void)
 
void shipout (Pointer p)
 
void dviout_ID_BYTE (void)
 
void dviout_SET_RULE (void)
 
void dviout_PUT_RULE (void)
 
void dviout_EOP (void)
 
void dviout_PUSH (void)
 
void dviout_POP (void)
 
void dviout_PRE (void)
 
void dviout_POST (void)
 
void dviout_XXX1 (void)
 
void dviout_XXX4 (void)
 
long get_dvi_mark (void)
 
Boolean dvi_openout (void)
 
void _dvibop (Integer counts[])
 used in [p236#638]: shipout 更多...
 
void _dvi_lastbop (void)
 
void dvi_set_font (int f)
 
void dvi_set_char (long c)
 
long dviflush (void)
 

变量

static EightBits dvibuf [DVI_BUF_SIZE+1]
 buffer for DVI output 更多...
 
static DVI_Index half_buf
 half of dvi buf size 更多...
 
static DVI_Index dvi_limit
 end of the current half buffer 更多...
 
static DVI_Index dvi_ptr
 the next available buffer address. 更多...
 
static Integer dvi_offset
 DVI_BUF_SIZE times the number of times the output buffer has been fully emptied. 更多...
 
static Integer dvigone
 the number of bytes already output to dvi file 更多...
 
static FILE * dvifile
 
static Integer last_bop
 LOCATION of previous bop in the DVI output. 更多...
 
static MovePtr down_ptr
 
static MovePtr right_ptr
 
Scaled maxh
 
Scaled maxv
 
Integer totalpages
 
Integer maxpush
 
Integer deadcycles
 
Boolean doingleaders
 
Static Integer lq
 
Static Integer lr
 
Static Scaled ruleht
 
Static Scaled ruledp
 
Static Scaled rulewd
 
Scaled dvih = 0
 
Scaled dviv = 0
 
Scaled curh
 
Scaled curv
 
Scaled curmu
 
Static InternalFontNumber dvif = NULL_FONT
 
Integer curs
 

详细描述

宏定义说明

◆ FREE_NODE

#define FREE_NODE (   x,
 
)    free(x)

◆ ID_BYTE

#define ID_BYTE   2

[#587]: identifies the kind of DVI files described here

◆ INFO

#define INFO (   x)    ((x)->infof)

◆ LINK

#define LINK (   x)    ((x)->linkf)

◆ LOCATION

#define LOCATION (   x)    ((x)->locationf)

DVI byte number for a movement command

◆ MOVEMENT_NODE_SIZE

#define MOVEMENT_NODE_SIZE   3

[#605]: number of words per entry in the down and right stacks

◆ synchh

#define synchh ( )
值:
do { \
dvih = synch_h(curh, dvih); \
} while (0)
Scaled curh
Definition: dviout.h:35
Scaled dvih
Definition: dviout.c:105
Scaled synch_h(Scaled cur_h, Scaled dvi_h)
[#616] 返回 cur_h 在 tex.c 中通过赋值更新 dvi_h.
Definition: dviout.c:405

[p229#619] label not_use

◆ synchv

#define synchv ( )
值:
do { \
dviv = synch_v(curv, dviv); \
} while (0)
Scaled curv
Definition: dviout.h:35
Scaled dviv
Definition: dviout.h:35
Scaled synch_v(Scaled cur_v, Scaled dvi_v)
Definition: dviout.c:414

◆ vetglue

#define vetglue (   x)
值:
(gluetemp = (x), \
((gluetemp > (1000000000.0)) \
? (gluetemp = 1000000000.0) \
: ((gluetemp < -1000000000.0) ? (gluetemp = -1000000000.0) : 0)))

[p223#605] DVI byte number for a movement command

[p231#625]

◆ WIDTH

#define WIDTH (   x)    ((x)->widthf)

类型定义说明

◆ DVI_Index

typedef Pointer DVI_Index

[#594]: an index into the output buffer.

[0, DVI_BUF_SIZE=800]

枚举类型说明

◆ DVISetting

enum DVISetting

p224#608

枚举值
Y_HERE 

info when the movement entry points to a y command

Z_HERE 

info when the movement entry points to a z command

YZ_OK 

info corresponding to an unconstrained down command

Y_OK 

info corresponding to a down that can’t become a z

Z_OK 

info corresponding to a down that can’t become a y

D_FIXED 

info corresponding to a down that can’t change.

◆ StackState

enum StackState

P226#611

枚举值
NONE_SEEN 

no y here or z here nodes have been encountered yet

Y_SEEN 

we have seen y here but not z here

Z_SEEN 

we have seen z here but not y here

函数说明

◆ _dvi_lastbop()

void _dvi_lastbop ( void  )

◆ _dvibop()

void _dvibop ( Integer  counts[])

used in [p236#638]: shipout

◆ dvi_font_def()

void dvi_font_def ( InternalFontNumber  f)

[#602]

◆ dvi_four()

void dvi_four ( Integer  x)

[#600]: outputs four bytes in two’s complement notation, without risking arithmetic overflow.

TODO: check

◆ dvi_openout()

Boolean dvi_openout ( void  )

◆ dvi_pop()

void dvi_pop ( Integer  l)

[#601]

◆ dvi_set_char()

void dvi_set_char ( long  c)

◆ dvi_set_font()

void dvi_set_font ( int  f)

◆ dvi_swap()

static void dvi_swap ( void  )
static

[#598]: outputs half of the buffer.

◆ dviflush()

long dviflush ( void  )

◆ dviout()

void dviout ( int  x)

[#598]

◆ dviout_EOP()

void dviout_EOP ( void  )
inline

◆ dviout_helper()

void dviout_helper ( ASCIICode  c)

◆ dviout_ID_BYTE()

void dviout_ID_BYTE ( void  )
inline

◆ dviout_init()

void dviout_init ( void  )

[#593, #596, #606] 初始化 dviout 内部变量

[#593]

[#596]

[#606]

◆ dviout_POP()

void dviout_POP ( void  )
inline

◆ dviout_POST()

void dviout_POST ( void  )
inline

◆ dviout_PRE()

void dviout_PRE ( void  )
inline

◆ dviout_PUSH()

void dviout_PUSH ( void  )
inline

◆ dviout_PUT_RULE()

void dviout_PUT_RULE ( void  )
inline

◆ dviout_SET_RULE()

void dviout_SET_RULE ( void  )
inline

◆ dviout_XXX1()

void dviout_XXX1 ( void  )
inline

◆ dviout_XXX4()

void dviout_XXX4 ( void  )
inline

◆ get_dvi_mark()

long get_dvi_mark ( void  )

◆ get_move_node()

static MovePtr get_move_node ( void  )
static

◆ hlistout()

void hlistout ( void  )

◆ movement()

static void movement ( Scaled  w,
enum DVICommands  dvicmd 
)
static

[p224#607] produces a DVI command for some specified downward or rightward motion.

parameters:

  • w: the amount of motion
  • dvicmd: DOWN1 or RIGHT1

have we seen a y or z?

current and top nodes on the stack

index into dvi buf , modulo dvi buf size

◆ prune_movements()

void prune_movements ( Integer  l)

[p227#615]: delete movement nodes with LOCATION ≥ l.

◆ shipout()

void shipout ( Pointer  p)

[ #640 ]: Ship box p out

[p236#639] Flush the box from memory, showing statistics if requested

◆ synch_h()

Scaled synch_h ( Scaled  cur_h,
Scaled  dvi_h 
)

[#616] 返回 cur_h 在 tex.c 中通过赋值更新 dvi_h.

◆ synch_v()

Scaled synch_v ( Scaled  cur_v,
Scaled  dvi_v 
)

◆ vlistout()

void vlistout ( void  )

◆ write_dvi()

static void write_dvi ( DVI_Index  a,
DVI_Index  b 
)
static

[#597]: The actual output of dvi_buf[a,b] to dvi file.

变量说明

◆ curh

Scaled curh

◆ curmu

Scaled curmu

◆ curs

Integer curs

◆ curv

Scaled curv

◆ deadcycles

Integer deadcycles

◆ doingleaders

Boolean doingleaders

◆ down_ptr

MovePtr down_ptr
static

◆ dvi_limit

DVI_Index dvi_limit
static

end of the current half buffer

◆ dvi_offset

Integer dvi_offset
static

DVI_BUF_SIZE times the number of times the output buffer has been fully emptied.

◆ dvi_ptr

DVI_Index dvi_ptr
static

the next available buffer address.

◆ dvibuf

EightBits dvibuf[DVI_BUF_SIZE+1]
static

buffer for DVI output

◆ dvif

◆ dvifile

FILE* dvifile
static

◆ dvigone

Integer dvigone
static

the number of bytes already output to dvi file

◆ dvih

Scaled dvih = 0

◆ dviv

Scaled dviv = 0

◆ half_buf

DVI_Index half_buf
static

half of dvi buf size

◆ last_bop

Integer last_bop
static

LOCATION of previous bop in the DVI output.

last_bop: [592], 593, 640, 642

◆ lq

◆ lr

◆ maxh

Scaled maxh

◆ maxpush

Integer maxpush

◆ maxv

Scaled maxv

◆ right_ptr

MovePtr right_ptr
static

◆ ruledp

Static Scaled ruledp

◆ ruleht

Static Scaled ruleht

◆ rulewd

Static Scaled rulewd

◆ totalpages

Integer totalpages