main.c 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927
  1. /* A Bison parser, made by GNU Bison 2.3. */
  2. /* Skeleton implementation for Bison's Yacc-like parsers in C
  3. Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
  4. Free Software Foundation, Inc.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. Boston, MA 02110-1301, USA. */
  17. /* As a special exception, you may create a larger work that contains
  18. part or all of the Bison parser skeleton and distribute that work
  19. under terms of your choice, so long as that work isn't itself a
  20. parser generator using the skeleton or a modified version thereof
  21. as a parser skeleton. Alternatively, if you modify or redistribute
  22. the parser skeleton itself, you may (at your option) remove this
  23. special exception, which will cause the skeleton and the resulting
  24. Bison output files to be licensed under the GNU General Public
  25. License without this special exception.
  26. This special exception was added by the Free Software Foundation in
  27. version 2.2 of Bison. */
  28. /* C LALR(1) parser skeleton written by Richard Stallman, by
  29. simplifying the original so-called "semantic" parser. */
  30. /* All symbols defined below should begin with yy or YY, to avoid
  31. infringing on user name space. This should be done even for local
  32. variables, as they might otherwise be expanded by user macros.
  33. There are some unavoidable exceptions within include files to
  34. define necessary library symbols; they are noted "INFRINGES ON
  35. USER NAME SPACE" below. */
  36. /* Identify Bison output. */
  37. #define YYBISON 1
  38. /* Bison version. */
  39. #define YYBISON_VERSION "2.3"
  40. /* Skeleton name. */
  41. #define YYSKELETON_NAME "yacc.c"
  42. /* Pure parsers. */
  43. #define YYPURE 0
  44. /* Using locations. */
  45. #define YYLSP_NEEDED 0
  46. /* Substitute the variable and function names. */
  47. #define yyparse convert_parse
  48. #define yylex convert_lex
  49. #define yyerror convert_error
  50. #define yylval convert_lval
  51. #define yychar convert_char
  52. #define yydebug convert_debug
  53. #define yynerrs convert_nerrs
  54. /* Tokens. */
  55. #ifndef YYTOKENTYPE
  56. # define YYTOKENTYPE
  57. /* Put the tokens into the symbol table, so that GDB and other debuggers
  58. know about them. */
  59. enum yytokentype {
  60. TOK_SEP = 258,
  61. TOK_KIND = 259,
  62. TOK_EQUAL = 260,
  63. TOK_USE = 261,
  64. TOK_MODULEMAIN = 262,
  65. TOK_NOTGRIDDEP = 263,
  66. TOK_USEITEM = 264,
  67. TOK_NAME = 265,
  68. TOK_CSTINT = 266,
  69. TOK_PROBTYPE = 267
  70. };
  71. #endif
  72. /* Tokens. */
  73. #define TOK_SEP 258
  74. #define TOK_KIND 259
  75. #define TOK_EQUAL 260
  76. #define TOK_USE 261
  77. #define TOK_MODULEMAIN 262
  78. #define TOK_NOTGRIDDEP 263
  79. #define TOK_USEITEM 264
  80. #define TOK_NAME 265
  81. #define TOK_CSTINT 266
  82. #define TOK_PROBTYPE 267
  83. /* Copy the first part of user declarations. */
  84. #line 35 "convert.y"
  85. #include <stdlib.h>
  86. #include <stdio.h>
  87. #include <string.h>
  88. #include "decl.h"
  89. int line_num=1;
  90. extern FILE * convert_in;
  91. int convert_error(const char *s)
  92. {
  93. printf("##\n## ERROR in conv: '%s' (line %d, file: %s)\n##\n", s, line_num, config_file);
  94. exit(0);
  95. }
  96. /* Enabling traces. */
  97. #ifndef YYDEBUG
  98. # define YYDEBUG 1
  99. #endif
  100. /* Enabling verbose error messages. */
  101. #ifdef YYERROR_VERBOSE
  102. # undef YYERROR_VERBOSE
  103. # define YYERROR_VERBOSE 1
  104. #else
  105. # define YYERROR_VERBOSE 0
  106. #endif
  107. /* Enabling the token table. */
  108. #ifndef YYTOKEN_TABLE
  109. # define YYTOKEN_TABLE 0
  110. #endif
  111. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  112. typedef union YYSTYPE
  113. #line 52 "convert.y"
  114. {
  115. char na[LONG_M];
  116. }
  117. /* Line 193 of yacc.c. */
  118. #line 149 "convert.tab.c"
  119. YYSTYPE;
  120. # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  121. # define YYSTYPE_IS_DECLARED 1
  122. # define YYSTYPE_IS_TRIVIAL 1
  123. #endif
  124. /* Copy the second part of user declarations. */
  125. /* Line 216 of yacc.c. */
  126. #line 162 "convert.tab.c"
  127. #ifdef short
  128. # undef short
  129. #endif
  130. #ifdef YYTYPE_UINT8
  131. typedef YYTYPE_UINT8 yytype_uint8;
  132. #else
  133. typedef unsigned char yytype_uint8;
  134. #endif
  135. #ifdef YYTYPE_INT8
  136. typedef YYTYPE_INT8 yytype_int8;
  137. #elif (defined __STDC__ || defined __C99__FUNC__ \
  138. || defined __cplusplus || defined _MSC_VER)
  139. typedef signed char yytype_int8;
  140. #else
  141. typedef short int yytype_int8;
  142. #endif
  143. #ifdef YYTYPE_UINT16
  144. typedef YYTYPE_UINT16 yytype_uint16;
  145. #else
  146. typedef unsigned short int yytype_uint16;
  147. #endif
  148. #ifdef YYTYPE_INT16
  149. typedef YYTYPE_INT16 yytype_int16;
  150. #else
  151. typedef short int yytype_int16;
  152. #endif
  153. #ifndef YYSIZE_T
  154. # ifdef __SIZE_TYPE__
  155. # define YYSIZE_T __SIZE_TYPE__
  156. # elif defined size_t
  157. # define YYSIZE_T size_t
  158. # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
  159. || defined __cplusplus || defined _MSC_VER)
  160. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  161. # define YYSIZE_T size_t
  162. # else
  163. # define YYSIZE_T unsigned int
  164. # endif
  165. #endif
  166. #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  167. #ifndef YY_
  168. # if defined YYENABLE_NLS && YYENABLE_NLS
  169. # if ENABLE_NLS
  170. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  171. # define YY_(msgid) dgettext ("bison-runtime", msgid)
  172. # endif
  173. # endif
  174. # ifndef YY_
  175. # define YY_(msgid) msgid
  176. # endif
  177. #endif
  178. /* Suppress unused-variable warnings by "using" E. */
  179. #if ! defined lint || defined __GNUC__
  180. # define YYUSE(e) ((void) (e))
  181. #else
  182. # define YYUSE(e) /* empty */
  183. #endif
  184. /* Identity function, used to suppress warnings about constant conditions. */
  185. #ifndef lint
  186. # define YYID(n) (n)
  187. #else
  188. #if (defined __STDC__ || defined __C99__FUNC__ \
  189. || defined __cplusplus || defined _MSC_VER)
  190. static int
  191. YYID (int i)
  192. #else
  193. static int
  194. YYID (i)
  195. int i;
  196. #endif
  197. {
  198. return i;
  199. }
  200. #endif
  201. #if ! defined yyoverflow || YYERROR_VERBOSE
  202. /* The parser invokes alloca or malloc; define the necessary symbols. */
  203. # ifdef YYSTACK_USE_ALLOCA
  204. # if YYSTACK_USE_ALLOCA
  205. # ifdef __GNUC__
  206. # define YYSTACK_ALLOC __builtin_alloca
  207. # elif defined __BUILTIN_VA_ARG_INCR
  208. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  209. # elif defined _AIX
  210. # define YYSTACK_ALLOC __alloca
  211. # elif defined _MSC_VER
  212. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  213. # define alloca _alloca
  214. # else
  215. # define YYSTACK_ALLOC alloca
  216. # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  217. || defined __cplusplus || defined _MSC_VER)
  218. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  219. # ifndef _STDLIB_H
  220. # define _STDLIB_H 1
  221. # endif
  222. # endif
  223. # endif
  224. # endif
  225. # endif
  226. # ifdef YYSTACK_ALLOC
  227. /* Pacify GCC's `empty if-body' warning. */
  228. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
  229. # ifndef YYSTACK_ALLOC_MAXIMUM
  230. /* The OS might guarantee only one guard page at the bottom of the stack,
  231. and a page size can be as small as 4096 bytes. So we cannot safely
  232. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  233. to allow for a few compiler-allocated temporary stack slots. */
  234. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  235. # endif
  236. # else
  237. # define YYSTACK_ALLOC YYMALLOC
  238. # define YYSTACK_FREE YYFREE
  239. # ifndef YYSTACK_ALLOC_MAXIMUM
  240. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  241. # endif
  242. # if (defined __cplusplus && ! defined _STDLIB_H \
  243. && ! ((defined YYMALLOC || defined malloc) \
  244. && (defined YYFREE || defined free)))
  245. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  246. # ifndef _STDLIB_H
  247. # define _STDLIB_H 1
  248. # endif
  249. # endif
  250. # ifndef YYMALLOC
  251. # define YYMALLOC malloc
  252. # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  253. || defined __cplusplus || defined _MSC_VER)
  254. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  255. # endif
  256. # endif
  257. # ifndef YYFREE
  258. # define YYFREE free
  259. # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  260. || defined __cplusplus || defined _MSC_VER)
  261. void free (void *); /* INFRINGES ON USER NAME SPACE */
  262. # endif
  263. # endif
  264. # endif
  265. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  266. #if (! defined yyoverflow \
  267. && (! defined __cplusplus \
  268. || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  269. /* A type that is properly aligned for any stack member. */
  270. union yyalloc
  271. {
  272. yytype_int16 yyss;
  273. YYSTYPE yyvs;
  274. };
  275. /* The size of the maximum gap between one aligned stack and the next. */
  276. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  277. /* The size of an array large to enough to hold all stacks, each with
  278. N elements. */
  279. # define YYSTACK_BYTES(N) \
  280. ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
  281. + YYSTACK_GAP_MAXIMUM)
  282. /* Copy COUNT objects from FROM to TO. The source and destination do
  283. not overlap. */
  284. # ifndef YYCOPY
  285. # if defined __GNUC__ && 1 < __GNUC__
  286. # define YYCOPY(To, From, Count) \
  287. __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
  288. # else
  289. # define YYCOPY(To, From, Count) \
  290. do \
  291. { \
  292. YYSIZE_T yyi; \
  293. for (yyi = 0; yyi < (Count); yyi++) \
  294. (To)[yyi] = (From)[yyi]; \
  295. } \
  296. while (YYID (0))
  297. # endif
  298. # endif
  299. /* Relocate STACK from its old location to the new one. The
  300. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  301. elements in the stack, and YYPTR gives the new location of the
  302. stack. Advance YYPTR to a properly aligned location for the next
  303. stack. */
  304. # define YYSTACK_RELOCATE(Stack) \
  305. do \
  306. { \
  307. YYSIZE_T yynewbytes; \
  308. YYCOPY (&yyptr->Stack, Stack, yysize); \
  309. Stack = &yyptr->Stack; \
  310. yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  311. yyptr += yynewbytes / sizeof (*yyptr); \
  312. } \
  313. while (YYID (0))
  314. #endif
  315. /* YYFINAL -- State number of the termination state. */
  316. #define YYFINAL 2
  317. /* YYLAST -- Last index in YYTABLE. */
  318. #define YYLAST 29
  319. /* YYNTOKENS -- Number of terminals. */
  320. #define YYNTOKENS 16
  321. /* YYNNTS -- Number of nonterminals. */
  322. #define YYNNTS 3
  323. /* YYNRULES -- Number of rules. */
  324. #define YYNRULES 11
  325. /* YYNRULES -- Number of states. */
  326. #define YYNSTATES 29
  327. /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
  328. #define YYUNDEFTOK 2
  329. #define YYMAXUTOK 267
  330. #define YYTRANSLATE(YYX) \
  331. ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  332. /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
  333. static const yytype_uint8 yytranslate[] =
  334. {
  335. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  336. 15, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  337. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  338. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  339. 2, 2, 2, 2, 13, 2, 2, 2, 2, 2,
  340. 2, 2, 2, 2, 2, 2, 2, 2, 2, 14,
  341. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  342. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  343. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  344. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  345. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  346. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  347. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  348. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  349. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  350. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  351. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  352. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  353. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  354. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  355. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  356. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  357. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  358. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  359. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  360. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  361. 5, 6, 7, 8, 9, 10, 11, 12
  362. };
  363. #if YYDEBUG
  364. /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
  365. YYRHS. */
  366. static const yytype_uint8 yyprhs[] =
  367. {
  368. 0, 0, 3, 4, 7, 9, 13, 19, 27, 31,
  369. 37, 42
  370. };
  371. /* YYRHS -- A `-1'-separated list of the rules' RHS. */
  372. static const yytype_int8 yyrhs[] =
  373. {
  374. 17, 0, -1, -1, 17, 18, -1, 15, -1, 12,
  375. 10, 14, -1, 12, 10, 13, 10, 14, -1, 12,
  376. 10, 13, 10, 13, 10, 14, -1, 7, 10, 14,
  377. -1, 4, 10, 5, 11, 14, -1, 8, 3, 10,
  378. 14, -1, 6, 9, 14, -1
  379. };
  380. /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  381. static const yytype_uint8 yyrline[] =
  382. {
  383. 0, 71, 71, 72, 75, 76, 77, 78, 79, 84,
  384. 100, 104
  385. };
  386. #endif
  387. #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  388. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  389. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  390. static const char *const yytname[] =
  391. {
  392. "$end", "error", "$undefined", "TOK_SEP", "TOK_KIND", "TOK_EQUAL",
  393. "TOK_USE", "TOK_MODULEMAIN", "TOK_NOTGRIDDEP", "TOK_USEITEM", "TOK_NAME",
  394. "TOK_CSTINT", "TOK_PROBTYPE", "','", "';'", "'\\n'", "$accept", "input",
  395. "line", 0
  396. };
  397. #endif
  398. # ifdef YYPRINT
  399. /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
  400. token YYLEX-NUM. */
  401. static const yytype_uint16 yytoknum[] =
  402. {
  403. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  404. 265, 266, 267, 44, 59, 10
  405. };
  406. # endif
  407. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  408. static const yytype_uint8 yyr1[] =
  409. {
  410. 0, 16, 17, 17, 18, 18, 18, 18, 18, 18,
  411. 18, 18
  412. };
  413. /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
  414. static const yytype_uint8 yyr2[] =
  415. {
  416. 0, 2, 0, 2, 1, 3, 5, 7, 3, 5,
  417. 4, 3
  418. };
  419. /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
  420. STATE-NUM when YYTABLE doesn't specify something else to do. Zero
  421. means the default is an error. */
  422. static const yytype_uint8 yydefact[] =
  423. {
  424. 2, 0, 1, 0, 0, 0, 0, 0, 4, 3,
  425. 0, 0, 0, 0, 0, 0, 11, 8, 0, 0,
  426. 5, 0, 10, 0, 9, 0, 6, 0, 7
  427. };
  428. /* YYDEFGOTO[NTERM-NUM]. */
  429. static const yytype_int8 yydefgoto[] =
  430. {
  431. -1, 1, 9
  432. };
  433. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  434. STATE-NUM. */
  435. #define YYPACT_NINF -13
  436. static const yytype_int8 yypact[] =
  437. {
  438. -13, 0, -13, -7, 2, -5, 10, 4, -13, -13,
  439. 11, 3, 5, 8, -12, 9, -13, -13, 7, 12,
  440. -13, 13, -13, -4, -13, 14, -13, 15, -13
  441. };
  442. /* YYPGOTO[NTERM-NUM]. */
  443. static const yytype_int8 yypgoto[] =
  444. {
  445. -13, -13, -13
  446. };
  447. /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
  448. positive, shift that token. If negative, reduce the rule which
  449. number is the opposite. If zero, do what YYDEFACT says.
  450. If YYTABLE_NINF, syntax error. */
  451. #define YYTABLE_NINF -1
  452. static const yytype_uint8 yytable[] =
  453. {
  454. 2, 19, 20, 10, 3, 12, 4, 5, 6, 25,
  455. 26, 11, 7, 13, 14, 8, 15, 16, 18, 17,
  456. 21, 22, 23, 0, 27, 0, 0, 24, 0, 28
  457. };
  458. static const yytype_int8 yycheck[] =
  459. {
  460. 0, 13, 14, 10, 4, 10, 6, 7, 8, 13,
  461. 14, 9, 12, 3, 10, 15, 5, 14, 10, 14,
  462. 11, 14, 10, -1, 10, -1, -1, 14, -1, 14
  463. };
  464. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  465. symbol of state STATE-NUM. */
  466. static const yytype_uint8 yystos[] =
  467. {
  468. 0, 17, 0, 4, 6, 7, 8, 12, 15, 18,
  469. 10, 9, 10, 3, 10, 5, 14, 14, 10, 13,
  470. 14, 11, 14, 10, 14, 13, 14, 10, 14
  471. };
  472. #define yyerrok (yyerrstatus = 0)
  473. #define yyclearin (yychar = YYEMPTY)
  474. #define YYEMPTY (-2)
  475. #define YYEOF 0
  476. #define YYACCEPT goto yyacceptlab
  477. #define YYABORT goto yyabortlab
  478. #define YYERROR goto yyerrorlab
  479. /* Like YYERROR except do call yyerror. This remains here temporarily
  480. to ease the transition to the new meaning of YYERROR, for GCC.
  481. Once GCC version 2 has supplanted version 1, this can go. */
  482. #define YYFAIL goto yyerrlab
  483. #define YYRECOVERING() (!!yyerrstatus)
  484. #define YYBACKUP(Token, Value) \
  485. do \
  486. if (yychar == YYEMPTY && yylen == 1) \
  487. { \
  488. yychar = (Token); \
  489. yylval = (Value); \
  490. yytoken = YYTRANSLATE (yychar); \
  491. YYPOPSTACK (1); \
  492. goto yybackup; \
  493. } \
  494. else \
  495. { \
  496. yyerror (YY_("syntax error: cannot back up")); \
  497. YYERROR; \
  498. } \
  499. while (YYID (0))
  500. #define YYTERROR 1
  501. #define YYERRCODE 256
  502. /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
  503. If N is 0, then set CURRENT to the empty location which ends
  504. the previous symbol: RHS[0] (always defined). */
  505. #define YYRHSLOC(Rhs, K) ((Rhs)[K])
  506. #ifndef YYLLOC_DEFAULT
  507. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  508. do \
  509. if (YYID (N)) \
  510. { \
  511. (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
  512. (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
  513. (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
  514. (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
  515. } \
  516. else \
  517. { \
  518. (Current).first_line = (Current).last_line = \
  519. YYRHSLOC (Rhs, 0).last_line; \
  520. (Current).first_column = (Current).last_column = \
  521. YYRHSLOC (Rhs, 0).last_column; \
  522. } \
  523. while (YYID (0))
  524. #endif
  525. /* YY_LOCATION_PRINT -- Print the location on the stream.
  526. This macro was not mandated originally: define only if we know
  527. we won't break user code: when these are the locations we know. */
  528. #ifndef YY_LOCATION_PRINT
  529. # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
  530. # define YY_LOCATION_PRINT(File, Loc) \
  531. fprintf (File, "%d.%d-%d.%d", \
  532. (Loc).first_line, (Loc).first_column, \
  533. (Loc).last_line, (Loc).last_column)
  534. # else
  535. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  536. # endif
  537. #endif
  538. /* YYLEX -- calling `yylex' with the right arguments. */
  539. #ifdef YYLEX_PARAM
  540. # define YYLEX yylex (YYLEX_PARAM)
  541. #else
  542. # define YYLEX yylex ()
  543. #endif
  544. /* Enable debugging if requested. */
  545. #if YYDEBUG
  546. # ifndef YYFPRINTF
  547. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  548. # define YYFPRINTF fprintf
  549. # endif
  550. # define YYDPRINTF(Args) \
  551. do { \
  552. if (yydebug) \
  553. YYFPRINTF Args; \
  554. } while (YYID (0))
  555. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  556. do { \
  557. if (yydebug) \
  558. { \
  559. YYFPRINTF (stderr, "%s ", Title); \
  560. yy_symbol_print (stderr, \
  561. Type, Value); \
  562. YYFPRINTF (stderr, "\n"); \
  563. } \
  564. } while (YYID (0))
  565. /*--------------------------------.
  566. | Print this symbol on YYOUTPUT. |
  567. `--------------------------------*/
  568. /*ARGSUSED*/
  569. #if (defined __STDC__ || defined __C99__FUNC__ \
  570. || defined __cplusplus || defined _MSC_VER)
  571. static void
  572. yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  573. #else
  574. static void
  575. yy_symbol_value_print (yyoutput, yytype, yyvaluep)
  576. FILE *yyoutput;
  577. int yytype;
  578. YYSTYPE const * const yyvaluep;
  579. #endif
  580. {
  581. if (!yyvaluep)
  582. return;
  583. # ifdef YYPRINT
  584. if (yytype < YYNTOKENS)
  585. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  586. # else
  587. YYUSE (yyoutput);
  588. # endif
  589. switch (yytype)
  590. {
  591. default:
  592. break;
  593. }
  594. }
  595. /*--------------------------------.
  596. | Print this symbol on YYOUTPUT. |
  597. `--------------------------------*/
  598. #if (defined __STDC__ || defined __C99__FUNC__ \
  599. || defined __cplusplus || defined _MSC_VER)
  600. static void
  601. yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  602. #else
  603. static void
  604. yy_symbol_print (yyoutput, yytype, yyvaluep)
  605. FILE *yyoutput;
  606. int yytype;
  607. YYSTYPE const * const yyvaluep;
  608. #endif
  609. {
  610. if (yytype < YYNTOKENS)
  611. YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  612. else
  613. YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
  614. yy_symbol_value_print (yyoutput, yytype, yyvaluep);
  615. YYFPRINTF (yyoutput, ")");
  616. }
  617. /*------------------------------------------------------------------.
  618. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  619. | TOP (included). |
  620. `------------------------------------------------------------------*/
  621. #if (defined __STDC__ || defined __C99__FUNC__ \
  622. || defined __cplusplus || defined _MSC_VER)
  623. static void
  624. yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
  625. #else
  626. static void
  627. yy_stack_print (bottom, top)
  628. yytype_int16 *bottom;
  629. yytype_int16 *top;
  630. #endif
  631. {
  632. YYFPRINTF (stderr, "Stack now");
  633. for (; bottom <= top; ++bottom)
  634. YYFPRINTF (stderr, " %d", *bottom);
  635. YYFPRINTF (stderr, "\n");
  636. }
  637. # define YY_STACK_PRINT(Bottom, Top) \
  638. do { \
  639. if (yydebug) \
  640. yy_stack_print ((Bottom), (Top)); \
  641. } while (YYID (0))
  642. /*------------------------------------------------.
  643. | Report that the YYRULE is going to be reduced. |
  644. `------------------------------------------------*/
  645. #if (defined __STDC__ || defined __C99__FUNC__ \
  646. || defined __cplusplus || defined _MSC_VER)
  647. static void
  648. yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
  649. #else
  650. static void
  651. yy_reduce_print (yyvsp, yyrule)
  652. YYSTYPE *yyvsp;
  653. int yyrule;
  654. #endif
  655. {
  656. int yynrhs = yyr2[yyrule];
  657. int yyi;
  658. unsigned long int yylno = yyrline[yyrule];
  659. YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  660. yyrule - 1, yylno);
  661. /* The symbols being reduced. */
  662. for (yyi = 0; yyi < yynrhs; yyi++)
  663. {
  664. fprintf (stderr, " $%d = ", yyi + 1);
  665. yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
  666. &(yyvsp[(yyi + 1) - (yynrhs)])
  667. );
  668. fprintf (stderr, "\n");
  669. }
  670. }
  671. # define YY_REDUCE_PRINT(Rule) \
  672. do { \
  673. if (yydebug) \
  674. yy_reduce_print (yyvsp, Rule); \
  675. } while (YYID (0))
  676. /* Nonzero means print parse trace. It is left uninitialized so that
  677. multiple parsers can coexist. */
  678. int yydebug;
  679. #else /* !YYDEBUG */
  680. # define YYDPRINTF(Args)
  681. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  682. # define YY_STACK_PRINT(Bottom, Top)
  683. # define YY_REDUCE_PRINT(Rule)
  684. #endif /* !YYDEBUG */
  685. /* YYINITDEPTH -- initial size of the parser's stacks. */
  686. #ifndef YYINITDEPTH
  687. # define YYINITDEPTH 200
  688. #endif
  689. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  690. if the built-in stack extension method is used).
  691. Do not make this value too large; the results are undefined if
  692. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  693. evaluated with infinite-precision integer arithmetic. */
  694. #ifndef YYMAXDEPTH
  695. # define YYMAXDEPTH 10000
  696. #endif
  697. #if YYERROR_VERBOSE
  698. # ifndef yystrlen
  699. # if defined __GLIBC__ && defined _STRING_H
  700. # define yystrlen strlen
  701. # else
  702. /* Return the length of YYSTR. */
  703. #if (defined __STDC__ || defined __C99__FUNC__ \
  704. || defined __cplusplus || defined _MSC_VER)
  705. static YYSIZE_T
  706. yystrlen (const char *yystr)
  707. #else
  708. static YYSIZE_T
  709. yystrlen (yystr)
  710. const char *yystr;
  711. #endif
  712. {
  713. YYSIZE_T yylen;
  714. for (yylen = 0; yystr[yylen]; yylen++)
  715. continue;
  716. return yylen;
  717. }
  718. # endif
  719. # endif
  720. # ifndef yystpcpy
  721. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  722. # define yystpcpy stpcpy
  723. # else
  724. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  725. YYDEST. */
  726. #if (defined __STDC__ || defined __C99__FUNC__ \
  727. || defined __cplusplus || defined _MSC_VER)
  728. static char *
  729. yystpcpy (char *yydest, const char *yysrc)
  730. #else
  731. static char *
  732. yystpcpy (yydest, yysrc)
  733. char *yydest;
  734. const char *yysrc;
  735. #endif
  736. {
  737. char *yyd = yydest;
  738. const char *yys = yysrc;
  739. while ((*yyd++ = *yys++) != '\0')
  740. continue;
  741. return yyd - 1;
  742. }
  743. # endif
  744. # endif
  745. # ifndef yytnamerr
  746. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  747. quotes and backslashes, so that it's suitable for yyerror. The
  748. heuristic is that double-quoting is unnecessary unless the string
  749. contains an apostrophe, a comma, or backslash (other than
  750. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  751. null, do not copy; instead, return the length of what the result
  752. would have been. */
  753. static YYSIZE_T
  754. yytnamerr (char *yyres, const char *yystr)
  755. {
  756. if (*yystr == '"')
  757. {
  758. YYSIZE_T yyn = 0;
  759. char const *yyp = yystr;
  760. for (;;)
  761. switch (*++yyp)
  762. {
  763. case '\'':
  764. case ',':
  765. goto do_not_strip_quotes;
  766. case '\\':
  767. if (*++yyp != '\\')
  768. goto do_not_strip_quotes;
  769. /* Fall through. */
  770. default:
  771. if (yyres)
  772. yyres[yyn] = *yyp;
  773. yyn++;
  774. break;
  775. case '"':
  776. if (yyres)
  777. yyres[yyn] = '\0';
  778. return yyn;
  779. }
  780. do_not_strip_quotes: ;
  781. }
  782. if (! yyres)
  783. return yystrlen (yystr);
  784. return yystpcpy (yyres, yystr) - yyres;
  785. }
  786. # endif
  787. /* Copy into YYRESULT an error message about the unexpected token
  788. YYCHAR while in state YYSTATE. Return the number of bytes copied,
  789. including the terminating null byte. If YYRESULT is null, do not
  790. copy anything; just return the number of bytes that would be
  791. copied. As a special case, return 0 if an ordinary "syntax error"
  792. message will do. Return YYSIZE_MAXIMUM if overflow occurs during
  793. size calculation. */
  794. static YYSIZE_T
  795. yysyntax_error (char *yyresult, int yystate, int yychar)
  796. {
  797. int yyn = yypact[yystate];
  798. if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
  799. return 0;
  800. else
  801. {
  802. int yytype = YYTRANSLATE (yychar);
  803. YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
  804. YYSIZE_T yysize = yysize0;
  805. YYSIZE_T yysize1;
  806. int yysize_overflow = 0;
  807. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  808. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  809. int yyx;
  810. # if 0
  811. /* This is so xgettext sees the translatable formats that are
  812. constructed on the fly. */
  813. YY_("syntax error, unexpected %s");
  814. YY_("syntax error, unexpected %s, expecting %s");
  815. YY_("syntax error, unexpected %s, expecting %s or %s");
  816. YY_("syntax error, unexpected %s, expecting %s or %s or %s");
  817. YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
  818. # endif
  819. char *yyfmt;
  820. char const *yyf;
  821. static char const yyunexpected[] = "syntax error, unexpected %s";
  822. static char const yyexpecting[] = ", expecting %s";
  823. static char const yyor[] = " or %s";
  824. char yyformat[sizeof yyunexpected
  825. + sizeof yyexpecting - 1
  826. + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
  827. * (sizeof yyor - 1))];
  828. char const *yyprefix = yyexpecting;
  829. /* Start YYX at -YYN if negative to avoid negative indexes in
  830. YYCHECK. */
  831. int yyxbegin = yyn < 0 ? -yyn : 0;
  832. /* Stay within bounds of both yycheck and yytname. */
  833. int yychecklim = YYLAST - yyn + 1;
  834. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  835. int yycount = 1;
  836. yyarg[0] = yytname[yytype];
  837. yyfmt = yystpcpy (yyformat, yyunexpected);
  838. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  839. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
  840. {
  841. if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  842. {
  843. yycount = 1;
  844. yysize = yysize0;
  845. yyformat[sizeof yyunexpected - 1] = '\0';
  846. break;
  847. }
  848. yyarg[yycount++] = yytname[yyx];
  849. yysize1 = yysize + yytnamerr (0, yytname[yyx]);
  850. yysize_overflow |= (yysize1 < yysize);
  851. yysize = yysize1;
  852. yyfmt = yystpcpy (yyfmt, yyprefix);
  853. yyprefix = yyor;
  854. }
  855. yyf = YY_(yyformat);
  856. yysize1 = yysize + yystrlen (yyf);
  857. yysize_overflow |= (yysize1 < yysize);
  858. yysize = yysize1;
  859. if (yysize_overflow)
  860. return YYSIZE_MAXIMUM;
  861. if (yyresult)
  862. {
  863. /* Avoid sprintf, as that infringes on the user's name space.
  864. Don't have undefined behavior even if the translation
  865. produced a string with the wrong number of "%s"s. */
  866. char *yyp = yyresult;
  867. int yyi = 0;
  868. while ((*yyp = *yyf) != '\0')
  869. {
  870. if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
  871. {
  872. yyp += yytnamerr (yyp, yyarg[yyi++]);
  873. yyf += 2;
  874. }
  875. else
  876. {
  877. yyp++;
  878. yyf++;
  879. }
  880. }
  881. }
  882. return yysize;
  883. }
  884. }
  885. #endif /* YYERROR_VERBOSE */
  886. /*-----------------------------------------------.
  887. | Release the memory associated to this symbol. |
  888. `-----------------------------------------------*/
  889. /*ARGSUSED*/
  890. #if (defined __STDC__ || defined __C99__FUNC__ \
  891. || defined __cplusplus || defined _MSC_VER)
  892. static void
  893. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
  894. #else
  895. static void
  896. yydestruct (yymsg, yytype, yyvaluep)
  897. const char *yymsg;
  898. int yytype;
  899. YYSTYPE *yyvaluep;
  900. #endif
  901. {
  902. YYUSE (yyvaluep);
  903. if (!yymsg)
  904. yymsg = "Deleting";
  905. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  906. switch (yytype)
  907. {
  908. default:
  909. break;
  910. }
  911. }
  912. /* Prevent warnings from -Wmissing-prototypes. */
  913. #ifdef YYPARSE_PARAM
  914. #if defined __STDC__ || defined __cplusplus
  915. int yyparse (void *YYPARSE_PARAM);
  916. #else
  917. int yyparse ();
  918. #endif
  919. #else /* ! YYPARSE_PARAM */
  920. #if defined __STDC__ || defined __cplusplus
  921. int yyparse (void);
  922. #else
  923. int yyparse ();
  924. #endif
  925. #endif /* ! YYPARSE_PARAM */
  926. /* The look-ahead symbol. */
  927. int yychar;
  928. /* The semantic value of the look-ahead symbol. */
  929. YYSTYPE yylval;
  930. /* Number of syntax errors so far. */
  931. int yynerrs;
  932. /*----------.
  933. | yyparse. |
  934. `----------*/
  935. #ifdef YYPARSE_PARAM
  936. #if (defined __STDC__ || defined __C99__FUNC__ \
  937. || defined __cplusplus || defined _MSC_VER)
  938. int
  939. yyparse (void *YYPARSE_PARAM)
  940. #else
  941. int
  942. yyparse (YYPARSE_PARAM)
  943. void *YYPARSE_PARAM;
  944. #endif
  945. #else /* ! YYPARSE_PARAM */
  946. #if (defined __STDC__ || defined __C99__FUNC__ \
  947. || defined __cplusplus || defined _MSC_VER)
  948. int
  949. yyparse (void)
  950. #else
  951. int
  952. yyparse ()
  953. #endif
  954. #endif
  955. {
  956. int yystate;
  957. int yyn;
  958. int yyresult;
  959. /* Number of tokens to shift before error messages enabled. */
  960. int yyerrstatus;
  961. /* Look-ahead token as an internal (translated) token number. */
  962. int yytoken = 0;
  963. #if YYERROR_VERBOSE
  964. /* Buffer for error messages, and its allocated size. */
  965. char yymsgbuf[128];
  966. char *yymsg = yymsgbuf;
  967. YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  968. #endif
  969. /* Three stacks and their tools:
  970. `yyss': related to states,
  971. `yyvs': related to semantic values,
  972. `yyls': related to locations.
  973. Refer to the stacks thru separate pointers, to allow yyoverflow
  974. to reallocate them elsewhere. */
  975. /* The state stack. */
  976. yytype_int16 yyssa[YYINITDEPTH];
  977. yytype_int16 *yyss = yyssa;
  978. yytype_int16 *yyssp;
  979. /* The semantic value stack. */
  980. YYSTYPE yyvsa[YYINITDEPTH];
  981. YYSTYPE *yyvs = yyvsa;
  982. YYSTYPE *yyvsp;
  983. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
  984. YYSIZE_T yystacksize = YYINITDEPTH;
  985. /* The variables used to return semantic value and location from the
  986. action routines. */
  987. YYSTYPE yyval;
  988. /* The number of symbols on the RHS of the reduced rule.
  989. Keep to zero when no symbol should be popped. */
  990. int yylen = 0;
  991. YYDPRINTF ((stderr, "Starting parse\n"));
  992. yystate = 0;
  993. yyerrstatus = 0;
  994. yynerrs = 0;
  995. yychar = YYEMPTY; /* Cause a token to be read. */
  996. /* Initialize stack pointers.
  997. Waste one element of value and location stack
  998. so that they stay on the same level as the state stack.
  999. The wasted elements are never initialized. */
  1000. yyssp = yyss;
  1001. yyvsp = yyvs;
  1002. goto yysetstate;
  1003. /*------------------------------------------------------------.
  1004. | yynewstate -- Push a new state, which is found in yystate. |
  1005. `------------------------------------------------------------*/
  1006. yynewstate:
  1007. /* In all cases, when you get here, the value and location stacks
  1008. have just been pushed. So pushing a state here evens the stacks. */
  1009. yyssp++;
  1010. yysetstate:
  1011. *yyssp = yystate;
  1012. if (yyss + yystacksize - 1 <= yyssp)
  1013. {
  1014. /* Get the current used size of the three stacks, in elements. */
  1015. YYSIZE_T yysize = yyssp - yyss + 1;
  1016. #ifdef yyoverflow
  1017. {
  1018. /* Give user a chance to reallocate the stack. Use copies of
  1019. these so that the &'s don't force the real ones into
  1020. memory. */
  1021. YYSTYPE *yyvs1 = yyvs;
  1022. yytype_int16 *yyss1 = yyss;
  1023. /* Each stack pointer address is followed by the size of the
  1024. data in use in that stack, in bytes. This used to be a
  1025. conditional around just the two extra args, but that might
  1026. be undefined if yyoverflow is a macro. */
  1027. yyoverflow (YY_("memory exhausted"),
  1028. &yyss1, yysize * sizeof (*yyssp),
  1029. &yyvs1, yysize * sizeof (*yyvsp),
  1030. &yystacksize);
  1031. yyss = yyss1;
  1032. yyvs = yyvs1;
  1033. }
  1034. #else /* no yyoverflow */
  1035. # ifndef YYSTACK_RELOCATE
  1036. goto yyexhaustedlab;
  1037. # else
  1038. /* Extend the stack our own way. */
  1039. if (YYMAXDEPTH <= yystacksize)
  1040. goto yyexhaustedlab;
  1041. yystacksize *= 2;
  1042. if (YYMAXDEPTH < yystacksize)
  1043. yystacksize = YYMAXDEPTH;
  1044. {
  1045. yytype_int16 *yyss1 = yyss;
  1046. union yyalloc *yyptr =
  1047. (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  1048. if (! yyptr)
  1049. goto yyexhaustedlab;
  1050. YYSTACK_RELOCATE (yyss);
  1051. YYSTACK_RELOCATE (yyvs);
  1052. # undef YYSTACK_RELOCATE
  1053. if (yyss1 != yyssa)
  1054. YYSTACK_FREE (yyss1);
  1055. }
  1056. # endif
  1057. #endif /* no yyoverflow */
  1058. yyssp = yyss + yysize - 1;
  1059. yyvsp = yyvs + yysize - 1;
  1060. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  1061. (unsigned long int) yystacksize));
  1062. if (yyss + yystacksize - 1 <= yyssp)
  1063. YYABORT;
  1064. }
  1065. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1066. goto yybackup;
  1067. /*-----------.
  1068. | yybackup. |
  1069. `-----------*/
  1070. yybackup:
  1071. /* Do appropriate processing given the current state. Read a
  1072. look-ahead token if we need one and don't already have one. */
  1073. /* First try to decide what to do without reference to look-ahead token. */
  1074. yyn = yypact[yystate];
  1075. if (yyn == YYPACT_NINF)
  1076. goto yydefault;
  1077. /* Not known => get a look-ahead token if don't already have one. */
  1078. /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
  1079. if (yychar == YYEMPTY)
  1080. {
  1081. YYDPRINTF ((stderr, "Reading a token: "));
  1082. yychar = YYLEX;
  1083. }
  1084. if (yychar <= YYEOF)
  1085. {
  1086. yychar = yytoken = YYEOF;
  1087. YYDPRINTF ((stderr, "Now at end of input.\n"));
  1088. }
  1089. else
  1090. {
  1091. yytoken = YYTRANSLATE (yychar);
  1092. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1093. }
  1094. /* If the proper action on seeing token YYTOKEN is to reduce or to
  1095. detect an error, take that action. */
  1096. yyn += yytoken;
  1097. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1098. goto yydefault;
  1099. yyn = yytable[yyn];
  1100. if (yyn <= 0)
  1101. {
  1102. if (yyn == 0 || yyn == YYTABLE_NINF)
  1103. goto yyerrlab;
  1104. yyn = -yyn;
  1105. goto yyreduce;
  1106. }
  1107. if (yyn == YYFINAL)
  1108. YYACCEPT;
  1109. /* Count tokens shifted since error; after three, turn off error
  1110. status. */
  1111. if (yyerrstatus)
  1112. yyerrstatus--;
  1113. /* Shift the look-ahead token. */
  1114. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1115. /* Discard the shifted token unless it is eof. */
  1116. if (yychar != YYEOF)
  1117. yychar = YYEMPTY;
  1118. yystate = yyn;
  1119. *++yyvsp = yylval;
  1120. goto yynewstate;
  1121. /*-----------------------------------------------------------.
  1122. | yydefault -- do the default action for the current state. |
  1123. `-----------------------------------------------------------*/
  1124. yydefault:
  1125. yyn = yydefact[yystate];
  1126. if (yyn == 0)
  1127. goto yyerrlab;
  1128. goto yyreduce;
  1129. /*-----------------------------.
  1130. | yyreduce -- Do a reduction. |
  1131. `-----------------------------*/
  1132. yyreduce:
  1133. /* yyn is the number of a rule to reduce with. */
  1134. yylen = yyr2[yyn];
  1135. /* If YYLEN is nonzero, implement the default value of the action:
  1136. `$$ = $1'.
  1137. Otherwise, the following line sets YYVAL to garbage.
  1138. This behavior is undocumented and Bison
  1139. users should not rely upon it. Assigning to YYVAL
  1140. unconditionally makes the parser a bit smaller, and it avoids a
  1141. GCC warning that YYVAL may be used uninitialized. */
  1142. yyval = yyvsp[1-yylen];
  1143. YY_REDUCE_PRINT (yyn);
  1144. switch (yyn)
  1145. {
  1146. case 5:
  1147. #line 76 "convert.y"
  1148. { initdimprob(1,(yyvsp[(2) - (3)].na),"0","0"); ;}
  1149. break;
  1150. case 6:
  1151. #line 77 "convert.y"
  1152. { initdimprob(2,(yyvsp[(2) - (5)].na), (yyvsp[(4) - (5)].na),"0"); ;}
  1153. break;
  1154. case 7:
  1155. #line 78 "convert.y"
  1156. { initdimprob(3,(yyvsp[(2) - (7)].na), (yyvsp[(4) - (7)].na), (yyvsp[(6) - (7)].na)); ;}
  1157. break;
  1158. case 8:
  1159. #line 80 "convert.y"
  1160. {
  1161. listofmodules = Addtolistnom((yyvsp[(2) - (3)].na),listofmodules,0);
  1162. Addmoduletothelist((yyvsp[(2) - (3)].na));
  1163. ;}
  1164. break;
  1165. case 9:
  1166. #line 85 "convert.y"
  1167. {
  1168. if (!strcasecmp((yyvsp[(4) - (5)].na),"4"))
  1169. {
  1170. listofkind = Addtolistnom((yyvsp[(2) - (5)].na),listofkind,4);
  1171. }
  1172. else if (!strcasecmp((yyvsp[(4) - (5)].na),"8"))
  1173. {
  1174. listofkind = Addtolistnom((yyvsp[(2) - (5)].na),listofkind,8);
  1175. }
  1176. else
  1177. {
  1178. printf("##\n## Unknown kind type : %s (must be 4 or 8)\n##",(yyvsp[(4) - (5)].na));
  1179. exit(0);
  1180. }
  1181. ;}
  1182. break;
  1183. case 10:
  1184. #line 101 "convert.y"
  1185. {
  1186. Add_NotGridDepend_Var_1((yyvsp[(3) - (4)].na));
  1187. ;}
  1188. break;
  1189. case 11:
  1190. #line 105 "convert.y"
  1191. {
  1192. if (!strcasecmp((yyvsp[(2) - (3)].na),"FIXED_GRIDS")) fixedgrids = 1;
  1193. if (!strcasecmp((yyvsp[(2) - (3)].na),"ONLY_FIXED_GRIDS")) onlyfixedgrids = 1;
  1194. ;}
  1195. break;
  1196. /* Line 1267 of yacc.c. */
  1197. #line 1420 "convert.tab.c"
  1198. default: break;
  1199. }
  1200. YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  1201. YYPOPSTACK (yylen);
  1202. yylen = 0;
  1203. YY_STACK_PRINT (yyss, yyssp);
  1204. *++yyvsp = yyval;
  1205. /* Now `shift' the result of the reduction. Determine what state
  1206. that goes to, based on the state we popped back to and the rule
  1207. number reduced by. */
  1208. yyn = yyr1[yyn];
  1209. yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  1210. if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1211. yystate = yytable[yystate];
  1212. else
  1213. yystate = yydefgoto[yyn - YYNTOKENS];
  1214. goto yynewstate;
  1215. /*------------------------------------.
  1216. | yyerrlab -- here on detecting error |
  1217. `------------------------------------*/
  1218. yyerrlab:
  1219. /* If not already recovering from an error, report this error. */
  1220. if (!yyerrstatus)
  1221. {
  1222. ++yynerrs;
  1223. #if ! YYERROR_VERBOSE
  1224. yyerror (YY_("syntax error"));
  1225. #else
  1226. {
  1227. YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
  1228. if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
  1229. {
  1230. YYSIZE_T yyalloc = 2 * yysize;
  1231. if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
  1232. yyalloc = YYSTACK_ALLOC_MAXIMUM;
  1233. if (yymsg != yymsgbuf)
  1234. YYSTACK_FREE (yymsg);
  1235. yymsg = (char *) YYSTACK_ALLOC (yyalloc);
  1236. if (yymsg)
  1237. yymsg_alloc = yyalloc;
  1238. else
  1239. {
  1240. yymsg = yymsgbuf;
  1241. yymsg_alloc = sizeof yymsgbuf;
  1242. }
  1243. }
  1244. if (0 < yysize && yysize <= yymsg_alloc)
  1245. {
  1246. (void) yysyntax_error (yymsg, yystate, yychar);
  1247. yyerror (yymsg);
  1248. }
  1249. else
  1250. {
  1251. yyerror (YY_("syntax error"));
  1252. if (yysize != 0)
  1253. goto yyexhaustedlab;
  1254. }
  1255. }
  1256. #endif
  1257. }
  1258. if (yyerrstatus == 3)
  1259. {
  1260. /* If just tried and failed to reuse look-ahead token after an
  1261. error, discard it. */
  1262. if (yychar <= YYEOF)
  1263. {
  1264. /* Return failure if at end of input. */
  1265. if (yychar == YYEOF)
  1266. YYABORT;
  1267. }
  1268. else
  1269. {
  1270. yydestruct ("Error: discarding",
  1271. yytoken, &yylval);
  1272. yychar = YYEMPTY;
  1273. }
  1274. }
  1275. /* Else will try to reuse look-ahead token after shifting the error
  1276. token. */
  1277. goto yyerrlab1;
  1278. /*---------------------------------------------------.
  1279. | yyerrorlab -- error raised explicitly by YYERROR. |
  1280. `---------------------------------------------------*/
  1281. yyerrorlab:
  1282. /* Pacify compilers like GCC when the user code never invokes
  1283. YYERROR and the label yyerrorlab therefore never appears in user
  1284. code. */
  1285. if (/*CONSTCOND*/ 0)
  1286. goto yyerrorlab;
  1287. /* Do not reclaim the symbols of the rule which action triggered
  1288. this YYERROR. */
  1289. YYPOPSTACK (yylen);
  1290. yylen = 0;
  1291. YY_STACK_PRINT (yyss, yyssp);
  1292. yystate = *yyssp;
  1293. goto yyerrlab1;
  1294. /*-------------------------------------------------------------.
  1295. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  1296. `-------------------------------------------------------------*/
  1297. yyerrlab1:
  1298. yyerrstatus = 3; /* Each real token shifted decrements this. */
  1299. for (;;)
  1300. {
  1301. yyn = yypact[yystate];
  1302. if (yyn != YYPACT_NINF)
  1303. {
  1304. yyn += YYTERROR;
  1305. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  1306. {
  1307. yyn = yytable[yyn];
  1308. if (0 < yyn)
  1309. break;
  1310. }
  1311. }
  1312. /* Pop the current state because it cannot handle the error token. */
  1313. if (yyssp == yyss)
  1314. YYABORT;
  1315. yydestruct ("Error: popping",
  1316. yystos[yystate], yyvsp);
  1317. YYPOPSTACK (1);
  1318. yystate = *yyssp;
  1319. YY_STACK_PRINT (yyss, yyssp);
  1320. }
  1321. if (yyn == YYFINAL)
  1322. YYACCEPT;
  1323. *++yyvsp = yylval;
  1324. /* Shift the error token. */
  1325. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  1326. yystate = yyn;
  1327. goto yynewstate;
  1328. /*-------------------------------------.
  1329. | yyacceptlab -- YYACCEPT comes here. |
  1330. `-------------------------------------*/
  1331. yyacceptlab:
  1332. yyresult = 0;
  1333. goto yyreturn;
  1334. /*-----------------------------------.
  1335. | yyabortlab -- YYABORT comes here. |
  1336. `-----------------------------------*/
  1337. yyabortlab:
  1338. yyresult = 1;
  1339. goto yyreturn;
  1340. #ifndef yyoverflow
  1341. /*-------------------------------------------------.
  1342. | yyexhaustedlab -- memory exhaustion comes here. |
  1343. `-------------------------------------------------*/
  1344. yyexhaustedlab:
  1345. yyerror (YY_("memory exhausted"));
  1346. yyresult = 2;
  1347. /* Fall through. */
  1348. #endif
  1349. yyreturn:
  1350. if (yychar != YYEOF && yychar != YYEMPTY)
  1351. yydestruct ("Cleanup: discarding lookahead",
  1352. yytoken, &yylval);
  1353. /* Do not reclaim the symbols of the rule which action triggered
  1354. this YYABORT or YYACCEPT. */
  1355. YYPOPSTACK (yylen);
  1356. YY_STACK_PRINT (yyss, yyssp);
  1357. while (yyssp != yyss)
  1358. {
  1359. yydestruct ("Cleanup: popping",
  1360. yystos[*yyssp], yyvsp);
  1361. YYPOPSTACK (1);
  1362. }
  1363. #ifndef yyoverflow
  1364. if (yyss != yyssa)
  1365. YYSTACK_FREE (yyss);
  1366. #endif
  1367. #if YYERROR_VERBOSE
  1368. if (yymsg != yymsgbuf)
  1369. YYSTACK_FREE (yymsg);
  1370. #endif
  1371. /* Make sure YYID is used. */
  1372. return YYID (yyresult);
  1373. }
  1374. #line 110 "convert.y"
  1375. void print_usage()
  1376. {
  1377. printf("usage : conv <config_file> -convfile <FILENAME>\n");
  1378. printf(" [-workdir <directory>] [-incdir <directory>]\n");
  1379. printf(" [-comdirin <directory>] [-comdirout <directory>]\n");
  1380. printf(" [-convfile <FILENAME>] [-SubloopScalar] [-SubloopScalar1] \n");
  1381. printf(" [-free|-fixed]\n");
  1382. exit(0);
  1383. }
  1384. int main(int argc,char *argv[])
  1385. {
  1386. extern FILE * convert_in ;
  1387. FILE *dependglobaloutput;
  1388. int i;
  1389. listnom *parcours;
  1390. listvar *newvar;
  1391. int stylegiven = 0;
  1392. int infreegiven ;
  1393. int infixedgiven ;
  1394. int lengthmainfile;
  1395. char filetoparse[LONG_FNAME];
  1396. /******************************************************************************/
  1397. /* 1- Variables initialization */
  1398. /******************************************************************************/
  1399. List_Global_Var = (listvar *) NULL;
  1400. List_GlobalParameter_Var = (listvar *) NULL;
  1401. List_Common_Var = (listvar *) NULL;
  1402. List_Allocate_Var = (listallocate *) NULL;
  1403. List_SubroutineWhereAgrifUsed = (listnom *) NULL;
  1404. List_Subroutine_For_Alloc = (listnom *) NULL;
  1405. List_Include = (listusemodule *) NULL;
  1406. List_NameOfModuleUsed = (listusemodule *) NULL;
  1407. listofmoduletmp = (listusemodule *) NULL;
  1408. List_SubroutineDeclaration_Var = (listvar *) NULL;
  1409. List_UsedInSubroutine_Var = (listvar *) NULL;
  1410. List_NotGridDepend_Var = (listvar *) NULL;
  1411. Listofavailableindices = (listindice *) NULL;
  1412. Listofavailableindices_glob = (listindice **) calloc(NB_CAT_VARIABLES,sizeof(listindice *));
  1413. List_CouplePointed_Var = (listvarpointtovar *) NULL;
  1414. List_ModuleUsed_Var = (listvar *) NULL;
  1415. List_ModuleUsedInModuleUsed_Var = (listvar *) NULL;
  1416. List_GlobParamModuleUsed_Var = (listparameter *) NULL;
  1417. List_GlobParamModuleUsedInModuleUsed_Var = (listparameter *) NULL;
  1418. List_SubroutineArgument_Var = (listvar *) NULL;
  1419. List_FunctionType_Var = (listvar *) NULL;
  1420. tmpuselocallist = (listusemodule *) NULL;
  1421. List_ContainsSubroutine = (listnom *) NULL;
  1422. oldfortran_out = (FILE *) NULL;
  1423. if (argc < 2) print_usage();
  1424. strcpy(config_file, argv[1]);
  1425. strcpy(work_dir, ".");
  1426. strcpy(input_dir, ".");
  1427. strcpy(output_dir, "AGRIF_MODELFILES");
  1428. strcpy(include_dir, "AGRIF_INC");
  1429. strcpy(filetoparse, "");
  1430. strcpy(subofagrifinitgrids, "");
  1431. strcpy(meetagrifinitgrids, "");
  1432. strcpy(mpiinitvar, "");
  1433. length_last = 0 ;
  1434. length_first = 0 ;
  1435. length_v_vallengspec = 0 ;
  1436. length_v_commoninfile = 0 ;
  1437. length_v_precision = 0 ;
  1438. length_v_IntentSpec = 0 ;
  1439. length_v_initialvalue = 0 ;
  1440. length_v_readedlistdimension = 0 ;
  1441. length_a_nomvar = 0 ;
  1442. length_toprintglob = 0 ;
  1443. length_tmpvargridname = 0 ;
  1444. length_ligne_Subloop = 0 ;
  1445. length_toprint_utilagrif = 0 ;
  1446. length_toprinttmp_utilchar = 0 ;
  1447. length_ligne_writedecl = 0 ;
  1448. length_newname_toamr = 0 ;
  1449. length_newname_writedecl = 0 ;
  1450. length_ligne_toamr = 0 ;
  1451. length_tmpligne_writedecl = 0 ;
  1452. value_char_size = 0 ;
  1453. value_char_size1 = 0 ;
  1454. value_char_size2 = 0 ;
  1455. value_char_size3 = 0 ;
  1456. inallocate = 0;
  1457. infixed = 1;
  1458. infree = 0;
  1459. onlyfixedgrids=0;
  1460. fixedgrids=0;
  1461. InAgrifParentDef = 0;
  1462. IndicenbmaillesX=0;
  1463. IndicenbmaillesY=0;
  1464. IndicenbmaillesZ=0;
  1465. created_dimensionlist = 1;
  1466. /* current indice in the table tabvars */
  1467. for ( i=0 ; i<NB_CAT_VARIABLES ; i++)
  1468. {
  1469. indicemaxtabvars[i] = 0;
  1470. }
  1471. SubloopScalar = 0;
  1472. todebug = 0;
  1473. retour77 = 1 ;
  1474. shouldincludempif = 0 ;
  1475. Read_val_max();
  1476. /******************************************************************************/
  1477. /* 2- Program arguments */
  1478. /******************************************************************************/
  1479. if ( (convert_in=fopen(config_file,"r")) == NULL )
  1480. {
  1481. printf("##\n## ERROR: the configuration file '%s' doesn't exist.\n##\n", config_file);
  1482. print_usage();
  1483. }
  1484. i=2;
  1485. while ( i < argc )
  1486. {
  1487. if (!strcasecmp(argv[i], "-workdir"))
  1488. {
  1489. strcpy(work_dir,argv[i+1]);
  1490. i++;
  1491. }
  1492. else if (!strcasecmp(argv[i], "-incdir"))
  1493. {
  1494. strcpy(include_dir,argv[i+1]);
  1495. i++;
  1496. }
  1497. else if (!strcasecmp(argv[i], "-comdirin")) /* input directory */
  1498. {
  1499. strcpy(input_dir,argv[i+1]);
  1500. i++;
  1501. }
  1502. else if (!strcasecmp(argv[i], "-comdirout")) /* output directory */
  1503. {
  1504. strcpy(output_dir,argv[i+1]);
  1505. i++;
  1506. }
  1507. else if (!strcasecmp(argv[i], "-convfile")) /* file to parse */
  1508. {
  1509. strcpy(filetoparse, argv[i+1]);
  1510. i++;
  1511. lengthmainfile = strlen(filetoparse);
  1512. if (!strcasecmp(&filetoparse[lengthmainfile-4], ".f90"))
  1513. {
  1514. infixed = 0;
  1515. infree = 1;
  1516. }
  1517. else
  1518. {
  1519. infixed = 1;
  1520. infree = 0;
  1521. }
  1522. }
  1523. else if (!strcasecmp(argv[i], "-free"))
  1524. {
  1525. stylegiven = 1;
  1526. infreegiven = 1 ;
  1527. infixedgiven = 0;
  1528. }
  1529. else if (!strcasecmp(argv[i], "-fixed"))
  1530. {
  1531. stylegiven = 1;
  1532. infreegiven = 0;
  1533. infixedgiven = 1;
  1534. }
  1535. else if (!strcasecmp(argv[i], "-SubloopScalar"))
  1536. {
  1537. SubloopScalar = 1 ;
  1538. }
  1539. else if (!strcasecmp(argv[i], "-SubloopScalar1"))
  1540. {
  1541. SubloopScalar = 2 ;
  1542. }
  1543. else if (!strcasecmp(argv[i], "-todebug"))
  1544. {
  1545. todebug = 1 ;
  1546. }
  1547. else if (!strcasecmp(argv[i],"-rm")) { }
  1548. else
  1549. {
  1550. printf("##\n## Unkwon option : %s\n##\n", argv[i]);
  1551. exit(0);
  1552. }
  1553. i++;
  1554. }
  1555. // Check input file
  1556. if ( strlen(filetoparse) == 0 ) // -convfile has not been specified
  1557. {
  1558. printf("##\n## ERROR: please provide a file to parse with -convfile.\n##\n");
  1559. print_usage();
  1560. }
  1561. // Setup input & output directories
  1562. if ( strcasecmp(work_dir, ".") != 0 ) // -workdir has been changed...
  1563. {
  1564. if ( strcasecmp(input_dir, ".") == 0 ) // ...and -comdirin has NOT been changed
  1565. {
  1566. strcpy(input_dir, work_dir);
  1567. }
  1568. if ( strcasecmp(output_dir, "AGRIF_MODELFILES") == 0 ) // ...and -comdirout has NOT been changed
  1569. {
  1570. sprintf(output_dir, "%s/%s", work_dir, "AGRIF_MODELFILES");
  1571. }
  1572. if ( strcasecmp(include_dir, "AGRIF_INC") == 0 ) // ...and -incdir has NOT been changed
  1573. {
  1574. sprintf(include_dir, "%s/%s", work_dir, "AGRIF_INC");
  1575. }
  1576. }
  1577. if (stylegiven == 1)
  1578. {
  1579. infree = infreegiven;
  1580. infixed = infixedgiven;
  1581. }
  1582. /******************************************************************************/
  1583. /* 3- Parsing of the conv file <name>.in */
  1584. /******************************************************************************/
  1585. if ( strstr(filetoparse, ".f90") || strstr(filetoparse, ".F90") ) retour77 = 0;
  1586. convert_parse();
  1587. /******************************************************************************/
  1588. /* 4- Preparation of the file parsing */
  1589. /******************************************************************************/
  1590. sprintf(dependfilename, "%s/.dependglobal_agrif", work_dir);
  1591. /* */
  1592. if ( (dependglobaloutput=fopen(dependfilename, "r")) != NULL )
  1593. {
  1594. for (i=0;i<NB_CAT_VARIABLES;i++)
  1595. {
  1596. fscanf(dependglobaloutput,"%d\n",&indicemaxtabvars[i]);
  1597. }
  1598. fclose(dependglobaloutput);
  1599. }
  1600. Readthedependavailablefile();
  1601. /* Read the .dependnbxnby file which contains indices of nbmaillsX, nbmailleY and nbmailleZ */
  1602. Readthedependnbxnbyfile();
  1603. Read_Subroutine_For_Alloc();
  1604. /******************************************************************************/
  1605. /* 5- Parsing of the input file (2 times) */
  1606. /******************************************************************************/
  1607. /* Record all variables in list */
  1608. firstpass = 1;
  1609. process_fortran(filetoparse);
  1610. CompleteThelistvarindoloop();
  1611. /* Read list of module used */
  1612. RecordUseModulesVariables();
  1613. /* Read list of module used in module used */
  1614. RecordUseModulesUseModulesVariables();
  1615. /* Save variables are considered as globals ones */
  1616. Update_List_Global_Var_From_List_Save_Var();
  1617. /* Update all lists */
  1618. ListUpdate();
  1619. Clean_List_Global_Var();
  1620. /* Indice tabvars identification */
  1621. IndiceTabvarsIdentification();
  1622. /* Update all lists */
  1623. ListUpdate();
  1624. /* The allocation subroutine is necessary ???? */
  1625. New_Allocate_Subroutine_Is_Necessary();
  1626. /* The allocation subroutine is necessary for common list */
  1627. New_Allocate_Subroutine_For_Common_Is_Necessary();
  1628. /* Sort List_SubroutineArgument_Var */
  1629. Sort_List_SubroutineArgument_Var();
  1630. /* Clean all lists */
  1631. ListClean();
  1632. /* Update Indice of List_UsedInSubroutine_Var from module used */
  1633. List_UsedInSubroutine_Var_Update_From_Module_Used();
  1634. /* Update List_SubroutineWhereAgrifUsed */
  1635. UpdateList_SubroutineWhereAgrifUsed();
  1636. /* Update List_UsedInSubroutine_Var with v_readedlistdimension */
  1637. UpdateList_UsedInSubroutine_With_dimension();
  1638. ModifyThelistvarindoloop();
  1639. UpdateListDeclarationWithDimensionList();
  1640. GiveTypeOfVariables();
  1641. /* Build new subroutines */
  1642. firstpass = 0;
  1643. process_fortran(filetoparse);
  1644. newvar = (listvar *) NULL;
  1645. while ( newvar )
  1646. {
  1647. printf("++++ %s %d %s %s %s\n",
  1648. newvar->var->v_nomvar,
  1649. newvar->var->v_nbdim,
  1650. newvar->var->v_subroutinename,
  1651. newvar->var->v_modulename,
  1652. newvar->var->v_typevar);
  1653. newvar = newvar->suiv;
  1654. }
  1655. /******************************************************************************/
  1656. /* 6- Write informations in output files */
  1657. /******************************************************************************/
  1658. /* Write the .dependglobal_agrif file which contain the max indice */
  1659. /* of the tabvars table */
  1660. sprintf(dependfilename, "%s/.dependglobal_agrif", work_dir);
  1661. dependglobaloutput = fopen(dependfilename, "w");
  1662. for (i=0;i<NB_CAT_VARIABLES;i++)
  1663. {
  1664. fprintf(dependglobaloutput,"%d\n",indicemaxtabvars[i]);
  1665. }
  1666. fclose(dependglobaloutput);
  1667. /* Write the list of available indice */
  1668. Writethedependavailablefile();
  1669. /* Write the .dependnbxnby file which contains indices of nbmaillsX, */
  1670. /* nbmailleY and nbmailleZ */
  1671. Writethedependnbxnbyfile();
  1672. /* Write the .depend<namefile> file which contain general informations */
  1673. /* about variable of this file */
  1674. parcours = List_NameOfModule;
  1675. while( parcours )
  1676. {
  1677. Writethedependlistofmoduleused(parcours->o_nom);
  1678. WritedependParameterList(parcours->o_nom);
  1679. Writethedependfile(parcours->o_nom,List_Global_Var);
  1680. parcours=parcours->suiv;
  1681. }
  1682. parcours = List_NameOfCommon;
  1683. while( parcours )
  1684. {
  1685. Writethedependfile(parcours->o_nom,List_Common_Var);
  1686. parcours=parcours->suiv;
  1687. }
  1688. Write_Subroutine_For_Alloc();
  1689. /******************************************************************************/
  1690. /* 7- Create files in AGRIF_INC directory */
  1691. /******************************************************************************/
  1692. creefichieramr();
  1693. Write_val_max();
  1694. if ( todebug == 1 ) printf("Out of CONV \n");
  1695. return 0;
  1696. }
  1697. #line 2 "convert.yy.c"
  1698. #line 4 "convert.yy.c"
  1699. #define YY_INT_ALIGNED short int
  1700. /* A lexical scanner generated by flex */
  1701. #define yy_create_buffer convert__create_buffer
  1702. #define yy_delete_buffer convert__delete_buffer
  1703. #define yy_flex_debug convert__flex_debug
  1704. #define yy_init_buffer convert__init_buffer
  1705. #define yy_flush_buffer convert__flush_buffer
  1706. #define yy_load_buffer_state convert__load_buffer_state
  1707. #define yy_switch_to_buffer convert__switch_to_buffer
  1708. #define yyin convert_in
  1709. #define yyleng convert_leng
  1710. #define yylex convert_lex
  1711. #define yylineno convert_lineno
  1712. #define yyout convert_out
  1713. #define yyrestart convert_restart
  1714. #define yytext convert_text
  1715. #define yywrap convert_wrap
  1716. #define yyalloc convert_alloc
  1717. #define yyrealloc convert_realloc
  1718. #define yyfree convert_free
  1719. #define FLEX_SCANNER
  1720. #define YY_FLEX_MAJOR_VERSION 2
  1721. #define YY_FLEX_MINOR_VERSION 5
  1722. #define YY_FLEX_SUBMINOR_VERSION 35
  1723. #if YY_FLEX_SUBMINOR_VERSION > 0
  1724. #define FLEX_BETA
  1725. #endif
  1726. /* First, we deal with platform-specific or compiler-specific issues. */
  1727. /* begin standard C headers. */
  1728. #include <stdio.h>
  1729. #include <string.h>
  1730. #include <errno.h>
  1731. #include <stdlib.h>
  1732. /* end standard C headers. */
  1733. /* flex integer type definitions */
  1734. #ifndef FLEXINT_H
  1735. #define FLEXINT_H
  1736. /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
  1737. #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  1738. /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  1739. * if you want the limit (max/min) macros for int types.
  1740. */
  1741. #ifndef __STDC_LIMIT_MACROS
  1742. #define __STDC_LIMIT_MACROS 1
  1743. #endif
  1744. #include <inttypes.h>
  1745. typedef int8_t flex_int8_t;
  1746. typedef uint8_t flex_uint8_t;
  1747. typedef int16_t flex_int16_t;
  1748. typedef uint16_t flex_uint16_t;
  1749. typedef int32_t flex_int32_t;
  1750. typedef uint32_t flex_uint32_t;
  1751. typedef uint64_t flex_uint64_t;
  1752. #else
  1753. typedef signed char flex_int8_t;
  1754. typedef short int flex_int16_t;
  1755. typedef int flex_int32_t;
  1756. typedef unsigned char flex_uint8_t;
  1757. typedef unsigned short int flex_uint16_t;
  1758. typedef unsigned int flex_uint32_t;
  1759. #endif /* ! C99 */
  1760. /* Limits of integral types. */
  1761. #ifndef INT8_MIN
  1762. #define INT8_MIN (-128)
  1763. #endif
  1764. #ifndef INT16_MIN
  1765. #define INT16_MIN (-32767-1)
  1766. #endif
  1767. #ifndef INT32_MIN
  1768. #define INT32_MIN (-2147483647-1)
  1769. #endif
  1770. #ifndef INT8_MAX
  1771. #define INT8_MAX (127)
  1772. #endif
  1773. #ifndef INT16_MAX
  1774. #define INT16_MAX (32767)
  1775. #endif
  1776. #ifndef INT32_MAX
  1777. #define INT32_MAX (2147483647)
  1778. #endif
  1779. #ifndef UINT8_MAX
  1780. #define UINT8_MAX (255U)
  1781. #endif
  1782. #ifndef UINT16_MAX
  1783. #define UINT16_MAX (65535U)
  1784. #endif
  1785. #ifndef UINT32_MAX
  1786. #define UINT32_MAX (4294967295U)
  1787. #endif
  1788. #endif /* ! FLEXINT_H */
  1789. #ifdef __cplusplus
  1790. /* The "const" storage-class-modifier is valid. */
  1791. #define YY_USE_CONST
  1792. #else /* ! __cplusplus */
  1793. /* C99 requires __STDC__ to be defined as 1. */
  1794. #if defined (__STDC__)
  1795. #define YY_USE_CONST
  1796. #endif /* defined (__STDC__) */
  1797. #endif /* ! __cplusplus */
  1798. #ifdef YY_USE_CONST
  1799. #define yyconst const
  1800. #else
  1801. #define yyconst
  1802. #endif
  1803. /* Returned upon end-of-file. */
  1804. #define YY_NULL 0
  1805. /* Promotes a possibly negative, possibly signed char to an unsigned
  1806. * integer for use as an array index. If the signed char is negative,
  1807. * we want to instead treat it as an 8-bit unsigned char, hence the
  1808. * double cast.
  1809. */
  1810. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  1811. /* Enter a start condition. This macro really ought to take a parameter,
  1812. * but we do it the disgusting crufty way forced on us by the ()-less
  1813. * definition of BEGIN.
  1814. */
  1815. #define BEGIN (yy_start) = 1 + 2 *
  1816. /* Translate the current start state into a value that can be later handed
  1817. * to BEGIN to return to the state. The YYSTATE alias is for lex
  1818. * compatibility.
  1819. */
  1820. #define YY_START (((yy_start) - 1) / 2)
  1821. #define YYSTATE YY_START
  1822. /* Action number for EOF rule of a given start state. */
  1823. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  1824. /* Special action meaning "start processing a new file". */
  1825. #define YY_NEW_FILE convert_restart(convert_in )
  1826. #define YY_END_OF_BUFFER_CHAR 0
  1827. /* Size of default input buffer. */
  1828. #ifndef YY_BUF_SIZE
  1829. #define YY_BUF_SIZE 16384
  1830. #endif
  1831. /* The state buf must be large enough to hold one state per character in the main buffer.
  1832. */
  1833. #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
  1834. #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  1835. #define YY_TYPEDEF_YY_BUFFER_STATE
  1836. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  1837. #endif
  1838. #ifndef YY_TYPEDEF_YY_SIZE_T
  1839. #define YY_TYPEDEF_YY_SIZE_T
  1840. typedef size_t yy_size_t;
  1841. #endif
  1842. extern yy_size_t convert_leng;
  1843. extern FILE *convert_in, *convert_out;
  1844. #define EOB_ACT_CONTINUE_SCAN 0
  1845. #define EOB_ACT_END_OF_FILE 1
  1846. #define EOB_ACT_LAST_MATCH 2
  1847. #define YY_LESS_LINENO(n)
  1848. /* Return all but the first "n" matched characters back to the input stream. */
  1849. #define yyless(n) \
  1850. do \
  1851. { \
  1852. /* Undo effects of setting up convert_text. */ \
  1853. int yyless_macro_arg = (n); \
  1854. YY_LESS_LINENO(yyless_macro_arg);\
  1855. *yy_cp = (yy_hold_char); \
  1856. YY_RESTORE_YY_MORE_OFFSET \
  1857. (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  1858. YY_DO_BEFORE_ACTION; /* set up convert_text again */ \
  1859. } \
  1860. while ( 0 )
  1861. #define unput(c) yyunput( c, (yytext_ptr) )
  1862. #ifndef YY_STRUCT_YY_BUFFER_STATE
  1863. #define YY_STRUCT_YY_BUFFER_STATE
  1864. struct yy_buffer_state
  1865. {
  1866. FILE *yy_input_file;
  1867. char *yy_ch_buf; /* input buffer */
  1868. char *yy_buf_pos; /* current position in input buffer */
  1869. /* Size of input buffer in bytes, not including room for EOB
  1870. * characters.
  1871. */
  1872. yy_size_t yy_buf_size;
  1873. /* Number of characters read into yy_ch_buf, not including EOB
  1874. * characters.
  1875. */
  1876. yy_size_t yy_n_chars;
  1877. /* Whether we "own" the buffer - i.e., we know we created it,
  1878. * and can realloc() it to grow it, and should free() it to
  1879. * delete it.
  1880. */
  1881. int yy_is_our_buffer;
  1882. /* Whether this is an "interactive" input source; if so, and
  1883. * if we're using stdio for input, then we want to use getc()
  1884. * instead of fread(), to make sure we stop fetching input after
  1885. * each newline.
  1886. */
  1887. int yy_is_interactive;
  1888. /* Whether we're considered to be at the beginning of a line.
  1889. * If so, '^' rules will be active on the next match, otherwise
  1890. * not.
  1891. */
  1892. int yy_at_bol;
  1893. int yy_bs_lineno; /**< The line count. */
  1894. int yy_bs_column; /**< The column count. */
  1895. /* Whether to try to fill the input buffer when we reach the
  1896. * end of it.
  1897. */
  1898. int yy_fill_buffer;
  1899. int yy_buffer_status;
  1900. #define YY_BUFFER_NEW 0
  1901. #define YY_BUFFER_NORMAL 1
  1902. /* When an EOF's been seen but there's still some text to process
  1903. * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  1904. * shouldn't try reading from the input source any more. We might
  1905. * still have a bunch of tokens to match, though, because of
  1906. * possible backing-up.
  1907. *
  1908. * When we actually see the EOF, we change the status to "new"
  1909. * (via convert_restart()), so that the user can continue scanning by
  1910. * just pointing convert_in at a new input file.
  1911. */
  1912. #define YY_BUFFER_EOF_PENDING 2
  1913. };
  1914. #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  1915. /* Stack of input buffers. */
  1916. static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
  1917. static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
  1918. static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
  1919. /* We provide macros for accessing buffer states in case in the
  1920. * future we want to put the buffer states in a more general
  1921. * "scanner state".
  1922. *
  1923. * Returns the top of the stack, or NULL.
  1924. */
  1925. #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
  1926. ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
  1927. : NULL)
  1928. /* Same as previous macro, but useful when we know that the buffer stack is not
  1929. * NULL or when we need an lvalue. For internal use only.
  1930. */
  1931. #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
  1932. /* yy_hold_char holds the character lost when convert_text is formed. */
  1933. static char yy_hold_char;
  1934. static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
  1935. yy_size_t convert_leng;
  1936. /* Points to current character in buffer. */
  1937. static char *yy_c_buf_p = (char *) 0;
  1938. static int yy_init = 0; /* whether we need to initialize */
  1939. static int yy_start = 0; /* start state number */
  1940. /* Flag which is used to allow convert_wrap()'s to do buffer switches
  1941. * instead of setting up a fresh convert_in. A bit of a hack ...
  1942. */
  1943. static int yy_did_buffer_switch_on_eof;
  1944. void convert_restart (FILE *input_file );
  1945. void convert__switch_to_buffer (YY_BUFFER_STATE new_buffer );
  1946. YY_BUFFER_STATE convert__create_buffer (FILE *file,int size );
  1947. void convert__delete_buffer (YY_BUFFER_STATE b );
  1948. void convert__flush_buffer (YY_BUFFER_STATE b );
  1949. void convert_push_buffer_state (YY_BUFFER_STATE new_buffer );
  1950. void convert_pop_buffer_state (void );
  1951. static void convert_ensure_buffer_stack (void );
  1952. static void convert__load_buffer_state (void );
  1953. static void convert__init_buffer (YY_BUFFER_STATE b,FILE *file );
  1954. #define YY_FLUSH_BUFFER convert__flush_buffer(YY_CURRENT_BUFFER )
  1955. YY_BUFFER_STATE convert__scan_buffer (char *base,yy_size_t size );
  1956. YY_BUFFER_STATE convert__scan_string (yyconst char *yy_str );
  1957. YY_BUFFER_STATE convert__scan_bytes (yyconst char *bytes,yy_size_t len );
  1958. void *convert_alloc (yy_size_t );
  1959. void *convert_realloc (void *,yy_size_t );
  1960. void convert_free (void * );
  1961. #define yy_new_buffer convert__create_buffer
  1962. #define yy_set_interactive(is_interactive) \
  1963. { \
  1964. if ( ! YY_CURRENT_BUFFER ){ \
  1965. convert_ensure_buffer_stack (); \
  1966. YY_CURRENT_BUFFER_LVALUE = \
  1967. convert__create_buffer(convert_in,YY_BUF_SIZE ); \
  1968. } \
  1969. YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  1970. }
  1971. #define yy_set_bol(at_bol) \
  1972. { \
  1973. if ( ! YY_CURRENT_BUFFER ){\
  1974. convert_ensure_buffer_stack (); \
  1975. YY_CURRENT_BUFFER_LVALUE = \
  1976. convert__create_buffer(convert_in,YY_BUF_SIZE ); \
  1977. } \
  1978. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  1979. }
  1980. #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  1981. /* Begin user sect3 */
  1982. #define convert_wrap(n) 1
  1983. #define YY_SKIP_YYWRAP
  1984. typedef unsigned char YY_CHAR;
  1985. FILE *convert_in = (FILE *) 0, *convert_out = (FILE *) 0;
  1986. typedef int yy_state_type;
  1987. extern int convert_lineno;
  1988. int convert_lineno = 1;
  1989. extern char *convert_text;
  1990. #define yytext_ptr convert_text
  1991. static yy_state_type yy_get_previous_state (void );
  1992. static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
  1993. static int yy_get_next_buffer (void );
  1994. static void yy_fatal_error (yyconst char msg[] );
  1995. /* Done after the current pattern has been matched and before the
  1996. * corresponding action - sets up convert_text.
  1997. */
  1998. #define YY_DO_BEFORE_ACTION \
  1999. (yytext_ptr) = yy_bp; \
  2000. convert_leng = (yy_size_t) (yy_cp - yy_bp); \
  2001. (yy_hold_char) = *yy_cp; \
  2002. *yy_cp = '\0'; \
  2003. (yy_c_buf_p) = yy_cp;
  2004. #define YY_NUM_RULES 15
  2005. #define YY_END_OF_BUFFER 16
  2006. /* This struct is not used in this scanner,
  2007. but its presence is necessary. */
  2008. struct yy_trans_info
  2009. {
  2010. flex_int32_t yy_verify;
  2011. flex_int32_t yy_nxt;
  2012. };
  2013. static yyconst flex_int16_t yy_accept[84] =
  2014. { 0,
  2015. 0, 0, 0, 0, 16, 15, 14, 13, 15, 12,
  2016. 11, 11, 11, 11, 12, 7, 10, 10, 10, 10,
  2017. 10, 10, 10, 14, 0, 4, 11, 9, 9, 9,
  2018. 5, 10, 10, 10, 10, 10, 10, 10, 10, 8,
  2019. 10, 10, 10, 10, 10, 3, 10, 6, 10, 10,
  2020. 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  2021. 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
  2022. 10, 10, 2, 10, 10, 10, 1, 10, 10, 10,
  2023. 10, 8, 0
  2024. } ;
  2025. static yyconst flex_int32_t yy_ec[256] =
  2026. { 0,
  2027. 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
  2028. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2029. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2030. 1, 2, 1, 1, 1, 1, 4, 1, 1, 5,
  2031. 6, 1, 1, 7, 1, 1, 1, 8, 9, 10,
  2032. 11, 8, 8, 8, 12, 8, 8, 13, 14, 1,
  2033. 15, 1, 1, 1, 16, 17, 17, 18, 19, 20,
  2034. 21, 17, 22, 17, 23, 24, 25, 26, 27, 28,
  2035. 17, 29, 30, 31, 32, 17, 17, 33, 34, 17,
  2036. 35, 1, 36, 1, 37, 1, 38, 17, 17, 39,
  2037. 40, 41, 42, 17, 43, 17, 44, 45, 46, 47,
  2038. 48, 49, 17, 50, 51, 52, 53, 17, 17, 54,
  2039. 55, 17, 1, 1, 1, 1, 1, 1, 1, 1,
  2040. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2041. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2042. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2043. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2044. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2045. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2046. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2047. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2048. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2049. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2050. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2051. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2052. 1, 1, 1, 1, 1
  2053. } ;
  2054. static yyconst flex_int32_t yy_meta[56] =
  2055. { 0,
  2056. 1, 1, 2, 1, 1, 1, 1, 3, 3, 3,
  2057. 3, 3, 1, 1, 1, 3, 3, 3, 3, 3,
  2058. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  2059. 3, 3, 3, 3, 1, 1, 3, 3, 3, 3,
  2060. 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
  2061. 3, 3, 3, 3, 3
  2062. } ;
  2063. static yyconst flex_int16_t yy_base[86] =
  2064. { 0,
  2065. 0, 0, 0, 0, 192, 194, 186, 194, 176, 194,
  2066. 48, 53, 58, 69, 164, 194, 0, 60, 51, 47,
  2067. 49, 67, 55, 173, 170, 169, 90, 194, 194, 194,
  2068. 194, 0, 160, 53, 62, 58, 66, 62, 74, 0,
  2069. 85, 95, 94, 82, 101, 0, 101, 0, 91, 134,
  2070. 96, 133, 100, 103, 99, 105, 109, 106, 102, 101,
  2071. 113, 99, 115, 113, 119, 127, 123, 139, 130, 142,
  2072. 137, 132, 0, 81, 144, 143, 0, 136, 144, 150,
  2073. 139, 0, 194, 190, 81
  2074. } ;
  2075. static yyconst flex_int16_t yy_def[86] =
  2076. { 0,
  2077. 83, 1, 1, 1, 83, 83, 83, 83, 84, 83,
  2078. 83, 83, 83, 83, 83, 83, 85, 85, 85, 85,
  2079. 85, 85, 85, 83, 84, 84, 83, 83, 83, 83,
  2080. 83, 85, 85, 85, 85, 85, 85, 85, 85, 85,
  2081. 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
  2082. 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
  2083. 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
  2084. 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
  2085. 85, 85, 0, 83, 83
  2086. } ;
  2087. static yyconst flex_int16_t yy_nxt[250] =
  2088. { 0,
  2089. 6, 7, 8, 9, 10, 10, 10, 11, 12, 13,
  2090. 14, 11, 15, 10, 16, 17, 17, 17, 17, 18,
  2091. 17, 17, 19, 17, 17, 20, 21, 22, 17, 17,
  2092. 17, 23, 17, 17, 10, 10, 17, 17, 17, 17,
  2093. 18, 17, 17, 19, 17, 17, 20, 21, 22, 17,
  2094. 17, 17, 23, 17, 17, 27, 27, 27, 27, 27,
  2095. 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
  2096. 28, 33, 35, 36, 37, 29, 27, 27, 27, 27,
  2097. 27, 34, 38, 32, 39, 41, 30, 42, 43, 44,
  2098. 45, 28, 46, 35, 36, 37, 29, 27, 27, 27,
  2099. 27, 27, 34, 47, 38, 39, 41, 30, 42, 43,
  2100. 44, 45, 48, 46, 49, 50, 51, 76, 52, 53,
  2101. 55, 57, 58, 59, 47, 60, 61, 62, 63, 64,
  2102. 65, 66, 67, 48, 68, 49, 50, 69, 51, 52,
  2103. 53, 55, 57, 58, 59, 70, 60, 61, 62, 63,
  2104. 64, 65, 66, 67, 71, 68, 72, 73, 69, 74,
  2105. 75, 40, 77, 78, 79, 80, 70, 81, 82, 56,
  2106. 54, 40, 26, 26, 24, 71, 31, 72, 73, 26,
  2107. 74, 75, 40, 77, 78, 79, 80, 24, 81, 82,
  2108. 25, 83, 25, 5, 83, 83, 83, 83, 83, 83,
  2109. 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
  2110. 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
  2111. 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
  2112. 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
  2113. 83, 83, 83, 83, 83, 83, 83, 83, 83
  2114. } ;
  2115. static yyconst flex_int16_t yy_chk[250] =
  2116. { 0,
  2117. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2118. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2119. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2120. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2121. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  2122. 1, 1, 1, 1, 1, 11, 11, 11, 11, 11,
  2123. 12, 12, 12, 12, 12, 13, 13, 13, 13, 13,
  2124. 12, 18, 19, 20, 21, 13, 14, 14, 14, 14,
  2125. 14, 18, 22, 85, 23, 34, 14, 35, 36, 37,
  2126. 38, 12, 39, 19, 20, 21, 13, 27, 27, 27,
  2127. 27, 27, 18, 41, 22, 23, 34, 14, 35, 36,
  2128. 37, 38, 42, 39, 43, 44, 45, 74, 47, 49,
  2129. 51, 53, 54, 55, 41, 56, 57, 58, 59, 60,
  2130. 61, 62, 63, 42, 64, 43, 44, 65, 45, 47,
  2131. 49, 51, 53, 54, 55, 66, 56, 57, 58, 59,
  2132. 60, 61, 62, 63, 67, 64, 68, 69, 65, 70,
  2133. 71, 72, 75, 76, 78, 79, 66, 80, 81, 52,
  2134. 50, 33, 26, 25, 24, 67, 15, 68, 69, 9,
  2135. 70, 71, 72, 75, 76, 78, 79, 7, 80, 81,
  2136. 84, 5, 84, 83, 83, 83, 83, 83, 83, 83,
  2137. 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
  2138. 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
  2139. 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
  2140. 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
  2141. 83, 83, 83, 83, 83, 83, 83, 83, 83
  2142. } ;
  2143. static yy_state_type yy_last_accepting_state;
  2144. static char *yy_last_accepting_cpos;
  2145. extern int convert__flex_debug;
  2146. int convert__flex_debug = 0;
  2147. /* The intent behind this definition is that it'll catch
  2148. * any uses of REJECT which flex missed.
  2149. */
  2150. #define REJECT reject_used_but_not_detected
  2151. #define yymore() yymore_used_but_not_detected
  2152. #define YY_MORE_ADJ 0
  2153. #define YY_RESTORE_YY_MORE_OFFSET
  2154. char *convert_text;
  2155. #line 1 "convert.lex"
  2156. /******************************************************************************/
  2157. /* */
  2158. /* CONV (converter) for Agrif (Adaptive Grid Refinement In Fortran) */
  2159. /* */
  2160. /* Copyright or or Copr. Laurent Debreu (Laurent.Debreu@imag.fr) */
  2161. /* Cyril Mazauric (Cyril_Mazauric@yahoo.fr) */
  2162. /* This software is governed by the CeCILL-C license under French law and */
  2163. /* abiding by the rules of distribution of free software. You can use, */
  2164. /* modify and/ or redistribute the software under the terms of the CeCILL-C */
  2165. /* license as circulated by CEA, CNRS and INRIA at the following URL */
  2166. /* "http://www.cecill.info". */
  2167. /* */
  2168. /* As a counterpart to the access to the source code and rights to copy, */
  2169. /* modify and redistribute granted by the license, users are provided only */
  2170. /* with a limited warranty and the software's author, the holder of the */
  2171. /* economic rights, and the successive licensors have only limited */
  2172. /* liability. */
  2173. /* */
  2174. /* In this respect, the user's attention is drawn to the risks associated */
  2175. /* with loading, using, modifying and/or developing or reproducing the */
  2176. /* software by the user in light of its specific status of free software, */
  2177. /* that may mean that it is complicated to manipulate, and that also */
  2178. /* therefore means that it is reserved for developers and experienced */
  2179. /* professionals having in-depth computer knowledge. Users are therefore */
  2180. /* encouraged to load and test the software's suitability as regards their */
  2181. /* requirements in conditions enabling the security of their systems and/or */
  2182. /* data to be ensured and, more generally, to use and operate it in the */
  2183. /* same conditions as regards security. */
  2184. /* */
  2185. /* The fact that you are presently reading this means that you have had */
  2186. /* knowledge of the CeCILL-C license and that you accept its terms. */
  2187. /******************************************************************************/
  2188. /* version 1.7 */
  2189. /******************************************************************************/
  2190. #line 40 "convert.lex"
  2191. #include <math.h>
  2192. #include <stdlib.h>
  2193. #include <string.h>
  2194. #define YY_NO_INPUT
  2195. #line 595 "convert.yy.c"
  2196. #define INITIAL 0
  2197. #define character 1
  2198. #ifndef YY_NO_UNISTD_H
  2199. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  2200. * down here because we want the user's section 1 to have been scanned first.
  2201. * The user has a chance to override it with an option.
  2202. */
  2203. #include <unistd.h>
  2204. #endif
  2205. #ifndef YY_EXTRA_TYPE
  2206. #define YY_EXTRA_TYPE void *
  2207. #endif
  2208. static int yy_init_globals (void );
  2209. /* Accessor methods to globals.
  2210. These are made visible to non-reentrant scanners for convenience. */
  2211. int convert_lex_destroy (void );
  2212. int convert_get_debug (void );
  2213. void convert_set_debug (int debug_flag );
  2214. YY_EXTRA_TYPE convert_get_extra (void );
  2215. void convert_set_extra (YY_EXTRA_TYPE user_defined );
  2216. FILE *convert_get_in (void );
  2217. void convert_set_in (FILE * in_str );
  2218. FILE *convert_get_out (void );
  2219. void convert_set_out (FILE * out_str );
  2220. yy_size_t convert_get_leng (void );
  2221. char *convert_get_text (void );
  2222. int convert_get_lineno (void );
  2223. void convert_set_lineno (int line_number );
  2224. /* Macros after this point can all be overridden by user definitions in
  2225. * section 1.
  2226. */
  2227. #ifndef YY_SKIP_YYWRAP
  2228. #ifdef __cplusplus
  2229. extern "C" int convert_wrap (void );
  2230. #else
  2231. extern int convert_wrap (void );
  2232. #endif
  2233. #endif
  2234. static void yyunput (int c,char *buf_ptr );
  2235. #ifndef yytext_ptr
  2236. static void yy_flex_strncpy (char *,yyconst char *,int );
  2237. #endif
  2238. #ifdef YY_NEED_STRLEN
  2239. static int yy_flex_strlen (yyconst char * );
  2240. #endif
  2241. #ifndef YY_NO_INPUT
  2242. #ifdef __cplusplus
  2243. static int yyinput (void );
  2244. #else
  2245. static int input (void );
  2246. #endif
  2247. #endif
  2248. /* Amount of stuff to slurp up with each read. */
  2249. #ifndef YY_READ_BUF_SIZE
  2250. #define YY_READ_BUF_SIZE 8192
  2251. #endif
  2252. /* Copy whatever the last rule matched to the standard output. */
  2253. #ifndef ECHO
  2254. /* This used to be an fputs(), but since the string might contain NUL's,
  2255. * we now use fwrite().
  2256. */
  2257. #define ECHO fwrite( convert_text, convert_leng, 1, convert_out )
  2258. #endif
  2259. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  2260. * is returned in "result".
  2261. */
  2262. #ifndef YY_INPUT
  2263. #define YY_INPUT(buf,result,max_size) \
  2264. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  2265. { \
  2266. int c = '*'; \
  2267. yy_size_t n; \
  2268. for ( n = 0; n < max_size && \
  2269. (c = getc( convert_in )) != EOF && c != '\n'; ++n ) \
  2270. buf[n] = (char) c; \
  2271. if ( c == '\n' ) \
  2272. buf[n++] = (char) c; \
  2273. if ( c == EOF && ferror( convert_in ) ) \
  2274. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  2275. result = n; \
  2276. } \
  2277. else \
  2278. { \
  2279. errno=0; \
  2280. while ( (result = fread(buf, 1, max_size, convert_in))==0 && ferror(convert_in)) \
  2281. { \
  2282. if( errno != EINTR) \
  2283. { \
  2284. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  2285. break; \
  2286. } \
  2287. errno=0; \
  2288. clearerr(convert_in); \
  2289. } \
  2290. }\
  2291. \
  2292. #endif
  2293. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  2294. * we don't want an extra ';' after the "return" because that will cause
  2295. * some compilers to complain about unreachable statements.
  2296. */
  2297. #ifndef yyterminate
  2298. #define yyterminate() return YY_NULL
  2299. #endif
  2300. /* Number of entries by which start-condition stack grows. */
  2301. #ifndef YY_START_STACK_INCR
  2302. #define YY_START_STACK_INCR 25
  2303. #endif
  2304. /* Report a fatal error. */
  2305. #ifndef YY_FATAL_ERROR
  2306. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  2307. #endif
  2308. /* end tables serialization structures and prototypes */
  2309. /* Default declaration of generated scanner - a define so the user can
  2310. * easily add parameters.
  2311. */
  2312. #ifndef YY_DECL
  2313. #define YY_DECL_IS_OURS 1
  2314. extern int convert_lex (void);
  2315. #define YY_DECL int convert_lex (void)
  2316. #endif /* !YY_DECL */
  2317. /* Code executed at the beginning of each rule, after convert_text and convert_leng
  2318. * have been set up.
  2319. */
  2320. #ifndef YY_USER_ACTION
  2321. #define YY_USER_ACTION
  2322. #endif
  2323. /* Code executed at the end of each rule. */
  2324. #ifndef YY_BREAK
  2325. #define YY_BREAK break;
  2326. #endif
  2327. #define YY_RULE_SETUP \
  2328. YY_USER_ACTION
  2329. /** The main scanner function which does all the work.
  2330. */
  2331. YY_DECL
  2332. {
  2333. register yy_state_type yy_current_state;
  2334. register char *yy_cp, *yy_bp;
  2335. register int yy_act;
  2336. #line 54 "convert.lex"
  2337. #line 780 "convert.yy.c"
  2338. if ( !(yy_init) )
  2339. {
  2340. (yy_init) = 1;
  2341. #ifdef YY_USER_INIT
  2342. YY_USER_INIT;
  2343. #endif
  2344. if ( ! (yy_start) )
  2345. (yy_start) = 1; /* first start state */
  2346. if ( ! convert_in )
  2347. convert_in = stdin;
  2348. if ( ! convert_out )
  2349. convert_out = stdout;
  2350. if ( ! YY_CURRENT_BUFFER ) {
  2351. convert_ensure_buffer_stack ();
  2352. YY_CURRENT_BUFFER_LVALUE =
  2353. convert__create_buffer(convert_in,YY_BUF_SIZE );
  2354. }
  2355. convert__load_buffer_state( );
  2356. }
  2357. while ( 1 ) /* loops until end-of-file is reached */
  2358. {
  2359. yy_cp = (yy_c_buf_p);
  2360. /* Support of convert_text. */
  2361. *yy_cp = (yy_hold_char);
  2362. /* yy_bp points to the position in yy_ch_buf of the start of
  2363. * the current run.
  2364. */
  2365. yy_bp = yy_cp;
  2366. yy_current_state = (yy_start);
  2367. yy_match:
  2368. do
  2369. {
  2370. register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  2371. if ( yy_accept[yy_current_state] )
  2372. {
  2373. (yy_last_accepting_state) = yy_current_state;
  2374. (yy_last_accepting_cpos) = yy_cp;
  2375. }
  2376. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  2377. {
  2378. yy_current_state = (int) yy_def[yy_current_state];
  2379. if ( yy_current_state >= 84 )
  2380. yy_c = yy_meta[(unsigned int) yy_c];
  2381. }
  2382. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  2383. ++yy_cp;
  2384. }
  2385. while ( yy_base[yy_current_state] != 194 );
  2386. yy_find_action:
  2387. yy_act = yy_accept[yy_current_state];
  2388. if ( yy_act == 0 )
  2389. { /* have to back up */
  2390. yy_cp = (yy_last_accepting_cpos);
  2391. yy_current_state = (yy_last_accepting_state);
  2392. yy_act = yy_accept[yy_current_state];
  2393. }
  2394. YY_DO_BEFORE_ACTION;
  2395. do_action: /* This label is used only to access EOF actions. */
  2396. switch ( yy_act )
  2397. { /* beginning of action switch */
  2398. case 0: /* must back up */
  2399. /* undo the effects of YY_DO_BEFORE_ACTION */
  2400. *yy_cp = (yy_hold_char);
  2401. yy_cp = (yy_last_accepting_cpos);
  2402. yy_current_state = (yy_last_accepting_state);
  2403. goto yy_find_action;
  2404. case 1:
  2405. YY_RULE_SETUP
  2406. #line 55 "convert.lex"
  2407. { return TOK_MODULEMAIN; } /* name of the module */
  2408. YY_BREAK
  2409. case 2:
  2410. YY_RULE_SETUP
  2411. #line 56 "convert.lex"
  2412. { return TOK_NOTGRIDDEP; } /* variable which are not grid dependent */
  2413. YY_BREAK
  2414. case 3:
  2415. YY_RULE_SETUP
  2416. #line 57 "convert.lex"
  2417. { return TOK_USE; }
  2418. YY_BREAK
  2419. case 4:
  2420. YY_RULE_SETUP
  2421. #line 58 "convert.lex"
  2422. { }
  2423. YY_BREAK
  2424. case 5:
  2425. YY_RULE_SETUP
  2426. #line 59 "convert.lex"
  2427. { return TOK_SEP; }
  2428. YY_BREAK
  2429. case 6:
  2430. YY_RULE_SETUP
  2431. #line 60 "convert.lex"
  2432. { return TOK_KIND; }
  2433. YY_BREAK
  2434. case 7:
  2435. YY_RULE_SETUP
  2436. #line 61 "convert.lex"
  2437. { return TOK_EQUAL; }
  2438. YY_BREAK
  2439. case 8:
  2440. YY_RULE_SETUP
  2441. #line 62 "convert.lex"
  2442. { strcpy(yylval.na,convert_text); return TOK_USEITEM; }
  2443. YY_BREAK
  2444. case 9:
  2445. YY_RULE_SETUP
  2446. #line 63 "convert.lex"
  2447. { strcpy(yylval.na,convert_text); return TOK_PROBTYPE; } /* dimension of the problem */
  2448. YY_BREAK
  2449. case 10:
  2450. YY_RULE_SETUP
  2451. #line 64 "convert.lex"
  2452. { strcpy(yylval.na,convert_text); return TOK_NAME; }
  2453. YY_BREAK
  2454. case 11:
  2455. YY_RULE_SETUP
  2456. #line 65 "convert.lex"
  2457. { strcpy(yylval.na,convert_text); return TOK_CSTINT; }
  2458. YY_BREAK
  2459. case 12:
  2460. YY_RULE_SETUP
  2461. #line 66 "convert.lex"
  2462. { return (int) *convert_text; }
  2463. YY_BREAK
  2464. case 13:
  2465. /* rule 13 can match eol */
  2466. YY_RULE_SETUP
  2467. #line 67 "convert.lex"
  2468. { line_num++; return (int) *convert_text; }
  2469. YY_BREAK
  2470. case 14:
  2471. YY_RULE_SETUP
  2472. #line 68 "convert.lex"
  2473. ;
  2474. YY_BREAK
  2475. case 15:
  2476. YY_RULE_SETUP
  2477. #line 69 "convert.lex"
  2478. ECHO;
  2479. YY_BREAK
  2480. #line 939 "convert.yy.c"
  2481. case YY_STATE_EOF(INITIAL):
  2482. case YY_STATE_EOF(character):
  2483. yyterminate();
  2484. case YY_END_OF_BUFFER:
  2485. {
  2486. /* Amount of text matched not including the EOB char. */
  2487. int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
  2488. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  2489. *yy_cp = (yy_hold_char);
  2490. YY_RESTORE_YY_MORE_OFFSET
  2491. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  2492. {
  2493. /* We're scanning a new file or input source. It's
  2494. * possible that this happened because the user
  2495. * just pointed convert_in at a new source and called
  2496. * convert_lex(). If so, then we have to assure
  2497. * consistency between YY_CURRENT_BUFFER and our
  2498. * globals. Here is the right place to do so, because
  2499. * this is the first action (other than possibly a
  2500. * back-up) that will match for the new input source.
  2501. */
  2502. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  2503. YY_CURRENT_BUFFER_LVALUE->yy_input_file = convert_in;
  2504. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  2505. }
  2506. /* Note that here we test for yy_c_buf_p "<=" to the position
  2507. * of the first EOB in the buffer, since yy_c_buf_p will
  2508. * already have been incremented past the NUL character
  2509. * (since all states make transitions on EOB to the
  2510. * end-of-buffer state). Contrast this with the test
  2511. * in input().
  2512. */
  2513. if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  2514. { /* This was really a NUL. */
  2515. yy_state_type yy_next_state;
  2516. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  2517. yy_current_state = yy_get_previous_state( );
  2518. /* Okay, we're now positioned to make the NUL
  2519. * transition. We couldn't have
  2520. * yy_get_previous_state() go ahead and do it
  2521. * for us because it doesn't know how to deal
  2522. * with the possibility of jamming (and we don't
  2523. * want to build jamming into it because then it
  2524. * will run more slowly).
  2525. */
  2526. yy_next_state = yy_try_NUL_trans( yy_current_state );
  2527. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  2528. if ( yy_next_state )
  2529. {
  2530. /* Consume the NUL. */
  2531. yy_cp = ++(yy_c_buf_p);
  2532. yy_current_state = yy_next_state;
  2533. goto yy_match;
  2534. }
  2535. else
  2536. {
  2537. yy_cp = (yy_c_buf_p);
  2538. goto yy_find_action;
  2539. }
  2540. }
  2541. else switch ( yy_get_next_buffer( ) )
  2542. {
  2543. case EOB_ACT_END_OF_FILE:
  2544. {
  2545. (yy_did_buffer_switch_on_eof) = 0;
  2546. if ( convert_wrap( ) )
  2547. {
  2548. /* Note: because we've taken care in
  2549. * yy_get_next_buffer() to have set up
  2550. * convert_text, we can now set up
  2551. * yy_c_buf_p so that if some total
  2552. * hoser (like flex itself) wants to
  2553. * call the scanner after we return the
  2554. * YY_NULL, it'll still work - another
  2555. * YY_NULL will get returned.
  2556. */
  2557. (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  2558. yy_act = YY_STATE_EOF(YY_START);
  2559. goto do_action;
  2560. }
  2561. else
  2562. {
  2563. if ( ! (yy_did_buffer_switch_on_eof) )
  2564. YY_NEW_FILE;
  2565. }
  2566. break;
  2567. }
  2568. case EOB_ACT_CONTINUE_SCAN:
  2569. (yy_c_buf_p) =
  2570. (yytext_ptr) + yy_amount_of_matched_text;
  2571. yy_current_state = yy_get_previous_state( );
  2572. yy_cp = (yy_c_buf_p);
  2573. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  2574. goto yy_match;
  2575. case EOB_ACT_LAST_MATCH:
  2576. (yy_c_buf_p) =
  2577. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  2578. yy_current_state = yy_get_previous_state( );
  2579. yy_cp = (yy_c_buf_p);
  2580. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  2581. goto yy_find_action;
  2582. }
  2583. break;
  2584. }
  2585. default:
  2586. YY_FATAL_ERROR(
  2587. "fatal flex scanner internal error--no action found" );
  2588. } /* end of action switch */
  2589. } /* end of scanning one token */
  2590. } /* end of convert_lex */
  2591. /* yy_get_next_buffer - try to read in a new buffer
  2592. *
  2593. * Returns a code representing an action:
  2594. * EOB_ACT_LAST_MATCH -
  2595. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  2596. * EOB_ACT_END_OF_FILE - end of file
  2597. */
  2598. static int yy_get_next_buffer (void)
  2599. {
  2600. register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  2601. register char *source = (yytext_ptr);
  2602. register int number_to_move, i;
  2603. int ret_val;
  2604. if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
  2605. YY_FATAL_ERROR(
  2606. "fatal flex scanner internal error--end of buffer missed" );
  2607. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  2608. { /* Don't try to fill the buffer, so this is an EOF. */
  2609. if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
  2610. {
  2611. /* We matched a single character, the EOB, so
  2612. * treat this as a final EOF.
  2613. */
  2614. return EOB_ACT_END_OF_FILE;
  2615. }
  2616. else
  2617. {
  2618. /* We matched some text prior to the EOB, first
  2619. * process it.
  2620. */
  2621. return EOB_ACT_LAST_MATCH;
  2622. }
  2623. }
  2624. /* Try to read more data. */
  2625. /* First move last chars to start of buffer. */
  2626. number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
  2627. for ( i = 0; i < number_to_move; ++i )
  2628. *(dest++) = *(source++);
  2629. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  2630. /* don't do the read, it's not guaranteed to return an EOF,
  2631. * just force an EOF
  2632. */
  2633. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  2634. else
  2635. {
  2636. yy_size_t num_to_read =
  2637. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  2638. while ( num_to_read <= 0 )
  2639. { /* Not enough room in the buffer - grow it. */
  2640. /* just a shorter name for the current buffer */
  2641. YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
  2642. int yy_c_buf_p_offset =
  2643. (int) ((yy_c_buf_p) - b->yy_ch_buf);
  2644. if ( b->yy_is_our_buffer )
  2645. {
  2646. yy_size_t new_size = b->yy_buf_size * 2;
  2647. if ( new_size <= 0 )
  2648. b->yy_buf_size += b->yy_buf_size / 8;
  2649. else
  2650. b->yy_buf_size *= 2;
  2651. b->yy_ch_buf = (char *)
  2652. /* Include room in for 2 EOB chars. */
  2653. convert_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
  2654. }
  2655. else
  2656. /* Can't grow it, we don't own it. */
  2657. b->yy_ch_buf = 0;
  2658. if ( ! b->yy_ch_buf )
  2659. YY_FATAL_ERROR(
  2660. "fatal error - scanner input buffer overflow" );
  2661. (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
  2662. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  2663. number_to_move - 1;
  2664. }
  2665. if ( num_to_read > YY_READ_BUF_SIZE )
  2666. num_to_read = YY_READ_BUF_SIZE;
  2667. /* Read in more data. */
  2668. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  2669. (yy_n_chars), num_to_read );
  2670. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  2671. }
  2672. if ( (yy_n_chars) == 0 )
  2673. {
  2674. if ( number_to_move == YY_MORE_ADJ )
  2675. {
  2676. ret_val = EOB_ACT_END_OF_FILE;
  2677. convert_restart(convert_in );
  2678. }
  2679. else
  2680. {
  2681. ret_val = EOB_ACT_LAST_MATCH;
  2682. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  2683. YY_BUFFER_EOF_PENDING;
  2684. }
  2685. }
  2686. else
  2687. ret_val = EOB_ACT_CONTINUE_SCAN;
  2688. if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  2689. /* Extend the array by 50%, plus the number we really need. */
  2690. yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  2691. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) convert_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
  2692. if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  2693. YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  2694. }
  2695. (yy_n_chars) += number_to_move;
  2696. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  2697. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  2698. (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  2699. return ret_val;
  2700. }
  2701. /* yy_get_previous_state - get the state just before the EOB char was reached */
  2702. static yy_state_type yy_get_previous_state (void)
  2703. {
  2704. register yy_state_type yy_current_state;
  2705. register char *yy_cp;
  2706. yy_current_state = (yy_start);
  2707. for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
  2708. {
  2709. register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  2710. if ( yy_accept[yy_current_state] )
  2711. {
  2712. (yy_last_accepting_state) = yy_current_state;
  2713. (yy_last_accepting_cpos) = yy_cp;
  2714. }
  2715. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  2716. {
  2717. yy_current_state = (int) yy_def[yy_current_state];
  2718. if ( yy_current_state >= 84 )
  2719. yy_c = yy_meta[(unsigned int) yy_c];
  2720. }
  2721. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  2722. }
  2723. return yy_current_state;
  2724. }
  2725. /* yy_try_NUL_trans - try to make a transition on the NUL character
  2726. *
  2727. * synopsis
  2728. * next_state = yy_try_NUL_trans( current_state );
  2729. */
  2730. static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
  2731. {
  2732. register int yy_is_jam;
  2733. register char *yy_cp = (yy_c_buf_p);
  2734. register YY_CHAR yy_c = 1;
  2735. if ( yy_accept[yy_current_state] )
  2736. {
  2737. (yy_last_accepting_state) = yy_current_state;
  2738. (yy_last_accepting_cpos) = yy_cp;
  2739. }
  2740. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  2741. {
  2742. yy_current_state = (int) yy_def[yy_current_state];
  2743. if ( yy_current_state >= 84 )
  2744. yy_c = yy_meta[(unsigned int) yy_c];
  2745. }
  2746. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  2747. yy_is_jam = (yy_current_state == 83);
  2748. return yy_is_jam ? 0 : yy_current_state;
  2749. }
  2750. static void yyunput (int c, register char * yy_bp )
  2751. {
  2752. register char *yy_cp;
  2753. yy_cp = (yy_c_buf_p);
  2754. /* undo effects of setting up convert_text */
  2755. *yy_cp = (yy_hold_char);
  2756. if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  2757. { /* need to shift things up to make room */
  2758. /* +2 for EOB chars. */
  2759. register yy_size_t number_to_move = (yy_n_chars) + 2;
  2760. register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
  2761. YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
  2762. register char *source =
  2763. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
  2764. while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  2765. *--dest = *--source;
  2766. yy_cp += (int) (dest - source);
  2767. yy_bp += (int) (dest - source);
  2768. YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
  2769. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
  2770. if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
  2771. YY_FATAL_ERROR( "flex scanner push-back overflow" );
  2772. }
  2773. *--yy_cp = (char) c;
  2774. (yytext_ptr) = yy_bp;
  2775. (yy_hold_char) = *yy_cp;
  2776. (yy_c_buf_p) = yy_cp;
  2777. }
  2778. #ifndef YY_NO_INPUT
  2779. #ifdef __cplusplus
  2780. static int yyinput (void)
  2781. #else
  2782. static int input (void)
  2783. #endif
  2784. {
  2785. int c;
  2786. *(yy_c_buf_p) = (yy_hold_char);
  2787. if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
  2788. {
  2789. /* yy_c_buf_p now points to the character we want to return.
  2790. * If this occurs *before* the EOB characters, then it's a
  2791. * valid NUL; if not, then we've hit the end of the buffer.
  2792. */
  2793. if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  2794. /* This was really a NUL. */
  2795. *(yy_c_buf_p) = '\0';
  2796. else
  2797. { /* need more input */
  2798. yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
  2799. ++(yy_c_buf_p);
  2800. switch ( yy_get_next_buffer( ) )
  2801. {
  2802. case EOB_ACT_LAST_MATCH:
  2803. /* This happens because yy_g_n_b()
  2804. * sees that we've accumulated a
  2805. * token and flags that we need to
  2806. * try matching the token before
  2807. * proceeding. But for input(),
  2808. * there's no matching to consider.
  2809. * So convert the EOB_ACT_LAST_MATCH
  2810. * to EOB_ACT_END_OF_FILE.
  2811. */
  2812. /* Reset buffer status. */
  2813. convert_restart(convert_in );
  2814. /*FALLTHROUGH*/
  2815. case EOB_ACT_END_OF_FILE:
  2816. {
  2817. if ( convert_wrap( ) )
  2818. return 0;
  2819. if ( ! (yy_did_buffer_switch_on_eof) )
  2820. YY_NEW_FILE;
  2821. #ifdef __cplusplus
  2822. return yyinput();
  2823. #else
  2824. return input();
  2825. #endif
  2826. }
  2827. case EOB_ACT_CONTINUE_SCAN:
  2828. (yy_c_buf_p) = (yytext_ptr) + offset;
  2829. break;
  2830. }
  2831. }
  2832. }
  2833. c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
  2834. *(yy_c_buf_p) = '\0'; /* preserve convert_text */
  2835. (yy_hold_char) = *++(yy_c_buf_p);
  2836. return c;
  2837. }
  2838. #endif /* ifndef YY_NO_INPUT */
  2839. /** Immediately switch to a different input stream.
  2840. * @param input_file A readable stream.
  2841. *
  2842. * @note This function does not reset the start condition to @c INITIAL .
  2843. */
  2844. void convert_restart (FILE * input_file )
  2845. {
  2846. if ( ! YY_CURRENT_BUFFER ){
  2847. convert_ensure_buffer_stack ();
  2848. YY_CURRENT_BUFFER_LVALUE =
  2849. convert__create_buffer(convert_in,YY_BUF_SIZE );
  2850. }
  2851. convert__init_buffer(YY_CURRENT_BUFFER,input_file );
  2852. convert__load_buffer_state( );
  2853. }
  2854. /** Switch to a different input buffer.
  2855. * @param new_buffer The new input buffer.
  2856. *
  2857. */
  2858. void convert__switch_to_buffer (YY_BUFFER_STATE new_buffer )
  2859. {
  2860. /* TODO. We should be able to replace this entire function body
  2861. * with
  2862. * convert_pop_buffer_state();
  2863. * convert_push_buffer_state(new_buffer);
  2864. */
  2865. convert_ensure_buffer_stack ();
  2866. if ( YY_CURRENT_BUFFER == new_buffer )
  2867. return;
  2868. if ( YY_CURRENT_BUFFER )
  2869. {
  2870. /* Flush out information for old buffer. */
  2871. *(yy_c_buf_p) = (yy_hold_char);
  2872. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  2873. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  2874. }
  2875. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  2876. convert__load_buffer_state( );
  2877. /* We don't actually know whether we did this switch during
  2878. * EOF (convert_wrap()) processing, but the only time this flag
  2879. * is looked at is after convert_wrap() is called, so it's safe
  2880. * to go ahead and always set it.
  2881. */
  2882. (yy_did_buffer_switch_on_eof) = 1;
  2883. }
  2884. static void convert__load_buffer_state (void)
  2885. {
  2886. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  2887. (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  2888. convert_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  2889. (yy_hold_char) = *(yy_c_buf_p);
  2890. }
  2891. /** Allocate and initialize an input buffer state.
  2892. * @param file A readable stream.
  2893. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  2894. *
  2895. * @return the allocated buffer state.
  2896. */
  2897. YY_BUFFER_STATE convert__create_buffer (FILE * file, int size )
  2898. {
  2899. YY_BUFFER_STATE b;
  2900. b = (YY_BUFFER_STATE) convert_alloc(sizeof( struct yy_buffer_state ) );
  2901. if ( ! b )
  2902. YY_FATAL_ERROR( "out of dynamic memory in convert__create_buffer()" );
  2903. b->yy_buf_size = size;
  2904. /* yy_ch_buf has to be 2 characters longer than the size given because
  2905. * we need to put in 2 end-of-buffer characters.
  2906. */
  2907. b->yy_ch_buf = (char *) convert_alloc(b->yy_buf_size + 2 );
  2908. if ( ! b->yy_ch_buf )
  2909. YY_FATAL_ERROR( "out of dynamic memory in convert__create_buffer()" );
  2910. b->yy_is_our_buffer = 1;
  2911. convert__init_buffer(b,file );
  2912. return b;
  2913. }
  2914. /** Destroy the buffer.
  2915. * @param b a buffer created with convert__create_buffer()
  2916. *
  2917. */
  2918. void convert__delete_buffer (YY_BUFFER_STATE b )
  2919. {
  2920. if ( ! b )
  2921. return;
  2922. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  2923. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  2924. if ( b->yy_is_our_buffer )
  2925. convert_free((void *) b->yy_ch_buf );
  2926. convert_free((void *) b );
  2927. }
  2928. #ifndef __cplusplus
  2929. extern int isatty (int );
  2930. #endif /* __cplusplus */
  2931. /* Initializes or reinitializes a buffer.
  2932. * This function is sometimes called more than once on the same buffer,
  2933. * such as during a convert_restart() or at EOF.
  2934. */
  2935. static void convert__init_buffer (YY_BUFFER_STATE b, FILE * file )
  2936. {
  2937. int oerrno = errno;
  2938. convert__flush_buffer(b );
  2939. b->yy_input_file = file;
  2940. b->yy_fill_buffer = 1;
  2941. /* If b is the current buffer, then convert__init_buffer was _probably_
  2942. * called from convert_restart() or through yy_get_next_buffer.
  2943. * In that case, we don't want to reset the lineno or column.
  2944. */
  2945. if (b != YY_CURRENT_BUFFER){
  2946. b->yy_bs_lineno = 1;
  2947. b->yy_bs_column = 0;
  2948. }
  2949. b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  2950. errno = oerrno;
  2951. }
  2952. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  2953. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  2954. *
  2955. */
  2956. void convert__flush_buffer (YY_BUFFER_STATE b )
  2957. {
  2958. if ( ! b )
  2959. return;
  2960. b->yy_n_chars = 0;
  2961. /* We always need two end-of-buffer characters. The first causes
  2962. * a transition to the end-of-buffer state. The second causes
  2963. * a jam in that state.
  2964. */
  2965. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  2966. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  2967. b->yy_buf_pos = &b->yy_ch_buf[0];
  2968. b->yy_at_bol = 1;
  2969. b->yy_buffer_status = YY_BUFFER_NEW;
  2970. if ( b == YY_CURRENT_BUFFER )
  2971. convert__load_buffer_state( );
  2972. }
  2973. /** Pushes the new state onto the stack. The new state becomes
  2974. * the current state. This function will allocate the stack
  2975. * if necessary.
  2976. * @param new_buffer The new state.
  2977. *
  2978. */
  2979. void convert_push_buffer_state (YY_BUFFER_STATE new_buffer )
  2980. {
  2981. if (new_buffer == NULL)
  2982. return;
  2983. convert_ensure_buffer_stack();
  2984. /* This block is copied from convert__switch_to_buffer. */
  2985. if ( YY_CURRENT_BUFFER )
  2986. {
  2987. /* Flush out information for old buffer. */
  2988. *(yy_c_buf_p) = (yy_hold_char);
  2989. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  2990. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  2991. }
  2992. /* Only push if top exists. Otherwise, replace top. */
  2993. if (YY_CURRENT_BUFFER)
  2994. (yy_buffer_stack_top)++;
  2995. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  2996. /* copied from convert__switch_to_buffer. */
  2997. convert__load_buffer_state( );
  2998. (yy_did_buffer_switch_on_eof) = 1;
  2999. }
  3000. /** Removes and deletes the top of the stack, if present.
  3001. * The next element becomes the new top.
  3002. *
  3003. */
  3004. void convert_pop_buffer_state (void)
  3005. {
  3006. if (!YY_CURRENT_BUFFER)
  3007. return;
  3008. convert__delete_buffer(YY_CURRENT_BUFFER );
  3009. YY_CURRENT_BUFFER_LVALUE = NULL;
  3010. if ((yy_buffer_stack_top) > 0)
  3011. --(yy_buffer_stack_top);
  3012. if (YY_CURRENT_BUFFER) {
  3013. convert__load_buffer_state( );
  3014. (yy_did_buffer_switch_on_eof) = 1;
  3015. }
  3016. }
  3017. /* Allocates the stack if it does not exist.
  3018. * Guarantees space for at least one push.
  3019. */
  3020. static void convert_ensure_buffer_stack (void)
  3021. {
  3022. yy_size_t num_to_alloc;
  3023. if (!(yy_buffer_stack)) {
  3024. /* First allocation is just for 2 elements, since we don't know if this
  3025. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  3026. * immediate realloc on the next call.
  3027. */
  3028. num_to_alloc = 1;
  3029. (yy_buffer_stack) = (struct yy_buffer_state**)convert_alloc
  3030. (num_to_alloc * sizeof(struct yy_buffer_state*)
  3031. );
  3032. if ( ! (yy_buffer_stack) )
  3033. YY_FATAL_ERROR( "out of dynamic memory in convert_ensure_buffer_stack()" );
  3034. memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  3035. (yy_buffer_stack_max) = num_to_alloc;
  3036. (yy_buffer_stack_top) = 0;
  3037. return;
  3038. }
  3039. if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
  3040. /* Increase the buffer to prepare for a possible push. */
  3041. int grow_size = 8 /* arbitrary grow size */;
  3042. num_to_alloc = (yy_buffer_stack_max) + grow_size;
  3043. (yy_buffer_stack) = (struct yy_buffer_state**)convert_realloc
  3044. ((yy_buffer_stack),
  3045. num_to_alloc * sizeof(struct yy_buffer_state*)
  3046. );
  3047. if ( ! (yy_buffer_stack) )
  3048. YY_FATAL_ERROR( "out of dynamic memory in convert_ensure_buffer_stack()" );
  3049. /* zero only the new slots.*/
  3050. memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
  3051. (yy_buffer_stack_max) = num_to_alloc;
  3052. }
  3053. }
  3054. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  3055. * @param base the character buffer
  3056. * @param size the size in bytes of the character buffer
  3057. *
  3058. * @return the newly allocated buffer state object.
  3059. */
  3060. YY_BUFFER_STATE convert__scan_buffer (char * base, yy_size_t size )
  3061. {
  3062. YY_BUFFER_STATE b;
  3063. if ( size < 2 ||
  3064. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  3065. base[size-1] != YY_END_OF_BUFFER_CHAR )
  3066. /* They forgot to leave room for the EOB's. */
  3067. return 0;
  3068. b = (YY_BUFFER_STATE) convert_alloc(sizeof( struct yy_buffer_state ) );
  3069. if ( ! b )
  3070. YY_FATAL_ERROR( "out of dynamic memory in convert__scan_buffer()" );
  3071. b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
  3072. b->yy_buf_pos = b->yy_ch_buf = base;
  3073. b->yy_is_our_buffer = 0;
  3074. b->yy_input_file = 0;
  3075. b->yy_n_chars = b->yy_buf_size;
  3076. b->yy_is_interactive = 0;
  3077. b->yy_at_bol = 1;
  3078. b->yy_fill_buffer = 0;
  3079. b->yy_buffer_status = YY_BUFFER_NEW;
  3080. convert__switch_to_buffer(b );
  3081. return b;
  3082. }
  3083. /** Setup the input buffer state to scan a string. The next call to convert_lex() will
  3084. * scan from a @e copy of @a str.
  3085. * @param yystr a NUL-terminated string to scan
  3086. *
  3087. * @return the newly allocated buffer state object.
  3088. * @note If you want to scan bytes that may contain NUL values, then use
  3089. * convert__scan_bytes() instead.
  3090. */
  3091. YY_BUFFER_STATE convert__scan_string (yyconst char * yystr )
  3092. {
  3093. return convert__scan_bytes(yystr,strlen(yystr) );
  3094. }
  3095. /** Setup the input buffer state to scan the given bytes. The next call to convert_lex() will
  3096. * scan from a @e copy of @a bytes.
  3097. * @param bytes the byte buffer to scan
  3098. * @param len the number of bytes in the buffer pointed to by @a bytes.
  3099. *
  3100. * @return the newly allocated buffer state object.
  3101. */
  3102. YY_BUFFER_STATE convert__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
  3103. {
  3104. YY_BUFFER_STATE b;
  3105. char *buf;
  3106. yy_size_t n, i;
  3107. /* Get memory for full buffer, including space for trailing EOB's. */
  3108. n = _yybytes_len + 2;
  3109. buf = (char *) convert_alloc(n );
  3110. if ( ! buf )
  3111. YY_FATAL_ERROR( "out of dynamic memory in convert__scan_bytes()" );
  3112. for ( i = 0; i < _yybytes_len; ++i )
  3113. buf[i] = yybytes[i];
  3114. buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
  3115. b = convert__scan_buffer(buf,n );
  3116. if ( ! b )
  3117. YY_FATAL_ERROR( "bad buffer in convert__scan_bytes()" );
  3118. /* It's okay to grow etc. this buffer, and we should throw it
  3119. * away when we're done.
  3120. */
  3121. b->yy_is_our_buffer = 1;
  3122. return b;
  3123. }
  3124. #ifndef YY_EXIT_FAILURE
  3125. #define YY_EXIT_FAILURE 2
  3126. #endif
  3127. static void yy_fatal_error (yyconst char* msg )
  3128. {
  3129. (void) fprintf( stderr, "%s\n", msg );
  3130. exit( YY_EXIT_FAILURE );
  3131. }
  3132. /* Redefine yyless() so it works in section 3 code. */
  3133. #undef yyless
  3134. #define yyless(n) \
  3135. do \
  3136. { \
  3137. /* Undo effects of setting up convert_text. */ \
  3138. int yyless_macro_arg = (n); \
  3139. YY_LESS_LINENO(yyless_macro_arg);\
  3140. convert_text[convert_leng] = (yy_hold_char); \
  3141. (yy_c_buf_p) = convert_text + yyless_macro_arg; \
  3142. (yy_hold_char) = *(yy_c_buf_p); \
  3143. *(yy_c_buf_p) = '\0'; \
  3144. convert_leng = yyless_macro_arg; \
  3145. } \
  3146. while ( 0 )
  3147. /* Accessor methods (get/set functions) to struct members. */
  3148. /** Get the current line number.
  3149. *
  3150. */
  3151. int convert_get_lineno (void)
  3152. {
  3153. return convert_lineno;
  3154. }
  3155. /** Get the input stream.
  3156. *
  3157. */
  3158. FILE *convert_get_in (void)
  3159. {
  3160. return convert_in;
  3161. }
  3162. /** Get the output stream.
  3163. *
  3164. */
  3165. FILE *convert_get_out (void)
  3166. {
  3167. return convert_out;
  3168. }
  3169. /** Get the length of the current token.
  3170. *
  3171. */
  3172. yy_size_t convert_get_leng (void)
  3173. {
  3174. return convert_leng;
  3175. }
  3176. /** Get the current token.
  3177. *
  3178. */
  3179. char *convert_get_text (void)
  3180. {
  3181. return convert_text;
  3182. }
  3183. /** Set the current line number.
  3184. * @param line_number
  3185. *
  3186. */
  3187. void convert_set_lineno (int line_number )
  3188. {
  3189. convert_lineno = line_number;
  3190. }
  3191. /** Set the input stream. This does not discard the current
  3192. * input buffer.
  3193. * @param in_str A readable stream.
  3194. *
  3195. * @see convert__switch_to_buffer
  3196. */
  3197. void convert_set_in (FILE * in_str )
  3198. {
  3199. convert_in = in_str ;
  3200. }
  3201. void convert_set_out (FILE * out_str )
  3202. {
  3203. convert_out = out_str ;
  3204. }
  3205. int convert_get_debug (void)
  3206. {
  3207. return convert__flex_debug;
  3208. }
  3209. void convert_set_debug (int bdebug )
  3210. {
  3211. convert__flex_debug = bdebug ;
  3212. }
  3213. static int yy_init_globals (void)
  3214. {
  3215. /* Initialization is the same as for the non-reentrant scanner.
  3216. * This function is called from convert_lex_destroy(), so don't allocate here.
  3217. */
  3218. (yy_buffer_stack) = 0;
  3219. (yy_buffer_stack_top) = 0;
  3220. (yy_buffer_stack_max) = 0;
  3221. (yy_c_buf_p) = (char *) 0;
  3222. (yy_init) = 0;
  3223. (yy_start) = 0;
  3224. /* Defined in main.c */
  3225. #ifdef YY_STDINIT
  3226. convert_in = stdin;
  3227. convert_out = stdout;
  3228. #else
  3229. convert_in = (FILE *) 0;
  3230. convert_out = (FILE *) 0;
  3231. #endif
  3232. /* For future reference: Set errno on error, since we are called by
  3233. * convert_lex_init()
  3234. */
  3235. return 0;
  3236. }
  3237. /* convert_lex_destroy is for both reentrant and non-reentrant scanners. */
  3238. int convert_lex_destroy (void)
  3239. {
  3240. /* Pop the buffer stack, destroying each element. */
  3241. while(YY_CURRENT_BUFFER){
  3242. convert__delete_buffer(YY_CURRENT_BUFFER );
  3243. YY_CURRENT_BUFFER_LVALUE = NULL;
  3244. convert_pop_buffer_state();
  3245. }
  3246. /* Destroy the stack itself. */
  3247. convert_free((yy_buffer_stack) );
  3248. (yy_buffer_stack) = NULL;
  3249. /* Reset the globals. This is important in a non-reentrant scanner so the next time
  3250. * convert_lex() is called, initialization will occur. */
  3251. yy_init_globals( );
  3252. return 0;
  3253. }
  3254. /*
  3255. * Internal utility routines.
  3256. */
  3257. #ifndef yytext_ptr
  3258. static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
  3259. {
  3260. register int i;
  3261. for ( i = 0; i < n; ++i )
  3262. s1[i] = s2[i];
  3263. }
  3264. #endif
  3265. #ifdef YY_NEED_STRLEN
  3266. static int yy_flex_strlen (yyconst char * s )
  3267. {
  3268. register int n;
  3269. for ( n = 0; s[n]; ++n )
  3270. ;
  3271. return n;
  3272. }
  3273. #endif
  3274. void *convert_alloc (yy_size_t size )
  3275. {
  3276. return (void *) malloc( size );
  3277. }
  3278. void *convert_realloc (void * ptr, yy_size_t size )
  3279. {
  3280. /* The cast to (char *) in the following accommodates both
  3281. * implementations that use char* generic pointers, and those
  3282. * that use void* generic pointers. It works with the latter
  3283. * because both ANSI C and C++ allow castless assignment from
  3284. * any pointer type to void*, and deal with argument conversions
  3285. * as though doing an assignment.
  3286. */
  3287. return (void *) realloc( (char *) ptr, size );
  3288. }
  3289. void convert_free (void * ptr )
  3290. {
  3291. free( (char *) ptr ); /* see convert_realloc() for (char *) cast */
  3292. }
  3293. #define YYTABLES_NAME "yytables"
  3294. #line 69 "convert.lex"