plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

slug.h (2412B)


      1 enum slugtypes {
      2 	NONE,		// can't happen
      3 	VBOX,		// Vertical Box -- printable stuff
      4 	SP,		// paddable SPace
      5 	BS,		// start Breakable Stream
      6 	US,		// start Unbreakable Stream
      7 	BF,		// start Breakable Float
      8 	UF,		// start Unbreakable Float
      9 	PT,		// start Page Top material (header)
     10 	BT,		// start page BoTtom material (footer)
     11 	END,		// ENDs of groups
     12 	NEUTRAL,	// NEUTRALized slugs can do no harm (cf. CIA)
     13 	PAGE,		// beginning of PAGE in troff input
     14 	TM,		// Terminal Message to appear during output
     15 	COORD,		// output page COORDinates
     16 	NE,		// NEed command
     17 	MC,		// Multiple-Column command
     18 	CMD,		// misc CoMmanDs:  FC, FL, BP
     19 	PARM,		// misc PARaMeters:  NP, FO
     20 	LASTTYPE	// can't happen either
     21 };
     22 
     23 enum cmdtypes {
     24 	FC,	// Freeze 2-Column material
     25 	FL,	// FLush all floats before reading more stream
     26 	BP	// Break Page
     27 };
     28 
     29 enum parmtypes {
     30 	NP,	// distance of top margin from page top (New Page)
     31 	FO,	// distance of bottom margin from page top (FOoter)
     32 	PL,	// distance of physical page bottom from page top (Page Length)
     33 	MF,	// minimum fullness required for padding
     34 	CT,	// tolerance for division into two columns
     35 	WARN,	// warnings to stderr?
     36 	DBG	// debugging flag
     37 };
     38 
     39 class slug {
     40 	int	serialnum;
     41 	int	dp;		// offset of data for this slug in inbuf
     42 	int	linenum;	// input line number (approx) for this slug
     43 	short	font;		// font in effect at slug beginning
     44 	short	size;		// size in effect at slug beginning
     45 	short	seen;		// 0 until output
     46 	short	ncol;		// number of columns (1 or 2)
     47 	short	offset;		// horizontal offset for 2 columns
     48   public:
     49 	short	type;		// VBOX, PP, etc.
     50 	short	parm;		// parameter
     51 	short	base;		// "depth" of this slug (from n command)
     52 	int	hpos;		// abs horizontal position
     53 	int	dv;		// height of this slug above its input Vpos
     54 	union {
     55 		int	ht;	// "height" of this slug (from n command)
     56 		int	parm2;	// second parameter, since only VBOXes have ht
     57 	};
     58 	friend	slug getslug(FILE *);
     59 	friend	void checkout();
     60 	friend	slug eofslug();
     61 	void	coalesce();	// with next slug in array slugs[]
     62 	void	neutralize();	// render this one a no-op
     63 	void	dump();		// dump its contents for debugging
     64 	char	*headstr();	// string value of text
     65 	void	slugout(int);	// add the slug to the output
     66 	char	*typename();	// printable slug type
     67 	int	serialno()	{ return serialnum; }
     68 	int	numcol()	{ return ncol; }
     69 	int	lineno()	{ return linenum; }
     70 };
     71 
     72 // functions in slug.c
     73 slug	eofslug();
     74 slug	getslug(FILE *);