[396] | 1 | /******************************************************************************/ |
---|
| 2 | /* */ |
---|
| 3 | /* CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran) */ |
---|
| 4 | /* */ |
---|
| 5 | /* Copyright (C) 2005 Laurent Debreu (Laurent.Debreu@imag.fr) */ |
---|
| 6 | /* Cyril Mazauric (Cyril.Mazauric@imag.fr) */ |
---|
| 7 | /* */ |
---|
| 8 | /* This program is free software; you can redistribute it and/or modify */ |
---|
| 9 | /* it */ |
---|
| 10 | /* */ |
---|
| 11 | /* This program is distributed in the hope that it will be useful, */ |
---|
| 12 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
---|
| 13 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
---|
| 14 | /* GNU General Public License for more details. */ |
---|
| 15 | /* */ |
---|
| 16 | /******************************************************************************/ |
---|
| 17 | %s character |
---|
| 18 | %{ |
---|
| 19 | #include <math.h> |
---|
| 20 | #include <stdlib.h> |
---|
| 21 | #include <string.h> |
---|
| 22 | int line_num=1; |
---|
| 23 | extern FILE * yyin; |
---|
| 24 | #define MAX_INCLUDE_DEPTH 30 |
---|
| 25 | YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; |
---|
| 26 | %} |
---|
| 27 | |
---|
| 28 | COMMENT "%" |
---|
| 29 | SEPARATEUR "::" |
---|
| 30 | NIMPORTEQUOI . |
---|
| 31 | COMMENTAIRES1 {COMMENT}{NIMPORTEQUOI}*{COMMENT} |
---|
| 32 | PROBTYPE "1D"|"2D"|"3D" |
---|
| 33 | USEITEM "FIXED_GRIDS"|"ONLY_FIXED_GRIDS"|"DEBUG" |
---|
| 34 | NAME [a-zA-Z\_][a-zA-Z0-9\_]* |
---|
| 35 | DIGIT [0-9]+ |
---|
| 36 | NUM {DIGIT} |
---|
| 37 | NEXTLINE \n+[ \t]+"$"|\n+[ \t]+"&" |
---|
| 38 | FILENAME {NAME}"."{NAME} |
---|
| 39 | %% |
---|
| 40 | regridding return TOK_REGRIDDING; /* period of regridding */ |
---|
| 41 | coeffrefx return TOK_COEFFRAFX; /* space refinement in the x direction */ |
---|
| 42 | coeffrefy return TOK_COEFFRAFY; /* space refinement in the y direction */ |
---|
| 43 | coeffrefz return TOK_COEFFRAFZ; /* space refinement in the z direction */ |
---|
| 44 | coeffreftx return TOK_COEFFRAFTX; /* time refinement in the x direction */ |
---|
| 45 | coeffrefty return TOK_COEFFRAFTY; /* time refinement in the y direction */ |
---|
| 46 | coeffreftz return TOK_COEFFRAFTZ; /* time refinement in the z direction */ |
---|
| 47 | parammodule return TOK_MODULEMAIN; /* name of the module */ |
---|
| 48 | efficiency return TOK_EFFICIENCY; /* efficiency for the adaptive refinement */ |
---|
| 49 | rafmax return TOK_RAFMAX; /* minimum size in all directions */ |
---|
| 50 | rafmaxx return TOK_RAFMAXX; /* minimum size in x direction */ |
---|
| 51 | rafmaxy return TOK_RAFMAXY; /* minimum size in y direction */ |
---|
| 52 | rafmaxz return TOK_RAFMAXZ; /* minimum size in z direction */ |
---|
| 53 | notgriddep return TOK_NOTGRIDDEP; /* variable which are not grid dependent */ |
---|
| 54 | use return TOK_USE; |
---|
| 55 | minwidth return TOK_MINWIDTH; /* minimum width of rectangles for the */ |
---|
| 56 | /* adaptive refinement */ |
---|
| 57 | {COMMENTAIRES1} {} |
---|
| 58 | {SEPARATEUR} return TOK_SEP; |
---|
| 59 | {FILENAME} {strcpy(yylval.na,yytext); return TOK_FILENAME;} |
---|
| 60 | {USEITEM} {strcpy(yylval.na,yytext); return TOK_USEITEM;} |
---|
| 61 | {PROBTYPE} {strcpy(yylval.na,yytext); return TOK_PROBTYPE;} |
---|
| 62 | /* dimension of the problem */ |
---|
| 63 | {NAME} {strcpy(yylval.na,yytext); return TOK_NAME;} |
---|
| 64 | {NUM} {yylval.ival=atoi(yytext); return TOK_NUM;} |
---|
| 65 | ;|\,|\(|\)|:|\[|\] {return (int) *yytext;} |
---|
| 66 | \n {line_num++;return (int) *yytext;} |
---|
| 67 | [ \t]+ ; |
---|
| 68 | %% |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | int yywrap() |
---|
| 72 | { |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | yyerror(char *s) |
---|
| 77 | { |
---|
| 78 | if (!strcasecmp(curfile,mainfile)) |
---|
| 79 | { |
---|
| 80 | printf("Dans convert %s line %d, fichier %s\n",s,line_num,curfile); |
---|
| 81 | } |
---|
| 82 | else |
---|
| 83 | { |
---|
| 84 | printf("Dans convert %s line %d, fichier %s\n",s,line_num,curfile); |
---|
| 85 | } |
---|
| 86 | exit(0); |
---|
| 87 | } |
---|