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 librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
26 * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
27 * ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
28 * the full copyright text.
35 static char rcsid[] = "$XConsortium: wmlsynbld.c /main/9 1995/08/29 11:11:12 drk $"
39 * (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
42 * This module contains the programs which construct the syntactic
43 * representation of the WML input. All the routines are called as
44 * actions of the grammar productions.
46 * Since WML is so simple, no stack frame technology is used. Instead,
47 * context is maintained by global pointers and vectors which contain
48 * the intermediate results of parsing a statement. At most, these
49 * contain an object being constructed (for instance a class descriptor)
50 * and a subobject (for instance a resource reference in a class).
52 * Results are communicated back using the global error count
53 * wml_err_count, and the ordered handle list wml_synobj_ptr.
67 * Globals used during WML parsing.
71 * Character arrays and other variables to hold lexemes
72 * are defined in wmllex.l
76 * Current principal object being constructed
79 ObjectPtr wml_cur_obj;
80 ObjectPtr wml_cur_subobj;
85 * Routine to create a class descriptor. The result is placed in both
86 * wml_cur_obj and wml_synobj.
89 * ctype class type, one of METACLASS | WIDGET | GADGET
92 void wmlCreateClass (name, ctype)
98 WmlSynClassDefPtr cdesc; /* new class descriptor */
102 * Initialize the new class descriptor. Enter it in the object list.
103 * Set the current object global to the descriptor.
105 cdesc = (WmlSynClassDefPtr) malloc (sizeof(WmlSynClassDef));
106 cdesc->validation = WmlClassDefValid;
107 cdesc->rslvdef = NULL;
111 cdesc->type = WmlClassTypeMetaclass;
114 cdesc->type = WmlClassTypeWidget;
117 cdesc->type = WmlClassTypeGadget;
120 printf ("\nwmlCreateClass: unknown class type %d", ctype);
124 cdesc->dialog = FALSE;
125 cdesc->name = wmlAllocateString (name);
126 cdesc->superclass = NULL;
127 cdesc->parentclass = NULL;
128 cdesc->widgetclass = NULL;
129 cdesc->int_lit = NULL;
130 cdesc->convfunc = NULL;
131 cdesc->docname = NULL;
132 cdesc->ctrlmapto = NULL;
133 cdesc->controls = NULL;
134 cdesc->resources = NULL;
135 cdesc->children = NULL;
137 if ( wmlFindInHList(wml_synobj_ptr,name) >= 0 )
139 printf ("\nDuplicate name %s found", name);
142 wmlInsertInHList (wml_synobj_ptr, name, (ObjectPtr)cdesc);
143 wml_cur_obj = (ObjectPtr) cdesc;
144 wml_cur_subobj = NULL;
153 * Routine to create a resource descriptor. The result is placed in both
154 * wml_cur_obj and wml_synobj.
156 * name the resource name
157 * rtype resource type, one of
158 * ARGUMENT | REASON | CONSTRAINT | SUBRESOURCE
161 void wmlCreateResource (name, rtype)
167 WmlSynResourceDefPtr rdesc; /* new resource descriptor */
171 * Initialize the new resource descriptor. Enter it in the object list.
172 * Set the current object global to the descriptor.
174 rdesc = (WmlSynResourceDefPtr) malloc (sizeof(WmlSynResourceDef));
175 rdesc->validation = WmlResourceDefValid;
176 rdesc->rslvdef = NULL;
180 rdesc->type = WmlResourceTypeArgument;
181 rdesc->xrm_support = WmlAttributeTrue;
184 rdesc->type = WmlResourceTypeReason;
185 rdesc->xrm_support = WmlAttributeFalse;
188 rdesc->type = WmlResourceTypeConstraint;
189 rdesc->xrm_support = WmlAttributeTrue;
192 rdesc->type = WmlResourceTypeSubResource;
193 rdesc->xrm_support = WmlAttributeTrue;
196 printf ("\nwmlCreateResource: unknown resource type %d", rtype);
200 rdesc->name = wmlAllocateString (name);
201 rdesc->datatype = NULL;
202 rdesc->int_lit = NULL;
203 rdesc->resliteral = wmlAllocateString (name); /* default to name */
204 rdesc->enumset = NULL;
205 rdesc->docname = NULL;
206 rdesc->related = NULL;
208 rdesc->alias_cnt = 0;
209 rdesc->alias_list = NULL;
211 if ( wmlFindInHList(wml_synobj_ptr,name) >= 0 )
213 printf ("\nDuplicate name %s found", name);
216 wmlInsertInHList (wml_synobj_ptr, name, (ObjectPtr)rdesc);
217 wml_cur_obj = (ObjectPtr) rdesc;
218 wml_cur_subobj = NULL;
227 * Routine to create a datatype descriptor. The result is placed in both
228 * wml_cur_obj and wml_synobj.
230 * name the datatype name
233 void wmlCreateDatatype (name)
238 WmlSynDataTypeDefPtr ddesc; /* new datatype descriptor */
242 * Initialize the new datatype descriptor. Enter it in the object list.
243 * Set the current object global to the descriptor.
245 ddesc = (WmlSynDataTypeDefPtr) malloc (sizeof(WmlSynDataTypeDef));
246 ddesc->validation = WmlDataTypeDefValid;
247 ddesc->rslvdef = NULL;
248 ddesc->name = wmlAllocateString (name);
249 ddesc->int_lit = NULL;
250 ddesc->docname = NULL;
251 ddesc->xrm_support = WmlAttributeTrue;
253 if ( wmlFindInHList(wml_synobj_ptr,name) >= 0 )
255 printf ("\nDuplicate name %s found", name);
258 wmlInsertInHList (wml_synobj_ptr, name, (ObjectPtr)ddesc);
259 wml_cur_obj = (ObjectPtr) ddesc;
260 wml_cur_subobj = NULL;
268 * Routine to create a child descriptor. The result is placed in both
269 * wml_cur_obj and wml_synobj.
271 * name the child name
272 * class the class name
275 void wmlCreateChild (name, class)
280 WmlSynChildDefPtr chdesc; /* new child descriptor */
284 * Initialize the new child descriptor. Enter it in the object list.
285 * Set the current object global to the descriptor.
287 chdesc = (WmlSynChildDefPtr) malloc (sizeof(WmlSynChildDef));
288 chdesc->validation = WmlChildDefValid;
289 chdesc->rslvdef = NULL;
290 chdesc->name = wmlAllocateString (name);
291 chdesc->class = wmlAllocateString (class);
293 if ( wmlFindInHList(wml_synobj_ptr,name) >= 0 )
295 printf ("\nDuplicate name %s found", name);
298 wmlInsertInHList (wml_synobj_ptr, name, (ObjectPtr)chdesc);
299 wml_cur_obj = (ObjectPtr) chdesc;
300 wml_cur_subobj = NULL;
309 * Routine to create a controls list descriptor. The result is placed in both
310 * wml_cur_obj and wml_synobj.
312 * name the controls list name
315 void wmlCreateOrAppendCtrlList (name)
320 WmlSynCtrlListDefPtr cdesc; /* new CtrlList descriptor */
322 idx = wmlFindInHList(wml_synobj_ptr,name);
325 /* Didn't find list */
328 * Initialize the new CtrlList descriptor. Enter it in the object list.
329 * Set the current object global to the descriptor.
331 cdesc = (WmlSynCtrlListDefPtr) malloc (sizeof(WmlSynCtrlListDef));
332 cdesc->validation = WmlCtrlListDefValid;
333 cdesc->rslvdef = NULL;
334 cdesc->name = wmlAllocateString (name);
335 cdesc->controls = NULL;
337 wmlInsertInHList (wml_synobj_ptr, name, (ObjectPtr)cdesc);
339 cdesc = (WmlSynCtrlListDefPtr) wml_synobj_ptr -> hvec[idx].objptr;
340 printf ("\nAppending to list name %s", name);
343 wml_cur_obj = (ObjectPtr) cdesc;
344 wml_cur_subobj = NULL;
353 * Routine to create an enumeration set descriptor. The result is placed in both
354 * wml_cur_obj and wml_synobj.
356 * name the enumeration set name
357 * type data type, must match a data type name
360 void wmlCreateEnumSet (name, dtype)
366 WmlSynEnumSetDefPtr esdesc; /* new enumeration set descriptor */
370 * Initialize the new resource descriptor. Enter it in the object list.
371 * Set the current object global to the descriptor.
373 esdesc = (WmlSynEnumSetDefPtr) malloc (sizeof(WmlSynEnumSetDef));
374 esdesc->validation = WmlEnumSetDefValid;
375 esdesc->rslvdef = NULL;
376 esdesc->name = wmlAllocateString (name);
377 esdesc->datatype = wmlAllocateString (dtype);
378 esdesc->values = NULL;
380 if ( wmlFindInHList(wml_synobj_ptr,name) >= 0 )
382 printf ("\nDuplicate name %s found", name);
385 wmlInsertInHList (wml_synobj_ptr, name, (ObjectPtr)esdesc);
386 wml_cur_obj = (ObjectPtr) esdesc;
387 wml_cur_subobj = NULL;
396 * Routine to create an enumeration value descriptor. The result is placed in both
397 * wml_cur_obj and wml_synobj.
399 * name the enumeration value name
402 void wmlCreateEnumValue (name)
407 WmlSynEnumValueDefPtr evdesc; /* new enumeration value descriptor */
411 * Initialize the new resource descriptor. Enter it in the object list.
412 * Set the current object global to the descriptor.
414 evdesc = (WmlSynEnumValueDefPtr) malloc (sizeof(WmlSynEnumValueDef));
415 evdesc->validation = WmlEnumValueDefValid;
416 evdesc->rslvdef = NULL;
417 evdesc->name = wmlAllocateString (name);
418 evdesc->enumlit = wmlAllocateString (name); /* defaults to name */
420 if ( wmlFindInHList(wml_synobj_ptr,name) >= 0 )
422 printf ("\nDuplicate name %s found", name);
425 wmlInsertInHList (wml_synobj_ptr, name, (ObjectPtr)evdesc);
426 wml_cur_obj = (ObjectPtr) evdesc;
427 wml_cur_subobj = NULL;
436 * Routine to create a charset descriptor. The result is placed in both
437 * wml_cur_obj and wml_synobj.
439 * name the charset name
442 void wmlCreateCharset (name)
447 WmlSynCharSetDefPtr ddesc; /* new charset descriptor */
451 * Initialize the new charset descriptor. Enter it in the object list.
452 * Set the current object global to the descriptor.
454 ddesc = (WmlSynCharSetDefPtr) malloc (sizeof(WmlSynCharSetDef));
455 ddesc->validation = WmlCharSetDefValid;
456 ddesc->rslvdef = NULL;
457 ddesc->name = wmlAllocateString (name);
458 ddesc->int_lit = NULL;
459 ddesc->xms_name = NULL;
460 ddesc->direction = WmlCharSetDirectionLtoR;
461 ddesc->parsedirection = WmlAttributeUnspecified;
462 ddesc->charsize = WmlCharSizeOneByte;
463 ddesc->alias_cnt = 0;
464 ddesc->alias_list = NULL;
466 if ( wmlFindInHList(wml_synobj_ptr,name) >= 0 )
468 printf ("\nDuplicate name %s found", name);
471 wmlInsertInHList (wml_synobj_ptr, name, (ObjectPtr)ddesc);
472 wml_cur_obj = (ObjectPtr) ddesc;
473 wml_cur_subobj = NULL;
482 * Routine to set an attribute in a class descriptor.
484 * This routine sets the given attribute in the current object, which
485 * must be a class descriptor. The current object and subobject do not
488 * attrid oneof SUPERCLASS | INTERNALLITERAL | DOCNAME |
489 * CONVFUNC | WIDGETCLASS | DIALOGCLASS |
491 * val value of the attribute, usually a string
494 void wmlAddClassAttribute (attrid, val)
500 WmlSynClassDefPtr cdesc; /* the class descriptor */
504 * Acquire the current class descriptor
506 if ( wml_cur_obj == NULL )
508 printf ("\nwmlAddClassAttribute: NULL current object");
511 cdesc = (WmlSynClassDefPtr) wml_cur_obj;
512 if ( cdesc->validation != WmlClassDefValid )
514 printf ("\nwmlAddClassAttribute: %d not a class descriptor",
520 * Set the appropriate resource
525 cdesc->superclass = wmlAllocateString (val);
528 cdesc->parentclass = wmlAllocateString (val);
530 case INTERNALLITERAL:
531 cdesc->int_lit = wmlAllocateString (val);
534 cdesc->convfunc = wmlAllocateString (val);
537 cdesc->docname = wmlAllocateString (val);
540 cdesc->widgetclass = wmlAllocateString (val);
546 cdesc->dialog = TRUE;
550 case CTRLMAPSRESOURCE:
551 cdesc->ctrlmapto = wmlAllocateString (val);
561 * Routine to add a control specification to the current class.
562 * The current object must be a class descriptor. The entry name
563 * is added to the controls list. The control specification becomes the
566 * name the name of the controlled class
569 void wmlAddClassControl (name)
574 WmlSynClassDefPtr cdesc; /* the class descriptor */
575 WmlSynClassCtrlDefPtr ctrlelm; /* controls element */
579 * Acquire the current class descriptor
581 if ( wml_cur_obj == NULL )
583 printf ("\nwmlAddClassControl: NULL current object");
586 cdesc = (WmlSynClassDefPtr) wml_cur_obj;
587 if ( cdesc->validation != WmlClassDefValid )
589 printf ("\nwmlAddClassControl: %d not a class descriptor",
595 * Add the control to the control list
597 ctrlelm = (WmlSynClassCtrlDefPtr) malloc (sizeof(WmlSynClassCtrlDef));
598 ctrlelm->validation = WmlClassCtrlDefValid;
599 ctrlelm->next = cdesc->controls;
600 cdesc->controls = ctrlelm;
601 ctrlelm->name = wmlAllocateString (name);
604 * This becomes the current subobject
606 wml_cur_subobj = (ObjectPtr) ctrlelm;
615 * Add a resource descriptor to a class.
616 * The current object must be a class descriptor. Create and add a
617 * resource descriptor, which becomes the current subobject. It is not
618 * entered in the named object list.
620 * name the resource name
623 void wmlAddClassResource (name)
628 WmlSynClassDefPtr cdesc; /* the class descriptor */
629 WmlSynClassResDefPtr rdesc; /* the resource reference descriptor */
633 * Acquire the current class descriptor
635 if ( wml_cur_obj == NULL )
637 printf ("\nwmlAddClassResource: NULL current object");
640 cdesc = (WmlSynClassDefPtr) wml_cur_obj;
641 if ( cdesc->validation != WmlClassDefValid )
643 printf ("\nwmlAddClassResource: %d not a class descriptor",
649 * Add the resource to the resource list
651 rdesc = (WmlSynClassResDefPtr) malloc (sizeof(WmlSynClassResDef));
652 rdesc->validation = WmlClassResDefValid;
653 rdesc->name = wmlAllocateString (name);
656 rdesc->exclude = WmlAttributeUnspecified;
658 rdesc->next = cdesc->resources;
659 cdesc->resources = rdesc;
662 * This becomes the current subobject
664 wml_cur_subobj = (ObjectPtr) rdesc;
672 * Add a child descriptor to a class.
673 * The current object must be a class descriptor. Create and add a
674 * child descriptor, which becomes the current subobject. It is not
675 * entered in the named object list.
677 * name the resource name
680 void wmlAddClassChild (name)
685 WmlSynClassDefPtr cdesc; /* the class descriptor */
686 WmlSynClassChildDefPtr chdesc; /* the child reference descriptor */
690 * Acquire the current class descriptor
692 if ( wml_cur_obj == NULL )
694 printf ("\nwmlAddClassResource: NULL current object");
697 cdesc = (WmlSynClassDefPtr) wml_cur_obj;
698 if ( cdesc->validation != WmlClassDefValid )
700 printf ("\nwmlAddClassResource: %d not a class descriptor",
706 * Add the child to the child list
708 chdesc = (WmlSynClassChildDefPtr) malloc (sizeof(WmlSynClassChildDef));
709 chdesc->validation = WmlClassChildDefValid;
710 chdesc->name = wmlAllocateString (name);
712 chdesc->next = cdesc->children;
713 cdesc->children = chdesc;
716 * This becomes the current subobject
718 wml_cur_subobj = (ObjectPtr) chdesc;
727 * This routine sets an attribute in the current class resource descriptor.
728 * The current subobject must be a class resource descriptor. The
729 * named attribute is set.
731 * attrid one of TYPE | DEFAULT | EXCLUDE
732 * val attribute value, usually a string. Must be
733 * ATTRTRUE | ATTRFALSE for EXCLUDE.
735 void wmlAddClassResourceAttribute (attrid, val)
741 WmlSynClassResDefPtr rdesc; /* current class resource descriptor */
742 long excval; /* EXCLUDE value */
746 * Acquire the descriptor from the current subobject.
748 if ( wml_cur_subobj == NULL )
750 printf ("\nwmlAddClassResourceAttribute: NULL current subobject");
753 rdesc = (WmlSynClassResDefPtr) wml_cur_subobj;
754 if ( rdesc->validation != WmlClassResDefValid )
757 ("\nwmlAddClassResourceAttribute: %d not a class resource descriptor",
765 rdesc->type = wmlAllocateString (val);
768 rdesc->dflt = wmlAllocateString (val);
775 rdesc->exclude = WmlAttributeTrue;
778 rdesc->exclude = WmlAttributeFalse;
781 printf ("\nwmlAddClassResourceAttribute: bad EXCLUDE value %d",
788 printf ("\nwmlAddClassResourceAttribute: unknown attrid %d", attrid);
801 * Routine to set an attribute in a resource descriptor.
803 * This routine sets the given attribute in the current object, which
804 * must be a resource descriptor. The current object and subobject do not
807 * attrid oneof TYPE | RESOURCELITERAL | INTERNALLITERAL |
808 * RELATED | DOCNAME | DEFAULT | XRMRESOURCE | ALIAS |
810 * val value of the attribute, usually a string
813 void wmlAddResourceAttribute (attrid, val)
819 WmlSynResourceDefPtr rdesc; /* the resource descriptor */
820 long xrmval; /* XRMRESOURCE value */
821 char **synlist; /* ALIAS pointer list */
825 * Acquire the current resource descriptor
827 if ( wml_cur_obj == NULL )
829 printf ("\nwmlAddResourceAttribute: NULL current object");
832 rdesc = (WmlSynResourceDefPtr) wml_cur_obj;
833 if ( rdesc->validation != WmlResourceDefValid )
835 printf ("\nwmlAddResourceAttribute: %d not a resource descriptor",
841 * Set the appropriate resource
846 rdesc->datatype = wmlAllocateString (val);
848 case INTERNALLITERAL:
849 rdesc->int_lit = wmlAllocateString (val);
851 case RESOURCELITERAL:
852 rdesc->resliteral = wmlAllocateString (val);
855 rdesc->enumset = wmlAllocateString (val);
858 rdesc->docname = wmlAllocateString (val);
861 rdesc->related = wmlAllocateString (val);
864 rdesc->dflt = wmlAllocateString (val);
871 rdesc->xrm_support = WmlAttributeTrue;
874 rdesc->xrm_support = WmlAttributeFalse;
878 ("\nwmlAddResourceAttribute: bad XRMRESOURCE value %d",
885 if ( rdesc->alias_cnt == 0 )
886 synlist = (char **) malloc (sizeof(char *));
889 realloc (rdesc->alias_list,
890 (rdesc->alias_cnt+1)*sizeof(char **));
891 synlist[rdesc->alias_cnt] = wmlAllocateString (val);
892 rdesc->alias_cnt += 1;
893 rdesc->alias_list = synlist;
896 printf ("\nwmlAddResourceAttribute: unknown attrid %d", attrid);
907 * Routine to set an attribute in a datatype descriptor.
909 * This routine sets the given attribute in the current object, which
910 * must be a datatype descriptor. The current object and subobject do not
913 * attrid oneof INTERNALLITERAL | DOCNAME | XRMRESOURCE
914 * val value of the attribute, usually a string
917 void wmlAddDatatypeAttribute (attrid, val)
923 WmlSynDataTypeDefPtr ddesc; /* the datatype descriptor */
924 long xrmval; /* XRMRESOURCE value */
928 * Acquire the current datatype descriptor
930 if ( wml_cur_obj == NULL )
932 printf ("\nwmlAddDatatypeAttribute: NULL current object");
935 ddesc = (WmlSynDataTypeDefPtr) wml_cur_obj;
936 if ( ddesc->validation != WmlDataTypeDefValid )
938 printf ("\nwmlAddDatatypeAttribute: %d not a datatype descriptor",
944 * Set the appropriate slot
948 case INTERNALLITERAL:
949 ddesc->int_lit = wmlAllocateString (val);
952 ddesc->docname = wmlAllocateString (val);
959 ddesc->xrm_support = WmlAttributeTrue;
962 ddesc->xrm_support = WmlAttributeFalse;
966 ("\nwmlAddDatatypeAttribute: bad XRMRESOURCE value %d",
973 printf ("\nwmlAddDatatypeAttribute: unknown attrid %d", attrid);
984 * Routine to add a control specification to the current controls list.
985 * The current object must be a controls list descriptor. The entry name
986 * is added to the controls list. The new element becomes the current
989 * name the name of the controlled class
992 void wmlAddCtrlListControl (name)
997 WmlSynCtrlListDefPtr cdesc; /* the controls list descriptor */
998 WmlSynClassCtrlDefPtr ctrlelm; /* controls element */
1002 * Acquire the current controls list descriptor
1004 if ( wml_cur_obj == NULL )
1006 printf ("\nwmlAddCtrlListControl: NULL current object");
1009 cdesc = (WmlSynCtrlListDefPtr) wml_cur_obj;
1010 if ( cdesc->validation != WmlCtrlListDefValid )
1012 printf ("\nwmlAddCtrlListControl: %d not a controls list descriptor",
1018 * Add the control to the control list
1020 ctrlelm = (WmlSynClassCtrlDefPtr) malloc (sizeof(WmlSynClassCtrlDef));
1021 ctrlelm->validation = WmlClassCtrlDefValid;
1022 ctrlelm->next = cdesc->controls;
1023 cdesc->controls = ctrlelm;
1024 ctrlelm->name = wmlAllocateString (name);
1027 * This becomes the current subobject
1029 wml_cur_subobj = (ObjectPtr) ctrlelm;
1038 * Routine to add an enumeration value to the current enumeration set
1039 * The current object must be an enumeration set descriptor. The entry name
1040 * is added to the the enumeration value list.
1042 * name the name of the enumeration value
1044 void wmlAddEnumSetValue (name)
1049 WmlSynEnumSetDefPtr esdesc; /* the enumeration set descriptor */
1050 WmlSynEnumSetValDefPtr evelm; /* EnumSet EnumValue element */
1053 * Acquire the current enumeration set descriptor
1055 if ( wml_cur_obj == NULL )
1057 printf ("\nwmlAddEnumSetValue: NULL current object");
1060 esdesc = (WmlSynEnumSetDefPtr) wml_cur_obj;
1061 if ( esdesc->validation != WmlEnumSetDefValid )
1063 printf ("\nwmlAddEnumSetValue: %d not an enumeration set descriptor",
1064 esdesc->validation);
1069 * Add the value to the set
1071 evelm = (WmlSynEnumSetValDefPtr) malloc (sizeof(WmlSynEnumSetValDef));
1072 evelm->validation = WmlEnumValueDefValid;
1073 evelm->next = esdesc->values;
1074 esdesc->values = evelm;
1075 evelm->name = wmlAllocateString (name);
1078 * Becomes current subobject
1080 wml_cur_subobj = (ObjectPtr) evelm;
1087 * Routine to set an attribute in an enumeration value
1089 * This routine sets the given attribute in the current object, which must
1090 * be an enumeration value descriptor. The current object does not change.
1092 * attrid oneof ENUMLITERAL
1093 * val value of the attribute, usually a string
1095 void wmlAddEnumValueAttribute (attrid, val)
1101 WmlSynEnumValueDefPtr evdesc; /* the enumeration value descriptor */
1105 * Acquire the current enumeration value descriptor
1107 if ( wml_cur_obj == NULL )
1109 printf ("\nwmlAddEnumValueAttribute: NULL current object");
1112 evdesc = (WmlSynEnumValueDefPtr) wml_cur_obj;
1113 if ( evdesc->validation != WmlEnumValueDefValid )
1115 printf ("\nwmlAddEnumValueAttribute: %d not an enumeration value descriptor",
1116 evdesc->validation);
1121 * Set the appropriate slot
1126 evdesc->enumlit = wmlAllocateString (val);
1129 printf ("\nwmlAddEnumValueAttribute: unknown attrid %d", attrid);
1141 * Routine to set an attribute in a charset descriptor.
1143 * This routine sets the given attribute in the current object, which
1144 * must be a charset descriptor. The current object and subobject do not
1147 * attrid oneof INTERNALLITERAL | ALIAS | XMSTRINGCHARSETNAME |
1148 * DIRECTION | PARSEDIRECTION | CHARACTERSIZE
1149 * val value of the attribute, usually a string
1152 void wmlAddCharsetAttribute (attrid, val)
1158 WmlSynCharSetDefPtr ddesc; /* the charset descriptor */
1159 char **synlist; /* ALIAS pointer list */
1160 long atrval; /* attribute value */
1164 * Acquire the current charset descriptor
1166 if ( wml_cur_obj == NULL )
1168 printf ("\nwmlAddCharSetAttribute: NULL current object");
1171 ddesc = (WmlSynCharSetDefPtr) wml_cur_obj;
1172 if ( ddesc->validation != WmlCharSetDefValid )
1174 printf ("\nwmlAddCharsetAttribute: %d not a CharSet descriptor",
1180 * Set the appropriate slot
1184 case INTERNALLITERAL:
1185 ddesc->int_lit = wmlAllocateString (val);
1188 if ( ddesc->alias_cnt == 0 )
1189 synlist = (char **) malloc (sizeof(char *));
1192 realloc (ddesc->alias_list,
1193 (ddesc->alias_cnt+1)*sizeof(char **));
1194 synlist[ddesc->alias_cnt] = wmlAllocateString (val);
1195 ddesc->alias_cnt += 1;
1196 ddesc->alias_list = synlist;
1198 case XMSTRINGCHARSETNAME:
1199 ddesc->xms_name = wmlAllocateString (val);
1202 atrval = (long) val;
1206 ddesc->direction = WmlCharSetDirectionLtoR;
1209 ddesc->direction = WmlCharSetDirectionRtoL;
1213 ("\nwmlAddCharsetAttribute: bad DIRECTION value %d",
1219 case PARSEDIRECTION:
1220 atrval = (long) val;
1224 ddesc->parsedirection = WmlCharSetDirectionLtoR;
1227 ddesc->parsedirection = WmlCharSetDirectionRtoL;
1231 ("\nwmlAddCharsetAttribute: bad PARSEDIRECTION value %d",
1238 atrval = (long) val;
1242 ddesc->charsize = WmlCharSizeOneByte;
1245 ddesc->charsize = WmlCharSizeTwoByte;
1248 ddesc->charsize = WmlCharSizeMixed1_2Byte;
1252 ("\nwmlAddCharsetAttribute: bad CHARACTERSIZE value %d",
1259 printf ("\nwmlAddCharsetAttribute: unknown attrid %d", attrid);
1270 * The error reporting routine.
1272 * For now, issue a very simple error message
1275 void LexIssueError (tkn)
1283 printf ("\n Syntax error: expected a semicolon");
1286 printf ("\n Syntax error: expected a right brace");
1289 printf ("\nSyntax error: Couldn't recognize a section name, probably fatal");
1292 printf ("\n\tnear name='%s', value='%s', line %d",
1293 yynameval, yystringval, wml_line_count);