Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
XCOMM $XConsortium: Imakefile /main/4 1996/04/21 19:29:56 drk $
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
SUBDIRS = pass1 canon1 pass2 helptag misc dtds
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
LintSubdirs($(SUBDIRS))

View File

@@ -0,0 +1,10 @@
The icons in this directory should be replaced with the ones we ship
with the HP COE run-time online help. They are stored in:
.../hp/rivers/help/graphicsShared/noteicon.pm
.../hp/rivers/help/graphicsShared/cauticon.pm
.../hp/rivers/help/graphicsShared/warnicon.pm
It was noticed that these files were out of synch too late to make it into
the IF3 release.

View File

@@ -0,0 +1,50 @@
/* XPM */
/* $XConsortium: cauticon.pm /main/3 1995/07/18 17:15:20 drk $ */
/*********************************************************************
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
* Novell, Inc.
**********************************************************************/
static char * cauticon [] = {
/* width height ncolors cpp [x_hot y_hot] */
"32 32 4 1 0 0",
/* colors */
" s none m none c none",
". s iconColor1 m black c black",
"X s iconColor5 m black c blue",
"o s iconColor6 m white c yellow",
/* pixels */
" ",
" ..... ",
" .XXXXX. ",
" .XXoooXX. ",
" .XXoooooXX. ",
" .XoooooooX. ",
" .XXoooooooXX. ",
" .XXoooXXXoooXX. ",
" .XoooXXXXXoooX. ",
" .XXoooXXXXXoooXX. ",
" .XXooooXXXXXooooXX. ",
" .XoooooXXXXXoooooX. ",
" .XXoooooXXXXXoooooXX. ",
" .XXooooooXXXXXooooooXX. ",
" .XooooooooXXXooooooooX. ",
" .XXooooooooXXXooooooooXX. ",
" .XXoooooooooXXXoooooooooXX. ",
" .XooooooooooXXXooooooooooX. ",
" .XXooooooooooXXXooooooooooXX. ",
".XXoooooooooooooooooooooooooX. ",
".XXoooooooooooooooooooooooooXX. ",
".XooooooooooooXXXooooooooooooX. ",
".XoooooooooooXXXXXoooooooooooX. ",
".XoooooooooooXXXXXoooooooooooX. ",
".XXoooooooooooXXXoooooooooooXX. ",
" .XoooooooooooooooooooooooooX. ",
" .XXXoooooooooooooooooooooXXX. ",
" ..XXXXXXXXXXXXXXXXXXXXXXX.. ",
" ....................... ",
" ",
" ",
" "};

View File

@@ -0,0 +1,49 @@
/* XPM */
/* $XConsortium: noteicon.pm /main/3 1995/07/18 17:15:28 drk $ */
/*********************************************************************
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
* Novell, Inc.
**********************************************************************/
static char * noteicon [] = {
/* width height ncolors cpp [x_hot y_hot] */
"32 32 3 1 -1 -1",
/* colors */
" s none m none c none",
". s iconGray2 m white c #bdbdbdbdbdbd",
"X s iconColor5 m black c blue",
/* pixels */
" ",
" ........ ",
" .............. ",
" .................. ",
" .................... ",
" ...................... ",
" ..........XXX........... ",
" ..........XXXXX........... ",
" ..........XXXXX........... ",
" ...........XXXXX............ ",
" ............XXX............. ",
" ............................ ",
" .............................. ",
" ..............XXX............. ",
" ............XXXXX............. ",
" ............XXXXX............. ",
" .............XXXX............. ",
" .............XXXX............. ",
" .............XXXX............. ",
" ............XXXX............ ",
" ............XXXX............ ",
" ............XXXX............ ",
" ...........XXXX........... ",
" ...........XXXX.......... ",
" .........XXXXXX......... ",
" ........XXXXXX........ ",
" .................... ",
" .................. ",
" .............. ",
" ........ ",
" ",
" "};

View File

@@ -0,0 +1,50 @@
/* XPM */
/* $XConsortium: warnicon.pm /main/3 1995/07/18 17:15:36 drk $ */
/*********************************************************************
* (c) Copyright 1993, 1994 Hewlett-Packard Company
* (c) Copyright 1993, 1994 International Business Machines Corp.
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
* Novell, Inc.
**********************************************************************/
static char * warnicon [] = {
/* width height ncolors cpp [x_hot y_hot] */
"32 32 4 1 -1 -1",
/* colors */
" s none m none c none",
". s iconColor1 m black c black",
"X s iconColor3 m black c red",
"o s iconColor6 m white c yellow",
/* pixels */
" ",
" ..... X ",
" .ooooo. XXX ",
" .ooXXXoo. XXXX ",
" .ooXXXXXoo. XXXXXXX ",
" .oXXXXXXXo. XXXXXXX ",
" .ooXXXXXXXooXXXXXXX ",
" .ooXXXXXXXXXoXXXXXX ",
" .oXXXXXXXXXoXXXXX ",
" .ooXXXXXXXXoooXX ",
" .ooXXXXXXXXoooooXXX ",
" .oXXXXXXXXooooooXoX ",
" .ooXXXXXXXooooooXXoo. ",
" .ooXXXXXXXooooooXXXXoo. ",
" .oXXXXXXXooooooXXXXXXo. ",
" .ooXXXXXXooooooXXXXXXXoo. ",
" .ooXXXXXXXXXoooXXXXXXXXXoo. ",
" .oXXXXXXXXXXooooXXXXXXXXXo. ",
" .ooXXXXXXXXXooooooXXXXXXXXoo. ",
".ooXXXXXXXXXoooooXXXXXXXXXXXo. ",
".ooXXXXXXXXoooooXXXXXXXXXXXXoo. ",
".oXXXXXXXXooooXXXXXXXXXXXXXXXo. ",
".oXXXXXXXXoooXXXXXXXXXXXXXXXXo. ",
".oXXXXXXXoooXXXXXXXXXXXXXXXXXo. ",
".ooXXXXXoooooXXXXXXXXXXXXXXXoo. ",
"..oXXXXooooXXXXXXXXXXXXXXXXXo. ",
" .oooooooXXXXXXXXXXXXXXXXXooo. ",
" ..oXXXooooooooooooooooooo.. ",
" XXXX.................... ",
" XXX ",
" XX ",
" X "};

View File

@@ -0,0 +1,16 @@
XCOMM $XConsortium: Imakefile /main/3 1995/11/08 09:24:17 rswiston $
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS)'
#if !UseCCMakeDepend
MDEP_DIR = makedepend
#endif
#ifdef SunArchitecture
.NO_PARALLEL:
#endif
SUBDIRS = util build eltdef helptag parser
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))

View File

@@ -0,0 +1,87 @@
XCOMM $XConsortium: Imakefile /main/3 1995/11/08 09:24:32 rswiston $
/* build Imakefile */
ARCCMD = arc u
UNARCCMD = arc x
ARCDELCMD = arc d
HELPTAG = ..
HELPTAGSRC = $(HELPTAG)/helptag
HELPPARSERSRC = $(HELPTAG)/parser
HELPELTDEFSRC = $(HELPTAG)/eltdef
HELPDTDFILE = $(HELPTAGSRC)/hptag.dtd
HELPUTILSRC = $(HELPTAG)/util
HELPBUILDSRC = $(HELPTAG)/build
HELPUTILLIB = $(HELPTAG)/util/libutil.a
INCLUDES = -I. -I$(HELPUTILSRC)
SRCS = \
build.c buildutl.c eltree.c except.c fsa.c out.c param.c \
scan.c sref.c tree.c
OBJS = \
build.o buildutl.o eltree.o except.o fsa.o out.o param.o \
scan.o sref.o tree.o
CHPRODS = context.h delim.h
CCPRODS = case.c
BHPRODS = arc.h dtd.h entity.h
BCPRODS =
CTRASH = error delim.dat
BTRASH = error template
CPRODS = $(CHPRODS) $(CCPRODS)
BPRODS = $(BHPRODS) $(BCPRODS)
TRASH = error delim.dat template
PRODUCTS = $(CPRODS) $(BPRODS)
LOCAL_LIBRARIES = $(HELPUTILLIB)
/* Don't use shared libs for hp */
#ifdef HPArchitecture
#if OSMajorVersion > 7
EXTRA_LOAD_FLAGS = -Wl,-a archive
#endif
#endif
#ifdef SunArchitecture
.NO_PARALLEL:
#endif
all:: $(PRODUCTS)
$(BPRODS): build $(HELPDTDFILE)
$(RM) $(BPRODS) $(BTRASH)
./build -m < $(HELPDTDFILE)
NormalLibraryObjectRule()
NormalProgramTarget(build,$(OBJS),delim.h $(LOCAL_LIBRARIES),$(LOCAL_LIBRARIES),)
$(CPRODS): $(HELPUTILSRC)/context $(HELPTAGSRC)/delim.bld context.dat
$(RM) $(CPRODS) $(CTRASH)
/* get application-specific delim.dat */
$(CP) $(HELPTAGSRC)/delim.bld delim.dat
$(HELPUTILSRC)/context sparse
$(HELPUTILSRC)/context:
cd $(HELPUTILSRC); make context
arc package :
if exist util.arc $(CP) build.arc old.arc
$(ARCCMD) util.arc *.c *.h makefile
unarc dearc :
$(UNARCCMD) util.arc
clean::
$(RM) $(PRODUCTS) $(TRASH)
depend:: $(SRCS)
DependTarget()
includes:: $(PRODUCTS)

View File

@@ -0,0 +1,52 @@
/* $XConsortium: build.c /main/3 1995/11/08 09:24:44 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Build.c contains the main procedure for program BUILD */
#include <string.h>
#include <malloc.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "context.h"
#define BUILDEF
#include "build.h"
#include "delim.h"
#include "entdef.h"
/* Main procedure */
void main(argc, argv)
int argc ;
char **argv ;
{
int m_prevcon ;
if (argc > 1)
{
if (strchr(argv[1], 'a')) m_malftrace = TRUE ;
if (strchr(argv[1], 'A')) m_malftrace = TRUE ;
if (strchr(argv[1], 'a')) m_malftrace = TRUE ;
if (strchr(argv[1], 'H')) m_heapchk = TRUE ;
if (strchr(argv[1], 'm')) standard = TRUE ;
if (strchr(argv[1], 'M')) standard = TRUE ;
if (strchr(argv[1], 's')) scantrace = TRUE ;
if (strchr(argv[1], 'S')) scantrace = TRUE ;
}
initialize() ;
while (TRUE)
{
m_token = scan() ;
m_prevcon = curcon ;
curcon = m_newcon(m_prevcon - 1, m_token - 1) ;
if (scantrace)
printf(
"m_prevcon=%d, m_token=%d, curcon=%d, scanval = %c (%d), line=%d\n",
m_prevcon, m_token, curcon, scanval, scanval, m_line) ;
#include "case.c"
if (m_token == ENDFILE) exit(FALSE) ;
}
}

View File

@@ -0,0 +1,406 @@
/* $XConsortium: build.h /main/3 1995/11/08 09:24:53 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Build.h is the primary include file for allocation of global variables
for program BUILD. */
#if defined(BUILDEF)
#define BUILDEXTERN
#define BUILDINIT(a) = a
#else
#define BUILDEXTERN extern
#define BUILDINIT(a)
#endif
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "common.h"
/* Defined types */
typedef struct arc ARC ;
typedef struct state STATE ;
typedef struct tree TREE ;
typedef struct statelist STATELIST ;
typedef struct parameter PARAMETER ;
typedef struct exception EXCEPTION ;
typedef struct ptype PTYPE ;
typedef struct eltstruct ELTSTRUCT ;
typedef struct lhsstruct LHS ;
typedef struct stack STACK ;
typedef struct srefstruct SREFSTRUCT ;
typedef struct srefdata SREFDATA ;
typedef struct mapstruct MAP ;
typedef struct andgroup ANDGROUP ;
/* Each item in a list of states contains value, a pointer to a state;
next, a pointer to the next item in the list; and level, which
indicates the level of nested subexpressions within the regular expression
when the state was added to the FSA. */
BUILDEXTERN struct statelist {
STATE *value ;
STATELIST *next ;
int level ;
} ;
struct stack {
STACK *oldtop ;
STATELIST *starts ;
STATELIST *finals ;
STATELIST *allfinal ;
STATELIST *newfinal ;
ARC *starta ;
} ;
BUILDEXTERN STACK bot
#if defined(BUILDEF)
= {
NULL, NULL, NULL, NULL, NULL, NULL
}
#endif
;
BUILDEXTERN STACK *top BUILDINIT(&bot) ;
BUILDEXTERN int stacklevels BUILDINIT(0) ;
/* Used to report nondeterminism in and groups */
#define ANDCONFLICT 1
#define DATACONFLICT 2
#define ELTCONFLICT 3
/* Name of an element, and of the first element on the left-hand side of
the current rule */
#define thisrule lhs->elt->enptr
/* Set declared entity type */
#define SETETYPE(p,t) adddefent(p) ; entity->type = t
/* Definitions for entities */
#define EMPTYMAP 1
#define ERREXIT 1
/* Prefix for default short reference map and entities */
#define M_PREFIX "M-"
/* State transition network generated by CONTEXT */
#define sparse
#include "sparse.h"
/* Function prototypes */
#include "proto.h"
/* Frequently output strings */
#define ndif "}\n#endif\n ;\n\n"
#define SUBONE else fputs("[1] ;\n\n", dtd) ;
/* An array used to indicate which characters can appear within
element names */
#if defined(BUILDEF)
#include "chartype.h"
#else
extern M_CHARTYPE m_ctarray[M_CHARSETLEN] ;
#endif
/* Current state of the finite-state machine which controls BUILD */
BUILDEXTERN int curcon BUILDINIT(RULE) ;
BUILDEXTERN int m_token ;
BUILDEXTERN M_WCHAR scanval ;
/* Used to pass names and literals from the scanner */
BUILDEXTERN M_WCHAR name[M_NAMELEN + 1] ;
BUILDEXTERN M_WCHAR literal[M_LITLEN + 1] ;
/* Scanner buffer for read-ahead */
BUILDEXTERN int toundo BUILDINIT(0) ;
BUILDEXTERN int maxundo BUILDINIT(0) ;
/* Size of scanner buffer for read-ahead */
#define SAVECHAR 50
BUILDEXTERN int savechar[SAVECHAR] ;
/* Whether errors have occurred */
BUILDEXTERN LOGICAL errexit BUILDINIT(FALSE) ;
/* FSA storage */
/* Each state in an FSA is represented by a flag indicating whether it is
a final state, a pointer to a list of transitions from the state,
and a flag that indicates whether parsed character data is possible
from the state */
BUILDEXTERN struct state {
LOGICAL final ;
LOGICAL datacontent ;
LOGICAL frompcdata ;
ARC *first ;
int count ;
STATE *next ;
} ;
BUILDEXTERN STATE *firststate BUILDINIT(NULL) ;
BUILDEXTERN STATE **nextstate BUILDINIT(&firststate) ;
BUILDEXTERN STATE *startstate ;
/* Each arc in an FSA is an element in the arc list emanating from a
particular state. Associated fields include label, a pointer to
the name of the element labelling the arc (garbage if the label is an
and group); optional, a flag indicating whether or not the label is
contextually required; minim, a flag indicating whether or not the arc
corresponds to an element selected by explicit minimization;
and group, a pointer to the list of FSA's making
up the andgroup if the arc's label is an andgroup; to, a pointer to the
state entered by the arc; next, a pointer to the next arc
in the current arc list; and finally, id, a pointer to the node in the
tree representation of the model corresponding to the arc (id is used
in the detection of ambiguity to differentiate between arcs with the same
label corresponding to one model token and those with the same label
corresponding to more than one model token).
*/
BUILDEXTERN struct arc {
ELTSTRUCT *label ;
LOGICAL optional ;
LOGICAL minim ;
ANDGROUP *group ;
STATE *to ;
ARC *next ;
int id ;
} ;
/* Andgroups are elements in a list of the FSA's corresponding to the
content submodels in an andgroup. Each list element contains a pointer
to the start state of the FSA and a pointer to the next element in the
list */
BUILDEXTERN struct andgroup{
STATE *start ;
ANDGROUP *nextptr ;
ANDGROUP *next ;
int count ;
} ;
BUILDEXTERN ANDGROUP *firstand BUILDINIT(NULL) ;
BUILDEXTERN ANDGROUP **nextand BUILDINIT(&firstand) ;
/* Tree representation of a rule */
/* Each node in the tree representation corresponds to a submodel.
Associated with the node is the submodel's connector and occurrence
indicator; terminal, a flag indicating whether the submodel in turn
has submodels; value, the element of which a terminal submodel consists;
pointers first and last to the first and last submodel of the node;
and right pointing to the node's next sibling in the tree. */
struct tree {
int connector, occurrence ;
ELTSTRUCT *value ;
LOGICAL terminal ;
LOGICAL minim ;
TREE *first, *right, *parent ;
int eltid ;
} ;
BUILDEXTERN TREE *ruletree BUILDINIT(NULL) ;
BUILDEXTERN TREE *curtree ;
/* Various counters */
BUILDEXTERN int eltsinrule BUILDINIT(0) ;
BUILDEXTERN int stateused BUILDINIT(0) ;
BUILDEXTERN int andused BUILDINIT(0) ;
/* Element names on the left-hand side of the current rule */
struct lhsstruct {
ELTSTRUCT *elt ;
LHS *next ;
} ;
BUILDEXTERN LHS *lhs BUILDINIT(NULL) ;
BUILDEXTERN LHS **nextlhs BUILDINIT(&lhs) ;
/* Content type (regular expression, ANY, NONE, CDATA, RCDATA) of the
current rule. */
BUILDEXTERN int contype ;
/* Indicates whether <PARAM>, <USEMAP>, or <MIN> fields have occurred in
current rule */
BUILDEXTERN LOGICAL poccur, uoccur, moccur ;
/* Indicates whether an ID parameter for this rule has occurred */
BUILDEXTERN LOGICAL idoccur ;
/* Short reference map for this rule */
BUILDEXTERN int srefp ;
BUILDEXTERN LOGICAL useoradd ;
/* Whether start- and end-tag minimization are permitted for the current
rule */
BUILDEXTERN LOGICAL smin, emin ;
/* Suffix for generated entity names */
BUILDEXTERN int egensuf ;
/* Storage for exceptions */
BUILDEXTERN int excount BUILDINIT(0) ;
struct exception {
int element ;
EXCEPTION *next ;
EXCEPTION *nextptr ;
} ;
BUILDEXTERN EXCEPTION *firstex BUILDINIT(NULL) ;
BUILDEXTERN EXCEPTION **nextex BUILDINIT(&firstex) ;
BUILDEXTERN EXCEPTION *exlist ;
/* Total number of parameters for all elements */
BUILDEXTERN int parcount BUILDINIT(0) ;
/* Primary representation of parameters */
struct parameter {
M_WCHAR *paramname ;
int type ;
int kwlist ;
PTYPE *ptypep ;
int deftype ;
int defval ;
M_WCHAR *defstring ;
/* Next parameter for this element */
PARAMETER *next ;
/* Link for list of all parameters for all elements */
PARAMETER *nextptr ;
} ;
BUILDEXTERN PARAMETER *newpar BUILDINIT(NULL) ;
BUILDEXTERN PARAMETER *plist BUILDINIT(NULL) ;
BUILDEXTERN PARAMETER *firstpar BUILDINIT(NULL) ;
BUILDEXTERN PARAMETER **nextpar BUILDINIT(&firstpar) ;
/* Storage for parameter names */
BUILDEXTERN int pnamelen BUILDINIT(0) ;
/* Storage for parameter values that are named keywords */
BUILDEXTERN int ptypelen BUILDINIT(0) ;
struct ptype {
M_WCHAR *keyword ;
int next ;
PTYPE *nextptr ;
} ;
BUILDEXTERN PTYPE *firstptype BUILDINIT(NULL) ;
BUILDEXTERN PTYPE *thisptype ;
BUILDEXTERN PTYPE **nextptype BUILDINIT(&firstptype) ;
BUILDEXTERN int kwlen BUILDINIT(0) ;
/* Storage for parameter default values */
BUILDEXTERN int deflen BUILDINIT(0) ;
/* Characters needed for element names */
BUILDEXTERN int enamelen BUILDINIT(0) ;
/* Description of an element: */
struct eltstruct {
/* Pointer to element name */
M_WCHAR *enptr ;
/* Start state of element's content model's FSA */
STATE *model ;
/* Type of element's content (Regular expression, ANY, RCDATA, etc) */
int content ;
/* Pointer to element's inclusion list */
int inptr ;
/* Pointer to element's exclusion list */
int exptr ;
/* Pointer to element's parameter list */
PARAMETER *parptr ;
/* Index in output of first item in element's parameter list */
int parindex ;
/* Number of element's parameters */
int paramcount ;
/* Whether start- and end-tag minimization are permitted */
LOGICAL stmin, etmin ;
/* Pointer to short reference map, if any */
int srefptr ;
/* TRUE for USEMAP, FALSE for ADDMAP */
LOGICAL useoradd ;
ELTSTRUCT *next ;
int eltno ;
} ;
BUILDEXTERN ELTSTRUCT *firstelt BUILDINIT(NULL) ;
BUILDEXTERN ELTSTRUCT **nextelt BUILDINIT(&firstelt) ;
/* Most number of parameters had by a single element */
BUILDEXTERN int maxpar BUILDINIT(0) ;
/* Number of parameters current element has */
BUILDEXTERN int pcount ;
BUILDEXTERN FILE *dtd ;
BUILDEXTERN FILE *m_errfile ;
/* Line number in input file */
BUILDEXTERN int m_line BUILDINIT(1) ;
/* Options */
/* Scan trace */
BUILDEXTERN LOGICAL scantrace BUILDINIT(FALSE) ;
/* Trace calls to malloc/free */
BUILDEXTERN LOGICAL m_malftrace BUILDINIT(FALSE) ;
/* Test validity of heap in calls to malloc/free */
BUILDEXTERN LOGICAL m_heapchk BUILDINIT(FALSE) ;
/* Flag set if strictly conforming to ISO 8879 */
BUILDEXTERN LOGICAL standard BUILDINIT(FALSE) ;
/* File pointer used by utilities in ..\util\scanutil for input file */
BUILDEXTERN FILE *ifile ;
/* Element names are stored in a trie. */
BUILDEXTERN M_TRIE eltree ;
/* Count of elements */
BUILDEXTERN int ecount BUILDINIT(0) ;
/* Storage for short reference map names and definitions */
BUILDEXTERN M_TRIE maptree ;
BUILDEXTERN M_TRIE sreftree ;
BUILDEXTERN int mapcnt BUILDINIT(0) ;
BUILDEXTERN int curmap ;
struct srefstruct {
int srefcnt ;
SREFDATA *data ;
SREFSTRUCT *next ;
} ;
BUILDEXTERN SREFSTRUCT *firstsref BUILDINIT(NULL) ;
BUILDEXTERN SREFSTRUCT **nextsref BUILDINIT(&firstsref) ;
struct srefdata {
int map ;
int entidx ;
SREFDATA *next ;
} ;
BUILDEXTERN SREFDATA *thissref ;
BUILDEXTERN int sreflen BUILDINIT(0) ;
BUILDEXTERN M_WCHAR mapname[M_NAMELEN + 1] ;
BUILDEXTERN int maxsr ;
BUILDEXTERN int maxseq ;
struct mapstruct {
int map ;
M_WCHAR *mapname ;
LOGICAL defined ;
MAP *nextptr ;
} ;
BUILDEXTERN MAP *firstmap BUILDINIT(NULL) ;
BUILDEXTERN MAP **nextmap BUILDINIT(&firstmap) ;
/* Storage for entities */
BUILDEXTERN M_TRIE m_enttrie[1] ;
BUILDEXTERN M_ENTITY *entity ;
BUILDEXTERN M_ENTITY *lastent BUILDINIT(NULL) ;
BUILDEXTERN M_ENTITY *firstent BUILDINIT(NULL) ;
BUILDEXTERN M_WCHAR entcontent[M_LITLEN + 1] ;
BUILDEXTERN int entclen ;
BUILDEXTERN int m_entcnt BUILDINIT(0) ;
BUILDEXTERN FILE *entfile ;
BUILDEXTERN LOGICAL entrule BUILDINIT(FALSE) ;
BUILDEXTERN M_WCHAR genname[M_NAMELEN + sizeof(M_PREFIX)] ;
M_WCHAR *MakeWideCharString(
#if defined(M_PROTO)
const char *from
#endif
);

View File

@@ -0,0 +1,148 @@
/* $XConsortium: buildutl.c /main/3 1995/11/08 09:25:04 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Buildult.c contains the main supporting utilities for program BUILD */
#include <malloc.h>
#include "context.h"
#include "build.h"
#include "delim.h"
#include "version.h"
/* Verify that <PARAM>, <MIN> or <USEMAP> has not previously occurred in
this rule */
void found(flag, delim)
LOGICAL *flag;
char *delim;
{
M_WCHAR wcbuff[129];
size_t length;
wcbuff[128] = 0;
length = mbstowcs(wcbuff,delim,128);
if (length < 0)
{
m_error("An invalid multibyte character was seen");
wcbuff[0] = 0;
}
if (*flag)
{
m_err1("A rule can contain only one %s clause", wcbuff) ;
return ;
}
*flag = TRUE ;
}
/* Program initialization */
void initialize(M_NOPAR)
{
char **mb_delims;
M_WCHAR **wc_delims;
ifile = stdin ;
m_openchk(&m_errfile, "error", "w") ;
fprintf(stderr, "MARKUP System - BUILD %s\n", M_VERSION) ;
fprintf(stderr, "Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.\n") ;
if (! standard)
warning("Warning: optional enhancements of SGML enabled.") ;
mb_delims = mb_dlmptr;
wc_delims = m_dlmptr;
while (*mb_delims)
{
*wc_delims++ = MakeWideCharString(*mb_delims);
mb_delims++;
}
*wc_delims = 0;
ruleinit() ;
}
/* Initialization before starting a new rule */
void ruleinit(M_NOPAR)
{
/* Reinitialize for next rule */
lhs = NULL ;
nextlhs = &lhs ;
eltsinrule = 0 ;
plist = NULL ;
pcount = 0 ;
dellist(&bot.finals) ;
dellist(&bot.allfinal) ;
dellist(&bot.newfinal) ;
poccur = uoccur = moccur = FALSE ;
smin = emin = FALSE ;
srefp = 0 ;
useoradd = TRUE ;
egensuf = 1 ;
idoccur = FALSE ;
}
/* Rule end processing */
void rulend(M_NOPAR)
{
STATE *fsa ;
LOGICAL canbenull ;
LHS *lhsp ;
LHS *discard ;
int inptr ;
int exptr ;
if (contype == GRPO) fsa = startfsa(ruletree, &canbenull) ;
if (pcount > maxpar) maxpar = pcount ;
inptr = lhs->elt->inptr ;
exptr = lhs->elt->exptr ;
for (lhsp = lhs ; lhsp ; ) {
lhsp->elt->model = contype == GRPO ? fsa : (STATE *) M_NULLVAL ;
lhsp->elt->content = contype ;
lhsp->elt->inptr = inptr ;
lhsp->elt->exptr = exptr ;
if (plist) {
if (lhsp->elt->parptr)
warning1("Redefining parameter list for element %s",
lhsp->elt->enptr) ;
lhsp->elt->parptr = plist ;
lhsp->elt->paramcount = pcount ;
lhsp->elt->parindex = parcount - pcount + 1 ;
}
lhsp->elt->stmin = smin ;
lhsp->elt->etmin = emin ;
lhsp->elt->srefptr = srefp ;
lhsp->elt->useoradd = useoradd ;
discard = lhsp ;
lhsp = lhsp->next ;
m_free((M_POINTER) discard, "lhs") ;
}
if (ruletree) freetree(ruletree) ;
ruletree = NULL ;
ruleinit() ;
}
/* Skip rest of statement after an error */
void skiptoend(M_NOPAR)
{
int i ;
static errlev = 0 ;
if (! errlev++) {
curcon = ERROR ;
for (i = scan() ; ; i = scan())
if ((i == REND && ! entrule) ||
(i == TAGC && entrule) ||
i == ENDFILE) break ;
curcon = RULE ;
entrule = FALSE ;
}
errlev-- ;
ruleinit() ;
}

View File

@@ -0,0 +1,819 @@
comment
comcon:comcon {
/* $XConsortium: context.dat /main/3 1995/07/17 19:37:25 lehors $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
Context.dat defines the state transitions for program BUILD.
*/
}
;
produces
postel:content
postsref:entity
post2sref:entity2
;
except
lastm:excon
postc:excon
;
paropen
rule:firstparname
;
param
sref:pcon,
postc:pcon,
skipex:pcon,
excon:pcon,
lastm:pcon,
mcon:pcon,
postuse:pcon,
typedent:pcon {found(&poccur, param) ;}
postsref:pcon {
adddefent(thisrule);
found(&poccur, param);
}
;
shortref
rule:scon
;
usemap
pcon:ucon,
postc:ucon,
skipex:ucon,
excon:ucon,
lastm:ucon,
mcon:ucon,
default:ucon,
iddefault:ucon,
postdef:ucon,
curdef:ucon {found(&uoccur, "<USEMAP> or <ADDMAP>") ;}
;
addmap
pcon:ucon,
postc:ucon,
skipex:ucon,
excon:ucon,
lastm:ucon,
mcon:ucon,
default:ucon,
iddefault:ucon,
postdef:ucon,
curdef:ucon {
if (standard)
{
M_WCHAR *w_addmap, *w_tagc;
w_addmap = MakeWideCharString(addmap);
w_tagc = MakeWideCharString(tagc);
m_err2("%s%s not defined in the SGML standard",w_addmap,w_tagc);
m_free(w_addmap,"wide character string");
m_free(w_tagc,"wide character string");
}
else {
useoradd = FALSE;
found(&uoccur, "<USEMAP> or <ADDMAP>");
}
}
;
empty
ucon:postucon {srefp = EMPTYMAP ;}
;
entstart
rule:entdec {entrule = TRUE ;}
;
tagc
postucon:skipex
ucon:sref {
defmapname();
if (addmapname(genname, TRUE)) srefp = curmap + 1;
else m_err1("Default map name %s already in use", genname) ;
}
sconet:s2ref
parname:p2con
error:error
entval:rule,
typedec:rule,
postent:rule {entrule = FALSE ;}
;
ero
entity:entname
entity2:ent2name
;
entsystem
entity:typedent {SETETYPE(thisrule, M_SYSTEM) ;}
entity2:typed2ent {SETETYPE(mapname, M_SYSTEM) ;}
entval:typedec {entity->type = M_SYSTEM ;}
;
entst
entity:typedent {SETETYPE(thisrule, M_STARTTAG) ;}
entity2:typed2ent {SETETYPE(mapname, M_STARTTAG) ;}
entval:typedec {entity->type = M_STARTTAG ;}
mcon:mcon {smin = TRUE ;}
;
entet
entity:typedent {SETETYPE(thisrule, M_ENDTAG) ;}
entity2:typed2ent {SETETYPE(mapname, M_ENDTAG) ;}
entval:typedec {entity->type = M_ENDTAG ;}
mcon:mcon {emin = TRUE ;}
;
entmd
entity:typedent {SETETYPE(thisrule, M_MD) ;}
entity2:typed2ent {SETETYPE(mapname, M_MD) ;}
entval:typedec {entity->type = M_MD ;}
;
entpi
entity:typedent {SETETYPE(thisrule, M_PI) ;}
entity2:typed2ent {SETETYPE(mapname, M_PI) ;}
entval:typedec {entity->type = M_PI ;}
;
entsdata
entity:typedent {SETETYPE(thisrule, M_SDATA) ;}
entity2:typed2ent {SETETYPE(mapname, M_SDATA) ;}
entval:typedec {entity->type = M_SDATA ;}
;
min
pcon:mcon,
sref:mcon,
postc:mcon,
skipex:mcon,
excon:mcon,
lastm:mcon,
default:mcon,
iddefault:mcon,
postdef:mcon,
curdef:mcon,
postuse:mcon,
typedent:mcon {found(&moccur, min) ;}
postsref:mcon {
adddefent(thisrule);
found(&moccur, min);
}
;
grpo
rule:ngname
content:model {
contype = m_token;
ruletree = curtree = gettreenode();
}
model:model {
curtree->first = gettreenode();
curtree->first->parent = curtree;
curtree = curtree->first;
}
submod:model {
curtree->right = gettreenode();
curtree->right->parent = curtree->parent;
curtree = curtree->right;
}
openex:exname
type:ntname,
type2:nt2name {
newpar->type = m_token;
newpar->kwlist = M_NULLVAL;
}
;
grpc
namegroup:postel
modcon:occur2,
samecon:occur2,
occur:occur2,
occur2:occur2 {endmodel() ;}
exlist:excon
ntgroup:default
nt2group:default2
;
emi
model:neednm {
if (standard)
m_error("Explicit minimization is not provided in IS 8879");
else {
curtree->first = gettreenode();
curtree->first->parent = curtree;
curtree = curtree->first;
curtree->terminal = TRUE;
curtree->minim = TRUE;
}
}
submod:neednm2 {
if (standard)
m_error("Explicit minimization is not provided in IS 8879");
else {
curtree->right = gettreenode();
curtree->right->parent = curtree->parent;
curtree = curtree->right;
curtree->terminal = TRUE;
curtree->minim = TRUE;
}
}
;
incl
excon:openex {
lhs->elt->inptr = excount + 1;
exlist = NULL;
}
;
excl
excon:openex {
lhs->elt->exptr = excount + 1;
exlist = NULL;
}
;
psep
default:pcon
default2:p2con
iddefault:pcon
id2default:p2con
postdef:pcon
post2def:p2con
curdef:pcon
cur2def:p2con
postuse:sref
post2use:s2ref
typedent:sref
typed2ent:s2ref
postsref:sref {adddefent(thisrule) ;}
post2sref:s2ref {adddefent(mapname) ;}
;
rend
rule:rule
lastm:rule,
skipex:rule,
postc:rule,
excon:rule,
default:rule,
iddefault:rule,
postdef:rule,
curdef:rule,
error:rule,
mcon:rule,
postuse:rule,
pcon:rule,
sref:rule,
typedent:rule {rulend() ;}
postsref:rule {
adddefent(thisrule);
rulend();
}
default2:rule,
id2default:rule,
post2def:rule,
cur2def:rule {prulend() ;}
post2use:rule,
s2ref:rule,
typed2ent:rule {ruleinit() ;}
post2sref:rule {
adddefent(mapname);
ruleinit();
}
;
opt
lastm:postc,
occur:modcon,
occur2:samecon {curtree->occurrence = m_token ;}
;
plus
lastm:postc,
occur:modcon,
occur2:samecon {curtree->occurrence = m_token ;}
;
rep
lastm:postc,
occur:modcon,
occur2:samecon {curtree->occurrence = m_token ;}
;
seq
modcon:submod,
occur:submod {curtree->parent->connector = SEQ ; }
samecon:submod,
occur2:submod {
if (m_token != curtree->parent->connector)
m_error("All connectors in a submodel should be identical");
}
;
or
modcon:submod,
occur:submod {curtree->parent->connector = OR ; }
samecon:submod,
occur2:submod {
if (m_token != curtree->parent->connector)
m_error("All connectors in a submodel should be identical");
}
;
and
modcon:submod,
occur:submod {curtree->parent->connector = AND ; }
samecon:submod,
occur2:submod {
if (m_token != curtree->parent->connector)
m_error("All connectors in a submodel should be identical");
}
;
vi
curdef:defval,
cur2def:def2val {
if (standard) {
M_WCHAR *w_current;
w_current = MakeWideCharString(current);
warning1("Warning: %s initial values disallowed in ISO 8879",
w_current);
warning2(" Parameter %s for element %s",
newpar->paramname,
thisrule);
m_free(w_current,"wide character string");
}
}
;
entlit
entity:litent {
adddefent(thisrule);
entclen = 0;
}
entity2:lit2ent {
adddefent(mapname);
entclen = 0;
}
declitent:postent,
litent:postuse,
lit2ent:post2use,
edeclitent:postent,
elitent:postuse,
elit2ent:post2use {
entcontent[entclen] = M_EOS;
entity->content =
(M_WCHAR *) m_malloc(entclen + 1, "entity content");
w_strcpy(entity->content, entcontent);
entity->wheredef = M_DBUILD;
}
entval:declitent,
typedec:declitent,
typedent:litent,
typed2ent:lit2ent {entclen = 0 ;}
;
lit
litcon:litcon
default:default
default2:default2
defval:defval
def2val:def2val
sref:sref
s2ref:s2ref
;
entlita
entity:litaent {
adddefent(thisrule);
entclen = 0;
}
entity2:lita2ent {
adddefent(mapname);
entclen = 0;
}
declitaent:postent,
litaent:postuse,
lita2ent:post2use,
edclitaent:postent
elitaent:postuse
elita2ent:post2use {
entcontent[entclen] = M_EOS;
entity->content =
(M_WCHAR *) m_malloc(entclen + 1, "entity content");
w_strcpy(entity->content, entcontent);
entity->wheredef = M_DBUILD;
}
entval:declitaent,
typedec:declitaent,
typedent:litaent,
typed2ent:lita2ent {entclen = 0 ;}
;
lita
litcon:litcon
default:default
default2:default2
defval:defval
def2val:def2val
sref:sref
s2ref:s2ref
;
rnicdata
model:modcon {
curtree->first = gettreenode();
curtree->first->parent = curtree;
curtree = curtree->first;
curtree->terminal = TRUE;
curtree->value = NULL;
/* While the SGML Standard treats #CDATA as a single character
with the occurrence indicator REP (optional and repeatable), here
it is treated as a variable-length string with occurrence
indicator OPT (optional). As a result, a single error message
is issued when text occurs in an invalid context instead of
repeating the diagnostic for each character */
curtree->occurrence = OPT;
}
submod:samecon {
curtree->right = gettreenode();
curtree->right->parent = curtree->parent;
curtree = curtree->right;
curtree->terminal = TRUE;
curtree->value = NULL;
curtree->occurrence = OPT;
}
;
connor
namegroup:ngname
exlist:exname
ntgroup:ntname
nt2group:nt2name
;
connseq
namegroup:ngname
exlist:exname
ntgroup:ntname
nt2group:nt2name
;
connand
namegroup:ngname
exlist:exname
ntgroup:ntname
nt2group:nt2name
;
current
default:curdef,
default2:cur2def {
newpar->deftype = m_token;
newpar->defval = M_NULLVAL;
}
;
required
iddefault:postdef,
default:postdef,
id2default:post2def,
default2:post2def {newpar->deftype = m_token ;}
;
nulldef
default:postdef
default2:post2def
iddefault:postdef
id2default:post2def
;
any
content:postc {contype = m_token ;}
;
none
content:skipex {contype = m_token ;}
;
rcdata
content:skipex {contype = m_token ;}
;
cdata
content:skipex {contype = m_token ;}
type:default,
type2:default2 {newpar->type = m_token ;}
entity:typedent {SETETYPE(thisrule, M_CDATAENT) ;}
entity2:typed2ent {SETETYPE(mapname, M_CDATAENT) ;}
entval:typedec {entity->type = M_CDATAENT ;}
;
cro
litcon:litcon
;
litrs
litcon:litcon
;
litrsc
litcon:litcon
;
litre
litcon:litcon
;
litrec
litcon:litcon
;
littab
litcon:litcon
;
littabc
litcon:litcon
;
litspace
litcon:litcon
;
litcspace
litcon:litcon
;
refc
charent:charent
;
id
type:iddefault,
type2:id2default {
if (idoccur) m_error("Only one ID parameter allowed in a rule");
else {
idoccur = TRUE;
newpar->type = m_token;
}
}
;
idref
type:default,
type2:default2 {newpar->type = m_token ;}
;
idrefs
type:default,
type2:default2 {newpar->type = m_token ;}
;
nametype
type:default,
type2:default2 {newpar->type = m_token ;}
;
names
type:default,
type2:default2 {newpar->type = m_token ;}
;
nmtoken
type:default,
type2:default2 {newpar->type = m_token ;}
;
nmtokens
type:default,
type2:default2 {newpar->type = m_token ;}
;
number
type:default,
type2:default2 {newpar->type = m_token ;}
;
numbers
type:default,
type2:default2 {newpar->type = m_token ;}
;
nutoken
type:default,
type2:default2 {newpar->type = m_token ;}
;
nutokens
type:default,
type2:default2 {newpar->type = m_token ;}
;
entatt
type:default,
type2:default2 {newpar->type = m_token ;}
;
endfile
curdef:rule,
default:rule,
iddefault:rule,
excon:rule,
lastm:rule,
postc:rule,
postdef:rule,
skipex:rule,
mcon:rule,
postuse:rule,
typedent:rule {
rulend() ;
done();
}
postsref:rule {
adddefent(thisrule);
rulend();
done();
}
cur2def:rule,
default2:rule,
id2default:rule,
post2def:rule {prulend() ; done() ;}
rule:rule,
post2use:rule,
post2sref:rule,
typed2ent:rule {done() ;}
;
name
default:postdef,
default2:post2def {
newpar->deftype = NAME;
setdefault(name);
}
defval:postdef,
def2val:post2def {setdefault(name) ;}
exname:exlist {addex() ;}
model:occur {
curtree->first = gettreenode();
curtree->first->parent = curtree;
curtree = curtree->first;
curtree->terminal = TRUE;
curtree->value = ntrelt(name);
}
submod:occur2 {
curtree->right = gettreenode();
curtree->right->parent = curtree->parent;
curtree = curtree->right;
curtree->terminal = TRUE;
curtree->value = ntrelt(name);
}
neednm:occur,
neednm2:occur2
{curtree->value = ntrelt(name) ;}
ngname:namegroup {savelhs(FALSE) ;}
nt2name:nt2group,
ntname:ntgroup {addkeyword() ;}
pcon:type,
p2con:type2 {addpar() ;}
rule:postel {savelhs(FALSE) ;}
ucon:postucon {
addmapname(name, FALSE);
srefp = curmap + 1;
}
entname:postuse,
ent2name:post2use {addndent(name) ;}
firstparname:parname,
parname:parname {savelhs(TRUE) ;}
scon:sconet {
if (! addmapname(name, TRUE))
m_err1("Map name %s already in use", name);
else w_strcpy(mapname, name);
}
entdec:entval {
if (! addent(name))
m_err1("Entity %s already defined", name);
}
;
literal
default:postdef,
default2:post2def {
newpar->deftype = NAME;
setdefault(literal);
}
defval:postdef,
def2val:post2def {setdefault(literal) ;}
sref:postsref,
s2ref:post2sref {addsref(literal) ;}
;
text
declitent:declitent {
if (entclen >= M_LITLEN) {
curcon = EDECLITENT;
m_error("Entity content too long");
}
else entcontent[entclen++] = scanval;
}
declitaent:declitaent {
if (entclen >= M_LITLEN) {
curcon = EDCLITAENT;
m_error("Entity content too long");
}
else entcontent[entclen++] = scanval;
}
litent:litent {
if (entclen >= M_LITLEN) {
curcon = ELITENT;
m_error("Entity content too long");
}
else entcontent[entclen++] = scanval;
}
lit2ent:lit2ent {
if (entclen >= M_LITLEN) {
curcon = ELIT2ENT;
m_error("Entity content too long");
}
else entcontent[entclen++] = scanval;
}
litaent:litaent {
if (entclen >= M_LITLEN) {
curcon = ELITAENT;
m_error("Entity content too long");
}
else entcontent[entclen++] = scanval;
}
lita2ent:lita2ent {
if (entclen >= M_LITLEN) {
curcon = ELITA2ENT;
m_error("Entity content too long");
}
else entcontent[entclen++] = scanval;
}
edeclitent:edeclitent
edclitaent:edclitaent
elitent:elitent
elit2ent:elit2ent
elitaent:elitaent
elita2ent:elita2ent
;

View File

@@ -0,0 +1,45 @@
/* $XConsortium: eltree.c /main/3 1995/11/08 09:25:13 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Eltree.c contains procedures that manipulate element names */
#include <string.h>
#include <malloc.h>
#include "build.h"
/* Enters an element name into the element name tree */
ELTSTRUCT *ntrelt(p)
M_WCHAR *p ;
{
ELTSTRUCT *new ;
ELTSTRUCT *old ;
int length ;
new = (ELTSTRUCT *) m_malloc(sizeof(ELTSTRUCT), "element structure") ;
if (old = (ELTSTRUCT *) m_ntrtrie(p, &eltree, (M_TRIE *) new)) {
m_free((M_POINTER) new, "element structure") ;
return(old) ;
}
*nextelt = new ;
nextelt = &new->next ;
new->eltno = ++ecount ;
length = w_strlen(p) + 1 ;
enamelen += length ;
new->enptr = (M_WCHAR *) m_malloc(length, "element name") ;
w_strcpy(new->enptr, p) ;
new->model = M_NULLVAL ;
new->content = M_NULLVAL ;
new->inptr = new->exptr = NULL ;
new->parptr = NULL ;
new->parindex = M_NULLVAL ;
new->paramcount = M_NULLVAL ;
new->stmin = new->etmin = FALSE ;
new->srefptr = M_NULLVAL ;
new->useoradd = TRUE ;
new->next = NULL ;
return(new) ;
}

View File

@@ -0,0 +1,23 @@
/* $XConsortium: except.c /main/3 1995/11/08 09:25:25 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Except.c contains procedures related to exceptions for program BUILD */
#include "build.h"
/* Add an exception (inclusion or exclusion) for the current element */
void addex(M_NOPAR)
{
excount++ ;
*nextex = (EXCEPTION *) m_malloc(sizeof(EXCEPTION), "exception") ;
if (exlist) exlist->next = *nextex ;
exlist = *nextex ;
(*nextex)->next = NULL ;
(*nextex)->nextptr = NULL ;
(*nextex)->element = ntrelt(name)->eltno ;
nextex = &(*nextex)->nextptr ;
}

View File

@@ -0,0 +1,734 @@
/* $XConsortium: fsa.c /main/3 1995/11/08 09:25:38 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Fsa.c contains the procedures used by program BUILD to convert a tree
representation of a content model to an FSA */
#include <malloc.h>
#include "build.h"
#include "context.h"
#include "delim.h"
/* Addarc adds an arc from FSA state <from> to state <to> setting other
fields as indicated by the other parameters.*/
#if defined(M_PROTO)
int addarc(STATE *from, STATE *to, ELTSTRUCT *label, ANDGROUP *and, LOGICAL optional, int id, LOGICAL minim, ELTSTRUCT **errelt)
#else
int addarc(from, to, label, and, optional, id, minim, errelt)
STATE *from, *to ;
ELTSTRUCT *label ;
ANDGROUP *and ;
LOGICAL optional ;
int id ;
LOGICAL minim ;
ELTSTRUCT **errelt ;
#endif
{
ARC *parc, *qarc ;
int determ ;
determ = checkdfsa(from, label, and, id, errelt) ;
parc = from->first ;
qarc = (ARC *) m_malloc(sizeof(ARC), "arc") ;
from->first = qarc ;
qarc->label = label ;
qarc->optional = optional ;
qarc->minim = minim ;
qarc->group = and ;
qarc->to = to ;
qarc->next = parc ;
qarc->id = id ;
return(determ) ;
}
/*checkand is used to verify nondeterminism from start and final states
of FSA's generated from and groups*/
void checkand(andstart, andptr, start, root, errelt)
ANDGROUP *andstart, *andptr ;
STATE *start ;
TREE *root ;
ELTSTRUCT **errelt ;
{
ARC *parc ;
ANDGROUP *pand ;
int c ;
for (parc = start->first ; parc ; parc = parc->next) {
if (parc->group) {
if (parc->group != andstart)
for (pand = parc->group ; pand ; pand = pand->next)
checkand(andstart, andptr, pand->start, root, errelt) ;
}
else if (c = checkdfsa(andptr->start,
parc->label,
parc->group,
parc->id,
errelt))
nondeterm(root, c, *errelt) ;
}
}
/*Checkdfsa is called when adding an arc to an FSA in order to verify that
no existing arc from the same state (or from a start state of an and-group
FSA labelling an arc from the same state) has the same label. */
int checkdfsa(from, label, and, id, errelt)
STATE *from ;
ELTSTRUCT *label ;
ANDGROUP *and ;
int id ;
ELTSTRUCT **errelt ;
{
int c ;
ARC *parc ;
ANDGROUP *group ;
for (parc = from->first ; parc ; parc = parc->next) {
if (parc->group) {
if (and == parc->group) return(ANDCONFLICT) ;
for (group = parc->group ; group ; group = group->next)
if (c = checkdfsa(group->start, label, and, id, errelt))
return(c) ;
}
else if (! and && label == parc->label && parc->id != id) {
if (label) {
*errelt = label ;
return(ELTCONFLICT) ;
}
return(DATACONFLICT) ;
}
}
return(FALSE) ;
}
/* Check use of repeated models with and groups */
int checkrepeat(from, and, errelt)
STATE *from ;
ANDGROUP *and ;
ELTSTRUCT **errelt ;
{
ARC *parc ;
int c ;
for (; and ; and = and->next)
for (parc = and->start->first ; parc ; parc = parc->next) {
if (parc->group)
if (c = checkrepeat(from, parc->group, errelt)) return(c) ;
else ;
else
if (c = checkdfsa(from,
parc->label,
M_NULLVAL,
parc->id,
errelt))
return(c) ;
else ;
}
return(FALSE) ;
}
/* Copyintolist copies one list of states into another */
void copyintolist(from, to)
STATELIST *from, **to ;
{
STATELIST **new, *old ;
old = *to ;
new = to ;
for ( ; from ; from = from->next) {
if (notinlist(from, old)) {
*new = (STATELIST *) m_malloc(sizeof(STATELIST), "state list") ;
(*new)->value = from->value ;
(*new)->level = from->level ;
new = &(*new)->next ;
}
}
*new = old ;
}
/* Dellist deletes a list of states */
void dellist(list)
STATELIST **list ;
{
STATELIST *p, *q ;
for (p = *list ; p ; ) {
q = p ;
p = p->next ;
m_free(q, "state list") ;
}
*list = NULL ;
}
/* Delstartarcs deletes the contents of the starta list of arcs from start
states of a submodel */
void delstartarcs(M_NOPAR)
{
ARC *arcptr ;
ARC *discard ;
for (arcptr = top->starta ; arcptr ; ) {
discard = arcptr ;
arcptr = arcptr->next ;
m_free(discard, "arc") ;
}
top->starta = NULL ;
}
/* Getand allocates and initializes a new andgroup structure */
ANDGROUP *getand(M_NOPAR)
{
ANDGROUP *new ;
new = (ANDGROUP *) m_malloc(sizeof(ANDGROUP), "and group") ;
new->nextptr = new->next = NULL ;
new->count = ++andused ;
*nextand = new ;
nextand = &new->nextptr ;
return(new) ;
}
/* Getstate obtains an FSA state */
STATE *getstate(M_NOPAR)
{
STATE *new ;
new = (STATE *) m_malloc(sizeof(STATE), "state") ;
new->final = FALSE ;
new->datacontent = FALSE ;
new->frompcdata = FALSE ;
new->first = NULL ;
new->count = ++stateused ;
new->next = NULL ;
*nextstate = new ;
nextstate = &new->next ;
return(new) ;
}
/* Makeand processes a submodel whose connector is & */
void makeand(canbenull, root, optional)
LOGICAL *canbenull ;
TREE *root ;
int optional ;
{
TREE *child ;
STATELIST *start, *final ;
LOGICAL groupbenull ;
ANDGROUP *andptr, *saveand, *otherand ;
STATELIST *index ;
ELTSTRUCT *errelt ;
for (child = root->first ; child ; child = child->right) {
if (child == root->first) {
*canbenull = TRUE ;
andptr = getand() ;
saveand = andptr ;
push() ;
copyintolist(top->oldtop->allfinal, &top->allfinal) ;
}
else {
andptr->next = getand() ;
andptr = andptr->next ;
}
andptr->start = startfsa(child, &groupbenull) ;
if (andptr->start->datacontent)
for (index = top->oldtop->starts ; index ; index = index->next)
index->value->datacontent = TRUE ;
if (! groupbenull) *canbenull = FALSE ;
/* Check for ambiguity between start state of branch just completed
and start state of the and-group (i.e., parent of branch just
completed) */
for (start = top->oldtop->starts ; start ; start = start->next)
checkand(saveand, andptr, start->value, root, &errelt) ;
/* Check for ambiguity between start state of branch just completed
and final states of previous branches */
for (final = top->allfinal ; final ; final = final->next)
checkand(saveand, andptr, final->value, root, &errelt) ;
copyintolist(top->finals, &top->allfinal) ;
copyintolist(top->newfinal, &top->allfinal) ;
copyintolist(top->finals, &top->oldtop->newfinal) ;
copyintolist(top->newfinal, &top->oldtop->newfinal) ;
dellist(&top->finals) ;
dellist(&top->newfinal) ;
/* Check for ambiguity between start states of branch just completed
and start states of previous branches */
for (otherand = saveand ; otherand != andptr ;
otherand = otherand->next)
checkand(saveand, andptr, otherand->start, root, &errelt) ;
}
pop() ;
if (*canbenull) optional = stacklevels + 1 ;
simplebranch(root, M_NULLVAL, saveand, optional) ;
if (*canbenull) copyintolist(top->starts, &top->finals) ;
for (final = top->finals ; final ; final = final->next)
final->level = stacklevels ;
}
/* Makefsa builds the portion of an FSA that corresponds to an entire
submodel (i.e., a subtree of the tree representation of the rule).
The value returned indicates whether the submodel can be null (i.e.,
whether all its elements are optional). The parameters are a pointer
to the root of the subtree and an integer indicating the level of
nesting (if any) of submodels at which the subtree became optional.
Note that as used here, "optional" means "not contextually required" in
the terminology of the Standard rather than "contextually optional".
Makefsa is a recursive procedure. As the FSA is built, a stack is
maintained of the nested content models that have been encountered
but not yet terminated. For each open model on the stack, starts is
a list of its start states (i.e., FSA states from which transitions
correspond to elements which can occur at the beginning of the rule
being processed), finals is a list of its final states, starta is a
list of arcs emanating from the start states of the model, and
allfinal and newfinal are lists of final states used in checking for
determinism when and-groups are used. In more detail, allfinal is a
list of final states of FSA's in and-groups that may occur just prior
to the current context; i.e., 1) when starting a new FSA in an and-group,
the set of final states of already-constructed FSA's in the same group
(or final states of FSA's in submodel and-groups that end such FSA's)
or 2) the set of final states of FSA's in an and-group that precedes
the current context (e.g., the final states of the and-group FSA's
when processing 'x' in ((a&b),x)). At each stage in the parse (or level
on the stack), newfinal is the set of states to be added to those in
allfinal as a result of processing at that level. Information in
allfinal is passed from model to submodel; information in newfinal
goes from submodel to model.
*/
LOGICAL makefsa(root, optional)
TREE *root ;
int optional ;
{
LOGICAL canbenull ;
canbenull = FALSE ;
if (root->occurrence == OPT || root->occurrence == REP)
optional = stacklevels + 1 ;
/* The branch consists of a single element name */
if (root->terminal)
simplebranch(root, root->value, M_NULLVAL, optional) ;
/* The submodel's connector is SEQ (,) */
else if (root->connector == SEQ)
makeseq(&canbenull, root, optional) ;
/* The submodel's connector is OR (|) */
else if (root->connector == OR)
makeor(&canbenull, root) ;
/* The submodel's connector is AND (&) */
else if (root->connector == AND)
makeand(&canbenull, root, optional) ;
/* The submodel is a single item in parentheses */
else canbenull = makefsa(root->first, optional) ;
/* The FSA is built, now repeat if occurrence indicator so indicates */
if (root->occurrence == OPT || root->occurrence == REP) canbenull = TRUE ;
if (root->occurrence == OPT) copyintolist(top->starts, &top->finals) ;
else if (root->occurrence == REP) {
repeat(root) ;
copyintolist(top->starts, &top->finals) ;
}
else if (root->occurrence == PLUS) repeat(root) ;
return(canbenull) ;
}
/* Makeor processes a submodel whose connector is | */
void makeor(canbenull, root)
LOGICAL *canbenull ;
TREE *root ;
{
TREE *child ;
STATELIST *final ;
push() ;
copyintolist(top->oldtop->starts, &top->starts) ;
copyintolist(top->oldtop->allfinal, &top->allfinal) ;
for (child = root->first ; child ; child = child->right) {
if (makefsa(child, stacklevels)) *canbenull = TRUE ;
savestartarcs() ;
delstartarcs() ;
copyintolist(top->finals, &top->oldtop->finals ) ;
dellist(&top->finals) ;
}
copyintolist(top->newfinal, &top->oldtop->newfinal) ;
pop() ;
for (final = top->finals ; final ; final = final->next)
final->level = stacklevels ;
}
/* Makeseq processes a submodel whose connector is , */
void makeseq(canbenull, root, optional)
LOGICAL *canbenull ;
TREE *root ;
int optional ;
{
LOGICAL branchnull ;
STATELIST *keepfinal = NULL, *final ;
TREE *child ;
push() ;
*canbenull = TRUE ;
copyintolist(top->oldtop->starts, &top->starts) ;
copyintolist(top->oldtop->allfinal, &top->allfinal) ;
for (child = root->first ; child ; child = child->right) {
branchnull = makefsa(child, optional) ;
if (*canbenull) savestartarcs() ;
if (! branchnull) {
*canbenull = FALSE ;
dellist(&top->allfinal) ;
dellist(&keepfinal) ;
}
copyintolist(top->newfinal, &top->allfinal) ;
copyintolist(top->newfinal, &keepfinal) ;
dellist(&top->newfinal) ;
delstartarcs() ;
dellist(&top->starts) ;
copyintolist(top->finals, &top->starts) ;
dellist(&top->finals) ;
if (! child->occurrence || child->occurrence == PLUS)
optional = FALSE ;
}
copyintolist(top->starts, &top->oldtop->finals) ;
copyintolist(keepfinal, &top->oldtop->newfinal) ;
dellist(&keepfinal) ;
pop() ;
for (final = top->finals ; final ; final = final->next)
final->level = stacklevels ;
}
/* Nondeterm issues a diagnostic when a nondeterministic model is
encountered */
void nondeterm(root, c, eltp)
TREE *root ;
int c ;
ELTSTRUCT *eltp ;
{
M_WCHAR *wtemp;
switch (c) {
case ANDCONFLICT:
wtemp = MakeWideCharString(and);
warning2("Error in model for %s: Conflict in use of '%s'",
thisrule,
wtemp) ;
m_free(wtemp, "wide character string");
break ;
case DATACONFLICT:
wtemp = MakeWideCharString(rnicdata);
warning2("Error in model for %s: Conflict in use of '%s'",
thisrule,
wtemp) ;
m_free(wtemp, "wide character string");
break ;
case ELTCONFLICT:
warning2("Error in model for %s: Conflict in use of '%s'",
thisrule,
eltp->enptr) ;
break ;
}
regenerate(ruletree, root) ;
msgline(" . . .\n") ;
}
/* Notinlist returns TRUE iff item is not in list. If item is in list,
it makes sure that the stored nesting level is the smaller of the two */
LOGICAL notinlist(item, list)
STATELIST *item, *list ;
{
for ( ; list ; list = list->next)
if (list->value == item->value) {
if (item->level < list->level) list->level = item->level ;
return(FALSE) ;
}
return(TRUE) ;
}
/* Returns true if the arc is labeled #PCDATA or with an and-group that
has an arc labelled #PCDATA from a start state */
LOGICAL permitspcd(a)
ARC *a ;
{
ANDGROUP *pand ;
ARC *b ;
if (a->group) {
for (pand = a->group ; pand ; pand = pand->next)
for (b = pand->start->first ;
b ;
b = b->next)
if (permitspcd(b)) return(TRUE) ;
return(FALSE) ;
}
/* Not an and-group */
if (a->label) return(FALSE) ;
return(TRUE) ;
}
/* Pop pops the submodel stack when the end of the current submodel is
encountered */
void pop(M_NOPAR)
{
STACK *discard ;
dellist(&top->starts) ;
dellist(&top->finals) ;
dellist(&top->allfinal) ;
dellist(&top->newfinal) ;
delstartarcs() ;
stacklevels-- ;
discard = top ;
top = top->oldtop ;
m_free((M_POINTER) discard, "stack entry") ;
}
/* Push pushes the submodel stack when a new group is encountered */
void push(M_NOPAR)
{
STACK *new ;
new = (STACK *) m_malloc(sizeof(STACK), "stack entry") ;
new->oldtop = top ;
top = new ;
stacklevels++ ;
top->starts = top->finals = top->newfinal = top->allfinal = NULL ;
top->starta = M_NULLVAL ;
}
/* Regenerate is used in error processing to print the portion of a grammar
rule preceding an error */
LOGICAL regenerate(start, stop)
TREE *start, *stop ;
{
TREE *child ;
if (start == stop) return(TRUE) ;
if (start->terminal)
{
char *mb_enptr;
if (start->value)
mb_enptr = MakeMByteString(start->value->enptr);
else
mb_enptr = NULL;
msg1line("%s", mb_enptr ? mb_enptr : rnicdata) ;
if (mb_enptr)
m_free(mb_enptr,"multi-byte string");
}
else
{
msgline("(") ;
for (child = start->first ; child ; child = child->right)
{
if (regenerate(child, stop)) return(TRUE) ;
if (child->right)
{
if (start->connector == SEQ) msg1line("%s", seq) ;
if (start->connector == OR) msg1line("%s", or) ;
if (start->connector == AND) msg1line("%s", and) ;
}
}
msgline(")") ;
}
if (start->occurrence == OPT) msg1line("%s", opt) ;
if (start->occurrence == PLUS) msg1line("%s", plus) ;
if (start->occurrence == REP) msg1line("%s", rep) ;
return(FALSE) ;
}
/* Repeat is called after a partial FSA is built for a submodel whose
occurrence indicator is RPT (*) or PLUS (+). It handles repetition
by adding arcs from all the final states to all the states reachable
in one transition from a start state, labelling them as arcs from
start states are labelled. */
void repeat(root)
TREE *root ;
{
STATELIST *final ;
ARC *a ;
int c ;
ELTSTRUCT *errelt ;
M_WCHAR *wtemp;
copyintolist(top->newfinal, &top->allfinal) ;
dellist(&top->newfinal) ;
for (a = top->starta ; a ; a = a->next) {
for (final = top->allfinal ; final ; final = final->next) {
if (a->group)
if (c = checkrepeat(final->value, a->group, &errelt)) {
wtemp = MakeWideCharString(root->occurrence == PLUS ? plus : rep);
warning1("Conflict in use of %s", wtemp);
m_free(wtemp, "wide character string");
nondeterm(root, c, errelt) ;
}
else
;
else
if (c = checkdfsa(final->value,
a->label,
a->group,
a->id,
&errelt))
nondeterm (root, c, errelt) ;
else
;
}
for (final = top->finals ; final ; final = final->next) {
if (samelabelarc(a, final->value)) continue ;
if (a->group)
if (c = checkrepeat(final->value, a->group, &errelt))
nondeterm(root, c, errelt) ;
if (a->label ||
a->group ||
! final->value->frompcdata) {
if (c = addarc(final->value, a->to, a->label,
a->group, TRUE, a->id,
a->minim, &errelt))
nondeterm(root, c, errelt) ;
if (permitspcd(a)) final->value->datacontent = TRUE ;
}
}
}
}
/* Used during processing of occurrence indicators in content models such
as (a+)+ to prohibit duplicate arcs */
LOGICAL samelabelarc(a, s)
ARC *a ;
STATE *s ;
{
ARC *b ;
for (b = s->first ; b ; b = b->next)
if (b->id == a->id) return(TRUE) ;
return(FALSE) ;
}
/* Saves the name of an element appearing on the left-hand side of a
grammar rule */
#if defined(M_PROTO)
void savelhs(LOGICAL param)
#else
void savelhs(param)
LOGICAL param ;
#endif
{
STATE *end ;
ELTSTRUCT *errelt ;
ELTSTRUCT *thiselt ;
*nextlhs = (LHS *) m_malloc(sizeof(LHS), "lhs") ;
(*nextlhs)->next = NULL ;
thiselt = ntrelt(name) ;
(*nextlhs)->elt = thiselt ;
nextlhs = &(*nextlhs)->next ;
if (! startstate) {
startstate = getstate() ;
end = getstate() ;
addarc(startstate, end, thiselt, M_NULLVAL, FALSE, 1, FALSE, &errelt) ;
end->final = TRUE ;
}
if (param && thiselt->parptr) {
m_err1("Parameters for %s already defined", thiselt->enptr) ;
return ;
}
if (! param && thiselt->model)
warning1("Duplicate model for element %s", thiselt->enptr) ;
}
/* Called when arcs are added to the start state of a submodel that is
also a start state of the parent model to set the parent model's
starta list */
void savestartarcs(M_NOPAR)
{
ARC *carcptr, *parcptr ;
for (carcptr = top->starta ; carcptr ; carcptr = carcptr->next) {
parcptr = (ARC *) m_malloc(sizeof(ARC), "arc") ;
parcptr->label = carcptr->label ;
parcptr->optional = carcptr->optional ;
parcptr->minim = carcptr->minim ;
parcptr->group = carcptr->group ;
parcptr->to = carcptr->to ;
parcptr->next = top->oldtop->starta ;
parcptr->id = carcptr->id ;
top->oldtop->starta = parcptr ;
}
}
/* Simplebranch adds a new state and transition to it in an FSA when a
submodel consists of a single element or of an and group */
void simplebranch(root, value, group, optional)
TREE *root ;
ELTSTRUCT *value ;
ANDGROUP *group ;
int optional ;
{
STATE *new = NULL ;
STATELIST *index ;
int c ;
ELTSTRUCT *errelt ;
/* Check for ambiguity between an arc to be added and arcs from final
states of and-groups that terminate at the start state of the new
arc */
for (index = top->allfinal ; index ; index = index->next)
if (c = checkdfsa(index->value, value, group, root->eltid, &errelt))
nondeterm(root, c, errelt) ;
for (index = top->starts ; index ; index = index->next) {
if (! group && ! value && index->value->frompcdata)
continue ;
if (! new) {
new = getstate() ;
new->frompcdata = (LOGICAL) (! group && ! value) ;
}
c = addarc(index->value, new, value, group,
(LOGICAL) (optional > index->level),
root->eltid, root->minim, &errelt) ;
if (c) nondeterm(root, c, errelt) ;
if (! group && ! value) index->value->datacontent = TRUE ;
}
if (new) {
top->finals = (STATELIST *) m_malloc(sizeof(STATELIST), "state list") ;
top->finals->value = new ;
top->finals->level = stacklevels ;
top->finals->next = NULL ;
top->starta = (ARC *) m_malloc(sizeof(ARC), "arc") ;
top->starta->label = value ;
top->starta->optional = FALSE ;
top->starta->minim = root->minim ;
top->starta->group = group ;
top->starta->to = new ;
top->starta->next = NULL ;
top->starta->id = root->eltid ;
}
else copyintolist(top->starts, &top->finals) ;
}
/* Startfsa creates a new FSA. It is called once for each content model and
once for each and group. Its parameters are the root of the
subtree in the tree representing the grammar rule being processed and
the pointer to a flag that is set to indicate whether or not the
submodel can be null. */
STATE *startfsa(root, canbenull)
TREE *root ;
LOGICAL *canbenull ;
{
STATELIST *item ;
STATE *first ;
top->starts = (STATELIST *) m_malloc(sizeof(STATELIST), "state list") ;
first = getstate() ;
top->starts->value = first ;
top->starts->level = stacklevels ;
top->starts->next = NULL ;
*canbenull = makefsa(root, FALSE) ;
for (item = top->finals ; item ; item = item->next)
item->value->final = TRUE ;
dellist(&top->starts) ;
delstartarcs() ;
return(first) ;
}

View File

@@ -0,0 +1,649 @@
/* $XConsortium: out.c /main/3 1995/11/08 09:25:54 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Out.c contains the procedures used by program BUILD to output results */
#include <string.h>
#include <malloc.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "context.h"
#include "build.h"
#include "delim.h"
#include "entdef.h"
#define boolean(x) x ? "TRUE" : "FALSE"
/* Macro names written to dtd.h */
char many[] = "M_ANY" ;
char mcdata[] = "M_CDATA" ;
char mcdataent[] = "CDATAENT" ;
char mcdata_att[] = "M_CDATT" ;
char mcurrent[] = "M_CURRENT" ;
char mentatt[] = "M_ENTATT" ;
char merror[] = "M_ERROR" ;
char mgeneral[] = "" ;
char midrefs[] = "M_IDRFS" ;
char midref[] = "M_IDRF" ;
char mid[] = "M_ID" ;
char mkeyword[] = "M_KEYWORD" ;
char mnamedef[] = "M_NAMEDEF" ;
char mnamepar[] = "M_NAMEPAR" ;
char mnames[] = "M_NAMES" ;
char mnmtkns[] = "M_NMSTOKEN" ;
char mnmtoken[] = "M_NMTOKEN" ;
char mnone[] = "M_NONE" ;
char mnulldef[] = "M_NULLDEF" ;
char mnumbers[] = "M_NUMS" ;
char mnumber[] = "M_NUMBER" ;
char mnutkns[] = "M_NUSTOKEN" ;
char mnutoken[] = "M_NUTOKEN" ;
char mrcdata[] = "M_RCDATA" ;
char mregexp[] = "M_REGEXP" ;
char mrequired[] = "M_REQUIRED" ;
/* Deftype returns a string indicating the default type of the nth parameter.
*/
char *deftype(n)
int n ;
{
switch (n) {
case NAME: return(mnamedef) ;
case CURRENT: return(mcurrent) ;
case REQUIRED: return(mrequired) ;
case NULLDEF: return(mnulldef) ;
default:
errexit = ERREXIT ;
return(merror) ;
}
}
/* Called after all input is read to generate output */
void done(M_NOPAR)
{
if (! eltree.data) {
warning("Error: no elements specified") ;
return ;
}
eltreeout() ;
parout() ;
srefout() ;
entout("entity") ;
fsa() ;
exout() ;
template() ;
}
/* Prints data value of an entry in the element name tree */
void dumpentnode(file, value)
FILE *file ;
M_TRIE *value ;
{
fprintf(file, ", %d", ((ELTSTRUCT *) value)->eltno) ;
}
/* Prints data value of an entry in the trie of short reference map names,
reporting any maps that are referenced but not defined */
void dumpmapnode(file, value)
FILE *file ;
M_TRIE *value ;
{
fprintf(file, ", %d", ((MAP *) value)->map) ;
if (! ((MAP *) value)->defined)
warning1("Short reference map \"%s\" referenced but not defined.",
((MAP *) value)->mapname) ;
}
/* Prints data value of an entry in the trie of short reference delimiters */
void dumpsrefnode(file, value)
FILE *file ;
M_TRIE *value ;
{
fprintf(file, ", %d", ((SREFSTRUCT *) value)->srefcnt) ;
}
/* Controls printing of element blocks in alphabetical order to the
template file */
void eltblocks(tempfile)
FILE *tempfile ;
{
int n ;
M_TRIE *node[M_NAMELEN + 1] ;
M_TRIE *current ;
char symbol ;
n = 0 ;
current = eltree.data ;
while (TRUE) {
symbol = current->symbol ;
node[n] = current->next ;
if (! symbol) {
tempelt((ELTSTRUCT *) current->data, tempfile) ;
current = current->next ;
while (! current) {
n-- ;
if (n < 0) return ;
current = node[n] ;
}
}
else {
current = current->data ;
n++ ;
}
}
}
/* Writes data about elements */
void eltreeout(M_NOPAR)
{
M_WCHAR *p ;
int enameindex = 0 ;
ELTSTRUCT *eltp ;
LOGICAL first ;
m_openchk(&dtd, "dtd.h", "w") ;
fputs("#if defined(M_DTDDEF)\n", dtd) ;
fputs("#define M_DTDEXTERN\n", dtd) ;
fputs("#define M_DTDINIT(a) = a\n", dtd) ;
fputs("#else\n", dtd) ;
fputs("#define M_DTDEXTERN extern\n", dtd) ;
fputs("#define M_DTDINIT(a)\n", dtd) ;
fputs("#endif\n\n", dtd) ;
fputs("#include \"dtddef.h\"\n\n", dtd) ;
dumpptrie(&eltree, "m_entree", dtd, "M_DTDEXTERN", "M_DTDDEF",
dumpentnode) ;
fprintf(dtd, "M_DTDEXTERN M_WCHAR m_ename[%d]\n", enamelen) ;
fputs("#if defined(M_DTDDEF)\n = {\n", dtd) ;
first = TRUE ;
for (eltp = firstelt ; eltp ; eltp = eltp->next) {
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
for (p = eltp->enptr ; *p ; p++)
fprintf(dtd, " %d,\n", *p) ;
fputs(" 0", dtd) ;
}
fputs(ndif, dtd) ;
fprintf(dtd, "M_DTDEXTERN int m_elcount M_DTDINIT(%d) ;\n", ecount) ;
fprintf(dtd,
"M_DTDEXTERN M_ELTSTRUCT m_element[%d]\n#if defined(M_DTDDEF)\n = {\n",
ecount) ;
first = TRUE ;
for (eltp = firstelt ; eltp ; eltp = eltp->next) {
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
if (! eltp->content)
warning1("No content model for element %s", eltp->enptr) ;
fprintf(dtd, " %d, %d, %s, ",
enameindex, eltp->model ? eltp->model->count : 0,
typecon(eltp->content)) ;
fprintf(dtd, "%d, %d, ", eltp->inptr, eltp->exptr) ;
fprintf(dtd, "%d, %d, %d",
eltp->parindex, eltp->paramcount, eltp->srefptr) ;
enameindex += w_strlen(eltp->enptr) + 1 ;
fprintf(dtd, ", %s, %s, %s",
boolean(eltp->stmin), boolean(eltp->etmin), boolean(eltp->useoradd)) ;
}
fputs(ndif, dtd) ;
}
/* Enttype returns a string indicating the type of an entity */
char *enttype(n)
int n ;
{
switch(n) {
case M_GENERAL: return(mgeneral) ;
case M_SYSTEM: return(entsystem) ;
case M_STARTTAG: return(entst) ;
case M_ENDTAG: return(entet) ;
case M_MD: return(entmd) ;
case M_PI: return(entpi) ;
case M_CDATAENT: return(cdata) ;
case M_SDATA: return(entsdata) ;
default:
errexit = ERREXIT ;
return(merror) ;
}
}
/* Outputs exception lists */
void exout(M_NOPAR)
{
EXCEPTION *ex ;
int exindex = 0 ;
LOGICAL first = TRUE ;
fputs("M_DTDEXTERN M_EXCEPTION m_exception", dtd) ;
if (excount) {
fprintf(dtd,
"[%d]\n#if defined(M_DTDDEF)\n = {\n",
excount) ;
for (ex = firstex ; ex ; ex = ex->nextptr) {
if (! first) fputs(",\n", dtd) ;
first = FALSE ;
exindex++ ;
fprintf(dtd, " %d, %d", ex->element, ex->next ? exindex + 1 : 0) ;
}
fputs(ndif, dtd) ;
}
SUBONE
}
/* Outputs FSA definitions */
void fsa(M_NOPAR)
{
int arcount = 0 ;
STATE *pstate ;
FILE *farc ;
LOGICAL first ;
ANDGROUP *pand ;
ARC *parc ;
m_openchk(&farc, "arc.h", "w") ;
fprintf(dtd,
"M_DTDEXTERN M_STATESTRUCT m_state[%d]\n#if defined(M_DTDDEF)\n = {\n",
stateused) ;
for (pstate = firststate ; pstate ; pstate = pstate->next)
for (parc = pstate->first ; parc ; parc = parc->next)
++arcount ;
fprintf(farc,
"M_DTDEXTERN M_ARCSTRUCT m_arc[%d]\n#if defined(M_DTDDEF)\n = {\n",
arcount) ;
arcount = 0 ;
first = TRUE ;
for (pstate = firststate ; pstate ; pstate = pstate->next) {
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
fprintf(dtd, " %s, %s, %d",
boolean(pstate->final), boolean(pstate->datacontent),
pstate->first ? ++arcount : 0) ;
for (parc = pstate->first ; parc ; parc = parc->next) {
if (arcount > 1) fputs(",\n", farc) ;
fprintf(farc, " %d, %s, %d, %d, %d, %d",
parc->label ? parc->label->eltno : 0,
boolean(parc->optional),
parc->minim ? parc->id : 0,
parc->group ? parc->group->count : 0,
parc->to->count,
parc->next ? ++arcount : 0
) ;
}
}
fputs(ndif, dtd) ;
fputs(ndif, farc) ;
fputs("M_DTDEXTERN M_ANDSTRUCT m_andgroup", dtd) ;
if (andused) {
fprintf(dtd, "[%d]\n#if defined(M_DTDDEF)\n = {\n", andused) ;
first = TRUE ;
for (pand = firstand ; pand ; pand = pand->nextptr) {
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
fprintf(dtd, " %d, %d",
pand->start->count,
pand->next ? pand->next->count : M_NULLVAL) ;
}
fputs(ndif, dtd) ;
}
SUBONE
fclose(farc) ;
}
/* Writes data about parameters */
void parout(M_NOPAR)
{
PARAMETER *paramp ;
LOGICAL first = TRUE ;
int pnameindex = 0 ;
M_WCHAR *p ;
int kw ;
int defindex = 0 ;
PTYPE *ptypep ;
fputs("M_DTDEXTERN M_WCHAR m_keyword", dtd) ;
if (kwlen)
{
fprintf(dtd,
"[%d]\n#if defined(M_DTDDEF)\n = {\n", /* keep the "}" balanced */
kwlen) ;
first = TRUE ;
for (ptypep = firstptype ; ptypep ; ptypep = ptypep->nextptr)
{
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
for (p = ptypep->keyword ; *p ; p++)
fprintf(dtd, " %d,\n", *p) ;
fputs(" 0", dtd) ;
}
fputs(ndif, dtd) ;
}
SUBONE
fputs("M_DTDEXTERN M_WCHAR m_defval", dtd) ;
if (deflen)
{
fprintf(dtd,
"[%d]\n#if defined(M_DTDDEF)\n = {\n", /* keep the "}" balanced */
deflen) ;
first = TRUE ;
for (paramp = firstpar ; paramp ; paramp = paramp->nextptr)
if (paramp->defstring)
{
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
for (p = paramp->defstring ; *p ; p++)
fprintf(dtd, " %d,\n", *p) ;
fputs(" 0", dtd) ;
}
fputs(ndif, dtd) ;
}
SUBONE
fputs(
"M_DTDEXTERN struct {\n int keyword, next ;\n } m_ptype",
dtd) ;
if (ptypelen)
{
fprintf(dtd, "[%d]\n#if defined(M_DTDDEF)\n = {\n", ptypelen) ;
/* keep the "}" balanced */
kw = 0 ;
first = TRUE ;
for (ptypep = firstptype ; ptypep ; ptypep = ptypep->nextptr)
{
if (first) first = FALSE ;
else fprintf(dtd, ",\n") ;
fprintf(dtd, " %d, %d", kw, ptypep->next) ;
kw += w_strlen(ptypep->keyword) + 1 ;
}
fputs(ndif, dtd) ;
}
SUBONE
fputs("M_DTDEXTERN M_PARAMETER m_parameter", dtd) ;
if (parcount)
{
kw = 0 ;
fprintf(dtd,
"[%d]\n#if defined(M_DTDDEF)\n = {\n", /* keep the "}" balanced */
parcount) ;
first = TRUE ;
for (paramp = firstpar ; paramp ; paramp = paramp->nextptr)
{
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
fprintf(dtd,
" %d, %s, %d, %s, ",
pnameindex,
partype(paramp->type),
paramp->kwlist,
deftype(paramp->deftype)) ;
pnameindex += w_strlen(paramp->paramname) + 1 ;
if (paramp->defval)
fprintf(dtd, "&m_keyword[%d]", paramp->defval - 1) ;
else if (paramp->defstring)
{
fprintf(dtd, "&m_defval[%d]", defindex) ;
defindex += w_strlen(paramp->defstring) + 1 ;
}
else
fputs("NULL", dtd) ;
}
fputs(ndif, dtd) ;
}
SUBONE
fputs("M_DTDEXTERN M_WCHAR m_pname", dtd) ;
if (pnamelen)
{
fprintf(dtd,
"[%d]\n#if defined(M_DTDDEF)\n = {\n", /* keep the "}" balanced */
pnamelen) ;
first = TRUE ;
for (paramp = firstpar ; paramp ; paramp = paramp->nextptr)
{
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
for (p = paramp->paramname ; *p ; p++) fprintf(dtd, " %d,\n", *p) ;
fputs(" 0", dtd) ;
}
fputs(ndif, dtd) ;
}
SUBONE
fprintf(dtd, "#define M_MAXPAR %d\n\n", maxpar) ;
}
/* Partype returns a string indicating the type of the nth parameter. */
char *partype(n)
int n ;
{
switch(n) {
case GRPO: return(mkeyword) ;
case CDATA: return(mcdata_att) ;
case ID: return(mid) ;
case IDREF: return(midref) ;
case IDREFS: return(midrefs) ;
case NAMETYPE: return(mnamepar) ;
case NAMES: return(mnames) ;
case NMTOKEN: return(mnmtoken) ;
case NMTOKENS: return(mnmtkns) ;
case NUMBER: return(mnumber) ;
case NUMBERS: return(mnumbers) ;
case NUTOKEN: return(mnutoken) ;
case NUTOKENS: return(mnutkns) ;
case ENTATT: return(mentatt) ;
default:
errexit = ERREXIT ;
return(merror) ;
}
}
/* Write short reference information */
void srefout(M_NOPAR)
{
LOGICAL first = TRUE ;
int *mapbysref ;
SREFSTRUCT *srefp ;
SREFDATA *data ;
int count = 0 ;
int thisrow ;
int i, j ;
fprintf(dtd, "#define M_MAXSR %d\n", maxsr) ;
fprintf(dtd, "#define M_MAXSEQ %d\n", maxseq) ;
fprintf(dtd, "#define M_SREFCNT %d\n", sreflen) ;
dumpptrie(&maptree, "m_maptree", dtd, "M_DTDEXTERN", "M_DTDDEF",
dumpmapnode) ;
dumpptrie(&sreftree, "m_sreftree", dtd, "M_DTDEXTERN", "M_DTDDEF",
dumpsrefnode) ;
fputs("M_DTDEXTERN int m_map", dtd) ;
if (mapcnt) {
mapbysref = (int *) calloc(mapcnt * sreflen, sizeof(int)) ;
if (! mapbysref) {
m_error("Unable to allocate workspace to process short references") ;
exit(TRUE) ;
}
for (srefp = firstsref ; srefp ; srefp = srefp->next)
for (data = srefp->data ; data ; data = data->next)
if (data->entidx)
mapbysref[sreflen * (data->map - 1) + srefp->srefcnt - 1] =
data->entidx ;
fprintf(dtd, "[%d]\n#if defined(M_DTDDEF)\n = {\n", mapcnt) ;
for (i = 0 ; i < mapcnt ; i++) {
if (i) fputs(",\n", dtd) ;
thisrow = 0 ;
for (j = 0 ; j < sreflen ; j++)
if (mapbysref[sreflen * i + j]) thisrow++ ;
fprintf(dtd, " %d", thisrow ? count + 1 : M_NULLVAL) ;
count += thisrow ;
}
fputs(ndif, dtd) ;
}
SUBONE
fputs(
"M_DTDEXTERN M_SREF m_sref", dtd) ;
if (count) {
fprintf(dtd, "[%d]\n#if defined(M_DTDDEF)\n = {\n", count) ;
first = TRUE ;
count = 0 ;
for (i = 0 ; i < mapcnt ; i++)
for (j = 0 ; j < sreflen ; )
if (mapbysref[sreflen * i + j]) {
count++ ;
if (first) first = FALSE ;
else fputs(",\n", dtd) ;
fprintf(dtd, " %d, %d, ", j + 1, mapbysref[sreflen * i + j]) ;
for (j++ ; j < sreflen ; j++)
if (mapbysref[sreflen * i + j]) break ;
fprintf(dtd, "%d", j < sreflen ? count + 1 : 0) ;
}
else j++ ;
fputs(ndif, dtd) ;
}
SUBONE
}
/* Output one element block in a template */
void tempelt(eltp, tempfile)
ELTSTRUCT *eltp ;
FILE *tempfile ;
{
PARAMETER *paramp ;
PTYPE *ptypep ;
M_WCHAR *p ;
char *mb_paramname;
int indent ;
int i ;
fprintf(tempfile, "\n<ELEMENT %s>\n", eltp->enptr) ;
if (eltp->parptr)
{
fputs(" /*\n", tempfile) ;
fputs(" <PARAM>\n", tempfile) ;
for (paramp = eltp->parptr ; paramp ; paramp = paramp->next)
{
fputs(" ", tempfile) ;
indent = 9 ;
for (p = paramp->paramname ; *p ; p++, indent += 2)
{
int length;
char mbyte[32]; /* larger than any multibyte character */
char *pc, c;
length = wctomb(mbyte, *p);
if (length < 0)
m_error("Invalid multibyte character found in an element");
else
{
pc = mbyte;
if (length == 1)
{
c = *pc;
putc(isupper(c) ? tolower(c) : c, tempfile) ;
}
else
while (--length >= 0) putc(*pc++, tempfile) ;
}
}
mb_paramname = MakeMByteString(paramp->paramname);
fprintf(tempfile, " = %s ", mb_paramname) ;
m_free(mb_paramname,"multi-byte string");
if (paramp->type == GRPO)
{
putc('(', tempfile) ;
for (ptypep = paramp->ptypep ; ptypep ; )
{
char *mb_keyword;
mb_keyword = MakeMByteString(ptypep->keyword);
fprintf(tempfile,
"%s = %s",
ptypep->keyword,
ptypep->keyword) ;
m_free(mb_keyword,"multi-byte string");
ptypep = ptypep->next ? ptypep->nextptr : (PTYPE *) NULL ;
if (ptypep)
{
fputs(",\n", tempfile) ;
for (i = 0 ; i < indent ; i++) putc(' ', tempfile) ;
}
}
putc(')', tempfile) ;
}
fputs(" ;\n", tempfile) ;
}
fputs(" */\n", tempfile) ;
}
fputs(" /*<STRING-CODE>*/\n", tempfile) ;
fputs(" <START-CODE>\n", tempfile) ;
fputs(" <START-STRING></START-STRING>\n", tempfile) ;
fputs(" /*<TEXT-CODE>*/\n", tempfile) ;
fputs(" /*<PI-CODE>*/\n", tempfile) ;
fputs(" <END-CODE>\n", tempfile) ;
fputs(" <END-STRING></END-STRING>\n", tempfile) ;
}
/* Write template */
void template(M_NOPAR)
{
FILE *tempfile ;
M_ENTITY *ent ;
LOGICAL undefent = FALSE ;
m_openchk(&tempfile, "template", "w") ;
for (ent = firstent ; ent ; ent = ent->next) {
if (! ent->wheredef) {
if (! undefent) {
fputs("/*\n", tempfile) ;
undefent = TRUE ;
}
fprintf(tempfile, "<!ENTITY %s %s \"\">\n",
ent->name,
enttype(ent->type)
) ;
}
}
if (undefent) fputs("*/\n", tempfile) ;
fputs("<SIGN-ON>\n", tempfile) ;
fputs("<GLOBAL-DEFINE>\n<GLOBAL-DECLARE>\n\n", tempfile) ;
eltblocks(tempfile) ;
fclose(tempfile) ;
}
/* Typecon returns a string indicating the content type of the nth element.*/
char *typecon(n)
int n ;
{
switch(n) {
case GRPO: return(mregexp) ;
case ANY: return(many) ;
case NONE: return(mnone) ;
case CDATA: return(mcdata) ;
case RCDATA: return(mrcdata) ;
default:
errexit = ERREXIT ;
return(merror) ;
}
}
#include "entout.c"

View File

@@ -0,0 +1,322 @@
/* $XConsortium: param.c /main/3 1995/11/08 09:26:10 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Param.c contains procedures related to parameters for program BUILD */
#include <malloc.h>
#include <string.h>
#include "build.h"
#include "context.h"
#include "delim.h"
/* Add a keyword to the list of possible values of a keyword parameter for
the current element
*/
void addkeyword(M_NOPAR)
{
int length ;
PARAMETER *par ;
PTYPE *kw ;
/* Check if duplicate keyword for this parameter */
for (kw = newpar->ptypep ; kw ; kw = kw->nextptr)
if (w_strcmp(kw->keyword, name) == 0)
{
warning3("Warning: Repeated keyword %s in parameter %s of %s",
name,
newpar->paramname,
thisrule) ;
return ;
}
/* Check if duplicate keyword within parameters of this element */
for (par = plist ; par != newpar ; par = par->next)
for (kw = par->ptypep ; kw ; kw = kw->nextptr)
{
if (w_strcmp(kw->keyword, name) == 0)
warning4("Keyword %s used in parameters %s and %s of %s",
name,
par->paramname,
newpar->paramname,
thisrule) ;
if (! kw->next) break ;
}
*nextptype = (PTYPE *) m_malloc(sizeof(PTYPE), "ptype") ;
if (newpar->kwlist) thisptype->next = ptypelen + 1 ;
else
{
newpar->kwlist = ptypelen + 1 ;
newpar->ptypep = *nextptype ;
}
thisptype = *nextptype ;
thisptype->next = M_NULLVAL ;
thisptype->nextptr = NULL ;
nextptype = &(thisptype->nextptr) ;
length = w_strlen(name) + 1 ;
thisptype->keyword = (M_WCHAR *) m_malloc(length, "keyword") ;
w_strcpy(thisptype->keyword, name) ;
kwlen += length ;
ptypelen++ ;
}
/* Add a parameter to the current element */
void addpar(M_NOPAR)
{
PARAMETER *paramp, *last ;
int length ;
parcount++ ;
pcount++ ;
for (paramp = plist ; paramp ; paramp = paramp->next)
{
if (w_strcmp(name, paramp->paramname) == 0)
warning2("Multiple definition of parameter %s for element %s",
name,
thisrule) ;
last = paramp ;
}
newpar = (PARAMETER *) m_malloc(sizeof(PARAMETER), "parameter") ;
if (! plist)
plist = newpar ;
else
last->next = newpar ;
*nextpar = newpar ;
nextpar = &newpar->nextptr ;
*nextpar = NULL ;
newpar->next = NULL ;
newpar->deftype = NULLDEF ;
newpar->defval = M_NULLVAL ;
newpar->defstring = NULL ;
newpar->kwlist = M_NULLVAL ;
length = w_strlen(name) + 1 ;
pnamelen += length ;
newpar->paramname = (M_WCHAR *) m_malloc(length, "parameter name") ;
w_strcpy(newpar->paramname, name) ;
newpar->ptypep = NULL ;
}
/* Check that specified default value is legal parameter value */
#if defined(M_PROTO)
LOGICAL checkdefault( const M_WCHAR *string )
#else
LOGICAL checkdefault(string)
M_WCHAR *string ;
#endif /* M_PROTO */
{
const M_WCHAR *p ;
int len ;
LOGICAL first ;
if (newpar->type == CDATA) return(TRUE) ;
if (m_allwhite(string)) return(FALSE) ;
first = TRUE ;
switch (newpar->type)
{
case IDREF:
case NAMETYPE:
case ENTATT:
case NMTOKEN:
case NUMBER:
case NUTOKEN:
/* Check length of default */
if (w_strlen(string) > M_NAMELEN) return(FALSE) ;
for (p = string ; *p ; p++)
{
if (m_cttype(*p) == M_NONNAME) return(FALSE) ;
else if (first || newpar->type == NUMBER)
switch (newpar->type)
{
case IDREF:
case NAMETYPE:
case ENTATT:
if (m_cttype(*p) != M_NMSTART) return(FALSE) ;
break ;
case NUMBER:
case NUTOKEN:
if (m_cttype(*p) != M_DIGIT) return(FALSE) ;
break ;
}
first = FALSE ;
}
return(TRUE) ;
case IDREFS:
case NAMES:
case NMTOKENS:
case NUMBERS:
case NUTOKENS:
len = 1 ;
for (p = string ; *p ; p++)
{
if (m_cttype(*p) == M_NONNAME)
{
if (! m_whitespace(*p)) return(FALSE) ;
len = 1 ;
}
else if (len == 1)
switch (newpar->type)
{
case IDREFS:
case NAMES:
if (m_cttype(*p) != M_NMSTART) return(FALSE) ;
break ;
case NUMBERS:
case NUTOKENS:
if (m_cttype(*p) != M_DIGIT) return(FALSE) ;
break ;
}
else if (newpar->type == NUMBERS &&
m_cttype(*p) != M_DIGIT) return(FALSE) ;
if (len++ > M_NAMELEN) return(FALSE) ;
}
break ;
}
}
/* Normalize parameter default. Change tabs and RE's to spaces, capitalize
all letters (unless type is CDATA), remove extra space in lists */
#if defined(M_PROTO)
void normdefault(M_WCHAR *string )
#else
void normdefault(string)
M_WCHAR *string ;
#endif /* M_PROTO */
{
M_WCHAR *p, *q ;
int i ;
switch (newpar->type)
{
case IDREF:
case NAMETYPE:
case NMTOKEN:
case NUTOKEN:
case ENTATT:
for ( ; *string ; string++)
*string = m_ctupper(*string) ;
return ;
case IDREFS:
case NAMES:
case NMTOKENS:
case NUTOKENS:
case NUMBERS:
/* Remove leading spaces */
for (p = string; *p ; p++)
if (! m_whitespace(*p)) break ;
w_strcpy(string, p) ;
/* Capitalize and normalize white space */
for (p = string, i = 0 ; *p ; p++, i++)
if (m_whitespace(*p))
{
mbtowc(p, " ", 1);
for (q = p + 1 ; m_whitespace(*q); q++) ;
w_strcpy(p + 1, q) ;
}
else
*p = m_ctupper(*p) ;
if (i && m_whitespace(string[i - 1])) string[i - 1] = M_EOS ;
return ;
default:
for ( ; *string ; string++)
{
char mbyte[32]; /* bigger than the biggest multibyte char */
int length;
length = wctomb(mbyte, *string);
if (length < 0)
{
m_error("Invalid wide character seen");
mbyte[0] = ' ';
mbyte[1] = 0;
}
if ((length == 1) && (*mbyte == '\n' || *mbyte == '\t'))
mbtowc(string, " ", 1);
}
return ;
}
}
/* Called at end of parameter attribute list rule */
void prulend(M_NOPAR)
{
LHS *lhsp ;
LHS *discard ;
if (pcount > maxpar) maxpar = pcount ;
for (lhsp = lhs ; lhsp ; )
{
if (lhsp->elt->parptr)
m_err1(
"Program error: prulend for %s, element with predefined parameters",
lhsp->elt->enptr) ;
lhsp->elt->parptr = plist ;
lhsp->elt->paramcount = pcount ;
lhsp->elt->parindex = parcount - pcount + 1 ;
discard = lhsp ;
lhsp = lhsp->next ;
m_free((M_POINTER) discard, "lhs") ;
}
ruleinit() ;
}
/* Make string the default for the current parameter of the current element */
#if defined(M_PROTO)
void setdefault(const M_WCHAR *string)
#else
void setdefault()
M_WCHAR *string;
#endif /* M_PROTO */
{
PTYPE *kw ;
int keycount ;
int length ;
/* Process default for non-keyword parameter*/
if (newpar->type != GRPO)
{
/* First check it is a legitimate value */
if (! checkdefault(string))
{
m_err2("\"%s\": Not a valid default value for parameter %s",
string,
newpar->paramname) ;
return ;
}
length = w_strlen(string) + 1 ;
newpar->defstring = (M_WCHAR *) m_malloc(length, "default") ;
w_strcpy(newpar->defstring, string) ;
deflen += length ;
/* Value is valid. Change tabs and RE's to spaces, if value is not
CDATA, put it in all caps, remove extra white space. */
normdefault(newpar->defstring) ;
}
else
{
/* It is a keyword parameter, store a pointer to the value */
for (kw = newpar->ptypep ; kw ; kw = kw->nextptr)
{
if (! m_wcupstrcmp(string, kw->keyword))
{
for (keycount = 0 ; kw ; kw = kw->nextptr)
keycount += w_strlen(kw->keyword) + 1 ;
newpar->defval = kwlen - keycount + 1;
return ;
}
}
m_err2("Invalid default: %s not a valid value for %s",
string,
newpar->paramname) ;
}
}

View File

@@ -0,0 +1,592 @@
/* $XConsortium: proto.h /main/3 1995/11/08 09:26:24 rswiston $ */
/*
Copyright (c) 1988, 1989 Hewlett-Packard Co.
*/
/* Proto.h contains function prototypes for program BUILD. */
int addarc(
#if defined(M_PROTO)
STATE *from, STATE *to, ELTSTRUCT *label, ANDGROUP *and, LOGICAL optional,
int id, LOGICAL minim, ELTSTRUCT **errelt
#endif
) ;
void adddefent(
#if defined(M_PROTO)
M_WCHAR *mapname
#endif
) ;
LOGICAL addent(
#if defined(M_PROTO)
M_WCHAR *name
#endif
) ;
void addex(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void addkeyword(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL addmapname(
#if defined(M_PROTO)
M_WCHAR *p, LOGICAL define
#endif
) ;
void addndent(
#if defined(M_PROTO)
M_WCHAR *p
#endif
) ;
void addpar(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void addsref(
#if defined(M_PROTO)
M_WCHAR *p
#endif
) ;
LOGICAL m_allwhite(
#if defined(M_PROTO)
const M_WCHAR *string
#endif
) ;
void checkand(
#if defined(M_PROTO)
ANDGROUP *andstart, ANDGROUP *andptr, STATE *start, TREE *root,
ELTSTRUCT **errelt
#endif
) ;
LOGICAL checkdefault(
#if defined(M_PROTO)
const M_WCHAR *string
#endif
) ;
int checkdfsa(
#if defined(M_PROTO)
STATE *from, ELTSTRUCT *label, ANDGROUP *and, int id, ELTSTRUCT **errelt
#endif
) ;
int checkrepeat(
#if defined(M_PROTO)
STATE *from, ANDGROUP *and, ELTSTRUCT **errelt
#endif
) ;
void copyintolist(
#if defined(M_PROTO)
STATELIST *from, STATELIST **to
#endif
) ;
void countdown(
#if defined(M_PROTO)
M_TRIE *parent, int *count
#endif
) ;
void defmapname(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
char *deftype(
#if defined(M_PROTO)
int n
#endif
) ;
void dellist(
#if defined(M_PROTO)
STATELIST **list
#endif
) ;
void delstartarcs(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void done(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void dumpentnode(
#if defined(M_PROTO)
FILE *file, M_TRIE *value
#endif
) ;
void dumpmapnode(
#if defined(M_PROTO)
FILE *file, M_TRIE *value
#endif
) ;
void dumpsrefnode(
#if defined(M_PROTO)
FILE *file,
M_TRIE *value
#endif
) ;
void dumpptrie(
#if defined(M_PROTO)
M_TRIE *intname, char *extname, FILE *file, char *externdef, char *defdef,
void (*proc)( FILE *, M_TRIE *)
#endif
) ;
void m_dumptrie(
#if defined(M_PROTO)
FILE *file,
M_TRIE *xtrie,
char *extname,
int *count,
void (*proc)(M_ENTITY *)
#endif
) ;
void eltblocks(
#if defined(M_PROTO)
FILE *tempfile
#endif
) ;
void eltreeout(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void endmodel(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void entout(
#if defined(M_PROTO)
char *fname
#endif
) ;
char *enttype(
#if defined(M_PROTO)
int n
#endif
) ;
void m_error(
#if defined(M_PROTO)
char *text
#endif
) ;
void m_err1(
#if defined(M_PROTO)
const char *text, const M_WCHAR *arg
#endif
) ;
void m_mberr1(
#if defined(M_PROTO)
char *text, const char *arg
#endif
) ;
void m_err2(
#if defined(M_PROTO)
const char *text, const M_WCHAR *arg1, const M_WCHAR *arg2
#endif
) ;
void exout(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_free(
#if defined(M_PROTO)
void *block, char *msg
#endif
) ;
void freetree(
#if defined(M_PROTO)
TREE *ruletree
#endif
) ;
void found(
#if defined(M_PROTO)
LOGICAL *flag, char *delim
#endif
) ;
void fsa(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int getachar(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
ANDGROUP *getand(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL getname(
#if defined(M_PROTO)
int first
#endif
) ;
STATE *getstate(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int gettoken(
#if defined(M_PROTO)
int *c, int context
#endif
) ;
TREE *gettreenode(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_initctype(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void initialize(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL litproc(
#if defined(M_PROTO)
int delim
#endif
) ;
void main(
#if defined(M_PROTO)
int argc, char **argv
#endif
) ;
void makeand(
#if defined(M_PROTO)
LOGICAL *canbenull, TREE *root, int optional
#endif
) ;
LOGICAL makefsa(
#if defined(M_PROTO)
TREE *root, int optional
#endif
) ;
void makeor(
#if defined(M_PROTO)
LOGICAL *canbenull, TREE *root
#endif
) ;
void makeseq(
#if defined(M_PROTO)
LOGICAL *canbenull, TREE *root, int optional
#endif
) ;
void *m_malloc(
#if defined(M_PROTO)
int size, char *msg
#endif
) ;
void msgline(
#if defined(M_PROTO)
char *text
#endif
) ;
void msg1line(
#if defined(M_PROTO)
char *text, char *arg1
#endif
) ;
void nondeterm(
#if defined(M_PROTO)
TREE *root, int c, ELTSTRUCT *eltp
#endif
) ;
void normdefault(
#if defined(M_PROTO)
M_WCHAR *string
#endif
) ;
LOGICAL notinlist(
#if defined(M_PROTO)
STATELIST *item, STATELIST *list
#endif
) ;
ELTSTRUCT *ntrelt(
#if defined(M_PROTO)
M_WCHAR *p
#endif
) ;
void m_openchk(
#if defined(M_PROTO)
FILE **ptr, char *name, char *mode
#endif
) ;
void parout(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
char *partype(
#if defined(M_PROTO)
int n
#endif
) ;
LOGICAL permitspcd(
#if defined(M_PROTO)
ARC *a
#endif
) ;
void pop(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void prulend(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void push(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL regenerate(
#if defined(M_PROTO)
TREE *start, TREE *stop
#endif
) ;
void repeat(
#if defined(M_PROTO)
TREE *root
#endif
) ;
void ruleinit(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void rulend(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL samelabelarc(
#if defined(M_PROTO)
ARC *a, STATE *s
#endif
) ;
void savelhs(
#if defined(M_PROTO)
LOGICAL param
#endif
) ;
void savestartarcs(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int scan(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void setdefault(
#if defined(M_PROTO)
const M_WCHAR *string
#endif
) ;
void simplebranch(
#if defined(M_PROTO)
TREE *root, ELTSTRUCT *value, ANDGROUP *group, int optional
#endif
) ;
void skiptoend(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int m_sprscon(
#if defined(M_PROTO)
int i, int j
#endif
) ;
void srefout(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
STATE *startfsa(
#if defined(M_PROTO)
TREE *root, LOGICAL *canbenull
#endif
) ;
void tempelt(
#if defined(M_PROTO)
ELTSTRUCT *eltp, FILE *tempfile
#endif
) ;
void template(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
char *typecon(
#if defined(M_PROTO)
int n
#endif
) ;
void undodelim(
#if defined(M_PROTO)
M_WCHAR *delim
#endif
) ;
void ungetachar(
#if defined(M_PROTO)
int c
#endif
) ;
int m_wcupstrcmp(
#if defined(M_PROTO)
const M_WCHAR *p, const M_WCHAR *q
#endif
) ;
int m_wcmbupstrcmp(
#if defined(M_PROTO)
const M_WCHAR *p, const char *q
#endif
) ;
int m_mbmbupstrcmp(
#if defined(M_PROTO)
const char *p, const char *q
#endif
) ;
void warning(
#if defined(M_PROTO)
char *text
#endif
) ;
void warning1(
#if defined(M_PROTO)
char *text, M_WCHAR *arg
#endif
) ;
void warning2(
#if defined(M_PROTO)
char *text, M_WCHAR *arg1, M_WCHAR *arg2
#endif
) ;
void warning3(
#if defined(M_PROTO)
char *text, M_WCHAR *arg1, M_WCHAR *arg2, M_WCHAR *arg3
#endif
) ;
void warning4(
#if defined(M_PROTO)
char *text, M_WCHAR *arg1, M_WCHAR *arg2, M_WCHAR *arg3, M_WCHAR *arg4
#endif
) ;
LOGICAL m_whitespace(
#if defined(M_PROTO)
M_WCHAR c
#endif
) ;

View File

@@ -0,0 +1,152 @@
/* $XConsortium: scan.c /main/3 1995/11/08 09:26:36 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Scan.c contains scanner procedures for program BUILD */
#include <string.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "build.h"
#define M_CONDEF
#include "context.h"
#define M_DELIMDEF
#include "delim.h"
#include "sref.h"
/* Reads a name */
LOGICAL getname(first)
int first;
{
M_WCHAR *p;
int c;
*(p = name) = first;
if ((curcon != DEFAULT && curcon != DEFVAL &&
curcon != DEFAULT2 && curcon != DEF2VAL) ||
newpar->type != CDATA)
*p = m_ctupper(*p);
while (TRUE)
{
c = getachar();
*++p = (M_WCHAR) c;
if (m_cttype(*p) == M_NONNAME) break;
if (p >= name + M_NAMELEN)
{
*(name + M_NAMELEN) = M_EOS;
m_error("Name too long");
return(FALSE);
}
if ((curcon != DEFAULT && curcon != DEFVAL &&
curcon != DEFAULT2 && curcon != DEF2VAL) ||
newpar->type != CDATA)
*p = m_ctupper(*p);
}
ungetachar(c);
*p = M_EOS;
return(TRUE);
}
/* Returns the next token to the main procedure */
int scan(M_NOPAR)
{
int c;
int n;
M_WCHAR wsp, wnl, wtb;
mbtowc(&wsp, " ", 1);
mbtowc(&wnl, "\n", 1);
mbtowc(&wtb, "\t", 1);
while (TRUE)
{
if (! m_newcon(curcon - 1, TEXT - 1))
{
while ((n = gettoken(&c, COMCON)) == COMMENT)
while ((n = gettoken(&c, COMCON)) != COMMENT)
if (c == EOF)
{
m_error("EOF occurred within comment");
exit(ERREXIT);
}
ungetachar(c);
}
n = gettoken(&c, curcon);
if (n)
{
if (n != LIT && n != LITA) return(n);
if (litproc(n))
{
if (scantrace)
{
char *mb_literal;
mb_literal = MakeMByteString(literal);
printf("literal '%s'\n", mb_literal);
m_free(mb_literal, "multibyte string");
}
return(LITERAL);
}
/* Litproc returns FALSE in case of error, when returned have
scanned to the end of erroneous rule */
else continue;
}
if (c == wsp || c == wnl || c == wtb)
{
if (m_newcon(curcon - 1, TEXT - 1))
{
scanval = (M_WCHAR) c;
return(TEXT);
}
else continue;
}
if (m_newcon(curcon - 1, NAME - 1))
if (m_cttype(c) == M_NMSTART ||
(m_cttype(c) != M_NONNAME &&
(curcon == DEFAULT || curcon == DEFVAL || curcon == NTNAME ||
curcon == DEFAULT2 || curcon == DEF2VAL || curcon == NT2NAME
))
)
{
if (getname(c))
{
if (scantrace)
{
char *mb_name;
mb_name = MakeMByteString(name);
printf("name '%s'\n", mb_name);
m_free(mb_name, "multibyte string");
}
return(NAME);
}
else continue;
}
if (c == EOF) return(ENDFILE);
if (m_newcon(curcon - 1, TEXT - 1))
{
scanval = (M_WCHAR) c;
return(TEXT);
}
if (curcon != ERROR)
{
char mbyte[32]; /* bigger than the biggest multibyte char */
wctomb(mbyte, c);
fprintf(stderr, "\n'%s' (%d)", mbyte, c);
fprintf(m_errfile, "\n'%s' (%d)", mbyte, c);
m_error("Unexpected character");
}
} /* End while */
} /* End scan */
#include "scanutil.c"
#if defined(sparse)
#include "sparse.c"
#endif

View File

@@ -0,0 +1,188 @@
/* $XConsortium: sref.c /main/3 1995/11/08 09:26:46 rswiston $ */
/* Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co. */
/* Sref.c contains procedures related to short reference map declarations */
#include <string.h>
#include <malloc.h>
#include "build.h"
#include "sref.h"
#include "entdef.h"
static M_WCHAR *wc_prefix = NULL;
/* Add an entity with the default name constructed by adding a suffix
to the name of the short reference map in which it is invoked, and
a prefix m- */
void adddefent(mapname)
M_WCHAR *mapname;
{
M_WCHAR *p;
int n, length;
char c;
if (!wc_prefix)
{
wc_prefix = MakeWideCharString(M_PREFIX);
w_strcpy(genname, wc_prefix);
}
w_strcpy(&genname[w_strlen(wc_prefix)], mapname);
p = &genname[w_strlen(genname)];
for (n = egensuf ; n ; n /= 10)
{
if (p - genname > M_NAMELEN)
{
m_err1("Entity name based on %s too long", mapname);
return;
}
c = ('0' + (n % 10));
mbtowc(p, &c, 1);
*p++;
}
*p = M_EOS;
egensuf++;
if (! addent(genname))
{
m_err1("Default entity name %s already in use", genname);
return;
}
thissref->entidx = entity->index;
}
/* Add an entity, return FALSE if already there, TRUE if adding it.
Pointer to the entity structure is in global M_STRUCT *entity. */
LOGICAL addent(name)
M_WCHAR *name;
{
M_ENTITY *new;
new = (M_ENTITY *) m_malloc(sizeof(M_ENTITY), "entity");
if (entity = (M_ENTITY *) m_ntrtrie(name, m_enttrie, (M_TRIE *) new))
{
m_free((M_POINTER) new, "entity");
return(FALSE);
}
entity = new;
if (lastent) lastent->next = entity;
else firstent = entity;
lastent = entity;
entity->type = M_GENERAL;
entity->wheredef = FALSE;
entity->content = NULL;
entity->name = (M_WCHAR *) m_malloc(w_strlen(name) + 1, "entity name");
entity->index = ++m_entcnt;
entity->next = NULL;
w_strcpy(entity->name, name);
return(TRUE);
}
/* Add a short reference map name */
#if defined(M_PROTO)
LOGICAL addmapname(M_WCHAR* p, LOGICAL define)
#else
LOGICAL addmapname(p, define)
M_WCHAR *p;
LOGICAL define;
#endif
{
MAP *old;
MAP *new;
LOGICAL retval;
new = (MAP *) m_malloc(sizeof(MAP), "map");
if (old = (MAP *) m_ntrtrie(p, &maptree, (M_TRIE *) new))
{
m_free(new, "map");
curmap = old->map;
retval = old->defined;
if (define) old->defined = TRUE;
return((LOGICAL) (retval ? FALSE : TRUE));
}
curmap = ++mapcnt;
new->map = mapcnt;
new->mapname = (M_WCHAR *) m_malloc(w_strlen(p) + 1, "map name");
w_strcpy(new->mapname, p);
new->defined = define;
new->nextptr = NULL;
*nextmap = new;
nextmap = &new->nextptr;
return(TRUE);
}
/* Add a named entity to a short reference map */
void addndent(p)
M_WCHAR *p;
{
addent(p);
thissref->entidx = entity->index;
}
/* Add a short reference delimiter */
void addsref(p)
M_WCHAR *p;
{
SREFSTRUCT *delim;
SREFSTRUCT *prevsr;
M_WCHAR *q;
M_WCHAR c;
int noseq = 0;
/* Define the delimiter */
delim = (SREFSTRUCT *)
m_malloc(sizeof(SREFSTRUCT), "short reference delimiter");
if (prevsr = (SREFSTRUCT *) m_ntrtrie(p, &sreftree, (M_TRIE *) delim))
{
m_free(delim, "short reference delimiter");
delim = prevsr;
}
else
{
for (q = p ; *q ; q++)
{
c = m_ctupper(*q);
if (m_cttype(c) == M_NMSTART)
{
if (c != BLANKSEQ && c != WSSEQ && c != RS)
{
m_free(delim, "short reference delimiter");
m_err1(
"Letters not permitted in short reference delimiters: %s",
p);
return;
}
if (c != RS) noseq++;
}
}
if (w_strlen(p) > maxsr) maxsr = w_strlen(p);
if (noseq > maxseq) maxseq = noseq;
delim->srefcnt = ++sreflen;
*nextsref = delim;
nextsref = &delim->next;
delim->next = NULL;
delim->data = NULL;
}
/* Add the delimiter to this map and prepare for the associated
entity */
thissref = (SREFDATA *)
m_malloc(sizeof(SREFDATA), "short reference delimiter");
thissref->map = curmap;
thissref->entidx = M_NULLVAL;
thissref->next = delim->data;
delim->data = thissref;
}
/* Prefix left-hand side with "M-" to create default short reference map
name, truncating to M_NAMELEN characters if necessary */
void defmapname(M_NOPAR)
{
if (!wc_prefix)
{
wc_prefix = MakeWideCharString(M_PREFIX);
w_strcpy(genname, wc_prefix);
}
w_strcpy(&genname[w_strlen(wc_prefix)], thisrule);
genname[M_NAMELEN] = M_EOS;
}

View File

@@ -0,0 +1,52 @@
/* $XConsortium: tree.c /main/3 1995/11/08 09:26:55 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Tree.c has procedures used by BUILD to construct the tree representation
of a content model */
#include <malloc.h>
#include "build.h"
#include "context.h"
/* Called after a right parenthesis is read while scanning a content model.
Resets curcon if it is the outermost submodel. */
void endmodel(M_NOPAR)
{
curtree = curtree->parent ;
if (! curtree->parent) curcon = LASTM ;
else if (curtree == curtree->parent->first) curcon = OCCUR ;
}
/* Release storage used for the tree representation of a rule */
void freetree(treep)
TREE *treep ;
{
TREE *child, *discard ;
for (child = treep->first ; child ; ) {
discard = child->right ;
freetree(child) ;
child = discard ;
}
m_free((M_POINTER) treep, "tree node") ;
}
/* Gettreenode obtains a node to use in the tree representation of a rule */
TREE *gettreenode(M_NOPAR)
{
TREE *new ;
new = (TREE *) m_malloc(sizeof(TREE), "tree node") ;
new->first = new->right = new->parent = NULL ;
new->connector = new->occurrence = M_NULLVAL ;
new->value = NULL ;
new->terminal = FALSE ;
new->minim = FALSE ;
new->eltid = eltsinrule++ ;
return(new) ;
}

View File

@@ -0,0 +1,86 @@
XCOMM $XConsortium: Imakefile /main/3 1995/11/08 09:27:14 rswiston $
/* eltdef Imakefile */
ARCCMD = arc u
UNARCCMD = arc x
ARCDELCMD = arc d
HELPTAG = ..
HELPTAGSRC = $(HELPTAG)/helptag
HELPPARSERSRC = $(HELPTAG)/parser
HELPELTDEFSRC = $(HELPTAG)/eltdef
HELPDTDFILE = $(HELPTAGSRC)/hptag.dtd
HELPUTILSRC = $(HELPTAG)/util
HELPBUILDSRC = $(HELPTAG)/build
HELPUTILLIB = $(HELPTAG)/util/libutil.a
HELPIFFILE = $(HELPTAGSRC)/help.if
HELPTSSFILE = $(HELPTAGSRC)/htag.tss
INCLUDES = -I. -I$(HELPUTILSRC) -I$(HELPBUILDSRC)
SRCS = eltdef.c eltutil.c entity.c scan.c
OBJS = eltdef.o eltutil.o entity.o scan.o
CCPRODS = case.c
ECPRODS = efile.c entfile.c pfile.c sfile.c stfile.c tfile.c
CHPRODS = context.h delim.h
EHPRODS = entity2.h globdec.h globdef.h if.h pval.h signon.h signonx.h
CPRODS = $(CCPRODS) $(CHPRODS)
EPRODS = $(ECPRODS) $(EHPRODS)
CTRASH = delim.dat error
ETRASH = estring.h error
TRASH = delim.dat estring.h error
PRODUCTS = $(CPRODS) $(EPRODS)
LOCAL_LIBRARIES = $(HELPUTILLIB)
/* Don't use shared libs for hp */
#ifdef HPArchitecture
#if OSMajorVersion > 7
EXTRA_LOAD_FLAGS = -Wl,-a archive
#endif
#endif
#ifdef SunArchitecture
.NO_PARALLEL:
#endif
all:: $(PRODUCTS)
NormalLibraryObjectRule()
NormalProgramTarget(eltdef,$(OBJS),delim.h $(LOCAL_LIBRARIES),$(LOCAL_LIBRARIES),)
$(EPRODS): eltdef $(HELPIFFILE) $(HELPTSSFILE)
$(RM) $(EPRODS) $(ETRASH)
./eltdef $(HELPIFFILE)
$(CPRODS): $(HELPUTILSRC)/context $(HELPTAGSRC)/delim.elt context.dat
$(RM) $(CPRODS) $(CTRASH)
/* get application-specific delim.dat */
$(CP) $(HELPTAGSRC)/delim.elt delim.dat
$(HELPUTILSRC)/context
$(HELPUTILSRC)/context:
cd $(HELPUTILSRC); make context
arc package :
if exist util.arc $(CP) build.arc old.arc
$(ARCCMD) util.arc *.c *.h makefile
unarc dearc :
$(UNARCCMD) util.arc
clean::
$(RM) $(PRODUCTS) $(TRASH)
depend::
includes:: $(PRODUCTS)
DependTarget()

View File

@@ -0,0 +1,722 @@
startcomment
comcon:comcon {
/* $XConsortium: context.dat /main/3 1995/07/17 19:48:59 lehors $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
Context.dat defines the state transitions for program ELTDEF.
*/
}
;
endcomment
incom:incom
;
entstart
start:entdec
error:entdec
;
entsystem
entval:typedec {enttype(M_SYSTEM) ;}
;
entst
entval:typedec {enttype(M_STARTTAG) ;}
;
entet
entval:typedec {enttype(M_ENDTAG) ;}
;
entmd
entval:typedec {enttype(M_MD) ;}
;
entpi
entval:piorsdata {enttype(M_PI) ;}
;
entsdata
entval:piorsdata {enttype(M_SDATA) ;}
;
entcdata
entval:typedec {enttype(M_CDATAENT) ;}
;
typecode
piorsdata:codetagc {
entity->wheredef = M_DELTDEF ;
enttype(entity->type == M_PI ? M_CODEPI : M_CODESDATA) ;
entity->codeindex = ++codeent ;
}
;
endofcode
inentc:start
;
lit
value:value,
litcon:litcon
;
lita
value:value,
litcon:litcon
;
entlit
entval:declitent,
piorsdata:declitent,
typedec:declitent {entclen = 0 ;}
declitent:postent,
edeclitent:postent {
entcontent[entclen] = M_EOS ;
entity->content =
(M_WCHAR *) m_malloc(entclen + 1, "entity content") ;
w_strcpy(entity->content, entcontent) ;
entity->wheredef = M_DELTDEF ;
}
;
entlita
entval:declitaent,
piorsdata:declitaent,
typedec:declitaent {entclen = 0 ;}
declitaent:postent,
edclitaent:postent {
entcontent[entclen] = M_EOS ;
entity->content =
(M_WCHAR *) m_malloc(entclen + 1, "entity content") ;
w_strcpy(entity->content, entcontent) ;
entity->wheredef = M_DELTDEF ;
}
;
cro
litcon:litcon
;
litrs
litcon:litcon
;
litrsc
litcon:litcon
;
litre
litcon:litcon
;
litrec
litcon:litcon
;
littab
litcon:litcon
;
littabc
litcon:litcon
;
litspace
litcon:litcon
;
litcspace
litcon:litcon
;
refc
charent:charent
;
signon
start:insignon {restart = RSIGNON ;}
error:insignon
;
gdef
start:globdef,
insignon:globdef {
endsignon() ;
restart = RGLOBDEF ;
/* fprintf(globdef, "#line %d \"%s\"\n", m_line, iffile) ; */
}
error:globdef {
endsignon() ;
/* fprintf(globdef, "#line %d \"%s\"\n", m_line, iffile) ; */
}
;
gdec
start:globdec,
insignon:globdec {
endsignon() ;
restart = RGLOBDEC ;
/* fprintf(globdec, "#line %d \"%s\"\n", m_line, iffile) ; */
}
globdef:globdec {
restart = RGLOBDEC ;
/* fprintf(globdec, "#line %d \"%s\"\n", m_line, iffile) ; */
}
error:globdec {
if (! signonend) endsignon() ;
restart = RGLOBDEC ;
/* fprintf(globdec, "#line %d \"%s\"\n", m_line, iffile) ; */
}
;
inisstring
start:iniss,
insignon:iniss {
endsignon() ;
gss = stringcnt ;
instring = TRUE ;
}
inies:iniss {
endstring() ;
gss = stringcnt ;
if (gss)
m_error("Multiple specification of global start string") ;
instring = TRUE ;
}
inisc:iniss,
iniec:iniss,
initc:iniss,
inipc:iniss,
inistc:iniss {
if (gss)
m_error("Multiple specification of global start string") ;
gss = stringcnt ;
instring = TRUE ;
}
globdef:iniss,
globdec:iniss {
gss = stringcnt ;
instring = TRUE ;
}
;
iniestring
start:inies,
insignon:inies {
endsignon() ;
ges = stringcnt ;
instring = TRUE ;
}
iniss:inies {
if (ges)
m_error("Multiple specification of global end string") ;
endstring() ;
ges = stringcnt ;
instring = TRUE ;
}
inisc:inies,
iniec:inies,
initc:inies,
inipc:inies,
inistc:inies {
if (ges)
m_error("Multiple specification of global end string") ;
ges = stringcnt ;
instring = TRUE ;
}
globdef:inies,
globdec:inies {
ges = stringcnt ;
instring = TRUE ;
}
;
inistring
start:inistc,
insignon:inistc {
endsignon() ;
/* fprintf(stfile, "#line %d \"%s\"\n", m_line, iffile) ; */
finistc = FALSE ;
}
iniss:inistc,
inies:inistc {
finistc = FALSE ;
endstring() ;
if (! finistc)
m_error("Multiple specification of global string code") ;
}
iniec:inistc,
initc:inistc,
inipc:inistc,
inisc:inistc {
if (! finistc)
m_error("Multiple specification of global string code") ;
/* fprintf(stfile, "#line %d \"%s\"\n", m_line, iffile) ; */
finistc = FALSE ;
}
globdef:inistc,
globdec:inistc {
finistc = FALSE ;
/* fprintf(stfile, "#line %d \"%s\"\n", m_line, iffile) ; */
}
;
inistart
start:inisc,
insignon:inisc {
endsignon() ;
/* fprintf(sfile, "#line %d \"%s\"\n", m_line, iffile) ; */
}
iniss:inisc,
inies:inisc {endstring() ;}
iniec:inisc,
initc:inisc,
inipc:inisc,
inistc:inisc,
globdef:inisc,
globdec:inisc {
/* fprintf(sfile, "#line %d \"%s\"\n", m_line, iffile) ; */
}
;
iniend
start:iniec,
insignon:iniec {
endsignon() ;
/* fprintf(efile, "#line %d \"%s\"\n", m_line, iffile) ; */
}
iniss:iniec,
inies:iniec {endstring() ;}
inisc:iniec,
initc:iniec,
inipc:iniec,
inistc:iniec,
globdef:iniec,
globdec:iniec {
/* fprintf(efile, "#line %d \"%s\"\n", m_line, iffile) ; */
}
;
initext
start:initc,
insignon:initc {
endsignon() ;
/* fprintf(tfile, "#line %d \"%s\"\n", m_line, iffile) ; */
finitext = FALSE ;
}
iniss:initc,
inies:initc {endstring() ;}
inisc:initc,
iniec:initc,
inipc:initc,
inistc:initc,
globdef:initc,
globdec:initc {
/* fprintf(tfile, "#line %d \"%s\"\n", m_line, iffile) ; */
finitext = FALSE ;
}
;
initpi
start:inipc,
insignon:inipc {
endsignon() ;
/* fprintf(pfile, "#line %d \"%s\"\n", m_line, iffile) ; */
finipi = FALSE ;
}
iniss:inipc,
inies:inipc {endstring() ;}
inisc:inipc,
iniec:inipc,
initc:inipc,
inistc:inipc,
globdef:inipc,
globdec:inipc {
/* fprintf(pfile, "#line %d \"%s\"\n", m_line, iffile) ; */
finipi = FALSE ;
}
;
elt
start:needn,
insignon:needn {
endsignon() ;
endini() ;
}
inelt:needn
globdef:needn,
globdec:needn,
inisc:needn,
iniec:needn,
initc:needn,
inipc:needn {endini() ;}
inss:needn,
ines:needn {endstring() ;}
insc:needn
inec:needn
intc:needn
inpc:needn
instc:needn
inparam:needn
preparam:needn
error:needn
;
tagc
postent:start
codetagc:inentc {
startcode(entity->codeindex, &inent, entfile,
"c", nopar, nopar, "") ;
}
close:preparam
sschain:inss {
*getaction(starray) = stringcnt ;
instring = TRUE ;
}
eschain:ines {
*getaction(etarray) = stringcnt ;
instring = TRUE ;
}
pcchain:inpc {
*getaction(pcarray) = ++pactions ;
startcode(pactions, &inpc, pfile, "p", pproto, pformal, pftype) ;
}
tcchain:intc {
*getaction(tcarray) = ++tactions ;
startcode(tactions, &intext, tfile, "t", tproto, tformal,
tftype) ;
}
scchain:insc {
*getaction(scarray) = ++sactions ;
startcode(sactions, &insc, sfile, "s", nopar, nopar, "") ;
}
ecchain:inec {
*getaction(ecarray) = ++eactions ;
startcode(eactions, &inec, efile, "e", nopar, nopar, "") ;
}
stcchain:instc {
*getaction(stcarray) = ++stactions ;
startcode(stactions, &instc, stfile, "st", stproto, stformal,
stft) ;
}
;
sep
sschain:sschain {*getaction(starray) = stringcnt ;}
eschain:eschain {*getaction(etarray) = stringcnt ;}
pcchain:pcchain {*getaction(pcarray) = pactions + 1 ;}
tcchain:tcchain {*getaction(tcarray) = tactions + 1 ;}
scchain:scchain {*getaction(scarray) = sactions + 1 ;}
ecchain:ecchain {*getaction(ecarray) = eactions + 1 ;}
stcchain:stcchain {*getaction(stcarray) = stactions + 1 ;}
postvalue:invalue
;
param
preparam:inparam
;
vi
cvar:pname
cvalue:value
;
rend
postpname:inparam
;
grpo
postpname:invalue
;
grpc
invalue:postpname
postvalue:postpname
;
sss
inelt:sschain
inss:sschain,
ines:sschain {endstring() ;}
inpc:sschain
intc:sschain
insc:sschain
inec:sschain
instc:sschain
inparam:sschain
preparam:sschain
;
ess
iniss:inisc,
inss:inelt {endstring() ;}
;
ses
inelt:eschain
inss:eschain,
ines:eschain {endstring() ;}
inpc:eschain
intc:eschain
insc:eschain
inec:eschain
instc:eschain
inparam:eschain
preparam:eschain
;
ees
inies:inisc,
ines:inelt {endstring() ;}
;
scode
inss:scchain,
ines:scchain {endstring() ;}
inparam:scchain
inelt:scchain
inpc:scchain
intc:scchain
insc:scchain
inec:scchain
instc:scchain
preparam:scchain
;
ecode
inss:ecchain,
ines:ecchain {endstring() ;}
insc:ecchain
inparam:ecchain
inelt:ecchain
inec:ecchain
intc:ecchain
inpc:ecchain
instc:eschain
preparam:ecchain
;
tcode
inss:tcchain,
ines:tcchain {endstring() ;}
insc:tcchain
inec:tcchain
inparam:tcchain
inelt:tcchain
preparam:tcchain
inpc:tcchain
intc:tcchain
instc:tcchain
;
pcode
inelt:pcchain
preparam:pcchain
inparam:pcchain
inss:pcchain,
ines:pcchain {endstring() ;}
inpc:pcchain
intc:pcchain
insc:pcchain
inec:pcchain
instc:pcchain
;
stcode
inelt:stcchain
preparam:stcchain
inparam:stcchain
inss:stcchain,
ines:stcchain {endstring() ;}
inpc:stcchain
intc:stcchain
insc:stcchain
inec:stcchain
instc:stcchain
;
endfile
start:finish,
insignon:finish {
endsignon() ;
endini() ;
}
globdef:finish,
globdec:finish,
inistc:finish,
inisc:finish,
iniec:finish,
initc:finish,
inipc:finish {endini() ;}
;
wildcard
stcchain:stcchain,
sschain:sschain,
eschain:eschain,
scchain:scchain,
ecchain:ecchain,
tcchain:tcchain,
pcchain:pcchain {
*nextchain = (CHAIN *) m_malloc(sizeof(CHAIN), "chain") ;
(*nextchain)->elt = 1 ;
(*nextchain)->next = NULL ;
nextchain = &(*nextchain)->next ;
}
;
literal
value:postvalue {value(literal) ;}
;
name
needn:close {startelement() ;}
inparam:cvar {storecvar() ;}
pname:postpname {storepname() ;}
invalue:cvalue {cvalue() ;}
value:postvalue {value(name) ;}
entdec:entval {addent() ;}
stcchain:stcchain,
sschain:sschain,
eschain:eschain,
scchain:scchain,
ecchain:ecchain,
tcchain:tcchain,
pcchain:pcchain {
*nextchain = (CHAIN *) m_malloc(sizeof(CHAIN), "chain") ;
(*nextchain)->next = NULL ;
if ((*nextchain)->elt = m_packedlook(m_entree, name))
(*nextchain)->elt++ ;
else
m_err1("Undefined element: %s", name) ;
nextchain = &(*nextchain)->next ;
}
;
text
declitent:declitent {
if (entclen >= M_LITLEN) {
curcon = EDECLITENT ;
m_error("Entity content too long") ;
}
else entcontent[entclen++] = textchar ;
}
declitaent:declitaent {
if (entclen >= M_LITLEN) {
curcon = EDCLITAENT ;
m_error("Entity content too long") ;
}
else entcontent[entclen++] = textchar ;
}
edeclitent:edeclitent
edclitaent:edclitaent
insignon:insignon {
socr = (LOGICAL) (textchar == '\n') ;
signonmsg[sochar++] = textchar ;
if (sochar >= SOCHAR) {
m_error("Exceeded buffer for sign-on message") ;
exit(TRUE) ;
}
}
globdef:globdef {
fprintf(globdef, "%c", textchar) ;
/* if (textchar == '\n') fprintf(globdef, "#line %d \"%s\"\n",
m_line, iffile) ; */
}
globdec:globdec {
fprintf(globdec, "%c", textchar) ;
/* if (textchar == '\n') fprintf(globdec, "#line %d \"%s\"\n",
m_line, iffile) ; */
}
iniss:iniss,
inss:inss {
if (! stringstart) fprintf(string, ",\n") ;
fprintf(string, " %d", textchar) ;
stringstart = FALSE ;
stringcnt++ ;
}
inies:inies,
ines:ines {
if (! stringstart) fprintf(string, ",\n") ;
fprintf(string, " %d", textchar) ;
stringstart = FALSE ;
stringcnt++ ;
}
inisc:inisc,
insc:insc {
fprintf(sfile, "%c", textchar) ;
/* if (textchar == '\n') fprintf(sfile, "#line %d \"%s\"\n",
m_line, iffile) ; */
}
iniec:iniec,
inec:inec {
fprintf(efile, "%c", textchar) ;
/* if (textchar == '\n') fprintf(efile, "#line %d \"%s\"\n",
m_line, iffile) ; */
}
initc:initc,
intc:intc {
fprintf(tfile, "%c", textchar) ;
/* if (textchar == '\n') fprintf(tfile, "#line %d \"%s\"\n",
m_line, iffile) ; */
}
inipc:inipc,
inpc:inpc {
fprintf(pfile, "%c", textchar) ;
/* if (textchar == '\n') fprintf(pfile, "#line %d \"%s\"\n",
m_line, iffile) ; */
}
inistc:inistc,
instc:instc {
fprintf(stfile, "%c", textchar) ;
/* if (textchar == '\n') fprintf(stfile, "#line %d \"%s\"\n",
m_line, iffile) ; */
}
inentc:inentc {
fprintf(entfile, "%c", textchar) ;
/* if (textchar == '\n') fprintf(entfile, "#line %d \"%s\"\n",
m_line, iffile) ; */
}
;

View File

@@ -0,0 +1,74 @@
/* $XConsortium: eltdef.c /main/3 1995/11/08 09:27:27 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Eltdef.c contains the main program for ELTDEF */
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "basic.h"
#include "trie.h"
#define M_DTDDEF
#include "dtd.h"
#include "context.h"
#include "delim.h"
#define ELTDEF
#include "eltdef.h"
#define M_ENTDEF
#include "entity.h"
/* Main program */
void main(argc, argv)
int argc ;
char **argv ;
{
int m_token ;
if (argc > 2)
if (*argv[2] == '-') {
if (strchr(argv[2], 'a')) m_malftrace = TRUE ;
if (strchr(argv[2], 'A')) m_malftrace = TRUE ;
if (strchr(argv[2], 'd')) debug = TRUE ;
if (strchr(argv[2], 'D')) debug = TRUE ;
if (strchr(argv[2], 'h')) m_heapchk = TRUE ;
if (strchr(argv[2], 'H')) m_heapchk = TRUE ;
if (strchr(argv[2], 's')) scantrace = TRUE ;
if (strchr(argv[2], 'S')) scantrace = TRUE ;
}
else
fprintf(stderr,
"****Starting with MARKUP 2.0, ELTDEF no longer writes a statistics file"
) ;
if (argc < 2) {
fprintf(stderr, "**** Specify interface file ****\n") ;
exit(TRUE) ;
}
strncpy(iffile, argv[1], IFLEN) ;
initialize() ;
while (TRUE) {
m_token = scan() ;
if (m_token == ELT) restart = RELEMENT ;
m_prevcon = curcon ;
curcon = m_newcon(m_prevcon - 1, m_token - 1) ;
if (scantrace)
printf(
"Main: m_prevcon=%d,m_token=%d,curcon=%d,textchar='%c'(%d), line=%d\n",
m_prevcon, m_token, curcon, textchar, textchar, m_line) ;
#include "case.c"
if (m_token == ENDFILE) break ;
if (! curcon) {
m_error("Parsing table error") ;
break ;
}
}
done() ;
}

View File

@@ -0,0 +1,219 @@
/* $XConsortium: eltdef.h /main/3 1995/11/08 09:27:36 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Eltdef.h is the include file for allocating global variables in ELTDEF */
#if defined(ELTDEF)
#define ELTEXTERN
#define ELTINIT(a) = a
#else
#define ELTEXTERN extern
#define ELTINIT(a)
#endif
#include "common.h"
/* Error recovery status */
#define RENTITY 0
#define RSIGNON 1
#define RGLOBDEC 2
#define RGLOBDEF 3
#define RELEMENT 4
/* State transition network generated by CONTEXT */
#include "sparse.h"
/* Indicates whether, and if so where, each character can appear in
a name */
#if defined(ELTDEF)
#include "chartype.h"
#else
extern M_CHARTYPE m_ctarray[M_CHARSETLEN] ;
#endif
/* Scanned name or literal */
ELTEXTERN M_WCHAR name[M_NAMELEN + 1] ;
ELTEXTERN M_WCHAR literal[M_LITLEN + 1] ;
/* Associates a C variable with a particular parameter */
typedef struct cvarstruct CVARSTRUCT ;
struct cvarstruct {
int param ;
M_WCHAR *cvarptr ;
CVARSTRUCT *next ;
} ;
ELTEXTERN CVARSTRUCT *cvarlist ;
/* Current and previous context (state) of transition system
controlling ELTDEF */
ELTEXTERN int curcon ELTINIT(START) ;
ELTEXTERN int m_prevcon ;
/* Character read-ahead buffer */
ELTEXTERN int toundo ELTINIT(0) ;
ELTEXTERN int maxundo ELTINIT(0) ;
#define SAVECHAR 50
ELTEXTERN int savechar[SAVECHAR] ;
/* Chain of elements named in pseudo-tag */
typedef struct chain CHAIN ;
struct chain {
M_ELEMENT elt ;
CHAIN *next ;
} ;
ELTEXTERN CHAIN *firstchain ELTINIT(NULL) ;
ELTEXTERN CHAIN **nextchain ELTINIT(&firstchain) ;
/* Text character returned from scanner */
ELTEXTERN M_WCHAR textchar ;
/* Identifying index of element currently being processed */
ELTEXTERN M_ELEMENT openelt ELTINIT(M_NULLVAL) ;
/* Output files */
ELTEXTERN FILE *globdec, *globdef, *string,
*pfile, *tfile, *sfile, *efile, *entfile, *ifile, *stfile, *ifh, *pvalh ;
/* Flags indicating whether currently in the middle of processing
an action */
ELTEXTERN LOGICAL intext ELTINIT(FALSE),
inent ELTINIT(FALSE),
inpc ELTINIT(FALSE),
insc ELTINIT(FALSE),
inec ELTINIT(FALSE),
instc ELTINIT(FALSE),
instring ELTINIT(FALSE) ;
/* Location of global start-string and end-string, if any */
ELTEXTERN int gss ELTINIT(0),
ges ELTINIT(0) ;
/* Flags indicating whether default code setments are to be used */
ELTEXTERN LOGICAL finitext ELTINIT(TRUE),
finipi ELTINIT(TRUE),
finistc ELTINIT(TRUE) ;
/* Whether have finished the sign-on message */
ELTEXTERN LOGICAL signonend ELTINIT(FALSE) ;
/* Whether errors have occurred */
ELTEXTERN LOGICAL errexit ELTINIT(FALSE) ;
/* Number of characters currently written to stext.h and etext.h */
ELTEXTERN int stringcnt ELTINIT(1) ;
/* Number of actions so far written to code files */
ELTEXTERN int sactions ELTINIT(1),
eactions ELTINIT(1),
tactions ELTINIT(1),
pactions ELTINIT(1),
stactions ELTINIT(1) ;
/* Pool of ponters for associating a chain of elements with an action string
or code */
typedef struct action ACTION ;
struct action {
int data ;
M_ELEMENT element ;
int count ;
ACTION *son ;
ACTION *next ;
ACTION *nextact ;
} ;
ELTEXTERN int actlen ELTINIT(0) ;
ELTEXTERN ACTION *firstact ELTINIT(NULL) ;
ELTEXTERN ACTION **nextact ELTINIT(&firstact) ;
/* Number of elements defined in the document type */
#if defined(M_DTDDEF)
#define ELCOUNT sizeof(m_element)/sizeof(m_element[0])
#else
#define ELCOUNT
#endif
/* Action arrays, indexed by the element in which they occur. Each element
is a linked list for actions qualified by the context in which they
occur. */
ELTEXTERN ACTION *starray[ELCOUNT],
*etarray[ELCOUNT],
*scarray[ELCOUNT],
*ecarray[ELCOUNT],
*tcarray[ELCOUNT],
*pcarray[ELCOUNT],
*stcarray[ELCOUNT] ;
/* Store the sign-on message */
#define SOCHAR 512
ELTEXTERN char signonmsg[SOCHAR] ;
ELTEXTERN int sochar ELTINIT(0) ;
/* Indicates which elements have been processed at a particular time */
ELTEXTERN LOGICAL processed[ELCOUNT] ;
/* Flags to indicate whether data has yet been written to various files */
ELTEXTERN LOGICAL stringstart ELTINIT(TRUE) ;
/* Flag indicating whether a carriage return was the last character of
the signon message */
ELTEXTERN LOGICAL socr ELTINIT(FALSE) ;
/* Number of current input line */
ELTEXTERN int m_line ELTINIT(1) ;
/* Pointer to file error for error messages */
ELTEXTERN FILE *m_errfile ;
/* Name of interface file */
#define IFLEN 512
ELTEXTERN char iffile[IFLEN] ;
/* Pointer to current entity */
ELTEXTERN M_ENTITY *entity ;
/* Count of code entities defined */
ELTEXTERN int codeent ELTINIT(0) ;
/* Content of entity being defined */
ELTEXTERN int entclen ;
ELTEXTERN M_WCHAR entcontent[M_LITLEN + 1] ;
/* Error recovery status */
ELTEXTERN int restart ELTINIT(RENTITY) ;
/* Strings to write to generated files */
#define pproto "M_WCHAR *m_pi, M_WCHAR *m_entname, int m_enttype"
#define pformal "m_pi, m_entname, m_enttype"
#define pftype " M_WCHAR *m_pi ;\n M_WCHAR *m_entname ;\n int m_enttype ;"
#define tproto "M_WCHAR m_textchar"
#define tformal "m_textchar"
#define tftype " M_WCHAR m_textchar ;\n"
#define stproto "M_WCHAR *m_string, LOGICAL M_START, LOGICAL M_END"
#define stformal "m_string, M_START, M_END"
#define stft " M_WCHAR *m_string ;\n LOGICAL M_START ;\n LOGICAL M_END ;\n"
#define nopar "M_NOPAR"
/* Structures for generating defines for parameter values */
ELTEXTERN M_TRIE parval ;
typedef struct {
M_WCHAR *cname ;
M_WCHAR *value ;
int line ;
} PARVAL ;
ELTEXTERN PARVAL *pval ;
/* Function prototypes */
#include "proto.h"
/* Flag to open fewer files for convenience of debugging with
CodeView */
ELTEXTERN LOGICAL debug ELTINIT(FALSE) ;
/* Scanner trace for debugging */
ELTEXTERN LOGICAL scantrace ELTINIT(FALSE) ;
/* Test validity of heap in calls to malloc/free */
ELTEXTERN LOGICAL m_heapchk ELTINIT(FALSE) ;
/* Trace calls to malloc/free */
ELTEXTERN LOGICAL m_malftrace ELTINIT(FALSE) ;

View File

@@ -0,0 +1,675 @@
/* $XConsortium: eltutil.c /main/3 1995/11/08 09:27:46 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Eltutil.c contains procedures for program ELTDEF */
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "eltdef.h"
#include "delim.h"
#include "context.h"
#include "entext.h"
#include "version.h"
/* Output indicated action pointer array to if.h */
void actptrout(array, name)
ACTION **array;
char *name;
{
int i;
fprintf(ifh, "M_IFEXTERN int %s[%d]\n#if defined(M_IFDEF)\n = {\n",
name, m_elcount);
for (i = 0 ; i < m_elcount ; i++) {
if (i > 0) fprintf(ifh, ",\n");
fprintf(ifh, " %d", array[i] ? array[i]->count : M_NULLVAL);
}
fprintf(ifh, "}\n#endif\n ;\n");
}
/* Close a code file and write jump table at the end */
#if defined(M_PROTO)
void closeiffile(LOGICAL flag, FILE *file, int count, char *table, char *proto)
#else
void closeiffile(flag, file, count, table, proto)
LOGICAL flag;
FILE *file;
int count;
char *table;
char *proto;
#endif
{
int i;
endcode(flag, file);
if (count) {
fprintf(file,
"void (*m_%stable[])(\n#if defined(M_PROTO)\n %s\n#endif\n ) = {\n",
table, proto);
fprintf(file, " m_%s1, /* Place holder for 1-based indexing */\n",
table);
for (i = 1 ; i <= count ; i++) {
fprintf(file, " m_%s%d", table, i);
if (i != count) fputs(",\n", file);
}
fputs("} ;\n", file);
}
else
fprintf(file,
"void (*m_%stable[1])(\n#if defined(M_PROTO)\n %s\n#endif\n ) ;\n",
table, proto);
fclose(file);
}
/* Called when the C identifier to be #define'd to a parameter value is
scanned */
void cvalue(M_NOPAR)
{
PARVAL *new;
new = (PARVAL *) m_malloc(sizeof(PARVAL), "parameter value");
if (pval = (PARVAL *) m_ntrtrie(name, &parval, (M_TRIE *) new))
m_free(new, "parameter value");
else {
new->line = 0;
new->value = NULL;
new->cname = (M_WCHAR *) m_malloc(w_strlen(name) + 1, "C name");
w_strcpy(new->cname, name);
pval = new;
}
}
/* Called after last input character is read to place closing punctuation
at end of output files and close them */
void done(M_NOPAR)
{
M_ENTITY *ent;
ACTION *actp;
LOGICAL first;
int i;
closeiffile(inent, entfile, codeent, "c", nopar);
closeiffile(intext, tfile, tactions, "t", tproto);
closeiffile(inpc, pfile, pactions, "p", pproto);
closeiffile(insc, sfile, sactions, "s", nopar);
closeiffile(inec, efile, eactions, "e", nopar);
closeiffile(instc, stfile, stactions, "st", stproto);
endstring();
fclose(string);
/* Write if.h (which was opened for sign-on message) */
fprintf(ifh, "M_IFEXTERN int m_gss M_IFINIT(%d) ;\n", gss);
fprintf(ifh, "M_IFEXTERN int m_ges M_IFINIT(%d) ;\n", ges);
fputs("M_IFEXTERN struct {\n", ifh);
fputs(" int data ;\n", ifh);
fputs(" M_ELEMENT element ;\n", ifh);
fputs(" int son ;\n", ifh);
fputs(" int next ;\n", ifh);
if (actlen) {
fprintf(ifh,
" } m_action[%d]\n#if defined(M_IFDEF)\n = {\n",
actlen);
first = TRUE;
for (actp = firstact ; actp ; actp = actp->nextact) {
if (first) first = FALSE;
else fprintf(ifh, ",\n");
fprintf(ifh, " %d, %d, %d, %d",
actp->data, actp->element,
actp->son ? actp->son->count : M_NULLVAL,
actp->next ? actp->next->count : M_NULLVAL);
}
fprintf(ifh, "}\n#endif\n ;\n");
}
else fputs(" } m_action[1] ;\n", ifh);
actptrout(starray, "m_starray");
actptrout(etarray, "m_etarray");
actptrout(scarray, "m_scarray");
actptrout(ecarray, "m_ecarray");
actptrout(tcarray, "m_tcarray");
actptrout(pcarray, "m_pcarray");
actptrout(stcarray, "m_stcarray");
outstring();
m_openchk(&pvalh, "pval.h", "w");
fputs("/* Parameter values specified in the interface */\n", pvalh);
if (parval.data) outpval(parval.data);
fclose(ifh);
/* Report any elements and entities left undefined */
for (i = 0 ; i < m_elcount ; i++)
if (! processed[i])
warning1("Warning: No specification for element %s",
&m_ename[m_element[i].enptr]);
for (ent = firstent ; ent ; ent = ent->next)
if (! ent->wheredef)
warning1("Warning: Entity %s undefined", ent->name);
entout("entity2");
exit(errexit);
}
/* Called when finished reading a section of code from the input file */
#if defined(M_PROTO)
void endcode(LOGICAL flag, FILE *file)
#else
void endcode(flag, file)
LOGICAL flag;
FILE *file;
#endif
{
if (flag) fprintf(file, "}}\n\n");
}
/* Called at the end of all initial fields in the interface definition */
void endini(M_NOPAR)
{
if (finitext)
fputs(" putc(m_textchar, m_outfile);\n", tfile);
if (finipi)
fputs(" fputs(m_pi, m_outfile) ;\n", pfile);
if (finistc)
{
fputs(" {\n", stfile);
fputs(" char *mb_string;\n", stfile);
fputs(" mb_string = MakeMByteString(m_string);\n", stfile);
fputs(" fputs(mb_string, m_outfile) ;\n", stfile);
fputs(" m_free(mb_string,\"multi-byte string\");;\n", stfile);
fputs(" }\n", stfile);
}
}
/* End the sign-on message */
#include <time.h>
void endsignon(M_NOPAR)
{
time_t storetime;
char *p;
char *timeofday;
static char signon1[] = "Interface generated from ";
static char signon2[] = " on ";
int i;
int len;
FILE *sgfile;
signonend = TRUE;
/* Discard a trailing carriage return in the sign-on message */
if (socr) sochar--;
time(&storetime);
timeofday = ctime(&storetime);
len =
sochar+strlen(signon1)+strlen(signon2)+strlen(iffile)+strlen(timeofday)
/* a byte for end of string marker */
+ 1
/* a byte for a carriage return after any user-supplied message */
+ (sochar ? 1 : 0);
m_openchk(&sgfile, "signonx.h", "w");
fprintf(sgfile, "extern char m_signon[%d] ;\n", len);
fclose(sgfile);
m_openchk(&sgfile, "signon.h", "w");
fprintf(sgfile, "char m_signon[%d] = {\n", len);
for (i = 0 ; i <sochar ; i++)
fprintf(sgfile, " %d,\n", signonmsg[i]);
if (sochar) fputs(" 10,\n", sgfile);
for (p = signon1 ; *p ; p++)
fprintf(sgfile, " %d,\n", *p);
for (p = iffile ; *p ; p++)
fprintf(sgfile, " %d,\n", *p);
for (p = signon2 ; *p ; p++)
fprintf(sgfile, " %d,\n", *p);
for (p = timeofday ; *p ; p++)
fprintf(sgfile, " %d,\n", *p);
fputs(" 0} ;\n", sgfile);
fclose(sgfile);
}
/* Closes a start-string or end-string */
void endstring(M_NOPAR)
{
if (instring) {
if (stringstart) stringstart = FALSE;
else fprintf(string, ",\n");
stringcnt++;
instring = FALSE;
fprintf(string, " 0");
}
/* If called after ENDFILE, ensure at least one character in output file*/
else if (stringstart) fprintf(string, " 0");
}
/* Set the type of an entity and check if different than declaration in
BUILD */
void enttype(type)
int type;
{
if ((entity->type == M_PI && type == M_CODEPI) ||
(entity->type == M_SDATA && type == M_CODESDATA));
else if (entity->type != M_GENERAL &&
entity->type != (unsigned char) type)
warning1("Redefining type of entity %s", name);
entity->type = (unsigned char) type;
}
/* Free storage used for a context-specification chain */
void freechain(M_NOPAR)
{
CHAIN *chainp, *dchainp;
for (chainp = firstchain ; chainp ;) {
dchainp = chainp;
chainp = chainp->next;
m_free(dchainp, "chain");
}
firstchain = NULL;
nextchain = &firstchain;
}
/* Returns pointer to data field in action node for current chain of
elements */
int *getaction(array)
ACTION **array;
{
ACTION *start, *node;
CHAIN *chainp;
if (! array[openelt - 1]) {
array[openelt - 1] = getactstruct();
array[openelt - 1]->element = openelt + 1;
}
start = array[openelt - 1];
for (chainp = firstchain ; chainp ; chainp = chainp->next) {
if (! start->son) {
for ( ; chainp ; chainp = chainp->next) {
start->son = getactstruct();
start->son->element = chainp->elt;
start = start->son;
}
freechain();
return(&start->data);
}
for (node = start->son ; node ; start = node, node = node->next)
if (node->element == chainp->elt) break;
if (! node) {
start->next = getactstruct();
start->next->element = chainp->elt;
start = start->next;
}
else start = node;
}
if (start->data) m_error("Duplicate specification");
freechain();
return(&start->data);
}
/* Allocate new action structure */
ACTION *getactstruct(M_NOPAR)
{
ACTION *new;
new = (ACTION *) m_malloc(sizeof(ACTION), "action");
new->count = ++actlen;
new->data = M_NULLVAL;
new->son = new->next = new->nextact = NULL;
*nextact = new;
nextact = &new->nextact;
return(new);
}
/* Program initialization */
void initialize(M_NOPAR)
{
char **mb_delims;
M_WCHAR **wc_delims;
fprintf(stderr, "MARKUP System - ELTDEF %s\n", M_VERSION);
fprintf(stderr, "Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.\n");
m_openchk(&ifh, "if.h", "w");
m_openchk(&globdef, "globdef.h", "w");
m_openchk(&globdec, "globdec.h", "w");
m_openchk(&pfile, "pfile.c", "w");
/* ELTDEF opens too many files for use with CodeView debugger. If
this option is set, all code segments are written to one file */
if (debug)
{
tfile =
sfile =
efile =
stfile =
entfile =
pfile;
}
else
{
m_openchk(&tfile, "tfile.c", "w");
m_openchk(&sfile, "sfile.c", "w");
m_openchk(&efile, "efile.c", "w");
m_openchk(&stfile, "stfile.c", "w");
m_openchk(&entfile, "entfile.c", "w");
}
m_openchk(&string, "estring.h", "w");
m_openchk(&m_errfile, "error", "w");
m_openchk(&ifile, iffile, "r");
mb_delims = mb_dlmptr;
wc_delims = m_dlmptr;
while (*mb_delims)
{
*wc_delims++ = MakeWideCharString(*mb_delims);
mb_delims++;
}
*wc_delims = 0;
/* Start array for sign-on message on globals.h. Also,
make sure there is at least one line in globals.h, because
DOS copy does not copy an empty file */
fputs("/* Global definitions specified by interface designer*/\n",
globdef);
fputs("/* Global declarations specified by interface designer*/\n",
globdec);
fputs("#if defined(M_IFDEF)\n", ifh);
fputs("#define M_IFEXTERN\n", ifh);
fputs("#define M_IFINIT(a) = a\n", ifh);
fputs("#else\n", ifh);
fputs("#define M_IFEXTERN extern\n", ifh);
fputs("#define M_IFINIT(a)\n", ifh);
fputs("#endif\n", ifh);
startcode(pactions, &inpc, pfile, "p", pproto, pformal, pftype);
startcode(tactions, &intext, tfile, "t", tproto, tformal, tftype);
startcode(sactions, &insc, sfile, "s", nopar, nopar, "");
startcode(eactions, &inec, efile, "e", nopar, nopar, "");
startcode(stactions, &instc, stfile, "st", stproto, stformal, stft);
}
/* Output definitions for strings */
void outstring(M_NOPAR)
{
int c;
m_openchk(&string, "estring.h", "r");
fprintf(ifh, "M_IFEXTERN char m_string[%d]\n",
stringcnt > 1 ? stringcnt - 1 : 1);
if (stringcnt - 1) {
fputs("#if defined(M_IFDEF)\n = {\n", ifh);
while ((c = getc(string)) != EOF) putc(c, ifh);
fputs("}\n#endif\n", ifh);
}
fputs(" ;\n", ifh);
fclose(string);
}
/* Output #define's for parameter values */
void outpval(p)
M_TRIE *p;
{
M_WCHAR *q;
for ( ; p ; p = p->next)
if (p->symbol) outpval(p->data);
else
{
char *mb_cname;
mb_cname = MakeMByteString(((PARVAL *) p->data)->cname);
fprintf(pvalh,
"/* line %d \"%s\" */\n",
((PARVAL *) p->data)->line,
iffile);
fprintf(pvalh, "#define %s \"", mb_cname);
m_free(mb_cname,"multi-byte string");
if (q = ((PARVAL *) p->data)->value)
for ( ; *q ; q++)
{
char mbq[32]; /* larger than largest possible mbyte char */
int length;
length = wctomb(mbq, *q);
if (length == 1)
switch (*mbq)
{
case '\n':
fputs("\\n", pvalh);
break;
case '"':
fputs("\\\"", pvalh);
break;
default:
putc(*mbq, pvalh);
break;
}
else
fputs(mbq, pvalh);
}
fputs("\"\n", pvalh);
}
}
/* Skip rest of statement after an error */
void skiptoend(M_NOPAR)
{
int i;
static errlev = 0;
CVARSTRUCT *cvarp, *dvarp;
for (cvarp = cvarlist ; cvarp ;) {
dvarp = cvarp;
m_free(cvarp->cvarptr, "C variable name");
cvarp = cvarp->next;
m_free(dvarp, "C variable");
}
cvarlist = NULL;
freechain();
if (! errlev++) {
curcon = ERROR;
while (TRUE) {
i = scan();
if (i == ENDFILE) break;
else if (i == ELT) {
if (restart <= RSIGNON) endsignon();
restart = RELEMENT;
curcon = NEEDN;
break;
}
else if (i == GDEF && restart < RGLOBDEF) {
if (restart <= RSIGNON) endsignon();
restart = RGLOBDEF;
curcon = GLOBDEF;
break;
}
else if (i == GDEC && restart < RGLOBDEC) {
if (restart <= RSIGNON) endsignon();
restart = RGLOBDEC;
curcon = GLOBDEC;
break;
}
else if (i == SIGNON && restart < RSIGNON) {
curcon = INSIGNON;
restart = RSIGNON;
break;
}
else if (i == ENTSTART && restart == RENTITY) {
curcon = ENTDEC;
break;
}
curcon = ERROR;
} /* end while */
} /* end if ! errlev */
errlev--;
}
/* Starts processing a code segment from the input file */
void startcode(caseno, flag, file, prefix, proto, formal, formtype)
int caseno;
LOGICAL *flag;
FILE *file;
char *prefix;
char *proto;
char *formal;
char *formtype;
{
CVARSTRUCT *cvarp;
endcode(*flag, file);
*flag = TRUE;
/* protoype */
fprintf(file,
"void m_%s%d(\n#if defined(M_PROTO)\n %s\n#endif\n ) ;\n",
prefix,
caseno,
proto);
/* ANSI defines */
fputs("#if defined(M_PROTO)\n", file);
fprintf(file, "void m_%s%d(%s)\n", prefix, caseno, proto);
fputs("#else\n", file);
fprintf(file,
"void m_%s%d(%s)\n%s\n#endif\n {\n", /* balance the "}" */
prefix,
caseno,
formal,
formtype);
for (cvarp = cvarlist ; cvarp ; cvarp = cvarp->next)
{
char *mb_cvarptr;
mb_cvarptr = MakeMByteString(cvarp->cvarptr);
fprintf(file, " M_WCHAR *%s ;\n", mb_cvarptr);
m_free(mb_cvarptr,"multi-byte string");
}
for (cvarp = cvarlist ; cvarp ; cvarp = cvarp->next)
{
char *mb_cvarptr;
mb_cvarptr = MakeMByteString(cvarp->cvarptr);
fprintf(file,
" m_setparam(&%s, %d) ;\n",
mb_cvarptr,
cvarp->param);
m_free(mb_cvarptr,"multi-byte string");
}
fprintf(file, "{\n/* line %d \"%s\" */\n", m_line, iffile); /* balance "}" */
}
/* Begins processing a new element */
void startelement(M_NOPAR)
{
CVARSTRUCT *cvarp;
CVARSTRUCT *discard;
for (cvarp = cvarlist ; cvarp ; ) {
discard = cvarp;
m_free(cvarp->cvarptr, "C variable name");
cvarp = cvarp->next;
m_free(discard, "C variable");
}
cvarlist = NULL;
if (openelt = m_packedlook(m_entree, name)) {
if (processed[openelt - 1])
warning1("Warning: Element %s already processed", name);
processed[openelt - 1] = TRUE;
}
else m_err1("Undefined element: %s", name);
}
/* Stores the name of a C variable read from the input file */
void storecvar(M_NOPAR)
{
CVARSTRUCT *new;
new = (CVARSTRUCT *) m_malloc(sizeof(CVARSTRUCT), "C variable");
new->cvarptr = (M_WCHAR *) m_malloc(w_strlen(name) + 1,
"C variable name");
w_strcpy(new->cvarptr, name);
new->next = cvarlist;
cvarlist = new;
}
/* Compares the parameter name associated with a C variable in the input
file with the names of all parameters of the current element. Stores
result for later output with code segments */
void storepname(M_NOPAR)
{
int i, par;
for (i = 0, par = m_element[openelt - 1].parptr;
i < m_element[openelt - 1].parcount;
i++, par++)
if (! w_strcmp(&m_pname[m_parameter[par - 1].paramname], name))
break;
if (i >= m_element[openelt - 1].parcount) {
m_err2("%s: No such parameter for element %s", name,
&m_ename[m_element[openelt - 1].enptr]);
return;
}
cvarlist->param = i;
}
/* Called when a possible parameter value to be defined is encountered */
void value(p)
M_WCHAR *p;
{
char buffer[5];
if (m_partype(cvarlist->param + m_element[openelt - 1].parptr, p))
{
if (pval->line)
{
if (w_strcmp(pval->value, p))
{
M_WCHAR *w_buffer;
sprintf(buffer, "%d", pval->line);
w_buffer = MakeWideCharString(buffer);
m_err5("Can't #define %s to %s. %s #define'd to %s on line %s",
pval->cname,
p,
pval->cname,
pval->value,
w_buffer);
m_free(w_buffer, "wide character string");
}
}
else {
pval->value = (M_WCHAR *) m_malloc(w_strlen(p) + 1, "pval value");
w_strcpy(pval->value, p);
pval->line = m_line;
}
}
else m_err3("\"%s\" illegal value for parameter %s of %s",
p,
&m_pname[m_parameter[cvarlist->param +
m_element[openelt - 1].parptr - 1].paramname],
&m_ename[m_element[openelt-1].enptr]);
}
#include "paramu.c"

View File

@@ -0,0 +1,51 @@
/* $XConsortium: entity.c /main/3 1995/11/08 09:27:56 rswiston $ */
/* Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co. */
/* Entity.c has ELTDEF procedures relevant to entities */
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "eltdef.h"
#include "entext.h"
/* Add an entity */
void addent(M_NOPAR)
{
M_ENTITY *new ;
new = (M_ENTITY *) m_malloc(sizeof(M_ENTITY), "entity") ;
if (entity = (M_ENTITY *) m_ntrtrie(name, m_enttrie, (M_TRIE *) new)) {
m_free(new, "entity") ;
if (! entity->wheredef) return ;
if (entity->wheredef == M_DBUILD) {
warning1("Redefining %s: entity defined in BUILD", entity->name) ;
entity->type = M_GENERAL ;
entity->wheredef = FALSE ;
entity->content = NULL ;
return ;
}
else
m_err1("Attempt to redefine %s", entity->name) ;
return ;
}
entity = new ;
if (lastent) lastent->next = entity ;
else firstent = entity ;
lastent = entity ;
entity->type = M_GENERAL ;
entity->wheredef = FALSE ;
entity->content = NULL ;
entity->name =
(M_WCHAR *) m_malloc(w_strlen(name) + 1, "entity name") ;
entity->index = ++m_entcnt ;
entity->codeindex = M_NULLVAL ;
entity->next = NULL ;
w_strcpy(entity->name, name) ;
return ;
}
#include "entout.c"

View File

@@ -0,0 +1,339 @@
/* $XConsortium: proto.h /main/3 1995/11/08 09:28:07 rswiston $ */
/*
Copyright (c) 1988, 1989 Hewlett-Packard Co.
*/
/* Proto.h contains function prototypes for program ELTDEF. */
void actptrout(
#if defined(M_PROTO)
ACTION **array, char *name
#endif
) ;
void addent(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL m_allwhite(
#if defined(M_PROTO)
const M_WCHAR *string
#endif
) ;
void closeiffile(
#if defined(M_PROTO)
LOGICAL flag, FILE *file, int count, char *table, char *proto
#endif
) ;
void countdown(
#if defined(M_PROTO)
M_TRIE *parent, int *count
#endif
) ;
void cvalue(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void done(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_dumptrie(
#if defined(M_PROTO)
FILE *file,
M_TRIE *xtrie,
char *extname,
int *count,
void (*proc)(M_ENTITY *)
#endif
) ;
void endcode(
#if defined(M_PROTO)
LOGICAL flag, FILE *file
#endif
) ;
void endini(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void endsignon(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void endstring(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void entout(
#if defined(M_PROTO)
char *fname
#endif
) ;
void enttype(
#if defined(M_PROTO)
int type
#endif
) ;
void m_error(
#if defined(M_PROTO)
char *text
#endif
) ;
void m_err1(
#if defined(M_PROTO)
const char *text, const M_WCHAR *arg
#endif
) ;
void m_mberr1(
#if defined(M_PROTO)
char *text, const char *arg
#endif
) ;
void m_err2(
#if defined(M_PROTO)
const char *text, const M_WCHAR *arg1, const M_WCHAR *arg2
#endif
) ;
void m_err3(
#if defined(M_PROTO)
char *text, M_WCHAR *arg1, M_WCHAR *arg2, M_WCHAR *arg3
#endif
) ;
void m_err5(
#if defined(M_PROTO)
char *text,
M_WCHAR *arg1, M_WCHAR *arg2, M_WCHAR *arg3, M_WCHAR *arg4, M_WCHAR *arg5
#endif
) ;
void m_exit(
#if defined(M_PROTO)
int status
#endif
) ;
void m_free(
#if defined(M_PROTO)
void *block, char *msg
#endif
) ;
void freechain(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int getachar(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int *getaction(
#if defined(M_PROTO)
ACTION **array
#endif
) ;
ACTION *getactstruct(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void getname(
#if defined(M_PROTO)
int first
#endif
) ;
int gettoken(
#if defined(M_PROTO)
int *c, int context
#endif
) ;
void m_initctype(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void initialize(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL m_letter(
#if defined(M_PROTO)
M_WCHAR c
#endif
) ;
LOGICAL litproc(
#if defined(M_PROTO)
int delim
#endif
) ;
void main(
#if defined(M_PROTO)
int argc, char **argv
#endif
) ;
void *m_malloc(
#if defined(M_PROTO)
int size, char *msg
#endif
) ;
void m_openchk(
#if defined(M_PROTO)
FILE **ptr, char *name, char *mode
#endif
) ;
void outpval(
#if defined(M_PROTO)
M_TRIE *p
#endif
) ;
void outstring(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int m_packedlook(
#if defined(M_PROTO)
M_PTRIE *xptrie, M_WCHAR *name
#endif
) ;
const M_WCHAR *m_partype(
#if defined(M_PROTO)
const int par, const M_WCHAR *string
#endif
) ;
int scan(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void skiptoend(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void startcode(
#if defined(M_PROTO)
int caseno, LOGICAL *flag, FILE *file, char *prefix, char *proto,
char *formal, char *formtype
#endif
) ;
void startelement(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void storecvar(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void storepname(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void undodelim(
#if defined(M_PROTO)
M_WCHAR *delim
#endif
) ;
void ungetachar(
#if defined(M_PROTO)
int c
#endif
) ;
int m_wcupstrcmp(
#if defined(M_PROTO)
const M_WCHAR *p, const M_WCHAR *q
#endif
) ;
int m_wcmbupstrcmp(
#if defined(M_PROTO)
const M_WCHAR *p, const char *q
#endif
) ;
int m_mbmbupstrcmp(
#if defined(M_PROTO)
const char *p, const char *q
#endif
) ;
void value(
#if defined(M_PROTO)
M_WCHAR *p
#endif
) ;
void warning(
#if defined(M_PROTO)
char *text
#endif
) ;
void warning1(
#if defined(M_PROTO)
char *text, M_WCHAR *arg
#endif
) ;
LOGICAL m_whitespace(
#if defined(M_PROTO)
M_WCHAR c
#endif
) ;

View File

@@ -0,0 +1,143 @@
/* $XConsortium: scan.c /main/3 1995/11/08 09:28:16 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Scan.c contains scanner procedures for program ELTDEF */
#include <stdio.h>
#include <string.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "eltdef.h"
#define M_CONDEF
#include "context.h"
#define M_DELIMDEF
#include "delim.h"
/* Reads a name token */
void getname(first)
int first;
{
M_WCHAR *p, wus;
int c, cttype;
LOGICAL cname;
mbtowc(&wus, "_", 1);
cname = (LOGICAL) (curcon == INPARAM || curcon == INVALUE);
*(p = name) = (M_WCHAR) first;
if (! cname) *p = m_ctupper(*p);
while (TRUE)
{
c = getachar();
if (c == EOF) break;
*++p = (M_WCHAR) c;
cttype = m_cttype(*p);
if (! cname)
{
if (cttype == M_NONNAME) break;
}
else
{
if ((cttype != M_NMSTART) && (cttype != M_DIGIT) && (*p != wus))
break;
}
if (p >= name + M_NAMELEN)
{
*(name + M_NAMELEN) = M_EOS;
m_error("Element name too long");
}
if (! cname) *p = m_ctupper(*p);
}
ungetachar(c);
*p = M_EOS;
}
/* Reads the next token and returns it to the main procedure */
int scan(M_NOPAR)
{
int c;
int n;
static char unexp[] = "c";
M_WCHAR wus;
mbtowc(&wus, "_", 1);
while (TRUE)
{
while ((n = gettoken(&c, COMCON)) == STARTCOMMENT)
while ((n = gettoken(&c, INCOM)) != ENDCOMMENT)
if (c == EOF)
{
m_error("EOF occurred within comment");
done();
exit(TRUE);
}
ungetachar(c);
n = gettoken(&c, curcon);
if (n)
{
if (n != LIT && n != LITA) return(n);
if (litproc(n))
{
if (scantrace)
{
char *mbyte;
mbyte = MakeMByteString(literal);
printf("literal '%s'\n", mbyte);
m_free(mbyte, "multi-byte string");
}
return(LITERAL);
}
}
if (c == EOF) return(ENDFILE);
if (m_newcon(curcon - 1, TEXT - 1))
{
textchar = (M_WCHAR) c;
return(TEXT);
}
if (m_whitespace((M_WCHAR) c)) continue;
if (m_newcon(curcon - 1, NAME - 1))
{
if (curcon == INPARAM || curcon == INVALUE)
{
/* Check for C identifier */
if (m_letter((M_WCHAR) c) || c == wus)
{
getname(c);
return(NAME);
}
}
else
{
/* Check for SGML name */
if ((m_cttype(c) == M_NMSTART) ||
(m_cttype(c) != M_NONNAME && curcon == VALUE))
{
getname(c);
return(NAME);
}
}
}
if (curcon != ERROR)
{
m_mberr1("Unexpected character: '%s'", unexp);
}
} /* End while */
} /* End scan */
#include "scanutil.c"
#if defined(sparse)
#include "sparse.c"
#endif

View File

@@ -0,0 +1,96 @@
XCOMM $XConsortium: Imakefile /main/9 1996/10/09 14:04:41 drk $
/* helptag Imakefile */
ARCCMD = arc u
UNARCCMD = arc x
ARCDELCMD = arc d
.SUFFIXES : .e .arc .c .h
HELPTAG = ..
HELPTAGSRC = $(HELPTAG)/helptag
HELPPARSERSRC = $(HELPTAG)/parser
HELPELTDEFSRC = $(HELPTAG)/eltdef
HELPDTDFILE = $(HELPTAGSRC)/hptag.dtd
HELPUTILSRC = $(HELPTAG)/util
HELPBUILDSRC = $(HELPTAG)/build
HELPUTILLIB = $(HELPTAG)/util/libutil.a
HELPIFFILE = $(HELPTAGSRC)/help.if
HELPTSSFILE = $(HELPTAGSRC)/htag.tss
XLATESRC = $(DTHELPSRC)
XLATEHDRS = $(XLATESRC)/XlationSvc.h $(XLATESRC)/LocaleXlate.h
XLATESRCS = LocaleXlate.c XlationSvc.c
XLATEOBJS = LocaleXlate.o XlationSvc.o
INCLUDES = -I. -I$(HELPUTILSRC) -I$(HELPPARSERSRC) \
-I$(HELPELTDEFSRC) -I$(XLATESRC)
DEFINES = -DOSMAJORVERSION=OSMajorVersion \
-DOSMINORVERSION=OSMinorVersion
ELTHDRS = $(HELPUTILSRC)/entdef.h $(HELPUTILSRC)/entext.h
XCOMM PARSEHDRS are header files used by many parser routines
PARSEHDRS = $(HELPUTILSRC)/basic.h $(HELPUTILSRC)/trie.h \
$(HELPUTILSRC)/common.h $(HELPUTILSRC)/dtddef.h \
$(HELPUTILSRC)/dtdext.h $(HELPUTILSRC)/sparse.h \
parser.h proto.h
APPLHDRS = $(PARSEHDRS) $(ELTHDRS) \
$(HELPUTILSRC)/version.h \
$(HELPTAGSRC)/global.h $(HELPTAGSRC)/charconv.h \
$(HELPTAGSRC)/roman8.h $(HELPTAGSRC)/fproto.h \
../parser/pval.h ../parser/globdec.h ../parser/signonx.h \
../parser/userinc.h
SRCS = custom.c default.c help.c make.c option.c out.c special.c xref.c \
$(XLATESRCS)
OBJS = custom.o default.o help.o make.o option.o out.o special.o xref.o \
$(XLATEOBJS)
LOCAL_LIBRARIES = $(HELPUTILLIB)
/* Don't use shared libs for hp */
#ifdef HPArchitecture
#if OSMajorVersion > 7
EXTRA_LOAD_FLAGS = -Wl,-a archive
#endif
#endif
#if defined (SunArchitecture)
SYS_LIBRARIES = -lm -ldl -lgen -lC
#endif /* SunArchitecture */
all:: $(OBJS)
LinkSourceFile(LocaleXlate.c,$(DTSVCSRC)/DtUtil2)
LinkSourceFile(XlationSvc.c,$(DTSVCSRC)/DtUtil2)
NormalLibraryObjectRule()
dthelp_ctag1: $(HELPPARSERSRC)/parser
$(RM) dthelp_ctag1
$(CP) $(HELPPARSERSRC)/parser dthelp_ctag1
clean::
$(RM) dthelp_ctag1
$(RM) $(XLATESRCS)
DependTarget()
arcappl archptag :
if exist hptag.arc $(CP) hptag.arc hptag.old
$(ARCCMD) hptag.arc *.c *.h linkcmd.dos linkcmd.unx $(HELPDTDFILE) \
tex.if makefile makefile.doc make.ini delim.*
unarcappl unarchptag :
$(UNARCCMD) hptag.arc
tags ::
etags -t *.c *.h *.if
etags ::
etags -t *.c *.h *.if

View File

@@ -0,0 +1,15 @@
/* $XConsortium: calculat.c /main/3 1995/11/08 09:28:53 rswiston $ */
/*
* Copyright 1989 Hewlett-Packard Co.
*
*
* procedures used by calculator elements for 1.2 release 26jul89-pj
*
* NOTE : This file is used as a Microsoft Linker overlay, so it cannot
* have functions as pointers, eg. (proc *) f(). Routines that are
* or invoke function pointers should be in tex.c.
*
*/
/* Obsolete */

View File

@@ -0,0 +1,806 @@
/* $XConsortium: calculat.h /main/3 1995/11/08 09:29:08 rswiston $ */
/* this file contains special character expansions for various characters
* in Dot Matrix (computer), Menu Label (ml), and White Menu Label (wl)
* arrays are: ccompspec[] --> computer specials
* cmenlspec[] --> menu label specials
* cwmenlspec[]--> white menu label specials
*/
/* special computer expansions for dot matrix in calculator style */
EXTERN char *ccompspec[256]
#if defined(DEFINE)
= {
/* Char Name TeX Expansion */
/* */
/* 0: ^@ NUL */ 0,
/* 1: ^A SOH */ 0,
/* 2: ^B STX */ 0,
/* 3: ^C ETX */ 0,
/* 4: ^D EOT */ 0,
/* 5: ^E ENQ */ 0,
/* 6: ^F ACK */ 0,
/* 7: ^G BEL */ 0,
/* 8: ^H BS */ 0,
/* 9: ^I HT */ 0,
/* 10: ^J LF */ 0,
/* 11: ^K VT */ 0,
/* 12: ^L FF */ 0,
/* 13: ^M CR */ 0,
/* 14: ^N SO */ 0,
/* 15: ^O SI */ 0,
/* 16: ^P DLE */ 0,
/* 17: ^Q DC1 */ 0,
/* 18: ^R DC2 */ 0,
/* 19: ^S DC3 */ 0,
/* 20: ^T DC4 */ 0,
/* 21: ^U NAK */ 0,
/* 22: ^V SYN */ 0,
/* 23: ^W ETB */ 0,
/* 24: ^X CAN */ 0,
/* 25: ^Y EM */ 0,
/* 26: ^Z SUB */ 0,
/* 27: ^[ ESC */ 0,
/* 28: ^\ FS */ 0,
/* 29: ^] GS */ 0,
/* 30: ^^ RS */ 0,
/* 31: ^_ US */ 0,
/* 32: SP */ 0,
/* 33: ! */ 0,
/* 34: " */ 0,
/* 35: # */ "\\#",
/* 36: $ */ "{\\dollar}",
/* 37: % */ "\\%",
/* 38: & */ "\\&",
/* 39: ' */ "{'}",
/* 40: ( */ 0,
/* 41: ) */ 0,
/* 42: * */ 0,
/* 43: + */ 0,
/* 44: , */ 0,
/* 45: - */ "{-}",
/* 46: . */ 0,
/* 47: / */ 0,
/* 48: 0 */ 0,
/* 49: 1 */ 0,
/* 50: 2 */ 0,
/* 51: 3 */ 0,
/* 52: 4 */ 0,
/* 53: 5 */ 0,
/* 54: 6 */ 0,
/* 55: 7 */ 0,
/* 56: 8 */ 0,
/* 57: 9 */ 0,
/* 58: : */ 0,
/* 59: ; */ 0,
/* 60: < */ "{\\tendmb\\char'045}",
/* 61: = */ 0,
/* 62: > */ "{\\tendmb\\char'046}",
/* 63: ? */ 0,
/* 64: @ */ 0,
/* 65: A */ 0,
/* 66: B */ 0,
/* 67: C */ 0,
/* 68: D */ 0,
/* 69: E */ 0,
/* 70: F */ 0,
/* 71: G */ 0,
/* 72: H */ 0,
/* 73: I */ 0,
/* 74: J */ 0,
/* 75: K */ 0,
/* 76: L */ 0,
/* 77: M */ 0,
/* 78: N */ 0,
/* 79: O */ 0,
/* 80: P */ 0,
/* 81: Q */ 0,
/* 82: R */ 0,
/* 83: S */ 0,
/* 84: T */ 0,
/* 85: U */ 0,
/* 86: V */ 0,
/* 87: W */ 0,
/* 88: X */ 0,
/* 89: Y */ 0,
/* 90: Z */ 0,
/* 91: [ */ 0,
/* 92: \\ */ "{\\tendmb\\char'047}",
/* 93: ] */ 0,
/* 94: ^ */ "{\\tendmb\\char'064}",
/* 95: _ */ "{\\tendmb\\char'066}",
/* 96: ` */ "{`}",
/* 97: a */ 0,
/* 98: b */ 0,
/* 99: c */ 0,
/* 100: d */ 0,
/* 101: e */ 0,
/* 102: f */ 0,
/* 103: g */ 0,
/* 104: h */ 0,
/* 105: i */ 0,
/* 106: j */ 0,
/* 107: k */ 0,
/* 108: l */ 0,
/* 109: m */ 0,
/* 110: n */ 0,
/* 111: o */ 0,
/* 112: p */ 0,
/* 113: q */ 0,
/* 114: r */ 0,
/* 115: s */ 0,
/* 116: t */ 0,
/* 117: u */ 0,
/* 118: v */ 0,
/* 119: w */ 0,
/* 120: x */ 0,
/* 121: y */ 0,
/* 122: z */ 0,
/* 123: { */ "{\\tendmb\\char'070}",
/* 124: | */ "{\\tendmb\\char'104}",
/* 125: } */ "{\\tendmb\\char'107}",
/* 126: ~ */ "{\\tendmb\\char'116}",
/* 127: DEL */ 0,
/* 128: undefined */ 0,
/* 129: undefined */ 0,
/* 130: undefined */ 0,
/* 131: undefined */ 0,
/* 132: undefined */ 0,
/* 133: undefined */ 0,
/* 134: undefined */ 0,
/* 135: undefined */ 0,
/* 136: undefined */ 0,
/* 137: undefined */ 0,
/* 138: undefined */ 0,
/* 139: undefined */ 0,
/* 140: undefined */ 0,
/* 141: undefined */ 0,
/* 142: undefined */ 0,
/* 143: undefined */ 0,
/* 144: undefined */ 0,
/* 145: undefined */ 0,
/* 146: undefined */ 0,
/* 147: undefined */ 0,
/* 148: undefined */ 0,
/* 149: undefined */ 0,
/* 150: undefined */ 0,
/* 151: undefined */ 0,
/* 152: undefined */ 0,
/* 153: undefined */ 0,
/* 154: undefined */ 0,
/* 155: undefined */ 0,
/* 156: undefined */ 0,
/* 157: undefined */ 0,
/* 158: undefined */ 0,
/* 159: undefined */ 0,
/* 160: undefined */ 0,
/* 161: A grave */ "{\\tendmc\\char'041}",
/* 162: A circumflex */ "{\\tendmc\\char'042}",
/* 163: E grave */ "{\\tendmc\\char'043}",
/* 164: E circumflex */ "{\\tendmc\\char'044}",
/* 165: E dieresis */ "{\\tendmc\\char'045}",
/* 166: I circumflex */ "{\\tendmc\\char'046}",
/* 167: I dieresis */ "{\\tendmc\\char'047}",
/* 168: acute accent */ "{\\tendma\\char'023}",
/* 169: grave accent */ "{\\tendma\\char'022}",
/* 170: circumflex */ "{\\tendma\\char'136}",
/* 171: dieresis */ "{\\tendma\\char'177}",
/* 172: tilde */ "{\\tendma\\char'176}",
/* 173: U grave */ "{\\tendmc\\char'050}",
/* 174: U circumflex */ "{\\tendmc\\char'051}",
/* 175: Italian Lira */ 0,
/* 176: overbar */ 0,
/* 177: Y acute */ "{\\tendmc\\char'053}",
/* 178: y acute */ "{\\tendmc\\char'054}",
/* 179: degree */ 0,
/* 180: C cedilla */ "{\\tendma\\char'030}",
/* 181: c cedilla */ "{\\tendma\\char'030}",
/* 182: N tilde */ "{\\tendmc\\char'055}",
/* 183: n tilde */ "{\\tendmc\\char'056}",
/* 184: inverted exclamation mark */ "{\\tendma\\char'074}",
/* 185: inverted question mark */ "{\\tendma\\char'076}",
/* 186: currency sign */ 0,
/* 187: pound sterling */ 0,
/* 188: Yen */ 0,
/* 189: Section sign */ 0,
/* 190: florin */ 0,
/* 191: Cent sign */ 0,
/* 192: a circumflex */ "{\\tendmc\\char'063}",
/* 193: e circumflex */ "{\\tendmc\\char'064}",
/* 194: o circumflex */ "{\\tendmc\\char'065}",
/* 195: u circumflex */ "{\\tendmc\\char'066}",
/* 196: a acute */ "{\\tendmc\\char'067}",
/* 197: e acute */ "{\\tendmc\\char'070}",
/* 198: o acute */ "{\\tendmc\\char'071}",
/* 199: u acute */ "{\\tendmc\\char'072}",
/* 200: a grave */ "{\\tendmc\\char'073}",
/* 201: e grave */ "{\\tendmc\\char'074}",
/* 202: o grave */ "{\\tendmc\\char'075}",
/* 203: u grave */ "{\\tendmc\\char'076}",
/* 204: a dieresis */ "{\\tendmc\\char'077}",
/* 205: e dieresis */ "{\\tendmc\\char'100}",
/* 206: o dieresis */ "{\\tendmc\\char'101}",
/* 207: u dieresis */ "{\\tendmc\\char'102}",
/* 208: A angstrom */ "{\\tendmc\\char'103}",
/* 209: i circumflex */ "{\\tendmc\\char'104}",
/* 210: O slash */ "{\\tendma\\char'037}",
/* 211: AE ligature */ "{\\tendma\\char'035}",
/* 212: a angstrom */ "{\\tendmc\\char'105}",
/* 213: i acute */ "{\\tendmc\\char'106}",
/* 214: o slash */ "{\\tendma\\char'034}",
/* 215: ae ligature */ "{\\tendma\\char'032}",
/* 216: A dieresis */ "{\\tendmc\\char'107}",
/* 217: i grave */ "{\\tendmc\\char'110}",
/* 218: O dieresis */ "{\\tendmc\\char'111}",
/* 219: U dieresis */ "{\\tendmc\\char'112}",
/* 220: E acute */ "{\\tendmc\\char'113}",
/* 221: i dieresis */ "{\\tendmc\\char'114}",
/* 222: SS ligature */ "{\\tendma\\char'031}",
/* 223: O circumflex */ "{\\tendmc\\char'115}",
/* 224: A acute */ "{\\tendmc\\char'116}",
/* 225: A tilde */ "{\\tendmc\\char'117}",
/* 226: a tilde */ "{\\tendmc\\char'120}",
/* 227: Eth */ 0,
/* 228: eth */ 0,
/* 229: I acute */ "{\\tendmc\\char'121}",
/* 230: I grave */ "{\\tendmc\\char'122}",
/* 231: O acute */ "{\\tendmc\\char'123}",
/* 232: O grave */ "{\\tendmc\\char'124}",
/* 233: O tilde */ "{\\tendmc\\char'125}",
/* 234: o tilde */ "{\\tendmc\\char'126}",
/* 235: S caron */ "{\\tendmc\\char'127}",
/* 236: s caron */ "{\\tendmc\\char'130}",
/* 237: U acute */ "{\\tendmc\\char'131}",
/* 238: Y dieresis */ "{\\tendmc\\char'132}",
/* 239: y dieresis */ "{\\tendmc\\char'133}",
/* 240: Thorn */ 0,
/* 241: thorn */ 0,
/* 242: undefined */ 0,
/* 243: mu */ 0,
/* 244: paragraph sign */ 0,
/* 245: fraction 3/4 */ 0,
/* 246: long dash */ 0,
/* 247: fraction 1/4 */ 0,
/* 248: fraction 1/2 */ 0,
/* 249: Female ordinal */ 0,
/* 250: Male ordinal */ 0,
/* 251: French double open quote */ 0,
/* 252: Solid square */ 0,
/* 253: French double close quote */ 0,
/* 254: Plus over minus sign */ 0,
/* 255: undefined */ 0
}
#endif
;
/* special menu label character expansions */
EXTERN char *cmenlspec[256]
#if defined(DEFINE)
= {
/* Char Name TeX Expansion */
/* */
/* 0: ^@ NUL */ 0,
/* 1: ^A SOH */ 0,
/* 2: ^B STX */ 0,
/* 3: ^C ETX */ 0,
/* 4: ^D EOT */ 0,
/* 5: ^E ENQ */ 0,
/* 6: ^F ACK */ 0,
/* 7: ^G BEL */ 0,
/* 8: ^H BS */ 0,
/* 9: ^I HT */ 0,
/* 10: ^J LF */ 0,
/* 11: ^K VT */ 0,
/* 12: ^L FF */ 0,
/* 13: ^M CR */ 0,
/* 14: ^N SO */ 0,
/* 15: ^O SI */ 0,
/* 16: ^P DLE */ 0,
/* 17: ^Q DC1 */ 0,
/* 18: ^R DC2 */ 0,
/* 19: ^S DC3 */ 0,
/* 20: ^T DC4 */ 0,
/* 21: ^U NAK */ 0,
/* 22: ^V SYN */ 0,
/* 23: ^W ETB */ 0,
/* 24: ^X CAN */ 0,
/* 25: ^Y EM */ 0,
/* 26: ^Z SUB */ 0,
/* 27: ^[ ESC */ 0,
/* 28: ^\ FS */ 0,
/* 29: ^] GS */ 0,
/* 30: ^^ RS */ 0,
/* 31: ^_ US */ 0,
/* 32: SP */ "{\\tenmlb\\char'146}",
/* 33: ! */ 0,
/* 34: " */ 0,
/* 35: # */ "\\#",
/* 36: $ */ "{\\dollar}",
/* 37: % */ "\\%",
/* 38: & */ "\\&",
/* 39: ' */ "{'}",
/* 40: ( */ 0,
/* 41: ) */ 0,
/* 42: * */ 0,
/* 43: + */ 0,
/* 44: , */ 0,
/* 45: - */ "{-}",
/* 46: . */ 0,
/* 47: / */ 0,
/* 48: 0 */ 0,
/* 49: 1 */ 0,
/* 50: 2 */ 0,
/* 51: 3 */ 0,
/* 52: 4 */ 0,
/* 53: 5 */ 0,
/* 54: 6 */ 0,
/* 55: 7 */ 0,
/* 56: 8 */ 0,
/* 57: 9 */ 0,
/* 58: : */ 0,
/* 59: ; */ 0,
/* 60: < */ "{\\tenmlb\\char'045}",
/* 61: = */ 0,
/* 62: > */ "{\\tenmlb\\char'046}",
/* 63: ? */ 0,
/* 64: @ */ 0,
/* 65: A */ 0,
/* 66: B */ 0,
/* 67: C */ 0,
/* 68: D */ 0,
/* 69: E */ 0,
/* 70: F */ 0,
/* 71: G */ 0,
/* 72: H */ 0,
/* 73: I */ 0,
/* 74: J */ 0,
/* 75: K */ 0,
/* 76: L */ 0,
/* 77: M */ 0,
/* 78: N */ 0,
/* 79: O */ 0,
/* 80: P */ 0,
/* 81: Q */ 0,
/* 82: R */ 0,
/* 83: S */ 0,
/* 84: T */ 0,
/* 85: U */ 0,
/* 86: V */ 0,
/* 87: W */ 0,
/* 88: X */ 0,
/* 89: Y */ 0,
/* 90: Z */ 0,
/* 91: [ */ 0,
/* 92: \\ */ "{\\tenmlb\\char'047}",
/* 93: ] */ 0,
/* 94: ^ */ "{\\tenmlb\\char'064}",
/* 95: _ */ "{\\tenmlb\\char'066}",
/* 96: ` */ "{`}",
/* 97: a */ 0,
/* 98: b */ 0,
/* 99: c */ 0,
/* 100: d */ 0,
/* 101: e */ 0,
/* 102: f */ 0,
/* 103: g */ 0,
/* 104: h */ 0,
/* 105: i */ 0,
/* 106: j */ 0,
/* 107: k */ 0,
/* 108: l */ 0,
/* 109: m */ 0,
/* 110: n */ 0,
/* 111: o */ 0,
/* 112: p */ 0,
/* 113: q */ 0,
/* 114: r */ 0,
/* 115: s */ 0,
/* 116: t */ 0,
/* 117: u */ 0,
/* 118: v */ 0,
/* 119: w */ 0,
/* 120: x */ 0,
/* 121: y */ 0,
/* 122: z */ 0,
/* 123: { */ "{\\tenmlb\\char'070}",
/* 124: | */ "{\\tenmlb\\char'104}",
/* 125: } */ "{\\tenmlb\\char'107}",
/* 126: ~ */ "{\\tenmlb\\char'116}",
/* 127: DEL */ 0,
/* 128: undefined */ 0,
/* 129: undefined */ 0,
/* 130: undefined */ 0,
/* 131: undefined */ 0,
/* 132: undefined */ 0,
/* 133: undefined */ 0,
/* 134: undefined */ 0,
/* 135: undefined */ 0,
/* 136: undefined */ 0,
/* 137: undefined */ 0,
/* 138: undefined */ 0,
/* 139: undefined */ 0,
/* 140: undefined */ 0,
/* 141: undefined */ 0,
/* 142: undefined */ 0,
/* 143: undefined */ 0,
/* 144: undefined */ 0,
/* 145: undefined */ 0,
/* 146: undefined */ 0,
/* 147: undefined */ 0,
/* 148: undefined */ 0,
/* 149: undefined */ 0,
/* 150: undefined */ 0,
/* 151: undefined */ 0,
/* 152: undefined */ 0,
/* 153: undefined */ 0,
/* 154: undefined */ 0,
/* 155: undefined */ 0,
/* 156: undefined */ 0,
/* 157: undefined */ 0,
/* 158: undefined */ 0,
/* 159: undefined */ 0,
/* 160: undefined */ 0,
/* 161: A grave */ "{\\tenmlc\\char'041}",
/* 162: A circumflex */ "{\\tenmlc\\char'042}",
/* 163: E grave */ "{\\tenmlc\\char'043}",
/* 164: E circumflex */ "{\\tenmlc\\char'044}",
/* 165: E dieresis */ "{\\tenmlc\\char'045}",
/* 166: I circumflex */ "{\\tenmlc\\char'046}",
/* 167: I dieresis */ "{\\tenmlc\\char'047}",
/* 168: acute accent */ "{\\tenmla\\char'023}",
/* 169: grave accent */ "{\\tenmla\\char'022}",
/* 170: circumflex */ "{\\tenmla\\char'136}",
/* 171: dieresis */ "{\\tenmla\\char'177}",
/* 172: tilde */ "{\\tenmla\\char'176}",
/* 173: U grave */ "{\\tenmlc\\char'050}",
/* 174: U circumflex */ "{\\tenmlc\\char'051}",
/* 175: Italian Lira */ 0,
/* 176: overbar */ 0,
/* 177: Y acute */ "{\\tenmlc\\char'053}",
/* 178: y acute */ "{\\tenmlc\\char'054}",
/* 179: degree */ 0,
/* 180: C cedilla */ "{\\tenmla\\char'030}",
/* 181: c cedilla */ "{\\tenmla\\char'030}",
/* 182: N tilde */ "{\\tenmlc\\char'055}",
/* 183: n tilde */ "{\\tenmlc\\char'056}",
/* 184: inverted exclamation mark */ "{\\tenmla\\char'074}",
/* 185: inverted question mark */ "{\\tenmla\\char'076}",
/* 186: currency sign */ 0,
/* 187: pound sterling */ 0,
/* 188: Yen */ 0,
/* 189: Section sign */ 0,
/* 190: florin */ 0,
/* 191: Cent sign */ 0,
/* 192: a circumflex */ "{\\tenmlc\\char'063}",
/* 193: e circumflex */ "{\\tenmlc\\char'064}",
/* 194: o circumflex */ "{\\tenmlc\\char'065}",
/* 195: u circumflex */ "{\\tenmlc\\char'066}",
/* 196: a acute */ "{\\tenmlc\\char'067}",
/* 197: e acute */ "{\\tenmlc\\char'070}",
/* 198: o acute */ "{\\tenmlc\\char'071}",
/* 199: u acute */ "{\\tenmlc\\char'072}",
/* 200: a grave */ "{\\tenmlc\\char'073}",
/* 201: e grave */ "{\\tenmlc\\char'074}",
/* 202: o grave */ "{\\tenmlc\\char'075}",
/* 203: u grave */ "{\\tenmlc\\char'076}",
/* 204: a dieresis */ "{\\tenmlc\\char'077}",
/* 205: e dieresis */ "{\\tenmlc\\char'100}",
/* 206: o dieresis */ "{\\tenmlc\\char'101}",
/* 207: u dieresis */ "{\\tenmlc\\char'102}",
/* 208: A angstrom */ "{\\tenmlc\\char'103}",
/* 209: i circumflex */ "{\\tenmlc\\char'104}",
/* 210: O slash */ "{\\tenmla\\char'037}",
/* 211: AE ligature */ "{\\tenmla\\char'035}",
/* 212: a angstrom */ "{\\tenmlc\\char'105}",
/* 213: i acute */ "{\\tenmlc\\char'106}",
/* 214: o slash */ "{\\tenmla\\char'034}",
/* 215: ae ligature */ "{\\tenmla\\char'032}",
/* 216: A dieresis */ "{\\tenmlc\\char'107}",
/* 217: i grave */ "{\\tenmlc\\char'110}",
/* 218: O dieresis */ "{\\tenmlc\\char'111}",
/* 219: U dieresis */ "{\\tenmlc\\char'112}",
/* 220: E acute */ "{\\tenmlc\\char'113}",
/* 221: i dieresis */ "{\\tenmlc\\char'114}",
/* 222: SS ligature */ "{\\tenmla\\char'031}",
/* 223: O circumflex */ "{\\tenmlc\\char'115}",
/* 224: A acute */ "{\\tenmlc\\char'116}",
/* 225: A tilde */ "{\\tenmlc\\char'117}",
/* 226: a tilde */ "{\\tenmlc\\char'120}",
/* 227: Eth */ 0,
/* 228: eth */ 0,
/* 229: I acute */ "{\\tenmlc\\char'121}",
/* 230: I grave */ "{\\tenmlc\\char'122}",
/* 231: O acute */ "{\\tenmlc\\char'123}",
/* 232: O grave */ "{\\tenmlc\\char'124}",
/* 233: O tilde */ "{\\tenmlc\\char'125}",
/* 234: o tilde */ "{\\tenmlc\\char'126}",
/* 235: S caron */ "{\\tenmlc\\char'127}",
/* 236: s caron */ "{\\tenmlc\\char'130}",
/* 237: U acute */ "{\\tenmlc\\char'131}",
/* 238: Y dieresis */ "{\\tenmlc\\char'132}",
/* 239: y dieresis */ "{\\tenmlc\\char'133}",
/* 240: Thorn */ 0,
/* 241: thorn */ 0,
/* 242: undefined */ 0,
/* 243: mu */ 0,
/* 244: paragraph sign */ 0,
/* 245: fraction 3/4 */ 0,
/* 246: long dash */ 0,
/* 247: fraction 1/4 */ 0,
/* 248: fraction 1/2 */ 0,
/* 249: Female ordinal */ 0,
/* 250: Male ordinal */ 0,
/* 251: French double open quote */ 0,
/* 252: Solid square */ 0,
/* 253: French double close quote */ 0,
/* 254: Plus over minus sign */ 0,
/* 255: undefined */ 0
}
#endif
;
/* white menu label special character expansions */
EXTERN char *cwmenlspec[256]
#if defined(DEFINE)
= {
/* Char Name TeX Expansion */
/* */
/* 0: ^@ NUL */ 0,
/* 1: ^A SOH */ 0,
/* 2: ^B STX */ 0,
/* 3: ^C ETX */ 0,
/* 4: ^D EOT */ 0,
/* 5: ^E ENQ */ 0,
/* 6: ^F ACK */ 0,
/* 7: ^G BEL */ 0,
/* 8: ^H BS */ 0,
/* 9: ^I HT */ 0,
/* 10: ^J LF */ 0,
/* 11: ^K VT */ 0,
/* 12: ^L FF */ 0,
/* 13: ^M CR */ 0,
/* 14: ^N SO */ 0,
/* 15: ^O SI */ 0,
/* 16: ^P DLE */ 0,
/* 17: ^Q DC1 */ 0,
/* 18: ^R DC2 */ 0,
/* 19: ^S DC3 */ 0,
/* 20: ^T DC4 */ 0,
/* 21: ^U NAK */ 0,
/* 22: ^V SYN */ 0,
/* 23: ^W ETB */ 0,
/* 24: ^X CAN */ 0,
/* 25: ^Y EM */ 0,
/* 26: ^Z SUB */ 0,
/* 27: ^[ ESC */ 0,
/* 28: ^\ FS */ 0,
/* 29: ^] GS */ 0,
/* 30: ^^ RS */ 0,
/* 31: ^_ US */ 0,
/* 32: SP */ "{\\tenwlb\\char'146}",
/* 33: ! */ 0,
/* 34: " */ 0,
/* 35: # */ "\\#",
/* 36: $ */ "{\\dollar}",
/* 37: % */ "\\%",
/* 38: & */ "\\&",
/* 39: ' */ "{'}",
/* 40: ( */ 0,
/* 41: ) */ 0,
/* 42: * */ 0,
/* 43: + */ 0,
/* 44: , */ 0,
/* 45: - */ "{-}",
/* 46: . */ 0,
/* 47: / */ 0,
/* 48: 0 */ 0,
/* 49: 1 */ 0,
/* 50: 2 */ 0,
/* 51: 3 */ 0,
/* 52: 4 */ 0,
/* 53: 5 */ 0,
/* 54: 6 */ 0,
/* 55: 7 */ 0,
/* 56: 8 */ 0,
/* 57: 9 */ 0,
/* 58: : */ 0,
/* 59: ; */ 0,
/* 60: < */ "{\\tenwlb\\char'045}",
/* 61: = */ 0,
/* 62: > */ "{\\tenwlb\\char'046}",
/* 63: ? */ 0,
/* 64: @ */ 0,
/* 65: A */ 0,
/* 66: B */ 0,
/* 67: C */ 0,
/* 68: D */ 0,
/* 69: E */ 0,
/* 70: F */ 0,
/* 71: G */ 0,
/* 72: H */ 0,
/* 73: I */ 0,
/* 74: J */ 0,
/* 75: K */ 0,
/* 76: L */ 0,
/* 77: M */ 0,
/* 78: N */ 0,
/* 79: O */ 0,
/* 80: P */ 0,
/* 81: Q */ 0,
/* 82: R */ 0,
/* 83: S */ 0,
/* 84: T */ 0,
/* 85: U */ 0,
/* 86: V */ 0,
/* 87: W */ 0,
/* 88: X */ 0,
/* 89: Y */ 0,
/* 90: Z */ 0,
/* 91: [ */ 0,
/* 92: \\ */ "{\\tenwlb\\char'047}",
/* 93: ] */ 0,
/* 94: ^ */ "{\\tenwlb\\char'064}",
/* 95: _ */ "{\\tenwlb\\char'066}",
/* 96: ` */ "{`}",
/* 97: a */ 0,
/* 98: b */ 0,
/* 99: c */ 0,
/* 100: d */ 0,
/* 101: e */ 0,
/* 102: f */ 0,
/* 103: g */ 0,
/* 104: h */ 0,
/* 105: i */ 0,
/* 106: j */ 0,
/* 107: k */ 0,
/* 108: l */ 0,
/* 109: m */ 0,
/* 110: n */ 0,
/* 111: o */ 0,
/* 112: p */ 0,
/* 113: q */ 0,
/* 114: r */ 0,
/* 115: s */ 0,
/* 116: t */ 0,
/* 117: u */ 0,
/* 118: v */ 0,
/* 119: w */ 0,
/* 120: x */ 0,
/* 121: y */ 0,
/* 122: z */ 0,
/* 123: { */ "{\\tenwlb\\char'070}",
/* 124: | */ "{\\tenwlb\\char'104}",
/* 125: } */ "{\\tenwlb\\char'107}",
/* 126: ~ */ "{\\tenwlb\\char'116}",
/* 127: DEL */ 0,
/* 128: undefined */ 0,
/* 129: undefined */ 0,
/* 130: undefined */ 0,
/* 131: undefined */ 0,
/* 132: undefined */ 0,
/* 133: undefined */ 0,
/* 134: undefined */ 0,
/* 135: undefined */ 0,
/* 136: undefined */ 0,
/* 137: undefined */ 0,
/* 138: undefined */ 0,
/* 139: undefined */ 0,
/* 140: undefined */ 0,
/* 141: undefined */ 0,
/* 142: undefined */ 0,
/* 143: undefined */ 0,
/* 144: undefined */ 0,
/* 145: undefined */ 0,
/* 146: undefined */ 0,
/* 147: undefined */ 0,
/* 148: undefined */ 0,
/* 149: undefined */ 0,
/* 150: undefined */ 0,
/* 151: undefined */ 0,
/* 152: undefined */ 0,
/* 153: undefined */ 0,
/* 154: undefined */ 0,
/* 155: undefined */ 0,
/* 156: undefined */ 0,
/* 157: undefined */ 0,
/* 158: undefined */ 0,
/* 159: undefined */ 0,
/* 160: undefined */ 0,
/* 161: A grave */ "{\\tenwlc\\char'041}",
/* 162: A circumflex */ "{\\tenwlc\\char'042}",
/* 163: E grave */ "{\\tenwlc\\char'043}",
/* 164: E circumflex */ "{\\tenwlc\\char'044}",
/* 165: E dieresis */ "{\\tenwlc\\char'045}",
/* 166: I circumflex */ "{\\tenwlc\\char'046}",
/* 167: I dieresis */ "{\\tenwlc\\char'047}",
/* 168: acute accent */ "{\\tenwla\\char'023}",
/* 169: grave accent */ "{\\tenwla\\char'022}",
/* 170: circumflex */ "{\\tenwla\\char'136}",
/* 171: dieresis */ "{\\tenwla\\char'177}",
/* 172: tilde */ "{\\tenwla\\char'176}",
/* 173: U grave */ "{\\tenwlc\\char'050}",
/* 174: U circumflex */ "{\\tenwlc\\char'051}",
/* 175: Italian Lira */ 0,
/* 176: overbar */ 0,
/* 177: Y acute */ "{\\tenwlc\\char'053}",
/* 178: y acute */ "{\\tenwlc\\char'054}",
/* 179: degree */ 0,
/* 180: C cedilla */ "{\\tenwla\\char'030}",
/* 181: c cedilla */ "{\\tenwla\\char'030}",
/* 182: N tilde */ "{\\tenwlc\\char'055}",
/* 183: n tilde */ "{\\tenwlc\\char'056}",
/* 184: inverted exclamation mark */ "{\\tenwla\\char'074}",
/* 185: inverted question mark */ "{\\tenwla\\char'076}",
/* 186: currency sign */ 0,
/* 187: pound sterling */ 0,
/* 188: Yen */ 0,
/* 189: Section sign */ 0,
/* 190: florin */ 0,
/* 191: Cent sign */ 0,
/* 192: a circumflex */ "{\\tenwlc\\char'063}",
/* 193: e circumflex */ "{\\tenwlc\\char'064}",
/* 194: o circumflex */ "{\\tenwlc\\char'065}",
/* 195: u circumflex */ "{\\tenwlc\\char'066}",
/* 196: a acute */ "{\\tenwlc\\char'067}",
/* 197: e acute */ "{\\tenwlc\\char'070}",
/* 198: o acute */ "{\\tenwlc\\char'071}",
/* 199: u acute */ "{\\tenwlc\\char'072}",
/* 200: a grave */ "{\\tenwlc\\char'073}",
/* 201: e grave */ "{\\tenwlc\\char'074}",
/* 202: o grave */ "{\\tenwlc\\char'075}",
/* 203: u grave */ "{\\tenwlc\\char'076}",
/* 204: a dieresis */ "{\\tenwlc\\char'077}",
/* 205: e dieresis */ "{\\tenwlc\\char'100}",
/* 206: o dieresis */ "{\\tenwlc\\char'101}",
/* 207: u dieresis */ "{\\tenwlc\\char'102}",
/* 208: A angstrom */ "{\\tenwlc\\char'103}",
/* 209: i circumflex */ "{\\tenwlc\\char'104}",
/* 210: O slash */ "{\\tenwla\\char'037}",
/* 211: AE ligature */ "{\\tenwla\\char'035}",
/* 212: a angstrom */ "{\\tenwlc\\char'105}",
/* 213: i acute */ "{\\tenwlc\\char'106}",
/* 214: o slash */ "{\\tenwla\\char'034}",
/* 215: ae ligature */ "{\\tenwla\\char'032}",
/* 216: A dieresis */ "{\\tenwlc\\char'107}",
/* 217: i grave */ "{\\tenwlc\\char'110}",
/* 218: O dieresis */ "{\\tenwlc\\char'111}",
/* 219: U dieresis */ "{\\tenwlc\\char'112}",
/* 220: E acute */ "{\\tenwlc\\char'113}",
/* 221: i dieresis */ "{\\tenwlc\\char'114}",
/* 222: SS ligature */ "{\\tenwla\\char'031}",
/* 223: O circumflex */ "{\\tenwlc\\char'115}",
/* 224: A acute */ "{\\tenwlc\\char'116}",
/* 225: A tilde */ "{\\tenwlc\\char'117}",
/* 226: a tilde */ "{\\tenwlc\\char'120}",
/* 227: Eth */ 0,
/* 228: eth */ 0,
/* 229: I acute */ "{\\tenwlc\\char'121}",
/* 230: I grave */ "{\\tenwlc\\char'122}",
/* 231: O acute */ "{\\tenwlc\\char'123}",
/* 232: O grave */ "{\\tenwlc\\char'124}",
/* 233: O tilde */ "{\\tenwlc\\char'125}",
/* 234: o tilde */ "{\\tenwlc\\char'126}",
/* 235: S caron */ "{\\tenwlc\\char'127}",
/* 236: s caron */ "{\\tenwlc\\char'130}",
/* 237: U acute */ "{\\tenwlc\\char'131}",
/* 238: Y dieresis */ "{\\tenwlc\\char'132}",
/* 239: y dieresis */ "{\\tenwlc\\char'133}",
/* 240: Thorn */ 0,
/* 241: thorn */ 0,
/* 242: undefined */ 0,
/* 243: mu */ 0,
/* 244: paragraph sign */ 0,
/* 245: fraction 3/4 */ 0,
/* 246: long dash */ 0,
/* 247: fraction 1/4 */ 0,
/* 248: fraction 1/2 */ 0,
/* 249: Female ordinal */ 0,
/* 250: Male ordinal */ 0,
/* 251: French double open quote */ 0,
/* 252: Solid square */ 0,
/* 253: French double close quote */ 0,
/* 254: Plus over minus sign */ 0,
/* 255: undefined */ 0
}
#endif
;

View File

@@ -0,0 +1,134 @@
/* $XConsortium: charconv.h /main/3 1995/11/08 09:29:21 rswiston $ */
EXTERN M_WCHAR pc8_to_r8 [256]
#if defined(DEFINE)
= {
'\000','\001','\002','\003','\004','\005','\006','\007','\010','\011',
'\012','\013','\014','\015','\016','\017','\020','\021','\022','\023',
'\024','\025','\026','\027','\030','\031','\032','\033','\034','\035',
'\036','\037','\040','\041','\042','\043','\044','\045','\046','\047',
'\050','\051','\052','\053','\054','\055','\056','\057','\060','\061',
'\062','\063','\064','\065','\066','\067','\070','\071','\072','\073',
'\074','\075','\076','\077','\100','\101','\102','\103','\104','\105',
'\106','\107','\110','\111','\112','\113','\114','\115','\116','\117',
'\120','\121','\122','\123','\124','\125','\126','\127','\130','\131',
'\132','\133','\134','\135','\136','\137','\140','\141','\142','\143',
'\144','\145','\146','\147','\150','\151','\152','\153','\154','\155',
'\156','\157','\160','\161','\162','\163','\164','\165','\166','\167',
'\170','\171','\172','\173','\174','\175','\176','\177','\264','\317',
'\305','\300','\314','\310','\324','\265','\301','\315','\311','\335',
'\321','\331','\330','\320','\334','\327','\323','\302','\316','\312',
'\303','\313','\357','\332','\333','\277','\273','\274','\120','\276',
'\304','\325','\306','\307','\267','\266','\371','\372','\271','\055',
'\052','\370','\367','\270','\373','\375','\374','\374','\374','\174',
'\053','\043','\053','\053','\043','\043','\174','\043','\043','\053',
'\043','\053','\053','\053','\053','\053','\055','\053','\043','\053',
'\043','\043','\043','\043','\043','\075','\043','\043','\053','\043',
'\053','\053','\043','\043','\053','\053','\043','\053','\053','\374',
'\374','\374','\374','\374','\052','\336','\052','\052','\052','\052',
'\363','\052','\052','\052','\052','\052','\052','\326','\052','\052',
'\052','\376','\052','\052','\174','\174','\057','\176','\263','\362',
'\362','\052','\052','\052','\374','\377'
}
#endif
;
EXTERN M_WCHAR pc8dn_to_r8 [256]
#if defined(DEFINE)
= {
'\000','\001','\002','\003','\004','\005','\006','\007','\010','\011',
'\012','\013','\014','\015','\016','\017','\020','\021','\022','\023',
'\024','\025','\026','\027','\030','\031','\032','\033','\034','\035',
'\036','\037','\040','\041','\042','\043','\044','\045','\046','\047',
'\050','\051','\052','\053','\054','\055','\056','\057','\060','\061',
'\062','\063','\064','\065','\066','\067','\070','\071','\072','\073',
'\074','\075','\076','\077','\100','\101','\102','\103','\104','\105',
'\106','\107','\110','\111','\112','\113','\114','\115','\116','\117',
'\120','\121','\122','\123','\124','\125','\126','\127','\130','\131',
'\132','\133','\134','\135','\136','\137','\140','\141','\142','\143',
'\144','\145','\146','\147','\150','\151','\152','\153','\154','\155',
'\156','\157','\160','\161','\162','\163','\164','\165','\166','\167',
'\170','\171','\172','\173','\174','\175','\176','\177','\264','\317',
'\305','\300','\314','\310','\324','\265','\301','\315','\311','\335',
'\321','\331','\330','\320','\334','\327','\323','\302','\316','\312',
'\303','\313','\357','\332','\333','\326','\273','\322','\114','\154',
'\304','\325','\306','\307','\267','\266','\352','\351','\271','\342',
'\341','\154','\156','\270','\052','\272','\374','\374','\374','\174',
'\053','\043','\053','\053','\043','\043','\174','\043','\043','\053',
'\043','\053','\053','\053','\053','\053','\055','\053','\043','\053',
'\043','\043','\043','\043','\043','\075','\043','\043','\053','\043',
'\053','\053','\043','\043','\053','\053','\043','\053','\053','\374',
'\374','\374','\374','\374','\052','\336','\052','\052','\052','\052',
'\363','\052','\052','\052','\052','\052','\052','\326','\052','\052',
'\052','\376','\052','\052','\174','\174','\057','\176','\263','\362',
'\362','\052','\052','\052','\374','\377'
}
#endif
;
EXTERN M_WCHAR r8_to_pc8 [256]
#if defined(DEFINE)
= {
'\000','\001','\002','\003','\004','\005','\006','\007','\010','\011',
'\012','\013','\014','\015','\016','\017','\020','\021','\022','\023',
'\024','\025','\026','\027','\030','\031','\032','\033','\034','\035',
'\036','\037','\040','\041','\042','\043','\044','\045','\046','\047',
'\050','\051','\052','\053','\054','\055','\056','\057','\060','\061',
'\062','\063','\064','\065','\066','\067','\070','\071','\072','\073',
'\074','\075','\076','\077','\100','\101','\102','\103','\104','\105',
'\106','\107','\110','\111','\112','\113','\114','\115','\116','\117',
'\120','\121','\122','\123','\124','\125','\126','\127','\130','\131',
'\132','\133','\134','\135','\136','\137','\140','\141','\142','\143',
'\144','\145','\146','\147','\150','\151','\152','\153','\154','\155',
'\156','\157','\160','\161','\162','\163','\164','\165','\166','\167',
'\170','\171','\172','\173','\174','\175','\176','\177','\200','\201',
'\202','\203','\204','\205','\206','\207','\210','\211','\212','\213',
'\214','\215','\216','\217','\220','\221','\222','\223','\224','\225',
'\226','\227','\230','\231','\232','\233','\234','\235','\236','\237',
'\040','\101','\101','\105','\105','\105','\111','\111','\047','\140',
'\136','\042','\176','\125','\125','\234','\055','\131','\171','\370',
'\200','\207','\245','\244','\255','\250','\052','\234','\235','\052',
'\237','\233','\203','\210','\223','\226','\240','\202','\242','\243',
'\205','\212','\225','\227','\204','\211','\224','\201','\217','\214',
'\117','\222','\206','\241','\355','\221','\216','\215','\231','\232',
'\220','\213','\341','\117','\101','\101','\141','\104','\144','\111',
'\111','\117','\117','\117','\157','\123','\163','\125','\131','\230',
'\052','\052','\372','\346','\052','\052','\304','\254','\253','\246',
'\247','\256','\376','\257','\361','\040'
}
#endif
;
EXTERN M_WCHAR r8_to_pc8dn [256]
#if defined(DEFINE)
= {
'\000','\001','\002','\003','\004','\005','\006','\007','\010','\011',
'\012','\013','\014','\015','\016','\017','\020','\021','\022','\023',
'\024','\025','\026','\027','\030','\031','\032','\033','\034','\035',
'\036','\037','\040','\041','\042','\043','\044','\045','\046','\047',
'\050','\051','\052','\053','\054','\055','\056','\057','\060','\061',
'\062','\063','\064','\065','\066','\067','\070','\071','\072','\073',
'\074','\075','\076','\077','\100','\101','\102','\103','\104','\105',
'\106','\107','\110','\111','\112','\113','\114','\115','\116','\117',
'\120','\121','\122','\123','\124','\125','\126','\127','\130','\131',
'\132','\133','\134','\135','\136','\137','\140','\141','\142','\143',
'\144','\145','\146','\147','\150','\151','\152','\153','\154','\155',
'\156','\157','\160','\161','\162','\163','\164','\165','\166','\167',
'\170','\171','\172','\173','\174','\175','\176','\177','\200','\201',
'\202','\203','\204','\205','\206','\207','\210','\211','\212','\213',
'\214','\215','\216','\217','\220','\221','\222','\223','\224','\225',
'\226','\227','\230','\231','\232','\233','\234','\235','\236','\237',
'\040','\101','\101','\105','\105','\105','\111','\111','\047','\140',
'\136','\042','\176','\125','\125','\234','\055','\131','\171','\370',
'\200','\207','\245','\244','\255','\250','\257','\234','\131','\052',
'\146','\143','\203','\210','\223','\226','\240','\202','\242','\243',
'\205','\212','\225','\227','\204','\211','\224','\201','\217','\214',
'\235','\222','\206','\241','\233','\221','\216','\215','\231','\232',
'\220','\213','\341','\117','\101','\252','\251','\104','\144','\111',
'\111','\117','\117','\247','\246','\123','\163','\125','\131','\230',
'\052','\052','\372','\346','\052','\052','\304','\052','\052','\052',
'\052','\074','\376','\076','\361','\040'
}
#endif
;
/* Obsolete */

View File

@@ -0,0 +1,367 @@
/* $XConsortium: custom.c /main/3 1995/11/08 09:29:32 rswiston $ */
/*
Copyright (c) 1988, 1989 Hewlett-Packard Co.
*/
/* Custom.c contains standard PARSER functions, customized for the HP
HelpTag formatting system. */
#include "userinc.h"
#include "globdec.h"
#include <stdlib.h>
#if defined(MSDOS)
/* Standard startup code doesn't have room to load inherited environments
in some cases. Since they're not used, don't bother. (Using Microsoft
C compiler). */
void _setenvp(M_NOPAR);
void _setenvp(){}
#endif
/* Write input file and line number for an error message */
void m_dumpline(file, line)
M_WCHAR *file;
int line;
{
char buffer[10];
char *mbyte;
m_errline("Line ");
sprintf(buffer, "%d", line);
m_errline(buffer);
if (!file)
{ /* no entity file */
if (inputname)
{ /* use main input, instead. Only if set though. */
mbyte = MakeMByteString(inputname);
m_errline(" of ");
m_errline(mbyte);
m_free(mbyte, "multi-byte string");
}
}
else
{ /* yes, entity file */
mbyte = MakeMByteString(file);
m_errline(" of ");
m_errline(mbyte);
m_free(mbyte, "multi-byte string");
}
}
/* Write error message prefix */
void m_eprefix(M_NOPAR)
{
m_errline("\n*****\n");
m_dumpline(m_thisfile(), m_thisline());
m_errline(",\n");
}
/* Process error message text */
void m_errline(p)
char *p;
{
char c;
for ( ; *p ; p++)
{
if (m_errfile) putc(*p, m_errfile);
putc(*p, stderr);
}
}
#if defined(MSDOS)
#include <process.h>
#endif
/* Write error message suffix */
void m_esuffix(M_NOPAR)
{
m_errline(":\n");
m_lastchars();
if (++m_errcnt == m_errlim)
{
m_error("Too many errors, processing stopped");
m_exit(TRUE);
}
}
/* Exit procedure */
void m_exit(status)
int status;
{
if (filefound)
{
if (m_outfile != stdout)
{
if (have_index)
{ /* sph: is this really necessary? */
fseek(m_outfile, 0L, SEEK_END);
}
fclose(m_outfile);
if (prebye == postpreamble)
m_error("No text in document");
}
}
if (status)
{
if (status == 77) /* tell helptag to re-run for forward xrefs */
{
if (stoponerror)
{
if (m_errcnt == 0)
exit(77);
else
exit(1);
}
else
exit(66);
}
if (stoponerror)
exit(1); /* tell helptag to quit */
exit(2); /* tell helptag to continue to next phases */
}
exit(0);
}
/* Get-char procedure */
int m_getc(m_ptr)
void *m_ptr;
{
int c;
M_WCHAR wc;
char badch[2];
char mbyte[32]; /* make this bigger than any possible multi-byte char */
int length;
static M_WCHAR wcr = 0, wsb, wsp, wtb;
char tab, space;
/* Unix/Dos compatibility: 0D0A handling */
if (!wcr)
{
mbtowc(&wcr, "\r", 1);
mbtowc(&wsb, "\032", 1);
space = M_SPACE;
mbtowc(&wsp, &space, 1);
tab = M_TAB;
mbtowc(&wtb, &tab, 1);
}
do {
length = 0;
if ((c = getc((FILE *) m_ptr)) == EOF) return(EOF);
while (1)
{
mbyte[length++] = c;
mbyte[length] = 0;
if (mblen(mbyte,length) != -1) break; /* hurray! */
if (length == MB_CUR_MAX)
{ /* reached max without a hit */
m_error("An invalid multi-byte character was found in the input");
c = ' ';
length = 1;
break;
}
if ((c = getc((FILE *) m_ptr)) == EOF)
{ /* huh? */
m_error("End-of-file found in within a multi-byte character");
return(EOF);
}
}
mbtowc(&wc,mbyte,length);
}
while ((wc == wcr) || (wc == wsb));
/* Change tabs to spaces */
if (wc == wtb) return((int) wsp);
return((int) wc);
}
/* Open SYSTEM entity procedure */
void *m_openent(entcontent)
M_WCHAR *entcontent;
{
FILE *open;
char *filename;
SEARCH *searchp;
char *mb_entcontent;
mb_entcontent = MakeMByteString(entcontent);
if (!*mb_entcontent) return NULL; /* null file name, don't open a directory */
open = fopen(mb_entcontent, "r");
if (open)
{
m_free(mb_entcontent, "multi-byte string");
return((void *) open);
}
for (searchp = path ; searchp ; searchp = searchp->next)
{
filename = (char *)
m_malloc(strlen(searchp->directory) +
strlen(mb_entcontent) + 1,
"filename");
strcpy(filename, searchp->directory);
strcat(filename, mb_entcontent);
open = fopen(filename, "r");
m_free(filename, "filename");
if (open)
{
m_free(mb_entcontent, "multi-byte string");
return((void *) open);
}
}
m_free(mb_entcontent, "multi-byte string");
return(NULL);
}
/* Open input file */
void *m_openfirst(M_NOPAR)
{
FILE *first;
char *input;
int length;
if (defaultext)
{
input = (char *)
m_malloc(strlen(m_argv[1]) + strlen(".htg") + 1, "input file name");
strcpy(input, m_argv[1]);
strcat(input, ".htg");
m_openchk(&first, input, "r");
if (filelist) puts(input);
/* keep name for global use */
length = strlen(input);
inputname = (M_WCHAR *) m_malloc(length + 1, "saved input file name");
mbstowcs(inputname, input, length + 1);
m_free(input, "input file name");
}
else
{
if (filelist) puts(m_argv[1]);
m_openchk(&first, m_argv[1], "r");
length = strlen(m_argv[1]);
inputname = (M_WCHAR *) m_malloc(length + 1, "saved input file name");
mbstowcs(inputname, m_argv[1], length + 1);
}
/* Set E option (to suppress error message on duplicate entity
declarations) if file begins with "<!--Index" */
if (first)
{
filefound = TRUE;
}
return((void *) first);
}
/* Set program options */
void m_setoptions()
{
/* F option used for FILELIST (checking done in basename, which is
called before this function is called) */
if (m_argc > 2) {
m_optstring(m_argv[2]);
if (strchr(m_argv[2], 'o')) tracetostd = TRUE;
if (strchr(m_argv[2], 'O')) tracetostd = TRUE;
/* Option "p" tells the search path to look at paths one level
higher when relative pathes are specified.
The following two lines of code should be here, but they are moved
to global START-CODE of tex.if. For some reason, global START-CODE
is executed before this procedure is called (parser.c), but we need
to have the order reversed. Moving this procedure to a spot earlier
is risky, since we don't know full reasons of why things are in a
particular order. This way, we minimize the damage:
if (strchr(m_argv[2], 'p')) parentsrch = TRUE;
if (strchr(m_argv[2], 'P')) parentsrch = TRUE;
*/
}
}
/* Process signon message text, stripping out MARKUP version number, so
only one version number will appear */
void m_signmsg(p)
char *p;
{
char *q;
char *pCopy;
if (q = strstr(p, VERSION)) {
pCopy = strdup(p);
q = strstr(pCopy, VERSION);
*q = M_EOS;
m_errline(pCopy);
free(pCopy);
return;
}
m_errline(p);
}
/* All entity declarations have been processed. Can now check if .TEX
file uptodate and open appropriate output file */
void m_startdoc()
{
LOGICAL init = TRUE;
unsigned char type;
M_WCHAR *content;
unsigned char wheredef;
M_WCHAR *name;
M_WCHAR *qfile;
char *mbyte;
/* set locale */
SetDefaultLocale();
if (! filelist)
{
texinit();
}
else
{ /* list files that make up document */
while (name = m_cyclent(init, &type, &content, &wheredef))
{
init = FALSE;
qfile = NULL;
if (type == M_SYSTEM)
qfile = searchforfile(content);
if (qfile)
{
mbyte = MakeMByteString(qfile);
puts(mbyte);
m_free(qfile, "figure filename");
m_free(mbyte, "multi-byte string");
}
else if (type == M_SYSTEM)
m_err2("Can't find file %s (declared in entity %s)", content, name);
}
if (idxpath) puts(idxpath);
exit(m_errexit);
}
}
/* Write debugging trace information */
void m_trace(p)
char *p;
{
if (tracetostd) fputs(p, stdout);
else fputs(p, m_outfile);
}
void m_wctrace(p)
M_WCHAR *p;
{
char *mb_p;
mb_p = MakeMByteString(p);
m_trace(mb_p);
m_free(mb_p,"multi-byte string");
}

View File

@@ -0,0 +1,161 @@
/* $XConsortium: default.c /main/3 1995/11/08 09:29:42 rswiston $ */
/*
Copyright 1988, 1989, 1992 Hewlett-Packard Co.
*/
/* HP Tag to TeX default processing */
#include "userinc.h"
#include "globdec.h"
#if defined(M_PROTO)
int vextextsize(const M_WCHAR *keyword)
#else
int vextextsize(keyword)
M_WCHAR *keyword;
#endif /* M_PROTO */
{
if (!keyword) return NORMAL;
if (! m_wcmbupstrcmp(keyword, QNORMAL)) return NORMAL;
else if (! m_wcmbupstrcmp(keyword, QSMALLER)) return SMALLER;
else if (! m_wcmbupstrcmp(keyword, QSMALLEST)) return SMALLEST;
m_err1("Unexpected value for ex/vex textsize parameter: %s", keyword);
return NORMAL;
}
#if defined(M_PROTO)
int vgloss(const M_WCHAR *keyword)
#else
int vgloss(keyword)
M_WCHAR *keyword;
#endif /* M_PROTO */
{
if (!keyword) return GLOSS;
if (! m_wcmbupstrcmp(keyword, QGLOSS)) return GLOSS;
else if (! m_wcmbupstrcmp(keyword, QNOGLOSS)) return NOGLOSS;
m_err1("Unexpected value for gloss parameter: %s", keyword);
return GLOSS;
}
#if defined(M_PROTO)
int vcenter(const M_WCHAR *keyword)
#else
int vcenter(keyword)
M_WCHAR *keyword;
#endif /* M_PROTO */
{
if (!keyword) return CENTER;
if (! m_wcmbupstrcmp(keyword, QLEFT)) return LEFT;
else if (! m_wcmbupstrcmp(keyword, QCENTER)) return CENTER;
else if (! m_wcmbupstrcmp(keyword, QRIGHT)) return RIGHT;
m_err1("Unexpected value for center parameter: %s", keyword);
return CENTER;
}
#if defined(M_PROTO)
int vnumber(const M_WCHAR *keyword)
#else
int vnumber(keyword)
M_WCHAR *keyword;
#endif /* M_PROTO */
{
if (!keyword) return NONUMBER;
if (! m_wcmbupstrcmp(keyword, QNUMBER)) return NUMBER;
else if (! m_wcmbupstrcmp(keyword, QNONUMBER)) return NONUMBER;
m_err1("Unexpected value for number parameter: %s", keyword);
return NONUMBER;
}
#if defined(M_PROTO)
LOGICAL vstack(const M_WCHAR *keyword)
#else
LOGICAL vnumber(keyword)
M_WCHAR *keyword;
#endif /* M_PROTO */
{
if (!keyword) return FALSE;
if (! m_wcmbupstrcmp(keyword, QSIDE)) return FALSE;
else if (! m_wcmbupstrcmp(keyword, QSTACK)) return TRUE;
m_err1("Unexpected value for number parameter: %s", keyword);
return FALSE;
}
#if defined(M_PROTO)
int vordertype(const M_WCHAR *keyword)
#else
int vordertype(keyword)
M_WCHAR *keyword;
#endif /* M_PROTO */
{
if (!keyword) return ARABIC;
if (! m_wcmbupstrcmp(keyword, QUALPHA)) return UALPHA;
else if (! m_wcmbupstrcmp(keyword, QLALPHA)) return LALPHA;
else if (! m_wcmbupstrcmp(keyword, QARABIC)) return ARABIC;
else if (! m_wcmbupstrcmp(keyword, QUROMAN)) return UROMAN;
else if (! m_wcmbupstrcmp(keyword, QLROMAN)) return LROMAN;
m_err1("Unexpected list order type: %s", keyword);
return ARABIC;
}
#if defined(M_PROTO)
int vspacing(const M_WCHAR *keyword)
#else
int vspacing(keyword)
M_WCHAR *keyword;
#endif /* M_PROTO */
{
if (!keyword) return LOOSE;
if (! m_wcmbupstrcmp(keyword, QTIGHT)) return TIGHT;
else if (! m_wcmbupstrcmp(keyword, QLOOSE)) return LOOSE;
m_err1("Unexpected value for spacing parameter: %s", keyword);
return LOOSE;
}
#if defined(M_PROTO)
int vlonglabel(const M_WCHAR *keyword)
#else
int vlonglabel(keyword)
M_WCHAR *keyword;
#endif /* M_PROTO */
{
if (!keyword) return WRAP;
if (! m_wcmbupstrcmp(keyword, QWRAP)) return WRAP;
else if (! m_wcmbupstrcmp(keyword, QNOWRAP)) return NOWRAP;
m_err1("Unexpected value for longlabel parameter: %s", keyword);
return WRAP;
}
#if defined(M_PROTO)
int vtype(const M_WCHAR *keyword)
#else
int vtype(keyword)
M_WCHAR *keyword;
#endif /* M_PROTO */
{
if (!keyword) return BULLET;
if (! m_wcmbupstrcmp(keyword, QORDER)) return ORDER;
else if (! m_wcmbupstrcmp(keyword, QBULLET)) return BULLET;
else if (! m_wcmbupstrcmp(keyword, QPLAIN)) return PLAIN;
else if (! m_wcmbupstrcmp(keyword, QMILSPEC)) return ORDER;
else if (! m_wcmbupstrcmp(keyword, QCHECK)) return CHECK;
m_err1("Unexpected list type: %s", keyword);
return BULLET;
}

View File

@@ -0,0 +1,73 @@
Copyright 1988, 1989 Hewlett-Packard Co.
Delimiter definitions for BUILD.
comment --
produces ->
except <EXCEPT>
paropen <!PARAM
param <PARAM>
shortref <!SHORTREF
usemap <USEMAP
addmap <ADDMAP
empty #EMPTY
entstart <!ENTITY
tagc >
ero &
entsystem SYSTEM
entst STARTTAG
entet ENDTAG
entmd MD
entpi PI
entsdata SDATA
min <MIN>
grpo (
grpc )
emi !
incl +
excl -
psep ,
rend ;
opt ?
plus +
rep *
seq ,
or |
and &
vi =
entlit "
lit "
entlita '
lita '
rnicdata #PCDATA
connor |
connseq ,
connand &
current #CURRENT
required #REQUIRED
nulldef #IMPLIED
any ANY
none EMPTY
rcdata RCDATA
cdata CDATA
cro &#
litrs &#RS
litrsc &#RS;
litre &#RE
litrec &#RE;
littab &#TAB
littabc &#TAB;
litspace &#SPACE
litcspace &#SPACE;
refc ;
id ID
idref IDREF
idrefs IDREFS
nametype NAME
names NAMES
nmtoken NAMETOKEN
nmtokens NAMETOKENS
number NUMBER
numbers NUMBERS
nutoken NUMBERTOKEN
nutokens NUMBERTOKENS
entatt ENTITY

View File

@@ -0,0 +1,58 @@
Copyright 1988, 1989 Hewlett-Packard Co.
Delimiter definitions for ELTDEF.
startcomment /*
endcomment */
entstart <!ENTITY
entsystem SYSTEM
entst STARTTAG
entet ENDTAG
entmd MD
entpi PI
entsdata SDATA
entcdata CDATA
typecode CODE
endofcode </CODE>
entlit "
entlita '
lit "
lita '
cro &#
litrs &#RS
litrsc &#RS;
litre &#RE
litrec &#RE;
littab &#TAB
littabc &#TAB;
litspace &#SPACE
litcspace &#SPACE;
refc ;
signon <SIGN-ON>
gdef <GLOBAL-DEFINE>
gdec <GLOBAL-DECLARE>
elt <ELEMENT
tagc >
sep ,
grpo (
grpc )
param <PARAM>
vi =
rend ;
inisstring <START-STRING>
sss <START-STRING
iniestring <END-STRING>
ess </START-STRING>
ses <END-STRING
ees </END-STRING>
inistart <START-CODE>
scode <START-CODE
iniend <END-CODE>
ecode <END-CODE
initext <TEXT-CODE>
tcode <TEXT-CODE
initpi <PI-CODE>
pcode <PI-CODE
inistring <STRING-CODE>
stcode <STRING-CODE
wildcard *

View File

@@ -0,0 +1,39 @@
Copyright 1988, 1989 Hewlett-Packard Co.
Delimiter definitions for PARSER.
m_comment --
m_mdo <!
m_mdc >
m_usemap USEMAP
m_addmap ADDMAP
m_empty #EMPTY
m_entkw ENTITY
m_entst STARTTAG
m_entet ENDTAG
m_entcdata CDATA
m_entsdata SDATA
m_entsystem SYSTEM
m_entmd MD
m_entpi PI
m_stago <
m_etago </
m_pio <?
m_tagc >
m_pic >
m_vi =
m_lit "
m_litdelim "
m_lita '
m_litadelim '
m_cro &#
m_litrs &#RS
m_litscr &#RS;
m_litre &#RE
m_litecr &#RE;
m_litspace &#SPACE
m_litcspace &#SPACE;
m_littab &#TAB
m_litctab &#TAB;
m_ero &
m_refc ;
m_net |

View File

@@ -0,0 +1,7 @@
/* $XConsortium: figure.c /main/3 1995/11/08 09:29:52 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
/* Figure.c contains HP Tag to TeX figure processing */
/* Obsolete */

View File

@@ -0,0 +1,634 @@
/* $XConsortium: fproto.h /main/3 1995/11/08 09:30:01 rswiston $ */
/* Copyright (c) 1988, 1989, 1990 Hewlett-Packard Co. */
/* Function prototypes for HP Tag/TeX translator */
void assert_hometopic_exists(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
/* osf has basename() defined in system header file, change
* basename() to fbasename(). --XPG4 standard.
*/
void fbasename(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void chapstart(
#if defined(M_PROTO)
M_WCHAR *id
#endif
) ;
void checkgloss(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
M_WCHAR *checkid(
#if defined(M_PROTO)
M_WCHAR *id
#endif
) ;
void checkmsghead (
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void dumpxref(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void echohead(
#if defined(M_PROTO)
M_WCHAR *p
#endif
) ;
void mb_echohead(
#if defined(M_PROTO)
char *p
#endif
) ;
void endhead(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void esoutchar(
#if defined(M_PROTO)
M_WCHAR textchar
#endif
) ;
void vexoutchar(
#if defined(M_PROTO)
M_WCHAR textchar
#endif
) ;
void exoutchar(
#if defined(M_PROTO)
M_WCHAR textchar
#endif
) ;
void imoutchar(
#if defined(M_PROTO)
M_WCHAR textchar
#endif
) ;
int getqualified (
#if defined(M_PROTO)
M_WCHAR *qualname, M_WCHAR *unqualname
#endif
) ;
void handle_link_and_graphic(
#if defined(M_PROTO)
M_WCHAR *parent, M_WCHAR *gentity, M_WCHAR *gposition, M_WCHAR *ghyperlink,
M_WCHAR *glinktype, M_WCHAR *gdescription
#endif
);
void idstring(
#if defined(M_PROTO)
M_WCHAR *string
#endif
) ;
void indexchar(
#if defined(M_PROTO)
M_WCHAR textchar
#endif
) ;
void Item(
#if defined(M_PROTO)
M_WCHAR *id
#endif
) ;
char *m_itoa(
#if defined(M_PROTO)
int n, char *s
#endif
) ;
LOGICAL m_letter(
#if defined(M_PROTO)
M_WCHAR c
#endif
) ;
void loadxref(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int m_lower(
#if defined(M_PROTO)
int c
#endif
) ;
void options(
#if defined(M_PROTO)
LOGICAL filelenonly
#endif
) ;
void outchar(
#if defined(M_PROTO)
M_WCHAR textchar, FILE *outfile
#endif
) ;
void outpi(
#if defined(M_PROTO)
int enttype, M_WCHAR *pi, M_WCHAR *entname
#endif
) ;
void realoutchar(
#if defined(M_PROTO)
M_WCHAR textchar, FILE *outfile
#endif
) ;
void rsectstart(
#if defined(M_PROTO)
M_WCHAR *id
#endif
) ;
void rseqend(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
M_WCHAR *searchforfile(
#if defined(M_PROTO)
M_WCHAR *file
#endif
) ;
void setid(
#if defined(M_PROTO)
M_WCHAR *id,
LOGICAL where,
LOGICAL csensitive,
LOGICAL inchapter,
char *chapter,
M_WCHAR *xrffile,
int xrfline,
LOGICAL xrefable
#endif
) ;
void setopt(
#if defined(M_PROTO)
char *string, LOGICAL filelenonly
#endif
) ;
LOGICAL setvalopt(
#if defined(M_PROTO)
int thisopt, char *string, LOGICAL filelenonly
#endif
) ;
void shchar(
#if defined(M_PROTO)
M_WCHAR textchar,
int *len,
int max,
M_WCHAR *string,
void (*proc)(M_WCHAR *string),
char *msg,
LOGICAL *errflg
#endif
) ;
void mb_shchar(
#if defined(M_PROTO)
char textchar,
int *len,
int max,
M_WCHAR *string,
void (*proc)(M_WCHAR *string),
char *msg,
LOGICAL *errflg
#endif
) ;
void shstring(
#if defined(M_PROTO)
M_WCHAR *addstring,
int *len,
int max,
M_WCHAR *storestring,
char *msg,
LOGICAL *errflg
#endif
) ;
void mb_shstring(
#if defined(M_PROTO)
char *addstring,
int *len,
int max,
M_WCHAR *storestring,
char *msg,
LOGICAL *errflg
#endif
) ;
void starthelpnode(
#if defined(M_PROTO)
M_WCHAR *ssi,
M_WCHAR *id,
int level
#endif
) ;
void mb_starthelpnode(
#if defined(M_PROTO)
char *ssi,
char *id,
int level
#endif
) ;
void StartLabList(
#if defined(M_PROTO)
M_WCHAR *spacing,
M_WCHAR *longlabel
#endif
) ;
void StartList(
#if defined(M_PROTO)
M_WCHAR *type, M_WCHAR *order, M_WCHAR *spacing, M_WCHAR *cont
#endif
) ;
void EndList(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void strcode(
#if defined(M_PROTO)
M_WCHAR *string, FILE *outfile
#endif
) ;
void mb_strcode(
#if defined(M_PROTO)
char *string, FILE *outfile
#endif
) ;
char *strstr(
#if defined(M_PROTO)
const char *s1, const char *s2
#endif
) ;
void svhdstring(
#if defined(M_PROTO)
M_WCHAR *string
#endif
) ;
void svtcstring(
#if defined(M_PROTO)
M_WCHAR *string
#endif
) ;
void termchar(
#if defined(M_PROTO)
M_WCHAR textchar
#endif
) ;
void termpi(
#if defined(M_PROTO)
int m_enttype, M_WCHAR *m_pi, M_WCHAR *m_entname
#endif
) ;
void texinit(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int vextextsize(
#if defined(M_PROTO)
const M_WCHAR *keyword
#endif
) ;
int vgloss(
#if defined(M_PROTO)
const M_WCHAR *keyword
#endif
) ;
int vcenter(
#if defined(M_PROTO)
const M_WCHAR *keyword
#endif
) ;
int vnumber(
#if defined(M_PROTO)
const M_WCHAR *keyword
#endif
) ;
LOGICAL vstack(
#if defined(M_PROTO)
const M_WCHAR *keyword
#endif
) ;
int vordertype(
#if defined(M_PROTO)
const M_WCHAR *keyword
#endif
) ;
int vlonglabel(
#if defined(M_PROTO)
const M_WCHAR *keyword
#endif
) ;
int vspacing(
#if defined(M_PROTO)
const M_WCHAR *keyword
#endif
) ;
int vtype(
#if defined(M_PROTO)
const M_WCHAR *keyword
#endif
) ;
void xrefexpand(
#if defined(M_PROTO)
M_WCHAR *id
#endif
) ;
int m_upper(
#if defined(M_PROTO)
int c
#endif
) ;
char *GetDefaultHeaderString(
#if defined(M_PROTO)
char *elementName,
unsigned char desiredType,
char *defaultString
#endif
) ;
void SetDefaultLocale(
#if defined(M_PROTO)
M_NOPAR
#endif
);
char *MakeMByteString(
#if defined(M_PROTO)
const M_WCHAR *from
#endif
);
M_WCHAR *MakeWideCharString(
#if defined(M_PROTO)
const char *from
#endif
);
void paragraph(
#if defined(M_PROTO)
M_WCHAR *indent,
M_WCHAR *id,
M_WCHAR *gentity,
M_WCHAR *gposition,
M_WCHAR *ghyperlink,
M_WCHAR *glinktype,
M_WCHAR *gdescription
#endif
);
void figure(
#if defined(M_PROTO)
M_WCHAR *number,
M_WCHAR *tonumber,
M_WCHAR *id,
M_WCHAR *file,
M_WCHAR *figpos,
M_WCHAR *cappos,
M_WCHAR *ghyperlink,
M_WCHAR *glinktype,
M_WCHAR *gdescription
#endif
);
void endterm(
#if defined(M_PROTO)
M_WCHAR *base,
M_WCHAR *gloss,
char *linktype
#endif
);
M_WCHAR wc_toupper(
#if defined(M_PROTO)
M_WCHAR wc
#endif
);
M_WCHAR *wc_stringtoupper(
#if defined(M_PROTO)
M_WCHAR *wcp
#endif
);
int NextId(
#if defined(M_PROTO)
M_NOPAR
#endif
);
char *GetLanguage(
#if defined(M_PROTO)
M_NOPAR
#endif
);
char *GetCharset(
#if defined(M_PROTO)
M_NOPAR
#endif
);
void HandleLink(
#if defined(M_PROTO)
M_WCHAR *hyperlink,
M_WCHAR *type,
M_WCHAR *description
#endif
);
char *mb_realloc(
#if defined(M_PROTO)
char *ptr, long size
#endif
);
char *mb_malloc(
#if defined(M_PROTO)
long size
#endif
);
void mb_free(
#if defined(M_PROTO)
char **pptr
#endif
);
void Add2ToRowVec(
#if defined(M_PROTO)
int *length, char **rowvec, char *id1, char *id2
#endif
);
void StartEx(
#if defined(M_PROTO)
M_WCHAR *notes, M_WCHAR *lines, M_WCHAR *textsize
#endif
);
void EndEx(
#if defined(M_PROTO)
M_NOPAR
#endif
);
void StartNCW(
#if defined(M_PROTO)
char *which
#endif
);
void StartBlock(
#if defined(M_PROTO)
char *pclass, char *ssi, char *id
#endif
);
void AddToSNB(
#if defined(M_PROTO)
char *id, char *iconName
#endif
);
void StartNCWtext(
#if defined(M_PROTO)
char *which, char *iconFile, char *headingString
#endif
);
void IncludeToss(
#if defined(M_PROTO)
M_NOPAR
#endif
);
M_WCHAR *CycleEnt(
#if defined(M_PROTO)
LOGICAL init,
unsigned char *type,
M_WCHAR ***content,
unsigned char *wheredef
#endif
);
void ModifyEntities(
#if defined(M_PROTO)
M_NOPAR
#endif
);
void PushForm(
#if defined(M_PROTO)
char *class,
char *ssi,
char *id
#endif
) ;
void PushForm2(
#if defined(M_PROTO)
char *class,
char *ssi,
char *id1,
char *id2
#endif
) ;
void PopForm(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void PopForm2(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void PopFormMaybe(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void EmitSavedAnchors(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void CloseVirpage(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;

View File

@@ -0,0 +1,736 @@
/* $TOG: global.h /main/4 1998/04/06 13:17:51 mgreess $ */
/* Copyright (c) 1988, 1989 Hewlett-Packard Co. */
/* Global definitions for HP Tag/TeX translator */
/* When changing this file, check "grphpar.h" for conflicts */
#if defined(DEFINE)
#define EXTERN
#define INIT(a) = a
#else
#define EXTERN extern
#define INIT(a)
#endif
#include <malloc.h>
#include <string.h>
#include <time.h>
#if defined(MSDOS)
#include <io.h>
#include <stdlib.h>
#include <process.h>
#include <direct.h>
#endif
#include <ctype.h>
#if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__) || defined(__osf__) || defined(linux)
#include <unistd.h>
#include <locale.h>
#include <fcntl.h>
#endif
#define MAXHEADLINES 3
#define FNAMELEN 513
#define BIGBUF 1024
/* substitute for m_ctupper; we don't cast x into (int), thereby
avoiding any problems of high order bit. This is in response
to "Entity no allowed in ART" messages by cupertino. However,
this more of a loose deduction, and really needs confirmation. */
#define ctupper(x) (m_ctarray[x].upper)
/* Must be in same order as values in optkey, adjust NUMOPTIONS if changed*/
#define DRAFT 1
#define FINAL 2
#define MEMO 3
#define NOMEMO 4
#define SEARCHKEY 5
#define CLEARSEARCH 6
#define LONGFILES 7
#define LONGFILE 8
#define LONG 9
#define SHORTFILES 10
#define SHORTFILE 11
#define SHORT 12
#define CHARSET 13
#define ONERROR 14
#if defined(FUTURE_FEATURE)
#define GRAPHICS 15
#define NOGRAPHICS 16
#define REV 17
#define NOREV 18
#endif /* FUTURE_FEATURE */
#define NUMOPTIONS 14
EXTERN int optval INIT(M_NULLVAL) ;
EXTERN char *optkey[NUMOPTIONS]
#if defined(DEFINE)
= {
"draft",
"final",
"memo",
"nomemo",
"search",
"clearsearch",
"longfiles",
"longfile",
"long",
"shortfiles",
"shortfile",
"short",
"charset",
"onerror",
#if defined(FUTURE_FEATURE)
"graphics",
"nographics",
"rev",
"norev",
#endif /* FUTURE_FEATURE */
}
#endif
;
/* Processing options */
EXTERN LOGICAL final INIT(FALSE) ;
EXTERN LOGICAL memo INIT(FALSE) ;
EXTERN int rebuild INIT(FALSE) ;
EXTERN LOGICAL stoponerror INIT(TRUE) ;
#if defined(FUTURE_FEATURE)
EXTERN LOGICAL prntrevs INIT(FALSE) ;
#endif /* FUTURE_FEATURE */
/* variables for index sorting and tagging in the scripts */
/* we create a child directory for processing the index, so as not
to clobber any files with the same base name. However, this will
affect search paths that are relative; those that are relative
need to have parent level prepended. This is done only when
"parentsrch" is set to TRUE; done only when we process indexes. */
EXTERN LOGICAL parentsrch INIT(FALSE) ;
EXTERN char *idxfile INIT(NULL) ; /* index file name only */
EXTERN char *idxpath INIT(NULL) ; /* index file name w/path */
EXTERN char *idxbase INIT(NULL) ; /* index base name only */
/* TeX counter for chapter number */
#define FRONTCOUNT 0
#define APPCOUNT 1000
#define TOCCOUNT 2000
#define MSGCOUNT 3000
#define BIBCOUNT 4000
#define GLOSSCOUNT 5000
#define INDEXCOUNT 6000
/* Flag for filelist vs. Tag to SDL translator */
EXTERN LOGICAL filelist INIT(FALSE) ;
EXTERN M_WCHAR *helpcharset INIT(NULL);
EXTERN M_WCHAR *helplang INIT(NULL);
EXTERN char *docId INIT("SDL-RESERVED0");
EXTERN char sdlReservedName[] INIT("SDL-RESERVED");
#define SDLNAMESIZ sizeof("SDL-RESERVED")
EXTERN char *pubId INIT("CDE 1.0");
/* Working directory, input directory, installation directory,
and search paths */
EXTERN LOGICAL defaultext ;
EXTERN M_WCHAR *inputname; /* pointer to name of main input file */
EXTERN char *base ;
EXTERN char *baseext ;
EXTERN char *nodirbase ;
EXTERN char *work INIT("") ;
EXTERN char *indir INIT(NULL) ;
EXTERN char *install INIT(NULL) ;
typedef struct search SEARCH ;
struct search {
char *directory ;
SEARCH *next ;
} ;
EXTERN SEARCH *path INIT(NULL) ;
EXTERN SEARCH **endpath INIT(&path) ;
EXTERN char dirsep
#if defined(MSDOS)
INIT('\\')
#else
#if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__) || defined(__osf__) || defined(linux)
INIT('/')
#else
****define directory separator here****
#endif
#endif
;
#if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__)|| defined(__osf__) || defined(linux)
#define CSEP '/'
#define SSEP "/"
#else
#if defined(MSDOS)
#define CSEP '\\'
#define SSEP "\\"
#else
****define directory separator here****
#endif
#endif
/* Location in .TEX file of two \wlog messages */
EXTERN long wlog ;
/* True if have encountered idx or idxsyn */
EXTERN LOGICAL have_index INIT(FALSE) ;
EXTERN long idxupdate INIT(0L) ; /* file/seek pointer for make facility */
/* True within a sequence of rsect's */
EXTERN LOGICAL rsectseq INIT(FALSE) ;
/* True if this manual has a glossary */
EXTERN LOGICAL glossary INIT(FALSE) ;
/* True while processing a note if a head was encountered */
EXTERN LOGICAL notehead ;
/* File address for "Generated TeX file complete" message */
EXTERN long texcomplete ;
/* File pointer for cross-reference file */
EXTERN FILE *xrf ;
/* global link type pointer, used in xref to match latest link type */
EXTERN int global_linktype INIT (0);
/* pointers to image parameters for use in imagetext */
EXTERN M_WCHAR *indentp;
EXTERN M_WCHAR *imagegentityp;
EXTERN M_WCHAR *imagegpositionp;
EXTERN M_WCHAR *imageghyperlinkp;
EXTERN M_WCHAR *imageglinktypep;
EXTERN M_WCHAR *imagegdescription;
/* stuff used to build a list of SDL <block> element so we can restart
* a block with the previous "class" and "ssi" attributes so
* formatting will be correct.
*/
typedef struct _block BLOCK;
typedef BLOCK *PBLOCK;
struct _block {
char *pclass;
char *pssi;
PBLOCK pprev;
} block, *pblock;
PBLOCK blockinfo INIT(NULL);
LOGICAL inParText INIT(FALSE);
LOGICAL inSdlP INIT(FALSE);
/* Save these ids and reuse them on the current virpage.
* We need two of each (except for the first) so we can alternate to
* avoid <form> thinking it is supposed to span them. The bullet id
* indexes will flip back and forth between 0 and 1 to pick an id.
*/
int bulletId[2], looseBulletId[2], firstBulletId, firstLooseBulletId;
int bulletIdIndex INIT(1);
int looseBulletIdIndex INIT(1);
/* indent for p, image, ex, vex, based on plain list */
#define LISTFIRSTINDENT 2
#define LISTITEMINDENT 2
#define LEFTINDENT (LISTFIRSTINDENT + LISTITEMINDENT)
/* save the textsize to emit it on the <p> tag; this allows us to have
* a single ssi= for the "ex" <block> and modify the text size individually
* in the "ex" <p>
*/
EXTERN int exTextSize;
#define ORDEREDLISTFIRSTINDENT 1
#define ORDEREDLISTITEMINDENT 3
#define ORDEREDLEFTINDENT (ORDEREDLISTFIRSTINDENT + ORDEREDLISTITEMINDENT)
/* File offset after preamble, and before \bye. Used to determine
whether content found in the document */
EXTERN long postpreamble INIT(0L) ;
EXTERN long prebye INIT(0L) ;
EXTERN LOGICAL filefound INIT(FALSE) ;
/* Chapter or appendix number */
EXTERN int part INIT(0) ;
EXTERN int chapter INIT(0) ;
EXTERN int chapinc INIT(0) ;
EXTERN char chapstring[15] INIT("0") ;
#define NODEID_LENGTH 204
/* name of current node */
EXTERN M_WCHAR nodeid[NODEID_LENGTH+1];
/* Node level variables */
EXTERN int thisnodelevel INIT(0);
/* Offset of node from beginning of file */
EXTERN long int nodeoffset INIT(0);
EXTERN M_WCHAR *savehelpfilename INIT(NULL);
/* flag for omitting first newline in topic map file */
EXTERN LOGICAL nohometopic INIT(TRUE);
EXTERN int parTextId INIT(0);
EXTERN long topicoffset INIT(0L);
EXTERN int htfileno INIT(1);
/* The first tag in the front section should trigger the node */
EXTERN LOGICAL have_a_frontnode INIT(FALSE);
EXTERN char *helpbase INIT(NULL);
EXTERN char *helpext;
/* small buffer for scratch work */
EXTERN char helptmpbuf[2] INIT("0");
/* Should we use these BASENAME_LIMIT on the size of file names? */
LOGICAL usingshortnames INIT(FALSE);
/* Limit on how long the basename can be for a .ht file */
#define BASENAME_LIMIT 6
/* limit on how many additional character are allowed before the ext */
/* (How many chapter numbers foo``12''.ht */
#define PRE_EXTENSION_LIMIT 2
EXTERN FILE *snbfp;
EXTERN FILE *indexfp;
/* Whether have processed anything in chapter or appendix */
EXTERN LOGICAL chapst INIT(FALSE) ;
/* TRUE for chapter, FALSE for appendix */
EXTERN LOGICAL inchapter INIT(TRUE) ;
/* Figure number within this chapter or appendix */
EXTERN int figno ;
/* Options on a particular figure */
EXTERN int ftype, fborder, ftonumber, fvideo, fstrip, fsnap, fautoscale,
fmaxlistrows ;
/* Place to hold <snb> entries until after a <virpage><head>, if any,
* is seen. Also, an integer value of the offset into the file to the
* point immediately after either <virpage> or <virpage><head> - the
* place to put the <snb>.
*/
EXTERN char *savesnb INIT(NULL);
EXTERN int snbstart INIT(0);
/* Table number within this chapter or appendix */
EXTERN int tableno ;
/* footnote number */
EXTERN int footnoteno INIT(0);
EXTERN FILE *outfile ;
/* True if a figure or table has a caption */
EXTERN LOGICAL figcaption ;
EXTERN LOGICAL tabcaption ;
EXTERN char *capposition; /* left/center/right position of the caption */
EXTERN LOGICAL had_an_otherfront_head INIT(FALSE);
/* contains current m_textchar, used to see if we need to issue an italic
correction. Issue italic correction everywhere except after commas
and periods. */
EXTERN M_WCHAR cur_char INIT(' ') ;
/* Special characters */
#define O_BR '{'
#define C_BR '}'
#define ESCAPE 27
/* Error Message section */
EXTERN LOGICAL emsghead INIT(FALSE) ;
/* emsghead has three possible values:
DEFHEAD : use default error message title
USERHEAD : user specified
FALSE : do not process head (assume define is not equal to
DEFHEAD or USERHEAD)
*/
#define DEFHEAD 2
#define USERHEAD 3
/* declarations for the <form> stack */
typedef struct forminfo FORMINFO;
struct forminfo {
char *rowVec;
int vecLen;
};
EXTERN FORMINFO *formStackBase INIT(NULL);
EXTERN FORMINFO *formStackTop INIT(NULL);
EXTERN FORMINFO *formStackMax INIT(NULL);
/* flag that we have output an SDL <block> for <partext> */
EXTERN LOGICAL inBlock INIT(FALSE);
/* flag that we need to output an <fdata> for a <form> */
EXTERN LOGICAL needFData INIT(FALSE);
/* Figure stuff */
#define FIGDEFWH "3in"
#define MAXNORMROWS 55
#define MAXSMALROWS 75
#define MAXTINYROWS 100
#define MAXPENS 8 /* when changing, check prfigpenwidths() ! */
#define MAXPENWIDTH 1864680 /* approx 1cm in scaled points */
EXTERN LOGICAL fignote ;
EXTERN int fignotePtr, in_graphic, nlines, blank_middle ;
EXTERN unsigned long ncolumns, max_columns, res_index, xx, ri ;
EXTERN LOGICAL file_ent ;
EXTERN M_WCHAR *f_content ;
EXTERN M_WCHAR f_contqual[FNAMELEN] ;
EXTERN M_WCHAR *f_file ;
/* callouts -- entfile and lineno */
EXTERN M_WCHAR *figinpath ;
EXTERN int figline INIT(0) ;
/* -- callouts -- */
#define BYTE unsigned char
#define NEWPT 0
#define NEWGROUP 1
#define NEWLINE 2
#define NEWCALLOUT 3
typedef struct tagFPOINT {
float x,y;
} FPOINT ;
typedef struct tagPwT {
FPOINT coord;
char ew[2],
ns[2],
lcr[2];
} PTWTXT ;
#define AN_desc 3
#define AN_nsew 60
#define AN_text 12
#define AN_isbros 16
#define AN_hasbros 32
#define AN_sf1 64
#define AN_sf2 128
#define SH_desc 0
#define SH_nsew 2
#define SH_text 2
#define SH_isbros 4
#define SH_hasbros 5
#define SH_sf1 6
#define SH_sf2 7
#define UNPK(c,an,sh) ((c&an)>>sh)
EXTERN FILE *calfile ;
EXTERN int maxct;
EXTERN LOGICAL okcallout ;
/* -- end callout -- */
EXTERN FILE *pclfile ;
#define VERSION "Version"
EXTERN char *version INIT(NULL) ;
EXTERN char texdone[] INIT("TeX run completed successfully.") ;
/* Code for standard library function "access" */
#define READABLE 04
/* Allowable units on dimensions */
#define SPperPT 65536.0
#define PTperIN 72.27
#define CMperIN 2.54
#define MMperIN 25.4
#define PTperPC 12.0
EXTERN char *dimarray[5]
#if defined(DEFINE)
= { "in",
"cm",
"mm",
"pc",
"pt" }
#endif
;
/* misc */
EXTERN int newhline INIT(0) ;
EXTERN int synelcnt INIT(0);
/* Cross-Reference Declarations */
/* do we have foreward references? */
EXTERN LOGICAL have_forward_xrefs INIT(FALSE);
EXTERN M_WCHAR *xrffile ; /* Save file and line number for error messages */
EXTERN int xrfline INIT(0) ; /* --used to store into structure "xref" */
EXTERN M_TRIE xtree ;
struct xref {
M_WCHAR *textptr ; /* Pointer to expansion of xref */
LOGICAL defined ; /* Whether the xref has been defined */
LOGICAL wheredef ; /* Whether defined in this pass or a previous one */
LOGICAL retrieved ; /* Whether the value has been used */
LOGICAL csensitive ; /* Whether the value is chapter sensitive */
LOGICAL xrefable; /* can this be xref'd to legally? */
char *chapstring ; /* Number of chapter or appendix where it occurs */
LOGICAL inchapter ; /* Whether in chapter or appendix */
M_WCHAR *file ; /* File and line # where first referred to or */
int line ; /* first defined for error reports */
} ;
/* Value of one particular cross-reference */
EXTERN M_WCHAR xrefstring[400] ;
EXTERN int xstrlen INIT(0) ;
/* Pointer to the id */
EXTERN M_WCHAR *savid ;
EXTERN LOGICAL iderr ;
EXTERN char *imageId INIT(NULL); /* "image" id saved for "imagetext" */
/* Save head for page header in rsect and table of contents string*/
EXTERN M_WCHAR savehead[400] ;
EXTERN M_WCHAR savetabcap[400] ;
EXTERN int svheadlen ;
EXTERN int svtclen ;
EXTERN LOGICAL savhd ;
EXTERN LOGICAL savtc ;
EXTERN LOGICAL hderr ;
EXTERN LOGICAL echo ;
EXTERN LOGICAL tooutput INIT(TRUE) ;
/* Save example until we see an annotation (which will behave like a head */
EXTERN char *saveex;
EXTERN int svexlen;
EXTERN char *saveexseg;
EXTERN int svexseglen;
EXTERN LOGICAL savex;
EXTERN LOGICAL stackex;
/* Glossary Declarations */
EXTERN M_TRIE gtree ;
#define MAXTERM 200
EXTERN M_WCHAR term[MAXTERM + 1] ;
EXTERN M_WCHAR *termp ;
EXTERN LOGICAL wsterm ;
EXTERN int lastTermId;
EXTERN LOGICAL firstAnnot;
EXTERN int exLineNum;
EXTERN LOGICAL tonumexlines;
EXTERN int oldExLineNum;
/* Saved document title */
EXTERN M_WCHAR *savedtitle;
/* tell whether .hmi should have generic info put into it */
EXTERN LOGICAL hadtitle INIT(FALSE);
EXTERN LOGICAL hadabstract INIT(FALSE);
/* emit an empty abstract title if no head specified */
EXTERN LOGICAL needabstracthead INIT(FALSE);
/* Numeric codes corresponding to keyword parameter values */
#define FIXED 1
#define FLOAT 2
#define SIDE 1
#define STACK 2
#define COMPUTER 1
#define DISPLAY 2
/* Note that the definition of BOX was chosen so that the border
parameter on both figure and table could use it, even though these
parameters do not share all possible values */
#define BOX 1
#define TOP 2
#define BOTTOM 3
#define NOBORDER 4
#define SCREEN 5
#define NOBOX 2
#define ART 1
#define PCL 2
#define TIFF 3
#define LISTING 4
#define TEXT 5
#define HPGL 7
/* IMPORTANT: "FIG..." values should not be */
/* changed (eg. see proc "checkmargin") */
#define FIGTOP 0
#define FIGRIGHT 1
#define FIGBOTTOM 2
#define FIGLEFT 3
#define NFIGSIDES 4
#define WRAP 1
#define NOWRAP 2
/* text size macros */
#define NORMAL 1
#define SMALLER 2
#define SMALLEST 3
#define NUMBER 1
#define NONUMBER 2
#define LEFT 1
#define INDENT 2
#define CENTER 3
#define RIGHT 4
#define TIGHT 1
#define LOOSE 2
#define NORULE 1
#define HEADRULE 2
#define GRID 3
#define ORDER 0
#define BULLET 1
#define PLAIN 2
#define MILSPEC 3
#define LABEL 4
#define CHECK 5
#define UROMAN 0
#define UALPHA 1
#define ARABIC 2
#define LALPHA 3
#define LROMAN 4
#define DOTPUNCT 0
#define PARENPUNCT 1
#define NEWPAGE 0
#define SAMEPAGE 1
#define GLOSS 1
#define NOGLOSS 2
#define INVERSE 1
#define NOINVERSE 2
#define STRIP 1
#define NOSTRIP 2
#define DPENWDVAL 1
#define SNAP 1
#define NOSNAP 2
#define AUTOSCALE 1
#define NOAUTOSCALE 2
/* the values for these elements are significant...they are used to set
* TeX register values which are later tested by macros
*/
#define COMMAND 1
#define KEYS2 2
/* the values for these elements are significant...they are used to set
* TeX register values which are later tested by macros
*/
#define TWO 2
#define FOUR 4
#define EIGHT 8
#define OTHER 0
/* values for ctable tracking */
EXTERN int ctbltype;
EXTERN int ctbldisplines;
EXTERN int ctblgraphics;
/* Declarations for lists */
#define MAXLISTLEV 8
/* FIRST => first paragraph in list item. The one following the label.
FOLLOW => immediately after a figure, note, caution, warning, ex or vex
INSIDE => at least one previous paragraph
*/
enum ParagraphListLocation {FIRST, FOLLOW, INSIDE};
EXTERN LOGICAL firstPInBlock; /* give the first para a different ssi= */
EXTERN LOGICAL lablisttight[MAXLISTLEV];
EXTERN int labhid[MAXLISTLEV];
EXTERN int labhtextid[MAXLISTLEV];
EXTERN int labelid[MAXLISTLEV];
EXTERN int labeltextid[MAXLISTLEV];
EXTERN int list INIT(0) ;
typedef struct contchain CONTCHAIN ;
struct contchain {
long where ;
CONTCHAIN *next ;
} ;
typedef struct list LIST ;
struct list {
int type ;
int order ;
int count ;
int space ;
unsigned char punct ;
unsigned char started ;
unsigned char where ;
LIST *lastlist ;
CONTCHAIN *chain ;
} ;
EXTERN LIST outlist
#if defined(DEFINE)
= {0, 0, 0, 0, DOTPUNCT, FALSE, FIRST, NULL, NULL}
#endif
;
EXTERN LIST *lastlist INIT(&outlist) ;
EXTERN int bulcount INIT(0) ;
typedef struct rowvec ROWVEC;
struct rowvec {
unsigned char firstitem;
unsigned char longlabel;
};
EXTERN ROWVEC listitems[MAXLISTLEV+1];
/* save area for index processing */
EXTERN M_WCHAR idxsav[400] ;
/* Sort form of an index term */
EXTERN M_WCHAR sort[400] ;
/* Sort form of an index sub term */
EXTERN M_WCHAR subsort[400] ;
/* print form of index term */
EXTERN M_WCHAR print[400] ;
/* print form of index sub term */
EXTERN M_WCHAR subprint[400] ;
EXTERN int idxsavlen ;
EXTERN LOGICAL didsort ;
EXTERN LOGICAL didsubsort ;
/* Strings for constructing error messages */
EXTERN char firstused[] INIT("'%s' first used in line %d") ;
EXTERN char undef[] INIT("Undefined cross-reference %s (") ;
EXTERN char infile[] INIT("file %s, ") ;
EXTERN char online[] INIT("line %d)\n") ;
EXTERN char offile[] INIT(" of file: %s") ;
/* Whitemenu supported only in calculator, issue message only once */
EXTERN LOGICAL wmenu_err INIT(FALSE) ;
/* For index entries */
#define IDXSTRT1 {}
#define IDXSTRT2 {}
#define IDXSTRT IDXSTRT1 IDXSTRT2
#define IDXEND1 {}
#define IDXEND2 {}
#define IDXEND3 {}
#define IDXEND IDXEND1 IDXEND2 IDXEND3
/* Absorb consecutive <CR>'s, because TeX gets confused by them */
EXTERN LOGICAL multi_cr_flag INIT(FALSE);
/* Direct debugging trace output to stdout or outfile */
EXTERN LOGICAL tracetostd INIT(FALSE) ;
/* Function prototypes */
#include "fproto.h"
/* Declarations for handling special characters */
#include "roman8.h"
/* Declarations for handling special characters for calculators*/
EXTERN char ccoutbuf[128] ;
/* Character conversion tables */
#include "charconv.h"

View File

@@ -0,0 +1,7 @@
/* $XConsortium: grphpar.c /main/3 1995/11/08 09:30:22 rswiston $ */
/* Copyright (c) 1988, 1989 Hewlett-Packard Co. */
/* HP Tag/TeX figure aspect ratio calculations */
#define GRAPHDEF
/* Obsolete */

View File

@@ -0,0 +1,6 @@
/* $XConsortium: grphpar.h /main/3 1995/11/08 09:30:34 rswiston $ */
/* Copyright (c) 1988, 1989 Hewlett-Packard Co. */
/* Variable definitions for HP Tag/TeX for figures and graphics */
/* when adding, check "global.h" for conflicts */
/* Obsolete */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,434 @@
-- HP Tag Document-Type Definition
Copyright (c) Hewlett-Packard Company, 1987-1994
Version 1.23 (2/1/94)-Canonical SGML only
$XConsortium: hptag.dtd /main/2 1996/11/07 11:55:24 drk $
--
-- Entity to read in user defined entities --
<!ENTITY USER-DEFINED-ENTITIES SYSTEM>
-- Standard pre-defined HP Tag Entities --
-- Math symbols --
<!ENTITY minus SDATA > -- Minus sign --
<!ENTITY pm SDATA > -- Plus or minus sign --
<!ENTITY div SDATA > -- Division sign --
<!ENTITY times SDATA > -- Multiplication sign --
<!ENTITY leq SDATA > -- Less than or equals sign --
<!ENTITY geq SDATA > -- Greater than or equals sign --
<!ENTITY neq SDATA > -- Not equals sign --
-- Special typographical symbols --
<!ENTITY copy SDATA >
<!ENTITY reg SDATA >
<!ENTITY tm SDATA >
<!ENTITY ellipsis SDATA >
<!ENTITY pellipsis SDATA >
<!ENTITY vellipsis SDATA >
<!ENTITY a.m. SDATA >
<!ENTITY p.m. SDATA >
<!ENTITY minutes SDATA >
<!ENTITY seconds SDATA >
<!ENTITY deg SDATA >
<!ENTITY squote SDATA > -- Single quote, non-directional --
<!ENTITY dquote SDATA > -- Double quote, non-directional --
<!ENTITY endash SDATA >
<!ENTITY emdash SDATA >
<!ENTITY vblank SDATA > -- Visible blank for syntax descriptions --
<!ENTITY cents SDATA >
<!ENTITY sterling SDATA > -- Pound sterling --
<!ENTITY m-d- PI > -- Discretionary hyphen --
<!ENTITY space SDATA > -- Unescaped significant space (for <ex>) --
<!ENTITY sigspace SDATA > -- Significant space --
<!ENTITY sigdash SDATA > -- Significant dash (hyphen) --
<!ENTITY empty SDATA "">
-- Special technical symbols --
<!ENTITY micro SDATA >
<!ENTITY ohm SDATA >
-- Keycap arrows --
<!ENTITY up SDATA >
<!ENTITY down SDATA >
<!ENTITY left SDATA >
<!ENTITY right SDATA >
<!ENTITY home SDATA >
<!ENTITY back SDATA >
-- Miscellaneous entities --
<!ENTITY date SDATA >
<!ENTITY time SDATA >
<!ENTITY halfspace SDATA >
-- Entities for MARKUP delimiters --
<!ENTITY m-backslash CDATA "\">
<!ENTITY m-slash CDATA "/">
<!ENTITY m-lt CDATA "<">
<!ENTITY m-and CDATA "&">
-- For localizable "special characters" head in
automatically generated index --
<!ENTITY m-specchar SDATA>
<!SHORTREF text>
"&\" -> &m-backslash,
"&/" -> &m-slash,
"&<" -> &m-lt,
"&&" -> &m-and,
"-?" -> &m-d-
;
helpvolume -> (metainfo?, hometopic?,
(chapter* | (s1*, rsect*)), message?, glossary?)
<EXCEPT> +(memo | idx )
<USEMAP text>
;
hometopic -> (chaphead, text?)
;
otherhead -> (head, text?)
;
memo -> CDATA -- A writer's note to self or reviewer --
;
link -> (partext)
<EXCEPT> -(link | xref)
<PARAM>
hyperlink CDATA,
type (JUMP | JUMPNEWVIEW | DEFINITION | EXECUTE | APPDEFINED | MAN),
description CDATA
;
location -> (partext?)
<PARAM>
id ID #REQUIRED
;
-- Front matter --
metainfo -> (idsection, abstract?, otherfront*)
<EXCEPT> -(footnote)
;
idsection -> (title, copyright?)
;
title -> (partext)
<EXCEPT> -(memo | location | idx)
;
copyright -> (text)
<EXCEPT> -(memo | location | idx)
;
abstract -> (head?, text?, frontsub*)
;
otherfront -> (head?, text?, frontsub*)
<PARAM>
id ID,
;
frontsub -> (head?, text)
;
chapter -> (chaphead, text?, (s1*, rsect*))
;
<!PARAM chapter s1 s2 s3 s4 s5 s6 s7 s8 s9>
id ID
;
s1 -> (chaphead, text?, s2*, rsect*)
;
s2 -> (chaphead, text?, s3*, rsect*)
;
s3 -> (chaphead, text?, s4*, rsect*)
;
s4 -> (chaphead, text?, s5*, rsect*)
;
s5 -> (chaphead, text?, s6*, rsect*)
;
s6 -> (chaphead, text?, s7*, rsect*)
;
s7 -> (chaphead, text?, s8*, rsect*)
;
s8 -> (chaphead, text?, s9*, rsect*)
;
s9 -> (chaphead, text?)
;
procedure -> (chaphead, text?)
<EXCEPT> -(procedure)
;
rsect -> (chaphead, text?, rsub*)
<PARAM>
id ID,
;
rsub -> (chaphead, text?)
;
chaphead -> (head, abbrev?)
<EXCEPT> -(memo | location | idx | footnote)
;
head -> (partext)
<EXCEPT> -(memo | location | idx)
;
abbrev -> (partext)
<EXCEPT> -(footnote)
;
-- TEXT --
text -> (p | note | caution | warning | lablist | list | vex |
ex | esc | otherhead | procedure | syntax | figure | image)*
;
<!PARAM p image>
indent (INDENT),
gentity ENTITY,
gposition (LEFT | RIGHT),
ghyperlink CDATA,
glinktype (JUMP | JUMPNEWVIEW | DEFINITION | EXECUTE | APPDEFINED | MAN),
gdescription CDATA,
id ID
;
p -> (head?, partext)
<EXCEPT> +(newline)
;
newline -> EMPTY
;
image -> (head?, partext)
<EXCEPT> -(footnote)
;
(note | caution | warning) -> (head?, text)
<EXCEPT> -(note | caution | warning | footnote)
;
list -> (head?, item +)
<PARAM>
type (ORDER | BULLET | PLAIN | MILSPEC | CHECK) #IMPLIED,
ordertype (UALPHA | LALPHA | ARABIC | UROMAN | LROMAN) #IMPLIED,
spacing (TIGHT | LOOSE) #IMPLIED,
continue (CONTINUE)
;
item -> (text)
<PARAM>
id ID
;
lablist -> (head?, labheads?, lablistitem +)
<PARAM>
longlabel (WRAP | NOWRAP) #IMPLIED,
spacing (TIGHT | LOOSE) #IMPLIED
;
labheads -> (labh, labhtext)
<EXCEPT> -(memo | location | idx)
;
labh -> (partext)
;
labhtext -> (partext)
;
lablistitem -> (label, text)
;
label -> (partext)
;
ex -> (head?, (exampleseg, annotation?)+)
<EXCEPT> -(ex | vex | note | caution | warning | syntax | footnote)
<PARAM>
notes (SIDE | STACK) #IMPLIED,
lines (NUMBER | NONUMBER) #IMPLIED,
textsize (NORMAL | SMALLER | SMALLEST) #IMPLIED,
;
exampleseg -> (partext)
<EXCEPT> +(lineno)
;
lineno -> EMPTY
<PARAM> id ID #REQUIRED
;
annotation -> (partext?)
<EXCEPT> +(newline)
;
vex -> CDATA
<PARAM>
lines (NUMBER | NONUMBER) #IMPLIED,
textsize (NORMAL | SMALLER | SMALLEST) #IMPLIED,
;
syntax -> (head?, synel)
;
synel -> (#PCDATA | esc | var | keycap | optblock | reqblock)+
;
optblock -> (synel)
;
reqblock -> (synel)
;
footnote -> (p +)
<EXCEPT> -(footnote)
;
idx -> (indexprimary, indexsub?)
<EXCEPT> -(term | footnote | location | idx)
;
indexprimary -> (partext, sort?)
;
indexsub -> (partext, sort?)
;
sort -> (#PCDATA | esc)+
;
graphic -> EMPTY
<PARAM>
id ID,
entity ENTITY,
;
figure -> (caption?)
<EXCEPT> -(figure, graphic)
<PARAM>
number NUMBER #IMPLIED,
tonumber (NUMBER | NONUMBER) #IMPLIED,
id ID,
entity ENTITY,
figpos (LEFT | CENTER | RIGHT) #IMPLIED,
cappos (CAPLEFT | CAPCENTER | CAPRIGHT) #IMPLIED,
ghyperlink CDATA,
glinktype (JUMP | JUMPNEWVIEW | DEFINITION | EXECUTE | APPDEFINED | MAN),
gdescription CDATA
;
caption -> (partext, abbrev?)
<EXCEPT> -(memo | location | idx)
;
-- Included text elements --
-- If modifying definition of "partext", check exclusions to "term" --
partext -> (#PCDATA | acro | emph | computer | graphic | term |
var | circle | quote | keycap | user | super |
sub | book | xref | footnote | esc | link |
location | newline)*
;
acro -> (#PCDATA | esc | super | sub)*
;
esc -> CDATA
;
emph -> (partext)
;
computer -> (#PCDATA | quote | keycap | var | user |
super | sub | esc)*
;
user -> (#PCDATA | keycap | var | super | sub | esc)*
;
term -> (partext)
<EXCEPT>
-(emph | computer | term | var | quote | user | book | footnote )
<PARAM>
base CDATA,
gloss (GLOSS | NOGLOSS)
;
quote -> (partext)
;
keycap -> (#PCDATA | super | sub | esc)+
;
super -> (#PCDATA)
;
sub -> (#PCDATA)
;
var -> (#PCDATA | sub | super | esc)+
;
circle -> (#PCDATA)
;
book -> (partext)
<EXCEPT> -(book)
;
xref -> EMPTY
<PARAM>
id IDREF #REQUIRED
;
-- Stuff following the chapters: error messages, and glossary --
-- Error Messages --
message -> (chaphead?, text?, (msg + | msgsub +))
<PARAM>
include CDATA,
exclude CDATA
;
msgsub -> (chaphead, text?, msg +)
<PARAM>
include CDATA,
exclude CDATA
;
msg -> (msgnum?, msgtext, explain?)
;
msgnum -> (#PCDATA | esc)+
;
msgtext -> (partext)
<EXCEPT> +(newline)
;
explain -> (text)
;
-- Glossary --
glossary -> (text?, glossent +)
;
glossent -> (dterm, definition)
;
dterm -> (partext)
<EXCEPT> -(term)
;
definition -> (text)
;

View File

@@ -0,0 +1,926 @@
EXTERN char *toss[]
#if defined(DEFINE)
= {
"<TOSS>",
"<KEYSTYLE CLASS=\"ACRO\"",
" PHRASE=\"An acronym\"",
" POINTSZ=\"8\" >",
"<KEYSTYLE CLASS=\"BOOK\"",
" PHRASE=\"The proper title of a document\"",
" SLANT=\"ITALIC\" >",
"<KEYSTYLE CLASS=\"EMPH\"",
" PHRASE=\"An emphasized phrase\"",
" SLANT=\"ITALIC\" >",
"<KEYSTYLE CLASS=\"EMPH\"",
" SSI=\"UNIMP\"",
" PHRASE=\"An HPTag feature unimplemented in HelpTag\"",
" SLANT=\"ITALIC\" >",
"<KEYSTYLE CLASS=\"MACH-CONT\"",
" PHRASE=\"A machine control or keyboard key name\"",
" ENTER=\"[\"",
" EXIT=\"]\"",
" STYLE=\"SANS-SERIF\"",
" WEIGHT=\"BOLD\" >",
"<KEYSTYLE CLASS=\"MACH-IN\"",
" PHRASE=\"A machine input phrase\"",
" SPACING=\"MONOSPACE\"",
" WEIGHT=\"BOLD\" >",
"<KEYSTYLE CLASS=\"MACH-OUT\"",
" PHRASE=\"A machine output phrase\"",
" STYLE=\"SERIF\"",
" SPACING=\"MONOSPACE\"",
" WEIGHT=\"MEDIUM\"",
" SLANT=\"ROMAN\" >",
"<KEYSTYLE CLASS=\"NAME\"",
" PHRASE=\"A variable name\" ",
" STYLE=\"SERIF\"",
" SPACING=\"PROPSPACE\"",
" SLANT=\"ITALIC\" >",
"<KEYSTYLE CLASS=\"QUOTE\"",
" SSI=\"OPEN\"",
" PHRASE=\"Entering a direct quote\"",
" ENTER=\"``\"",
" SPACING=\"PROPSPACE\" >",
"<KEYSTYLE CLASS=\"QUOTE\"",
" SSI=\"CLOSE\"",
" PHRASE=\"Leaving a direct quote\"",
" EXIT=\"''\"",
" SPACING=\"PROPSPACE\" >",
"<KEYSTYLE CLASS=\"TERM\"",
" PHRASE=\"A phrase defined elsewhere\"",
" WEIGHT=\"BOLD\" >",
"<KEYSTYLE CLASS=\"UDEFKEY\"",
" SSI=\"SUB\"",
" PHRASE=\"A subscript\"",
" POINTSZ=\"8\"",
" STYLE=\"SERIF\"",
" SPACING=\"PROPSPACE\"",
" SLANT=\"ITALIC\" >",
"<KEYSTYLE CLASS=\"UDEFKEY\"",
" SSI=\"SUPER\"",
" PHRASE=\"A subscript\"",
" POINTSZ=\"8\"",
" STYLE=\"SERIF\"",
" SPACING=\"PROPSPACE\"",
" SLANT=\"ITALIC\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"ABSTRACT\"",
" PHRASE=\"Abstract heading\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" POINTSZ=\"14\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"CHAPHEAD\"",
" RLEVEL=\"0\"",
" PHRASE=\"Frontmatter heading\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" POINTSZ=\"14\"",
" STYLE=\"SERIF\"",
" WEIGHT=\"BOLD\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"CHAPHEAD\"",
" RLEVEL=\"1\"",
" PHRASE=\"Home topic heading\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" POINTSZ=\"14\"",
" STYLE=\"SERIF\"",
" WEIGHT=\"BOLD\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"CHAPHEAD\"",
" PHRASE=\"Chapter heading\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" POINTSZ=\"14\"",
" STYLE=\"SERIF\"",
" WEIGHT=\"BOLD\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"PROCEDURE\"",
" PHRASE=\"Procedure heading\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" STYLE=\"SERIF\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"EX\"",
" PHRASE=\"Head for example (ex) text\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" WEIGHT=\"BOLD\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"FRONTSUB\"",
" PHRASE=\"Heading for subsection of frontmatter\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" POINTSZ=\"14\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"IMAGE\"",
" PHRASE=\"Head for image text\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" FLOW=\"JOIN\"",
" WEIGHT=\"BOLD\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"IMAGE-GRAPHIC-LEFT\"",
" PHRASE=\"Container for a left oriented graphic in image text\"",
" ORIENT=\"LEFT-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" HEADW=\"0\"",
" FLOW=\"WRAP\"",
" R-MARGIN=\"2\"",
" VJUST=\"TOP-VJUST\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"IMAGE-GRAPHIC-RIGHT\"",
" PHRASE=\"Container for a right oriented graphic in image text\"",
" ORIENT=\"RIGHT-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" HEADW=\"0\"",
" FLOW=\"WRAP\"",
" L-MARGIN=\"2\"",
" VJUST=\"TOP-VJUST\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"LABLIST\"",
" PHRASE=\"Heading for a labeled list\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" WEIGHT=\"BOLD\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"LIST\"",
" PHRASE=\"Heading for a list\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" WEIGHT=\"BOLD\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"METAINFO\"",
" PHRASE=\"Heading for the metainfo section\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" POINTSZ=\"14\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"IDSECTION\"",
" PHRASE=\"ID Section Heading\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" POINTSZ=\"14\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"MSGNUM\"",
" PHRASE=\"Message number\"",
" ORIENT=\"LEFT-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" HEADW=\"0\"",
" VJUST=\"TOP-VJUST\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"NCW-ICON\"",
" PHRASE=\"Icon for a note, caution or warning\"",
" ORIENT=\"LEFT-CORNER-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" HEADW=\"0\"",
" VJUST=\"TOP-VJUST\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"NCW\"",
" PHRASE= \"Heading for a note, caution or warning\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" HEADW=\"0\"",
" POINTSZ=\"10\"",
" STYLE=\"SERIF\"",
" WEIGHT=\"BOLD\"",
" L-MARGIN=\"1\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"OTHERHEAD\"",
" PHRASE=\"Other heading\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" POINTSZ=\"14\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"P\"",
" PHRASE=\"Paragraph\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" FLOW=\"JOIN\"",
" WEIGHT=\"BOLD\"",
" VJUST=\"TOP-VJUST\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"P-GRAPHIC-LEFT\"",
" PHRASE=\"Container for a left oriented graphic in a paragraph\"",
" ORIENT=\"LEFT-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" HEADW=\"0\"",
" FLOW=\"WRAP\"",
" R-MARGIN=\"2\"",
" VJUST=\"TOP-VJUST\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"P-GRAPHIC-RIGHT\"",
" PHRASE=\"Container for a right oriented graphic in a paragraph\"",
" ORIENT=\"RIGHT-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" HEADW=\"0\"",
" FLOW=\"WRAP\"",
" L-MARGIN=\"2\"",
" VJUST=\"TOP-VJUST\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"TITLE\"",
" PHRASE=\"Document title\"",
" ORIENT=\"LEFT-MARGIN-ORIENT\"",
" POINTSZ=\"14\"",
" WEIGHT=\"BOLD\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"ANNOTATION\"",
" SSI=\"ANNOT-SIDE\"",
" PHRASE=\"Side oriented example annotation\"",
" ORIENT=\"RIGHT-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" HEADW=\"4000\"",
" L-MARGIN=\"5\"",
" VJUST=\"TOP-VJUST\"",
" SLANT=\"ITALIC\"",
" JUSTIFY=\"LEFT-JUSTIFY\">",
"<HEADSTYLE CLASS=\"ANNOTATION\"",
" SSI=\"ANNOT-STACK\"",
" PHRASE=\"Stacked example annotation\"",
" ORIENT=\"CENTER-ORIENT\"",
" VORIENT=\"BOTTOM-VORIENT\"",
" JUSTIFY=\"LEFT-JUSTIFY\"",
" VJUST=\"BOTTOM-VJUST\"",
" SLANT=\"ITALIC\" >",
"<HEADSTYLE CLASS=\"HEAD\"",
" SSI=\"EX-NUM\"",
" PHRASE=\"Example line numbers\"",
" ORIENT=\"LEFT-ORIENT\"",
" VORIENT=\"BOTTOM-VORIENT\"",
" HEADW=\"0\"",
" R-MARGIN=\"2\"",
" JUSTIFY=\"RIGHT-JUSTIFY\"",
" VJUST=\"BOTTOM-VJUST\">",
"<HEADSTYLE CLASS=\"CAPTION\"",
" SSI=\"CAPTION\"",
" PHRASE=\"Caption of an unnumbered figure\"",
" VORIENT=\"TOP-VORIENT\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" VJUST=\"TOP-VJUST\"",
" JUSTIFY=\"CENTER-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"CAPTION\"",
" SSI=\"CAPTION-CENTER\"",
" PHRASE=\"Center oriented caption of an unnumbered figure\"",
" VORIENT=\"TOP-VORIENT\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" VJUST=\"TOP-VJUST\"",
" JUSTIFY=\"CENTER-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"CAPTION\"",
" SSI=\"CAPTION-LEFT\"",
" PHRASE=\"Left oriented caption of an unnumbered figure\"",
" ORIENT=\"LEFT-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" VJUST=\"TOP-VJUST\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"CAPTION\"",
" SSI=\"CAPTION-RIGHT\"",
" PHRASE=\"Right oriented caption of an unnumbered figure\"",
" ORIENT=\"RIGHT-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" VJUST=\"TOP-VJUST\"",
" JUSTIFY=\"RIGHT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"CAPTION\"",
" SSI=\"NUMBER\"",
" PHRASE=\"Figure number\"",
" ORIENT=\"CENTER-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" T-MARGIN=\"1\"",
" VJUST=\"TOP-VJUST\"",
" JUSTIFY=\"CENTER-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"CAPTION\"",
" SSI=\"NUMBER-CENTER\"",
" PHRASE=\"Center oriented figure number\"",
" VORIENT=\"TOP-VORIENT\"",
" T-MARGIN=\"1\"",
" VJUST=\"TOP-VJUST\"",
" JUSTIFY=\"CENTER-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"CAPTION\"",
" SSI=\"NUMBER-LEFT\"",
" PHRASE=\"Left oriented figure number\"",
" ORIENT=\"LEFT-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" T-MARGIN=\"1\"",
" VJUST=\"TOP-VJUST\" >",
"<HEADSTYLE CLASS=\"CAPTION\"",
" SSI=\"NUMBER-RIGHT\"",
" PHRASE=\"Right oriented figure number\"",
" ORIENT=\"RIGHT-ORIENT\"",
" VORIENT=\"TOP-VORIENT\"",
" T-MARGIN=\"1\"",
" VJUST=\"TOP-VJUST\"",
" JUSTIFY=\"RIGHT-JUSTIFY\" >",
"<HEADSTYLE CLASS=\"CAPTION\"",
" SSI=\"CAPTION-NUMBERED\"",
" PHRASE=\"Author supplied caption of a numbered figure\"",
" VORIENT=\"TOP-VORIENT\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" VJUST=\"TOP-VJUST\"",
" JUSTIFY=\"CENTER-JUSTIFY\" >",
"<FORMSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-LOOSE\"",
" PHRASE=\"First item in a loose list\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FORMSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-TIGHT\"",
" PHRASE=\"First item in a tight list\"",
" T-MARGIN=\"1\" >",
"<FORMSTYLE CLASS=\"ITEM\"",
" SSI=\"LOOSE\"",
" PHRASE=\"Subsequent item in a loose list\"",
" B-MARGIN=\"1\" >",
"<FORMSTYLE CLASS=\"ITEM\"",
" SSI=\"TIGHT\"",
" PHRASE=\"Subsequent item in a tight list\" >",
"<FORMSTYLE CLASS=\"LIST\"",
" SSI=\"BULLET-LOOSE\"",
" PHRASE=\"Bulleted loose list\"",
" COLW=\"1 99,0,98\"",
" L-MARGIN=\"2\" >",
"<FORMSTYLE CLASS=\"LIST\"",
" SSI=\"BULLET-TIGHT\"",
" PHRASE=\"Bulleted tight list\"",
" COLW=\"1 99,0,98\"",
" L-MARGIN=\"2\"",
" B-MARGIN=\"1\" >",
"<FORMSTYLE CLASS=\"LIST\"",
" SSI=\"CHECK-LOOSE\"",
" PHRASE=\"Checked loose list\"",
" COLW=\"1 99,0,98\"",
" L-MARGIN=\"2\" >",
"<FORMSTYLE CLASS=\"LIST\"",
" SSI=\"CHECK-TIGHT\"",
" PHRASE=\"Checked tight list\"",
" COLW=\"1 99,0,98\"",
" L-MARGIN=\"2\"",
" B-MARGIN=\"1\" >",
"<FORMSTYLE CLASS=\"LIST\"",
" SSI=\"LABELED-LOOSE\"",
" PHRASE=\"Labeled loose list\"",
" COLW=\"20,20,10 80,10,20\" >",
"<FORMSTYLE CLASS=\"LIST\"",
" SSI=\"LABELED-TIGHT\"",
" PHRASE=\"Labeled tight list\"",
" COLW=\"20,20,10 80,10,20\"",
" B-MARGIN=\"1\" >",
"<FORMSTYLE CLASS=\"LIST\"",
" SSI=\"ORDER-LOOSE\"",
" PHRASE=\"Ordered loose list\"",
" COLW=\"1,98,0 99,0,98\"",
" COLJ=\"D L\"",
" L-MARGIN=\"2\" >",
"<FORMSTYLE CLASS=\"LIST\"",
" SSI=\"ORDER-TIGHT\"",
" PHRASE=\"Ordered tight list\"",
" COLW=\"1,98,0 99,0,98\"",
" COLJ=\"D L\"",
" L-MARGIN=\"2\"",
" B-MARGIN=\"1\" >",
"<FORMSTYLE CLASS=\"LIST\"",
" SSI=\"PLAIN-LOOSE\"",
" PHRASE=\"Plain loose list\"",
" L-MARGIN=\"4\" >",
"<FORMSTYLE CLASS=\"LIST\"",
" SSI=\"PLAIN-TIGHT\"",
" PHRASE=\"Plain tight list\"",
" B-MARGIN=\"1\"",
" L-MARGIN=\"4\" >",
"<FORMSTYLE CLASS=\"TEXT\"",
" SSI=\"MSGSUB\"",
" PHRASE=\"Container for a group of related messages\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"CAUTION\"",
" PHRASE=\"Caution\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"MEMO\"",
" PHRASE=\"Writers comments or questions during development\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"MSG\"",
" PHRASE=\"An individual message in the Message section\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"NOTE\"",
" PHRASE=\"Note\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"OTHERHEAD\"",
" PHRASE=\"Otherhead\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"WARNING\"",
" PHRASE=\"Warning\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-LOOSE-ARABIC\"",
" PHRASE=\"First label in an Arabic numeral loose list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-LOOSE-BULLET\"",
" PHRASE=\"First label in a bulleted loose list\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-LOOSE-CHECK\"",
" PHRASE=\"First label in a checked loose list\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-LOOSE-LABEL\"",
" PHRASE=\"First label in a labeled loose list\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-LOOSE-ALPHA\"",
" PHRASE=\"First label in a alphabetic loose list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-LOOSE-ROMAN\"",
" PHRASE=\"First label in a Roman numeral loose list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-TIGHT-ARABIC\"",
" PHRASE=\"First label in an Arabic numeral tight list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-TIGHT-BULLET\"",
" PHRASE=\"First label in a bulleted tight list\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-TIGHT-CHECK\"",
" PHRASE=\"First label in a checked tight list\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-TIGHT-LABEL\"",
" PHRASE=\"First label in a labeled tight list\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-TIGHT-ALPHA\"",
" PHRASE=\"First label in a alphabetic tight list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIRST-TIGHT-ROMAN\"",
" PHRASE=\"First label in a Roman numeral tight list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"LABH-LOOSE\"",
" PHRASE=\"Label heading for loose labeled list\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"LABH-TIGHT\"",
" PHRASE=\"Label heading for tight labeled list\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"LABHTEXT-LOOSE\"",
" PHRASE=\"Item heading for loose labeled list\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"LABHTEXT-TIGHT\"",
" PHRASE=\"Item heading for tight labeled list\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"LOOSE-ARABIC\"",
" PHRASE=\"Subsequent label in an Arabic numeral loose list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"LOOSE-BULLET\"",
" PHRASE=\"Subsequent label in a bulleted loose list\"",
" R-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"LOOSE-CHECK\"",
" PHRASE=\"Subsequent label in a checked loose list\"",
" R-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"LOOSE-LABEL\"",
" PHRASE=\"Subsequent label in a labeled loose list\"",
" R-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"LOOSE-ALPHA\"",
" PHRASE=\"Subsequent label in a alphabetic loose list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"LOOSE-ROMAN\"",
" PHRASE=\"Subsequent label in a Roman numeral loose list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"TIGHT-ARABIC\"",
" PHRASE=\"Subsequent label in an Arabic numeral tight list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"TIGHT-BULLET\"",
" PHRASE=\"Subsequent label in a bulleted tight list\"",
" R-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"TIGHT-CHECK\"",
" PHRASE=\"Subsequent label in a checked tight list\"",
" R-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"TIGHT-LABEL\"",
" PHRASE=\"Subsequent label in a labeled tight list\"",
" R-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"TIGHT-ALPHA\"",
" PHRASE=\"Subsequent label in a alphabetic tight list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"TIGHT-ROMAN\"",
" PHRASE=\"Subsequent label in a Roman numeral tight list\"",
" WEIGHT=\"BOLD\"",
" R-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"TERM\"",
" PHRASE=\"Term being defined in the glossary\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"DEFINITION\"",
" PHRASE=\"Term definition in the glossary\"",
" L-MARGIN=\"2\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"EX\"",
" PHRASE=\"Example\"",
" STYLE=\"SERIF\"",
" SPACING=\"MONOSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\"",
" L-MARGIN=\"3\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"EX\"",
" PHRASE=\"Example - inside a list item\"",
" STYLE=\"SERIF\"",
" SPACING=\"MONOSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\"",
" L-MARGIN=\"3\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"EX-NML\"",
" PHRASE=\"Example text - normal size\"",
" POINTSZ=\"10\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"EX-SMLR\"",
" PHRASE=\"Example text - smaller size\"",
" POINTSZ=\"8\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"EX-SMLST\"",
" PHRASE=\"Example text - smallest size\"",
" POINTSZ=\"6\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"EX-NML\"",
" PHRASE=\"Example text - normal size inside a list item\"",
" POINTSZ=\"10\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"EX-SMLR\"",
" PHRASE=\"Example text - smaller size inside a list item\"",
" POINTSZ=\"8\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"EX-SMLST\"",
" PHRASE=\"Example text - smallest size inside a list item\"",
" POINTSZ=\"6\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"PROCEDURE\"",
" PHRASE=\"Text describing a particular procedure\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"ENTRYPOINT\"",
" PHRASE=\"Entrypoint\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"FIGURE\"",
" PHRASE=\"Container for a stand-alone figure\"",
" JUSTIFY=\"CENTER-JUSTIFY\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"FIGURE\"",
" PHRASE=\"Container for a stand-alone figure inside a list item\"",
" JUSTIFY=\"CENTER-JUSTIFY\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"IMAGE\"",
" PHRASE=\"Image text\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"IMAGE-INDENT\"",
" PHRASE=\"Indented image text\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\"",
" L-MARGIN=\"6\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"IMAGE\"",
" PHRASE=\"Image text inside a list item\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"IMAGE-INDENT\"",
" PHRASE=\"Indented image text inside a list item\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\"",
" L-MARGIN=\"6\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"MSGTEXT\"",
" PHRASE=\"Text of messages in the Message section\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"P1-INDENT\"",
" PHRASE=\"Indented first paragraph text\"",
" L-MARGIN=\"6\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"P1-INDENT\"",
" PHRASE=\"Indented first paragraph text inside a list item\"",
" L-MARGIN=\"6\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"P-INDENT\"",
" PHRASE=\"Indented paragraph text\"",
" L-MARGIN=\"6\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"P-INDENT\"",
" PHRASE=\"Indented paragraph text inside a list item\"",
" L-MARGIN=\"6\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"UNIMP\"",
" PHRASE=\"Unimplemented element message\"",
" WEIGHT=\"BOLD\"",
" T-MARGIN=\"1\"",
" B-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"P1\"",
" PHRASE=\"Normal first paragraph text\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"P1\"",
" PHRASE=\"Normal first paragraph text inside a list item\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"P\"",
" PHRASE=\"Normal paragraph text\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"SYNTAX\"",
" PHRASE=\"Paragraph text describing syntax usage\"",
" STYLE=\"SERIF\"",
" SPACING=\"MONOSPACE\"",
" L-MARGIN=\"4\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"ITEM\"",
" SSI=\"P\"",
" PHRASE=\"Normal paragraph text inside a list item\"",
" T-MARGIN=\"1\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"_ABSTRACT\"",
" PHRASE=\"Virtual page for an abstract\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"_COPYRIGHT\"",
" PHRASE=\"Virtual page for a copyright notice\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"_GLOSSARY\"",
" PHRASE=\"Virtual page for a glossary\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"_HOMETOPIC\"",
" PHRASE=\"Virtual page for the Home Topic\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"METAINFO\"",
" PHRASE=\"Virtual page for an unaddressable metainfo section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"MESSAGE\"",
" PHRASE=\"Virtual page for a Message section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"IDSECTION\"",
" PHRASE=\"Virtual page for an unaddressable idsection section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"_TITLE\"",
" PHRASE=\"Virtual page for a document title\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"APPENDIX\"",
" PHRASE=\"Virtual page for an appendix\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"CHAPTER\"",
" PHRASE=\"Virtual page for a chapter\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"RSECT\"",
" PHRASE=\"Virtual page for a reference section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"S1\"",
" PHRASE=\"Virtual page for a first level section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"S2\"",
" PHRASE=\"Virtual page for a second level section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"S3\"",
" PHRASE=\"Virtual page for a third level section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"S4\"",
" PHRASE=\"Virtual page for a fourth level section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"S5\"",
" PHRASE=\"Virtual page for a fifth level section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"S6\"",
" PHRASE=\"Virtual page for a sixth level section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"S7\"",
" PHRASE=\"Virtual page for a seventh level section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"S8\"",
" PHRASE=\"Virtual page for a eighth level section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"S9\"",
" PHRASE=\"Virtual page for a ninth level section\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<FRMTSTYLE CLASS=\"TEXT\"",
" SSI=\"TEST\"",
" PHRASE=\"Virtual page for a Test element (should not appear)\"",
" POINTSZ=\"10\"",
" STYLE=\"SANS-SERIF\"",
" SPACING=\"PROPSPACE\"",
" WEIGHT=\"MEDIUM\" ",
" SLANT=\"ROMAN\" >",
"<GRPHSTYLE CLASS=\"FIGURE\"",
" SSI=\"FIG\"",
" PHRASE=\"Stand alone figure\"",
" JUSTIFY=\"CENTER-JUSTIFY\" >",
"<GRPHSTYLE CLASS=\"FIGURE\"",
" SSI=\"FIG-CENTER\"",
" PHRASE=\"Center oriented stand alone figure\"",
" JUSTIFY=\"CENTER-JUSTIFY\" >",
"<GRPHSTYLE CLASS=\"FIGURE\"",
" SSI=\"FIG-LEFT\"",
" PHRASE=\"Left oriented stand alone figure\"",
" JUSTIFY=\"LEFT-JUSTIFY\" >",
"<GRPHSTYLE CLASS=\"FIGURE\"",
" SSI=\"FIG-RIGHT\"",
" PHRASE=\"Right oriented stand alone figure\"",
" JUSTIFY=\"RIGHT-JUSTIFY\" >",
"<GRPHSTYLE CLASS=\"FIGURE\"",
" SSI=\"GRPH-LEFT\"",
" PHRASE=\"Left oriented graphic in text\" >",
"<GRPHSTYLE CLASS=\"FIGURE\"",
" SSI=\"GRPH-RIGHT\"",
" PHRASE=\"Right oriented graphic in text\"",
" JUSTIFY=\"RIGHT-JUSTIFY\" >",
"<GRPHSTYLE CLASS=\"ICON\"",
" SSI=\"NCW-ICON\"",
" PHRASE=\"Icon for a note, caution or warning\" >",
"</TOSS>",
0
}
#endif
;

View File

@@ -0,0 +1,31 @@
/* $XConsortium: make.c /main/3 1995/11/08 09:31:30 rswiston $ */
/* Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co. */
/* Functions for pseudo-make features of HP Tag/TeX translator, i.e.,
for testing which generated files are current and which must be
recreated. */
/*
NOTE : This file is used as a Microsoft Linker overlay, so it cannot
have functions as pointers, eg. (proc *) f(). Routines that are
or invoke function pointers should be in tex.c.
*/
#if defined(MSDOS)
#include <sys\types.h>
#include <sys\stat.h>
#endif
#if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__) || defined(__osf__)
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include <math.h>
#if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__) || defined(__osf__)
#undef M_PI /* M_PI is used by markup, we don't need the math PI */
#endif
#include "userinc.h"
#include "globdec.h"
/* Obsolete */

View File

@@ -0,0 +1,2 @@
/* $XConsortium: need.c /main/3 1995/11/08 09:31:41 rswiston $ */
/* Obsolete */

View File

@@ -0,0 +1,350 @@
/* $XConsortium: option.c /main/3 1995/11/08 09:31:54 rswiston $ */
/* Copyright (c) 1986, 1987, 1988, 1989, 1992 Hewlett-Packard Co. */
/* Functions for command-line options for Help Tag/Cache Creek translator */
#include "userinc.h"
#include "globdec.h"
#if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__)
/* get definition of getenv(3c) for getting of environment variables */
#include <stdlib.h>
#endif
/* Interpret options from command line and specified files */
#define OPTLEN 512 /* If OPTLEN changes, change fscanf call below */
#define TAGDOTOPT "helptag.opt"
#define DOTOPT ".opt"
#if defined(M_PROTO)
void options(LOGICAL filelenonly)
#else
void options(filelenonly)
LOGICAL filelenonly;
#endif
{
int i;
FILE *optfile;
char option[OPTLEN + 1];
char *nameofoptfile;
/* Check helptag.opt in installation directory */
nameofoptfile = (char *) m_malloc(strlen(install) + strlen(TAGDOTOPT) + 1,
"installation helptag.opt");
strcpy(nameofoptfile, install);
strcat(nameofoptfile, TAGDOTOPT);
if (optfile = fopen(nameofoptfile, "r"))
{
while (fscanf(optfile, "%512s", option) != EOF)
setopt(option, filelenonly);
fclose(optfile);
}
m_free(nameofoptfile, "installation helptag.opt");
#if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__)
{
char *opts;
/* Check options in $DTTAGOPT */
opts = getenv("DTTAGOPT");
if (opts)
{
while (m_whitespace(*opts)) opts++;
while (sscanf(opts, "%512s", option) != EOF)
{
setopt(option, filelenonly);
opts += strlen(option);
while (m_whitespace(*opts)) opts++;
}
}
}
#endif /* hpux or _AIX or sun */
/* Check helptag.opt in input directory */
if (indir)
{
nameofoptfile = (char *) m_malloc(strlen(indir) + strlen(TAGDOTOPT) + 1,
"input helptag.opt");
strcpy(nameofoptfile, indir);
strcat(nameofoptfile, TAGDOTOPT);
}
else nameofoptfile = TAGDOTOPT;
if (optfile = fopen(nameofoptfile, "r"))
{
while (fscanf(optfile, "%512s", option) != EOF)
setopt(option, filelenonly);
fclose(optfile);
}
if (indir) m_free(nameofoptfile, "input helptag.opt");
/* Check basename.opt in input directory */
nameofoptfile = (char *) m_malloc((indir ? strlen(indir) : 0) +
strlen(nodirbase) + strlen(DOTOPT) + 1,
"basename.opt");
*nameofoptfile = M_EOS;
if (indir) strcpy(nameofoptfile, indir);
strcat(nameofoptfile, nodirbase);
strcat(nameofoptfile, DOTOPT);
if (optfile = fopen(nameofoptfile, "r"))
{
while (fscanf(optfile, "%512s", option) != EOF)
setopt(option, filelenonly);
fclose(optfile);
}
m_free(nameofoptfile, "basename.opt");
/* Read command line options */
for (i = 3 ; i < m_argc ; i++)
if (*m_argv[i] == '@')
{
if (optfile = fopen(m_argv[i] + 1, "r"))
{
while (fscanf(optfile, "%512s", option) != EOF)
setopt(option, filelenonly);
fclose(optfile);
}
else
{
m_mberr1("Unable to open option file %s", (m_argv[i] + 1));
}
}
else setopt(m_argv[i], filelenonly);
if (filelenonly) return ;
if (optval)
{
m_mberr1("%s: Expecting value for option on command line or in option file",
optkey[optval - 1]);
}
optval = M_NULLVAL;
}
/* Set a single option */
/* Workonly parameter described with function options()*/
#if defined(M_PROTO)
void setopt(char *string, LOGICAL filelenonly)
#else
void setopt(string, filelenonly)
char *string;
LOGICAL filelenonly;
#endif
{
char *p;
int thisopt;
LOGICAL ok;
if (optval)
{
/* Ignore '=' by itself */
if (*string == '=' && *(string + 1) == M_EOS) return;
setvalopt(optval, string, filelenonly);
optval = M_NULLVAL;
return;
}
if (p = strchr(string, '='))
{
*p = M_EOS;
for (thisopt = 0 ; thisopt < NUMOPTIONS ; thisopt++)
if (! m_mbmbupstrcmp(string, optkey[thisopt]))
break;
/* Note: call setvalopt only if thisopt < NUMOPTIONS */
ok = (LOGICAL)
((thisopt < NUMOPTIONS) && setvalopt(thisopt + 1, p + 1, filelenonly));
*p = '=';
if (! ok && ! filelenonly)
m_mberr1("%s: Unrecognized option on command line or in option file",
string);
return;
} /* End strchr(string, '=') */
for (thisopt = 0 ; thisopt < NUMOPTIONS ; thisopt++)
if (! m_mbmbupstrcmp(string, optkey[thisopt]))
break;
if (thisopt >= NUMOPTIONS)
{
if (! filelenonly)
m_mberr1("%s: Unrecognized option on command line or in option file",
string);
return;
}
else switch(thisopt + 1)
{
case ONERROR:
case CHARSET:
case SEARCHKEY:
optval = thisopt + 1;
break;
case DRAFT:
final = FALSE;
break;
case FINAL:
final = TRUE;
break;
#if defined(FUTURE_FEATURE)
case GRAPHICS:
dofigure = SMOOTH;
break;
case NOGRAPHICS:
dofigure = FALSE;
break;
case REV:
prntrevs = TRUE;
break;
case NOREV:
prntrevs = FALSE;
break;
case TOC:
toc = TRUE;
if (tocfile!=NULL)
{
m_free(tocfile, "TOC option");
tocfile = NULL;
}
break;
case NOTOC:
toc = FALSE;
if (tocfile!=NULL)
{
m_free(tocfile, "NOTOC option");
tocfile = NULL;
}
break;
case INDEX:
break;
case NOINDEX:
break;
#endif /* FUTURE_FEATURE */
case MEMO:
memo = TRUE;
break;
case NOMEMO:
memo = FALSE;
break;
case CLEARSEARCH:
{
SEARCH *searchp, *searchq;
for (searchp = path ; searchp ;)
{
searchq = searchp;
searchp = searchp->next;
m_free(searchq->directory, "search directory");
m_free(searchq, "search path");
}
path = NULL;
endpath = &path;
break;
}
case LONGFILES:
case LONGFILE:
case LONG:
usingshortnames = FALSE;
break;
case SHORTFILES:
case SHORTFILE:
case SHORT:
usingshortnames = TRUE;
break;
}
}
/* Process a value for a command line option */
#if defined(M_PROTO)
LOGICAL setvalopt(int thisopt, char *string, LOGICAL filelenonly)
#else
LOGICAL setvalopt(thisopt, string, filelenonly)
int thisopt;
char *string;
LOGICAL filelenonly;
#endif
{
char *p;
int i;
char *tempstr;
/* Ignore leading = (occurs if "option =val" is entered in .opt file) */
if (*string == '=') string++;
/* Check for empty string (occurs if "option= val" is entered in .opt file) */
if (! *string)
switch(thisopt)
{
case SEARCHKEY:
case CHARSET:
case ONERROR:
optval = thisopt;
return TRUE;
default:
return FALSE;
}
switch (thisopt)
{
case SEARCHKEY:
if ( (parentsrch==TRUE) && (*string!=M_EOS) && (*string!=dirsep)
#if defined(MSDOS)
&& ( *(string+1) != ':' )
#endif
)
{
/* prepend "..", for index processing in temporary sub-directory */
tempstr = (char *) m_malloc( strlen(string) + 4, "tempstr search");
strcpy(tempstr, "..");
strcat(tempstr, SSEP);
strcat(tempstr, string);
}
else
{
tempstr = (char *) m_malloc( strlen(string) + 1, "tempstr search");
strcpy(tempstr, string);
}
*endpath = (SEARCH *) m_malloc(sizeof(SEARCH), "search path");
p = strchr(tempstr, M_EOS);
if (p != tempstr && *(p - 1) != dirsep
#if defined(MSDOS)
&& *(p - 1) != ':'
#endif
)
{
i = strlen(tempstr);
(*endpath)->directory = (char *) m_malloc(i + 2,
"search directory");
strcpy((*endpath)->directory, tempstr);
(*endpath)->directory[i] = dirsep;
(*endpath)->directory[i + 1] = M_EOS;
}
else
{
(*endpath)->directory = (char *) m_malloc(strlen(tempstr) + 1,
"search directory");
strcpy((*endpath)->directory, tempstr);
}
(*endpath)->next = NULL;
endpath = &(*endpath)->next;
m_free(tempstr, "tempstr search");
return(TRUE);
case CHARSET:
m_free(helpcharset, "help charset");
helpcharset = MakeWideCharString(string);
return TRUE;
case ONERROR:
if (! m_mbmbupstrcmp(string, "GO"))
stoponerror = FALSE;
else if (! m_mbmbupstrcmp(string, "STOP"))
stoponerror = TRUE;
else m_mberr1("Invalid ONERROR option: %s", string);
return(TRUE);
default:
return(FALSE);
}
}

View File

@@ -0,0 +1,704 @@
/* $XConsortium: out.c /main/4 1995/12/04 11:41:40 rswiston $ */
/* Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co. */
/* Functions for HPTag/TeX translator relevant to output of heads and
data characters */
#include "userinc.h"
#include "globdec.h"
/* Echo part of a head to the screen to indicate how much of the document
has been processed */
void echohead(p)
M_WCHAR *p;
{
char *mb_p,*mb_string;
mb_string = MakeMByteString(p);
#ifdef _AIX
/* This is a bug fix for AIX. Using putc() for EUC Gaiji characters on aixterm
* has a problem.
*/
fprintf(stderr, "%s", mb_string);
#else /* _AIX */
for (mb_p = mb_string ; *mb_p ; mb_p++)
{
putc(*mb_p, stderr);
}
#endif /* _AIX */
m_free(mb_string,"multi-byte string");
}
/* call echohead with a literal string */
void mb_echohead(p)
char *p;
{
M_WCHAR *wc;
wc = MakeWideCharString(p);
echohead(wc);
m_free(wc,"wide character string");
}
/* Called at end of a head in a chapter, appendix, section, or
reference section */
void endhead(M_NOPAR)
{
if (savid)
{
if (w_strlen(xrefstring) + 1 > (sizeof(xrefstring) / sizeof(M_WCHAR)))
{
m_error("ID expansion too long");
m_exit(TRUE);
}
mb_shchar(M_EOS,
&xstrlen,
(sizeof(xrefstring) / sizeof(M_WCHAR)),
xrefstring,
idstring,
"Too many characters in corresponding cross-reference",
&iderr);
setid(savid,
TRUE,
TRUE,
inchapter,
chapstring,
xrffile,
xrfline,
TRUE);
}
savehead[svheadlen] = M_EOS;
echo = savhd = FALSE;
}
/* Called at the end of SDL <head> elements for <virpage> elements.
* Saves the location in the output file of the end of the
* <virpage><head>. If any <snb> elements have been generated, the
* location is placed in the snb file and the <snb> elements are
* emitted there too.
*/
void chksnb()
{
fputs("</HEAD>\n", outfile);
snbstart = ftell(outfile);
if (savesnb)
{
if (strlen(savesnb) != 0)
{
fprintf(snbfp, "%d\n%s", snbstart, savesnb);
snbstart = 0;
}
mb_free(&savesnb);
}
}
/* Process a character in an environment where spaces must be escaped */
#if defined(M_PROTO)
void esoutchar(M_WCHAR textchar)
#else
void esoutchar(textchar)
M_WCHAR textchar;
#endif
{
static M_WCHAR wsp = 0;
if (!wsp)
{
char space[2];
space[0] = M_SPACE;
space[1] = 0;
mbtowc(&wsp, space, 1);
}
if (textchar == wsp)
{
mb_strcode("&", outfile);
}
outchar(textchar, outfile);
}
/* Process a character in a verbatim example */
#if defined(M_PROTO)
void vexoutchar(M_WCHAR textchar)
#else
void vexoutchar(textchar)
M_WCHAR textchar;
#endif
{
static M_WCHAR wla = 0;
char *holdSaveExSeg;
if (!wla)
{
mbtowc(&wla, "<", 1);
}
if (textchar == wla)
{
holdSaveExSeg = saveexseg;
saveexseg = NULL;
mb_strcode("&<", outfile);
saveexseg = holdSaveExSeg;
}
else
{
multi_cr_flag = FALSE;
outchar(textchar, outfile);
}
}
/* Process a character in an example */
#if defined(M_PROTO)
void exoutchar(M_WCHAR textchar)
#else
void exoutchar(textchar)
M_WCHAR textchar;
#endif
{
char exbuff[32]; /* arbitrarily large */
int bufflen;
LOGICAL holdSavex;
unsigned char index;
bufflen = wctomb(exbuff, textchar);
exbuff[bufflen] = '\0';
if (bufflen == 1)
{
index = (unsigned char) exbuff[0];
if (index == M_RE)
exLineNum++;
if (special[index])
{
strcpy(exbuff, special[index]);
bufflen = strlen(exbuff);
}
}
saveexseg = mb_realloc(saveexseg, svexseglen + bufflen);
strcpy(saveexseg + svexseglen - 1, exbuff);
svexseglen += bufflen;
holdSavex = savex;
savex = FALSE;
outchar(textchar, outfile);
savex = holdSavex;
}
/* Process a character in an image paragraph */
#if defined(M_PROTO)
void imoutchar(M_WCHAR textchar)
#else
void imoutchar(textchar)
M_WCHAR textchar;
#endif
{
char imbuff[32]; /* arbitrarily large */
int bufflen;
bufflen = wctomb(imbuff, textchar);
imbuff[bufflen] = '\0';
if (bufflen == 1)
{
unsigned char index;
index = (unsigned char) imbuff[0];
if (special[index])
{
strcpy(imbuff, special[index]);
bufflen = strlen(imbuff);
}
mb_strcode(imbuff, outfile);
}
else
outchar(textchar, outfile);
}
/* Write a character to be passed to the index file */
#if defined(M_PROTO)
void indexchar(M_WCHAR textchar)
#else
void indexchar(textchar)
M_WCHAR textchar;
#endif
{
if (idxsavlen + 4 > (sizeof(idxsav) / sizeof(M_WCHAR)))
{
m_error("Internal error. Exceeded save buffer for index");
m_exit(TRUE);
}
idxsav[idxsavlen++] = textchar;
}
/* Processes a data character */
#if defined(M_PROTO)
void outchar(M_WCHAR textchar, FILE *outfile)
#else
void outchar(textchar, outfile)
M_WCHAR textchar;
FILE *outfile;
#endif
{
M_WCHAR buffer[2];
static M_WCHAR wnl = 0;
char mb_textchar[32]; /* arbitrarily large */
unsigned char index;
int length;
if (!wnl)
mbtowc(&wnl, "\n", 1);
if (textchar == wnl)
{
if (multi_cr_flag)
{
return;
}
multi_cr_flag = TRUE;
}
else
{
multi_cr_flag = FALSE;
}
if (echo)
{
buffer[0] = textchar;
buffer[1] = M_EOS;
echohead(buffer);
}
cur_char = textchar;
length = wctomb(mb_textchar, textchar);
index = (unsigned char) mb_textchar[0];
if ((length == 1) && special[index])
mb_strcode(special[index], outfile);
else
realoutchar(textchar, outfile);
} /* end procedure outchar() */
/* Called for processing instruction */
void outpi(enttype, pi, entname)
int enttype;
M_WCHAR *pi;
M_WCHAR *entname;
{
strcode(pi, outfile);
if (echo)
{
if (entname)
{
mb_echohead(m_ero);
echohead(entname);
mb_echohead(m_refc);
}
else
{
mb_echohead(m_pio);
echohead(pi);
mb_echohead(m_pic);
}
}
}
/* Really output a character */
#if defined(M_PROTO)
void realoutchar(M_WCHAR textchar, FILE *outfile)
#else
void realoutchar(textchar, outfile)
M_WCHAR textchar;
FILE *outfile;
#endif
{
char mb_textchar[32]; /* arbitrarily large */
int length, i;
length = wctomb(mb_textchar, textchar);
if (tooutput)
for (i = 0; i < length; i++)
putc(mb_textchar[i], outfile);
if (savid)
shchar(textchar,
&xstrlen,
(sizeof(xrefstring) / sizeof(M_WCHAR)),
xrefstring,
idstring,
"Too many characters in corresponding cross-reference",
&iderr);
if (savhd)
shchar(textchar,
&svheadlen,
(sizeof(savehead) / sizeof(M_WCHAR)),
savehead,
svhdstring,
"Too many characters in head or caption",
&hderr);
if (savtc)
shchar(textchar,
&svtclen,
(sizeof(savetabcap) / sizeof(M_WCHAR)),
savetabcap,
svtcstring,
"Too many characters in table caption",
&hderr);
}
/* Save a character in the array used to store table of contents entries
when processing a head */
#if defined(M_PROTO)
void shchar(M_WCHAR textchar, int *len, int max, M_WCHAR *string, void (*proc)(M_WCHAR *string), char *msg, LOGICAL *errflg)
#else
void shchar(textchar, len, max, string, proc, msg, errflg)
M_WCHAR textchar;
int *len;
int max;
M_WCHAR *string;
void (*proc)(
#if defined(M_PROTO)
M_WCHAR *string
#endif
);
char *msg;
LOGICAL *errflg;
#endif
{
char mb_textchar[32]; /* arbitrarily large */
unsigned char index;
int length;
length = wctomb(mb_textchar, textchar);
index = (unsigned char) mb_textchar[0];
if ((length == 1) && special[index])
{
M_WCHAR *wc_special;
wc_special = MakeWideCharString(special[index]);
(*proc)(wc_special);
m_free(wc_special,"wide character string");
}
else
{
if (*len + 1 + 1 > max)
{
if (! *errflg)
{
m_error(msg);
*errflg = TRUE;
}
}
else
string[(*len)++] = textchar;
}
}
#if defined(M_PROTO)
void mb_shchar(char textchar,
int *len,
int max,
M_WCHAR *string,
void (*proc)(M_WCHAR *string),
char *msg, LOGICAL *errflg)
#else
void mb_shchar(textchar, len, max, string, proc, msg, errflg)
char textchar;
int *len;
int max;
M_WCHAR *string;
void (*proc)(
#if defined(M_PROTO)
M_WCHAR *string
#endif
);
char *msg;
LOGICAL *errflg;
#endif
{
M_WCHAR wc_textchar;
mbtowc(&wc_textchar, &textchar, 1);
shchar(wc_textchar, len, max, string, proc, msg, errflg);
}
/* Save a string in the array used to store table of contents entries
when processing a head */
void shstring(addstring, len, max, storestring, msg, errflg)
M_WCHAR *addstring;
int *len;
int max;
M_WCHAR *storestring;
char *msg;
LOGICAL *errflg;
{
int addlength;
addlength = w_strlen(addstring);
if (*len + addlength + 1 > max)
{
if (! *errflg)
{
m_error(msg);
*errflg = TRUE;
}
}
else
{
w_strcpy(&storestring[*len], addstring);
*len += addlength;
}
}
void mb_shstring(addstring, len, max, storestring, msg, errflg)
char *addstring;
int *len;
int max;
M_WCHAR *storestring;
char *msg;
LOGICAL *errflg;
{
M_WCHAR *wc_addstring;
wc_addstring = MakeWideCharString(addstring);
shstring(wc_addstring, len, max, storestring, msg, errflg);
m_free(wc_addstring,"wide character string");
}
/* Writes a string to the output file, and if appropriate saves it */
void strcode(string, outfile)
M_WCHAR *string;
FILE *outfile;
{
char exbuff[32]; /* arbitrarily large */
int bufflen;
M_WCHAR wc;
if (tooutput)
{
char *mb_string;
mb_string = MakeMByteString(string);
fputs(mb_string, outfile);
m_free(mb_string,"multi-byte string");
}
if (savid)
shstring(string,
&xstrlen,
(sizeof(xrefstring) / sizeof(M_WCHAR)),
xrefstring,
"Too many characters in corresponding cross-reference",
&iderr);
if (savhd)
shstring(string,
&svheadlen,
(sizeof(savehead) / sizeof(M_WCHAR)),
savehead,
"Too many characters in head or caption",
&hderr);
if (savtc)
shstring(string,
&svtclen,
(sizeof(savetabcap) / sizeof(M_WCHAR)),
savetabcap,
"Too many characters in table caption",
&hderr);
if (savex)
{
while (wc = *string++)
{
bufflen = wctomb(exbuff, wc);
if ((exbuff[0] == M_RE) && (bufflen == 1))
exLineNum++;
saveexseg = mb_realloc(saveexseg, svexseglen + bufflen);
strncpy(saveexseg + svexseglen - 1, exbuff, bufflen);
svexseglen += bufflen;
}
saveexseg[svexseglen-1] = '\0';
}
}
void mb_strcode(string, outfile)
char *string;
FILE *outfile;
{
M_WCHAR *wc;
wc = MakeWideCharString(string);
strcode(wc, outfile);
m_free(wc,"wide character string");
}
/* Copies string to end of buffer where saving head for table of contents */
void svhdstring(string)
M_WCHAR *string;
{
int length;
length = w_strlen(string);
if (svheadlen + length + 1 > (sizeof(savehead) / sizeof(M_WCHAR)))
{
if (! hderr)
{
m_error("Too many characters in head or caption");
hderr = TRUE;
}
return;
}
w_strcpy(&savehead[svheadlen], string);
svheadlen += length;
}
/* Copies string to end of buffer where saving table caption */
void svtcstring(string)
M_WCHAR *string;
{
int length;
length = w_strlen(string);
if (svtclen + length + 1 > (sizeof(savetabcap) / sizeof(M_WCHAR)))
{
if (! hderr)
{
m_error("Too many characters in table caption");
hderr = TRUE;
}
return;
}
w_strcpy(&savetabcap[svtclen], string);
svtclen += length;
}
/* Process a character in a term */
#if defined(M_PROTO)
void termchar(M_WCHAR textchar)
#else
void termchar(textchar)
M_WCHAR textchar;
#endif
{
int length;
char mb_textchar[32]; /* arbitrarily large */
char *pc;
length = wctomb(mb_textchar, textchar);
if ((length == 1) && (pc = special[(unsigned char) *mb_textchar]))
{
length = strlen(pc);
if (termp - term + length > MAXTERM)
{
if (termp - term <= MAXTERM)
{
M_WCHAR *wc_stago, *wc_tagc;
wc_stago = MakeWideCharString(m_stago);
wc_tagc = MakeWideCharString(m_tagc);
m_err4("Too many characters in %sTERM%s or %sDTERM%s",
wc_stago,
wc_tagc,
wc_stago,
wc_tagc);
m_free(wc_stago,"wide character string");
m_free(wc_tagc,"wide character string");
}
}
else
{
mbstowcs(termp, pc, length);
}
termp += length;
}
else
{
if (termp - term >= MAXTERM)
{
if (termp - term == MAXTERM)
{
M_WCHAR *wc_stago, *wc_tagc;
wc_stago = MakeWideCharString(m_stago);
wc_tagc = MakeWideCharString(m_tagc);
m_err4("Too many characters in %sTERM%s or %sDTERM%s",
wc_stago,
wc_tagc,
wc_stago,
wc_tagc);
m_free(wc_stago,"wide character string");
m_free(wc_tagc,"wide character string");
termp++; /* avoid getting this message again */
}
}
else
{
*termp++ = textchar;
}
}
}
/* Process a PI in a term */
void termpi(m_enttype, m_pi, m_entname)
int m_enttype;
M_WCHAR *m_pi;
M_WCHAR *m_entname;
{
int length;
length = w_strlen(m_pi);
if (termp - term + length > MAXTERM)
{
if ((termp - term) <= MAXTERM)
{
M_WCHAR *wc_stago, *wc_tagc;
wc_stago = MakeWideCharString(m_stago);
wc_tagc = MakeWideCharString(m_tagc);
m_err4("Too many characters in %sTERM%s or %sDTERM%s",
wc_stago,
wc_tagc,
wc_stago,
wc_tagc);
m_free(wc_stago,"wide character string");
m_free(wc_tagc,"wide character string");
}
}
else
{
w_strncpy(termp, m_pi, length);
}
termp += length;
if (echo)
{
if (m_entname)
{
mb_echohead(m_ero);
echohead(m_entname);
mb_echohead(m_refc);
}
else
{
mb_echohead(m_pio);
echohead(m_pi);
mb_echohead(m_pic);
}
}
}

View File

@@ -0,0 +1,266 @@
/* $XConsortium: roman8.h /main/3 1995/11/08 09:32:18 rswiston $ */
EXTERN char *special[256]
#if defined(DEFINE)
= {
/* Char Name Roman8 Expansion (none needed) */
/* */
/* 0: ^@ NUL */ 0,
/* 1: ^A SOH */ 0,
/* 2: ^B STX */ 0,
/* 3: ^C ETX */ 0,
/* 4: ^D EOT */ 0,
/* 5: ^E ENQ */ 0,
/* 6: ^F ACK */ 0,
/* 7: ^G BEL */ 0,
/* 8: ^H BS */ 0,
/* 9: ^I HT */ 0,
/* 10: ^J LF */ 0,
/* 11: ^K VT */ 0,
/* 12: ^L FF */ 0,
/* 13: ^M CR */ 0,
/* 14: ^N SO */ 0,
/* 15: ^O SI */ 0,
/* 16: ^P DLE */ 0,
/* 17: ^Q DC1 */ 0,
/* 18: ^R DC2 */ 0,
/* 19: ^S DC3 */ 0,
/* 20: ^T DC4 */ 0,
/* 21: ^U NAK */ 0,
/* 22: ^V SYN */ 0,
/* 23: ^W ETB */ 0,
/* 24: ^X CAN */ 0,
/* 25: ^Y EM */ 0,
/* 26: ^Z SUB */ 0,
/* 27: ^[ ESC */ 0,
/* 28: ^\ FS */ 0,
/* 29: ^] GS */ 0,
/* 30: ^^ RS */ 0,
/* 31: ^_ US */ 0,
/* 32: SP */ 0,
/* 33: ! */ 0,
/* 34: " */ 0,
/* 35: # */ 0,
/* 36: $ */ 0,
/* 37: % */ 0,
/* 38: & */ "&&",
/* 39: ' */ 0,
/* 40: ( */ 0,
/* 41: ) */ 0,
/* 42: * */ 0,
/* 43: + */ 0,
/* 44: , */ 0,
/* 45: - */ 0,
/* 46: . */ 0,
/* 47: / */ 0,
/* 48: 0 */ 0,
/* 49: 1 */ 0,
/* 50: 2 */ 0,
/* 51: 3 */ 0,
/* 52: 4 */ 0,
/* 53: 5 */ 0,
/* 54: 6 */ 0,
/* 55: 7 */ 0,
/* 56: 8 */ 0,
/* 57: 9 */ 0,
/* 58: : */ 0,
/* 59: ; */ 0,
/* 60: < */ "&<",
/* 61: = */ 0,
/* 62: > */ 0,
/* 63: ? */ 0,
/* 64: @ */ 0,
/* 65: A */ 0,
/* 66: B */ 0,
/* 67: C */ 0,
/* 68: D */ 0,
/* 69: E */ 0,
/* 70: F */ 0,
/* 71: G */ 0,
/* 72: H */ 0,
/* 73: I */ 0,
/* 74: J */ 0,
/* 75: K */ 0,
/* 76: L */ 0,
/* 77: M */ 0,
/* 78: N */ 0,
/* 79: O */ 0,
/* 80: P */ 0,
/* 81: Q */ 0,
/* 82: R */ 0,
/* 83: S */ 0,
/* 84: T */ 0,
/* 85: U */ 0,
/* 86: V */ 0,
/* 87: W */ 0,
/* 88: X */ 0,
/* 89: Y */ 0,
/* 90: Z */ 0,
/* 91: [ */ 0,
/* 92: \\ */ "\\",
/* 93: ] */ 0,
/* 94: ^ */ 0,
/* 95: _ */ 0,
/* 96: ` */ 0,
/* 97: a */ 0,
/* 98: b */ 0,
/* 99: c */ 0,
/* 100: d */ 0,
/* 101: e */ 0,
/* 102: f */ 0,
/* 103: g */ 0,
/* 104: h */ 0,
/* 105: i */ 0,
/* 106: j */ 0,
/* 107: k */ 0,
/* 108: l */ 0,
/* 109: m */ 0,
/* 110: n */ 0,
/* 111: o */ 0,
/* 112: p */ 0,
/* 113: q */ 0,
/* 114: r */ 0,
/* 115: s */ 0,
/* 116: t */ 0,
/* 117: u */ 0,
/* 118: v */ 0,
/* 119: w */ 0,
/* 120: x */ 0,
/* 121: y */ 0,
/* 122: z */ 0,
/* 123: { */ 0,
/* 124: | */ 0,
/* 125: } */ 0,
/* 126: ~ */ 0,
/* 127: DEL */ 0,
/* 128: undefined */ 0,
/* 129: undefined */ 0,
/* 130: undefined */ 0,
/* 131: undefined */ 0,
/* 132: undefined */ 0,
/* 133: undefined */ 0,
/* 134: undefined */ 0,
/* 135: undefined */ 0,
/* 136: undefined */ 0,
/* 137: undefined */ 0,
/* 138: undefined */ 0,
/* 139: undefined */ 0,
/* 140: undefined */ 0,
/* 141: undefined */ 0,
/* 142: undefined */ 0,
/* 143: undefined */ 0,
/* 144: undefined */ 0,
/* 145: undefined */ 0,
/* 146: undefined */ 0,
/* 147: undefined */ 0,
/* 148: undefined */ 0,
/* 149: undefined */ 0,
/* 150: undefined */ 0,
/* 151: undefined */ 0,
/* 152: undefined */ 0,
/* 153: undefined */ 0,
/* 154: undefined */ 0,
/* 155: undefined */ 0,
/* 156: undefined */ 0,
/* 157: undefined */ 0,
/* 158: undefined */ 0,
/* 159: undefined */ 0,
/* 160: undefined */ 0,
/* 161: A grave */ 0,
/* 162: A circumflex */ 0,
/* 163: E grave */ 0,
/* 164: E circumflex */ 0,
/* 165: E dieresis */ 0,
/* 166: I circumflex */ 0,
/* 167: I dieresis */ 0,
/* 168: acute accent */ 0,
/* 169: grave accent */ 0,
/* 170: circumflex */ 0,
/* 171: dieresis */ 0,
/* 172: tilde */ 0,
/* 173: U grave */ 0,
/* 174: U circumflex */ 0,
/* 175: Italian Lira */ 0,
/* 176: overbar */ 0,
/* 177: Y acute */ 0,
/* 178: y acute */ 0,
/* 179: degree */ 0,
/* 180: C cedilla */ 0,
/* 181: c cedilla */ 0,
/* 182: N tilde */ 0,
/* 183: n tilde */ 0,
/* 184: inverted exclamation mark */ 0,
/* 185: inverted question mark */ 0,
/* 186: currency sign */ 0,
/* 187: pound sterling */ 0,
/* 188: Yen */ 0,
/* 189: Section sign */ 0,
/* 190: florin */ 0,
/* 191: Cent sign */ 0,
/* 192: a circumflex */ 0,
/* 193: e circumflex */ 0,
/* 194: o circumflex */ 0,
/* 195: u circumflex */ 0,
/* 196: a acute */ 0,
/* 197: e acute */ 0,
/* 198: o acute */ 0,
/* 199: u acute */ 0,
/* 200: a grave */ 0,
/* 201: e grave */ 0,
/* 202: o grave */ 0,
/* 203: u grave */ 0,
/* 204: a dieresis */ 0,
/* 205: e dieresis */ 0,
/* 206: o dieresis */ 0,
/* 207: u dieresis */ 0,
/* 208: A angstrom */ 0,
/* 209: i circumflex */ 0,
/* 210: O slash */ 0,
/* 211: AE ligature */ 0,
/* 212: a angstrom */ 0,
/* 213: i acute */ 0,
/* 214: o slash */ 0,
/* 215: ae ligature */ 0,
/* 216: A dieresis */ 0,
/* 217: i grave */ 0,
/* 218: O dieresis */ 0,
/* 219: U dieresis */ 0,
/* 220: E acute */ 0,
/* 221: i dieresis */ 0,
/* 222: SS ligature */ 0,
/* 223: O circumflex */ 0,
/* 224: A acute */ 0,
/* 225: A tilde */ 0,
/* 226: a tilde */ 0,
/* 227: Eth */ 0,
/* 228: eth */ 0,
/* 229: I acute */ 0,
/* 230: I grave */ 0,
/* 231: O acute */ 0,
/* 232: O grave */ 0,
/* 233: O tilde */ 0,
/* 234: o tilde */ 0,
/* 235: S caron */ 0,
/* 236: s caron */ 0,
/* 237: U acute */ 0,
/* 238: Y dieresis */ 0,
/* 239: y dieresis */ 0,
/* 240: Thorn */ 0,
/* 241: thorn */ 0,
/* 242: undefined */ 0,
/* 243: mu */ 0,
/* 244: paragraph sign */ 0,
/* 245: fraction 3/4 */ 0,
/* 246: long dash */ 0,
/* 247: fraction 1/4 */ 0,
/* 248: fraction 1/2 */ 0,
/* 249: Female ordinal */ 0,
/* 250: Male ordinal */ 0,
/* 251: French double open quote */ 0,
/* 252: Solid square */ 0,
/* 253: French double close quote */ 0,
/* 254: Plus over minus sign */ 0,
/* 255: undefined */ 0
}
#endif
;

View File

@@ -0,0 +1,205 @@
/* $XConsortium: special.c /main/3 1995/11/08 09:32:32 rswiston $ */
/****************************************************************************/
/* */
/* This program generates either one or both of two include files needed */
/* for other programs. */
/* */
/* For the portion of HP Tag/Vectra that transforms characters into */
/* their TeX equivalents, this program produces a file with entries that */
/* consist of a comment field and either a 0 or a string entry. Within */
/* the comment field is the character's eight-bit character code plus */
/* the name of the character, as: */
/* */
/* 0: ^@ NUL */
/* 60: < */
/* 65: A */
/* 159: undefined */
/* 161: A grave */
/* */
/* and so on. The string entry is of the form: */
/* */
/* "\`A", */
/* "\^A", */
/* "{\bslash}", */
/* */
/* and so on. */
/* */
/* For the collating program used with indexing, this program produces a */
/* file with entries that consist of a comment field, a number */
/* representing the collating position of the character, a "handling" */
/* field, and the character code of the lowercase representation of */
/* those characters that also have uppercase representations. The */
/* "handling" field is one of NORMAL, SPECIAL, or UNSUPP. Here are */
/* examples showing the fields: */
/* */
/* * 63: ? * 54, SPECIAL, 63, */
/* * 64: @ * 55, SPECIAL, 64, */
/* * 65: A * 92, NORMAL, 97, */
/* * 161: A grave * 94, NORMAL, 200, */
/* * 162: A circumflex * 93, NORMAL, 192, */
/* * 200: a grave * 86, NORMAL, 200, */
/* */
/* The question mark has ROMAN8 character code 63. Its collating */
/* position as defined for the indexing program is 54. (That is, it */
/* collates just before the at-sign.) It is given SPECIAL handling by */
/* the collating program. Since it has no lowercase representation, the */
/* number in this position is the same as its ROMAN8 character code. */
/* The uppercase A has ROMAN8 character code 65. Its collating position */
/* as defined for the indexing program is 92. (That is, it collates */
/* just before A circumflex.) It is given NORMAL handling by the */
/* collating program. Its lowercase representation is 200, the same as */
/* lowercase a grave. */
/* */
/* The collating order for this program is specified in SPECIAL.H. The */
/* collating order to be used by the indexing program can be changed by */
/* modifying SPECIAL.H and recompiling and rerunning this program. For */
/* example, at the moment, two of the lines in SPECIAL.H are: */
/* */
/* 162, "A circumflex", NORMAL, "\\^A", 192, */
/* 161, "A grave", NORMAL, "\\`A", 200, */
/* */
/* Thus, A circumflex is specified to collate before A grave. If this */
/* changes, and it is determined that A grave should collate first, it */
/* would be necessary only to switch the lines, so they look like this: */
/* */
/* 161, "A grave", NORMAL, "\\`A", 200, */
/* 162, "A circumflex", NORMAL, "\\^A", 192, */
/* */
/* In SPECIAL.H, only those characters that have ROMAN8 representations */
/* are listed. The program generates the undefined positions in both */
/* outputs. */
/* */
/* To output only the include file for generating TeX characters, run */
/* this program with the "s" switch: */
/* */
/* SPECIAL S > output_file_name */
/* */
/* To output only the include file for generating the collating */
/* sequence, run this program with the "c" switch: */
/* */
/* SPECIAL C > output_file_name */
/* */
/* To output both, run this program with the "b" switch, or with no */
/* specification: */
/* */
/* SPECIAL B > output_file_name */
/* SPECIAL > output_file_name */
/* */
/* In all cases, if you specify no redirected file name, the output goes */
/* to the Vectra's screen. */
/* */
/****************************************************************************/
#define NORMAL 1
#define SPECIAL 2
#define UNSUPP 3
#define TRUE 1
#define FALSE 0
#include <stdio.h>
#include <stdlib.h>
typedef wchar_t M_WCHAR;
struct {
int charcode;
char *name ;
int handling;
char *texexpand ;
int lower;
} specials[] = {
#include "special.h"
} ;
#define NOSPECIALS sizeof(specials)/sizeof(specials[0])
#define NO8BITCHARS 256
int invert[NO8BITCHARS], emptycell;
main(argc, argv)
int argc;
char *argv[];
{
int i, both = FALSE, spec = FALSE, coll = FALSE, error = FALSE ;
if (argc < 3)
{ /* Either one argument or none; not more */
if (argc == 2)
{
if (!stricmp(argv[1], "b")) both = TRUE;
else if (!stricmp(argv[1], "s")) spec = TRUE;
else if (!stricmp(argv[1], "c")) coll = TRUE;
else error = TRUE;
}
else both = TRUE;
}
else error = TRUE;
if (error)
{
fprintf(stderr,"Usage: SPECIAL [b | s | c]\n");
exit (0);
}
for (i = 0 ; i < NOSPECIALS ; i++)
invert[specials[i].charcode] = i + 1;
if (both || spec)
{
printf("/* Char Name TeX Expansion */\n");
printf("/* */\n");
for (i = 0 ; i < NO8BITCHARS ; i++)
{
if (invert[i])
{
printf("/* %3d: %-31s */ ", i, specials[invert[i] - 1].name) ;
if (specials[invert[i] - 1].texexpand)
printf("\"%s\"", specials[invert[i] - 1].texexpand) ;
else putchar('0') ;
}
else printf("/* %3d: undefined */ 0", i) ;
if (i < NO8BITCHARS - 1) putchar(',') ;
putchar('\n') ;
}
}
if (both || coll)
{
printf(
"/* */\n");
printf(
"/* Char Name Coll Status Lower */\n");
printf(
"/* */\n");
for (i = 0, emptycell = NOSPECIALS + 1; i < NO8BITCHARS ; i++)
{
if (invert[i])
{
printf("/* %3d: %-31s */ %3d, ",
specials[invert[i] - 1].charcode,
specials[invert[i] - 1].name, invert[i]) ;
switch (specials[invert[i] - 1].handling)
{
case NORMAL:
printf("NORMAL,");
break;
case SPECIAL:
printf("SPECIAL,");
break;
case UNSUPP:
printf("UNSUPP,");
break;
}
if (specials[invert[i] - 1].lower)
printf(" %3d", specials[invert[i] - 1].lower);
else
printf(" %3d", specials[invert[i] - 1].charcode);
}
else
printf(
"/* %3d: undefined */ %3d, UNSUPP, %3d",
i,
emptycell++,
i) ;
if (i < NO8BITCHARS - 1) putchar(',') ;
putchar('\n') ;
}
}
return 0;
}

View File

@@ -0,0 +1,222 @@
/* $XConsortium: special.h /main/3 1995/11/08 09:32:44 rswiston $ */
0, "^@ NUL", SPECIAL, NULL, NULL,
1, "^A SOH", SPECIAL, NULL, NULL,
2, "^B STX", SPECIAL, NULL, NULL,
3, "^C ETX", SPECIAL, NULL, NULL,
4, "^D EOT", SPECIAL, NULL, NULL,
5, "^E ENQ", SPECIAL, NULL, NULL,
6, "^F ACK", SPECIAL, NULL, NULL,
7, "^G BEL", SPECIAL, NULL, NULL,
8, "^H BS", SPECIAL, NULL, NULL,
9, "^I HT", SPECIAL, NULL, NULL,
10, "^J LF", SPECIAL, NULL, NULL,
11, "^K VT", SPECIAL, NULL, NULL,
12, "^L FF", SPECIAL, NULL, NULL,
13, "^M CR", SPECIAL, NULL, NULL,
14, "^N SO", SPECIAL, NULL, NULL,
15, "^O SI", SPECIAL, NULL, NULL,
16, "^P DLE", SPECIAL, NULL, NULL,
17, "^Q DC1", SPECIAL, NULL, NULL,
18, "^R DC2", SPECIAL, NULL, NULL,
19, "^S DC3", SPECIAL, NULL, NULL,
20, "^T DC4", SPECIAL, NULL, NULL,
21, "^U NAK", SPECIAL, NULL, NULL,
22, "^V SYN", SPECIAL, NULL, NULL,
23, "^W ETB", SPECIAL, NULL, NULL,
24, "^X CAN", SPECIAL, NULL, NULL,
25, "^Y EM", SPECIAL, NULL, NULL,
26, "^Z SUB", SPECIAL, NULL, NULL,
27, "^[ ESC", SPECIAL, NULL, NULL,
28, "^\\ FS", SPECIAL, NULL, NULL,
29, "^] GS", SPECIAL, NULL, NULL,
30, "^^ RS", SPECIAL, NULL, NULL,
31, "^_ US", SPECIAL, NULL, NULL,
32, "SP", SPECIAL, NULL, NULL,
33, "!", SPECIAL, NULL, NULL,
34, "\"", SPECIAL, NULL, NULL,
35, "#", SPECIAL, "\\\\#", NULL,
36, "$", SPECIAL, "\\\\dollar{}", NULL,
37, "%", SPECIAL, "\\\\%", NULL,
38, "&", SPECIAL, "\\\\&", NULL,
39, "'", SPECIAL, NULL, NULL,
40, "(", SPECIAL, NULL, NULL,
41, ")", SPECIAL, NULL, NULL,
42, "*", SPECIAL, NULL, NULL,
43, "+", SPECIAL, NULL, NULL,
44, ",", SPECIAL, NULL, NULL,
45, "-", SPECIAL, "{-}", NULL,
46, ".", SPECIAL, NULL, NULL,
47, "/", SPECIAL, NULL, NULL,
58, ":", SPECIAL, NULL, NULL,
59, ";", SPECIAL, NULL, NULL,
60, "<", SPECIAL, "{\\\\lthan}", NULL,
61, "=", SPECIAL, NULL, NULL,
62, ">", SPECIAL, "{\\\\gthan}", NULL,
63, "?", SPECIAL, NULL, NULL,
64, "@", SPECIAL, NULL, NULL,
91, "[", SPECIAL, NULL, NULL,
92, "\\\\", SPECIAL, "{\\\\bslash}", NULL,
93, "]", SPECIAL, NULL, NULL,
94, "^", SPECIAL, "\\\\string^", NULL,
95, "_", SPECIAL, "{\\\\under}", NULL,
96, "`", SPECIAL, NULL, NULL,
123, "{", SPECIAL, "{\\\\lbrac}", NULL,
124, "|", SPECIAL, "{\\\\vbar}", NULL,
125, "}", SPECIAL, "{\\\\rbrac}", NULL,
126, "~", SPECIAL, "\\\\string~", NULL,
184, "inverted exclamation mark", SPECIAL, "{!`}", NULL,
185, "inverted question mark", SPECIAL, "{?`}", NULL,
168, "acute accent", SPECIAL, "\\\\'{ }", NULL,
169, "grave accent", SPECIAL, "\\\\`{ }", NULL,
170, "circumflex", SPECIAL, "\\\\^{ }", NULL,
171, "dieresis", SPECIAL, "\\\\\\\"{ }", NULL,
172, "tilde", SPECIAL, "\\\\~{ }", NULL,
127, "DEL", SPECIAL, NULL, NULL,
48, "0", NORMAL, NULL, NULL,
49, "1", NORMAL, NULL, NULL,
50, "2", NORMAL, NULL, NULL,
51, "3", NORMAL, NULL, NULL,
52, "4", NORMAL, NULL, NULL,
53, "5", NORMAL, NULL, NULL,
54, "6", NORMAL, NULL, NULL,
55, "7", NORMAL, NULL, NULL,
56, "8", NORMAL, NULL, NULL,
57, "9", NORMAL, NULL, NULL,
97, "a", NORMAL, NULL, NULL,
192, "a circumflex", NORMAL, "\\\\^a", NULL,
200, "a grave", NORMAL, "\\\\`a", NULL,
196, "a acute", NORMAL, "\\\\'a", NULL,
204, "a dieresis", NORMAL, "\\\\\\\"a", NULL,
226, "a tilde", NORMAL, "\\\\~a", NULL,
212, "a angstrom", NORMAL, "{\\\\aa}", NULL,
215, "ae ligature", NORMAL, "{\\\\ae}", NULL,
65, "A", NORMAL, NULL, 97,
162, "A circumflex", NORMAL, "\\\\^A", 192,
161, "A grave", NORMAL, "\\\\`A", 200,
224, "A acute", NORMAL, "\\\\'A", 196,
216, "A dieresis", NORMAL, "\\\\\\\"A", 204,
225, "A tilde", NORMAL, "\\\\~A", 226,
208, "A angstrom", NORMAL, "{\\\\AA}", 212,
211, "AE ligature", NORMAL, "{\\\\AE}", 215,
98, "b", NORMAL, NULL, NULL,
66, "B", NORMAL, NULL, 98,
99, "c", NORMAL, NULL, NULL,
67, "C", NORMAL, NULL, 99,
181, "c cedilla", NORMAL, "\\\\c{c}", NULL,
180, "C cedilla", NORMAL, "\\\\c{C}", 181,
68, "D", NORMAL, NULL, 100,
100, "d", NORMAL, NULL, NULL,
101, "e", NORMAL, NULL, NULL,
193, "e circumflex", NORMAL, "\\\\^e", NULL,
201, "e grave", NORMAL, "\\\\`e", NULL,
197, "e acute", NORMAL, "\\\\'e", NULL,
205, "e dieresis", NORMAL, "\\\\\\\"e", NULL,
69, "E", NORMAL, NULL, 101,
164, "E circumflex", NORMAL, "\\\\^E", 193,
163, "E grave", NORMAL, "\\\\`E", 201,
220, "E acute", NORMAL, "\\\\'E", 197,
165, "E dieresis", NORMAL, "\\\\\\\"E", 205,
102, "f", NORMAL, NULL, NULL,
70, "F", NORMAL, NULL, 102,
103, "g", NORMAL, NULL, NULL,
71, "G", NORMAL, NULL, 103,
104, "h", NORMAL, NULL, NULL,
72, "H", NORMAL, NULL, 104,
105, "i", NORMAL, NULL, NULL,
209, "i circumflex", NORMAL, "{\\\\^\\\\i}", NULL,
217, "i grave", NORMAL, "{\\\\`\\\\i}", NULL,
213, "i acute", NORMAL, "{\\\\'\\\\i}", NULL,
221, "i dieresis", NORMAL, "{\\\\\\\"\\\\i}", NULL,
73, "I", NORMAL, NULL, 105,
166, "I circumflex", NORMAL, "\\\\^I", 209,
230, "I grave", NORMAL, "\\\\`I", 217,
229, "I acute", NORMAL, "\\\\'I", 213,
167, "I dieresis", NORMAL, "\\\\\\\"I", 221,
106, "j", NORMAL, NULL, NULL,
74, "J", NORMAL, NULL, 106,
107, "k", NORMAL, NULL, NULL,
75, "K", NORMAL, NULL, 107,
108, "l", NORMAL, NULL, NULL,
76, "L", NORMAL, NULL, 108,
109, "m", NORMAL, NULL, NULL,
77, "M", NORMAL, NULL, 109,
110, "n", NORMAL, NULL, NULL,
183, "n tilde", NORMAL, "\\\\~n", NULL,
78, "N", NORMAL, NULL, 110,
182, "N tilde", NORMAL, "\\\\~N", 183,
111, "o", NORMAL, NULL, NULL,
194, "o circumflex", NORMAL, "\\\\^o", NULL,
202, "o grave", NORMAL, "\\\\`o", NULL,
198, "o acute", NORMAL, "\\\\'o", NULL,
206, "o dieresis", NORMAL, "\\\\\\\"o", NULL,
234, "o tilde", NORMAL, "\\\\~o", NULL,
214, "o slash", NORMAL, "{\\\\o}", NULL,
79, "O", NORMAL, NULL, 111,
223, "O circumflex", NORMAL, "\\\\^O", 194,
232, "O grave", NORMAL, "\\\\`O", 202,
231, "O acute", NORMAL, "\\\\'O", 198,
218, "O dieresis", NORMAL, "\\\\\\\"O", 206,
233, "O tilde", NORMAL, "\\\\~O", 234,
210, "O slash", NORMAL, "{\\\\O}", 214,
112, "p", NORMAL, NULL, NULL,
80, "P", NORMAL, NULL, 112,
113, "q", NORMAL, NULL, NULL,
81, "Q", NORMAL, NULL, 113,
114, "r", NORMAL, NULL, NULL,
82, "R", NORMAL, NULL, 114,
115, "s", NORMAL, NULL, NULL,
236, "s caron", NORMAL, "\\\\v{s}", NULL,
222, "SS ligature", NORMAL, "{\\\\ss}", NULL,
83, "S", NORMAL, NULL, 115,
235, "S caron", NORMAL, "\\\\v{S}", 236,
116, "t", NORMAL, NULL, NULL,
84, "T", NORMAL, NULL, 116,
117, "u", NORMAL, NULL, NULL,
195, "u circumflex", NORMAL, "\\\\^u", NULL,
203, "u grave", NORMAL, "\\\\`u", NULL,
199, "u acute", NORMAL, "\\\\'u", NULL,
207, "u dieresis", NORMAL, "\\\\\\\"u", NULL,
85, "U", NORMAL, NULL, 117,
174, "U circumflex", NORMAL, "\\\\^U", 195,
173, "U grave", NORMAL, "\\\\`U", 203,
237, "U acute", NORMAL, "\\\\'U", 199,
219, "U dieresis", NORMAL, "\\\\\\\"U", 207,
118, "v", NORMAL, NULL, NULL,
86, "V", NORMAL, NULL, 118,
119, "w", NORMAL, NULL, NULL,
87, "W", NORMAL, NULL, 119,
120, "x", NORMAL, NULL, NULL,
88, "X", NORMAL, NULL, 120,
121, "y", NORMAL, NULL, NULL,
178, "y acute", NORMAL, "\\\\'y", NULL,
239, "y dieresis", NORMAL, "\\\\\\\"y", NULL,
89, "Y", NORMAL, NULL, 121,
177, "Y acute", NORMAL, "\\\\'Y", 178,
238, "Y dieresis", NORMAL, "\\\\\\\"Y", 239,
122, "z", NORMAL, NULL, NULL,
90, "Z", NORMAL, NULL, NULL,
176, "overbar", UNSUPP, NULL, NULL,
179, "degree", UNSUPP, NULL, NULL,
189, "Section sign", UNSUPP, NULL, NULL,
191, "Cent sign", UNSUPP, NULL, NULL,
243, "mu", UNSUPP, NULL, NULL,
244, "paragraph sign", UNSUPP, NULL, NULL,
246, "long dash", UNSUPP, NULL, NULL,
249, "Female ordinal", UNSUPP, NULL, NULL,
250, "Male ordinal", UNSUPP, NULL, NULL,
254, "Plus over minus sign", UNSUPP, NULL, NULL,
175, "Italian Lira", UNSUPP, NULL, NULL,
186, "currency sign", UNSUPP, NULL, NULL,
187, "pound sterling", UNSUPP, NULL, NULL,
188, "Yen", UNSUPP, NULL, NULL,
190, "florin", UNSUPP, NULL, NULL,
227, "Eth", UNSUPP, NULL, NULL,
228, "eth", UNSUPP, NULL, NULL,
240, "Thorn", UNSUPP, NULL, NULL,
241, "thorn", UNSUPP, NULL, NULL,
245, "fraction 3/4", UNSUPP, NULL, NULL,
247, "fraction 1/4", UNSUPP, NULL, NULL,
248, "fraction 1/2", UNSUPP, NULL, NULL,
251, "French double open quote", UNSUPP, NULL, NULL,
252, "Solid square", UNSUPP, NULL, NULL,
253, "French double close quote", UNSUPP, NULL, NULL

View File

@@ -0,0 +1,2 @@
/* $XConsortium: table.c /main/3 1995/11/08 09:32:57 rswiston $ */
/* Obsolete */

View File

@@ -0,0 +1,266 @@
/* $XConsortium: tex.h /main/3 1995/11/08 09:33:08 rswiston $ */
EXTERN char *special[256]
#if defined(DEFINE)
= {
/* Char Name TeX Expansion */
/* */
/* 0: ^@ NUL */ 0,
/* 1: ^A SOH */ 0,
/* 2: ^B STX */ 0,
/* 3: ^C ETX */ 0,
/* 4: ^D EOT */ 0,
/* 5: ^E ENQ */ 0,
/* 6: ^F ACK */ 0,
/* 7: ^G BEL */ 0,
/* 8: ^H BS */ 0,
/* 9: ^I HT */ 0,
/* 10: ^J LF */ 0,
/* 11: ^K VT */ 0,
/* 12: ^L FF */ 0,
/* 13: ^M CR */ 0,
/* 14: ^N SO */ 0,
/* 15: ^O SI */ 0,
/* 16: ^P DLE */ 0,
/* 17: ^Q DC1 */ 0,
/* 18: ^R DC2 */ 0,
/* 19: ^S DC3 */ 0,
/* 20: ^T DC4 */ 0,
/* 21: ^U NAK */ 0,
/* 22: ^V SYN */ 0,
/* 23: ^W ETB */ 0,
/* 24: ^X CAN */ 0,
/* 25: ^Y EM */ 0,
/* 26: ^Z SUB */ 0,
/* 27: ^[ ESC */ 0,
/* 28: ^\ FS */ 0,
/* 29: ^] GS */ 0,
/* 30: ^^ RS */ 0,
/* 31: ^_ US */ 0,
/* 32: SP */ 0,
/* 33: ! */ 0,
/* 34: " */ 0,
/* 35: # */ "\\#",
/* 36: $ */ "{\\dollar}",
/* 37: % */ "\\%",
/* 38: & */ "\\&",
/* 39: ' */ "{'}",
/* 40: ( */ 0,
/* 41: ) */ 0,
/* 42: * */ 0,
/* 43: + */ 0,
/* 44: , */ 0,
/* 45: - */ "{-}",
/* 46: . */ 0,
/* 47: / */ 0,
/* 48: 0 */ 0,
/* 49: 1 */ 0,
/* 50: 2 */ 0,
/* 51: 3 */ 0,
/* 52: 4 */ 0,
/* 53: 5 */ 0,
/* 54: 6 */ 0,
/* 55: 7 */ 0,
/* 56: 8 */ 0,
/* 57: 9 */ 0,
/* 58: : */ 0,
/* 59: ; */ 0,
/* 60: < */ "{\\lthan}",
/* 61: = */ 0,
/* 62: > */ "{\\gthan}",
/* 63: ? */ 0,
/* 64: @ */ 0,
/* 65: A */ 0,
/* 66: B */ 0,
/* 67: C */ 0,
/* 68: D */ 0,
/* 69: E */ 0,
/* 70: F */ 0,
/* 71: G */ 0,
/* 72: H */ 0,
/* 73: I */ 0,
/* 74: J */ 0,
/* 75: K */ 0,
/* 76: L */ 0,
/* 77: M */ 0,
/* 78: N */ 0,
/* 79: O */ 0,
/* 80: P */ 0,
/* 81: Q */ 0,
/* 82: R */ 0,
/* 83: S */ 0,
/* 84: T */ 0,
/* 85: U */ 0,
/* 86: V */ 0,
/* 87: W */ 0,
/* 88: X */ 0,
/* 89: Y */ 0,
/* 90: Z */ 0,
/* 91: [ */ 0,
/* 92: \\ */ "{\\bslash}",
/* 93: ] */ 0,
/* 94: ^ */ "\\string^",
/* 95: _ */ "{\\under}",
/* 96: ` */ "{`}",
/* 97: a */ 0,
/* 98: b */ 0,
/* 99: c */ 0,
/* 100: d */ 0,
/* 101: e */ 0,
/* 102: f */ 0,
/* 103: g */ 0,
/* 104: h */ 0,
/* 105: i */ 0,
/* 106: j */ 0,
/* 107: k */ 0,
/* 108: l */ 0,
/* 109: m */ 0,
/* 110: n */ 0,
/* 111: o */ 0,
/* 112: p */ 0,
/* 113: q */ 0,
/* 114: r */ 0,
/* 115: s */ 0,
/* 116: t */ 0,
/* 117: u */ 0,
/* 118: v */ 0,
/* 119: w */ 0,
/* 120: x */ 0,
/* 121: y */ 0,
/* 122: z */ 0,
/* 123: { */ "{\\lbrac}",
/* 124: | */ "{\\vbar}",
/* 125: } */ "{\\rbrac}",
/* 126: ~ */ "\\string~",
/* 127: DEL */ 0,
/* 128: undefined */ 0,
/* 129: undefined */ 0,
/* 130: undefined */ 0,
/* 131: undefined */ 0,
/* 132: undefined */ 0,
/* 133: undefined */ 0,
/* 134: undefined */ 0,
/* 135: undefined */ 0,
/* 136: undefined */ 0,
/* 137: undefined */ 0,
/* 138: undefined */ 0,
/* 139: undefined */ 0,
/* 140: undefined */ 0,
/* 141: undefined */ 0,
/* 142: undefined */ 0,
/* 143: undefined */ 0,
/* 144: undefined */ 0,
/* 145: undefined */ 0,
/* 146: undefined */ 0,
/* 147: undefined */ 0,
/* 148: undefined */ 0,
/* 149: undefined */ 0,
/* 150: undefined */ 0,
/* 151: undefined */ 0,
/* 152: undefined */ 0,
/* 153: undefined */ 0,
/* 154: undefined */ 0,
/* 155: undefined */ 0,
/* 156: undefined */ 0,
/* 157: undefined */ 0,
/* 158: undefined */ 0,
/* 159: undefined */ 0,
/* 160: undefined */ 0,
/* 161: A grave */ "\\`A",
/* 162: A circumflex */ "\\^A",
/* 163: E grave */ "\\`E",
/* 164: E circumflex */ "\\^E",
/* 165: E dieresis */ "\\\042E",
/* 166: I circumflex */ "\\^I",
/* 167: I dieresis */ "\\\042I",
/* 168: acute accent */ "\\'{ }",
/* 169: grave accent */ "\\`{ }",
/* 170: circumflex */ "\\^{ }",
/* 171: dieresis */ "\\\042{ }",
/* 172: tilde */ "\\~{ }",
/* 173: U grave */ "\\`U",
/* 174: U circumflex */ "\\^U",
/* 175: Italian Lira */ 0,
/* 176: overbar */ 0,
/* 177: Y acute */ "\\'Y",
/* 178: y acute */ "\\'y",
/* 179: degree */ 0,
/* 180: C cedilla */ "\\c{C}",
/* 181: c cedilla */ "\\c{c}",
/* 182: N tilde */ "\\~N",
/* 183: n tilde */ "\\~n",
/* 184: inverted exclamation mark */ "{!`}",
/* 185: inverted question mark */ "{?`}",
/* 186: currency sign */ 0,
/* 187: pound sterling */ 0,
/* 188: Yen */ 0,
/* 189: Section sign */ 0,
/* 190: florin */ 0,
/* 191: Cent sign */ 0,
/* 192: a circumflex */ "\\^a",
/* 193: e circumflex */ "\\^e",
/* 194: o circumflex */ "\\^o",
/* 195: u circumflex */ "\\^u",
/* 196: a acute */ "\\'a",
/* 197: e acute */ "\\'e",
/* 198: o acute */ "\\'o",
/* 199: u acute */ "\\'u",
/* 200: a grave */ "\\`a",
/* 201: e grave */ "\\`e",
/* 202: o grave */ "\\`o",
/* 203: u grave */ "\\`u",
/* 204: a dieresis */ "\\\042a",
/* 205: e dieresis */ "\\\042e",
/* 206: o dieresis */ "\\\042o",
/* 207: u dieresis */ "\\\042u",
/* 208: A angstrom */ "{\\AA}",
/* 209: i circumflex */ "{\\^\\i}",
/* 210: O slash */ "{\\O}",
/* 211: AE ligature */ "{\\AE}",
/* 212: a angstrom */ "{\\aa}",
/* 213: i acute */ "{\\'\\i}",
/* 214: o slash */ "{\\o}",
/* 215: ae ligature */ "{\\ae}",
/* 216: A dieresis */ "\\\042A",
/* 217: i grave */ "{\\`\\i}",
/* 218: O dieresis */ "\\\042O",
/* 219: U dieresis */ "\\\042U",
/* 220: E acute */ "\\'E",
/* 221: i dieresis */ "{\\\042\\i}",
/* 222: SS ligature */ "{\\ss}",
/* 223: O circumflex */ "\\^O",
/* 224: A acute */ "\\'A",
/* 225: A tilde */ "\\~A",
/* 226: a tilde */ "\\~a",
/* 227: Eth */ 0,
/* 228: eth */ 0,
/* 229: I acute */ "\\'I",
/* 230: I grave */ "\\`I",
/* 231: O acute */ "\\'O",
/* 232: O grave */ "\\`O",
/* 233: O tilde */ "\\~O",
/* 234: o tilde */ "\\~o",
/* 235: S caron */ "\\v{S}",
/* 236: s caron */ "\\v{s}",
/* 237: U acute */ "\\'U",
/* 238: Y dieresis */ "\\\042Y",
/* 239: y dieresis */ "\\\042y",
/* 240: Thorn */ 0,
/* 241: thorn */ 0,
/* 242: undefined */ 0,
/* 243: mu */ 0,
/* 244: paragraph sign */ 0,
/* 245: fraction 3/4 */ 0,
/* 246: long dash */ 0,
/* 247: fraction 1/4 */ 0,
/* 248: fraction 1/2 */ 0,
/* 249: Female ordinal */ 0,
/* 250: Male ordinal */ 0,
/* 251: French double open quote */ 0,
/* 252: Solid square */ 0,
/* 253: French double close quote */ 0,
/* 254: Plus over minus sign */ 0,
/* 255: undefined */ 0
}
#endif
;

View File

@@ -0,0 +1,530 @@
/* $XConsortium: xref.c /main/3 1995/11/08 09:33:21 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
/* HP Tag to TeX cross-reference processing */
#include "userinc.h"
#include "globdec.h"
/* Chk for duplicate xref id's, called in TEST, S1, S2, S3, S4, and rsect. */
M_WCHAR *checkid(id)
M_WCHAR *id;
{
struct xref *xref;
char *buffer;
char *mb_id;
if (!id) return(NULL);
m_getline(&xrffile, &xrfline);
if (xrffile == NULL)
{
/* set to primary input */
xrffile = inputname;
}
xref = (struct xref*) m_lookfortrie(id, &xtree);
if (!xref) return(id); /* not in trie, so not previously defined */
if (!(xref->wheredef)) /* defined only in previous pass */
return(id);
/* else, we have a duplicate definition of id */
m_err1("Redefinition of ID '%s'", id);
mb_id = MakeMByteString(id);
buffer = (char *) m_malloc(1 + strlen(firstused) + strlen(mb_id) + 6,
"error buffer");
sprintf(buffer, firstused, mb_id, xref->line);
m_errline(buffer);
m_free(buffer, "error buffer");
m_free(mb_id,"multi-byte string");
if (xref->file)
{
char *mb_file;
mb_file = MakeMByteString(xref->file);
buffer = (char *) m_malloc(1 - 2 + strlen(offile) + strlen(mb_file),
"error buffer");
sprintf(buffer, offile, mb_file);
m_errline(buffer);
m_free(buffer, "error buffer");
m_free(mb_file,"multi-byte string");
}
m_errline(".\n");
return(NULL);
}
/* Write a single cross-reference macro definition */
static void defxref(xfile, id, xref)
FILE *xfile;
M_WCHAR *id;
struct xref *xref;
{
char *csname;
char *p;
char *buffer;
csname = MakeMByteString(id);
if (xref->defined)
{
char *mb_text;
mb_text = MakeMByteString(xref->textptr);
fprintf(xfile,
"\\definexref %s\\\\endxref\001%s\002\001%s",
csname,
mb_text,
xref->chapstring);
fprintf(xfile,
"\002\001%c\002\001%s\002\001%c\002%%\n",
xref->csensitive ? 'Y' : 'N',
xref->inchapter ? "\\LOCchap" : "\\LOCapp",
xref->xrefable ? 'Y' : 'N');
m_free(mb_text,"multi-byte string");
}
else
{
fprintf(xfile, "\\undefinedxref %s\\\\endxref\001", csname);
for (p = csname; *p ; p++)
outchar(*p, xfile);
fputs("\002%\n", xfile);
m_eprefix(); /* correctly delimit error in error file */
buffer = (char *) m_malloc(1 - 2 + strlen(undef) + w_strlen(id),
"error buffer");
sprintf(buffer, undef, csname);
m_errline(buffer);
m_free(buffer, "error buffer");
if (xref->file)
{
char *mb_file;
mb_file = MakeMByteString(xref->file);
buffer = (char *) m_malloc(1 - 2 + strlen(infile) +
strlen(mb_file),
"error buffer");
sprintf(buffer, infile, mb_file);
m_errline(buffer);
m_free(buffer, "error buffer");
m_free(mb_file,"multi-byte string");
}
buffer = (char *) m_malloc(1 - 2 + strlen(online) + 10,
"error buffer");
sprintf(buffer, online, xref->line);
m_errline(buffer);
m_free(buffer, "error buffer");
}
m_free(csname, "csname");
}
/* Write cross-reference file for next time document is processed
and TeX macro file for post-processing this pass */
void dumpxref(M_NOPAR)
{
int n;
M_WCHAR id[M_NAMELEN + 1];
M_TRIE *node[M_NAMELEN + 1];
M_TRIE *current;
FILE *tex;
strcpy(helpext, ".xrh");
tex = fopen(helpbase, "w");
fprintf(tex, "\\gobble\001%s\002%%\n", m_signon);
fputs("% Generated Cross-Reference Macros (for a particular document)\n", tex);
if (! xtree.data) return;
n = 0;
current = xtree.data;
while (TRUE)
{
id[n] = current->symbol;
node[n] = current->next;
if (! id[n])
{
/* Process one table entry */
defxref(tex, id, (struct xref *) current->data);
/* Look for the next one */
current = current->next;
while (! current)
{
n--;
if (n < 0)
{
fclose(tex);
return;
}
current = node[n];
}
}
else
{
current = current->data;
n++;
}
}
}
/* Copies string to end of current cross-reference string */
void idstring(string)
M_WCHAR *string;
{
int length;
length = w_strlen(string);
if (xstrlen + length + 1 > (sizeof(xrefstring) / sizeof(M_WCHAR)))
{
if (! iderr)
{
m_error(
"Internal error. Too many characters in cross-reference expansion.");
iderr = TRUE;
}
return;
}
w_strcpy(&xrefstring[xstrlen],string);
xstrlen += length;
}
/* Initializes cross-reference table reading in file output from previous
pass through document */
void loadxref(M_NOPAR)
{
M_WCHAR id[M_NAMELEN + 1];
char c, d;
int nextc;
int n;
LOGICAL csensitive;
LOGICAL inchapter;
LOGICAL xrefable;
char chapnum[15];
char string[15];
int braces;
M_WCHAR *p, *pStart;
static M_WCHAR wbs = 0, wca, wcb, wnl, weof;
if (! xrf) return;
if (!wbs)
{
char mb_eof;
mbtowc(&wbs, "\\", 1);
mbtowc(&wca, "\001", 1); /* ^A */
mbtowc(&wcb, "\002", 1); /* ^B */
mbtowc(&wnl, "\n", 1);
mb_eof = EOF;
mbtowc(&weof, &mb_eof, 1);
}
while (TRUE)
{
if (fscanf(xrf, "%14s ", string) != 1)
{
fclose(xrf);
return;
}
if (! strcmp(string, "\\undefinedxref"))
{
for (nextc = mb_getwc(xrf);
(nextc != wnl) && (nextc != weof);
nextc = mb_getwc(xrf)
);
continue;
}
for (n = 0; n <= M_NAMELEN ; n++)
{
nextc = mb_getwc(xrf); /* use mb_getwc to read multi-byte chars */
if (nextc == weof)
{
m_error("Incomplete cross-reference file.");
fclose(xrf);
return;
}
if (nextc == wbs) break;
id[n] = nextc;
}
if (n > M_NAMELEN)
{
m_error("Error in cross-reference file.");
fclose(xrf);
return;
}
pStart = p = MakeWideCharString("\\endxref\001");
for (; *p ; p++)
{
nextc = mb_getwc(xrf);
if (nextc != *p)
{
m_free(pStart,"wide character string");
m_error("Error in cross-reference file.");
fclose(xrf);
return;
}
}
m_free(pStart,"wide character string");
id[n] = M_EOS;
for (xstrlen = 0, braces = 1;
xstrlen < (sizeof(xrefstring) / sizeof(M_WCHAR));
xstrlen++)
{
xrefstring[xstrlen] = mb_getwc(xrf);
if (xrefstring[xstrlen] == wca) braces++;
else if (xrefstring[xstrlen] == wcb) if (! --braces) break;
}
if (xstrlen >= (sizeof(xrefstring) / sizeof(M_WCHAR)))
{
m_error("Error in cross-reference file");
fclose(xrf);
return;
}
xrefstring[xstrlen] = M_EOS;
if ((fscanf(xrf,
"\001%14[^\002]\002\001%c\002\001%8[^\002]\002\001%c\002%%\n",
chapnum, &c, string, &d) != 4) ||
(c != 'Y' && c != 'N') || (d != 'Y' && d != 'N') ||
(strcmp(string, "\\LOCapp") && strcmp(string, "\\LOCchap"))
)
{
m_error("Error in cross-reference file");
fclose(xrf);
return;
}
csensitive = (LOGICAL) (c == 'Y');
inchapter = (LOGICAL) (strcmp(string, "\\LOCchap") == FALSE);
xrefable = (LOGICAL) (d == 'Y');
setid(id,
FALSE,
csensitive,
inchapter,
chapnum,
NULL,
0,
xrefable);
}
/* fclose(xrf); ** not reachable; left in for future reference */
}
/* Save a cross-reference ID and associated expansion */
#if defined(M_PROTO)
void setid(M_WCHAR *id, LOGICAL where, LOGICAL csensitive, LOGICAL inchapter,
char *chapter, M_WCHAR *xrffile, int xrfline, LOGICAL xrefable)
#else
void setid(id, where, csensitive, inchapter, chapter, xrffile, xrfline, xrefable)
M_WCHAR *id;
LOGICAL where;
LOGICAL csensitive;
LOGICAL inchapter;
char *chapter;
M_WCHAR *xrffile;
int xrfline;
LOGICAL xrefable;
#endif
{
struct xref *old;
struct xref *xref;
char *buffer;
if (!*id)
{
m_err2("Erroneous cross reference of `%s' for id `%s'",
xrefstring,
id);
return;
}
xref = (struct xref *) m_malloc(sizeof(struct xref), "xref");
if (old = (struct xref *) m_ntrtrie(id, &xtree, (M_TRIE *) xref))
{
m_free(xref, "xref");
xref = old;
if (xref->wheredef)
{
char *mb_id;
mb_id = MakeMByteString(id);
m_err1("Redefinition of ID '%s'", id);
buffer = (char *)
m_malloc(1 + strlen(firstused) + w_strlen(id) + 6,
"error buffer");
sprintf(buffer, firstused, mb_id, xref -> line);
m_errline(buffer);
m_free(buffer, "error buffer");
m_free(mb_id,"multi-byte string");
if (xref->file)
{
char *mb_file;
mb_file = MakeMByteString(xref->file);
buffer = (char *)
m_malloc(1 - 2 + strlen(offile) + strlen(mb_file),
"error message");
sprintf(buffer, offile, mb_file);
m_errline(buffer);
m_free(buffer, "error buffer");
m_free(mb_file,"multi-byte string");
}
m_errline(".\n");
return;
}
if (xref->defined)
{
if (w_strcmp(xrefstring, xref->textptr) != 0) /* ref has changed */
have_forward_xrefs = TRUE; /* so force a second pass */
m_free(xref->chapstring, "xref chapter string");
m_free(xref->textptr, "xref text pointer");
}
}
else xref->retrieved = FALSE;
xref->defined = TRUE;
xref->wheredef = where;
xref->csensitive = csensitive;
xref->inchapter = inchapter;
xref->chapstring =
(char *) m_malloc(strlen(chapter) + 1, "xref chapter string");
xref->textptr = (M_WCHAR *) m_malloc(xstrlen + 1, "xref text pointer");
strcpy(xref->chapstring, chapter);
w_strcpy(xref->textptr, xrefstring);
xref->file = xrffile;
xref->line = xrfline;
xref->xrefable = xrefable;
xstrlen = 0;
savid = NULL;
}
/* Generate a cross-reference */
void xrefexpand(id)
M_WCHAR *id;
{
struct xref *xref;
struct xref *old;
#define format "\\<xref %s>"
char *texcode;
char *csname;
/* ID is 0 in case of a parameter error which MARKUP will report */
if (! id) return;
/* Write call to generated macro in output file */
csname = MakeMByteString(id);
texcode = (char *) m_malloc(sizeof(format) + strlen(csname), "texcode");
sprintf(texcode, format, csname);
if (echo)
{
mb_echohead(m_stago);
mb_echohead("XREF ");
echohead(id);
mb_echohead(m_tagc);
}
if (savhd)
mb_shstring(texcode,
&svheadlen,
(sizeof(savehead) / sizeof(M_WCHAR)),
savehead,
"Too many characters in head or caption",
&hderr);
if (savtc)
mb_shstring(texcode,
&svtclen,
(sizeof(savetabcap) / sizeof(M_WCHAR)),
savetabcap,
"Too many characters in table caption",
&hderr);
if (savid)
mb_shstring(texcode,
&xstrlen,
(sizeof(xrefstring) / sizeof(M_WCHAR)),
xrefstring,
"Too many characters in corresponding cross-reference",
&iderr);
/* Enter id in xref table if it's not already there */
xref = (struct xref *) m_malloc(sizeof(struct xref), "xref");
if (old = (struct xref *) m_ntrtrie(id, &xtree, (M_TRIE *) xref))
{
/* non-NULL, we had an old one */
m_free(xref, "xref");
xref = old;
if (! xref->xrefable)
{
m_error("You can't cross reference to that type of tag");
/* but put out the string anyway... */
/* decrement error counter to treat this as a warning */
m_errcnt--;
}
if (xref->textptr)
{
/* we have an expansion */
char *mb_textptr;
if (!*xref->textptr)
{
m_err1("Empty cross reference for id `%s'", id);
return;
}
mb_textptr = MakeMByteString(xref->textptr);
fprintf(outfile,
"<LINK RID=\"%s\">%s</LINK>",
csname,
mb_textptr);
m_free(mb_textptr,"multi-byte string");
}
else
{ /* expansion */
/* dump out a tag string as a placeholder */
fputs(texcode, outfile);
/* not really forward, but a null string */
have_forward_xrefs = TRUE;
/* xref->defined = FALSE;
xref->retrieved = FALSE;
xref->textptr = NULL;
xref->wheredef = FALSE;*/
}
}
else
{ /* no old xref */
if (rebuild)
{
m_errline(
"Unresolved xrefs. Running HelpTag a second time may help.\n");
rebuild = FALSE; /* one error message will do */
}
have_forward_xrefs = TRUE;
xref->defined = FALSE;
xref->retrieved = FALSE;
xref->textptr = NULL;
xref->wheredef = FALSE;
/* This is a forward ref. We assume it is xrefable */
/* It will be set correctly if and when the ref is defined */
xref->xrefable = TRUE;
fputs(texcode, outfile);
}
/* Record retrieval status if this is the first reference */
if (! xref->retrieved && ! xref->defined)
{
m_getline(&xref->file, &xref->line);
if (xref->file == NULL)
{
/* set to primary input */
xref->file = inputname;
}
xref->retrieved = TRUE;
}
m_free(texcode, "texcode buffer");
m_free(csname, "csname");
}

View File

@@ -0,0 +1,129 @@
XCOMM $XConsortium: Imakefile /main/10 1996/10/09 14:04:51 drk $
/* parser Imakefile */
ARCCMD = arc u
UNARCCMD = arc x
ARCDELCMD = arc d
HELPTAG = ..
HELPTAGSRC = $(HELPTAG)/helptag
HELPPARSERSRC = $(HELPTAG)/parser
HELPELTDEFSRC = $(HELPTAG)/eltdef
HELPDTDFILE = $(HELPTAGSRC)/hptag.dtd
HELPUTILSRC = $(HELPTAG)/util
HELPBUILDSRC = $(HELPTAG)/build
HELPUTILLIB = $(HELPTAG)/util/libutil.a
INCLUDES = -I. -I$(HELPUTILSRC) -I$(HELPTAGSRC) -I$(HELPBUILDSRC) \
-I$(HELPELTDEFSRC)
SRCS = parser.c actutil.c \
closent.c code.c cyclent.c dcurelt.c \
end.c entity.c \
error.c getsign.c \
input.c level.c lookent.c \
minim.c optstrg.c param.c parent.c \
parutil.c pi.c \
scan.c setpar.c start.c string.c struct.c \
text.c
XCOMM parvalok.c parname.c ifdata.c findpar.c
OBJS = parser.o actutil.o \
closent.o code.o cyclent.o dcurelt.o \
end.o entity.o \
error.o getsign.o \
input.o level.o lookent.o \
minim.o optstrg.o param.o parent.o \
parutil.o pi.o \
scan.o setpar.o start.o string.o struct.o \
text.o
XCOMM parvalok.o parname.o ifdata.o findpar.o
XLATEOBJECTS = $(HELPTAGSRC)/LocaleXlate.o $(HELPTAGSRC)/XlationSvc.o
APPLOBJECTS = \
$(HELPTAGSRC)/custom.o \
$(HELPTAGSRC)/default.o \
$(HELPTAGSRC)/help.o \
$(HELPTAGSRC)/make.o \
$(HELPTAGSRC)/option.o \
$(HELPTAGSRC)/out.o \
$(HELPTAGSRC)/xref.o \
$(XLATEOBJECTS)
ELT_H = \
$(HELPELTDEFSRC)/entity2.h \
$(HELPELTDEFSRC)/globdec.h \
$(HELPELTDEFSRC)/globdef.h \
$(HELPELTDEFSRC)/if.h \
$(HELPELTDEFSRC)/pval.h \
$(HELPELTDEFSRC)/signon.h \
$(HELPELTDEFSRC)/signonx.h
ELT_C = \
$(HELPELTDEFSRC)/efile.c \
$(HELPELTDEFSRC)/entfile.c \
$(HELPELTDEFSRC)/pfile.c \
$(HELPELTDEFSRC)/sfile.c \
$(HELPELTDEFSRC)/stfile.c \
$(HELPELTDEFSRC)/tfile.c
ELT_DEFS = $(ELT_H) $(ELT_C)
#ifdef SunArchitecture
.NO_PARALLEL:
#endif
LOCAL_LIBRARIES = $(HELPUTILLIB)
SYS_LIBRARIES = $(XLIB) DtClientSysLibs
#if defined (SunArchitecture)
SYS_LIBRARIES = $(XLIB) -lm -ldl -lgen -lC
#endif /* SunArchitecture */
all:: $(HELPTAGSRC)/dthelp_ctag1
other_dirs:
cd $(HELPELTDEFSRC); make
cd $(HELPTAGSRC); make
NormalLibraryObjectRule()
NormalProgramTarget(parser,$(OBJS) $(APPLOBJECTS),delim.h $(LOCAL_LIBRARIES) other_dirs,$(LOCAL_LIBRARIES),)
CPRODS = case.c context.h delim.h
CTRASH = error delim.dat
$(HELPTAGSRC)/dthelp_ctag1: parser
$(RM) $(HELPTAGSRC)/dthelp_ctag1
$(CP) parser $(HELPTAGSRC)/dthelp_ctag1
$(CPRODS): $(HELPUTILSRC)/context $(HELPTAGSRC)/delim.par context.dat
$(RM) $(CPRODS) $(CTRASH)
/* get application-specific delim.dat */
$(CP) $(HELPTAGSRC)/delim.par delim.dat
$(HELPUTILSRC)/context
$(HELPUTILSRC)/context:
cd $(HELPUTILSRC); make context
$(APPLOBJECTS):
cd $(HELPTAGSRC); make $(APPLOBJECTS)
$(ELT_DEFS):
cd $(HELPELTDEFSRC); make $(ELT_DEFS)
arc package :
if exist util.arc $(CP) build.arc old.arc
$(ARCCMD) util.arc *.c *.h makefile
unarc dearc :
$(UNARCCMD) util.arc
clean::
$(RM) $(CPRODS) $(CTRASH) parser *.o
depend:: $(SRCS)
includes:: $(CPRODS)
DependTarget()

View File

@@ -0,0 +1,316 @@
/* $XConsortium: actutil.c /main/3 1995/11/08 09:34:00 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Actutil.c contains utility procedures for processing actions specified
in the interface definition.*/
#include <stdio.h>
#include <malloc.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include <string.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
#define M_IFDEF
#include "if.h"
#include "delim.h"
#include "context.h"
#include "signon.h"
/* When an explicit or implied end-tag occurs */
void m_endaction(m_elt)
M_ELEMENT m_elt;
{
M_ELEMENT m_action;
char buffer[2*MAXD+M_NAMELEN+1];
if (m_tagtrace) {
if (m_element[m_elt - 1].content != M_NONE) {
if (m_toptstat == M_OTHER) {
strcpy(buffer, "\n");
m_trace(buffer);
}
sprintf(buffer,
"%s%s%s",
m_etago,
m_nameofelt(m_elt),
m_tagc);
m_trace(buffer);
}
m_toptstat = M_OTHER;
}
if (m_action = m_findact(m_elt, m_ecarray)) {
m_stackpar = m_stacktop;
m_endcase(m_action);
}
if (m_action = m_findact(m_elt, m_etarray)) {
m_stackpar = m_stacktop->stparam;
m_textout(&m_string[m_action - 1], FALSE, TRUE);
}
}
/* Find appropriate action according to current stack */
int m_findact(elt, array)
M_ELEMENT elt;
int *array;
{
int chainlen = 0;
int index;
if (! array[elt - 1]) return(FALSE);
if (m_stacktop->element != elt) {
m_error("Program error in findact");
m_exit(TRUE);
}
/* There is an action for this element with no context specification */
if (m_action[array[elt - 1] - 1].data) {
chainlen = 1;
index = array[elt - 1];
}
/* Only actions for this element have context specified */
else {
chainlen = 0;
index = 0;
}
m_findchain(m_stacktop->oldtop, array[elt - 1], chainlen, &chainlen,
&index, FALSE);
return(index ? m_action[index - 1].data : FALSE);
}
/* Recursive procedure called by findact() to search m_action */
#if defined(M_PROTO)
void m_findchain(M_PARSE *stackptr, int start, int chainin, int *chainout, int *index, LOGICAL wild)
#else
void m_findchain(stackptr, start, chainin, chainout, index, wild)
M_PARSE *stackptr;
int start;
int chainin;
int *chainout;
int *index;
LOGICAL wild;
#endif
{
int node;
M_PARSE *stackp;
for (node = m_action[start - 1].son ; node;
node = m_action[node - 1].next) {
if (m_action[node - 1].element == 1)
m_findchain(stackptr, node, chainin, chainout, index, TRUE);
else for (stackp = stackptr;
stackp->oldtop;
stackp = stackp->oldtop) {
if (stackp->element == m_action[node - 1].element - 1) {
if (m_action[node - 1].data)
if (chainin + 1 > *chainout ||
(chainin + 1 == *chainout && node < *index)) {
*chainout = chainin + 1;
*index = node;
}
m_findchain(stackp->oldtop, node, chainin + 1, chainout,
index, FALSE);
}
if (! wild) break;
}
}
}
/* Process global end string. In separate procedure to keep all references
to if.h in one source file and minimize recompilation if interface
changes. */
void m_globes(M_NOPAR)
{
M_WCHAR *wc_string;
wc_string = MakeWideCharString(&m_string[m_ges]);
if (m_ges) m_stcaction(wc_string, FALSE, TRUE);
m_free(wc_string,"wide character string");
}
/* Process global start string. In separate procedure to keep all references
to if.h in one source file and minimize recompilation if interface
changes. */
void m_globss(M_NOPAR)
{
M_WCHAR *wc_string;
wc_string = MakeWideCharString(&m_string[m_gss]);
if (m_gss) m_stcaction(wc_string, TRUE, FALSE);
m_free(wc_string,"wide character string");
}
/* When an explicit or implied start-tag occurs */
void m_strtaction(m_elt)
M_ELEMENT m_elt;
{
int m_par, m_i;
M_WCHAR *m_p;
M_ELEMENT m_action;
static char newpar[] = "\n ";
static char quote[] = " = \"";
char buffer[M_NAMELEN + 1 +
(sizeof(quote) + sizeof(newpar) - 2 > MAXD ?
sizeof(quote) + sizeof(newpar) - 2 :
MAXD)
];
m_start = TRUE;
m_getline(&m_stacktop->file, &m_stacktop->line);
if (m_tagtrace) {
sprintf(buffer, "%s%s", m_stago, m_nameofelt(m_elt));
m_trace(buffer);
for (m_i = 0, m_par = m_element[m_elt - 1].parptr;
m_i < m_element[m_elt - 1].parcount;
m_i++, m_par++)
if (m_stacktop->param[m_i]) {
sprintf(buffer, "%s%s%s",
newpar, &m_pname[m_parameter[m_par - 1].paramname], quote);
m_trace(buffer);
buffer[1] = M_EOS;
for (m_p = m_stacktop->param[m_i] ; *m_p ; m_p++)
if (*m_p != '"') {
buffer[0] = *m_p;
m_trace(buffer);
}
else {
sprintf(buffer, "%s%d", m_cro, '"');
m_trace(buffer);
buffer[1] = M_EOS;
}
buffer[0] = '"';
m_trace(buffer);
}
if (m_element[m_elt - 1].parcount) {
buffer[0] = '\n';
buffer[1] = M_EOS;
m_trace(buffer);
}
sprintf(buffer, "%s\n", m_tagc);
m_trace(buffer);
m_toptstat = M_TOPTSTARTTAG;
}
if (m_action = m_findact(m_elt, m_scarray)) {
m_stackpar = m_stacktop;
m_strtcase(m_action);
}
if (m_action = m_findact(m_elt, m_stcarray)) {
m_stacktop->stccase = m_action;
m_stacktop->stparam = m_stacktop;
}
if (m_action = m_findact(m_elt, m_starray)) {
m_stackpar = m_stacktop->stparam;
m_textout(&m_string[m_action - 1], TRUE, FALSE);
}
if (m_action = m_findact(m_elt, m_tcarray)) {
m_stacktop->cdcase = m_action;
m_stacktop->cdparam = m_stacktop;
}
if (m_action = m_findact(m_elt, m_pcarray)) {
m_stacktop->picase = m_action;
m_stacktop->piparam = m_stacktop;
}
}
/* Output a start-string or end-string */
#if defined(M_PROTO)
void m_textout(char *format, LOGICAL start, LOGICAL end)
#else
void m_textout(format, start, end)
char *format;
LOGICAL start;
LOGICAL end;
#endif
{
M_WCHAR name[M_NAMELEN + 1];
int i, par;
LOGICAL found;
M_WCHAR *string;
M_WCHAR *p;
M_WCHAR *q;
M_WCHAR *r;
M_WCHAR *s;
M_WCHAR *new;
int stringlen;
int changelen;
int unused;
stringlen = strlen(format) + 1;
unused = 0;
string = (M_WCHAR *) m_malloc(stringlen, "string space");
for (p = string ; *format ; )
{
if (*format == M_ESCAPECHAR)
{
for (i = 0, format++ ; i < M_NAMELEN ; i++, format++)
{
mbtowc(&name[i], format, 1);
if (m_cttype(name[i]) == M_NONNAME ||
(m_cttype(name[i]) != M_NMSTART && i == 0)
) break;
}
if (! i)
{
char mb;
mb = M_ESCAPECHAR;
mbtowc(p, &mb, 1);
p++;
/* Double escape character used to insert a single escape character
in the output string */
if (*format == M_ESCAPECHAR) format++;
continue;
}
name[i] = M_EOS;
for (found = FALSE, i = 0,
par = m_element[m_stacktop->element - 1].parptr;
i < m_element[m_stacktop->element - 1].parcount;
i++, par++)
if (! m_wcupstrcmp(&m_pname[m_parameter[par - 1].paramname], name))
{
q = m_stacktop->param[i];
if (! q)
{
found = TRUE;
unused += w_strlen(name) + 1;
break;
}
changelen = w_strlen(q) - w_strlen(name) - 1 - unused;
if (changelen > 0)
{
new = (M_WCHAR *) m_malloc(stringlen + changelen,
"string space");
for (r = string, s = new ; r < p ; ) *s++ = *r++;
m_free(string, "string space");
string = new;
stringlen = stringlen + changelen;
p = s;
unused = 0;
}
else if (changelen < 0) unused = -changelen;
found = TRUE;
break;
}
if (! found)
{
char mb;
mb = M_ESCAPECHAR;
mbtowc(p, &mb, 1);
p++;
q = name;
}
if (q) while (*q) *p++ = *q++;
}
else *p++ = *format++;
}
*p = M_EOS;
m_stcaction(string, start, end);
m_free(string, "string space");
}

View File

@@ -0,0 +1,2 @@
/* $XConsortium: addinput.c /main/3 1995/11/08 09:34:10 rswiston $ */
/* Obsolete */

View File

@@ -0,0 +1,133 @@
/* $XConsortium: charconv.h /main/3 1995/11/08 09:34:21 rswiston $ */
EXTERN M_WCHAR pc8_to_r8 [256]
#if defined(DEFINE)
= {
'\000','\001','\002','\003','\004','\005','\006','\007','\010','\011',
'\012','\013','\014','\015','\016','\017','\020','\021','\022','\023',
'\024','\025','\026','\027','\030','\031','\032','\033','\034','\035',
'\036','\037','\040','\041','\042','\043','\044','\045','\046','\047',
'\050','\051','\052','\053','\054','\055','\056','\057','\060','\061',
'\062','\063','\064','\065','\066','\067','\070','\071','\072','\073',
'\074','\075','\076','\077','\100','\101','\102','\103','\104','\105',
'\106','\107','\110','\111','\112','\113','\114','\115','\116','\117',
'\120','\121','\122','\123','\124','\125','\126','\127','\130','\131',
'\132','\133','\134','\135','\136','\137','\140','\141','\142','\143',
'\144','\145','\146','\147','\150','\151','\152','\153','\154','\155',
'\156','\157','\160','\161','\162','\163','\164','\165','\166','\167',
'\170','\171','\172','\173','\174','\175','\176','\177','\264','\317',
'\305','\300','\314','\310','\324','\265','\301','\315','\311','\335',
'\321','\331','\330','\320','\334','\327','\323','\302','\316','\312',
'\303','\313','\357','\332','\333','\277','\273','\274','\120','\276',
'\304','\325','\306','\307','\267','\266','\371','\372','\271','\055',
'\052','\370','\367','\270','\373','\375','\374','\374','\374','\174',
'\053','\043','\053','\053','\043','\043','\174','\043','\043','\053',
'\043','\053','\053','\053','\053','\053','\055','\053','\043','\053',
'\043','\043','\043','\043','\043','\075','\043','\043','\053','\043',
'\053','\053','\043','\043','\053','\053','\043','\053','\053','\374',
'\374','\374','\374','\374','\052','\336','\052','\052','\052','\052',
'\363','\052','\052','\052','\052','\052','\052','\326','\052','\052',
'\052','\376','\052','\052','\174','\174','\057','\176','\263','\362',
'\362','\052','\052','\052','\374','\377'
}
#endif
;
EXTERN M_WCHAR pc8dn_to_r8 [256]
#if defined(DEFINE)
= {
'\000','\001','\002','\003','\004','\005','\006','\007','\010','\011',
'\012','\013','\014','\015','\016','\017','\020','\021','\022','\023',
'\024','\025','\026','\027','\030','\031','\032','\033','\034','\035',
'\036','\037','\040','\041','\042','\043','\044','\045','\046','\047',
'\050','\051','\052','\053','\054','\055','\056','\057','\060','\061',
'\062','\063','\064','\065','\066','\067','\070','\071','\072','\073',
'\074','\075','\076','\077','\100','\101','\102','\103','\104','\105',
'\106','\107','\110','\111','\112','\113','\114','\115','\116','\117',
'\120','\121','\122','\123','\124','\125','\126','\127','\130','\131',
'\132','\133','\134','\135','\136','\137','\140','\141','\142','\143',
'\144','\145','\146','\147','\150','\151','\152','\153','\154','\155',
'\156','\157','\160','\161','\162','\163','\164','\165','\166','\167',
'\170','\171','\172','\173','\174','\175','\176','\177','\264','\317',
'\305','\300','\314','\310','\324','\265','\301','\315','\311','\335',
'\321','\331','\330','\320','\334','\327','\323','\302','\316','\312',
'\303','\313','\357','\332','\333','\326','\273','\322','\114','\154',
'\304','\325','\306','\307','\267','\266','\352','\351','\271','\342',
'\341','\154','\156','\270','\052','\272','\374','\374','\374','\174',
'\053','\043','\053','\053','\043','\043','\174','\043','\043','\053',
'\043','\053','\053','\053','\053','\053','\055','\053','\043','\053',
'\043','\043','\043','\043','\043','\075','\043','\043','\053','\043',
'\053','\053','\043','\043','\053','\053','\043','\053','\053','\374',
'\374','\374','\374','\374','\052','\336','\052','\052','\052','\052',
'\363','\052','\052','\052','\052','\052','\052','\326','\052','\052',
'\052','\376','\052','\052','\174','\174','\057','\176','\263','\362',
'\362','\052','\052','\052','\374','\377'
}
#endif
;
EXTERN M_WCHAR r8_to_pc8 [256]
#if defined(DEFINE)
= {
'\000','\001','\002','\003','\004','\005','\006','\007','\010','\011',
'\012','\013','\014','\015','\016','\017','\020','\021','\022','\023',
'\024','\025','\026','\027','\030','\031','\032','\033','\034','\035',
'\036','\037','\040','\041','\042','\043','\044','\045','\046','\047',
'\050','\051','\052','\053','\054','\055','\056','\057','\060','\061',
'\062','\063','\064','\065','\066','\067','\070','\071','\072','\073',
'\074','\075','\076','\077','\100','\101','\102','\103','\104','\105',
'\106','\107','\110','\111','\112','\113','\114','\115','\116','\117',
'\120','\121','\122','\123','\124','\125','\126','\127','\130','\131',
'\132','\133','\134','\135','\136','\137','\140','\141','\142','\143',
'\144','\145','\146','\147','\150','\151','\152','\153','\154','\155',
'\156','\157','\160','\161','\162','\163','\164','\165','\166','\167',
'\170','\171','\172','\173','\174','\175','\176','\177','\200','\201',
'\202','\203','\204','\205','\206','\207','\210','\211','\212','\213',
'\214','\215','\216','\217','\220','\221','\222','\223','\224','\225',
'\226','\227','\230','\231','\232','\233','\234','\235','\236','\237',
'\040','\101','\101','\105','\105','\105','\111','\111','\047','\140',
'\136','\042','\176','\125','\125','\234','\055','\131','\171','\370',
'\200','\207','\245','\244','\255','\250','\052','\234','\235','\052',
'\237','\233','\203','\210','\223','\226','\240','\202','\242','\243',
'\205','\212','\225','\227','\204','\211','\224','\201','\217','\214',
'\117','\222','\206','\241','\355','\221','\216','\215','\231','\232',
'\220','\213','\341','\117','\101','\101','\141','\104','\144','\111',
'\111','\117','\117','\117','\157','\123','\163','\125','\131','\230',
'\052','\052','\372','\346','\052','\052','\304','\254','\253','\246',
'\247','\256','\376','\257','\361','\040'
}
#endif
;
EXTERN M_WCHAR r8_to_pc8dn [256]
#if defined(DEFINE)
= {
'\000','\001','\002','\003','\004','\005','\006','\007','\010','\011',
'\012','\013','\014','\015','\016','\017','\020','\021','\022','\023',
'\024','\025','\026','\027','\030','\031','\032','\033','\034','\035',
'\036','\037','\040','\041','\042','\043','\044','\045','\046','\047',
'\050','\051','\052','\053','\054','\055','\056','\057','\060','\061',
'\062','\063','\064','\065','\066','\067','\070','\071','\072','\073',
'\074','\075','\076','\077','\100','\101','\102','\103','\104','\105',
'\106','\107','\110','\111','\112','\113','\114','\115','\116','\117',
'\120','\121','\122','\123','\124','\125','\126','\127','\130','\131',
'\132','\133','\134','\135','\136','\137','\140','\141','\142','\143',
'\144','\145','\146','\147','\150','\151','\152','\153','\154','\155',
'\156','\157','\160','\161','\162','\163','\164','\165','\166','\167',
'\170','\171','\172','\173','\174','\175','\176','\177','\200','\201',
'\202','\203','\204','\205','\206','\207','\210','\211','\212','\213',
'\214','\215','\216','\217','\220','\221','\222','\223','\224','\225',
'\226','\227','\230','\231','\232','\233','\234','\235','\236','\237',
'\040','\101','\101','\105','\105','\105','\111','\111','\047','\140',
'\136','\042','\176','\125','\125','\234','\055','\131','\171','\370',
'\200','\207','\245','\244','\255','\250','\257','\234','\131','\052',
'\146','\143','\203','\210','\223','\226','\240','\202','\242','\243',
'\205','\212','\225','\227','\204','\211','\224','\201','\217','\214',
'\235','\222','\206','\241','\233','\221','\216','\215','\231','\232',
'\220','\213','\341','\117','\101','\252','\251','\104','\144','\111',
'\111','\117','\117','\247','\246','\123','\163','\125','\131','\230',
'\052','\052','\372','\346','\052','\052','\304','\052','\052','\052',
'\052','\074','\376','\076','\361','\040'
}
#endif
;

View File

@@ -0,0 +1,14 @@
/* $XConsortium: closent.c /main/3 1995/11/08 09:34:31 rswiston $ */
/* Copyright 1988, 1989 Hewlett-Packard Co. */
/* Default close SYSTEM entity procedure */
#include "userinc.h"
#include "globdec.h"
void m_closent(m_ptr)
void *m_ptr ;
{
fclose((FILE *) m_ptr) ;
}

View File

@@ -0,0 +1,23 @@
/* $XConsortium: code.c /main/3 1995/11/08 09:34:41 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Code.c executes code entities specified in the interface. */
#include "userinc.h"
#include "globdef.h"
#include <time.h>
/* Include generated file */
#include "entfile.c"
/* When a reference to a CODE entity is encountered */
void m_codeent(m_ent)
int m_ent ;
{
(*m_ctable[m_ent])() ;
}

View File

@@ -0,0 +1,697 @@
m_comment
comcon:comcon {
/* $XConsortium: context.dat /main/3 1995/07/17 19:56:40 lehors $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
Context.dat defines the state transitions for program PARSER.
*/
}
prlgdecl:prlgdecl,
pdecl:pdecl,
decl:decl,
mapname:mapname,
endmap:endmap,
entname:entname,
entval:entval,
dupent:dupent,
typedentval:typedentval,
typedupent:typedupent,
entend:entend {m_readcomments() ;}
;
m_mdo
prolog:prlgdecl
preamble:pdecl
datacon:decl
elcon:decl
netdatacon:decl
netelcon:decl
poundcdata:decl
netcdata:decl
;
m_mdc
entend:prolog
prlgerror:prolog
prlgdecl:prolog
perror:preamble
pdecl:preamble
endmap:start
decl:start
derror:start
;
m_usemap
decl:mapname
;
m_addmap
decl:amapname {
if (m_conform) m_mberr1("%s not provided in IS 8879",
m_addmap) ;
}
;
m_empty
mapname:endmap {m_setmap(1, TRUE) ;}
amapname:endmap {m_setmap(1, FALSE) ;}
;
m_entkw
prlgdecl:entname
pdecl:perror { m_error("Entities must be defined in helptag.ent"); }
;
m_entst
entval:typedentval {if (m_entity) m_entity->type = M_STARTTAG ;}
dupent:typedupent {m_eduptype(M_STARTTAG) ;}
;
m_entet
entval:typedentval {if (m_entity) m_entity->type = M_ENDTAG ;}
dupent:typedupent {m_eduptype(M_ENDTAG) ;}
;
m_entcdata
entval:typedentval {if (m_entity) m_entity->type = M_CDATAENT ;}
dupent:typedupent {m_eduptype(M_CDATAENT) ;}
;
m_entsdata
entval:typedentval {if (m_entity) m_entity->type = M_SDATA ;}
dupent:typedupent {m_eduptype(M_SDATA) ;}
;
m_entsystem
entval:typedentval {if (m_entity) m_entity->type = M_SYSTEM ;}
dupent:typedupent {m_eduptype(M_SYSTEM) ;}
;
m_entmd
entval:typedentval {if (m_entity) m_entity->type = M_MD ;}
dupent:typedupent {m_eduptype(M_MD) ;}
;
m_entpi
entval:typedentval {if (m_entity) m_entity->type = M_PI ;}
dupent:typedupent {m_eduptype(M_PI) ;}
;
m_stago
datacon:selement,
elcon:selement,
netdatacon:selement,
netelcon:selement,
poundcdata:selement,
netcdata:selement {m_scannet = FALSE ;}
eelement:selement {
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_etcomplete() ;
}
selement:selement {
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_stcomplete() ;
}
attname:selement {
m_stcomplete() ;
}
needvi:selement {
m_attvonly(m_saveatt) ;
m_stcomplete() ;
}
etagend:selement {m_etcomplete() ;}
;
m_etago
elcon:eelement
datacon:eelement
netelcon:eelement
netdatacon:eelement
poundcdata:eelement
netcdata:eelement
cdatael:eelement
rcdatael:eelement
netelcdata:eelement
netrcdata:eelement
eelement:eelement {
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_etcomplete() ;
}
selement:eelement {
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_stcomplete() ;
}
attname:eelement {m_stcomplete() ;}
needvi:eelement {
m_attvonly(m_saveatt) ;
m_stcomplete() ;
}
etagend:eelement {m_etcomplete() ;}
;
m_pio
datacon:procint
elcon:procint
netdatacon:procint
netelcon:procint
selement:procint {
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_stcomplete() ;
}
eelement:procint {
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_etcomplete() ;
}
poundcdata:procint
netcdata:procint
attname:procint {m_stcomplete() ;}
needvi:procint {
m_attvonly(m_saveatt) ;
m_stcomplete() ;
}
etagend:procint {m_etcomplete() ;}
;
m_tagc
eelement:start {
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_stacktop->holdre = FALSE ;
m_etcomplete() ;
}
selement:start {
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_stcomplete() ;
}
attname:start {m_stcomplete() ;}
etagend:start {m_etcomplete() ;}
needvi:start {
m_attvonly(m_saveatt) ;
m_stcomplete() ;
}
;
m_pic
procint:start {
m_pi[m_pilen] = M_EOS ;
m_piaction(m_pi, NULL, M_NULLVAL) ;
m_pilen = 0 ;
}
pierror:start
;
m_vi
needvi:attval {m_findatt() ;}
;
m_lit
attname:litcon
attval:litcon
litcon:litcon
;
m_litdelim
entval:litent,
typedentval:litent,
dupent:dlitent,
typedupent:dlitent {m_entclen = 0 ;}
litent:entend,
elitent:entend {
if (m_entity) {
m_entcontent[m_entclen] = M_EOS ;
m_entity->content =
(M_WCHAR *) m_malloc(m_entclen + 1, "entity content") ;
w_strcpy(m_entity->content, m_entcontent) ;
}
}
dlitent:entend,
edlitent:entend {
m_entcontent[m_entclen] = M_EOS ;
if (w_strcmp(m_entity->content, m_entcontent))
m_err1("Redefinition of entity %s ignored", m_entity->name) ;
}
;
m_lita
attname:litacon
attval:litacon
litacon:litacon
;
m_litadelim
entval:litaent,
typedentval:litaent,
dupent:dlitaent,
typedupent:dlitaent {m_entclen = 0 ;}
litaent:entend,
elitaent:entend {
if (m_entity) {
m_entcontent[m_entclen] = M_EOS ;
m_entity->content =
(M_WCHAR *) m_malloc(m_entclen + 1, "entity content") ;
w_strcpy(m_entity->content, m_entcontent) ;
}
}
dlitaent:entend,
edlitaent:entend {
m_entcontent[m_entclen] = M_EOS ;
if (w_strcmp(m_entity->content, m_entcontent))
m_err1("Redefinition of entity %s ignored", m_entity->name) ;
}
;
m_cro
litcon:litcon
litacon:litacon
poundcdata:poundcdata
netcdata:netcdata
elcon:poundcdata
netelcon:netcdata
rcdatael:rcdatael
netrcdata:netrcdata
;
m_litrs
litcon:litcon
litacon:litacon
poundcdata:poundcdata
netcdata:netcdata
elcon:elcon
netelcon:netelcon
;
m_litscr
litcon:litcon
litacon:litacon
poundcdata:poundcdata
netcdata:netcdata
elcon:elcon
netelcon:netelcon
;
m_litre
litcon:litcon
litacon:litacon
poundcdata:poundcdata
netcdata:netcdata
elcon:elcon
netelcon:netelcon
;
m_litecr
litcon:litcon
litacon:litacon
poundcdata:poundcdata
netcdata:netcdata
elcon:elcon
netelcon:netelcon
;
m_litspace
litcon:litcon
litacon:litacon
poundcdata:poundcdata
netcdata:netcdata
elcon:elcon
netelcon:netelcon
;
m_litcspace
litcon:litcon
litacon:litacon
poundcdata:poundcdata
netcdata:netcdata
elcon:elcon
netelcon:netelcon
;
m_littab
litcon:litcon
litacon:litacon
poundcdata:poundcdata
netcdata:netcdata
elcon:elcon
netelcon:netelcon
;
m_litctab
litcon:litcon
litacon:litacon
poundcdata:poundcdata
netcdata:netcdata
elcon:elcon
netelcon:netelcon
;
m_ero
rcdatael:rcdatael
netrcdata:netrcdata
poundcdata:poundcdata
netcdata:netcdata
datacon:datacon
elcon:elcon
netdatacon:netdatacon
netelcon:netelcon
prolog:prolog
preamble:preamble
litcon:litcon
litacon:litacon
entinlit:entinlit
;
m_refc
entref:entref
;
m_net
netdatacon:start,
netelcon:start,
netcdata:start,
netelcdata:start,
netrcdata:start {m_nullendtag() ;}
selement:start {
m_scannet = TRUE ;
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_stcomplete() ;
}
attname:start {
m_scannet = TRUE ;
m_stcomplete() ;
}
needvi:start {
m_scannet = TRUE ;
m_attvonly(m_saveatt) ;
m_stcomplete() ;
}
;
m_endfile
datacon:datacon
elcon:elcon
netdatacon:netdatacon
netelcon:netelcon
poundcdata:poundcdata
netcdata:netcdata
prolog:prolog
preamble:preamble {
m_startdoc() ;
if (! m_state[2].final) m_error("Empty document") ;
}
rcdatael:rcdatael
netrcdata:netrcdata
rcnewent:rcnewent
cdatael:cdatael
netelcdata:netelcdata
eelement:start {
if (! m_wholetag)
m_mberr1("Missing %s in end-tag", m_tagc) ;
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_stacktop->holdre = FALSE ;
m_etcomplete() ;
}
selement:start {
if (! m_wholetag)
m_mberr1("Missing %s in start-tag", m_tagc) ;
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_stcomplete() ;
}
attname:start {
if (! m_wholetag)
m_mberr1("Invalid parameter or missing %s", m_tagc) ;
m_stcomplete() ;
}
etagend:start {
if (! m_wholetag)
m_mberr1("Missing %s delimiter in end-tag", m_tagc) ;
m_etcomplete() ;
}
needvi:start {
if (! m_wholetag)
m_mberr1("Invalid parameter or missing %s", m_tagc) ;
m_attvonly(m_saveatt) ;
m_stcomplete() ;
}
attval:start {
if (! m_wholetag)
m_mberr1("Invalid parameter or missing %s", m_tagc) ;
m_err1("Expecting value for %s",
&m_pname[m_parameter[m_ppsave - 1].paramname]) ;
m_stcomplete() ;
}
;
m_name
mapname:endmap {m_ckmap(m_name, TRUE) ;}
amapname:endmap {m_ckmap(m_name, FALSE) ;}
entname:entval {
m_ntrent(m_name) ;
if (! m_entity) m_curcon = PRLGERROR ;
}
selement:attname {
{
int i ;
if (m_scanel = m_eltname()) {
for (i = 0 ; i < m_element[m_scanel - 1].parcount ; i++)
m_poccur[i] = 0 ;
}
else m_curcon = START ;
}
}
eelement:etagend {
if (m_scanel = m_eltname()) m_stacktop->holdre = FALSE ;
else
if (m_element[m_stacktop->element - 1].content == M_CDATA ||
m_element[m_stacktop->element - 1].content == M_RCDATA) {
m_ckend(m_stacktop->element, FALSE) ;
m_curcon = START ;
}
else m_curcon = START ;
}
attname:needvi {if (m_validinpar(m_name))
w_strcpy(m_saveatt, m_name) ;}
attval:attname {m_attval(m_name) ;}
needvi:needvi {
m_attvonly(m_saveatt) ;
if (m_validinpar(m_name))
w_strcpy(m_saveatt, m_name) ;
}
;
m_text
litcon:litcon
litacon:litacon
entinlit:entinlit
litent:litent {m_longent(ELITENT) ;}
litaent:litaent {m_longent(ELITAENT) ;}
dlitent:dlitent {m_longent(EDLITENT) ;}
dlitaent:dlitaent {m_longent(EDLITAENT) ;}
elitent:elitent
elitaent:elitaent
edlitent:edlitent
edlitaent:edlitaent
prlgerror:prlgerror
perror:perror
derror:derror
prlgdecl:prlgerror,
pdecl:perror,
decl:derror {m_error("Invalid markup declaration") ;}
rcdatael:rcdatael,
netrcdata:netrcdata,
rcnewent:rcnewent,
cdatael:cdatael,
netelcdata:netelcdata,
poundcdata:poundcdata,
netcdata:netcdata {m_textaction(m_scanval) ;}
procint:procint {
m_pi[m_pilen++] = m_scanval ;
if (m_pilen > M_PILEN) {
m_error("Processing instruction too long") ;
m_pi[m_pilen - 1] = M_EOS ;
m_piaction(m_pi, NULL, M_NULLVAL) ;
m_curcon = PIERROR ;
m_pilen = 0 ;
}
}
pierror:pierror
datacon:poundcdata,
netdatacon:netcdata {m_strtcdata(m_scanval) ;}
;
m_blackspace
elcon:poundcdata,
netelcon:netcdata {m_strtcdata(m_scanval) ;}
preamble:start {
m_ungetachar((int) m_scanval, M_NORMAL, TRUE) ;
m_startdoc() ;
}
prolog:prlgerror
{
m_error("Only entities and comments are allowed in helptag.ent");
}
prlgerror:prlgerror
amapname:derror,
mapname:derror,
endmap:derror {m_error("Invalid usemap declaration") ;}
typedentval:prlgerror,
entname:prlgerror,
entval:prlgerror,
typedupent:prlgerror,
dupent:prlgerror
{
m_error("Invalid ENTITY declaration") ;
if (m_entity)
{
m_entcontent[m_entclen] = M_EOS ;
m_entity->content =
(M_WCHAR *) m_malloc(m_entclen + 1, "entity content") ;
w_strcpy(m_entity->content, m_entcontent) ;
}
}
entend:prlgerror
{
m_error("Unexpected characters within ENTITY declaration") ;
if (m_entity)
{
m_entcontent[m_entclen] = M_EOS ;
m_entity->content =
(M_WCHAR *) m_malloc(m_entclen + 1, "entity content") ;
w_strcpy(m_entity->content, m_entcontent) ;
}
}
selement:poundcdata {
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_strtcdata(m_scanval) ;
}
eelement:poundcdata {
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_etcomplete() ;
m_strtcdata(m_scanval) ;
}
;
m_literal
attname:attname {m_attvonly(m_literal) ;}
attval:attname {m_attval(m_literal) ;}
;
m_entityend
eelement:start {
if (! m_wholetag)
m_mberr1("Missing %s in entity containing end-tag", m_tagc) ;
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_stacktop->holdre = FALSE ;
m_etcomplete() ;
}
selement:start {
if (! m_wholetag)
m_mberr1("Missing %s in entity containing start-tag", m_tagc) ;
if (! m_stacktop->oldtop)
m_scanel = m_arc[m_state[0].first - 1].label ;
else m_scanel = m_stacktop->element ;
m_stcomplete() ;
}
attname:start {
if (! m_wholetag)
m_mberr1(
"Invalid parameter or missing %s in entity containing start-tag",
m_tagc) ;
m_stcomplete() ;
}
etagend:start {
if (! m_wholetag)
m_mberr1("Missing %s in entity containing end-tag", m_tagc) ;
m_etcomplete() ;
}
needvi:start {
if (! m_wholetag)
m_mberr1(
"Invalid parameter or missing %s in entity containing start-tag",
m_tagc) ;
m_attvonly(m_saveatt) ;
m_stcomplete() ;
}
attval:start {
if (! m_wholetag)
m_mberr1(
"Invalid parameter or missing %s in entity containing start-tag",
m_tagc) ;
m_err1("Expecting value for %s",
&m_pname[m_parameter[m_ppsave - 1].paramname]) ;
m_stcomplete() ;
}
;

View File

@@ -0,0 +1,57 @@
/* $XConsortium: cyclent.c /main/3 1995/11/08 09:34:52 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
/* Cyclent.c contains procedure m_cyclent(), callable by interface
designers, to cycle through all defined entities, returning information
about them */
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
#include "entext.h"
#if defined(M_PROTO)
M_WCHAR *m_cyclent(LOGICAL init, unsigned char *type, M_WCHAR **content, unsigned char *wheredef)
#else
M_WCHAR *m_cyclent(init, type, content, wheredef)
LOGICAL init ;
unsigned char *type ;
M_WCHAR **content ;
unsigned char *wheredef ;
#endif
{
static M_TRIE *current ;
static M_TRIE *ancestor[M_NAMELEN + 1] ;
static length = 0 ;
static M_WCHAR name[M_NAMELEN + 1] ;
if (init) {
current = m_enttrie->data ;
length = 0 ;
}
if (length < 0) return(NULL) ;
while (current->symbol) {
ancestor[length] = current ;
name[length++] = current->symbol ;
current = current->data ;
}
name[length] = M_EOS ;
*type = ((M_ENTITY *) current->data)->type ;
*content = ((M_ENTITY *) current->data)->content ;
*wheredef = ((M_ENTITY *) current->data)->wheredef ;
while (length >= 0) {
if (current->next) {
current = current->next ;
break ;
}
length-- ;
if (length < 0) break ;
current = ancestor[length] ;
}
return(name) ;
}

View File

@@ -0,0 +1,23 @@
/* $XConsortium: dcurelt.c /main/3 1995/11/08 09:35:06 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
#include "userinc.h"
#include "globdec.h"
/* Displays current element after some error messages */
void m_dispcurelt(file, line)
M_WCHAR *file ;
int line ;
{
char *mb_parent;
m_errline("Current element is ") ;
mb_parent = MakeMByteString(m_parent(0));
m_errline(mb_parent) ;
m_free(mb_parent,"multi-byte string");
m_errline(" begun on ") ;
m_dumpline(file, line) ;
m_errline(".\n") ;
}

View File

@@ -0,0 +1,39 @@
/* $XConsortium: delfree.c /main/3 1995/11/08 09:35:18 rswiston $ */
/* Copyright (c) 1988 Hewlett-Packard Co. */
/* Versions of m_free and m_malloc for debugging. */
/**/
#include <malloc.h>
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtd.h"
#include "parser.h"
m_free(block, msg)
char *block ;
char *msg ;
{
free(block) ;
fprintf(m_outfile, "%5u:%5u- Freed %s\n",
(unsigned int) ((unsigned long) block >> 16),
(unsigned int) block, msg) ;
}
char *m_mallocx(size, msg)
int size ;
char *msg ;
{
char *p ;
if (! size) return(NULL) ;
p = malloc(size) ;
if (! p) {
m_err1("Unable to allocate space for %s", msg) ;
exit(TRUE) ;
}
fprintf(m_outfile, "%5u:%5u- Allocated %s\n",
(unsigned int) ((unsigned long) p >> 16), (unsigned int) p, msg) ;
return(p) ;
}

View File

@@ -0,0 +1,28 @@
/* $XConsortium: dmpline.c /main/3 1995/11/08 09:35:33 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
#include "userinc.h"
#include "globdec.h"
/* Write input file and line number for an error message */
void m_dumpline(file, line)
M_WCHAR *file ;
int line ;
{
char buffer[10] ;
m_errline("Line ") ;
sprintf(buffer, "%d", line) ;
m_errline(buffer) ;
if (file)
{
char mb_file;
m_errline(" of File ") ;
mb_file = MakeMByteString(file);
m_errline(mb_file) ;
m_free(mb_file,"multi-byte string");
}
}

View File

@@ -0,0 +1,23 @@
/* $XConsortium: end.c /main/3 1995/11/08 09:35:47 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* End.c executes end-code specified in the interface. */
#include "userinc.h"
#include "globdec.h"
/* Include generated file */
#include "efile.c"
/* Perform the m_action-th end-code in the interface */
void m_endcase(m_action)
int m_action ;
{
(*m_etable[m_action])() ;
}

View File

@@ -0,0 +1,95 @@
/* $XConsortium: entity.c /main/3 1995/11/08 09:35:59 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Entity.c contains procedures pertaining to entities */
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "basic.h"
#include "trie.h"
#include "context.h"
#include "dtdext.h"
#include "parser.h"
#include "entext.h"
/* Process the name in a usemap delaration */
#if defined(M_PROTO)
void m_ckmap(M_WCHAR *name, LOGICAL useoradd)
#else
void m_ckmap(name, useoradd)
M_WCHAR *name ;
LOGICAL useoradd ;
#endif
{
int mapid ;
if (mapid = m_packedlook(m_maptree, name))
m_setmap(mapid + 1, useoradd) ;
else m_err1("Undefined short reference map %s", name) ;
}
/* Check type specified in entity declaration for previously defined
entity. Testing to see if the new declaration is identical to the
original one. */
void m_eduptype(type)
int type ;
{
if ((int) m_entity->type != type) {
m_err1("Redefinition of entity %s ignored", m_entity->name) ;
m_entity = NULL ;
m_curcon = TYPEDENTVAL ;
}
}
/* Tests if an entity is too long */
void m_longent(context)
int context ;
{
if (m_entclen >= M_LITLEN) {
m_curcon = context ;
m_error("Entity content too long") ;
}
else m_entcontent[m_entclen++] = m_scanval ;
}
/* Enters an entity name into the entity name tree */
void m_ntrent(p)
M_WCHAR *p ;
{
M_ENTITY *new ;
new = (M_ENTITY *) m_malloc(sizeof(M_ENTITY), "entity") ;
if (m_entity = (M_ENTITY *) m_ntrtrie(p, m_enttrie, (M_TRIE *) new)) {
m_free(new, "entity") ;
if (m_entity->wheredef == M_DPARSER) {
if (m_entdupchk) {
m_err1("Redefinition of entity %s ignored", p) ;
m_entity = NULL ;
}
else m_curcon = DUPENT ;
}
else {
if (m_entity->content) {
m_err1("Warning: Redefinition of predefined entity %s", p) ;
m_entity->type = M_GENERAL ;
m_entity->content = NULL ;
}
m_entity->wheredef = M_DPARSER ;
}
return ;
}
m_entity = new ;
m_entity->type = M_GENERAL ;
m_entity->wheredef = M_DPARSER ;
m_entity->content = NULL ;
m_entity->name = (M_WCHAR *) m_malloc(w_strlen(p) + 1, "entity name") ;
w_strcpy(m_entity->name, p) ;
}

View File

@@ -0,0 +1,14 @@
/* $XConsortium: eprefix.c /main/3 1995/11/08 09:36:12 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
#include "userinc.h"
#include "globdec.h"
/* Write error message prefix */
void m_eprefix(M_NOPAR)
{
m_errline("\n*****\n") ;
}

View File

@@ -0,0 +1,20 @@
/* $XConsortium: errline.c /main/3 1995/11/08 09:36:25 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
#include "userinc.h"
#include "globdec.h"
/* Process error message text */
void m_errline(p)
M_WCHAR *p ;
{
char mb_p;
mb_p = MakeMByteString(p);
fputs(mb_p, m_errfile) ;
fputs(mb_p, stderr) ;
m_free(mb_p,"multi-byte string");
}

View File

@@ -0,0 +1,466 @@
/* $XConsortium: error.c /main/3 1995/11/08 09:36:38 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Util.c contains general utilities for program PARSER */
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
#include "entext.h"
/* Issue error message (no arguments) */
void m_error(text)
char *text;
{
m_startmsg();
m_errline(text);
m_esuffix();
}
/* Issue error message (one argument) */
#if defined(M_PROTO)
void m_err1(
const char *text,
const M_WCHAR *arg)
#else
void m_err1(text, arg)
char *text;
M_WCHAR *arg;
#endif
{
char *buffer, *mb_arg;
m_startmsg();
/* Subtract 2 characters for the %s and add an EOS*/
mb_arg = MakeMByteString(arg);
buffer = (char *)
m_malloc(strlen(text) + strlen(mb_arg) - 2 + 1, "error message");
sprintf(buffer, text, mb_arg);
m_errline(buffer);
m_free(buffer, "error message");
m_free(mb_arg,"multi-byte string");
m_esuffix();
}
#if defined(M_PROTO)
void m_mberr1(
const char *text,
const char *arg)
#else
void m_err1(text, arg)
char *text;
char *arg;
#endif
{
M_WCHAR *wc_arg;
wc_arg = MakeWideCharString(arg);
m_err1(text, wc_arg);
m_free(wc_arg,"wide character string");
}
/* Issue error message (two arguments) */
#if defined(M_PROTO)
void m_err2(
const char *text,
const M_WCHAR *arg1,
const M_WCHAR *arg2)
#else
void m_err2(text, arg1, arg2)
char *text;
M_WCHAR *arg1;
M_WCHAR *arg2;
#endif
{
char *buffer;
char *mb_arg1,*mb_arg2;
m_startmsg();
/* Subtract 2 characters for each of 2 %s's and add an EOS*/
mb_arg1 = MakeMByteString(arg1);
mb_arg2 = MakeMByteString(arg2);
buffer = (char *) m_malloc(
strlen(text) + strlen(mb_arg1) + strlen(mb_arg2) - 4 + 1,
"error message");
sprintf(buffer, text, mb_arg1, mb_arg2);
m_errline(buffer);
m_free(buffer, "error message");
m_free(mb_arg1,"multi-byte string");
m_free(mb_arg2,"multi-byte string");
m_esuffix();
}
/* Issue error message (three arguments) */
#if defined(M_PROTO)
void m_err3(
char *text,
M_WCHAR *arg1,
M_WCHAR *arg2,
M_WCHAR *arg3)
#else
void m_err3(text, arg1, arg2, arg3)
char *text;
M_WCHAR *arg1;
M_WCHAR *arg2;
M_WCHAR *arg3;
#endif
{
char *buffer;
char *mb_arg1, *mb_arg2, *mb_arg3;
m_startmsg();
/* Subtract 2 characters for each of 3 %s's and add an EOS*/
mb_arg1 = MakeMByteString(arg1);
mb_arg2 = MakeMByteString(arg2);
mb_arg3 = MakeMByteString(arg3);
buffer = (char *) m_malloc(
strlen(text) +
strlen(mb_arg1) +
strlen(mb_arg2) +
strlen(mb_arg3) - 6 + 1,
"error message");
sprintf(buffer, text, mb_arg1, mb_arg2, mb_arg3);
m_errline(buffer);
m_free(buffer, "error message");
m_free(mb_arg1,"multi-byte string");
m_free(mb_arg2,"multi-byte string");
m_free(mb_arg3,"multi-byte string");
m_esuffix();
}
/* Issue error message (four arguments) */
#if defined(M_PROTO)
void m_err4(
char *text,
M_WCHAR *arg1,
M_WCHAR *arg2,
M_WCHAR *arg3,
M_WCHAR *arg4)
#else
void m_err4(text, arg1, arg2, arg3, arg4)
char *text;
M_WCHAR *arg1;
M_WCHAR *arg2;
M_WCHAR *arg3;
M_WCHAR *arg4;
#endif
{
char *buffer;
char *mb_arg1, *mb_arg2,*mb_arg3,*mb_arg4;
m_startmsg();
/* Subtract 2 characters for each of 4 %s's and add an EOS*/
mb_arg1 = MakeMByteString(arg1);
mb_arg2 = MakeMByteString(arg2);
mb_arg3 = MakeMByteString(arg3);
mb_arg4 = MakeMByteString(arg4);
buffer = (char *) m_malloc(
strlen(text) +
strlen(mb_arg1) +
strlen(mb_arg2) +
strlen(mb_arg3) +
strlen(mb_arg4) - 8 + 1,
"error message");
sprintf(buffer, text, arg1, arg2, arg3, arg4);
m_errline(buffer);
m_free(buffer, "error message");
m_free(mb_arg1,"multi-byte string");
m_free(mb_arg2,"multi-byte string");
m_free(mb_arg3,"multi-byte string");
m_free(mb_arg4,"multi-byte string");
m_esuffix();
}
/* Issue error message (five arguments) */
#if defined(M_PROTO)
void m_err5(
char *text,
M_WCHAR *arg1,
M_WCHAR *arg2,
M_WCHAR *arg3,
M_WCHAR *arg4,
M_WCHAR *arg5)
#else
void m_err5(text, arg1, arg2, arg3, arg4, arg5)
char *text;
M_WCHAR *arg1;
M_WCHAR *arg2;
M_WCHAR *arg3;
M_WCHAR *arg4;
M_WCHAR *arg5;
#endif
{
char *buffer;
char *mb_arg1, *mb_arg2, *mb_arg3, *mb_arg4, *mb_arg5;
m_startmsg();
/* Subtract 2 characters for each of 5 %s's and add an EOS*/
mb_arg1 = MakeMByteString(arg1);
mb_arg2 = MakeMByteString(arg2);
mb_arg3 = MakeMByteString(arg3);
mb_arg4 = MakeMByteString(arg4);
mb_arg5 = MakeMByteString(arg5);
buffer = (char *) m_malloc(
strlen(text) +
strlen(mb_arg1) +
strlen(mb_arg2) +
strlen(mb_arg3) +
strlen(mb_arg4) +
strlen(mb_arg5) - 10 + 1,
"error message");
sprintf(buffer,
text,
mb_arg1,
mb_arg2,
mb_arg3,
mb_arg4,
mb_arg5);
m_errline(buffer);
m_free(buffer, "error message");
m_free(mb_arg1,"multi-byte string");
m_free(mb_arg2,"multi-byte string");
m_free(mb_arg3,"multi-byte string");
m_free(mb_arg4,"multi-byte string");
m_free(mb_arg5,"multi-byte string");
m_esuffix();
}
/* Issue error message (six arguments) */
#if defined(M_PROTO)
void m_err6(
char *text,
M_WCHAR *arg1,
M_WCHAR *arg2,
M_WCHAR *arg3,
M_WCHAR *arg4,
M_WCHAR *arg5,
M_WCHAR *arg6)
#else
void m_err6(text, arg1, arg2, arg3, arg4, arg5, arg6)
char *text;
M_WCHAR *arg1;
M_WCHAR *arg2;
M_WCHAR *arg3;
M_WCHAR *arg4;
M_WCHAR *arg5;
M_WCHAR *arg6;
#endif
{
char *buffer;
char *mb_arg1, *mb_arg2, *mb_arg3, *mb_arg4, *mb_arg5, *mb_arg6;
m_startmsg();
/* Subtract 2 characters for each of 6 %s's and add an EOS*/
mb_arg1 = MakeMByteString(arg1);
mb_arg2 = MakeMByteString(arg2);
mb_arg3 = MakeMByteString(arg3);
mb_arg4 = MakeMByteString(arg4);
mb_arg5 = MakeMByteString(arg5);
mb_arg6 = MakeMByteString(arg6);
buffer = (char *) m_malloc(
strlen(text) +
strlen(mb_arg1) +
strlen(mb_arg2) +
strlen(mb_arg3) +
strlen(mb_arg4) +
strlen(mb_arg5) +
strlen(mb_arg6) - 12 + 1,
"error message");
sprintf(buffer,
text,
mb_arg1,
mb_arg2,
mb_arg3,
mb_arg4,
mb_arg5,
mb_arg6);
m_errline(buffer);
m_free(buffer, "error message");
m_free(mb_arg1,"multi-byte string");
m_free(mb_arg2,"multi-byte string");
m_free(mb_arg3,"multi-byte string");
m_free(mb_arg4,"multi-byte string");
m_free(mb_arg5,"multi-byte string");
m_free(mb_arg6,"multi-byte string");
m_esuffix();
}
/* Issue error message (seven arguments) */
#if defined(M_PROTO)
void m_err7(
char *text,
M_WCHAR *arg1,
M_WCHAR *arg2,
M_WCHAR *arg3,
M_WCHAR *arg4,
M_WCHAR *arg5,
M_WCHAR *arg6,
M_WCHAR *arg7)
#else
void m_err7(text, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
char *text;
M_WCHAR *arg1;
M_WCHAR *arg2;
M_WCHAR *arg3;
M_WCHAR *arg4;
M_WCHAR *arg5;
M_WCHAR *arg6;
M_WCHAR *arg7;
#endif
{
char *buffer;
char *mb_arg1, *mb_arg2, *mb_arg3, *mb_arg4, *mb_arg5, *mb_arg6, *mb_arg7;
m_startmsg();
/* Subtract 2 characters for each of 7 %s's and add an EOS*/
mb_arg1 = MakeMByteString(arg1);
mb_arg2 = MakeMByteString(arg2);
mb_arg3 = MakeMByteString(arg3);
mb_arg4 = MakeMByteString(arg4);
mb_arg5 = MakeMByteString(arg5);
mb_arg6 = MakeMByteString(arg6);
mb_arg7 = MakeMByteString(arg7);
buffer = (char *) m_malloc(
strlen(text) +
strlen(mb_arg1) +
strlen(mb_arg2) +
strlen(mb_arg3) +
strlen(mb_arg4) +
strlen(mb_arg5) +
strlen(mb_arg6) +
strlen(mb_arg7) - 14 + 1,
"error message");
sprintf(buffer,
text,
mb_arg1,
mb_arg2,
mb_arg3,
mb_arg4,
mb_arg5,
mb_arg6,
mb_arg7);
m_errline(buffer);
m_free(buffer, "error message");
m_free(mb_arg1,"multi-byte string");
m_free(mb_arg2,"multi-byte string");
m_free(mb_arg3,"multi-byte string");
m_free(mb_arg4,"multi-byte string");
m_free(mb_arg5,"multi-byte string");
m_free(mb_arg6,"multi-byte string");
m_free(mb_arg7,"multi-byte string");
m_esuffix();
}
/* Getline.c returns the name of the current input file and the number
of the current line */
void m_getline(file, line)
M_WCHAR **file;
int *line;
{
int i;
if (m_sysecnt) {
for (i = m_eopencnt ; i ; i--)
if (m_opene[i - 1]->type == M_SYSTEM) break;
*file = m_opene[i - 1]->content;
}
else *file = NULL;
*line = m_line[m_sysecnt];
}
/* Dump last characters read from input stream to give context to
an error message */
void m_lastchars(M_NOPAR)
{
int i;
M_WCHAR buffer[2];
buffer[1] = M_EOS;
if (m_svlnwrap[m_sysecnt] || m_svlncnt[m_sysecnt])
m_errline("...");
if (m_svlnwrap[m_sysecnt])
for (i = m_svlncnt[m_sysecnt] ; i < M_LINELENGTH ; i++)
{
char *mb_buffer;
buffer[0] = (M_WCHAR) m_saveline[i][m_sysecnt];
if (buffer[0] == (M_WCHAR) -1)
{
m_errline("\n");
}
else
{
mb_buffer = MakeMByteString(buffer);
m_errline(mb_buffer);
m_free(mb_buffer,"multi-byte string");
}
}
for (i = 0 ; i < m_svlncnt[m_sysecnt] ; i++)
{
char *mb_buffer;
buffer[0] = (M_WCHAR) m_saveline[i][m_sysecnt];
if (buffer[0] == (M_WCHAR) -1)
{
m_errline("\n");
}
else
{
mb_buffer = MakeMByteString(buffer);
m_errline(mb_buffer);
m_free(mb_buffer,"multi-byte string");
}
}
if ((m_svlncnt[m_sysecnt] &&
m_saveline[m_svlncnt[m_sysecnt] - 1][m_sysecnt] != M_RE) ||
(! m_svlncnt[m_sysecnt] && m_svlnwrap[m_sysecnt] &&
m_saveline[M_LINELENGTH - 1][m_sysecnt] != M_RE)
) m_errline("...\n");
}
/* Display information about the current element */
void m_showcurelt(M_NOPAR)
{
if (m_stacktop->oldtop)
m_dispcurelt(m_stacktop->file, m_stacktop->line);
}
/* Start an error message */
void m_startmsg(M_NOPAR)
{
m_eprefix();
m_errexit = TRUE;
}
/* Return the name of the current input file (most recently opened, but
unclosed SYSTEM entity) */
M_WCHAR *m_thisfile(M_NOPAR)
{
int i;
if (m_sysecnt) {
for (i = m_eopencnt ; i ; i--)
if (m_opene[i - 1]->type == M_SYSTEM)
return(m_opene[i - 1]->content);
}
return(NULL);
}
/* Return the line number in the current input file */
int m_thisline(M_NOPAR)
{
return(m_line[m_sysecnt]);
}

View File

@@ -0,0 +1,24 @@
/* $XConsortium: esuffix.c /main/3 1995/11/08 09:36:52 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
#include "userinc.h"
#include "globdec.h"
#if defined(MSDOS)
#include <process.h>
#endif
/* Write error message suffix */
void m_esuffix(M_NOPAR)
{
m_errline("\n") ;
m_dumpline(m_thisfile(), m_thisline()) ;
m_errline(":\n") ;
m_lastchars() ;
if (++m_errcnt == m_errlim) {
m_error("Too many errors, processing stopped") ;
m_exit(TRUE) ;
}
}

View File

@@ -0,0 +1,19 @@
/* $XConsortium: exit.c /main/3 1995/11/08 09:37:05 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
#include "userinc.h"
#include "globdec.h"
#if defined(MSDOS)
#include <process.h>
#endif
/* Default version of PARSER m_exit(). Allows interface control if
internal error causes PARSER to halt. */
void m_exit(status)
int status ;
{
exit(status) ;
}

View File

@@ -0,0 +1,77 @@
/* $XConsortium: findpar.c /main/3 1995/11/08 09:37:18 rswiston $ */
/*
Copyright 1989 Hewlett-Packard Co.
*/
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
/* Function callable by interface designers. Returns index in parameter
list of a specified parameter for an element (i.e., 1 for first parameter
specified in the DTD, 2 for second, etc.). First parameter, elt, is
the name of the element. Second parameter is the name of the parameter
or NULL. Third parameter is used only if second parameter is NULL. In
the latter case, function returns first keyword parameter, if any, for
which the specified value is a legal value and otherwise first
Returns 0 if elt is not a valid element name, if param is specified
but is not a valid parameter name, or if param is NULL and value is
not a valid value of any of elt's parameters. */
#if defined(M_PROTO)
int m_findpar( const char *elt , const char *param , const M_WCHAR *value )
#else
int m_findpar(elt, param, value)
char *elt ;
char *param ;
M_WCHAR *value ;
#endif /* M_PROTO */
{
M_ELEMENT eltid ;
int par ;
int i ;
M_WCHAR *wc_elt;
wc_elt = MakeWideCharString(elt);
if (! (eltid = m_packedlook(m_entree, wc_elt)))
{
m_free(wc_elt,"wide character string");
return(M_NULLVAL) ;
}
m_free(wc_elt,"wide character string");
/* A parameter name specified */
if (param)
{
for (par = m_element[eltid - 1].parptr, i = 1 ;
i <= m_element[eltid - 1].parcount ;
par++, i++)
if (!m_wcmbupstrcmp(&m_pname[m_parameter[par - 1].paramname], param))
return(i) ;
return(M_NULLVAL) ;
}
/* No parameter name specified */
/* First check is it a valid keyword? */
for (par = m_element[eltid - 1].parptr, i = 1 ;
i <= m_element[eltid - 1].parcount ;
par++, i++)
if (m_parameter[par - 1].type == M_KEYWORD)
if (m_partype(par, value)) return(i) ;
/* It wasn't a keyword. Check for valid value for some other parameter.*/
for (par = m_element[eltid - 1].parptr, i = 1 ;
i <= m_element[eltid - 1].parcount ;
par++, i++)
{
if (m_parameter[par - 1].type == M_KEYWORD) continue ;
if (m_partype(par, value)) return(i) ;
}
/* Not a valid value for any parameter */
return(M_NULLVAL) ;
}

View File

@@ -0,0 +1,13 @@
/* $XConsortium: getc.c /main/3 1995/11/08 09:37:33 rswiston $ */
/* Copyright 1988, 1989 Hewlett-Packard Co. */
/* Default get-char procedure */
#include "userinc.h"
#include "globdec.h"
int m_getc(m_ptr)
void *m_ptr ;
{
return(getc((FILE*) m_ptr)) ;
}

View File

@@ -0,0 +1,20 @@
/* $XConsortium: getsign.c /main/3 1995/11/08 09:37:47 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
/* Issue interface-generated sign-on message */
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
#include "signonx.h"
void m_getsignon(M_NOPAR)
{
m_errline(m_signon) ;
}

View File

@@ -0,0 +1,49 @@
/* $XConsortium: ifdata.c /main/3 1995/11/08 09:38:00 rswiston $ */
/* Copyright 1988, 1989 Hewlett-Packard Co. */
/* Ifdata.c contains functions used by the interface to access the
single item of interface-determined data stored on the parse stack. */
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
/* Retrieve the interface data stored with the current element's nth parent */
void *m_getdata(n, flag)
int n ;
LOGICAL *flag ;
{
M_PARSE *stackptr ;
for (stackptr = m_stacktop ;
stackptr->oldtop && n >= 0 ;
stackptr = stackptr->oldtop, n--) {
if (! n) {
*flag = TRUE ;
return(stackptr->ifdata) ;
}
}
*flag = FALSE ;
return(NULL) ;
}
/* Store interface data for the current element's nth parent */
LOGICAL m_putdata(data, n)
void *data ;
int n ;
{
M_PARSE *stackptr ;
for (stackptr = m_stacktop ;
stackptr->oldtop && n >= 0 ;
stackptr = stackptr->oldtop, n--) {
if (! n) {
stackptr->ifdata = data ;
return(TRUE) ;
}
}
return(FALSE) ;
}

View File

@@ -0,0 +1,140 @@
/* $XConsortium: input.c /main/3 1995/11/08 09:38:12 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Input.c contains procedures that deal with the interface between the
scanner and parser for PARSER */
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "delim.h"
#include "context.h"
#include "parser.h"
/* M_etcomplete is called when a complete end-tag has been read */
void m_etcomplete(M_NOPAR)
{
if (! m_scanel) {
M_WCHAR *wc_etago, *wc_tagc;
wc_etago = MakeWideCharString(m_etago);
wc_tagc = MakeWideCharString(m_tagc);
m_err3("%s%s%s ignored: element undefined", wc_etago, m_name, wc_tagc) ;
m_free(wc_etago,"multi-byte string");
m_free(wc_tagc,"multi-byte string");
}
else
if (! m_ckend(m_scanel, FALSE)) {
m_err1("End tag for %s unexpected", m_nameofelt(m_scanel)) ;
m_expecting() ;
m_showcurelt() ;
if (m_element[m_stacktop->element - 1].content == M_CDATA ||
m_element[m_stacktop->element - 1].content == M_RCDATA)
m_ckend(m_stacktop->element, FALSE) ;
m_frcend(m_scanel) ;
}
}
/* M_frcend is called after a syntax error to end element VAL even
if more content for that element is expected */
void m_frcend(val)
M_ELEMENT val ;
{
M_PARSE *stackptr ;
M_ELEMENT poppedval ;
for (stackptr = m_stacktop ;
stackptr->oldtop && stackptr->element != val ;
stackptr = stackptr->oldtop) ;
if (! stackptr->oldtop) {
m_err1("No %s element currently opened", m_nameofelt(val)) ;
if (m_stacktop->oldtop)
if (m_element[m_stacktop->element].content == M_CDATA ||
m_element[m_stacktop->element].content == M_RCDATA)
m_ckend(m_stacktop->element, FALSE) ;
return ;
}
while (TRUE) {
poppedval = m_stacktop->element ;
m_endaction(m_stacktop->element) ;
m_pop() ;
if (poppedval == val) return ;
}
}
/* M_frcstart is called to force the start of an element when that element
cannot legally occur in the current context but does appear in the text*/
void m_frcstart(M_NOPAR)
{
m_push(m_scanel, m_element[m_scanel - 1].start, m_scannet) ;
if (m_scannet) m_netlevel++ ;
m_stacktop->contextual = FALSE ;
m_stkparams() ;
if (m_element[m_scanel - 1].content == M_CDATA ||
m_element[m_scanel - 1].content == M_RCDATA) {
m_stacktop->intext = TRUE ;
m_curcon = m_element[m_scanel - 1].content == M_CDATA ?
CDATAEL : RCDATAEL ;
m_stacktop->thisent = m_eopencnt ;
}
}
/* M_holdproc processes a RE that was saved to test if it was the last
RE in an element's content */
void m_holdproc(M_NOPAR)
{
if (m_stacktop->holdre) {
m_stacktop->holdre = FALSE ;
if (m_stacktop->intext) m_textaction(M_RE) ;
else {
m_strtcdata((int) M_RE) ;
if (m_curcon == NETDATACON) m_curcon = NETCDATA ;
else if (m_curcon == DATACON) m_curcon = POUNDCDATA ;
}
}
}
/* M_stcomplete is called when a complete start tag has been recognized */
void m_stcomplete(M_NOPAR)
{
if (! m_scanel) return ;
if (m_strtproc(m_scanel))
m_stkparams() ;
else {
if (m_stacktop->holdre) m_holdproc() ;
/* M_strtproc should not return TRUE as long as #PCDATA is considered
optional, but this code should work if the standard is changed */
if (m_strtproc(m_scanel)) m_stkparams() ;
else {
if (m_stacktop->oldtop) {
m_err2("%s not allowed at this point in %s",
m_nameofelt(m_scanel),
m_nameofelt(m_stacktop->element)) ;
m_expecting() ;
m_showcurelt() ;
}
else if (! m_start) {
M_WCHAR *wc_stago, *wc_tagc;
wc_stago = MakeWideCharString(m_stago);
wc_tagc = MakeWideCharString(m_tagc);
m_err6("Expecting %s%s%s instead of %s%s%s to start document",
wc_stago,
m_nameofelt(1),
wc_tagc,
wc_stago,
m_nameofelt(m_scanel),
wc_tagc) ;
m_free(wc_stago,"multi-byte string");
m_free(wc_tagc,"multi-byte string");
}
m_frcstart() ;
}
}
if (m_element[m_scanel - 1].content == M_NONE) m_endtag(m_scanel) ;
}

View File

@@ -0,0 +1,39 @@
/* $XConsortium: level.c /main/3 1995/11/08 09:38:25 rswiston $ */
/*
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
/* Procedure callable by interface designer. Returns number of occurrences
of element on parse stack */
int m_level(elt)
M_WCHAR *elt ;
{
int i = 0 ;
M_PARSE *stackptr ;
for (stackptr = m_stacktop ;
stackptr->oldtop ;
stackptr = stackptr->oldtop) {
if (! m_wcupstrcmp(elt, m_nameofelt(stackptr->element))) i++ ;
}
return(i) ;
}
int m_mblevel(elt)
char *elt ;
{
int retval;
M_WCHAR *wc_elt;
wc_elt = MakeWideCharString(elt);
retval = m_level(wc_elt);
m_free(wc_elt,"wide character string");
return(retval);
}

View File

@@ -0,0 +1,34 @@
/* $XConsortium: lookent.c /main/3 1995/11/08 09:38:38 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Lookent.c contains procedure m_lookent(), callable by interface
designers, to return entity type and content. Useful for entity
parameters */
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
#include "entext.h"
LOGICAL m_lookent(name, type, content, wheredef)
M_WCHAR *name ;
unsigned char *type ;
M_WCHAR **content ;
unsigned char *wheredef ;
{
M_ENTITY *entity ;
if (entity = (M_ENTITY *) m_lookfortrie(name, m_enttrie)) {
*type = entity->type ;
*content = entity->content ;
*wheredef = entity->wheredef ;
return(TRUE) ;
}
else return(FALSE) ;
}

View File

@@ -0,0 +1,404 @@
/* $XConsortium: minim.c /main/3 1995/11/08 09:38:51 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Minim.c contains procedures relevant to tag minimization */
#include <stdio.h>
#include <string.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
#include "delim.h"
#include "context.h"
/* M_expecting reports to the user the possible valid content at a particular
state in the parse of the document */
void m_expecting(M_NOPAR)
{
LOGICAL expstart = TRUE ;
M_PARSE *stackptr ;
M_OPENFSA *fsastack ;
M_ANDLIST *usedand ;
M_ANDGROUP pand ;
LOGICAL required = FALSE ;
LOGICAL data = FALSE ;
m_expcount = 0 ;
if (m_stacktop->intext) m_expline(&expstart, &data, M_NULLVAL) ;
for (stackptr = m_stacktop ; stackptr ; stackptr = stackptr->oldtop) {
if (m_explimit && m_expcount > M_EXPLIMIT) return ;
if (m_start && ! stackptr->oldtop) return ;
/* First check for possible start-tags.
Begin by testing if at start of document or not within a
CDATA or RCDATA element. */
if (! stackptr->oldtop ||
m_element[stackptr->element - 1].content == M_REGEXP) {
/* Note the following statement, which checks the type of the
element at the top of the stack, is not a repeat of the previous
one, which checks the type of an element embedded in the stack.
The second comparison prevents traversing paths from
a parent of an RCDATA or CDATA element and still allows displaying
the end-tag of the parent */
if (! stackptr->oldtop ||
m_element[m_stacktop->element - 1].content == M_REGEXP)
for (fsastack = stackptr->fsastack ;
fsastack ;
fsastack = fsastack->oldtop) {
for (pand = fsastack->andgroup ;
pand ;
pand = m_andgroup[pand - 1].next) {
for (usedand = fsastack->usedand ;
usedand ;
usedand = usedand->next)
if (usedand->group == pand) break ;
if (! usedand)
m_expexpand(&expstart, m_andgroup[pand - 1].start, &required,
&data) ;
}
if (required) return ;
m_expexpand(&expstart, fsastack->current, &required, &data) ;
if (! m_state[fsastack->current - 1].final) return ;
}
}
else if (m_element[stackptr->element - 1].content == M_CDATA ||
m_element[stackptr->element - 1].content == M_RCDATA)
m_expline(&expstart, &data, M_NULLVAL) ;
if (m_explimit && m_expcount > M_EXPLIMIT) return ;
/* Now report the end-tag */
m_exptend(&expstart, stackptr) ;
if (! m_element[stackptr->element - 1].emin) return ;
}
}
/* Recursive procedure first called from expecting() to display
names of elements reachable from a particular node */
void m_expexpand(expstart, node, required, data)
LOGICAL *expstart ;
M_STATE node ;
LOGICAL *required ;
LOGICAL *data ;
{
M_ARC parc ;
M_ANDGROUP pand ;
for (parc = m_state[node - 1].first ;
parc ;
parc = m_arc[parc - 1].next) {
if (m_explimit && m_expcount > M_EXPLIMIT) return ;
if (m_arc[parc - 1].group)
for (pand = m_arc[parc - 1].group ;
pand ;
pand = m_andgroup[pand - 1].next)
m_expexpand(expstart, m_andgroup[pand - 1].start, required, data) ;
else {
if (! m_state[node - 1].final) *required = TRUE ;
m_expline(expstart, data, m_arc[parc - 1].label) ;
}
}
}
/* M_expline writes one line for m_expecting() */
void m_expline(expstart, data, label)
LOGICAL *expstart ;
LOGICAL *data ;
M_ELEMENT label ;
{
char buffer[M_NAMELEN + 2*MAXD + 1] ;
if (! label && *data) return ;
if (m_excluded(label)) return ;
if (*expstart) {
sprintf(buffer, "Expecting ") ;
m_errline(buffer) ;
*expstart = FALSE ;
}
else {
sprintf(buffer, " or ") ;
m_errline(buffer) ;
}
if (m_explimit && m_expcount == M_EXPLIMIT) {
sprintf(buffer, ". . .\n") ;
m_errline(buffer) ;
}
else if (label) {
char *mb_enptr;
mb_enptr = MakeMByteString(&m_ename[m_element[label - 1].enptr]);
sprintf(buffer, "%s%s%s\n", m_stago, mb_enptr, m_tagc) ;
m_free(mb_enptr,"multi-byte string");
m_errline(buffer) ;
}
else {
sprintf(buffer, "data characters\n") ;
m_errline(buffer) ;
*data = TRUE ;
}
m_expcount++ ;
}
/* M_exptend is called from m_expecting to inform the user after an
error if an end tag is permitted */
void m_exptend(expstart, stackptr)
LOGICAL *expstart ;
M_PARSE *stackptr ;
{
char buffer[M_NAMELEN + 2*MAXD + 1] ;
if (*expstart) {
sprintf(buffer, "Expecting ") ;
m_errline(buffer) ;
*expstart = FALSE ;
}
else {
sprintf(buffer, " or ") ;
m_errline(buffer) ;
}
if (m_explimit && m_expcount == M_EXPLIMIT) {
sprintf(buffer, ". . .\n") ;
m_errline(buffer) ;
}
else if (stackptr->neednet) {
sprintf(buffer, "%s\n", m_net) ;
m_errline(buffer) ;
}
else {
char *mb_enptr;
mb_enptr =
MakeMByteString(&m_ename[m_element[stackptr->element - 1].enptr]);
sprintf(buffer, "%s%s%s\n", m_etago, mb_enptr, m_tagc) ;
m_free(mb_enptr,"multi-byte string");
m_errline(buffer) ;
}
m_expcount++ ;
}
/* M_findunique is used to test for start tag minimization. If the current
parse state permits at least one element with explicit start-tag
minimization, the left-most such element to occur in the content model
is returned. Otherwise, the contextually-required element, if any,
is returned. Finally, if the parse state permits a unique valid element,
and the flag for conformance to ISO 8879 is not set, the unique valid
element is returned by m_findunique.
Before returning, m_findunique verifies that the element to be returned
permits start-tag minimization. If not, the value is returned only if
conformance to ISO 8879 is set.
Actually m_findunique returns 1 greater than the index of the unique
element, 1 if character data is expected, and 0 (FALSE) if there is
no unique element.
*/
M_ELEMENT m_findunique(from, newleft)
M_STATE from ;
int *newleft ;
{
M_ARC parc ;
M_ELEMENT cr = 0, minim = 0;
int leftmost = M_BIGINT ;
int testleft = M_BIGINT ;
int testminim ;
M_ANDGROUP pand ;
for (parc = m_state[from - 1].first ;
parc ;
parc = m_arc[parc - 1].next) {
if (m_arc[parc - 1].group) {
if (! m_conform)
for (pand = m_arc[parc - 1].group ;
pand ;
pand = m_andgroup[pand - 1].next) {
testminim = m_findunique(m_andgroup[pand - 1].start, &testleft) ;
if (testminim && testleft < leftmost) {
minim = testminim ;
leftmost = testleft ;
}
}
}
else {
if (! m_conform) {
if (m_arc[parc - 1].minim &&
m_arc[parc - 1].minim < leftmost &&
! m_excluded(m_arc[parc - 1].label)) {
/* Save the explicitly minimizable element plus its position
in the content model */
leftmost = m_arc[parc - 1].minim ;
minim = m_arc[parc - 1].label + 1 ;
} /* End arc.minim > leftmost */
else if (m_arc[parc - 1].optional &&
parc == m_state[from - 1].first &&
! m_arc[parc - 1].next &&
m_element[m_arc[parc - 1].label -1].smin &&
! m_excluded(m_arc[parc - 1].label))
/* Save the only element that can occur */
cr = m_arc[parc - 1].label ;
} /* End if (! m_conform) */
/* Save the contextually-required element */
if (! m_arc[parc - 1].optional && ! m_excluded(m_arc[parc - 1].label))
cr = m_arc[parc - 1].label ;
} /* End if (! group) */
} /* End for parc */
*newleft = leftmost ;
if (minim) return(minim) ;
if (cr) return(cr + 1) ;
return(FALSE) ;
}
/* M_nullendtag is called when a null end tag is encountered; i.e., at the
end of a short element */
void m_nullendtag(M_NOPAR)
{
LOGICAL foundnet ;
while (m_stacktop->oldtop) {
foundnet = m_stacktop->neednet ;
if (! foundnet && ! m_element[m_stacktop->element - 1].emin) {
m_err1("Missing end tag for %s",
m_nameofelt(m_stacktop->element)) ;
m_showcurelt() ;
}
if (! m_ckend(m_stacktop->element, foundnet)) {
M_WCHAR *wc_found;
wc_found = MakeWideCharString(foundnet ? "Null" : "Implied");
m_err2("%s end tag for %s unexpected",
wc_found,
m_nameofelt(m_stacktop->element)) ;
m_free(wc_found,"wide character string");
m_expecting() ;
m_showcurelt() ;
m_frcend(m_stacktop->element) ;
}
if (foundnet) return ;
}
m_error("Internal error: Invalid stack in Nullendtag") ;
m_exit(TRUE) ;
}
/* Tests to see if an end tag may have been omitted at this point in the
parse.*/
LOGICAL m_omitend(M_NOPAR)
{
M_ANDGROUP pand ;
M_OPENFSA *fsastack ;
M_ANDLIST *usedand ;
if (! m_stacktop->oldtop) return(FALSE) ;
if (m_element[m_stacktop->element - 1].content != M_REGEXP) return(TRUE) ;
for (fsastack = m_stacktop->fsastack ;
fsastack ;
fsastack = fsastack->oldtop) {
for (pand = fsastack->andgroup ;
pand ;
pand = m_andgroup[pand - 1].next) {
/* Doesn't matter if optional submodel of and-group has occurred */
if (m_state[m_andgroup[pand - 1].start - 1].final) continue ;
for (usedand = fsastack->usedand ;
usedand ;
usedand = usedand->next)
if (usedand->group == pand) break ;
/* Required submodel of and-group has not occurred */
if (! usedand) return(FALSE) ;
}
/* Current FSA not in final state */
if (! m_state[fsastack->current - 1].final) return(FALSE) ;
}
*m_nextme = (M_MIN *) m_malloc(sizeof(M_MIN), "end-tag minimization") ;
(*m_nextme)->val = m_stacktop->element ;
(*m_nextme)->next = NULL ;
m_nextme = &(*m_nextme)->next ;
return(TRUE) ;
}
/* Tests to see if a start tag may have been omitted at this point of
the parse. If so, saves the element name in the MINVAL array*/
LOGICAL m_omitstart()
{
M_ELEMENT c = M_NULLVAL ;
/* int par ; (used in commented-out code below) */
M_OPENFSA *fsastack ;
M_ANDLIST *usedand ;
M_ANDGROUP pand ;
int leftmost = M_BIGINT ;
int newleft = M_BIGINT ;
M_ELEMENT newc = M_NULLVAL ;
LOGICAL required = FALSE ;
M_MIN *min ;
/* Make sure are in an element that has a content model */
if (m_stacktop->oldtop &&
m_element[m_stacktop->element - 1].content != M_REGEXP)
return(FALSE) ;
/* Test for unique element expected, or only allowed token is #PCDATA */
for (fsastack = m_stacktop->fsastack ;
fsastack ;
fsastack = fsastack->oldtop) {
for (pand = fsastack->andgroup ;
pand ;
pand = m_andgroup[pand - 1].next) {
for (usedand = fsastack->usedand ;
usedand ;
usedand = usedand->next)
if (usedand->group == pand) break ;
if (! usedand) {
if (! m_state[m_andgroup[pand - 1].start - 1].final)
required = TRUE ;
newc = m_findunique(m_andgroup[pand - 1].start, &newleft) ;
if (newleft < leftmost) {
leftmost = newleft ;
c = newc ;
}
}
}
if (! required) {
newc = m_findunique(fsastack->current, &newleft) ;
if (newleft < leftmost) {
leftmost = newleft ;
c = newc ;
}
}
if (c > 1) break ;
if (fsastack == m_stacktop->fsastack && newc) {
c = newc ;
break ;
}
if (m_conform) return(FALSE) ;
if (! m_state[fsastack->current - 1].final) return(FALSE) ;
}
if (! c) return(FALSE) ;
/* Have found a unique element. Can its start-tag be omitted? */
c-- ;
if (m_element[c - 1].content == M_NONE) return(FALSE) ;
if (m_element[c - 1].content == M_CDATA) return(FALSE) ;
if (m_element[c - 1].content == M_RCDATA) return(FALSE) ;
/* Following code allows start-tag to be omitted only if all required
parameters are specified:
for (par = m_element[c - 1].parptr ; par ;
par = m_parameter[par - 1].next)
if (m_parameter[par - 1].deftype == M_REQUIRED) return(FALSE) ;
*/
/* Check for recursive sequences of omitted tags */
for (min = m_minstart ; min ; min = min->next)
if (c == min->val) return(FALSE) ;
m_push(c, m_element[c - 1].start, FALSE) ;
*m_nextms = (M_MIN *) m_malloc(sizeof(M_MIN), "start-tag minimization") ;
(*m_nextms)->val = m_stacktop->element ;
(*m_nextms)->next = NULL ;
m_nextms = &(*m_nextms)->next ;
return(TRUE) ;
}

View File

@@ -0,0 +1,14 @@
/* $XConsortium: openent.c /main/3 1995/11/08 09:39:07 rswiston $ */
/* Copyright 1988, 1989 Hewlett-Packard Co. */
/* Default open SYSTEM entity procedure */
#include "userinc.h"
#include "globdec.h"
void *m_openent(entcontent)
M_WCHAR *entcontent ;
{
return((void *) fopen(entcontent, "r")) ;
}

View File

@@ -0,0 +1,14 @@
/* $XConsortium: openfrst.c /main/3 1995/11/08 09:39:20 rswiston $ */
/* Copyright 1988, 1989 Hewlett-Packard Co. */
/* Default open SYSTEM entity procedure */
#include "userinc.h"
#include "globdec.h"
void *m_openfirst(M_NOPAR)
{
return((void *) stdin) ;
}

View File

@@ -0,0 +1,38 @@
/* $XConsortium: optstrg.c /main/3 1995/11/08 09:39:33 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
#include <stdio.h>
#include <string.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
/* Get program options from a string */
void m_optstring(p)
char *p ;
{
if (strchr(p, 'a')) m_malftrace = TRUE ;
if (strchr(p, 'c')) m_chtrace = TRUE ;
if (strchr(p, 'd')) m_cdtrace = TRUE ;
if (strchr(p, 'e')) m_entdupchk = FALSE ;
if (strchr(p, 'h')) m_heapchk = TRUE ;
if (strchr(p, 'l')) m_explimit = FALSE ;
if (strchr(p, 'm')) m_conform = TRUE ;
if (strchr(p, 's')) m_scantrace = TRUE ;
if (strchr(p, 't')) m_tagtrace = TRUE ;
if (strchr(p, 'w')) m_wholetag = TRUE ;
if (strchr(p, 'A')) m_malftrace = TRUE ;
if (strchr(p, 'C')) m_chtrace = TRUE ;
if (strchr(p, 'D')) m_cdtrace = TRUE ;
if (strchr(p, 'E')) m_entdupchk = FALSE ;
if (strchr(p, 'H')) m_heapchk = TRUE ;
if (strchr(p, 'L')) m_explimit = FALSE ;
if (strchr(p, 'M')) m_conform = TRUE ;
if (strchr(p, 'S')) m_scantrace = TRUE ;
if (strchr(p, 'T')) m_tagtrace = TRUE ;
if (strchr(p, 'W')) m_wholetag = TRUE ;
}

View File

@@ -0,0 +1,338 @@
/* $XConsortium: param.c /main/3 1995/11/08 09:39:48 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Param.c has procedures relevant to parameters (attributes). */
#include <string.h>
#include <stdio.h>
#include <malloc.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "basic.h"
#include "trie.h"
#include "delim.h"
#include "context.h"
#include "dtdext.h"
#include "parser.h"
#include "entext.h"
/* Process the value for the parameter whose index number was previously
saved in m_ppsave */
void m_attval(string)
M_WCHAR *string ;
{
const M_WCHAR *p ;
if (p = m_partype(m_ppsave, string)) {
if (m_parameter[m_ppsave - 1].type == M_KEYWORD)
m_poccur[m_psave] = (M_WCHAR *) p ;
else {
m_poccur[m_psave] = (M_WCHAR *)
m_malloc(w_strlen(p) + 1, "parameter value") ;
w_strcpy(m_poccur[m_psave], p) ;
m_parupper(m_ppsave, m_poccur[m_psave]) ;
}
m_updatedefault(m_ppsave, p) ;
}
else m_err2("\"%s\" -- error in value for parameter %s",
string,
&m_pname[m_parameter[m_ppsave - 1].paramname]) ;
}
/* Process a string that is a parameter value not prefixed by the parameter
name and value indicator */
LOGICAL m_attvonly(string)
M_WCHAR *string ;
{
const M_WCHAR *p ;
int par, i ;
if (! m_scanel) {
m_error("Program error in m_attvonly") ;
m_exit(TRUE) ;
}
/* First check is it a valid keyword? */
for (par = m_element[m_scanel - 1].parptr, i = 0 ;
i < m_element[m_scanel - 1].parcount ;
par++, i++)
if (m_parameter[par - 1].type == M_KEYWORD)
if (p = m_partype(par, string)) {
if (m_poccur[i])
m_err2(
"Redefinition of parameter %s. Discarding old value '%s'.",
&m_pname[m_parameter[par - 1].paramname],
m_poccur[i]) ;
m_poccur[i] = (M_WCHAR *) p ;
m_updatedefault(par, p) ;
return(TRUE) ;
}
/* It wasn't a keyword. Check for valid value for some other
parameter whose value has not yet been specified. */
for (par = m_element[m_scanel - 1].parptr, i = 0 ;
i < m_element[m_scanel - 1].parcount ;
par++, i++)
if (! m_poccur[i]) {
m_poccur[i] = (M_WCHAR *) m_partype(par, string) ;
if (m_poccur[i]) {
m_parupper(par, string) ;
m_poccur[i] = (M_WCHAR *)
m_malloc(w_strlen(string) + 1, "parameter value") ;
w_strcpy(m_poccur[i], string) ;
m_updatedefault(par, m_poccur[i]) ;
return(TRUE) ;
}
}
m_err2("%s: impossible value for any parameters of %s",
string,
m_nameofelt(m_scanel)) ;
return(FALSE) ;
}
/* Check a name previously saved in m_saveatt to see if it is the name of
a valid parameter for the current start tag */
void m_findatt(M_NOPAR)
{
int par, i ;
if (! m_scanel) {
m_error("Program error in m_findatt") ;
m_exit(TRUE) ;
}
for (par = m_element[m_scanel - 1].parptr, i = 0 ;
i < m_element[m_scanel - 1].parcount ;
par++, i++)
if (! m_wcupstrcmp(&m_pname[m_parameter[par - 1].paramname],
m_saveatt)) {
if (m_poccur[i])
m_err2("Redefinition of parameter %s. Discarding old value '%s'.",
&m_pname[m_parameter[par - 1].paramname],
m_poccur[i]) ;
m_psave = i ;
m_ppsave = par ;
return ;
}
m_attvonly(m_saveatt) ;
if (! m_wholetag) {
M_WCHAR *wc_tagc;
wc_tagc = MakeWideCharString(m_tagc);
m_err3("No %s parameter for %s (possibly missing %s)",
m_saveatt,
m_nameofelt(m_scanel),
wc_tagc) ;
m_free(wc_tagc,"multi-byte string");
}
m_undodelim(m_dlmptr[M_VI - 1], TRUE) ;
m_stcomplete() ;
m_curcon = START ;
}
/* Free the parameter storage associated with an element on the parse stack */
void m_freeparam(stackelt)
M_PARSE *stackelt ;
{
int i ;
int par ;
if (stackelt->param) {
for (i = 0, par = m_element[stackelt->element - 1].parptr - 1 ;
i < m_element[stackelt->element - 1].parcount ; i++, par++)
if (m_parameter[par].type != M_KEYWORD)
if (m_parameter[par].deftype != M_NAMEDEF ||
stackelt->param[i] != m_parameter[par].defval)
if (stackelt->param[i])
m_free(stackelt->param[i], "parameter value") ;
m_free(stackelt->param, "parameter block") ;
}
}
/* Force a parameter value to uppercase, if appropriate for its type.
Also, if list-valued attribute, remove leading and trailing spaces,
and condense white-space sequences to a single blank*/
void m_parupper(par, string)
int par ;
M_WCHAR *string ;
{
M_WCHAR *p ;
M_WCHAR *q ;
int i ;
switch (m_parameter[par - 1].type) {
case M_ID:
case M_IDRF:
case M_NAMEPAR:
case M_NMTOKEN:
case M_NUTOKEN:
case M_ENTATT:
for ( ; *string ; string++)
*string = m_ctupper(*string) ;
return ;
case M_IDRFS:
case M_NAMES:
case M_NMSTOKEN:
case M_NUSTOKEN:
case M_NUMS:
for (p = string; *p ; p++)
if (! m_whitespace(*p)) break ;
w_strcpy(string, p) ;
for (p = string, i = 0 ; *p ; p++, i++)
*p = m_ctupper(*p) ;
if (m_whitespace(*p)) {
*p = M_SPACE ;
for (q = p + 1 ; m_whitespace(*q); q++) ;
w_strcpy(p + 1, q) ;
}
if (i && m_whitespace(string[i - 1])) string[i - 1] = M_EOS ;
return ;
default:
for ( ; *string ; string++)
if (*string == M_RE || *string == M_TAB) *string = M_SPACE ;
return ;
}
}
/* Set all parameters to their default values for an element included by
tag minimization */
void m_stkdefaultparams(M_NOPAR)
{
int i, par = 0 ;
m_stacktop->param = (M_WCHAR **)
m_malloc(
m_element[m_stacktop->element - 1].parcount * sizeof(M_WCHAR *),
"parameter block") ;
for (i = 0, par = m_element[m_stacktop->element - 1].parptr ;
i < m_element[m_stacktop->element - 1].parcount ;
i++, par++)
m_stkonedef(par, m_stacktop->element, m_stacktop->param, i) ;
m_strtaction(m_stacktop->element) ;
}
/* Stack one default parameter */
void m_stkonedef(par, scanel, poccur, i)
int par ;
M_ELEMENT scanel ;
M_WCHAR **poccur ;
int i ;
{
if (m_parameter[par - 1].deftype == M_REQUIRED ||
(m_parameter[par - 1].deftype == M_CURRENT &&
! m_parameter[par - 1].defval))
m_err2("Missing value for %s parameter of element %s",
&m_pname[m_parameter[par - 1].paramname],
m_nameofelt(scanel)) ;
poccur[i] = m_parameter[par - 1].defval ;
if (! m_parameter[par - 1].defval) return ;
if (m_parameter[par - 1].type == M_KEYWORD) return ;
/* If parameter is an entity name, the default is usable only if
the name is that of a defined entity */
if (m_parameter[par - 1].type == M_ENTATT)
if (! (M_ENTITY *)
m_lookfortrie(m_parameter[par - 1].defval, m_enttrie)) {
m_err1("Interface error: Default entity %s undefined", poccur[i]) ;
poccur[i] = NULL ;
return ;
}
/* Non-null, non-keyword current default must go on stack, since
default could change in a subelement */
if (m_parameter[par - 1].deftype != M_CURRENT &&
m_parameter[par - 1].deftype != M_CHANGEDCUR) return ;
poccur[i] = (M_WCHAR *)
m_malloc(w_strlen(poccur[i]) + 1, "parameter value") ;
w_strcpy(poccur[i], m_parameter[par - 1].defval) ;
}
/* Stack parameter values */
void m_stkparams(M_NOPAR)
{
int i, par ;
m_stacktop->param = (M_WCHAR **)
m_malloc(
m_element[m_stacktop->element - 1].parcount * sizeof(M_WCHAR *),
"parameter block") ;
for (i = 0, par = m_element[m_scanel - 1].parptr ;
i < m_element[m_scanel - 1].parcount ;
i++, par++) {
if (! m_poccur[i]) m_stkonedef(par, m_scanel, m_stacktop->param, i) ;
else m_stacktop->param[i] = m_poccur[i] ;
}
m_strtaction(m_stacktop->element) ;
}
/* Update the default of a parameter whose default is #CURRENT */
#if defined(M_PROTO)
void m_updatedefault(const int par , const M_WCHAR *string )
#else
void m_updatedefault(par, string)
int par ;
M_WCHAR *string ;
#endif /* M_PROTO */
{
if (m_parameter[par - 1].deftype != M_CURRENT &&
m_parameter[par - 1].deftype != M_CHANGEDCUR) return ;
/* For keyword parameters, the string is already saved in the
keyword array; for entities, it is saved with the entity structure */
/* In light of the above comment, why does the following if statement
not test for parameters of type entity? */
if (m_parameter[par - 1].type == M_KEYWORD)
m_parameter[par - 1].defval = (M_WCHAR *) string ;
/* Save value in allocated storage */
else {
if (m_parameter[par - 1].deftype == M_CHANGEDCUR)
m_free(m_parameter[par - 1].defval, "updateable default") ;
m_parameter[par - 1].defval = (M_WCHAR *)
m_malloc(w_strlen(string) + 1, "updateable default") ;
w_strcpy(m_parameter[par - 1].defval, string) ;
}
m_parameter[par - 1].deftype = M_CHANGEDCUR ;
}
/* Check to see if a string that occurs after the element name in a start
tag is a valid parameter name or value; if not, assume tag is ended */
LOGICAL m_validinpar(string)
M_WCHAR *string ;
{
int par ;
M_WCHAR *p ;
int i ;
M_WCHAR *wc_tagc;
if (! m_scanel) {
m_error("Program error in m_validinpar") ;
m_exit(TRUE) ;
}
for (par = m_element[m_scanel - 1].parptr, i = 0 ;
i < m_element[m_scanel - 1].parcount ;
par++, i++) {
/* Check if valid name of a parameter */
if (! m_wcupstrcmp(&m_pname[m_parameter[par - 1].paramname], string))
return(TRUE) ;
/* Check if possible value of a keyword parameter or of a non-keyword
parameter that has not yet occurred*/
if (m_partype(par, string) &&
(m_parameter[par - 1].type == M_KEYWORD || ! m_poccur[i]))
return(TRUE) ;
}
wc_tagc = MakeWideCharString(m_tagc);
if (! m_wholetag) m_err1("Invalid parameter or missing %s", wc_tagc) ;
m_free(wc_tagc,"wide character string");
m_stcomplete() ;
m_curcon = POUNDCDATA ;
for (p = string ; *p ; p++) ;
for (p-- ; p >= string ; p--) m_ungetachar((int) *p, M_NORMAL, TRUE) ;
return(FALSE) ;
}
#include "paramu.c"

View File

@@ -0,0 +1,22 @@
/* $XConsortium: parcount.c /main/3 1995/11/08 09:40:02 rswiston $ */
/*
Copyright 1989 Hewlett-Packard Co.
*/
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
/* Function callable by interface designers. Returns number of parameters
of specified element (-1 indicates error). */
int m_parcount(elt)
M_WCHAR *elt ;
{
M_ELEMENT eltid ;
if (! (eltid = m_packedlook(m_entree, elt))) return(-1) ;
return(m_element[eltid - 1].parcount) ;
}

View File

@@ -0,0 +1,39 @@
/* $XConsortium: pardef.c /main/3 1995/11/08 09:40:15 rswiston $ */
/*
Copyright 1989 Hewlett-Packard Co.
*/
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
/* Function callable by interface designers. Returns pointer to default
value of a parameter of an element. Type is set to indicate type of
default. Error indication is type is 0 and function returns NULL. */
M_WCHAR *m_pardefault(elt, param, type)
M_WCHAR *elt ;
M_WCHAR *param ;
unsigned char *type ;
{
M_ELEMENT eltid ;
int par ;
int i ;
*type = M_NULLVAL ;
if (! (eltid = m_packedlook(m_entree, elt))) return(NULL) ;
for (par = m_element[eltid - 1].parptr, i = 0 ;
i < m_element[eltid - 1].parcount ;
par++, i++)
if (! m_wcupstrcmp(&m_pname[m_parameter[par - 1].paramname], param)) {
*type = (unsigned char) m_parameter[par - 1].deftype ;
if (*type == M_REQUIRED || *type == M_NULLDEF) return(NULL) ;
return(m_parameter[par -1].defval) ;
}
/* Can't find the parameter */
return(NULL) ;
}

View File

@@ -0,0 +1,27 @@
/* $XConsortium: parent.c /main/3 1995/11/08 09:40:28 rswiston $ */
/*
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
/* Procedure callable by interface designers. Returns pointer to name
of nth level parent of current element (0 is self, 1 is parent, 2
is grandparent, etc.) */
M_WCHAR *m_parent(n)
int n ;
{
M_PARSE *stackptr ;
for (stackptr = m_stacktop ;
stackptr->oldtop && n >= 0 ;
stackptr = stackptr->oldtop, n--) {
if (! n)
return(m_nameofelt(stackptr->element)) ;
}
return(NULL) ;
}

View File

@@ -0,0 +1,36 @@
/* $XConsortium: parname.c /main/3 1995/11/08 09:40:42 rswiston $ */
/*
Copyright 1989 Hewlett-Packard Co.
*/
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
/* Function callable by interface designers. Returns name of nth parameter
of specified element (NULL indicates error). */
M_WCHAR *m_parname(elt, n)
M_WCHAR *elt ;
int n ;
{
M_ELEMENT eltid ;
if (! (eltid = m_packedlook(m_entree, elt))) return(NULL) ;
if (n < 1 || n > m_element[eltid - 1].parcount) return(NULL) ;
return(&m_pname[m_parameter[(n - 1) + m_element[eltid - 1].parptr - 1].
paramname]) ;
}
M_WCHAR *m_mbparname(elt, n)
char *elt ;
int n ;
{
M_WCHAR *wc_elt, *retval;
wc_elt = MakeWideCharString(elt);
retval = m_parname(wc_elt, n);
m_free(wc_elt,"wide character string");
}

View File

@@ -0,0 +1,139 @@
/* $XConsortium: parser.c /main/3 1995/11/08 09:40:55 rswiston $ */
/* Parser.c contains the main procedure for program PARSER */
#include <string.h>
#include <stdio.h>
#include <malloc.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "context.h"
#include "delim.h"
#include "parser.h"
#include "if.h"
#include "entext.h"
static void scanloop(LOGICAL prolog);
/* Main procedure */
void main(argc, argv)
int argc ;
char **argv ;
{
M_WCHAR *wc_userdef;
m_argc = argc ;
m_argv = argv ;
m_strtcase(1) ;
m_globss() ;
m_setoptions() ;
m_initialize() ;
/* open and process helptag.ent */
wc_userdef = MakeWideCharString("USER-DEFINED-ENTITIES");
m_sysecnt = 0;
m_entexpand((M_ENTITY *) m_lookfortrie(wc_userdef, m_enttrie));
if (m_sysecnt == 1)
{
scanloop(TRUE);
m_closent(m_sysent[0]);
}
m_sysecnt = 0;
m_free(wc_userdef, "user defined entities name");
/* open and process document */
m_curcon = PREAMBLE;
if (! (m_sysent[m_sysecnt] = m_openfirst()))
{
m_error("Unable to open input file") ;
m_exit(TRUE) ;
}
scanloop(FALSE);
/* At EOF */
m_done() ;
}
static void scanloop(LOGICAL prolog)
{
static char parserr[] = "\nM_token=%d, m_prevcon=%d, m_scanval=%d\n" ;
static char sopt[] =
"prevcon=%d,token=%d,curcon=%d,scanval='%c'(%d),line=%d,netlevel=%d\n" ;
static char name[] = "m_name = '%s'\n" ;
static char literal[] = "m_literal = '%s'\n" ;
#if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(___uxp__) || defined(__osf__)
char buffer[M_LITLEN + 80] ;
#else
#define max4(a,b,c,d) (a>b&&a>c&&a>d) ? a : ((b>c&&b>d) ? b : (c>d ? c : d))
M_WCHAR buffer[max4(sizeof(parserr) + 3,
sizeof(sopt) + 6,
sizeof(name) + M_NAMELEN - 2,
sizeof(literal) + M_LITLEN - 2)] ;
#endif
while (TRUE)
{
m_token = m_scan(prolog) ;
m_prevcon = m_curcon ;
m_curcon = m_newcon(m_prevcon - 1, m_token - 1) ;
if (! m_curcon)
{
if (m_token != M_ENDFILE)
{
m_error("Parsing table error") ;
sprintf(buffer, parserr, m_token, m_prevcon, m_scanval) ;
m_errline(buffer) ;
m_done() ;
}
else if (!prolog)
{
m_error("Unexpected end of document") ;
m_showcurelt() ;
m_done() ;
}
else if (m_prevcon != PROLOG)
{
m_error("Unexpected end of file") ;
m_showcurelt() ;
m_done() ;
}
}
if ((! m_stacktop->oldtop) &&
m_start &&
! m_aftereod &&
m_state[m_stacktop->fsastack->current - 1].final &&
(m_token != M_ENDFILE) &&
(m_token != M_TEXT || ! m_whitespace((M_WCHAR) m_scanval))
)
{
m_error("Expecting end of document") ;
m_aftereod = TRUE ;
}
if (m_scantrace)
{
sprintf(buffer,
sopt,
m_prevcon,
m_token,
m_curcon,
m_scanval ? m_scanval : ' ',
m_scanval,
m_line[m_sysecnt],
m_netlevel) ;
m_trace(buffer) ;
if (m_token == M_NAME)
{
sprintf(buffer, name, m_name) ;
m_trace(buffer) ;
}
if (m_token == M_LITERAL)
{
sprintf(buffer, literal, m_literal) ;
m_trace(buffer) ;
}
}
#include "case.c"
m_adjuststate() ;
if (m_token == M_ENDFILE) break ;
}
}

View File

@@ -0,0 +1,437 @@
/* $XConsortium: parser.h /main/3 1995/11/08 09:41:12 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Parser.h allocates global variables for PARSER */
#if defined(M_PARDEF)
#define M_PAREXTERN
#define M_PARINIT(a) = a
#else
#define M_PAREXTERN extern
#define M_PARINIT(a)
#endif
#include "common.h"
/* Stack of open entities and line number in each external file */
#define M_ENTLVL 16 /* Maximum number of open entities */
M_PAREXTERN M_ENTITY *m_opene[M_ENTLVL] ;
M_PAREXTERN int m_eopencnt M_PARINIT(0) ;
M_PAREXTERN void *m_sysent[M_ENTLVL + 1] ;
#define M_FIRSTLINE 1
M_PAREXTERN int m_line[M_ENTLVL + 1] M_PARINIT({M_FIRSTLINE}) ;
M_PAREXTERN int m_sysecnt M_PARINIT(0) ;
/* Possible states of a line -- no SGML characters yet processed, SGML
characters processed but no data character or contextual end tag,
data character or contextual end tag (i.e., end tag of a proper
subelement) has occurred. Note that linestat is stacked with each
element. If an element contains a line that
* is neither its first nor last line
* contains data characters within an included element
the status of the line should be M_SOMETHING not M_DCORCET because the data
characters belong to the inner element rather than the outer one.
Also note that "M_DCORCET" originally stood for "data character or contextual
end tag" when the Standard used the term "contextual element" to mean
an element allowed by a model rather than an inclusion and when
the rules for ignoring RE's referred to the occurrence of end tags of
such elements rather than the entire elements. Now the acronym can be
interpreted as "data character or contextual element".
*/
#define M_NOTHING 0
#define M_SOMETHING 1
#define M_DCORCET 2
/* Definitions for parse stack. The primary data structure of PARSER
is a stack containing one entry for each open element. Each entry
on the stack is described in an m_parse structure. Entries for
element's whose content is defined by a content model have a
pointer to a stack of open FSAs. These FSA stacks do not describe
the actual automata (which are coded in the data structures
generated by BUILD, but rather the current state in the active
automata. An element's FSA stack will have one entry for the
content model and an additional entry for each active and-group.
*/
typedef struct m_parse M_PARSE ;
typedef struct m_openfsa M_OPENFSA ;
typedef struct m_andlist M_ANDLIST ;
struct m_parse {
/* Pointer to preceding entry on stack */
M_PARSE *oldtop ;
/* Identifier of element this entry represents */
M_ELEMENT element ;
/* Pointer to table of parameter pointers for this instance of this
element */
M_WCHAR **param ;
/* Pointer to stack of open FSAs for this element */
M_OPENFSA *fsastack ;
/* For RCDATA elements to indicate the nesting level
of entities when the element opened, since net and etago
delimiters are not recognized except in the same entity
as the element began. */
int thisent ;
/* TRUE iff the element's start-tag ended with a NET so that a NET
is expected to end the element */
LOGICAL neednet ;
/* Has a Record End occurred in the element's content? */
LOGICAL firstre ;
/* Flag that indicates whether the element is contextual, i.e.,
whether it occurred because it was allowed in context by a
content model, or it was allowed by an inclusion exception or
occurred by error. (The term "contextual subelement" was used
in the Draft International Standard in the same sense as
"proper subelement" in the International Standard.) */
LOGICAL contextual ;
/* Whether character data is currently being processed. */
LOGICAL intext ;
/* Line status. Indicates whether anything has occurred after
the start-tag or most recent Record Start in this element */
char linestat ;
/* Flag indicating whether or not a Record End (carriage return)
has been scanned and is being held to see if there is more
content in the element. If there is, the RE will be processed
as a data character, otherwise it will be discarded. */
LOGICAL holdre ;
/* Pointer to the element's short reference map. The value is NULL
if there is no map. */
int *map ;
/* Index in actions for processing text characters encountered
in this element, and pointer to stack location where parameters
should be retrieved. */
int cdcase ;
M_PARSE *cdparam ;
/* Index in actions for processing processing instructions
encountered in this element, and pointer to stack location where
parameters should be retrieved. */
int picase ;
M_PARSE *piparam ;
/* Index in actions for processing start- and end-strings
encountered in this element, and pointer to stack location where
parameters should be retrieved. */
int stccase ;
M_PARSE *stparam ;
/* Pointer to name of input file in which the current element
began (NULL if primary input file). */
M_WCHAR *file ;
/* Line number where the current element began. */
int line ;
/* Interface-defined pointer stored on the stack */
void *ifdata ;
} ;
struct m_openfsa {
/* Pointer to preceding entry on FSA stack */
M_OPENFSA *oldtop ;
/* Current state in this FSA */
M_STATE current ;
/* Identifier of set of and-groups being processed and pointer to list of
and-groups that have occurred within this set. */
M_ANDGROUP andgroup ;
M_ANDLIST *usedand ;
} ;
struct m_andlist {
M_ANDGROUP group ;
M_ANDLIST *next ;
} ;
extern M_OPENFSA m_botfsa ;
/* Bottom marker of parse stack */
M_PAREXTERN M_PARSE m_stackbot
#if defined(M_PARDEF)
= {
/* M_PARSE *oldtop ;*/ NULL,
/* M_ELEMENT element ;*/ M_NULLVAL,
/* M_WCHAR **param ;*/ NULL,
/* M_OPENFSA *fsastack ;*/ &m_botfsa,
/* int thisent ;*/ 0,
/* LOGICAL neednet ;*/ FALSE,
/* LOGICAL firstre ; */ FALSE,
/* LOGICAL contextual ;*/ TRUE,
/* LOGICAL intext ;*/ FALSE,
/* int linestat ;*/ M_NOTHING,
/* LOGICAL holdre ;*/ FALSE,
/* int *map ;*/ NULL,
/* int cdcase ;*/ 1,
/* M_PARSE *cdparam ;*/ &m_stackbot,
/* int picase ;*/ 1,
/* M_PARSE *piparam ;*/ &m_stackbot,
/* int stccase ;*/ 1,
/* M_PARSE *stparam ;*/ &m_stackbot,
/* M_WCHAR *file ;*/ NULL,
/* int line ;*/ M_FIRSTLINE,
/* void *ifdata ;*/ NULL,
}
#endif
;
M_PAREXTERN M_OPENFSA m_botfsa
#if defined(M_PARDEF)
= {
/* M_OPENFSA *oldtop ;*/ NULL,
/* M_STATE current ;*/ 1,
/* M_ANDGROUP andgroup ;*/ M_NULLVAL,
/* M_ANDGROUP *usedand ;*/ NULL,
}
#endif
;
/* Index of current top of parse stack */
M_PAREXTERN M_PARSE *m_stacktop M_PARINIT(&m_stackbot) ;
/* Pointer to stack location where parameters for current code
segment are defined. Used for inherited code segments (text-code,
pi-code, string-code) */
M_PAREXTERN M_PARSE *m_stackpar ;
/* Type of characters */
typedef char M_HOLDTYPE ;
#if defined(M_PARDEF)
#include "chartype.h"
#else
extern M_CHARTYPE m_ctarray[M_CHARSETLEN] ;
#endif
/* Indicates a start tag is allowed by an inclusion exception */
#define M_NONCONTEXTUAL 2
/* Character used to delimit parameter names in start and end strings
entered as data to ELTDEF */
#define M_ESCAPECHAR '@'
/* Pointer to name of element */
#define m_nameofelt(x) &m_ename[m_element[x - 1].enptr]
/* Status of characters as read from input stream */
#define M_EE 0
#define M_NORMAL 1
#define M_CDCHAR 2
#define M_ENTNORMAL 3
/* State transition network generated by CONTEXT */
#include "sparse.h"
/* Maximum length of a sequence of blanks in a short reference delimiter */
#define M_BSEQLEN 100
/* #defines used in recognition of short reference delimiters */
#if defined(M_PARDEF)
#define M_HOLDSIZ M_MAXSR + M_BSEQLEN * M_MAXSEQ + 1
#else
#define M_HOLDSIZ
#endif
#define M_REGCHAR 1
#define M_SEQCHAR 2
#define M_BSCHAR 3
#define M_WSCHAR 4
#define M_RSCHAR 5
/* Number of allowable tokens to display after a syntax error */
#define M_EXPLIMIT 5
/* Status of T option output */
#define M_TOPTSTARTTAG 0
#define M_WHITESPACE 1
#define M_OTHER 2
/* Maximum length of processing instruction (not in a PI entity) */
#define M_PILEN 240
/* Storage for a name token just read by the scanner; and for a name read
while parsing parameters */
M_PAREXTERN M_WCHAR m_name[M_NAMELEN + 1] ;
M_PAREXTERN M_WCHAR m_saveatt[M_NAMELEN + 1] ;
/* M_curcon is current state of FSA that controls parser; m_prevcon is the
value of m_curcon before last character was scanned; m_token is the token
type returned by last call to scanner; and
m_scanval is index of element name just read within tag delimiters */
M_PAREXTERN int m_curcon M_PARINIT(PROLOG) ;
M_PAREXTERN int m_prevcon ;
M_PAREXTERN int m_token ;
M_PAREXTERN int m_scanval ;
char *user_defined_entities M_PARINIT("USER-DEFINED-ENTITIES");
/* Declarations for tentative list of omitted tags when checking for tag
MINimization */
typedef struct m_min M_MIN ;
struct m_min {
int val ;
M_MIN *next ;
} ;
M_PAREXTERN M_MIN *m_minstart ;
M_PAREXTERN M_MIN *m_minend ;
M_PAREXTERN M_MIN **m_nextms ;
M_PAREXTERN M_MIN **m_nextme ;
/* Count of the number of open elements expecting to be terminated with
a NET */
M_PAREXTERN int m_netlevel M_PARINIT(0) ;
/* Count of errors that have occurred */
M_PAREXTERN int m_errcnt M_PARINIT(0) ;
#define M_ERRLIM 100
M_PAREXTERN int m_errlim M_PARINIT(M_ERRLIM) ;
M_PAREXTERN int m_expcount ;
M_PAREXTERN LOGICAL m_errexit M_PARINIT(FALSE) ;
/* Flag to indicate whether processing of the text has begun */
M_PAREXTERN LOGICAL m_start M_PARINIT(FALSE) ;
/* Flag indicates whether current start tag is terminated by End-tag
indicator or by tag-close delimiter (or start of another tag) */
M_PAREXTERN LOGICAL m_scannet ;
/* Storage for literals */
M_PAREXTERN M_WCHAR m_literal[M_LITLEN + 1] ;
/* Buffer for sequence of white space that has been read before it is
determined whether or not the white space is significant */
#define M_WSPACELEN 100
M_PAREXTERN int m_wspace[M_WSPACELEN] ;
M_PAREXTERN int m_wscount M_PARINIT(0) ;
M_PAREXTERN int m_maxws M_PARINIT(0) ;
M_PAREXTERN int m_wsused ;
/* Temporary pointers to parameter values. Used while scanning start tag
before element is placed on parse stack.*/
M_PAREXTERN
#if defined M_PROTO
#endif
M_WCHAR *m_poccur[
#if defined(M_PARDEF)
M_MAXPAR ? M_MAXPAR : 1
#endif
] ;
/* Index of a particular parameter within the parameter list for a given
element */
M_PAREXTERN int m_psave ;
/* Index of a particular parameter within the list of all parameters for all
elements */
M_PAREXTERN int m_ppsave ;
/* Index of element of tag just scanned; may be result of short tag
minimization */
M_PAREXTERN M_ELEMENT m_scanel ;
/* Read-ahead buffer and number of characters currently in that buffer */
#define M_SAVECHAR 500
M_PAREXTERN int m_savechar[M_SAVECHAR] ;
M_PAREXTERN M_WCHAR m_savedchar[M_SAVECHAR] ;
M_PAREXTERN M_WCHAR m_oldlinestat[M_SAVECHAR] ;
M_PAREXTERN M_WCHAR m_oldatrs[M_SAVECHAR] ;
M_PAREXTERN int m_sourcefile[M_SAVECHAR] ;
M_PAREXTERN M_WCHAR m_atrs M_PARINIT(TRUE) ;
M_PAREXTERN int m_oldlsindex M_PARINIT(M_SAVECHAR - 1) ;
M_PAREXTERN int m_toundo M_PARINIT(0) ;
M_PAREXTERN int m_maxundo M_PARINIT(0) ;
#define M_LINELENGTH 80
M_PAREXTERN int m_saveline[M_LINELENGTH][M_ENTLVL + 1] ;
M_PAREXTERN int m_svlncnt[M_ENTLVL + 1] M_PARINIT({0}) ;
M_PAREXTERN LOGICAL m_svlnwrap[M_ENTLVL + 1] M_PARINIT({FALSE}) ;
/* Arrays used for short references */
M_PAREXTERN int m_hold[M_HOLDSIZ] ;
M_PAREXTERN M_HOLDTYPE m_dhold[M_HOLDSIZ] ;
M_PAREXTERN int m_delim[M_HOLDSIZ] ;
M_PAREXTERN char m_srefchartype[M_HOLDSIZ] ;
M_PAREXTERN int m_current[M_HOLDSIZ] ;
/* Options
A -- Trace of calls to m_malloc() and m_free()
B --
C -- Trace of calls to m_getachar(), putachar()
D -- Trace of encountered data characters
E -- Don't report duplicate entity declarations
F --
G --
H -- M_malloc and m_free check for valid heap
I --
J --
K --
L -- Don't limit number of possible tokens displayed by expecting()
M -- Determine start-tag minimization strictly according to the Standard
N --
O --
P --
Q --
R --
S -- Scanner trace
T -- Tag trace
U --
V --
W -- Missing tagc not considered an error
X --
Y --
Z --
*/
M_PAREXTERN LOGICAL m_malftrace M_PARINIT(FALSE) ;
M_PAREXTERN LOGICAL m_chtrace M_PARINIT(FALSE) ;
M_PAREXTERN LOGICAL m_cdtrace M_PARINIT(FALSE) ;
M_PAREXTERN LOGICAL m_entdupchk M_PARINIT(TRUE) ;
M_PAREXTERN LOGICAL m_heapchk M_PARINIT(FALSE) ;
M_PAREXTERN LOGICAL m_explimit M_PARINIT(TRUE) ;
M_PAREXTERN LOGICAL m_conform M_PARINIT(FALSE) ;
M_PAREXTERN LOGICAL m_scantrace M_PARINIT(FALSE) ;
M_PAREXTERN LOGICAL m_tagtrace M_PARINIT(FALSE) ;
M_PAREXTERN LOGICAL m_wholetag M_PARINIT(FALSE) ;
M_PAREXTERN int m_toptstat ;
/* Flag that indicates when unexpected content detected after document
appears to be complete */
M_PAREXTERN LOGICAL m_aftereod M_PARINIT(FALSE) ;
/* Save standard C main program arguments */
M_PAREXTERN int m_argc ;
M_PAREXTERN char **m_argv ;
/* PARSER output file */
M_PAREXTERN FILE *m_outfile M_PARINIT(stdout) ;
M_PAREXTERN FILE *m_errfile M_PARINIT(stdout) ;
/* Save processing instruction */
M_PAREXTERN M_WCHAR m_pi[M_PILEN + 1] ;
M_PAREXTERN int m_pilen M_PARINIT(0) ;
/* Entity being defined */
M_PAREXTERN M_ENTITY *m_entity ;
M_PAREXTERN int m_entclen ;
M_PAREXTERN M_WCHAR m_entcontent[M_LITLEN + 1] ;
/* Largest positive integer */
#define M_BIGINT 0x7FFF
/* Include function prototypes */
#include "proto.h"

View File

@@ -0,0 +1,110 @@
/* $XConsortium: parutil.c /main/3 1995/11/08 09:41:25 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Parutil.c contains utility functions for program PARSER */
#include <string.h>
#include <stdio.h>
#include <malloc.h>
#include <locale.h>
#if defined(MSDOS)
#include <process.h>
#endif
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "delim.h"
#include "context.h"
#include "parser.h"
#include "entext.h"
#include "if.h"
#include "version.h"
/* Adjust parsing state after each token if necessary */
void m_adjuststate(M_NOPAR)
{
if (m_curcon == START) {
if (m_netlevel) {
if (m_stacktop->intext) m_curcon = NETCDATA ;
else if (m_textpermitted()) m_curcon = NETDATACON ;
else m_curcon = NETELCON ;
}
else {
if (m_stacktop->intext) m_curcon = POUNDCDATA ;
else if (m_textpermitted()) m_curcon = DATACON ;
else m_curcon = ELCON ;
}
}
else if (m_netlevel) switch(m_curcon) {
case POUNDCDATA:
m_curcon = NETCDATA ;
break ;
case CDATAEL:
if (m_stacktop->neednet) m_curcon = NETELCDATA ;
break ;
case RCDATAEL:
if (m_stacktop->neednet) m_curcon = NETRCDATA ;
break ;
default:
break ;
}
}
/* Tests whether the element named in a tag is defined; if so, returns its
index; otherwise return FALSE */
M_ELEMENT m_eltname(M_NOPAR)
{
M_ELEMENT eltid ;
if (eltid = m_packedlook(m_entree, m_name)) return(eltid) ;
else {
m_err1("Undefined element %s", m_name) ;
return(FALSE) ;
}
}
int get_mb_cur_max()
{
char *l;
int i;
l = getenv("LANG");
i = MB_CUR_MAX;
return i;
}
/* Program initialization */
void m_initialize(M_NOPAR)
{
char **mb_delims;
M_WCHAR **wc_delims;
m_signmsg("MARKUP PARSER - (canonical SGML)");
m_signmsg(M_VERSION) ;
m_signmsg("\n") ;
m_signmsg("(c) Copyright 1993, 1994, 1995 Hewlett-Packard Company\n");
m_signmsg("(c) Copyright 1993, 1994, 1995 International Business Machines Corp.\n");
m_signmsg("(c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.\n");
m_signmsg("(c) Copyright 1993, 1994, 1995 Unix System Labs, Inc., a subsidiary of Novell, Inc.\n");
/* commented out since interfers with testing --bad reason I know
m_getsignon() ;
*/
setlocale(LC_ALL, "");
get_mb_cur_max();
mb_delims = mb_dlmptr;
wc_delims = m_dlmptr;
while (*mb_delims)
{
*wc_delims++ = MakeWideCharString(*mb_delims);
mb_delims++;
}
*wc_delims = 0;
}

View File

@@ -0,0 +1,39 @@
/* $XConsortium: parvalok.c /main/3 1995/11/08 09:41:38 rswiston $ */
/*
Copyright 1989 Hewlett-Packard Co.
*/
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
/* Function callable by interface designers. Returns TRUE if specified value
is a legal value for the indicated parameter of the given element,
FALSE otherwise. */
#if defined(M_PROTO)
LOGICAL m_parvalok( M_WCHAR *elt , M_WCHAR *param , const M_WCHAR *value )
#else
LOGICAL m_parvalok(elt, param, value)
M_WCHAR *elt ;
M_WCHAR *param ;
M_WCHAR *value ;
#endif /* M_PROTO */
{
M_ELEMENT eltid ;
int par ;
int i ;
if (! (eltid = m_packedlook(m_entree, elt))) return(FALSE) ;
for (par = m_element[eltid - 1].parptr, i = 1 ;
i <= m_element[eltid - 1].parcount ;
par++, i++)
if (! m_wcupstrcmp(&m_pname[m_parameter[par - 1].paramname], param))
if (m_partype(par, value)) return(TRUE) ;
else return(FALSE) ;
/* No such parameter */
return(FALSE) ;
}

View File

@@ -0,0 +1,27 @@
/* $XConsortium: pi.c /main/3 1995/11/08 09:41:52 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Pi.c executes pi-code specified in the interface. */
#include "userinc.h"
#include "globdec.h"
/* Include generated code */
#include "pfile.c"
/* When a processing instruction or SDATA entity other than a CODE entity
occurs */
void m_piaction(m_pi, m_entname, m_enttype)
M_WCHAR *m_pi ;
M_WCHAR *m_entname ;
int m_enttype ;
{
m_stackpar = m_stacktop->piparam ;
(*m_ptable[m_stacktop->picase])(m_pi, m_entname, m_enttype) ;
}

View File

@@ -0,0 +1,17 @@
/* $XConsortium: procscmp.c /main/3 1995/11/08 09:42:07 rswiston $ */
/*
Copyright 1986 Tandem Computers Incorporated.
This product and information is proprietary of Tandem Computers Incorporated.
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Procscmp.c prefixes the interface's procs.c file with appropriate
declarations so it can be compiled. */
#include "userinc.h"
#include "globdec.h"
/* Include any procedures specified by the interface designer */
#include "procs.c"

View File

@@ -0,0 +1,825 @@
/* $XConsortium: proto.h /main/3 1995/11/08 09:42:21 rswiston $ */
int m_actgetc(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_adjuststate(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL m_allwhite(
#if defined(M_PROTO)
const M_WCHAR *string
#endif
) ;
void m_attval(
#if defined(M_PROTO)
M_WCHAR *string
#endif
) ;
LOGICAL m_attvonly(
#if defined(M_PROTO)
M_WCHAR *string
#endif
) ;
int m_checkstart(
#if defined(M_PROTO)
M_ELEMENT val
#endif
) ;
LOGICAL m_ckend(
#if defined(M_PROTO)
M_ELEMENT val, LOGICAL neednet
#endif
) ;
void m_ckmap(
#if defined(M_PROTO)
M_WCHAR *name, LOGICAL useoradd
#endif
) ;
void m_closent(
#if defined(M_PROTO)
void *m_ptr
#endif
) ;
void m_codeent(
#if defined(M_PROTO)
int m_ent
#endif
) ;
M_PARSE *m_copystackelt(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
M_WCHAR *m_cyclent(
#if defined(M_PROTO)
LOGICAL init, unsigned char *type, M_WCHAR **content,
unsigned char *wheredef
#endif
) ;
void m_dispcurelt(
#if defined(M_PROTO)
M_WCHAR *file, int line
#endif
) ;
void m_done(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_dumpline(
#if defined(M_PROTO)
M_WCHAR *file, int line
#endif
) ;
void m_eduptype(
#if defined(M_PROTO)
int type
#endif
) ;
M_ELEMENT m_eltname(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_endaction(
#if defined(M_PROTO)
M_ELEMENT m_elt
#endif
) ;
void m_endcase(
#if defined(M_PROTO)
int m_action
#endif
) ;
void m_endtag(
#if defined(M_PROTO)
M_ELEMENT c
#endif
) ;
void m_entexpand(
#if defined(M_PROTO)
M_ENTITY *openent
#endif
) ;
void m_eprefix(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_err1(
#if defined(M_PROTO)
const char *text, const M_WCHAR *arg
#endif
) ;
void m_err2(
#if defined(M_PROTO)
const char *text, const M_WCHAR *arg1, const M_WCHAR *arg2
#endif
) ;
void m_err3(
#if defined(M_PROTO)
char *text, M_WCHAR *arg1, M_WCHAR *arg2, M_WCHAR *arg3
#endif
) ;
void m_err4(
#if defined(M_PROTO)
char *text, M_WCHAR *arg1, M_WCHAR *arg2, M_WCHAR *arg3, M_WCHAR *arg4
#endif
) ;
void m_err5(
#if defined(M_PROTO)
char *text, M_WCHAR *arg1, M_WCHAR *arg2, M_WCHAR *arg3,
M_WCHAR *arg4, M_WCHAR *arg5
#endif
) ;
void m_err6(
#if defined(M_PROTO)
char *text, M_WCHAR *arg1, M_WCHAR *arg2, M_WCHAR *arg3,
M_WCHAR *arg4, M_WCHAR *arg5, M_WCHAR *arg6
#endif
) ;
void m_err7(
#if defined(M_PROTO)
char *text, M_WCHAR *arg1, M_WCHAR *arg2, M_WCHAR *arg3,
M_WCHAR *arg4, M_WCHAR *arg5, M_WCHAR *arg6, M_WCHAR *arg7
#endif
) ;
void m_errline(
#if defined(M_PROTO)
char *p
#endif
) ;
void m_error(
#if defined(M_PROTO)
char *text
#endif
) ;
void m_esuffix(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_exit(
#if defined(M_PROTO)
int status
#endif
) ;
void m_etcomplete(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL m_excluded(
#if defined(M_PROTO)
M_ELEMENT elt
#endif
) ;
void m_expecting(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_expexpand(
#if defined(M_PROTO)
LOGICAL *expstart, M_STATE node, LOGICAL *required, LOGICAL *data
#endif
) ;
void m_expline(
#if defined(M_PROTO)
LOGICAL *expstart, LOGICAL *data, M_ELEMENT label
#endif
) ;
void m_exptend(
#if defined(M_PROTO)
LOGICAL *expstart, M_PARSE *stackptr
#endif
) ;
int m_findact(
#if defined(M_PROTO)
M_ELEMENT elt, int *array
#endif
) ;
void m_findatt(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_findchain(
#if defined(M_PROTO)
M_PARSE *stackptr, int start, int chainin, int *chainout, int *index,
LOGICAL wild
#endif
) ;
int m_findpar(
#if defined(M_PROTO)
const char *elt, const char *param, const M_WCHAR *value
#endif
) ;
M_ELEMENT m_findunique(
#if defined(M_PROTO)
M_STATE from, int *newleft
#endif
) ;
void m_frcend(
#if defined(M_PROTO)
M_ELEMENT val
#endif
) ;
void m_frcstart(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_free(
#if defined(M_PROTO)
void *block, char *msg
#endif
) ;
void m_freeFSA(
#if defined(M_PROTO)
M_PARSE *stackelt
#endif
) ;
void m_freemin(
#if defined(M_PROTO)
M_MIN *min
, char *msg
#endif
) ;
void m_freeparam(
#if defined(M_PROTO)
M_PARSE *stackelt
#endif
) ;
LOGICAL m_gendelim(
#if defined(M_PROTO)
int srlen, int context
#endif
) ;
int m_getachar(
#if defined(M_PROTO)
M_HOLDTYPE *dchar
#endif
) ;
int m_getc(
#if defined(M_PROTO)
void *m_ptr
#endif
) ;
int mb_getwc(
#if defined(M_PROTO)
void *m_ptr
#endif
) ;
void *m_getdata(
#if defined(M_PROTO)
int n, LOGICAL *flag
#endif
) ;
void m_getline(
#if defined(M_PROTO)
M_WCHAR **file, int *line
#endif
) ;
void m_getname(
#if defined(M_PROTO)
M_WCHAR first
#endif
) ;
void m_getsignon(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int m_gettoken(
#if defined(M_PROTO)
int *c, M_HOLDTYPE *dchar, int context
#endif
) ;
void m_globes(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_globss(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_holdproc(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_inctest(
#if defined(M_PROTO)
int *count, int limit, char *message
#endif
) ;
void m_initctype(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_initialize(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_lastchars(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int m_level(
#if defined(M_PROTO)
M_WCHAR *elt
#endif
) ;
int m_mblevel(
#if defined(M_PROTO)
char *elt
#endif
) ;
void m_litproc(
#if defined(M_PROTO)
int delim
#endif
) ;
void m_longent(
#if defined(M_PROTO)
int context
#endif
) ;
LOGICAL m_lookent(
#if defined(M_PROTO)
M_WCHAR *name, unsigned char *type, M_WCHAR **content,
unsigned char *wheredef
#endif
) ;
void main(
#if defined(M_PROTO)
int argc, char **argv
#endif
) ;
void *m_malloc(
#if defined(M_PROTO)
int size, char *msg
#endif
) ;
void m_missingtagc(
#if defined(M_PROTO)
int c, M_HOLDTYPE dchar, LOGICAL start
#endif
) ;
LOGICAL m_nextand(
#if defined(M_PROTO)
M_OPENFSA *thisfsa, M_ELEMENT label
#endif
) ;
void m_nextdelimchar(
#if defined(M_PROTO)
int *n, int i, LOGICAL *linestart, LOGICAL newlinestart, LOGICAL skipblank,
unsigned char type
#endif
) ;
void m_ntrent(
#if defined(M_PROTO)
M_WCHAR *p
#endif
) ;
void m_nullendtag(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL m_omitend(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL m_omitstart(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_openchk(
#if defined(M_PROTO)
FILE **ptr, char *name, char *mode
#endif
) ;
void *m_openent(
#if defined(M_PROTO)
M_WCHAR *entcontent
#endif
) ;
void *m_openfirst(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_optstring(
#if defined(M_PROTO)
char *p
#endif
) ;
int m_packedlook(
#if defined(M_PROTO)
M_PTRIE *xptrie, M_WCHAR *name
#endif
) ;
int m_parcount(
#if defined(M_PROTO)
M_WCHAR *elt
#endif
) ;
M_WCHAR *m_pardefault(
#if defined(M_PROTO)
M_WCHAR *elt, M_WCHAR *param, unsigned char *type
#endif
) ;
M_WCHAR *m_parent(
#if defined(M_PROTO)
int n
#endif
) ;
M_WCHAR *m_parname(
#if defined(M_PROTO)
M_WCHAR *elt, int n
#endif
) ;
M_WCHAR *m_mbparname(
#if defined(M_PROTO)
char *elt, int n
#endif
) ;
const M_WCHAR *m_partype(
#if defined(M_PROTO)
const int par, const M_WCHAR *string
#endif
) ;
void m_parupper(
#if defined(M_PROTO)
int par, M_WCHAR *string
#endif
) ;
LOGICAL m_parvalok(
#if defined(M_PROTO)
M_WCHAR *elt, M_WCHAR *param, const M_WCHAR *value
#endif
) ;
void m_piaction(
#if defined(M_PROTO)
M_WCHAR *m_pi, M_WCHAR *m_entname, int m_enttype
#endif
) ;
void m_pop(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_push(
#if defined(M_PROTO)
M_ELEMENT elt, M_STATE current, LOGICAL need
#endif
) ;
LOGICAL m_putdata(
#if defined(M_PROTO)
void *data, int n
#endif
) ;
void m_readcomments(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void *m_realloc(
#if defined(M_PROTO)
void *ptr, int size, char *msg
#endif
) ;
int m_scan(
#if defined(M_PROTO)
LOGICAL prolog
#endif
) ;
void m_setmap(
#if defined(M_PROTO)
int map, LOGICAL useoradd
#endif
) ;
void m_setoptions(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_setparam(
#if defined(M_PROTO)
M_WCHAR **cvar, int par
#endif
) ;
void m_shortref(
#if defined(M_PROTO)
int context
#endif
) ;
void m_showcurelt(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_signmsg(
#if defined(M_PROTO)
char *p
#endif
) ;
void m_sigre(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_startdoc(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_startmsg(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_stcaction(
#if defined(M_PROTO)
M_WCHAR *m_string, LOGICAL M_START, LOGICAL M_END
#endif
) ;
void m_stcomplete(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_stkdefaultparams(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_stkonedef(
#if defined(M_PROTO)
int par, M_ELEMENT scanel, M_WCHAR **poccur, int i
#endif
) ;
void m_stkparams(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_strtaction(
#if defined(M_PROTO)
M_ELEMENT m_elt
#endif
) ;
void m_strtcase(
#if defined(M_PROTO)
int m_action
#endif
) ;
void m_strtcdata(
#if defined(M_PROTO)
int scanval
#endif
) ;
LOGICAL m_strtproc(
#if defined(M_PROTO)
M_ELEMENT scanval
#endif
) ;
void m_strttag(
#if defined(M_PROTO)
M_ELEMENT val, LOGICAL net
#endif
) ;
void m_textaction(
#if defined(M_PROTO)
M_WCHAR m_textchar
#endif
) ;
void m_textout(
#if defined(M_PROTO)
char *format, LOGICAL start, LOGICAL end
#endif
) ;
LOGICAL m_textpermitted(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
M_WCHAR *m_thisfile(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
int m_thisline(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
void m_trace(
#if defined(M_PROTO)
char *p
#endif
) ;
void m_wctrace(
#if defined(M_PROTO)
M_WCHAR *p
#endif
) ;
LOGICAL m_transition(
#if defined(M_PROTO)
M_ELEMENT label, LOGICAL recur
#endif
) ;
void m_undodelim(
#if defined(M_PROTO)
M_WCHAR *delim, LOGICAL flag
#endif
) ;
void m_ungetachar(
#if defined(M_PROTO)
int c, M_HOLDTYPE dchar, LOGICAL preread
#endif
) ;
void m_updatedefault(
#if defined(M_PROTO)
const int par, const M_WCHAR *string
#endif
) ;
int m_wcupstrcmp(
#if defined(M_PROTO)
const M_WCHAR *p, const M_WCHAR *q
#endif
) ;
int m_wcmbupstrcmp(
#if defined(M_PROTO)
const M_WCHAR *p, const char *q
#endif
) ;
int m_mbmbupstrcmp(
#if defined(M_PROTO)
const char *p, const char *q
#endif
) ;
LOGICAL m_validinpar(
#if defined(M_PROTO)
M_WCHAR *string
#endif
) ;
LOGICAL m_vldentref(
#if defined(M_PROTO)
M_NOPAR
#endif
) ;
LOGICAL m_whitespace(
#if defined(M_PROTO)
M_WCHAR c
#endif
) ;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
/* $XConsortium: setopt.c /main/3 1995/11/08 09:42:58 rswiston $ */
/*
Copyright 1988, 1989 Hewlett-Packard Co.
*/
#include "userinc.h"
#include "globdec.h"
/* Set program options */
void m_setoptions(M_NOPAR)
{
if (m_argc > 1) m_optstring(m_argv[1]) ;
}

View File

@@ -0,0 +1,22 @@
/* $XConsortium: setpar.c /main/3 1995/11/08 09:43:12 rswiston $ */
/*
Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
*/
/* Setparam.c is used by interfaces where code accesses an element's
attributes */
#include <stdio.h>
#include "basic.h"
#include "trie.h"
#include "dtdext.h"
#include "parser.h"
/* Set a user-defined C variable to the corresponding parameter value */
void m_setparam(cvar, par)
M_WCHAR **cvar ;
int par ;
{
*cvar = m_stackpar->param[par] ;
}

Some files were not shown because too many files have changed in this diff Show More