1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

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,14 @@
XCOMM $XConsortium: Imakefile /main/6 1996/10/24 00:10:08 cde-hp $
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
#if !UseNSGMLS
SGMLSDIR = sgmls
#endif
SUBDIRS = doc2sdl lib tcl instant $(SGMLSDIR) xlate_locale
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))

View file

@ -0,0 +1,67 @@
/* $XConsortium: README /main/2 1996/07/15 14:08:58 drk $ */
This directory and its subdirectories contain the sources for
dtdocbook, the DocBook to SDL converter.
The directories here are:
doc2sdl
docbook.cmap - character mappings, used by "instant"
docbook.tcl - Tcl code for conversion actions, used by "instant"
docbook.ts - translation spec to be read by "instant"
docbook.tss - base SDL style sheet (augmented by docbook.tcl)
dtdocbook - the driver script for the dtdocbook passes
*catalog.sh - a script to build symbolic links to PUBLIC ids
*env.csh - csh code to be sourced to set environment vars
*env.sh - sh/ksh code to be sourced to set environment vars
[The files with an asterisk are to be modified to customize the
environment of dtdocbook for a particular system and directory
structure. See the files themselves for comments regarding
their modification.]
instant
[C source code for the program "instant" which reads the output
of sgmls (the element structure information set, or ESIS),
builds a tree structure from that output and provides a set of
commands to walk that tree and emit text or interpret the code
in docbook.tcl to accomplish the DocBook to SDL conversion.
The program "instant" will be called by dtdocbook passing it a
set of commands in the file docbook.ts (translation
specification).]
lib
tptregexp
[A regular expression parser library to be linked into
"instant".]
sgml
docbook.2.2.1.dtd - the document type definition for DocBook
docbook.sgml - an SGML declaration for DocBook
iso-box.gml - ISO box and line drawing entities
iso-dia.gml - ISO diacritical marks
iso-grk1.gml - ISO greek alphabet 1
iso-grk3.gml - ISO greek alphabet 3
iso-lat1.gml - ISO latin 1 alphabet
iso-lat2.gml - ISO latin 2 alphabet
iso-num.gml - ISO numeric entities
iso-pub.gml - ISO publishing entities
iso-tech.gml - ISO technical entities
[The contents of this directory are provided for
convenience during the snapshot only. These files will
eventually be put in a location common to both dtinfo and
dtdocbook.]
sgmls
[C source code for the program "sgmls", an SGML parser.]
tcl
[C source code for the Tool Command Language (Tcl) library,
libtcl.a, to be linked into "instant".]

View file

@ -0,0 +1,8 @@
# $XConsortium: strings /main/2 1996/10/26 10:23:35 rws $
"Home Topic" "Home Topic"
"No home topic (PartIntro) was specified by the author." "No home topic (PartIntro) was specified by the author."
"See" "See"
"See Also" "See Also"
"NAME" "NAME"
"SYNOPSIS" "SYNOPSIS"

View file

@ -0,0 +1,9 @@
XCOMM $XConsortium: Imakefile /main/2 1996/06/19 17:12:02 drk $
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
SUBDIRS = SGML
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))

View file

@ -0,0 +1,35 @@
XCOMM $XConsortium: Imakefile /main/6 1996/09/23 09:29:42 rws $
LinkSourceFile(dtinfo.af,$(CDESRC)/dtinfo/dtinfogen/infolib/C.ISO-8859-1/SGML)
LinkSourceFile(docbook.dtd,$(CDESRC)/dtinfo/dtinfogen/infolib/C.ISO-8859-1/SGML)
#if !UseNSGMLS
XCOMM symlinks used by dtdocbook when run from the build tree
XCOMM really ugly but will do the trick until nsgmls is used...
includes:: clean
$(LN) dtinfo.af "-%%Common_Desktop_Environment%%ENTITIES_DtInfo_Architectural_Forms%%EN"
$(LN) docbook.dtd "-%%HaL_and_O'Reilly%%DTD_DocBook%%EN"
$(LN) iso-lat1.gml "ISO_8879-1986%%ENTITIES_Added_Latin_1%%EN"
$(LN) iso-lat2.gml "ISO_8879-1986%%ENTITIES_Added_Latin_2%%EN"
$(LN) iso-box.gml "ISO_8879-1986%%ENTITIES_Box_and_Line_Drawing%%EN"
$(LN) iso-dia.gml "ISO_8879-1986%%ENTITIES_Diacritical_Marks%%EN"
$(LN) iso-tech.gml "ISO_8879-1986%%ENTITIES_General_Technical%%EN"
$(LN) iso-grk1.gml "ISO_8879-1986%%ENTITIES_Greek_Letters%%EN"
$(LN) iso-grk3.gml "ISO_8879-1986%%ENTITIES_Greek_Symbols%%EN"
$(LN) iso-num.gml "ISO_8879-1986%%ENTITIES_Numeric_and_Special_Graphic%%EN"
$(LN) iso-pub.gml "ISO_8879-1986%%ENTITIES_Publishing%%EN"
clean::
$(RM) -- "-%%Common_Desktop_Environment%%ENTITIES_DtInfo_Architectural_Forms%%EN"
$(RM) -- "-%%HaL_and_O'Reilly%%DTD_DocBook%%EN"
$(RM) "ISO_8879-1986%%ENTITIES_Added_Latin_1%%EN"
$(RM) "ISO_8879-1986%%ENTITIES_Added_Latin_2%%EN"
$(RM) "ISO_8879-1986%%ENTITIES_Box_and_Line_Drawing%%EN"
$(RM) "ISO_8879-1986%%ENTITIES_Diacritical_Marks%%EN"
$(RM) "ISO_8879-1986%%ENTITIES_General_Technical%%EN"
$(RM) "ISO_8879-1986%%ENTITIES_Greek_Letters%%EN"
$(RM) "ISO_8879-1986%%ENTITIES_Greek_Symbols%%EN"
$(RM) "ISO_8879-1986%%ENTITIES_Numeric_and_Special_Graphic%%EN"
$(RM) "ISO_8879-1986%%ENTITIES_Publishing%%EN"
#endif /* !UseNSGMLS */

View file

@ -0,0 +1,15 @@
SGMLDECL ../docbook.sgml
PUBLIC "-//HaL and O'Reilly//DTD DocBook//EN" ./docbook.dtd
PUBLIC "-//Common Desktop Environment//ENTITIES DtInfo Architectural Forms//EN"
./dtinfo.af
PUBLIC "ISO 8879-1986//ENTITIES Numeric and Special Graphic//EN" ./iso-num.gml
PUBLIC "ISO 8879-1986//ENTITIES Added Latin 1//EN" ./iso-lat1.gml
PUBLIC "ISO 8879-1986//ENTITIES Added Latin 2//EN" ./iso-lat2.gml
PUBLIC "ISO 8879-1986//ENTITIES Box and Line Drawing//EN" ./iso-box.gml
PUBLIC "ISO 8879-1986//ENTITIES Diacritical Marks//EN" ./iso-dia.gml
PUBLIC "ISO 8879-1986//ENTITIES General Technical//EN" ./iso-tech.gml
PUBLIC "ISO 8879-1986//ENTITIES Greek Symbols//EN" ./iso-grk3.gml
PUBLIC "ISO 8879-1986//ENTITIES Publishing//EN" ./iso-pub.gml

View file

@ -0,0 +1,63 @@
<!-- $XConsortium: iso-box.gml /main/3 1996/06/19 17:12:11 drk $ -->
<!-- (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Character entity set. Typical invocation:
<!ENTITY % ISObox PUBLIC
"ISO 8879-1986//ENTITIES Box and Line Drawing//EN">
%ISObox;
-->
<!-- All names are in the form: box1234, where:
box = constants that identify a box drawing entity.
1&2 = v, V, u, U, d, D, Ud, or uD, as follows:
v = vertical line for full height.
u = upper half of vertical line.
d = downward (lower) half of vertical line.
3&4 = h, H, l, L, r, R, Lr, or lR, as follows:
h = horizontal line for full width.
l = left half of horizontal line.
r = right half of horizontal line.
In all cases, an upper-case letter means a double or heavy line.
-->
<!ENTITY boxh SDATA "[boxh ]"--horizontal line -->
<!ENTITY boxv SDATA "[boxv ]"--vertical line-->
<!ENTITY boxur SDATA "[boxur ]"--upper right quadrant-->
<!ENTITY boxul SDATA "[boxul ]"--upper left quadrant-->
<!ENTITY boxdl SDATA "[boxdl ]"--lower left quadrant-->
<!ENTITY boxdr SDATA "[boxdr ]"--lower right quadrant-->
<!ENTITY boxvr SDATA "[boxvr ]"--upper and lower right quadrants-->
<!ENTITY boxhu SDATA "[boxhu ]"--upper left and right quadrants-->
<!ENTITY boxvl SDATA "[boxvl ]"--upper and lower left quadrants-->
<!ENTITY boxhd SDATA "[boxhd ]"--lower left and right quadrants-->
<!ENTITY boxvh SDATA "[boxvh ]"--all four quadrants-->
<!ENTITY boxvR SDATA "[boxvR ]"--upper and lower right quadrants-->
<!ENTITY boxhU SDATA "[boxhU ]"--upper left and right quadrants-->
<!ENTITY boxvL SDATA "[boxvL ]"--upper and lower left quadrants-->
<!ENTITY boxhD SDATA "[boxhD ]"--lower left and right quadrants-->
<!ENTITY boxvH SDATA "[boxvH ]"--all four quadrants-->
<!ENTITY boxH SDATA "[boxH ]"--horizontal line-->
<!ENTITY boxV SDATA "[boxV ]"--vertical line-->
<!ENTITY boxUR SDATA "[boxUR ]"--upper right quadrant-->
<!ENTITY boxUL SDATA "[boxUL ]"--upper left quadrant-->
<!ENTITY boxDL SDATA "[boxDL ]"--lower left quadrant-->
<!ENTITY boxDR SDATA "[boxDR ]"--lower right quadrant-->
<!ENTITY boxVR SDATA "[boxVR ]"--upper and lower right quadrants-->
<!ENTITY boxHU SDATA "[boxHU ]"--upper left and right quadrants-->
<!ENTITY boxVL SDATA "[boxVL ]"--upper and lower left quadrants-->
<!ENTITY boxHD SDATA "[boxHD ]"--lower left and right quadrants-->
<!ENTITY boxVH SDATA "[boxVH ]"--all four quadrants-->
<!ENTITY boxVr SDATA "[boxVr ]"--upper and lower right quadrants-->
<!ENTITY boxHu SDATA "[boxHu ]"--upper left and right quadrants-->
<!ENTITY boxVl SDATA "[boxVl ]"--upper and lower left quadrants-->
<!ENTITY boxHd SDATA "[boxHd ]"--lower left and right quadrants-->
<!ENTITY boxVh SDATA "[boxVh ]"--all four quadrants-->
<!ENTITY boxuR SDATA "[boxuR ]"--upper right quadrant-->
<!ENTITY boxUl SDATA "[boxUl ]"--upper left quadrant-->
<!ENTITY boxdL SDATA "[boxdL ]"--lower left quadrant-->
<!ENTITY boxDr SDATA "[boxDr ]"--lower right quadrant-->
<!ENTITY boxUr SDATA "[boxUr ]"--upper right quadrant-->
<!ENTITY boxuL SDATA "[boxuL ]"--upper left quadrant-->
<!ENTITY boxDl SDATA "[boxDl ]"--lower left quadrant-->
<!ENTITY boxdR SDATA "[boxdR ]"--lower right quadrant-->

View file

@ -0,0 +1,25 @@
<!-- $XConsortium: iso-dia.gml /main/3 1996/06/19 17:12:15 drk $ -->
<!-- (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Character entity set. Typical invocation:
<!ENTITY % ISOdia PUBLIC
"ISO 8879-1986//ENTITIES Diacritical Marks//EN">
%ISOdia;
-->
<!ENTITY acute SDATA "[acute ]"--=acute accent-->
<!ENTITY breve SDATA "[breve ]"--=breve-->
<!ENTITY caron SDATA "[caron ]"--=caron-->
<!ENTITY cedil SDATA "[cedil ]"--=cedilla-->
<!ENTITY circ SDATA "[circ ]"--=circumflex accent-->
<!ENTITY dblac SDATA "[dblac ]"--=double acute accent-->
<!ENTITY die SDATA "[die ]"--=dieresis-->
<!ENTITY dot SDATA "[dot ]"--=dot above-->
<!ENTITY grave SDATA "[grave ]"--=grave accent-->
<!ENTITY macr SDATA "[macr ]"--=macron-->
<!ENTITY ogon SDATA "[ogon ]"--=ogonek-->
<!ENTITY ring SDATA "[ring ]"--=ring-->
<!ENTITY tilde SDATA "[tilde ]"--=tilde-->
<!ENTITY uml SDATA "[uml ]"--=umlaut mark-->

View file

@ -0,0 +1,60 @@
<!-- $XConsortium: iso-grk1.gml /main/3 1996/06/19 17:12:20 drk $ -->
<!-- (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Character entity set. Typical invocation:
<!ENTITY % ISOgrk1 PUBLIC
"ISO 8879-1986//ENTITIES Greek Letters//EN">
%ISOgrk1;
-->
<!ENTITY agr SDATA "[agr ]"--=small alpha, Greek-->
<!ENTITY Agr SDATA "[Agr ]"--=capital Alpha, Greek-->
<!ENTITY bgr SDATA "[bgr ]"--=small beta, Greek-->
<!ENTITY Bgr SDATA "[Bgr ]"--=capital Beta, Greek-->
<!ENTITY ggr SDATA "[ggr ]"--=small gamma, Greek-->
<!ENTITY Ggr SDATA "[Ggr ]"--=capital Gamma, Greek-->
<!ENTITY dgr SDATA "[dgr ]"--=small delta, Greek-->
<!ENTITY Dgr SDATA "[Dgr ]"--=capital Delta, Greek-->
<!ENTITY egr SDATA "[egr ]"--=small epsilon, Greek-->
<!ENTITY Egr SDATA "[Egr ]"--=capital Epsilon, Greek-->
<!ENTITY zgr SDATA "[zgr ]"--=small zeta, Greek-->
<!ENTITY Zgr SDATA "[Zgr ]"--=capital Zeta, Greek-->
<!ENTITY eegr SDATA "[eegr ]"--=small eta, Greek-->
<!ENTITY EEgr SDATA "[EEgr ]"--=capital Eta, Greek-->
<!ENTITY thgr SDATA "[thgr ]"--=small theta, Greek-->
<!ENTITY THgr SDATA "[THgr ]"--=capital Theta, Greek-->
<!ENTITY igr SDATA "[igr ]"--=small iota, Greek-->
<!ENTITY Igr SDATA "[Igr ]"--=capital Iota, Greek-->
<!ENTITY kgr SDATA "[kgr ]"--=small kappa, Greek-->
<!ENTITY Kgr SDATA "[Kgr ]"--=capital Kappa, Greek-->
<!ENTITY lgr SDATA "[lgr ]"--=small lambda, Greek-->
<!ENTITY Lgr SDATA "[Lgr ]"--=capital Lambda, Greek-->
<!ENTITY mgr SDATA "[mgr ]"--=small mu, Greek-->
<!ENTITY Mgr SDATA "[Mgr ]"--=capital Mu, Greek-->
<!ENTITY ngr SDATA "[ngr ]"--=small nu, Greek-->
<!ENTITY Ngr SDATA "[Ngr ]"--=capital Nu, Greek-->
<!ENTITY xgr SDATA "[xgr ]"--=small xi, Greek-->
<!ENTITY Xgr SDATA "[Xgr ]"--=capital Xi, Greek-->
<!ENTITY ogr SDATA "[ogr ]"--=small omicron, Greek-->
<!ENTITY Ogr SDATA "[Ogr ]"--=capital Omicron, Greek-->
<!ENTITY pgr SDATA "[pgr ]"--=small pi, Greek-->
<!ENTITY Pgr SDATA "[Pgr ]"--=capital Pi, Greek-->
<!ENTITY rgr SDATA "[rgr ]"--=small rho, Greek-->
<!ENTITY Rgr SDATA "[Rgr ]"--=capital Rho, Greek-->
<!ENTITY sgr SDATA "[sgr ]"--=small sigma, Greek-->
<!ENTITY Sgr SDATA "[Sgr ]"--=capital Sigma, Greek-->
<!ENTITY sfgr SDATA "[sfgr ]"--=final small sigma, Greek-->
<!ENTITY tgr SDATA "[tgr ]"--=small tau, Greek-->
<!ENTITY Tgr SDATA "[Tgr ]"--=capital Tau, Greek-->
<!ENTITY ugr SDATA "[ugr ]"--=small upsilon, Greek-->
<!ENTITY Ugr SDATA "[Ugr ]"--=capital Upsilon, Greek-->
<!ENTITY phgr SDATA "[phgr ]"--=small phi, Greek-->
<!ENTITY PHgr SDATA "[PHgr ]"--=capital Phi, Greek-->
<!ENTITY khgr SDATA "[khgr ]"--=small chi, Greek-->
<!ENTITY KHgr SDATA "[KHgr ]"--=capital Chi, Greek-->
<!ENTITY psgr SDATA "[psgr ]"--=small psi, Greek-->
<!ENTITY PSgr SDATA "[PSgr ]"--=capital Psi, Greek-->
<!ENTITY ohgr SDATA "[ohgr ]"--=small omega, Greek-->
<!ENTITY OHgr SDATA "[OHgr ]"--=capital Omega, Greek-->

View file

@ -0,0 +1,54 @@
<!-- $XConsortium: iso-grk3.gml /main/3 1996/06/19 17:12:24 drk $ -->
<!-- (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Character entity set. Typical invocation:
<!ENTITY % ISOgrk3 PUBLIC
"ISO 8879-1986//ENTITIES Greek Symbols//EN">
%ISOgrk3;
-->
<!ENTITY alpha SDATA "[alpha ]"--=small alpha, Greek-->
<!ENTITY beta SDATA "[beta ]"--=small beta, Greek-->
<!ENTITY gamma SDATA "[gamma ]"--=small gamma, Greek-->
<!ENTITY Gamma SDATA "[Gamma ]"--=capital Gamma, Greek-->
<!ENTITY gammad SDATA "[gammad]"--/digamma-->
<!ENTITY delta SDATA "[delta ]"--=small delta, Greek-->
<!ENTITY Delta SDATA "[Delta ]"--=capital Delta, Greek-->
<!ENTITY epsi SDATA "[epsi ]"--=small epsilon, Greek-->
<!ENTITY epsiv SDATA "[epsiv ]"--/varepsilon-->
<!ENTITY epsis SDATA "[epsis ]"--/straightepsilon-->
<!ENTITY zeta SDATA "[zeta ]"--=small zeta, Greek-->
<!ENTITY eta SDATA "[eta ]"--=small eta, Greek-->
<!ENTITY thetas SDATA "[thetas]"--straight theta-->
<!ENTITY Theta SDATA "[Theta ]"--=capital Theta, Greek-->
<!ENTITY thetav SDATA "[thetav]"--/vartheta - curly or open theta-->
<!ENTITY iota SDATA "[iota ]"--=small iota, Greek-->
<!ENTITY kappa SDATA "[kappa ]"--=small kappa, Greek-->
<!ENTITY kappav SDATA "[kappav]"--/varkappa-->
<!ENTITY lambda SDATA "[lambda]"--=small lambda, Greek-->
<!ENTITY Lambda SDATA "[Lambda]"--=capital Lambda, Greek-->
<!ENTITY mu SDATA "[mu ]"--=small mu, Greek-->
<!ENTITY nu SDATA "[nu ]"--=small nu, Greek-->
<!ENTITY xi SDATA "[xi ]"--=small xi, Greek-->
<!ENTITY Xi SDATA "[Xi ]"--=capital Xi, Greek-->
<!ENTITY pi SDATA "[pi ]"--=small pi, Greek-->
<!ENTITY piv SDATA "[piv ]"--/varpi-->
<!ENTITY Pi SDATA "[Pi ]"--=capital Pi, Greek-->
<!ENTITY rho SDATA "[rho ]"--=small rho, Greek-->
<!ENTITY rhov SDATA "[rhov ]"--/varrho-->
<!ENTITY sigma SDATA "[sigma ]"--=small sigma, Greek-->
<!ENTITY Sigma SDATA "[Sigma ]"--=capital Sigma, Greek-->
<!ENTITY sigmav SDATA "[sigmav]"--/varsigma-->
<!ENTITY tau SDATA "[tau ]"--=small tau, Greek-->
<!ENTITY upsi SDATA "[upsi ]"--=small upsilon, Greek-->
<!ENTITY Upsi SDATA "[Upsi ]"--=capital Upsilon, Greek-->
<!ENTITY phis SDATA "[phis ]"--/straightphi - straight phi-->
<!ENTITY Phi SDATA "[Phi ]"--=capital Phi, Greek-->
<!ENTITY phiv SDATA "[phiv ]"--/varphi - curly or open phi-->
<!ENTITY chi SDATA "[chi ]"--=small chi, Greek-->
<!ENTITY psi SDATA "[psi ]"--=small psi, Greek-->
<!ENTITY Psi SDATA "[Psi ]"--=capital Psi, Greek-->
<!ENTITY omega SDATA "[omega ]"--=small omega, Greek-->
<!ENTITY Omega SDATA "[Omega ]"--=capital Omega, Greek-->

View file

@ -0,0 +1,73 @@
<!-- $XConsortium: iso-lat1.gml /main/3 1996/06/19 17:12:28 drk $ -->
<!-- (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Character entity set. Typical invocation:
<!ENTITY % ISOlat1 PUBLIC
"ISO 8879-1986//ENTITIES Added Latin 1//EN">
%ISOlat1;
-->
<!ENTITY aacute SDATA "[aacute]"--=small a, acute accent-->
<!ENTITY Aacute SDATA "[Aacute]"--=capital A, acute accent-->
<!ENTITY acirc SDATA "[acirc ]"--=small a, circumflex accent-->
<!ENTITY Acirc SDATA "[Acirc ]"--=capital A, circumflex accent-->
<!ENTITY agrave SDATA "[agrave]"--=small a, grave accent-->
<!ENTITY Agrave SDATA "[Agrave]"--=capital A, grave accent-->
<!ENTITY aring SDATA "[aring ]"--=small a, ring-->
<!ENTITY Aring SDATA "[Aring ]"--=capital A, ring-->
<!ENTITY atilde SDATA "[atilde]"--=small a, tilde-->
<!ENTITY Atilde SDATA "[Atilde]"--=capital A, tilde-->
<!ENTITY auml SDATA "[auml ]"--=small a, dieresis or umlaut mark-->
<!ENTITY Auml SDATA "[Auml ]"--=capital A, dieresis or umlaut mark-->
<!ENTITY aelig SDATA "[aelig ]"--=small ae diphthong (ligature)-->
<!ENTITY AElig SDATA "[AElig ]"--=capital AE diphthong (ligature)-->
<!ENTITY ccedil SDATA "[ccedil]"--=small c, cedilla-->
<!ENTITY Ccedil SDATA "[Ccedil]"--=capital C, cedilla-->
<!ENTITY eth SDATA "[eth ]"--=small eth, Icelandic-->
<!ENTITY ETH SDATA "[ETH ]"--=capital Eth, Icelandic-->
<!ENTITY eacute SDATA "[eacute]"--=small e, acute accent-->
<!ENTITY Eacute SDATA "[Eacute]"--=capital E, acute accent-->
<!ENTITY ecirc SDATA "[ecirc ]"--=small e, circumflex accent-->
<!ENTITY Ecirc SDATA "[Ecirc ]"--=capital E, circumflex accent-->
<!ENTITY egrave SDATA "[egrave]"--=small e, grave accent-->
<!ENTITY Egrave SDATA "[Egrave]"--=capital E, grave accent-->
<!ENTITY euml SDATA "[euml ]"--=small e, dieresis or umlaut mark-->
<!ENTITY Euml SDATA "[Euml ]"--=capital E, dieresis or umlaut mark-->
<!ENTITY iacute SDATA "[iacute]"--=small i, acute accent-->
<!ENTITY Iacute SDATA "[Iacute]"--=capital I, acute accent-->
<!ENTITY icirc SDATA "[icirc ]"--=small i, circumflex accent-->
<!ENTITY Icirc SDATA "[Icirc ]"--=capital I, circumflex accent-->
<!ENTITY igrave SDATA "[igrave]"--=small i, grave accent-->
<!ENTITY Igrave SDATA "[Igrave]"--=capital I, grave accent-->
<!ENTITY iuml SDATA "[iuml ]"--=small i, dieresis or umlaut mark-->
<!ENTITY Iuml SDATA "[Iuml ]"--=capital I, dieresis or umlaut mark-->
<!ENTITY ntilde SDATA "[ntilde]"--=small n, tilde-->
<!ENTITY Ntilde SDATA "[Ntilde]"--=capital N, tilde-->
<!ENTITY oacute SDATA "[oacute]"--=small o, acute accent-->
<!ENTITY Oacute SDATA "[Oacute]"--=capital O, acute accent-->
<!ENTITY ocirc SDATA "[ocirc ]"--=small o, circumflex accent-->
<!ENTITY Ocirc SDATA "[Ocirc ]"--=capital O, circumflex accent-->
<!ENTITY ograve SDATA "[ograve]"--=small o, grave accent-->
<!ENTITY Ograve SDATA "[Ograve]"--=capital O, grave accent-->
<!ENTITY oslash SDATA "[oslash]"--=small o, slash-->
<!ENTITY Oslash SDATA "[Oslash]"--=capital O, slash-->
<!ENTITY otilde SDATA "[otilde]"--=small o, tilde-->
<!ENTITY Otilde SDATA "[Otilde]"--=capital O, tilde-->
<!ENTITY ouml SDATA "[ouml ]"--=small o, dieresis or umlaut mark-->
<!ENTITY Ouml SDATA "[Ouml ]"--=capital O, dieresis or umlaut mark-->
<!ENTITY szlig SDATA "[szlig ]"--=small sharp s, German (sz ligature)-->
<!ENTITY thorn SDATA "[thorn ]"--=small thorn, Icelandic-->
<!ENTITY THORN SDATA "[THORN ]"--=capital THORN, Icelandic-->
<!ENTITY uacute SDATA "[uacute]"--=small u, acute accent-->
<!ENTITY Uacute SDATA "[Uacute]"--=capital U, acute accent-->
<!ENTITY ucirc SDATA "[ucirc ]"--=small u, circumflex accent-->
<!ENTITY Ucirc SDATA "[Ucirc ]"--=capital U, circumflex accent-->
<!ENTITY ugrave SDATA "[ugrave]"--=small u, grave accent-->
<!ENTITY Ugrave SDATA "[Ugrave]"--=capital U, grave accent-->
<!ENTITY uuml SDATA "[uuml ]"--=small u, dieresis or umlaut mark-->
<!ENTITY Uuml SDATA "[Uuml ]"--=capital U, dieresis or umlaut mark-->
<!ENTITY yacute SDATA "[yacute]"--=small y, acute accent-->
<!ENTITY Yacute SDATA "[Yacute]"--=capital Y, acute accent-->
<!ENTITY yuml SDATA "[yuml ]"--=small y, dieresis or umlaut mark-->

View file

@ -0,0 +1,132 @@
<!-- $XConsortium: iso-lat2.gml /main/3 1996/06/19 17:12:32 drk $ -->
<!-- (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Character entity set. Typical invocation:
<!ENTITY % ISOlat2 PUBLIC
"ISO 8879-1986//ENTITIES Added Latin 2//EN">
%ISOlat2;
-->
<!ENTITY abreve SDATA "[abreve]"--=small a, breve-->
<!ENTITY Abreve SDATA "[Abreve]"--=capital A, breve-->
<!ENTITY amacr SDATA "[amacr ]"--=small a, macron-->
<!ENTITY Amacr SDATA "[Amacr ]"--=capital A, macron-->
<!ENTITY aogon SDATA "[aogon ]"--=small a, ogonek-->
<!ENTITY Aogon SDATA "[Aogon ]"--=capital A, ogonek-->
<!ENTITY cacute SDATA "[cacute]"--=small c, acute accent-->
<!ENTITY Cacute SDATA "[Cacute]"--=capital C, acute accent-->
<!ENTITY ccaron SDATA "[ccaron]"--=small c, caron-->
<!ENTITY Ccaron SDATA "[Ccaron]"--=capital C, caron-->
<!ENTITY ccirc SDATA "[ccirc ]"--=small c, circumflex accent-->
<!ENTITY Ccirc SDATA "[Ccirc ]"--=capital C, circumflex accent-->
<!ENTITY cdot SDATA "[cdot ]"--=small c, dot above-->
<!ENTITY Cdot SDATA "[Cdot ]"--=capital C, dot above-->
<!ENTITY dcaron SDATA "[dcaron]"--=small d, caron-->
<!ENTITY Dcaron SDATA "[Dcaron]"--=capital D, caron-->
<!ENTITY dstrok SDATA "[dstrok]"--=small d, stroke-->
<!ENTITY Dstrok SDATA "[Dstrok]"--=capital D, stroke-->
<!ENTITY ecaron SDATA "[ecaron]"--=small e, caron-->
<!ENTITY Ecaron SDATA "[Ecaron]"--=capital E, caron-->
<!ENTITY edot SDATA "[edot ]"--=small e, dot above-->
<!ENTITY Edot SDATA "[Edot ]"--=capital E, dot above-->
<!ENTITY emacr SDATA "[emacr ]"--=small e, macron-->
<!ENTITY Emacr SDATA "[Emacr ]"--=capital E, macron-->
<!ENTITY eogon SDATA "[eogon ]"--=small e, ogonek-->
<!ENTITY Eogon SDATA "[Eogon ]"--=capital E, ogonek-->
<!ENTITY gacute SDATA "[gacute]"--=small g, acute accent-->
<!ENTITY gbreve SDATA "[gbreve]"--=small g, breve-->
<!ENTITY Gbreve SDATA "[Gbreve]"--=capital G, breve-->
<!ENTITY Gcedil SDATA "[Gcedil]"--=capital G, cedilla-->
<!ENTITY gcirc SDATA "[gcirc ]"--=small g, circumflex accent-->
<!ENTITY Gcirc SDATA "[Gcirc ]"--=capital G, circumflex accent-->
<!ENTITY gdot SDATA "[gdot ]"--=small g, dot above-->
<!ENTITY Gdot SDATA "[Gdot ]"--=capital G, dot above-->
<!ENTITY hcirc SDATA "[hcirc ]"--=small h, circumflex accent-->
<!ENTITY Hcirc SDATA "[Hcirc ]"--=capital H, circumflex accent-->
<!ENTITY hstrok SDATA "[hstrok]"--=small h, stroke-->
<!ENTITY Hstrok SDATA "[Hstrok]"--=capital H, stroke-->
<!ENTITY Idot SDATA "[Idot ]"--=capital I, dot above-->
<!ENTITY Imacr SDATA "[Imacr ]"--=capital I, macron-->
<!ENTITY imacr SDATA "[imacr ]"--=small i, macron-->
<!ENTITY ijlig SDATA "[ijlig ]"--=small ij ligature-->
<!ENTITY IJlig SDATA "[IJlig ]"--=capital IJ ligature-->
<!ENTITY inodot SDATA "[inodot]"--=small i without dot-->
<!ENTITY iogon SDATA "[iogon ]"--=small i, ogonek-->
<!ENTITY Iogon SDATA "[Iogon ]"--=capital I, ogonek-->
<!ENTITY itilde SDATA "[itilde]"--=small i, tilde-->
<!ENTITY Itilde SDATA "[Itilde]"--=capital I, tilde-->
<!ENTITY jcirc SDATA "[jcirc ]"--=small j, circumflex accent-->
<!ENTITY Jcirc SDATA "[Jcirc ]"--=capital J, circumflex accent-->
<!ENTITY kcedil SDATA "[kcedil]"--=small k, cedilla-->
<!ENTITY Kcedil SDATA "[Kcedil]"--=capital K, cedilla-->
<!ENTITY kgreen SDATA "[kgreen]"--=small k, Greenlandic-->
<!ENTITY lacute SDATA "[lacute]"--=small l, acute accent-->
<!ENTITY Lacute SDATA "[Lacute]"--=capital L, acute accent-->
<!ENTITY lcaron SDATA "[lcaron]"--=small l, caron-->
<!ENTITY Lcaron SDATA "[Lcaron]"--=capital L, caron-->
<!ENTITY lcedil SDATA "[lcedil]"--=small l, cedilla-->
<!ENTITY Lcedil SDATA "[Lcedil]"--=capital L, cedilla-->
<!ENTITY lmidot SDATA "[lmidot]"--=small l, middle dot-->
<!ENTITY Lmidot SDATA "[Lmidot]"--=capital L, middle dot-->
<!ENTITY lstrok SDATA "[lstrok]"--=small l, stroke-->
<!ENTITY Lstrok SDATA "[Lstrok]"--=capital L, stroke-->
<!ENTITY nacute SDATA "[nacute]"--=small n, acute accent-->
<!ENTITY Nacute SDATA "[Nacute]"--=capital N, acute accent-->
<!ENTITY eng SDATA "[eng ]"--=small eng, Lapp-->
<!ENTITY ENG SDATA "[ENG ]"--=capital ENG, Lapp-->
<!ENTITY napos SDATA "[napos ]"--=small n, apostrophe-->
<!ENTITY ncaron SDATA "[ncaron]"--=small n, caron-->
<!ENTITY Ncaron SDATA "[Ncaron]"--=capital N, caron-->
<!ENTITY ncedil SDATA "[ncedil]"--=small n, cedilla-->
<!ENTITY Ncedil SDATA "[Ncedil]"--=capital N, cedilla-->
<!ENTITY odblac SDATA "[odblac]"--=small o, double acute accent-->
<!ENTITY Odblac SDATA "[Odblac]"--=capital O, double acute accent-->
<!ENTITY Omacr SDATA "[Omacr ]"--=capital O, macron-->
<!ENTITY omacr SDATA "[omacr ]"--=small o, macron-->
<!ENTITY oelig SDATA "[oelig ]"--=small oe ligature-->
<!ENTITY OElig SDATA "[OElig ]"--=capital OE ligature-->
<!ENTITY racute SDATA "[racute]"--=small r, acute accent-->
<!ENTITY Racute SDATA "[Racute]"--=capital R, acute accent-->
<!ENTITY rcaron SDATA "[rcaron]"--=small r, caron-->
<!ENTITY Rcaron SDATA "[Rcaron]"--=capital R, caron-->
<!ENTITY rcedil SDATA "[rcedil]"--=small r, cedilla-->
<!ENTITY Rcedil SDATA "[Rcedil]"--=capital R, cedilla-->
<!ENTITY sacute SDATA "[sacute]"--=small s, acute accent-->
<!ENTITY Sacute SDATA "[Sacute]"--=capital S, acute accent-->
<!ENTITY scaron SDATA "[scaron]"--=small s, caron-->
<!ENTITY Scaron SDATA "[Scaron]"--=capital S, caron-->
<!ENTITY scedil SDATA "[scedil]"--=small s, cedilla-->
<!ENTITY Scedil SDATA "[Scedil]"--=capital S, cedilla-->
<!ENTITY scirc SDATA "[scirc ]"--=small s, circumflex accent-->
<!ENTITY Scirc SDATA "[Scirc ]"--=capital S, circumflex accent-->
<!ENTITY tcaron SDATA "[tcaron]"--=small t, caron-->
<!ENTITY Tcaron SDATA "[Tcaron]"--=capital T, caron-->
<!ENTITY tcedil SDATA "[tcedil]"--=small t, cedilla-->
<!ENTITY Tcedil SDATA "[Tcedil]"--=capital T, cedilla-->
<!ENTITY tstrok SDATA "[tstrok]"--=small t, stroke-->
<!ENTITY Tstrok SDATA "[Tstrok]"--=capital T, stroke-->
<!ENTITY ubreve SDATA "[ubreve]"--=small u, breve-->
<!ENTITY Ubreve SDATA "[Ubreve]"--=capital U, breve-->
<!ENTITY udblac SDATA "[udblac]"--=small u, double acute accent-->
<!ENTITY Udblac SDATA "[Udblac]"--=capital U, double acute accent-->
<!ENTITY umacr SDATA "[umacr ]"--=small u, macron-->
<!ENTITY Umacr SDATA "[Umacr ]"--=capital U, macron-->
<!ENTITY uogon SDATA "[uogon ]"--=small u, ogonek-->
<!ENTITY Uogon SDATA "[Uogon ]"--=capital U, ogonek-->
<!ENTITY uring SDATA "[uring ]"--=small u, ring-->
<!ENTITY Uring SDATA "[Uring ]"--=capital U, ring-->
<!ENTITY utilde SDATA "[utilde]"--=small u, tilde-->
<!ENTITY Utilde SDATA "[Utilde]"--=capital U, tilde-->
<!ENTITY wcirc SDATA "[wcirc ]"--=small w, circumflex accent-->
<!ENTITY Wcirc SDATA "[Wcirc ]"--=capital W, circumflex accent-->
<!ENTITY ycirc SDATA "[ycirc ]"--=small y, circumflex accent-->
<!ENTITY Ycirc SDATA "[Ycirc ]"--=capital Y, circumflex accent-->
<!ENTITY Yuml SDATA "[Yuml ]"--=capital Y, dieresis or umlaut mark-->
<!ENTITY zacute SDATA "[zacute]"--=small z, acute accent-->
<!ENTITY Zacute SDATA "[Zacute]"--=capital Z, acute accent-->
<!ENTITY zcaron SDATA "[zcaron]"--=small z, caron-->
<!ENTITY Zcaron SDATA "[Zcaron]"--=capital Z, caron-->
<!ENTITY zdot SDATA "[zdot ]"--=small z, dot above-->
<!ENTITY Zdot SDATA "[Zdot ]"--=capital Z, dot above-->

View file

@ -0,0 +1,92 @@
<!-- $XConsortium: iso-num.gml /main/3 1996/06/19 17:12:37 drk $ -->
<!-- (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Character entity set. Typical invocation:
<!ENTITY % ISOnum PUBLIC
"ISO 8879-1986//ENTITIES Numeric and Special Graphic//EN">
%ISOnum;
-->
<!ENTITY half SDATA "[half ]"--=fraction one-half-->
<!ENTITY frac12 SDATA "[frac12]"--=fraction one-half-->
<!ENTITY frac14 SDATA "[frac14]"--=fraction one-quarter-->
<!ENTITY frac34 SDATA "[frac34]"--=fraction three-quarters-->
<!ENTITY frac18 SDATA "[frac18]"--=fraction one-eighth-->
<!ENTITY frac38 SDATA "[frac38]"--=fraction three-eighths-->
<!ENTITY frac58 SDATA "[frac58]"--=fraction five-eighths-->
<!ENTITY frac78 SDATA "[frac78]"--=fraction seven-eighths-->
<!ENTITY sup1 SDATA "[sup1 ]"--=superscript one-->
<!ENTITY sup2 SDATA "[sup2 ]"--=superscript two-->
<!ENTITY sup3 SDATA "[sup3 ]"--=superscript three-->
<!ENTITY plus SDATA "[plus ]"--=plus sign B:-- >
<!ENTITY plusmn SDATA "[plusmn]"--/pm B: =plus-or-minus sign-->
<!ENTITY lt SDATA "[lt ]"--=less-than sign R:-->
<!ENTITY equals SDATA "[equals]"--=equals sign R:-->
<!ENTITY gt SDATA "[gt ]"--=greater-than sign R:-->
<!ENTITY divide SDATA "[divide]"--/div B: =divide sign-->
<!ENTITY times SDATA "[times ]"--/times B: =multiply sign-->
<!ENTITY curren SDATA "[curren]"--=general currency sign-->
<!ENTITY pound SDATA "[pound ]"--=pound sign-->
<!ENTITY dollar SDATA "[dollar]"--=dollar sign-->
<!ENTITY cent SDATA "[cent ]"--=cent sign-->
<!ENTITY yen SDATA "[yen ]"--/yen =yen sign-->
<!ENTITY num SDATA "[num ]"--=number sign-->
<!ENTITY percnt SDATA "[percnt]"--=percent sign-->
<!ENTITY amp SDATA "[amp ]"--=ampersand-->
<!ENTITY ast SDATA "[ast ]"--/ast B: =asterisk-->
<!ENTITY commat SDATA "[commat]"--=commercial at-->
<!ENTITY lsqb SDATA "[lsqb ]"--/lbrack O: =left square bracket-->
<!ENTITY bsol SDATA "[bsol ]"--/backslash =reverse solidus-->
<!ENTITY rsqb SDATA "[rsqb ]"--/rbrack C: =right square bracket-->
<!ENTITY lcub SDATA "[lcub ]"--/lbrace O: =left curly bracket-->
<!ENTITY horbar SDATA "[horbar]"--=horizontal bar-->
<!ENTITY verbar SDATA "[verbar]"--/vert =vertical bar-->
<!ENTITY rcub SDATA "[rcub ]"--/rbrace C: =right curly bracket-->
<!ENTITY micro SDATA "[micro ]"--=micro sign-->
<!ENTITY ohm SDATA "[ohm ]"--=ohm sign-->
<!ENTITY deg SDATA "[deg ]"--=degree sign-->
<!ENTITY ordm SDATA "[ordm ]"--=ordinal indicator, masculine-->
<!ENTITY ordf SDATA "[ordf ]"--=ordinal indicator, feminine-->
<!ENTITY sect SDATA "[sect ]"--=section sign-->
<!ENTITY para SDATA "[para ]"--=pilcrow (paragraph sign)-->
<!ENTITY middot SDATA "[middot]"--/centerdot B: =middle dot-->
<!ENTITY larr SDATA "[larr ]"--/leftarrow /gets A: =leftward arrow-->
<!ENTITY rarr SDATA "[rarr ]"--/rightarrow /to A: =rightward arrow-->
<!ENTITY uarr SDATA "[uarr ]"--/uparrow A: =upward arrow-->
<!ENTITY darr SDATA "[darr ]"--/downarrow A: =downward arrow-->
<!ENTITY copy SDATA "[copy ]"--=copyright sign-->
<!ENTITY reg SDATA "[reg ]"--/circledR =registered sign-->
<!ENTITY trade SDATA "[trade ]"--=trade mark sign-->
<!ENTITY brvbar SDATA "[brvbar]"--=broken (vertical) bar-->
<!ENTITY not SDATA "[not ]"--/neg /lnot =not sign-->
<!ENTITY sung SDATA "[sung ]"--=music note (sung text sign)-->
<!ENTITY excl SDATA "[excl ]"--=exclamation mark-->
<!ENTITY iexcl SDATA "[iexcl ]"--=inverted exclamation mark-->
<!ENTITY quot SDATA "[quot ]"--=quotation mark-->
<!ENTITY apos SDATA "[apos ]"--=apostrophe-->
<!ENTITY lpar SDATA "[lpar ]"--O: =left parenthesis-->
<!ENTITY rpar SDATA "[rpar ]"--C: =right parenthesis-->
<!ENTITY comma SDATA "[comma ]"--P: =comma-->
<!ENTITY lowbar SDATA "[lowbar]"--=low line-->
<!ENTITY hyphen SDATA "[hyphen]"--=hyphen-->
<!ENTITY period SDATA "[period]"--=full stop, period-->
<!ENTITY sol SDATA "[sol ]"--=solidus-->
<!ENTITY colon SDATA "[colon ]"--/colon P:-->
<!ENTITY semi SDATA "[semi ]"--=semicolon P:-->
<!ENTITY quest SDATA "[quest ]"--=question mark-->
<!ENTITY iquest SDATA "[iquest]"--=inverted question mark-->
<!ENTITY laquo SDATA "[laquo ]"--=angle quotation mark, left-->
<!ENTITY raquo SDATA "[raquo ]"--=angle quotation mark, right-->
<!ENTITY lsquo SDATA "[lsquo ]"--=single quotation mark, left-->
<!ENTITY rsquo SDATA "[rsquo ]"--=single quotation mark, right-->
<!ENTITY ldquo SDATA "[ldquo ]"--=double quotation mark, left-->
<!ENTITY rdquo SDATA "[rdquo ]"--=double quotation mark, right-->
<!ENTITY nbsp SDATA "[nbsp ]"--=no break (required) space-->
<!ENTITY shy SDATA "[shy ]"--=soft hyphen-->

View file

@ -0,0 +1,101 @@
<!-- $XConsortium: iso-pub.gml /main/3 1996/06/19 17:12:41 drk $ -->
<!-- (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Character entity set. Typical invocation:
<!ENTITY % ISOpub PUBLIC
"ISO 8879-1986//ENTITIES Publishing//EN">
%ISOpub;
-->
<!ENTITY emsp SDATA "[emsp ]"--=em space-->
<!ENTITY ensp SDATA "[ensp ]"--=en space (1/2-em)-->
<!ENTITY emsp13 SDATA "[emsp3 ]"--=1/3-em space-->
<!ENTITY emsp14 SDATA "[emsp4 ]"--=1/4-em space-->
<!ENTITY numsp SDATA "[numsp ]"--=digit space (width of a number)-->
<!ENTITY puncsp SDATA "[puncsp]"--=punctuation space (width of comma)-->
<!ENTITY thinsp SDATA "[thinsp]"--=thin space (1/6-em)-->
<!ENTITY hairsp SDATA "[hairsp]"--=hair space-->
<!ENTITY mdash SDATA "[mdash ]"--=em dash-->
<!ENTITY ndash SDATA "[ndash ]"--=en dash-->
<!ENTITY dash SDATA "[dash ]"--=hyphen (true graphic)-->
<!ENTITY blank SDATA "[blank ]"--=significant blank symbol-->
<!ENTITY hellip SDATA "[hellip]"--=ellipsis (horizontal)-->
<!ENTITY nldr SDATA "[nldr ]"--=double baseline dot (en leader)-->
<!ENTITY frac13 SDATA "[frac13]"--=fraction one-third-->
<!ENTITY frac23 SDATA "[frac23]"--=fraction two-thirds-->
<!ENTITY frac15 SDATA "[frac15]"--=fraction one-fifth-->
<!ENTITY frac25 SDATA "[frac25]"--=fraction two-fifths-->
<!ENTITY frac35 SDATA "[frac35]"--=fraction three-fifths-->
<!ENTITY frac45 SDATA "[frac45]"--=fraction four-fifths-->
<!ENTITY frac16 SDATA "[frac16]"--=fraction one-sixth-->
<!ENTITY frac56 SDATA "[frac56]"--=fraction five-sixths-->
<!ENTITY incare SDATA "[incare]"--=in-care-of symbol-->
<!ENTITY block SDATA "[block ]"--=full block-->
<!ENTITY uhblk SDATA "[uhblk ]"--=upper half block-->
<!ENTITY lhblk SDATA "[lhblk ]"--=lower half block-->
<!ENTITY blk14 SDATA "[blk14 ]"--=25% shaded block-->
<!ENTITY blk12 SDATA "[blk12 ]"--=50% shaded block-->
<!ENTITY blk34 SDATA "[blk34 ]"--=75% shaded block-->
<!ENTITY marker SDATA "[marker]"--=histogram marker-->
<!ENTITY cir SDATA "[cir ]"--/circ B: =circle, open-->
<!ENTITY squ SDATA "[squ ]"--=square, open-->
<!ENTITY rect SDATA "[rect ]"--=rectangle, open-->
<!ENTITY utri SDATA "[utri ]"--/triangle =up triangle, open-->
<!ENTITY dtri SDATA "[dtri ]"--/triangledown =down triangle, open-->
<!ENTITY star SDATA "[star ]"--=star, open-->
<!ENTITY bull SDATA "[bull ]"--/bullet B: =round bullet, filled-->
<!ENTITY squf SDATA "[squf ]"--/blacksquare =sq bullet, filled-->
<!ENTITY utrif SDATA "[utrif ]"--/blacktriangle =up tri, filled-->
<!ENTITY dtrif SDATA "[dtrif ]"--/blacktriangledown =dn tri, filled-->
<!ENTITY ltrif SDATA "[ltrif ]"--/blacktriangleleft R: =l tri, filled-->
<!ENTITY rtrif SDATA "[rtrif ]"--/blacktriangleright R: =r tri, filled-->
<!ENTITY clubs SDATA "[clubs ]"--/clubsuit =club suit symbol-->
<!ENTITY diams SDATA "[diams ]"--/diamondsuit =diamond suit symbol-->
<!ENTITY hearts SDATA "[hearts]"--/heartsuit =heart suit symbol-->
<!ENTITY spades SDATA "[spades]"--/spadesuit =spades suit symbol-->
<!ENTITY malt SDATA "[malt ]"--/maltese =maltese cross-->
<!ENTITY dagger SDATA "[dagger]"--/dagger B: =dagger-->
<!ENTITY Dagger SDATA "[Dagger]"--/ddagger B: =double dagger-->
<!ENTITY check SDATA "[check ]"--/checkmark =tick, check mark-->
<!ENTITY cross SDATA "[ballot]"--=ballot cross-->
<!ENTITY sharp SDATA "[sharp ]"--/sharp =musical sharp-->
<!ENTITY flat SDATA "[flat ]"--/flat =musical flat-->
<!ENTITY male SDATA "[male ]"--=male symbol-->
<!ENTITY female SDATA "[female]"--=female symbol-->
<!ENTITY phone SDATA "[phone ]"--=telephone symbol-->
<!ENTITY telrec SDATA "[telrec]"--=telephone recorder symbol-->
<!ENTITY copysr SDATA "[copysr]"--=sound recording copyright sign-->
<!ENTITY caret SDATA "[caret ]"--=caret (insertion mark)-->
<!ENTITY lsquor SDATA "[lsquor]"--=rising single quote, left (low)-->
<!ENTITY ldquor SDATA "[ldquor]"--=rising dbl quote, left (low)-->
<!ENTITY fflig SDATA "[fflig ]"--small ff ligature-->
<!ENTITY filig SDATA "[filig ]"--small fi ligature-->
<!ENTITY fjlig SDATA "[fjlig ]"--small fj ligature-->
<!ENTITY ffilig SDATA "[ffilig]"--small ffi ligature-->
<!ENTITY ffllig SDATA "[ffllig]"--small ffl ligature-->
<!ENTITY fllig SDATA "[fllig ]"--small fl ligature-->
<!ENTITY mldr SDATA "[mldr ]"--em leader-->
<!ENTITY rdquor SDATA "[rdquor]"--rising dbl quote, right (high)-->
<!ENTITY rsquor SDATA "[rsquor]"--rising single quote, right (high)-->
<!ENTITY vellip SDATA "[vellip]"--vertical ellipsis-->
<!ENTITY hybull SDATA "[hybull]"--rectangle, filled (hyphen bullet)-->
<!ENTITY loz SDATA "[loz ]"--/lozenge - lozenge or total mark-->
<!ENTITY lozf SDATA "[lozf ]"--/blacklozenge - lozenge, filled-->
<!ENTITY ltri SDATA "[ltri ]"--/triangleleft B: l triangle, open-->
<!ENTITY rtri SDATA "[rtri ]"--/triangleright B: r triangle, open-->
<!ENTITY starf SDATA "[starf ]"--/bigstar - star, filled-->
<!ENTITY natur SDATA "[natur ]"--/natural - music natural-->
<!ENTITY rx SDATA "[rx ]"--pharmaceutical prescription (Rx)-->
<!ENTITY sext SDATA "[sext ]"--sextile (6-pointed star)-->
<!ENTITY target SDATA "[target]"--register mark or target-->
<!ENTITY dlcrop SDATA "[dlcrop]"--downward left crop mark -->
<!ENTITY drcrop SDATA "[drcrop]"--downward right crop mark -->
<!ENTITY ulcrop SDATA "[ulcrop]"--upward left crop mark -->
<!ENTITY urcrop SDATA "[urcrop]"--upward right crop mark -->

View file

@ -0,0 +1,74 @@
<!-- $XConsortium: iso-tech.gml /main/3 1996/06/19 17:12:45 drk $ -->
<!-- (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!-- Character entity set. Typical invocation:
<!ENTITY % ISOtech PUBLIC
"ISO 8879-1986//ENTITIES General Technical//EN">
%ISOtech;
-->
<!ENTITY aleph SDATA "[aleph ]"--/aleph =aleph, Hebrew-->
<!ENTITY and SDATA "[and ]"--/wedge /land B: =logical and-->
<!ENTITY ang90 SDATA "[ang90 ]"--=right (90 degree) angle-->
<!ENTITY angsph SDATA "[angsph]"--/sphericalangle =angle-spherical-->
<!ENTITY ap SDATA "[ap ]"--/approx R: =approximate-->
<!ENTITY becaus SDATA "[becaus]"--/because R: =because-->
<!ENTITY bottom SDATA "[bottom]"--/bot B: =perpendicular-->
<!ENTITY cap SDATA "[cap ]"--/cap B: =intersection-->
<!ENTITY cong SDATA "[cong ]"--/cong R: =congruent with-->
<!ENTITY conint SDATA "[conint]"--/oint L: =contour integral operator-->
<!ENTITY cup SDATA "[cup ]"--/cup B: =union or logical sum-->
<!ENTITY equiv SDATA "[equiv ]"--/equiv R: =identical with-->
<!ENTITY exist SDATA "[exist ]"--/exists =at least one exists-->
<!ENTITY forall SDATA "[forall]"--/forall =for all-->
<!ENTITY fnof SDATA "[fnof ]"--=function of (italic small f)-->
<!ENTITY ge SDATA "[ge ]"--/geq /ge R: =greater-than-or-equal-->
<!ENTITY iff SDATA "[iff ]"--/iff =if and only if-->
<!ENTITY infin SDATA "[infin ]"--/infty =infinity-->
<!ENTITY int SDATA "[int ]"--/int L: =integral operator-->
<!ENTITY isin SDATA "[isin ]"--/in R: =set membership-->
<!ENTITY lang SDATA "[lang ]"--/langle O: =left angle bracket-->
<!ENTITY lArr SDATA "[lArr ]"--/Leftarrow A: =is implied by-->
<!ENTITY le SDATA "[le ]"--/leq /le R: =less-than-or-equal-->
<!ENTITY minus SDATA "[minus ]"--B: =minus sign-->
<!ENTITY mnplus SDATA "[mnplus]"--/mp B: =minus-or-plus sign-->
<!ENTITY nabla SDATA "[nabla ]"--/nabla =del, Hamilton operator-->
<!ENTITY ne SDATA "[ne ]"--/ne /neq R: =not equal-->
<!ENTITY ni SDATA "[ni ]"--/ni /owns R: =contains-->
<!ENTITY or SDATA "[or ]"--/vee /lor B: =logical or-->
<!ENTITY par SDATA "[par ]"--/parallel R: =parallel-->
<!ENTITY part SDATA "[part ]"--/partial =partial differential-->
<!ENTITY permil SDATA "[permil]"--=per thousand-->
<!ENTITY perp SDATA "[perp ]"--/perp R: =perpendicular-->
<!ENTITY prime SDATA "[prime ]"--/prime =prime or minute-->
<!ENTITY Prime SDATA "[Prime ]"--=double prime or second-->
<!ENTITY prop SDATA "[prop ]"--/propto R: =is proportional to-->
<!ENTITY radic SDATA "[radic ]"--/surd =radical-->
<!ENTITY rang SDATA "[rang ]"--/rangle C: =right angle bracket-->
<!ENTITY rArr SDATA "[rArr ]"--/Rightarrow A: =implies-->
<!ENTITY sim SDATA "[sim ]"--/sim R: =similar-->
<!ENTITY sime SDATA "[sime ]"--/simeq R: =similar, equals-->
<!ENTITY square SDATA "[square]"--/square B: =square-->
<!ENTITY sub SDATA "[sub ]"--/subset R: =subset or is implied by-->
<!ENTITY sube SDATA "[sube ]"--/subseteq R: =subset, equals-->
<!ENTITY sup SDATA "[sup ]"--/supset R: =superset or implies-->
<!ENTITY supe SDATA "[supe ]"--/supseteq R: =superset, equals-->
<!ENTITY there4 SDATA "[there4]"--/therefore R: =therefore-->
<!ENTITY Verbar SDATA "[Verbar]"--/Vert =dbl vertical bar-->
<!ENTITY angst SDATA "[angst ]"--Angstrom =capital A, ring-->
<!ENTITY bernou SDATA "[bernou]"--Bernoulli function (script capital B)-->
<!ENTITY compfn SDATA "[compfn]"--B: composite function (small circle)-->
<!ENTITY Dot SDATA "[Dot ]"--=dieresis or umlaut mark-->
<!ENTITY DotDot SDATA "[DotDot]"--four dots above-->
<!ENTITY hamilt SDATA "[hamilt]"--Hamiltonian (script capital H)-->
<!ENTITY lagran SDATA "[lagran]"--Lagrangian (script capital L)-->
<!ENTITY lowast SDATA "[lowast]"--low asterisk-->
<!ENTITY notin SDATA "[notin ]"--N: negated set membership-->
<!ENTITY order SDATA "[order ]"--order of (script small o)-->
<!ENTITY phmmat SDATA "[phmmat]"--physics M-matrix (script capital M)-->
<!ENTITY tdot SDATA "[tdot ]"--three dots above-->
<!ENTITY tprime SDATA "[tprime]"--triple prime-->
<!ENTITY wedgeq SDATA "[wedgeq]"--R: corresponds to (wedge, equals)-->

View file

@ -0,0 +1,54 @@
#!/bin/ksh
# $XConsortium: catalog.sh /main/3 1996/06/19 17:12:50 drk $
# This file may be "sourced" into your current shell (i.e., invoked
# as ". env.sh") or executed in its own shell (i.e., invoked
# as "env.sh". It's purpose is to set up symbolic links from munged
# PUBLIC identifiers in the SGML declaration to the actual files on
# the system. PUBLIC identifiers get munged by replacing spaces with
# underscores and slashes with percent signs.
# If all the things you need are based on a common path with entities
# in a directory named "Entities" and the DocBook SGML declaration
# and document type definition in a directory named SgmlStuff, simply
# setting PATH_TOP to that path will make the necessary
# customization. Otherwise, the path to each directory will have
# to be edited individually.
PATH_TOP=/projects/help/sgml/OSF/tpt/DtDocBook
# the DocBook DTD
ln -s ${PATH_TOP}/SgmlStuff/docbook.2.2.1.dtd \
-%%HaL_and_O\'Reilly%%DTD_DocBook%%EN
# ISO Numeric and Special Graphic entities
ln -s ${PATH_TOP}/Entities/iso-num.gml \
ISO_8879-1986%%ENTITIES_Numeric_and_Special_Graphic%%EN
# ISO Publishing entities
ln -s ${PATH_TOP}/Entities/iso-pub.gml \
ISO_8879-1986%%ENTITIES_Publishing%%EN
# ISO Diacritical Mark entities
ln -s ${PATH_TOP}/Entities/iso-dia.gml \
ISO_8879-1986%%ENTITIES_Diacritical_Marks%%EN
# ISO General Technical entities
ln -s ${PATH_TOP}/Entities/iso-tech.gml \
ISO_8879-1986%%ENTITIES_General_Technical%%EN
# ISO Latin 1 entities
ln -s ${PATH_TOP}/Entities/iso-lat1.gml \
ISO_8879-1986%%ENTITIES_Added_Latin_1%%EN
# ISO Latin 2 entities
ln -s ${PATH_TOP}/Entities/iso-lat2.gml \
ISO_8879-1986%%ENTITIES_Added_Latin_2%%EN
# ISO Greek 3 entities
ln -s ${PATH_TOP}/Entities/iso-grk3.gml \
ISO_8879-1986%%ENTITIES_Greek_Symbols%%EN
# ISO Box and Line entities
ln -s ${PATH_TOP}/Entities/iso-box.gml \
ISO_8879-1986%%ENTITIES_Box_and_Line_Drawing%%EN

View file

@ -0,0 +1,8 @@
# $XConsortium: strings /main/2 1996/11/11 11:21:29 rws $
"Home Topic" "Ausgangsthema"
"No home topic (PartIntro) was specified by the author." "Ausgangsthema (PartIntro) vom Author nicht angegeben."
"See" "Siehe"
"See Also" "Siehe auch unter"
"NAME" "NAME"
"SYNOPSIS" "ABRISS"

View file

@ -0,0 +1,3 @@
# Characters that need to be mapped (quoted) for SDL
& &&
^ \^

View file

@ -0,0 +1,141 @@
<!SGML "ISO 8879:1986"
CHARSET
BASESET "ISO 646:1983//CHARSET
International Reference Version (IRV)//ESC 2/5 4/0"
DESCSET
0 9 UNUSED
9 2 9
11 2 UNUSED
13 1 13
14 18 UNUSED
32 95 32
127 1 UNUSED
BASESET "ISO Registration Number 100//CHARSET
ECMA-94 Right Part of Latin Alphabet Nr. 1//ESC 2/13 4/1"
DESCSET
128 32 UNUSED
160 96 32
CAPACITY SGMLREF
TOTALCAP 99000000
ATTCAP 1000000
ATTCHCAP 1000000
AVGRPCAP 1000000
ELEMCAP 1000000
ENTCAP 1000000
ENTCHCAP 1000000
GRPCAP 1000000
IDCAP 32000000
IDREFCAP 32000000
SCOPE DOCUMENT
SYNTAX
SHUNCHAR CONTROLS 0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 127 128 129
130 131 132 133 134 135 136 137 138 139
140 141 142 143 144 145 146 147 148 149
150 151 152 153 154 155 156 157 158 159
BASESET "ISO 646:1983//CHARSET
International Reference Version (IRV)//ESC 2/5 4/0"
DESCSET
0 128 0
FUNCTION
RE 13
RS 10
SPACE 32
TAB SEPCHAR 9
NAMING
LCNMSTRT ""
UCNMSTRT ""
LCNMCHAR ".-"
UCNMCHAR ".-"
NAMECASE GENERAL YES
ENTITY NO
DELIM GENERAL SGMLREF
SHORTREF SGMLREF
NAMES SGMLREF
QUANTITY SGMLREF
ATTCNT 256
GRPCNT 253
GRPGTCNT 253
LITLEN 8092
NAMELEN 128
TAGLVL 100
FEATURES
MINIMIZE
DATATAG NO
OMITTAG NO
RANK NO
SHORTTAG YES
LINK
SIMPLE NO
IMPLICIT NO
EXPLICIT NO
OTHER
CONCUR NO
SUBDOC NO
FORMAL YES
APPINFO
NONE
>
<!-- $XConsortium: docbook.sgml /main/5 1996/06/19 17:12:54 drk $ -->
<!--
Reference Concrete Syntax modifications for the DocBook DTD,
Revision: 2.2.1
-->
<!-- ===================================================================== -->
<!--
DocBook DTD Revision: 2.2.1
$Date: 1996/06/19 17:12:54 $
Copyright 1992, 1993, 1994 HaL Computer Systems, Inc., and
O'Reilly & Associates, Inc.
Permission to use, copy, modify and distribute the DocBook DTD and
its accompanying documentation for any purpose and without fee is
hereby granted, provided that this copyright notice appears in
all copies. If you modify the DocBook DTD, rename your modified
version. HaL Computer Systems, Inc., and O'Reilly & Associates,
Inc., make no representation about the suitability of the DTD for
any purpose. It is provided "as is" without expressed or implied
warranty.
The DocBook DTD is maintained by HaL Computer Systems, Inc., and
O'Reilly & Associates, Inc. Please direct all questions, bug
reports, or suggestions for changes to: davenport@ora.com or by
postal mail to either: Terry Allen, O'Reilly & Associates, Inc.,
103A Morris Street, Sebastopol, California, 95472; or Conleth
O'Connell, HaL Computer Systems, 3006-A Longhorn Blvd., Austin,
Texas, 78758.
Please note that an SGML declaration is provided for this DTD.
Public Identifier:
"-//HaL and O'Reilly//DTD DocBook//EN"
-->

File diff suppressed because it is too large Load diff

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,476 @@
#!/bin/ksh
# get the name of this command for errors, warnings and messages
command_name=`basename $0`
# initialize the variables that get set by options
typeset -i compress=0
typeset -i decompress=0
typeset -i help=0
typeset -i log=0
mapfiles=""
catfiles=""
outname=""
typeset -i remove=0
typeset -i uncompressed=0
typeset -i verbose=0
typeset -i debug=0
# We use this string a couple of different places.
c_and_d="Compress (-c) and decompress (-d)"
# Create a funtion to call on fatal error before we know about file
# names.
function fatal {
echo "$command_name fatal error:"
echo " $1"
exit 1
}
# Create a funtion to call on fatal error merging any error files.
function fatalError {
echo "$command_name fatal error:"
echo " $1"
if [[ -a $basename.out.err ]]; then
cat $basename.out.err >> $basename.log
rm -f $basename.out.err
fi
exit 1
}
# Create a function to call for warnings.
function warn {
echo "$command_name warning:"
echo " $1"
}
# Process the options.
while
getopts ":cdg:hlm:o:rs:t:uvxH:I:L:S:" opt
do
case $opt in
(c) compress=1;;
(d) decompress=1;;
(g) if [[ "$catfiles" = "" ]] then
catfiles="m $OPTARG"
else
catfiles="$catfiles -m $OPTARG"
fi;;
(h) help=1;;
(i) info_dir="$OPTARG";;
(l) log=1;;
(m) mapfiles="$mapfiles $OPTARG";;
(o) oname="$OPTARG"
if [[ $oname = -* ]] then
warn "Output file name (-o $oname) begins with a \"-\""
fi;;
(r) remove=1;;
(s) sgml_dir="$OPTARG";;
(t) dbk_lib="$OPTARG";;
(u) uncompressed=1;;
(v) verbose=1;;
(x) debug=1;;
# undocumented options to be used at build time
(H) helptag2="$OPTARG";;
(I) instant="$OPTARG";;
(L) x_locale="$OPTARG";;
(S) sgmls="$OPTARG";;
(?) fatal "Unknown option: -$OPTARG";;
esac
done
dbk_lib="${dbk_lib:-/usr/dt/dthelp/dtdocbook}" # if no -t, use installed dir
sgml_dir="${sgml_dir:-${dbk_lib}}" # if no -s, use -t
info_dir="${info_dir:-/usr/dt/infolib}" # if no -i, use installed dir
sgml_cat="${sgml_dir}/SGML"
if [[ ${#sgmls} -eq 0 ]] then # if no -S, use installed one
if [[ -x ${info_dir}/etc/nsgmls ]] then
sgmls="${info_dir}/etc/nsgmls"
else
sgmls="${info_dir}/etc/sgmls"
fi
fi
sgmls="${sgmls:-${info_dir}/etc/sgmls}" # if no -S, use installed one
instant="${instant:-${dbk_lib}/instant}" # if no -I, use installed one
x_locale="${x_locale:-${dbk_lib}/xlate_locale}" # if no -L, use installed one
helptag2="${helptag2:-dthelp_htag2}" # if no -H, use one in PATH
# Set the environment variables for instant(1) to find its files
export TPT_LIB="${dbk_lib}"
export LOCALE_DIR="${dbk_lib}/$($x_locale)"
# Determine whether we are using sgmls or nsgmls
parser=`basename $sgmls`
# If running sgmls, set the environment variable for sgmls(1) to find
# its files; if running nsgmls (or anything besides sgmls), set the
# environment variable for finding the default catalog - also, if we
# are running sgmls, delete any -g options since sgmls doesn't support
# catalogs
if ([[ "$parser" = sgmls ]]) then
export SGML_PATH="${sgml_cat}/%P:${sgml_cat}/%S:%S"
catfiles=""
elif ([[ "$SGML_CATALOG_FILES" = "" ]]) then
export SGML_CATALOG_FILES="${sgml_cat}/catalog"
else
export SGML_CATALOG_FILES="${SGML_CATALOG_FILES}:${sgml_cat}/catalog"
fi
# Set the environment variable to be picked up inside instant(1) when it
# goes to call Tcl.
export DBKTCL_DIR="${dbk_lib}/"
# The user asked for help, give it and exit.
if (( $help )); then
echo "$command_name [options] <file>"
echo "options:"
echo " -c compress an existing SDL file"
echo " -d decompress an existing SDL file"
echo " -g specify additional catalog file (repeatable)"
echo " -h emit this message"
echo " -l leave <basename>.log in current directory"
echo " -m <maps> add <maps> to list of SDATA or CMAP files"
echo " -o <file> use <file> as the output file name"
echo " -r remove leftover intermediate files"
echo " -s <dir> docbook.sgml is in <dir>"
echo " -t <dir> read translation specs, etc., from <dir>"
echo " -u do not compress during translation"
echo " -v verbose"
echo " -x leave intermediate files, for debugging"
exit 0
fi
# Check for too many input files or none.
if (( $OPTIND < $# )); then
fatal "Too many names after the options, should only be input file name"
elif (( $OPTIND > $# )); then
fatal "No input file name specified"
fi
# Get the name of the input file.
iname=`eval echo \\\${\$OPTIND}`
# Check for mutually exclusive options.
if (( $compress && $decompress )); then
fatal "$c_and_d are mutually exclusive."
fi
# Get the basename and directory of the input file.
basename=`basename $iname`
dirname=`dirname $iname`
# Look for an extension on the input file, if it's .sgm (or .sdl for
# -c and -d), use it as is, else add the proper extension.
if [[ $basename != *.* ]] then
if (( $compress || $decompress )); then
iname=$iname.sdl
else
iname=$iname.sgm
fi
else
iname=$dirname/$basename
set -A basearray `echo $basename | tr "." " "`
basename=${basearray[0]}
length=${#basearray[*]}
if (( length = $length - 1 )); then
if (( $compress || $decompress )); then
if [[ ${basearray[$length]} = "sgm" ]] then
fatal "$c_and_d take .sdl as an extension, not .sgm"
elif [[ ${basearray[$length]} = "sdl" ]] then
unset basearray[$length]
else
iname=$iname.sdl
fi
else
if [[ ${basearray[$length]} = "sdl" ]] then
fatal "Use .sgm or no extension, not .sdl"
elif [[ ${basearray[$length]} = "sgm" ]] then
unset basearray[$length]
else
iname=$iname.sgm
fi
fi
unset basearray[0]
for i in ${basearray[*]}
do
basename=$basename.$i
done
fi
fi
# If no output file was specified, use <basename>.sdl.
if [[ $oname = "" ]] then
oname=$basename.sdl
fi
# Did the user ask to only remove old files (i.e., "clean")? If so,
# do it and exit.
if (( $remove )); then
if (( $verbose )); then
echo "rm -f $basename.esis"
fi
rm -f $basename.esis
if (( $verbose )); then
echo "rm -f $basename.out.sdl"
fi
rm -f $basename.out.sdl
if (( $verbose )); then
echo "rm -f $basename.out.snb"
fi
rm -f $basename.out.snb
if (( $verbose )); then
echo "rm -f $basename.log"
fi
rm -f $basename.log
if (( $verbose )); then
echo "rm -f $basename.out.err"
fi
rm -f $basename.out.err
if (( $verbose )); then
echo "rm -f $oname"
fi
rm -f $oname
exit 0
fi
# make sure the error files are clean
if (( $verbose )); then
echo "rm -f $basename.log"
fi
rm -f $basename.log
if (( $? )); then
fatal "Could not remove $basename.log - permissions?"
fi
if (( $verbose )); then
echo "rm -f $basename.out.err"
fi
rm -f $basename.out.err
if (( $? )); then
fatal "Could not remove $basename.out.err - permissions?"
fi
# Did the user ask for only compression an existing .sdl file?
# If so, do it and exit with the return code of dthelp_htag2.
if (( $compress )); then
if (( $verbose )); then
echo $helptag2 -c $iname
$helptag2 -c $iname
exit $?
fi
$helptag2 -c $iname 2>/dev/null
exit $?
fi
# Did the user ask for only decompression an existing .sdl file?
# If so, do it and exit with the return code of dthelp_htag2.
if (( $decompress )); then
if (( $verbose )); then
echo $helptag2 -d $iname
$helptag2 -d $iname
exit $?
fi
$helptag2 -d $iname 2>/dev/null
exit $?
fi
# If we get here, we really want to process a .sgm file. First run
# sgmls(1) on it.
if [[ -a $basename.esis ]] then
if (( $verbose )); then
echo rm $basename.esis
fi
rm $basename.esis
if (( $? )); then
fatalError "Could not remove $basename.esis - permissions?"
fi
fi
if (( $verbose )); then
echo "${sgmls} -deglru$catfiles ${sgml_dir}/docbook.sgml $iname > $basename.esis"
${sgmls} -deglru$catfiles ${sgml_dir}/docbook.sgml $iname > $basename.esis
if (( $? )); then
if (( !$debug )); then
echo "rm -f $basename.esis"
rm -f $basename.esis
fi
fatalError "Error processing $iname by $parser"
fi
else
${sgmls} -deglru$catfiles ${sgml_dir}/docbook.sgml $iname \
> $basename.esis 2> $basename.log
if (( $? )); then
if (( !$debug )); then
rm -f $basename.esis
fi
fatalError "Error processing $iname by $parser"
fi
fi
# The sgmls(1) run succeeded. Run instant(1) on the result to create
# an unenhanced .sdl file (e.g., no LOIDS yet).
if [[ -a $basename.out.sdl ]] then
if (( $verbose )); then
echo rm -f $basename.out.sdl
fi
rm -f $basename.out.sdl
if (( $? )); then
fatalError "Could not remove $basename.out.sdl - permissions?"
fi
if (( $verbose )); then
echo rm -f $basename.out.snb
fi
rm -f $basename.out.snb
if (( $? )); then
fatalError "Could not remove $basename.out.snb - permissions?"
fi
fi
if (( $verbose )); then
echo "${instant} -o $basename.out.sdl \\\\"
if [[ $mapfiles != "" ]] then
echo " $mapfiles \\\\"
fi
echo " -c docbook.cmap \\\\"
echo " -t docbook.ts \\\\"
echo " $basename.esis"
${instant} -o $basename.out.sdl \
$mapfiles \
-c docbook.cmap \
-t docbook.ts \
$basename.esis
status=$?
if ([[ $status -eq 255 ]]) then
warn "Warning(s) processing $basename.esis by instant"
elif ([[ $status -eq 1 ]]) then
if (( !$debug )); then
echo "rm -f $basename.esis"
rm -f $basename.esis
echo "rm -f $basename.out.sdl"
rm -f $basename.out.sdl
echo "rm -f $basename.out.snb"
rm -f $basename.out.snb
fi
fatalError "Error processing $basename.esis by instant"
fi
else
${instant} -o $basename.out.sdl \
$mapfiles \
-c docbook.cmap \
-t docbook.ts \
$basename.esis 2> $basename.log
status=$?
if ([[ $status -eq 255 ]]) then
warn "Warning(s) processing $basename.esis by instant"
elif ([[ $status -eq 1 ]]) then
if (( !$debug )); then
rm -f $basename.esis
rm -f $basename.out.sdl
rm -f $basename.out.snb
fi
fatalError "Error processing $basename.esis by instant"
fi
fi
if (( !$debug )); then
if (( $verbose )); then
echo "rm -f $basename.esis"
fi
rm -f $basename.esis
fi
# The run of instant(1) succeeded. Run dthelp_htag2(1) to create the
# generated elements (e.g., the list of ids or LOIDS), incorporate the
# table of semantics and styles (TOSS) and do the compression, if
# requested.
if (( $uncompressed )); then
flags=-ot
else
flags=-otc
fi
if [[ -a $oname ]] then
if (( $verbose )); then
echo rm $oname
fi
rm $oname
if (( $? )); then
fatalError "Could not remove $oname - permissions?"
fi
fi
if (( $verbose )); then
echo "$helptag2 $flags $basename.out.sdl $oname"
$helptag2 $flags $basename.out.sdl $oname
if (( $? )); then
if (( !$debug )); then
echo "rm -f $basename.out.sdl"
rm -f $basename.out.sdl
echo "rm -f $basename.out.snb"
rm -f $basename.out.snb
echo "rm -f $oname"
rm -f $oname
fi
fatalError "Error processing $basename.out.sdl by $helptag2"
fi
else
$helptag2 $flags $basename.out.sdl $oname 2>/dev/null
if (( $? )); then
if (( !$debug )); then
rm -f $basename.out.sdl
rm -f $basename.out.snb
rm -f $oname
fi
fatalError "Error processing $basename.out.sdl by $helptag2"
fi
fi
if (( !$debug )); then
if (( $verbose )); then
echo "rm -f $basename.out.sdl"
fi
rm -f $basename.out.sdl
if (( $verbose )); then
echo "rm -f $basename.out.snb"
fi
rm -f $basename.out.snb
fi
# If we get here, all went well - we know the .log files are writable.
if (( !$debug )); then
if (( $verbose )); then
echo "cat $basename.out.err >> $basename.log"
fi
cat $basename.out.err >> $basename.log
if (( $verbose )); then
echo "rm -f $basename.out.err"
fi
rm -f $basename.out.err
fi
# if we're not in debug mode and the log file wasn't requested, remove it
if (( !$debug & !$log )); then
if (( $verbose )); then
echo "rm -f $basename.log"
fi
rm -f $basename.log
fi
if (( $verbose )); then
echo "$command_name successfully processed $iname"
fi
exit 0

View file

@ -0,0 +1,30 @@
#!/bin/csh
# This file is to be "sourced" into your current shell (i.e., invoked
# as "source env.csh"). It's purpose is to set up environment variables
# to point to the install locations of the pieces of the dtdocbook
# program.
# If all the things you need are based on a common path, simply
# setting PATH_TOP to that path will make the necessary
# customization. Otherwise, the path to each directory will have to
# be edited individually.
set PATH_TOP=/projects/help/sgml/OSF/tpt/DtDocBook
# the dtdocbook program and its constituent executable parts
setenv PATH ${PATH}:${PATH_TOP}/BinStuff
# the dtdocbook style sheet and character maps
setenv TPT_LIB ${PATH_TOP}/LibStuff:${PATH_TOP}/SgmlStuff:${PATH_TOP}/BinStuff
# the DocBook SGML declaration
setenv SGML_DIR ${PATH_TOP}/SgmlStuff
# the icons for note/caution/warning (tip/important)
setenv ICON_DIR ${PATH_TOP}/Icons
# the catalog directory for finding PUBLIC entities
# you will want to edit and run the catalog.sh or catalog.csh program
# in the Catalog directory to build the desired symbolic links to your
# actual entities
setenv SGML_PATH ${PATH_TOP}/Catalog/%P

View file

@ -0,0 +1,31 @@
#!/bin/ksh
# $XConsortium: env.sh /main/3 1996/06/19 17:12:59 drk $
# This file is to be "sourced" into your current shell (i.e., invoked
# as ". env.sh"). It's purpose is to set up environment variables to
# point to the install locations of the pieces of the dtdocbook
# program.
# If all the things you need are based on a common path, simply
# setting PATH_TOP to that path will make the necessary
# customization. Otherwise, the path to each directory will have to
# be edited individually.
PATH_TOP=/projects/help/sgml/OSF/tpt/DtDocBook
# the dtdocbook program and its constituent executable parts
export PATH=${PATH}:${PATH_TOP}/BinStuff
# the dtdocbook style sheet and character maps
export TPT_LIB=${PATH_TOP}/LibStuff:${PATH_TOP}/SgmlStuff:${PATH_TOP}/BinStuff
# the DocBook SGML declaration
export SGML_DIR=${PATH_TOP}/SgmlStuff
# the icons for note/caution/warning (tip/important)
export ICON_DIR=${PATH_TOP}/Icons
# the catalog directory for finding PUBLIC entities
# you will want to edit and run the catalog.sh or catalog.csh program
# in the Catalog directory to build the desired symbolic links to your
# actual entities
export SGML_PATH=${PATH_TOP}/Catalog/%P

View file

@ -0,0 +1,8 @@
# $XConsortium: strings /main/2 1996/11/11 11:22:24 rws $
"Home Topic" "Tema principal"
"No home topic (PartIntro) was specified by the author." "El autor no ha especificado ningún tema principal (PartIntro)."
"See" "Vea"
"See Also" "Vea también"
"NAME" "NOMBRE"
"SYNOPSIS" "SINOPSIS"

View file

@ -0,0 +1,8 @@
# $XConsortium: strings /main/2 1996/11/11 11:23:16 rws $
"Home Topic" "Sujet principal"
"No home topic (PartIntro) was specified by the author." "Aucun sujet principal (PartIntro) n'a été spécifié par l'auteur."
"See" "Voir"
"See Also" "Voir aussi"
"NAME" "NOM"
"SYNOPSIS" "SYNOPSIS"

View file

@ -0,0 +1,8 @@
# $XConsortium: strings /main/2 1996/11/11 11:24:25 rws $
"Home Topic" "Argomento principale"
"No home topic (PartIntro) was specified by the author." "Non è stato specificato nessun argomento principale (PartIntro)."
"See" "Vedere"
"See Also" "Vedere anche"
"NAME" "NOME"
"SYNOPSIS" "RIEPILOGO"

View file

@ -0,0 +1,8 @@
# $XConsortium: strings /main/2 1996/10/26 10:24:08 rws $
"Home Topic" "Home Topic"
"No home topic (PartIntro) was specified by the author." "No home topic (PartIntro) was specified by the author."
"See" "See"
"See Also" "See Also"
"NAME" "NAME"
"SYNOPSIS" "SYNOPSIS"

View file

@ -0,0 +1,18 @@
XCOMM $XConsortium: Imakefile /main/6 1996/11/29 11:06:09 rswiston $
XLATESRC = $(DTSVCSRC)/DtUtil2
INCLUDES = -I../lib/tptregexp -I../tcl -I$(XLATESRC)
DEPLIBS = $(DEPDTSVCLIB)
LOCAL_LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB) \
-L../lib/tptregexp -ltptregexp -L../tcl -ltcl
#if defined(SunArchitecture) || defined (UXPArchitecture) || defined(USLArchitecture)
EXTRA_LIBRARIES = -lsocket -lnsl -lgen -lm
#else
EXTRA_LIBRARIES = -lm
#endif
OBJS = main.o util.o info.o translate.o traninit.o tranvar.o tables.o browse.o
SRCS = main.c util.c info.c translate.c traninit.c tranvar.c tables.c browse.c
ComplexProgramTarget(instant)

View file

@ -0,0 +1,151 @@
/* $XConsortium: README /main/2 1996/07/15 14:09:31 drk $ */
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
instant - a formatting application for OSF SGML instances
____________________________________________________________________________
Requirements
ANSI C compiler (gcc is one)
sgmls 1.1 -- sgml parser from James Clark. Based on Goldfarb's ARC parser.
Vanilla unix make
POSIX C libraries
Files for instant program
Module Function
------ --------
browse.c interactive browser
general.h general definitions
info.c print information about the instances
main.c main entry, arg parsing, instance reading
tables.c table-specific formatting routines (TeX and tbl)
traninit.c translator initialization (read spec, etc.)
translate.c main translator
translate.h structure definitions for translation code
tranvar.c routines for handling "special variables"
util.c general utilities
Also required
1. Translation spec (transpec) files. (../transpecs/*.ts)
2. SDATA mapping files for mapping sdata entities. (../transpecs/*.sdata)
3. Character mapping files for mapping characters. (../transpecs/*.cmap)
Platforms tried on
OSF1 1.3 (i486)
Ultrix 4.2 (mips)
HP-UX 9.01 (hp 9000/700)
AIX 3.2 (rs6000)
SunOS [missing strerror()]
____________________________________________________________________________
General outline of program
------- ------- -- -------
To summarize in a sentence, instant reads the output of sgmls, builds a tree
of the instnace in memory, then traverses the tree in in-order, processing
the nodes according to a translation spec.
Element tree storage
------- ---- -------
The first thing instant must do is read the ESIS (output of sgmls) from the
specified file or stdin, forming a tree in memory. (Nothing makes sense
without an instance...) Each element of the instance is a node in the tree,
stored as a structure called Element_t. Elements contain content (what
else?), which is a mixture of data (#PCDATA, #CDATA, #RCDATA - all the same
in the ESIS), child elements, and PIs. Each 'chunk' of content is referred
to by a Content_t structure. A Content_t contains an enum that can point to
a string (data or PI), another Element_t. For example, if a <p> element
contains some characters, an <emphasis> element, some more characters,
a <function> element, then some more characters, it has 5 Content_t children
as an array.
Element_t's have pointers to their parents, and a next element in a linked
list (they're stored as a linked list, for cases when you'd want to quickly
travers all the nodes, in no particular order).
For convenience, Element_t's have an array of pointers to it's child
Element_t's. These are just pointers to the same thing contained in the
Content_t array, without the intervening data or PIs. This makes it easier
for the program to traverse the elements of the tree (it does not have to
be concerned with skipping data, etc.). There is an analagous array of
pointers for the data content, an array of (char *)'s. This makes it easier
to consider the immediate character content of an element.
Attributes are kept as an array of name-value mappings (using the typedef
Mapping_t). ID attributes are also stored in a separate list of ID value -
element pointer pairs so that it is quick to find an element by ID.
Other information kept about each element (in the Element_t struct) includes
the line number in the EISI where the element occurs, the input filename.
(These depend on sgmls being run with the "-l" option.) Also stored is
an element's order in its parent's collection of children and an element's
depth in the tree.
Translation specs
----------- -----
A translation spec is read into a linked list in memory. As the instance
tree is traversed, the transpecs are searched in order for a match. As a
rule, one should position the less specific transpecs later in the file.
Also, specs for seldom-used element are best placed later in the file, since
it takes cpu cycles to skip over them for each of the more-used elements.
During translation of a particular element, the list of Content_t structures
are processed in order. If a content 'chunk' is data, it is printed to
the output stream. If it is an element, the translation routine is called
for that elemen, recursively. Hence, in-order traversal.
Miscellaneous information displays
------------- ----------- --------
There are several informational display options available. They include:
- a list of element usage (-u) -- lists each element in the instance,
it's attributes, number of children, parent, data content 'nodes'.
- statistics about elements (-S) -- lists elements, number of times
each is used, percent of elements that this is, total char content
in that element, average number of characters in they element.
- show context of each element (-x) -- lists each element and its
context, looking up the tree (this is the same context that
would match the Context field of a transpec).
- show the hierarchy of the instance (-h) -- show an ascii 'tree' of
the instance, where elements deeper in the tree are indented more.
Numbers after the element name in parentheses are the number of
element content nodes and the number of data content nodes.
Interactive browser
----------- -------
Originally, the interactive browser was intended as a debugging aid for
the code developer. It was a way to examine a particular node of the
instance tree or process a subtree without being distracted by the rest
of the instance. Many of the commands test functionality of the query
and search code (such as testing whether a certain element has a given
relationship to the current position in the tree).
____________________________________________________________________________

View file

@ -0,0 +1,47 @@
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
Stuff to do:
Add param to _nchild - gi. ??
Tables
Consider having _osftable do the entire table, just calling it
for each call and row.
More work on tables, in general. (try more test more cases, etc.)
Document _osftable special variable better.
Use message catalogs.
Investigate translating StartText/EndText escapes (\n, etc.) as they are
read, not when processing.
Keep a list of SpecID's. Right now we search all specs in FindSpecByID().
a test suite
PI mapping - document how it works
faster trans spec lookup (hash buckets?)
Info option:
in summary, total and avg char data in for each elem type
when malloc'ing structs of a linked list, do N structures at a shot?

View file

@ -0,0 +1,444 @@
/*
* Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
* All rights reserved.
*/
/*
* Copyright (c) 1994
* Open Software Foundation, Inc.
*
* Permission is hereby granted to use, copy, modify and freely distribute
* the software in this file and its documentation for any purpose without
* fee, provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation. Further, provided that the name of Open
* Software Foundation, Inc. ("OSF") not be used in advertising or
* publicity pertaining to distribution of the software without prior
* written permission from OSF. OSF makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* ________________________________________________________________________
*
* Module for interactive browsing.
*
* Entry points for this module:
* Browse() interactive browser
* ________________________________________________________________________
*/
#ifndef lint
static char *RCSid =
"$XConsortium: browse.c /main/3 1996/06/19 17:13:03 drk $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "general.h"
static void PrElemPlusID(Element_t *);
static void ls_node(Element_t *, int, char **);
static void do_query(Element_t *, char *, char *);
static void do_find(Element_t *, char **);
/* ______________________________________________________________________ */
static char *br_help_msg[] = {
" ls List info about current element in tree",
" (context, children, attributes, etc.)",
" cd N ... Change to Nth elememt child, where N is shown by 'ls'.",
" N may also be '/' (top) or '..' (up).",
" cd id I Change to elememt whose ID is I",
" data N Show data of Nth data node",
" where Show current position in the tree",
" id I Show path to element with id I",
" (using '?' for I will lists all IDs and their paths)",
" find S Find elements matching spec S. Recognized syntaxes:",
" find attr <name> <value>",
" find cont <string>",
" find parent <gi-name>",
" find child <gi-name>",
" find gi <gi-name>",
" q rel gi Query: report if elem 'gi' has relation to current elem",
" ('rel' is one of 'child parent ancestor descendant",
" sibling sibling+ sibling+1 sibling- sibling-1 cousin')",
"",
" tran file [outfile]",
" With trans spec in 'file' translate into 'outfile' (stdout)",
" sdata file Read SDATA map file (for translations).",
" cmap file Read character map file (for translations).",
" stat Print statistics (how often elements occur, etc.)",
" sum Print elem usage summary (# of children, depth, etc.)",
" tree Print document hierarchy as a tree",
" cont Print context of each element",
NULL
};
/* ______________________________________________________________________ */
void
Browse()
{
char buf[256], *cmd, **av, **sv, *cmapfile, *sdatafile;
char *Prompt;
Element_t *ce; /* current element */
Element_t *e;
int i, n, ac;
if (slave) Prompt = "=>\n";
else Prompt = "=> ";
ce = DocTree;
while (fputs(Prompt, stdout)) {
if (!fgets(buf, 256, stdin)) break;
stripNL(buf);
if (buf[0] == EOS) {
fputs(Prompt, stdout);
continue;
}
ac = 20;
av = Split(buf, &ac, S_ALVEC);
if (ac > 0) cmd = av[0];
if (!cmd || !(*cmd)) continue;
if (!strcmp(cmd, "ls")) ls_node(ce, ac, av);
else if (!strcmp(cmd, "cd")) {
if (av[1]) {
if (ac == 3 && !strcmp(av[1], "id")) {
if ((e = FindElemByID(av[2]))) ce = e;
else printf("Element with ID '%s' not found.\n", av[2]);
continue;
}
for (i=1; i<ac; i++) {
if (!strcmp(av[i], "..")) {
if (ce->parent) ce = ce->parent;
continue;
}
if (!strcmp(av[i], "/")) {
if (ce->parent) ce = DocTree;
continue;
}
if (!isdigit(*av[i])) {
printf("Expecting digit, '..', or '/', got '%s'.\n",
av[i]);
break;
}
n = atoi(av[i]);
if (n < ce->necont) ce = ce->econt[n];
else {
printf("Must be in range 0 - %d.\n", ce->necont);
break;
}
}
}
}
else if (!strcmp(cmd, "data")) {
if (av[1] && isdigit(*av[1])) {
n = atoi(av[1]);
if (n < ce->ndcont) {
printf(ce->dcont[n]);
fputs("\n", stdout);
}
else if (ce->ndcont == 0)
printf("No data at this node.\n");
else printf("Must be in range 0 - %d.\n", ce->ndcont);
}
}
/* show where we are in the tree */
else if (!strcmp(cmd, "where")) PrintLocation(ce, stdout);
/* show where we are in the tree */
else if (!strcmp(cmd, "pwd")) PrElemPlusID(ce);
/* perform query with yes/no answer */
else if (!strcmp(cmd, "q") && av[1] && av[2])
do_query(ce, av[1], av[2]);
/* perform query printing paths to matching elements */
else if (!strcmp(cmd, "find") && av[1] && av[2])
do_find(ce, av);
/* list locations where specified ID(s) occur */
else if (!strcmp(cmd, "id")) {
if (ac <= 1) continue;
if (*av[1] == '?') PrintIDList();
else {
/* short: "id i1 i2 ...", long: "id -l i1 i2 ..." */
if (!strcmp(av[1], "-l")) n = 2;
else n = 1;
for (i=n; i<ac; i++) {
if ((e = FindElemByID(av[i]))) {
if (n == 2) { /* long (multiline) format */
if (n != i) putchar('\n');
PrintLocation(e, stdout);
}
else PrElemPlusID(e);
}
else printf("Element with ID '%s' not found.\n", av[i]);
}
}
}
/* show and set variables */
else if (!strcmp(cmd, "show") && av[1]) {
printf("%s\n", FindMappingVal(Variables, av[1]));
}
else if (!strcmp(cmd, "set") && av[1] && av[2]) {
SetMappingNV(Variables, av[1], av[2]);
}
/* print summary of tag usage */
else if (!strcmp(cmd, "sum")) {
if (ac > 1) PrintElemSummary(ce);
else PrintElemSummary(DocTree);
}
/* print element tree */
else if (!strcmp(cmd, "tree")) {
if (ac > 1) PrintElemTree(ce);
else PrintElemTree(DocTree);
}
/* print statistics */
else if (!strcmp(cmd, "stat")) {
if (ac > 1) PrintStats(ce);
else PrintStats(DocTree);
}
/* print context of each element of tree */
else if (!strcmp(cmd, "cont")) {
if (ac > 1) PrintContext(ce);
else PrintContext(DocTree);
}
/* print translation, given transpec */
else if (!strcmp(cmd, "tran")) {
FILE *fp;
if (ac > 2){
if (!(fp = fopen(av[2], "w"))) {
perror("Can not open output file");
continue;
}
}
else fp = stdout;
DoTranslate(ce, av[1], fp);
if (ac > 2) fclose(fp);
}
else if (!strcmp(cmd, "sdata")){
sdatafile = strdup(av[1]);
ReadSDATA(sdatafile);
}
else if (!strcmp(cmd, "cmap")){
cmapfile = strdup(av[1]);
ReadCharMap(cmapfile);
}
else if (!strcmp(cmd, "help") || *cmd == '?') {
sv = br_help_msg;
while (*sv) puts(*sv++);
}
/* quit (control-D also works) */
else if (!strcmp(cmd, "quit")) break;
else
fprintf(stderr, "Unknown command '%s' - ingored.\n", cmd);
}
putc(NL, stdout);
}
/* ______________________________________________________________________ */
/* Do the "ls" command.
* Arguments:
* Pointer to element under consideration.
* Arg count from command line (this command, not the shell command).
* Arg vector.
*/
static void
ls_node(
Element_t *e,
int ac,
char **av
)
{
int i;
char buf[LINESIZE];
if (ac > 1 && !strcmp(av[1], "-n")) {
for(i=0; i<e->ncont; i++) {
if (IsContElem(e,i)) printf("%s\n", ContElem(e,i)->gi);
else if (IsContData(e,i)) printf("#data %s\n", ContData(e,i));
else if (IsContPI(e,i)) printf("#pi %s\n", ContData(e,i));
}
return;
}
printf("Element: %s\tLineNumber: %d\n", e->gi, e->lineno);
if (e->parent)
printf("Context: %s\n", FindContext(e, 20, buf));
if (e->natts) {
printf("%d attributes:\n", e->natts);
for (i=0; i<e->natts; i++)
printf("\t%2d: %s = '%s'\n", i, e->atts[i].name, e->atts[i].sval);
}
if (e->entity) {
printf("Entity & notation information:\n");
if (e->entity->ename)
printf("Entity name: %s\n", e->entity->ename);
if (e->entity->nname)
printf("Notation name: %s\n", e->entity->nname);
if (e->entity->sysid)
printf("Sys id: %s\n", e->entity->sysid);
if (e->entity->pubid)
printf("Pub id: %s\n", e->entity->pubid);
if (e->entity->fname)
printf("Filename: %s\n", e->entity->fname);
}
if (e->my_eorder >= 0)
printf("My order among my siblings: %d\n", e->my_eorder);
if (e->necont) {
printf("%d child element nodes:\n", e->necont);
for(i=0; i<e->necont; i++) printf("\t%2d: %s\n", i, e->econt[i]->gi);
}
if (e->ndcont) {
printf("%d child data nodes:\n", e->ndcont);
for(i=0; i<e->ndcont; i++) {
if (strlen(e->dcont[i]) < 40)
printf("\t%2d: %s\n", i, e->dcont[i]);
else
printf("\t%2d: %-40.40s...\n", i, e->dcont[i]);
}
}
}
/* ______________________________________________________________________ */
/* Perform query. Syntax: find relationship gi. Tells whether gi has
* given relationship to current element. Result (message) sent to stdout.
* Args:
* Pointer to element under consideration.
* Pointer to name of relationship. (see FindRelByName() for names)
* Pointer to GI to look for.
*/
static void
do_query(
Element_t *e,
char *rel,
char *gi
)
{
char *cp;
Relation_t r;
Element_t *ep;
for (cp=gi; *cp; cp++) if (islower(*cp)) *cp = toupper(*cp);
if ((r = FindRelByName(rel)) == REL_Unknown) {
return;
}
ep = QRelation(e, gi, r);
printf("%s, '%s' is%s %s of '%s'.\n", (ep ? "Yes" : "No"), gi,
(ep ? "" : " not"), rel, e->gi);
}
/* ______________________________________________________________________ */
/* Print path to the element and its ID (if it has one) on a single line.
* Arguments:
* Pointer to element under consideration.
*/
static void
PrElemPlusID(
Element_t *e
)
{
char buf[LINESIZE];
if (e->id) printf("%s -- ID=%s\n", FindElementPath(e, buf), e->id);
else printf("%s\n", FindElementPath(e, buf));
}
/* ______________________________________________________________________ */
/* Print path to the element and its ID (if it has one) on a single line.
* Arguments:
* Pointer to element under consideration.
*/
static void
match_gi(
Element_t *e,
char **av
)
{
if (!strcmp(av[1], e->gi)) PrElemPlusID(e);
}
/* Shorthand for defining simple finctions, which are just interfaces to
* calling QRelation(). DescendTree() only passes ptr to element. */
#define MATCH(Fun,Rel) \
static void Fun(Element_t *e, char **av) \
{ if (QRelation(e, av[1], Rel)) PrElemPlusID(e); }
MATCH(match_parent, REL_Parent)
MATCH(match_child, REL_Child)
MATCH(match_anc, REL_Ancestor)
MATCH(match_desc, REL_Descendant)
MATCH(match_sib, REL_Sibling)
static void
match_attr(
Element_t *e,
char **av
)
{
char *atval;
if ((atval = FindAttValByName(e, av[1])) && !strcmp(av[2], atval))
PrElemPlusID(e);
}
static void
match_cont(
Element_t *e,
char **av
)
{
int i;
for (i=0; i<e->ncont; i++) {
if (IsContData(e,i) && strstr(ContData(e,i), av[1])) {
PrElemPlusID(e);
return;
}
}
}
/* Find an element, given the criteria on its command line.
* Arguments:
* Pointer to element under consideration.
*/
static void
do_find(
Element_t *e,
char **av
)
{
av++;
if (!strcmp(av[0], ".")) av++;
else e = DocTree;
if (!strcmp(av[0], "gi")) DescendTree(e, match_gi, 0, 0, av);
else if (!strcmp(av[0], "attr")) DescendTree(e, match_attr, 0, 0, av);
else if (!strcmp(av[0], "parent")) DescendTree(e, match_parent, 0, 0, av);
else if (!strcmp(av[0], "child")) DescendTree(e, match_child, 0, 0, av);
else if (!strcmp(av[0], "cont")) DescendTree(e, match_cont, 0, 0, av);
else if (!strcmp(av[0], "sib")) DescendTree(e, match_sib, 0, 0, av);
else if (!strcmp(av[0], "desc")) DescendTree(e, match_desc, 0, 0, av);
else if (!strcmp(av[0], "anc")) DescendTree(e, match_anc, 0, 0, av);
else fprintf(stderr, "Unknown find command: %s.\n", av[0]);
}
/* ______________________________________________________________________ */

View file

@ -0,0 +1,310 @@
/*
* Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
* All rights reserved.
*/
/*
* Copyright (c) 1994
* Open Software Foundation, Inc.
*
* Permission is hereby granted to use, copy, modify and freely distribute
* the software in this file and its documentation for any purpose without
* fee, provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation. Further, provided that the name of Open
* Software Foundation, Inc. ("OSF") not be used in advertising or
* publicity pertaining to distribution of the software without prior
* written permission from OSF. OSF makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* ________________________________________________________________________
*
* Common definitions for "instant" program.
* ________________________________________________________________________
*/
#ifdef STORAGE
#ifndef lint
static char *gen_h_RCSid =
"$XConsortium: general.h /main/11 1996/08/08 14:41:50 cde-hp $";
#endif
#endif
/* get Tcl header so the variables make sense */
#include <tcl.h>
/* instant variable delimiter (can't use '$', collides with Tcl) */
#define VDELIM '@'
/* string/numeric/character definitions */
#define EOS '\0'
#define NL '\n'
#define TAB '\t'
#define CR '\r'
#define ANCHOR '^'
/* bigmask/flags for the Split() function */
#define S_STRDUP 0x01
#define S_ALVEC 0x02
/* Command codes (1st char of esis lines) from sgmls. See its manpage. */
#define CMD_DATA '-'
#define CMD_OPEN '('
#define CMD_CLOSE ')'
#define CMD_ATT 'A'
#define CMD_D_ATT 'D'
#define CMD_NOTATION 'N'
#define CMD_EXT_ENT 'E'
#define CMD_INT_ENT 'I'
#define CMD_SYSID 's'
#define CMD_PUBID 'p'
#define CMD_FILENAME 'f'
#define CMD_LINE 'L'
#define CMD_PI '?'
#define CMD_SUBDOC 'S'
#define CMD_SUBDOC_S '{'
#define CMD_SUBDOC_E '}'
#define CMD_EXT_REF '&'
#define CMD_APPINFO '#'
#define CMD_CONFORM 'C'
/* Some sizes */
#define MAX_DEPTH 40
#define LINESIZE 60000
/* Name of library env variable, and default value. */
#ifndef TPT_LIB
#define TPT_LIB "TPT_LIB"
#endif
#ifndef DEF_TPT_LIB
#define DEF_TPT_LIB "/project/tools/libdata/tpt"
#endif
/* for buffered output (buffer gets passed to interpreter) */
typedef struct _OutputBuffer {
char *base; /* pointer to start of buffer */
char *current; /* pointer to current location in buffer */
int size; /* total size of buffer */
} OutputBuffer_t;
#define OBUF_INCR 4096 /* enlarge buffer by this when full */
#ifndef MIN
#define MIN(i,j) (((i) < (j)) ? (i) : (j))
#endif
/* Relationships - for querying */
typedef enum {
REL_None, REL_Parent, REL_Child, REL_Ancestor, REL_Descendant,
REL_Sibling, REL_Preceding, REL_ImmPreceding, REL_Following,
REL_ImmFollowing, REL_Cousin, REL_Is1stContent, REL_HasOnlyContent,
REL_Unknown
} Relation_t;
/* Initial map sizes (IMS) */
#define IMS_relations 3
#define IMS_setvar 3
#define IMS_incvar 3
#define IMS_sdata 50
#define IMS_sdatacache 30
#define IMS_variables 20
#define IMS_attnames 50
#define IMS_elemnames 50
/* ----- structure definitions ----- */
/* We use this for variables, attributes, etc., so the caller only needs an
* opaque handle to the thing below, not worrying about array management. */
typedef struct {
char *name; /* name of the thing */
char *sval; /* string value */
} Mapping_t;
typedef struct {
int n_alloc; /* number of elements allocated */
int n_used; /* number of elements used */
int slot_incr; /* increment for allocating slots */
int flags; /* info about this set of mappings */
Mapping_t *maps; /* array of mappings */
} Map_t;
/* ______________________________________________________________________ */
/* Information about an entity reference. Not all fields will be used
* at once. */
typedef struct _ent {
char *type; /* entity type */
char *ename; /* entity name */
char *nname; /* notation name */
char *sysid; /* sys id */
char *pubid; /* pub id */
char *fname; /* filename */
struct _ent *next; /* next in linked list */
} Entity_t;
/* Content (child nodes) of an element (node in the tree) -- both data
* and other elements. */
typedef struct {
char type; /* element, data, or pi? */
union {
struct _elem *elem; /* direct children of this elem */
char *data; /* character data of this elem */
} ch;
} Content_t;
/* An element (node in the tree) */
typedef struct _elem {
char *gi; /* element GI */
Content_t *cont; /* content - element & data children */
int ncont; /* # of content/children */
struct _elem **econt; /* element children */
int necont; /* # of element children */
char **dcont; /* character data children */
int ndcont; /* # of data children */
Mapping_t *atts; /* array of attributes */
int natts; /* # of attributes */
Entity_t *entity; /* ext entity & notation info */
char *id; /* for linking */
int index; /* an internal bookkeeping mechanism */
int depth; /* how deep in tree */
int lineno; /* line number */
char *infile; /* input filename */
int my_eorder; /* order of this elem of its parent */
struct _elem *parent; /* this elem's direct parent */
struct _elem *next; /* kept in linked list */
void *trans; /* pointer to translation spec */
/* I'm not crazy about this, but it works */
int gen_trans[2]; /* refs to generated trans specs */
int processed; /* was this node processed? */
} Element_t;
/* For mapping of element IDs to elements themselves. */
typedef struct id_s {
char *id; /* ID of the element */
Element_t *elem; /* pointer to it */
struct id_s *next;
} ID_t;
/* ----- global variable declarations ----- */
#ifdef STORAGE
# define def
#else
# define def extern
#endif
def Element_t *DocTree; /* root of document tree */
def char **UsedElem; /* a unique list of used elem names */
def int nUsedElem; /* number of used elem names */
def char **UsedAtt; /* a unique list of used attrib names */
def int nUsedAtt; /* number of used attrib names */
def ID_t *IDList; /* list of IDs used in the doc */
def Map_t *Variables; /* general, global variables */
def Map_t *SDATAmap; /* SDATA mappings */
def Map_t *PImap; /* Processing Instruction mappings */
def Entity_t *Entities; /* list of entities */
def FILE *outfp; /* where output is written */
def char *tpt_lib; /* TPT library directory */
def int verbose; /* flag - verbose output? */
def int warnings; /* flag - show warnings? */
def int interactive; /* flag - interactive browsing? */
def int slave; /* are we slave to another process? */
def int fold_case; /* flag - fold case of GIs? */
def Tcl_Interp *interpreter; /* interp for start_ and end_code */
def Element_t *tclE; /* active element in Tcl call */
/* ----- some macros for convenience and ease of code reading ----- */
/* #define stripNL(s) { char *_cp; if ((_cp=strchr(s, NL))) *_cp = EOS; } */
#define stripNL(s) { char *_cp = s; while (*_cp) _cp++; \
if ((_cp > s) && (*--_cp == NL)) *_cp = EOS; }
#define I18N_TRIGGER 0xFF
/* Similar to calloc(), malloc(), and realloc(), but check for success.
* Args to all:
* (1) number of 'elements' to allocate
* (2) variable to point at allocated space
* (3) type of 'element'
* Eg: Calloc(5, e, Element_t) replaces
* if (!(e = (Element_t *)calloc(5, sizeof(Element_t))) {
* ... handle error ... ;
* }
*/
#define Calloc(N,V,T) \
{ if (!((V) = (T *)calloc((size_t)N, sizeof(T)))) { \
perror("Calloc failed -- out of memory. Bailing out."); exit(1); \
} }
#define Malloc(N,V,T) \
{ if (!((V) = (T *)malloc((size_t)N*sizeof(T)))) { \
perror("Malloc failed -- out of memory. Bailing out."); exit(1); \
} }
#define Realloc(N,V,T) \
{ if (!((V) = (T *)realloc(V,(size_t)N*sizeof(T)))) { \
perror("Realloc failed -- out of memory. Bailing out."); exit(1); \
} }
/* similar to strcmp(), but check first chars first, for efficiency */
#define StrEq(s1,s2) (s1[0] == s2[0] && !strcmp(s1,s2))
/* similar to isspace(), but check for blank or tab - without overhead
* of procedure call */
#define IsWhite(c) (c == ' ' || c == TAB)
#define ContType(e,i) (e->cont[i].type)
#define ContData(e,i) (e->cont[i].ch.data)
#define ContElem(e,i) (e->cont[i].ch.elem)
#define IsContData(e,i) (e->cont[i].type == CMD_DATA)
#define IsContElem(e,i) (e->cont[i].type == CMD_OPEN)
#define IsContPI(e,i) (e->cont[i].type == CMD_PI)
/* ----- function prototypes ----- */
/* things defined in util.c */
Element_t *QRelation(Element_t *, char *, Relation_t);
Relation_t FindRelByName(char *);
char *FindAttValByName(Element_t *, char *);
char *FindContext(Element_t *, int, char *);
char *AddElemName(char *);
char *AddAttName(char *);
void OutputString(char *, FILE *, int);
int Putc(int, FILE *);
int FPuts(const char *, FILE *);
int FFlush(FILE *);
FILE *OpenFile(char *);
char *FindElementPath(Element_t *, char *);
char *NearestOlderElem(Element_t *, char *);
void PrintLocation(Element_t *, FILE *);
char **Split(char *, int *, int);
void DescendTree(Element_t *, void(*)(), void(*)(), void(*)(), void *);
Map_t *NewMap(int);
Mapping_t *FindMapping(Map_t *, char *);
char *FindMappingVal(Map_t *, char *);
void SetMapping(Map_t *, char *);
void SetMappingNV(Map_t *, char *, char *);
void AddID(Element_t *, char *);
Element_t *FindElemByID(char *);
/* things defined in translate.c */
void DoTranslate(Element_t*, char *, FILE *);
/* things defined in traninit.c */
void ReadTransSpec(char *);
void ReadSDATA(char *);
void ReadCharMap(char *);
/* things defined in info.c */
void PrintContext(Element_t *e);
void PrintElemSummary(Element_t *);
void PrintElemTree(Element_t *);
void PrintStats(Element_t *);
void PrintIDList();
/* ----- other declarations ----- */
#ifdef ultrix
#define strdup(s) strcpy((char *)malloc(strlen(s)+1), s)
#endif

View file

@ -0,0 +1,73 @@
/*
* Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
* All rights reserved.
*/
/*
* Copyright (c) 1994
* Open Software Foundation, Inc.
*
* Permission is hereby granted to use, copy, modify and freely distribute
* the software in this file and its documentation for any purpose without
* fee, provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation. Further, provided that the name of Open
* Software Foundation, Inc. ("OSF") not be used in advertising or
* publicity pertaining to distribution of the software without prior
* written permission from OSF. OSF makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* ________________________________________________________________________
*
* Hypermedia-related facilities.
*
* Entry points for this module:
* AddID(elem, idval) add elem-id pair to list of known ids
* FindElemByID(idval) find elem by id
* ________________________________________________________________________
*/
#ifndef lint
static char *RCSid =
"$XConsortium: hyper.c /main/3 1996/06/19 17:13:07 drk $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <memory.h>
#include <sys/types.h>
#include "general.h"
/* ______________________________________________________________________ */
void
AddID(Element *e, char *idval)
{
static ID *id_last;
if (!IDList) {
Calloc(1, id_last, ID);
IDList = id_last;
}
else {
Calloc(1, id_last->next, ID);
id_last = id_last->next;
}
id_last->elem = e;
id_last->id = idval;
}
Element *
FindElemByID(char *idval)
{
ID *id;
for (id=IDList; id; id=id->next)
if (!strcmp(id->id, idval)) return id->elem;
return 0;
}
/* ______________________________________________________________________ */

View file

@ -0,0 +1,273 @@
/*
* Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
* All rights reserved.
*/
/*
* Copyright (c) 1994
* Open Software Foundation, Inc.
*
* Permission is hereby granted to use, copy, modify and freely distribute
* the software in this file and its documentation for any purpose without
* fee, provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation. Further, provided that the name of Open
* Software Foundation, Inc. ("OSF") not be used in advertising or
* publicity pertaining to distribution of the software without prior
* written permission from OSF. OSF makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* ________________________________________________________________________
*
* Functions for printing information about an instance in the 'instant'
* program. Most of these are fairly short and simple.
*
* Entry points for this module:
* PrintElemSummary(elem) print summary info of each element
* PrintContext(elem) print context of each element
* PrintElemTree(elem) print tree of document
* PrintStats(elem) print statistics about doc tree
* PrintIDList(elem) print list of IDs and element context
* Most Print*() functions start at subtree pointed to by 'elem'.
* ________________________________________________________________________
*/
#ifndef lint
static char *RCSid =
"$XConsortium: info.c /main/3 1996/06/19 17:13:13 drk $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "general.h"
/* ______________________________________________________________________ */
/* Print a summary of each tag use in the instance. Things like depth in
* the tree, number of children, parent, attributes.
*/
/* Do the actual printing. Print the info about the node. If null,
* print a header for the columns.
* Arguments:
* Pointer to element structure of the node to print.
*/
static void
print_summ(
Element_t *e
)
{
int i, n, dsize;
char *hfmt="%-18.18s %4s %5s %4s %4s %s\n";
char *fmt ="%-18.18s %4d %5d %4d %4d %s\n";
if (e == NULL) {
fprintf(outfp, hfmt, "Element", "Att", "Data", "Chd", "Dep", "Parent");
return;
}
for (i=0,n=0; i<e->ncont; i++) if (IsContElem(e,i)) n++;
for (i=0,dsize=0; i<e->ncont; i++)
if (IsContElem(e,i)) dsize += strlen(e->cont[i].ch.data);
fprintf(outfp, fmt, e->gi, e->natts, dsize, n, e->depth,
e->parent ? e->parent->gi : "-");
for (i=0; i<e->natts; i++) {
fprintf(outfp, "%45d: %s = %s\n", i, e->atts[i].name,
e->atts[i].sval ? e->atts[i].sval : "empty");
}
}
/* Descend the tree, calling processing routine.
* Arguments:
* Pointer to element structure at top of tree to traverse.
*/
void
PrintElemSummary(
Element_t *e
)
{
print_summ(0);
DescendTree(e, print_summ, 0, 0, 0);
}
/* ______________________________________________________________________ */
/* Print the context of each tag in the instance (i.e. the tag with its
* ancestors).
*/
/* Do the actual printing. Print the context of the node.
* Arguments:
* Pointer to element structure of the node to print.
*/
static void
print_context(
Element_t *e
)
{
char buf[LINESIZE];
fprintf(outfp, "%-22s %s\n", e->gi, FindContext(e, 10, buf));
}
/* Descend the tree, calling processing routine.
* Arguments:
* Pointer to element structure at top of tree to traverse.
*/
void
PrintContext(
Element_t *e
)
{
fprintf(outfp, "%-22s %s\n", "Element", "Context");
fprintf(outfp, "%-22s %s\n", "---------------", "-----------");
DescendTree(e, print_context, 0, 0, 0);
putc(NL, outfp);
}
/* ______________________________________________________________________ */
/* Print tree of the instance. GI's are printed indented by their depth
* in the tree.
*/
/* Do the actual printing. Print the element name, indented the right amount.
* Arguments:
* Pointer to element structure of the node to print.
*/
static void
print_indent(
Element_t *e
)
{
int i, ne, nd;
for(i=0; i<e->depth; i++) fputs(". ", outfp);
for(i=0,ne=0; i<e->ncont; i++) if (IsContElem(e,i)) ne++;
for(i=0,nd=0; i<e->ncont; i++) if IsContData(e,i) nd++;
fprintf(outfp, "%s (%d,%d)\n", e->gi, ne, nd);
}
/* Descend the tree, calling processing routine.
* Arguments:
* Pointer to element structure at top of tree to traverse.
*/
void
PrintElemTree(
Element_t *e
)
{
DescendTree(e, print_indent, 0, 0, 0);
putc(NL, outfp);
}
/* ______________________________________________________________________ */
/* Print some statistics about the instance.
*/
/* Accumulate the totals for the statistics.
* Arguments:
* Pointer to element structure of the node to print.
* Pointer to the total number of elements.
* Pointer to the total amount of content data.
* Pointer to the maximum depth of tree.
*/
static void
acc_tots(
Element_t *e,
int *tot_el,
int *tot_data,
int *max_depth
)
{
int i;
for(i=0; i<e->necont; i++)
acc_tots(e->econt[i], tot_el, tot_data, max_depth);
for (i=0; i<e->necont; i++) (*tot_el)++;
for (i=0; i<e->ndcont; i++) (*tot_data) += strlen(e->dcont[i]);
if (e->depth > (*max_depth)) *max_depth = e->depth;
}
/* Descend the tree (recursively), collecting the statistics.
* Arguments:
* Pointer to element structure of the node to print.
* Pointer to the total number of elements.
* Pointer to the total amount of content data.
* Pointer to the maximum depth of tree.
*/
static void
elem_usage(
Element_t *e,
char *name,
int *n_used,
int *nchars
)
{
int i;
if (!strcmp(name, e->gi)) {
(*n_used)++;
for (i=0; i<e->ncont; i++)
if (IsContData(e,i)) (*nchars) += strlen(ContData(e,i));
}
for(i=0; i<e->necont; i++)
elem_usage(e->econt[i], name, n_used, nchars);
}
/* Descend the tree, calling processing routine.
* Arguments:
* Pointer to element structure at top of tree to traverse.
*/
void
PrintStats(
Element_t *top
)
{
int i, n;
int dif_el=0, tot_el=0, tot_data=0, nchars, max_depth=0;
float pct;
fprintf(outfp, "%-22s %s %s\n", "Element name", "Occurrances", "Character Content");
fprintf(outfp, "%-22s %s %s\n", "---------------", "-----------", "-----------------");
acc_tots(top, &tot_el, &tot_data, &max_depth);
for (i=0; i<nUsedElem; i++) {
n = 0;
nchars = 0;
elem_usage(top, UsedElem[i], &n, &nchars);
if (n > 0) {
pct = 100.0 * (float)n / (float)tot_el;
fprintf(outfp, "%-22s %4d %4.1f%% %6d %4d\n", UsedElem[i],
n, pct, nchars, (nchars/n));
dif_el++;
}
}
fprintf(outfp, "\nTotal of %d elements used, %d different ones.\n",
tot_el, dif_el);
fprintf(outfp, "Total character data: %d.\n", tot_data);
fprintf(outfp, "Maximum element depth: %d.\n", max_depth);
putc(NL, outfp);
}
/* ______________________________________________________________________ */
/* Print list of: ID, GI, input file, line number, separated by colons.
* This is better for other programs to manipulate (like for keeping a
* database of IDs in documents) than humans to read.
*/
void
PrintIDList()
{
ID_t *id;
Element_t *ep;
for (id=IDList; id; id=id->next) {
ep = id->elem;
fprintf(outfp, "%s:%s:%s:%d\n", id->id, ep->gi,
ep->infile?ep->infile:"-", ep->lineno);
}
}
/* ______________________________________________________________________ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,43 @@
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
These are what sgmls feeds us (from the sgmls manpage):
Commands (the command is the 1st char):
(gi start of element gi
)gi end of element gi
-data data
&name ref to external data entity
?pi processing instruction
Aname val attr name and value
Dename name val same as A, except external entity ename
Nnname sysid pubid def notation nname, ass w/ sysid,pubid
Eename typ nname filename def external data entity ename
Iename text def internal data entity ename
Sename filename... def subdoc entity
{ename start of SGML subdocument entity
}ename end of SGML subdocument entity
Llineno [file] set current line number, filename
And attributes values can have the form:
IMPLIED
CDATA data
TOKEN token
NOTATION nname
ENTITY name...
ID id
IDREF id...

View file

@ -0,0 +1,953 @@
/*
* Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
* All rights reserved.
*/
/*
* Copyright (c) 1994
* Open Software Foundation, Inc.
*
* Permission is hereby granted to use, copy, modify and freely distribute
* the software in this file and its documentation for any purpose without
* fee, provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation. Further, provided that the name of Open
* Software Foundation, Inc. ("OSF") not be used in advertising or
* publicity pertaining to distribution of the software without prior
* written permission from OSF. OSF makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* ________________________________________________________________________
*
* Program to manipulate SGML instances.
*
* This module is for handling OSF table markup, printing TeX or tbl
* (tbl) markup to the output stream. Also, table markup checking is
* done here. Yes, this depends on the DTD, but it makes translation
* specs much cleaner (and makes some things possible.
*
* Incomplete / not implemented / limitations / notes:
* vertical alignment (valign attr)
* vertical spanning
* 'wrap hint' attribute
* row separators are for the whole line, not per cell (the prog looks
* at rowsep for the 1st cell and applies it to the whole row)
* trusts that units if colwidths are acceptable to LaTeX and tbl
* "s" is an acceptable shorthand for "span" in model attributes
*
* A note on use of OutputString(): Strings with backslashes (\) need lots
* of backslashes. You have to escape them for the C compiler, and escape
* them again for OutputString() itself.
* ________________________________________________________________________
*/
#ifndef lint
static char *RCSid =
"$XConsortium: tables.c /main/3 1996/06/19 17:13:17 drk $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <memory.h>
#include <sys/types.h>
#include <errno.h>
#include <tptregexp.h>
#include "general.h"
#include "translate.h"
/* text width of page, in inches */
#define TEXTWIDTH 6.0
#define MAXCOLS 100
#define SPAN_NOT 0
#define SPAN_START 1
#define SPAN_CONT 2
/* these cover the attributes on the table element */
typedef struct {
char *ncols;
char *halign, **halign_v;
char *model, **model_v;
char *colwidth, **colwidth_v;
char *colsep, **colsep_v;
char *colweight, **colweight_v;
char *frame;
int n_halign, n_model, n_colwidth, n_colsep, n_colweight;
int repeathead;
int nc;
} TableInfo;
/* some flags, set when the table tag is processed, used later */
static int rowsep, siderules;
static int frametop, framebot, frameall;
static char basemodel[128]; /* model for table (in formatting language) */
static int spaninfo[MAXCOLS]; /* 100 columns, max */
static TableInfo TheTab;
/* forward references */
void SetTabAtts(Element_t *, TableInfo *, int);
void FreeTabAtts(TableInfo *);
void CheckTable(Element_t *);
void TblTable(Element_t *, FILE *);
void TblTableCellStart(Element_t *, FILE *);
void TblTableCellEnd(Element_t *, FILE *);
void TblTableRowStart(Element_t *, FILE *);
void TblTableRowEnd(Element_t *, FILE *);
void TblTableTop(Element_t *, FILE *);
void TblTableBottom(Element_t *, FILE *);
void TexTable(Element_t *, FILE *);
void TexTableCellStart(Element_t *, FILE *);
void TexTableCellEnd(Element_t *, FILE *);
void TexTableRowStart(Element_t *, FILE *);
void TexTableRowEnd(Element_t *, FILE *);
void TexTableTop(Element_t *, FILE *);
void TexTableBottom(Element_t *, FILE *);
/* ______________________________________________________________________ */
/* Hard-coded stuff for OSF DTD tables.
* Here are the TABLE attributes (for handy reference):
* ncols NUMBER num of cells/row should match
* model CDATA column prototypes for this table
* colwidth NUTOKENS absolute widths of cols
* colweight NUMBERS column weights
* halign CDATA horiz alignment for columns
* valign CDATA vertical alignment for columns
* colsep NUMBERS use col separators (lines)?
* rowsep NUMBERS use row separators (lines)?
* wrap NUMBERS wrap hints for columns
* repeathead NUMBER carry title rows to other pages
* frame (top|bottom|topbot|all|sides|none) frame style
*
* The 'wrap' attribute is never used.
*
* Usage in transpec: _osftable [tex|tbl|check] ['aspect']
* where 'aspect' is:
* rowstart stuff to do at start of a row (tests for spanning)
* rowend stuff to do at end of a row (eg, rules, etc.)
* cellstart stuff to do at start of a cell (eg, handle actual
* spanning instructions, etc.)
* cellend stuff to do at end of a cell (eg, cell separator)
* top stuff to do at top of the table
* (like whether or not it needs a starting horiz rule)
* bottom stuff to do at bottom of the table
* (like whether or not it needs an ending horiz rule)
* (nothing) the 'cols' param to LaTeX's \begin{tabular}[pos]{cols}
* or 'options' and 'formats' part in tbl
*/
/* Procedure to
* Arguments:
* Pointer to element under consideration.
* FILE pointer to where to write output.
* Vector of args to _osftable
* Count of args to _osftable
*/
void
OSFtable(
Element_t *e,
FILE *fp,
char **av,
int ac
)
{
/* Check params and dispatch to appropriate routine */
if (ac > 1 && !strcmp(av[1], "check")) CheckTable(e);
else if (!strcmp(av[1], "tbl")) {
if (ac > 2) {
if (!strcmp(av[2], "cellstart")) TblTableCellStart(e, fp);
else if (!strcmp(av[2], "cellend")) TblTableCellEnd(e, fp);
else if (!strcmp(av[2], "rowstart")) TblTableRowStart(e, fp);
else if (!strcmp(av[2], "rowend")) TblTableRowEnd(e, fp);
else if (!strcmp(av[2], "top")) TblTableTop(e, fp);
else if (!strcmp(av[2], "bottom")) TblTableBottom(e, fp);
else fprintf(stderr, "Unknown %s table instruction: %s\n",
av[1], av[2]);
}
else TblTable(e, fp);
}
else if (!strcmp(av[1], "tex")) {
if (ac > 2) {
if (!strcmp(av[2], "cellstart")) TexTableCellStart(e, fp);
else if (!strcmp(av[2], "cellend")) TexTableCellEnd(e, fp);
else if (!strcmp(av[2], "rowstart")) TexTableRowStart(e, fp);
else if (!strcmp(av[2], "rowend")) TexTableRowEnd(e, fp);
else if (!strcmp(av[2], "top")) TexTableTop(e, fp);
else if (!strcmp(av[2], "bottom")) TexTableBottom(e, fp);
else fprintf(stderr, "Unknown %s table instruction: %s\n",
av[1], av[2]);
}
else TexTable(e, fp);
}
else fprintf(stderr, "Unknown table type: %s\n", av[1]);
}
/* ______________________________________________________________________ */
/* Set values of the our internal table structure based on the table's
* attributes. (This is also called for rows, since tables and rows
* share many of the same attributes.)
* Arguments:
* Pointer to element under consideration.
* Pointer table info structure which will be filled in.
* Flag saying whether or not to set global variables based on attrs.
*/
void
SetTabAtts(
Element_t *e,
TableInfo *t,
int set_globals
)
{
char *at;
memset(t, 0, sizeof(TableInfo));
/* remember values of attributes */
if ((at = FindAttValByName(e, "HALIGN"))) t->halign = at;
if ((at = FindAttValByName(e, "MODEL"))) t->model = at;
if ((at = FindAttValByName(e, "COLWIDTH"))) t->colwidth = at;
if ((at = FindAttValByName(e, "COLSEP"))) t->colsep = at;
if ((at = FindAttValByName(e, "COLWEIGHT"))) t->colweight = at;
if ((at = FindAttValByName(e, "FRAME"))) t->frame = at;
if ((at = FindAttValByName(e, "REPEATHEAD"))) t->repeathead = atoi(at);
if ((at = FindAttValByName(e, "NCOLS"))) t->ncols = at;
/* Set some things for later when processing this table */
if (set_globals) {
rowsep = 1;
frametop = framebot = 1; /* default style */
/* For now we look at the first number of rowsep - it controls the
* horiz rule for then entire row. (not easy to specify lines that
* span only some columns in tex or tbl. */
if ((at = FindAttValByName(e, "ROWSEP"))) rowsep = atoi(at);
}
if (t->frame) {
/* top|bottom|topbot|all|sides|none */
if (!strcmp(t->frame, "NONE") || !strcmp(t->frame, "SIDES"))
frametop = framebot = 0;
else if (!strcmp(t->frame, "TOP")) framebot = 0;
else if (!strcmp(t->frame, "BOTTOM")) frametop = 0;
}
/* tbl and tex like lower case for units. convert. */
if (t->colwidth) {
char *cp;
for (cp=t->colwidth; *cp; cp++)
if (isupper(*cp)) *cp = tolower(*cp);
}
/* Now, split (space-separated) strings into vectors. Hopefully, the
* number of elements in each vector matches the number of columns.
*/
t->halign_v = Split(t->halign, &t->n_halign, S_STRDUP|S_ALVEC);
t->model_v = Split(t->model, &t->n_model, S_STRDUP|S_ALVEC);
t->colwidth_v = Split(t->colwidth, &t->n_colwidth, S_STRDUP|S_ALVEC);
t->colweight_v = Split(t->colweight, &t->n_colweight, S_STRDUP|S_ALVEC);
t->colsep_v = Split(t->colsep, &t->n_colsep, S_STRDUP|S_ALVEC);
/* Determin the _numeric_ number of columns, "nc". The order in which we
* check things to set nc is: NCOLS attribute, # of child element of 1st
* row, number of tokens in the various attr lists.
*/
if (t->ncols) t->nc = atoi(t->ncols);
/* If ncols attribute not set, see how many children first child has.
* I can't see how this can be non-zero (unless there are no rows, or
* no rows have any cells).
*/
if (!t->nc && e->necont) t->nc = e->econt[0]->necont;
/* If ncols still not set, guess it from other attrs. Last resort. */
if (!t->nc) {
if (t->n_halign) t->nc = t->n_halign;
else if (t->n_model) t->nc = t->n_model;
else if (t->n_colwidth) t->nc = t->n_colwidth;
else if (t->n_colweight) t->nc = t->n_colweight;
else if (t->n_colsep) t->nc = t->n_colsep;
}
}
/* ______________________________________________________________________ */
/* Free the storage of info use by the table info structure. (not the
* structure itself, but the strings its elements point to)
* Arguments:
* Pointer table info structure to be freed.
*/
void
FreeTabAtts(
TableInfo *t
)
{
if (!t) return;
if (t->halign_v) free(*t->halign_v);
if (t->model_v) free(*t->model_v);
if (t->colwidth_v) free(*t->colwidth_v);
if (t->colweight_v) free(*t->colweight_v);
if (t->colsep_v) free(*t->colsep_v);
}
/* ______________________________________________________________________ */
/* Check the attributes and children of the table pointed to by e.
* Report problems and inconsistencies to stderr.
* Arguments:
* Pointer to element (table) under consideration.
*/
void
CheckTable(
Element_t *e
)
{
int pr_loc=0; /* flag to say if we printed location */
int i, r, c;
float wt;
char *tpref = "Table Check"; /* prefix for err messages */
char *ncolchk =
"Table Check: %s ('%s') has wrong number of tokens. Expecting %d.\n";
if (strcmp(e->gi, "TABLE")) {
fprintf(stderr, "%s: Not pointing to a table!\n", tpref);
return;
}
FreeTabAtts(&TheTab); /* free storage, if allocated earlier */
SetTabAtts(e, &TheTab, 1); /* look at attributes */
/* NCOLS attribute set? */
if (!TheTab.ncols) {
pr_loc++;
fprintf(stderr, "%s: NCOLS attribute missing. Inferred as %d.\n",
tpref, TheTab.nc);
}
/* HALIGN attribute set? */
if (!TheTab.halign) {
pr_loc++;
fprintf(stderr, "%s: HALIGN attribute missing.\n", tpref);
}
/* See if the number of cells in each row matches */
for (r=0; r<e->necont; r++) {
if (e->econt[r]->necont != TheTab.nc) {
pr_loc++;
fprintf(stderr, "%s: NCOLS (%d) differs from actual number of cells (%d) in row %d.\n",
tpref, TheTab.nc, e->econt[r]->necont, r);
}
}
/* Check HALIGN */
if (TheTab.halign) {
if (TheTab.nc != TheTab.n_halign) { /* number of tokens OK? */
pr_loc++;
fprintf(stderr, ncolchk, "HALIGN", TheTab.halign, TheTab.nc);
}
else { /* values OK? */
for (i=0; i<TheTab.nc; i++) {
if (*TheTab.halign_v[i] != 'c' && *TheTab.halign_v[i] != 'l' &&
*TheTab.halign_v[i] != 'r') {
pr_loc++;
fprintf(stderr, "%s: HALIGN (%d) value wrong: %s\n",
tpref, i, TheTab.halign_v[i]);
}
}
}
}
/* check COLWIDTH */
if (TheTab.colwidth) {
if (TheTab.nc != TheTab.n_colwidth) { /* number of tokens OK? */
pr_loc++;
fprintf(stderr, ncolchk, "COLWIDTH", TheTab.colwidth, TheTab.nc);
}
else { /* values OK? */
for (i=0; i<TheTab.nc; i++) {
/* check that the units after the numbers are OK
we want "in", "cm".
*/
}
}
}
/* check COLWEIGHT */
if (TheTab.colweight) {
if (TheTab.nc != TheTab.n_colweight) { /* number of tokens OK? */
pr_loc++;
fprintf(stderr, ncolchk, "COLWEIGHT", TheTab.colweight, TheTab.nc);
}
else { /* values OK? */
for (i=0; i<TheTab.nc; i++) { /* check that magitude is reasonable */
wt = atof(TheTab.colweight_v[i]);
if (wt > 50.0) {
pr_loc++;
fprintf(stderr, "%s: unreasonable COLWEIGHT value: %f.\n",
tpref, wt);
}
}
}
}
/* check COLSEP */
if (TheTab.colsep) {
if (TheTab.nc != TheTab.n_colsep) { /* number of tokens OK? */
pr_loc++;
fprintf(stderr, ncolchk, "COLSEP", TheTab.colsep, TheTab.nc);
}
else { /* values OK? */
for (i=0; i<TheTab.nc; i++) {
}
}
}
/* See if MODEL has the same number of tokens as NCOLS. Then do model. */
if (TheTab.model) {
if (TheTab.nc != TheTab.n_model) {
pr_loc++;
fprintf(stderr, ncolchk, "MODEL", TheTab.model, TheTab.nc);
}
for (r=0; r<e->necont; r++) {
/* only check normal rows */
if (strcmp(e->econt[r]->gi, "ROW")) continue;
for (c=0; c<e->econt[r]->necont; c++) {
if (!strcmp(TheTab.model_v[c], "text") ||
!strcmp(TheTab.model_v[c], "-")) continue;
if (e->econt[r]->econt[c]->necont &&
strcmp(e->econt[r]->econt[c]->econt[0]->gi, TheTab.model_v[c])) {
fprintf(stderr, "%s: MODEL wants %s, but cell contains %s: row %d, cell %d.\n",
tpref, TheTab.model_v[c],
e->econt[r]->econt[c]->econt[0]->gi, r, c);
pr_loc++;
}
}
}
}
if (pr_loc) {
fprintf(stderr, "%s: Above problem in table located at:\n", tpref);
PrintLocation(e, stderr);
}
}
/* ______________________________________________________________________ */
/* Do the "right thing" for the table spec for tbl (troff) tables. This will
* generate the "center,box,tab(@)..." and the column justification stuff.
* Arguments:
* Pointer to element (table) under consideration.
* FILE pointer to where to write output.
*/
void
TblTable(
Element_t *e,
FILE *fp
)
{
int i, n;
char *fr;
float tot;
char *cp, wbuf[1500], **widths=0, **widths_v=0, *mp;
FreeTabAtts(&TheTab); /* free storage, if allocated earlier */
SetTabAtts(e, &TheTab, 1); /* look at attributes */
fr = "box"; /* default framing */
frameall = 1;
siderules = 0;
if (TheTab.frame) {
if (!strcmp(TheTab.frame, "ALL")) {
fr = "box";
frametop = framebot = 0;
}
else {
fr = "";
frameall = 0;
}
if (!strcmp(TheTab.frame, "SIDES")) siderules = 1;
}
else frametop = framebot = 0; /* because 'box' is default */
fprintf(fp, "center, %s%s tab(@);\n", fr, ((*fr)?",":""));
/* Figure out the widths, based either on "colwidth" or "colweight".
* (we pick width over weight if both are specified). */
if (TheTab.colwidth && TheTab.nc == TheTab.n_colwidth) {
widths = TheTab.colwidth_v;
}
else if (TheTab.colweight && TheTab.nc == TheTab.n_colweight) {
for (n=0,i=0; i<TheTab.nc; i++) n += atoi(TheTab.colweight_v[i]);
tot = (float)n;
cp = wbuf;
for (i=0; i<TheTab.nc; i++) {
sprintf(cp, "%5.3fin", atof(TheTab.colweight_v[i])*(TEXTWIDTH/tot));
while (*cp) cp++;
*cp++ = ' ';
}
*cp = EOS;
widths_v = Split(wbuf, 0, S_ALVEC);
widths = widths_v;
}
/* Remember the base model in case we do spans later. We write it
* into a static buffer, then output it at once. */
mp = basemodel;
if (siderules) *mp++ = '|';
for (i=0; i<TheTab.nc; i++) {
/* If width specified, use it; else if halign set, use it; else left. */
if (widths && widths[i][0] != '0' && widths[i][1] != EOS) {
if (i) *mp++ = ' ';
strcpy(mp, TheTab.halign_v[i]);
while (*mp) mp++;
*mp++ = 'w';
*mp++ = '(';
strcpy(mp, widths[i]);
while (*mp) mp++;
*mp++ = ')';
}
else if (TheTab.halign && TheTab.nc == TheTab.n_halign) {
if (i) *mp++ = ' ';
strcpy(mp, TheTab.halign_v[i]);
while (*mp) mp++;
}
else {
if (i) *mp++ = ' ';
*mp++ = 'l';
}
/* See if we want column separators. */
if (TheTab.colsep) {
if ( (i+1) < TheTab.nc ) {
if ( *TheTab.colsep_v[i] == '1' )
*mp++ = '|';
if ( *TheTab.colsep_v[i] == '2') {
*mp++ = '|';
*mp++ = '|';
}
}
}
}
if (siderules) *mp++ = '|';
/* *mp++ = '.';*/
/* *mp++ = '^';*/
*mp = EOS;
OutputString(basemodel, fp, 1);
OutputString(".^", fp, 1);
if (widths_v) free(widths_v);
}
/*
* Arguments:
* Pointer to element (cell) under consideration.
* FILE pointer to where to write output.
*/
void
TblTableCellStart(
Element_t *e,
FILE *fp
)
{
/* nothing to do at start of cell */
}
/*
* Arguments:
* Pointer to element (cell) under consideration.
* FILE pointer to where to write output.
*/
void
TblTableCellEnd(
Element_t *e,
FILE *fp
)
{
/* do cell/col separators */
if (e->my_eorder < (TheTab.nc-1)) {
if (spaninfo[e->my_eorder] == SPAN_NOT ||
spaninfo[e->my_eorder+1] != SPAN_CONT)
OutputString("@", fp, 1);
}
}
/* Look at model attribute for spanning. If set, remember info for when
* doing the cells. Called by TblTableRowStart() and TexTableRowStart().
* Arguments:
* Pointer to element (row) under consideration.
*/
int
check_for_spans(
Element_t *e
)
{
char *at;
char **spans;
int n, i, inspan;
/* See if MODEL attr is set */
if ((at = FindAttValByName(e, "MODEL"))) {
/* Split into tokens, then look at each for the word "span" */
n = TheTab.nc;
spans = Split(at, &n, S_STRDUP|S_ALVEC);
/* Mark columns as start-of-span, in-span, or not spanned. Remember
* in at list, "spaningo". (Span does not make sense in 1st column.)
*/
for (i=1,inspan=0; i<n; i++) {
if (StrEq(spans[i], "span") || StrEq(spans[i], "s")) {
if (inspan == 0) spaninfo[i-1] = SPAN_START;
spaninfo[i] = SPAN_CONT;
inspan = 1;
}
else {
spaninfo[i] = SPAN_NOT;
inspan = 0;
}
}
free(*spans); /* free string */
free(spans); /* free vector */
spaninfo[TheTab.nc] = SPAN_NOT; /* after last cell */
return 1;
}
/* if model not set, mark all as not spanning */
else
for (i=0; i<MAXCOLS; i++) spaninfo[i] = SPAN_NOT;
return 0;
}
/* Output format for cell. Called from TblTableRowStart().
* Arguments:
* Pointer to table info structure (for this row)
* Which cell/column we're considering
* Flag saying whether we're on last column
* Default format of col, if none is set for this row or table
* FILE pointer to where to write output.
*/
void
tbl_cell_fmt(
TableInfo *t,
int i,
int lastcol,
char *def_fmt,
FILE *fp
)
{
if (t->halign) OutputString(t->halign_v[i], fp, 1);
else if (TheTab.halign) OutputString(TheTab.halign_v[i], fp, 1);
else OutputString(def_fmt, fp, 1);
if (!lastcol && spaninfo[i+1] != SPAN_CONT) {
if (t->colsep) {
if (*t->colsep_v[i] == '1')
OutputString("|", fp, 1);
if (*t->colsep_v[i] == '2')
OutputString("||", fp, 1);
}
else if (TheTab.colsep) {
if (*TheTab.colsep_v[i] == '1')
OutputString("|", fp, 1);
if (*TheTab.colsep_v[i] == '2')
OutputString("||", fp, 1);
}
else OutputString("|", fp, 1);
}
OutputString(" ", fp, 1);
}
/*
* Arguments:
* Pointer to element (row) under consideration.
* FILE pointer to where to write output.
*/
void
TblTableRowStart(
Element_t *e,
FILE *fp
)
{
int i, lastcol, stayhere;
char **basev, *cp;
TableInfo RowInfo;
/* check if we're spanning, or if HALIGN set */
stayhere = 0;
if (check_for_spans(e)) stayhere = 1;
SetTabAtts(e, &RowInfo, 0);
if (RowInfo.halign) stayhere = 1;
if (!stayhere) return;
/* Change table layout because we have a span, or the row has HALIGN. */
OutputString("^.T&^", fp, 1);
basev = Split(basemodel, 0, S_ALVEC|S_STRDUP);
for (i=0; i<TheTab.nc; i++) {
lastcol = !(i < TheTab.nc-1);
if (spaninfo[i] == SPAN_START) {
tbl_cell_fmt(&RowInfo, i, lastcol, "c ", fp);
}
else if (spaninfo[i] == SPAN_CONT) {
/* See if next col is NOT spanned, and we're not in last col */
OutputString("s", fp, 1);
if (!lastcol && spaninfo[i+1] != SPAN_CONT) {
if (RowInfo.colsep) cp = RowInfo.colsep_v[i];
else if (TheTab.colsep) cp = TheTab.colsep_v[i];
else cp = "1";
if (*cp == '1')
OutputString("|", fp, 1);
if (*cp == '2')
OutputString("||", fp, 1);
}
OutputString(" ", fp, 1);
}
else
tbl_cell_fmt(&RowInfo, i, lastcol, "l ", fp);
}
OutputString("^", fp, 1);
OutputString(basemodel, fp, 1);
OutputString(".^", fp, 1);
free(*basev);
free(basev);
FreeTabAtts(&RowInfo);
}
/*
* Arguments:
* Pointer to element (row) under consideration.
* FILE pointer to where to write output.
*/
void
TblTableRowEnd(
Element_t *e,
FILE *fp
)
{
char *at;
/* See if we're on the last row, then if we're putting a frame
* around the whole table. If so, we need no bottom separator. */
if ((e->parent->necont-1) == e->my_eorder) {
if (frameall || framebot) return;
}
/* check this row's attributes */
if ((at = FindAttValByName(e, "ROWSEP"))) {
if (at[0] == '1') fprintf(fp, "_\n");
}
else if (rowsep) /* fprintf(fp, "_\n") */ ;
}
/*
* Arguments:
* Pointer to element (table) under consideration.
* FILE pointer to where to write output.
*/
void
TblTableTop(Element_t *e, FILE *fp)
{
if (frametop) OutputString("^_^", fp, 1);
}
void
TblTableBottom(Element_t *e, FILE *fp)
{
if (framebot) OutputString("^_^", fp, 1);
}
/* ______________________________________________________________________ */
/* Do the "right thing" for the table spec for TeX tables. This will
* generate the arg to \begin{tabular}[xxx].
* Arguments:
* Pointer to element (table) under consideration.
* FILE pointer to where to write output.
*/
void
TexTable(
Element_t *e,
FILE *fp
)
{
int i, n;
float tot;
char *cp, wbuf[1500], **widths=0, **widths_v=0;
FreeTabAtts(&TheTab); /* free storage, if allocated earlier */
SetTabAtts(e, &TheTab, 1); /* look at attributes */
/* Figure out the widths, based either on "colwidth" or "colweight".
* (we pick width over weight if both are specified). */
if (TheTab.colwidth && TheTab.nc == TheTab.n_colwidth) {
widths = TheTab.colwidth_v;
}
else if (TheTab.colweight && TheTab.nc == TheTab.n_colweight) {
for (n=0,i=0; i<TheTab.nc; i++) n += atoi(TheTab.colweight_v[i]);
tot = (float)n;
cp = wbuf;
for (i=0; i<TheTab.nc; i++) {
sprintf(cp, "%5.3fin", atof(TheTab.colweight_v[i])*(TEXTWIDTH/tot));
while (*cp) cp++;
*cp++ = ' ';
}
*cp = EOS;
widths_v = Split(wbuf, 0, S_ALVEC);
widths = widths_v;
}
siderules = 1;
if (TheTab.frame)
if (strcmp(TheTab.frame, "ALL") && strcmp(TheTab.frame, "SIDES"))
siderules = 0;
if (siderules) OutputString("|", fp, 1);
for (i=0; i<TheTab.nc; i++) {
/* If width specified, use it; else if halign set, use it; else left. */
if (widths && widths[i][0] != '0' && widths[i][1] != EOS) {
fprintf(fp, "%sp{%s}", (i?" ":""), widths[i]);
}
else if (TheTab.halign && TheTab.nc == TheTab.n_halign) {
fprintf(fp, "%s%s", (i?" ":""), TheTab.halign_v[i]);
}
else
fprintf(fp, "%sl", (i?" ":""));
/* See if we want column separators. */
if (TheTab.colsep) {
if ( (i+1) < TheTab.nc ) {
if ( *TheTab.colsep_v[i] == '1' ) {
fprintf(fp, " |");
}
if ( *TheTab.colsep_v[i] == '2' ) {
fprintf(fp, " ||");
}
}
}
}
if (siderules) OutputString("|", fp, 1);
if (widths_v) free(widths_v);
}
/*
* Arguments:
* Pointer to element (cell) under consideration.
* FILE pointer to where to write output.
*/
void
TexTableCellStart(
Element_t *e,
FILE *fp
)
{
int n, i;
char buf[50], *at;
if (spaninfo[e->my_eorder] == SPAN_START) {
for (i=e->my_eorder+1,n=1; ; i++) {
if (spaninfo[i] == SPAN_CONT) n++;
else break;
}
sprintf(buf, "\\\\multicolumn{%d}{%sc%s}", n,
(siderules?"|":""), (siderules?"|":""));
OutputString(buf, fp, 1);
}
#ifdef New
if ((at = FindAttValByName(e->parent, "HALIGN"))) {
/* no span, but user wants to change the alignment */
h_v = Split(wbuf, 0, S_ALVEC|S_STRDUP);
OutputString("\\\\multicolumn{1}{%sc%s}", n,
fp, 1);
}
#endif
if (spaninfo[e->my_eorder] != SPAN_CONT) OutputString("{", fp, 1);
}
/*
* Arguments:
* Pointer to element (cell) under consideration.
* FILE pointer to where to write output.
*/
void
TexTableCellEnd(
Element_t *e,
FILE *fp
)
{
if (spaninfo[e->my_eorder] != SPAN_CONT) OutputString("} ", fp, 1);
/* do cell/col separators */
if (e->my_eorder < (TheTab.nc-1)) {
if (spaninfo[e->my_eorder] == SPAN_NOT ||
spaninfo[e->my_eorder+1] != SPAN_CONT)
OutputString("& ", fp, 1);
}
}
/* Look at model for spanning. If set, remember it for when doing the cells.
* Arguments:
* Pointer to element (row) under consideration.
* FILE pointer to where to write output.
*/
void
TexTableRowStart(
Element_t *e,
FILE *fp
)
{
check_for_spans(e);
}
/*
* Arguments:
* Pointer to element (row) under consideration.
* FILE pointer to where to write output.
*/
void
TexTableRowEnd(
Element_t *e,
FILE *fp
)
{
char *at;
/* check this row's attributes */
if ((at = FindAttValByName(e, "ROWSEP"))) {
if (at[0] == '1') OutputString("\\\\\\\\[2mm] \\\\hline ", fp, 1);
}
else if (rowsep) OutputString("\\\\\\\\ ", fp, 1);
else
OutputString("\\\\\\\\ ", fp, 1);
}
/*
* Arguments:
* Pointer to element (table) under consideration.
* FILE pointer to where to write output.
*/
void
TexTableTop(Element_t *e, FILE *fp)
{
if (frametop) OutputString("\\\\hline", fp, 1);
}
void
TexTableBottom(Element_t *e, FILE *fp)
{
if (framebot) OutputString("\\\\hline", fp, 1);
}
/* ______________________________________________________________________ */

View file

@ -0,0 +1,416 @@
/*
* Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
* All rights reserved.
*/
/*
* Copyright (c) 1994
* Open Software Foundation, Inc.
*
* Permission is hereby granted to use, copy, modify and freely distribute
* the software in this file and its documentation for any purpose without
* fee, provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation. Further, provided that the name of Open
* Software Foundation, Inc. ("OSF") not be used in advertising or
* publicity pertaining to distribution of the software without prior
* written permission from OSF. OSF makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* ________________________________________________________________________
*
* Program to manipulate SGML instances.
*
* This module contains the initialization routines for translation module.
* They mostly deal with reading data files (translation specs, SDATA
* mappings, character mappings).
*
* Entry points:
* ReadTransSpec(transfile) read/store translation spec from file
* ReadSDATA(sdatafile) read/store SDATA mappings from file
* ReadMapping(mapfile) read/store char mappings from file
* ________________________________________________________________________
*/
#ifndef lint
static char *RCSid =
"$XConsortium: traninit.c /main/3 1996/06/19 17:13:22 drk $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <memory.h>
#include <sys/types.h>
#include <errno.h>
#include <tptregexp.h>
#include "general.h"
#include "translate.h"
/* forward references */
void RememberTransSpec(Trans_t *, int);
/* ______________________________________________________________________ */
/* Read the translation specs from the input file, storing in memory.
* Arguments:
* Name of translation spec file.
*/
void
ReadTransSpec(
char *transfile
)
{
FILE *fp;
char buf[LINESIZE], *cp, *fn, *cp2;
int lineno=0, c, i;
Trans_t T;
int giLen;
char *giBuf;
if ((fp=OpenFile(transfile)) == NULL) {
fprintf(stderr, "Can not open translation spec file '%s'.\n%s\n",
transfile, strerror(errno));
return;
}
memset(&T, 0, sizeof T); /* initialize/clear structure */
while (fgets(buf, LINESIZE, fp)) /* read line from .ts file */
{
lineno++;
/* skip comment and blank lines */
if (buf[0] == '#' || buf[0] == NL) continue;
/* '-' indicates end of a spec. When we hit one, remember what we've
* accumulated so far, and null-out the accumulating structure. */
if (buf[0] == '-') {
T.lineno = lineno;
RememberTransSpec(&T, lineno);
memset(&T, 0, sizeof T);
continue;
}
stripNL(buf);
/* See if next line is continued from this one -- ie. it starts with
* whitespace. If so, append to current line. (This is similar to
* how e-mail headers work...) */
while (1) {
c = getc(fp); /* 1st char of next line */
if (IsWhite(c)) { /* space or tab? */
/* keep getting characters until it's a non-whitespace */
c = getc(fp);
while (IsWhite(c)) c = getc(fp);
ungetc(c, fp); /* put back non-whitespace */
i = strlen(buf);
fn = buf + i; /* point to end of string in buffer */
fgets(fn, LINESIZE-i, fp); /* read and append to buf */
lineno++;
stripNL(buf);
}
else {
ungetc(c, fp); /* put back non-whitespace */
break;
}
}
/* Isolate field value */
if ((cp=strchr(buf, ':'))) {
cp++; /* point past colon */
while (*cp && IsWhite(*cp)) cp++; /* point to content */
}
else {
fprintf(stderr,
"Trans spec error, missing colon (skipping line):\n %s\n", fn);
continue;
}
fn = buf; /* fn is name of the field, cp the value. */
/* Check field names in order that they're likely to occur. */
if (!strncmp("GI:", fn, 3)) {
/* if we are folding the case of GIs, make all upper (unless
it's an internal pseudo-GI name, which starts with '_') */
if (fold_case && cp[0] != '_' && cp[0] != '#') {
for (cp2=cp; *cp2; cp2++)
if (islower(*cp2)) *cp2 = toupper(*cp2);
}
if (T.gi) {
giLen = strlen(T.gi) + strlen(cp) + 2;
Malloc(giLen, giBuf, char);
strcpy(giBuf, T.gi);
strcat(giBuf, " "); /* why we added "2" above */
strcat(giBuf, cp);
T.gi = AddElemName(giBuf);
free(giBuf);
} else {
T.gi = AddElemName(cp);
}
}
else if (!strncmp("StartText:", fn, 10)) T.starttext = strdup(cp);
else if (!strncmp("EndText:", fn, 8)) T.endtext = strdup(cp);
else if (!strncmp("Relation:", fn, 9)) {
if (!T.relations) T.relations = NewMap(IMS_relations);
SetMapping(T.relations, cp);
}
else if (!strncmp("StartCode:", fn, 10)) T.startcode = strdup(cp);
else if (!strncmp("EndCode:", fn, 8)) T.endcode = strdup(cp);
else if (!strncmp("Replace:", fn, 8)) T.replace = strdup(cp);
else if (!strncmp("AttValue:", fn, 9)) {
if (!T.nattpairs) {
Malloc(1, T.attpair, AttPair_t);
}
else
Realloc((T.nattpairs+1), T.attpair, AttPair_t);
/* we'll split name/value pairs later */
T.attpair[T.nattpairs].name = strdup(cp);
T.nattpairs++;
}
/* If there's only one item in context, it's the parent. Treat
* it specially, since it's easier to just check parent gi.
*/
else if (!strncmp("Context:", fn, 8)) T.context = strdup(cp);
else if (!strncmp("Message:", fn, 8)) T.message = strdup(cp);
else if (!strncmp("SpecID:", fn, 7)) T.my_id = atoi(cp);
else if (!strncmp("Action:", fn, 7)) T.use_id = atoi(cp);
else if (!strncmp("Content:", fn, 8)) T.content = strdup(cp);
else if (!strncmp("PAttSet:", fn, 8)) T.pattrset = strdup(cp);
else if (!strncmp("Ignore:", fn, 7)) {
if (!strcmp(cp, "all")) T.ignore = IGN_ALL;
else if (!strcmp(cp, "data")) T.ignore = IGN_DATA;
else if (!strcmp(cp, "children")) T.ignore = IGN_CHILDREN;
else
fprintf(stderr, "Bad 'Ignore:' arg in transpec (line %d): %s\n",
lineno, cp);
}
else if (!strncmp("VarValue:", fn, 9)) {
char **tok;
i = 2;
tok = Split(cp, &i, S_STRDUP);
T.var_name = tok[0];
T.var_value = tok[1];
}
else if (!strncmp("Set:", fn, 4)) {
if (!T.set_var) T.set_var = NewMap(IMS_setvar);
SetMapping(T.set_var, cp);
}
else if (!strncmp("Increment:", fn, 10)) {
if (!T.incr_var) T.incr_var = NewMap(IMS_incvar);
SetMapping(T.incr_var, cp);
}
else if (!strncmp("NthChild:", fn, 9)) T.nth_child = atoi(cp);
else if (!strncmp("Var:", fn, 4)) SetMapping(Variables, cp);
else if (!strncmp("Quit:", fn, 5)) T.quit = strdup(cp);
else
fprintf(stderr, "Unknown translation spec (skipping it): %s\n", fn);
}
fclose(fp);
}
/* ______________________________________________________________________ */
/* Store translation spec 't' in memory.
* Arguments:
* Pointer to translation spec to remember.
* Line number where translation spec ends.
*/
void
RememberTransSpec(
Trans_t *t,
int lineno
)
{
char *cp;
int i, do_regex;
static Trans_t *last_t;
/* If context testing, check some details and set things up for later. */
if (t->context) {
/* See if the context specified is a regular expression.
* If so, compile the reg expr. It is assumed to be a regex if
* it contains a character other than what's allowed for GIs in the
* OSF sgml declaration (alphas, nums, '-', and '.').
*/
for (do_regex=0,cp=t->context; *cp; cp++) {
if (!isalnum(*cp) && *cp != '-' && *cp != '.' && *cp != ' ') {
do_regex = 1;
break;
}
}
if (do_regex) {
t->depth = MAX_DEPTH;
if (!(t->context_re=tpt_regcomp(t->context))) {
fprintf(stderr, "Regex error in Context: %s\n", t->context);
}
}
else {
/* If there's only one item in context, it's the parent. Treat
* it specially, since it's faster to just check parent gi.
*/
cp = t->context;
if (!strchr(cp, ' ')) {
t->parent = t->context;
t->context = NULL;
}
else {
/* Figure out depth of context string */
t->depth = 0;
while (*cp) {
if (*cp) t->depth++;
while (*cp && !IsWhite(*cp)) cp++; /* find end of gi */
while (*cp && IsWhite(*cp)) cp++; /* skip space */
}
}
}
}
/* Compile regular expressions for each attribute */
for (i=0; i<t->nattpairs; i++) {
/* Initially, name points to "name value". Split them... */
cp = t->attpair[i].name;
while (*cp && !IsWhite(*cp)) cp++; /* point past end of name */
if (*cp) { /* value found */
*cp++ = EOS; /* terminate name */
while (*cp && IsWhite(*cp)) cp++; /* point to value */
t->attpair[i].val = cp;
}
else { /* value not found */
t->attpair[i].val = ".";
}
if (!(t->attpair[i].rex=tpt_regcomp(t->attpair[i].val))) {
fprintf(stderr, "Regex error in AttValue: %s %s\n",
t->attpair[i].name, t->attpair[i].val);
}
}
/* Compile regular expression for content */
t->content_re = 0;
if (t->content) {
if (!(t->content_re=tpt_regcomp(t->content)))
fprintf(stderr, "Regex error in Content: %s\n",
t->content);
}
/* If multiple GIs, break up into a vector, then remember it. We either
* sture the individual, or the list - not both. */
if (t->gi && strchr(t->gi, ' ')) {
t->gilist = Split(t->gi, 0, S_ALVEC);
t->gi = NULL;
}
/* Now, store structure in linked list. */
if (!TrSpecs) {
Malloc(1, TrSpecs, Trans_t);
last_t = TrSpecs;
}
else {
Malloc(1, last_t->next, Trans_t);
last_t = last_t->next;
}
*last_t = *t;
}
/* ______________________________________________________________________ */
/* Read mapping file, filling in structure slots (just name-value pairs).
* Arguments:
* Name of character mapping file.
*/
void
ReadCharMap(
char *filename
)
{
FILE *fp;
char buf[LINESIZE], *name, *val;
int lineno=0;
int n_alloc=0; /* number of slots allocated so far */
if ((fp=OpenFile(filename)) == NULL) {
fprintf(stderr, "Can not open character mapping file '%s'.\n%s\n",
filename, strerror(errno));
return;
}
/* We allocate slots in blocks of N, so we don't have to call
* malloc so many times. */
n_alloc = 32;
Calloc(n_alloc, CharMap, Mapping_t);
nCharMap = 0;
while (fgets(buf, LINESIZE, fp))
{
lineno++;
/* skip comment and blank lines */
if (buf[0] == '#' || buf[0] == NL) continue;
stripNL(buf);
/* Need more slots for mapping structures? */
if (nCharMap >= n_alloc) {
n_alloc += 32;
Realloc(n_alloc, CharMap, Mapping_t);
}
name = val = buf;
while (*val && !IsWhite(*val)) val++; /* point past end of name */
if (*val) {
*val++ = EOS; /* terminate name */
while (*val && IsWhite(*val)) val++; /* point to value */
}
if (name) {
CharMap[nCharMap].name = strdup(name);
if (val) CharMap[nCharMap].sval = strdup(val);
if (CharMap[nCharMap].name[0] == '\\') CharMap[nCharMap].name++;
nCharMap++;
}
}
fclose(fp);
}
/* ______________________________________________________________________ */
/* Read SDATA mapping file, remembering the mappings in memory.
* Input file format is 2 columns, name and value, separated by one or
* more tabs (not spaces).
* This can be called multuple times, reading several files.
* Arguments:
* Name of SDATA entity mapping file.
*/
void
ReadSDATA(
char *filename
)
{
FILE *fp;
char buf[LINESIZE], *name, *val;
int lineno=0;
if ((fp=OpenFile(filename)) == NULL) {
fprintf(stderr, "Can not open SDATA file '%s': %s", filename,
strerror(errno));
return;
}
if (!SDATAmap) SDATAmap = NewMap(IMS_sdata);
while (fgets(buf, LINESIZE, fp))
{
lineno++;
/* skip comment and blank lines */
if (buf[0] == '#' || buf[0] == NL) continue;
stripNL(buf);
name = val = buf;
while (*val && *val != TAB) val++; /* point past end of name */
if (*val) {
*val++ = EOS; /* terminate name */
while (*val && *val == TAB) val++; /* point to value */
}
SetMappingNV(SDATAmap, name, val);
}
fclose(fp);
}
/* ______________________________________________________________________ */

View file

@ -0,0 +1,875 @@
/*
* Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
* All rights reserved.
*/
/*
* Copyright (c) 1994
* Open Software Foundation, Inc.
*
* Permission is hereby granted to use, copy, modify and freely distribute
* the software in this file and its documentation for any purpose without
* fee, provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation. Further, provided that the name of Open
* Software Foundation, Inc. ("OSF") not be used in advertising or
* publicity pertaining to distribution of the software without prior
* written permission from OSF. OSF makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* ________________________________________________________________________
*
* Program to manipulate SGML instances.
*
* This module is for "translating" an instance to another form, usually
* suitable for a formatting application.
*
* Entry points for this module:
* DoTranslate(elem, transfile, mapfile, fp)
* ________________________________________________________________________
*/
#ifndef lint
static char *RCSid =
"$XConsortium: translate.c /main/10 1996/10/29 11:47:36 cde-hp $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <memory.h>
#include <sys/types.h>
#include <errno.h>
#include <tptregexp.h>
#include "general.h"
#define STORAGE
#include "translate.h"
static Trans_t NullTrans; /* an empty one */
/* forward references */
void ProcesOutputSpec(char *, Element_t *, FILE *, int);
void CallInterpreter(char *, Element_t *);
/* ______________________________________________________________________ */
/* Translate the subtree starting at 'e'. Use 'transfile' for translation
* specs. Output goes to 'fp'. This is the entry point for translating
* an instance.
* Assumes you've read SDATA and CharMap files (optionally).
* Arguments:
* Pointer to element under consideration.
* Pointer to name of translation spec file.
* FILE pointer to where to write output.
*/
static void WasProcessed(Element_t *);
void
DoTranslate(
Element_t *e,
char *transfile,
FILE *fp
)
{
Trans_t *t, *tn;
if (!transfile) {
fprintf(stderr,
"Translation spec file not specified. Skipping translation.\n");
return;
}
ReadTransSpec(transfile);
/* Find transpec for each node. */
DescendTree(e, PrepTranspecs, 0, 0, 0);
/* Stuff to do at start of processing */
if ((t = FindTransByName("_Start"))) {
if (t->starttext) ProcesOutputSpec(t->starttext, 0, fp, 1);
if (t->startcode) CallInterpreter(t->startcode, 0);
if (t->replace) ProcesOutputSpec(t->replace, 0, fp, 1);
if (t->message) ProcesOutputSpec(t->message, 0, stderr, 0);
if (t->endcode) CallInterpreter(t->endcode, 0);
if (t->endtext) ProcesOutputSpec(t->endtext, 0, fp, 1);
}
/* Translate topmost/first element. This is recursive. */
TransElement(e, fp, NULL);
/* Stuff to do at end of processing */
if ((t = FindTransByName("_End"))) {
if (t->starttext) ProcesOutputSpec(t->starttext, 0, fp, 1);
if (t->startcode) CallInterpreter(t->startcode, 0);
if (t->replace) ProcesOutputSpec(t->replace, 0, fp, 1);
if (t->message) ProcesOutputSpec(t->message, 0, stderr, 0);
if (t->endcode) CallInterpreter(t->endcode, 0);
if (t->endtext) ProcesOutputSpec(t->endtext, 0, fp, 1);
}
/* Warn about unprocessed elements in this doc tree, if verbose mode. */
if (verbose)
DescendTree(e, WasProcessed, 0, 0, 0);
/* Clean up. This is not yet complete, which is no big deal (since the
* program is normally done at this point anyway. */
for (t=TrSpecs; t; ) {
tn = t->next;
/* free the contents of t here ... */
(void)free((void* )t);
t = tn;
}
TrSpecs = 0;
}
/* ______________________________________________________________________ */
/* Print warning about unprocessed elements in this doc tree (if they
* were not explicitely ignored).
* Arguments:
* Pointer to element under consideration.
*/
static void
WasProcessed(
Element_t *e
)
{
Trans_t *t;
t = e->trans;
if (!e->processed && (t && !t->ignore)) {
fprintf(stderr, "Warning: element '%s' was not processed:\n", e->gi);
PrintLocation(e, stderr);
}
}
/* ______________________________________________________________________ */
/* For each element find transpec.
* Arguments:
* Pointer to element under consideration.
*/
void
PrepTranspecs(
Element_t *e
)
{
Trans_t *t;
t = FindTrans(e);
e->trans = t;
}
/* ______________________________________________________________________ */
/* Copy a buffer/string into another, expanding regular variables. (Special
* variables are done later.)
* Arguments:
* Pointer to string to expand.
* Pointer to expanded string. (return)
* Pointer to element under consideration.
*/
void
ExpandVariables(
char *in,
char *out,
Element_t *e
)
{
char *ip, *vp, *op;
char *def_val, *s, *atval, *modifier;
char vbuf[500];
int lev;
ip = in;
op = out;
while (*ip) {
/* start of regular variable? */
if (*ip == VDELIM && *(ip+1) == L_CURLY && *(ip+2) != '_') {
ip++;
ip++; /* point at variable name */
vp = vbuf;
/* Look for matching (closing) curly. (watch for nesting)
* We store the variable content in a tmp buffer, so we don't
* clobber the input buffer.
*/
lev = 0;
while (*ip) {
if (*ip == L_CURLY) lev++;
if (*ip == R_CURLY) {
if (lev == 0) {
ip++;
break;
}
else lev--;
}
*vp++ = *ip++; /* copy to variable buffer */
}
*vp = EOS;
/* vbuf now contains the variable name (stuff between curlys). */
if (lev != 0) {
fprintf(stderr, "Botched variable use: %s\n", in);
/* copy rest of string if we can't recover ?? */
return;
}
/* Now, expand variable. */
vp = vbuf;
/* See if this variable has a default [ format: ${varname def} ] */
def_val = vp;
while (*def_val && *def_val != ' ') def_val++;
if (*def_val) *def_val++ = EOS;
else def_val = 0;
/* def_val now points to default, if it exists, null if not. */
modifier = vp;
while (*modifier && *modifier != ':') modifier++;
if (*modifier) *modifier++ = EOS;
else modifier = 0;
/* modifier now points to modifier if it exists, null if not. */
s = 0;
/* if attribute of current elem with this name found, use value */
if (e && (atval = FindAttValByName(e, vp)))
s = atval;
else /* else try for (global) variable with this name */
s = FindMappingVal(Variables, vp);
if (!s) {
modifier = 0; /* assume user gave us the exact string */
s = def_val; /* may be null if no default value given */
}
/* If we found a value, copy it to the output buffer. */
if (s) {
if ( modifier && *modifier == 'l' ) {
while (*s) {
*op = tolower(*s);
op++, *s++;
}
} else
while (*s) *op++ = *s++;
}
}
*op++ = *ip++;
}
*op = EOS; /* terminate string */
}
/* ______________________________________________________________________ */
/* Call ProcesOutputSpec to expand parser variables then call the
* interpreter passing the resulting string.
* Arguments:
* Input buffer (string) to be expanded and passed.
* Pointer to element under consideration.
*/
void
CallInterpreter(
char *ib,
Element_t *e
)
{
int result;
char line[20];
int recursive;
/* save the value of this "e" to be used by Tcl_PrintLocation in
* the case of a user error
*/
tclE = e;
/* if there's something in the output buffer, we're recursing,
* just append, don't call the interpreter or clear the buffer
*/
recursive = OutputBufferActive();
ProcesOutputSpec(ib, e, 0, 1);
if (!recursive) {
result = Tcl_Eval(interpreter, GetOutputBuffer());
ClearOutputBuffer();
if (result != TCL_OK) {
static char errMessConst[] = "puts stderr $errorInfo";
char errMessVar[sizeof(errMessConst)];
fprintf(stderr, "Interpreter (internal to DtDocBook) error\n");
strcpy(errMessVar, errMessConst);
Tcl_Eval(interpreter, errMessVar);
exit(1);
}
}
}
/* ______________________________________________________________________ */
/* Process an "output" translation spec - one of StartText, EndText,
* Replace, Message (these are the ones that produce output), or
* StartCode and EndCode (these get passed to the interpreter).
* Steps done:
* Expand attributes and regular varaibles in input string.
* Pass thru string, accumulating chars to be sent to output stream.
* If we find the start of a special variable, output what we've
* accumulated, then find the special variable's "bounds" (ie, the
* stuff between the curly brackets), and expand that by passing to
* ExpandSpecialVar(). Continue until done the input string.
* Arguments:
* Input buffer (string) to be expanded and output.
* Pointer to element under consideration.
* FILE pointer to where to write output.
* Flag saying whether to track the character position we're on
* (passed to OutputString).
*/
void
ProcesOutputSpec(
char *ib,
Element_t *e,
FILE *fp,
int track_pos
)
{
char obuf[LINESIZE];
char vbuf[LINESIZE];
char *dest, vname[LINESIZE], *cp;
int esc;
obuf[0] = EOS; /* start with empty output buffer */
ExpandVariables(ib, vbuf, e); /* expand regular variables */
ib = vbuf;
dest = obuf;
esc = 0;
while (*ib) {
/* Is esc-$ next? If so, just copy the '$'. */
if (*ib == '\\' && ib[1] == VDELIM) {
ib++; /* skip esc */
*dest++ = *ib++; /* copy $ */
continue;
}
/* If not a $, it's a regular char. Just copy it and go to next. */
if (*ib != VDELIM) { /* look for att/variable marker */
*dest++ = *ib++; /* it's not. just copy character */
continue;
}
/* We have a $. What we have must be a "special variable" since
* regular variables have already been expanded, or just a lone $. */
if (ib[1] != L_CURLY) { /* just a stray dollar sign (no variable) */
*dest++ = *ib++;
continue;
}
ib++; /* point past $ */
/* Output what we have in buffer so far. */
*dest = EOS; /* terminate string */
if (obuf[0]) OutputString(obuf, fp, track_pos);
dest = obuf; /* ready for new stuff in buffer */
if (!strchr(ib, R_CURLY)) {
fprintf(stderr, "Mismatched braces in TranSpec: %s\n", ib);
/* how do we recover from this? */
}
ib++;
cp = vname;
while (*ib && *ib != R_CURLY) *cp++ = *ib++;
*cp = EOS; /* terminate att/var name */
ib++; /* point past closing curly */
/* we now have special variable name (stuff in curly {}'s) in vname */
/* if the special variable is _break and it's true, we're done */
if (ExpandSpecialVar(&vname[1], e, fp, track_pos) == CONT_BREAK) {
break;
}
}
*dest = EOS; /* terminate string in output buffer */
if (obuf[0]) OutputString(obuf, fp, track_pos);
}
/* ______________________________________________________________________ */
/* Find the translation spec for the given tag.
* Returns pointer to first spec that matches (name, depth, etc., of tag).
* Arguments:
* Pointer to element under consideration.
* Return:
* Pointer to translation spec that matches given element's context.
*/
Trans_t *
FindTrans(
Element_t *e
)
{
char context[LINESIZE], *cp, **vec, *atval;
int i, a, match;
Trans_t *t, *tt;
/* loop through all transpecs */
for (t=TrSpecs; t; t=t->next)
{
/* Only one of gi or gilist will be set. */
/* Check if elem name matches */
if (t->gi && !StrEq(t->gi, e->gi)) continue;
/* Match one in the list of GIs? */
if (t->gilist) {
for (match=0,vec=t->gilist; *vec; vec++) {
if (StrEq(*vec, e->gi)) {
match = 1;
break;
}
}
if (!match) continue;
}
/* Check context */
/* Special case of context */
if (t->parent)
if (!QRelation(e, t->parent, REL_Parent)) continue;
if (t->context) { /* no context specified -> a match */
FindContext(e, t->depth, context);
/* If reg expr set, do regex compare; else just string compare. */
if (t->context_re) {
if (! tpt_regexec(t->context_re, context)) continue;
}
else {
/* Is depth of spec deeper than element's depth? */
if (t->depth > e->depth) continue;
/* See if context of element matches "context" of transpec */
match = ( (t->context[0] == context[0]) &&
!strcmp(t->context, context) );
if (!match) continue;
}
}
/* Check attributes. Loop through list, comparing each. */
if (t->nattpairs) { /* no att specified -> a match */
for (match=1,a=0; a<t->nattpairs; a++) {
if (!(atval = FindAttValByName(e, t->attpair[a].name))) {
match = 0;
break;
}
if (!tpt_regexec(t->attpair[a].rex, atval)) match = 0;
}
if (!match) continue;
}
/* Check relationships: child, parent, ancestor, sib, ... */
if (t->relations) {
Mapping_t *r;
match = 1;
for (r=t->relations->maps,i=0; i<t->relations->n_used; i++) {
if (!CheckRelation(e, r[i].name, r[i].sval, 0, 0, RA_Current)) {
match = 0;
break;
}
}
if (!match) continue;
}
/* check this element's parent's attribute */
if (t->pattrset && e->parent) {
char *p, **tok;
i = 2;
match = 1;
tok = Split(t->pattrset, &i, S_STRDUP);
if ( i == 2 ) {
p = FindAttValByName(e->parent, tok[0]);
if ( !p || strcmp(p, tok[1]) )
match = 0;
} else {
if (!FindAttValByName(e->parent, t->pattrset))
match = 0;
}
free(tok[0]);
if (!match) continue;
}
/* check this element's "birth order" */
if (t->nth_child) {
/* First one is called "1" by the user. Internally called "0". */
i = t->nth_child;
if (i > 0) { /* positive # -- count from beginning */
if (e->my_eorder != (i-1)) continue;
}
else { /* negative # -- count from end */
i = e->parent->necont + i;
if (e->my_eorder != i) continue;
}
}
/* check that variables match */
if (t->var_name) {
cp = FindMappingVal(Variables, t->var_name);
if (!cp || strcmp(cp, t->var_value)) continue;
}
/* check content */
if (t->content) { /* no att specified -> a match */
for (match=0,i=0; i<e->ndcont; i++) {
if (tpt_regexec(t->content_re, e->dcont[i])) {
match = 1;
break;
}
}
if (!match) continue;
}
/* -------- at this point we've passed all criteria -------- */
/* See if we should be using another transpec's actions. */
if (t->use_id) {
if (t->use_id < 0) return &NullTrans; /* missing? */
/* see if we have a pointer to that transpec */
if (t->use_trans) return t->use_trans;
for (tt=TrSpecs; tt; tt=tt->next) {
if (t->use_id == tt->my_id) {
/* remember pointer for next time */
t->use_trans = tt;
return t->use_trans;
}
}
t->use_id = -1; /* flag it as missing */
fprintf(stderr, "Warning: transpec ID (%d) not found for %s.\n",
t->use_id, e->gi);
return &NullTrans;
}
return t;
}
/* At this point, we have not found a matching spec. See if there
* is a wildcard, and if so, use it. (Wildcard GI is named "*".) */
if ((t = FindTransByName("*"))) return t;
if (warnings)
fprintf(stderr, "Warning: transpec not found for %s\n", e->gi);
/* default spec - pass character data and descend node */
return &NullTrans;
}
/* ______________________________________________________________________ */
/* Find translation spec by (GI) name. Returns the first one that matches.
* Arguments:
* Pointer to name of transpec (the "gi" field of the Trans structure).
* Return:
* Pointer to translation spec that matches name.
*/
Trans_t *
FindTransByName(
char *s
)
{
Trans_t *t;
for (t=TrSpecs; t; t=t->next) {
/* check if tag name matches (first check 1st char, for efficiency) */
if (t->gi) {
if (*(t->gi) != *s) continue; /* check 1st character */
if (!strcmp(t->gi, s)) return t;
}
}
return NULL;
}
/* Find translation spec by its ID (SpecID).
* Arguments:
* Spec ID (an int).
* Return:
* Pointer to translation spec that matches name.
*/
Trans_t *
FindTranByID(int n)
{
Trans_t *t;
for (t=TrSpecs; t; t=t->next)
if (n == t->my_id) return t;
return NULL;
}
/* ______________________________________________________________________ */
/* Process a "chunk" of content data of an element.
* Arguments:
* Pointer to data content to process
* FILE pointer to where to write output.
*/
void
DoData(
char *data,
FILE *fp
)
{
char *cp, buf[LINESIZE], *dp, *sub, prev;
int i, mapped;
/* Worry about embedded newlines? */
if (!fp) return;
/* CLEANUP: this should really all be done in OutputString(). (I think) */
if (nCharMap) {
/* for each character, see if it's mapped to something else */
for (prev=0,cp=data,dp=buf; *cp; cp++) {
if (prev == '\\') {
*dp++ = *cp;
prev = *cp;
continue;
}
for (mapped=0,i=0; i<nCharMap; i++) {
if (*cp != CharMap[i].name[0]) continue;
sub = CharMap[i].sval;
while (*sub) *dp++ = *sub++;
mapped = 1;
break;
}
if (!mapped) *dp++ = *cp;
prev = *cp;
}
*dp = EOS;
dp = buf;
}
else dp = data;
OutputString(dp, fp, 1);
}
/* ______________________________________________________________________ */
/* Handle a processing instruction. This is done similarly to elements,
* where we find a transpec, then do what it says. Differences: PI names
* start with '_' in the spec file (if a GI does not start with '_', it
* may be forced to upper case, sgmls keeps PIs as mixed case); the args
* to the PI are treated as the data of an element.
* Arguments:
* Pointer to the PI.
* FILE pointer to where to write output.
*/
void
DoPI(
char *pi,
FILE *fp
)
{
char buf[250], **tok;
int n;
Trans_t *t;
buf[0] = '_';
strcpy(&buf[1], pi);
n = 2;
tok = Split(buf, &n, 0);
if ((t = FindTransByName(tok[0]))) {
if (t->replace) ProcesOutputSpec(t->replace, 0, fp, 1);
else {
if (t->starttext) ProcesOutputSpec(t->starttext, 0, fp, 1);
if (t->startcode) CallInterpreter(t->startcode, 0);
if (n > 1) OutputString(tok[1], fp, 1);
if (t->endcode) CallInterpreter(t->endcode, 0);
if (t->endtext) ProcesOutputSpec(t->endtext, 0, fp, 1);
}
if (t->message) ProcesOutputSpec(t->message, 0, stderr, 0);
}
else {
/* If not found, just print the PI in square brackets, along
* with a warning message. */
/* fprintf(fp, "[%s]", pi); don't clutter up the output -- steve */
if (warnings) fprintf(stderr, "Warning: Unrecognized PI: [%s]\n", pi);
}
}
/* ______________________________________________________________________ */
/* Set and increment variables, as appropriate, if the transpec says to.
* Arguments:
* Pointer to translation spec for current element.
*/
static void
set_and_increment(
Trans_t *t
)
{
Mapping_t *m;
int i, inc, n;
char *cp, buf[50];
/* set/reset variables */
if (t->set_var) {
for (m=t->set_var->maps,i=0; i<t->set_var->n_used; i++)
SetMappingNV(Variables, m[i].name, m[i].sval);
}
/* increment counters */
if (t->incr_var) {
for (m=t->incr_var->maps,i=0; i<t->incr_var->n_used; i++) {
cp = FindMappingVal(Variables, m[i].name);
/* if not set at all, set to 1 */
if (!cp) SetMappingNV(Variables, m[i].name, "1");
else {
if (isdigit(*cp) || (*cp == '-' && isdigit(cp[1]))) {
n = atoi(cp);
if (m[i].sval && isdigit(*m[i].sval)) inc = atoi(m[i].sval);
else inc = 1;
sprintf(buf, "%d", (n + inc));
SetMappingNV(Variables, m[i].name, buf);
}
}
}
}
}
/* ______________________________________________________________________ */
/* Translate one element.
* Arguments:
* Pointer to element under consideration.
* FILE pointer to where to write output.
* Pointer to translation spec for current element, or null.
*/
void
TransElement(
Element_t *e,
FILE *fp,
Trans_t *t
)
{
int i;
if (!t) t = ((e && e->trans) ? e->trans : &NullTrans);
/* see if we should quit. */
if (t->quit) {
fprintf(stderr, "Quitting at location:\n");
PrintLocation(e, fp);
fprintf(stderr, "%s\n", t->quit);
exit(1);
}
/* See if we want to replace subtree (do text, don't descend subtree) */
if (t->replace) {
ProcesOutputSpec(t->replace, e, fp, 1);
if (t->message) ProcesOutputSpec(t->message, e, stderr, 0);
set_and_increment(t); /* adjust variables, if appropriate */
return;
}
if (t->starttext) ProcesOutputSpec(t->starttext, e, fp, 1);
if (t->startcode) CallInterpreter(t->startcode, e);
if (t->message) ProcesOutputSpec(t->message, e, stderr, 0);
/* Process data for this node and descend child elements/nodes. */
if (t->ignore != IGN_ALL) {
/* Is there a "generated" node at the front of this one? */
if (e->gen_trans[0]) {
Trans_t *tp;
if ((tp = FindTranByID(e->gen_trans[0]))) {
if (tp->starttext) ProcesOutputSpec(tp->starttext, e, fp, 1);
if (tp->startcode) CallInterpreter(t->startcode, e);
if (tp->message) ProcesOutputSpec(tp->message, e, stderr, 0);
if (tp->endcode) CallInterpreter(t->endcode, e);
if (tp->endtext) ProcesOutputSpec(tp->endtext, e, fp, 1);
}
}
/* Loop thruthe "nodes", whether data, child element, or PI. */
for (i=0; i<e->ncont; i++) {
if (IsContElem(e,i)) {
if (t->ignore != IGN_CHILDREN) /* skip child nodes? */
TransElement(ContElem(e,i), fp, NULL);
}
else if (IsContData(e,i)) {
if (t->ignore != IGN_DATA) /* skip data nodes? */
DoData(ContData(e,i), fp);
}
else if (IsContPI(e,i))
DoPI(e->cont[i].ch.data, fp);
}
/* Is there a "generated" node at the end of this one? */
if (e->gen_trans[1]) {
Trans_t *tp;
if ((tp = FindTranByID(e->gen_trans[1]))) {
if (tp->starttext) ProcesOutputSpec(tp->starttext, e, fp, 1);
if (tp->startcode) CallInterpreter(t->startcode, e);
if (tp->message) ProcesOutputSpec(tp->message, e, stderr, 0);
if (tp->endcode) CallInterpreter(t->endcode, e);
if (tp->endtext) ProcesOutputSpec(tp->endtext, e, fp, 1);
}
}
}
set_and_increment(t); /* adjust variables, if appropriate */
if (t->endcode) CallInterpreter(t->endcode, e);
if (t->endtext) ProcesOutputSpec(t->endtext, e, fp, 1);
e->processed = 1;
}
/* ______________________________________________________________________ */
/* Check if element matches specified relationship, and, if it does, perform
* action on either current element or matching element (depends on flag).
* Arguments:
* Pointer to element under consideration.
* Pointer to relationship name.
* Pointer to related element name (GI).
* Pointer to action to take (string - turned into an int).
* FILE pointer to where to write output.
* Flag saying whether to do action on related element (RA_Related)
* or on current element (RA_Current).
* Return:
* Bool, saying whether (1) or not (0) relationship matches.
*/
int
CheckRelation(
Element_t *e,
char *relname, /* relationship name */
char *related, /* related element */
char *actname, /* action to take */
FILE *fp,
RelAction_t flag
)
{
Element_t *ep;
Relation_t r;
if ((r = FindRelByName(relname)) == REL_Unknown) return 0;
if (!(ep=QRelation(e, related, r))) return 0;
if (!actname) return 1; /* no action - return what we found */
switch (flag) {
case RA_Related: TranByAction(ep, atoi(actname), fp); break;
case RA_Current: TranByAction(e, atoi(actname), fp); break;
}
return 1;
}
/* ______________________________________________________________________ */
/* Perform action given by a SpecID on the given element.
* Arguments:
* Pointer to element under consideration.
* SpecID of action to perform.
* FILE pointer to where to write output.
*/
void
TranByAction(
Element_t *e,
int n,
FILE *fp
)
{
Trans_t *t;
t = FindTranByID(n);
if (!t) {
fprintf(stderr, "Could not find named action for %d.\n", n);
return;
}
TransElement(e, fp, t);
}
/* ______________________________________________________________________ */

View file

@ -0,0 +1,131 @@
/*
* Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
* All rights reserved.
*/
/*
* Copyright (c) 1994
* Open Software Foundation, Inc.
*
* Permission is hereby granted to use, copy, modify and freely distribute
* the software in this file and its documentation for any purpose without
* fee, provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation. Further, provided that the name of Open
* Software Foundation, Inc. ("OSF") not be used in advertising or
* publicity pertaining to distribution of the software without prior
* written permission from OSF. OSF makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* ________________________________________________________________________
*
* Program to manipulate SGML instances.
*
* These are data definitions for the "translating" portion of the program.
*
* ________________________________________________________________________
*/
#ifdef STORAGE
#ifndef lint
static char *tr_h_RCSid =
"$XConsortium: translate.h /main/3 1996/06/19 17:13:31 drk $";
#endif
#endif
#define L_CURLY '{'
#define R_CURLY '}'
/* things to ignore when processing an element */
#define IGN_NONE 0
#define IGN_ALL 1
#define IGN_DATA 2
#define IGN_CHILDREN 3
/* for CheckRelation() */
typedef enum { RA_Current, RA_Related } RelAction_t;
/* for ExpandSpecialVar() */
typedef enum { CONT_CONTINUE, CONT_BREAK } ContParse_t;
typedef struct {
char *name; /* attribute name string */
char *val; /* attribute value string */
regexp *rex; /* attribute value reg expr (compiled) */
} AttPair_t;
typedef struct _Trans {
/* criteria */
char *gi; /* element name of tag under consideration */
char **gilist; /* list of element names (multiple gi's) */
char *context; /* context in tree - looking depth levels up */
regexp *context_re; /* tree heirarchy looking depth levels up */
int depth; /* number of levels to look up the tree */
AttPair_t *attpair; /* attr name-value pairs */
int nattpairs; /* number of name-value pairs */
char *parent; /* GI has this element as parent */
int nth_child; /* GI is Nth child of this of parent element */
char *content; /* element has this string in content */
regexp *content_re; /* content reg expr (compiled) */
char *pattrset; /* is this attr set (any value) in parent? */
char *var_name; /* variable name */
char *var_value; /* variable value */
Map_t *relations; /* various relations to check */
/* actions */
char *starttext; /* string to output at the start tag */
char *startcode; /* Tcl code to execute at the start tag */
char *endtext; /* string to output at the end tag */
char *endcode; /* Tcl code to execute at the end tag */
char *replace; /* string to replace this subtree with */
char *message; /* message for stderr, if element encountered */
int ignore; /* flag - ignore content or data of element? */
char *var_reset;
char *increment; /* increment these variables */
Map_t *set_var; /* set these variables */
Map_t *incr_var; /* increment these variables */
char *quit; /* print message and exit */
/* pointers and bookkeeping */
int my_id; /* unique (hopefully) ID of this transpec */
int use_id; /* use transpec whose ID is this */
struct _Trans *use_trans; /* pointer to other transpec */
struct _Trans *next; /* linked list */
int lineno; /* line number of end of transpec */
} Trans_t;
#ifdef def
#undef def
#endif
#ifdef STORAGE
# define def
#else
# define def extern
#endif
def Trans_t *TrSpecs;
def Mapping_t *CharMap;
def int nCharMap;
/* prototypes for things defined in translate.c */
int CheckRelation(Element_t *, char *, char *, char *, FILE*, RelAction_t);
Trans_t *FindTrans(Element_t *);
Trans_t *FindTransByName(char *);
Trans_t *FindTransByID(int);
void PrepTranspecs(Element_t *);
void ProcessOneSpec(char *, Element_t *, FILE *, int);
void TransElement(Element_t *, FILE *, Trans_t *);
void TranByAction(Element_t *, int, FILE *);
/* prototypes for things defined in tranvar.c */
ContParse_t ExpandSpecialVar(char *, Element_t *, FILE *, int);
/* prototypes for things defined in tables.c */
void OSFtable(Element_t *, FILE *, char **, int);
/* prototypes for things defines in util.c */
void ClearOutputBuffer();
char *GetOutputBuffer();
int OutputBufferActive();
/* ______________________________________________________________________ */

View file

@ -0,0 +1,780 @@
/*
* Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
* All rights reserved.
*/
/*
* Copyright (c) 1994
* Open Software Foundation, Inc.
*
* Permission is hereby granted to use, copy, modify and freely distribute
* the software in this file and its documentation for any purpose without
* fee, provided that the above copyright notice appears in all copies and
* that both the copyright notice and this permission notice appear in
* supporting documentation. Further, provided that the name of Open
* Software Foundation, Inc. ("OSF") not be used in advertising or
* publicity pertaining to distribution of the software without prior
* written permission from OSF. OSF makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* ________________________________________________________________________
*
* instant - a program to manipulate SGML instances.
*
* This module is for handling "special variables". These act a lot like
* procedure calls
* ________________________________________________________________________
*/
#ifndef lint
static char *RCSid =
"$XConsortium: tranvar.c /main/7 1996/08/08 14:42:09 cde-hp $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <memory.h>
#include <sys/types.h>
#include <errno.h>
#include <tptregexp.h>
#include "general.h"
#include "translate.h"
static char **idrefs; /* list of IDREF att names to follow */
static char *def_idrefs[] = { "LINKEND", "LINKENDS", "IDREF", 0 };
/* forward references */
void ChaseIDRefs(Element_t *, char *, int, FILE *);
void Find(Element_t *, int, char **, FILE *);
void GetIDREFnames();
static void OutputCDATA(Content_t *cp, void *client_data);
typedef struct _cdata_info {
int track_pos;
FILE *fp;
} OutputCDATA_info_t;
/* ______________________________________________________________________ */
/* Handle "special" variable - read file, run command, do action, etc.
* Arguments:
* Name of special variable to expand.
* Pointer to element under consideration.
* FILE pointer to where to write output.
* Flag saying whether to track the character position we're on
* (passed to OutputString).
*/
ContParse_t
ExpandSpecialVar(
char *name,
Element_t *e,
FILE *fp,
int track_pos
)
{
FILE *infile;
char buf[LINESIZE], tempbuf[LINESIZE], *cp, *atval, letter;
char **tok;
int ntok, n, i, action, action1, number;
Element_t *ep;
Trans_t *t, *tt;
static char *s_A, *s_C;
/* Run a command.
* Format: _! command args ... */
if (*name == '!') {
name++;
if ((infile = popen(name, "r"))) {
while (fgets(buf, LINESIZE, infile)) FPuts(buf, fp);
pclose(infile);
FFlush(fp);
}
else {
fprintf(stderr, "Could not start program '%s': %s",
name, strerror(errno));
}
return CONT_CONTINUE;
}
/* See if caller wants one of the tokens from _eachatt or _eachcon.
* If so, output it and return. (Yes, I admit that this is a hack.)
*/
if (*name == 'A' && name[1] == EOS && s_A) {
OutputString(s_A, fp, track_pos);
return CONT_CONTINUE;
}
if (*name == 'C' && name[1] == EOS && s_C) {
OutputString(s_C, fp, track_pos);
return CONT_CONTINUE;
}
ntok = 0;
tok = Split(name, &ntok, 0);
/* Include another file.
* Format: _include filename */
if (StrEq(tok[0], "include")) {
name = tok[1];
if (ntok > 1 ) {
if ((infile=OpenFile(name)) == NULL) {
sprintf(buf, "Can not open included file '%s'", name);
perror(buf);
return CONT_CONTINUE;
}
while (fgets(buf, LINESIZE, infile)) FPuts(buf, fp);
fclose(infile);
}
else fprintf(stderr, "No file name specified for include\n");
return CONT_CONTINUE;
}
/* Print location (nearest title, line no, path).
* Format: _location */
else if (StrEq(tok[0], "location")) {
PrintLocation(e, fp);
}
/* Print path to this element.
* Format: _path */
else if (StrEq(tok[0], "path")) {
(void)FindElementPath(e, buf);
OutputString(buf, fp, track_pos);
}
/* Print name of this element (gi).
* Format: _gi [M|L|U] */
else if (StrEq(tok[0], "gi")) {
strcpy(buf, e->gi);
if (ntok >= 2) {
if (*tok[1] == 'L' || *tok[1] == 'l' ||
*tok[1] == 'M' || *tok[1] == 'm') {
for (cp=buf; *cp; cp++)
if (isupper(*cp)) *cp = tolower(*cp);
}
if (*tok[1] == 'M' || *tok[1] == 'm')
if (islower(buf[0])) buf[0] = toupper(buf[0]);
}
OutputString(buf, fp, track_pos);
}
/* Print name of the parent of this element (parent).
* If a parent number is given, go that far up the parent tree
* (e.g., "_parent 1 U" returns the parent in upper case
* "_parent 2 L" returns the grandparent in lower case
* "_parent 0" is equivalent to "_gi"
* "_parent" is equivalent to "_parent 1")
* Format: _parent [<number>] [M|L|U] */
else if (StrEq(tok[0], "parent")) {
number = 1;
letter = 'U';
if (ntok >= 2) {
if (isdigit(*tok[1])) {
number = atoi(tok[1]);
if (ntok >= 3) {
letter = *tok[2];
}
} else {
letter = *tok[1];
}
}
ep = e;
while (--number >= 0) {
if (ep) ep = ep->parent;
}
if (ep) {
strcpy(buf, ep->gi);
} else {
*buf = 0;
}
if (letter == 'L' || letter == 'l' ||
letter == 'M' || letter == 'm') {
for (cp=buf; *cp; cp++)
if (isupper(*cp)) *cp = tolower(*cp);
}
if (letter == 'M' || letter == 'm')
if (islower(buf[0])) buf[0] = toupper(buf[0]);
OutputString(buf, fp, track_pos);
}
/* Print filename of this element's associated external entity.
* Format: _filename */
else if (StrEq(tok[0], "filename")) {
if (!e->entity) {
fprintf(stderr, "Expected ext entity (internal error? bug?):\n");
PrintLocation(e, stderr);
return CONT_CONTINUE;
}
if (!e->entity->fname) {
fprintf(stderr, "Expected filename ");
if (e->entity->sysid) {
fprintf(stderr,
"(could not find \"%s\"):\n",
e->entity->sysid);
} else if (e->entity->pubid) {
fprintf(stderr,
"(could not resolve \"%s\"):\n",
e->entity->pubid);
} else {
fprintf(stderr, "(internal error? bug?):\n");
}
PrintLocation(e, stderr);
return CONT_CONTINUE;
}
OutputString(e->entity->fname, fp, track_pos);
}
/* Value of parent's attribute, by attr name.
* Format: _pattr attname */
else if (StrEq(tok[0], "pattr")) {
ep = e->parent;
if (!ep) {
fprintf(stderr, "Element does not have a parent:\n");
PrintLocation(ep, stderr);
return CONT_CONTINUE;
}
if ((atval = FindAttValByName(ep, tok[1]))) {
OutputString(atval, fp, track_pos);
}
}
/* Use an action, given transpec's SID.
* Format: _action action */
else if (StrEq(tok[0], "action")) {
action = atoi(tok[1]);
if (action) TranByAction(e, action, fp);
}
/* Number of child elements of this element.
* Format: _nchild */
else if (StrEq(tok[0], "nchild")) {
if (ntok > 1) {
for (n=0,i=0; i<e->necont; i++)
if (StrEq(e->econt[i]->gi, tok[1])) n++;
}
else n = e->necont;
sprintf(buf, "%d", n);
OutputString(buf, fp, track_pos);
}
/* number of 1st child's child elements (grandchildren from first child).
* Format: _n1gchild */
else if (StrEq(tok[0], "n1gchild")) {
if (e->necont) {
sprintf(buf, "%d", e->econt[0]->necont);
OutputString(buf, fp, track_pos);
}
}
/* Chase this element's pointers until we hit the named GI.
* Do the action if it matches.
* Format: _chasetogi gi action */
else if (StrEq(tok[0], "chasetogi")) {
if (ntok < 3) {
fprintf(stderr, "Error: Not enough args for _chasetogi.\n");
return CONT_CONTINUE;
}
action = atoi(tok[2]);
if (action) ChaseIDRefs(e, tok[1], action, fp);
}
/* Follow link to element pointed to, then do action.
* Format: _followlink [attname] action. */
else if (StrEq(tok[0], "followlink")) {
char **s;
if (ntok > 2) {
action = atoi(tok[2]);
if ((atval = FindAttValByName(e, tok[1]))) {
if ((ep = FindElemByID(atval))) {
TranByAction(ep, action, fp);
return CONT_CONTINUE;
}
}
else fprintf(stderr, "Error: Did not find attr: %s.\n", tok[1]);
return CONT_CONTINUE;
}
else action = atoi(tok[1]);
GetIDREFnames();
for (s=idrefs; *s; s++) {
/* is this IDREF attr set? */
if ((atval = FindAttValByName(e, *s))) {
ntok = 0;
tok = Split(atval, &ntok, S_STRDUP);
/* we'll follow the first one... */
if ((ep = FindElemByID(tok[0]))) {
TranByAction(ep, action, fp);
return CONT_CONTINUE;
}
else fprintf(stderr, "Error: Can not find elem for ID: %s.\n",
tok[0]);
}
}
fprintf(stderr, "Error: Element does not have IDREF attribute set:\n");
PrintLocation(e, stderr);
return CONT_CONTINUE;
}
/* Starting at this element, decend tree (in-order), finding GI.
* Do the action if it matches.
* Format: _find args ... */
else if (StrEq(tok[0], "find")) {
Find(e, ntok, tok, fp);
}
/* Starting at this element's parent, decend tree (in-order), finding GI.
* Do the action if it matches.
* Format: _pfind args ... */
else if (StrEq(tok[0], "pfind")) {
Find(e->parent ? e->parent : e, ntok, tok, fp);
}
/* Content is supposed to be a list of IDREFs. Follow each, doing action.
* If 2 actions are specified, use 1st for the 1st ID, 2nd for the rest.
* Format: _namelist action [action2] */
else if (StrEq(tok[0], "namelist")) {
int id;
action1 = atoi(tok[1]);
if (ntok > 2) action = atoi(tok[2]);
else action = action1;
for (i=0; i<e->ndcont; i++) {
n = 0;
tok = Split(e->dcont[i], &n, S_STRDUP);
for (id=0; id<n; id++) {
if (fold_case)
for (cp=tok[id]; *cp; cp++)
if (islower(*cp)) *cp = toupper(*cp);
if ((e = FindElemByID(tok[id]))) {
if (id) TranByAction(e, action, fp);
else TranByAction(e, action1, fp); /* first one */
}
else fprintf(stderr, "Error: Can not find ID: %s.\n", tok[id]);
}
}
}
/* For each word in the element's content, do action.
* Format: _eachcon action [action] */
else if (StrEq(tok[0], "eachcon")) {
int id;
action1 = atoi(tok[1]);
if (ntok > 3) action = atoi(tok[2]);
else action = action1;
for (i=0; i<e->ndcont; i++) {
n = 0;
tok = Split(e->dcont[i], &n, S_STRDUP|S_ALVEC);
for (id=0; id<n; id++) {
s_C = tok[id];
TranByAction(e, action, fp);
}
free(*tok);
}
}
/* For each word in the given attribute's value, do action.
* Format: _eachatt attname action [action] */
else if (StrEq(tok[0], "eachatt")) {
int id;
action1 = atoi(tok[2]);
if (ntok > 3) action = atoi(tok[3]);
else action = action1;
if ((atval = FindAttValByName(e, tok[1]))) {
n = 0;
tok = Split(atval, &n, S_STRDUP|S_ALVEC);
for (id=0; id<n; id++) {
s_A = tok[id];
if (id) TranByAction(e, action, fp);
else TranByAction(e, action1, fp); /* first one */
}
free(*tok);
}
}
/* Do action on this element if element has [relationship] with gi.
* Format: _relation relationship gi action [action] */
else if (StrEq(tok[0], "relation")) {
if (ntok >= 4) {
if (!CheckRelation(e, tok[1], tok[2], tok[3], fp, RA_Current)) {
/* action not done, see if alt action specified */
if (ntok >= 5)
TranByAction(e, atoi(tok[4]), fp);
}
}
}
/* Do action on followed element if element has [relationship] with gi.
* Format: _followrel relationship gi action */
else if (StrEq(tok[0], "followrel")) {
if (ntok >= 4)
(void)CheckRelation(e, tok[1], tok[2], tok[3], fp, RA_Related);
}
/* Find element with matching ID and do action. If action not specified,
* choose the right one appropriate for its context.
* Format: _id id [action] */
else if (StrEq(tok[0], "id")) {
if (ntok > 2) action = atoi(tok[2]);
else action = 0;
if ((ep = FindElemByID(tok[1]))) {
if (action) TranByAction(ep, action, fp);
else {
t = FindTrans(ep);
TransElement(ep, fp, t);
}
}
}
/* Set variable to value.
* Format: _set name value */
else if (StrEq(tok[0], "set")) {
SetMappingNV(Variables, tok[1], tok[2]);
}
/* Do action if variable is set, optionally to value.
* If not set, do nothing.
* Format: _isset varname [value] action */
else if (StrEq(tok[0], "isset")) {
if ((cp = FindMappingVal(Variables, tok[1]))) {
if (ntok == 3) TranByAction(e, atoi(tok[2]), fp);
else if (ntok > 3 && !strcmp(cp, tok[2]))
TranByAction(e, atoi(tok[3]), fp);
}
}
/* If variable is unset or not set to optional value, return an
* indication that the parsing of this specification should
* continue; otherwise, return an indication that the parse should
* quit. */
else if (StrEq(tok[0], "break")) {
if ((cp = FindMappingVal(Variables, tok[1]))) {
if ((ntok <= 2) || (strcmp(cp, tok[2]) == 0)) return CONT_BREAK;
}
return CONT_CONTINUE;
}
/* Insert a node into the tree at start/end, pointing to action to perform.
* Format: _insertnode S|E action */
else if (StrEq(tok[0], "insertnode")) {
action = atoi(tok[2]);
if (*tok[1] == 'S') e->gen_trans[0] = action;
else if (*tok[1] == 'E') e->gen_trans[1] = action;
}
/* Do an OSF DTD table spec for TeX or troff. Looks through attributes
* and determines what to output. "check" means to check consistency,
* and print error messages.
* This is (hopefully) the only hard-coded part of the program.
* Format: _osftable [tex|roff|check] [cell|top|bottom|rowend] */
else if (StrEq(tok[0], "osftable")) {
OSFtable(e, fp, tok, ntok);
}
/* Do action if element's attr is set, optionally to value.
* If not set, do nothing.
* Format: _attval att [value] action */
else if (StrEq(tok[0], "attval")) {
if ((atval = FindAttValByName(e, tok[1]))) {
if (ntok == 3) TranByAction(e, atoi(tok[2]), fp);
else if (ntok > 3 && !strcmp(atval, tok[2]))
TranByAction(e, atoi(tok[3]), fp);
}
}
/* Same thing, but look at parent */
else if (StrEq(tok[0], "pattval")) {
if ((atval = FindAttValByName(e->parent, tok[1]))) {
if (ntok == 3) {
TranByAction(e, atoi(tok[2]), fp);
}
if (ntok > 3 && !strcmp(atval, tok[2]))
TranByAction(e, atoi(tok[3]), fp);
}
}
/* Print each attribute and value for the current element, hopefully
* in a legal sgml form: <elem-name att1="value1" att2="value2:> .
* Format: _allatts */
else if (StrEq(tok[0], "allatts")) {
for (i=0; i<e->natts; i++) {
if (i != 0) Putc(' ', fp);
FPuts(e->atts[i].name, fp);
FPuts("=\"", fp);
FPuts(e->atts[i].sval, fp);
Putc('"', fp);
}
}
/* Print the element's input filename, and optionally, the line number.
* Format: _infile [line] */
else if (StrEq(tok[0], "infile")) {
if (e->infile) {
if (ntok > 1 && !strcmp(tok[1], "root")) {
strcpy(buf, e->infile);
if ((cp = strrchr(buf, '.'))) *cp = EOS;
FPuts(buf, fp);
}
else {
FPuts(e->infile, fp);
if (ntok > 1 && !strcmp(tok[1], "line"))
{
sprintf(tempbuf, " %d", e->lineno);
FPuts(tempbuf, fp);
}
}
return CONT_CONTINUE;
}
else FPuts("input-file??", fp);
}
/* Get value of an environement variable */
else if (StrEq(tok[0], "env")) {
if (ntok > 1 && (cp = getenv(tok[1]))) {
OutputString(cp, fp, track_pos);
}
}
/* Get the cdata content of the node (and descendents) */
else if (StrEq(tok[0], "cdata")) {
OutputCDATA_info_t client_data;
client_data.track_pos = track_pos;
client_data.fp = fp;
DescendTree(e, 0, 0, OutputCDATA, (void *) &client_data);
}
/* Something unknown */
else {
fprintf(stderr, "Unknown special variable: %s\n", tok[0]);
tt = e->trans;
if (tt && tt->lineno)
fprintf(stderr, "Used in transpec, line %d\n", tt->lineno);
}
return CONT_CONTINUE;
}
/* ______________________________________________________________________ */
/* A routine to pass to DescendTree(). This routine will be called
* on each data node in the tree from the current element (e) down -
* putting any cdata on the output stream.
* Arguments:
* Pointer to content of the node
* Client data - holds fp and track_pos from ExpandSpecialVariable()
*/
static void
OutputCDATA(Content_t *cp, void *client_data)
{
OutputCDATA_info_t *pInfo = (OutputCDATA_info_t *) client_data;
if (cp->type == CMD_DATA)
OutputString(cp->ch.data, pInfo->fp, pInfo->track_pos);
}
/* ______________________________________________________________________ */
/* Chase IDs until we find an element whose GI matches. We also check
* child element names, not just the names of elements directly pointed
* at (by IDREF attributes).
*/
void
GetIDREFnames()
{
char *cp;
if (!idrefs) {
/* did user or transpec set the variable */
if ((cp = FindMappingVal(Variables, "link_atts")))
idrefs = Split(cp, 0, S_STRDUP|S_ALVEC);
else
idrefs = def_idrefs;
}
}
/* ______________________________________________________________________ */
/* Chase ID references - follow IDREF(s) attributes until we find
* a GI named 'gi', then perform given action on that GI.
* Arguments:
* Pointer to element under consideration.
* Name of GI we're looking for.
* Spec ID of action to take.
* FILE pointer to where to write output.
*/
void
ChaseIDRefs(
Element_t *e,
char *gi,
int action,
FILE *fp
)
{
int ntok, i, ei;
char **tok, **s, *atval;
/* First, see if we got what we came for with this element */
if (StrEq(e->gi, gi)) {
TranByAction(e, action, fp);
return;
}
GetIDREFnames();
/* loop for each attribute of type IDREF(s) */
for (s=idrefs; *s; s++) {
/* is this IDREF attr set? */
if ((atval = FindAttValByName(e, *s))) {
ntok = 0;
tok = Split(atval, &ntok, 0);
for (i=0; i<ntok; i++) {
/* get element pointed to */
if ((e = FindElemByID(tok[i]))) {
/* OK, we found a matching GI name */
if (StrEq(e->gi, gi)) {
/* process using named action */
TranByAction(e, action, fp);
return;
}
else {
/* this elem itself did not match, try its children */
for (ei=0; ei<e->necont; ei++) {
if (StrEq(e->econt[ei]->gi, gi)) {
TranByAction(e->econt[ei], action, fp);
return;
}
}
/* try this elem's IDREF attributes */
ChaseIDRefs(e, gi, action, fp);
return;
}
}
else {
/* should not happen, since parser checks ID/IDREFs */
fprintf(stderr, "Error: Could not find ID %s\n", atval);
return;
}
}
}
}
/* if the pointers didn't lead to the GI, give error */
if (!s)
fprintf(stderr, "Error: Could not find '%s'\n", gi);
}
/* ______________________________________________________________________ */
/* state to pass to recursive routines - so we don't have to use
* global variables. */
typedef struct {
char *gi;
char *gi2;
int action;
Element_t *elem;
FILE *fp;
} Descent_t;
static void
tr_find_gi(
Element_t *e,
Descent_t *ds
)
{
if (StrEq(ds->gi, e->gi))
if (ds->action) TranByAction(e, ds->action, ds->fp);
}
static void
tr_find_gipar(
Element_t *e,
Descent_t *ds
)
{
if (StrEq(ds->gi, e->gi) && e->parent &&
StrEq(ds->gi2, e->parent->gi))
if (ds->action) TranByAction(e, ds->action, ds->fp);
}
static void
tr_find_attr(
Element_t *e,
Descent_t *ds
)
{
char *atval;
if ((atval = FindAttValByName(e, ds->gi)) && StrEq(ds->gi2, atval))
TranByAction(e, ds->action, ds->fp);
}
static void
tr_find_parent(
Element_t *e,
Descent_t *ds
)
{
if (QRelation(e, ds->gi, REL_Parent)) {
if (ds->action) TranByAction(e, ds->action, ds->fp);
}
}
/* ______________________________________________________________________ */
/* Descend tree, finding elements that match criteria, then perform
* given action.
* Arguments:
* Pointer to element under consideration.
* Number of tokens in special variable.
* Vector of tokens in special variable (eg, "find" "gi" "TITLE")
* FILE pointer to where to write output.
*/
void
Find(
Element_t *e,
int ac,
char **av,
FILE *fp
)
{
Descent_t DS; /* state passed to recursive routine */
memset(&DS, 0, sizeof(Descent_t));
DS.elem = e;
DS.fp = fp;
/* see if we should start at the top of instance tree */
if (StrEq(av[1], "top")) {
av++;
ac--;
e = DocTree;
}
if (ac < 4) {
fprintf(stderr, "Bad '_find' specification - missing args.\n");
return;
}
/* Find elem whose GI is av[2] */
if (StrEq(av[1], "gi")) {
DS.gi = av[2];
DS.action = atoi(av[3]);
DescendTree(e, tr_find_gi, 0, 0, &DS);
}
/* Find elem whose GI is av[2] and whose parent GI is av[3] */
else if (StrEq(av[1], "gi-parent")) {
DS.gi = av[2];
DS.gi2 = av[3];
DS.action = atoi(av[4]);
DescendTree(e, tr_find_gipar, 0, 0, &DS);
}
/* Find elem whose parent GI is av[2] */
else if (StrEq(av[0], "parent")) {
DS.gi = av[2];
DS.action = atoi(av[3]);
DescendTree(e, tr_find_parent, 0, 0, &DS);
}
/* Find elem whose attribute av[2] has value av[3] */
else if (StrEq(av[0], "attr")) {
DS.gi = av[2];
DS.gi2 = av[3];
DS.action = atoi(av[4]);
DescendTree(e, tr_find_attr, 0, 0, &DS);
}
}
/* ______________________________________________________________________ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,10 @@
XCOMM $XConsortium: Imakefile /main/1 1996/02/27 18:28:20 lehors $
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
SUBDIRS = tptregexp
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
LintSubdirs($(LINTSUBDIRS))

View file

@ -0,0 +1,876 @@
# Copyright (c) 1993 Open Software Foundation, Inc.
# All rights reserved.
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# ______________________________________________________________________
#
# book (and refpage) to HTML
#
# $XConsortium: book-html.ts /main/2 1996/07/18 14:21:17 drk $
# ______________________________________________________________________
#
Var: Auth Open Software Foundation
Var: part 1
Var: chap 1
Var: sect 1
Var: subsect 1
Var: app 1
# ______________________________________________________________________
GI: TITLE
Context: DISPLAY
Relation: sibling TABLE
StartText: ^<P><B>
EndText: </B>^\n
-
GI: DISPLAY
Relation: child TABLE
StartText: ^<BLOCKQUOTE>^${_attval ID 76}^
EndText: ^${_attval ID 77}</BLOCKQUOTE>^
-
GI: DISPLAY
AttValue: WRAP NOWRAP
StartText: ^\n<BLOCKQUOTE>^<PRE>^${_attval ID 76}^
EndText: ^</PRE>^${_attval ID 77}</BLOCKQUOTE>^\n
-
GI: TITLE
Context: DISPLAY
Relation: sibling GRAPHIC
StartText: ^<P><B>
EndText: </B>^\n
-
# default display
GI: DISPLAY
StartText: ^<!-- start of display -->^<BLOCKQUOTE>^${_attval ID 76}^
EndText: ^${_attval ID 77}</BLOCKQUOTE>^<!-- end of display -->^\n
-
GI: TITLE
Context: DISPLAY
StartText: ^
EndText: ^
-
GI: TEXT-AS-FIGURE
StartText: ^\n<PRE>^
EndText: ^</PRE>^\n
-
# ______________________________________________________________________
GI: PROGLANG-SYNOPSIS
StartText: ^\n<P>
EndText: ^\n
-
GI: INCLUDE
StartText: ^
EndText: ^
-
# GI: DATA-DECLARATION
# StartText: ^
# EndText: ^
#-
GI: DATA-DECLARATION
Message: \nDATA-DECLARATION element not supported\n
-
GI: FILE-SYNOPSIS
StartText: ^\n<P>
EndText: ^\n
-
GI: CMD-SYNOPSIS
StartText: ^\n<P>
EndText: ^\n
-
# GI: CMD-ARGUMENT
# StartText: \s
# EndText: \s
# -
GI: CMD-ARGUMENT
Message: \nCMD-ARGUMENT element no longer supported\n
-
# ______________________________________________________________________
GI: LITERAL COMMAND FUNCTION FILE DIRECTORY DATATYPE E-MAIL OPTION-NAME
StartText: <B>
EndText: </B>
-
GI: VARIABLE
StartText: <VAR>
EndText: </VAR>
-
GI: EMPHASIS
StartText: <EM>
EndText: </EM>
-
GI: SUBSCRIPT
StartText: subscript(
EndText: )
-
GI: SUPERSCRIPT
StartText: superscript(
EndText: )
-
GI: TRADEMARK
StartText: <B>
EndText: </B>
-
GI: PERSON PLACE HONORIFIC DATE TIME TELEPHONE NUMBER ACRONYM
-
GI: KEYBOARD-INPUT
StartText: <KBD>
EndText: </KBD>
-
GI: COMPUTER-OUTPUT
Relation: ancestor DISPLAY
StartText: ^<LISTING>^
EndText: ^</LISTING>^
-
GI: COMPUTER-OUTPUT
StartText: <SAMP>
EndText: </SAMP>
-
GI: KEYBOARD-KEY
StartText: <TT>&lt;
EndText: &gt;</TT>
-
GI: INPUT-INSTRUCT
StartText: <I>
EndText: </I>
-
GI: GUI-TEXT
StartText: <B>
EndText: </B>
-
GI: FOREIGN-PHRASE
StartText: <EM>
EndText: </EM>
-
GI: LOGICAL-NEGATION
StartText: ^.ul 1^
EndText: ^
-
GI: MISC-DATA
-
GI: MARKUP
AttValue: LANG sgml
AttValue: CATEGORY elem.*
StartText: <B>&lt;
EndText: &gt;</B>
-
GI: MARKUP
AttValue: CATEGORY (attr|entity)
StartText: <B>
EndText: </B>
-
GI: MARKUP
StartText: <B>&lt;
EndText: &gt;</B>
-
GI: SPECIAL-FORMAT
AttValue: SMALLCAPS SMALLCAPS
StartText: [
EndText: ]
-
GI: SPECIAL-FORMAT
AttValue: HORIZKEEP NOBREAK
StartText: ^.DS^
EndText: ^.DE^
-
# a bit if a hack
GI: SPECIAL-FORMAT
AttValue: STYLE .
StartText: [\\${STYLE}\s
EndText: ]
-
GI: EXCERPT
StartText: ^<BLOCKQUOTE>
EndText: </BLOCKQUOTE>^
-
GI: QUOTE
StartText: ``
StartText: ''
-
# ______________________________________________________________________
GI: P
Context: ITEM
StartText: ^
EndText: ^
-
# label/item for labeled list
GI: LABEL
StartText: ^<DT>
EndText: ^
-
GI: ITEM
Context: L-ITEM
StartText: ^<DD>
EndText: ^
-
# item for general list
GI: ITEM
StartText: ^<LI>
EndText: ^
-
GI: LIST
Relation: child L-ITEM
StartText: ^<DL>^
EndText: ^</DL>^
-
GI: LIST
Relation: child ITEM
AttValue: TYPE UNORDERED
StartText: ^<UL>^
EndText: ^</UL>^
-
GI: LIST
Relation: child ITEM
AttValue: TYPE ORDERED
StartText: ^<OL>^
EndText: ^</OL>^
-
# default general list
GI: LIST
Relation: child ITEM
StartText: ^<UL>^
EndText: ^</UL>^
-
# procedure list
GI: LIST
Relation: child PROCEDURE-STEP
StartText: ^<UL>^
EndText: ^.LE^
-
GI: PROCEDURE-STEP
StartText: ^<LI>
EndText: ^
-
# note list
GI: LIST
Relation: child NOTE
StartText: ^
EndText: ^
-
# hack?? I have not tried this yet.
GI: BRIDGE-P
StartText: ^.P^
EndText: ^
-
GI: L-ITEM
EndText: ^
-
# ______________________________________________________________________
GI: ROW
StartText: ^
EndText: ^
-
GI: TITLE-ROW
StartText: ^
EndText: ^
-
GI: CELL
Context: TITLE-ROW
Relation: sibling+ CELL
#StartText:
EndText: \ |\s
-
GI: CELL
Context: TITLE-ROW
#StartText:
#EndText:
-
GI: CELL
Relation: sibling+ CELL
#StartText:
EndText: \ |\s
-
GI: CELL
#StartText:
#EndText:
-
# if you want a table title/caption, put it in a display
GI: TABLE
StartText: ^\n<!-- Table -->^<PRE>^
Table Markup omitted.
EndText: ^</PRE>^\n
Ignore: all
-
# ______________________________________________________________________
GI: NOTE
Relation: child TITLE
StartText: ^<BLOCKQUOTE>^
EndText: ^</BLOCKQUOTE>^
-
GI: NOTE
StartText: ^<BLOCKQUOTE>^<B>Note</B>^
EndText: ^</BLOCKQUOTE>^
-
GI: TITLE
Context: NOTE
StartText: ^<B>
EndText: </B>^
-
GI: ANNOTATION
StartText: ^<BLOCKQUOTE>^<B>Annotation</B>^
EndText: ^</BLOCKQUOTE>^
-
GI: FOOTNOTE
StartText: ^<BLOCKQUOTE>^<B>Footnote</B>^
EndText: ^</BLOCKQUOTE>^
-
GI: NOTEREF
-
# ______________________________________________________________________
GI: _
SpecID: 98
-
GI: REF-NAME
Relation: ancestor BODY
StartText: <H2>Name</H2>^<P>
EndText: \ --\s
SpecID: 19
-
GI: REF-NAME
Relation: ancestor SUPPLEMENTS
Action: 19
-
GI: REF-NAME
StartText: ^<TITLE>
EndText: </TITLE>^\n<H2>Name</H2>^<P>${_action 98} --\s
#EndText: " ${_pattr CATEGORY}^.SH "Name"^${_action 98} --\s
-
GI: REF-PURPOSE
#StartText:
EndText: ^\n
-
GI: TITLE
Context: RSECTION
StartText: ^<H2>
EndText: </H2>^
-
GI: TITLE
Context: RSUBSECTION
StartText: ^<H3>
EndText: </H3>^
-
GI: TITLE
Context: RDIVISION
StartText: ^<H3>
EndText: </H3>^
-
GI: RSECTION
StartText: ^
EndText: ^
-
GI: RSUBSECTION
StartText: ^
EndText: ^
-
GI: RDIVISION
StartText: ^
EndText: ^
-
GI: OSF-REFPAGE
StartText: ^<!-- Start OSF-REFPAGE -->
EndText: ^<!-- End OSF-REFPAGE -->^
-
# ______________________________________________________________________
GI: MESSAGE
StartText: ^<!-- Message -->^<DL>^
EndText: ^</DL>^
-
GI: MSG-CODE
Context: MESSAGE
StartText: ^<DT><B>Code</B></DT>^<DD>
EndText: ^
-
GI: MSG-SYMBOL
StartText: ^<DT><B>Symbol</B></DT>^<DD>
EndText: ^
-
GI: MSG-TEXT
StartText: ^<DT><B>Text</B></DT>^<DD>
Context: MESSAGE
EndText: ^
-
GI: MSG-TYPE
StartText: ^<DT><B>Type</B></DT>^<DD>
EndText: ^
-
GI: MSG-DESC
StartText: ^<DT><B>Description</B></DT>^<DD>
EndText: ^
-
GI: MSG-CAUSE
StartText: ^<DT><B>Cause</B></DT>^<DD>
EndText: ^
-
GI: MSG-AUDIENCE
StartText: ^<DT><B>Audience</B></DT>^<DD>
EndText: ^
-
GI: MSG-RESP
StartText: ^<DT><B>Response</B></DT>^<DD>
EndText: ^
-
GI: MSG-ORIGIN
StartText: ^<DT><B>Origin</B></DT>^<DD>
EndText: ^
-
GI: P
Context: MSG-DESC
NthChild: 1
Action: 2
-
GI: P
Context: MSG-CAUSE
NthChild: 1
Action: 2
-
GI: P
Context: MSG-RESP
NthChild: 1
Action: 2
-
# ______________________________________________________________________
GI: TITLE
Context: OSF-BOOK
StartText: ^<TITLE>
EndText: </TITLE>^
-
# ______________________________________________________________________
# "default" handling of some common and keydata elements
GI: P
StartText: ^<P>^
EndText: ^\n
-
GI: MSG-CODE
StartText: <B>
EndText: </B>
-
GI: MSG-TEXT
#StartText: {
#EndText: }
-
# ______________________________________________________________________
GI: TOC
Context: NAVIGATION AUGMENTUM OSF-BOOK
StartText: ^\n
EndText: ^
-
GI: INDEX
Replace: ^<!-- This document wants an index -->
Ignore: all
-
GI: BIBLIOGRAPHY
Replace: ^<!-- This document wants a bibliography -->
EndText: ^
-
GI: GLOSSARY
StartText: ^% This document wants a glossary:\s
EndText: ^
-
# ______________________________________________________________________
# Set page number to 1 (roman) for TOC and friends
GI: AUGMENTUM
Context: OSF-BOOK
StartText: ^
EndText: ^
-
GI: NAVIGATION
-
GI: HY-LOCATOR
Ignore: all
-
# ignore until we know how to process these
GI: HY-CONCEPT
Context: META
Ignore: all
-
GI: HY-CONCEPT
Ignore: all
-
GI: HY-DEF
-
GI: HY-TERM
-
# ----
GI: ENTRY
AttValue: DAVROLE glossary
StartText: ^.gL "
EndText: "^
-
# (check for some content to avoud empty tag)
GI: ENTRY
Content: .
AttValue: DAVROLE index
StartText: ${_attval ID 76}
EndText: ${_attval ID 77}
Ignore: children
-
GI: ENTRY
-
# ----
GI: XREF
AttValue: OSFROLE gettitle
StartText: Get-Title
-
GI: XREF
AttValue: OSFROLE getnumber
#StartText: Get-Division-Number
EndText: \ <A HREF="#${LINKEND}">go there</A>
-
GI: XREF
AttValue: OSFROLE getpage
EndText: \ <A HREF="#${LINKEND}">go there</A>
-
# Print GI name, in mixed case
GI: _pr_gi_name
SpecID: 87
Ignore: all
EndText: ${_gi M}
-
# GI name
GI: XREF
AttValue: OSFROLE gettype
EndText: ${_followlink 87}
-
# name of refpage
GI: XREF
AttValue: OSFROLE getrefname
Replace: <B>${_chasetogi REF-NAME 1}</B>
-
# title and page number -- page is the input file
GI: XREF
AttValue: OSFROLE getshort
Replace: <B>${_chasetogi TITLE 1}</B>, <A HREF="${_infile}">page</A>
-
# section number, title, and page number
GI: XREF
AttValue: OSFROLE getfull
Replace: ${_followlink 87} <A HREF="#${LINKEND}">go there</A>,\s
<B>${_chasetogi TITLE 1}</B>, <A HREF="${_infile}">page</A>
-
GI: XREF
-
# ----
GI: HY-BIB-DESCRIPTION
StartText: <I>
EndText: </I>
-
GI: HY-NMLIST
Ignore: all
-
# ______________________________________________________________________
GI: META
Ignore: all
-
GI: DOC-ID
Ignore: all
-
GI: AUTHOR-INFO
StartText: ^<ADDRESS>^
EndText: ^</ADDRESS>^
-
GI: PERSON
Context: AUTHOR-INFO
StartText: ^
EndText: ^
-
GI: AUTH-AFFILIATION ADDRESS
StartText: ^
EndText: ^
-
GI: PRODUCT
Context: MESSAGE
Ignore: all
-
GI: VALID-DATE PRODUCT
-
GI: PRODUCT-NAME PRODUCT-VERSION
StartText: \s
EndText: \s
-
GI: NOTICES DISCLAIMER COPYRIGHTS
StartText: ^\n
EndText: ^\n
-
GI: OWNER STATEMENT YEAR
Context: COPYRIGHT-NOTICE
Ignore: all
-
GI: COPYRIGHT-NOTICE
StartText: ^Copyright (c) ${_followrel child YEAR 1}\s
${_followrel child OWNER 1} ${_followrel child STATEMENT 1}
EndText: ^.br^
-
GI: STATEMENT
StartText: \s
-
GI: TRADEMARKS
StartText: ^<P>
-
GI: TRADEMARK-PAIR
StartText: ^<P>
EndText: ^
-
#GI: PRODUCT-ID
#StartText: ^
#-
GI: AUDIENCE
StartText: ^<P>
EndText: ^
-
# ______________________________________________________________________
GI: REV-BRACKET
StartText: ^<!-- REV bracket -->^
-
GI: I18N-BRACKET REV-DESCRIPTION OCCURRENCES OCC-ASYNC OCC-SYNC
-
GI: DESC-POOL
Ignore: all
-
GI: REV-DESCRIPTION
Ignore: all
-
# ______________________________________________________________________
GI: GRAPHIC
Context: DISPLAY
#StartText: ^<IMG SRC="${_filename}">^
Replace: ^<P><A HREF="${_filename}">Click for PostScript image.</A><P>^
-
GI: GRAPHIC
Replace: ^<A HREF="${_filename}">Click for PostScript image.</A>^
-
GI: EQUATION
Context: DISPLAY
StartText: ^<BLOCKQUOTE>^
EndText: ^</BLOCKQUOTE>^
-
GI: EQUATION
StartText: ^<P>TeX equatin:\s
EndText: ^<P>
-
# ______________________________________________________________________
GI: _anch-title-start
SpecID: 71
Replace: ${_attval ID 76}
-
GI: _anch-title-end
SpecID: 72
Replace: ${_attval ID 77}
-
GI: TITLE
Context: SECTION
SpecID: 12
StartText: ^<H2>${chap}.${sect} ${_followrel parent SECTION 71}
EndText: ${_followrel parent SECTION 72}</H2>^
-
GI: TITLE
Context: CHAPTER
SpecID: 11
StartText: ^<H1>Chapter ${chap}: ${_followrel parent CHAPTER 71}
EndText: ${_followrel parent CHAPTER 72}</H1>^
-
GI: TITLE
Context: PART
SpecID: 14
StartText: ^<H1>Part ${part}:\s
EndText: </H1>^
-
GI: TITLE
Context: DIVISION CHAPTER
Action: 12
-
GI: TITLE
Context: DIVISION APPENDIX
Action: 12
-
GI: TITLE
Context: DIVISION BODY
Action: 11
-
GI: TITLE
Context: DIVISION SECTION
SpecID: 13
Increment: subsect
StartText: ^<H3>${chap}.${sect}.${subsect}\s
EndText: </H3>^
-
GI: TITLE
Context: DIVISION DIVISION SECTION
StartText: ^<H4>
EndText: </H4>^
-
GI: TITLE
Context: DIVISION
Context: DIVISION DIVISION BODY
Action: 13
-
GI: TITLE
Context: DIVISION DIVISION BODY
Action: 12
-
GI: TITLE
Context: DIVISION BODY
Action: 11
-
GI: TITLE
Context: DIVISION DIVISION
StartText: ^<H4>
EndText: </H4>^
-
GI: CHAPTER
StartText: ^<!-- Start CHAPTER: ch-${chap}: ${_followrel child TITLE 1} -->^
EndText: ^<!-- End CHAPTER -->^
Increment: chap
Set: sect 1
-
GI: SECTION
StartText: ^<!-- Start SECTION: ${_followrel child TITLE 1} -->^
EndText: ^<!-- End SECTION -->^
Increment: sect
Set: subsect 1
-
GI: DIVISION
StartText: ^
EndText: ^
-
GI: PART
StartText: ^<!-- Start PART: -: ${_followrel child TITLE 1} -->^
EndText: ^<!-- End PART -->^
Increment: part
#Var: chap 1
-
GI: PREFACE
StartText: ^<!-- Start PREFACE: preface: ${_followrel child TITLE 1} -->^
EndText: ^<!-- End PREFACE -->^
-
GI: PDIVISION
StartText: ^
EndText: ^
-
GI: TITLE
Context: PREFACE
StartText: ^<H1>${_followrel parent PREFACE 71}
EndText: ${_followrel parent PREFACE 72}</H1>^
-
GI: TITLE
Context: PDIVISION
StartText: ^<H2>${_followrel parent PDIVISION 71}
EndText: ${_followrel parent PDIVISION 72}</H2>^
-
GI: TITLE
Context: APPENDIX
StartText: ^<H1>Appendix ${app}: ${_followrel parent APPENDIX 71}
EndText: ${_followrel parent APPENDIX 72}</H1>^
-
GI: APPENDIX
StartText: ^<!-- Start PREFACE: app-${app}: ${_followrel child TITLE 1} -->^
EndText: ^<!-- End APPENDIX -->^
Increment: app
Var: sect 1
-
GI: SUPPLEMENTS
StartText: ^<!-- Start SUPPLEMENTS -->
EndText: ^<!-- End SUPPLEMENTS -->^
-
GI: BODY
StartText: ^
EndText: ^
StartText: ^<!-- Start BODY -->
EndText: ^<!-- End BODY -->^
-
GI: OSF-BOOK
StartText: ^
EndText: ^
-
# ______________________________________________________________________
GI: TITLE
#StartText: "
#EndText: ^
Message: +++ TITLE??\n${_location}\n
-
GI: ALT-TITLE
Ignore: all
#StartText: ^... Alt title:\s
#EndText: ^
-
GI: AUGMENTUM
Ignore: all
-
GI: PRELIMINARIES
StartText: ^<!-- Start PRELIMINARIES -->
EndText: ^<!-- End PRELIMINARIES -->^
-
GI: YEAR
-
# ______________________________________________________________________
GI: BRIDGE-TITLE
StartText: ^\n<B>
EndText: </B>^
-
# ______________________________________________________________________
# Some named specs, used throughout.
GI: _pass-text
SpecID: 1
-
#
GI: _osf-size
Replace:
-
GI: _osf-indent
Replace:
-
GI: _osf-center
Replace:
-
GI: _osf-break
Replace:
-
GI: _osf-point-size
Replace:
-
GI: _osf-space
Replace:
-
GI: _osf-new-page
Replace:
-
# a "paragraph", with no .P
GI: _no-dot-P
SpecID: 2
StartText: ^
EndText: ^
-
# Just output the anchor tag and ID. No content.
GI: _name
SpecID: 76
StartText: <A NAME="${ID id}">
Ignore: all
-
GI: _name-end
SpecID: 77
StartText: </A>
Ignore: all
-
# ______________________________________________________________________
#
GI: _Start
StartText: ^
-
GI: _End
EndText: ^
-
# ______________________________________________________________________

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,41 @@
# ______________________________________________________________________
# Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
# All rights reserved.
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# This will return the book's title, marked up for SML's Headers/* files
# Just the text is returned.
#
# $XConsortium: book-title-header.ts /main/2 1996/07/18 14:22:12 drk $
# ______________________________________________________________________
#
GI: TITLE
Context: OSF-BOOK
StartText: ^.ds !@\s
EndText: ^
-
# Ignore all other child elements of the book
GI: META BODY AUGMENTUM PRELIMINARIES SUPPLEMENTS
Ignore: all
-
GI: ALT-TITLE
Ignore: all
Message: Warning: Ignoring ALT-TITLE within TITLE.\n
-
# Pass characters of child elements of book's TITLE.
GI: *
-

View file

@ -0,0 +1,173 @@
# ______________________________________________________________________
# Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
# All rights reserved.
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# $XConsortium: book-toc.ts /main/2 1996/07/18 14:22:29 drk $
# ______________________________________________________________________
#
# This is for printing a TOC/outline of an instance as text.
# Only division titles will be printed.
# ______________________________________________________________________
Var: part 1
Var: chap 1
Var: sect 1
Var: subsect 1
Var: app 1
#
# ______________________________________________________________________
GI: DIVISION
Context: SECTION
SpecID: 12
StartText: ^ ${subsect}.\s
EndText: ^
Increment: subsect
-
GI: SECTION
SpecID: 11
StartText: ^ ${sect}.\s
EndText: ^
Set: subsect 1
Increment: sect
-
GI: CHAPTER
SpecID: 10
StartText: ^Chapter ${chap}.\s
EndText: ^
Set: sect 1
Increment: chap
-
GI: PART
StartText: ^\nPart ${part}:\s
EndText: ^
Increment: part
-
GI: APPENDIX
SpecID: 15
StartText: ^${app}.\s
EndText: ^
Set: sect 1
Increment: app
-
GI: DIVISION
Context: APPENDIX
Action: 11
-
# ______________________________________________________________________
GI: DIVISION
Context: DIVISION DIVISION BODY
Action: 12
-
GI: DIVISION
Context: DIVISION BODY
Action: 11
-
GI: DIVISION
Context: CHAPTER
Action: 11
-
GI: DIVISION
Context: BODY
Action: 10
-
# ______________________________________________________________________
GI: PREFACE
StartText: ^
-
GI: PDIVISION
StartText: ^ \s
-
# ______________________________________________________________________
GI: OSF-REFPAGE
StartText: \n
-
GI: REF-NAME
StartText: ^
EndText: \ --\s
-
GI: REF-PURPOSE
#StartText:
EndText: ^\n
-
GI: SUB-NAME
StartText: ^ \s
-
GI: SUB-PURPOSE
StartText: \t
-
GI: RSECTION
SpecID: 21
StartText: ^ \s
EndText: ^
-
GI: RSUBSECTION
SpecID: 22
StartText: ^ \s
EndText: ^
-
GI: RDIVISION
Context: RSUBSECTION
SpecID: 23
StartText: ^ \s
EndText: ^
-
GI: RDIVISION
Context: RDIVISION RDIVISION REFPAGE
Action: 23
-
GI: RDIVISION
Context: RDIVISION REFPAGE
Action: 22
-
GI: RDIVISION
Context: REFPAGE
Action: 21
-
# ______________________________________________________________________
GI: OSF-BOOK
-
GI: BODY
StartText: \n
-
GI: SUPPLEMENTS
StartText: \nAppendixes^
-
GI: PRELIMINARIES
StartText: \n
-
# ______________________________________________________________________
GI: TITLE
EndText: ^
-
GI: ALT-TITLE
StartText: ^ [
EndText: ]^
-
# ______________________________________________________________________
# Pass through text of things inside a title
Relation: ancestor TITLE
-
Relation: ancestor REF-NAME
-
Relation: ancestor REF-PURPOSE
-
#
# Wildcard - skip all other elements...
GI: *
Ignore: all
-
# ______________________________________________________________________

View file

@ -0,0 +1,197 @@
# ______________________________________________________________________
# Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
# All rights reserved.
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# $XConsortium: book-toc_ps.ts /main/2 1996/07/18 14:22:43 drk $
# ______________________________________________________________________
#
# This is for printing a TOC/outline of an instance in PostScript.
# Only division titles will be printed.
# ______________________________________________________________________
Var: part 1
Var: chap 1
Var: sect 1
Var: subsect 1
Var: app 1
#
# ______________________________________________________________________
GI: DIVISION
Context: SECTION
SpecID: 12
StartText: ^${_followrel child TITLE 1000}\s
( ${chap}.${sect}.${subsect}) 10 DivTitle^
Increment: subsect
-
GI: SECTION
SpecID: 11
StartText: ^${_followrel child TITLE 1000} ( ${chap}.${sect}) 12 DivTitle^
Set: subsect 1
Increment: sect
-
GI: CHAPTER
SpecID: 10
StartText: ^${_followrel child TITLE 1000} (Chapter ${chap}:) 14 DivTitle^
Set: sect 1
Increment: chap
-
GI: PART
StartText: ^${_followrel child TITLE 1000} (Part ${part}:) 16 DivTitle^
Increment: part
-
GI: APPENDIX
SpecID: 15
StartText: ^${app}.\s
StartText: ^${_followrel child TITLE 1000} (Appendix ${app}:) 14 DivTitle^
Set: sect 1
Increment: app
-
GI: DIVISION
Context: APPENDIX
StartText: ^${_followrel child TITLE 1000} ( ${app}.${sect}) 14 DivTitle^
Set: subsect 1
Increment: sect
-
# ______________________________________________________________________
GI: DIVISION
Context: DIVISION DIVISION BODY
Action: 12
-
GI: DIVISION
Context: CHAPTER
Action: 11
-
GI: DIVISION
Context: DIVISION BODY
Action: 11
-
GI: DIVISION
Context: BODY
Action: 10
-
# ______________________________________________________________________
GI: PREFACE
StartText: ^${_followrel child TITLE 1000} () 14 DivTitle^
-
GI: PDIVISION
StartText: ^${_followrel child TITLE 1000} ( ) 12 DivTitle^
-
# ______________________________________________________________________
GI: OSF-REFPAGE
StartText: \n(${_followrel child REF-PURPOSE 1001})\s
(Refpage: ${_followrel child REF-NAME 1001} \\267) 14 DivTitle
-
GI: SUB-NAME
StartText: ^ \s
-
GI: SUB-PURPOSE
StartText: \t
-
GI: RSECTION
SpecID: 21
StartText: ^${_followrel child TITLE 1000} ( ) 12 DivTitle^
-
GI: RSUBSECTION
SpecID: 22
StartText: ^${_followrel child TITLE 1000} ( ) 10 DivTitle^
-
GI: RDIVISION
Context: RSUBSECTION
SpecID: 23
StartText: ^${_followrel child TITLE 1000} ( ) 10 DivTitle^
-
GI: RDIVISION
Context: RDIVISION RDIVISION REFPAGE
Action: 23
-
GI: RDIVISION
Context: RDIVISION REFPAGE
Action: 22
-
GI: RDIVISION
Context: REFPAGE
Action: 21
-
# ______________________________________________________________________
GI: OSF-BOOK
StartText: ^${_followrel child TITLE 1000} 20 BkTitle^
-
GI: BODY
StartText: \n
-
GI: SUPPLEMENTS
StartText: \n
-
GI: PRELIMINARIES
-
# ______________________________________________________________________
# This just descends tree...
GI: _TITLE
SpecID: 1000
StartText: (
EndText: )
-
# Same, but no parens...
GI: _TITLE
SpecID: 1001
-
GI: ALT-TITLE
Ignore: all
-
# ______________________________________________________________________
# Pass through text of things inside a title
Relation: ancestor TITLE
-
Relation: ancestor REF-NAME
-
Relation: ancestor REF-PURPOSE
-
#
# Wildcard - skip all other elements...
GI: *
Ignore: all
-
# ______________________________________________________________________
# PostScript prolog stuff
GI: _Start
StartText: %!^
/in {72 mul} bind def^
/Home {/X 1 in def /Y 10 in def} def^
/BkTitle { % (title) ps^
\ /ps exch def^
\ /Times-Bold findfont ps scalefont setfont^
\ X Y moveto 0 ps neg rmoveto^
\ dup stringwidth pop /w exch def w 2 div neg 3.25 in add 0 rmoveto^
\ show^
\ 0 -3 rmoveto w neg 0 rlineto stroke^
\ /Y Y ps 1.1 mul sub def^
} def^
/DivTitle { % (title) (divname) ps^
\ /ps exch def^
\ /Times-Roman findfont ps scalefont setfont^
\ X Y moveto 0 ps neg rmoveto^
\ show ( ) show show^
\ /Y Y ps 1.1 mul sub def^
\ % check for end of page^
\ Y 1 in lt { showpage Home } if^
} def^
\nHome^
-
GI: _End
EndText: ^showpage^\n
-
# ______________________________________________________________________

View file

@ -0,0 +1,52 @@
# ______________________________________________________________________
# Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
# All rights reserved.
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# $XConsortium: depend.ts /main/2 1996/07/18 14:22:57 drk $
# ______________________________________________________________________
#
# Generate part of the dependency list for Makefiles.
# For referenced graphic entities, output a line like:
# input-file.sgml: graphic-file.eps
# For elements whose name matches a blessed list, output a line like this:
# ID.latex: input-file.sgml
#
# These are sane places where you can start formatting
GI: CHAPTER SECTION DIVISION DISPLAY TABLE APPENDIX LIST
OSF-REFPAGE PART PREFACE PDIVSION OSF-BOOK
StartText: ${_attval ID 10}
Ignore: data
-
GI: GRAPHIC
Replace: ${_infile root}.dvi:\t${_filename}\n
-
GI: XREF
Replace: ${_infile root}.dvi:\t${_followlink LINKEND 20}\n
-
GI: *
Ignore: data
-
GI: _id
SpecID: 10
Replace: ${ID}.latex:\t${_infile}\n
-
GI: _xref
SpecID: 20
Replace: ${_infile}
#Message: XREF ${_infile}\n
-

View file

@ -0,0 +1,575 @@
# Copyright (c) 1993 Open Software Foundation, Inc.
# All rights reserved.
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# ______________________________________________________________________
#
# refpage-to-man translation spec.
#
# $XConsortium: ref-man.ts /main/2 1996/07/18 14:23:11 drk $
# ______________________________________________________________________
#
Var: User !printenv USER
Var: Auth Open Software Foundation
# ______________________________________________________________________
GI: OSF-REFPAGE
StartText: ^
EndText: ^
-
# ______________________________________________________________________
GI: ROW
StartText: ^
EndText: ^${_osftable tbl rowend}^
-
GI: TITLE-ROW
StartText: ^
EndText: ^${_osftable tbl rowend}^
-
GI: CELL
Context: TITLE-ROW
Relation: sibling+ CELL
StartText: \\fB
EndText: \\fR@
-
GI: CELL
Context: TITLE-ROW
StartText: \\fB
EndText: \\fR
-
GI: CELL
Relation: sibling+ CELL
EndText: @
-
GI: CELL
-
GI: C-CELL
Relation: sibling+ C-CELL
StartText: T{^
EndText: ^T}@
-
GI: C-CELL
StartText: T{^
EndText: ^T}
-
# if you want a table title/caption, put it in a display
GI: TABLE
StartText: ^.TS^
${_osftable tbl}^${_osftable tbl top}^
EndText: ^${_osftable tbl bottom}^.TE^
-
# ______________________________________________________________________
#GI: TEXT-AS-FIGURE
#StartText: ^\n\\begin{verbatim}^
#EndText: ^\\end{verbatim}^\n
#-
GI: TITLE
Context: DISPLAY
Relation: sibling TABLE
StartText: ^.TB "
EndText: "^
-
GI: DISPLAY
Relation: child TABLE
#StartText: ^
#EndText: ^
-
GI: DISPLAY
AttValue: WRAP NOWRAP
StartText: ^.DS^.nf^
EndText: ^.ad^.DE^
-
GI: DISPLAY
AttValue: TYPE FIGURE
StartText: ^.DS^
EndText: ^.DE^
-
GI: TITLE
Context: DISPLAY
Relation: sibling GRAPHIC
StartText: ^.C 1^
EndText: ^
-
# default display
GI: DISPLAY
StartText: ^.DS^
EndText: ^.DE^
-
GI: TITLE
Context: DISPLAY
StartText: ^.C 1^
EndText: ^
-
# ______________________________________________________________________
GI: CMD-SYNOPSIS PROGLANG-SYNOPSIS FILE-SYNOPSIS
StartText: ^.na^.PP^
EndText: ^.ad^
-
GI: INCLUDE
StartText: ^.br^
EndText: ^.sp 1.5^
-
GI: DATA-DECLARATION
StartText: ^
EndText: ^
-
GI: CMD-ARGUMENT
AttValue: PRESENCE OPTIONAL
AttValue: REPEATABILITY REPEATABLE
StartText: \ [
EndText: \ ...]\s
-
GI: CMD-ARGUMENT
AttValue: REPEATABILITY REPEATABLE
StartText: \s
EndText: \ ...
-
GI: CMD-ARGUMENT
AttValue: PRESENCE OPTIONAL
StartText: \ [
EndText: ]\s
-
GI: CMD-ARGUMENT
StartText: \s
EndText: \s
-
# hack - should check value of parent's TYPE attr (for OR)
GI: OPTION-NAME
Context: CMD-ARGUMENT
PAttSet: TYPE
NthChild: 1
StartText: \ \\fB
EndText: \\fP\s
-
GI: OPTION-NAME
Context: CMD-ARGUMENT
PAttSet: TYPE
StartText: \ | \\fB
EndText: \\fP\s
-
GI: OPTION-NAME
Context: CMD-ARGUMENT
StartText: \ \\fB
EndText: \\fP\s
-
# ______________________________________________________________________
GI: LITERAL COMMAND FUNCTION FILE DIRECTORY DATATYPE E-MAIL
StartText: \\fB
EndText: \\fP
-
GI: VARIABLE EMPHASIS
StartText: \\fI
EndText: \\fP
-
GI: SUBSCRIPT
StartText: \\d\\s-2
EndText: \\s+2\\u
-
GI: SUPERSCRIPT
StartText: \\u\\s-2
EndText: \\s+2\\d
-
GI: TRADEMARK
StartText: \\fB
EndText: \\fP
-
GI: NUMBER DATE TIME PERSON PLACE HONORIFIC TELEPHONE YEAR ACRONYM
-
# change this if you have font C (Courier) instead of CW.
GI: KEYBOARD-INPUT
#StartText: \\fC
StartText: \\f(CW
EndText: \\fP
-
GI: COMPUTER-OUTPUT
Context: DISPLAY
#StartText: ^.DS^.nf^.ft CW^
#EndText: ^.ft R^.fi^.DE^
StartText: ^.nf^.ft CW^
EndText: ^.ft R^.fi^
-
GI: COMPUTER-OUTPUT
#StartText: \\fC
StartText: \\f(CW
EndText: \\fP
-
GI: KEYBOARD-KEY
StartText: <\\fB
EndText: \\fP>
-
GI: INPUT-INSTRUCT FOREIGN-PHRASE
StartText: \\fI
EndText: \\fP
-
GI: GUI-TEXT
StartText: \\fB
EndText: \\fP
-
GI: LOGICAL-NEGATION
StartText: ^.ul 1^
EndText: ^
-
GI: OPTION-NAME
StartText: \\fB
EndText: \\fP
-
GI: MISC-DATA
#StartText: {
#EndText: }
-
GI: MARKUP
AttValue: LANG sgml
AttValue: CATEGORY elem.*
StartText: \\fB<
EndText: >\\fP
-
GI: MARKUP
AttValue: CATEGORY (attr|entity)
StartText: \\fB
EndText: \\fP
-
GI: MARKUP
StartText: \\fB<
EndText: >\\fP
-
GI: SPECIAL-FORMAT
AttValue: SMALLCAPS SMALLCAPS
StartText: \\s-1
EndText: \\s+1
-
GI: SPECIAL-FORMAT
AttValue: HORIZKEEP NOBREAK
StartText: ^.DS^
EndText: ^.DE^
-
# a bit if a hack
GI: SPECIAL-FORMAT
AttValue: STYLE .
StartText: {\\${STYLE}\s
EndText: }
-
GI: EXCERPT
StartText: ^.br^.in +.7i^
EndText: ^.in^.br^
-
GI: QUOTE
StartText: ``
StartText: ''
-
# ______________________________________________________________________
# label/item for labeled list
GI: LABEL
StartText: ^.IP "
EndText: "^
-
GI: ITEM
Context: L-ITEM
StartText: ^
EndText: ^
-
# item for general list
GI: ITEM
StartText: ^.IP \\(bu^
EndText: ^
-
GI: _nested-list
SpecID: 881
#Replace: ^.RS 1cm^
Replace: ^.RS +\\n(INu^
-
GI: _nested-list
SpecID: 882
Replace: ^.RE^
-
GI: LIST
Relation: child L-ITEM
StartText: ^'br\\" labeled list^${_relation ancestor LIST 881}
EndText: ${_relation ancestor LIST 882}^'br\\" labeled list end^
-
GI: LIST
Relation: child ITEM
AttValue: TYPE UNORDERED
StartText: ^'br\\" unordered list^${_relation ancestor LIST 881}
EndText: ${_relation ancestor LIST 882}^^'br\\" unordered list end^
-
GI: LIST
Relation: child ITEM
AttValue: TYPE ORDERED
StartText: ^'br\\" ordered list^${_relation ancestor LIST 881}
EndText: ${_relation ancestor LIST 882}^^'br\\" ordered list end^
-
# default general list
GI: LIST
Relation: child ITEM
StartText: ^'br\\" unordered list^${_relation ancestor LIST 881}
EndText: ${_relation ancestor LIST 882}^^'br\\" unordered list end^
-
# procedure list
GI: LIST
Relation: child PROCEDURE-STEP
StartText: ^'br\\" procedure list^${_relation ancestor LIST 881}
EndText: ${_relation ancestor LIST 882}^^'br\\" procedure list end^
Set: stepnum 1
-
GI: PROCEDURE-STEP
StartText: ^.IP ${stepnum}. 2cm^
EndText: ^
Increment: stepnum
-
# note list
GI: LIST
Relation: child NOTE
StartText: ^
EndText: ^
-
# hack?? I have not tried this yet.
GI: BRIDGE-P
StartText: ^.PP^
EndText: ^
-
GI: L-ITEM
EndText: ^
-
GI: P
Context: ITEM
NthChild: 1
StartText: ^
EndText: ^
-
GI: P
Context: ITEM
StartText: ^.IP^
EndText: ^
-
# ______________________________________________________________________
GI: NOTE
Relation: child TITLE
StartText: ^.IP\s
EndText: ^
-
GI: NOTE
StartText: ^.IP Note: 2cm
EndText: ^
-
GI: TITLE
Context: NOTE
StartText: "
EndText: " 2 cm^
-
GI: ANNOTATION
StartText: ^.FS^
EndText: ^.FE^
Message: WARNING: Found ${_gi} in a manpage:\n${_location}\n
-
GI: FOOTNOTE
StartText: ^.FS^
EndText: ^.FE^
Message: WARNING: Found ${_gi} in a manpage:\n${_location}\n
-
GI: NOTEREF
-
# ______________________________________________________________________
# plain text...
GI: _
SpecID: 98
-
GI: REF-NAME
StartText: ^.TH "
EndText: " "${_pattr CATEGORY}"^.SH "Name"^${_action 98} -\s
-
GI: REF-PURPOSE
#StartText:
EndText: ^
-
GI: RSECTION
StartText: ^.SH\s
EndText: ^
-
GI: RSUBSECTION
StartText: ^.SS\s
EndText: ^
-
GI: RDIVISION
StartText: ^.SS\s
EndText: ^
-
GI: META
Ignore: all
-
GI: AUGMENTUM
Ignore: all
-
# ______________________________________________________________________
GI: BRIDGE-TITLE
StartText: ^.B "
EndText: "^
-
# ______________________________________________________________________
GI: MESSAGE
StartText: ^... Message^
-
GI: MSG-CODE
Context: MESSAGE
StartText: ^.LI "Code"^
EndText: ^
-
GI: MSG-SYMBOL
StartText: ^.LI "Symbol"^
EndText: ^
-
GI: MSG-TEXT
StartText: ^.LI "Text"^
Context: MESSAGE
EndText: ^
-
GI: MSG-TYPE
StartText: ^.LI "Type"^
EndText: ^
-
GI: MSG-DESC
StartText: ^.LI "Description"^
EndText: ^
-
GI: MSG-CAUSE
StartText: ^.LI "Cause"^
EndText: ^
-
GI: MSG-AUDIENCE
StartText: ^.LI "Audience"^
EndText: ^
-
GI: MSG-RESP
StartText: ^.LI "Response"^
EndText: ^
-
GI: MSG-ORIGIN
StartText: ^.LI "Origin"^
EndText: ^
-
# ______________________________________________________________________
# "default" handling of some common and keydata elements
GI: P
StartText: ^.PP^
EndText: ^
-
GI: MSG-CODE
StartText: \\fB
EndText: \\fP
-
GI: MSG-TEXT
#StartText: {
#EndText: }
-
GI: TITLE
StartText: "
EndText: "^
-
GI: ALT-TITLE
StartText: ^... Alt title:\s
EndText: ^
-
# ______________________________________________________________________
GI: TOC INDEX BIBLIOGRAPHY GLOSSARY NAVIGATION HY-LOCATOR HY-CONCEPT
Ignore: all
-
GI: HY-DEF HY-TERM
-
# ----
GI: ENTRY
AttValue: DAVROLE glossary
StartText: \\fB
EndText: \\fP
-
GI: ENTRY
AttValue: DAVROLE index
# no processing for manpage
-
GI: ENTRY
-
# ----
GI: XREF
AttValue: OSFROLE gettitle
StartText: Get-Title
-
GI: XREF
AttValue: OSFROLE getnumber
#StartText: Get-Division-Number
#EndText: \ \\ref{${LINKEND}}
-
GI: XREF
AttValue: OSFROLE getpage
#EndText: \ \\pageref{${LINKEND}}
-
GI: XREF
-
# ----
GI: HY-BIB-DESCRIPTION
StartText: \\fI
EndText: \\fP
-
# ______________________________________________________________________
GI: REV-BRACKET
StartText: ^'br rev-bracket^
-
GI: I18N-BRACKET REV-DESCRIPTION OCCURRENCES OCC-ASYNC OCC-SYNC
-
GI: DESC-POOL
Ignore: all
-
# ______________________________________________________________________
GI: GRAPHIC
Context: DISPLAY
StartText: ^'br\\" Graphic from file: ${_filename}^
EndText: ^
Message: WARNING: Found ${_gi} in a manpage:\n${_location}\n
-
GI: GRAPHIC
StartText: ^'br\\" Graphic from file: ${_filename}^
Message: WARNING: Found ${_gi} in a manpage:\n${_location}\n
-
GI: EQUATION
StartText: ^.EQ^
EndText: ^.EN^
-
# ______________________________________________________________________
#
GI: *
Message: Found element without a matching spec:\n${_location}\n
-
GI: _Start
StartText: ^'br Translated with ${transpec} by ${user} on ${host}, ${date}^
-
GI: _End
EndText: ^
-
# ______________________________________________________________________
#
# Processing Instructions
GI: _osf-break
Replace: ^.br^
-
GI: _osf-new-page
Replace: ^.bp^
-
GI: _osf-need
StartText: ^.ne\s
EndText: ^
-
GI: _osf-hyphen
Replace: -
-
# ______________________________________________________________________

View file

@ -0,0 +1,743 @@
# Copyright (c) 1993 Open Software Foundation, Inc.
# All rights reserved.
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# ______________________________________________________________________
# $XConsortium: ref-tex.ts /main/2 1996/07/18 14:23:28 drk $
# ______________________________________________________________________
#
Var: User !printenv USER
#Var: Auth !egrep "^$USER:" /etc/passwd | sed -e 's/,.*//' -e 's/^.*://'
Var: Auth Open Software Foundation
#Var: Date !date
# ______________________________________________________________________
GI: AUGMENTUM
StartText: ^\\setcounter{page}{2}^
EndText: ^% recall ${_action 21}^
#Message: AUGMENTUM\n
-
# ______________________________________________________________________
GI: OSF-REFPAGE
StartText: ^\n\\begin{document}^
\\lhead{\\Pname} \\rhead{\\Pname} \\chead{OSF} \\rfoot{\\today}
EndText: ^\n\\end{document}^\n
-
GI: BODY
StartText: ^\n% start body^\\pagebreak^\\cleardoublepage^
\\pagenumbering{arabic}^\\setcounter{page}{1}
EndText: ^% end body^
-
GI: SECTION
StartText: ^\n\\section
EndText: ^
-
GI: CHAPTER
StartText: ^\n\\chapter
EndText: ^
-
GI: DIVISION
Context: SECTION
StartText: ^\n\\subsection
EndText: ^
-
GI: DIVISION
Context: DIVISION SECTION
StartText: ^\n\\subsubsection
EndText: ^
-
GI: DIVISION
Context: DIVISION
Message: ^Caught deep division (beyond subsubsection)!!\n${_location}
StartText: ^\n\\subsubsection*
EndText: ^
-
GI: TITLE
Context: CHAPTER
StartText: {
EndText: \\label{${_pattr ID}}}
-
GI: TITLE
Context: SECTION
StartText: {
EndText: \\label{${_pattr ID}}}
-
# ______________________________________________________________________
GI: ROW
StartText: ^
EndText: \\\\ \\hline^
-
GI: TITLE-ROW
StartText: ^
EndText: \\\\ \\hline\\hline^
-
GI: CELL
Context: TITLE-ROW
SibFollow: CELL
StartText: {\\bf\s
EndText: } &\s
-
GI: CELL
Context: TITLE-ROW
StartText: {\\bf\s
EndText: } \s
-
GI: CELL
SibFollow: CELL
StartText: {
EndText: } &\s
-
GI: CELL
StartText: {
EndText: }\s
-
# if you want a table title/caption, put it in a display
GI: TABLE
StartText: ^\n\\begin{center}^\\begin{tabular}{${HALIGN}} \\hline^
EndText: ^\\end{tabular}^\\end{center}^\n
-
# ______________________________________________________________________
GI: TEXT-AS-FIGURE
StartText: ^\n\\begin{verbatim}^
EndText: ^\\end{verbatim}^\n
-
GI: TITLE
Context: DISPLAY
Sibling: TABLE
StartText: ^\\caption{
EndText: }^
-
GI: DISPLAY
AttValue: IN-FLOW FLOAT
Child: TABLE
StartText: ^\n\\begin{table}^
EndText: ^\\end{table}^\n
-
GI: DISPLAY
Child: TABLE
StartText: ^\n\\begin{table}[h]^
EndText: ^\\end{table}^\n
-
GI: DISPLAY
AttValue: WRAP NOWRAP
StartText: ^\\begin{quote}^\\begingroup \\obeylines\\obeyspaces\\tt\\scriptsize^
EndText: ^\\endgroup^\\end{quote}^
-
GI: DISPLAY
AttValue: TYPE FIGURE
StartText: ^\\begin{figure}^
EndText: ^\\end{figure}^
-
GI: TITLE
Context: DISPLAY
Sibling: GRAPHIC
StartText: ^\\caption{
EndText: }^
-
# default display
GI: DISPLAY
StartText: ^\\begin{quote}^
EndText: ^\\end{quote}^
-
GI: TITLE
Context: DISPLAY
StartText: \\centerline{\\bf\\large\s
EndText: }
-
# ______________________________________________________________________
GI: PROGLANG-SYNOPSIS
StartText: ^\n% Prog lang synopsis^
EndText: ^\n
-
GI: INCLUDE
StartText: ^
EndText: \\vspace{2ex}\\\\^
-
GI: DATA-DECLARATION
StartText: ^{
EndText: }^
-
GI: FILE-SYNOPSIS
StartText: ^\n% File synopsis^
EndText: ^\n
-
GI: CMD-SYNOPSIS
StartText: ^\n% Command synopsis^
EndText: ^\n
-
GI: CMD-ARGUMENT
StartText: {
EndText: }
-
# ______________________________________________________________________
GI: LITERAL
StartText: {\\bf\s
EndText: }
-
GI: EMPHASIS
StartText: {\\em\s
EndText: }
-
GI: SUBSCRIPT
StartText: {\$\\sb{
EndText: }\$}
-
GI: SUPERSCRIPT
StartText: {\$\\sp{
EndText: }\$}
-
GI: ACRONYM
-
GI: TRADEMARK
StartText: {\\bf\s
EndText: }
-
GI: PERSON
-
GI: PLACE
-
GI: HONORIFIC
-
GI: DATE
-
GI: TIME
-
GI: TELEPHONE
-
# yes, a hack...
GI: YEAR
Context: COPYRIGHT-NOTICE
StartText: \\def\\copYr{
EndText: }
-
GI: YEAR
-
GI: E-MAIL
StartText: {\\bf\s
EndText: }
-
GI: NUMBER
-
GI: VARIABLE
StartText: {\\it\s
EndText: }
-
GI: COMMAND
StartText: {\\bf\s
EndText: }
-
GI: FUNCTION
StartText: {\\bf\s
EndText: }
-
GI: FILE
StartText: {\\bf\s
EndText: }
-
GI: DIRECTORY
StartText: {\\bf\s
EndText: }
-
GI: DATATYPE
StartText: {\\bf\s
EndText: }
-
GI: KEYBOARD-INPUT
StartText: {\\tt\s
EndText: }
-
GI: COMPUTER-OUTPUT
Context: DISPLAY
StartText: ^\\begin{verbatim}^
EndText: ^\\end{verbatim}^
-
GI: COMPUTER-OUTPUT
StartText: {\\tt\s
EndText: }
-
GI: KEYBOARD-KEY
StartText: {\$<\$\\bf\s
EndText: \$>\$}
-
GI: INPUT-INSTRUCT
StartText: {\\sl\s
EndText: }
-
GI: GUI-TEXT
StartText: {\\bf\s
EndText: }
-
GI: FOREIGN-PHRASE
StartText: {\\it\s
EndText: }
-
GI: LOGICAL-NEGATION
StartText: \$\\overline{
EndText: }\$
-
GI: OPTION-NAME
StartText: {\\bf\s
EndText: }
-
GI: MISC-DATA
StartText: {
EndText: }
-
GI: MARKUP
AttValue: LANG sgml
AttValue: CATEGORY elem.*
StartText: {\\bf\s\$<\$
EndText: \$>\$}
-
GI: MARKUP
AttValue: CATEGORY (attr|entity)
StartText: {\\bf\s
EndText: }
-
GI: MARKUP
StartText: {\\bf\s\$<\$
EndText: \$>\$}
-
GI: SPECIAL-FORMAT
AttValue: SMALLCAPS SMALLCAPS
StartText: {\\sc\s
EndText: }
-
GI: SPECIAL-FORMAT
AttValue: HORIZKEEP NOBREAK
StartText: \\mbox{
EndText: }
-
# a bit if a hack
GI: SPECIAL-FORMAT
AttValue: STYLE
StartText: {\\${STYLE}\s
EndText: }
-
GI: EXCERPT
StartText: ^\n\\begin{quote}^
EndText: ^\\end{quote}^
-
GI: QUOTE
StartText: ``
StartText: ''
-
# ______________________________________________________________________
# label/item for labeled list
GI: LABEL
StartText: ^\\item[{
EndText: }] \\ ^
-
GI: ITEM
Context: L-ITEM
StartText: ^\n
EndText: ^\n
-
# item for general list
GI: ITEM
StartText: ^\n\\item\s
-
GI: LIST
Child: L-ITEM
StartText: ^\n\\begin{description}^
EndText: ^\\end{description}^\n
#Message: -> LABELED LIST\n
-
GI: LIST
Child: ITEM
AttValue: TYPE UNORDERED
StartText: ^\n\\begin{itemize}^
EndText: ^\\end{itemize}^\n
-
GI: LIST
Child: ITEM
AttValue: TYPE ORDERED
StartText: ^\n\\begin{enumerate}^
EndText: ^\\end{enumerate}^\n
-
# default general list
GI: LIST
Child: ITEM
StartText: ^\n\\begin{itemize}^
EndText: ^\\end{itemize}^\n
-
# procedure list
GI: LIST
Child: PROCEDURE-STEP
StartText: ^\n\\begin{itemize}^
EndText: ^\\end{itemize}^\n
-
GI: PROCEDURE-STEP
StartText: ^\\item\s
-
# hack?? I have not tried this yet.
GI: BRIDGE-P
StartText: ^\\item{}\s
EndText: ^
-
GI: L-ITEM
-
# ______________________________________________________________________
GI: NOTE
Child: TITLE
StartText: ^\n\\osfnote{\\textwidth}{
EndText: }^\n
-
GI: NOTE
StartText: ^\n\\osfnote{\\textwidth}{Note:}{
EndText: }^\n
-
GI: TITLE
Context: NOTE
#StartText: {
EndText: }{
-
GI: P
Context: NOTE
-
GI: ANNOTATION
#StartText: ^\\osfannotation{
#EndText: }^\n
StartText: \\footnote{
EndText: }
-
GI: FOOTNOTE
StartText: \\footnote{
EndText: }
-
GI: P
Context: ANNOTATION
-
GI: P
Context: FOOTNOTE
EndText: ^
-
GI: NOTEREF
-
# ______________________________________________________________________
GI: REF-NAME
StartText: ^\\def\\Pname{
EndText: }^\\section*{Name}^{\\Pname} --\s
-
GI: REF-PURPOSE
#StartText:
EndText: ^
-
GI: RSECTION
StartText: ^\n\\section*
EndText: ^
-
GI: RSUBSECTION
StartText: ^\n\\subsection*
EndText: ^
-
GI: RDIVISION
StartText: ^\n\\subsection*
EndText: ^
-
GI: OSF-REFPAGE
-
GI: META
Context: OSF-REFPAGE
Ignore: all
-
# ______________________________________________________________________
GI: BRIDGE-TITLE
StartText: ^\n\\leftline{\\bf
EndText: }^
-
# ______________________________________________________________________
GI: MESSAGE
StartText: ^% Message^\\begin{description}^
EndText: ^\\end{description}^% Message end^
-
GI: MSG-CODE
Context: MESSAGE
StartText: ^\\item[{Code}]^
EndText: ^
-
GI: MSG-SYMBOL
StartText: ^\\item[{Symbol}]^
EndText: ^
-
GI: MSG-TEXT
StartText: ^\\item[{Text}]^
Context: MESSAGE
EndText: ^
-
GI: MSG-TYPE
StartText: ^\\item[{Type}]^
EndText: ^
-
GI: MSG-DESC
StartText: ^\\item[{Description}]^
EndText: ^
-
GI: MSG-CAUSE
StartText: ^\\item[{Cause}]^
EndText: ^
-
GI: MSG-AUDIENCE
StartText: ^\\item[{Audience}]^
EndText: ^
-
GI: MSG-RESP
StartText: ^\\item[{Response}]^
EndText: ^
-
GI: MSG-ORIGIN
StartText: ^\\item[{Origin}]^
EndText: ^
-
# ______________________________________________________________________
# "default" handling of some common and keydata elements
GI: P
StartText: ^\n
EndText: ^
-
GI: MSG-CODE
StartText: {\\bf\s
EndText: }
-
GI: MSG-TEXT
StartText: {
EndText: }
-
GI: TITLE
StartText: {
EndText: }^
-
GI: ALT-TITLE
Ignore: all
-
# ______________________________________________________________________
GI: TOC
Context: NAVIGATION AUGMENTUM OSF-BOOK
StartText: ^\n\\begingroup^\\tightenlist^\\tableofcontents^\\endgroup^
EndText: ^
-
GI: INDEX
#StartText: ^\n\\makeindex^
StartText: ^% This document wants an index:\s
EndText: ^
-
GI: BIBLIOGRAPHY
StartText: ^\n\\makebib^
EndText: ^
-
GI: GLOSSARY
StartText: ^% This document wants a glossary:\s
EndText: ^
-
# ______________________________________________________________________
# Set page number to 1 (roman) for TOC and friends
GI: AUGMENTUM
Context: OSF-BOOK
StartText: ^\\setcounter{page}{1}^
EndText: ^
-
GI: NAVIGATION
-
GI: HY-LOCATOR
Ignore: all
-
# ignore until we know how to process these
GI: HY-CONCEPT
Context: META
Ignore: all
-
GI: HY-CONCEPT
Ignore: all
-
GI: HY-DEF
-
GI: HY-TERM
-
# ----
GI: ENTRY
AttValue: DAVROLE glossary
StartText: {
EndText: }
-
GI: ENTRY
AttValue: DAVROLE index
StartText: {
EndText: }
#StartText: \\index{
#EndText: }
-
GI: ENTRY
-
# ----
GI: XREF
AttValue: OSFROLE gettitle
StartText: Get-Title
-
GI: XREF
AttValue: OSFROLE getnumber
#StartText: Get-Division-Number
EndText: \ \\ref{${LINKEND}}
-
GI: XREF
AttValue: OSFROLE getpage
EndText: \ \\pageref{${LINKEND}}
-
GI: XREF
-
# ----
GI: HY-BIB-DESCRIPTION
StartText: {\\it\s
EndText: }
-
# ______________________________________________________________________
GI: META
StartText: ^% start meta^
EndText: ^% end meta^
-
GI: DOC-ID
#StartText: ^.ad r^.S 20^.SP 1.5i^.\\" start doc id^
#EndText: ^.ad b^.br^.\\" end doc id^
-
GI: AUTHOR-INFO
StartText: ^\\begin{flushright}^
EndText: ^\\end{flushright}^
-
GI: PERSON
Context: AUTHOR-INFO
StartText: ^\\author{
EndText: }^
-
GI: AUTH-AFFILIATION
StartText: ^\\author{
EndText: }^
-
GI: ADDRESS
StartText: ^
EndText: \\\\^
-
GI: VALID-DATE
-
GI: PRODUCT
StartText: ^% PRODUCT...\s
EndText: ^
-
GI: PRODUCT-NAME
StartText: ^% PRODUCT-NAME...\s
EndText: ^
-
GI: PRODUCT-VERSION
StartText: ^%\s
-
GI: NOTICES
StartText: ^
-
GI: DISCLAIMER
StartText: ^\n
EndText: ^\n
-
GI: COPYRIGHTS
StartText: ^
-
GI: COPYRIGHT-NOTICE
EndText: ^
-
GI: OWNER
StartText: \\def\\copOwn{
EndText: }
-
# yes, a hack...
GI: STATEMENT
Context: COPYRIGHT-NOTICE
StartText: ^Copyright \\copyright{} \\copYr{} \\copOwn\\hfill\\\\
EndText: ^
-
GI: STATEMENT
StartText: \s
-
GI: TRADEMARKS
StartText: ^\\vskip 2em
-
GI: TRADEMARK-PAIR
StartText: ^
EndText: \\\\^
-
GI: PRODUCT-ID
StartText: ^
-
GI: AUDIENCE
StartText: ^\n
EndText: ^
-
# ______________________________________________________________________
GI: REV-BRACKET
StartText: \\osfrev{}
-
GI: I18N-BRACKET
-
GI: REV-DESCRIPTION
-
GI: OCCURRENCES
-
GI: OCC-ASYNC
-
GI: OCC-SYNC
-
GI: DESC-POOL
Ignore: all
-
GI: REV-DESCRIPTION
-
# ______________________________________________________________________
#GI: GRAPHIC
#StartText: ${NOTATION} graphic from file ${NAME} goes here.
#EndText: ^
#-
GI: GRAPHIC
Context: DISPLAY
StartText: ^\\begin{center}\\ ^\\psfig{figure=${_filename}}
EndText: ^\\end{center}^
-
GI: GRAPHIC
StartText: \\psfig{figure=${_filename}}
#EndText: }
-
GI: EQUATION
Context: DISPLAY
StartText: \\begin{center}^\$\$
EndText: \$\$\\end{center}^
-
GI: EQUATION
StartText: {\$
EndText: \$}
-
# ______________________________________________________________________
#
# For the "book.sty" LaTeX style
#
GI: _Start
StartText: ^\n\\documentstyle[11pt,osf-extras,osf-ref]{article}^
-
GI: _End
EndText: ^
-
GI: _Comment
StartText: ^%\s
EndText: ^
-
# ______________________________________________________________________

View file

@ -0,0 +1,45 @@
# Copyright (c) 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
# All rights reserved
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# This will extract the name(s) and purpose(s) from and osf-refpage
# instance. The first line is category attr of osf-refpage.
# The second line is "REF-NAME: ", then the main name/purpose
# (ref-name/ref-purpose). (name/purpose are separated by a single tab.)
# Subsequent lines are, "SUB-NAME: ", then sub-name/sub-purpose.
#
# Usage: instant -t refname.ts your-document.esis
#
GI: OSF-REFPAGE
StartText: CATEGORY: ${CATEGORY x}
EndText: ^
-
GI: REF-NAME SUB-NAME
StartText: ^${_gi}:\s
-
GI: REF-PURPOSE SUB-PURPOSE
StartText: \t
EndText: ^
-
GI: RSECTION
Ignore: all
-
Relation: ancestor REF-NAME
-
GI: *
Ignore: data
-

View file

@ -0,0 +1,22 @@
#
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Character strings to map for troff/nroff.
#
# From To
#\\ \\e
^ \^

View file

@ -0,0 +1,557 @@
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# SDATA entity mappings to TeX instructions.
# sgmls outputs sdata references in the form: \\|[mdash ]\\|
#
# J.Bowe, 1993
#
# Numeric and Special Graphic ________________________________
#
[half ] \\(12
[frac12] \\(12
[frac14] \\(14
[frac34] \\(34
# [frac18] =fraction one-eighth
# [frac38] =fraction three-eighths
# [frac58] =fraction five-eighths
# [frac78] =fraction seven-eighths
[sup1 ] \\u1\\l
[sup2 ] \\u2\\l
[sup3 ] \\u3\\l
[plus ] \\(pl
[plusmn] \\(+-
[lt ] <
[equals] =
[gt ] >
[divide] \\(di
[times ] \\(ti
# [curren] =general currency sign
[pound ] #
[dollar] $
[cent ] \\(ct
# [yen ] /yen =yen sign
[num ] #
[percnt] %
[amp ] &
[ast ] *
[commat] @
[lsqb ] [
[bsol ] \\e
[rsqb ] ]
[lcub ] { /lbrace O: =left curly bracket
# [horbar] =horizontal bar
[verbar] \\(or
[rcub ] }
[micro ] \\(*m
[ohm ] \\(*W
[deg ] \\(de
# [ordm ] =ordinal indicator, masculine
# [ordf ] =ordinal indicator, feminine
[sect ] \\(sc
# [para ] =pilcrow (paragraph sign)
# [middot] /centerdot B: =middle dot
[larr ] \\(<-
[rarr ] \\(->
[uarr ] \\(ua
[darr ] \\(da
[copy ] \\(co
[reg ] \\(rg
# [trade ] =trade mark sign
# [brvbar] =broken (vertical) bar
[not ] \\(no
# [sung ] =music note (sung text sign)
[excl ] !
# [iexcl ] =inverted exclamation mark
# [quot ] =quotation mark
[apos ] '
[lpar ] (
[rpar ] )
[comma ] ,
[lowbar] _
[hyphen] \\-
[period] .
[sol ] /
[colon ] :
[semi ] ;
[quest ] ?
# [iquest] =inverted question mark
# [laquo ] =angle quotation mark, left
# [raquo ] =angle quotation mark, right
# [lsquo ] =single quotation mark, left
# [rsquo ] =single quotation mark, right
# [ldquo ] =double quotation mark, left
# [rdquo ] =double quotation mark, right
# [nbsp ] =no break (required) space
# [shy ] =soft hyphen
#
# Publishing ________________________________
#
# trailing space here
[emsp ] \\ \\
[ensp ] \\
# [emsp3 ] =1/3-em space
# [emsp4 ] =1/4-em space
[numsp ] \\0
# [puncsp] =punctuation space (width of comma)
[thinsp] \\!
[hairsp] \\\^
[mdash ] \\*(em
[ndash ] -
[dash ] -
# [blank ] =significant blank symbol
# [hellip] =ellipsis (horizontal)
# [nldr ] =double baseline dot (en leader)
# [frac13] =fraction one-third
# [frac23] =fraction two-thirds
# [frac15] =fraction one-fifth
# [frac25] =fraction two-fifths
# [frac35] =fraction three-fifths
# [frac45] =fraction four-fifths
# [frac16] =fraction one-sixth
# [frac56] =fraction five-sixths
# [incare] =in-care-of symbol
# [block ] =full block
# [uhblk ] =upper half block
# [lhblk ] =lower half block
# [blk14 ] =25% shaded block
# [blk12 ] =50% shaded block
# [blk34 ] =75% shaded block
# [marker] =histogram marker
# [cir ] \\(ci
[squ ] \\(sq
# [rect ] =rectangle, open
# [utri ] /triangle =up triangle, open
# [dtri ] /triangledown =down triangle, open
[star ] \\(** =star, open
[bull ] \\(bu
# [squf ] /blacksquare =sq bullet, filled
# [utrif ] /blacktriangle =up tri, filled
# [dtrif ] /blacktriangledown =dn tri, filled
# [ltrif ] /blacktriangleleft R: =l tri, filled
# [rtrif ] /blacktriangleright R: =r tri, filled
# [clubs ] /clubsuit =club suit symbol
# [diams ] /diamondsuit =diamond suit symbol
# [hearts] /heartsuit =heart suit symbol
# [spades] /spadesuit =spades suit symbol
# [malt ] /maltese =maltese cross
[dagger] \\(dg
[Dagger] \\(dd
# [check ] /checkmark =tick, check mark
# [ballot] =ballot cross
# [sharp ] /sharp =musical sharp
# [flat ] /flat =musical flat
# [male ] =male symbol
# [female] =female symbol
# [phone ] =telephone symbol
# [telrec] =telephone recorder symbol
# [copysr] =sound recording copyright sign
[caret ] \^
[lsquor] `
[ldquor] ``
[fflig ] \\(ff
[filig ] \\(fi
# [fjlig ] small fj ligature
[ffilig] \\(Fi
[ffllig] \\(Fl
[fllig ] \\(fl
# [mldr ] em leader
[rdquor] ''
[rsquor] '
# [vellip] vertical ellipsis
# [hybull] rectangle, filled (hyphen bullet)
# [loz ] /lozenge - lozenge or total mark
# [lozf ] /blacklozenge - lozenge, filled
# [ltri ] /triangleleft B: l triangle, open
# [rtri ] /triangleright B: r triangle, open
# [starf ] /bigstar - star, filled
# [natur ] /natural - music natural
# [rx ] pharmaceutical prescription (Rx)
# [sext ] sextile (6-pointed star)
# [target] register mark or target
# [dlcrop] downward left crop mark
# [drcrop] downward right crop mark
# [ulcrop] upward left crop mark
# [urcrop] upward right crop mark
#
# Added Latin 1 ________________________________
#
# [aacute] =small a, acute accent
# [Aacute] =capital A, acute accent
# [acirc ] =small a, circumflex accent
# [Acirc ] =capital A, circumflex accent
# [agrave] =small a, grave accent
# [Agrave] =capital A, grave accent
# [aring ] =small a, ring
# [Aring ] =capital A, ring
# [atilde] =small a, tilde
# [Atilde] =capital A, tilde
# [auml ] =small a, dieresis or umlaut mark
# [Auml ] =capital A, dieresis or umlaut mark
# [aelig ] =small ae diphthong (ligature)
# [AElig ] =capital AE diphthong (ligature)
# [ccedil] =small c, cedilla
# [Ccedil] =capital C, cedilla
# [eth ] =small eth, Icelandic
# [ETH ] =capital Eth, Icelandic
# [eacute] =small e, acute accent
# [Eacute] =capital E, acute accent
# [ecirc ] =small e, circumflex accent
# [Ecirc ] =capital E, circumflex accent
# [egrave] =small e, grave accent
# [Egrave] =capital E, grave accent
# [euml ] =small e, dieresis or umlaut mark
# [Euml ] =capital E, dieresis or umlaut mark
# [iacute] =small i, acute accent
# [Iacute] =capital I, acute accent
# [icirc ] =small i, circumflex accent
# [Icirc ] =capital I, circumflex accent
# [igrave] =small i, grave accent
# [Igrave] =capital I, grave accent
# [iuml ] =small i, dieresis or umlaut mark
# [Iuml ] =capital I, dieresis or umlaut mark
# [ntilde] =small n, tilde
# [Ntilde] =capital N, tilde
# [oacute] =small o, acute accent
# [Oacute] =capital O, acute accent
# [ocirc ] =small o, circumflex accent
# [Ocirc ] =capital O, circumflex accent
# [ograve] =small o, grave accent
# [Ograve] =capital O, grave accent
# [oslash] =small o, slash
# [Oslash] =capital O, slash
# [otilde] =small o, tilde
# [Otilde] =capital O, tilde
# [ouml ] =small o, dieresis or umlaut mark
# [Ouml ] =capital O, dieresis or umlaut mark
# [szlig ] =small sharp s, German (sz ligature)
# [thorn ] =small thorn, Icelandic
# [THORN ] =capital THORN, Icelandic
# [uacute] =small u, acute accent
# [Uacute] =capital U, acute accent
# [ucirc ] =small u, circumflex accent
# [Ucirc ] =capital U, circumflex accent
# [ugrave] =small u, grave accent
# [Ugrave] =capital U, grave accent
# [uuml ] =small u, dieresis or umlaut mark
# [Uuml ] =capital U, dieresis or umlaut mark
# [yacute] =small y, acute accent
# [Yacute] =capital Y, acute accent
# [yuml ] =small y, dieresis or umlaut mark
#
# Added Latin 2 ________________________________
#
# [abreve] =small a, breve
# [Abreve] =capital A, breve
# [amacr ] =small a, macron
# [Amacr ] =capital A, macron
# [aogon ] =small a, ogonek
# [Aogon ] =capital A, ogonek
# [cacute] =small c, acute accent
# [Cacute] =capital C, acute accent
# [ccaron] =small c, caron
# [Ccaron] =capital C, caron
# [ccirc ] =small c, circumflex accent
# [Ccirc ] =capital C, circumflex accent
# [cdot ] =small c, dot above
# [Cdot ] =capital C, dot above
# [dcaron] =small d, caron
# [Dcaron] =capital D, caron
# [dstrok] =small d, stroke
# [Dstrok] =capital D, stroke
# [ecaron] =small e, caron
# [Ecaron] =capital E, caron
# [edot ] =small e, dot above
# [Edot ] =capital E, dot above
# [emacr ] =small e, macron
# [Emacr ] =capital E, macron
# [eogon ] =small e, ogonek
# [Eogon ] =capital E, ogonek
# [gacute] =small g, acute accent
# [gbreve] =small g, breve
# [Gbreve] =capital G, breve
# [Gcedil] =capital G, cedilla
# [gcirc ] =small g, circumflex accent
# [Gcirc ] =capital G, circumflex accent
# [gdot ] =small g, dot above
# [Gdot ] =capital G, dot above
# [hcirc ] =small h, circumflex accent
# [Hcirc ] =capital H, circumflex accent
# [hstrok] =small h, stroke
# [Hstrok] =capital H, stroke
# [Idot ] =capital I, dot above
# [Imacr ] =capital I, macron
# [imacr ] =small i, macron
# [ijlig ] =small ij ligature
# [IJlig ] =capital IJ ligature
# [inodot] =small i without dot
# [iogon ] =small i, ogonek
# [Iogon ] =capital I, ogonek
# [itilde] =small i, tilde
# [Itilde] =capital I, tilde
# [jcirc ] =small j, circumflex accent
# [Jcirc ] =capital J, circumflex accent
# [kcedil] =small k, cedilla
# [Kcedil] =capital K, cedilla
# [kgreen] =small k, Greenlandic
# [lacute] =small l, acute accent
# [Lacute] =capital L, acute accent
# [lcaron] =small l, caron
# [Lcaron] =capital L, caron
# [lcedil] =small l, cedilla
# [Lcedil] =capital L, cedilla
# [lmidot] =small l, middle dot
# [Lmidot] =capital L, middle dot
# [lstrok] =small l, stroke
# [Lstrok] =capital L, stroke
# [nacute] =small n, acute accent
# [Nacute] =capital N, acute accent
# [eng ] =small eng, Lapp
# [ENG ] =capital ENG, Lapp
# [napos ] =small n, apostrophe
# [ncaron] =small n, caron
# [Ncaron] =capital N, caron
# [ncedil] =small n, cedilla
# [Ncedil] =capital N, cedilla
# [odblac] =small o, double acute accent
# [Odblac] =capital O, double acute accent
# [Omacr ] =capital O, macron
# [omacr ] =small o, macron
# [oelig ] =small oe ligature
# [OElig ] =capital OE ligature
# [racute] =small r, acute accent
# [Racute] =capital R, acute accent
# [rcaron] =small r, caron
# [Rcaron] =capital R, caron
# [rcedil] =small r, cedilla
# [Rcedil] =capital R, cedilla
# [sacute] =small s, acute accent
# [Sacute] =capital S, acute accent
# [scaron] =small s, caron
# [Scaron] =capital S, caron
# [scedil] =small s, cedilla
# [Scedil] =capital S, cedilla
# [scirc ] =small s, circumflex accent
# [Scirc ] =capital S, circumflex accent
# [tcaron] =small t, caron
# [Tcaron] =capital T, caron
# [tcedil] =small t, cedilla
# [Tcedil] =capital T, cedilla
# [tstrok] =small t, stroke
# [Tstrok] =capital T, stroke
# [ubreve] =small u, breve
# [Ubreve] =capital U, breve
# [udblac] =small u, double acute accent
# [Udblac] =capital U, double acute accent
# [umacr ] =small u, macron
# [Umacr ] =capital U, macron
# [uogon ] =small u, ogonek
# [Uogon ] =capital U, ogonek
# [uring ] =small u, ring
# [Uring ] =capital U, ring
# [utilde] =small u, tilde
# [Utilde] =capital U, tilde
# [wcirc ] =small w, circumflex accent
# [Wcirc ] =capital W, circumflex accent
# [ycirc ] =small y, circumflex accent
# [Ycirc ] =capital Y, circumflex accent
# [Yuml ] =capital Y, dieresis or umlaut mark
# [zacute] =small z, acute accent
# [Zacute] =capital Z, acute accent
# [zcaron] =small z, caron
# [Zcaron] =capital Z, caron
# [zdot ] =small z, dot above
# [Zdot ] =capital Z, dot above
#
# Greek Letters ________________________________
#
[agr ] \\(*a
[Agr ] \\(*A
[bgr ] \\(*b
[Bgr ] \\(*B
[ggr ] \\(*g
[Ggr ] \\(*G
[dgr ] \\(*d
[Dgr ] \\(*D
[egr ] \\(*e
[Egr ] \\(*E
[zgr ] \\(*z
[Zgr ] \\(*Z
[eegr ] \\(*y
[EEgr ] \\(*Y
[thgr ] \\(*h
[THgr ] \\(*H
[igr ] \\(*i
[Igr ] \\(*I
[kgr ] \\(*k
[Kgr ] \\(*K
[lgr ] \\(*l
[Lgr ] \\(*L
[mgr ] \\(*m
[Mgr ] \\(*M
[ngr ] \\(*n
[Ngr ] \\(*N
[xgr ] \\(*c
[Xgr ] \\(*C
[ogr ] \\(*o
[Ogr ] \\(*O
[pgr ] \\(*p
[Pgr ] \\(*P
[rgr ] \\(*r
[Rgr ] \\(*R
[sgr ] \\(*s
[Sgr ] \\(*S
[sfgr ] \\(ts
[tgr ] \\(*t
[Tgr ] \\(*T
[ugr ] \\(*u
[Ugr ] \\(*U
[phgr ] \\(*f
[PHgr ] \\(*F
[khgr ] \\(*x
[KHgr ] \\(*X
[psgr ] \\(*q
[PSgr ] \\(*Q
[ohgr ] \\(*w
[OHgr ] \\(*W
#
# Greek Symbols ________________________________
#
[alpha ] \\(*a
[beta ] \\(*b
[gamma ] \\(*g
[Gamma ] \\(*G
# [gammad] /digamma
[delta ] \\(*d
[Delta ] \\(*D
[epsi ] \\(*e
# [epsiv ] /varepsilon
[epsis ] \\(*e
[zeta ] \\(*z
[eta ] \\(*y
[thetas] \\(*h
[Theta ] \\(*H
# [thetav] /vartheta - curly or open theta
[iota ] \\(*i
[kappa ] \\(*k
# [kappav] /varkappa
[lambda] \\(*l
[Lambda] \\(*L
[mu ] \\(*m
[nu ] \\(*n
[xi ] \\(*c
[Xi ] \\(*C
[pi ] \\(*p
# [piv ] /varpi
[Pi ] \\(*P
[rho ] \\(*r
# [rhov ] /varrho
[sigma ] \\(*s
[Sigma ] \\(*S
# [sigmav] /varsigma
[tau ] \\(*t
[upsi ] \\(*u
[Upsi ] \\(*U
[phis ] \\(*f
[Phi ] \\(*F
# [phiv ] /varphi - curly or open phi
[chi ] \\(*x
[psi ] \\(*q
[Psi ] \\(*X
[omega ] \\(*w
[Omega ] \\(*W
#
# General Technical ________________________________
#
# [aleph ] /aleph =aleph, Hebrew
# [and ] /wedge /land B: =logical and
# [ang90 ] =right (90 degree) angle
# [angsph] /sphericalangle =angle-spherical
[ap ] \\(ap
# [becaus] /because R: =because
# [bottom] /bot B: =perpendicular
# [cap ] /cap B: =intersection
# [cong ] /cong R: =congruent with
# [conint] /oint L: =contour integral operator
# [cup ] /cup B: =union or logical sum
[equiv ] \\(==
# [exist ] /exists =at least one exists
# [forall] /forall =for all
# [fnof ] =function of (italic small f)
[ge ] \\(>=
# [iff ] /iff =if and only if
[infin ] \\(if
# [int ] /int L: =integral operator
[isin ] \\(sb
# [lang ] /langle O: =left angle bracket
# [lArr ] /Leftarrow A: =is implied by
[le ] \\(<=
[minus ] \\(mi
# [mnplus] /mp B: =minus-or-plus sign
# [nabla ] /nabla =del, Hamilton operator
[ne ] \\(!=
# [ni ] /ni /owns R: =contains
# [or ] /vee /lor B: =logical or
# [par ] /parallel R: =parallel
# [part ] /partial =partial differential
# [permil] =per thousand
# [perp ] /perp R: =perpendicular
# [prime ] /prime =prime or minute
# [Prime ] =double prime or second
[prop ] \\(pt
# [radic ] /surd =radical
# [rang ] /rangle C: =right angle bracket
# [rArr ] /Rightarrow A: =implies
# [sim ] /sim R: =similar
# [sime ] /simeq R: =similar, equals
[square] \\(sq
[sub ] \\(sb
[sube ] \\(ib
[sup ] \\(sp
[supe ] \\(ip
# [there4] /therefore R: =therefore
# [Verbar] /Vert =dbl vertical bar
# [angst ] Angstrom =capital A, ring
# [bernou] Bernoulli function (script capital B)
# [compfn] B: composite function (small circle)
# [Dot ] =dieresis or umlaut mark
# [DotDot] four dots above
# [hamilt] Hamiltonian (script capital H)
# [lagran] Lagrangian (script capital L)
# [lowast] low asterisk
# [notin ] N: negated set membership
# [order ] order of (script small o)
# [phmmat] physics M-matrix (script capital M)
# [tdot ] three dots above
# [tprime] triple prime
# [wedgeq] R: corresponds to (wedge, equals)
#
# Diacritical Marks ________________________________
#
# [acute ] =acute accent
# [breve ] =breve
# [caron ] =caron
# [cedil ] =cedilla
# [circ ] =circumflex accent
# [dblac ] =double acute accent
# [die ] =dieresis
# [dot ] =dot above
# [grave ] =grave accent
# [macr ] =macron
# [ogon ] =ogonek
# [ring ] =ring
[tilde ] ~
# [uml ] =umlaut mark
#

View file

@ -0,0 +1,23 @@
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# Character strings to map for SGML.
#
# From To
< &lt;
> &gt;
& &amp;

View file

@ -0,0 +1,557 @@
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# SDATA entity mappings BACK to entity references.
# I think this is only usefule for creating a normalized instance.
#
# J.Bowe, 1993
#
# Numeric and Special Graphic ________________________________
#
[half ] &half;
[frac12] &frac12;
[frac14] &frac14;
[frac34] &frac34;
[frac18] &frac18;
[frac38] &frac38;
[frac58] &frac58;
[frac78] &frac78;
[sup1 ] &sup1;
[sup2 ] &sup2;
[sup3 ] &sup3;
[plus ] &plus;
[plusmn] &plusmn;
[lt ] &lt;
[equals] &equals;
[gt ] &gt;
[divide] &divide;
[times ] &times;
[curren] &curren;
[pound ] &pound;
[dollar] &dollar;
[cent ] &cent;
[yen ] &yen;
[num ] &num;
[percnt] &percnt;
[amp ] &amp;
[ast ] &ast;
[commat] &commat;
[lsqb ] &lsqb;
[bsol ] &bsol;
[rsqb ] &rsqb;
[lcub ] &lcub;
[horbar] &horbar;
[verbar] &verbar;
[rcub ] &rcub;
[micro ] &micro;
[ohm ] &ohm;
[deg ] &deg;
[ordm ] &ordm;
[ordf ] &ordf;
[sect ] &sect;
[para ] &para;
[middot] &middot;
[larr ] &larr;
[rarr ] &rarr;
[uarr ] &uarr;
[darr ] &darr;
[copy ] &copy;
[reg ] &reg;
[trade ] &trade;
[brvbar] &brvbar;
[not ] &not;
[sung ] &sung;
[excl ] &excl;
[iexcl ] &iexcl;
[quot ] &quot;
[apos ] &apos;
[lpar ] &lpar;
[rpar ] &rpar;
[comma ] &comma;
[lowbar] &lowbar;
[hyphen] &hyphen;
[period] &period;
[sol ] &sol;
[colon ] &colon;
[semi ] &semi;
[quest ] &quest;
[iquest] &iquest;
[laquo ] &laquo;
[raquo ] &raquo;
[lsquo ] &lsquo;
[rsquo ] &rsquo;
[ldquo ] &ldquo;
[rdquo ] &rdquo;
[nbsp ] &nbsp;
[shy ] &shy;
#
# Publishing ________________________________
#
[emsp ] &emsp;
[ensp ] &ensp;
[emsp3 ] &emsp3;
[emsp4 ] &emsp4;
[numsp ] &numsp;
[puncsp] &puncsp;
[thinsp] &thinsp;
[hairsp] &hairsp;
[mdash ] &mdash;
[ndash ] &ndash;
[dash ] &dash;
[blank ] &blank;
[hellip] &hellip;
[nldr ] &nldr;
[frac13] &frac13;
[frac23] &frac23;
[frac15] &frac15;
[frac25] &frac25;
[frac35] &frac35;
[frac45] &frac45;
[frac16] &frac16;
[frac56] &frac56;
[incare] &incare;
[block ] &block;
[uhblk ] &uhblk;
[lhblk ] &lhblk;
[blk14 ] &blk14;
[blk12 ] &blk12;
[blk34 ] &blk34;
[marker] &marker;
[cir ] &cir;
[squ ] &squ;
[rect ] &rect;
[utri ] &utri;
[dtri ] &dtri;
[star ] &star;
[bull ] &bull;
[squf ] &squf;
[utrif ] &utrif;
[dtrif ] &dtrif;
[ltrif ] &ltrif;
[rtrif ] &rtrif;
[clubs ] &clubs;
[diams ] &diams;
[hearts] &hearts;
[spades] &spades;
[malt ] &malt;
[dagger] &dagger;
[Dagger] &Dagger;
[check ] &check;
[ballot] &ballot;
[sharp ] &sharp;
[flat ] &flat;
[male ] &male;
[female] &female;
[phone ] &phone;
[telrec] &telrec;
[copysr] &copysr;
[caret ] &caret;
[lsquor] &lsquor;
[ldquor] &ldquor;
[fflig ] &fflig;
[filig ] &filig;
[fjlig ] &fjlig;
[ffilig] &ffilig;
[ffllig] &ffllig;
[fllig ] &fllig;
[mldr ] &mldr;
[rdquor] &rdquor;
[rsquor] &rsquor;
[vellip] &vellip;
[hybull] &hybull;
[loz ] &loz;
[lozf ] &lozf;
[ltri ] &ltri;
[rtri ] &rtri;
[starf ] &starf;
[natur ] &natur;
[rx ] &rx;
[sext ] &sext;
[target] &target;
[dlcrop] &dlcrop;
[drcrop] &drcrop;
[ulcrop] &ulcrop;
[urcrop] &urcrop;
#
# Added Latin 1 ________________________________
#
[aacute] &aacute;
[Aacute] &Aacute;
[acirc ] &acirc;
[Acirc ] &Acirc;
[agrave] &agrave;
[Agrave] &Agrave;
[aring ] &aring;
[Aring ] &Aring;
[atilde] &atilde;
[Atilde] &Atilde;
[auml ] &auml;
[Auml ] &Auml;
[aelig ] &aelig;
[AElig ] &AElig;
[ccedil] &ccedil;
[Ccedil] &Ccedil;
[eth ] &eth;
[ETH ] &ETH;
[eacute] &eacute;
[Eacute] &Eacute;
[ecirc ] &ecirc;
[Ecirc ] &Ecirc;
[egrave] &egrave;
[Egrave] &Egrave;
[euml ] &euml;
[Euml ] &Euml;
[iacute] &iacute;
[Iacute] &Iacute;
[icirc ] &icirc;
[Icirc ] &Icirc;
[igrave] &igrave;
[Igrave] &Igrave;
[iuml ] &iuml;
[Iuml ] &Iuml;
[ntilde] &ntilde;
[Ntilde] &Ntilde;
[oacute] &oacute;
[Oacute] &Oacute;
[ocirc ] &ocirc;
[Ocirc ] &Ocirc;
[ograve] &ograve;
[Ograve] &Ograve;
[oslash] &oslash;
[Oslash] &Oslash;
[otilde] &otilde;
[Otilde] &Otilde;
[ouml ] &ouml;
[Ouml ] &Ouml;
[szlig ] &szlig;
[thorn ] &thorn;
[THORN ] &THORN;
[uacute] &uacute;
[Uacute] &Uacute;
[ucirc ] &ucirc;
[Ucirc ] &Ucirc;
[ugrave] &ugrave;
[Ugrave] &Ugrave;
[uuml ] &uuml;
[Uuml ] &Uuml;
[yacute] &yacute;
[Yacute] &Yacute;
[yuml ] &yuml;
#
# Added Latin 2 ________________________________
#
[abreve] &abreve;
[Abreve] &Abreve;
[amacr ] &amacr;
[Amacr ] &Amacr;
[aogon ] &aogon;
[Aogon ] &Aogon;
[cacute] &cacute;
[Cacute] &Cacute;
[ccaron] &ccaron;
[Ccaron] &Ccaron;
[ccirc ] &ccirc;
[Ccirc ] &Ccirc;
[cdot ] &cdot;
[Cdot ] &Cdot;
[dcaron] &dcaron;
[Dcaron] &Dcaron;
[dstrok] &dstrok;
[Dstrok] &Dstrok;
[ecaron] &ecaron;
[Ecaron] &Ecaron;
[edot ] &edot;
[Edot ] &Edot;
[emacr ] &emacr;
[Emacr ] &Emacr;
[eogon ] &eogon;
[Eogon ] &Eogon;
[gacute] &gacute;
[gbreve] &gbreve;
[Gbreve] &Gbreve;
[Gcedil] &Gcedil;
[gcirc ] &gcirc;
[Gcirc ] &Gcirc;
[gdot ] &gdot;
[Gdot ] &Gdot;
[hcirc ] &hcirc;
[Hcirc ] &Hcirc;
[hstrok] &hstrok;
[Hstrok] &Hstrok;
[Idot ] &Idot;
[Imacr ] &Imacr;
[imacr ] &imacr;
[ijlig ] &ijlig;
[IJlig ] &IJlig;
[inodot] &inodot;
[iogon ] &iogon;
[Iogon ] &Iogon;
[itilde] &itilde;
[Itilde] &Itilde;
[jcirc ] &jcirc;
[Jcirc ] &Jcirc;
[kcedil] &kcedil;
[Kcedil] &Kcedil;
[kgreen] &kgreen;
[lacute] &lacute;
[Lacute] &Lacute;
[lcaron] &lcaron;
[Lcaron] &Lcaron;
[lcedil] &lcedil;
[Lcedil] &Lcedil;
[lmidot] &lmidot;
[Lmidot] &Lmidot;
[lstrok] &lstrok;
[Lstrok] &Lstrok;
[nacute] &nacute;
[Nacute] &Nacute;
[eng ] &eng;
[ENG ] &ENG;
[napos ] &napos;
[ncaron] &ncaron;
[Ncaron] &Ncaron;
[ncedil] &ncedil;
[Ncedil] &Ncedil;
[odblac] &odblac;
[Odblac] &Odblac;
[Omacr ] &Omacr;
[omacr ] &omacr;
[oelig ] &oelig;
[OElig ] &OElig;
[racute] &racute;
[Racute] &Racute;
[rcaron] &rcaron;
[Rcaron] &Rcaron;
[rcedil] &rcedil;
[Rcedil] &Rcedil;
[sacute] &sacute;
[Sacute] &Sacute;
[scaron] &scaron;
[Scaron] &Scaron;
[scedil] &scedil;
[Scedil] &Scedil;
[scirc ] &scirc;
[Scirc ] &Scirc;
[tcaron] &tcaron;
[Tcaron] &Tcaron;
[tcedil] &tcedil;
[Tcedil] &Tcedil;
[tstrok] &tstrok;
[Tstrok] &Tstrok;
[ubreve] &ubreve;
[Ubreve] &Ubreve;
[udblac] &udblac;
[Udblac] &Udblac;
[umacr ] &umacr;
[Umacr ] &Umacr;
[uogon ] &uogon;
[Uogon ] &Uogon;
[uring ] &uring;
[Uring ] &Uring;
[utilde] &utilde;
[Utilde] &Utilde;
[wcirc ] &wcirc;
[Wcirc ] &Wcirc;
[ycirc ] &ycirc;
[Ycirc ] &Ycirc;
[Yuml ] &Yuml;
[zacute] &zacute;
[Zacute] &Zacute;
[zcaron] &zcaron;
[Zcaron] &Zcaron;
[zdot ] &zdot;
[Zdot ] &Zdot;
#
# Greek Letters ________________________________
#
[agr ] &agr;
[Agr ] &Agr;
[bgr ] &bgr;
[Bgr ] &Bgr;
[ggr ] &ggr;
[Ggr ] &Ggr;
[dgr ] &dgr;
[Dgr ] &Dgr;
[egr ] &egr;
[Egr ] &Egr;
[zgr ] &zgr;
[Zgr ] &Zgr;
[eegr ] &eegr;
[EEgr ] &EEgr;
[thgr ] &thgr;
[THgr ] &THgr;
[igr ] &igr;
[Igr ] &Igr;
[kgr ] &kgr;
[Kgr ] &Kgr;
[lgr ] &lgr;
[Lgr ] &Lgr;
[mgr ] &mgr;
[Mgr ] &Mgr;
[ngr ] &ngr;
[Ngr ] &Ngr;
[xgr ] &xgr;
[Xgr ] &Xgr;
[ogr ] &ogr;
[Ogr ] &Ogr;
[pgr ] &pgr;
[Pgr ] &Pgr;
[rgr ] &rgr;
[Rgr ] &Rgr;
[sgr ] &sgr;
[Sgr ] &Sgr;
[sfgr ] &sfgr;
[tgr ] &tgr;
[Tgr ] &Tgr;
[ugr ] &ugr;
[Ugr ] &Ugr;
[phgr ] &phgr;
[PHgr ] &PHgr;
[khgr ] &khgr;
[KHgr ] &KHgr;
[psgr ] &psgr;
[PSgr ] &PSgr;
[ohgr ] &ohgr;
[OHgr ] &OHgr;
#
# Greek Symbols ________________________________
#
[alpha ] &alpha;
[beta ] &beta;
[gamma ] &gamma;
[Gamma ] &Gamma;
[gammad] &gammad;
[delta ] &delta;
[Delta ] &Delta;
[epsi ] &epsi;
[epsiv ] &epsiv;
[epsis ] &epsis;
[zeta ] &zeta;
[eta ] &eta;
[thetas] &thetas;
[Theta ] &Theta;
[thetav] &thetav;
[iota ] &iota;
[kappa ] &kappa;
[kappav] &kappav;
[lambda] &lambda;
[Lambda] &Lambda;
[mu ] &mu;
[nu ] &nu;
[xi ] &xi;
[Xi ] &Xi;
[pi ] &pi;
[piv ] &piv;
[Pi ] &Pi;
[rho ] &rho;
[rhov ] &rhov;
[sigma ] &sigma;
[Sigma ] &Sigma;
[sigmav] &sigmav;
[tau ] &tau;
[upsi ] &upsi;
[Upsi ] &Upsi;
[phis ] &phis;
[Phi ] &Phi;
[phiv ] &phiv;
[chi ] &chi;
[psi ] &psi;
[Psi ] &Psi;
[omega ] &omega;
[Omega ] &Omega;
#
# General Technical ________________________________
#
[aleph ] &aleph;
[and ] &and;
[ang90 ] &ang90;
[angsph] &angsph;
[ap ] &ap;
[becaus] &becaus;
[bottom] &bottom;
[cap ] &cap;
[cong ] &cong;
[conint] &conint;
[cup ] &cup;
[equiv ] &equiv;
[exist ] &exist;
[forall] &forall;
[fnof ] &fnof;
[ge ] &ge;
[iff ] &iff;
[infin ] &infin;
[int ] &int;
[isin ] &isin;
[lang ] &lang;
[lArr ] &lArr;
[le ] &le;
[minus ] &minus;
[mnplus] &mnplus;
[nabla ] &nabla;
[ne ] &ne;
[ni ] &ni;
[or ] &or;
[par ] &par;
[part ] &part;
[permil] &permil;
[perp ] &perp;
[prime ] &prime;
[Prime ] &Prime;
[prop ] &prop;
[radic ] &radic;
[rang ] &rang;
[rArr ] &rArr;
[sim ] &sim;
[sime ] &sime;
[square] &square;
[sub ] &sub;
[sube ] &sube;
[sup ] &sup;
[supe ] &supe;
[there4] &there4;
[Verbar] &Verbar;
[angst ] &angst;
[bernou] &bernou;
[compfn] &compfn;
[Dot ] &Dot;
[DotDot] &DotDot;
[hamilt] &hamilt;
[lagran] &lagran;
[lowast] &lowast;
[notin ] &notin;
[order ] &order;
[phmmat] &phmmat;
[tdot ] &tdot;
[tprime] &tprime;
[wedgeq] &wedgeq;
#
# Diacritical Marks ________________________________
#
[acute ] &acute;
[breve ] &breve;
[caron ] &caron;
[cedil ] &cedil;
[circ ] &circ;
[dblac ] &dblac;
[die ] &die;
[dot ] &dot;
[grave ] &grave;
[macr ] &macr;
[ogon ] &ogon;
[ring ] &ring;
[tilde ] &tilde;
[uml ] &uml;
#

View file

@ -0,0 +1,41 @@
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# Character strings to map for TeX.
#
# Be sure \ is first, if you have it.
#
# From To
#\\ \\\\
#[ \\lbrack\s
#] \\rbrack\s
{ \\{
} \\}
% \\%
\# \\#
$ \\$
& \\&
~ \\~
_ \\_
^ \\^
| $\\vert\s$
# comments:
# brackets:
# brackets can screw things up when used within an optinal arg.
# You can't escape them, because that means a displayed equation.
# vertical bar:
# These seem to come out as long (longer than em) dashes. Dunno why.

View file

@ -0,0 +1,571 @@
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# SDATA entity mappings to TeX instructions.
# sgmls outputs sdata references in the form: \\|[mdash ]\\|
#
# I found most of these from the LaTeX and TeX books. I found a few on
# various places around the net.
#
# J.Bowe, 1993
#
# Numeric and Special Graphic ________________________________
#
[half ] $\\scriptstyle{1\\over2}$
[frac12] $\\frac{1}{2}$
[frac14] $\\frac{1}{4}$
[frac34] $\\frac{3}{4}$
[frac18] $\\frac{1}{8}$
[frac38] $\\frac{3}{8}$
[frac58] $\\frac{5}{8}$
[frac78] $\\frac{7}{8}$
#
[sup1 ] $^1$
[sup2 ] $^2$
[sup3 ] $^3$
#
[plus ] $+$
[plusmn] $\\pm$
[lt ] $<$
[equals] $=$
[gt ] $>$
[divide] $\\div$
[times ] $\\times$
#
[curren] [curren]
[pound ] \pounds{}
[dollar] \\$
[cent ] \\hbox{\\rm\\rlap\\/c}
[yen ] [yen]
#
[num ] \\#{}
[percnt] \\%
[amp ] \\&
[ast ] {*}
[commat] @
[lsqb ] $\\lbrack$
[bsol ] $\\backslash$
[rsqb ] $\\rbrack$
[lcub ] $\\lbrace$
[horbar] {--}
[verbar] $|$
[rcub ] $\\rbrace$
[micro ] $\\mu$
[ohm ] $\\Omega$
[deg ] $^\\circ$
[ordm ] [ordm]
[ordf ] [ordf]
[sect ] \\S{}
[para ] \\P{}
[middot] $\\cdot$
[larr ] $\\leftarrow$
[rarr ] $\\rightarrow$
[uarr ] $\\uparrrow$
[darr ] $\\downarrrow$
[copy ] \\copyright{}
[reg ] \\ooalign{\\hfil\\raise.07ex\\hbox{r}\\hfil\\crcr\\mathhexbox20D}
[trade ] {$\\sp{TM}$}
[brvbar] [brvbar]
[not ] $\\neg$
[sung ] [sung]
#
[excl ] !
[iexcl ] {!`}
[quot ] {\\tt\\char`\\"}
[apos ] '
[lpar ] (
[rpar ] )
[comma ] ,
[lowbar] \\_
[hyphen] -
[period] .
[sol ] \\/
[colon ] :
[semi ] ;
[quest ] ?
[iquest] {?`}
[laquo ] \\laquo{}
[raquo ] \\raquo{}
[lsquo ] {`}
[rsquo ] {'}
[ldquo ] {``}
[rdquo ] {''}
[nbsp ] ~
[shy ] \\-
#
# Publishing ________________________________
#
[emsp ] \\hskip1em
[ensp ] \\hskip0.5em
[emsp3 ] \\hskip0.33333em
[emsp4 ] \\hskip0.25em
[numsp ] \\hskip0.5em
[puncsp] \\hskip0.25em
[thinsp] \\hskip0.16667em
[hairsp] \\hskip0.08333em
[mdash ] {---}
[ndash ] {--}
[dash ] {-}
# trailing blank next:
[blank ] \\
[hellip] $\\ldots$
[nldr ] [nldr]
[frac13] $\\frac{1}{3}$
[frac23] $\\frac{2}{3}$
[frac15] $\\frac{1}{5}$
[frac25] $\\frac{2}{5}$
[frac35] $\\frac{3}{5}$
[frac45] $\\frac{4}{5}$
[frac16] $\\frac{1}{6}$
[frac56] $\\frac{5}{6}$
# [incare] =in-care-of symbol
# [block ] =full block
# [uhblk ] =upper half block
# [lhblk ] =lower half block
# [blk14 ] =25% shaded block
# [blk12 ] =50% shaded block
# [blk34 ] =75% shaded block
# [marker] =histogram marker
[cir ] $\\bigcirc$
# [squ ] =square, open
# [rect ] =rectangle, open
[utri ] $\\bigtriangleup$
[dtri ] $\\bigtriangledown$
# [star ] =star, open
[bull ] $\\bullet$
[squf ] {\\vrule height .9ex width .8ex depth -.1ex}
# [utrif ] /blacktriangle =up tri, filled
# [dtrif ] /blacktriangledown =dn tri, filled
# [ltrif ] /blacktriangleleft R: =l tri, filled
# [rtrif ] /blacktriangleright R: =r tri, filled
[clubs ] $\\clubsuit$
[diams ] $\\diamondsuit$
[hearts] $\\heartsuit$
[spades] $\\spadesuit$
# [malt ] /maltese =maltese cross
[dagger] $\\daggar$
[Dagger] $\\ddaggar$
[check ] $\\surd$
[ballot] $\\times$
[sharp ] $\\sharp$
[flat ] $\\flat$
[male ] $\\bigcirc^{\\mkern-5.5mu\\raise.5ex\\hbox{$\\nearrow$}}$
[female] $\\bigcirc\\mkern-15.64mu\\lower1.75ex\\hbox{+}$
[phone ] [phone]
# [telrec] =telephone recorder symbol
# [copysr] =sound recording copyright sign
[caret ] \\char94
[lsquor] \\lsquor{}
[ldquor] \\lsquor{}
#
[fflig ] {ff}
[filig ] {fi}
[fjlig ] {fj}
[ffilig] {ffi}
[ffllig] {ffl}
[fllig ] {fl}
#
[mldr ] [mldr]
[rdquor] {''}
[rsquor] {'}
[vellip] $\\vdots$
#
[hybull] {\\vrule height .6ex width .8ex depth -.4ex}
# [loz ] /lozenge - lozenge or total mark
# [lozf ] /blacklozenge - lozenge, filled
[ltri ] $\\triangleleft$
[rtri ] $\\triangleright$
[starf ] $\\star$
#
[natur ] $\\natural$
[rx ] [Rx]
# [sext ] sextile (6-pointed star)
#
[target] $\\mathchar"2208$
# [dlcrop] downward left crop mark
# [drcrop] downward right crop mark
# [ulcrop] upward left crop mark
# [urcrop] upward right crop mark
#
# Added Latin 1 ________________________________
#
[aacute] \\'{a}
[Aacute] \\'{A}
[acirc ] \\^{a}
[Acirc ] \\^{A}
[agrave] \\`{a}
[Agrave] \\`{A}
[aring ] \\aa{}
[Aring ] \\AA{}
[atilde] \\~{a}
[Atilde] \\~{A}
[auml ] \\"{a}
[Auml ] \\"{A}
[aelig ] \\ae{}
[AElig ] \\AE{}
[ccedil] \\c{c}
[Ccedil] \\c{C}
[eth ] $\\partial$
[ETH ] \\hbox{\\rlap{\\raise.3ex\\hbox{--}}D}
[eacute] \\'{e}
[Eacute] \\'{E}
[ecirc ] \\^{e}
[Ecirc ] \\^{E}
[egrave] \\`{e}
[Egrave] \\`{E}
[euml ] \\"{e}
[Euml ] \\"{E}
[iacute] \\'{\\i}
[Iacute] \\'{I}
[icirc ] \\^{\\i}
[Icirc ] \\^{I}
[igrave] \\`{\\i}
[Igrave] \\`{I}
[iuml ] \\"{\\i}
[Iuml ] \\"{I}
[ntilde] \\~{n}
[Ntilde] \\~{N}
[oacute] \\'{o}
[Oacute] \\'{O}
[ocirc ] \\^{o}
[Ocirc ] \\^{O}
[ograve] \\`{o}
[Ograve] \\`{O}
[oslash] \\o
[Oslash] \\O
[otilde] \\~{o}
[Otilde] \\~{O}
[ouml ] \\"{o}
[Ouml ] \\"{O}
[szlig ] \\ss{}
[thorn ] th
[THORN ] Th
[uacute] \\'{u}
[Uacute] \\'{U}
[ucirc ] \\^{u}
[Ucirc ] \\^{U}
[ugrave] \\`{u}
[Ugrave] \\`{U}
[uuml ] \\"{u}
[Uuml ] \\"{U}
[yacute] \\'{y}
[Yacute] \\'{Y}
[yuml ] \\"{y}
#
# Added Latin 2 ________________________________
#
# [abreve] =small a, breve
# [Abreve] =capital A, breve
# [amacr ] =small a, macron
# [Amacr ] =capital A, macron
# [aogon ] =small a, ogonek
# [Aogon ] =capital A, ogonek
# [cacute] =small c, acute accent
# [Cacute] =capital C, acute accent
# [ccaron] =small c, caron
# [Ccaron] =capital C, caron
# [ccirc ] =small c, circumflex accent
# [Ccirc ] =capital C, circumflex accent
# [cdot ] =small c, dot above
# [Cdot ] =capital C, dot above
# [dcaron] =small d, caron
# [Dcaron] =capital D, caron
# [dstrok] =small d, stroke
# [Dstrok] =capital D, stroke
# [ecaron] =small e, caron
# [Ecaron] =capital E, caron
# [edot ] =small e, dot above
# [Edot ] =capital E, dot above
# [emacr ] =small e, macron
# [Emacr ] =capital E, macron
# [eogon ] =small e, ogonek
# [Eogon ] =capital E, ogonek
# [gacute] =small g, acute accent
# [gbreve] =small g, breve
# [Gbreve] =capital G, breve
# [Gcedil] =capital G, cedilla
# [gcirc ] =small g, circumflex accent
# [Gcirc ] =capital G, circumflex accent
# [gdot ] =small g, dot above
# [Gdot ] =capital G, dot above
# [hcirc ] =small h, circumflex accent
# [Hcirc ] =capital H, circumflex accent
# [hstrok] =small h, stroke
# [Hstrok] =capital H, stroke
# [Idot ] =capital I, dot above
# [Imacr ] =capital I, macron
# [imacr ] =small i, macron
# [ijlig ] =small ij ligature
# [IJlig ] =capital IJ ligature
# [inodot] =small i without dot
# [iogon ] =small i, ogonek
# [Iogon ] =capital I, ogonek
# [itilde] =small i, tilde
# [Itilde] =capital I, tilde
# [jcirc ] =small j, circumflex accent
# [Jcirc ] =capital J, circumflex accent
# [kcedil] =small k, cedilla
# [Kcedil] =capital K, cedilla
# [kgreen] =small k, Greenlandic
# [lacute] =small l, acute accent
# [Lacute] =capital L, acute accent
# [lcaron] =small l, caron
# [Lcaron] =capital L, caron
# [lcedil] =small l, cedilla
# [Lcedil] =capital L, cedilla
# [lmidot] =small l, middle dot
# [Lmidot] =capital L, middle dot
[lstrok] \\l{}
[Lstrok] \\L{}
# [nacute] =small n, acute accent
# [Nacute] =capital N, acute accent
# [eng ] =small eng, Lapp
# [ENG ] =capital ENG, Lapp
# [napos ] =small n, apostrophe
# [ncaron] =small n, caron
# [Ncaron] =capital N, caron
# [ncedil] =small n, cedilla
# [Ncedil] =capital N, cedilla
# [odblac] =small o, double acute accent
# [Odblac] =capital O, double acute accent
# [Omacr ] =capital O, macron
# [omacr ] =small o, macron
[oelig ] $\\oe$
[OElig ] $\\OE$
# [racute] =small r, acute accent
# [Racute] =capital R, acute accent
# [rcaron] =small r, caron
# [Rcaron] =capital R, caron
# [rcedil] =small r, cedilla
# [Rcedil] =capital R, cedilla
# [sacute] =small s, acute accent
# [Sacute] =capital S, acute accent
# [scaron] =small s, caron
# [Scaron] =capital S, caron
# [scedil] =small s, cedilla
# [Scedil] =capital S, cedilla
# [scirc ] =small s, circumflex accent
# [Scirc ] =capital S, circumflex accent
# [tcaron] =small t, caron
# [Tcaron] =capital T, caron
# [tcedil] =small t, cedilla
# [Tcedil] =capital T, cedilla
# [tstrok] =small t, stroke
# [Tstrok] =capital T, stroke
# [ubreve] =small u, breve
# [Ubreve] =capital U, breve
# [udblac] =small u, double acute accent
# [Udblac] =capital U, double acute accent
# [umacr ] =small u, macron
# [Umacr ] =capital U, macron
# [uogon ] =small u, ogonek
# [Uogon ] =capital U, ogonek
# [uring ] =small u, ring
# [Uring ] =capital U, ring
# [utilde] =small u, tilde
# [Utilde] =capital U, tilde
# [wcirc ] =small w, circumflex accent
# [Wcirc ] =capital W, circumflex accent
# [ycirc ] =small y, circumflex accent
# [Ycirc ] =capital Y, circumflex accent
# [Yuml ] =capital Y, dieresis or umlaut mark
# [zacute] =small z, acute accent
# [Zacute] =capital Z, acute accent
# [zcaron] =small z, caron
# [Zcaron] =capital Z, caron
# [zdot ] =small z, dot above
# [Zdot ] =capital Z, dot above
#
# Greek Letters ________________________________
#
[agr ] $\\alpha$
# [Agr ] =capital Alpha, Greek
[bgr ] $\\beta$
# [Bgr ] =capital Beta, Greek
[ggr ] $\\gamma$
[Ggr ] $\\Gamma$
[dgr ] $\\delta$
[Dgr ] $\\Delta$
[egr ] $\\epsilon$
# [Egr ] =capital Epsilon, Greek
[zgr ] $\\zeta$
# [Zgr ] =capital Zeta, Greek
[eegr ] $\\eta$
# [EEgr ] =capital Eta, Greek
[thgr ] $\\theta$
# [THgr ] =capital Theta, Greek
[igr ] $\\iota$
# [Igr ] =capital Iota, Greek
[kgr ] $\\kappa$
# [Kgr ] =capital Kappa, Greek
[lgr ] $\\lamda$
[Lgr ] $\\Lambda$
[mgr ] $\\mu$
# [Mgr ] =capital Mu, Greek
[ngr ] $\\nu$
# [Ngr ] =capital Nu, Greek
[xgr ] $\\xi$
[Xgr ] $\\Xi$
[ogr ] $o$
# [Ogr ] =capital Omicron, Greek
[pgr ] $\\pi$
[Pgr ] $\\Pi$
[rgr ] $\\rho$
# [Rgr ] =capital Rho, Greek
[sgr ] $\\sigma$
[Sgr ] $\\Sigma$
# [sfgr ] =final small sigma, Greek
[tgr ] $\\tau$
# [Tgr ] =capital Tau, Greek
[ugr ] $\\upsilon$
[Ugr ] $\\Upsilon$
[phgr ] $\\phi$
[PHgr ] $\\Phi$
[khgr ] $\\chi$
# [KHgr ] =capital Chi, Greek
[psgr ] $\\psi$
[PSgr ] $\\Psi$
[ohgr ] $\\omega$
[OHgr ] $\\Omega$
#
# Greek Symbols ________________________________
#
[alpha ] $\\alpha$
[beta ] $\\beta$
[gamma ] $\\gamma$
[Gamma ] $\\Gamma$
# [gammad] /digamma
[delta ] $\\delta$
[Delta ] $\\Delta$
[epsi ] $\\epsilon$
[epsiv ] $\\varepsilon$
[epsis ] $\\epsilon$
[zeta ] $\\zeta$
[eta ] $\\eta$
[thetas] $\\theta$
[Theta ] $\\Theta$
[thetav] $\\vartheta$
[iota ] $\\iota$
[kappa ] $\\kappa$
# [kappav] /varkappa
[lambda] $\\lamda$
[Lambda] $\\Lambda$
[mu ] $\\mu$
[nu ] $\\nu$
[xi ] $\\zi$
[Xi ] $\\Xi$
[pi ] $\\pi$
[piv ] $\\varpi$
[Pi ] $\\Pi$
[rho ] $\\rho$
[rhov ] $\\varrho$
[sigma ] $\\sigma$
[Sigma ] $\\Sigma$
[sigmav] $\\varsigma$
[tau ] $\\tau$
[upsi ] $\\upsilon$
[Upsi ] $\\Upsilon$
[phis ] $\\phi$
[Phi ] $\\phi$
[phiv ] $\\varphi$
[chi ] $\\chi$
[psi ] $\\psi$
[Psi ] $\\Psi$
[omega ] $\\omega$
[Omega ] $\\Omega$
#
# General Technical ________________________________
#
[aleph ] $\\aleph$
[and ] $\\wedge$
# [ang90 ] =right (90 degree) angle
# [angsph] /sphericalangle =angle-spherical
[ap ] $\\approx$
# [becaus] /because R: =because
# [bottom] /bot B: =perpendicular
[cap ] $\\cap$
# [cong ] /cong R: =congruent with
# [conint] /oint L: =contour integral operator
[cup ] $\\cup$
[equiv ] $\\equiv$
[exist ] $\\exists$
[forall] $\\forall$
# [fnof ] =function of (italic small f)
[ge ] $\\ge$
[iff ] $\\iff$
[infin ] $\\infty$
# [int ] $\\int$
[isin ] $\\in$
[lang ] $\\langle$
[lArr ] $\\Leftarrow$
[le ] $\\le$
[minus ] $\\-$
[mnplus] $\\mp$
[nabla ] $\\nabla$
[ne ] $\\ne$
[ni ] $\\ni$
[or ] $\\vee$
[par ] $\\vert$
[part ] $\\partial$
# [permil] =per thousand
[perp ] $\\perp$
[prime ] \\prime{}
# [Prime ] =double prime or second
# [prop ] /propto R: =is proportional to
# [radic ] /surd =radical
# [rang ] /rangle C: =right angle bracket
[rArr ] $\\Rightarrow$
[sim ] $\\sim$
[sime ] $\\simeq$
# [square] /square B: =square
[sub ] $\\subset$
[sube ] $\\subseteq$
[sup ] $\\supset$
[supe ] $\\supseteq$
# [there4] /therefore R: =therefore
# [Verbar] $\\|$
# [angst ] Angstrom =capital A, ring
# [bernou] Bernoulli function (script capital B)
# [compfn] B: composite function (small circle)
# [Dot ] =dieresis or umlaut mark
# [DotDot] four dots above
# [hamilt] Hamiltonian (script capital H)
# [lagran] Lagrangian (script capital L)
# [lowast] low asterisk
# [notin ] N: negated set membership
# [order ] order of (script small o)
# [phmmat] physics M-matrix (script capital M)
# [tdot ] three dots above
# [tprime] triple prime
# [wedgeq] R: corresponds to (wedge, equals)
#
# Diacritical Marks ________________________________
#
[acute ] \\'
[breve ] \\u
# [caron ] =caron
[cedil ] \\c
[circ ] \\^
# [dblac ] =double acute accent
[die ] \\"
[dot ] \\.
[grave ] \\`
[macr ] \\=
# [ogon ] =ogonek
[ring ] \\accent23
[tilde ] \\tilde
[uml ] \\"
#

View file

@ -0,0 +1,26 @@
# Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
# All rights reserved.
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# Character strings to map for texinfo.
#
# From To
@ @@
{ @{
} @}

View file

@ -0,0 +1,560 @@
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
#
# SDATA entity mappings to TeX instructions.
# sgmls outputs sdata references in the form: \\|[mdash ]\\|
#
# I found many of these with the "gf" program, on ftp.th-darmstadt.de.
#
# J.Bowe, 1993
#
# Nore: there are trailing spaces with some of these (tab, then space)...
#
# Numeric and Special Graphic ________________________________
#
[half ] 1/2
[frac12] 1/2
[frac14] 1/4
[frac34] 3/4
[frac18] 1/8
[frac38] 3/8
[frac58] 5/8
[frac78] 7/8
[sup1 ] ^1
[sup2 ] ^2
[sup3 ] ^3
[plus ] +
[plusmn] +-
[lt ] <
[equals] =
[gt ] >
[divide] /
[times ] x
[curren] [curren]
[pound ] L-
[dollar] $
[cent ] c
[yen ] Y-
[num ] #
[percnt] %
[amp ] &
[ast ] *
[commat] @
[lsqb ] [
[bsol ] \
[rsqb ] ]
[lcub ] {
[horbar] -
[verbar] |
[rcub ] }
[micro ] u
[ohm ] [ohm ]
[deg ] [deg ]
[ordm ] [ordm ]
[ordf ] [ordf ]
[sect ] [sect ]
[para ] [para ]
[middot] [middot]
[larr ] <-
[rarr ] ->
[uarr ] [uarr ]
[darr ] [darr ]
[copy ] (C)
[reg ] (R)
[trade ] (TM)
[brvbar] [brvbar]
[not ] [not ]
[sung ] [sung ]
[excl ] !
[iexcl ] -!
[quot ] "
[apos ] '
[lpar ] (
[rpar ] )
[comma ] ,
[lowbar] _
[hyphen] -
[period] .
[sol ] /
[colon ] :
[semi ] ;
[quest ] ?
[iquest] -?
[laquo ] <<
[raquo ] >>
[lsquo ] `
[rsquo ] '
[ldquo ] "
[rdquo ] "
[nbsp ]
[shy ]
#
# Publishing ________________________________
#
[emsp ]
[ensp ]
[emsp3 ]
[emsp4 ]
[numsp ]
[puncsp]
[thinsp]
[hairsp]
[mdash ] ---
[ndash ] --
[dash ] -
[blank ]
[hellip] ...
[nldr ] [nldr ]
[frac13] 1/3
[frac23] 2/3
[frac15] 1/5
[frac25] 2/5
[frac35] 3/5
[frac45] 4/5
[frac16] 1/6
[frac56] 5/6
[incare] [incare]
[block ] [block ]
[uhblk ] [uhblk ]
[lhblk ] [lhblk ]
[blk14 ] [blk14 ]
[blk12 ] [blk12 ]
[blk34 ] [blk34 ]
[marker] [marker]
[cir ] o
[squ ] [squ ]
[rect ] [rect ]
[utri ] [utri ]
[dtri ] [dtri ]
[star ] [star ]
[bull ] o
[squf ] [squf ]
[utrif ] [utrif ]
[dtrif ] [dtrif ]
[ltrif ] [ltrif ]
[rtrif ] [rtrif ]
[clubs ] [clubs ]
[diams ] [diams ]
[hearts] [hearts]
[spades] [spades]
[malt ] [malt ]
[dagger] [dagger]
[Dagger] [Dagger]
[check ] [check ]
[ballot] [ballot]
[sharp ] [sharp ]
[flat ] [flat ]
[male ] [male ]
[female] [female]
[phone ] [phone ]
[telrec] [telrec]
[copysr] [copysr]
[caret ] ^
[lsquor] [lsquor]
[ldquor] [ldquor]
[fflig ] ff
[filig ] fi
[fjlig ] fj
[ffilig] ff
[ffllig] ffl
[fllig ] fl
[mldr ] [mldr ]
[rdquor] "
[rsquor] '
[vellip] [vellip]
[hybull] [hybull]
[loz ] [loz ]
[lozf ] [lozf ]
[ltri ] [ltri ]
[rtri ] [rtri ]
[starf ] [starf ]
[natur ] [natur ]
[rx ] [rx ]
[sext ] [sext ]
[target] [target]
[dlcrop] [dlcrop]
[drcrop] [drcrop]
[ulcrop] [ulcrop]
[urcrop] [urcrop]
#
# Added Latin 1 ________________________________
#
[aacute] a'
[Aacute] A'
[acirc ] a>
[Acirc ] A>
[agrave] a!
[Agrave] A!
[aring ] a.
[Aring ] A.
[atilde] a?
[Atilde] A?
[auml ] a:
[Auml ] A:
[aelig ] ae
[AElig ] AE
[ccedil] c,
[Ccedil] C,
[eth ] d/
[ETH ] D/
[eacute] e'
[Eacute] E'
[ecirc ] e>
[Ecirc ] E>
[egrave] e!
[Egrave] E!
[euml ] e:
[Euml ] E:
[Iacute] I'
[icirce] i>
[Icirc ] I>
[igrave] i!
[Igrave] I!
[iuml ] i:
[Iuml ] I:
[ntilde] n?
[Ntilde] N?
[oacute] o'
[Oacute] O'
[ocirc ] o>
[Ocirc ] O>
[ograve] o!
[Ograve] O!
[oslash] o/
[Oslash] O/
[otilde] o?
[Otilde] O?
[ouml ] o:
[Ouml ] O:
[szlig ] ss
[thorn ] th
[THORN ] Th
[uacute] u'
[Uacute] U'
[ucirc ] u>
[Ucirc ] U>
[ugrave] u!
[Ugrave] U!
[uuml ] u:
[Uuml ] U:
[yacute] y'
[Yacute] Y'
[yuml ] y:
#
# Added Latin 2 ________________________________
#
# [abreve] =small a, breve
# [Abreve] =capital A, breve
# [amacr ] =small a, macron
# [Amacr ] =capital A, macron
# [aogon ] =small a, ogonek
# [Aogon ] =capital A, ogonek
# [cacute] =small c, acute accent
# [Cacute] =capital C, acute accent
# [ccaron] =small c, caron
# [Ccaron] =capital C, caron
# [ccirc ] =small c, circumflex accent
# [Ccirc ] =capital C, circumflex accent
# [cdot ] =small c, dot above
# [Cdot ] =capital C, dot above
# [dcaron] =small d, caron
# [Dcaron] =capital D, caron
# [dstrok] =small d, stroke
# [Dstrok] =capital D, stroke
# [ecaron] =small e, caron
# [Ecaron] =capital E, caron
# [edot ] =small e, dot above
# [Edot ] =capital E, dot above
# [emacr ] =small e, macron
# [Emacr ] =capital E, macron
# [eogon ] =small e, ogonek
# [Eogon ] =capital E, ogonek
# [gacute] =small g, acute accent
# [gbreve] =small g, breve
# [Gbreve] =capital G, breve
# [Gcedil] =capital G, cedilla
# [gcirc ] =small g, circumflex accent
# [Gcirc ] =capital G, circumflex accent
# [gdot ] =small g, dot above
# [Gdot ] =capital G, dot above
# [hcirc ] =small h, circumflex accent
# [Hcirc ] =capital H, circumflex accent
# [hstrok] =small h, stroke
# [Hstrok] =capital H, stroke
# [Idot ] =capital I, dot above
# [Imacr ] =capital I, macron
# [imacr ] =small i, macron
# [ijlig ] =small ij ligature
# [IJlig ] =capital IJ ligature
# [inodot] =small i without dot
# [iogon ] =small i, ogonek
# [Iogon ] =capital I, ogonek
# [itilde] =small i, tilde
# [Itilde] =capital I, tilde
# [jcirc ] =small j, circumflex accent
# [Jcirc ] =capital J, circumflex accent
# [kcedil] =small k, cedilla
# [Kcedil] =capital K, cedilla
# [kgreen] =small k, Greenlandic
# [lacute] =small l, acute accent
# [Lacute] =capital L, acute accent
# [lcaron] =small l, caron
# [Lcaron] =capital L, caron
# [lcedil] =small l, cedilla
# [Lcedil] =capital L, cedilla
# [lmidot] =small l, middle dot
# [Lmidot] =capital L, middle dot
[lstrok] \\l{}
[Lstrok] \\L{}
# [nacute] =small n, acute accent
# [Nacute] =capital N, acute accent
# [eng ] =small eng, Lapp
# [ENG ] =capital ENG, Lapp
# [napos ] =small n, apostrophe
# [ncaron] =small n, caron
# [Ncaron] =capital N, caron
# [ncedil] =small n, cedilla
# [Ncedil] =capital N, cedilla
# [odblac] =small o, double acute accent
# [Odblac] =capital O, double acute accent
# [Omacr ] =capital O, macron
# [omacr ] =small o, macron
[oelig ] $\\oe$
[OElig ] $\\OE$
# [racute] =small r, acute accent
# [Racute] =capital R, acute accent
# [rcaron] =small r, caron
# [Rcaron] =capital R, caron
# [rcedil] =small r, cedilla
# [Rcedil] =capital R, cedilla
# [sacute] =small s, acute accent
# [Sacute] =capital S, acute accent
# [scaron] =small s, caron
# [Scaron] =capital S, caron
# [scedil] =small s, cedilla
# [Scedil] =capital S, cedilla
# [scirc ] =small s, circumflex accent
# [Scirc ] =capital S, circumflex accent
# [tcaron] =small t, caron
# [Tcaron] =capital T, caron
# [tcedil] =small t, cedilla
# [Tcedil] =capital T, cedilla
# [tstrok] =small t, stroke
# [Tstrok] =capital T, stroke
# [ubreve] =small u, breve
# [Ubreve] =capital U, breve
# [udblac] =small u, double acute accent
# [Udblac] =capital U, double acute accent
# [umacr ] =small u, macron
# [Umacr ] =capital U, macron
# [uogon ] =small u, ogonek
# [Uogon ] =capital U, ogonek
# [uring ] =small u, ring
# [Uring ] =capital U, ring
# [utilde] =small u, tilde
# [Utilde] =capital U, tilde
# [wcirc ] =small w, circumflex accent
# [Wcirc ] =capital W, circumflex accent
# [ycirc ] =small y, circumflex accent
# [Ycirc ] =capital Y, circumflex accent
# [Yuml ] =capital Y, dieresis or umlaut mark
# [zacute] =small z, acute accent
# [Zacute] =capital Z, acute accent
# [zcaron] =small z, caron
# [Zcaron] =capital Z, caron
# [zdot ] =small z, dot above
# [Zdot ] =capital Z, dot above
#
# Greek Letters ________________________________
#
[agr ] $\\alpha$
# [Agr ] =capital Alpha, Greek
[bgr ] $\\beta$
# [Bgr ] =capital Beta, Greek
[ggr ] $\\gamma$
[Ggr ] $\\Gamma$
[dgr ] $\\delta$
[Dgr ] $\\Delta$
[egr ] $\\epsilon$
# [Egr ] =capital Epsilon, Greek
[zgr ] $\\zeta$
# [Zgr ] =capital Zeta, Greek
[eegr ] $\\eta$
# [EEgr ] =capital Eta, Greek
[thgr ] $\\theta$
# [THgr ] =capital Theta, Greek
[igr ] $\\iota$
# [Igr ] =capital Iota, Greek
[kgr ] $\\kappa$
# [Kgr ] =capital Kappa, Greek
[lgr ] $\\lamda$
[Lgr ] $\\Lambda$
[mgr ] $\\mu$
# [Mgr ] =capital Mu, Greek
[ngr ] $\\nu$
# [Ngr ] =capital Nu, Greek
[xgr ] $\\xi$
[Xgr ] $\\Xi$
[ogr ] $o$
# [Ogr ] =capital Omicron, Greek
[pgr ] $\\pi$
[Pgr ] $\\Pi$
[rgr ] $\\rho$
# [Rgr ] =capital Rho, Greek
[sgr ] $\\sigma$
[Sgr ] $\\Sigma$
# [sfgr ] =final small sigma, Greek
[tgr ] $\\tau$
# [Tgr ] =capital Tau, Greek
[ugr ] $\\upsilon$
[Ugr ] $\\Upsilon$
[phgr ] $\\phi$
[PHgr ] $\\Phi$
[khgr ] $\\chi$
# [KHgr ] =capital Chi, Greek
[psgr ] $\\psi$
[PSgr ] $\\Psi$
[ohgr ] $\\omega$
[OHgr ] $\\Omega$
#
# Greek Symbols ________________________________
#
[alpha ] $\\alpha$
[beta ] $\\beta$
[gamma ] $\\gamma$
[Gamma ] $\\Gamma$
# [gammad] /digamma
[delta ] $\\delta$
[Delta ] $\\Delta$
[epsi ] $\\epsilon$
[epsiv ] $\\varepsilon$
[epsis ] $\\epsilon$
[zeta ] $\\zeta$
[eta ] $\\eta$
[thetas] $\\theta$
[Theta ] $\\Theta$
[thetav] $\\vartheta$
[iota ] $\\iota$
[kappa ] $\\kappa$
# [kappav] /varkappa
[lambda] $\\lamda$
[Lambda] $\\Lambda$
[mu ] $\\mu$
[nu ] $\\nu$
[xi ] $\\zi$
[Xi ] $\\Xi$
[pi ] $\\pi$
[piv ] $\\varpi$
[Pi ] $\\Pi$
[rho ] $\\rho$
[rhov ] $\\varrho$
[sigma ] $\\sigma$
[Sigma ] $\\Sigma$
[sigmav] $\\varsigma$
[tau ] $\\tau$
[upsi ] $\\upsilon$
[Upsi ] $\\Upsilon$
[phis ] $\\phi$
[Phi ] $\\phi$
[phiv ] $\\varphi$
[chi ] $\\chi$
[psi ] $\\psi$
[Psi ] $\\Psi$
[omega ] $\\omega$
[Omega ] $\\Omega$
#
# General Technical ________________________________
#
[aleph ] $\\aleph$
[and ] $\\wedge$
# [ang90 ] =right (90 degree) angle
# [angsph] /sphericalangle =angle-spherical
[ap ] $\\approx$
# [becaus] /because R: =because
# [bottom] /bot B: =perpendicular
[cap ] $\\cap$
# [cong ] /cong R: =congruent with
# [conint] /oint L: =contour integral operator
[cup ] $\\cup$
[equiv ] $\\equiv$
[exist ] $\\exists$
[forall] $\\forall$
# [fnof ] =function of (italic small f)
[ge ] $\\ge$
[iff ] $\\iff$
[infin ] $\\infty$
# [int ] $\\int$
[isin ] $\\in$
[lang ] $\\langle$
[lArr ] $\\Leftarrow$
[le ] $\\le$
[minus ] $\\-$
[mnplus] $\\mp$
[nabla ] $\\nabla$
[ne ] $\\ne$
[ni ] $\\ni$
[or ] $\\vee$
[par ] $\\vert$
[part ] $\\partial$
# [permil] =per thousand
[perp ] $\\perp$
[prime ] \\prime{}
# [Prime ] =double prime or second
# [prop ] /propto R: =is proportional to
# [radic ] /surd =radical
# [rang ] /rangle C: =right angle bracket
[rArr ] $\\Rightarrow$
[sim ] $\\sim$
[sime ] $\\simeq$
# [square] /square B: =square
[sub ] $\\subset$
[sube ] $\\subseteq$
[sup ] $\\supset$
[supe ] $\\supseteq$
# [there4] /therefore R: =therefore
# [Verbar] $\\|$
# [angst ] Angstrom =capital A, ring
# [bernou] Bernoulli function (script capital B)
# [compfn] B: composite function (small circle)
# [Dot ] =dieresis or umlaut mark
# [DotDot] four dots above
# [hamilt] Hamiltonian (script capital H)
# [lagran] Lagrangian (script capital L)
# [lowast] low asterisk
# [notin ] N: negated set membership
# [order ] order of (script small o)
# [phmmat] physics M-matrix (script capital M)
# [tdot ] three dots above
# [tprime] triple prime
# [wedgeq] R: corresponds to (wedge, equals)
#
# Diacritical Marks ________________________________
#
[acute ] '
[breve ] [breve ]
[caron ] [caron ]
[cedil ] ,
[circ ] >
[dblac ] [dblac ]
[die ] :
[dot ] [dot ]
[grave ] `
[macr ] [macr ]
[ogon ] [ogon ]
[ring ] .
[tilde ] ?
[uml ] :
#

View file

@ -0,0 +1,17 @@
XCOMM $XConsortium: Imakefile /main/2 1996/04/21 19:55:57 drk $
#define DoNormalLib YES
#define DoSharedLib NO
#define DoDebugLib NO
#define DoProfileLib NO
#define LibName tptregexp
#define LibHeaders NO
#define LibInstall NO
SRCS = regexp.c regsub.c regerror.c
OBJS = regexp.o regsub.o regerror.o
INCLUDES = -I.
#include <Library.tmpl>
DependTarget()

View file

@ -0,0 +1,101 @@
/* $XConsortium: README /main/2 1996/07/15 14:09:54 drk $ */
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
This is a nearly-public-domain reimplementation of the V8 regexp(3) package.
It gives C programs the ability to use egrep-style regular expressions, and
does it in a much cleaner fashion than the analogous routines in SysV.
Copyright (c) 1986 by University of Toronto.
Written by Henry Spencer. Not derived from licensed software.
Permission is granted to anyone to use this software for any
purpose on any computer system, and to redistribute it freely,
subject to the following restrictions:
1. The author is not responsible for the consequences of use of
this software, no matter how awful, even if they arise
from defects in it.
2. The origin of this software must not be misrepresented, either
by explicit claim or by omission.
3. Altered versions must be plainly marked as such, and must not
be misrepresented as being the original software.
Barring a couple of small items in the BUGS list, this implementation is
believed 100% compatible with V8. It should even be binary-compatible,
sort of, since the only fields in a "struct regexp" that other people have
any business touching are declared in exactly the same way at the same
location in the struct (the beginning).
This implementation is *NOT* AT&T/Bell code, and is not derived from licensed
software. Even though U of T is a V8 licensee. This software is based on
a V8 manual page sent to me by Dennis Ritchie (the manual page enclosed
here is a complete rewrite and hence is not covered by AT&T copyright).
The software was nearly complete at the time of arrival of our V8 tape.
I haven't even looked at V8 yet, although a friend elsewhere at U of T has
been kind enough to run a few test programs using the V8 regexp(3) to resolve
a few fine points. I admit to some familiarity with regular-expression
implementations of the past, but the only one that this code traces any
ancestry to is the one published in Kernighan & Plauger (from which this
one draws ideas but not code).
Simplistically: put this stuff into a source directory, copy regexp.h into
/usr/include, inspect Makefile for compilation options that need changing
to suit your local environment, and then do "make r". This compiles the
regexp(3) functions, compiles a test program, and runs a large set of
regression tests. If there are no complaints, then put regexp.o, regsub.o,
and regerror.o into your C library, and regexp.3 into your manual-pages
directory.
Note that if you don't put regexp.h into /usr/include *before* compiling,
you'll have to add "-I." to CFLAGS before compiling.
The files are:
Makefile instructions to make everything
regexp.3 manual page
regexp.h header file, for /usr/include
regexp.c source for regcomp() and regexec()
regsub.c source for regsub()
regerror.c source for default regerror()
regmagic.h internal header file
try.c source for test program
timer.c source for timing program
tests test list for try and timer
This implementation uses nondeterministic automata rather than the
deterministic ones found in some other implementations, which makes it
simpler, smaller, and faster at compiling regular expressions, but slower
at executing them. In theory, anyway. This implementation does employ
some special-case optimizations to make the simpler cases (which do make
up the bulk of regular expressions actually used) run quickly. In general,
if you want blazing speed you're in the wrong place. Replacing the insides
of egrep with this stuff is probably a mistake; if you want your own egrep
you're going to have to do a lot more work. But if you want to use regular
expressions a little bit in something else, you're in luck. Note that many
existing text editors use nondeterministic regular-expression implementations,
so you're in good company.
This stuff should be pretty portable, given appropriate option settings.
If your chars have less than 8 bits, you're going to have to change the
internal representation of the automaton, although knowledge of the details
of this is fairly localized. There are no "reserved" char values except for
NUL, and no special significance is attached to the top bit of chars.
The string(3) functions are used a fair bit, on the grounds that they are
probably faster than coding the operations in line. Some attempts at code
tuning have been made, but this is invariably a bit machine-specific.

View file

@ -0,0 +1,37 @@
/* $XConsortium: README.osf /main/2 1996/07/15 14:10:16 drk $ */
#
# Copyright (c) 1994
# Open Software Foundation, Inc.
#
# Permission is hereby granted to use, copy, modify and freely distribute
# the software in this file and its documentation for any purpose without
# fee, provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. Further, provided that the name of Open
# Software Foundation, Inc. ("OSF") not be used in advertising or
# publicity pertaining to distribution of the software without prior
# written permission from OSF. OSF makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
OSF did not write this code.
Changes made:
Renamed "regexp.h" to "tptregexp.h" to avoid conflicts with systems that
have a /usr/include/regexp.h. Changed the *.c files in the appropriate
places.
Renamed these routines:
regcomp() -> tpt_regcomp()
regexec() -> tpt_regexec()
regsub() -> tpt_regsub()
regerror() -> tpt_regerror()
This is to avoid conflicts in the standard C library.
In Makefile - wrote "all" and "install" targets. Changed "regexp.h"
to "tptregexp.h", as appropriate.
In regexp.c - added #include <string.h> to keep compiler happy.

View file

@ -0,0 +1,15 @@
/* $XConsortium: regerror.c /main/3 1996/06/19 17:13:36 drk $ */
#include <stdio.h>
void
tpt_regerror(s)
char *s;
{
#ifdef ERRAVAIL
error("tpt_regexp: %s", s);
#else
fprintf(stderr, "tpt_regexp(3): %s", s);
exit(1);
#endif
/* NOTREACHED */
}

View file

@ -0,0 +1,180 @@
.\" $XConsortium: regexp.3 /main/2 1996/10/29 15:06:28 drk $
.TH REGEXP 3 local
.DA 30 Nov 1985
.SH NAME
regcomp, regexec, regsub, regerror \- regular expression handler
.SH SYNOPSIS
.ft B
.nf
#include <regexp.h>
regexp *regcomp(exp)
char *exp;
int regexec(prog, string)
regexp *prog;
char *string;
regsub(prog, source, dest)
regexp *prog;
char *source;
char *dest;
regerror(msg)
char *msg;
.SH DESCRIPTION
These functions implement
.IR egrep (1)-style
regular expressions and supporting facilities.
.PP
.I Regcomp
compiles a regular expression into a structure of type
.IR regexp ,
and returns a pointer to it.
The space has been allocated using
.IR malloc (3)
and may be released by
.IR free .
.PP
.I Regexec
matches a NUL-terminated \fIstring\fR against the compiled regular expression
in \fIprog\fR.
It returns 1 for success and 0 for failure, and adjusts the contents of
\fIprog\fR's \fIstartp\fR and \fIendp\fR (see below) accordingly.
.PP
The members of a
.I regexp
structure include at least the following (not necessarily in order):
.PP
.RS
char *startp[NSUBEXP];
.br
char *endp[NSUBEXP];
.RE
.PP
where
.I NSUBEXP
is defined (as 10) in the header file.
Once a successful \fIregexec\fR has been done using the \fIregexp\fR,
each \fIstartp\fR-\fIendp\fR pair describes one substring
within the \fIstring\fR,
with the \fIstartp\fR pointing to the first character of the substring and
the \fIendp\fR pointing to the first character following the substring.
The 0th substring is the substring of \fIstring\fR that matched the whole
regular expression.
The others are those substrings that matched parenthesized expressions
within the regular expression, with parenthesized expressions numbered
in left-to-right order of their opening parentheses.
.PP
.I Regsub
copies \fIsource\fR to \fIdest\fR, making substitutions according to the
most recent \fIregexec\fR performed using \fIprog\fR.
Each instance of `&' in \fIsource\fR is replaced by the substring
indicated by \fIstartp\fR[\fI0\fR] and
\fIendp\fR[\fI0\fR].
Each instance of `\e\fIn\fR', where \fIn\fR is a digit, is replaced by
the substring indicated by
\fIstartp\fR[\fIn\fR] and
\fIendp\fR[\fIn\fR].
To get a literal `&' or `\e\fIn\fR' into \fIdest\fR, prefix it with `\e';
to get a literal `\e' preceding `&' or `\e\fIn\fR', prefix it with
another `\e'.
.PP
.I Regerror
is called whenever an error is detected in \fIregcomp\fR, \fIregexec\fR,
or \fIregsub\fR.
The default \fIregerror\fR writes the string \fImsg\fR,
with a suitable indicator of origin,
on the standard
error output
and invokes \fIexit\fR(2).
.I Regerror
can be replaced by the user if other actions are desirable.
.SH "REGULAR EXPRESSION SYNTAX"
A regular expression is zero or more \fIbranches\fR, separated by `|'.
It matches anything that matches one of the branches.
.PP
A branch is zero or more \fIpieces\fR, concatenated.
It matches a match for the first, followed by a match for the second, etc.
.PP
A piece is an \fIatom\fR possibly followed by `*', `+', or `?'.
An atom followed by `*' matches a sequence of 0 or more matches of the atom.
An atom followed by `+' matches a sequence of 1 or more matches of the atom.
An atom followed by `?' matches a match of the atom, or the null string.
.PP
An atom is a regular expression in parentheses (matching a match for the
regular expression), a \fIrange\fR (see below), `.'
(matching any single character), `^' (matching the null string at the
beginning of the input string), `$' (matching the null string at the
end of the input string), a `\e' followed by a single character (matching
that character), or a single character with no other significance
(matching that character).
.PP
A \fIrange\fR is a sequence of characters enclosed in `[]'.
It normally matches any single character from the sequence.
If the sequence begins with `^',
it matches any single character \fInot\fR from the rest of the sequence.
If two characters in the sequence are separated by `\-', this is shorthand
for the full list of ASCII characters between them
(e.g. `[0-9]' matches any decimal digit).
To include a literal `]' in the sequence, make it the first character
(following a possible `^').
To include a literal `\-', make it the first or last character.
.SH AMBIGUITY
If a regular expression could match two different parts of the input string,
it will match the one which begins earliest.
If both begin in the same place but match different lengths, or match
the same length in different ways, life gets messier, as follows.
.PP
In general, the possibilities in a list of branches are considered in
left-to-right order, the possibilities for `*', `+', and `?' are
considered longest-first, nested constructs are considered from the
outermost in, and concatenated constructs are considered leftmost-first.
The match that will be chosen is the one that uses the earliest
possibility in the first choice that has to be made.
If there is more than one choice, the next will be made in the same manner
(earliest possibility) subject to the decision on the first choice.
And so forth.
.PP
For example, `(ab|a)b*c' could match `abc' in one of two ways.
The first choice is between `ab' and `a'; since `ab' is earlier, and does
lead to a successful overall match, it is chosen.
Since the `b' is already spoken for,
the `b*' must match its last possibility\(emthe empty string\(emsince
it must respect the earlier choice.
.PP
In the particular case where no `|'s are present and there is only one
`*', `+', or `?', the net effect is that the longest possible
match will be chosen.
So `ab*', presented with `xabbbby', will match `abbbb'.
Note that if `ab*' is tried against `xabyabbbz', it
will match `ab' just after `x', due to the begins-earliest rule.
(In effect, the decision on where to start the match is the first choice
to be made, hence subsequent choices must respect it even if this leads them
to less-preferred alternatives.)
.SH SEE ALSO
egrep(1), expr(1)
.SH DIAGNOSTICS
\fIRegcomp\fR returns NULL for a failure
(\fIregerror\fR permitting),
where failures are syntax errors, exceeding implementation limits,
or applying `+' or `*' to a possibly-null operand.
.SH HISTORY
Both code and manual page were
written at U of T.
They are intended to be compatible with the Bell V8 \fIregexp\fR(3),
but are not derived from Bell code.
.SH BUGS
Empty branches and empty regular expressions are not portable to V8.
.PP
The restriction against
applying `*' or `+' to a possibly-null operand is an artifact of the
simplistic implementation.
.PP
Does not support \fIegrep\fR's newline-separated branches;
neither does the V8 \fIregexp\fR(3), though.
.PP
Due to emphasis on
compactness and simplicity,
it's not strikingly fast.
It does give special attention to handling simple cases quickly.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
/* $XConsortium: regmagic.h /main/3 1996/06/19 17:13:41 drk $ */
/*
* The first byte of the regexp internal "program" is actually this magic
* number; the start node begins in the second byte.
*/
#define MAGIC 0234

View file

@ -0,0 +1,82 @@
/* $XConsortium: regsub.c /main/3 1996/06/19 17:13:46 drk $ */
/*
* regsub
*
* Copyright (c) 1986 by University of Toronto.
* Written by Henry Spencer. Not derived from licensed software.
*
* Permission is granted to anyone to use this software for any
* purpose on any computer system, and to redistribute it freely,
* subject to the following restrictions:
*
* 1. The author is not responsible for the consequences of use of
* this software, no matter how awful, even if they arise
* from defects in it.
*
* 2. The origin of this software must not be misrepresented, either
* by explicit claim or by omission.
*
* 3. Altered versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*/
#include <stdio.h>
#include <tptregexp.h>
#include "regmagic.h"
#ifndef CHARBITS
#define UCHARAT(p) ((int)*(unsigned char *)(p))
#else
#define UCHARAT(p) ((int)*(p)&CHARBITS)
#endif
/*
- regsub - perform substitutions after a regexp match
*/
void
tpt_regsub(prog, source, dest)
regexp *prog;
char *source;
char *dest;
{
register char *src;
register char *dst;
register char c;
register int no;
register int len;
extern char *strncpy();
if (prog == NULL || source == NULL || dest == NULL) {
tpt_regerror("NULL parm to regsub");
return;
}
if (UCHARAT(prog->program) != MAGIC) {
tpt_regerror("damaged regexp fed to regsub");
return;
}
src = source;
dst = dest;
while ((c = *src++) != '\0') {
if (c == '&')
no = 0;
else if (c == '\\' && '0' <= *src && *src <= '9')
no = *src++ - '0';
else
no = -1;
if (no < 0) { /* Ordinary character. */
if (c == '\\' && (*src == '\\' || *src == '&'))
c = *src++;
*dst++ = c;
} else if (prog->startp[no] != NULL && prog->endp[no] != NULL) {
len = prog->endp[no] - prog->startp[no];
(void) strncpy(dst, prog->startp[no], len);
dst += len;
if (len != 0 && *(dst-1) == '\0') { /* strncpy hit NUL. */
tpt_regerror("damaged match string");
return;
}
}
}
*dst++ = '\0';
}

View file

@ -0,0 +1,127 @@
abc abc y & abc
abc xbc n - -
abc axc n - -
abc abx n - -
abc xabcy y & abc
abc ababc y & abc
ab*c abc y & abc
ab*bc abc y & abc
ab*bc abbc y & abbc
ab*bc abbbbc y & abbbbc
ab+bc abbc y & abbc
ab+bc abc n - -
ab+bc abq n - -
ab+bc abbbbc y & abbbbc
ab?bc abbc y & abbc
ab?bc abc y & abc
ab?bc abbbbc n - -
ab?c abc y & abc
^abc$ abc y & abc
^abc$ abcc n - -
^abc abcc y & abc
^abc$ aabc n - -
abc$ aabc y & abc
^ abc y &
$ abc y &
a.c abc y & abc
a.c axc y & axc
a.*c axyzc y & axyzc
a.*c axyzd n - -
a[bc]d abc n - -
a[bc]d abd y & abd
a[b-d]e abd n - -
a[b-d]e ace y & ace
a[b-d] aac y & ac
a[-b] a- y & a-
a[b-] a- y & a-
a[b-a] - c - -
a[]b - c - -
a[ - c - -
a] a] y & a]
a[]]b a]b y & a]b
a[^bc]d aed y & aed
a[^bc]d abd n - -
a[^-b]c adc y & adc
a[^-b]c a-c n - -
a[^]b]c a]c n - -
a[^]b]c adc y & adc
ab|cd abc y & ab
ab|cd abcd y & ab
()ef def y &-\1 ef-
()* - c - -
*a - c - -
^* - c - -
$* - c - -
(*)b - c - -
$b b n - -
a\ - c - -
a\(b a(b y &-\1 a(b-
a\(*b ab y & ab
a\(*b a((b y & a((b
a\\b a\b y & a\b
abc) - c - -
(abc - c - -
((a)) abc y &-\1-\2 a-a-a
(a)b(c) abc y &-\1-\2 abc-a-c
a+b+c aabbabc y & abc
a** - c - -
a*? - c - -
(a*)* - c - -
(a*)+ - c - -
(a|)* - c - -
(a*|b)* - c - -
(a+|b)* ab y &-\1 ab-b
(a+|b)+ ab y &-\1 ab-b
(a+|b)? ab y &-\1 a-a
[^ab]* cde y & cde
(^)* - c - -
(ab|)* - c - -
)( - c - -
abc y &
abc n - -
a* y &
([abc])*d abbbcd y &-\1 abbbcd-c
([abc])*bcd abcd y &-\1 abcd-a
a|b|c|d|e e y & e
(a|b|c|d|e)f ef y &-\1 ef-e
((a*|b))* - c - -
abcd*efg abcdefg y & abcdefg
ab* xabyabbbz y & ab
ab* xayabbbz y & a
(ab|cd)e abcde y &-\1 cde-cd
[abhgefdc]ij hij y & hij
^(ab|cd)e abcde n x\1y xy
(abc|)ef abcdef y &-\1 ef-
(a|b)c*d abcd y &-\1 bcd-b
(ab|ab*)bc abc y &-\1 abc-a
a([bc]*)c* abc y &-\1 abc-bc
a([bc]*)(c*d) abcd y &-\1-\2 abcd-bc-d
a([bc]+)(c*d) abcd y &-\1-\2 abcd-bc-d
a([bc]*)(c+d) abcd y &-\1-\2 abcd-b-cd
a[bcd]*dcdcde adcdcde y & adcdcde
a[bcd]+dcdcde adcdcde n - -
(ab|a)b*c abc y &-\1 abc-ab
((a)(b)c)(d) abcd y \1-\2-\3-\4 abc-a-b-d
[a-zA-Z_][a-zA-Z0-9_]* alpha y & alpha
^a(bc+|b[eh])g|.h$ abh y &-\1 bh-
(bc+d$|ef*g.|h?i(j|k)) effgz y &-\1-\2 effgz-effgz-
(bc+d$|ef*g.|h?i(j|k)) ij y &-\1-\2 ij-ij-j
(bc+d$|ef*g.|h?i(j|k)) effg n - -
(bc+d$|ef*g.|h?i(j|k)) bcdd n - -
(bc+d$|ef*g.|h?i(j|k)) reffgz y &-\1-\2 effgz-effgz-
((((((((((a)))))))))) - c - -
(((((((((a))))))))) a y & a
multiple words of text uh-uh n - -
multiple words multiple words, yeah y & multiple words
(.*)c(.*) abcde y &-\1-\2 abcde-ab-de
\((.*), (.*)\) (a, b) y (\2, \1) (b, a)
[k] ab n - -
abcd abcd y &-\&-\\& abcd-&-\abcd
a(bc)d abcd y \1-\\1-\\\1 bc-\1-\bc
[ -~]* abc y & abc
[ -~ -~]* abc y & abc
[ -~ -~ -~]* abc y & abc
[ -~ -~ -~ -~]* abc y & abc
[ -~ -~ -~ -~ -~]* abc y & abc
[ -~ -~ -~ -~ -~ -~]* abc y & abc
[ -~ -~ -~ -~ -~ -~ -~]* abc y & abc

View file

@ -0,0 +1,183 @@
/* $XConsortium: timer.c /main/3 1996/06/19 17:13:50 drk $ */
/*
* Simple timing program for regcomp().
*
* Copyright (c) 1986 by University of Toronto.
* Written by Henry Spencer. Not derived from licensed software.
*
* Permission is granted to anyone to use this software for any
* purpose on any computer system, and to redistribute it freely,
* subject to the following restrictions:
*
* 1. The author is not responsible for the consequences of use of
* this software, no matter how awful, even if they arise
* from defects in it.
*
* 2. The origin of this software must not be misrepresented, either
* by explicit claim or by omission.
*
* 3. Altered versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* Usage: timer ncomp nexec nsub
* or
* timer ncomp nexec nsub regexp string [ answer [ sub ] ]
*
* The second form is for timing repetitions of a single test case.
* The first form's test data is a compiled-in copy of the "tests" file.
* Ncomp, nexec, nsub are how many times to do each regcomp, regexec,
* and regsub. The way to time an operation individually is to do something
* like "timer 1 50 1".
*/
#include <stdio.h>
struct try {
char *re, *str, *ans, *src, *dst;
} tests[] = {
#include "timer.t.h"
{ NULL, NULL, NULL, NULL, NULL }
};
#include <tptregexp.h>
int errreport = 0; /* Report errors via errseen? */
char *errseen = NULL; /* Error message. */
char *progname;
/* ARGSUSED */
main(argc, argv)
int argc;
char *argv[];
{
int ncomp, nexec, nsub;
struct try one;
char dummy[512];
if (argc < 4) {
ncomp = 1;
nexec = 1;
nsub = 1;
} else {
ncomp = atoi(argv[1]);
nexec = atoi(argv[2]);
nsub = atoi(argv[3]);
}
progname = argv[0];
if (argc > 5) {
one.re = argv[4];
one.str = argv[5];
if (argc > 6)
one.ans = argv[6];
else
one.ans = "y";
if (argc > 7) {
one.src = argv[7];
one.dst = "xxx";
} else {
one.src = "x";
one.dst = "x";
}
errreport = 1;
try(one, ncomp, nexec, nsub);
} else
multiple(ncomp, nexec, nsub);
exit(0);
}
void
tpt_regerror(s)
char *s;
{
if (errreport)
errseen = s;
else
error(s, "");
}
#ifndef ERRAVAIL
error(s1, s2)
char *s1;
char *s2;
{
fprintf(stderr, "regexp: ");
fprintf(stderr, s1, s2);
fprintf(stderr, "\n");
exit(1);
}
#endif
int lineno = 0;
multiple(ncomp, nexec, nsub)
int ncomp, nexec, nsub;
{
register int i;
extern char *strchr();
errreport = 1;
for (i = 0; tests[i].re != NULL; i++) {
lineno++;
try(tests[i], ncomp, nexec, nsub);
}
}
try(fields, ncomp, nexec, nsub)
struct try fields;
int ncomp, nexec, nsub;
{
regexp *r;
char dbuf[BUFSIZ];
register int i;
errseen = NULL;
r = tpt_regcomp(fields.re);
if (r == NULL) {
if (*fields.ans != 'c')
complain("tpt_regcomp failure in `%s'", fields.re);
return;
}
if (*fields.ans == 'c') {
complain("unexpected tpt_regcomp success in `%s'", fields.re);
free((char *)r);
return;
}
for (i = ncomp-1; i > 0; i--) {
free((char *)r);
r = tpt_regcomp(fields.re);
}
if (!tpt_regexec(r, fields.str)) {
if (*fields.ans != 'n')
complain("tpt_regexec failure in `%s'", "");
free((char *)r);
return;
}
if (*fields.ans == 'n') {
complain("unexpected tpt_regexec success", "");
free((char *)r);
return;
}
for (i = nexec-1; i > 0; i--)
(void) tpt_regexec(r, fields.str);
errseen = NULL;
for (i = nsub; i > 0; i--)
tpt_regsub(r, fields.src, dbuf);
if (errseen != NULL) {
complain("tpt_regsub complaint", "");
free((char *)r);
return;
}
if (strcmp(dbuf, fields.dst) != 0)
complain("tpt_regsub result `%s' wrong", dbuf);
free((char *)r);
}
complain(s1, s2)
char *s1;
char *s2;
{
fprintf(stderr, "try: %d: ", lineno);
fprintf(stderr, s1, s2);
fprintf(stderr, " (%s)\n", (errseen != NULL) ? errseen : "");
}

View file

@ -0,0 +1,22 @@
/* $XConsortium: tptregexp.h /main/3 1996/06/19 17:13:54 drk $ */
/*
* Definitions etc. for regexp(3) routines.
*
* Caveat: this is V8 regexp(3) [actually, a reimplementation thereof],
* not the System V one.
*/
#define NSUBEXP 10
typedef struct regexp {
char *startp[NSUBEXP];
char *endp[NSUBEXP];
char regstart; /* Internal use only. */
char reganch; /* Internal use only. */
char *regmust; /* Internal use only. */
int regmlen; /* Internal use only. */
char program[1]; /* Unwarranted chumminess with compiler. */
} regexp;
extern regexp *tpt_regcomp();
extern int tpt_regexec();
extern void tpt_regsub();
extern void tpt_regerror();

View file

@ -0,0 +1,239 @@
/* $XConsortium: try.c /main/3 1996/06/19 17:13:58 drk $ */
/*
* Simple test program for regexp(3) stuff. Knows about debugging hooks.
*
* Copyright (c) 1986 by University of Toronto.
* Written by Henry Spencer. Not derived from licensed software.
*
* Permission is granted to anyone to use this software for any
* purpose on any computer system, and to redistribute it freely,
* subject to the following restrictions:
*
* 1. The author is not responsible for the consequences of use of
* this software, no matter how awful, even if they arise
* from defects in it.
*
* 2. The origin of this software must not be misrepresented, either
* by explicit claim or by omission.
*
* 3. Altered versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* Usage: try re [string [output [-]]]
* The re is compiled and dumped, regexeced against the string, the result
* is applied to output using regsub(). The - triggers a running narrative
* from regexec(). Dumping and narrative don't happen unless DEBUG.
*
* If there are no arguments, stdin is assumed to be a stream of lines with
* five fields: a r.e., a string to match it against, a result code, a
* source string for regsub, and the proper result. Result codes are 'c'
* for compile failure, 'y' for match success, 'n' for match failure.
* Field separator is tab.
*/
#include <stdio.h>
#include <tptregexp.h>
#ifdef ERRAVAIL
char *progname;
extern char *mkprogname();
#endif
#ifdef DEBUG
extern int regnarrate;
#endif
char buf[BUFSIZ];
int errreport = 0; /* Report errors via errseen? */
char *errseen = NULL; /* Error message. */
int status = 0; /* Exit status. */
/* ARGSUSED */
main(argc, argv)
int argc;
char *argv[];
{
regexp *r;
int i;
#ifdef ERRAVAIL
progname = mkprogname(argv[0]);
#endif
if (argc == 1) {
multiple();
exit(status);
}
r = tpt_regcomp(argv[1]);
if (r == NULL)
error("tpt_regcomp failure", "");
#ifdef DEBUG
regdump(r);
if (argc > 4)
regnarrate++;
#endif
if (argc > 2) {
i = tpt_regexec(r, argv[2]);
printf("%d", i);
for (i = 1; i < NSUBEXP; i++)
if (r->startp[i] != NULL && r->endp[i] != NULL)
printf(" \\%d", i);
printf("\n");
}
if (argc > 3) {
tpt_regsub(r, argv[3], buf);
printf("%s\n", buf);
}
exit(status);
}
void
tpt_regerror(s)
char *s;
{
if (errreport)
errseen = s;
else
error(s, "");
}
#ifndef ERRAVAIL
error(s1, s2)
char *s1;
char *s2;
{
fprintf(stderr, "regexp: ");
fprintf(stderr, s1, s2);
fprintf(stderr, "\n");
exit(1);
}
#endif
int lineno;
regexp badregexp; /* Implicit init to 0. */
multiple()
{
char rbuf[BUFSIZ];
char *field[5];
char *scan;
int i;
regexp *r;
extern char *strchr();
errreport = 1;
lineno = 0;
while (fgets(rbuf, sizeof(rbuf), stdin) != NULL) {
rbuf[strlen(rbuf)-1] = '\0'; /* Dispense with \n. */
lineno++;
scan = rbuf;
for (i = 0; i < 5; i++) {
field[i] = scan;
if (field[i] == NULL) {
complain("bad testfile format", "");
exit(1);
}
scan = strchr(scan, '\t');
if (scan != NULL)
*scan++ = '\0';
}
try(field);
}
/* And finish up with some internal testing... */
lineno = 9990;
errseen = NULL;
if (tpt_regcomp((char *)NULL) != NULL || errseen == NULL)
complain("tpt_regcomp(NULL) doesn't complain", "");
lineno = 9991;
errseen = NULL;
if (tpt_regexec((regexp *)NULL, "foo") || errseen == NULL)
complain("tpt_regexec(NULL, ...) doesn't complain", "");
lineno = 9992;
r = tpt_regcomp("foo");
if (r == NULL) {
complain("tpt_regcomp(\"foo\") fails", "");
return;
}
lineno = 9993;
errseen = NULL;
if (tpt_regexec(r, (char *)NULL) || errseen == NULL)
complain("tpt_regexec(..., NULL) doesn't complain", "");
lineno = 9994;
errseen = NULL;
tpt_regsub((regexp *)NULL, "foo", rbuf);
if (errseen == NULL)
complain("tpt_regsub(NULL, ..., ...) doesn't complain", "");
lineno = 9995;
errseen = NULL;
tpt_regsub(r, (char *)NULL, rbuf);
if (errseen == NULL)
complain("tpt_regsub(..., NULL, ...) doesn't complain", "");
lineno = 9996;
errseen = NULL;
tpt_regsub(r, "foo", (char *)NULL);
if (errseen == NULL)
complain("tpt_regsub(..., ..., NULL) doesn't complain", "");
lineno = 9997;
errseen = NULL;
if (tpt_regexec(&badregexp, "foo") || errseen == NULL)
complain("tpt_regexec(nonsense, ...) doesn't complain", "");
lineno = 9998;
errseen = NULL;
tpt_regsub(&badregexp, "foo", rbuf);
if (errseen == NULL)
complain("tpt_regsub(nonsense, ..., ...) doesn't complain", "");
}
try(fields)
char **fields;
{
regexp *r;
char dbuf[BUFSIZ];
errseen = NULL;
r = tpt_regcomp(fields[0]);
if (r == NULL) {
if (*fields[2] != 'c')
complain("tpt_regcomp failure in `%s'", fields[0]);
return;
}
if (*fields[2] == 'c') {
complain("unexpected tpt_regcomp success in `%s'", fields[0]);
free((char *)r);
return;
}
if (!tpt_regexec(r, fields[1])) {
if (*fields[2] != 'n')
complain("tpt_regexec failure in `%s'", "");
free((char *)r);
return;
}
if (*fields[2] == 'n') {
complain("unexpected tpt_regexec success", "");
free((char *)r);
return;
}
errseen = NULL;
tpt_regsub(r, fields[3], dbuf);
if (errseen != NULL) {
complain("tpt_regsub complaint", "");
free((char *)r);
return;
}
if (strcmp(dbuf, fields[4]) != 0)
complain("tpt_regsub result `%s' wrong", dbuf);
free((char *)r);
}
complain(s1, s2)
char *s1;
char *s2;
{
fprintf(stderr, "try: %d: ", lineno);
fprintf(stderr, s1, s2);
fprintf(stderr, " (%s)\n", (errseen != NULL) ? errseen : "");
status = 1;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,56 @@
This file describes how to install sgmls.
UNIX
----
Look at the Makefile and edit it if necessary.
Do `make config.h'. This runs a shell script that generates an
appropriate config.h file from unix.cfg. If this works, have a look
at config.h and make sure it's correct. (In particular you might want
to change the definition of DEFAULT_PATH.) If this doesn't work, copy
unix.cfg to config.h, and then edit config.h yourself; please also
tell me what went wrong.
Do `make'.
If you like, do `make test' to run some tests.
Do `make install' to install the binaries.
If you like, do `make install.man' to install the man pages.
MS-DOS with Borland C++ 2.0
---------------------------
Rename makefile to makefile.ux and then rename makefile.bcc to
makefile.
Copy dos.cfg to config.h.
Look at config.h and makefile and edit them if you want.
Do `make -S'.
Copy sgmls.exe and sgmlsasp.exe to a directory that's on your path.
VAX/VMS
-------
Copy vms.cfg to config.h.
Look at Makefile.vms and config.h and edit them if you want.
Use the script in Makefile.vms to build sgmls and sgmlsasp.
VM/CMS
------
[This configuration is untested.]
Copy cms.cfg to config.h.
Use Makefile.cms to build sgmls and sgmlsasp.
James Clark
jjc@jclark.com

View file

@ -0,0 +1,53 @@
XCOMM $XConsortium: Imakefile /main/3 1996/07/17 12:21:51 rws $
#ifdef IBMArchitecture
EXTRA_DEFINES = -Dvfork=fork
#endif
PROG1=sgmls
SRCS1=lexrf.c pcbrf.c synrf.c context.c md1.c md2.c pars1.c pars2.c serv.c \
sgml1.c sgml2.c sgmlmsg.c sgmlxtrn.c traceset.c entgen.c sgmlio.c \
xfprintf.c main.c unixproc.c sgmldecl.c version.c strerror.c getopt.c \
msgcat.c lineout.c ambig.c exclude.c lextaba.c
OBJS1=lexrf.o pcbrf.o synrf.o context.o md1.o md2.o pars1.o pars2.o serv.o \
sgml1.o sgml2.o sgmlmsg.o sgmlxtrn.o traceset.o entgen.o sgmlio.o \
xfprintf.o main.o unixproc.o sgmldecl.o version.o strerror.o getopt.o \
msgcat.o lineout.o ambig.o exclude.o lextaba.o
PROG2=sgmlsasp
OBJS2=sgmlsasp.o replace.o sgmls.o strerror.o getopt.o
SRCS2a=sgmlsasp.c replace.c sgmls.c
SRCS2=$(SRCS2a) strerror.c getopt.c
PROG3=rast
SRCS3a=rast.c
SRCS3=$(SRCS3a) sgmls.c strerror.c
OBJS3=rast.o sgmls.o strerror.o getopt.o
XCOMM Not build for now...
PROG4=genlex
SRCS4a=genlex.c ebcdic.c
SRCS4=$(SRCS4a) lextaba.c lexrf.c
OBJS4=genlex.o ebcdic.o lextaba.o lexrf.o
XCOMM SRCS=$(SRCS1) $(SRCS2a) $(SRCS3a) $(SRCS4a) lextabe.c
HDRS=action.h adl.h entity.h error.h etype.h sgmldecl.h keyword.h lextoke.h \
msg.h sgmlaux.h sgmlfnsm.h sgmlincl.h sgmlmain.h lineout.h sgmlxtrn.h \
source.h synxtrn.h tools.h trace.h context.h getopt.h msgcat.h std.h \
appl.h sgmls.h sgmlsasp.h replace.h lexcode.h latin1.h ebcdic.h
PROGRAMS = $(PROG1) $(PROG2) $(PROG3)
#ifdef USLArchitecture
/* work around likely optimizer problem */
context.o: context.c
RemoveFile($@)
ClearmakeOSName
$(CC) -c $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES) $*.c
#endif
ComplexProgramTarget_1(sgmls,,)
ComplexProgramTarget_2(sgmlsasp,,)
ComplexProgramTarget_3(rast,,)

View file

@ -0,0 +1,43 @@
LICENSE AND DISCLAIMER OF WARRANTIES
Standard Generalized Markup Language Users' Group (SGMLUG)
SGML Parser Materials
1. License
SGMLUG hereby grants to any user: (1) an irrevocable royalty-free,
worldwide, non-exclusive license to use, execute, reproduce, display,
perform and distribute copies of, and to prepare derivative works
based upon these materials; and (2) the right to authorize others to
do any of the foregoing.
2. Disclaimer of Warranties
(a) The SGML Parser Materials are provided "as is" to any USER. USER
assumes responsibility for determining the suitability of the SGML
Parser Materials for its use and for results obtained. SGMLUG makes
no warranty that any errors have been eliminated from the SGML Parser
Materials or that they can be eliminated by USER. SGMLUG shall not
provide any support maintenance or other aid to USER or its licensees
with respect to SGML Parser Materials. SGMLUG shall not be
responsible for losses of any kind resulting from use of the SGML
Parser Materials including (without limitation) any liability for
business expense, machine downtime, or damages caused to USER or third
parties by any deficiency, defect, error, or malfunction.
(b) SGMLUG DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, ARISING OUT
OF OR RELATING TO THE SGML PARSER MATERIALS OR ANY USE THEREOF,
INCLUDING (WITHOUT LIMITATION) ANY WARRANTY WHATSOEVER AS TO THE
FITNESS FOR A PARTICULAR USE OR THE MERCHANTABILITY OF THE SGML PARSER
MATERIALS.
(c) In no event shall SGMLUG be liable to USER or third parties
licensed by USER for any indirect, special, incidental, or
consequential damages (including lost profits).
(d) SGMLUG has no knowledge of any conditions that would impair its right
to license the SGML Parser Materials. Notwithstanding the foregoing,
SGMLUG does not make any warranties or representations that the
SGML Parser Materials are free of claims by third parties of patent,
copyright infringement or the like, nor does SGMLUG assume any
liability in respect of any such infringement of rights of third
parties due to USER's operation under this license.

View file

@ -0,0 +1,104 @@
This file describes recent user-visible changes in sgmls. Bug fixes
are not described. See the man pages for more details.
Version 1.1
===========
The rast filter converts the output of sgmls to RAST format. See
rast.man.
There have been some changes to the output format: system and public
identifiers for external entities and notations are specified using
the new `s' and `p' commands; the filenames for external entities are
specified using the new `f' command rather than being arguments to the
`E' and `S' commands; the `\s' escape sequence is no longer generated;
an `S' command is generated for an entity mentioned in a `{' command;
RS characters are no longer stripped and are represented by `\012'.
The -c option now takes an argument giving the name of the file to
which the report of capacity calculations should be written. The
report is in RACT format.
sgmls can now handle non-seekable devices (such as pipes). If no
filenames are specified on the command line, sgmls will read the
document entity from standard input. A filename of `-' can also be
used to refer to standard input.
The output format no longer distinguishes attributes whose declared
value is ID, IDREF or IDREFS and uses the TOKEN keyword for these.
(The ESIS does not distinguish these attributes.)
The -a option is no longer allowed.
Version 1.0
===========
Eight bit characters can be made name characters.
Ambiguous content models are always detected. The -a option is ignored.
Version 0.8
===========
On Unix systems, the configure script can automatically generate
config.h from unix.cfg.
An APPINFO parameter in the SGML declaration other than NONE is output
as a `#' command.
sgmls has a -iNAME option which defines a parameter entity NAME with
replacement text "INCLUDE".
sgmls has a -u option that warns about undefined elements.
In SGML_PATH, the public text designating sequence (escape sequence)
is now accessed with %E rather than %S. %S now gives the system
identifier. When a system identifier is supplied, SGML_PATH will be
used to generate a filename only if SGML_PATH uses %S and the system
identifier does not contain (semi-)colons.
An accordance with Amendment 1 to ISO 8879:1986, in the SGML
declaration `ISO 8879:1986' rather than `ISO 8879-1986' is required.
With MS-DOS, errors can be redirected to a file using the -f option.
Version 0.7
===========
More quantity limits can be changed. In particular, GRPCNT, GRPLVL
and GRPGTCNT can be increased up to 253; NAMELEN can be increased to
239. Names are now dynamically allocated (that is, the amount of
memory used to store a name depends on the actual length of the name
rather than on value specified for NAMELEN.)
sgmlasp supports a -n option which disables upper-case substitution
for names in replacement files.
sgmls has a -p option which makes it parse only the prolog.
The format of the I command has been changed: CDATA and SDATA entities
are distinguished using a keyword rather than by surrounding SDATA
entities with \|s.
Version 0.6
===========
A concrete syntax can now be specified explicitly in the SGML
declaration, and various parts of the reference concrete syntax can be
changed, including some quantity limits.
The treatment of notation identifiers and the syntax of the N output
command have been changed.
SUBDOC support works with MS-DOS.
The -n option has been removed; references to subdocument entities are
always resolved.
It is no longer possible to change the implied SGML declaration using
environment variables. You must use an explicit SGML declaration
instead.
The V output command has been removed.
sgmlsasp supports multiple replacement files.

View file

@ -0,0 +1,38 @@
/* $XConsortium: README /main/2 1996/07/15 14:10:45 drk $ */
This is sgmls, an SGML parser derived from the ARCSGML parser
materials which were written by Charles F. Goldfarb. (These are
available for anonymous ftp from ftp.ifi.uio.no [128.240.88.1] in the
directory SIGhyper/SGMLUG/distrib.)
The version number is given in the file version.c.
The file INSTALL contains installation instructions.
The file NEWS describes recent user-visible changes.
The file sgmls.man contains a Unix manual page; sgmls.txt is the
formatted version of this.
The file sgml-mode.el contains a very simple SGML mode for GNU Emacs.
The files sgmls.c and sgmls.h contain a small library for parsing the
output of sgmls. This is used by sgmlsasp, which translates the
output of sgmls using an ASP replacement file, and by rast, which
translates the output of sgmls to the format of a RAST result. The
files sgmlsasp.man and rast.man contain Unix manual pages for sgmlsasp
and rast; sgmlsasp.txt and rast.txt are the formatted versions of
these.
The file LICENSE contains the license which applies to arcsgml and
accordingly to those parts of sgmls derived from arcsgml. See also
the copyright notice at the beginning of sgmlxtrn.c. The parts that
were written by me are in the public domain (any files that were
written entirely by me contain a comment to that effect.) The file
sgml-mode.el is covered by the GNU GPL.
Please report any bugs to me. When reporting bugs, please include the
version number, details of your machine, OS and compiler, and a
complete self-contained file that will allow me to reproduce the bug.
James Clark
jjc@jclark.com

View file

@ -0,0 +1,78 @@
Warn about mixed content models where #PCDATA can't occur everywhere.
Perhaps there should be a configuration option saying what a control
character is for the purpose of SHUNCHAR CONTROLS.
Should the current character that is printed in error messages be
taken from be taken from the file entity or the current entity?
Refine SYS_ action. If we distinguish DELNONCH in lexmark, lexgrp,
lexsd, we can have separate action that ignores the following
character as well.
Should RSs in CDATA/SDATA entities be ignored as specified in 322:1-2?
Similarily, do the rules on REs in 322:3-11 apply to CDATA/SDATA
entities? (I don't think they count as being `in content'.)
What should the entity manager do when it encounters code 13 in an
input file? (Currently it treats it as an RE.)
Document when invalid exclusions are detected.
Option not to perform capacity checking.
Give a warning if the recommendation of 422:1-3 is contravened.
Should an empty CDATA/RCDATA marked section be allowed in the document
type declaration subset?
Include example of use of SGML_PATH in documentation.
Try to detect the situation in 310:8-10 (but see 282:1-2).
Resize hash tables if they become too full.
Say something in the man page about message catalogues.
Consider whether support for SHORTREF NONE requires further changes
(other than disallowing short reference mapping declaration).
Fake /dev/fd/N and /dev/stdin for systems that don't provide it.
Improve the effficiency of the entity manager by not closing and
reopening files. If we run out of FILEs choose the stream with the
fewest bytes remaining to be read, and read the rest of it into
memory. Each entity level will have its own read buffer.
Support multi-line error messages: automatically indent after
newline. (We could output to a temporary file first, then copy to
stderr replacing newlines by newline+indent).
Option that says to output out of context things.
Divide up formal public identifier errors. Give these errors their
own type code.
Consider whether, when OMITTAG is NO, we need to change interpretation
of an empty start-tag (7.4.1.1).
Possibly turn errors 70 and 136 into warnings.
Make things work with NORMSEP > 2. Would need to keep track of number
of CDATA and SDATA entities in CDATA attributes.
Handle `SCOPE INSTANCE'.
In entgen.c, truncate filenames for OSs that don't do this themselves.
Provide an option that specifies that maximum number of errors; when
this limit is exceeded sgmls would exit.
Document non-portable assumptions in the code.
Option to write out SGML declaration. In this case make it write out
APPINFO parameter.
Allow there to be catalogs mapping public ids to filenames.
Environment variable SGML_CATALOG containing list of filenames of
catalogs.

View file

@ -0,0 +1,180 @@
/* $XConsortium: action.h /main/3 1996/06/19 17:14:03 drk $ */
/* ACTION.H: Symbols for all PCB action codes. */
/* CONACT.H: Symbols for content parse action names (end with '_').
There must be no conflict with PARSEACT.H, which
uses 0 through 19, or SGMLACT.H, which uses 20 through 32
(except that 31 - 32 can be defined here because they are
used only by PARSEPRO and do not conflict with SGML.C).
*/
#define CIR_ 31 /* Invalid character(s) ignored in MDS; restarting parse. */
#define DTD_ 32 /* Process DOCTYPE declaration. */
#define DTE_ 33 /* End of DOCTYPE declaration. */
#define PEP_ 34 /* TEMP: Previous character ended prolog. */
#define DAS_ 35 /* Current character begins data. */
#define FCE_ 36 /* Process free character (SR12-18, 21-30). */
#define DCE_ 37 /* Data character in element text; change PCB. */
#define LAS_ 38 /* Start lookahead buffer with current character. */
#define LAM_ 39 /* Move character to lookahead buffer. */
#define LAF_ 40 /* Flush the lookahead buffer; REPEATCC. */
#define NED_ 41 /* Process null end-tag delimiter. */
#define NET_ 42 /* Process null end-tag. */
#define NST_ 43 /* Process null start-tag. */
#define NLF_ 44 /* Flush lookahead buffer except for trailing NET or SR. */
#define ETC_ 45 /* End-tag in CDATA or RCDATA; treat as data if invalid. */
#define SRMIN 46 /* Dummy for SHORT REFERENCES: srn = SRn - SRMIN. */
#define SR1_ 47 /* TAB */
#define SR2_ 48 /* RE */
#define SR3_ 49 /* RS */
#define SR4_ 50 /* Leading blanks */
#define SR5_ 51 /* Null record */
#define DAR_ 52 /* Flush data buffer after repeating current character. */
#define SR7_ 53 /* Trailing blanks */
#define SR8_ 54 /* Space */
#define SR9_ 55 /* Two or more blanks */
#define SR10 56 /* Quotation mark (first data character) */
#define SR11 57 /* Number sign */
#define SR12 58 /* FCE CHARACTERS start here */
/* _ 59 */
#define BSQ_ 60 /* Blank sequence begun; find its end. */
/* 61 In use by PARSEACT.H */
/* 62 In use by PARSEACT.H */
/* 63 In use by PARSEACT.H */
/* 64 In use by PARSEACT.H */
#define SR19 65 /* Hyphen */
#define SR20 66 /* Two hyphens */
#define SR25 71 /* Left bracket */
#define SR26 72 /* Right bracket */
#define RBR_ 73 /* Two right brackets. */
#define GTR_ 74 /* EOB with pending data character */
#define MSP_ 75 /* Marked section start in prolog outside DTD */
#define APP_ 76 /* APPINFO (other than NONE) */
#define STE_ 77 /* Start tag ended prolog */
/* GRPACT.H: Symbols for group tokenization action names (all alpha).
There must be no conflict with PARSEACT.H, which
uses 0 - 19.
*/
#define AND 20 /* AND connector found. */
#define DTAG 21 /* Data tag token group occurred (treat as #CHARS). */
#define GRPE 22 /* Group ended. */
#define GRP_ 23 /* Group started. */
#define NAS_ 24 /* Name started in content model or name group. */
#define NMT_ 25 /* Name or name token started in name token group. */
#define OPT 26 /* OPT occurrence indicator for previous token. */
#define OR 27 /* OR connector found. */
#define OREP 28 /* OREP occurrence indicator for previous token. */
#define REP 29 /* REP occurrence indicator for previous token. */
#define RNS_ 30 /* Reserved name started (#PCDATA). */
#define SEQ 31 /* SEQ connector found. */
/* LITACT.H: Symbols for content parse action names (end with '_').
There must be no conflict with PARSEACT.H, which
uses 0 through 19.
*/
#define MLA_ 20 /* Move character to look-aside data buffer. */
#define LPR_ 21 /* Move previous character to data buffer. */
#define RSM_ 22 /* Process record start and move it to data buffer. */
#define FUN_ 23 /* Replace function character with a space. */
#define LP2_ 24 /* Move previous two characters to data buffer. */
#define MLE_ 25 /* Minimum literal error: invalid character ignored. */
#define RPR_ 26 /* Remove previous character from data buffer; terminate. */
#define TER_ 27 /* Terminate the parse. */
/* MDACT.H: Symbols for markup declaration parse action names (all alpha).
There must be no conflict with PARSEACT.H, which
uses 0 - 19.
*/
#define CDR 20 /* CD[1] (MINUS) occurred previously. */
#define EMD 21 /* End of markup declaration. */
#define GRPS 22 /* Group started. */
#define LIT 23 /* Literal started: character data. */
#define LITE 24 /* Literal started: character data; LITA is delimiter. */
#define MGRP 25 /* Minus exception group (MINUS,GRPO). */
#define NAS 26 /* Name started. */
#define NMT 27 /* Name token started. */
#define NUM 28 /* Number or number token started. */
#define PEN 29 /* Parameter entity name being defined (PERO found). */
#define PGRP 30 /* Plus exception group (PLUS,GRPO). */
#define RNS 31 /* Reserved name started. */
#define MDS 32 /* Markup declaration subset start. */
#define PENR 33 /* REPEATCC; PERO found. */
/* PARSEACT.H: Symbols for common parse action names (end with '_').
There must be no conflict with other action name
files, which use numbers greater than 19.
*/
#define CRA_ 1 /* Character reference: alphabetic. */
#define CRN_ 2 /* Character reference: numeric; non-char refs o.k.. */
#define NON_ 3 /* Single byte of non-character data found. */
#define EOF_ 4 /* Error: illegal entity end; resume old input; return. */
#define ER_ 5 /* Entity reference; start new input source; continue. */
#define GET_ 6 /* EOB, EOS, or EE: resume old input source; continue. */
#define INV_ 7 /* Error: invalid char terminated markup; repeat char. */
#define LEN_ 8 /* Error: length limit exceeded; end markup; repeat char. */
#define NOP_ 9 /* No action necessary. */
#define PCI_ 10 /* Previous character was invalid. */
#define PER_ 11 /* Parameter reference; start new input source; continue. */
#define RC2_ 12 /* Back up two characters. */
#define RCC_ 13 /* Repeat current character. */
#define RCR_ 14 /* Repeat current character and return to caller. */
#define EE_ 15 /* EOS or EE: resume old input source; return to caller. */
#define RS_ 16 /* Record start: ccnt=0; ++rcnt. */
#define ERX_ 17 /* Entity reference; start new input source; return. */
#define SYS_ 18 /* Error allowed: SYSCHAR in input stream; replace it. */
#define EOD_ 19 /* End of document. */
/* Number way out of order to avoid recompilation. */
#define NSC_ 58 /* Handle DELNONCH/DELXNONCH when NON_ is allowed */
#define PEX_ 61 /* Parameter entity ref; start new input source; return. */
#define DEF_ 62 /* Data entity found. */
#define PIE_ 63 /* PI entity found (needed in markup). */
#define LNR_ 64 /* LEN_ error with extra REPEATCC. */
/* SGMLACT.H: Symbols for content parse action names (end with '_')
that are returned to SGML.C for processing.
There must be no conflict with PARSEACT.H, which
uses 0 through 19, or CONACT.H, which uses 34 and above.
(Note: 31 is also used in CONACT.H, but no conflict
is created because they are tested only in PARSEPRO.C, which
completes before SGML.C starts to examine those codes.
Also, when EOD_ is returned from PARSECON, it is changed
to LOP_.)
*/
#define CON_ 20 /* Normal content action (one of the following). */
#define DAF_ 21 /* Data found. */
#define ETG_ 22 /* Process end-tag. */
#define MD_ 23 /* Process markup declaration (NAMESTRT found). */
#define MDC_ 24 /* Process markup declaration comment (CD found). */
#define MSS_ 25 /* Process marked section start. */
#define MSE_ 26 /* Process marked section end. */
#define PIS_ 27 /* Processing instruction (string). */
#define REF_ 28 /* Record end found. */
#define STG_ 29 /* Process start-tag. */
#define RSR_ 30 /* Return RS to effect SGML state transition. */
#define LOP_ 31 /* Loop for new content without returning anything. */
/* TAGACT.H: Symbols for tag parse action names (all alpha).
There must be no conflict with PARSEACT.H, which
uses 0 - 19.
*/
#define AVD 20 /* Delimited attribute value started: normal delimiter. */
#define AVU 21 /* Undelimited value started. */
#define ETIC 22 /* Tag closed with ETI. */
#define NVS 23 /* Name of attribute or value started. */
#define NASV 24 /* Saved NAS was actually an NTV. */
#define NTV 25 /* Name token value started; get name and full value. */
#define TAGC 26 /* Tag closed normally. */
#define TAGO 27 /* Tag closed implicitly by TAGO character. */
#define AVDA 28 /* Delimited attribute value started: alternative delim. */
#define DSC 29 /* Closed by DSC character. */
/* VALACT.H: Symbols for attribute value tokenization action names (all alpha).
*/
#define NOPA 0 /* No action necessary. */
#define INVA 1 /* Invalid character; terminate parse. */
#define LENA 2 /* Length limit of token exceeded; terminate parse. */
#define NASA 3 /* Name started. */
#define NMTA 4 /* Name token started. */
#define NUMA 5 /* Number or number token started. */
/* SGML declaration parsing actions. */
#define ESGD 20 /* End of SGML declaration. */
#define LIT1 21 /* Literal started. */
#define LIT2 22 /* Literal started with LITA delimiter. */
#define NUM1 23 /* Number started. */
#define NAS1 24 /* Name started. */
#define ISIG 25 /* Insignificant character occurred. */

View file

@ -0,0 +1,119 @@
/* $XConsortium: adl.h /main/3 1996/06/19 17:14:09 drk $ */
/* ADL.H: Definitions for attribute descriptor list processing.
*/
/* N/C/SDATA external entity types for nxetype member of ne structure. */
#define ESNCDATA 1 /* External character data entity. */
#define ESNNDATA 2 /* Non-SGML data entity. */
#define ESNSDATA 3 /* External specific character data entity. */
#define ESNSUB 4 /* SGML subdocument entity. */
/* N/C/SDATA control block for AENTITY attributes and NDATA returns.*/
struct ne { /* N/C/SDATA entity control block. */
UNIV neid; /* Files for NDATA entity. */
UNCH *nepubid; /* Public identifier if specified. */
UNCH *nesysid; /* System identifier if specified. */
PDCB nedcn; /* Data content notation control block. */
struct ad *neal; /* Data attribute list (NULL if none). */
UNCH *neename; /* Ptr to entity name (length and EOS). */
UNCH nextype; /* Entity type: NDATA SDATA CDATA SUBDOC. */
};
#define NESZ (sizeof(struct ne))
typedef struct ne *PNE;
/* NDATA entity control block fields. */
#define NEID(p) (((PNE)p)->neid) /* File ID of NDATA entity. */
#define NESYSID(p) (((PNE)p)->nesysid) /* System ID of NDATA entity. */
#define NEPUBID(p) (((PNE)p)->nepubid) /* Public ID of NDATA entity. */
#define NEDCN(p) (((PNE)p)->nedcn->ename) /* Data content notation name. */
#define NEDCNSYSID(p) (((PNE)p)->nedcn->sysid) /* Notation system ID.*/
#define NEDCNPUBID(p) (((PNE)p)->nedcn->pubid) /* Notation public ID.*/
#define NEDCNDEFINED(p) (((PNE)p)->nedcn->defined) /* Notation defined? */
#define NEDCNADL(p) (((PNE)p)->nedcn->adl) /* Data content notation attlist.*/
#define NEENAME(p) (((PNE)p)->neename) /* Entity name pointer. */
#define NEXTYPE(p) (((PNE)p)->nextype) /* External entity type. */
#define NEAL(p) (((PNE)p)->neal) /* Data attributes (if any). */
#define NEDCNMARK(p) DCNMARK(((PNE)p)->nedcn)
/* Attribute descriptor list entry. */
struct ad {
UNCH *adname; /* Attribute name with length and EOS. */
UNCH adflags; /* Attribute flags. */
UNCH adtype; /* Value type. */
UNS adnum; /* Group size or member pos in grp. */
UNS adlen; /* Length of default or value (for capacity). */
UNCH *addef; /* Default value (NULL if REQUIRED or IMPLIED). */
union {
PNE n; /* AENTITY: NDATA control block. */
PDCB x; /* ANOTEGRP: DCN control block. */
} addata; /* Special data associated with some attributes.*/
};
#define ADSZ (sizeof(struct ad)) /* Size of an ad structure. */
/* Attribute flags for entire list adflags: ADLF. */
#define ADLREQ 0x80 /* Attribute list: 1=REQUIRED att defined. */
#define ADLNOTE 0x40 /* Attribute list: 1=NOTATION att defined. */
#define ADLCONR 0x20 /* Attribute list: 1=CONREF att defined. */
/* Attribute flags for list member adflags: ADFLAGS(n). */
#define AREQ 0x80 /* Attribute: 0=null; 1=required. */
#define ACURRENT 0x40 /* Attribute: 0=normal; 1=current. */
#define AFIXED 0x20 /* Attribute: 0=normal; 1=must equal default. */
#define AGROUP 0x10 /* Attribute: 0=single; 1=group of ad's. */
#define ACONREF 0x08 /* Attribute: 0=normal; 1=att is CONREF. */
#define AINVALID 0x04 /* Attribute: 1=value is invalid; 0=o.k. */
#define AERROR 0x02 /* Attribute: 1=error was specified; 0=o.k. */
#define ASPEC 0x01 /* Attribute: 1=value was specified; 0=default. */
/* Attribute types for adtype. */
#define ANMTGRP 0x00 /* Attribute: Name token group or member. */
#define ANOTEGRP 0x01 /* Attribute: Notation (name group). */
#define ACHARS 0x02 /* Attribute: Character string. */
#define AENTITY 0x03 /* Attribute: Data entity (name). */
#define AID 0x04 /* Attribute: ID value (name). */
#define AIDREF 0x05 /* Attribute: ID reference value (name). */
#define ANAME 0x06 /* Attribute: Name. */
#define ANMTOKE 0x07 /* Attribute: Name token. */
#define ANUMBER 0x08 /* Attribute: Number. */
#define ANUTOKE 0x09 /* Attribute: Number token. */
#define ATKNLIST 0x0A /* Attribute: >= means value is a token list. */
#define AENTITYS 0x0A /* Attribute: Data entities (name list). */
#define AIDREFS 0x0B /* Attribute: ID reference value (name list). */
#define ANAMES 0x0C /* Attribute: Name list. */
#define ANMTOKES 0x0D /* Attribute: Name token list. */
#define ANUMBERS 0x0E /* Attribute: Number list. */
#define ANUTOKES 0x0F /* Attribute: Number token list. */
/* Field definitions for entries in an attribute list.
The first argument to all of these is the list address.
*/
/* Attribute list: flags. */
#define ADLF(a) ((a)[0].adflags)
/* Attribute list: number of list members. */
#define ADN(a) ((a)[0].adtype)
/* Attribute list: number of attributes. */
#define AN(a) ((a)[0].adnum)
/* Nth attribute in list: name. */
#define ADNAME(a, n) (((a)[n].adname+1))
/* Nth att in list: number of val)ues. */
#define ADNUM(a, n) ((a)[n].adnum)
/* Nth attribute in list: flags. */
#define ADFLAGS(a, n) ((a)[n].adflags)
/* Nth attribute in list: type. */
#define ADTYPE(a, n) ((a)[n].adtype)
/* Nth attribute in list: len of def or val.*/
#define ADLEN(a, n) ((a)[n].adlen)
/* Nth attribute in list: def or value. */
#define ADVAL(a, n) ((a)[n].addef)
/* Nth attribute in list: special data. */
#define ADDATA(a, n) ((a)[n].addata)
/* Nth att: token at Pth pos in value. */
#define ADTOKEN(a, n, p)(((a)[n].addef+(p)))
#define IDHASH 101 /* Size of ID hash table. Must be prime. */
struct id { /* ID attribute control block. */
struct id *idnext; /* Next ID in chain. */
UNCH *idname; /* ID name with length prefix and EOS. */
UNCH iddefed; /* Non-zero if it has been defined. */
struct fwdref *idrl; /* Chain of forward references to this ID. */
};
#define IDSZ sizeof(struct id)
typedef struct id *PID; /* Ptr to ID attribute control block. */

View file

@ -0,0 +1,439 @@
/* $XConsortium: ambig.c /main/3 1996/06/19 17:14:13 drk $ */
/* ambig.c -
Content model ambiguity checking.
Written by James Clark (jjc@jclark.com).
*/
/*
This uses the construction in pp8-9 of [1], extended to deal with AND
groups.
Note that it is not correct for the purposes of ambiguity analysis to
handle AND groups by turning them into an OR group of SEQ groups
(consider (a&b?)).
We build an automaton for the entire content model by adding the
following case for AND:
nullable(v) := nullable(left child) and nullable(right child)
if nullable(right child) then
for each x in last(left child) do
follow(v,x) = follow(left child,x) U first(right child);
if nullable(left child) then
for each x in last(right child) do
follow(v,x) = follow(right child,x) U first(left child);
first(v) := first(left child) U first(right child);
last(v) := first(left child) U first(right child);
We also build an automaton for each AND group by building automata for
each of the members of the AND group using the above procedure and
then combine the members using:
for each x in last(left child) do
follow(v,x) = follow(left child,x) U first(right child);
for each x in last(right child) do
follow(v,x) = follow(right child,x) U first(left child);
first(v) := first(left child) U first(right child);
The content model is ambiguous just in case one of these automata is
non-deterministic. (Note that when checking determinism we need to
check the `first' set as well as all the `follow' sets.)
Why is this correct? Consider a primitive token in a member of an AND
group. There are two worst cases for ambiguity: firstly, when none of
the other members of AND group have been matched; secondly, when just
the nullable members remain to be matched. The first case is not
affected by context of the AND group (unless the first case is
identical to the second case.)
Note that inclusions are not relevant for the purposes of determining
the ambiguity of content models. Otherwise the case in clause
11.2.5.1:
An element that can satisfy an element in the content model is
considered to do so, even if the element is also an inclusion.
could never arise.
[1] Anne Brueggemann-Klein, Regular Expressions into Finite Automata,
Universitaet Freiburg, Institut fur Informatik, 33 July 1991.
*/
#include "sgmlincl.h"
/* Sets of states are represented by 0-terminated, ordered lists of
indexes in gbuf. */
#define MAXSTATES (GRPGTCNT+2)
#define listcat(x, y) strcat((char *)(x), (char *)(y))
#define listcpy(x, y) strcpy((char *)(x), (char *)(y))
/* Information about a content token. */
struct contoken {
UNCH size;
UNCH nullable;
UNCH *first;
UNCH *last;
};
static VOID contoken P((int, int, struct contoken *));
static VOID andgroup P((int, int, struct contoken *));
static VOID orgroup P((int, int, struct contoken *));
static VOID seqgroup P((int, int, struct contoken *));
static VOID andambig P((int));
static int listambig P((UNCH *));
static VOID listmerge P((UNCH *, UNCH *));
static struct contoken *newcontoken P((void));
static VOID freecontoken P((struct contoken *));
/* Dynamically allocated vector of follow sets. */
static UNCH **follow;
static UNCH *mergebuf; /* for use by listmerge */
/* Set to non-zero if the content model is ambiguous. */
static int ambigsw;
/* Check the current content model (in gbuf) for ambiguity. */
VOID ambig()
{
struct contoken *s;
int i;
if (!follow) {
/* We can't allocate everything in one chunk, because that would
overflow a 16-bit unsigned if GRPGTCNT was 253. */
UNCH *ptr;
follow = (UNCH **)rmalloc(MAXSTATES*sizeof(UNCH *));
follow[0] = 0;
ptr = (UNCH *)rmalloc((MAXSTATES - 1)*MAXSTATES);
for (i = 1; i < MAXSTATES; i++) {
follow[i] = ptr;
ptr += MAXSTATES;
}
mergebuf = (UNCH *)rmalloc(MAXSTATES);
}
for (i = 1; i < MAXSTATES; i++)
follow[i][0] = 0;
ambigsw = 0;
s = newcontoken();
contoken(1, 1, s);
ambigsw = ambigsw || listambig(s->first);
freecontoken(s);
for (i = 1; !ambigsw && i < MAXSTATES; i++)
if (listambig(follow[i]))
ambigsw = 1;
if (ambigsw)
mderr(137, (UNCH *)0, (UNCH *)0);
}
/* Free memory used for ambiguity checking. */
VOID ambigfree()
{
if (follow) {
frem((UNIV)follow[1]);
frem((UNIV)follow);
frem((UNIV)mergebuf);
follow = 0;
}
}
/* Determine whether a list of primitive content tokens (each
represented by its index in gbuf) is ambiguous. */
static
int listambig(list)
UNCH *list;
{
UNCH *p;
int chars = 0;
int rc = 0;
for (p = list; *p; p++) {
if ((gbuf[*p].ttype & TTMASK) == TTETD) {
struct etd *e = gbuf[*p].tu.thetd;
if (e->mark) {
rc = 1;
break;
}
e->mark = 1;
}
else {
assert((gbuf[*p].ttype & TTMASK) == TTCHARS);
if (chars) {
rc = 1;
break;
}
chars = 1;
}
}
for (p = list; *p; p++)
if ((gbuf[*p].ttype & TTMASK) == TTETD)
gbuf[*p].tu.thetd->mark = 0;
return rc;
}
/* Analyze a content token. The `checkand' argument is needed to ensure
that the algorithm is not exponential in the AND-group nesting depth.
*/
static
VOID contoken(m, checkand, res)
int m; /* Index of content token in gbuf */
int checkand; /* Non-zero if AND groups should be checked */
struct contoken *res; /* Result */
{
UNCH flags = gbuf[m].ttype;
switch (flags & TTMASK) {
case TTCHARS:
case TTETD:
res->first[0] = m;
res->first[1] = 0;
res->last[0] = m;
res->last[1] = 0;
res->size = 1;
res->nullable = 0;
break;
case TTAND:
if (checkand)
andambig(m);
andgroup(m, checkand, res);
break;
case TTOR:
orgroup(m, checkand, res);
break;
case TTSEQ:
seqgroup(m, checkand, res);
break;
default:
abort();
}
if (flags & TREP) {
UNCH *p;
for (p = res->last; *p; p++)
listmerge(follow[*p], res->first);
}
if (flags & TOPT)
res->nullable = 1;
}
/* Check an AND group for ambiguity. */
static
VOID andambig(m)
int m;
{
int i, tnum;
int lim;
struct contoken *curr;
struct contoken *next;
tnum = gbuf[m].tu.tnum;
assert(tnum > 0);
curr = newcontoken();
next = newcontoken();
contoken(m + 1, 0, curr);
i = m + 1 + curr->size;
curr->size += 1;
for (--tnum; tnum > 0; --tnum) {
UNCH *p;
contoken(i, 0, next);
curr->size += next->size;
i += next->size;
for (p = curr->last; *p; p++)
listcat(follow[*p], next->first);
for (p = next->last; *p; p++)
listmerge(follow[*p], curr->first);
listcat(curr->first, next->first);
listcat(curr->last, next->last);
}
lim = m + curr->size;
for (i = m + 1; i < lim; i++) {
if (listambig(follow[i]))
ambigsw = 1;
follow[i][0] = 0;
}
freecontoken(curr);
freecontoken(next);
}
/* Handle an AND group. */
static
VOID andgroup(m, checkand, res)
int m;
int checkand;
struct contoken *res;
{
int i, tnum;
/* union of the first sets of nullable members of the group */
UNCH *nullablefirst;
struct contoken *next;
tnum = gbuf[m].tu.tnum;
assert(tnum > 0);
contoken(m + 1, checkand, res);
nullablefirst = (UNCH *)rmalloc(MAXSTATES);
if (res->nullable)
listcpy(nullablefirst, res->first);
else
nullablefirst[0] = 0;
i = m + 1 + res->size;
res->size += 1;
next = newcontoken();
for (--tnum; tnum > 0; --tnum) {
UNCH *p;
contoken(i, checkand, next);
res->size += next->size;
i += next->size;
if (next->nullable)
for (p = res->last; *p; p++)
listcat(follow[*p], next->first);
for (p = next->last; *p; p++)
listmerge(follow[*p], nullablefirst);
listcat(res->first, next->first);
if (next->nullable)
listcat(nullablefirst, next->first);
listcat(res->last, next->last);
res->nullable &= next->nullable;
}
frem((UNIV)nullablefirst);
freecontoken(next);
}
/* Handle a SEQ group. */
static
VOID seqgroup(m, checkand, res)
int m;
int checkand;
struct contoken *res;
{
int i, tnum;
struct contoken *next;
tnum = gbuf[m].tu.tnum;
assert(tnum > 0);
contoken(m + 1, checkand, res);
i = m + 1 + res->size;
res->size += 1;
next = newcontoken();
for (--tnum; tnum > 0; --tnum) {
UNCH *p;
contoken(i, checkand, next);
res->size += next->size;
i += next->size;
for (p = res->last; *p; p++)
listcat(follow[*p], next->first);
if (res->nullable)
listcat(res->first, next->first);
if (next->nullable)
listcat(res->last, next->last);
else
listcpy(res->last, next->last);
res->nullable &= next->nullable;
}
freecontoken(next);
}
/* Handle an OR group. */
static
VOID orgroup(m, checkand, res)
int m;
int checkand;
struct contoken *res;
{
int i, tnum;
struct contoken *next;
tnum = gbuf[m].tu.tnum;
assert(tnum > 0);
contoken(m + 1, checkand, res);
i = m + 1 + res->size;
res->size += 1;
next = newcontoken();
for (--tnum; tnum > 0; --tnum) {
contoken(i, checkand, next);
res->size += next->size;
i += next->size;
listcat(res->first, next->first);
listcat(res->last, next->last);
res->nullable |= next->nullable;
}
freecontoken(next);
}
/* Merge the second ordered list into the first. */
static
VOID listmerge(p, b)
UNCH *p, *b;
{
UNCH *a = mergebuf;
strcpy((char *)a, (char *)p);
for (;;) {
if (*a) {
if (*b) {
if (*a < *b)
*p++ = *a++;
else if (*a > *b)
*p++ = *b++;
else
a++;
}
else
*p++ = *a++;
}
else if (*b)
*p++ = *b++;
else
break;
}
*p = '\0';
}
static
struct contoken *newcontoken()
{
struct contoken *p = (struct contoken *)rmalloc(sizeof(struct contoken)
+ MAXSTATES*2);
p->first = (UNCH *)(p + 1);
p->last = p->first + MAXSTATES;
return p;
}
static
VOID freecontoken(p)
struct contoken *p;
{
frem((UNIV)p);
}
/*
Local Variables:
c-indent-level: 5
c-continued-statement-offset: 5
c-brace-offset: -5
c-argdecl-indent: 0
c-label-offset: -5
End:
*/

View file

@ -0,0 +1,34 @@
/* $XConsortium: appl.h /main/3 1996/06/19 17:14:17 drk $ */
/* appl.h */
enum {
E_NOMEM = 1,
E_DOC,
E_EXEC,
E_FORK,
E_WAIT,
E_SIGNAL,
E_OPEN,
E_CAPBOTCH,
E_SUBDOC
};
VOID process_document P((int));
VOID output_conforming P((void));
UNIV xmalloc P((UNS));
UNIV xrealloc P((UNIV, UNS));
VOID appl_error VP((int, ...));
#ifdef SUPPORT_SUBDOC
int run_process P((char **));
char **make_argv P((UNIV));
VOID get_subcaps P((void));
#endif
#ifdef SUPPORT_SUBDOC
extern int suberr;
#endif
extern int suppsw;
extern int locsw;

View file

@ -0,0 +1,146 @@
/* cms.cfg: Configuration file for sgmls on VM/CMS. */
/* Contributed by C. M. Sperberg-McQueen <u35395@uicvm.uic.edu>. */
/* A list of filename templates to use for searching for external
entities.
The filenames are separated by the character specified in PATH_FILE_SEP.
See sgmls.man for details. */
#define DEFAULT_PATH "%N.%X:%N.%C"
/* The character that separates the filenames templates. */
#define PATH_FILE_SEP ';'
/* The character that separates filenames in a system identifier.
Usually the same as PATH_FILE_SEP. */
#define SYSID_FILE_SEP ';'
/* The environment variable that contains the list of fileid patterns. */
#define PATH_ENV_VAR "SGML_PATH"
/* MIN_DAT_SUBS_FROM and MIN_DATS_SUBS_TO tell sgmls how to transform a
name or system identifier into a legal filename. A character in
MIN_DAT_SUBS_FROM will be transformed into the character in the
corresponding position in MIN_DAT_SUBS_TO. If there is no such
position, then the character is removed. */
/* This says that spaces and the characters :'(),./=? should be deleted. */
#define MIN_DAT_SUBS_FROM " :\'(),./=?"
#define MIN_DAT_SUBS_TO ""
/* Define this to allow tracing. */
/* #define TRACE 1 */
/* Define this you want support for subdocuments. This is implemented
using features that are not part of Standard C, so you might not want
to define it if you are porting to a new system. Otherwise I suggest
you leave it defined. */
/* OK, I'll drop it for now. -MSM */
#define SUPPORT_SUBDOC 0
/* Define HAVE_EXTENDED_PRINTF if your *printf functions supports
X/Open extensions; if they do, then, for example,
printf("%2$s%1$s", "bar", "foo")
should print `foobar'. */
/* #define HAVE_EXTENDED_PRINTF 1 */
/* Define HAVE_CAT if your system provides the X/Open message
catalogue functions catopen() and catgets(), and you want to use them.
An implementations of these functions is included and will be used if
you don't define this. On SunOS 4.1.1, if you do define this you
should set CC=/usr/xpg2bin/cc in the makefile. */
/* #define HAVE_CAT 1 */
#ifdef __STDC__
/* Define this if your compiler supports prototypes. */
#define USE_PROTOTYPES 1
#endif
/* Can't use <stdarg.h> without prototypes. */
#ifndef USE_PROTOTYPES
#define VARARGS 1
#endif
/* If your compiler defines __STDC__ but doesn't provide <stdarg.h>,
you must define VARARGS yourself here. */
/* #define VARARGS 1 */
/* Define this if you do not have strerror(). */
/* Manual says we do, linker says it don't like it. -msm */
/* #define STRERROR_MISSING 1 */
/* Define this unless the character testing functions in ctype.h
are defined for all values representable as an unsigned char. You do
not need to define this if your system is ANSI C conformant. You
should define for old Unix systems. */
/* #define USE_ISASCII 1 */
/* Define this if your system provides the BSD style string operations
rather than ANSI C ones (eg bcopy() rather than memcpy(), and index()
rather than strchr()). */
/* #define BSD_STRINGS 1 */
/* Define this if you have getopt(). */
/* #define HAVE_GETOPT 1 */
/* Define this if you have access(). */
#define HAVE_ACCESS 1
/* Define this if you have <unistd.h>. */
/* #define HAVE_UNISTD_H 1 */
/* Define this if you have waitpid(). */
/* #define HAVE_WAITPID 1 */
/* Define this if your system is POSIX.1 (ISO 9945-1:1990) compliant. */
/* #define POSIX 1 */
/* Define this if you have the vfork() system call. */
/* #define HAVE_VFORK 1 */
/* Define this if you have <vfork.h>. */
/* #define HAVE_VFORK_H 1 */
/* Define this if you don't have <stdlib.h> */
/* #define STDLIB_H_MISSING 1 */
/* Define this if you don't have <stddef.h> */
/* #define STDDEF_H_MISSING 1 */
/* Define this if you don't have remove(); unlink() will be used instead. */
/* #define REMOVE_MISSING 1 */
/* Define this if you don't have raise(); kill() will be used instead. */
/* #define RAISE_MISSING 1 */
/* Define this if you don't have fsetpos() and fgetpos(). */
/* Hmm. Waterloo C manual includes them but says "reserved
for future use." -msm */
/* #define FPOS_MISSING 1 */
/* Universal pointer type. */
/* If your compiler doesn't fully support void *, change `void' to `char'. */
typedef void *UNIV;
/* If your compiler doesn't support void as a function return type,
change `void' to `int'. */
typedef void VOID;
/* If you don't have an ANSI C conformant <limits.h>, define
CHAR_SIGNED as 1 or 0 according to whether the `char' type is signed.
The <limits.h> on some versions of System Release V 3.2 is not ANSI C
conformant: the value of CHAR_MIN is 0 even though the `char' type is
signed. */
/* #define CHAR_SIGNED 1 */
/* #define CHAR_SIGNED 0 */
#ifndef CHAR_SIGNED
#include <limits.h>
#if CHAR_MIN < 0
#define CHAR_SIGNED 1
#else
#define CHAR_SIGNED 0
#endif
#endif /* not CHAR_SIGNED */
/* VM/CMS uses EBCDIC. */
#include "ebcdic.h"

View file

@ -0,0 +1,148 @@
/* $XConsortium: config.h /main/4 1996/06/19 17:14:22 drk $ */
/* unix.cfg: Configuration file for sgmls on Unix. */
/* A list of filename templates to use for searching for external entities.
The filenames are separated by the character specified in PATH_FILE_SEP.
See sgmls.man for details. */
#define DEFAULT_PATH "/usr/local/lib/sgml/%O/%C/%T:%N.%X:%N.%D"
/* The character that separates the filenames templates. */
#define PATH_FILE_SEP ':'
/* The character that separates filenames in a system identifier.
Usually the same as PATH_FILE_SEP. */
#define SYSID_FILE_SEP ':'
/* The environment variable that contains the list of filename templates. */
#define PATH_ENV_VAR "SGML_PATH"
/* MIN_DAT_SUBS_FROM and MIN_DATS_SUBS_TO tell sgmls how to transform a name
or system identifier into a legal filename. A character in
MIN_DAT_SUBS_FROM will be transformed into the character in the
corresponding position in MIN_DAT_SUBS_TO. If there is no such
position, then the character is removed. */
/* This says that spaces should be transformed to underscores, and
slashes to percents. */
#define MIN_DAT_SUBS_FROM " /"
#define MIN_DAT_SUBS_TO "_%"
/* Define this to allow tracing. */
/* #define TRACE 1 */
/* Define this you want support for subdocuments. This is implemented
using features that are not part of Standard C, so you might not want
to define it if you are porting to a new system. Otherwise I suggest
you leave it defined. */
#define SUPPORT_SUBDOC 1
/* Define HAVE_EXTENDED_PRINTF if your *printf functions supports
X/Open extensions; if they do, then, for example,
printf("%2$s%1$s", "bar", "foo")
should print `foobar'. */
#define HAVE_EXTENDED_PRINTF 1
/* Define HAVE_CAT if your system provides the X/Open message
catalogue functions catopen() and catgets(), and you want to use them.
An implementations of these functions is included and will be used if
you don't define this. On SunOS 4.1.1, if you do define this you
should set CC=/usr/xpg2bin/cc in the makefile. */
#define HAVE_CAT 1
#ifdef __STDC__
/* Define this if your compiler supports prototypes. */
#define USE_PROTOTYPES 1
#endif
/* Can't use <stdarg.h> without prototypes. */
#ifndef USE_PROTOTYPES
#define VARARGS 1
#endif
/* If your compiler defines __STDC__ but doesn't provide <stdarg.h>,
you must define VARARGS yourself here. */
/* #define VARARGS 1 */
/* Define this if you do not have strerror(). */
/* #define STRERROR_MISSING 1 */
/* Define this unless the character testing functions in ctype.h
are defined for all values representable as an unsigned char. You do
not need to define this if your system is ANSI C conformant. You
should define for old Unix systems. */
/* #define USE_ISASCII 1 */
/* Define this if your system provides the BSD style string operations
rather than ANSI C ones (eg bcopy() rather than memcpy(), and index()
rather than strchr()). */
/* #define BSD_STRINGS 1 */
/* Define this if you have getopt(). */
#define HAVE_GETOPT 1
/* Define this if you have access(). */
#define HAVE_ACCESS 1
/* Define this if you have <unistd.h>. */
#define HAVE_UNISTD_H 1
/* Define this if you have <sys/stat.h>. */
#define HAVE_SYS_STAT_H 1
/* Define this if you have waitpid(). */
#define HAVE_WAITPID 1
/* Define this if your system is POSIX.1 (ISO 9945-1:1990) compliant. */
#define POSIX 1
/* Define this if you have the vfork() system call. */
#define HAVE_VFORK 1
/* Define this if you have <vfork.h>. */
/* #define HAVE_VFORK_H 1 */
/* Define this if you don't have <stdlib.h> */
/* #define STDLIB_H_MISSING 1 */
/* Define this if you don't have <stddef.h> */
/* #define STDDEF_H_MISSING 1 */
/* Define this if you don't have <limits.h> */
/* #define LIMITS_H_MISSING 1 */
/* Define this if you don't have remove(); unlink() will be used instead. */
/* #define REMOVE_MISSING 1 */
/* Define this if you don't have raise(); kill() will be used instead. */
/* #define RAISE_MISSING 1 */
/* Define this if you don't have fsetpos() and fgetpos(). */
/* #define FPOS_MISSING 1 */
/* Universal pointer type. */
/* If your compiler doesn't fully support void *, change `void' to `char'. */
typedef void *UNIV;
/* If your compiler doesn't support void as a function return type,
change `void' to `int'. */
typedef void VOID;
/* If you don't have an ANSI C conformant <limits.h>, define
CHAR_SIGNED as 1 or 0 according to whether the `char' type is signed.
The <limits.h> on some versions of System Release V 3.2 is not ANSI C
conformant: the value of CHAR_MIN is 0 even though the `char' type is
signed. */
/* #define CHAR_SIGNED 1 */
/* #define CHAR_SIGNED 0 */
#ifndef CHAR_SIGNED
#include <limits.h>
#if CHAR_MIN < 0
#define CHAR_SIGNED 1
#else
#define CHAR_SIGNED 0
#endif
#endif /* not CHAR_SIGNED */
/* Assume the system character set is ISO Latin-1. */
#include "latin1.h"

617
cde/programs/dtdocbook/sgmls/configure vendored Executable file
View file

@ -0,0 +1,617 @@
#!/bin/sh
# Generate config.h from unix.cfg.
trap 'rm -f doit doit.c doit.o doit.log config.out; exit 1' 1 2 3 15
on=
off=
CC=${CC-cc}
# Normally we use VARARGS if __STDC__ is not defined.
# Test whether this assumption is wrong.
cat >doit.c <<\EOF
#ifdef __STDC__
#include <stdarg.h>
int foo(char *s,...)
{
va_list ap;
va_start(ap, s);
va_end(ap);
return 0;
}
#else
int foo = 0;
#endif
EOF
$CC $CFLAGS -c doit.c >/dev/null 2>&1
if test $? -ne 0
then
on="$on VARARGS"
fi
cat >doit.c <<\EOF
#include <stddef.h>
int foo = 0;
EOF
if $CC $CFLAGS -c doit.c >/dev/null 2>&1
then
off="$off STDDEF_H_MISSING"
else
on="$on STDDEF_H_MISSING"
fi
cat >doit.c <<\EOF
#include <stdlib.h>
int foo = 0;
EOF
if $CC $CFLAGS -c doit.c >/dev/null 2>&1
then
off="$off STDLIB_H_MISSING"
else
on="$on STDLIB_H_MISSING"
fi
cat >doit.c <<\EOF
#include <limits.h>
int foo = 0;
EOF
if $CC $CFLAGS -c doit.c >/dev/null 2>&1
then
off="$off LIMITS_H_MISSING"
else
on="$on LIMITS_H_MISSING"
fi
cat >doit.c <<\EOF
#include <vfork.h>
int foo = 0;
EOF
if $CC $CFLAGS -c doit.c >/dev/null 2>&1
then
on="$on HAVE_VFORK_H"
else
off="$off HAVE_VFORK_H"
fi
cat >doit.c <<\EOF
#include <unistd.h>
int foo = 0;
EOF
if $CC $CFLAGS -c doit.c >/dev/null 2>&1
then
on="$on HAVE_UNISTD_H"
else
off="$off HAVE_UNISTD_H"
fi
cat >doit.c <<\EOF
#include <sys/types.h>
#include <sys/stat.h>
int foo = 0;
EOF
if $CC $CFLAGS -c doit.c >/dev/null 2>&1
then
on="$on HAVE_SYS_STAT_H"
else
off="$off HAVE_SYS_STAT_H"
fi
cat >doit.c <<\EOF
/* Exit normally unless we need to use isascii. */
#include <ctype.h>
#include <signal.h>
static int whoops()
{
_exit(1);
}
main()
{
int c;
#ifdef isascii
#ifdef SIGSEGV
signal(SIGSEGV, whoops);
#endif
#ifdef SIGBUS
signal(SIGBUS, whoops);
#endif
#ifdef SIGIOT
signal(SIGIOT, whoops);
#endif
for (c = 128; c < 256; c++) {
if (c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || c == '5'
|| c == '6' || c == '7' || c == '8' || c == '9') {
if (!isdigit(c) || isalpha(c) || iscntrl(c) || isspace(c) || ispunct(c))
exit(1);
}
else if (isdigit(c))
exit(1);
else if (isalpha(c)) {
if (iscntrl(c) || isspace(c) || ispunct(c)
|| (islower(c) && toupper(c) != c && !isupper(toupper(c)))
|| (isupper(c) && tolower(c) != c && !islower(tolower(c))))
exit(1);
}
else if (islower(c) || isupper(c))
exit(1);
else if (iscntrl(c)) {
if (ispunct(c))
exit(1);
}
}
#endif /* isascii */
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
# This tries to find the symbol that looks like the array
# used by <ctype.h>, and sees if its length appears to be 128
# rather than 256.
if test 1 = `(nm -n doit 2>/dev/null) | awk '
BEGIN {
weight["0"] = 0;
weight["1"] = 1;
weight["2"] = 2;
weight["3"] = 3;
weight["4"] = 4;
weight["5"] = 5;
weight["6"] = 6;
weight["7"] = 7;
weight["8"] = 8;
weight["9"] = 9;
weight["a"] = weight["A"] = 10;
weight["b"] = weight["B"] = 11;
weight["c"] = weight["C"] = 12;
weight["d"] = weight["D"] = 13;
weight["e"] = weight["E"] = 14;
weight["f"] = weight["F"] = 15;
}
/^[0-9a-zA-Z]* D .*ctype/ && ctype_nr == 0 {
ctype_nr = NR;
addr = 0;
len = length($1);
for (i = 1; i <= len; i++)
addr = addr*16 + weight[substr($1, i, 1)];
}
/^[0-9a-zA-Z]* D / && NR == ctype_nr + 1 {
next_addr = 0;
len = length($1);
for (i = 1; i <= len; i++)
next_addr = next_addr*16 + weight[substr($1, i, 1)];
}
END {
size = next_addr - addr;
if (size >= 128 && size < 256)
print "1";
else
print "0";
}'`
then
on="$on USE_ISASCII"
else
if ((yes | man 3 ctype) 2>/dev/null) \
| sed -e 's/.//g' -e 's/ *$//' -e '/de-$/N' \
-e 's/-\n//g' -e '/defined$/N' -e '/only$/N' \
-e '/where$/N' -e '/isascii$/N' -e '/is$/N' \
-e 's/\n/ /g' -e 's/ */ /g' \
| grep "defined only where isascii is true" >/dev/null
then
on="$on USE_ISASCII"
else
off="$off USE_ISASCII"
fi
fi
else
on="$on USE_ISASCII"
fi
cat >doit.c <<\EOF
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0)
remove("foo");
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
off="$off REMOVE_MISSING"
else
on="$on REMOVE_MISSING"
fi
cat >doit.c <<\EOF
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0)
getopt(argc, argv, "v");
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
on="$on HAVE_GETOPT"
else
off="$off HAVE_GETOPT"
fi
cat >doit.c <<\EOF
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0)
access("foo", 4);
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
on="$on HAVE_ACCESS"
else
off="$off HAVE_ACCESS"
fi
cat >doit.c <<\EOF
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0)
vfork();
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
on="$on HAVE_VFORK"
else
off="$off HAVE_VFORK"
fi
cat >doit.c <<\EOF
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0) {
int status;
waitpid(-1, &status, 0);
}
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
on="$on HAVE_WAITPID"
else
off="$off HAVE_WAITPID"
fi
cat >doit.c <<\EOF
#include <string.h>
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0)
strerror(0);
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
off="$off STRERROR_MISSING"
else
on="$on STRERROR_MISSING"
fi
cat >doit.c <<\EOF
#include <strings.h>
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0)
bcopy((char *)0, (char *)0, 0);
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
# Only use BSD_STRINGS if ANSI string functions don't work.
cat >doit.c <<\EOF
#include <string.h>
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0)
memcpy((char *)0, (char *)0, 0);
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
off="$off BSD_STRINGS"
else
on="$on BSD_STRINGS"
fi
else
off="$off BSD_STRINGS"
fi
cat >doit.c <<\EOF
#include <signal.h>
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0)
raise(SIGINT);
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
off="$off RAISE_MISSING"
else
on="$on RAISE_MISSING"
fi
cat >doit.c <<\EOF
#include <stdio.h>
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0) {
fpos_t pos;
fsetpos(stdin, &pos);
fgetpos(stdin, &pos);
}
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
off="$off FPOS_MISSING"
else
on="$on FPOS_MISSING"
fi
cat >doit.c <<\EOF
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0) {
pid_t pid;
int status;
long n = sysconf(_SC_OPEN_MAX);
pid = waitpid(-1, &status, 0);
WIFSTOPPED(status);
WIFSIGNALED(status);
WIFEXITED(status);
WEXITSTATUS(status);
WTERMSIG(status);
WSTOPSIG(status);
}
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
on="$on POSIX"
else
off="$off POSIX"
fi
cat >doit.c <<\EOF
#include <stdio.h>
#include <signal.h>
static int whoops()
{
_exit(1);
}
main()
{
char buf[30];
#ifdef SIGSEGV
signal(SIGSEGV, whoops);
#endif
#ifdef SIGBUS
signal(SIGBUS, whoops);
#endif
#ifdef SIGIOT
signal(SIGIOT, whoops);
#endif
sprintf(buf, "%2$s%2$s%1$s%1$s", "bar", "foo");
exit(!!strcmp(buf, "foofoobarbar"));
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
on="$on HAVE_EXTENDED_PRINTF"
else
off="$off HAVE_EXTENDED_PRINTF"
fi
cat >doit.c <<\EOF
#include <nl_types.h>
main(argc, argv)
int argc;
char **argv;
{
if (argc == 0) {
nl_catd d = catopen("foo", 0);
catgets(d, 1, 1, "default");
catclose(d);
}
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
on="$on HAVE_CAT"
else
off="$off HAVE_CAT"
fi
cat >doit.c <<\EOF
#include <limits.h>
char c = UCHAR_MAX;
main(argc, argv)
int argc;
char **argv;
{
#if CHAR_MIN < 0
exit(!(c < 0));
#else
exit(!(c > 0));
#endif
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
char_signed=
else
cat >doit.c <<\EOF
main()
{
int i;
for (i = 0; i < 512; i++) {
char c = (char)i;
if (c < 0)
exit(1);
}
exit(0);
}
EOF
if $CC $CFLAGS -o doit doit.c $LIBS >/dev/null 2>&1 && ./doit 2>/dev/null
then
char_signed=0
else
char_signed=1
fi
fi
cat >doit.c <<\EOF
typedef void VOID;
extern VOID bar();
VOID foo()
{
}
EOF
if $CC $CFLAGS -c doit.c >/dev/null 2>&1
then
void_ret=void
else
void_ret=int
fi
cat >doit.c <<\EOF
void *foo()
{
static char *buf;
return buf;
}
EOF
if $CC $CFLAGS -c doit.c >doit.log 2>&1
then
if test -s doit.log
then
void_star="char \*"
else
void_star="void \*"
fi
else
void_star="char \*"
fi
edit=
rm -f doit.c doit doit.log doit.o
for var in $on
do
edit="$edit -e 's;^/\\* *\\(#define $var [^/]*\\) *\\*/;\\1;'"
done
for var in $off
do
edit="$edit -e 's;^#define $var [^/]*;/* & */;'"
done
if test -n "$char_signed"
then
edit="$edit -e 's;^/\\* *\\(#define CHAR_SIGNED $char_signed\\) *\\*/;\\1;'"
fi
edit="$edit -e 's/^typedef .*VOID;/typedef $void_ret VOID;/'"
edit="$edit -e 's/^typedef .*UNIV;/typedef ${void_star}UNIV;/'"
if test "X$(PREFIX)" != "X/usr/local"
then
edit="$edit -e '/DEFAULT_PATH/s;/usr/local;$PREFIX;g'"
fi
eval sed $edit unix.cfg ">config.out"
mv config.out config.h
exit 0

View file

@ -0,0 +1,445 @@
/* $XConsortium: context.c /main/3 1996/06/19 17:14:26 drk $ */
#include "sgmlincl.h" /* #INCLUDE statements for SGML parser. */
#include "context.h"
#define GI (tags[ts].tetd->etdgi+1) /* GI of current element. */
#define NEWGI (newetd->etdgi+1) /* GI of new tag. */
#define STATUS (*statuspt) /* Token status: RCHIT RCMISS RCEND RCREQ RCNREQ*/
#define PEX (-1) /* GI is a plus exception and not a minus. */
#define ANYHIT(h) (grplongs == 1 ? ((h)[0] != 0) : anyhit(h))
#define HITSET(h, n) (h[(unsigned)(n-1)>>LONGPOW] \
|= (1L<<((n-1)&(LONGBITS-1))))
#define HITON(h, n) (h[(unsigned)(n-1)>>LONGPOW] & (1L<<((n-1)&(LONGBITS-1))))
#define HITOFF(h, n) (!(HITON(h, n)))
#define TOKENHIT HITON(H,T)
static
VOID copypos(to, from)
struct mpos *to, *from;
{
int i;
for (i = 0; i <= (int)from[0].t; i++) {
to[i].g = from[i].g;
to[i].t = from[i].t;
memcpy(to[i].h, from[i].h, grplongs*sizeof(unsigned long));
}
}
/* CONTEXT: Determine whether a GI is valid in the present structural context.
Returns RCHIT if valid, RCEND if element has ended, RCREQ if a
different element is required, and RCMISS if it is totally invalid.
On entry, pos points to the model token to be tested against the GI.
TO DO: Save allowed GIs for an error message on an RCMISS.
Support a "query" mode (what is allowed now?) by working
with a copy of pos.
*/
int context(gi, mod, pos, statuspt, mexts)
struct etd *gi; /* ETD of new GI. */
struct thdr mod[]; /* Model of current open element. */
struct mpos pos[]; /* Position in open element's model. */
UNCH *statuspt; /* Token status: RCHIT RCMISS RCEND RCREQ RCNREQ*/
int mexts; /* >0=stack level of minus grp; -1=plus; 0=none.*/
{
UNCH toccsv, gtypesv; /* Save token's TOCC and GTYPE in case grp ends.*/
if (mexts == -1) {
if (STATUS == RCEND)
return RCPEX;
copypos(savedpos, pos);
}
Tstart = T; /* Save starting token for AND group testing. */
while (STATUS!=RCMISS && STATUS!=RCEND) {
TRACEGI("CONTEXT", gi, mod, pos, Tstart);
while (TTYPE==TTOR || TTYPE==TTSEQ || TTYPE==TTAND) {
pos[P+1].g = M++; pos[++P].t = 1; HITCLEAR(H);
Tstart = T; /* Save starting token for AND group testing. */
TRACEGI("OPENGRP", gi, mod, pos, Tstart);
}
STATUS = (UNCH)tokenreq(gi, mod, pos);
TRACEGI("STATUS", gi, mod, pos, Tstart);
if (gi==TOKEN.tu.thetd) { /* Hit in model. */
STATUS = (UNCH)RCHIT;
gtypesv = GTYPE; toccsv = TOCC;
newtoken(mod, pos, statuspt);
return(mexts<=0 ? RCHIT : (gtypesv==TTOR || BITON(toccsv, TOPT))
? RCMEX : RCHITMEX);
}
if (STATUS==RCREQ) {
if (mexts == -1)
break;
STATUS = RCHIT;
nextetd = TOKEN.tu.thetd;
newtoken(mod, pos, statuspt);
return(RCREQ);
}
/* else if (STATUS==RCNREQ) */
if (mexts>0) return(RCMEX);
newtoken(mod, pos, statuspt);
}
if (mexts == -1) {
copypos(pos, savedpos);
return STATUS = RCPEX;
}
return((int)STATUS);
}
/* ECONTEXT: Determine whether the current element can be ended, or whether
non-optional tokens remain at the current level or higher.
Returns 1 if element can be ended, or 0 if tokens remain.
On entry, STATUS==RCEND if there are no tokens left; if not,
pos points to the next model token to be tested.
TO DO: Support a "query" mode (what is required now?) by working
with a copy of pos.
*/
int econtext(mod, pos, statuspt)
struct thdr mod[]; /* Model of current open element. */
struct mpos pos[]; /* Position in open element's model. */
UNCH *statuspt; /* Token status: RCHIT RCMISS RCEND RCREQ RCNREQ*/
{
unsigned next; /* Position in AND group of next testable token.*/
Tstart = T;
TRACEEND("ECONT", mod, pos, 0, 0, Tstart);
if (P<=1) {nextetd = 0; return(TOKENHIT || BITON(TOCC, TOPT));}
nextetd = TTYPE == TTETD ? TOKEN.tu.thetd : 0;
while (STATUS!=RCMISS && STATUS!=RCEND) {
STATUS = (UNCH)testend(mod, pos, 0, 0);
TRACEEND("ECONTEND", mod, pos, 0, 0, Tstart);
nextetd = P<=1 || TTYPE != TTETD ? 0 : TOKEN.tu.thetd;
if (STATUS==RCEND) return(1);
if (P<=1) return(TOKENHIT || BITON(TOCC, TOPT));
if (STATUS==RCMISS) {
if (BITON(TOCC, TOPT)) nextetd = 0;
return(0);
}
if (!tokenopt(mod, pos)) return(0);
STATUS = RCNREQ;
if (GTYPE!=TTAND) ++T; /* T!=GNUM or group would have ended. */
else T = (UNCH)(((next = (UNS)offbit(H, (int)T, GNUM))!=0) ?
next : offbit(H, 0, GNUM));
M = G + grpsz(&GHDR, (int)T-1) + 1;
TRACEEND("ECONTNEW", mod, pos, 0, 0, Tstart);
}
if (STATUS==RCMISS) {
if (BITON(TOCC, TOPT)) nextetd = 0;
return(0);
}
return(1); /* STATUS==RCEND */
}
/* NEWTOKEN: Find the next token to test. Set STATUS to indicate results:
RCEND if element has ended (no more tokens to test);
RCREQ if required new token was found;
RCNREQ if non-required new token was found;
RCHIT if a hit token was repeated (now non-required);
and RCMISS if a new token can't be found because current token
(which was not hit) was neither unconditionally required nor
optional.
*/
VOID newtoken(mod, pos, statuspt)
struct thdr mod[]; /* Model of current open element. */
struct mpos pos[]; /* Position in open element's model. */
UNCH *statuspt; /* Token status: RCHIT RCMISS RCEND RCREQ RCNREQ*/
{
unsigned nextand = 0; /* Position in AND group of next testable token.*/
int currhit = (STATUS==RCHIT); /* 1=current GI hit; 0=not. */
/* If the GI was a hit, turn on the hit bit and set the status to
assume that the token to be tested against the next GI will
be non-required. If the current token is repeatable, exit so
it will stand as the next token to test.
*/
if (STATUS==RCHIT) {
HITSET(H, T);
STATUS = RCNREQ;
if (BITON(TOCC, TREP)) return;
}
/* At this point, we must determine the next token to test:
either against the next GI, if this one was a hit, or
against the same GI if conditions permit a retry.
To find the next token, we must first end the current group,
if possible, and any we can that contain it.
If the outermost group was a hit and is repeatable, or
if the element has ended, we exit now.
If it hasn't ended, or was optional and ended with a miss,
we can retry the GI against the next token.
*/
if ((STATUS = (UNCH)testend(mod, pos, 1, 1))!=RCNREQ) return;
/* At this point, the "current token" is either the original one,
or the token for the highest level unhit group that it ended.
We will retry a missed GI, by testing it against the next
token, if the current token:
1. Is optional;
2. Was hit (i.e., because it is repeatable and was hit by a
previous GI or because it is a hit group that just ended);
3. Is in an AND or OR group and is not the last testable token.
It will be the next sequential one (unhit one, in an AND group);
if there are none left, use the first unhit token in the group.
In either case, set M to correspond to the new T.
*/
retest:
TRACEEND("RETEST", mod, pos, (int)nextand, 1, Tstart);
if (GTYPE==TTAND) {
nextand = offbit(H, (int)T, GNUM);
if (!nextand)
nextand = offbit(H, 0, GNUM);
}
if ( BITON(TOCC, TOPT)
|| TOKENHIT
|| GTYPE==TTOR /* T!=GNUM or group would have ended. */
|| nextand ) {
if (GTYPE!=TTAND) ++T; /* T!=GNUM or group would have ended. */
else T = nextand;
M = G + grpsz(&GHDR, (int)T-1) + 1;
if (GTYPE==TTAND) {
/* If AND group wrapped, it can end if all non-optionals were
hit. */
if (T==Tstart && !currhit) {
UNCH Psave = P;
int rc = testend(mod, pos, 0, 1);
if (Psave!=P) {if ((STATUS = (UNCH)rc)==RCNREQ) goto retest;}
else STATUS = RCMISS;
}
/* We only test unhit tokens, so we must use an unhit token
as Tstart (which is used to detect when the AND group has
wrapped). */
else if (HITON(H,Tstart)) Tstart = T;
}
}
else STATUS = RCMISS;
TRACEEND("NEWTOKEN", mod, pos, (int)nextand, 1, Tstart);
}
/* TESTEND: End the current group, if possible, and any that it is nested in.
The current token will either be a group header, or some token
that could not end its group. Return 1 if the (possibly new)
current token is repeatable; 0 if it is not.
*/
int testend(mod, pos, andoptsw, newtknsw)
struct thdr mod[]; /* Model of current open element. */
struct mpos pos[]; /* Position in open element's model. */
int andoptsw; /* 1=test optional AND members; 0=ignore. */
int newtknsw; /* 1=new token test; 0=end element test. */
{
int rc = 0; /* Return code: RCNREQ RCHIT RCMISS RCEND */
while (!rc) {
TRACEEND("TRACEEND", mod, pos, rc, andoptsw, Tstart);
/* TESTMISS:
If we've hit no tokens yet in the current group, and
the current token is the last unhit one in the group we can test,
we will end the group (it may never really have started!)
because we might be able to try the token that follows it.
In any group, a token is the last testable unhit token if it
is the last sequential one, as the GI was already tested against
the preceding unhit tokens. In addition,
in a SEQ group, it is the last testable unhit token if it isn't
optional, because we can't skip past it to the following ones.
If we end the group, before popping the level, set M to G, as this
level`s group header will be the next level's current token.
*/
if (!ANYHIT(H) && (T==GNUM
|| (GTYPE==TTSEQ && BITOFF(TOCC, TOPT)))) {
M = G; --P; Tstart = T;
if (P<=1) {
if (BITON(TOCC, TOPT) || TOKENHIT) rc = RCEND;
else rc = RCMISS;
}
continue;
}
/* TESTHIT:
See if we've hit all the non-optional tokens in the group.
If so, pop to the previous level and set the group's hit bit.
If we were called from NEWTOKEN we are trying to find the token
to test against the next start-tag, so if the group is repeatable,
process it again. (If not, we were called from ECONTEXT and
are testing whether the element can be ended.)
Otherwise, if we are at the first level, the element is over.
*/
if ((GTYPE==TTOR && TOKENHIT)
|| (GTYPE==TTSEQ && T==(UNCH)GNUM
&& (TOKENHIT || BITON(TOCC, TOPT)))
|| (GTYPE==TTAND && allhit(&GHDR, H, 0, andoptsw))) {
M = G;
--P;
HITSET(H, T);
Tstart = T;
if (newtknsw && BITON(TOCC, TREP)) rc = RCHIT;
else if (P<=1) rc = RCEND;
/* If we are looking for a new token to test against the next
start-tag, then we need to consider optional and members
in this group, even if we didn't need to consider them
in the group that we just ended because that group had
wrapped. */
else if (newtknsw) andoptsw = 1;
/* Else loop to test new outer group. */
}
else rc = RCNREQ; /* No group ended this time, so return. */
}
TRACEEND("ENDFOUND", mod, pos, rc, andoptsw, Tstart);
return(rc);
}
/* TOKENOPT: Return 1 if current token is contextually optional;
otherwise, return 0.
*/
int tokenopt(mod, pos)
struct thdr mod[]; /* Model of current open element. */
struct mpos pos[]; /* Position in open element's model. */
{
TRACEEND("TOKENOPT", mod, pos, 0, 0, Tstart);
return (BITON(TOCC, TOPT) /* Inherently optional. */
|| TOKENHIT /* Was hit (handles "plus" suffix case). */
|| (!ANYHIT(H) && groupopt(mod, pos)));
/* In optional group with no hits. */
}
/* GROUPOPT: Temporarily makes the current group be the current token so that
TOKENOPT() can be applied to it. Returns the value returned
by TOKENOPT.
*/
int groupopt(mod, pos)
struct thdr mod[]; /* Model of current open element. */
struct mpos pos[]; /* Position in open element's model. */
{
UNCH saveM; /* Save M when testing if group is not required.*/
int rc; /* 1=contextually optional; 0=not. */
if (P==1) return(BITON(GOCC, TOPT) || TOKENHIT);
saveM = M; M = G; --P;
rc = tokenopt(mod, pos);
++P; G = M; M = saveM;
return(rc);
}
/* TOKENREQ: Returns RCREQ if the current token is "contextually required".
That is, it is not contextually optional and
1) it is a member of a "seq" group that is either required
or has at least 1 hit token.
2) it is a member of an "and" group in which all other
tokens were hit.
Optional tokens are not counted
if GI is ETDCDATA, as we are looking for an
omitted start-tag. Otherwise, they are counted,
as the GI might match one of them.
Returns RCNREQ if the current token is "not required".
*/
int tokenreq(gi, mod, pos)
struct etd *gi; /* ETD of new GI. */
struct thdr mod[]; /* Model of current open element. */
struct mpos pos[]; /* Position in open element's model. */
{
TRACEGI("TOKENREQ", gi, mod, pos, Tstart);
return( tokenopt(mod, pos) ? RCNREQ
: ( GTYPE==TTSEQ && (ANYHIT(H) || groupreq(gi, mod, pos)==RCREQ)
#if 0
|| (GTYPE==TTAND && allhit(&GHDR, H, T, \*gi!=ETDCDATA*\ 1))
#endif
)
? RCREQ : RCNREQ );
}
/* GROUPREQ: Temporarily makes the current group be the current token so that
TOKENREQ() can be applied to it. Returns the value returned
by TOKENREQ.
*/
int groupreq(gi, mod, pos)
struct etd *gi; /* ETD of new GI. */
struct thdr mod[]; /* Model of current open element. */
struct mpos pos[]; /* Position in open element's model. */
{
UNCH saveM; /* Save M when testing if group is not required.*/
int rc; /* Return code: RCREQ RCNREQ */
if (P==1) return(BITOFF(GOCC, TOPT) ? RCREQ : RCNREQ);
saveM = M; M = G; --P;
rc = tokenreq(gi, mod, pos);
++P; G = M; M = saveM;
return(rc);
}
/* GRPSZ: Returns the number of tokens spanned by a group in the model (M),
from the group's start (G) to a specified index within the group (T).
M = 0, plus 1 for each token in the group, plus the size of
any subgroups (gotten by calling GRPSZ recursively). On entry,
M must be equal to G at the current level.
*/
int grpsz(g, t)
struct thdr *g; /* mod[G]: Ptr to group in the model. */
int t; /* T: Index of last token in the group. */
{
struct thdr *p = g; /* Ptr to current token in the model. */
int m = 0; /* Size of group (including nested groups). */
int i = 0; /* Number of group members (loop counter). */
UNS type; /* Token type (without TOREP bits). */
while (++i<=t) {
++p; ++m;
type = GET(p->ttype, TTMASK);
if (type==TTOR || type==TTSEQ || type==TTAND) {
m += grpsz(p, p->tu.tnum);
p = g+m;
}
}
return(m);
}
/* ALLHIT: Returns 1 if all hit bits for the specified group are turned on,
(other than those that correspond to optional tokens if "opt" is
0) and the "but" bit (all bits if "but" bit is zero). Otherwise,
returns 0. GRPSZ is used to skip past subgroup tokens.
*/
int allhit(p, hits, but, opt)
struct thdr *p; /* mod[G]: Ptr to group in the model. */
unsigned long *hits; /* H: Hit bits to be tested. */
int but; /* Index of bit to ignore; 0=test all. */
int opt; /* 1=optional tokens must be hit; 0=ignore. */
{
int b = 0; /* Index of bit being tested in hits. */
int e = p->tu.tnum; /* Ending index (number of bits to test). */
unsigned type; /* Token type (without TOREP bits). */
while (++p, ++b<=e) {
if (HITOFF(hits,b) && (opt || BITOFF(p->ttype,TOPT)) && b!=but)
return 0;
if ((type = GET(p->ttype,TTMASK))==TTOR || type==TTSEQ || type==TTAND)
p += grpsz(p, p->tu.tnum);
}
return 1;
}
/* OFFBIT: Returns the index of the first unset bit after (i.e., not including)
the caller's "first" bit. If all bits through the
specified last bit are on, it returns 0.
*/
int offbit(bits, first, last)
unsigned long *bits; /* Bits to be tested. */
int first; /* Index of first bit to be tested in bits. */
int last; /* Index of last bit to be tested in bits. */
{
while (++first <= last)
if (HITOFF(bits, first))
return first;
return 0;
}
/* ANYHIT: Return 1 if any bit is set. */
int anyhit(bits)
unsigned long *bits;
{
int i;
for (i = 0; i < grplongs; i++)
if (bits[i] != 0)
return 1;
return 0;
}
/*
Local Variables:
c-indent-level: 5
c-continued-statement-offset: 5
c-brace-offset: -5
c-argdecl-indent: 0
c-label-offset: -5
comment-column: 30
End:
*/

View file

@ -0,0 +1,18 @@
/* $XConsortium: context.h /main/3 1996/06/19 17:14:30 drk $ */
/* context.h */
#define M pos[0].g /* Index of current token in model. */
#ifdef P
#undef P
#endif
#define P pos[0].t /* Index of current group in pos. */
#define G pos[P].g /* Index of current group in model. */
#define T pos[P].t /* Index of current token in its group. */
#define H pos[P].h /* Pointer to hit bits for current group. */
#define GHDR mod[G] /* Current group header. */
#define TOKEN mod[M] /* Current token. */
#define TTYPE (GET(TOKEN.ttype, TTMASK)) /* Token type of current token. */
#define TOCC (GET(TOKEN.ttype, TOREP)) /* Occurrence for current token. */
#define GTYPE (GET(GHDR.ttype, TTMASK)) /* Token type of current group. */
#define GOCC (GET(GHDR.ttype, TOREP)) /* Occurrence for current group. */
#define GNUM GHDR.tu.tnum /* Number of tokens in current grp. */

View file

@ -0,0 +1,95 @@
/* dos.cfg: Configuration file for sgmls on MS-DOS. */
/* Define this if your compiler supports prototypes. */
#define USE_PROTOTYPES 1
/* Define this if you do not have strerror(). */
/* Borland C++ has strerror(), but it adds a newline to the end of the
message, so don't use it. */
#define STRERROR_MISSING 1
/* Define this if you have getopt(). */
/* #define HAVE_GETOPT 1 */
#ifndef HAVE_GETOPT
/* #define OPTION_CHAR '/' */
/* Use MS-DOS (undocumented) system call to get switch character. */
#define SWITCHAR 1
#define REORDER_ARGS 1
/* #define CASE_INSENSITIVE_OPTIONS 1 */
#endif
/* A list of filename templates to use for searching for external entities.
See sgmls.man for details. */
#define DEFAULT_PATH "C:\\SGML\\%N.%X;%N.%X;%N.%D"
/* The character that separates the filenames templates. */
#define PATH_FILE_SEP ';'
/* The character that separates filenames in a system identifier.
Usually the same as PATH_FILE_SEP. */
#define SYSID_FILE_SEP ';'
/* The environment variable that contains the list of filename templates. */
#define PATH_ENV_VAR "SGML_PATH"
/* Define this if open() understands the O_NOINHERIT flag. This tells
DOS that subprocesses should not inherit the file descriptor. */
#define HAVE_O_NOINHERIT 1
/* When turning a minimum literal into a filename, each character in
MIN_DAT_SUBS_FROM will be replaced by the character at the
corresponding position in MIN_DATA_SUBS_TO. If there is no such
character, then the character will be stripped. */
#define MIN_DAT_SUBS_FROM " +,./:=?"
#define MIN_DAT_SUBS_TO ""
/* Define this if you have access(). */
#define HAVE_ACCESS 1
/* Define this if you have <unistd.h>. */
/* #define HAVE_UNISTD_H 1 */
/* Define this if you have a Unix-style <sys/stat.h>. */
#define HAVE_SYS_STAT_H 1
/* Define this to strip an extension off the program name in argv[0],
before using it in error messsages. */
#define PROG_STRIP_EXTENSION 1
/* Define this to fold the program name in argv[0] to lower case,
before using it in error messsages. */
#define PROG_FOLD 1
/* Before using argv[0] in error messages, strip off everything up to and
including the last character in prog that occurs in PROG_PREFIX. */
#define PROG_PREFIX "\\/:"
/* Define this to allow tracing. */
/* #define TRACE 1 */
/* Define this you want support for subdocuments. This is implemented
using features that are not part of Standard C. */
#define SUPPORT_SUBDOC 1
/* Define this if your shell does not allow you conveniently to
redirect errors to a file. Then sgmls will provide an option (-f)
that does this. */
#define CANT_REDIRECT_STDERR 1
typedef void *UNIV; /* Universal (i.e., undefined) pointer type. */
typedef void VOID; /* void as a function return type */
/* If you don't have <limits.h>, define CHAR_SIGNED as 1 or 0
according to whether the `char' type is signed. */
/* #define CHAR_SIGNED 1 */
/* #define CHAR_SIGNED 0 */
#ifndef CHAR_SIGNED
#include <limits.h>
#if CHAR_MIN < 0
#define CHAR_SIGNED 1
#else
#define CHAR_SIGNED 0
#endif
#endif /* not CHAR_SIGNED */
/* Assume the system character set is ISO Latin-1. */
#include "latin1.h"

View file

@ -0,0 +1,41 @@
/* $XConsortium: dosproc.c /main/3 1996/06/19 17:14:34 drk $ */
/* dosproc.c -
MS-DOS implementation of run_process().
Written by James Clark (jjc@jclark.com).
*/
#include "config.h"
#ifdef SUPPORT_SUBDOC
#include "std.h"
#include "entity.h"
#include "appl.h"
#include <process.h>
int run_process(argv)
char **argv;
{
int ret;
fflush(stdout);
fflush(stderr);
ret = spawnvp(P_WAIT, argv[0], argv);
if (ret < 0)
appl_error(E_EXEC, argv[0], strerror(errno));
return ret;
}
#endif /* SUPPORT_SUBDOC */
/*
Local Variables:
c-indent-level: 5
c-continued-statement-offset: 5
c-brace-offset: -5
c-argdecl-indent: 0
c-label-offset: -5
End:
*/

View file

@ -0,0 +1,43 @@
/* $XConsortium: ebcdic.c /main/3 1996/06/19 17:14:38 drk $ */
/* ASCII to EBCDIC (ISO 8859-1 to IBM CP 37v2) table. */
/* Contributed by C. M. Sperberg-McQueen <u35395@uicvm.uic.edu>. */
/* The mapping must be 1 to 1. The positions of *CHAR and *CH in the table
must not be changed, although the values in ebcdic.h can be. */
#include "ebcdic.h"
unsigned char charset[] = {
0, 1, 2, 3, 55, 45, 46, 47,
GENRECHAR, TABCHAR, RSCHAR, 11, 12, RECHAR, 14, 15,
16, 17, 18, 19, 60, 61, 50, 38,
24, 25, EOFCHAR, 39, EOBCHAR, DELCDATA, DELSDATA, DELNONCH,
SPCCHAR, 90, 127, 123, 91, 108, 80, 125,
77, 93, 92, 78, 107, 96, 75, 97,
240, 241, 242, 243, 244, 245, 246, 247,
248, 249, 122, 94, 76, 126, 110, 111,
124, 193, 194, 195, 196, 197, 198, 199,
200, 201, 209, 210, 211, 212, 213, 214,
215, 216, 217, 226, 227, 228, 229, 230,
231, 232, 233, 173, 224, 189, 176, 109,
121, 129, 130, 131, 132, 133, 134, 135,
136, 137, 145, 146, 147, 148, 149, 150,
151, 152, 153, 162, 163, 164, 165, 166,
167, 168, 169, 192, 79, 208, 161, 7,
4, 6, 8, 9, 10, 20, 21, 23,
26, 27, 32, 33, 34, 35, 36, 40,
41, 42, 43, 44, 48, 49, 51, 52,
53, 54, 56, 57, 58, 59, 62, 255,
65, 170, 74, 177, 159, 178, 106, 181,
187, 180, 154, 138, 95, 202, 175, 188,
144, 143, 234, 250, 190, 160, 182, 179,
157, 218, 155, 139, 183, 184, 185, 171,
100, 101, 98, 102, 99, 103, 158, 104,
116, 113, 114, 115, 120, 117, 118, 119,
172, 105, 237, 238, 235, 239, 236, 191,
128, 253, 254, 251, 252, 186, 174, 89,
68, 69, 66, 70, 67, 71, 156, 72,
84, 81, 82, 83, 88, 85, 86, 87,
140, 73, 205, 206, 203, 207, 204, 225,
112, 221, 222, 219, 220, 141, 142, 223,
};

View file

@ -0,0 +1,41 @@
/* $XConsortium: ebcdic.h /main/3 1996/06/19 17:14:42 drk $ */
/* SGML Character Use: EBCDIC
*/
#define EOFCHAR '\077' /* FUNCTION: EE (entity end: files). */
#define EOBCHAR '\034' /* NONCHAR: EOB (file entity: end of buffer. */
#define RSCHAR '\045' /* FUNCTION: RS (record start). */
#define RECHAR '\015' /* FUNCTION: RE (record end). */
#define TABCHAR '\005' /* FUNCTION: TAB (horizontal tab). */
#define SPCCHAR '\100' /* FUNCTION: SPACE (horizontal space). */
#define GENRECHAR '\026' /* NONCHAR: Generated RE. */
#define DELCDATA '\035' /* NONCHAR: Delimiter for CDATA entity in
attribute value. */
#define DELSDATA '\036' /* NONCHAR: Delimiter for SDATA entity in
attribute value. */
#define DELNONCH '\037' /* NONCHAR: non-SGML character prefix. */
/* This should work for EBCDIC. See comment in latin1.h. */
#define SHIFTNON(ch) ((UNCH)(ch) | 0200)
#define UNSHIFTNON(ch) ((UNCH)(ch) & ~0200)
/* See comment in latin1.h. */
#define CANON_NONSGML 255
/* See comment in latin1.h. */
#define CANON_DATACHAR 254
/* Components for a formal public identifier for the whole of the
system character set. Protect with ifndef so that it can be overriden
in config.h. */
/* Use a private escape sequence. */
#ifndef SYSTEM_CHARSET_DESIGNATING_SEQUENCE
#define SYSTEM_CHARSET_DESIGNATING_SEQUENCE "ESC 2/5 2/15 3/0"
#endif
#ifndef SYSTEM_CHARSET_OWNER
#define SYSTEM_CHARSET_OWNER "-//IBM"
#endif
#ifndef SYSTEM_CHARSET_DESCRIPTION
#define SYSTEM_CHARSET_DESCRIPTION "Code Page 1047"
#endif

View file

@ -0,0 +1,406 @@
/* $XConsortium: entgen.c /main/3 1996/06/19 17:14:46 drk $ */
/* entgen.c -
Implement entgen() which generates a list of filenames from a struct fpi.
Written by James Clark (jjc@jclark.com).
*/
#include "config.h"
#ifdef HAVE_ACCESS
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* For R_OK. */
#endif /* HAVE_UNISTD_H */
#ifndef R_OK
#define R_OK 4
#endif /* not R_OK */
#endif /* HAVE_ACCESS */
#include "sgmlaux.h"
/* Environment variable that contains path. */
#ifndef PATH_ENV_VAR
#define PATH_ENV_VAR "SGML_PATH"
#endif
/* Default search path. See field() for interpretation of %*. */
#ifndef DEFAULT_PATH
#define DEFAULT_PATH "/usr/local/lib/sgml/%O/%C/%T:%N.%X:%N.%D"
#endif
#ifndef PATH_FILE_SEP
#define PATH_FILE_SEP ':'
#endif
#ifndef SYSID_FILE_SEP
#define SYSID_FILE_SEP ':'
#endif
/* This says: change space to underscore, slash to percent. */
#ifndef MIN_DAT_SUBS_FROM
#define MIN_DAT_SUBS_FROM " /"
#endif
#ifndef MIN_DAT_SUBS_TO
#define MIN_DAT_SUBS_TO "_%"
#endif
static int field P((struct fpi *, int, char *));
static int mindatcpy P((char *, char *, int, int));
static int testopen P((char *));
static UNIV sysidgen P((char *));
static char *path = 0;
/* Non-zero if searching should be performed when a system identifier
is specified. */
static int sysidsrch = 0;
#define EMPTY_VERSION "default"
static char *classes[] = {
"capacity",
"charset",
"notation",
"syntax",
"document",
"dtd",
"elements",
"entities",
"lpd",
"nonsgml",
"shortref",
"subdoc",
"text"
};
/* This is mainly for compatibility with arcsgml. */
static char *genext[] = {
"nsd", /* Non-SGML data entity. */
"gml", /* GML document or text entity. */
"spe", /* System parameter entity. */
"dtd", /* Document type definition. */
"lpd", /* Link process definition. */
"pns", /* Public non-SGML data entity. */
"pge", /* Public general entity. */
"ppe", /* Public parameter entity. */
"pdt", /* Public document type definition. */
"plp", /* Public link process definition. */
"vns", /* Display version non-SGML data entity. */
"vge", /* Display version general entity. */
"vpe", /* Display version parameter entity. */
"vdt", /* Display version document type definition.*/
"vlp", /* Display version link process definition.*/
};
static char *ext[] = {
"sgml", /* SGML subdocument */
"data", /* Data */
"text", /* General text */
"parm", /* Parameter entity */
"dtd", /* Document type definition */
"lpd", /* Link process definition */
};
/* Like memcpy, but substitute, fold to lower case (if fold is
non-zero) and null terminate. This is used both for minimum data and
for names. If p is NULL, do nothing. Return len. */
static int mindatcpy(p, q, len, fold)
char *p, *q;
int len;
int fold;
{
static char subsfrom[] = MIN_DAT_SUBS_FROM;
static char substo[] = MIN_DAT_SUBS_TO;
int n;
if (!p)
return len;
for (n = len; --n >= 0; q++) {
char *r = strchr(subsfrom, *q);
if (!r) {
if (fold && ISASCII(*q) && isupper((UNCH)*q))
*p++ = tolower((UNCH)*q);
else
*p++ = *q;
}
else {
int i = r - subsfrom;
if (i < sizeof(substo) - 1)
*p++ = substo[i];
}
}
*p = '\0';
return len;
}
/* Return length of field. Copy into buf if non-NULL. */
static int field(f, c, buf)
struct fpi *f;
int c;
char *buf;
{
int n;
switch (c) {
case '%':
if (buf) {
buf[0] = '%';
buf[1] = '\0';
}
return 1;
case 'N': /* the entity, document or dcn name */
return mindatcpy(buf, (char *)f->fpinm, ustrlen(f->fpinm),
(f->fpistore != 1 && f->fpistore != 2 && f->fpistore != 3
? NAMECASE
: ENTCASE));
case 'D': /* dcn name */
if (f->fpistore != 1) /* not a external data entity */
return -1;
if (f->fpinedcn == 0) /* it's a SUBDOC */
return -1;
return mindatcpy(buf, (char *)f->fpinedcn, ustrlen(f->fpinedcn),
NAMECASE);
case 'X':
/* This is for compatibility with arcsgml */
if (f->fpistore < 1 || f->fpistore > 5)
return -1;
n = (f->fpipubis != 0)*(f->fpiversw > 0 ? 2 : 1)*5+f->fpistore - 1;
if (buf)
strcpy(buf, genext[n]);
return strlen(genext[n]);
case 'Y': /* tYpe */
n = f->fpistore;
if (n < 1 || n > 5)
return -1;
if (n == 1 && f->fpinedcn == 0) /* it's a SUBDOC */
n = 0;
if (buf)
strcpy(buf, ext[n]);
return strlen(ext[n]);
case 'P': /* public identifier */
if (!f->fpipubis)
return -1;
return mindatcpy(buf, (char *)f->fpipubis, ustrlen(f->fpipubis), 0);
case 'S': /* system identifier */
if (!f->fpisysis)
return -1;
else {
UNCH *p;
n = 0;
for (p = f->fpisysis; *p; p++)
if (*p != RSCHAR) {
if (buf)
buf[n] = *p == RECHAR ? '\n' : *p;
n++;
}
return n;
}
}
/* Other fields need a formal public identifier. */
/* return -1 if the formal public identifier was invalid or missing. */
if (f->fpiversw < 0 || !f->fpipubis)
return -1;
switch (c) {
case 'A': /* Is it available? */
return f->fpitt == '+' ? 0 : -1;
case 'I': /* Is it ISO? */
return f->fpiot == '!' ? 0 : -1;
case 'R': /* Is it registered? */
return f->fpiot == '+' ? 0 : -1;
case 'U': /* Is it unregistered? */
return f->fpiot == '-' ? 0 : -1;
case 'L': /* public text language */
if (f->fpic == FPICHARS)
return -1;
/* it's entered in all upper case letters */
return mindatcpy(buf, (char *)f->fpipubis + f->fpil, f->fpill, 1);
case 'O': /* owner identifier */
return mindatcpy(buf, (char *)f->fpipubis + f->fpio, f->fpiol, 0);
case 'C': /* public text class */
n = f->fpic - 1;
if (n < 0 || n >= sizeof(classes)/sizeof(classes[0]))
return -1;
if (buf)
strcpy(buf, classes[n]);
return strlen(classes[n]);
case 'T': /* text description */
return mindatcpy(buf, (char *)f->fpipubis + f->fpit, f->fpitl, 0);
case 'V':
if (f->fpic < FPICMINV) /* class doesn't have version */
return -1;
if (f->fpiversw > 0) /* no version */
return -1;
if (f->fpivl == 0) { /* empty version: */
/* use device-independent version*/
if (buf)
strcpy(buf, EMPTY_VERSION);
return strlen(EMPTY_VERSION);
}
return mindatcpy(buf, (char *)f->fpipubis + f->fpiv, f->fpivl, 0);
case 'E': /* public text designating (escape) sequence */
if (f->fpic != FPICHARS)
return -1;
return mindatcpy(buf, (char *)f->fpipubis + f->fpil, f->fpill, 0);
default:
break;
}
return -1;
}
static int testopen(pathname)
char *pathname;
{
#ifdef HAVE_ACCESS
return access(pathname, R_OK) >= 0;
#else /* not HAVE_ACCESS */
FILE *fp;
fp = fopen(pathname, "r");
if (!fp)
return 0;
fclose(fp);
return 1;
#endif /* not HAVE_ACCESS */
}
/* Return a pointer to an dynamically-allocated buffer that contains
the names of the files containing this entity, with each filename
terminated by a '\0', and with the list of filenames terminated by
another '\0'. */
UNIV entgen(f)
struct fpi *f;
{
char *file;
assert(f->fpistore != 6); /* Musn't call entgen for a notation. */
if (!path) {
char *p;
char c;
path = getenv(PATH_ENV_VAR);
if (!path)
path = DEFAULT_PATH;
p = path;
/* Only search for system identifiers if path uses %S. */
while ((c = *p++) != '\0')
if (c == '%') {
if (*p == 'S') {
sysidsrch = 1;
break;
}
if (*p != '\0' && *p != PATH_FILE_SEP)
p++;
}
}
if (f->fpisysis
&& (!sysidsrch
|| strchr((char *)f->fpisysis, SYSID_FILE_SEP)
|| strcmp((char *)f->fpisysis, STDINNAME) == 0))
return sysidgen((char *)f->fpisysis);
file = path;
for (;;) {
char *p;
int len = 0;
char *fileend = strchr(file, PATH_FILE_SEP);
if (!fileend)
fileend = strchr(file, '\0');
/* Check that all substitutions are non-null, and calculate
the resulting total length of the filename. */
for (p = file; p < fileend; p++)
if (*p == '%') {
int n;
/* Set len to -1 if a substitution is invalid. */
if (++p >= fileend) {
len = -1;
break;
}
n = field(f, *p, (char *)0);
if (n < 0) {
len = -1;
break;
}
len += n;
}
else
len++;
if (len > 0) {
/* We've got a valid non-empty filename. */
char *s;
char *buf;
s = buf = (char *)rmalloc(len + 2);
for (p = file; p < fileend; p++)
if (*p == '%')
s += field(f, *++p, s);
else
*s++ = *p;
*s++ = '\0';
if (testopen(buf)) {
/* Terminate the array of filenames. */
*s++ = '\0';
return buf;
}
free((UNIV)buf);
}
if (*fileend == '\0')
break;
file = ++fileend;
}
return 0;
}
/* Handle a system identifier without searching. */
static
UNIV sysidgen(s)
char *s;
{
char *buf, *p;
buf = (char *)rmalloc(strlen(s) + 2);
for (p = buf; *s; s++) {
if (*s == SYSID_FILE_SEP) {
if (p > buf && p[-1] != '\0')
*p++ = '\0';
}
else if (*s == RECHAR)
*p++ = '\n';
else if (*s != RSCHAR)
*p++ = *s;
}
/* Terminate this filename. */
if (p > buf && p[-1] != '\0')
*p++ = '\0';
if (p == buf) {
/* No filenames. */
frem((UNIV)buf);
return 0;
}
/* Terminate the list. */
*p++ = '\0';
return buf;
}
/*
Local Variables:
c-indent-level: 5
c-continued-statement-offset: 5
c-brace-offset: -5
c-argdecl-indent: 0
c-label-offset: -5
End:
*/

View file

@ -0,0 +1,190 @@
/* $XConsortium: entity.h /main/3 1996/06/19 17:14:51 drk $ */
/* Struct dcncb: attribute list added to support data attributes. */
#ifndef ENTITY_H /* Don't include this file more than once. */
#define ENTITY_H
/* ENTITY.H: Definitions and control block templates for entity management.
*/
#include "tools.h" /* Definitions for type declarations, etc. */
#include "msgcat.h"
#define STDINNAME "-" /* File name that refers to standard input. */
#define EOS '\0' /* NONCHAR: EE (entity end: strings). */
#define AVALCASE 2 /* 2=untranslated string of name characters. */
#define REFNAMELEN 8 /* reference quantity set NAMELEN */
#define REFLITLEN 240 /* reference quantity set LITLEN */
/* Minimization status of returned tags.
*/
#define MINNONE 0 /* Minimization: tag not minimized. */
#define MINNULL 1 /* Minimization: tag was null. */
#define MINNET 2 /* Minimization: end-tag was NET delimiter. */
#define MINDATA 3 /* Minimization: end-tag was data tag. */
#define MINSTAG 4 /* Minimization: tag implied by start-tag. */
#define MINETAG 5 /* Minimization: end-tag implied by end-tag. */
/* Formal public identifier public text classes.
*/
#define FPICAP 1
#define FPICHARS 2
#define FPINOT 3
#define FPISYN 4
#define FPICMINV 5 /* Minimum fpic value for versionable text. */
#define FPIDOC 5
#define FPIDTD 6
#define FPIELEM 7
#define FPIENT 8
#define FPILPD 9
#define FPINON 10
#define FPISHORT 11
#define FPISUB 12
#define FPITEXT 13
struct fpi { /* Formal public identifier. */
UNCH fpiot; /* Owner type: + or - or ! (for ISO). */
UNS fpiol; /* Length of owner identifier. */
UNS fpio; /* Offset in pubis of owner identifier (no EOS).*/
int fpic; /* Public text class. */
UNCH fpitt; /* Text type: - or + (for available). */
UNS fpitl; /* Length of text identifier. */
UNS fpit; /* Offset in pubis of text identifier (no EOS). */
UNS fpill; /* Language/designating sequence length. */
UNS fpil; /* Offset in pubis of language. */
UNS fpivl; /* Length of display version . */
UNS fpiv; /* Offset in pubis of display version (no EOS). */
int fpiversw; /* 1=use best ver; 0=use stated ver; -1=error. */
UNCH *fpinm; /* Entity/DCN name (EOS, no length). */
UNCH fpistore; /* 1=NDATA 2=general 3=parm 4=DTD 5=LPD 6=DCN. */
/* Name of the entity's DCN. Valid only when fpistore == 1.
NULL if it's a SUBDOC. */
UNCH *fpinedcn;
UNCH *fpipubis; /* Public ID string (EOS). */
UNCH *fpisysis; /* System ID string (EOS). */
};
#define FPISZ sizeof(struct fpi)
typedef struct fpi *PFPI; /* Ptr to FPI control block. */
/* General control blocks.
*/
#define NONONCH 1 /* Character references to non-chars invalid. */
#define OKNONCH 0 /* Character references to non-chars allowed. */
struct parse { /* Parse control block. */
char *pname; /* Parse name; content, tag, etc. */
UNCH *plex; /* Lexical analysis table. */
UNCH **ptab; /* State and action table. */
UNS state; /* State. */
UNS input; /* Input. */
UNS action; /* Action. */
UNS newstate; /* Next state. */
};
struct restate {
UNS sstate; /* State. */
UNS sinput; /* Input. */
UNS saction; /* Action. */
UNS snext; /* Next state. */
};
struct map {
UNCH *mapnm; /* Name followed by EOS. */
int mapdata; /* Data associated with that name. */
};
struct hash { /* Dummy structure for function arguments. */
struct hash *enext; /* Next entry in chain. */
UNCH *ename; /* Entry name with size and EOS. */
};
typedef struct hash *PHASH; /* Ptr to hash table entry. */
typedef struct hash **THASH; /* Ptr to hash table. */
struct fwdref { /* A forward id reference. */
struct fwdref *next; /* Pt to next reference in chain. */
UNIV msg; /* Ptr to saved error messsage. */
};
#define FWDREFSZ sizeof(struct fwdref)
struct dcncb { /* Data content notation control block. */
struct dcncb *enext; /* Next DCN in chain. */
UNCH *ename; /* Notation name followed by EOS. */
UNCH mark; /* For use by application. */
UNCH entsw; /* Entity defined with this notation? */
UNCH defined; /* Has this notation been defined. */
UNCH *sysid; /* System identifier of notation. */
UNCH *pubid; /* Public identifier of notation. */
struct ad *adl; /* Data attribute list (NULL if none). */
};
#define DCBSZ sizeof(struct dcncb)
#define DCNMARK(p) ((p)->mark ? 1 : ((p)->mark = 1, 0))
typedef struct dcncb *PDCB; /* Ptr to DCN control block. */
/* Number of capacities in a capacity set. */
#define NCAPACITY 17
struct sgmlcap {
char **name;
UNCH *points;
long *number;
long *limit;
};
struct sgmlstat { /* Document statistics. */
UNS dcncnt; /* Number of data content notations defined. */
UNS pmexgcnt; /* Number of plus or minus exception groups. */
UNS etdcnt; /* Number of element types declared. */
UNS etdercnt; /* Number of element types defined by default. */
UNS pmexcnt; /* Number of plus/minus exception grp members. */
UNS modcnt; /* Number of content model tokens defined. */
UNS attcnt; /* Number of attributes defined. */
UNS attdef; /* Characters of attribute defaults defined. */
UNS attgcnt; /* Number of att value grp members (incl dcn). */
UNS idcnt; /* Number of ID attributes specified. */
UNS idrcnt; /* Number of ID references specified. */
UNS ecbcnt; /* Number of entities declared. */
UNS ecbtext; /* Characters of entity text defined. */
UNS srcnt; /* Number of short reference tables defined. */
UNS dcntext; /* Characters of notation identifiers defined. */
};
struct switches { /* Parser control switches (1=non-standard). */
int swdupent; /* 1=msg if duplicate ENTITY def attempted;0=no.*/
int swcommnt; /* 1=return comment declarations as data; 0=no. */
int swrefmsg; /* 1=msg if undeclared ref is defaulted; 0=no. */
UNS swbufsz; /* Size of source file buffer for READ(). */
int swenttr; /* 1=trace entity stack in error messages; 0=no.*/
int sweltr; /* 1=trace element stack in error messages; 0=no. */
int swambig; /* 1=check content model ambiguity */
int swundef; /* 1=warn about undefined elements and notations. */
char *prog; /* Program name for error messages. */
#ifdef TRACE
char *trace; /* What to trace in the body. */
char *ptrace; /* What to trace in the prolog. */
#endif /* TRACE */
nl_catd catd; /* Message catalog descriptor. */
long nopen; /* Number of open document entities */
int onlypro; /* Parse only the prolog. */
char **includes; /* List of parameter entities to be defined
as "INCLUDE"; NULL terminated.*/
VOID (*die) P((void)); /* Function to call on fatal error. */
};
struct markup { /* Delimiter strings for text processor. */
UNCH *cro; /* LEXCON markup string: CRO */
UNCH *dso; /* LEXCON markup string: DSO */
UNCH *ero; /* LEXCON markup string: ERO */
UNCH *etag; /* LEXMARK markup string: end-tag */
UNCH *lit; /* LEXMARK markup string: LIT */
UNCH *lita; /* LEXMARK markup string: LITA */
UNCH *mdc; /* LEXCON markup string: MDC */
UNCH *mdo; /* LEXCON markup string: MDO */
UNCH *mse; /* LEXCON markup string: mse */
UNCH *mss; /* LEXCON markup string: mss */
UNCH *mssc; /* LEXCON markup string: mss CDATA */
UNCH *mssr; /* LEXCON markup string: mss RCDATA */
UNCH *pic; /* LEXCON markup string: PIC */
UNCH *pio; /* LEXCON markup string: PIO */
UNCH *refc; /* LEXGRP markup string: REFC */
UNCH *stag; /* LEXMARK markup string: start-tag */
UNCH *tagc; /* LEXMARK markup string: TAGC */
UNCH *vi; /* LEXMARK markup string: VI */
int lennet; /* LEXMARK markup string length: null end-tag. */
int lennst; /* LEXMARK markup string length: null start-tag.*/
};
#endif /* ndef ENTITY_H */

View file

@ -0,0 +1,62 @@
/* $XConsortium: error.h /main/3 1996/06/19 17:14:57 drk $ */
/* ERROR.H: Symbols for SGML error codes (start with 'E_').
Numbers 46 - 56 are generated by ERROR.C.
Later numbers are coded directly.
*/
/* SGMLERR.C: General errors and syntax errors.
*/
#define E_CONTEXT 1 /* W GI not allowed at this point in structure. */
#define E_MDNAME 2 /* E Invalid markup declaration name. */
/*efine E_LEN 3 E Syntax error: length exceeded. */
#define E_SYS 4 /* W Illegal system character. */
#define E_ETAG 5 /* E End-tag does not match any open start-tag. */
#define E_STAGMAX 6 /* E Maximum number of open elements exceeded. */
/* E_ALLNULL 7 W Start- and end-tag omitted with null content. */
#define E_EOF 8 /* E/W Illegal entity end in markup or delimited text. */
/* fine E_INV 9 E Markup error: invalid character. */
#define E_CHARS 10 /* W Data found in content that doesn't allow it. */
/* fine E_NOETDE 11 E End-tag GI not defined by element declaration. */
#define E_BADNM 12 /* E Name is not syntactically valid. */
#define E_BADATT 13 /* E Attribute was not defined by element declaration. */
#define E_VALINV 14 /* W Att value/declaration conflict: invalid char. */
#define E_VALLEN 15 /* W Att value/declaration conflict: token too long. */
#define E_VALCNT 16 /* W Att value/declaration conflict: too many tokens. */
#define E_VALTYPE 17 /* W Att value/declaration conflict: wrong token type.*/
#define E_VALGRP 18 /* W Att value/declaration conflict: token not in grp.*/
#define E_VALREQ 19 /* W Att value/declaration conflict: req unspecified. */
/* E_EMIN 20 W End-tag implied by end-tag; not minimizable. */
/* E_SMIN 21 W Omitted start-tag was not minimizable. */
#define E_POSSATT 22 /* E Possible att found but not defined; used as data.*/
/* Late additions numbered out of order to avoid recompilation. */
/*efine E_ENTSYNC 37 E Entity and group nesting levels out of sync. */
#define E_BADVAL 25 /* W Att value omitted (null); default used. */
/* E_ECONTXT 30 W Element ended prematurely (some content omitted).*/
/* E_EMINST 39 W End-tag implied by start-tag; not minimizable. */
/* E_MEXTAG 40 W *** In Use *** */
#define E_MEXERR 41 /* W Attempt to exclude contextually required element.*/
#define E_DOCTYPE 42 /* W No document type defined; *DOCTYPE assumed. */
/* E_NOETDS 43 E Start-tag GI not defined by element declaration. */
#define E_RESTART 44 /* E Invalid chars ignored; trying to restart parse. */
/* MDERROR.C: Errors in markup declarations.
*/
/*efine E_DUP 23 E Duplicate specification. */
/*efine E_KEY 24 E Incorrect keyword for parameter. */
/*efine E_MSE 26 E MSE occurred with no corresponding MS. */
/*efine E_MSS 27 E MSS exceeded maximum nesting level. */
/*efine E_NUM 28 E Incorrect number of parameters. */
#define E_TYPE 29 /* E Incorrect parameter type. */
/* Late additions numbered out of order to avoid recompilation. */
/*efine E_VAL 38 W Incorrect parameter value. */
/* RESERROR.C: Errors in resource routines.
*/
/* Unused I End of primary source entity. */
/* fine E_FILBUF 31 E Could not read next buffer. */
/* fine E_ERFILE 32 E Could not open file. */
/* fine E_MALLOC 33 T Could not obtain required main storage. */
/* fine E_ERMAX 34 E Maximum number of open entities exceeded. */
/* fine E_ERNAME 35 E Referenced entity undeclared. */
/* fine E_ERLOOP 36 E Entity referenced within itself: ref ignored. */
/* Late additions numbered out of order to avoid recompilation. */
/* E_ERDEF 45 E Referenced entity undeclared; SYSTEM assumed. */

View file

@ -0,0 +1,92 @@
/* $XConsortium: etype.h /main/3 1996/06/19 17:15:01 drk $ */
/* ETYPE.H: Definitions for element type and group processing.
*/
#define MCHARS 0x80 /* Model: contains #CHARS. */
#define MGI 0x40 /* Model: contains GI names. */
#define MPHRASE 0x20 /* Model: first token is #CHARS. */
#define MKEYWORD 0x1F /* Model: defined with single keyword. */
#define MNONE 0x10 /* Model: contains no GIs or #CHARS. */
#define MANY 0x08 /* Model: contains any GIs or #CHARS. */
#define MRCDATA 0x04 /* Model: contains RCDATA. */
#define MCDATA 0x02 /* Model: contains CDATA. */
#define TOREP (TOPT+TREP) /* 11000000 Optional and repeatable. */
#define TOPT 0x80 /* Token: 1=optional; 0=required. */
#define TREP 0x40 /* Token: 1=repeatable; 0=not. */
#define TXOREP (TXOPT+TXREP) /* * explicitly specified */
#define TXOPT 0x20 /* ? explicitly specified */
#define TXREP 0x10 /* + explicitly specified */
#define TTMASK 0x0F /* 00001111 Mask for testing token type. */
#define TTETD 4 /* 00000100 Token is an ETD. */
#define TTAND 3 /* 00000011 Token is an AND group. */
#define TTSEQ 2 /* 00000010 Token is a sequence group. */
#define TTOR 1 /* 00000001 Token is an OR group. */
#define TTCHARS 0 /* 00000000 Token is #CHARS. */
struct thdr { /* Token header or model header. */
UNCH ttype; /* Token type attributes or model content. */
union {
int tnum; /* Group token: tokens in group.
Model header: content tokens at any level. */
struct etd *thetd; /* GI token: ptr to etd. */
} tu;
};
#define THSZ (sizeof(struct thdr))
#define ETDHASH 211 /* Size of element hash table. Must be prime. */
#define SMO 0x40 /* ETDMIN: Start-tag O minimization. */
#define EMO 0x04 /* ETDMIN: End-tag O minimization. */
#define EMM 0x02 /* ETDMIN: End-tag minimization explicitly
specified to be minus */
#define ETDDCL 0x80 /* ETDMIN: Element was declared. */
#define ETDUSED 0x20 /* ETDMIN: Element used in another declaration. */
#define ETDOCC 0x10 /* ETDMIN: Element occurred in document. */
struct etd { /* Element type definition. */
struct etd *etdnext; /* Next element type definition in hash chain. */
UNCH *etdgi; /* GI preceded by its length, followed by EOS. */
UNCH etdmin; /* Flag bits: minimization. */
UNCH mark; /* Mark bit: for ambiguity checking */
struct thdr *etdmod; /* Content model. */
struct etd **etdmex; /* Minus exceptions. */
struct etd **etdpex; /* Plus exceptions. */
struct ad *adl; /* Attribute descriptor list. */
struct entity **etdsrm; /* Short reference map. */
};
#define ETDSZ (sizeof(struct etd))
typedef struct etd *PETD;
extern struct etd dumetd[];
/* Number of bits in a long must be >= 1<<LONGPOW */
#define LONGPOW 5
#define LONGBITS (1<<LONGPOW)
struct mpos { /* Position of current element in model. */
UNCH g; /* Index of this group in the model. */
UNCH t; /* Index of the current token in this group. */
unsigned long *h; /* Hit bits of this group's tokens. */
};
#define HITCLEAR(h) MEMZERO((UNIV)(h), grplongs*sizeof(unsigned long))
#define TAGCONER 0x01 /* 00000001 (contersw) Tag was out of context. */
#define TAGNET 0x02 /* 00000010 (etisw) Tag has NET enabled. */
#define TAGPEX 0x04 /* 00000100 (pexsw) Tag was plus exception. */
#define TAGREF 0x08 /* 00001000 (conrefsw) Tag had CONREF or EMPTY.*/
struct tag { /* Tag control block. */
UNCH status; /* Status of context check. */
UNCH tflags; /* Flags: TAGCONER TAGNET TAGPEX TAGREF */
struct etd *tetd; /* Element type definition for tag. */
struct entity **tsrm; /* Current short reference map. */
struct mpos *tpos; /* Position of next tag in this model. */
};
#define RCEND 1 /* No more tokens: end element and retry GI. */
#define RCREQ 2 /* Required GI must precede proposed GI. */
#define RCMISS 3 /* GI invalid: not element end; no required GI. */
#define RCHIT 4 /* GI is the one expected next. */
#define RCMEX 5 /* GI invalid: minus exception. */
#define RCHITMEX 6 /* RCMEX with invalid attempted minus exclusion.*/
#define RCPEX 7 /* GI is valid solely because of plus exclusion.*/
#define RCNREQ 8 /* Token is not required; can retry invalid GI. */

View file

@ -0,0 +1,122 @@
/* $XConsortium: exclude.c /main/3 1996/06/19 17:15:05 drk $ */
/* exclude.c -
Exclusion checking.
Written by James Clark (jjc@jclark.com).
*/
#include "sgmlincl.h"
static int excktok P((struct thdr *, int, int *));
static int exmark P((int));
/* Check that the current exclusions are legal for the content model
of the current element. */
VOID exclude()
{
struct thdr *mod = tags[ts].tetd->etdmod;
if ((mod->ttype & MKEYWORD) == 0 && exmark(1)) {
int excl;
excktok(mod + 1, 0, &excl);
exmark(0);
}
}
/* Set the mark field of all current exclusions to val. Return 1 if
there are some current exclusions. */
static
int exmark(val)
int val;
{
int i;
int gotone = 0;
for (i = ts; i > 0; --i) {
struct etd **p = tags[i].tetd->etdmex;
if (p) {
for (; *p; p++)
(*p)->mark = val;
gotone = 1;
}
}
return gotone;
}
/* Check exclusions for this token. Return size of token. */
static
int excktok(t, orgrp, excl)
struct thdr *t;
int orgrp; /* 1 if token is member of or group */
int *excl; /* Set to 1 if token is excluded. */
{
int size;
struct thdr *tem;
int tnum;
int optional = 0;
int hadopt, hadreq;
*excl = 0;
switch (t->ttype & TTMASK) {
case TTETD:
if (t->tu.thetd->mark) {
if (orgrp || (t->ttype & TOPT))
*excl = 1;
else
sgmlerr(217, &pcbstag, t->tu.thetd->etdgi + 1,
tags[ts].tetd->etdgi + 1);
}
/* fall through */
case TTCHARS:
size = 1;
break;
case TTOR:
case TTAND:
case TTSEQ:
tem = t + 1;
hadopt = 0;
hadreq = 0;
for (tnum = t->tu.tnum; tnum > 0; --tnum) {
int ex;
int n = excktok(tem, (t->ttype & TTMASK) == TTOR, &ex);
if (!ex) {
if (tem->ttype & TOPT)
hadopt = 1;
else
hadreq = 1;
}
tem += n;
}
size = tem - t;
if ((t->ttype & TTMASK) == TTOR)
optional = hadreq ? hadopt : 1;
else
optional = !hadreq;
break;
default:
abort();
}
/* Was required, but exclusions have made it optional.
eg <!element foo - - (a | b) -(a, b)> */
if (optional && !(t->ttype & TOPT))
sgmlerr(216, &pcbstag, tags[ts].tetd->etdgi + 1, (UNCH *)0);
return size;
}
/*
Local Variables:
c-indent-level: 5
c-continued-statement-offset: 5
c-brace-offset: -5
c-argdecl-indent: 0
c-label-offset: -5
End:
*/

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