tdef.h revision e5190c108bde19ca4d7c03b1d1eab7b00bd3a1ed
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* starting values for typesetting parameters: */
#ifdef NROFF
# define TRAILER 0
# define PO 0 /* page offset */
# define ASCII 1
# define PTID 1
# define LG 0
# define DTAB 0 /* set at 8 Ems at init time */
#endif
#ifndef NROFF /* TROFF */
/* Inch is set by ptinit() when troff started. */
/* all derived values set then too
*/
/* # define EM (POINT * pts) */
# define ASCII 0
# define PTID 1
# define LG 1
#endif
/* These "characters" are used to encode various internal functions
* Some make use of the fact that most ascii characters between
* 0 and 040 don't have any graphic or other function.
* The few that do have a purpose (e.g., \n, \b, \t, ...
* are avoided by the ad hoc choices here.
* See ifilt[] in n1.c for others -- 1, 2, 3, 5, 6, 7, 010, 011, 012
*/
#define LEADER 001
#define TAB 011
/* line: 'l' dx dy char */
/* circle: 'c' r */
/* ellipse: 'e' rx ry */
/* arc: 'a' dx dy r */
/* wiggly line '~' x y x y ... */
#define DRAWLINE 'l'
#define DRAWELLIPSE 'e'
#define FLSS 031
#define ESC 033
/* array sizes, and similar limits: */
/*
Internal character representation:
Internally, every character is carried around as
a 32 bit cookie, called a "tchar" (typedef long).
Bits are numbered 31..0 from left to right.
If bit 15 is 1, the character is motion, with
if bit 16 it's vertical motion
if bit 17 it's negative motion
If bit 15 is 0, the character is a real character.
if bit 31 zero motion
bits 30..24 size
bits 23..16 font
ifndef EUC
bit 8 absolute char number in 7..0
This implies at most 256-32 characters in a single font,
which is going to be a problem somewhere
else
bits 14,13 identifier for the colunm of print of character.
bits 12,11 multibyte position identifier
Currently, this applies only to nroff.
endif EUC
*/
/* in the following, "L" should really be a tchar, but ... */
#define BYTEMASK 0377
#define BYTE 8
#ifdef EUC
#ifdef NROFF
#define MBMASK1 0x1800
#define FIRSTOFMB 0x1000
#define MIDDLEOFMB 0x0800
#define LASTOFMB 0x0400
#define BYTE_CHR 0x0000
#endif /* NROFF */
#endif /* EUC */
#define TABMASK 037777
#define RTAB (unsigned) 0100000
#define CTAB 040000
#define LDRBIT 04
#define FCBIT 010
#ifndef EUC
#else
#ifndef NROFF
#endif /* NROFF */
#endif /* EUC */
/*
* "temp file" parameters. macros and strings
* are stored in an array of linked blocks,
* which may be in memory and an array called
* corebuf[], if INCORE is set during
* compilation, or otherwise in a file called trtmp$$.
* The numerology is delicate if filep is 16 bits:
#define BLK 128
#define NBLIST 512
* i.e., the product is 16 bits long.
* If filep is an unsigned long (and if your
* compiler will let you say that) then NBLIST
* can be a lot bigger. Of course that makes
* the file or core image a lot bigger too,
* and means you don't detect missing diversion
* terminations as quickly... .
* It also means that you may have trouble running
* on non-swapping systems, since the core image
* will be over 1Mb.
* BLK must be a power of 2
*/
typedef unsigned int filep; /* this is good for 32 bit machines */
#ifdef SMALLER
# define NBLIST 512
#else
/* machines with paging can use 2048 */
#endif
/* Other things are stored in the temp file or corebuf:
* a single block for .rd input, at offset RD_OFFSET
* NEV copies of the environment block, at offset ENV_OFFSET
* The existing implementation assumes very strongly that
* these are respectively NBLIST*BLK and 0.
*/
#define ENV_OFFSET 0
/* rounded up to even BLK */
typedef long tchar;
extern long atoi0();
/* these characters are used as various signals or values
* in miscellaneous places.
* values are set in specnames in t10.c
*/
extern int c_hyphen;
extern int c_emdash;
extern int c_rule;
extern int c_minus;
extern int c_fi;
extern int c_fl;
extern int c_ff;
extern int c_ffi;
extern int c_ffl;
extern int c_acute;
extern int c_grave;
extern int c_under;
extern int c_rooten;
extern int c_boxrule;
extern int c_lefthand;
extern int c_dagger;
/*
* stderr. So undef it if it is already defined.
*/
#ifdef stderr
#endif
extern int stderr; /* this is NOT the stdio value! */
#ifdef DEBUG
extern int debug; /*debug flag*/
#endif /* DEBUG */
struct d { /* diversion */
int dnl;
int dimac;
int ditrap;
int ditf;
int alss;
int blss;
int nls;
int mkline;
int maxl;
int hnl;
int curd;
};
struct s { /* stack frame */
int nargs;
struct s *pframe;
int pnchar;
int ppendt;
int mname;
};
extern struct contab {
unsigned short rq;
int (*f)();
unsigned mx;
extern struct numtab {
short r; /* name */
short fmt;
short inc;
int val;
#define PN 0
#define NL 1
#define YR 2
#define HP 3
#define CT 4
#define DN 5
#define MO 6
#define DY 7
#define DW 8
#define LN 9
#define DL 10
#define ST 11
#define SB 12
#define CD 13
#define PID 14
/* the infamous environment block */
extern struct env {
int _ics;
int _sps;
int _spacesz;
int _lss;
int _lss1;
int _ll;
int _ll1;
int _lt;
int _lt1;
int _icf;
int _apts;
int _apts1;
int _pts;
int _pts1;
int _font;
int _font1;
int _ls;
int _ls1;
int _ad;
int _nms;
int _ndf;
int _fi;
int _cc;
int _c2;
int _ohc;
int _tdelim;
int _hyf;
int _hyoff;
int _un1;
int _tabc;
int _dotc;
int _adsp;
int _adrem;
int _lastl;
int _nel;
int _admod;
int _spflg;
int _wne;
int _ne;
int _nc;
int _nb;
int _lnmod;
int _nwd;
int _nn;
int _ni;
int _ul;
int _cu;
int _ce;
int _in;
int _in1;
int _un;
int _wch;
int _pendt;
int _pendnf;
int _spread;
int _it;
int _itmac;
int _lnsize;
} env;