2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * Copyright 1993 Open Software Foundation, Inc., Cambridge, Massachusetts.
25 * All rights reserved.
29 * Open Software Foundation, Inc.
31 * Permission is hereby granted to use, copy, modify and freely distribute
32 * the software in this file and its documentation for any purpose without
33 * fee, provided that the above copyright notice appears in all copies and
34 * that both the copyright notice and this permission notice appear in
35 * supporting documentation. Further, provided that the name of Open
36 * Software Foundation, Inc. ("OSF") not be used in advertising or
37 * publicity pertaining to distribution of the software without prior
38 * written permission from OSF. OSF makes no representations about the
39 * suitability of this software for any purpose. It is provided "as is"
40 * without express or implied warranty.
42 /* ________________________________________________________________________
44 * Program to manipulate SGML instances.
46 * These are data definitions for the "translating" portion of the program.
48 * ________________________________________________________________________
53 static char *tr_h_RCSid =
54 "$XConsortium: translate.h /main/3 1996/06/19 17:13:31 drk $";
61 /* things to ignore when processing an element */
65 #define IGN_CHILDREN 3
67 /* for CheckRelation() */
68 typedef enum { RA_Current, RA_Related } RelAction_t;
70 /* for ExpandSpecialVar() */
71 typedef enum { CONT_CONTINUE, CONT_BREAK } ContParse_t;
74 char *name; /* attribute name string */
75 char *val; /* attribute value string */
76 regexp *rex; /* attribute value reg expr (compiled) */
79 typedef struct _Trans {
81 char *gi; /* element name of tag under consideration */
82 char **gilist; /* list of element names (multiple gi's) */
83 char *context; /* context in tree - looking depth levels up */
84 regexp *context_re; /* tree hierarchy looking depth levels up */
85 int depth; /* number of levels to look up the tree */
86 AttPair_t *attpair; /* attr name-value pairs */
87 int nattpairs; /* number of name-value pairs */
88 char *parent; /* GI has this element as parent */
89 int nth_child; /* GI is Nth child of this of parent element */
90 char *content; /* element has this string in content */
91 regexp *content_re; /* content reg expr (compiled) */
92 char *pattrset; /* is this attr set (any value) in parent? */
93 char *var_name; /* variable name */
94 char *var_value; /* variable value */
95 Map_t *relations; /* various relations to check */
98 char *starttext; /* string to output at the start tag */
99 char *startcode; /* Tcl code to execute at the start tag */
100 char *endtext; /* string to output at the end tag */
101 char *endcode; /* Tcl code to execute at the end tag */
102 char *replace; /* string to replace this subtree with */
103 char *message; /* message for stderr, if element encountered */
104 int ignore; /* flag - ignore content or data of element? */
106 char *increment; /* increment these variables */
107 Map_t *set_var; /* set these variables */
108 Map_t *incr_var; /* increment these variables */
109 char *quit; /* print message and exit */
111 /* pointers and bookkeeping */
112 int my_id; /* unique (hopefully) ID of this transpec */
113 int use_id; /* use transpec whose ID is this */
114 struct _Trans *use_trans; /* pointer to other transpec */
115 struct _Trans *next; /* linked list */
116 int lineno; /* line number of end of transpec */
128 def Trans_t *TrSpecs;
129 def Mapping_t *CharMap;
132 /* prototypes for things defined in translate.c */
133 int CheckRelation(Element_t *, char *, char *, char *, FILE*, RelAction_t);
134 Trans_t *FindTrans(Element_t *);
135 Trans_t *FindTransByName(char *);
136 Trans_t *FindTransByID(int);
137 void PrepTranspecs(Element_t *);
138 void ProcessOneSpec(char *, Element_t *, FILE *, int);
139 void TransElement(Element_t *, FILE *, Trans_t *);
140 void TranByAction(Element_t *, int, FILE *);
142 /* prototypes for things defined in tranvar.c */
143 ContParse_t ExpandSpecialVar(char *, Element_t *, FILE *, int);
145 /* prototypes for things defined in tables.c */
146 void OSFtable(Element_t *, FILE *, char **, int);
148 /* prototypes for things defines in util.c */
149 void ClearOutputBuffer();
150 char *GetOutputBuffer();
151 int OutputBufferActive();
152 /* ______________________________________________________________________ */