diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/Makefile.am b/cde/programs/dtinfo/DtMmdb/StyleSheet/Makefile.am index 6cb41b98b..372ad1aa2 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/Makefile.am +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/Makefile.am @@ -29,3 +29,27 @@ libStyleSheet_la_SOURCES = Attribute.C \ defToken.C \ style.C \ tokenStyle.C + +AM_YFLAGS = -l -d +AM_LFLAGS = -8 -s + +CLEANFILES = defParser.C \ + defParser.tab.h \ + defToken.C \ + style.C \ + style.tab.h \ + tokenStyle.C + +defParser.C: defParser.yy + $(YACC) $(AM_YFLAGS) -p defParser -b defParser $< + mv defParser.tab.c $@ + +defToken.C: defToken.ll + $(LEX) $(AM_LFLAGS) -P defParser -o $@ $< + +style.C: style.yy + $(YACC) $(AM_YFLAGS) -p style -b style $< + mv style.tab.c style.C + +tokenStyle.C: tokenStyle.ll + $(LEX) $(AM_LFLAGS) -P style -o $@ $< diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.C deleted file mode 100644 index 23e8f94d1..000000000 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.C +++ /dev/null @@ -1,528 +0,0 @@ -/* - * CDE - Common Desktop Environment - * - * Copyright (c) 1993-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these libraries and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -// $TOG: defParser.C /main/5 1997/12/23 11:16:25 bill $ -#ifndef lint -__attribute__((unused)) -static const char defParsersccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90"; -#endif -#define defParserBYACC 1 -#include -#include -#include -#include -using namespace std; -#include "Debug.h" -#include "FeatureDefDictionary.h" - -#ifdef alloca -# undef alloca -#endif -#define alloca(x) (malloc(x)) - -def_list_t* g_def_list = 0; - -extern void defParsererror(char*); -extern int defParserlex(); - -#undef defParserwrap - -typedef union -{ - unsigned char charData; - unsigned char* charPtrData; - int intData; - float realData; - FeatureValue* valueData; - - defv_t* valueListPtrData; - TypeValues* typeValuesPtrData; - type_values_list_t* typeValuesListPtrData; - - def_list_t* defListPtrData; - FeatureDef* defPtrData; - -} defParserSTYPE; -#define STAR 257 -#define COMMA 258 -#define COLON 259 -#define SEMI_COLON 260 -#define FSOPEN 261 -#define FSCLOSE 262 -#define OPER_parenopen 263 -#define OPER_parenclose 264 -#define INTEGER 265 -#define REAL 266 -#define NORMAL_STRING 267 -#define QUOTED_STRING 268 -#define REF_NAME 269 -#define TYPE 270 -#define ValueListOpt 271 -#define defParserERRCODE 256 -short defParserlhs[] = { -1, - 0, 11, 11, 6, 6, 6, 6, 8, 10, 7, - 9, 1, 5, 5, 4, 4, 3, 3, 2, 2, - 2, -}; -short defParserlen[] = { 2, - 1, 2, 1, 1, 1, 1, 1, 4, 4, 2, - 2, 1, 3, 1, 4, 1, 3, 1, 1, 1, - 1, -}; -short defParserdefred[] = { 0, - 0, 12, 0, 0, 3, 6, 4, 7, 5, 0, - 11, 0, 10, 0, 2, 0, 14, 0, 0, 0, - 0, 9, 8, 19, 21, 20, 18, 0, 13, 0, - 15, 17, -}; -short defParserdgoto[] = { 3, - 4, 27, 28, 17, 18, 5, 6, 7, 8, 9, - 10, -}; -short defParsersindex[] = { -256, - -258, 0, 0, -240, 0, 0, 0, 0, 0, -256, - 0, -262, 0, -256, 0, -249, 0, -254, -257, -250, - -262, 0, 0, 0, 0, 0, 0, -251, 0, -250, - 0, 0, -}; -short defParserrindex[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, - 0, 0, 0, 0, 0, -236, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -}; -short defParsergindex[] = { 0, - 0, -13, 0, 2, 0, -7, 0, 0, 0, 0, - 11, -}; -#define defParserTABLESIZE 25 -short defParsertable[] = { 1, - 1, 11, 15, 21, 23, 22, 30, 16, 1, 2, - 2, 15, 31, 20, 24, 25, 32, 26, 12, 13, - 14, 16, 29, 16, 19, -}; -short defParsercheck[] = { 257, - 257, 260, 10, 258, 262, 260, 258, 270, 0, 267, - 267, 19, 264, 263, 265, 266, 30, 268, 259, 260, - 261, 258, 21, 260, 14, -}; -#define defParserFINAL 3 -#ifndef defParserDEBUG -#define defParserDEBUG 0 -#endif -#define defParserMAXTOKEN 271 -#if defParserDEBUG -char *defParsername[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"STAR","COMMA","COLON", -"SEMI_COLON","FSOPEN","FSCLOSE","OPER_parenopen","OPER_parenclose","INTEGER", -"REAL","NORMAL_STRING","QUOTED_STRING","REF_NAME","TYPE","ValueListOpt", -}; -char *defParserrule[] = { -"$accept : featureDef", -"featureDef : DefList", -"DefList : DefList Def", -"DefList : Def", -"Def : CompositeDef", -"Def : PrimitiveDef", -"Def : DefReference", -"Def : WildCardDef", -"CompositeDef : Name FSOPEN DefList FSCLOSE", -"PrimitiveDef : Name COLON TypeValuesList SEMI_COLON", -"DefReference : Name SEMI_COLON", -"WildCardDef : STAR SEMI_COLON", -"Name : NORMAL_STRING", -"TypeValuesList : TypeValuesList COMMA TypeValues", -"TypeValuesList : TypeValues", -"TypeValues : TYPE OPER_parenopen ValueList OPER_parenclose", -"TypeValues : TYPE", -"ValueList : ValueList COMMA Value", -"ValueList : Value", -"Value : INTEGER", -"Value : QUOTED_STRING", -"Value : REAL", -}; -#endif -#define defParserclearin (defParserchar=(-1)) -#define defParsererrok (defParsererrflag=0) -#ifdef defParserSTACKSIZE -#ifndef defParserMAXDEPTH -#define defParserMAXDEPTH defParserSTACKSIZE -#endif -#else -#ifdef defParserMAXDEPTH -#define defParserSTACKSIZE defParserMAXDEPTH -#else -#define defParserSTACKSIZE 500 -#define defParserMAXDEPTH 500 -#endif -#endif -int defParserdebug; -int defParsernerrs; -int defParsererrflag; -int defParserchar; -short *defParserssp; -defParserSTYPE *defParservsp; -defParserSTYPE defParserval; -defParserSTYPE defParserlval; -short defParserss[defParserSTACKSIZE]; -defParserSTYPE defParservs[defParserSTACKSIZE]; -#define defParserstacksize defParserSTACKSIZE - -/* -void defParsererror(char *errorstr) -{ - cerr << errorstr ; -} -*/ -#define defParserABORT goto defParserabort -#define defParserACCEPT goto defParseraccept -#define defParserERROR goto defParsererrlab -#if defParserDEBUG -#ifndef __cplusplus -extern char *getenv(const char *); -#endif -#endif -int -defParserparse() -{ - int defParserm, defParsern, defParserstate; -#if defParserDEBUG - char *defParsers; - - if (defParsers = getenv("defParserDEBUG")) - { - defParsern = *defParsers; - if (defParsern >= '0' && defParsern <= '9') - defParserdebug = defParsern - '0'; - } -#endif - - defParsernerrs = 0; - defParsererrflag = 0; - defParserchar = (-1); - - defParserssp = defParserss; - defParservsp = defParservs; - *defParserssp = defParserstate = 0; - -defParserloop: - if ((defParsern = defParserdefred[defParserstate])) goto defParserreduce; - if (defParserchar < 0) - { - if ((defParserchar = defParserlex()) < 0) defParserchar = 0; -#if defParserDEBUG - if (defParserdebug) - { - defParsers = 0; - if (defParserchar <= defParserMAXTOKEN) defParsers = defParsername[defParserchar]; - if (!defParsers) defParsers = "illegal-symbol"; - printf("defParserdebug: state %d, reading %d (%s)\n", defParserstate, - defParserchar, defParsers); - } -#endif - } - if ((defParsern = defParsersindex[defParserstate]) && (defParsern += defParserchar) >= 0 && - defParsern <= defParserTABLESIZE && defParsercheck[defParsern] == defParserchar) - { -#if defParserDEBUG - if (defParserdebug) - printf("defParserdebug: state %d, shifting to state %d\n", - defParserstate, defParsertable[defParsern]); -#endif - if (defParserssp >= defParserss + defParserstacksize - 1) - { - goto defParseroverflow; - } - *++defParserssp = defParserstate = defParsertable[defParsern]; - *++defParservsp = defParserlval; - defParserchar = (-1); - if (defParsererrflag > 0) --defParsererrflag; - goto defParserloop; - } - if ((defParsern = defParserrindex[defParserstate]) && (defParsern += defParserchar) >= 0 && - defParsern <= defParserTABLESIZE && defParsercheck[defParsern] == defParserchar) - { - defParsern = defParsertable[defParsern]; - goto defParserreduce; - } - if (defParsererrflag) goto defParserinrecovery; -// Disable for now -#if 0 -#ifdef lint - goto defParsernewerror; -#endif -defParsernewerror: -#endif /* 0 */ - defParsererror((char*)"syntax error"); -// Disable for now -#if 0 -#ifdef lint - goto defParsererrlab; -#endif -defParsererrlab: -#endif /* 0 */ - ++defParsernerrs; -defParserinrecovery: - if (defParsererrflag < 3) - { - defParsererrflag = 3; - for (;;) - { - if ((defParsern = defParsersindex[*defParserssp]) && (defParsern += defParserERRCODE) >= 0 && - defParsern <= defParserTABLESIZE && defParsercheck[defParsern] == defParserERRCODE) - { -#if defParserDEBUG - if (defParserdebug) - printf("defParserdebug: state %d, error recovery shifting\ - to state %d\n", *defParserssp, defParsertable[defParsern]); -#endif - if (defParserssp >= defParserss + defParserstacksize - 1) - { - goto defParseroverflow; - } - *++defParserssp = defParserstate = defParsertable[defParsern]; - *++defParservsp = defParserlval; - goto defParserloop; - } - else - { -#if defParserDEBUG - if (defParserdebug) - printf("defParserdebug: error recovery discarding state %d\n", - *defParserssp); -#endif - if (defParserssp <= defParserss) goto defParserabort; - --defParserssp; - --defParservsp; - } - } - } - else - { - if (defParserchar == 0) goto defParserabort; -#if defParserDEBUG - if (defParserdebug) - { - defParsers = 0; - if (defParserchar <= defParserMAXTOKEN) defParsers = defParsername[defParserchar]; - if (!defParsers) defParsers = "illegal-symbol"; - printf("defParserdebug: state %d, error recovery discards token %d (%s)\n", - defParserstate, defParserchar, defParsers); - } -#endif - defParserchar = (-1); - goto defParserloop; - } -defParserreduce: -#if defParserDEBUG - if (defParserdebug) - printf("defParserdebug: state %d, reducing by rule %d (%s)\n", - defParserstate, defParsern, defParserrule[defParsern]); -#endif - defParserm = defParserlen[defParsern]; - defParserval = defParservsp[1-defParserm]; - switch (defParsern) - { -case 1: -{ - g_def_list = defParservsp[0].defListPtrData; - } -break; -case 2: -{ - defParserval.defListPtrData=defParservsp[-1].defListPtrData; - - if ( defParservsp[0].defPtrData -> type() == FeatureDef::WILDCARD ) - defParserval.defListPtrData -> prepend(defParservsp[0].defPtrData); - else - defParserval.defListPtrData -> append(defParservsp[0].defPtrData); - } -break; -case 3: -{ - defParserval.defListPtrData=new def_list_t(); - defParserval.defListPtrData -> append(defParservsp[0].defPtrData); - } -break; -case 4: -{ - defParserval.defPtrData=defParservsp[0].defPtrData; - } -break; -case 5: -{ - defParserval.defPtrData=defParservsp[0].defPtrData; - } -break; -case 6: -{ - defParserval.defPtrData=defParservsp[0].defPtrData; - } -break; -case 7: -{ - defParserval.defPtrData=defParservsp[0].defPtrData; - } -break; -case 8: -{ - defParserval.defPtrData= new FeatureDefComposite((char*)defParservsp[-3].charPtrData, defParservsp[-1].defListPtrData); - delete defParservsp[-3].charPtrData; - } -break; -case 9: -{ - defParserval.defPtrData= new FeatureDefPrimitive((char*)defParservsp[-3].charPtrData, defParservsp[-1].typeValuesListPtrData); - delete defParservsp[-3].charPtrData; - } -break; -case 10: -{ - defParserval.defPtrData= new FeatureDefReference((char*)defParservsp[-1].charPtrData); - delete defParservsp[-1].charPtrData; - } -break; -case 11: -{ - defParserval.defPtrData= new FeatureDefWildCard("*"); - } -break; -case 12: -{ - defParserval.charPtrData=defParservsp[0].charPtrData; - } -break; -case 13: -{ - defParserval.typeValuesListPtrData=defParservsp[-2].typeValuesListPtrData; - defParserval.typeValuesListPtrData -> append(defParservsp[0].typeValuesPtrData); - } -break; -case 14: -{ - defParserval.typeValuesListPtrData=new type_values_list_t(); - defParserval.typeValuesListPtrData -> append(defParservsp[0].typeValuesPtrData); - } -break; -case 15: -{ - defParserval.typeValuesPtrData=new TypeValues((char*)defParservsp[-3].charPtrData, defParservsp[-1].valueListPtrData); - delete defParservsp[-3].charPtrData; - } -break; -case 16: -{ - defParserval.typeValuesPtrData=new TypeValues((char*)defParservsp[0].charPtrData, 0); - delete defParservsp[0].charPtrData; - } -break; -case 17: -{ - defParservsp[-2].valueListPtrData -> append(defParservsp[0].valueData); - defParserval.valueListPtrData=defParservsp[-2].valueListPtrData; - } -break; -case 18: -{ - defParserval.valueListPtrData = new defv_t(); - defParserval.valueListPtrData -> append(defParservsp[0].valueData); - - } -break; -case 19: -{ - defParserval.valueData=new FeatureValueInt(defParservsp[0].intData); - } -break; -case 20: -{ - defParserval.valueData=new FeatureValueString((char*)defParservsp[0].charPtrData); - delete defParservsp[0].charPtrData; - } -break; -case 21: -{ - defParserval.valueData=new FeatureValueReal(defParservsp[0].realData); - } -break; - } - defParserssp -= defParserm; - defParserstate = *defParserssp; - defParservsp -= defParserm; - defParserm = defParserlhs[defParsern]; - if (defParserstate == 0 && defParserm == 0) - { -#if defParserDEBUG - if (defParserdebug) - printf("defParserdebug: after reduction, shifting from state 0 to\ - state %d\n", defParserFINAL); -#endif - defParserstate = defParserFINAL; - *++defParserssp = defParserFINAL; - *++defParservsp = defParserval; - if (defParserchar < 0) - { - if ((defParserchar = defParserlex()) < 0) defParserchar = 0; -#if defParserDEBUG - if (defParserdebug) - { - defParsers = 0; - if (defParserchar <= defParserMAXTOKEN) defParsers = defParsername[defParserchar]; - if (!defParsers) defParsers = "illegal-symbol"; - printf("defParserdebug: state %d, reading %d (%s)\n", - defParserFINAL, defParserchar, defParsers); - } -#endif - } - if (defParserchar == 0) goto defParseraccept; - goto defParserloop; - } - if ((defParsern = defParsergindex[defParserm]) && (defParsern += defParserstate) >= 0 && - defParsern <= defParserTABLESIZE && defParsercheck[defParsern] == defParserstate) - defParserstate = defParsertable[defParsern]; - else - defParserstate = defParserdgoto[defParserm]; -#if defParserDEBUG - if (defParserdebug) - printf("defParserdebug: after reduction, shifting from state %d \ -to state %d\n", *defParserssp, defParserstate); -#endif - if (defParserssp >= defParserss + defParserstacksize - 1) - { - goto defParseroverflow; - } - *++defParserssp = defParserstate; - *++defParservsp = defParserval; - goto defParserloop; -defParseroverflow: - defParsererror((char*)"yacc stack overflow"); -defParserabort: - return (1); -defParseraccept: - return (0); -} diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.tab.h b/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.tab.h deleted file mode 100644 index 5c15175d1..000000000 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.tab.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDE - Common Desktop Environment - * - * Copyright (c) 1993-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these libraries and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* $XConsortium: defParser.tab.h /main/3 1996/06/11 17:46:23 cde-hal $ */ -#define STAR 257 -#define COMMA 258 -#define COLON 259 -#define SEMI_COLON 260 -#define FSOPEN 261 -#define FSCLOSE 262 -#define OPER_parenopen 263 -#define OPER_parenclose 264 -#define INTEGER 265 -#define REAL 266 -#define NORMAL_STRING 267 -#define QUOTED_STRING 268 -#define REF_NAME 269 -#define TYPE 270 -#define ValueListOpt 271 -typedef union -{ - unsigned char charData; - unsigned char* charPtrData; - int intData; - float realData; - FeatureValue* valueData; - - defv_t* valueListPtrData; - TypeValues* typeValuesPtrData; - type_values_list_t* typeValuesListPtrData; - - def_list_t* defListPtrData; - FeatureDef* defPtrData; - -} YYSTYPE; -extern YYSTYPE defParserlval; diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.y b/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.yy similarity index 99% rename from cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.y rename to cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.yy index 097815e8b..59b81dcdb 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.y +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/defParser.yy @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include "Debug.h" #include "FeatureDefDictionary.h" diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.C deleted file mode 100644 index ae5364396..000000000 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.C +++ /dev/null @@ -1,1321 +0,0 @@ -/* - * CDE - Common Desktop Environment - * - * Copyright (c) 1993-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these libraries and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* A lexical scanner generated by flex */ - -/* scanner skeleton version: - * $XConsortium: defToken.C /main/5 1996/08/21 15:57:31 drk $ - */ - -#define FLEX_SCANNER - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include - -#if !defined(__linux__) && !defined(CSRG_BASED) && !defined(sun) -#include -#endif - -/* use prototypes in function declarations */ -#define defParser_USE_PROTOS - -/* the "const" storage-class-modifier is valid */ -#define defParser_USE_CONST - -#else /* ! __cplusplus */ - -#ifdef __STDC__ - -#ifdef __GNUC__ -#include -void *malloc( size_t ); -void free( void* ); -#else -#include -#endif /* __GNUC__ */ - -#define defParser_USE_PROTOS -#define defParser_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - - -#ifdef __TURBOC__ -#define defParser_USE_CONST -#endif - - -#ifndef defParser_USE_CONST -#define const -#endif - - -#ifdef defParser_USE_PROTOS -#define defParser_PROTO(proto) proto -#else -#define defParser_PROTO(proto) () -/* we can't get here if it's an ANSI C compiler, or a C++ compiler, - * so it's got to be a K&R compiler, and therefore there's no standard - * place from which to include these definitions - */ -char *malloc(); -int free(); -int read(); -#endif - - -/* amount of stuff to slurp up with each read */ -#ifndef defParser_READ_BUF_SIZE -#define defParser_READ_BUF_SIZE 8192 -#endif - -/* returned upon end-of-file */ -#define defParser_END_TOK 0 - -/* copy whatever the last rule matched to the standard output */ - -/* cast to (char *) is because for 8-bit chars, defParsertext is (unsigned char *) */ -/* this used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite() - */ -#define ECHO (void) fwrite( (char *) defParsertext, defParserleng, 1, defParserout ) - -/* gets input and stuffs it into "buf". number of characters read, or defParser_NULL, - * is returned in "result". - */ -#define defParser_INPUT(buf,result,max_size) \ - if ( (result = read( fileno(defParserin), (char *) buf, max_size )) < 0 ) \ - defParser_FATAL_ERROR( "read() in flex scanner failed" ); -#define defParser_NULL 0 - -/* no semi-colon after return; correct usage is to write "defParserterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#define defParserterminate() return ( defParser_NULL ) - -/* report a fatal error */ - -/* The funky do-while is used to turn this macro definition into - * a single C statement (which needs a semi-colon terminator). - * This avoids problems with code like: - * - * if ( something_happens ) - * defParser_FATAL_ERROR( "oops, the something happened" ); - * else - * everything_okay(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the defParser_FATAL_ERROR() call. - */ - -#define defParser_FATAL_ERROR(msg) \ - do \ - { \ - (void) fputs( msg, stderr ); \ - (void) putc( '\n', stderr ); \ - exit( 1 ); \ - } \ - while ( 0 ) - -/* default defParserwrap function - always treat EOF as an EOF */ -#define defParserwrap() 1 - -/* enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN - */ -#define BEGIN defParser_start = 1 + 2 * - -/* action number for EOF rule of a given start state */ -#define defParser_STATE_EOF(state) (defParser_END_OF_BUFFER + state + 1) - -/* special action meaning "start processing a new file" */ -#define defParser_NEW_FILE \ - do \ - { \ - defParser_init_buffer( defParser_current_buffer, defParserin ); \ - defParser_load_buffer_state(); \ - } \ - while ( 0 ) - -/* default declaration of generated scanner - a define so the user can - * easily add parameters - */ -#define defParser_DECL int defParserlex defParser_PROTO(( void )) - -/* code executed at the end of each rule */ -#define defParser_BREAK break; - -#define defParser_END_OF_BUFFER_CHAR 0 - -#ifndef defParser_BUF_SIZE -#define defParser_BUF_SIZE (defParser_READ_BUF_SIZE * 2) /* size of default input buffer */ -#endif - -typedef struct defParser_buffer_state *defParser_BUFFER_STATE; - -#define defParser_CHAR unsigned char -# line 1 "defToken.l" -#define INITIAL 0 -# line 10 "defToken.l" -#include -#include "FeatureDefDictionary.h" -#include "defParser.tab.h" -#include "Debug.h" -#include -using namespace std; - -extern istream *g_defParserin; - -#undef defParser_INPUT -#define defParser_INPUT(buf,result,max_size)\ - {\ - if (g_defParserin -> eof()) {\ - result=0;\ - } else {\ - g_defParserin -> read((char *)buf, max_size-1); \ - result = g_defParserin -> gcount(); \ - buf[result] = 0; \ - }\ - } - -int defParserlineno=1; - -unsigned char* defToken_string_buf = new unsigned char[1024]; -int defToken_string_buf_size = 1024; -int defToken_string_buf_content_size = 0; - -unsigned char* new_copy(const unsigned char* str, int size) -{ - unsigned char* x = new unsigned char[ ( size <= 0 ) ? 1 : size + 1]; - memcpy(x, str, size); - x[size] = 0; - return x; -} - -void addToDefTokenStringBuf(const unsigned char* str, int size) -{ - if ( size <= 0 ) return; - - if ( defToken_string_buf_size - defToken_string_buf_content_size < size ) { - defToken_string_buf_size = 2*(size+defToken_string_buf_content_size); - unsigned char* x = new unsigned char[defToken_string_buf_size]; - memcpy(x, defToken_string_buf, defToken_string_buf_content_size); - delete [] defToken_string_buf; - defToken_string_buf = x; - } - - memcpy(defToken_string_buf + defToken_string_buf_content_size, str, size); - defToken_string_buf_content_size += size; - defToken_string_buf[defToken_string_buf_content_size] = 0; -} - - - -#define quoted_string 1 -# line 74 "defToken.l" - -/* done after the current pattern has been matched and before the - * corresponding action - sets up defParsertext - */ -#define defParser_DO_BEFORE_ACTION \ - defParsertext = defParser_bp; \ - defParserleng = defParser_cp - defParser_bp; \ - defParser_hold_char = *defParser_cp; \ - *defParser_cp = '\0'; \ - defParser_c_buf_p = defParser_cp; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* return all but the first 'n' matched characters back to the input stream */ -#define defParserless(n) \ - do \ - { \ - /* undo effects of setting up defParsertext */ \ - *defParser_cp = defParser_hold_char; \ - defParser_c_buf_p = defParser_cp = defParser_bp + n; \ - defParser_DO_BEFORE_ACTION; /* set up defParsertext again */ \ - } \ - while ( 0 ) - -#define unput(c) defParserunput( c, defParsertext ) - - -struct defParser_buffer_state - { - FILE *defParser_input_file; - - defParser_CHAR *defParser_ch_buf; /* input buffer */ - defParser_CHAR *defParser_buf_pos; /* current position in input buffer */ - - /* size of input buffer in bytes, not including room for EOB characters*/ - int defParser_buf_size; - - /* number of characters read into defParser_ch_buf, not including EOB characters */ - int defParser_n_chars; - - int defParser_eof_status; /* whether we've seen an EOF on this buffer */ -#define EOF_NOT_SEEN 0 - /* "pending" happens when the EOF has been seen but there's still - * some text process - */ -#define EOF_PENDING 1 -#define EOF_DONE 2 - }; - -static defParser_BUFFER_STATE defParser_current_buffer; - -/* we provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state" - */ -#define defParser_CURRENT_BUFFER defParser_current_buffer - - -/* defParser_hold_char holds the character lost when defParsertext is formed */ -static defParser_CHAR defParser_hold_char; - -static int defParser_n_chars; /* number of characters read into defParser_ch_buf */ - - - -#ifndef defParser_USER_ACTION -#define defParser_USER_ACTION -#endif - -#ifndef defParser_USER_INIT -#define defParser_USER_INIT -#endif - -extern defParser_CHAR *defParsertext; -extern int defParserleng; -extern FILE *defParserin, *defParserout; - -defParser_CHAR *defParsertext; -int defParserleng; - -FILE *defParserin = (FILE *) 0, *defParserout = (FILE *) 0; - -#define defParser_END_OF_BUFFER 29 -typedef int defParser_state_type; -static const short int defParser_accept[84] = - { 0, - 0, 0, 0, 0, 29, 24, 25, 26, 27, 20, - 24, 8, 9, 3, 2, 18, 5, 4, 24, 24, - 24, 24, 24, 24, 6, 7, 1, 22, 28, 21, - 24, 23, 0, 18, 24, 24, 24, 24, 24, 24, - 1, 1, 19, 24, 24, 24, 24, 24, 24, 24, - 24, 24, 24, 13, 24, 16, 24, 24, 24, 24, - 24, 24, 24, 11, 17, 24, 12, 24, 24, 24, - 14, 24, 24, 24, 24, 24, 24, 24, 24, 10, - 24, 15, 0 - } ; - -static const defParser_CHAR defParser_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 1, 5, 6, 1, 1, 7, 1, 8, - 9, 10, 4, 11, 1, 12, 4, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 14, 15, 1, - 4, 1, 4, 4, 16, 17, 1, 18, 19, 20, - 21, 1, 22, 1, 1, 23, 24, 25, 26, 27, - 1, 28, 29, 30, 1, 1, 1, 31, 32, 1, - 4, 1, 4, 4, 33, 1, 16, 17, 1, 18, - - 19, 20, 21, 1, 22, 1, 1, 23, 24, 25, - 26, 27, 1, 28, 29, 30, 1, 1, 1, 31, - 32, 1, 34, 1, 35, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static const defParser_CHAR defParser_meta[36] = - { 0, - 1, 2, 3, 2, 2, 1, 1, 2, 2, 2, - 2, 2, 1, 2, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 2 - } ; - -static const short int defParser_base[89] = - { 0, - 0, 119, 33, 34, 124, 0, 126, 126, 126, 126, - 0, 126, 126, 126, 126, 28, 126, 126, 95, 96, - 99, 95, 100, 88, 126, 126, 40, 126, 126, 126, - 0, 0, 104, 34, 79, 80, 81, 74, 87, 74, - 74, 0, 88, 84, 76, 79, 78, 73, 73, 62, - 74, 67, 70, 0, 65, 0, 71, 52, 61, 56, - 48, 50, 43, 37, 0, 43, 0, 41, 42, 38, - 32, 45, 36, 42, 39, 38, 28, 27, 38, 0, - 33, 0, 126, 109, 52, 42, 112, 114 - } ; - -static const short int defParser_def[89] = - { 0, - 83, 1, 84, 84, 83, 85, 83, 83, 83, 83, - 86, 83, 83, 83, 83, 85, 83, 83, 85, 85, - 85, 85, 85, 85, 83, 83, 87, 83, 83, 83, - 85, 86, 83, 85, 85, 85, 85, 85, 85, 85, - 87, 88, 83, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 0, 83, 83, 83, 83, 83 - } ; - -static const short int defParser_nxt[162] = - { 0, - 6, 7, 8, 9, 10, 6, 11, 12, 13, 14, - 15, 9, 16, 17, 18, 19, 20, 21, 6, 6, - 6, 22, 6, 6, 6, 6, 6, 23, 24, 6, - 6, 6, 6, 25, 26, 29, 29, 30, 30, 33, - 34, 42, 32, 42, 42, 33, 34, 42, 42, 42, - 42, 42, 31, 42, 42, 82, 81, 80, 79, 78, - 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, - 67, 66, 65, 42, 42, 42, 64, 42, 42, 63, - 62, 42, 42, 42, 42, 42, 61, 42, 42, 60, - 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, - - 43, 49, 48, 47, 46, 45, 44, 42, 42, 28, - 28, 28, 41, 41, 42, 42, 43, 40, 39, 38, - 37, 36, 35, 83, 27, 5, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83 - } ; - -static const short int defParser_chk[162] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 4, 3, 4, 16, - 16, 27, 86, 27, 27, 34, 34, 27, 27, 27, - 27, 27, 85, 27, 27, 81, 79, 78, 77, 76, - 75, 74, 73, 72, 71, 70, 69, 68, 66, 64, - 63, 62, 61, 27, 27, 41, 60, 41, 41, 59, - 58, 41, 41, 41, 41, 41, 57, 41, 41, 55, - 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, - - 43, 40, 39, 38, 37, 36, 35, 41, 41, 84, - 84, 84, 87, 87, 88, 88, 33, 24, 23, 22, - 21, 20, 19, 5, 2, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83 - } ; - -static defParser_state_type defParser_last_accepting_state; -static defParser_CHAR *defParser_last_accepting_cpos; - -/* the intent behind this definition is that it'll catch - * any uses of REJECT which flex missed - */ -#define REJECT reject_used_but_not_detected -#define defParsermore() defParsermore_used_but_not_detected -#define defParser_MORE_ADJ 0 - -/* these variables are all declared out here so that section 3 code can - * manipulate them - */ -/* points to current character in buffer */ -static defParser_CHAR *defParser_c_buf_p = (defParser_CHAR *) 0; -static int defParser_init = 1; /* whether we need to initialize */ -static int defParser_start = 0; /* start state number */ - -/* flag which is used to allow defParserwrap()'s to do buffer switches - * instead of setting up a fresh defParserin. A bit of a hack ... - */ -static int defParser_did_buffer_switch_on_eof; - -static defParser_state_type defParser_get_previous_state defParser_PROTO(( void )); -static defParser_state_type defParser_try_NUL_trans defParser_PROTO(( defParser_state_type current_state )); -static int defParser_get_next_buffer defParser_PROTO(( void )); -#if 0 -static void defParserunput defParser_PROTO(( defParser_CHAR c, defParser_CHAR *buf_ptr )); -#endif -void defParserrestart defParser_PROTO(( FILE *input_file )); -void defParser_switch_to_buffer defParser_PROTO(( defParser_BUFFER_STATE new_buffer )); -void defParser_load_buffer_state defParser_PROTO(( void )); -defParser_BUFFER_STATE defParser_create_buffer defParser_PROTO(( FILE *file, int size )); -void defParser_delete_buffer defParser_PROTO(( defParser_BUFFER_STATE b )); -void defParser_init_buffer defParser_PROTO(( defParser_BUFFER_STATE b, FILE *file )); - -#define defParser_new_buffer defParser_create_buffer - -#if 0 -#ifdef __cplusplus -static int defParserinput defParser_PROTO(( void )); -#else -static int input defParser_PROTO(( void )); -#endif -#endif - -defParser_DECL - { - defParser_state_type defParser_current_state; - defParser_CHAR *defParser_cp, *defParser_bp; - int defParser_act; - - - - - if ( defParser_init ) - { - defParser_USER_INIT; - - if ( ! defParser_start ) - defParser_start = 1; /* first start state */ - - if ( ! defParserin ) - defParserin = stdin; - - if ( ! defParserout ) - defParserout = stdout; - - if ( defParser_current_buffer ) - defParser_init_buffer( defParser_current_buffer, defParserin ); - else - defParser_current_buffer = defParser_create_buffer( defParserin, defParser_BUF_SIZE ); - - defParser_load_buffer_state(); - - defParser_init = 0; - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - defParser_cp = defParser_c_buf_p; - - /* support of defParsertext */ - *defParser_cp = defParser_hold_char; - - /* defParser_bp points to the position in defParser_ch_buf of the start of the - * current run. - */ - defParser_bp = defParser_cp; - - defParser_current_state = defParser_start; - if ( defParser_bp[-1] == '\n' ) - ++defParser_current_state; -defParser_match: - do - { - defParser_CHAR defParser_c = defParser_ec[*defParser_cp]; - if ( defParser_accept[defParser_current_state] ) - { - defParser_last_accepting_state = defParser_current_state; - defParser_last_accepting_cpos = defParser_cp; - } - while ( defParser_chk[defParser_base[defParser_current_state] + defParser_c] != defParser_current_state ) - { - defParser_current_state = defParser_def[defParser_current_state]; - if ( defParser_current_state >= 84 ) - defParser_c = defParser_meta[defParser_c]; - } - defParser_current_state = defParser_nxt[defParser_base[defParser_current_state] + defParser_c]; - ++defParser_cp; - } - while ( defParser_current_state != 83 ); - defParser_cp = defParser_last_accepting_cpos; - defParser_current_state = defParser_last_accepting_state; - -defParser_find_action: - defParser_act = defParser_accept[defParser_current_state]; - - defParser_DO_BEFORE_ACTION; - defParser_USER_ACTION; - -do_action: /* this label is used only to access EOF actions */ - - - switch ( defParser_act ) - { - case 0: /* must backtrack */ - /* undo the effects of defParser_DO_BEFORE_ACTION */ - *defParser_cp = defParser_hold_char; - defParser_cp = defParser_last_accepting_cpos; - defParser_current_state = defParser_last_accepting_state; - goto defParser_find_action; - -case 1: -# line 76 "defToken.l" -{ - } - defParser_BREAK -case 2: -# line 79 "defToken.l" -{ - return(COMMA); - } - defParser_BREAK -case 3: -# line 83 "defToken.l" -{ - return(STAR); - } - defParser_BREAK -case 4: -# line 87 "defToken.l" -{ - return(SEMI_COLON); - } - defParser_BREAK -case 5: -# line 91 "defToken.l" -{ - return(COLON); - } - defParser_BREAK -case 6: -# line 95 "defToken.l" -{ - return(FSOPEN); - } - defParser_BREAK -case 7: -# line 99 "defToken.l" -{ - return(FSCLOSE); - } - defParser_BREAK -case 8: -# line 103 "defToken.l" -{ - return(OPER_parenopen); - } - defParser_BREAK -case 9: -# line 107 "defToken.l" -{ - return(OPER_parenclose); - } - defParser_BREAK -case 10: -# line 112 "defToken.l" -{ - defParserlval.charPtrData = new_copy((unsigned char*)defParsertext, defParserleng); - return(TYPE); - } - defParser_BREAK -case 11: -# line 117 "defToken.l" -{ - defParserlval.charPtrData = new_copy((unsigned char*)defParsertext, defParserleng); - return(TYPE); - } - defParser_BREAK -case 12: -# line 122 "defToken.l" -{ - defParserlval.charPtrData = new_copy((unsigned char*)defParsertext, defParserleng); - return(TYPE); - } - defParser_BREAK -case 13: -# line 127 "defToken.l" -{ - defParserlval.charPtrData = new_copy((unsigned char*)defParsertext, defParserleng); - return(TYPE); - } - defParser_BREAK -case 14: -# line 132 "defToken.l" -{ - defParserlval.charPtrData = new_copy((unsigned char*)defParsertext, defParserleng); - return(TYPE); - } - defParser_BREAK -case 15: -# line 137 "defToken.l" -{ - defParserlval.charPtrData = new_copy((unsigned char*)defParsertext, defParserleng); - return(TYPE); - } - defParser_BREAK -case 16: -# line 142 "defToken.l" -{ - defParserlval.charPtrData = new_copy((unsigned char*)defParsertext, defParserleng); - return(TYPE); - } - defParser_BREAK -case 17: -# line 147 "defToken.l" -{ - defParserlval.charPtrData = - new_copy((unsigned char*)"INTEGER", strlen("INTEGER")); - return(TYPE); - } - defParser_BREAK -case 18: -# line 153 "defToken.l" -{ - defParserlval.intData = atoi((char*)defParsertext); - return(INTEGER); - } - defParser_BREAK -case 19: -# line 158 "defToken.l" -{ - defParserlval.realData = atof((char*)defParsertext); - return(REAL); - } - defParser_BREAK -case 20: -# line 163 "defToken.l" -{ - BEGIN quoted_string; - } - defParser_BREAK -case 21: -# line 167 "defToken.l" -{ - - defParserlval.charPtrData = - new unsigned char[defToken_string_buf_content_size+1]; - memcpy( defParserlval.charPtrData, - defToken_string_buf, - defToken_string_buf_content_size+1 - ); - - defToken_string_buf_content_size = 0; - BEGIN 0; - - return(QUOTED_STRING); - } - defParser_BREAK -case 22: -# line 182 "defToken.l" -{ - addToDefTokenStringBuf((const unsigned char *)defParsertext, defParserleng); - } - defParser_BREAK -case 23: -# line 186 "defToken.l" -{ - defParserlval.charPtrData = - (unsigned char*)strdup((const char*)(defParsertext+1)); - return(REF_NAME); - } - defParser_BREAK -case 24: -# line 192 "defToken.l" -{ - defParserlval.charPtrData = - (unsigned char*)strdup((const char*)defParsertext); - return(NORMAL_STRING); - } - defParser_BREAK -case 25: -# line 198 "defToken.l" -{ - } - defParser_BREAK -case 26: -# line 201 "defToken.l" -{ - defParserlineno++; - } - defParser_BREAK -case 27: -# line 205 "defToken.l" -{ - } - defParser_BREAK -case 28: -# line 210 "defToken.l" -defParser_FATAL_ERROR( "flex scanner jammed" ); - defParser_BREAK -case defParser_STATE_EOF(INITIAL): -case defParser_STATE_EOF(quoted_string): - defParserterminate(); - - case defParser_END_OF_BUFFER: - { - /* amount of text matched not including the EOB char */ - int defParser_amount_of_matched_text = defParser_cp - defParsertext - 1; - - /* undo the effects of defParser_DO_BEFORE_ACTION */ - *defParser_cp = defParser_hold_char; - - /* note that here we test for defParser_c_buf_p "<=" to the position - * of the first EOB in the buffer, since defParser_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the end- - * of-buffer state). Contrast this with the test in defParserinput(). - */ - if ( defParser_c_buf_p <= &defParser_current_buffer->defParser_ch_buf[defParser_n_chars] ) - /* this was really a NUL */ - { - defParser_state_type defParser_next_state; - - defParser_c_buf_p = defParsertext + defParser_amount_of_matched_text; - - defParser_current_state = defParser_get_previous_state(); - - /* okay, we're now positioned to make the - * NUL transition. We couldn't have - * defParser_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we - * don't want to build jamming into it because - * then it will run more slowly) - */ - - defParser_next_state = defParser_try_NUL_trans( defParser_current_state ); - - defParser_bp = defParsertext + defParser_MORE_ADJ; - - if ( defParser_next_state ) - { - /* consume the NUL */ - defParser_cp = ++defParser_c_buf_p; - defParser_current_state = defParser_next_state; - goto defParser_match; - } - - else - { - defParser_cp = defParser_last_accepting_cpos; - defParser_current_state = defParser_last_accepting_state; - goto defParser_find_action; - } - } - - else switch ( defParser_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - defParser_did_buffer_switch_on_eof = 0; - - if ( defParserwrap() ) - { - /* note: because we've taken care in - * defParser_get_next_buffer() to have set up defParsertext, - * we can now set up defParser_c_buf_p so that if some - * total hoser (like flex itself) wants - * to call the scanner after we return the - * defParser_NULL, it'll still work - another defParser_NULL - * will get returned. - */ - defParser_c_buf_p = defParsertext + defParser_MORE_ADJ; - - defParser_act = defParser_STATE_EOF((defParser_start - 1) / 2); - goto do_action; - } - - else - { - if ( ! defParser_did_buffer_switch_on_eof ) - defParser_NEW_FILE; - } - } - break; - - case EOB_ACT_CONTINUE_SCAN: - defParser_c_buf_p = defParsertext + defParser_amount_of_matched_text; - - defParser_current_state = defParser_get_previous_state(); - - defParser_cp = defParser_c_buf_p; - defParser_bp = defParsertext + defParser_MORE_ADJ; - goto defParser_match; - - case EOB_ACT_LAST_MATCH: - defParser_c_buf_p = - &defParser_current_buffer->defParser_ch_buf[defParser_n_chars]; - - defParser_current_state = defParser_get_previous_state(); - - defParser_cp = defParser_c_buf_p; - defParser_bp = defParsertext + defParser_MORE_ADJ; - goto defParser_find_action; - } - break; - } - - default: -#ifdef FLEX_DEBUG - printf( "action # %d\n", defParser_act ); -#endif - defParser_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } - } - } - - -/* defParser_get_next_buffer - try to read in a new buffer - * - * synopsis - * int defParser_get_next_buffer(); - * - * returns a code representing an action - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int defParser_get_next_buffer() - - { - defParser_CHAR *dest = defParser_current_buffer->defParser_ch_buf; - defParser_CHAR *source = defParsertext - 1; /* copy prev. char, too */ - int number_to_move, i; - int ret_val; - - if ( defParser_c_buf_p > &defParser_current_buffer->defParser_ch_buf[defParser_n_chars + 1] ) - defParser_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - /* try to read more data */ - - /* first move last chars to start of buffer */ - number_to_move = defParser_c_buf_p - defParsertext; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( defParser_current_buffer->defParser_eof_status != EOF_NOT_SEEN ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - defParser_n_chars = 0; - - else - { - int num_to_read = defParser_current_buffer->defParser_buf_size - number_to_move - 1; - - if ( num_to_read > defParser_READ_BUF_SIZE ) - num_to_read = defParser_READ_BUF_SIZE; - - else if ( num_to_read <= 0 ) - defParser_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - - /* read in more data */ - defParser_INPUT( (&defParser_current_buffer->defParser_ch_buf[number_to_move]), - defParser_n_chars, num_to_read ); - } - - if ( defParser_n_chars == 0 ) - { - if ( number_to_move == 1 ) - { - ret_val = EOB_ACT_END_OF_FILE; - defParser_current_buffer->defParser_eof_status = EOF_DONE; - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - defParser_current_buffer->defParser_eof_status = EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - defParser_n_chars += number_to_move; - defParser_current_buffer->defParser_ch_buf[defParser_n_chars] = defParser_END_OF_BUFFER_CHAR; - defParser_current_buffer->defParser_ch_buf[defParser_n_chars + 1] = defParser_END_OF_BUFFER_CHAR; - - /* defParsertext begins at the second character in defParser_ch_buf; the first - * character is the one which preceded it before reading in the latest - * buffer; it needs to be kept around in case it's a newline, so - * defParser_get_previous_state() will have with '^' rules active - */ - - defParsertext = &defParser_current_buffer->defParser_ch_buf[1]; - - return ( ret_val ); - } - - -/* defParser_get_previous_state - get the state just before the EOB char was reached - * - * synopsis - * defParser_state_type defParser_get_previous_state(); - */ - -static defParser_state_type defParser_get_previous_state() - - { - defParser_state_type defParser_current_state; - defParser_CHAR *defParser_cp; - - defParser_CHAR *defParser_bp = defParsertext; - - defParser_current_state = defParser_start; - if ( defParser_bp[-1] == '\n' ) - ++defParser_current_state; - - for ( defParser_cp = defParsertext + defParser_MORE_ADJ; defParser_cp < defParser_c_buf_p; ++defParser_cp ) - { - defParser_CHAR defParser_c = (*defParser_cp ? defParser_ec[*defParser_cp] : 1); - if ( defParser_accept[defParser_current_state] ) - { - defParser_last_accepting_state = defParser_current_state; - defParser_last_accepting_cpos = defParser_cp; - } - while ( defParser_chk[defParser_base[defParser_current_state] + defParser_c] != defParser_current_state ) - { - defParser_current_state = defParser_def[defParser_current_state]; - if ( defParser_current_state >= 84 ) - defParser_c = defParser_meta[defParser_c]; - } - defParser_current_state = defParser_nxt[defParser_base[defParser_current_state] + defParser_c]; - } - - return ( defParser_current_state ); - } - - -/* defParser_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = defParser_try_NUL_trans( current_state ); - */ - -#ifdef defParser_USE_PROTOS -static defParser_state_type defParser_try_NUL_trans( defParser_state_type defParser_current_state ) -#else -static defParser_state_type defParser_try_NUL_trans( defParser_current_state ) -defParser_state_type defParser_current_state; -#endif - - { - int defParser_is_jam; - defParser_CHAR *defParser_cp = defParser_c_buf_p; - - defParser_CHAR defParser_c = 1; - if ( defParser_accept[defParser_current_state] ) - { - defParser_last_accepting_state = defParser_current_state; - defParser_last_accepting_cpos = defParser_cp; - } - while ( defParser_chk[defParser_base[defParser_current_state] + defParser_c] != defParser_current_state ) - { - defParser_current_state = defParser_def[defParser_current_state]; - if ( defParser_current_state >= 84 ) - defParser_c = defParser_meta[defParser_c]; - } - defParser_current_state = defParser_nxt[defParser_base[defParser_current_state] + defParser_c]; - defParser_is_jam = (defParser_current_state == 83); - - return ( defParser_is_jam ? 0 : defParser_current_state ); - } - - -#if 0 -#ifdef defParser_USE_PROTOS -static void defParserunput( defParser_CHAR c, defParser_CHAR *defParser_bp ) -#else -static void defParserunput( c, defParser_bp ) -defParser_CHAR c; -defParser_CHAR *defParser_bp; -#endif - - { - defParser_CHAR *defParser_cp = defParser_c_buf_p; - - /* undo effects of setting up defParsertext */ - *defParser_cp = defParser_hold_char; - - if ( defParser_cp < defParser_current_buffer->defParser_ch_buf + 2 ) - { /* need to shift things up to make room */ - int number_to_move = defParser_n_chars + 2; /* +2 for EOB chars */ - defParser_CHAR *dest = - &defParser_current_buffer->defParser_ch_buf[defParser_current_buffer->defParser_buf_size + 2]; - defParser_CHAR *source = - &defParser_current_buffer->defParser_ch_buf[number_to_move]; - - while ( source > defParser_current_buffer->defParser_ch_buf ) - *--dest = *--source; - - defParser_cp += dest - source; - defParser_bp += dest - source; - defParser_n_chars = defParser_current_buffer->defParser_buf_size; - - if ( defParser_cp < defParser_current_buffer->defParser_ch_buf + 2 ) - defParser_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - if ( defParser_cp > defParser_bp && defParser_cp[-1] == '\n' ) - defParser_cp[-2] = '\n'; - - *--defParser_cp = c; - - /* note: the formal parameter *must* be called "defParser_bp" for this - * macro to now work correctly - */ - defParser_DO_BEFORE_ACTION; /* set up defParsertext again */ - } -#endif - - -#if 0 -#ifdef __cplusplus -static int defParserinput() -#else -static int input() -#endif - - { - int c; - defParser_CHAR *defParser_cp = defParser_c_buf_p; - - *defParser_cp = defParser_hold_char; - - if ( *defParser_c_buf_p == defParser_END_OF_BUFFER_CHAR ) - { - /* defParser_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( defParser_c_buf_p < &defParser_current_buffer->defParser_ch_buf[defParser_n_chars] ) - /* this was really a NUL */ - *defParser_c_buf_p = '\0'; - - else - { /* need more input */ - defParsertext = defParser_c_buf_p; - ++defParser_c_buf_p; - - switch ( defParser_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( defParserwrap() ) - { - defParser_c_buf_p = defParsertext + defParser_MORE_ADJ; - return ( EOF ); - } - - defParser_NEW_FILE; - -#ifdef __cplusplus - return ( defParserinput() ); -#else - return ( input() ); -#endif - } - break; - - case EOB_ACT_CONTINUE_SCAN: - defParser_c_buf_p = defParsertext + defParser_MORE_ADJ; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - defParser_FATAL_ERROR( "unexpected last match in defParserinput()" ); -#else - defParser_FATAL_ERROR( "unexpected last match in input()" ); -#endif - } - } - } - - c = *defParser_c_buf_p; - defParser_hold_char = *++defParser_c_buf_p; - - return ( c ); - } -#endif - - -#ifdef defParser_USE_PROTOS -void defParserrestart( FILE *input_file ) -#else -void defParserrestart( input_file ) -FILE *input_file; -#endif - - { - defParser_init_buffer( defParser_current_buffer, input_file ); - defParser_load_buffer_state(); - } - - -#ifdef defParser_USE_PROTOS -void defParser_switch_to_buffer( defParser_BUFFER_STATE new_buffer ) -#else -void defParser_switch_to_buffer( new_buffer ) -defParser_BUFFER_STATE new_buffer; -#endif - - { - if ( defParser_current_buffer == new_buffer ) - return; - - if ( defParser_current_buffer ) - { - /* flush out information for old buffer */ - *defParser_c_buf_p = defParser_hold_char; - defParser_current_buffer->defParser_buf_pos = defParser_c_buf_p; - defParser_current_buffer->defParser_n_chars = defParser_n_chars; - } - - defParser_current_buffer = new_buffer; - defParser_load_buffer_state(); - - /* we don't actually know whether we did this switch during - * EOF (defParserwrap()) processing, but the only time this flag - * is looked at is after defParserwrap() is called, so it's safe - * to go ahead and always set it. - */ - defParser_did_buffer_switch_on_eof = 1; - } - - -#ifdef defParser_USE_PROTOS -void defParser_load_buffer_state( void ) -#else -void defParser_load_buffer_state() -#endif - - { - defParser_n_chars = defParser_current_buffer->defParser_n_chars; - defParsertext = defParser_c_buf_p = defParser_current_buffer->defParser_buf_pos; - defParserin = defParser_current_buffer->defParser_input_file; - defParser_hold_char = *defParser_c_buf_p; - } - - -#ifdef defParser_USE_PROTOS -defParser_BUFFER_STATE defParser_create_buffer( FILE *file, int size ) -#else -defParser_BUFFER_STATE defParser_create_buffer( file, size ) -FILE *file; -int size; -#endif - - { - defParser_BUFFER_STATE b; - - b = (defParser_BUFFER_STATE) malloc( sizeof( struct defParser_buffer_state ) ); - - if ( ! b ) - defParser_FATAL_ERROR( "out of dynamic memory in defParser_create_buffer()" ); - - b->defParser_buf_size = size; - - /* defParser_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->defParser_ch_buf = (defParser_CHAR *) malloc( (unsigned) (b->defParser_buf_size + 2) ); - - if ( ! b->defParser_ch_buf ) - defParser_FATAL_ERROR( "out of dynamic memory in defParser_create_buffer()" ); - - defParser_init_buffer( b, file ); - - return ( b ); - } - - -#ifdef defParser_USE_PROTOS -void defParser_delete_buffer( defParser_BUFFER_STATE b ) -#else -void defParser_delete_buffer( b ) -defParser_BUFFER_STATE b; -#endif - - { - if ( b == defParser_current_buffer ) - defParser_current_buffer = (defParser_BUFFER_STATE) 0; - - free( (char *) b->defParser_ch_buf ); - free( (char *) b ); - } - - -#ifdef defParser_USE_PROTOS -void defParser_init_buffer( defParser_BUFFER_STATE b, FILE *file ) -#else -void defParser_init_buffer( b, file ) -defParser_BUFFER_STATE b; -FILE *file; -#endif - - { - b->defParser_input_file = file; - - /* we put in the '\n' and start reading from [1] so that an - * initial match-at-newline will be true. - */ - - b->defParser_ch_buf[0] = '\n'; - b->defParser_n_chars = 1; - - /* we always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->defParser_ch_buf[1] = defParser_END_OF_BUFFER_CHAR; - b->defParser_ch_buf[2] = defParser_END_OF_BUFFER_CHAR; - - b->defParser_buf_pos = &b->defParser_ch_buf[1]; - - b->defParser_eof_status = EOF_NOT_SEEN; - } -# line 210 "defToken.l" - - -void defParsererror(char* msg) -{ - cerr << "line " << defParserlineno << ": " << msg; -} - diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.l b/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.ll similarity index 75% rename from cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.l rename to cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.ll index 1d1f0d58e..3c83032f1 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.l +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/defToken.ll @@ -1,3 +1,4 @@ +%option noyywrap %a 30000 %e 10000 @@ -16,21 +17,19 @@ #include using namespace std; -extern istream *g_yyin; +extern istream *g_defParserin; #define YY_INPUT(buf,result,max_size)\ {\ - if (g_yyin -> eof()) {\ + if (g_defParserin -> eof()) {\ result=0;\ } else {\ - g_yyin -> read((char *)buf, max_size-1); \ - result = g_yyin -> gcount(); \ + g_defParserin -> read((char *)buf, max_size-1); \ + result = g_defParserin -> gcount(); \ buf[result] = 0; \ }\ } -int yylineno=1; - unsigned char* defToken_string_buf = new unsigned char[1024]; int defToken_string_buf_size = 1024; int defToken_string_buf_content_size = 0; @@ -43,7 +42,7 @@ unsigned char* new_copy(const unsigned char* str, int size) return x; } -void addToDefTokenStringBuf(const unsigned char* str, int size) +void addToDefTokenStringBuf(const char* str, int size) { if ( size <= 0 ) return; @@ -113,53 +112,53 @@ boolean ([Bb][Oo][Oo][Ll][Ee][Aa][Nn]) {stringprefix} { - yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng); + defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng); return(TYPE); } {string} { - yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng); + defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng); return(TYPE); } {integer} { - yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng); + defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng); return(TYPE); } {real} { - yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng); + defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng); return(TYPE); } {unit} { - yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng); + defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng); return(TYPE); } {unitpixel} { - yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng); + defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng); return(TYPE); } {array} { - yylval.charPtrData = new_copy((unsigned char*)yytext, yyleng); + defParserlval.charPtrData = new_copy((unsigned char*)yytext, yyleng); return(TYPE); } {boolean} { - yylval.charPtrData = + defParserlval.charPtrData = new_copy((unsigned char*)"INTEGER", strlen("INTEGER")); return(TYPE); } [0-9]+ { - yylval.intData = atoi((char*)yytext); + defParserlval.intData = atoi((char*)yytext); return(INTEGER); } [0-9]+"."[0-9]+ { - yylval.realData = atof((char*)yytext); + defParserlval.realData = atof((char*)yytext); return(REAL); } @@ -169,10 +168,10 @@ boolean ([Bb][Oo][Oo][Ll][Ee][Aa][Nn]) \" { - yylval.charPtrData = + defParserlval.charPtrData = new unsigned char[defToken_string_buf_content_size+1]; - memcpy( yylval.charPtrData, - defToken_string_buf, + memcpy( defParserlval.charPtrData, + defToken_string_buf, defToken_string_buf_content_size+1 ); @@ -187,13 +186,13 @@ boolean ([Bb][Oo][Oo][Ll][Ee][Aa][Nn]) } "&"[^ \t\n\";.=@+*\/\.\*:?\^,{}\[\]()]+ { - yylval.charPtrData = + defParserlval.charPtrData = (unsigned char*)strdup((const char*)(yytext+1)); return(REF_NAME); } [^ \t\n\";.=@+*\/\.\*:?\^,{}\[\]()]+ { - yylval.charPtrData = + defParserlval.charPtrData = (unsigned char*)strdup((const char*)yytext); return(NORMAL_STRING); } @@ -212,7 +211,7 @@ boolean ([Bb][Oo][Oo][Ll][Ee][Aa][Nn]) %% -void yyerror(char* msg) +void defParsererror(char* msg) { cerr << "line " << yylineno << ": " << msg; } diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/style.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/style.C deleted file mode 100644 index f94efc5e5..000000000 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/style.C +++ /dev/null @@ -1,1375 +0,0 @@ -/* - * CDE - Common Desktop Environment - * - * Copyright (c) 1993-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these libraries and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -// $TOG: style.C /main/6 1998/04/17 11:51:49 mgreess $ -#ifndef lint -__attribute__((unused)) -static const char stylesccsid[] = "@(#)yaccpar 1.8 (Berkeley) 01/20/90"; -#endif -#define styleBYACC 1 -#include -#include -#include -#include -using namespace std; -#include -#include "StyleSheetExceptions.h" -#include "VariableTable.h" -#include "FeatureValue.h" -#include "Expression.h" -#include "SSPath.h" -#include "PathTable.h" -#include "Renderer.h" -#include "PathQualifier.h" -#include "Debug.h" -#include "ParserConst.h" -#include "FeatureDefDictionary.h" -#include - -#include "HardCopy/autoNumberFP.h" -extern autoNumberFP gAutoNumberFP; - - -#ifdef alloca -# undef alloca -#endif -#define alloca(x) (malloc(x)) - -extern void styleerror(char*); -extern int stylelex(); - -extern void enter_sgmlgi_context(); - -extern featureDefDictionary* g_FeatureDefDictionary; -extern unsigned g_validation_mode; -extern unsigned g_hasSemanticError; - -static char localCharToCharPtrBuf[2]; - -#undef stylewrap - -const char* toUpperCase(unsigned char* string) -{ - static char buffer[512]; - int j=0; - for ( unsigned int i=0; i* FeatureValueSlistPtrData; - - PQExpr* PQExprPtrData; -} styleSTYPE; -#define INTEGER 257 -#define OPER_equality 258 -#define OPER_relational 259 -#define BOOLVAL 260 -#define REAL 261 -#define OPER_assign 262 -#define ARRAYOPEN 263 -#define ARRAYCLOSE 264 -#define SEPARATOR 265 -#define FSOPEN 266 -#define FSCLOSE 267 -#define OPER_modify 268 -#define OPER_parent 269 -#define OPER_attr 270 -#define OPER_oneof 271 -#define OPER_star 272 -#define OPER_or 273 -#define OPER_and 274 -#define OPER_div 275 -#define OPER_parenopen 276 -#define OPER_parenclose 277 -#define OPER_logicalnegate 278 -#define PMEMOPEN 279 -#define PMEMCLOSE 280 -#define OPER_period 281 -#define OPER_plus 282 -#define OPER_minus 283 -#define DIMENSION 284 -#define NORMAL_STRING 285 -#define UNIT_STRING 286 -#define QUOTED_STRING 287 -#define GI_CASE_SENSITIVE 288 -#define SGMLGI_STRING 289 -#define styleERRCODE 256 -short stylelhs[] = { -1, - 0, 37, 38, 38, 39, 13, 13, 13, 22, 22, - 14, 15, 19, 19, 19, 11, 11, 10, 10, 7, - 7, 6, 6, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 20, 20, 4, 4, 23, 23, 21, - 21, 17, 17, 18, 18, 40, 40, 24, 29, 29, - 28, 28, 27, 27, 25, 25, 26, 26, 26, 9, - 8, 8, 2, 41, 5, 5, 5, 16, 3, 3, - 34, 30, 30, 31, 31, 32, 32, 1, 1, 35, - 35, 36, 36, 42, 42, 33, 33, -}; -short stylelen[] = { 2, - 2, 3, 1, 1, 3, 1, 2, 1, 3, 1, - 2, 2, 1, 1, 1, 3, 1, 3, 1, 1, - 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, - 1, 1, 3, 4, 3, 1, 0, 3, 1, 1, - 1, 4, 2, 3, 1, 1, 0, 3, 3, 1, - 2, 4, 3, 1, 2, 1, 2, 1, 1, 1, - 1, 1, 1, 0, 4, 2, 1, 1, 1, 1, - 3, 1, 3, 1, 3, 4, 3, 1, 1, 1, - 0, 1, 0, 2, 1, 1, 0, -}; -short styledefred[] = { 0, - 0, 0, 0, 80, 0, 58, 59, 69, 70, 0, - 0, 63, 0, 56, 4, 1, 85, 3, 0, 2, - 0, 57, 86, 0, 0, 0, 0, 0, 51, 55, - 84, 0, 0, 0, 0, 74, 0, 24, 0, 0, - 0, 0, 68, 28, 0, 0, 0, 0, 19, 0, - 0, 6, 27, 15, 5, 14, 0, 0, 43, 50, - 0, 45, 0, 0, 54, 0, 0, 71, 0, 0, - 29, 30, 11, 12, 10, 0, 0, 22, 23, 0, - 61, 62, 0, 25, 0, 60, 0, 65, 0, 0, - 0, 0, 0, 52, 0, 78, 79, 77, 0, 75, - 33, 35, 0, 41, 0, 0, 18, 0, 9, 44, - 42, 48, 49, 53, 76, 0, 34, 38, -}; -short styledgoto[] = { 2, - 98, 10, 28, 46, 12, 80, 0, 83, 87, 47, - 48, 49, 50, 51, 52, 53, 54, 61, 55, 56, - 105, 57, 106, 62, 13, 14, 64, 15, 63, 34, - 35, 36, 22, 23, 3, 16, 4, 17, 18, 90, - 58, 19, -}; -short stylesindex[] = { -277, - -246, 0, -225, 0, -218, 0, 0, 0, 0, -231, - -228, 0, -259, 0, 0, 0, 0, 0, -225, 0, - -265, 0, 0, -221, 0, -234, -225, -222, 0, 0, - 0, -229, -196, -206, -204, 0, -213, 0, -187, -229, - -229, -168, 0, 0, 0, -156, -251, -177, 0, -172, - -229, 0, 0, 0, 0, 0, -161, -167, 0, 0, - -141, 0, -237, -255, 0, -133, -249, 0, -265, -265, - 0, 0, 0, 0, 0, -199, -189, 0, 0, -168, - 0, 0, -168, 0, -161, 0, -229, 0, -229, -139, - -221, -229, -225, 0, -158, 0, 0, 0, -204, 0, - 0, 0, -177, 0, -132, -130, 0, -251, 0, 0, - 0, 0, 0, 0, 0, -168, 0, 0, -}; -short stylerindex[] = { 37, - 0, 0, 132, 0, 0, 0, 0, 0, 0, -145, - -257, 0, 0, 0, 0, 0, 0, 0, 135, 0, - 0, 0, 0, -127, 1, 0, 0, 30, 0, 0, - 0, 0, 0, 0, -179, 0, 169, 0, 178, 0, - 0, 0, 0, 0, 54, 0, 123, 130, 0, 200, - 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, - -129, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -127, 0, 0, 0, - 0, 0, 0, 0, 100, 0, 0, 0, -128, 0, - -127, 0, 0, 0, 0, 0, 0, 0, -160, 0, - 0, 0, -155, 0, -122, 0, 0, 146, 0, 0, - 0, 0, 0, 0, 0, -127, 0, 0, -}; -short stylegindex[] = { 0, - 0, 71, -1, 0, 0, 0, 0, 0, 74, 60, - -42, 64, 0, 0, 0, 0, 134, 0, 57, -73, - 0, 94, 33, 61, 0, 138, 0, -24, 0, 0, - 83, 84, 0, 0, 0, 0, 0, 136, 0, 0, - 0, 0, -}; -#define styleTABLESIZE 485 -short styletable[] = { 76, - 66, 11, 65, 104, 32, 67, 26, 96, 67, 93, - 1, 6, 7, 67, 67, 5, 27, 11, 67, 33, - 78, 94, 45, 79, 60, 8, 9, 67, 67, 67, - 91, 21, 59, 24, 103, 37, 81, 97, 38, 39, - 75, 20, 104, 86, 26, 6, 7, 40, 41, 75, - 8, 9, 25, 10, 42, 8, 9, 68, 25, 8, - 9, 67, 43, 8, 9, 44, 69, 37, 114, 70, - 38, 39, 71, 103, 102, 45, 8, 101, 75, 40, - 41, 75, 81, 82, 72, 109, 42, 60, 37, 45, - 113, 38, 39, 72, 43, 8, 9, 44, 72, 7, - 40, 41, 66, 73, 81, 82, 77, 42, 40, 40, - 73, 74, 73, 84, 45, 43, 8, 9, 44, 86, - 87, 88, 17, 89, 95, 87, 87, 111, 115, 13, - 87, 83, 116, 117, 82, 37, 92, 47, 46, 87, - 87, 39, 108, 107, 85, 16, 29, 112, 118, 110, - 30, 99, 0, 100, 31, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, - 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, - 0, 0, 0, 66, 66, 66, 66, 66, 0, 0, - 0, 66, 66, 0, 0, 66, 66, 66, 0, 0, - 0, 0, 66, 66, 0, 66, 66, 67, 0, 64, - 0, 0, 67, 67, 67, 67, 67, 0, 0, 0, - 67, 67, 0, 0, 67, 67, 67, 81, 81, 0, - 0, 67, 67, 0, 67, 67, 36, 10, 10, 0, - 10, 81, 81, 0, 10, 10, 0, 0, 10, 0, - 0, 0, 0, 0, 10, 10, 10, 0, 10, 10, - 8, 8, 0, 8, 0, 0, 0, 8, 8, 0, - 0, 8, 0, 8, 0, 0, 0, 0, 8, 8, - 0, 8, 8, 7, 7, 0, 7, 0, 0, 0, - 7, 7, 0, 0, 7, 0, 7, 0, 0, 0, - 0, 7, 7, 0, 7, 7, 17, 17, 0, 17, - 0, 0, 0, 17, 13, 0, 13, 0, 0, 17, - 13, 13, 0, 0, 17, 17, 0, 17, 17, 16, - 16, 0, 16, 0, 13, 13, 16, 0, 0, 0, - 0, 0, 16, 0, 0, 0, 0, 16, 16, 0, - 16, 16, 31, 31, 0, 31, 0, 0, 0, 31, - 31, 32, 32, 31, 32, 31, 0, 0, 32, 32, - 31, 31, 32, 31, 32, 0, 0, 0, 0, 32, - 32, 0, 32, 26, 26, 0, 26, 0, 0, 0, - 26, 26, 0, 0, 26, 0, 26, 0, 0, 0, - 0, 26, 26, 0, 26, -}; -short stylecheck[] = { 42, - 0, 3, 27, 77, 270, 263, 266, 257, 266, 265, - 288, 271, 272, 271, 272, 262, 276, 19, 276, 285, - 272, 277, 24, 275, 26, 285, 286, 285, 286, 0, - 268, 263, 267, 262, 77, 257, 0, 287, 260, 261, - 42, 260, 116, 281, 266, 271, 272, 269, 270, 51, - 285, 286, 281, 0, 276, 285, 286, 264, 281, 285, - 286, 258, 284, 285, 286, 287, 273, 257, 93, 274, - 260, 261, 286, 116, 264, 77, 0, 277, 80, 269, - 270, 83, 282, 283, 264, 87, 276, 89, 257, 91, - 92, 260, 261, 273, 284, 285, 286, 287, 286, 0, - 269, 270, 32, 264, 282, 283, 263, 276, 264, 265, - 40, 41, 273, 286, 116, 284, 285, 286, 287, 281, - 266, 289, 0, 265, 258, 271, 272, 267, 287, 0, - 276, 0, 265, 264, 0, 263, 63, 267, 267, 285, - 286, 264, 83, 80, 51, 0, 13, 91, 116, 89, - 13, 69, -1, 70, 19, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, - -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 258, -1, - -1, -1, -1, 263, 264, 265, 266, 267, -1, -1, - -1, 271, 272, -1, -1, 275, 276, 277, -1, -1, - -1, -1, 282, 283, -1, 285, 286, 258, -1, 289, - -1, -1, 263, 264, 265, 266, 267, -1, -1, -1, - 271, 272, -1, -1, 275, 276, 277, 271, 272, -1, - -1, 282, 283, -1, 285, 286, 263, 264, 265, -1, - 267, 285, 286, -1, 271, 272, -1, -1, 275, -1, - -1, -1, -1, -1, 281, 282, 283, -1, 285, 286, - 264, 265, -1, 267, -1, -1, -1, 271, 272, -1, - -1, 275, -1, 277, -1, -1, -1, -1, 282, 283, - -1, 285, 286, 264, 265, -1, 267, -1, -1, -1, - 271, 272, -1, -1, 275, -1, 277, -1, -1, -1, - -1, 282, 283, -1, 285, 286, 264, 265, -1, 267, - -1, -1, -1, 271, 265, -1, 267, -1, -1, 277, - 271, 272, -1, -1, 282, 283, -1, 285, 286, 264, - 265, -1, 267, -1, 285, 286, 271, -1, -1, -1, - -1, -1, 277, -1, -1, -1, -1, 282, 283, -1, - 285, 286, 264, 265, -1, 267, -1, -1, -1, 271, - 272, 264, 265, 275, 267, 277, -1, -1, 271, 272, - 282, 283, 275, 285, 277, -1, -1, -1, -1, 282, - 283, -1, 285, 264, 265, -1, 267, -1, -1, -1, - 271, 272, -1, -1, 275, -1, 277, -1, -1, -1, - -1, 282, 283, -1, 285, -}; -#define styleFINAL 2 -#ifndef styleDEBUG -#define styleDEBUG 0 -#endif -#define styleMAXTOKEN 289 -#if styleDEBUG -char *stylename[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"INTEGER","OPER_equality", -"OPER_relational","BOOLVAL","REAL","OPER_assign","ARRAYOPEN","ARRAYCLOSE", -"SEPARATOR","FSOPEN","FSCLOSE","OPER_modify","OPER_parent","OPER_attr", -"OPER_oneof","OPER_star","OPER_or","OPER_and","OPER_div","OPER_parenopen", -"OPER_parenclose","OPER_logicalnegate","PMEMOPEN","PMEMCLOSE","OPER_period", -"OPER_plus","OPER_minus","DIMENSION","NORMAL_STRING","UNIT_STRING", -"QUOTED_STRING","GI_CASE_SENSITIVE","SGMLGI_STRING", -}; -char *stylerule[] = { -"$accept : stylesheet", -"stylesheet : sensitivityOPTL statement.gpOPTL", -"sensitivity : GI_CASE_SENSITIVE OPER_assign BOOLVAL", -"statement.gp : var_assignment", -"statement.gp : path_expr", -"var_assignment : STRING OPER_assign rhs.gp", -"symbol : attr", -"symbol : parent string_list", -"symbol : string_list", -"string_list : string_list OPER_feature STRING", -"string_list : STRING", -"parent : OPER_parent SGMLGI", -"attr : OPER_attr SGMLGI", -"rhs.gp : simple_expr", -"rhs.gp : array", -"rhs.gp : featureset", -"simple_expr : simple_expr OPER_add multi_expr", -"simple_expr : multi_expr", -"multi_expr : multi_expr OPER_mult term", -"multi_expr : term", -"OPER_binop : OPER_mult", -"OPER_binop : OPER_add", -"OPER_mult : OPER_star", -"OPER_mult : OPER_div", -"term : BOOLVAL", -"term : symbol UNIT_STRING", -"term : symbol", -"term : dimension", -"term : QUOTED_STRING", -"term : INTEGER UNIT_STRING", -"term : REAL UNIT_STRING", -"term : INTEGER", -"term : REAL", -"term : OPER_parenopen simple_expr OPER_parenclose", -"array : array_name ARRAYOPEN array_member_list ARRAYCLOSE", -"array : array_name ARRAYOPEN ARRAYCLOSE", -"array_name : STRING", -"array_name :", -"array_member_list : array_member SEPARATOR array_member_list", -"array_member_list : array_member", -"array_member : simple_expr", -"array_member : array", -"featureset : FSOPEN feature_list SEPARATOR_OPTL FSCLOSE", -"featureset : FSOPEN FSCLOSE", -"feature_list : feature_list SEPARATOR feature", -"feature_list : feature", -"SEPARATOR_OPTL : SEPARATOR", -"SEPARATOR_OPTL :", -"feature : feature_name_list OPER_modify rhs.gp", -"feature_name_list : feature_name_list OPER_feature STRING", -"feature_name_list : STRING", -"path_expr : path_term_list featureset", -"path_expr : path_term_list OPER_parenopen path_expr_list OPER_parenclose", -"path_expr_list : path_expr_list SEPARATOR path_expr", -"path_expr_list : path_expr", -"path_term_list : path_term_list path_term", -"path_term_list : path_term", -"path_term : SGMLGI path_selectorOPTL", -"path_term : OPER_oneof", -"path_term : OPER_star", -"OPER_feature : OPER_period", -"OPER_add : OPER_plus", -"OPER_add : OPER_minus", -"SGMLGI : SGMLGI_CONTENT", -"$$1 :", -"SGMLGI_CONTENT : STRING OPER_period $$1 SGMLGI_STRING", -"SGMLGI_CONTENT : STRING OPER_period", -"SGMLGI_CONTENT : STRING", -"dimension : DIMENSION", -"STRING : NORMAL_STRING", -"STRING : UNIT_STRING", -"path_selector : ARRAYOPEN boolean_expr ARRAYCLOSE", -"boolean_expr : logical_and_expr", -"boolean_expr : boolean_expr OPER_or logical_and_expr", -"logical_and_expr : equality_expr", -"logical_and_expr : logical_and_expr OPER_and equality_expr", -"equality_expr : OPER_attr SGMLGI OPER_equality QUOTED_STRING", -"equality_expr : NORMAL_STRING OPER_equality POSITION_VALUE", -"POSITION_VALUE : INTEGER", -"POSITION_VALUE : QUOTED_STRING", -"sensitivityOPTL : sensitivity", -"sensitivityOPTL :", -"statement.gpOPTL : statement.gpPLUS", -"statement.gpOPTL :", -"statement.gpPLUS : statement.gpPLUS statement.gp", -"statement.gpPLUS : statement.gp", -"path_selectorOPTL : path_selector", -"path_selectorOPTL :", -}; -#endif -#define styleclearin (stylechar=(-1)) -#define styleerrok (styleerrflag=0) -#ifdef styleSTACKSIZE -#ifndef styleMAXDEPTH -#define styleMAXDEPTH styleSTACKSIZE -#endif -#else -#ifdef styleMAXDEPTH -#define styleSTACKSIZE styleMAXDEPTH -#else -#define styleSTACKSIZE 500 -#define styleMAXDEPTH 500 -#endif -#endif -int styledebug; -int stylenerrs; -int styleerrflag; -int stylechar; -short *stylessp; -styleSTYPE *stylevsp; -styleSTYPE styleval; -styleSTYPE stylelval; -short styless[styleSTACKSIZE]; -styleSTYPE stylevs[styleSTACKSIZE]; -#define stylestacksize styleSTACKSIZE -#define styleABORT goto styleabort -#define styleACCEPT goto styleaccept -#define styleERROR goto styleerrlab -#if styleDEBUG -#ifndef __cplusplus -extern char *getenv(const char *); -#endif -#endif -int -styleparse() -{ - int stylem, stylen, stylestate; -#if styleDEBUG - char *styles; - - if (styles = getenv("styleDEBUG")) - { - stylen = *styles; - if (stylen >= '0' && stylen <= '9') - styledebug = stylen - '0'; - } -#endif - - stylenerrs = 0; - styleerrflag = 0; - stylechar = (-1); - - stylessp = styless; - stylevsp = stylevs; - *stylessp = stylestate = 0; - -styleloop: - if ((stylen = styledefred[stylestate])) goto stylereduce; - if (stylechar < 0) - { - if ((stylechar = stylelex()) < 0) stylechar = 0; -#if styleDEBUG - if (styledebug) - { - styles = 0; - if (stylechar <= styleMAXTOKEN) styles = stylename[stylechar]; - if (!styles) styles = "illegal-symbol"; - printf("styledebug: state %d, reading %d (%s)\n", stylestate, - stylechar, styles); - } -#endif - } - if ((stylen = stylesindex[stylestate]) && (stylen += stylechar) >= 0 && - stylen <= styleTABLESIZE && stylecheck[stylen] == stylechar) - { -#if styleDEBUG - if (styledebug) - printf("styledebug: state %d, shifting to state %d\n", - stylestate, styletable[stylen]); -#endif - if (stylessp >= styless + stylestacksize - 1) - { - goto styleoverflow; - } - *++stylessp = stylestate = styletable[stylen]; - *++stylevsp = stylelval; - stylechar = (-1); - if (styleerrflag > 0) --styleerrflag; - goto styleloop; - } - if ((stylen = stylerindex[stylestate]) && (stylen += stylechar) >= 0 && - stylen <= styleTABLESIZE && stylecheck[stylen] == stylechar) - { - stylen = styletable[stylen]; - goto stylereduce; - } - if (styleerrflag) goto styleinrecovery; -#if 0 /* remove if needed */ -#ifdef lint - goto stylenewerror; -#endif -stylenewerror: -#endif /* if 0 */ - styleerror((char*)"syntax error"); -#if 0 /* remove if needed */ -#ifdef lint - goto styleerrlab; -#endif -styleerrlab: -#endif /* if 0 */ - ++stylenerrs; -styleinrecovery: - if (styleerrflag < 3) - { - styleerrflag = 3; - for (;;) - { - if ((stylen = stylesindex[*stylessp]) && (stylen += styleERRCODE) >= 0 && - stylen <= styleTABLESIZE && stylecheck[stylen] == styleERRCODE) - { -#if styleDEBUG - if (styledebug) - printf("styledebug: state %d, error recovery shifting\ - to state %d\n", *stylessp, styletable[stylen]); -#endif - if (stylessp >= styless + stylestacksize - 1) - { - goto styleoverflow; - } - *++stylessp = stylestate = styletable[stylen]; - *++stylevsp = stylelval; - goto styleloop; - } - else - { -#if styleDEBUG - if (styledebug) - printf("styledebug: error recovery discarding state %d\n", - *stylessp); -#endif - if (stylessp <= styless) goto styleabort; - --stylessp; - --stylevsp; - } - } - } - else - { - if (stylechar == 0) goto styleabort; -#if styleDEBUG - if (styledebug) - { - styles = 0; - if (stylechar <= styleMAXTOKEN) styles = stylename[stylechar]; - if (!styles) styles = "illegal-symbol"; - printf("styledebug: state %d, error recovery discards token %d (%s)\n", - stylestate, stylechar, styles); - } -#endif - stylechar = (-1); - goto styleloop; - } -stylereduce: -#if styleDEBUG - if (styledebug) - printf("styledebug: state %d, reducing by rule %d (%s)\n", - stylestate, stylen, stylerule[stylen]); -#endif - stylem = stylelen[stylen]; - styleval = stylevsp[1-stylem]; - switch (stylen) - { -case 1: -{ - } -break; -case 2: -{ - gGI_CASE_SENSITIVE = stylevsp[0].boolData; - } -break; -case 3: -{ - } -break; -case 4: -{ - /* copy items form the feature list into the path table */ - PathFeatureListIterator l_Iter(*(stylevsp[0].PathFeatureListPtrData)); - - PathFeature *x = 0; - - while ( ++l_Iter ) { - - x = l_Iter.key(); - - if ( g_validation_mode == true ) - if ( g_FeatureDefDictionary -> checkSemantics(x -> featureSet()) == false ) - g_hasSemanticError = true; - - gPathTab -> addPathFeatureSet( x ); - - - } - -/* clear out the first list so the elements are not deleted - with the list because they are still referenced by the - path table */ - - stylevsp[0].PathFeatureListPtrData -> clear(); - delete stylevsp[0].PathFeatureListPtrData; - - } -break; -case 5: -{ - Expression *x = new Expression(new ConstantNode(stylevsp[0].FeatureValuePtrData)); - - if ( gAutoNumberFP.accept((const char*)stylevsp[-2].charPtrData, x) ) { - delete stylevsp[-2].charPtrData; - delete x; - break; - } - - gVariableTable -> enter( gSymTab -> intern((const char*)stylevsp[-2].charPtrData), x); - delete stylevsp[-2].charPtrData; - } -break; -case 6: -{ - styleval.termNodePtrData=stylevsp[0].termNodePtrData; - } -break; -case 7: -{ - styleval.termNodePtrData=stylevsp[-1].termNodePtrData; - } -break; -case 8: -{ - const Symbol* x = stylevsp[0].CompositeVariableNodePtrData -> convertableToVariable(); - if ( x ) { - styleval.termNodePtrData=new VariableNode(*x); - delete stylevsp[0].CompositeVariableNodePtrData; - } else - styleval.termNodePtrData=stylevsp[0].CompositeVariableNodePtrData; - } -break; -case 9: -{ - - stylevsp[-2].CompositeVariableNodePtrData->appendItem(gSymTab->intern(toUpperCase(stylevsp[0].charPtrData))); - styleval.CompositeVariableNodePtrData=stylevsp[-2].CompositeVariableNodePtrData; - delete stylevsp[0].charPtrData ; - } -break; -case 10: -{ - styleval.CompositeVariableNodePtrData=new CompositeVariableNode; - styleval.CompositeVariableNodePtrData -> appendItem(gSymTab->intern(toUpperCase(stylevsp[0].charPtrData))); - delete stylevsp[0].charPtrData; - } -break; -case 11: -{ -/* - $$=new - ParentNode(gSymTab->intern((const char*)$1)); -*/ - MESSAGE(cerr, "^ operator not supported."); - throw(CASTSSEXCEPT StyleSheetException()); - } -break; -case 12: -{ - styleval.termNodePtrData=new - SgmlAttributeNode(gSymTab->intern((const char*)stylevsp[0].charPtrData)); - delete stylevsp[0].charPtrData; - } -break; -case 13: -{ - styleval.FeatureValuePtrData=new FeatureValueExpression(stylevsp[0].expPtrData); - } -break; -case 14: -{ - styleval.FeatureValuePtrData=stylevsp[0].FeatureValuePtrData; - } -break; -case 15: -{ - styleval.FeatureValuePtrData=new FeatureValueFeatureSet(stylevsp[0].FeatureSetPtrData); - } -break; -case 16: -{ - BinaryOperatorNode::operatorType opType; - switch (stylevsp[-1].charData) { - case '+': opType=BinaryOperatorNode::PLUS; break; - case '-': opType=BinaryOperatorNode::MINUS; break; - default: - throw(CASTBEEXCEPT badEvaluationException()); - } - - FeatureValueExpression* FVexprL = new FeatureValueExpression(stylevsp[-2].expPtrData); - FeatureValueExpression* FVexprR = new FeatureValueExpression(stylevsp[0].expPtrData); - - styleval.expPtrData = new Expression( - new BinaryOperatorNode(opType, - new ConstantNode(FVexprL), - new ConstantNode(FVexprR) - ) - ); - } -break; -case 17: -{ - styleval.expPtrData=stylevsp[0].expPtrData; - } -break; -case 18: -{ - BinaryOperatorNode::operatorType opType; - switch (stylevsp[-1].charData) { - case '*': opType=BinaryOperatorNode::TIMES; break; - case '/': opType=BinaryOperatorNode::DIVIDE; break; - default: - throw(CASTBEEXCEPT badEvaluationException()); - } - - FeatureValueExpression* FVexpr = new FeatureValueExpression(stylevsp[-2].expPtrData); - - styleval.expPtrData = new Expression( - new BinaryOperatorNode(opType, new ConstantNode(FVexpr), stylevsp[0].termNodePtrData) - ); - } -break; -case 19: -{ - styleval.expPtrData = new Expression(stylevsp[0].termNodePtrData); - } -break; -case 20: -{ - styleval.charData=stylevsp[0].charData; - } -break; -case 21: -{ - styleval.charData=stylevsp[0].charData; - } -break; -case 22: -{ - styleval.charData=stylevsp[0].charData; - } -break; -case 23: -{ - styleval.charData=stylevsp[0].charData; - } -break; -case 24: -{ - styleval.termNodePtrData=new ConstantNode(new FeatureValueInt(int(stylevsp[0].boolData))); - } -break; -case 25: -{ - FeatureValueExpression* fve = - new FeatureValueExpression(new Expression(stylevsp[-1].termNodePtrData)); - FeatureValueDimension* x = - new FeatureValueDimension(fve, (const char*)stylevsp[0].charPtrData); - delete stylevsp[0].charPtrData ; - styleval.termNodePtrData=new ConstantNode(x); - } -break; -case 26: -{ - styleval.termNodePtrData=stylevsp[0].termNodePtrData; - } -break; -case 27: -{ - styleval.termNodePtrData=stylevsp[0].termNodePtrData; - } -break; -case 28: -{ - styleval.termNodePtrData=new ConstantNode(new FeatureValueString((const char*)stylevsp[0].charPtrData)); - delete stylevsp[0].charPtrData ; - } -break; -case 29: -{ - styleval.termNodePtrData=new ConstantNode(new FeatureValueDimension(new FeatureValueInt(stylevsp[-1].intData), (const char*)stylevsp[0].charPtrData)); - delete stylevsp[0].charPtrData ; - } -break; -case 30: -{ - styleval.termNodePtrData=new ConstantNode(new FeatureValueDimension(new FeatureValueReal(stylevsp[-1].realData), (const char*)stylevsp[0].charPtrData)); - delete stylevsp[0].charPtrData ; - } -break; -case 31: -{ - styleval.termNodePtrData=new ConstantNode(new FeatureValueInt(stylevsp[0].intData)); - } -break; -case 32: -{ - styleval.termNodePtrData=new ConstantNode(new FeatureValueReal(stylevsp[0].realData)); - } -break; -case 33: -{ - styleval.termNodePtrData=new ConstantNode(new FeatureValueExpression(stylevsp[-1].expPtrData)); - } -break; -case 34: -{ - FeatureValueArray* x = - new FeatureValueArray((const char*)stylevsp[-3].charPtrData, stylevsp[-1].FeatureValueSlistPtrData -> entries()); - CC_TPtrSlistIterator iter(*stylevsp[-1].FeatureValueSlistPtrData); - - int i = 0; - while ( ++iter ) { - (*x)[i++] = iter.key(); - } - - delete stylevsp[-3].charPtrData; - delete stylevsp[-1].FeatureValueSlistPtrData; - - styleval.FeatureValuePtrData = x; - } -break; -case 35: -{ - styleval.FeatureValuePtrData = new FeatureValueArray((const char*)stylevsp[-2].charPtrData, 0); - delete stylevsp[-2].charPtrData; - } -break; -case 36: -{ - styleval.charPtrData = stylevsp[0].charPtrData; - } -break; -case 37: -{ - styleval.charPtrData = new unsigned char[1]; - styleval.charPtrData[0] = 0; - } -break; -case 38: -{ - stylevsp[0].FeatureValueSlistPtrData -> prepend(stylevsp[-2].FeatureValuePtrData); - styleval.FeatureValueSlistPtrData = stylevsp[0].FeatureValueSlistPtrData; - } -break; -case 39: -{ - styleval.FeatureValueSlistPtrData=new CC_TPtrSlist; - styleval.FeatureValueSlistPtrData -> append(stylevsp[0].FeatureValuePtrData); - } -break; -case 40: -{ - styleval.FeatureValuePtrData = new FeatureValueExpression(stylevsp[0].expPtrData); - } -break; -case 41: -{ - styleval.FeatureValuePtrData=stylevsp[0].FeatureValuePtrData; - } -break; -case 42: -{ - styleval.FeatureSetPtrData=stylevsp[-2].FeatureSetPtrData; - } -break; -case 43: -{ - styleval.FeatureSetPtrData = new FeatureSet (); - } -break; -case 44: -{ - if (stylevsp[0].FeaturePtrData -> name() == Symbol(gSymTab->intern("FAMILY"))) { - /* the evaluate() call clones $3 */ - FeatureValueFeatureSet *fvfs = - (FeatureValueFeatureSet*) stylevsp[0].FeaturePtrData->evaluate(); - const FeatureSet* fs = fvfs->value(); - const Feature* charsetF = - fs->lookup(gSymTab->intern("CHARSET")); - /* charsetF is a mandatory entry in fontfamily*/ - assert( charsetF ); - const FeatureValueString* fv_string = - (FeatureValueString*)charsetF->value(); - const char* charset = *fv_string; - assert( charset ); - - int entries = stylevsp[-2].FeatureSetPtrData -> entries(); - for (int i=0; iat(i); - if (! (entry->name() == Symbol(gSymTab->intern("FAMILY")))) - continue; - const FeatureSet* entry_fs = - ((FeatureValueFeatureSet*)(entry->evaluate()))->value(); - const Feature* entry_charsetF = - entry_fs->lookup(gSymTab->intern("CHARSET")); - assert( entry_charsetF ); - const char* entry_charset = - *((FeatureValueString*)(entry_charsetF->value())); - assert( entry_charset ); - if (! strcmp(charset, entry_charset)) { - delete stylevsp[-2].FeatureSetPtrData -> removeAt(i); - break; /* escape from for-loop*/ - } - } - delete fvfs ; - - styleval.FeatureSetPtrData = stylevsp[-2].FeatureSetPtrData; - styleval.FeatureSetPtrData -> add(stylevsp[0].FeaturePtrData); - } - else { - if ( stylevsp[-2].FeatureSetPtrData -> find((Feature*)stylevsp[0].FeaturePtrData) ) { - FeatureSet* fs = new FeatureSet(); - fs -> add(stylevsp[0].FeaturePtrData); - - styleval.FeatureSetPtrData =new FeatureSet(*stylevsp[-2].FeatureSetPtrData, *fs); - delete stylevsp[-2].FeatureSetPtrData; - delete fs; - } - else { - styleval.FeatureSetPtrData=stylevsp[-2].FeatureSetPtrData; - styleval.FeatureSetPtrData -> add(stylevsp[0].FeaturePtrData); - } - } - } -break; -case 45: -{ - styleval.FeatureSetPtrData=new FeatureSet(); - styleval.FeatureSetPtrData -> add(stylevsp[0].FeaturePtrData); - } -break; -case 46: -{ - } -break; -case 47: -{ - } -break; -case 48: -{ - CC_TPtrDlistIterator l_Iter(*(stylevsp[-2].charPtrDlistData)); - - FeatureSet *fs = 0; - Feature *f = 0; - FeatureValue *fv = stylevsp[0].FeatureValuePtrData; - const char* cptr = 0; - char buffer[256]; - while (++l_Iter) { - cptr = l_Iter.key(); - int index = 0 ; - const char *c = cptr ; - while (*c) - { - if (islower(*c)) - buffer[index] = toupper(*c) ; - else - buffer[index] = *c ; - c++ ; - index++; - } - buffer[index] = 0; - /* fprintf(stderr, "converted: %s to %s\n", cptr, buffer); */ - f = new Feature(gSymTab -> intern(buffer), fv); - - if ( stylevsp[-2].charPtrDlistData -> last() != cptr ) { - fs = new FeatureSet(); - fs -> add(f); - fv = new FeatureValueFeatureSet(fs); - } - } - - stylevsp[-2].charPtrDlistData->clearAndDestroy(); - delete stylevsp[-2].charPtrDlistData ; - styleval.FeaturePtrData=f; - } -break; -case 49: -{ - stylevsp[-2].charPtrDlistData -> prepend((char *)stylevsp[0].charPtrData); - styleval.charPtrDlistData=stylevsp[-2].charPtrDlistData; - } -break; -case 50: -{ - styleval.charPtrDlistData=new CC_TPtrDlist; - styleval.charPtrDlistData -> append((char *)stylevsp[0].charPtrData); - } -break; -case 51: -{ - styleval.PathFeatureListPtrData=new PathFeatureList; - styleval.PathFeatureListPtrData -> append(new PathFeature(stylevsp[-1].PathPtrData, stylevsp[0].FeatureSetPtrData)); - } -break; -case 52: -{ - - PathFeatureListIterator l_Iter(*(stylevsp[-1].PathFeatureListPtrData)); - - while ( ++l_Iter ) { - (l_Iter.key()) -> path() -> prependPath(*stylevsp[-3].PathPtrData); - } - delete stylevsp[-3].PathPtrData; - styleval.PathFeatureListPtrData=stylevsp[-1].PathFeatureListPtrData; - } -break; -case 53: -{ - styleval.PathFeatureListPtrData=stylevsp[-2].PathFeatureListPtrData; - styleval.PathFeatureListPtrData -> appendList(*stylevsp[0].PathFeatureListPtrData); - delete stylevsp[0].PathFeatureListPtrData ; - } -break; -case 54: -{ - styleval.PathFeatureListPtrData=stylevsp[0].PathFeatureListPtrData; - } -break; -case 55: -{ - stylevsp[-1].PathPtrData -> appendPathTerm(stylevsp[0].PathTermPtrData); - styleval.PathPtrData=stylevsp[-1].PathPtrData; - } -break; -case 56: -{ - styleval.PathPtrData = new SSPath; - styleval.PathPtrData -> appendPathTerm(stylevsp[0].PathTermPtrData); - } -break; -case 57: -{ - styleval.PathTermPtrData=new PathTerm((const char*)stylevsp[-1].charPtrData, stylevsp[0].PQExprPtrData); - delete stylevsp[-1].charPtrData; - } -break; -case 58: -{ - localCharToCharPtrBuf[0]=stylevsp[0].charData; localCharToCharPtrBuf[1]=0; - styleval.PathTermPtrData=new PathTerm(localCharToCharPtrBuf, 0); - } -break; -case 59: -{ - localCharToCharPtrBuf[0]=stylevsp[0].charData; localCharToCharPtrBuf[1]=0; - styleval.PathTermPtrData=new PathTerm(localCharToCharPtrBuf, 0); - } -break; -case 60: -{ - } -break; -case 61: -{ - } -break; -case 62: -{ - } -break; -case 63: -{ - /* char % can start an OLIAS internal element which*/ - /* is used only by the browser.*/ - /* Example %BOGUS within HEAD1 in OLIAS book*/ - - if ( stylevsp[0].charPtrData[0] != '%' && isalnum(stylevsp[0].charPtrData[0]) == 0 ) { - MESSAGE(cerr, form("%s is not a SGMLGI", stylevsp[0].charPtrData)); - throw(CASTBEEXCEPT badEvaluationException()); - } - /* note, should probably be using RCStrings, would make wide */ - /* char handling better too? */ - if ( gGI_CASE_SENSITIVE == false ) - { - for (unsigned int i=0; i 0 ) { - c = stylevsp[0].charPtrData[i]; stylevsp[0].charPtrData[i]=0; - x = atof((const char*)stylevsp[0].charPtrData); - stylevsp[0].charPtrData[i]=c; - } else - x = 1; - - styleval.termNodePtrData=new ConstantNode(new FeatureValueDimension(new FeatureValueReal(x), (const char*)&stylevsp[0].charPtrData[i])); - - delete stylevsp[0].charPtrData; - } -break; -case 69: -{ - styleval.charPtrData=stylevsp[0].charPtrData; - } -break; -case 70: -{ - styleval.charPtrData=stylevsp[0].charPtrData; - } -break; -case 71: -{ - styleval.PQExprPtrData=stylevsp[-1].PQExprPtrData; - } -break; -case 72: -{ -/*////////////////////////////////////////////////////*/ -/* This portion of the code (up to equality_expr) is */ -/* hacked for V1.1 only. Due to the way */ -/* PathQualifier.h is written, this code is not */ -/* general at all. qfc 8/16/94*/ -/*////////////////////////////////////////////////////*/ - styleval.PQExprPtrData=stylevsp[0].PQExprPtrData; - } -break; -case 73: -{ - styleval.PQExprPtrData = new PQLogExpr(stylevsp[-2].PQExprPtrData, PQor, stylevsp[0].PQExprPtrData); - } -break; -case 74: -{ - styleval.PQExprPtrData=stylevsp[0].PQExprPtrData; - } -break; -case 75: -{ - styleval.PQExprPtrData = new PQLogExpr(stylevsp[-2].PQExprPtrData, PQand, stylevsp[0].PQExprPtrData); - } -break; -case 76: -{ - styleval.PQExprPtrData = new PQAttributeSelector( - gSymTab->intern((const char*)stylevsp[-2].charPtrData), - ( stylevsp[-1].intData == EQUAL ) ? PQEqual : PQNotEqual, - (const char*)stylevsp[0].charPtrData - ); - delete stylevsp[-2].charPtrData; - delete stylevsp[0].charPtrData; - } -break; -case 77: -{ - if ( strcasecmp((char*)stylevsp[-2].charPtrData, "position") == 0 ) { - styleval.PQExprPtrData=new PQPosition( - ( stylevsp[-1].intData == EQUAL ) ? PQEqual : PQNotEqual, - stylevsp[0].intData - ); - } else - if ( strcasecmp((char*)stylevsp[-2].charPtrData, "sibling") == 0 ) { - styleval.PQExprPtrData=new PQSibling( - ( stylevsp[-1].intData == EQUAL ) ? PQEqual : PQNotEqual, - stylevsp[0].intData - ); - } else - throw(CASTSSEXCEPT StyleSheetException()); - - delete stylevsp[-2].charPtrData; - } -break; -case 78: -{ - styleval.intData = (int)stylevsp[0].intData; - } -break; -case 79: -{ - if ( strcasecmp((char*)stylevsp[0].charPtrData, "#LAST") != 0 ) - throw(CASTSSEXCEPT StyleSheetException()); - - styleval.intData = -1; - } -break; -case 80: -{ - - } -break; -case 81: -{ - - } -break; -case 82: -{ - } -break; -case 83: -{ - } -break; -case 84: -{ - - } -break; -case 85: -{ - - } -break; -case 86: -{ - styleval.PQExprPtrData=stylevsp[0].PQExprPtrData; - } -break; -case 87: -{ - styleval.PQExprPtrData=0; - } -break; - } - stylessp -= stylem; - stylestate = *stylessp; - stylevsp -= stylem; - stylem = stylelhs[stylen]; - if (stylestate == 0 && stylem == 0) - { -#if styleDEBUG - if (styledebug) - printf("styledebug: after reduction, shifting from state 0 to\ - state %d\n", styleFINAL); -#endif - stylestate = styleFINAL; - *++stylessp = styleFINAL; - *++stylevsp = styleval; - if (stylechar < 0) - { - if ((stylechar = stylelex()) < 0) stylechar = 0; -#if styleDEBUG - if (styledebug) - { - styles = 0; - if (stylechar <= styleMAXTOKEN) styles = stylename[stylechar]; - if (!styles) styles = "illegal-symbol"; - printf("styledebug: state %d, reading %d (%s)\n", - styleFINAL, stylechar, styles); - } -#endif - } - if (stylechar == 0) goto styleaccept; - goto styleloop; - } - if ((stylen = stylegindex[stylem]) && (stylen += stylestate) >= 0 && - stylen <= styleTABLESIZE && stylecheck[stylen] == stylestate) - stylestate = styletable[stylen]; - else - stylestate = styledgoto[stylem]; -#if styleDEBUG - if (styledebug) - printf("styledebug: after reduction, shifting from state %d \ -to state %d\n", *stylessp, stylestate); -#endif - if (stylessp >= styless + stylestacksize - 1) - { - goto styleoverflow; - } - *++stylessp = stylestate; - *++stylevsp = styleval; - goto styleloop; -styleoverflow: - styleerror((char*)"yacc stack overflow"); -styleabort: - return (1); -styleaccept: - return (0); -} diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/style.tab.h b/cde/programs/dtinfo/DtMmdb/StyleSheet/style.tab.h deleted file mode 100644 index c828abaa2..000000000 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/style.tab.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * CDE - Common Desktop Environment - * - * Copyright (c) 1993-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these libraries and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* $XConsortium: style.tab.h /main/3 1996/06/11 17:46:36 cde-hal $ */ -#define INTEGER 257 -#define OPER_equality 258 -#define OPER_relational 259 -#define BOOLVAL 260 -#define REAL 261 -#define OPER_assign 262 -#define ARRAYOPEN 263 -#define ARRAYCLOSE 264 -#define SEPARATOR 265 -#define FSOPEN 266 -#define FSCLOSE 267 -#define OPER_modify 268 -#define OPER_parent 269 -#define OPER_attr 270 -#define OPER_oneof 271 -#define OPER_star 272 -#define OPER_or 273 -#define OPER_and 274 -#define OPER_div 275 -#define OPER_parenopen 276 -#define OPER_parenclose 277 -#define OPER_logicalnegate 278 -#define PMEMOPEN 279 -#define PMEMCLOSE 280 -#define OPER_period 281 -#define OPER_plus 282 -#define OPER_minus 283 -#define DIMENSION 284 -#define NORMAL_STRING 285 -#define UNIT_STRING 286 -#define QUOTED_STRING 287 -#define GI_CASE_SENSITIVE 288 -#define SGMLGI_STRING 289 -typedef union -{ - unsigned char charData; - unsigned char* charPtrData; - unsigned int boolData; - int intData; - float realData; - Expression* expPtrData; - TermNode* termNodePtrData; - FeatureValue* FeatureValuePtrData; - FeatureSet* FeatureSetPtrData; - Feature* FeaturePtrData; - SSPath* PathPtrData; - PathTerm* PathTermPtrData; - charPtrDlist* charPtrDlistData; - PathFeatureList* PathFeatureListPtrData; - CompositeVariableNode* CompositeVariableNodePtrData; - - CC_TPtrSlist* FeatureValueSlistPtrData; - - PQExpr* PQExprPtrData; -} YYSTYPE; -extern YYSTYPE stylelval; diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/style.y b/cde/programs/dtinfo/DtMmdb/StyleSheet/style.yy similarity index 99% rename from cde/programs/dtinfo/DtMmdb/StyleSheet/style.y rename to cde/programs/dtinfo/DtMmdb/StyleSheet/style.yy index 0846f5d0e..e84d9d2b1 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/style.y +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/style.yy @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include "StyleSheetExceptions.h" #include "VariableTable.h" diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.C b/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.C deleted file mode 100644 index 235e0fdf5..000000000 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.C +++ /dev/null @@ -1,1583 +0,0 @@ -/* - * CDE - Common Desktop Environment - * - * Copyright (c) 1993-2012, The Open Group. All rights reserved. - * - * These libraries and programs are free software; you can - * redistribute them and/or modify them under the terms of the GNU - * Lesser General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * These libraries and programs are distributed in the hope that - * they will be useful, but WITHOUT ANY WARRANTY; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU Lesser General Public License for more - * details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with these libraries and programs; if not, write - * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301 USA - */ -/* A lexical scanner generated by flex */ - -/* scanner skeleton version: - * $TOG: tokenStyle.C /main/6 1998/04/17 11:52:06 mgreess $ - */ - -#define FLEX_SCANNER - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include - -#if !defined(__linux__) && !defined(CSRG_BASED) && !defined(sun) -#include -#endif - -/* use prototypes in function declarations */ -#define style_USE_PROTOS - -/* the "const" storage-class-modifier is valid */ -#define style_USE_CONST - -#else /* ! __cplusplus */ - -#ifdef __STDC__ - -#ifdef __GNUC__ -#include -void *malloc( size_t ); -void free( void* ); -#else -#include -#endif /* __GNUC__ */ - -#define style_USE_PROTOS -#define style_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - - -#ifdef __TURBOC__ -#define style_USE_CONST -#endif - - -#ifndef style_USE_CONST -#define const -#endif - - -#ifdef style_USE_PROTOS -#define style_PROTO(proto) proto -#else -#define style_PROTO(proto) () -/* we can't get here if it's an ANSI C compiler, or a C++ compiler, - * so it's got to be a K&R compiler, and therefore there's no standard - * place from which to include these definitions - */ -char *malloc(); -int free(); -int read(); -#endif - - -/* amount of stuff to slurp up with each read */ -#ifndef style_READ_BUF_SIZE -#define style_READ_BUF_SIZE 8192 -#endif - -/* returned upon end-of-file */ -#define style_END_TOK 0 - -/* copy whatever the last rule matched to the standard output */ - -/* cast to (char *) is because for 8-bit chars, styletext is (unsigned char *) */ -/* this used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite() - */ -#define ECHO (void) fwrite( (char *) styletext, styleleng, 1, styleout ) - -/* gets input and stuffs it into "buf". number of characters read, or style_NULL, - * is returned in "result". - */ -#define style_INPUT(buf,result,max_size) \ - if ( (result = read( fileno(stylein), (char *) buf, max_size )) < 0 ) \ - style_FATAL_ERROR( "read() in flex scanner failed" ); -#define style_NULL 0 - -/* no semi-colon after return; correct usage is to write "styleterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#define styleterminate() return ( style_NULL ) - -/* report a fatal error */ - -/* The funky do-while is used to turn this macro definition into - * a single C statement (which needs a semi-colon terminator). - * This avoids problems with code like: - * - * if ( something_happens ) - * style_FATAL_ERROR( "oops, the something happened" ); - * else - * everything_okay(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the style_FATAL_ERROR() call. - */ - -#define style_FATAL_ERROR(msg) \ - do \ - { \ - (void) fputs( msg, stderr ); \ - (void) putc( '\n', stderr ); \ - exit( 1 ); \ - } \ - while ( 0 ) - -/* default stylewrap function - always treat EOF as an EOF */ -#define stylewrap() 1 - -/* enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN - */ -#define BEGIN style_start = 1 + 2 * - -/* action number for EOF rule of a given start state */ -#define style_STATE_EOF(state) (style_END_OF_BUFFER + state + 1) - -/* special action meaning "start processing a new file" */ -#define style_NEW_FILE \ - do \ - { \ - style_init_buffer( style_current_buffer, stylein ); \ - style_load_buffer_state(); \ - } \ - while ( 0 ) - -/* default declaration of generated scanner - a define so the user can - * easily add parameters - */ -#define style_DECL int stylelex style_PROTO(( void )) - -/* code executed at the end of each rule */ -#define style_BREAK break; - -#define style_END_OF_BUFFER_CHAR 0 - -#ifndef style_BUF_SIZE -#define style_BUF_SIZE (style_READ_BUF_SIZE * 2) /* size of default input buffer */ -#endif - -typedef struct style_buffer_state *style_BUFFER_STATE; - -#define style_CHAR unsigned char -# line 1 "tokenStyle.l" -#define INITIAL 0 -/* -* $TOG: tokenStyle.C /main/6 1998/04/17 11:52:06 mgreess $ -* -* Copyright (c) 1993 HAL Computer Systems International, Ltd. -* All rights reserved. Unpublished -- rights reserved under -* the Copyright Laws of the United States. USE OF A COPYRIGHT -* NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION -* OR DISCLOSURE. -* -* THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE -* SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE, -* DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE -* PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS -* INTERNATIONAL, LTD. -* -* RESTRICTED RIGHTS LEGEND -* Use, duplication, or disclosure by the Government is subject -* to the restrictions as set forth in subparagraph (c)(l)(ii) -* of the Rights in Technical Data and Computer Software clause -* at DFARS 252.227-7013. -* -* HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. -* 1315 Dell Avenue -* Campbell, CA 95008 -* -*/ -# line 37 "tokenStyle.l" -#include -#include "ParserConst.h" -#include "Expression.h" -#include "FeatureValue.h" -#include "PathTable.h" -#include "SSPath.h" -#include "PathQualifier.h" -#include "StyleSheetExceptions.h" -#include "style.tab.h" -#include "Debug.h" -#include -using namespace std; - -istream *g_stylein = 0; - -#undef style_INPUT -#define style_INPUT(buf,result,max_size)\ - {\ - if (g_stylein -> eof()) {\ - result=0;\ - } else {\ - g_stylein -> read((char*)buf, max_size-1); \ - result = g_stylein -> gcount(); \ - buf[result] = 0; \ - }\ - } - -unsigned char* qstring_buf = new unsigned char[1024]; -int qstring_buf_size = 1024; -int qstring_buf_content_size = 0; - -char* commentBuffer = new char [1024]; -int commentBufferSize = 1024; -int commentBufferContentSize = 0; - -int stylelineno=1; - -void addToQstringBuf(const unsigned char* str, int size) -{ - if ( size <= 0 ) return; - - if ( qstring_buf_size - qstring_buf_content_size < size ) { - qstring_buf_size = 2*(size+qstring_buf_content_size); - unsigned char* x = new unsigned char[qstring_buf_size]; - memcpy(x, qstring_buf, qstring_buf_content_size); - delete [] qstring_buf; - qstring_buf = x; - } - - memcpy(qstring_buf + qstring_buf_content_size, str, size); - qstring_buf_content_size += size; - qstring_buf[qstring_buf_content_size] = 0; -} - - -#define block 1 -#define sgmlgimode 2 -#define quoted_string 3 -# line 95 "tokenStyle.l" - -/* done after the current pattern has been matched and before the - * corresponding action - sets up styletext - */ -#define style_DO_BEFORE_ACTION \ - styletext = style_bp; \ - styleleng = style_cp - style_bp; \ - style_hold_char = *style_cp; \ - *style_cp = '\0'; \ - style_c_buf_p = style_cp; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* return all but the first 'n' matched characters back to the input stream */ -#define styleless(n) \ - do \ - { \ - /* undo effects of setting up styletext */ \ - *style_cp = style_hold_char; \ - style_c_buf_p = style_cp = style_bp + n; \ - style_DO_BEFORE_ACTION; /* set up styletext again */ \ - } \ - while ( 0 ) - -#define unput(c) styleunput( c, styletext ) - - -struct style_buffer_state - { - FILE *style_input_file; - - style_CHAR *style_ch_buf; /* input buffer */ - style_CHAR *style_buf_pos; /* current position in input buffer */ - - /* size of input buffer in bytes, not including room for EOB characters*/ - int style_buf_size; - - /* number of characters read into style_ch_buf, not including EOB characters */ - int style_n_chars; - - int style_eof_status; /* whether we've seen an EOF on this buffer */ -#define EOF_NOT_SEEN 0 - /* "pending" happens when the EOF has been seen but there's still - * some text process - */ -#define EOF_PENDING 1 -#define EOF_DONE 2 - }; - -static style_BUFFER_STATE style_current_buffer; - -/* we provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state" - */ -#define style_CURRENT_BUFFER style_current_buffer - - -/* style_hold_char holds the character lost when styletext is formed */ -static style_CHAR style_hold_char; - -static int style_n_chars; /* number of characters read into style_ch_buf */ - - - -#ifndef style_USER_ACTION -#define style_USER_ACTION -#endif - -#ifndef style_USER_INIT -#define style_USER_INIT -#endif - -extern style_CHAR *styletext; -extern int styleleng; -extern FILE *stylein, *styleout; - -style_CHAR *styletext; -int styleleng; - -FILE *stylein = (FILE *) 0, *styleout = (FILE *) 0; - -#define style_END_OF_BUFFER 48 -typedef int style_state_type; -static const short int style_accept[134] = - { 0, - 0, 0, 0, 0, 0, 0, 36, 36, 48, 39, - 41, 42, 43, 23, 33, 39, 39, 18, 19, 9, - 5, 13, 6, 8, 7, 31, 10, 24, 3, 24, - 11, 4, 39, 39, 39, 39, 39, 39, 39, 16, - 17, 12, 39, 39, 14, 39, 15, 2, 45, 46, - 45, 47, 40, 36, 36, 34, 35, 39, 22, 1, - 21, 0, 31, 39, 39, 39, 24, 38, 39, 39, - 38, 39, 28, 39, 39, 39, 20, 2, 2, 1, - 44, 40, 36, 32, 30, 30, 39, 39, 39, 39, - 39, 29, 39, 39, 39, 39, 0, 0, 0, 39, - - 39, 39, 39, 39, 39, 39, 39, 26, 30, 30, - 0, 0, 39, 39, 27, 39, 0, 0, 0, 0, - 39, 0, 0, 39, 39, 39, 39, 39, 39, 39, - 39, 25, 0 - } ; - -static const style_CHAR style_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 5, 6, 7, 1, 1, 8, 1, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 18, 1, 19, - 20, 21, 22, 23, 24, 25, 26, 25, 27, 28, - 29, 30, 31, 25, 25, 32, 33, 34, 35, 36, - 25, 37, 38, 39, 40, 25, 25, 41, 25, 25, - 42, 43, 44, 45, 1, 1, 46, 25, 47, 25, - - 48, 28, 25, 30, 49, 25, 25, 32, 33, 50, - 51, 36, 25, 37, 52, 53, 40, 54, 25, 41, - 25, 25, 55, 56, 57, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static const style_CHAR style_meta[58] = - { 0, - 1, 2, 3, 2, 2, 4, 1, 1, 2, 2, - 2, 2, 2, 5, 6, 2, 5, 2, 1, 2, - 1, 2, 2, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 2, 7, 2, 2, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 2, 1, 2 - } ; - -static const short int style_base[141] = - { 0, - 0, 341, 55, 56, 112, 0, 57, 58, 347, 0, - 349, 349, 349, 326, 349, 289, 336, 349, 349, 349, - 349, 349, 0, 349, 349, 50, 349, 323, 322, 321, - 349, 349, 303, 38, 300, 32, 40, 57, 284, 349, - 349, 349, 35, 289, 349, 259, 349, 168, 349, 349, - 307, 349, 0, 0, 0, 349, 349, 0, 349, 0, - 0, 296, 170, 262, 37, 169, 349, 0, 262, 267, - 44, 264, 0, 156, 44, 251, 0, 224, 0, 0, - 349, 0, 0, 224, 0, 47, 168, 46, 51, 244, - 259, 0, 56, 144, 155, 166, 255, 177, 223, 257, - - 152, 204, 198, 211, 234, 253, 168, 0, 349, 217, - 237, 226, 250, 212, 0, 213, 223, 221, 229, 246, - 164, 167, 244, 127, 59, 55, 56, 45, 30, 24, - 24, 0, 349, 297, 304, 311, 318, 321, 327, 333 - } ; - -static const short int style_def[141] = - { 0, - 133, 1, 134, 134, 133, 5, 135, 135, 133, 136, - 133, 133, 133, 133, 133, 136, 136, 133, 133, 133, - 133, 133, 136, 133, 133, 136, 133, 136, 133, 136, - 133, 133, 136, 136, 136, 136, 136, 136, 136, 133, - 133, 133, 136, 136, 133, 136, 133, 137, 133, 133, - 133, 133, 138, 139, 139, 133, 133, 136, 133, 136, - 136, 133, 136, 136, 136, 136, 133, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 136, 137, 140, 78, - 133, 138, 139, 133, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 133, 133, 133, 136, - - 136, 136, 136, 136, 136, 136, 136, 136, 133, 133, - 133, 133, 136, 136, 136, 136, 133, 133, 133, 133, - 136, 133, 133, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 0, 133, 133, 133, 133, 133, 133, 133 - } ; - -static const short int style_nxt[407] = - { 0, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 10, 10, 33, 10, 34, 35, 10, - 36, 10, 10, 10, 37, 38, 10, 10, 39, 10, - 10, 40, 10, 41, 42, 10, 33, 10, 36, 43, - 44, 10, 39, 10, 45, 46, 47, 50, 50, 55, - 55, 69, 56, 56, 62, 71, 63, 72, 73, 91, - 86, 132, 100, 73, 95, 64, 103, 131, 130, 68, - 65, 71, 68, 69, 73, 66, 86, 74, 104, 73, - 91, 75, 95, 100, 103, 68, 64, 129, 65, 57, - - 57, 68, 104, 68, 128, 74, 127, 75, 126, 68, - 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 53, 53, 52, 53, 52, - 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 52, 52, 52, 52, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 52, 52, 52, 79, - 106, 79, 79, 79, 125, 85, 79, 79, 79, 79, - 79, 93, 79, 79, 62, 79, 63, 79, 107, 79, - 79, 106, 108, 101, 85, 64, 94, 85, 109, 87, - - 65, 124, 93, 88, 107, 66, 68, 85, 102, 79, - 110, 79, 79, 108, 101, 85, 64, 87, 65, 88, - 68, 85, 79, 80, 79, 79, 110, 79, 79, 79, - 113, 114, 79, 79, 79, 79, 79, 115, 79, 79, - 84, 79, 117, 79, 109, 79, 79, 114, 109, 97, - 85, 113, 109, 111, 98, 122, 120, 112, 115, 99, - 121, 109, 118, 117, 85, 79, 109, 79, 79, 109, - 97, 111, 98, 112, 120, 109, 122, 119, 79, 123, - 79, 85, 109, 118, 68, 116, 85, 109, 68, 105, - 96, 92, 90, 89, 85, 123, 109, 49, 49, 49, - - 49, 49, 49, 49, 54, 54, 54, 54, 54, 54, - 54, 58, 84, 81, 77, 58, 72, 58, 78, 78, - 76, 78, 78, 78, 78, 82, 82, 83, 83, 83, - 70, 83, 83, 79, 79, 68, 79, 79, 79, 79, - 67, 59, 67, 61, 60, 59, 133, 48, 9, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - - 133, 133, 133, 133, 133, 133 - } ; - -static const short int style_chk[407] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 4, 7, - 8, 34, 7, 8, 26, 36, 26, 37, 43, 71, - 65, 131, 86, 37, 75, 26, 88, 130, 129, 93, - 26, 36, 38, 34, 43, 26, 65, 38, 89, 37, - 71, 38, 75, 86, 88, 38, 26, 128, 26, 7, - - 8, 93, 89, 38, 127, 38, 126, 38, 125, 38, - 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 48, - 94, 48, 48, 48, 124, 101, 48, 48, 48, 48, - 48, 74, 48, 48, 63, 48, 63, 48, 95, 48, - 48, 94, 96, 87, 66, 63, 74, 101, 122, 66, - - 63, 121, 74, 66, 95, 63, 107, 66, 87, 48, - 98, 48, 48, 96, 87, 66, 63, 66, 63, 66, - 107, 66, 48, 48, 48, 78, 98, 78, 78, 78, - 102, 103, 78, 78, 78, 78, 78, 104, 78, 78, - 84, 78, 110, 78, 118, 78, 78, 103, 99, 84, - 114, 102, 117, 99, 84, 119, 112, 99, 104, 84, - 116, 99, 111, 110, 114, 78, 118, 78, 78, 99, - 84, 99, 84, 99, 112, 99, 119, 111, 78, 120, - 78, 113, 123, 111, 106, 105, 100, 97, 91, 90, - 76, 72, 70, 69, 64, 120, 123, 134, 134, 134, - - 134, 134, 134, 134, 135, 135, 135, 135, 135, 135, - 135, 136, 62, 51, 46, 136, 44, 136, 137, 137, - 39, 137, 137, 137, 137, 138, 138, 139, 139, 139, - 35, 139, 139, 140, 140, 33, 140, 140, 140, 140, - 30, 29, 28, 17, 16, 14, 9, 2, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - - 133, 133, 133, 133, 133, 133 - } ; - -static style_state_type style_last_accepting_state; -static style_CHAR *style_last_accepting_cpos; - -/* the intent behind this definition is that it'll catch - * any uses of REJECT which flex missed - */ -#define REJECT reject_used_but_not_detected -#define stylemore() stylemore_used_but_not_detected -#define style_MORE_ADJ 0 - -/* these variables are all declared out here so that section 3 code can - * manipulate them - */ -/* points to current character in buffer */ -static style_CHAR *style_c_buf_p = (style_CHAR *) 0; -static int style_init = 1; /* whether we need to initialize */ -static int style_start = 0; /* start state number */ - -/* flag which is used to allow stylewrap()'s to do buffer switches - * instead of setting up a fresh stylein. A bit of a hack ... - */ -static int style_did_buffer_switch_on_eof; - -static style_state_type style_get_previous_state style_PROTO(( void )); -static style_state_type style_try_NUL_trans style_PROTO(( style_state_type current_state )); -static int style_get_next_buffer style_PROTO(( void )); -#if 0 -static void styleunput style_PROTO(( style_CHAR c, style_CHAR *buf_ptr )); -#endif -void stylerestart style_PROTO(( FILE *input_file )); -void style_switch_to_buffer style_PROTO(( style_BUFFER_STATE new_buffer )); -void style_load_buffer_state style_PROTO(( void )); -style_BUFFER_STATE style_create_buffer style_PROTO(( FILE *file, int size )); -void style_delete_buffer style_PROTO(( style_BUFFER_STATE b )); -void style_init_buffer style_PROTO(( style_BUFFER_STATE b, FILE *file )); - -#define style_new_buffer style_create_buffer - -#ifdef __cplusplus -static int styleinput style_PROTO(( void )); -#else -static int input style_PROTO(( void )); -#endif - -style_DECL - { - style_state_type style_current_state; - style_CHAR *style_cp, *style_bp; - int style_act; - - - - - if ( style_init ) - { - style_USER_INIT; - - if ( ! style_start ) - style_start = 1; /* first start state */ - - if ( ! stylein ) - stylein = stdin; - - if ( ! styleout ) - styleout = stdout; - - if ( style_current_buffer ) - style_init_buffer( style_current_buffer, stylein ); - else - style_current_buffer = style_create_buffer( stylein, style_BUF_SIZE ); - - style_load_buffer_state(); - - style_init = 0; - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - style_cp = style_c_buf_p; - - /* support of styletext */ - *style_cp = style_hold_char; - - /* style_bp points to the position in style_ch_buf of the start of the - * current run. - */ - style_bp = style_cp; - - style_current_state = style_start; - if ( style_bp[-1] == '\n' ) - ++style_current_state; -style_match: - do - { - style_CHAR style_c = style_ec[*style_cp]; - if ( style_accept[style_current_state] ) - { - style_last_accepting_state = style_current_state; - style_last_accepting_cpos = style_cp; - } - while ( style_chk[style_base[style_current_state] + style_c] != style_current_state ) - { - style_current_state = style_def[style_current_state]; - if ( style_current_state >= 134 ) - style_c = style_meta[style_c]; - } - style_current_state = style_nxt[style_base[style_current_state] + style_c]; - ++style_cp; - } - while ( style_current_state != 133 ); - style_cp = style_last_accepting_cpos; - style_current_state = style_last_accepting_state; - -style_find_action: - style_act = style_accept[style_current_state]; - - style_DO_BEFORE_ACTION; - style_USER_ACTION; - -do_action: /* this label is used only to access EOF actions */ - - - switch ( style_act ) - { - case 0: /* must backtrack */ - /* undo the effects of style_DO_BEFORE_ACTION */ - *style_cp = style_hold_char; - style_cp = style_last_accepting_cpos; - style_current_state = style_last_accepting_state; - goto style_find_action; - -case 1: -# line 97 "tokenStyle.l" -BEGIN(block); - style_BREAK -case 2: -# line 99 "tokenStyle.l" -{ - if ( commentBufferSize < styleleng ) { - delete [] commentBuffer; - commentBufferSize = 2 * styleleng ; - commentBuffer = new char [commentBufferSize]; - } - - commentBufferContentSize = styleleng-1; - memcpy(commentBuffer, styletext+1, commentBufferContentSize); // copy everything except the # - commentBuffer[commentBufferContentSize] = 0; - } - style_BREAK -case 3: -# line 111 "tokenStyle.l" -{ - return(OPER_assign); - } - style_BREAK -case 4: -# line 115 "tokenStyle.l" -{ - return(OPER_attr); - } - style_BREAK -case 5: -# line 119 "tokenStyle.l" -{ - stylelval.charData = styletext[0]; - return(OPER_plus); - } - style_BREAK -case 6: -# line 124 "tokenStyle.l" -{ - stylelval.charData = styletext[0]; - return(OPER_minus); - } - style_BREAK -case 7: -# line 129 "tokenStyle.l" -{ - stylelval.charData = styletext[0]; - return(OPER_div); - } - style_BREAK -case 8: -# line 134 "tokenStyle.l" -{ - return(OPER_period); - } - style_BREAK -case 9: -# line 138 "tokenStyle.l" -{ - stylelval.charData = styletext[0]; - return(OPER_star); - } - style_BREAK -case 10: -# line 143 "tokenStyle.l" -{ - return(OPER_modify); - } - style_BREAK -case 11: -# line 147 "tokenStyle.l" -{ - return(OPER_oneof); - } - style_BREAK -case 12: -# line 151 "tokenStyle.l" -{ - return(OPER_parent); - } - style_BREAK -case 13: -# line 155 "tokenStyle.l" -{ - return(SEPARATOR); - } - style_BREAK -case 14: -# line 159 "tokenStyle.l" -{ - return(FSOPEN); - } - style_BREAK -case 15: -# line 163 "tokenStyle.l" -{ - return(FSCLOSE); - } - style_BREAK -case 16: -# line 167 "tokenStyle.l" -{ - return(ARRAYOPEN); - } - style_BREAK -case 17: -# line 171 "tokenStyle.l" -{ - return(ARRAYCLOSE); - } - style_BREAK -case 18: -# line 175 "tokenStyle.l" -{ - return(OPER_parenopen); - } - style_BREAK -case 19: -# line 179 "tokenStyle.l" -{ - return(OPER_parenclose); - } - style_BREAK -case 20: -# line 183 "tokenStyle.l" -{ - return(OPER_or); - } - style_BREAK -case 21: -# line 187 "tokenStyle.l" -{ - return(OPER_and); - } - style_BREAK -case 22: -# line 191 "tokenStyle.l" -{ - if ( strcmp((const char*)styletext, "==") == 0 ) - stylelval.intData = EQUAL; - else - stylelval.intData = NOT_EQUAL; - - return(OPER_equality); - } - style_BREAK -case 23: -# line 200 "tokenStyle.l" -{ - return(OPER_logicalnegate); - } - style_BREAK -case 24: -# line 204 "tokenStyle.l" -{ - if ( strcmp((const char*)styletext, "<=") == 0 ) - stylelval.intData = LESS_OR_EQUAL; - else - if ( strcmp((const char*)styletext, "<") == 0 ) - stylelval.intData = LESS; - else - if ( strcmp((const char*)styletext, ">=") == 0 ) - stylelval.intData = GREATER_OR_EQUAL; - else - stylelval.intData = GREATER; - - return(OPER_relational); - } - style_BREAK -case 25: -# line 219 "tokenStyle.l" -{ - return(GI_CASE_SENSITIVE); - } - style_BREAK -case 26: -# line 223 "tokenStyle.l" -{ - stylelval.boolData = true; - return(BOOLVAL); - } - style_BREAK -case 27: -# line 228 "tokenStyle.l" -{ - stylelval.boolData = false; - return(BOOLVAL); - } - style_BREAK -case 28: -# line 233 "tokenStyle.l" -{ - stylelval.boolData = true; - return(BOOLVAL); - } - style_BREAK -case 29: -# line 238 "tokenStyle.l" -{ - stylelval.boolData = false; - return(BOOLVAL); - } - style_BREAK -case 30: -# line 243 "tokenStyle.l" -{ - stylelval.charPtrData = - (unsigned char*)strdup((const char*)styletext); - return(DIMENSION); - } - style_BREAK -case 31: -# line 249 "tokenStyle.l" -{ - stylelval.intData = atoi((char*)styletext); - return(INTEGER); - } - style_BREAK -case 32: -# line 254 "tokenStyle.l" -{ - stylelval.realData = atof((char*)styletext); - return(REAL); - } - style_BREAK -case 33: -# line 259 "tokenStyle.l" -{ - BEGIN quoted_string; - } - style_BREAK -case 34: -# line 263 "tokenStyle.l" -{ - - stylelval.charPtrData = - new unsigned char[qstring_buf_content_size+1]; - memcpy( stylelval.charPtrData, - qstring_buf, - qstring_buf_content_size+1 - ); - - qstring_buf_content_size = 0; - BEGIN 0; - - return(QUOTED_STRING); - } - style_BREAK -case 35: -# line 278 "tokenStyle.l" -{ - int c = styleinput(); - switch (c) { - case '"': - addToQstringBuf((unsigned char*)"\"", 1); - break; - case '\\': - addToQstringBuf((unsigned char*)"\\", 1); - break; - default: - throw(CASTSSEXCEPT StyleSheetException()); - } - } - style_BREAK -case 36: -# line 292 "tokenStyle.l" -{ - addToQstringBuf((const unsigned char *)styletext, styleleng); - } - style_BREAK -case 37: -# line 296 "tokenStyle.l" -{ - addToQstringBuf((const unsigned char *)styletext, styleleng); - } - style_BREAK -case 38: -# line 300 "tokenStyle.l" -{ - stylelval.charPtrData = - (unsigned char*)strdup((const char*)styletext); - return(UNIT_STRING); - } - style_BREAK -case 39: -# line 306 "tokenStyle.l" -{ - stylelval.charPtrData = - (unsigned char*)strdup((const char*)styletext); - return(NORMAL_STRING); - } - style_BREAK -case 40: -# line 312 "tokenStyle.l" -{ - stylelval.charPtrData = - (unsigned char*)strdup((const char*)styletext); - BEGIN 0; - return(SGMLGI_STRING); - } - style_BREAK -case 41: -# line 319 "tokenStyle.l" -{ - } - style_BREAK -case 42: -# line 322 "tokenStyle.l" -{ - stylelineno++; - } - style_BREAK -case 43: -# line 326 "tokenStyle.l" -{ - } - style_BREAK -case 44: -# line 331 "tokenStyle.l" -{ BEGIN(0); } - style_BREAK -case 45: -# line 332 "tokenStyle.l" -; - style_BREAK -case 46: -# line 333 "tokenStyle.l" -; - style_BREAK -case 47: -# line 334 "tokenStyle.l" -style_FATAL_ERROR( "flex scanner jammed" ); - style_BREAK -case style_STATE_EOF(INITIAL): -case style_STATE_EOF(block): -case style_STATE_EOF(sgmlgimode): -case style_STATE_EOF(quoted_string): - styleterminate(); - - case style_END_OF_BUFFER: - { - /* amount of text matched not including the EOB char */ - int style_amount_of_matched_text = style_cp - styletext - 1; - - /* undo the effects of style_DO_BEFORE_ACTION */ - *style_cp = style_hold_char; - - /* note that here we test for style_c_buf_p "<=" to the position - * of the first EOB in the buffer, since style_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the end- - * of-buffer state). Contrast this with the test in styleinput(). - */ - if ( style_c_buf_p <= &style_current_buffer->style_ch_buf[style_n_chars] ) - /* this was really a NUL */ - { - style_state_type style_next_state; - - style_c_buf_p = styletext + style_amount_of_matched_text; - - style_current_state = style_get_previous_state(); - - /* okay, we're now positioned to make the - * NUL transition. We couldn't have - * style_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we - * don't want to build jamming into it because - * then it will run more slowly) - */ - - style_next_state = style_try_NUL_trans( style_current_state ); - - style_bp = styletext + style_MORE_ADJ; - - if ( style_next_state ) - { - /* consume the NUL */ - style_cp = ++style_c_buf_p; - style_current_state = style_next_state; - goto style_match; - } - - else - { - style_cp = style_last_accepting_cpos; - style_current_state = style_last_accepting_state; - goto style_find_action; - } - } - - else switch ( style_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - style_did_buffer_switch_on_eof = 0; - - if ( stylewrap() ) - { - /* note: because we've taken care in - * style_get_next_buffer() to have set up styletext, - * we can now set up style_c_buf_p so that if some - * total hoser (like flex itself) wants - * to call the scanner after we return the - * style_NULL, it'll still work - another style_NULL - * will get returned. - */ - style_c_buf_p = styletext + style_MORE_ADJ; - - style_act = style_STATE_EOF((style_start - 1) / 2); - goto do_action; - } - - else - { - if ( ! style_did_buffer_switch_on_eof ) - style_NEW_FILE; - } - } - break; - - case EOB_ACT_CONTINUE_SCAN: - style_c_buf_p = styletext + style_amount_of_matched_text; - - style_current_state = style_get_previous_state(); - - style_cp = style_c_buf_p; - style_bp = styletext + style_MORE_ADJ; - goto style_match; - - case EOB_ACT_LAST_MATCH: - style_c_buf_p = - &style_current_buffer->style_ch_buf[style_n_chars]; - - style_current_state = style_get_previous_state(); - - style_cp = style_c_buf_p; - style_bp = styletext + style_MORE_ADJ; - goto style_find_action; - } - break; - } - - default: -#ifdef FLEX_DEBUG - printf( "action # %d\n", style_act ); -#endif - style_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } - } - } - - -/* style_get_next_buffer - try to read in a new buffer - * - * synopsis - * int style_get_next_buffer(); - * - * returns a code representing an action - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int style_get_next_buffer() - - { - style_CHAR *dest = style_current_buffer->style_ch_buf; - style_CHAR *source = styletext - 1; /* copy prev. char, too */ - int number_to_move, i; - int ret_val; - - if ( style_c_buf_p > &style_current_buffer->style_ch_buf[style_n_chars + 1] ) - style_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - /* try to read more data */ - - /* first move last chars to start of buffer */ - number_to_move = style_c_buf_p - styletext; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( style_current_buffer->style_eof_status != EOF_NOT_SEEN ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - style_n_chars = 0; - - else - { - int num_to_read = style_current_buffer->style_buf_size - number_to_move - 1; - - if ( num_to_read > style_READ_BUF_SIZE ) - num_to_read = style_READ_BUF_SIZE; - - else if ( num_to_read <= 0 ) - style_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - - /* read in more data */ - style_INPUT( (&style_current_buffer->style_ch_buf[number_to_move]), - style_n_chars, num_to_read ); - } - - if ( style_n_chars == 0 ) - { - if ( number_to_move == 1 ) - { - ret_val = EOB_ACT_END_OF_FILE; - style_current_buffer->style_eof_status = EOF_DONE; - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - style_current_buffer->style_eof_status = EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - style_n_chars += number_to_move; - style_current_buffer->style_ch_buf[style_n_chars] = style_END_OF_BUFFER_CHAR; - style_current_buffer->style_ch_buf[style_n_chars + 1] = style_END_OF_BUFFER_CHAR; - - /* styletext begins at the second character in style_ch_buf; the first - * character is the one which preceded it before reading in the latest - * buffer; it needs to be kept around in case it's a newline, so - * style_get_previous_state() will have with '^' rules active - */ - - styletext = &style_current_buffer->style_ch_buf[1]; - - return ( ret_val ); - } - - -/* style_get_previous_state - get the state just before the EOB char was reached - * - * synopsis - * style_state_type style_get_previous_state(); - */ - -static style_state_type style_get_previous_state() - - { - style_state_type style_current_state; - style_CHAR *style_cp; - - style_CHAR *style_bp = styletext; - - style_current_state = style_start; - if ( style_bp[-1] == '\n' ) - ++style_current_state; - - for ( style_cp = styletext + style_MORE_ADJ; style_cp < style_c_buf_p; ++style_cp ) - { - style_CHAR style_c = (*style_cp ? style_ec[*style_cp] : 1); - if ( style_accept[style_current_state] ) - { - style_last_accepting_state = style_current_state; - style_last_accepting_cpos = style_cp; - } - while ( style_chk[style_base[style_current_state] + style_c] != style_current_state ) - { - style_current_state = style_def[style_current_state]; - if ( style_current_state >= 134 ) - style_c = style_meta[style_c]; - } - style_current_state = style_nxt[style_base[style_current_state] + style_c]; - } - - return ( style_current_state ); - } - - -/* style_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = style_try_NUL_trans( current_state ); - */ - -#ifdef style_USE_PROTOS -static style_state_type style_try_NUL_trans( style_state_type style_current_state ) -#else -static style_state_type style_try_NUL_trans( style_current_state ) -style_state_type style_current_state; -#endif - - { - int style_is_jam; - style_CHAR *style_cp = style_c_buf_p; - - style_CHAR style_c = 1; - if ( style_accept[style_current_state] ) - { - style_last_accepting_state = style_current_state; - style_last_accepting_cpos = style_cp; - } - while ( style_chk[style_base[style_current_state] + style_c] != style_current_state ) - { - style_current_state = style_def[style_current_state]; - if ( style_current_state >= 134 ) - style_c = style_meta[style_c]; - } - style_current_state = style_nxt[style_base[style_current_state] + style_c]; - style_is_jam = (style_current_state == 133); - - return ( style_is_jam ? 0 : style_current_state ); - } - - -#if 0 -#ifdef style_USE_PROTOS -static void styleunput( style_CHAR c, style_CHAR *style_bp ) -#else -static void styleunput( c, style_bp ) -style_CHAR c; -style_CHAR *style_bp; -#endif - - { - style_CHAR *style_cp = style_c_buf_p; - - /* undo effects of setting up styletext */ - *style_cp = style_hold_char; - - if ( style_cp < style_current_buffer->style_ch_buf + 2 ) - { /* need to shift things up to make room */ - int number_to_move = style_n_chars + 2; /* +2 for EOB chars */ - style_CHAR *dest = - &style_current_buffer->style_ch_buf[style_current_buffer->style_buf_size + 2]; - style_CHAR *source = - &style_current_buffer->style_ch_buf[number_to_move]; - - while ( source > style_current_buffer->style_ch_buf ) - *--dest = *--source; - - style_cp += dest - source; - style_bp += dest - source; - style_n_chars = style_current_buffer->style_buf_size; - - if ( style_cp < style_current_buffer->style_ch_buf + 2 ) - style_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - if ( style_cp > style_bp && style_cp[-1] == '\n' ) - style_cp[-2] = '\n'; - - *--style_cp = c; - - /* note: the formal parameter *must* be called "style_bp" for this - * macro to now work correctly - */ - style_DO_BEFORE_ACTION; /* set up styletext again */ - } -#endif - - -#ifdef __cplusplus -static int styleinput() -#else -static int input() -#endif - - { - int c; - style_CHAR *style_cp = style_c_buf_p; - - *style_cp = style_hold_char; - - if ( *style_c_buf_p == style_END_OF_BUFFER_CHAR ) - { - /* style_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( style_c_buf_p < &style_current_buffer->style_ch_buf[style_n_chars] ) - /* this was really a NUL */ - *style_c_buf_p = '\0'; - - else - { /* need more input */ - styletext = style_c_buf_p; - ++style_c_buf_p; - - switch ( style_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( stylewrap() ) - { - style_c_buf_p = styletext + style_MORE_ADJ; - return ( EOF ); - } - - style_NEW_FILE; - -#ifdef __cplusplus - return ( styleinput() ); -#else - return ( input() ); -#endif - } - break; - - case EOB_ACT_CONTINUE_SCAN: - style_c_buf_p = styletext + style_MORE_ADJ; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - style_FATAL_ERROR( "unexpected last match in styleinput()" ); -#else - style_FATAL_ERROR( "unexpected last match in input()" ); -#endif - } - } - } - - c = *style_c_buf_p; - style_hold_char = *++style_c_buf_p; - - return ( c ); - } - - -#ifdef style_USE_PROTOS -void stylerestart( FILE *input_file ) -#else -void stylerestart( input_file ) -FILE *input_file; -#endif - - { - style_init_buffer( style_current_buffer, input_file ); - style_load_buffer_state(); - } - - -#ifdef style_USE_PROTOS -void style_switch_to_buffer( style_BUFFER_STATE new_buffer ) -#else -void style_switch_to_buffer( new_buffer ) -style_BUFFER_STATE new_buffer; -#endif - - { - if ( style_current_buffer == new_buffer ) - return; - - if ( style_current_buffer ) - { - /* flush out information for old buffer */ - *style_c_buf_p = style_hold_char; - style_current_buffer->style_buf_pos = style_c_buf_p; - style_current_buffer->style_n_chars = style_n_chars; - } - - style_current_buffer = new_buffer; - style_load_buffer_state(); - - /* we don't actually know whether we did this switch during - * EOF (stylewrap()) processing, but the only time this flag - * is looked at is after stylewrap() is called, so it's safe - * to go ahead and always set it. - */ - style_did_buffer_switch_on_eof = 1; - } - - -#ifdef style_USE_PROTOS -void style_load_buffer_state( void ) -#else -void style_load_buffer_state() -#endif - - { - style_n_chars = style_current_buffer->style_n_chars; - styletext = style_c_buf_p = style_current_buffer->style_buf_pos; - stylein = style_current_buffer->style_input_file; - style_hold_char = *style_c_buf_p; - } - - -#ifdef style_USE_PROTOS -style_BUFFER_STATE style_create_buffer( FILE *file, int size ) -#else -style_BUFFER_STATE style_create_buffer( file, size ) -FILE *file; -int size; -#endif - - { - style_BUFFER_STATE b; - - b = (style_BUFFER_STATE) malloc( sizeof( struct style_buffer_state ) ); - - if ( ! b ) - style_FATAL_ERROR( "out of dynamic memory in style_create_buffer()" ); - - b->style_buf_size = size; - - /* style_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->style_ch_buf = (style_CHAR *) malloc( (unsigned) (b->style_buf_size + 2) ); - - if ( ! b->style_ch_buf ) - style_FATAL_ERROR( "out of dynamic memory in style_create_buffer()" ); - - style_init_buffer( b, file ); - - return ( b ); - } - - -#ifdef style_USE_PROTOS -void style_delete_buffer( style_BUFFER_STATE b ) -#else -void style_delete_buffer( b ) -style_BUFFER_STATE b; -#endif - - { - if ( b == style_current_buffer ) - style_current_buffer = (style_BUFFER_STATE) 0; - - free( (char *) b->style_ch_buf ); - free( (char *) b ); - } - - -#ifdef style_USE_PROTOS -void style_init_buffer( style_BUFFER_STATE b, FILE *file ) -#else -void style_init_buffer( b, file ) -style_BUFFER_STATE b; -FILE *file; -#endif - - { - b->style_input_file = file; - - /* we put in the '\n' and start reading from [1] so that an - * initial match-at-newline will be true. - */ - - b->style_ch_buf[0] = '\n'; - b->style_n_chars = 1; - - /* we always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->style_ch_buf[1] = style_END_OF_BUFFER_CHAR; - b->style_ch_buf[2] = style_END_OF_BUFFER_CHAR; - - b->style_buf_pos = &b->style_ch_buf[1]; - - b->style_eof_status = EOF_NOT_SEEN; - } -# line 334 "tokenStyle.l" - - -void enter_sgmlgi_context() -{ - BEGIN sgmlgimode; -} - - -void report_error_location() -{ - if ( commentBufferContentSize > 0 ) { - cerr << commentBuffer << "\n"; - } -} - -void styleerror(char* msg) -{ -#ifdef DEBUG - cerr << "line " << stylelineno << ": " << msg << "\n"; -#endif - throw(CASTSSEXCEPT StyleSheetSyntaxError()); -} - diff --git a/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.l b/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.ll similarity index 85% rename from cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.l rename to cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.ll index 49243c70b..4bcdaa56b 100644 --- a/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.l +++ b/cde/programs/dtinfo/DtMmdb/StyleSheet/tokenStyle.ll @@ -6,13 +6,13 @@ * the Copyright Laws of the United States. USE OF A COPYRIGHT * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION * OR DISCLOSURE. - * + * * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE, * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS * INTERNATIONAL, LTD. - * + * * RESTRICTED RIGHTS LEGEND * Use, duplication, or disclosure by the Government is subject * to the restrictions as set forth in subparagraph (c)(l)(ii) @@ -22,9 +22,10 @@ * HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. * 1315 Dell Avenue * Campbell, CA 95008 - * + * */ +%option noyywrap %a 30000 %e 10000 @@ -44,9 +45,9 @@ #include "StyleSheetExceptions.h" #include "style.tab.h" #include "Debug.h" -#include +#include -extern istream *g_stylein ; +istream *g_stylein = 0; #define YY_INPUT(buf,result,max_size)\ {\ @@ -67,8 +68,6 @@ char* commentBuffer = new char [1024]; int commentBufferSize = 1024; int commentBufferContentSize = 0; -int yylineno=1; - void addToQstringBuf(const unsigned char* str, int size) { if ( size <= 0 ) return; @@ -101,7 +100,7 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][ delete [] commentBuffer; commentBufferSize = 2 * yyleng ; commentBuffer = new char [commentBufferSize]; - } + } commentBufferContentSize = yyleng-1; memcpy(commentBuffer, yytext+1, commentBufferContentSize); // copy everything except the # @@ -117,17 +116,17 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][ } [+] { - yylval.charData = yytext[0]; + stylelval.charData = yytext[0]; return(OPER_plus); } [-] { - yylval.charData = yytext[0]; + stylelval.charData = yytext[0]; return(OPER_minus); } "/" { - yylval.charData = yytext[0]; + stylelval.charData = yytext[0]; return(OPER_div); } @@ -136,7 +135,7 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][ } "*" { - yylval.charData = yytext[0]; + stylelval.charData = yytext[0]; return(OPER_star); } @@ -190,9 +189,9 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][ "=="|"!=" { if ( strcmp((const char*)yytext, "==") == 0 ) - yylval.intData = EQUAL; + stylelval.intData = EQUAL; else - yylval.intData = NOT_EQUAL; + stylelval.intData = NOT_EQUAL; return(OPER_equality); } @@ -203,15 +202,15 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][ "<="|"<"|">="|">" { if ( strcmp((const char*)yytext, "<=") == 0 ) - yylval.intData = LESS_OR_EQUAL; + stylelval.intData = LESS_OR_EQUAL; else if ( strcmp((const char*)yytext, "<") == 0 ) - yylval.intData = LESS; + stylelval.intData = LESS; else if ( strcmp((const char*)yytext, ">=") == 0 ) - yylval.intData = GREATER_OR_EQUAL; + stylelval.intData = GREATER_OR_EQUAL; else - yylval.intData = GREATER; + stylelval.intData = GREATER; return(OPER_relational); } @@ -221,38 +220,38 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][ } [Tt][Rr][Uu][Ee] { - yylval.boolData = true; + stylelval.boolData = true; return(BOOLVAL); } [Ff][Aa][Ll][Ss][Ee] { - yylval.boolData = false; + stylelval.boolData = false; return(BOOLVAL); } [On][Nn] { - yylval.boolData = true; + stylelval.boolData = true; return(BOOLVAL); } [Oo][Ff][Ff] { - yylval.boolData = false; + stylelval.boolData = false; return(BOOLVAL); } [0-9]+("."[0-9]+)?{unit} { - yylval.charPtrData = + stylelval.charPtrData = (unsigned char*)strdup((const char*)yytext); return(DIMENSION); } [0-9]+ { - yylval.intData = atoi((char*)yytext); + stylelval.intData = atoi((char*)yytext); return(INTEGER); } [0-9]+"."[0-9]+ { - yylval.realData = atof((char*)yytext); + stylelval.realData = atof((char*)yytext); return(REAL); } @@ -262,10 +261,10 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][ \" { - yylval.charPtrData = + stylelval.charPtrData = new unsigned char[qstring_buf_content_size+1]; - memcpy( yylval.charPtrData, - qstring_buf, + memcpy( stylelval.charPtrData, + qstring_buf, qstring_buf_content_size+1 ); @@ -276,7 +275,7 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][ } \\ { - int c = styleinput(); + int c = yyinput(); switch (c) { case '"': addToQstringBuf((unsigned char*)"\"", 1); @@ -298,19 +297,19 @@ unit ([Ii][Nn]|[Ii][Nn][Cc][Hh]|[Pp][Cc]|[Pp][Ii][Cc][Aa]|[Pp][Tt]|[Pp][Oo][Ii][ } {unit} { - yylval.charPtrData = + stylelval.charPtrData = (unsigned char*)strdup((const char*)yytext); return(UNIT_STRING); } [^ \t\n\".=@+*\/\.\*:?\^,{}\[\]()!]+ { - yylval.charPtrData = + stylelval.charPtrData = (unsigned char*)strdup((const char*)yytext); return(NORMAL_STRING); } [0-9a-zA-Z\.\-]+ { - yylval.charPtrData = + stylelval.charPtrData = (unsigned char*)strdup((const char*)yytext); BEGIN 0; return(SGMLGI_STRING); @@ -346,7 +345,7 @@ void report_error_location() } } -void yyerror(char* msg) +void styleerror(char* msg) { #ifdef DEBUG cerr << "line " << yylineno << ": " << msg << "\n";