34 #include <libFreeWRL.h>
39 #include "../vrml_parser/Structs.h"
40 #include "../main/headers.h"
41 #include "CParseGeneral.h"
42 #include "../scenegraph/Vector.h"
43 #include "../vrml_parser/CFieldDecls.h"
44 #include "../world_script/fieldSet.h"
45 #include "../input/InputFunctions.h"
46 #include "../input/EAIHelpers.h"
47 #include "CParseParser.h"
48 #include "CParseLexer.h"
51 void lexer_handle_EXTERNPROTO(
struct VRMLLexer *me);
54 const char* EXPOSED_EVENT_IN_PRE=
"set_";
55 const char* EXPOSED_EVENT_OUT_SUF=
"_changed";
58 #define USER_IDS_INIT_SIZE 16
61 #define MAX_IDLEN 155 //127
63 #define INITIAL_STRINGLEN 256
66 static int setLexerNextIn(
struct VRMLLexer *);
68 #define LEXER_GETINPUT(c) \
71 if(!*me->nextIn) c=setLexerNextIn(me); \
74 ccc = *(me->nextIn++);\
79 #define LEXER_UNGETINPUT(c) \
86 #define CHECK_EOF(var) \
103 for (i=0; i<LEXER_INPUT_STACK_MAX; i++) ret->startOfStringPtr[i] = NULL;
108 ret->lexerInputLevel = -1;
111 ret->userNodeNames=newStack(
struct Vector*);
112 ret->userNodeTypesStack=newStack(
int);
113 stack_push(
int, ret->userNodeTypesStack, 0);
114 ret->userNodeTypesVec=newVector(
char*, USER_IDS_INIT_SIZE);
115 ret->user_initializeOnly=newVector(
char*, USER_IDS_INIT_SIZE);
116 ret->user_inputOutput=newVector(
char*, USER_IDS_INIT_SIZE);
117 ret->user_inputOnly=newVector(
char*, USER_IDS_INIT_SIZE);
118 ret->user_outputOnly=newVector(
char*, USER_IDS_INIT_SIZE);
121 #ifdef CPARSERVERBOSE
122 printf(
"new lexer created, userNodeTypesVec is %p, user_initializeOnly is %p, user_inputOutput is %p, user_inputOnly is %p, user_outputOnly is %p\n", ret->userNodeTypesVec, ret->user_initializeOnly, ret->user_inputOutput, ret->user_inputOnly, ret->user_outputOnly);
130 #ifdef CPARSERVERBOSE
131 printf (
"deleteLexer called; deleting lexer %x %u\n",me,me);
133 FREE_IF_NZ (me->curID);
140 static int setLexerNextIn(
struct VRMLLexer *me) {
143 #ifdef CPARSERVERBOSE
144 printf (
"set lexerNextIn called \n");
147 if (me->lexerInputLevel > 0) {
148 #ifdef CPARSERVERBOSE
149 printf (
"setlexerNextIn, decrementing; deleting %x, setting nextIn to %x\n", me->startOfStringPtr[me->lexerInputLevel], me->oldNextIn[me->lexerInputLevel]);
153 if(me->startOfStringPtr[me->lexerInputLevel]){
154 if(strlen(me->startOfStringPtr[me->lexerInputLevel])){
155 FREE_IF_NZ(me->startOfStringPtr[me->lexerInputLevel]);
157 me->startOfStringPtr[me->lexerInputLevel] = NULL;
160 me->nextIn = me->oldNextIn[me->lexerInputLevel];
161 me->lexerInputLevel--;
163 retval = (int)*(me->nextIn++);
165 #ifdef CPARSERVERBOSE
166 printf (
"setLexerNextIn returning :%d:\n",retval);
174 void lexer_fromString (
struct VRMLLexer *me,
char *str) {
175 if (str!= NULL) me->isEof=(str[0]==
'\0');
176 else (me)->isEof=TRUE;
178 me->lexerInputLevel ++;
179 me->startOfStringPtr[me->lexerInputLevel]=str;
180 me->oldNextIn[me->lexerInputLevel] = me->nextIn;
182 #ifdef CPARSERVERBOSE
183 printf (
"lexer_fromString, me %x %u\n",me,me);
184 printf (
"lexer_fromString, working on level %d\n",me->lexerInputLevel);
185 printf (
"lexer_fromString, passedin char pointer is %x %u\n",str,str);
186 printf (
"lexer_fromString, saving nextin as %x\n",me->oldNextIn[me->lexerInputLevel]);
187 printf (
"lexer_fromString, input is :%s:\n",str);
192 void lexer_forceStringCleanup (
struct VRMLLexer *me) {
194 for (i=1; i<me->lexerInputLevel; i++) {
195 FREE_IF_NZ(me->startOfStringPtr[i]);
196 me->startOfStringPtr[i] = NULL;
198 #ifdef CPARSERVERBOSE
199 printf (
"lexer_forceStringCleanup, level was %d\n",me->lexerInputLevel);
202 me->lexerInputLevel = -1;
206 static void lexer_scopeOut_(
Stack*);
207 void lexer_destroyIdStack(
Stack* s)
210 while(!stack_empty(s))
212 deleteStack(
struct Vector*, s);
217 void lexer_destroyData(
struct VRMLLexer* me)
219 #define DESTROY_IDVEC(v) \
220 if(v) { int i; for(i=0; i<vectorSize(v); i++) {FREE_IF_NZ (vector_get(char*, v, i));} deleteVector(char*,v);} \
225 if(me->userNodeNames)
226 lexer_destroyIdStack(me->userNodeNames);
227 me->userNodeNames=NULL;
230 DESTROY_IDVEC(me->userNodeTypesVec)
231 if(me->userNodeTypesStack) {
232 deleteStack(
int, me->userNodeTypesStack);
233 me->userNodeTypesStack = NULL;
237 DESTROY_IDVEC(me->user_initializeOnly)
238 DESTROY_IDVEC(me->user_inputOutput)
239 DESTROY_IDVEC(me->user_inputOnly)
240 DESTROY_IDVEC(me->user_outputOnly)
245 static
void lexer_scopeIn_(
Stack** s)
248 *s=newStack(
struct Vector*);
249 stack_push(
struct Vector*, *s, newVector(
char*, USER_IDS_INIT_SIZE));
252 static void lexer_scopeOut_(
Stack* s)
255 ASSERT(!stack_empty(s));
257 for(i=0; i!=vectorSize(stack_top(
struct Vector*, s)); ++i)
258 FREE_IF_NZ (vector_get(
char*, stack_top(
struct Vector*, s), i));
259 deleteVector(
char*, stack_top(
struct Vector*, s));
260 stack_pop(
struct Vector*, s);
267 lexer_scopeIn_(&me->userNodeNames);
271 stack_push(
int, me->userNodeTypesStack, vectorSize(me->userNodeTypesVec));
276 void lexer_scopeOut(
struct VRMLLexer* me)
279 lexer_scopeOut_(me->userNodeNames);
290 void lexer_scopeOut_PROTO(
struct VRMLLexer* me)
293 while(vectorSize(me->userNodeTypesVec)>stack_top(
int, me->userNodeTypesStack))
296 FREE_IF_NZ (vector_back(
char*, me->userNodeTypesVec));
299 vector_popBack(
char*, me->userNodeTypesVec);
303 stack_pop(
int, me->userNodeTypesStack);
307 BOOL lexer_setCurID(
struct VRMLLexer* me)
310 char buf[MAX_IDLEN+1];
329 while(cur!=buf+MAX_IDLEN)
331 ASSERT(cur<buf+MAX_IDLEN);
339 parseError("ID buffer length hit! File must end with \n");
342 ASSERT(cur<=buf+MAX_IDLEN);
345 ASSERT(strlen(buf)==(cur-buf));
347 me->curID=MALLOC(
char *, sizeof(
char)*(cur-buf+1));
349 strcpy(me->curID, buf);
351 #ifdef CPARSERVERBOSE
352 printf (
"lexer_setCurID, got %s\n",me->curID);
359 BOOL lexer_keyword(
struct VRMLLexer* me,
int kw) {
360 if(!lexer_setCurID(me))
return FALSE;
363 if(!strcmp(me->curID, KEYWORDS[kw])) {
364 FREE_IF_NZ (me->curID);
371 int lexer_string2id(
const char* str,
const struct Vector* v)
376 for(i=0; i!=vectorSize(v); ++i) {
378 if(!strcmp(str, vector_get(
const char*, v, i)))
390 BOOL lexer_specialID(
struct VRMLLexer* me,
int* retB,
int* retU,
391 const char** builtIn,
const int builtInCount,
struct Vector* user)
394 if(!lexer_setCurID(me))
398 #ifdef CPARSERVERBOSE
399 printf(
"lexer_specialID looking for %s\n", me->curID);
402 if(lexer_specialID_string(me, retB, retU, builtIn, builtInCount, user, me->curID)) {
403 FREE_IF_NZ (me->curID);
413 BOOL lexer_specialID_string(
struct VRMLLexer* me,
int* retB,
int* retU,
414 const char** builtIn,
const int builtInCount,
415 struct Vector* user,
const char* str)
421 #ifdef CPARSERVERBOSE
422 printf (
"lexer_specialID_string, builtInCount %d, builtIn %u\n",builtInCount, builtIn);
429 if(retB) *retB=ID_UNDEFINED;
430 if(retU) *retU=ID_UNDEFINED;
434 for(i=0; i!=builtInCount; ++i) {
436 if(!strcmp(str, builtIn[i])) {
437 #ifdef CPARSERVERBOSE
438 printf(
"found ID %s matches %s, return retB %d\n", str, builtIn[i], i);
441 if (builtIn == PROTOKEYWORDS) {
443 case PKW_eventIn: i = PKW_inputOnly;
break;
444 case PKW_eventOut: i= PKW_outputOnly;
break;
445 case PKW_exposedField: i= PKW_inputOutput;
break;
446 case PKW_field: i= PKW_initializeOnly;
break;
449 #ifdef CPARSERVERBOSE
450 printf(
"CONVERTED - found ID %s matches %s, return retB %d\n", str, builtIn[i], i);
481 for (ind= (
int)vectorSize(user)-1; ind>=0; ind--) {
491 if(!strcmp(str, vector_get(
char*, user, i))) {
492 #ifdef CPARSERVERBOSE
493 printf(
"found ID %s matches %s, return retU %d\n", str, vector_get(
char*, user, i), i);
511 BOOL lexer_defineID(
struct VRMLLexer* me,
int* ret,
struct Vector* vec, BOOL multi) {
514 if(!lexer_setCurID(me))
518 #ifdef CPARSERVERBOSE
519 printf (
"lexer_defineID, VRMLLexer %u Vector %u\n",me,vec);
520 if (multi) printf (
"Multi SET\n");
else printf (
"no Mlti set\n");
530 for(i=0; i!=vectorSize(vec); ++i) {
532 #ifdef CPARSERVERBOSE
533 printf (
"lexer_defineID, comparing %s to %s\n",me->curID, vector_get(
const char*, vec, i));
536 if(!strcmp(me->curID, vector_get(
const char*, vec, i))) {
537 FREE_IF_NZ (me->curID);
544 if (gglobal()->internalc.global_strictParsing) {
546 for(i=0; i!=vectorSize(vec); ++i) {
547 if(!strcmp(me->curID, vector_get(
const char*, vec, i))) {
548 ConsoleMessage (
"warning, duplicate ID (%s at %u), using last DEF",me->curID,i);
557 *ret=vectorSize(vec);
558 #ifdef CPARSERVERBOSE
559 printf(
"lexer_defineID: adding %s to vector %p\n", me->curID, vec);
562 vector_pushBack(
char*, vec, me->curID);
583 int* rBO,
int* rBE,
int* rUO,
int* rUE,
591 const char** userArr;
594 if(routedToFrom==ROUTED_FIELD_EVENT_IN)
597 uarr=me->user_inputOnly;
599 arrCnt=EVENT_IN_COUNT;
603 uarr=me->user_outputOnly;
605 arrCnt=EVENT_OUT_COUNT;
609 if (me->curID == NULL)
610 if(!lexer_setCurID(me)) {
616 #ifdef CPARSERVERBOSE
617 printf(
"lexer_event: looking for %s\n", me->curID);
621 userArr=&vector_get(
const char*, uarr, 0);
622 userCnt=vectorSize(uarr);
628 *rBO=findRoutedFieldInARR(routedNode, me->curID, routedToFrom, arr, arrCnt,
634 *rUO=findRoutedFieldInARR(routedNode, me->curID, routedToFrom,
635 userArr, userCnt, TRUE);
639 found=((rBO && *rBO!=ID_UNDEFINED) || (rUO && *rUO!=ID_UNDEFINED));
641 #ifdef CPARSERVERBOSE
642 if (rBO && *rBO != ID_UNDEFINED)
643 printf(
"lexer_event: found in EVENT_IN/EVENT_OUT\n");
645 if (rUO && *rUO != ID_UNDEFINED)
646 printf(
"lexer_event: found in user_inputOnly/user_outputOnly\n");
650 userArr=&vector_get(
const char*, me->user_inputOutput, 0);
651 userCnt=vectorSize(me->user_inputOutput);
658 *rBE=findRoutedFieldInEXPOSED_FIELD(routedNode, me->curID, routedToFrom);
663 *rUE=findRoutedFieldInARR(routedNode, me->curID, routedToFrom,
664 userArr, userCnt, TRUE);
668 found=((rBE && *rBE!=ID_UNDEFINED) || (rUE && *rUE!=ID_UNDEFINED));
670 #ifdef CPARSERVERBOSE
671 if (rBE && *rBE != ID_UNDEFINED)
672 printf(
"lexer_event: found in EXPOSED_FIELD\n");
674 if (rUE && *rUE != ID_UNDEFINED)
675 printf(
"lexer_event: found in user_inputOutput\n");
679 FREE_IF_NZ(me->curID);
692 int* retBO,
int* retBE,
int* retUO,
int* retUE)
694 const char** userArr;
700 if(!lexer_setCurID(me))
705 userArr=&vector_get(
const char*, me->user_initializeOnly, 0);
706 userCnt=vectorSize(me->user_initializeOnly);
708 #ifdef CPARSERVERBOSE
709 printf(
"lexer_field: looking for %s\n", me->curID);
714 *retBO=findFieldInFIELD(me->curID);
719 *retUO=findFieldInARR(me->curID, userArr, userCnt);
723 found=((retBO && *retBO!=ID_UNDEFINED) || (retUO && *retUO!=ID_UNDEFINED));
726 userArr=&vector_get(
const char*, me->user_inputOutput, 0);
727 userCnt=vectorSize(me->user_inputOutput);
732 *retBE=findFieldInEXPOSED_FIELD(me->curID);
737 *retUE=findFieldInARR(me->curID, userArr, userCnt);
741 found=((retBE && *retBE!=ID_UNDEFINED) || (retUE && *retUE!=ID_UNDEFINED));
743 #ifdef CPARSERVERBOSE
744 if (retBO && *retBO != ID_UNDEFINED)
745 printf(
"lexer_field: found field in FIELDNAMES\n");
746 if (retUO && *retUO != ID_UNDEFINED)
747 printf(
"lexer_field: found field in me->user_initializeOnly\n");
748 if (retBE && *retBE != ID_UNDEFINED)
749 printf(
"lexer_field: found field in EXPOSED_FIELD\n");
750 if (retUE && *retUE != ID_UNDEFINED)
751 printf(
"lexer_field: found field in me->user_inputOutput\n");
756 FREE_IF_NZ (me->curID);
765 const char* lexer_stringUser_fieldName(
struct VRMLLexer* me,
int name,
int mode)
767 #define OOB_RETURN_VAL "__UNDEFINED__"
771 case PKW_initializeOnly:
772 if (name>vectorSize(me->user_initializeOnly))
return OOB_RETURN_VAL;
773 return lexer_stringUser_initializeOnly(me, name);
774 case PKW_inputOutput:
775 if (name>vectorSize(me->user_inputOutput))
return OOB_RETURN_VAL;
776 return lexer_stringUser_inputOutput(me, name);
778 if (name>vectorSize(me->user_inputOnly))
return OOB_RETURN_VAL;
779 return lexer_stringUser_inputOnly(me, name);
781 if (name>vectorSize(me->user_outputOnly))
return OOB_RETURN_VAL;
782 return lexer_stringUser_outputOnly(me, name);
785 return OOB_RETURN_VAL;
793 if(me->curID)
return;
815 }
while(c!=
'\n' && c!=
'\r' && c!=EOF);
833 #define NUMBER_PROCESS_SIGN_GENERAL(addCheck) \
836 if(c=='-' || c=='+') \
839 if(!(c>='0' && c<='9') addCheck) \
841 LEXER_UNGETINPUT(c) \
848 #define NUMBER_PROCESS_SIGN_INT \
849 NUMBER_PROCESS_SIGN_GENERAL(&& TRUE)
851 #define NUMBER_PROCESS_SIGN_INT \
852 NUMBER_PROCESS_SIGN_GENERAL()
854 #define NUMBER_PROCESS_SIGN_FLOAT \
855 NUMBER_PROCESS_SIGN_GENERAL(&& c!='.')
858 #define RETURN_NUMBER_WITH_SIGN \
865 BOOL lexer_int32(
struct VRMLLexer* me, vrmlInt32T* ret)
870 if(me->curID)
return FALSE;
876 if(c!='-' && c!='+' && !(c>='0' && c<='9'))
883 NUMBER_PROCESS_SIGN_INT
900 else if(c>=
'A' && c<=
'F')
902 else if(c>=
'a' && c<=
'f')
908 ASSERT(!(*ret%0x10));
911 RETURN_NUMBER_WITH_SIGN
918 if(!(c>=
'0' && c<=
'9'))
927 RETURN_NUMBER_WITH_SIGN
930 BOOL lexer_float(struct
VRMLLexer* me, vrmlFloatT* ret)
938 if(me->curID)
return FALSE;
944 if(c!='-' && c!='+' && c!='.' && !(c>='0' && c<='9'))
951 NUMBER_PROCESS_SIGN_FLOAT
956 decimalFact=(
float) 0.1;
959 if(c==
'.' && !afterPoint)
961 else if(c>=
'0' && c<=
'9')
964 *ret+=decimalFact*(c-
'0');
1011 *ret*=(float)(pow(10, exp));
1015 RETURN_NUMBER_WITH_SIGN
1019 BOOL lexer_double(struct
VRMLLexer* me, vrmlDoubleT* ret)
1027 if(me->curID)
return FALSE;
1033 if(c!='-' && c!='+' && c!='.' && !(c>='0' && c<='9'))
1040 NUMBER_PROCESS_SIGN_FLOAT
1048 if(c==
'.' && !afterPoint)
1050 else if(c>=
'0' && c<=
'9')
1053 *ret+=decimalFact*(c-
'0');
1074 if(c==
'e' || c==
'E')
1082 if(c=='-' || c=='+')
1088 if(c>=
'0' && c<=
'9')
1100 *ret*=(pow(10, exp));
1104 RETURN_NUMBER_WITH_SIGN
1111 int bufLen=INITIAL_STRINGLEN;
1114 if(me->curID)
return FALSE;
1127 buf=MALLOC(
char *, sizeof(*buf)*bufLen);
1137 buf=REALLOC(buf,
sizeof(*buf)*bufLen);
1139 ASSERT(cur+1<bufLen);
1147 parseError(
"String literal not closed at all!");
1149 goto breakStringLoop;
1156 parseError(
"String literal not closed at all!");
1157 goto breakStringLoop;
1170 *ret=newASCIIString(buf);
1178 BOOL lexer_operator(
struct VRMLLexer* me,
char op)
1183 ConsoleMessage (
"lexer_operator: did not expect to find a text string - it is \"%s\" - as I am looking for a \'%c\'\n",me->curID,op);
1184 FREE_IF_NZ(me->curID);
1196 LEXER_UNGETINPUT(c);
1205 #define PARSE_ERROR(msg) \
1211 #define FIND_PROTO_IN_proto_BUFFER \
1213 proto = strstr (proto,"PROTO"); \
1214 if (proto == NULL) \
1215 PARSE_ERROR ("EXTERNPROTO does not contain a PROTO!"); \
1216 if (*(proto-1) != 'N') { \
1224 char fw_outline[2000];
1227 if(!lexer_openSquare(me)) {
1229 if(!lexer_sfstringValue(me, (
void*)ret->p))
1237 while(!lexer_closeSquare(me)) {
1239 if(!lexer_sfstringValue (me, &val)) {
1241 strcpy (fw_outline,
"ERROR:Expected \"]\" before end of EXTERNPROTO URL value, found \"");
1242 if (me->curID != ((
void *)0))
1243 strcat (fw_outline, me->curID);
1245 strcat (fw_outline,
"(EOF)");
1246 strcat (fw_outline,
"\" ");
1247 ConsoleMessage(fw_outline);
1248 fprintf (stderr,
"%s\n",fw_outline);
1255 ret->n=vectorSize(vec);
1263 void embedEXTERNPROTO(
struct VRMLLexer *me,
const char *myName,
char *buffer,
char *pound) {
1265 char *externProtoPointer;
1273 while (*cp !=
'\0') {
1281 }
while((*cp!=
'\n') && (*cp!=
'\r') && (*cp!=
'\0'));
1289 if (pound != NULL) {
1295 FIND_PROTO_IN_proto_BUFFER
1298 proto +=
sizeof (
"PROTO");
1299 while ((*proto <=
' ') && (*proto !=
'\0')) proto++;
1301 }
while (strncmp(pound,proto,strlen(pound)) != 0);
1305 FIND_PROTO_IN_proto_BUFFER
1310 cp = strchr(proto,
'[');
1311 if (cp != NULL) proto = cp;
1316 foundBracket = FALSE;
1318 if (*cp ==
'{') {curlscount++; foundBracket = TRUE;}
1319 if (*cp ==
'}') curlscount--;
1322 PARSE_ERROR (
"brackets missing in EXTERNPROTO");
1324 }
while (!foundBracket || (curlscount > 0));
1330 externProtoPointer = MALLOC (
char *,
sizeof (
char) * (strlen (proto)+strlen(myName) +40));
1331 externProtoPointer[0]=
'\0';
1332 strcat (externProtoPointer,
"PROTO ");
1333 strcat (externProtoPointer,myName);
1334 strcat (externProtoPointer,
" ");
1335 strcat (externProtoPointer,proto);
1340 lexer_fromString(me,externProtoPointer);
1346 void lexer_handle_EXTERNPROTO(
struct VRMLLexer *me) {
1347 #ifdef HAD_RESOURCE_LOAD
1348 char *myName = NULL;
1357 if (lexer_setCurID(me)) {
1359 #ifdef HAD_RESOURCE_LOAD
1360 myName = STRDUP(me->curID);
1362 FREE_IF_NZ(me->curID);
1364 PARSE_ERROR (
"EXTERNPROTO - expected a PROTO name\n");
1369 if (!lexer_openSquare(me))
1370 PARSE_ERROR (
"EXTERNPROTO - expected a '['");
1377 while (lexer_protoFieldMode(me, &mode)) {
1380 if(!lexer_fieldType(me, &type))
1381 PARSE_ERROR(
"Expected fieldType after proto-field keyword!")
1386 if (lexer_setCurID(me)) {
1388 FREE_IF_NZ(me->curID);
1390 PARSE_ERROR (
"EXTERNPROTO - expected a PROTO name\n");
1395 if (!lexer_closeSquare(me))
1396 PARSE_ERROR (
"EXTERNPROTO - expected a ']'");
1399 if (!lexer_EXTERNPROTO_mfstringValue(me,&url)) {
1400 PARSE_ERROR (
"EXTERNPROTO - problem reading URL string");
1403 res = resource_create_multi(&url);
1408 resource_identify((
resource_item_t*)gglobal()->resources.root_res, res);
1410 if (res->type != rest_invalid) {
1411 #ifdef HAD_RESOURCE_LOAD
1412 if (resource_fetch(res)) {
1413 unsigned char *buffer;
1415 pound = strchr(res->URLrequest,
'#');
1416 if (resource_load(res)) {
1419 l = res->openned_files;
1421 buffer = of->fileData;
1422 embedEXTERNPROTO(me, myName, (
char *)buffer, pound);
1426 res->status = ress_failed;
1427 printf(
"externProto not currently supported\n");
1431 if (res->status == ress_loaded) {
1433 res->status = ress_parsed;
1434 res->complete = TRUE;
1448 void skipToEndOfOpenCurly(
struct VRMLLexer *me,
int level) {
1452 #ifdef CPARSELEXERVERBOSE
1453 if (level == 0) printf (
"start of skipToEndOfOpenCurly, have :%s:\n",me->nextIn);
1456 while ((curlyCount > 0) && (*me->nextIn !=
'\0')) {
1458 #ifdef CPARSELEXERVERBOSE
1459 printf (
"cc %d, looking at :%c:\n",curlyCount,*me->nextIn);
1462 if (*me->nextIn ==
'{') curlyCount++;
1463 else if (*me->nextIn ==
'}') curlyCount--;
1464 if (lexer_string(me,&tmpstring)) {
1465 #ifdef CPARSELEXERVERBOSE
1466 printf (
"after string, :%s:\n",me->nextIn);
1467 printf (
"and string :%s:\n",tmpstring->strptr);
1470 FREE_IF_NZ(tmpstring->strptr);
1476 #ifdef CPARSELEXERVERBOSE
1477 if (level == 0) printf (
"returning from skipToEndOfOpenCurly nextIn :%s:\n",me->nextIn);
1482 void concatAndGiveToLexer(
struct VRMLLexer *me,
const char *str_a,
const char *str_b) {
1486 if (str_a != NULL) len_a = (int) strlen(str_a);
1487 if (str_b != NULL) len_b = (int) strlen(str_b);
1489 if ((len_a == 0) & (len_b == 0)) {
1490 printf (
"concatAndGiveToLexer, no input!\n");
1494 newstring = MALLOC(
char *,
sizeof (
char) * (len_a + len_b +10));
1495 newstring[0] =
'\0';
1496 if (len_a != 0) strcat (newstring,str_a);
1497 if (len_b != 0) strcat (newstring,str_b);
1500 lexer_fromString(me,newstring);