Skip to content
Snippets Groups Projects
Commit 4cd92eab authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

Functions are added in the Parser

parent 7d07cc81
No related branches found
No related tags found
No related merge requests found
# $Id: Makefile,v 1.13 2000-12-06 22:25:24 geuzaine Exp $
# $Id: Makefile,v 1.14 2000-12-07 16:03:43 remacle Exp $
# ----------------------------------------------------------------------
# Makefile for Gmsh
# ----------------------------------------------------------------------
......@@ -21,8 +21,8 @@
MESA_STATIC_LIB = $(HOME)/SOURCES/Mesa-3.0-static/lib/libGLw.a\
$(HOME)/SOURCES/Mesa-3.0-static/lib/libGLU.a\
$(HOME)/SOURCES/Mesa-3.0-static/lib/libGL.a
// MOTIF_LIB = /usr/local/lib/libXm.so.2
MOTIF_LIB = -L/usr/local/lib -L/usr/X11R6/LessTif/Motif1.2/lib -lXm
MOTIF_LIB = /usr/local/lib/libXm.so.2
// MOTIF_LIB = -L/usr/local/lib -L/usr/X11R6/LessTif/Motif1.2/lib -lXm
X_LIB = -L/usr/X11R6/lib -lXt -lX11 -lXext
THREAD_LIB = -L/usr/lib -lpthread
......
%{ /* $Id: Gmsh.l,v 1.13 2000-12-07 09:21:33 geuzaine Exp $ */
%{ /* $Id: Gmsh.l,v 1.14 2000-12-07 16:03:43 remacle Exp $ */
#include <stdio.h>
#include <stdlib.h>
......@@ -182,9 +182,11 @@ With return tWith;
For return tFor;
EndFor return tEndFor;
Script return tScript;
Exit return tExit;
Merge return tMerge;
Function return tFunction;
Return return tReturn;
Call return tCall;
SS return tScalarTetrahedron;
VS return tVectorTetrahedron;
......@@ -309,3 +311,42 @@ void skipline(void)
while (yyinput() != '\n') ;
}
void skip_until(char *until)
{
int l = strlen(until);
char chars[256];
while(1)
{
while (1)
{
chars[0] = yyinput();
if(chars[0] == EOF)
{
fprintf(stderr, "Error, Unexpected End Of File\n") ;
exit(1);
}
if(chars[0] == until[0])break;
}
printf("%c",chars[0]);
for(int i=1;i<l;i++)
{
chars[i] = yyinput();
if(chars[i] == EOF)
{
fprintf(stderr, "Error, Unexpected End Of File\n") ;
exit(1);
}
}
chars[l] = '\0';
if(!strcmp(chars,until))
{
return;
}
for(int i=1;i<l-1;i++)
{
unput(chars[l-i]);
}
}
}
This diff is collapsed.
......@@ -7,161 +7,164 @@ typedef union {
Shape s;
List_T *l;
} YYSTYPE;
#define tDOUBLE 258
#define tSTRING 259
#define tBIGSTR 260
#define tEND 261
#define tAFFECT 262
#define tDOTS 263
#define tPi 264
#define tExp 265
#define tLog 266
#define tLog10 267
#define tSqrt 268
#define tSin 269
#define tAsin 270
#define tCos 271
#define tAcos 272
#define tTan 273
#define tAtan 274
#define tAtan2 275
#define tSinh 276
#define tCosh 277
#define tTanh 278
#define tFabs 279
#define tFloor 280
#define tCeil 281
#define tFmod 282
#define tModulo 283
#define tHypot 284
#define tPrintf 285
#define tDraw 286
#define tSleep 287
#define tPoint 288
#define tCircle 289
#define tEllipsis 290
#define tLine 291
#define tSurface 292
#define tSpline 293
#define tVolume 294
#define tCharacteristic 295
#define tLength 296
#define tParametric 297
#define tElliptic 298
#define tPlane 299
#define tRuled 300
#define tTransfinite 301
#define tComplex 302
#define tPhysical 303
#define tUsing 304
#define tBump 305
#define tProgression 306
#define tRotate 307
#define tTranslate 308
#define tSymmetry 309
#define tDilate 310
#define tExtrude 311
#define tDuplicata 312
#define tLoop 313
#define tInclude 314
#define tRecombine 315
#define tDelete 316
#define tCoherence 317
#define tView 318
#define tAttractor 319
#define tLayers 320
#define tScalarTetrahedron 321
#define tVectorTetrahedron 322
#define tTensorTetrahedron 323
#define tScalarTriangle 324
#define tVectorTriangle 325
#define tTensorTriangle 326
#define tScalarLine 327
#define tVectorLine 328
#define tTensorLine 329
#define tScalarPoint 330
#define tVectorPoint 331
#define tTensorPoint 332
#define tBSpline 333
#define tNurbs 334
#define tOrder 335
#define tWith 336
#define tBounds 337
#define tKnots 338
#define tColor 339
#define tFor 340
#define tEndFor 341
#define tScript 342
#define tExit 343
#define tMerge 344
#define tB_SPLINE_SURFACE_WITH_KNOTS 345
#define tB_SPLINE_CURVE_WITH_KNOTS 346
#define tCARTESIAN_POINT 347
#define tTRUE 348
#define tFALSE 349
#define tUNSPECIFIED 350
#define tU 351
#define tV 352
#define tEDGE_CURVE 353
#define tVERTEX_POINT 354
#define tORIENTED_EDGE 355
#define tPLANE 356
#define tFACE_OUTER_BOUND 357
#define tEDGE_LOOP 358
#define tADVANCED_FACE 359
#define tVECTOR 360
#define tDIRECTION 361
#define tAXIS2_PLACEMENT_3D 362
#define tISO 363
#define tENDISO 364
#define tENDSEC 365
#define tDATA 366
#define tHEADER 367
#define tFILE_DESCRIPTION 368
#define tFILE_SCHEMA 369
#define tFILE_NAME 370
#define tMANIFOLD_SOLID_BREP 371
#define tCLOSED_SHELL 372
#define tADVANCED_BREP_SHAPE_REPRESENTATION 373
#define tFACE_BOUND 374
#define tCYLINDRICAL_SURFACE 375
#define tCONICAL_SURFACE 376
#define tCIRCLE 377
#define tTRIMMED_CURVE 378
#define tGEOMETRIC_SET 379
#define tCOMPOSITE_CURVE_SEGMENT 380
#define tCONTINUOUS 381
#define tCOMPOSITE_CURVE 382
#define tTOROIDAL_SURFACE 383
#define tPRODUCT_DEFINITION 384
#define tPRODUCT_DEFINITION_SHAPE 385
#define tSHAPE_DEFINITION_REPRESENTATION 386
#define tELLIPSE 387
#define tTrimmed 388
#define tSolid 389
#define tEndSolid 390
#define tVertex 391
#define tFacet 392
#define tNormal 393
#define tOuter 394
#define tLoopSTL 395
#define tEndLoop 396
#define tEndFacet 397
#define tAND 398
#define tOR 399
#define tNOTEQUAL 400
#define tEQUAL 401
#define tAPPROXEQUAL 402
#define tAFFECTPLUS 403
#define tAFFECTMINUS 404
#define tAFFECTTIMES 405
#define tAFFECTDIVIDE 406
#define tLESSOREQUAL 407
#define tGREATEROREQUAL 408
#define tCROSSPRODUCT 409
#define UNARYPREC 410
#define tPLUSPLUS 411
#define tMINUSMINUS 412
#define tDOUBLE 257
#define tSTRING 258
#define tBIGSTR 259
#define tEND 260
#define tAFFECT 261
#define tDOTS 262
#define tPi 263
#define tExp 264
#define tLog 265
#define tLog10 266
#define tSqrt 267
#define tSin 268
#define tAsin 269
#define tCos 270
#define tAcos 271
#define tTan 272
#define tAtan 273
#define tAtan2 274
#define tSinh 275
#define tCosh 276
#define tTanh 277
#define tFabs 278
#define tFloor 279
#define tCeil 280
#define tFmod 281
#define tModulo 282
#define tHypot 283
#define tPrintf 284
#define tDraw 285
#define tSleep 286
#define tPoint 287
#define tCircle 288
#define tEllipsis 289
#define tLine 290
#define tSurface 291
#define tSpline 292
#define tVolume 293
#define tCharacteristic 294
#define tLength 295
#define tParametric 296
#define tElliptic 297
#define tPlane 298
#define tRuled 299
#define tTransfinite 300
#define tComplex 301
#define tPhysical 302
#define tUsing 303
#define tBump 304
#define tProgression 305
#define tRotate 306
#define tTranslate 307
#define tSymmetry 308
#define tDilate 309
#define tExtrude 310
#define tDuplicata 311
#define tLoop 312
#define tInclude 313
#define tRecombine 314
#define tDelete 315
#define tCoherence 316
#define tView 317
#define tAttractor 318
#define tLayers 319
#define tScalarTetrahedron 320
#define tVectorTetrahedron 321
#define tTensorTetrahedron 322
#define tScalarTriangle 323
#define tVectorTriangle 324
#define tTensorTriangle 325
#define tScalarLine 326
#define tVectorLine 327
#define tTensorLine 328
#define tScalarPoint 329
#define tVectorPoint 330
#define tTensorPoint 331
#define tBSpline 332
#define tNurbs 333
#define tOrder 334
#define tWith 335
#define tBounds 336
#define tKnots 337
#define tColor 338
#define tFor 339
#define tEndFor 340
#define tScript 341
#define tExit 342
#define tMerge 343
#define tReturn 344
#define tCall 345
#define tFunction 346
#define tB_SPLINE_SURFACE_WITH_KNOTS 347
#define tB_SPLINE_CURVE_WITH_KNOTS 348
#define tCARTESIAN_POINT 349
#define tTRUE 350
#define tFALSE 351
#define tUNSPECIFIED 352
#define tU 353
#define tV 354
#define tEDGE_CURVE 355
#define tVERTEX_POINT 356
#define tORIENTED_EDGE 357
#define tPLANE 358
#define tFACE_OUTER_BOUND 359
#define tEDGE_LOOP 360
#define tADVANCED_FACE 361
#define tVECTOR 362
#define tDIRECTION 363
#define tAXIS2_PLACEMENT_3D 364
#define tISO 365
#define tENDISO 366
#define tENDSEC 367
#define tDATA 368
#define tHEADER 369
#define tFILE_DESCRIPTION 370
#define tFILE_SCHEMA 371
#define tFILE_NAME 372
#define tMANIFOLD_SOLID_BREP 373
#define tCLOSED_SHELL 374
#define tADVANCED_BREP_SHAPE_REPRESENTATION 375
#define tFACE_BOUND 376
#define tCYLINDRICAL_SURFACE 377
#define tCONICAL_SURFACE 378
#define tCIRCLE 379
#define tTRIMMED_CURVE 380
#define tGEOMETRIC_SET 381
#define tCOMPOSITE_CURVE_SEGMENT 382
#define tCONTINUOUS 383
#define tCOMPOSITE_CURVE 384
#define tTOROIDAL_SURFACE 385
#define tPRODUCT_DEFINITION 386
#define tPRODUCT_DEFINITION_SHAPE 387
#define tSHAPE_DEFINITION_REPRESENTATION 388
#define tELLIPSE 389
#define tTrimmed 390
#define tSolid 391
#define tEndSolid 392
#define tVertex 393
#define tFacet 394
#define tNormal 395
#define tOuter 396
#define tLoopSTL 397
#define tEndLoop 398
#define tEndFacet 399
#define tAND 400
#define tOR 401
#define tNOTEQUAL 402
#define tEQUAL 403
#define tAPPROXEQUAL 404
#define tAFFECTPLUS 405
#define tAFFECTMINUS 406
#define tAFFECTTIMES 407
#define tAFFECTDIVIDE 408
#define tLESSOREQUAL 409
#define tGREATEROREQUAL 410
#define tCROSSPRODUCT 411
#define UNARYPREC 412
#define tPLUSPLUS 413
#define tMINUSMINUS 414
extern YYSTYPE yylval;
%{ /* $Id: Gmsh.y,v 1.25 2000-12-07 09:21:34 geuzaine Exp $ */
%{ /* $Id: Gmsh.y,v 1.26 2000-12-07 16:03:44 remacle Exp $ */
#include <stdarg.h>
......@@ -16,6 +16,7 @@
#include "Colors.h"
#include "Parser.h"
#include "Main.h"
#include "FunctionManager.h"
#ifdef __DECCXX // bug in bison
#include <alloca.h>
......@@ -86,6 +87,7 @@ void vyyerror (char *fmt, ...);
%token tScalarPoint tVectorPoint tTensorPoint
%token tBSpline tNurbs tOrder tWith tBounds tKnots
%token tColor tFor tEndFor tScript tExit tMerge
%token tReturn tCall tFunction
%token tB_SPLINE_SURFACE_WITH_KNOTS
%token tB_SPLINE_CURVE_WITH_KNOTS
......@@ -1737,7 +1739,31 @@ Loop :
ImbricatedLoop--;
}
}
| tReturn
{
if(!FunctionManager::Instance()->leaveFunction(&yyin))
{
vyyerror("Error while exiting function");
}
}
| tCall tSTRING tEND
{
if(!FunctionManager::Instance()->enterFunction($2,&yyin))
{
vyyerror("Unknown Function %s",$2);
}
}
| tFunction tSTRING
{
// skip everything until return is found
if(!FunctionManager::Instance()->createFunction($2,yyin))
{
vyyerror("Redefinition of function %s",$2);
}
void skip_until(char *until);
skip_until("Return");
}
;
/* ---------------
S C R I P T
---------------
......
This diff is collapsed.
# $Id: Makefile,v 1.6 2000-12-07 08:46:27 geuzaine Exp $
# $Id: Makefile,v 1.7 2000-12-07 16:03:44 remacle Exp $
#
# Makefile for "libParser.a"
#
......@@ -23,7 +23,8 @@ INCLUDE = -I../includes -I../Common -I../DataStr -I../Geo -I../Graphics\
CFLAGS = $(C_FLAGS) $(OS_FLAGS) $(INCLUDE)
SRC = Gmsh.yy.cpp \
Gmsh.tab.cpp
Gmsh.tab.cpp\
FunctionManager.cpp
OBJ = $(SRC:.cpp=.o)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment