gram.cc 117 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749
  1. /* A Bison parser, made from gram.yy
  2. by GNU Bison version 1.28 */
  3. #define YYBISON 1 /* Identify Bison output. */
  4. #define LABEL 257
  5. #define VARIABLE 258
  6. #define NUMBER 259
  7. #define TEXT 260
  8. #define COMMAND_LINE 261
  9. #define DELIMITED 262
  10. #define ORDINAL 263
  11. #define TH 264
  12. #define LEFT_ARROW_HEAD 265
  13. #define RIGHT_ARROW_HEAD 266
  14. #define DOUBLE_ARROW_HEAD 267
  15. #define LAST 268
  16. #define UP 269
  17. #define DOWN 270
  18. #define LEFT 271
  19. #define RIGHT 272
  20. #define BOX 273
  21. #define CIRCLE 274
  22. #define ELLIPSE 275
  23. #define ARC 276
  24. #define LINE 277
  25. #define ARROW 278
  26. #define MOVE 279
  27. #define SPLINE 280
  28. #define HEIGHT 281
  29. #define RADIUS 282
  30. #define WIDTH 283
  31. #define DIAMETER 284
  32. #define FROM 285
  33. #define TO 286
  34. #define AT 287
  35. #define WITH 288
  36. #define BY 289
  37. #define THEN 290
  38. #define DOTTED 291
  39. #define DASHED 292
  40. #define CHOP 293
  41. #define SAME 294
  42. #define INVISIBLE 295
  43. #define LJUST 296
  44. #define RJUST 297
  45. #define ABOVE 298
  46. #define BELOW 299
  47. #define OF 300
  48. #define THE 301
  49. #define WAY 302
  50. #define BETWEEN 303
  51. #define AND 304
  52. #define HERE 305
  53. #define DOT_N 306
  54. #define DOT_E 307
  55. #define DOT_W 308
  56. #define DOT_S 309
  57. #define DOT_NE 310
  58. #define DOT_SE 311
  59. #define DOT_NW 312
  60. #define DOT_SW 313
  61. #define DOT_C 314
  62. #define DOT_START 315
  63. #define DOT_END 316
  64. #define DOT_X 317
  65. #define DOT_Y 318
  66. #define DOT_HT 319
  67. #define DOT_WID 320
  68. #define DOT_RAD 321
  69. #define SIN 322
  70. #define COS 323
  71. #define ATAN2 324
  72. #define LOG 325
  73. #define EXP 326
  74. #define SQRT 327
  75. #define K_MAX 328
  76. #define K_MIN 329
  77. #define INT 330
  78. #define RAND 331
  79. #define SRAND 332
  80. #define COPY 333
  81. #define THRU 334
  82. #define TOP 335
  83. #define BOTTOM 336
  84. #define UPPER 337
  85. #define LOWER 338
  86. #define SH 339
  87. #define PRINT 340
  88. #define CW 341
  89. #define CCW 342
  90. #define FOR 343
  91. #define DO 344
  92. #define IF 345
  93. #define ELSE 346
  94. #define ANDAND 347
  95. #define OROR 348
  96. #define NOTEQUAL 349
  97. #define EQUALEQUAL 350
  98. #define LESSEQUAL 351
  99. #define GREATEREQUAL 352
  100. #define LEFT_CORNER 353
  101. #define RIGHT_CORNER 354
  102. #define CENTER 355
  103. #define END 356
  104. #define START 357
  105. #define RESET 358
  106. #define UNTIL 359
  107. #define PLOT 360
  108. #define THICKNESS 361
  109. #define FILL 362
  110. #define ALIGNED 363
  111. #define SPRINTF 364
  112. #define COMMAND 365
  113. #define DEFINE 366
  114. #define UNDEF 367
  115. #line 5 "gram.yy"
  116. #include "pic.h"
  117. #include "object.h"
  118. //////////////////////////////////////////////////////////////////////
  119. // PIC PARSER
  120. // Public interface:
  121. //
  122. // parse_init() [should be called only once]
  123. // yyparse()
  124. // parse_cleanup() [should be called after each parse]
  125. // define_variable(), lookup_variable() [declared in object.h,
  126. // also used in lex.cc for `for' loops]
  127. //
  128. // delim_flag [state flag read by lexer in lex.cc]
  129. //
  130. // The parser makes heavy use of special functions provided by the lexer,
  131. // such as do_copy(), do_for(), copy_file_thru(), copy_rest_thru(),
  132. // push_body(), and especially do_lookahead(). It also calls lex_warning()
  133. // and lex_error().
  134. //////////////////////////////////////////////////////////////////////
  135. #undef fmod
  136. #undef rand
  137. #undef srand
  138. extern "C" {
  139. double fmod(double, double);
  140. int rand();
  141. void srand(unsigned int);
  142. }
  143. // Maximum number of characters produced by printf("%g")
  144. #define GDIGITS 14
  145. static char sprintf_buf[1024];
  146. direction current_direction;
  147. position current_position;
  148. implement_ptable(place)
  149. PTABLE(place) top_table;
  150. PTABLE(place) *current_table = &top_table;
  151. saved_state *current_saved_state = 0;
  152. object_list olist;
  153. // external variable, used by lexer
  154. int delim_flag = 0;
  155. // forward references
  156. static place *lookup_label(const char *label);
  157. static void define_label(const char *label, const place *pl);
  158. static void reset (const char *nm);
  159. static void reset_all (void);
  160. static const char * ordinal_postfix(int n);
  161. static const char * object_type_name(object_type type);
  162. static char * format_number(const char *form, double n);
  163. static char * do_sprintf(const char *form, const double *v, int nv);
  164. #line 70 "gram.yy"
  165. typedef union {
  166. char *str;
  167. int n;
  168. double x;
  169. struct { double x, y; } pair;
  170. struct { double x; char *body; } if_data;
  171. struct { char *str; const char *filename; int lineno; } lstr;
  172. struct { double *v; int nv; int maxv; } dv;
  173. struct { double val; int is_multiplicative; } by;
  174. place pl;
  175. object *obj;
  176. corner crn;
  177. path *pth;
  178. object_spec *spec;
  179. saved_state *pstate;
  180. graphics_state state;
  181. object_type obtype;
  182. } YYSTYPE;
  183. #include <stdio.h>
  184. #ifndef __cplusplus
  185. #ifndef __STDC__
  186. #define const
  187. #endif
  188. #endif
  189. #define YYFINAL 413
  190. #define YYFLAG -32768
  191. #define YYNTBASE 135
  192. #define YYTRANSLATE(x) ((unsigned)(x) <= 367 ? yytranslate[x] : 180)
  193. static const short yytranslate[] = { 0,
  194. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  195. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  196. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  197. 2, 2, 124, 2, 2, 2, 123, 2, 2, 114,
  198. 133, 121, 119, 116, 120, 134, 122, 2, 2, 2,
  199. 2, 2, 2, 2, 2, 2, 2, 128, 126, 117,
  200. 127, 118, 2, 2, 2, 2, 2, 2, 2, 2,
  201. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  202. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  203. 131, 2, 132, 125, 2, 115, 2, 2, 2, 2,
  204. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  205. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  206. 2, 2, 129, 2, 130, 2, 2, 2, 2, 2,
  207. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  208. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  209. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  210. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  211. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  212. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  213. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  214. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  215. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  216. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  217. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  218. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  219. 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
  220. 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
  221. 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
  222. 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
  223. 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
  224. 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
  225. 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
  226. 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
  227. 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
  228. 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
  229. 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
  230. 107, 108, 109, 110, 111, 112, 113
  231. };
  232. #if YYDEBUG != 0
  233. static const short yyprhs[] = { 0,
  234. 0, 2, 4, 8, 10, 14, 15, 17, 19, 22,
  235. 26, 31, 33, 35, 37, 39, 41, 44, 47, 48,
  236. 52, 55, 56, 57, 65, 66, 67, 74, 75, 86,
  237. 88, 89, 94, 96, 98, 101, 104, 108, 110, 113,
  238. 115, 117, 119, 120, 126, 127, 130, 132, 134, 138,
  239. 142, 146, 150, 154, 158, 162, 166, 169, 170, 173,
  240. 177, 179, 184, 189, 194, 195, 196, 203, 205, 206,
  241. 208, 210, 212, 214, 216, 218, 220, 222, 224, 226,
  242. 229, 233, 234, 239, 243, 247, 251, 255, 258, 261,
  243. 265, 268, 272, 275, 279, 282, 286, 290, 294, 298,
  244. 302, 306, 309, 312, 316, 319, 323, 326, 330, 333,
  245. 337, 340, 343, 346, 349, 352, 355, 358, 361, 364,
  246. 367, 370, 373, 377, 380, 382, 388, 389, 393, 395,
  247. 397, 399, 403, 407, 413, 419, 426, 428, 433, 437,
  248. 441, 443, 446, 449, 453, 455, 457, 459, 463, 465,
  249. 469, 471, 474, 477, 480, 482, 484, 486, 488, 490,
  250. 492, 494, 497, 499, 502, 506, 508, 510, 513, 515,
  251. 521, 526, 530, 534, 537, 539, 541, 543, 545, 547,
  252. 549, 551, 553, 555, 557, 559, 561, 563, 565, 567,
  253. 570, 573, 576, 579, 581, 583, 586, 589, 592, 595,
  254. 597, 599, 601, 603, 605, 608, 611, 614, 617, 620,
  255. 624, 628, 632, 636, 640, 644, 647, 651, 656, 661,
  256. 668, 673, 678, 683, 690, 697, 702, 707, 711, 716,
  257. 720, 724, 728, 732, 736, 740, 744, 748
  258. };
  259. static const short yyrhs[] = { 138,
  260. 0, 136, 0, 138, 137, 138, 0, 157, 0, 137,
  261. 139, 157, 0, 0, 139, 0, 126, 0, 139, 126,
  262. 0, 4, 127, 154, 0, 4, 128, 127, 154, 0,
  263. 15, 0, 16, 0, 17, 0, 18, 0, 7, 0,
  264. 111, 149, 0, 86, 149, 0, 0, 85, 141, 8,
  265. 0, 79, 6, 0, 0, 0, 79, 6, 80, 142,
  266. 8, 143, 153, 0, 0, 0, 79, 80, 144, 8,
  267. 145, 153, 0, 0, 89, 4, 127, 179, 32, 179,
  268. 156, 90, 146, 8, 0, 151, 0, 0, 151, 92,
  269. 147, 8, 0, 148, 0, 104, 0, 104, 4, 0,
  270. 148, 4, 0, 148, 116, 4, 0, 150, 0, 149,
  271. 150, 0, 179, 0, 163, 0, 165, 0, 0, 91,
  272. 154, 36, 152, 8, 0, 0, 105, 6, 0, 179,
  273. 0, 155, 0, 163, 96, 163, 0, 163, 95, 163,
  274. 0, 155, 93, 155, 0, 155, 93, 179, 0, 179,
  275. 93, 155, 0, 155, 94, 155, 0, 155, 94, 179,
  276. 0, 179, 94, 155, 0, 124, 155, 0, 0, 35,
  277. 179, 0, 35, 121, 179, 0, 161, 0, 3, 128,
  278. 138, 157, 0, 3, 128, 138, 166, 0, 3, 128,
  279. 138, 169, 0, 0, 0, 129, 158, 136, 130, 159,
  280. 160, 0, 140, 0, 0, 157, 0, 19, 0, 20,
  281. 0, 21, 0, 22, 0, 23, 0, 24, 0, 25,
  282. 0, 26, 0, 163, 0, 106, 179, 0, 106, 179,
  283. 163, 0, 0, 131, 162, 136, 132, 0, 161, 27,
  284. 179, 0, 161, 28, 179, 0, 161, 29, 179, 0,
  285. 161, 30, 179, 0, 161, 179, 0, 161, 15, 0,
  286. 161, 15, 179, 0, 161, 16, 0, 161, 16, 179,
  287. 0, 161, 18, 0, 161, 18, 179, 0, 161, 17,
  288. 0, 161, 17, 179, 0, 161, 31, 165, 0, 161,
  289. 32, 165, 0, 161, 33, 165, 0, 161, 34, 177,
  290. 0, 161, 35, 168, 0, 161, 36, 0, 161, 37,
  291. 0, 161, 37, 179, 0, 161, 38, 0, 161, 38,
  292. 179, 0, 161, 108, 0, 161, 108, 179, 0, 161,
  293. 39, 0, 161, 39, 179, 0, 161, 40, 0, 161,
  294. 41, 0, 161, 11, 0, 161, 12, 0, 161, 13,
  295. 0, 161, 87, 0, 161, 88, 0, 161, 163, 0,
  296. 161, 42, 0, 161, 43, 0, 161, 44, 0, 161,
  297. 45, 0, 161, 107, 179, 0, 161, 109, 0, 6,
  298. 0, 110, 114, 6, 164, 133, 0, 0, 164, 116,
  299. 179, 0, 166, 0, 169, 0, 168, 0, 165, 119,
  300. 168, 0, 165, 120, 168, 0, 114, 165, 116, 165,
  301. 133, 0, 179, 167, 165, 50, 165, 0, 179, 117,
  302. 165, 116, 165, 118, 0, 49, 0, 46, 47, 48,
  303. 49, 0, 179, 116, 179, 0, 114, 168, 133, 0,
  304. 170, 0, 170, 178, 0, 178, 170, 0, 178, 46,
  305. 170, 0, 51, 0, 3, 0, 173, 0, 170, 134,
  306. 3, 0, 9, 0, 115, 154, 10, 0, 14, 0,
  307. 171, 14, 0, 171, 174, 0, 172, 174, 0, 19,
  308. 0, 20, 0, 21, 0, 22, 0, 23, 0, 24,
  309. 0, 26, 0, 131, 132, 0, 6, 0, 134, 3,
  310. 0, 175, 134, 3, 0, 178, 0, 175, 0, 175,
  311. 178, 0, 176, 0, 114, 176, 116, 176, 133, 0,
  312. 9, 14, 174, 176, 0, 14, 174, 176, 0, 9,
  313. 174, 176, 0, 3, 176, 0, 52, 0, 53, 0,
  314. 54, 0, 55, 0, 56, 0, 57, 0, 58, 0,
  315. 59, 0, 60, 0, 61, 0, 62, 0, 81, 0,
  316. 82, 0, 17, 0, 18, 0, 83, 17, 0, 84,
  317. 17, 0, 83, 18, 0, 84, 18, 0, 99, 0,
  318. 100, 0, 83, 99, 0, 84, 99, 0, 83, 100,
  319. 0, 84, 100, 0, 101, 0, 103, 0, 102, 0,
  320. 4, 0, 5, 0, 169, 63, 0, 169, 64, 0,
  321. 169, 65, 0, 169, 66, 0, 169, 67, 0, 179,
  322. 119, 179, 0, 179, 120, 179, 0, 179, 121, 179,
  323. 0, 179, 122, 179, 0, 179, 123, 179, 0, 179,
  324. 125, 179, 0, 120, 179, 0, 114, 154, 133, 0,
  325. 68, 114, 154, 133, 0, 69, 114, 154, 133, 0,
  326. 70, 114, 154, 116, 154, 133, 0, 71, 114, 154,
  327. 133, 0, 72, 114, 154, 133, 0, 73, 114, 154,
  328. 133, 0, 74, 114, 154, 116, 154, 133, 0, 75,
  329. 114, 154, 116, 154, 133, 0, 76, 114, 154, 133,
  330. 0, 77, 114, 154, 133, 0, 77, 114, 133, 0,
  331. 78, 114, 154, 133, 0, 179, 117, 179, 0, 179,
  332. 97, 179, 0, 179, 118, 179, 0, 179, 98, 179,
  333. 0, 179, 96, 179, 0, 179, 95, 179, 0, 179,
  334. 93, 179, 0, 179, 94, 179, 0, 124, 179, 0
  335. };
  336. #endif
  337. #if YYDEBUG != 0
  338. static const short yyrline[] = { 0,
  339. 264, 266, 274, 279, 282, 286, 288, 291, 293, 296,
  340. 302, 315, 317, 319, 321, 323, 328, 333, 339, 342,
  341. 350, 357, 360, 362, 370, 373, 375, 382, 385, 391,
  342. 399, 402, 413, 414, 418, 421, 423, 427, 430, 450,
  343. 458, 460, 468, 472, 475, 478, 482, 485, 489, 496,
  344. 502, 504, 506, 508, 510, 512, 514, 519, 522, 524,
  345. 528, 544, 546, 554, 560, 566, 573, 576, 584, 587,
  346. 591, 596, 600, 604, 609, 616, 623, 630, 637, 642,
  347. 647, 654, 669, 681, 687, 693, 699, 705, 725, 732,
  348. 739, 746, 753, 760, 767, 774, 781, 788, 803, 816,
  349. 822, 829, 842, 848, 854, 860, 866, 871, 877, 896,
  350. 916, 921, 926, 931, 936, 941, 946, 951, 959, 970,
  351. 981, 992, 1003, 1009, 1016, 1021, 1031, 1038, 1062, 1065,
  352. 1073, 1076, 1081, 1086, 1091, 1096, 1103, 1105, 1108, 1111,
  353. 1115, 1118, 1124, 1130, 1136, 1144, 1156, 1160, 1168, 1171,
  354. 1178, 1181, 1185, 1203, 1222, 1225, 1227, 1229, 1231, 1233,
  355. 1235, 1237, 1239, 1243, 1248, 1255, 1263, 1267, 1274, 1279,
  356. 1285, 1291, 1297, 1303, 1311, 1314, 1316, 1318, 1320, 1322,
  357. 1324, 1326, 1328, 1330, 1332, 1334, 1336, 1338, 1340, 1342,
  358. 1344, 1346, 1348, 1350, 1352, 1354, 1356, 1358, 1360, 1362,
  359. 1364, 1366, 1370, 1380, 1382, 1389, 1396, 1403, 1410, 1417,
  360. 1419, 1421, 1423, 1432, 1441, 1456, 1458, 1460, 1470, 1480,
  361. 1495, 1505, 1515, 1525, 1527, 1529, 1531, 1533, 1539, 1541,
  362. 1543, 1545, 1547, 1549, 1551, 1553, 1555, 1557
  363. };
  364. #endif
  365. #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
  366. static const char * const yytname[] = { "$","error","$undefined.","LABEL",
  367. "VARIABLE","NUMBER","TEXT","COMMAND_LINE","DELIMITED","ORDINAL","TH","LEFT_ARROW_HEAD",
  368. "RIGHT_ARROW_HEAD","DOUBLE_ARROW_HEAD","LAST","UP","DOWN","LEFT","RIGHT","BOX",
  369. "CIRCLE","ELLIPSE","ARC","LINE","ARROW","MOVE","SPLINE","HEIGHT","RADIUS","WIDTH",
  370. "DIAMETER","FROM","TO","AT","WITH","BY","THEN","DOTTED","DASHED","CHOP","SAME",
  371. "INVISIBLE","LJUST","RJUST","ABOVE","BELOW","OF","THE","WAY","BETWEEN","AND",
  372. "HERE","DOT_N","DOT_E","DOT_W","DOT_S","DOT_NE","DOT_SE","DOT_NW","DOT_SW","DOT_C",
  373. "DOT_START","DOT_END","DOT_X","DOT_Y","DOT_HT","DOT_WID","DOT_RAD","SIN","COS",
  374. "ATAN2","LOG","EXP","SQRT","K_MAX","K_MIN","INT","RAND","SRAND","COPY","THRU",
  375. "TOP","BOTTOM","UPPER","LOWER","SH","PRINT","CW","CCW","FOR","DO","IF","ELSE",
  376. "ANDAND","OROR","NOTEQUAL","EQUALEQUAL","LESSEQUAL","GREATEREQUAL","LEFT_CORNER",
  377. "RIGHT_CORNER","CENTER","END","START","RESET","UNTIL","PLOT","THICKNESS","FILL",
  378. "ALIGNED","SPRINTF","COMMAND","DEFINE","UNDEF","'('","'`'","','","'<'","'>'",
  379. "'+'","'-'","'*'","'/'","'%'","'!'","'^'","';'","'='","':'","'{'","'}'","'['",
  380. "']'","')'","'.'","top","element_list","middle_element_list","optional_separator",
  381. "separator","placeless_element","@1","@2","@3","@4","@5","@6","@7","reset_variables",
  382. "print_args","print_arg","simple_if","@8","until","any_expr","text_expr","optional_by",
  383. "element","@9","@10","optional_element","object_spec","@11","text","sprintf_args",
  384. "position","position_not_place","between","expr_pair","place","label","ordinal",
  385. "optional_ordinal_last","nth_primitive","object_type","label_path","relative_path",
  386. "path","corner","expr", NULL
  387. };
  388. #endif
  389. static const short yyr1[] = { 0,
  390. 135, 135, 136, 137, 137, 138, 138, 139, 139, 140,
  391. 140, 140, 140, 140, 140, 140, 140, 140, 141, 140,
  392. 140, 142, 143, 140, 144, 145, 140, 146, 140, 140,
  393. 147, 140, 140, 140, 148, 148, 148, 149, 149, 150,
  394. 150, 150, 152, 151, 153, 153, 154, 154, 155, 155,
  395. 155, 155, 155, 155, 155, 155, 155, 156, 156, 156,
  396. 157, 157, 157, 157, 158, 159, 157, 157, 160, 160,
  397. 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
  398. 161, 162, 161, 161, 161, 161, 161, 161, 161, 161,
  399. 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
  400. 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
  401. 161, 161, 161, 161, 161, 161, 161, 161, 161, 161,
  402. 161, 161, 161, 161, 163, 163, 164, 164, 165, 165,
  403. 166, 166, 166, 166, 166, 166, 167, 167, 168, 168,
  404. 169, 169, 169, 169, 169, 170, 170, 170, 171, 171,
  405. 172, 172, 173, 173, 174, 174, 174, 174, 174, 174,
  406. 174, 174, 174, 175, 175, 176, 176, 176, 177, 177,
  407. 177, 177, 177, 177, 178, 178, 178, 178, 178, 178,
  408. 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
  409. 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
  410. 178, 178, 179, 179, 179, 179, 179, 179, 179, 179,
  411. 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
  412. 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
  413. 179, 179, 179, 179, 179, 179, 179, 179
  414. };
  415. static const short yyr2[] = { 0,
  416. 1, 1, 3, 1, 3, 0, 1, 1, 2, 3,
  417. 4, 1, 1, 1, 1, 1, 2, 2, 0, 3,
  418. 2, 0, 0, 7, 0, 0, 6, 0, 10, 1,
  419. 0, 4, 1, 1, 2, 2, 3, 1, 2, 1,
  420. 1, 1, 0, 5, 0, 2, 1, 1, 3, 3,
  421. 3, 3, 3, 3, 3, 3, 2, 0, 2, 3,
  422. 1, 4, 4, 4, 0, 0, 6, 1, 0, 1,
  423. 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
  424. 3, 0, 4, 3, 3, 3, 3, 2, 2, 3,
  425. 2, 3, 2, 3, 2, 3, 3, 3, 3, 3,
  426. 3, 2, 2, 3, 2, 3, 2, 3, 2, 3,
  427. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  428. 2, 2, 3, 2, 1, 5, 0, 3, 1, 1,
  429. 1, 3, 3, 5, 5, 6, 1, 4, 3, 3,
  430. 1, 2, 2, 3, 1, 1, 1, 3, 1, 3,
  431. 1, 2, 2, 2, 1, 1, 1, 1, 1, 1,
  432. 1, 2, 1, 2, 3, 1, 1, 2, 1, 5,
  433. 4, 3, 3, 2, 1, 1, 1, 1, 1, 1,
  434. 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
  435. 2, 2, 2, 1, 1, 2, 2, 2, 2, 1,
  436. 1, 1, 1, 1, 2, 2, 2, 2, 2, 3,
  437. 3, 3, 3, 3, 3, 2, 3, 4, 4, 6,
  438. 4, 4, 4, 6, 6, 4, 4, 3, 4, 3,
  439. 3, 3, 3, 3, 3, 3, 3, 2
  440. };
  441. static const short yydefact[] = { 6,
  442. 8, 2, 1, 7, 0, 0, 125, 16, 12, 13,
  443. 14, 15, 71, 72, 73, 74, 75, 76, 77, 78,
  444. 0, 19, 0, 0, 0, 34, 0, 0, 0, 65,
  445. 82, 6, 68, 33, 30, 4, 61, 79, 9, 6,
  446. 0, 0, 21, 25, 0, 146, 203, 204, 149, 151,
  447. 188, 189, 145, 175, 176, 177, 178, 179, 180, 181,
  448. 182, 183, 184, 185, 0, 0, 0, 0, 0, 0,
  449. 0, 0, 0, 0, 0, 186, 187, 0, 0, 194,
  450. 195, 200, 202, 201, 0, 0, 0, 0, 18, 38,
  451. 41, 42, 129, 131, 130, 141, 0, 0, 147, 0,
  452. 40, 0, 0, 0, 0, 48, 0, 0, 47, 35,
  453. 80, 0, 17, 6, 6, 3, 7, 36, 0, 31,
  454. 113, 114, 115, 89, 91, 95, 93, 0, 0, 0,
  455. 0, 0, 0, 0, 0, 0, 102, 103, 105, 109,
  456. 111, 112, 119, 120, 121, 122, 116, 117, 0, 107,
  457. 124, 118, 88, 0, 10, 0, 22, 0, 20, 0,
  458. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  459. 190, 192, 196, 198, 191, 193, 197, 199, 0, 0,
  460. 131, 47, 0, 216, 238, 39, 0, 0, 205, 206,
  461. 207, 208, 209, 0, 142, 163, 152, 155, 156, 157,
  462. 158, 159, 160, 161, 0, 153, 154, 0, 143, 0,
  463. 137, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  464. 0, 0, 0, 0, 0, 0, 0, 0, 57, 238,
  465. 43, 0, 0, 0, 0, 0, 0, 0, 81, 127,
  466. 0, 0, 0, 5, 37, 0, 90, 92, 96, 94,
  467. 84, 85, 86, 87, 97, 0, 98, 99, 0, 0,
  468. 0, 0, 0, 167, 169, 100, 166, 0, 101, 0,
  469. 104, 106, 110, 123, 108, 146, 203, 188, 189, 62,
  470. 0, 63, 64, 11, 0, 26, 0, 0, 0, 0,
  471. 0, 0, 0, 0, 0, 228, 0, 0, 217, 0,
  472. 140, 150, 132, 133, 148, 162, 144, 0, 236, 237,
  473. 235, 234, 231, 233, 139, 0, 230, 232, 210, 211,
  474. 212, 213, 214, 215, 0, 0, 0, 51, 52, 54,
  475. 55, 50, 49, 53, 236, 56, 237, 230, 0, 66,
  476. 83, 32, 174, 0, 0, 0, 0, 164, 0, 168,
  477. 0, 47, 23, 45, 218, 219, 0, 221, 222, 223,
  478. 0, 0, 226, 227, 229, 0, 0, 0, 0, 0,
  479. 44, 0, 126, 69, 0, 173, 172, 0, 165, 45,
  480. 0, 27, 0, 0, 0, 134, 138, 0, 135, 58,
  481. 128, 70, 67, 171, 0, 24, 46, 220, 224, 225,
  482. 136, 0, 0, 170, 0, 59, 28, 60, 0, 29,
  483. 0, 0, 0
  484. };
  485. static const short yydefgoto[] = { 411,
  486. 2, 32, 242, 4, 33, 45, 285, 380, 158, 354,
  487. 409, 246, 34, 89, 90, 35, 327, 382, 179, 106,
  488. 403, 36, 114, 374, 393, 37, 115, 107, 339, 92,
  489. 93, 227, 94, 108, 96, 97, 98, 99, 206, 264,
  490. 265, 266, 100, 109
  491. };
  492. static const short yypact[] = { -114,
  493. -32768,-32768, 677, -100, -104, -120,-32768,-32768,-32768,-32768,
  494. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  495. 3,-32768, 899, 29, 1012, 43, 1450, -61, 899,-32768,
  496. -32768, -114,-32768, 9, -33,-32768, 786,-32768,-32768, -114,
  497. 1012, -66, -13,-32768, 61,-32768,-32768,-32768,-32768,-32768,
  498. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  499. -32768,-32768,-32768,-32768, -35, -32, -30, -2, 0, 16,
  500. 30, 36, 40, 45, 49,-32768,-32768, 70, 80,-32768,
  501. -32768,-32768,-32768,-32768, 1125, 1012, 1450, 1450, 899,-32768,
  502. -32768, -64,-32768,-32768, 172, 2045, 54, 267,-32768, 8,
  503. 2037, -5, 1012, 1012, 126, 48, 4, 172, 2113,-32768,
  504. 629, 66, 899, -114, -114,-32768, 649,-32768, 173,-32768,
  505. -32768,-32768,-32768, 1904, 1904, 1740, 1822, 1450, 1450, 1450,
  506. 1450, 1554, 1554, 1554, 302, 1658,-32768, 1904, 1904, 1904,
  507. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1450, 1904,
  508. -32768,-32768, 2122, 530,-32768, 1012,-32768, 175,-32768, 1012,
  509. 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 408, 1012,
  510. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 74, -74,
  511. 79, 2070, 196, 92, 92,-32768, 1658, 1658,-32768,-32768,
  512. -32768,-32768,-32768, 220,-32768,-32768,-32768,-32768,-32768,-32768,
  513. -32768,-32768,-32768,-32768, 95,-32768,-32768, 18, 90, 193,
  514. -32768, 1450, 1450, 1450, 1450, 1450, 1450, 1450, 1554, 1450,
  515. 1450, 1450, 1450, 1450, 1450, 1450, 1554, 1450,-32768, 92,
  516. -32768, 1012, 1012, 19, 19, 1012, 1012, 1450,-32768,-32768,
  517. 113, 677, 112,-32768,-32768, 245, 2122, 2122, 2122, 2122,
  518. 2122, 2122, 2122, 2122, -64, 2037, -64, -64, 1977, 152,
  519. 267, 1977, 251, 1991,-32768,-32768,-32768, 1238,-32768, 1353,
  520. 2122, 2122, 2122, 2122, 2122, -104, -120, 2, 23,-32768,
  521. -64, 37, 155,-32768, 247,-32768, 136, 137, 160, 138,
  522. 145, 146, 164, 165, 149,-32768, 159, 163,-32768, 1554,
  523. -32768,-32768,-32768,-32768,-32768,-32768, 90, 250, 312, 217,
  524. 376, 376, 109, 109, 2122, -27, 327, 109, 125, 125,
  525. 92, 92, 92, 92, -34, 272, 291,-32768, 312, 208,
  526. 2131,-32768,-32768,-32768, 312, 208, 2131, 109, -113,-32768,
  527. -32768,-32768,-32768, 267, 1977, 1977, 186,-32768, 300,-32768,
  528. 79, 2080,-32768, 202,-32768,-32768, 1012,-32768,-32768,-32768,
  529. 1012, 1012,-32768,-32768,-32768, -82, 259, 1554, 1554, 1450,
  530. -32768, 1450,-32768, 677, 1977,-32768,-32768, 1977,-32768, 202,
  531. 303,-32768, 184, 185, 188,-32768,-32768, -79, -64, 592,
  532. 2122,-32768,-32768,-32768, 189,-32768,-32768,-32768,-32768,-32768,
  533. -32768, 1342, 233,-32768, 1450, 2122,-32768, 2122, 317,-32768,
  534. 326, 328,-32768
  535. };
  536. static const short yypgoto[] = {-32768,
  537. 73,-32768, 31, 297,-32768,-32768,-32768,-32768,-32768,-32768,
  538. -32768,-32768,-32768, 301, -55,-32768,-32768, -49, 96, -85,
  539. -32768, -102,-32768,-32768,-32768,-32768,-32768, 7,-32768, -84,
  540. 178,-32768, -42, 6, -72,-32768,-32768,-32768, -93,-32768,
  541. -51,-32768, -78, -23
  542. };
  543. #define YYLAST 2256
  544. static const short yytable[] = { 101,
  545. 180, -14, 372, 111, 207, 101, 41, 42, 43, 38,
  546. 46, 1, 118, 153, 244, 369, 49, 195, 229, 373,
  547. 46, 50, -15, 40, 7, 39, 49, 209, 95, 91,
  548. 3, 50, 102, 186, 95, 91, 187, 188, 401, 187,
  549. 188, 300, 181, 152, 187, 188, 110, 255, 257, 258,
  550. 386, 280, 112, 208, 187, 188, 267, 186, 120, 196,
  551. 156, 182, 116, 184, 185, 101, 157, 197, 159, 281,
  552. 154, 240, 198, 199, 200, 201, 202, 203, 160, 204,
  553. 230, 161, 44, 162, 187, 188, 171, 172, 368, 101,
  554. 95, 187, 188, 269, 95, 91, 175, 176, 234, 235,
  555. 247, 248, 249, 250, 251, 252, 253, 254, 256, 256,
  556. 256, 163, 270, 164, 271, 272, 273, 239, 95, 91,
  557. 105, 228, 86, 38, 119, 274, 275, -14, 28, 165,
  558. 256, -14, 86, -14, 316, 307, 155, 95, 95, 95,
  559. 232, 233, 325, 166, 303, 304, 328, 330, -15, 167,
  560. 334, 336, -15, 168, -15, -129, -129, 196, 169, 283,
  561. 38, 231, 170, 270, 270, 344, 345, 346, 173, 174,
  562. 198, 199, 200, 201, 202, 203, 245, 204, 177, 178,
  563. 267, 183, 286, 267, 205, 350, 241, 243, 309, 310,
  564. 311, 312, 313, 314, 315, 317, 318, 319, 320, 321,
  565. 322, 323, 324, 256, 326, 302, 299, 343, 329, 331,
  566. 347, 301, 335, 337, 338, 366, 226, 189, 190, 191,
  567. 192, 193, 305, 194, 95, 351, 306, 221, 222, 223,
  568. 224, 225, 95, 226, 189, 190, 191, 192, 193, 308,
  569. 332, 333, 340, 341, 352, 223, 224, 225, 38, 226,
  570. 375, 284, 342, 348, 353, 287, 288, 289, 290, 291,
  571. 292, 293, 294, 295, 297, 298, 267, 267, 355, 356,
  572. 358, 392, 196, -130, -130, 357, 256, 359, 360, 361,
  573. 362, 363, 205, 388, 389, 198, 199, 200, 201, 202,
  574. 203, 364, 204, 376, 377, 365, 267, 367, 371, 267,
  575. 232, 378, 379, 370, 259, 95, 381, 387, 397, 212,
  576. 260, 214, 215, 216, 217, 261, 398, 399, 51, 52,
  577. 400, 404, 407, 394, 410, 412, 395, 413, 117, 113,
  578. 396, 282, 0, 238, 220, 221, 222, 223, 224, 225,
  579. 0, 226, 0, 0, 256, 256, 390, 0, 391, 0,
  580. 0, 0, 0, 54, 55, 56, 57, 58, 59, 60,
  581. 61, 62, 63, 64, 212, 213, 214, 215, 216, 217,
  582. 0, 0, 210, 95, 95, 211, 0, 0, 406, 0,
  583. 38, 408, 76, 77, 78, 79, 0, 0, 238, 220,
  584. 221, 222, 223, 224, 225, 0, 226, 205, 0, 0,
  585. 80, 81, 82, 83, 84, 0, 214, 215, 216, 217,
  586. 46, 47, 48, 7, 0, 262, 49, 0, 0, 0,
  587. 0, 50, 0, 0, 51, 52, 0, 0, 238, 220,
  588. 221, 222, 223, 224, 225, 263, 226, 0, 0, 0,
  589. 0, 0, 0, 0, 0, 221, 222, 223, 224, 225,
  590. 0, 226, 383, 0, 0, 0, 384, 385, 53, 54,
  591. 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
  592. 0, 0, 216, 217, 0, 65, 66, 67, 68, 69,
  593. 70, 71, 72, 73, 74, 75, 0, 0, 76, 77,
  594. 78, 79, 238, 220, 221, 222, 223, 224, 225, 0,
  595. 226, 0, 0, 0, 0, 0, 80, 81, 82, 83,
  596. 84, 0, 0, 0, 0, 0, 0, 28, 0, 0,
  597. 0, 103, 86, 0, 0, 0, 0, 87, 0, 0,
  598. 0, 104, 276, 277, 48, 7, 8, 0, 49, 0,
  599. 296, 0, 0, 50, 9, 10, 278, 279, 13, 14,
  600. 15, 16, 17, 18, 19, 20, 0, 0, 0, 0,
  601. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  602. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  603. 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  604. 63, 64, 0, 0, 0, 0, 0, 65, 66, 67,
  605. 68, 69, 70, 71, 72, 73, 74, 75, 21, 0,
  606. 76, 77, 78, 79, 22, 23, 0, 0, 24, 0,
  607. 25, 0, 0, 0, 0, 0, 402, 0, 80, 81,
  608. 82, 83, 84, 26, 7, 27, 0, 0, 0, 28,
  609. 29, 0, 0, 85, 86, 0, 0, 0, 0, 87,
  610. 0, 5, 6, 88, 7, 8, 0, 0, 30, 0,
  611. 31, 0, 0, 9, 10, 11, 12, 13, 14, 15,
  612. 16, 17, 18, 19, 20, 0, 0, 0, 0, 5,
  613. 6, 0, 7, 8, 212, 213, 214, 215, 216, 217,
  614. 0, 9, 10, 11, 12, 13, 14, 15, 16, 17,
  615. 18, 19, 20, 0, 0, 0, 0, 0, 238, 220,
  616. 221, 222, 223, 224, 225, 0, 226, 0, 0, 0,
  617. 0, 212, 213, 214, 215, 216, 217, 21, 0, 0,
  618. 0, 0, 0, 22, 23, 0, 0, 24, 28, 25,
  619. 0, 0, 0, 0, 0, 238, 220, 221, 222, 223,
  620. 224, 225, 26, 226, 27, 21, 0, 0, 28, 29,
  621. 0, 22, 23, 0, 0, 24, 0, 25, 0, 0,
  622. 0, 0, 0, 0, 39, 0, 0, 30, 0, 31,
  623. 26, 0, 27, 0, 0, 0, 28, 29, 46, 47,
  624. 48, 7, 0, 0, 49, 0, 121, 122, 123, 50,
  625. 124, 125, 126, 127, 0, 30, 0, 31, 0, 0,
  626. 0, 0, 128, 129, 130, 131, 132, 133, 134, 135,
  627. 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
  628. 146, 0, 0, 0, 0, 0, 53, 54, 55, 56,
  629. 57, 58, 59, 60, 61, 62, 63, 64, 0, 0,
  630. 0, 0, 0, 65, 66, 67, 68, 69, 70, 71,
  631. 72, 73, 74, 75, 0, 0, 76, 77, 78, 79,
  632. 0, 0, 147, 148, 0, 0, 0, 0, 0, 0,
  633. 0, 0, 0, 0, 80, 81, 82, 83, 84, 0,
  634. 0, 0, 149, 150, 151, 28, 0, 0, 0, 103,
  635. 86, 46, 47, 48, 7, 87, 0, 49, 0, 88,
  636. 0, 0, 50, 0, 0, 51, 52, 0, 0, 0,
  637. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  638. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  639. 0, 0, 0, 0, 0, 0, 0, 0, 0, 53,
  640. 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
  641. 64, 0, 0, 0, 0, 0, 65, 66, 67, 68,
  642. 69, 70, 71, 72, 73, 74, 75, 0, 0, 76,
  643. 77, 78, 79, 0, 0, 0, 0, 0, 0, 0,
  644. 0, 0, 0, 0, 0, 0, 0, 80, 81, 82,
  645. 83, 84, 0, 0, 0, 0, 0, 0, 28, 0,
  646. 0, 0, 85, 86, 46, 47, 48, 7, 87, 0,
  647. 49, 0, 88, 0, 0, 50, 0, 0, 51, 52,
  648. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  649. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  650. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  651. 0, 0, 53, 54, 55, 56, 57, 58, 59, 60,
  652. 61, 62, 63, 64, 0, 0, 0, 0, 0, 65,
  653. 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
  654. 0, 0, 76, 77, 78, 79, 0, 0, 0, 0,
  655. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  656. 80, 81, 82, 83, 84, 0, 0, 0, 0, 0,
  657. 0, 28, 0, 0, 0, 103, 86, 46, 47, 48,
  658. 7, 87, 0, 49, 0, 104, 0, 0, 50, 0,
  659. 0, 51, 52, 0, 0, 0, 0, 0, 0, 0,
  660. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  661. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  662. 0, 0, 0, 0, 0, 53, 54, 55, 56, 57,
  663. 58, 59, 60, 61, 62, 63, 64, 0, 0, 0,
  664. 0, 0, 65, 66, 67, 68, 69, 70, 71, 72,
  665. 73, 74, 75, 0, 0, 76, 77, 78, 79, 0,
  666. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  667. 0, 0, 0, 80, 81, 82, 83, 84, 0, 0,
  668. 0, 0, 0, 0, 28, 0, 0, 0, 85, 86,
  669. 46, 47, 48, 7, 87, 0, 49, 0, 104, 0,
  670. 0, 50, 0, 0, 51, 52, 0, 0, 0, 0,
  671. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  672. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  673. 0, 0, 0, 0, 0, 0, 0, 0, 53, 54,
  674. 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
  675. 0, 0, 0, 0, 0, 65, 66, 67, 68, 69,
  676. 70, 71, 72, 73, 74, 75, 0, 0, 76, 77,
  677. 78, 79, 0, 0, 0, 0, 0, 0, 0, 0,
  678. 0, 0, 0, 0, 0, 0, 80, 81, 82, 83,
  679. 84, 0, 0, 0, 46, 47, 48, 28, 0, 0,
  680. 49, 268, 86, 0, 0, 50, 0, 87, 51, 52,
  681. 0, 104, 0, 0, 0, 0, 0, 0, 0, 0,
  682. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  683. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  684. 0, 0, 53, 54, 55, 56, 57, 58, 59, 60,
  685. 61, 62, 63, 64, 0, 0, 0, 0, 0, 65,
  686. 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
  687. 0, 0, 76, 77, 78, 79, 0, 0, 0, 0,
  688. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  689. 80, 81, 82, 83, 84, 212, 213, 214, 215, 216,
  690. 217, 0, 46, 47, 48, 103, 86, 0, 49, 0,
  691. 0, 87, 405, 50, 0, 88, 51, 52, 218, 238,
  692. 220, 221, 222, 223, 224, 225, 0, 226, 0, 0,
  693. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  694. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  695. 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  696. 63, 64, 0, 0, 0, 0, 0, 65, 66, 67,
  697. 68, 69, 70, 71, 72, 73, 74, 75, 0, 0,
  698. 76, 77, 78, 79, 0, 0, 0, 0, 0, 0,
  699. 0, 0, 0, 0, 0, 0, 0, 0, 80, 81,
  700. 82, 83, 84, 0, 0, 0, 46, 47, 48, 0,
  701. 0, 0, 49, 103, 86, 0, 0, 50, 0, 87,
  702. 51, 52, 0, 88, 0, 0, 0, 0, 0, 0,
  703. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  704. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  705. 0, 0, 0, 0, 53, 54, 55, 56, 57, 58,
  706. 59, 60, 61, 62, 63, 64, 0, 0, 0, 0,
  707. 0, 65, 66, 67, 68, 69, 70, 71, 72, 73,
  708. 74, 75, 0, 0, 76, 77, 78, 79, 0, 0,
  709. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  710. 0, 0, 80, 81, 82, 83, 84, 0, 0, 0,
  711. 46, 47, 48, 0, 0, 0, 49, 85, 86, 0,
  712. 0, 50, 0, 87, 51, 52, 0, 88, 0, 0,
  713. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  714. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  715. 0, 0, 0, 0, 0, 0, 0, 0, 53, 54,
  716. 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
  717. 0, 0, 0, 0, 0, 65, 66, 67, 68, 69,
  718. 70, 71, 72, 73, 74, 75, 0, 0, 76, 77,
  719. 78, 79, 46, 47, 48, 0, 0, 0, 49, 0,
  720. 0, 0, 0, 50, 0, 0, 80, 81, 82, 83,
  721. 84, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  722. 0, 268, 86, 0, 0, 0, 0, 87, 0, 0,
  723. 0, 88, 0, 0, 0, -188, 0, 0, 0, 0,
  724. 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  725. 63, 64, 0, 0, 0, 0, 0, 65, 66, 67,
  726. 68, 69, 70, 71, 72, 73, 74, 75, 0, 0,
  727. 76, 77, 78, 79, 46, 47, 48, 0, 0, 0,
  728. 49, 0, 0, 0, 0, 50, 0, 0, 80, 81,
  729. 82, 83, 84, 0, 0, 0, 0, 0, 0, 0,
  730. 0, 0, 0, 103, 86, 0, 0, 0, 0, 87,
  731. 0, 0, 0, 88, 0, 0, 0, -189, 0, 0,
  732. 0, 0, 53, 54, 55, 56, 57, 58, 59, 60,
  733. 61, 62, 63, 64, 0, 0, 0, 0, 0, 65,
  734. 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
  735. 0, 0, 76, 77, 78, 79, 46, 47, 48, 0,
  736. 0, 0, 49, 0, 0, 0, 0, 50, 0, 0,
  737. 80, 81, 82, 83, 84, 0, 0, 0, 0, 0,
  738. 0, 0, 0, 0, 0, 103, 86, 0, 0, 0,
  739. 0, 87, 0, 0, 0, 88, 0, 0, 0, 0,
  740. 0, 0, 0, 0, 53, 54, 55, 56, 57, 58,
  741. 59, 60, 61, 62, 63, 64, 0, 0, 0, 0,
  742. 0, 65, 66, 67, 68, 69, 70, 71, 72, 73,
  743. 74, 75, 0, 0, 76, 77, 78, 79, 0, 0,
  744. 0, 0, 0, 51, 52, 0, 0, 0, 0, 0,
  745. 0, 0, 80, 81, 82, 83, 84, 51, 52, 0,
  746. 0, 0, 0, 0, 0, 0, 0, 103, 86, 0,
  747. 0, 0, 0, 87, 0, 0, 0, 88, 54, 55,
  748. 56, 57, 58, 59, 60, 61, 62, 63, 64, 0,
  749. 0, 0, 54, 55, 56, 57, 58, 59, 60, 61,
  750. 62, 63, 64, 0, 0, 0, 0, 76, 77, 78,
  751. 79, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  752. 0, 76, 77, 78, 79, 80, 81, 82, 83, 84,
  753. 0, 0, 210, 0, 0, 211, 0, 0, 0, 80,
  754. 81, 82, 83, 84, 0, 0, 54, 55, 56, 57,
  755. 58, 59, 60, 61, 62, 63, 64, 0, 0, 0,
  756. 263, 0, 0, 0, 0, 210, 0, 0, 211, 0,
  757. 0, 0, 0, 0, 349, 76, 77, 78, 79, 212,
  758. 213, 214, 215, 216, 217, 0, 0, 0, 0, 0,
  759. 0, 0, 0, 80, 81, 82, 83, 84, 0, 0,
  760. 0, 0, 218, 219, 220, 221, 222, 223, 224, 225,
  761. 0, 226, 236, 237, 214, 215, 216, 217, 0, 0,
  762. 0, 0, 236, 237, 214, 215, 216, 217, 194, 0,
  763. 0, 0, 0, 0, 0, 218, 219, 220, 221, 222,
  764. 223, 224, 225, 0, 226, 218, 238, 220, 221, 222,
  765. 223, 224, 225, 0, 226, 236, 237, 214, 215, 216,
  766. 217, 0, 0, 0, 212, 213, 214, 215, 216, 217,
  767. 0, 0, 0, 236, 0, 214, 215, 216, 217, 238,
  768. 220, 221, 222, 223, 224, 225, 0, 226, 238, 220,
  769. 221, 222, 223, 224, 225, 0, 226, 238, 220, 221,
  770. 222, 223, 224, 225, 0, 226
  771. };
  772. static const short yycheck[] = { 23,
  773. 85, 0, 116, 27, 98, 29, 127, 128, 6, 3,
  774. 3, 126, 4, 37, 117, 50, 9, 96, 104, 133,
  775. 3, 14, 0, 128, 6, 126, 9, 100, 23, 23,
  776. 0, 14, 4, 89, 29, 29, 119, 120, 118, 119,
  777. 120, 116, 85, 37, 119, 120, 4, 132, 133, 134,
  778. 133, 154, 114, 46, 119, 120, 135, 113, 92, 6,
  779. 127, 85, 32, 87, 88, 89, 80, 14, 8, 154,
  780. 40, 6, 19, 20, 21, 22, 23, 24, 114, 26,
  781. 104, 114, 80, 114, 119, 120, 17, 18, 116, 113,
  782. 85, 119, 120, 136, 89, 89, 17, 18, 95, 96,
  783. 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
  784. 134, 114, 136, 114, 138, 139, 140, 111, 113, 113,
  785. 25, 127, 115, 117, 116, 149, 150, 126, 110, 114,
  786. 154, 130, 115, 132, 219, 208, 41, 132, 133, 134,
  787. 93, 94, 227, 114, 187, 188, 232, 233, 126, 114,
  788. 236, 237, 130, 114, 132, 119, 120, 6, 114, 154,
  789. 154, 36, 114, 187, 188, 14, 260, 261, 99, 100,
  790. 19, 20, 21, 22, 23, 24, 4, 26, 99, 100,
  791. 259, 86, 8, 262, 131, 264, 114, 115, 212, 213,
  792. 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  793. 224, 225, 226, 227, 228, 10, 133, 259, 232, 233,
  794. 262, 133, 236, 237, 238, 300, 125, 63, 64, 65,
  795. 66, 67, 3, 134, 219, 268, 132, 119, 120, 121,
  796. 122, 123, 227, 125, 63, 64, 65, 66, 67, 47,
  797. 234, 235, 130, 132, 268, 121, 122, 123, 242, 125,
  798. 344, 156, 8, 3, 8, 160, 161, 162, 163, 164,
  799. 165, 166, 167, 168, 169, 170, 345, 346, 133, 133,
  800. 133, 374, 6, 119, 120, 116, 300, 133, 133, 116,
  801. 116, 133, 131, 368, 369, 19, 20, 21, 22, 23,
  802. 24, 133, 26, 345, 346, 133, 375, 48, 8, 378,
  803. 93, 116, 3, 32, 3, 300, 105, 49, 6, 93,
  804. 9, 95, 96, 97, 98, 14, 133, 133, 17, 18,
  805. 133, 133, 90, 375, 8, 0, 378, 0, 32, 29,
  806. 380, 154, -1, 117, 118, 119, 120, 121, 122, 123,
  807. -1, 125, -1, -1, 368, 369, 370, -1, 372, -1,
  808. -1, -1, -1, 52, 53, 54, 55, 56, 57, 58,
  809. 59, 60, 61, 62, 93, 94, 95, 96, 97, 98,
  810. -1, -1, 46, 368, 369, 49, -1, -1, 402, -1,
  811. 374, 405, 81, 82, 83, 84, -1, -1, 117, 118,
  812. 119, 120, 121, 122, 123, -1, 125, 131, -1, -1,
  813. 99, 100, 101, 102, 103, -1, 95, 96, 97, 98,
  814. 3, 4, 5, 6, -1, 114, 9, -1, -1, -1,
  815. -1, 14, -1, -1, 17, 18, -1, -1, 117, 118,
  816. 119, 120, 121, 122, 123, 134, 125, -1, -1, -1,
  817. -1, -1, -1, -1, -1, 119, 120, 121, 122, 123,
  818. -1, 125, 357, -1, -1, -1, 361, 362, 51, 52,
  819. 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  820. -1, -1, 97, 98, -1, 68, 69, 70, 71, 72,
  821. 73, 74, 75, 76, 77, 78, -1, -1, 81, 82,
  822. 83, 84, 117, 118, 119, 120, 121, 122, 123, -1,
  823. 125, -1, -1, -1, -1, -1, 99, 100, 101, 102,
  824. 103, -1, -1, -1, -1, -1, -1, 110, -1, -1,
  825. -1, 114, 115, -1, -1, -1, -1, 120, -1, -1,
  826. -1, 124, 3, 4, 5, 6, 7, -1, 9, -1,
  827. 133, -1, -1, 14, 15, 16, 17, 18, 19, 20,
  828. 21, 22, 23, 24, 25, 26, -1, -1, -1, -1,
  829. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  830. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  831. 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
  832. 61, 62, -1, -1, -1, -1, -1, 68, 69, 70,
  833. 71, 72, 73, 74, 75, 76, 77, 78, 79, -1,
  834. 81, 82, 83, 84, 85, 86, -1, -1, 89, -1,
  835. 91, -1, -1, -1, -1, -1, 35, -1, 99, 100,
  836. 101, 102, 103, 104, 6, 106, -1, -1, -1, 110,
  837. 111, -1, -1, 114, 115, -1, -1, -1, -1, 120,
  838. -1, 3, 4, 124, 6, 7, -1, -1, 129, -1,
  839. 131, -1, -1, 15, 16, 17, 18, 19, 20, 21,
  840. 22, 23, 24, 25, 26, -1, -1, -1, -1, 3,
  841. 4, -1, 6, 7, 93, 94, 95, 96, 97, 98,
  842. -1, 15, 16, 17, 18, 19, 20, 21, 22, 23,
  843. 24, 25, 26, -1, -1, -1, -1, -1, 117, 118,
  844. 119, 120, 121, 122, 123, -1, 125, -1, -1, -1,
  845. -1, 93, 94, 95, 96, 97, 98, 79, -1, -1,
  846. -1, -1, -1, 85, 86, -1, -1, 89, 110, 91,
  847. -1, -1, -1, -1, -1, 117, 118, 119, 120, 121,
  848. 122, 123, 104, 125, 106, 79, -1, -1, 110, 111,
  849. -1, 85, 86, -1, -1, 89, -1, 91, -1, -1,
  850. -1, -1, -1, -1, 126, -1, -1, 129, -1, 131,
  851. 104, -1, 106, -1, -1, -1, 110, 111, 3, 4,
  852. 5, 6, -1, -1, 9, -1, 11, 12, 13, 14,
  853. 15, 16, 17, 18, -1, 129, -1, 131, -1, -1,
  854. -1, -1, 27, 28, 29, 30, 31, 32, 33, 34,
  855. 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
  856. 45, -1, -1, -1, -1, -1, 51, 52, 53, 54,
  857. 55, 56, 57, 58, 59, 60, 61, 62, -1, -1,
  858. -1, -1, -1, 68, 69, 70, 71, 72, 73, 74,
  859. 75, 76, 77, 78, -1, -1, 81, 82, 83, 84,
  860. -1, -1, 87, 88, -1, -1, -1, -1, -1, -1,
  861. -1, -1, -1, -1, 99, 100, 101, 102, 103, -1,
  862. -1, -1, 107, 108, 109, 110, -1, -1, -1, 114,
  863. 115, 3, 4, 5, 6, 120, -1, 9, -1, 124,
  864. -1, -1, 14, -1, -1, 17, 18, -1, -1, -1,
  865. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  866. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  867. -1, -1, -1, -1, -1, -1, -1, -1, -1, 51,
  868. 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
  869. 62, -1, -1, -1, -1, -1, 68, 69, 70, 71,
  870. 72, 73, 74, 75, 76, 77, 78, -1, -1, 81,
  871. 82, 83, 84, -1, -1, -1, -1, -1, -1, -1,
  872. -1, -1, -1, -1, -1, -1, -1, 99, 100, 101,
  873. 102, 103, -1, -1, -1, -1, -1, -1, 110, -1,
  874. -1, -1, 114, 115, 3, 4, 5, 6, 120, -1,
  875. 9, -1, 124, -1, -1, 14, -1, -1, 17, 18,
  876. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  877. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  878. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  879. -1, -1, 51, 52, 53, 54, 55, 56, 57, 58,
  880. 59, 60, 61, 62, -1, -1, -1, -1, -1, 68,
  881. 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
  882. -1, -1, 81, 82, 83, 84, -1, -1, -1, -1,
  883. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  884. 99, 100, 101, 102, 103, -1, -1, -1, -1, -1,
  885. -1, 110, -1, -1, -1, 114, 115, 3, 4, 5,
  886. 6, 120, -1, 9, -1, 124, -1, -1, 14, -1,
  887. -1, 17, 18, -1, -1, -1, -1, -1, -1, -1,
  888. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  889. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  890. -1, -1, -1, -1, -1, 51, 52, 53, 54, 55,
  891. 56, 57, 58, 59, 60, 61, 62, -1, -1, -1,
  892. -1, -1, 68, 69, 70, 71, 72, 73, 74, 75,
  893. 76, 77, 78, -1, -1, 81, 82, 83, 84, -1,
  894. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  895. -1, -1, -1, 99, 100, 101, 102, 103, -1, -1,
  896. -1, -1, -1, -1, 110, -1, -1, -1, 114, 115,
  897. 3, 4, 5, 6, 120, -1, 9, -1, 124, -1,
  898. -1, 14, -1, -1, 17, 18, -1, -1, -1, -1,
  899. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  900. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  901. -1, -1, -1, -1, -1, -1, -1, -1, 51, 52,
  902. 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  903. -1, -1, -1, -1, -1, 68, 69, 70, 71, 72,
  904. 73, 74, 75, 76, 77, 78, -1, -1, 81, 82,
  905. 83, 84, -1, -1, -1, -1, -1, -1, -1, -1,
  906. -1, -1, -1, -1, -1, -1, 99, 100, 101, 102,
  907. 103, -1, -1, -1, 3, 4, 5, 110, -1, -1,
  908. 9, 114, 115, -1, -1, 14, -1, 120, 17, 18,
  909. -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
  910. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  911. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  912. -1, -1, 51, 52, 53, 54, 55, 56, 57, 58,
  913. 59, 60, 61, 62, -1, -1, -1, -1, -1, 68,
  914. 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
  915. -1, -1, 81, 82, 83, 84, -1, -1, -1, -1,
  916. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  917. 99, 100, 101, 102, 103, 93, 94, 95, 96, 97,
  918. 98, -1, 3, 4, 5, 114, 115, -1, 9, -1,
  919. -1, 120, 121, 14, -1, 124, 17, 18, 116, 117,
  920. 118, 119, 120, 121, 122, 123, -1, 125, -1, -1,
  921. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  922. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  923. 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
  924. 61, 62, -1, -1, -1, -1, -1, 68, 69, 70,
  925. 71, 72, 73, 74, 75, 76, 77, 78, -1, -1,
  926. 81, 82, 83, 84, -1, -1, -1, -1, -1, -1,
  927. -1, -1, -1, -1, -1, -1, -1, -1, 99, 100,
  928. 101, 102, 103, -1, -1, -1, 3, 4, 5, -1,
  929. -1, -1, 9, 114, 115, -1, -1, 14, -1, 120,
  930. 17, 18, -1, 124, -1, -1, -1, -1, -1, -1,
  931. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  932. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  933. -1, -1, -1, -1, 51, 52, 53, 54, 55, 56,
  934. 57, 58, 59, 60, 61, 62, -1, -1, -1, -1,
  935. -1, 68, 69, 70, 71, 72, 73, 74, 75, 76,
  936. 77, 78, -1, -1, 81, 82, 83, 84, -1, -1,
  937. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  938. -1, -1, 99, 100, 101, 102, 103, -1, -1, -1,
  939. 3, 4, 5, -1, -1, -1, 9, 114, 115, -1,
  940. -1, 14, -1, 120, 17, 18, -1, 124, -1, -1,
  941. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  942. -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  943. -1, -1, -1, -1, -1, -1, -1, -1, 51, 52,
  944. 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
  945. -1, -1, -1, -1, -1, 68, 69, 70, 71, 72,
  946. 73, 74, 75, 76, 77, 78, -1, -1, 81, 82,
  947. 83, 84, 3, 4, 5, -1, -1, -1, 9, -1,
  948. -1, -1, -1, 14, -1, -1, 99, 100, 101, 102,
  949. 103, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  950. -1, 114, 115, -1, -1, -1, -1, 120, -1, -1,
  951. -1, 124, -1, -1, -1, 46, -1, -1, -1, -1,
  952. 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
  953. 61, 62, -1, -1, -1, -1, -1, 68, 69, 70,
  954. 71, 72, 73, 74, 75, 76, 77, 78, -1, -1,
  955. 81, 82, 83, 84, 3, 4, 5, -1, -1, -1,
  956. 9, -1, -1, -1, -1, 14, -1, -1, 99, 100,
  957. 101, 102, 103, -1, -1, -1, -1, -1, -1, -1,
  958. -1, -1, -1, 114, 115, -1, -1, -1, -1, 120,
  959. -1, -1, -1, 124, -1, -1, -1, 46, -1, -1,
  960. -1, -1, 51, 52, 53, 54, 55, 56, 57, 58,
  961. 59, 60, 61, 62, -1, -1, -1, -1, -1, 68,
  962. 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
  963. -1, -1, 81, 82, 83, 84, 3, 4, 5, -1,
  964. -1, -1, 9, -1, -1, -1, -1, 14, -1, -1,
  965. 99, 100, 101, 102, 103, -1, -1, -1, -1, -1,
  966. -1, -1, -1, -1, -1, 114, 115, -1, -1, -1,
  967. -1, 120, -1, -1, -1, 124, -1, -1, -1, -1,
  968. -1, -1, -1, -1, 51, 52, 53, 54, 55, 56,
  969. 57, 58, 59, 60, 61, 62, -1, -1, -1, -1,
  970. -1, 68, 69, 70, 71, 72, 73, 74, 75, 76,
  971. 77, 78, -1, -1, 81, 82, 83, 84, -1, -1,
  972. -1, -1, -1, 17, 18, -1, -1, -1, -1, -1,
  973. -1, -1, 99, 100, 101, 102, 103, 17, 18, -1,
  974. -1, -1, -1, -1, -1, -1, -1, 114, 115, -1,
  975. -1, -1, -1, 120, -1, -1, -1, 124, 52, 53,
  976. 54, 55, 56, 57, 58, 59, 60, 61, 62, -1,
  977. -1, -1, 52, 53, 54, 55, 56, 57, 58, 59,
  978. 60, 61, 62, -1, -1, -1, -1, 81, 82, 83,
  979. 84, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  980. -1, 81, 82, 83, 84, 99, 100, 101, 102, 103,
  981. -1, -1, 46, -1, -1, 49, -1, -1, -1, 99,
  982. 100, 101, 102, 103, -1, -1, 52, 53, 54, 55,
  983. 56, 57, 58, 59, 60, 61, 62, -1, -1, -1,
  984. 134, -1, -1, -1, -1, 46, -1, -1, 49, -1,
  985. -1, -1, -1, -1, 134, 81, 82, 83, 84, 93,
  986. 94, 95, 96, 97, 98, -1, -1, -1, -1, -1,
  987. -1, -1, -1, 99, 100, 101, 102, 103, -1, -1,
  988. -1, -1, 116, 117, 118, 119, 120, 121, 122, 123,
  989. -1, 125, 93, 94, 95, 96, 97, 98, -1, -1,
  990. -1, -1, 93, 94, 95, 96, 97, 98, 134, -1,
  991. -1, -1, -1, -1, -1, 116, 117, 118, 119, 120,
  992. 121, 122, 123, -1, 125, 116, 117, 118, 119, 120,
  993. 121, 122, 123, -1, 125, 93, 94, 95, 96, 97,
  994. 98, -1, -1, -1, 93, 94, 95, 96, 97, 98,
  995. -1, -1, -1, 93, -1, 95, 96, 97, 98, 117,
  996. 118, 119, 120, 121, 122, 123, -1, 125, 117, 118,
  997. 119, 120, 121, 122, 123, -1, 125, 117, 118, 119,
  998. 120, 121, 122, 123, -1, 125
  999. };
  1000. /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
  1001. #line 3 "/usr/local/share/bison.simple"
  1002. /* This file comes from bison-1.28. */
  1003. /* Skeleton output parser for bison,
  1004. Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
  1005. This program is free software; you can redistribute it and/or modify
  1006. it under the terms of the GNU General Public License as published by
  1007. the Free Software Foundation; either version 2, or (at your option)
  1008. any later version.
  1009. This program is distributed in the hope that it will be useful,
  1010. but WITHOUT ANY WARRANTY; without even the implied warranty of
  1011. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1012. GNU General Public License for more details.
  1013. You should have received a copy of the GNU General Public License
  1014. along with this program; if not, write to the Free Software
  1015. Foundation, Inc., 59 Temple Place - Suite 330,
  1016. Boston, MA 02111-1307, USA. */
  1017. /* As a special exception, when this file is copied by Bison into a
  1018. Bison output file, you may use that output file without restriction.
  1019. This special exception was added by the Free Software Foundation
  1020. in version 1.24 of Bison. */
  1021. /* This is the parser code that is written into each bison parser
  1022. when the %semantic_parser declaration is not specified in the grammar.
  1023. It was written by Richard Stallman by simplifying the hairy parser
  1024. used when %semantic_parser is specified. */
  1025. #ifndef YYSTACK_USE_ALLOCA
  1026. #ifdef alloca
  1027. #define YYSTACK_USE_ALLOCA
  1028. #else /* alloca not defined */
  1029. #ifdef __GNUC__
  1030. #define YYSTACK_USE_ALLOCA
  1031. #define alloca __builtin_alloca
  1032. #else /* not GNU C. */
  1033. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
  1034. #define YYSTACK_USE_ALLOCA
  1035. #include <alloca.h>
  1036. #else /* not sparc */
  1037. /* We think this test detects Watcom and Microsoft C. */
  1038. /* This used to test MSDOS, but that is a bad idea
  1039. since that symbol is in the user namespace. */
  1040. #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
  1041. #if 0 /* No need for malloc.h, which pollutes the namespace;
  1042. instead, just don't use alloca. */
  1043. #include <malloc.h>
  1044. #endif
  1045. #else /* not MSDOS, or __TURBOC__ */
  1046. #if defined(_AIX)
  1047. /* I don't know what this was needed for, but it pollutes the namespace.
  1048. So I turned it off. rms, 2 May 1997. */
  1049. /* #include <malloc.h> */
  1050. #pragma alloca
  1051. #define YYSTACK_USE_ALLOCA
  1052. #else /* not MSDOS, or __TURBOC__, or _AIX */
  1053. #if 0
  1054. #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
  1055. and on HPUX 10. Eventually we can turn this on. */
  1056. #define YYSTACK_USE_ALLOCA
  1057. #define alloca __builtin_alloca
  1058. #endif /* __hpux */
  1059. #endif
  1060. #endif /* not _AIX */
  1061. #endif /* not MSDOS, or __TURBOC__ */
  1062. #endif /* not sparc */
  1063. #endif /* not GNU C */
  1064. #endif /* alloca not defined */
  1065. #endif /* YYSTACK_USE_ALLOCA not defined */
  1066. #ifdef YYSTACK_USE_ALLOCA
  1067. #define YYSTACK_ALLOC alloca
  1068. #else
  1069. #define YYSTACK_ALLOC malloc
  1070. #endif
  1071. /* Note: there must be only one dollar sign in this file.
  1072. It is replaced by the list of actions, each action
  1073. as one case of the switch. */
  1074. #define yyerrok (yyerrstatus = 0)
  1075. #define yyclearin (yychar = YYEMPTY)
  1076. #define YYEMPTY -2
  1077. #define YYEOF 0
  1078. #define YYACCEPT goto yyacceptlab
  1079. #define YYABORT goto yyabortlab
  1080. #define YYERROR goto yyerrlab1
  1081. /* Like YYERROR except do call yyerror.
  1082. This remains here temporarily to ease the
  1083. transition to the new meaning of YYERROR, for GCC.
  1084. Once GCC version 2 has supplanted version 1, this can go. */
  1085. #define YYFAIL goto yyerrlab
  1086. #define YYRECOVERING() (!!yyerrstatus)
  1087. #define YYBACKUP(token, value) \
  1088. do \
  1089. if (yychar == YYEMPTY && yylen == 1) \
  1090. { yychar = (token), yylval = (value); \
  1091. yychar1 = YYTRANSLATE (yychar); \
  1092. YYPOPSTACK; \
  1093. goto yybackup; \
  1094. } \
  1095. else \
  1096. { yyerror ("syntax error: cannot back up"); YYERROR; } \
  1097. while (0)
  1098. #define YYTERROR 1
  1099. #define YYERRCODE 256
  1100. #ifndef YYPURE
  1101. #define YYLEX yylex()
  1102. #endif
  1103. #ifdef YYPURE
  1104. #ifdef YYLSP_NEEDED
  1105. #ifdef YYLEX_PARAM
  1106. #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
  1107. #else
  1108. #define YYLEX yylex(&yylval, &yylloc)
  1109. #endif
  1110. #else /* not YYLSP_NEEDED */
  1111. #ifdef YYLEX_PARAM
  1112. #define YYLEX yylex(&yylval, YYLEX_PARAM)
  1113. #else
  1114. #define YYLEX yylex(&yylval)
  1115. #endif
  1116. #endif /* not YYLSP_NEEDED */
  1117. #endif
  1118. /* If nonreentrant, generate the variables here */
  1119. #ifndef YYPURE
  1120. int yychar; /* the lookahead symbol */
  1121. YYSTYPE yylval; /* the semantic value of the */
  1122. /* lookahead symbol */
  1123. #ifdef YYLSP_NEEDED
  1124. YYLTYPE yylloc; /* location data for the lookahead */
  1125. /* symbol */
  1126. #endif
  1127. int yynerrs; /* number of parse errors so far */
  1128. #endif /* not YYPURE */
  1129. #if YYDEBUG != 0
  1130. int yydebug; /* nonzero means print parse trace */
  1131. /* Since this is uninitialized, it does not stop multiple parsers
  1132. from coexisting. */
  1133. #endif
  1134. /* YYINITDEPTH indicates the initial size of the parser's stacks */
  1135. #ifndef YYINITDEPTH
  1136. #define YYINITDEPTH 200
  1137. #endif
  1138. /* YYMAXDEPTH is the maximum size the stacks can grow to
  1139. (effective only if the built-in stack extension method is used). */
  1140. #if YYMAXDEPTH == 0
  1141. #undef YYMAXDEPTH
  1142. #endif
  1143. #ifndef YYMAXDEPTH
  1144. #define YYMAXDEPTH 10000
  1145. #endif
  1146. /* Define __yy_memcpy. Note that the size argument
  1147. should be passed with type unsigned int, because that is what the non-GCC
  1148. definitions require. With GCC, __builtin_memcpy takes an arg
  1149. of type size_t, but it can handle unsigned int. */
  1150. #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
  1151. #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
  1152. #else /* not GNU C or C++ */
  1153. #ifndef __cplusplus
  1154. /* This is the most reliable way to avoid incompatibilities
  1155. in available built-in functions on various systems. */
  1156. static void
  1157. __yy_memcpy (to, from, count)
  1158. char *to;
  1159. char *from;
  1160. unsigned int count;
  1161. {
  1162. register char *f = from;
  1163. register char *t = to;
  1164. register int i = count;
  1165. while (i-- > 0)
  1166. *t++ = *f++;
  1167. }
  1168. #else /* __cplusplus */
  1169. /* This is the most reliable way to avoid incompatibilities
  1170. in available built-in functions on various systems. */
  1171. static void
  1172. __yy_memcpy (char *to, char *from, unsigned int count)
  1173. {
  1174. register char *t = to;
  1175. register char *f = from;
  1176. register int i = count;
  1177. while (i-- > 0)
  1178. *t++ = *f++;
  1179. }
  1180. #endif
  1181. #endif
  1182. #line 217 "/usr/local/share/bison.simple"
  1183. /* The user can define YYPARSE_PARAM as the name of an argument to be passed
  1184. into yyparse. The argument should have type void *.
  1185. It should actually point to an object.
  1186. Grammar actions can access the variable by casting it
  1187. to the proper pointer type. */
  1188. #ifdef YYPARSE_PARAM
  1189. #ifdef __cplusplus
  1190. #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
  1191. #define YYPARSE_PARAM_DECL
  1192. #else /* not __cplusplus */
  1193. #define YYPARSE_PARAM_ARG YYPARSE_PARAM
  1194. #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
  1195. #endif /* not __cplusplus */
  1196. #else /* not YYPARSE_PARAM */
  1197. #define YYPARSE_PARAM_ARG
  1198. #define YYPARSE_PARAM_DECL
  1199. #endif /* not YYPARSE_PARAM */
  1200. /* Prevent warning if -Wstrict-prototypes. */
  1201. #ifdef __GNUC__
  1202. #ifdef YYPARSE_PARAM
  1203. int yyparse (void *);
  1204. #else
  1205. int yyparse (void);
  1206. #endif
  1207. #endif
  1208. int
  1209. yyparse(YYPARSE_PARAM_ARG)
  1210. YYPARSE_PARAM_DECL
  1211. {
  1212. register int yystate;
  1213. register int yyn;
  1214. register short *yyssp;
  1215. register YYSTYPE *yyvsp;
  1216. int yyerrstatus; /* number of tokens to shift before error messages enabled */
  1217. int yychar1 = 0; /* lookahead token as an internal (translated) token number */
  1218. short yyssa[YYINITDEPTH]; /* the state stack */
  1219. YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
  1220. short *yyss = yyssa; /* refer to the stacks thru separate pointers */
  1221. YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
  1222. #ifdef YYLSP_NEEDED
  1223. YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
  1224. YYLTYPE *yyls = yylsa;
  1225. YYLTYPE *yylsp;
  1226. #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
  1227. #else
  1228. #define YYPOPSTACK (yyvsp--, yyssp--)
  1229. #endif
  1230. int yystacksize = YYINITDEPTH;
  1231. int yyfree_stacks = 0;
  1232. #ifdef YYPURE
  1233. int yychar;
  1234. YYSTYPE yylval;
  1235. int yynerrs;
  1236. #ifdef YYLSP_NEEDED
  1237. YYLTYPE yylloc;
  1238. #endif
  1239. #endif
  1240. YYSTYPE yyval; /* the variable used to return */
  1241. /* semantic values from the action */
  1242. /* routines */
  1243. int yylen;
  1244. #if YYDEBUG != 0
  1245. if (yydebug)
  1246. fprintf(stderr, "Starting parse\n");
  1247. #endif
  1248. yystate = 0;
  1249. yyerrstatus = 0;
  1250. yynerrs = 0;
  1251. yychar = YYEMPTY; /* Cause a token to be read. */
  1252. /* Initialize stack pointers.
  1253. Waste one element of value and location stack
  1254. so that they stay on the same level as the state stack.
  1255. The wasted elements are never initialized. */
  1256. yyssp = yyss - 1;
  1257. yyvsp = yyvs;
  1258. #ifdef YYLSP_NEEDED
  1259. yylsp = yyls;
  1260. #endif
  1261. /* Push a new state, which is found in yystate . */
  1262. /* In all cases, when you get here, the value and location stacks
  1263. have just been pushed. so pushing a state here evens the stacks. */
  1264. yynewstate:
  1265. *++yyssp = yystate;
  1266. if (yyssp >= yyss + yystacksize - 1)
  1267. {
  1268. /* Give user a chance to reallocate the stack */
  1269. /* Use copies of these so that the &'s don't force the real ones into memory. */
  1270. YYSTYPE *yyvs1 = yyvs;
  1271. short *yyss1 = yyss;
  1272. #ifdef YYLSP_NEEDED
  1273. YYLTYPE *yyls1 = yyls;
  1274. #endif
  1275. /* Get the current used size of the three stacks, in elements. */
  1276. int size = yyssp - yyss + 1;
  1277. #ifdef yyoverflow
  1278. /* Each stack pointer address is followed by the size of
  1279. the data in use in that stack, in bytes. */
  1280. #ifdef YYLSP_NEEDED
  1281. /* This used to be a conditional around just the two extra args,
  1282. but that might be undefined if yyoverflow is a macro. */
  1283. yyoverflow("parser stack overflow",
  1284. &yyss1, size * sizeof (*yyssp),
  1285. &yyvs1, size * sizeof (*yyvsp),
  1286. &yyls1, size * sizeof (*yylsp),
  1287. &yystacksize);
  1288. #else
  1289. yyoverflow("parser stack overflow",
  1290. &yyss1, size * sizeof (*yyssp),
  1291. &yyvs1, size * sizeof (*yyvsp),
  1292. &yystacksize);
  1293. #endif
  1294. yyss = yyss1; yyvs = yyvs1;
  1295. #ifdef YYLSP_NEEDED
  1296. yyls = yyls1;
  1297. #endif
  1298. #else /* no yyoverflow */
  1299. /* Extend the stack our own way. */
  1300. if (yystacksize >= YYMAXDEPTH)
  1301. {
  1302. yyerror("parser stack overflow");
  1303. if (yyfree_stacks)
  1304. {
  1305. free (yyss);
  1306. free (yyvs);
  1307. #ifdef YYLSP_NEEDED
  1308. free (yyls);
  1309. #endif
  1310. }
  1311. return 2;
  1312. }
  1313. yystacksize *= 2;
  1314. if (yystacksize > YYMAXDEPTH)
  1315. yystacksize = YYMAXDEPTH;
  1316. #ifndef YYSTACK_USE_ALLOCA
  1317. yyfree_stacks = 1;
  1318. #endif
  1319. yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
  1320. __yy_memcpy ((char *)yyss, (char *)yyss1,
  1321. size * (unsigned int) sizeof (*yyssp));
  1322. yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
  1323. __yy_memcpy ((char *)yyvs, (char *)yyvs1,
  1324. size * (unsigned int) sizeof (*yyvsp));
  1325. #ifdef YYLSP_NEEDED
  1326. yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
  1327. __yy_memcpy ((char *)yyls, (char *)yyls1,
  1328. size * (unsigned int) sizeof (*yylsp));
  1329. #endif
  1330. #endif /* no yyoverflow */
  1331. yyssp = yyss + size - 1;
  1332. yyvsp = yyvs + size - 1;
  1333. #ifdef YYLSP_NEEDED
  1334. yylsp = yyls + size - 1;
  1335. #endif
  1336. #if YYDEBUG != 0
  1337. if (yydebug)
  1338. fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  1339. #endif
  1340. if (yyssp >= yyss + yystacksize - 1)
  1341. YYABORT;
  1342. }
  1343. #if YYDEBUG != 0
  1344. if (yydebug)
  1345. fprintf(stderr, "Entering state %d\n", yystate);
  1346. #endif
  1347. goto yybackup;
  1348. yybackup:
  1349. /* Do appropriate processing given the current state. */
  1350. /* Read a lookahead token if we need one and don't already have one. */
  1351. /* yyresume: */
  1352. /* First try to decide what to do without reference to lookahead token. */
  1353. yyn = yypact[yystate];
  1354. if (yyn == YYFLAG)
  1355. goto yydefault;
  1356. /* Not known => get a lookahead token if don't already have one. */
  1357. /* yychar is either YYEMPTY or YYEOF
  1358. or a valid token in external form. */
  1359. if (yychar == YYEMPTY)
  1360. {
  1361. #if YYDEBUG != 0
  1362. if (yydebug)
  1363. fprintf(stderr, "Reading a token: ");
  1364. #endif
  1365. yychar = YYLEX;
  1366. }
  1367. /* Convert token to internal form (in yychar1) for indexing tables with */
  1368. if (yychar <= 0) /* This means end of input. */
  1369. {
  1370. yychar1 = 0;
  1371. yychar = YYEOF; /* Don't call YYLEX any more */
  1372. #if YYDEBUG != 0
  1373. if (yydebug)
  1374. fprintf(stderr, "Now at end of input.\n");
  1375. #endif
  1376. }
  1377. else
  1378. {
  1379. yychar1 = YYTRANSLATE(yychar);
  1380. #if YYDEBUG != 0
  1381. if (yydebug)
  1382. {
  1383. fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  1384. /* Give the individual parser a way to print the precise meaning
  1385. of a token, for further debugging info. */
  1386. #ifdef YYPRINT
  1387. YYPRINT (stderr, yychar, yylval);
  1388. #endif
  1389. fprintf (stderr, ")\n");
  1390. }
  1391. #endif
  1392. }
  1393. yyn += yychar1;
  1394. if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  1395. goto yydefault;
  1396. yyn = yytable[yyn];
  1397. /* yyn is what to do for this token type in this state.
  1398. Negative => reduce, -yyn is rule number.
  1399. Positive => shift, yyn is new state.
  1400. New state is final state => don't bother to shift,
  1401. just return success.
  1402. 0, or most negative number => error. */
  1403. if (yyn < 0)
  1404. {
  1405. if (yyn == YYFLAG)
  1406. goto yyerrlab;
  1407. yyn = -yyn;
  1408. goto yyreduce;
  1409. }
  1410. else if (yyn == 0)
  1411. goto yyerrlab;
  1412. if (yyn == YYFINAL)
  1413. YYACCEPT;
  1414. /* Shift the lookahead token. */
  1415. #if YYDEBUG != 0
  1416. if (yydebug)
  1417. fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  1418. #endif
  1419. /* Discard the token being shifted unless it is eof. */
  1420. if (yychar != YYEOF)
  1421. yychar = YYEMPTY;
  1422. *++yyvsp = yylval;
  1423. #ifdef YYLSP_NEEDED
  1424. *++yylsp = yylloc;
  1425. #endif
  1426. /* count tokens shifted since error; after three, turn off error status. */
  1427. if (yyerrstatus) yyerrstatus--;
  1428. yystate = yyn;
  1429. goto yynewstate;
  1430. /* Do the default action for the current state. */
  1431. yydefault:
  1432. yyn = yydefact[yystate];
  1433. if (yyn == 0)
  1434. goto yyerrlab;
  1435. /* Do a reduction. yyn is the number of a rule to reduce with. */
  1436. yyreduce:
  1437. yylen = yyr2[yyn];
  1438. if (yylen > 0)
  1439. yyval = yyvsp[1-yylen]; /* implement default value of the action */
  1440. #if YYDEBUG != 0
  1441. if (yydebug)
  1442. {
  1443. int i;
  1444. fprintf (stderr, "Reducing via rule %d (line %d), ",
  1445. yyn, yyrline[yyn]);
  1446. /* Print the symbols being reduced, and their result. */
  1447. for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  1448. fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  1449. fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  1450. }
  1451. #endif
  1452. switch (yyn) {
  1453. case 2:
  1454. #line 267 "gram.yy"
  1455. {
  1456. if (olist.head)
  1457. print_picture(olist.head);
  1458. ;
  1459. break;}
  1460. case 3:
  1461. #line 276 "gram.yy"
  1462. { yyval.pl = yyvsp[-1].pl; ;
  1463. break;}
  1464. case 4:
  1465. #line 281 "gram.yy"
  1466. { yyval.pl = yyvsp[0].pl; ;
  1467. break;}
  1468. case 5:
  1469. #line 283 "gram.yy"
  1470. { yyval.pl = yyvsp[-2].pl; ;
  1471. break;}
  1472. case 10:
  1473. #line 298 "gram.yy"
  1474. {
  1475. define_variable(yyvsp[-2].str, yyvsp[0].x);
  1476. a_delete yyvsp[-2].str;
  1477. ;
  1478. break;}
  1479. case 11:
  1480. #line 303 "gram.yy"
  1481. {
  1482. place *p = lookup_label(yyvsp[-3].str);
  1483. if (!p)
  1484. {
  1485. lex_error("variable `%1' not defined", yyvsp[-3].str);
  1486. YYABORT;
  1487. }
  1488. p->obj = 0;
  1489. p->x = yyvsp[0].x;
  1490. p->y = 0.0;
  1491. a_delete yyvsp[-3].str;
  1492. ;
  1493. break;}
  1494. case 12:
  1495. #line 316 "gram.yy"
  1496. { current_direction = UP_DIRECTION; ;
  1497. break;}
  1498. case 13:
  1499. #line 318 "gram.yy"
  1500. { current_direction = DOWN_DIRECTION; ;
  1501. break;}
  1502. case 14:
  1503. #line 320 "gram.yy"
  1504. { current_direction = LEFT_DIRECTION; ;
  1505. break;}
  1506. case 15:
  1507. #line 322 "gram.yy"
  1508. { current_direction = RIGHT_DIRECTION; ;
  1509. break;}
  1510. case 16:
  1511. #line 324 "gram.yy"
  1512. {
  1513. olist.append(make_command_object(yyvsp[0].lstr.str, yyvsp[0].lstr.filename,
  1514. yyvsp[0].lstr.lineno));
  1515. ;
  1516. break;}
  1517. case 17:
  1518. #line 329 "gram.yy"
  1519. {
  1520. olist.append(make_command_object(yyvsp[0].lstr.str, yyvsp[0].lstr.filename,
  1521. yyvsp[0].lstr.lineno));
  1522. ;
  1523. break;}
  1524. case 18:
  1525. #line 334 "gram.yy"
  1526. {
  1527. fprintf(stderr, "%s\n", yyvsp[0].lstr.str);
  1528. a_delete yyvsp[0].lstr.str;
  1529. fflush(stderr);
  1530. ;
  1531. break;}
  1532. case 19:
  1533. #line 340 "gram.yy"
  1534. { delim_flag = 1; ;
  1535. break;}
  1536. case 20:
  1537. #line 342 "gram.yy"
  1538. {
  1539. delim_flag = 0;
  1540. if (safer_flag)
  1541. lex_error("unsafe to run command `%1'", yyvsp[0].str);
  1542. else
  1543. system(yyvsp[0].str);
  1544. a_delete yyvsp[0].str;
  1545. ;
  1546. break;}
  1547. case 21:
  1548. #line 351 "gram.yy"
  1549. {
  1550. if (yychar < 0)
  1551. do_lookahead();
  1552. do_copy(yyvsp[0].lstr.str);
  1553. // do not delete the filename
  1554. ;
  1555. break;}
  1556. case 22:
  1557. #line 358 "gram.yy"
  1558. { delim_flag = 2; ;
  1559. break;}
  1560. case 23:
  1561. #line 360 "gram.yy"
  1562. { delim_flag = 0; ;
  1563. break;}
  1564. case 24:
  1565. #line 362 "gram.yy"
  1566. {
  1567. if (yychar < 0)
  1568. do_lookahead();
  1569. copy_file_thru(yyvsp[-5].lstr.str, yyvsp[-2].str, yyvsp[0].str);
  1570. // do not delete the filename
  1571. a_delete yyvsp[-2].str;
  1572. a_delete yyvsp[0].str;
  1573. ;
  1574. break;}
  1575. case 25:
  1576. #line 371 "gram.yy"
  1577. { delim_flag = 2; ;
  1578. break;}
  1579. case 26:
  1580. #line 373 "gram.yy"
  1581. { delim_flag = 0; ;
  1582. break;}
  1583. case 27:
  1584. #line 375 "gram.yy"
  1585. {
  1586. if (yychar < 0)
  1587. do_lookahead();
  1588. copy_rest_thru(yyvsp[-2].str, yyvsp[0].str);
  1589. a_delete yyvsp[-2].str;
  1590. a_delete yyvsp[0].str;
  1591. ;
  1592. break;}
  1593. case 28:
  1594. #line 383 "gram.yy"
  1595. { delim_flag = 1; ;
  1596. break;}
  1597. case 29:
  1598. #line 385 "gram.yy"
  1599. {
  1600. delim_flag = 0;
  1601. if (yychar < 0)
  1602. do_lookahead();
  1603. do_for(yyvsp[-8].str, yyvsp[-6].x, yyvsp[-4].x, yyvsp[-3].by.is_multiplicative, yyvsp[-3].by.val, yyvsp[0].str);
  1604. ;
  1605. break;}
  1606. case 30:
  1607. #line 392 "gram.yy"
  1608. {
  1609. if (yychar < 0)
  1610. do_lookahead();
  1611. if (yyvsp[0].if_data.x != 0.0)
  1612. push_body(yyvsp[0].if_data.body);
  1613. a_delete yyvsp[0].if_data.body;
  1614. ;
  1615. break;}
  1616. case 31:
  1617. #line 400 "gram.yy"
  1618. { delim_flag = 1; ;
  1619. break;}
  1620. case 32:
  1621. #line 402 "gram.yy"
  1622. {
  1623. delim_flag = 0;
  1624. if (yychar < 0)
  1625. do_lookahead();
  1626. if (yyvsp[-3].if_data.x != 0.0)
  1627. push_body(yyvsp[-3].if_data.body);
  1628. else
  1629. push_body(yyvsp[0].str);
  1630. a_delete yyvsp[-3].if_data.body;
  1631. a_delete yyvsp[0].str;
  1632. ;
  1633. break;}
  1634. case 34:
  1635. #line 415 "gram.yy"
  1636. { define_variable("scale", 1.0); ;
  1637. break;}
  1638. case 35:
  1639. #line 420 "gram.yy"
  1640. { reset(yyvsp[0].str); a_delete yyvsp[0].str; ;
  1641. break;}
  1642. case 36:
  1643. #line 422 "gram.yy"
  1644. { reset(yyvsp[0].str); a_delete yyvsp[0].str; ;
  1645. break;}
  1646. case 37:
  1647. #line 424 "gram.yy"
  1648. { reset(yyvsp[0].str); a_delete yyvsp[0].str; ;
  1649. break;}
  1650. case 38:
  1651. #line 429 "gram.yy"
  1652. { yyval.lstr = yyvsp[0].lstr; ;
  1653. break;}
  1654. case 39:
  1655. #line 431 "gram.yy"
  1656. {
  1657. yyval.lstr.str = new char[strlen(yyvsp[-1].lstr.str) + strlen(yyvsp[0].lstr.str) + 1];
  1658. strcpy(yyval.lstr.str, yyvsp[-1].lstr.str);
  1659. strcat(yyval.lstr.str, yyvsp[0].lstr.str);
  1660. a_delete yyvsp[-1].lstr.str;
  1661. a_delete yyvsp[0].lstr.str;
  1662. if (yyvsp[-1].lstr.filename)
  1663. {
  1664. yyval.lstr.filename = yyvsp[-1].lstr.filename;
  1665. yyval.lstr.lineno = yyvsp[-1].lstr.lineno;
  1666. }
  1667. else if (yyvsp[0].lstr.filename)
  1668. {
  1669. yyval.lstr.filename = yyvsp[0].lstr.filename;
  1670. yyval.lstr.lineno = yyvsp[0].lstr.lineno;
  1671. }
  1672. ;
  1673. break;}
  1674. case 40:
  1675. #line 452 "gram.yy"
  1676. {
  1677. yyval.lstr.str = new char[GDIGITS + 1];
  1678. sprintf(yyval.lstr.str, "%g", yyvsp[0].x);
  1679. yyval.lstr.filename = 0;
  1680. yyval.lstr.lineno = 0;
  1681. ;
  1682. break;}
  1683. case 41:
  1684. #line 459 "gram.yy"
  1685. { yyval.lstr = yyvsp[0].lstr; ;
  1686. break;}
  1687. case 42:
  1688. #line 461 "gram.yy"
  1689. {
  1690. yyval.lstr.str = new char[GDIGITS + 2 + GDIGITS + 1];
  1691. sprintf(yyval.lstr.str, "%g, %g", yyvsp[0].pair.x, yyvsp[0].pair.y);
  1692. yyval.lstr.filename = 0;
  1693. yyval.lstr.lineno = 0;
  1694. ;
  1695. break;}
  1696. case 43:
  1697. #line 470 "gram.yy"
  1698. { delim_flag = 1; ;
  1699. break;}
  1700. case 44:
  1701. #line 472 "gram.yy"
  1702. { delim_flag = 0; yyval.if_data.x = yyvsp[-3].x; yyval.if_data.body = yyvsp[0].str; ;
  1703. break;}
  1704. case 45:
  1705. #line 477 "gram.yy"
  1706. { yyval.str = 0; ;
  1707. break;}
  1708. case 46:
  1709. #line 479 "gram.yy"
  1710. { yyval.str = yyvsp[0].lstr.str; ;
  1711. break;}
  1712. case 47:
  1713. #line 484 "gram.yy"
  1714. { yyval.x = yyvsp[0].x; ;
  1715. break;}
  1716. case 48:
  1717. #line 486 "gram.yy"
  1718. { yyval.x = yyvsp[0].x; ;
  1719. break;}
  1720. case 49:
  1721. #line 491 "gram.yy"
  1722. {
  1723. yyval.x = strcmp(yyvsp[-2].lstr.str, yyvsp[0].lstr.str) == 0;
  1724. a_delete yyvsp[-2].lstr.str;
  1725. a_delete yyvsp[0].lstr.str;
  1726. ;
  1727. break;}
  1728. case 50:
  1729. #line 497 "gram.yy"
  1730. {
  1731. yyval.x = strcmp(yyvsp[-2].lstr.str, yyvsp[0].lstr.str) != 0;
  1732. a_delete yyvsp[-2].lstr.str;
  1733. a_delete yyvsp[0].lstr.str;
  1734. ;
  1735. break;}
  1736. case 51:
  1737. #line 503 "gram.yy"
  1738. { yyval.x = (yyvsp[-2].x != 0.0 && yyvsp[0].x != 0.0); ;
  1739. break;}
  1740. case 52:
  1741. #line 505 "gram.yy"
  1742. { yyval.x = (yyvsp[-2].x != 0.0 && yyvsp[0].x != 0.0); ;
  1743. break;}
  1744. case 53:
  1745. #line 507 "gram.yy"
  1746. { yyval.x = (yyvsp[-2].x != 0.0 && yyvsp[0].x != 0.0); ;
  1747. break;}
  1748. case 54:
  1749. #line 509 "gram.yy"
  1750. { yyval.x = (yyvsp[-2].x != 0.0 || yyvsp[0].x != 0.0); ;
  1751. break;}
  1752. case 55:
  1753. #line 511 "gram.yy"
  1754. { yyval.x = (yyvsp[-2].x != 0.0 || yyvsp[0].x != 0.0); ;
  1755. break;}
  1756. case 56:
  1757. #line 513 "gram.yy"
  1758. { yyval.x = (yyvsp[-2].x != 0.0 || yyvsp[0].x != 0.0); ;
  1759. break;}
  1760. case 57:
  1761. #line 515 "gram.yy"
  1762. { yyval.x = (yyvsp[0].x == 0.0); ;
  1763. break;}
  1764. case 58:
  1765. #line 521 "gram.yy"
  1766. { yyval.by.val = 1.0; yyval.by.is_multiplicative = 0; ;
  1767. break;}
  1768. case 59:
  1769. #line 523 "gram.yy"
  1770. { yyval.by.val = yyvsp[0].x; yyval.by.is_multiplicative = 0; ;
  1771. break;}
  1772. case 60:
  1773. #line 525 "gram.yy"
  1774. { yyval.by.val = yyvsp[0].x; yyval.by.is_multiplicative = 1; ;
  1775. break;}
  1776. case 61:
  1777. #line 530 "gram.yy"
  1778. {
  1779. yyval.pl.obj = yyvsp[0].spec->make_object(&current_position,
  1780. &current_direction);
  1781. if (yyval.pl.obj == 0)
  1782. YYABORT;
  1783. delete yyvsp[0].spec;
  1784. if (yyval.pl.obj)
  1785. olist.append(yyval.pl.obj);
  1786. else
  1787. {
  1788. yyval.pl.x = current_position.x;
  1789. yyval.pl.y = current_position.y;
  1790. }
  1791. ;
  1792. break;}
  1793. case 62:
  1794. #line 545 "gram.yy"
  1795. { yyval.pl = yyvsp[0].pl; define_label(yyvsp[-3].str, & yyval.pl); a_delete yyvsp[-3].str; ;
  1796. break;}
  1797. case 63:
  1798. #line 547 "gram.yy"
  1799. {
  1800. yyval.pl.obj = 0;
  1801. yyval.pl.x = yyvsp[0].pair.x;
  1802. yyval.pl.y = yyvsp[0].pair.y;
  1803. define_label(yyvsp[-3].str, & yyval.pl);
  1804. a_delete yyvsp[-3].str;
  1805. ;
  1806. break;}
  1807. case 64:
  1808. #line 555 "gram.yy"
  1809. {
  1810. yyval.pl = yyvsp[0].pl;
  1811. define_label(yyvsp[-3].str, & yyval.pl);
  1812. a_delete yyvsp[-3].str;
  1813. ;
  1814. break;}
  1815. case 65:
  1816. #line 561 "gram.yy"
  1817. {
  1818. yyval.state.x = current_position.x;
  1819. yyval.state.y = current_position.y;
  1820. yyval.state.dir = current_direction;
  1821. ;
  1822. break;}
  1823. case 66:
  1824. #line 567 "gram.yy"
  1825. {
  1826. current_position.x = yyvsp[-2].state.x;
  1827. current_position.y = yyvsp[-2].state.y;
  1828. current_direction = yyvsp[-2].state.dir;
  1829. ;
  1830. break;}
  1831. case 67:
  1832. #line 573 "gram.yy"
  1833. {
  1834. yyval.pl = yyvsp[-3].pl;
  1835. ;
  1836. break;}
  1837. case 68:
  1838. #line 577 "gram.yy"
  1839. {
  1840. yyval.pl.obj = 0;
  1841. yyval.pl.x = current_position.x;
  1842. yyval.pl.y = current_position.y;
  1843. ;
  1844. break;}
  1845. case 69:
  1846. #line 586 "gram.yy"
  1847. {;
  1848. break;}
  1849. case 70:
  1850. #line 588 "gram.yy"
  1851. {;
  1852. break;}
  1853. case 71:
  1854. #line 593 "gram.yy"
  1855. {
  1856. yyval.spec = new object_spec(BOX_OBJECT);
  1857. ;
  1858. break;}
  1859. case 72:
  1860. #line 597 "gram.yy"
  1861. {
  1862. yyval.spec = new object_spec(CIRCLE_OBJECT);
  1863. ;
  1864. break;}
  1865. case 73:
  1866. #line 601 "gram.yy"
  1867. {
  1868. yyval.spec = new object_spec(ELLIPSE_OBJECT);
  1869. ;
  1870. break;}
  1871. case 74:
  1872. #line 605 "gram.yy"
  1873. {
  1874. yyval.spec = new object_spec(ARC_OBJECT);
  1875. yyval.spec->dir = current_direction;
  1876. ;
  1877. break;}
  1878. case 75:
  1879. #line 610 "gram.yy"
  1880. {
  1881. yyval.spec = new object_spec(LINE_OBJECT);
  1882. lookup_variable("lineht", & yyval.spec->segment_height);
  1883. lookup_variable("linewid", & yyval.spec->segment_width);
  1884. yyval.spec->dir = current_direction;
  1885. ;
  1886. break;}
  1887. case 76:
  1888. #line 617 "gram.yy"
  1889. {
  1890. yyval.spec = new object_spec(ARROW_OBJECT);
  1891. lookup_variable("lineht", & yyval.spec->segment_height);
  1892. lookup_variable("linewid", & yyval.spec->segment_width);
  1893. yyval.spec->dir = current_direction;
  1894. ;
  1895. break;}
  1896. case 77:
  1897. #line 624 "gram.yy"
  1898. {
  1899. yyval.spec = new object_spec(MOVE_OBJECT);
  1900. lookup_variable("moveht", & yyval.spec->segment_height);
  1901. lookup_variable("movewid", & yyval.spec->segment_width);
  1902. yyval.spec->dir = current_direction;
  1903. ;
  1904. break;}
  1905. case 78:
  1906. #line 631 "gram.yy"
  1907. {
  1908. yyval.spec = new object_spec(SPLINE_OBJECT);
  1909. lookup_variable("lineht", & yyval.spec->segment_height);
  1910. lookup_variable("linewid", & yyval.spec->segment_width);
  1911. yyval.spec->dir = current_direction;
  1912. ;
  1913. break;}
  1914. case 79:
  1915. #line 638 "gram.yy"
  1916. {
  1917. yyval.spec = new object_spec(TEXT_OBJECT);
  1918. yyval.spec->text = new text_item(yyvsp[0].lstr.str, yyvsp[0].lstr.filename, yyvsp[0].lstr.lineno);
  1919. ;
  1920. break;}
  1921. case 80:
  1922. #line 643 "gram.yy"
  1923. {
  1924. yyval.spec = new object_spec(TEXT_OBJECT);
  1925. yyval.spec->text = new text_item(format_number(0, yyvsp[0].x), 0, -1);
  1926. ;
  1927. break;}
  1928. case 81:
  1929. #line 648 "gram.yy"
  1930. {
  1931. yyval.spec = new object_spec(TEXT_OBJECT);
  1932. yyval.spec->text = new text_item(format_number(yyvsp[0].lstr.str, yyvsp[-1].x),
  1933. yyvsp[0].lstr.filename, yyvsp[0].lstr.lineno);
  1934. a_delete yyvsp[0].lstr.str;
  1935. ;
  1936. break;}
  1937. case 82:
  1938. #line 655 "gram.yy"
  1939. {
  1940. saved_state *p = new saved_state;
  1941. yyval.pstate = p;
  1942. p->x = current_position.x;
  1943. p->y = current_position.y;
  1944. p->dir = current_direction;
  1945. p->tbl = current_table;
  1946. p->prev = current_saved_state;
  1947. current_position.x = 0.0;
  1948. current_position.y = 0.0;
  1949. current_table = new PTABLE(place);
  1950. current_saved_state = p;
  1951. olist.append(make_mark_object());
  1952. ;
  1953. break;}
  1954. case 83:
  1955. #line 670 "gram.yy"
  1956. {
  1957. current_position.x = yyvsp[-2].pstate->x;
  1958. current_position.y = yyvsp[-2].pstate->y;
  1959. current_direction = yyvsp[-2].pstate->dir;
  1960. yyval.spec = new object_spec(BLOCK_OBJECT);
  1961. olist.wrap_up_block(& yyval.spec->oblist);
  1962. yyval.spec->tbl = current_table;
  1963. current_table = yyvsp[-2].pstate->tbl;
  1964. current_saved_state = yyvsp[-2].pstate->prev;
  1965. delete yyvsp[-2].pstate;
  1966. ;
  1967. break;}
  1968. case 84:
  1969. #line 682 "gram.yy"
  1970. {
  1971. yyval.spec = yyvsp[-2].spec;
  1972. yyval.spec->height = yyvsp[0].x;
  1973. yyval.spec->flags |= HAS_HEIGHT;
  1974. ;
  1975. break;}
  1976. case 85:
  1977. #line 688 "gram.yy"
  1978. {
  1979. yyval.spec = yyvsp[-2].spec;
  1980. yyval.spec->radius = yyvsp[0].x;
  1981. yyval.spec->flags |= HAS_RADIUS;
  1982. ;
  1983. break;}
  1984. case 86:
  1985. #line 694 "gram.yy"
  1986. {
  1987. yyval.spec = yyvsp[-2].spec;
  1988. yyval.spec->width = yyvsp[0].x;
  1989. yyval.spec->flags |= HAS_WIDTH;
  1990. ;
  1991. break;}
  1992. case 87:
  1993. #line 700 "gram.yy"
  1994. {
  1995. yyval.spec = yyvsp[-2].spec;
  1996. yyval.spec->radius = yyvsp[0].x/2.0;
  1997. yyval.spec->flags |= HAS_RADIUS;
  1998. ;
  1999. break;}
  2000. case 88:
  2001. #line 706 "gram.yy"
  2002. {
  2003. yyval.spec = yyvsp[-1].spec;
  2004. yyval.spec->flags |= HAS_SEGMENT;
  2005. switch (yyval.spec->dir)
  2006. {
  2007. case UP_DIRECTION:
  2008. yyval.spec->segment_pos.y += yyvsp[0].x;
  2009. break;
  2010. case DOWN_DIRECTION:
  2011. yyval.spec->segment_pos.y -= yyvsp[0].x;
  2012. break;
  2013. case RIGHT_DIRECTION:
  2014. yyval.spec->segment_pos.x += yyvsp[0].x;
  2015. break;
  2016. case LEFT_DIRECTION:
  2017. yyval.spec->segment_pos.x -= yyvsp[0].x;
  2018. break;
  2019. }
  2020. ;
  2021. break;}
  2022. case 89:
  2023. #line 726 "gram.yy"
  2024. {
  2025. yyval.spec = yyvsp[-1].spec;
  2026. yyval.spec->dir = UP_DIRECTION;
  2027. yyval.spec->flags |= HAS_SEGMENT;
  2028. yyval.spec->segment_pos.y += yyval.spec->segment_height;
  2029. ;
  2030. break;}
  2031. case 90:
  2032. #line 733 "gram.yy"
  2033. {
  2034. yyval.spec = yyvsp[-2].spec;
  2035. yyval.spec->dir = UP_DIRECTION;
  2036. yyval.spec->flags |= HAS_SEGMENT;
  2037. yyval.spec->segment_pos.y += yyvsp[0].x;
  2038. ;
  2039. break;}
  2040. case 91:
  2041. #line 740 "gram.yy"
  2042. {
  2043. yyval.spec = yyvsp[-1].spec;
  2044. yyval.spec->dir = DOWN_DIRECTION;
  2045. yyval.spec->flags |= HAS_SEGMENT;
  2046. yyval.spec->segment_pos.y -= yyval.spec->segment_height;
  2047. ;
  2048. break;}
  2049. case 92:
  2050. #line 747 "gram.yy"
  2051. {
  2052. yyval.spec = yyvsp[-2].spec;
  2053. yyval.spec->dir = DOWN_DIRECTION;
  2054. yyval.spec->flags |= HAS_SEGMENT;
  2055. yyval.spec->segment_pos.y -= yyvsp[0].x;
  2056. ;
  2057. break;}
  2058. case 93:
  2059. #line 754 "gram.yy"
  2060. {
  2061. yyval.spec = yyvsp[-1].spec;
  2062. yyval.spec->dir = RIGHT_DIRECTION;
  2063. yyval.spec->flags |= HAS_SEGMENT;
  2064. yyval.spec->segment_pos.x += yyval.spec->segment_width;
  2065. ;
  2066. break;}
  2067. case 94:
  2068. #line 761 "gram.yy"
  2069. {
  2070. yyval.spec = yyvsp[-2].spec;
  2071. yyval.spec->dir = RIGHT_DIRECTION;
  2072. yyval.spec->flags |= HAS_SEGMENT;
  2073. yyval.spec->segment_pos.x += yyvsp[0].x;
  2074. ;
  2075. break;}
  2076. case 95:
  2077. #line 768 "gram.yy"
  2078. {
  2079. yyval.spec = yyvsp[-1].spec;
  2080. yyval.spec->dir = LEFT_DIRECTION;
  2081. yyval.spec->flags |= HAS_SEGMENT;
  2082. yyval.spec->segment_pos.x -= yyval.spec->segment_width;
  2083. ;
  2084. break;}
  2085. case 96:
  2086. #line 775 "gram.yy"
  2087. {
  2088. yyval.spec = yyvsp[-2].spec;
  2089. yyval.spec->dir = LEFT_DIRECTION;
  2090. yyval.spec->flags |= HAS_SEGMENT;
  2091. yyval.spec->segment_pos.x -= yyvsp[0].x;
  2092. ;
  2093. break;}
  2094. case 97:
  2095. #line 782 "gram.yy"
  2096. {
  2097. yyval.spec = yyvsp[-2].spec;
  2098. yyval.spec->flags |= HAS_FROM;
  2099. yyval.spec->from.x = yyvsp[0].pair.x;
  2100. yyval.spec->from.y = yyvsp[0].pair.y;
  2101. ;
  2102. break;}
  2103. case 98:
  2104. #line 789 "gram.yy"
  2105. {
  2106. yyval.spec = yyvsp[-2].spec;
  2107. if (yyval.spec->flags & HAS_SEGMENT)
  2108. yyval.spec->segment_list = new segment(yyval.spec->segment_pos,
  2109. yyval.spec->segment_is_absolute,
  2110. yyval.spec->segment_list);
  2111. yyval.spec->flags |= HAS_SEGMENT;
  2112. yyval.spec->segment_pos.x = yyvsp[0].pair.x;
  2113. yyval.spec->segment_pos.y = yyvsp[0].pair.y;
  2114. yyval.spec->segment_is_absolute = 1;
  2115. yyval.spec->flags |= HAS_TO;
  2116. yyval.spec->to.x = yyvsp[0].pair.x;
  2117. yyval.spec->to.y = yyvsp[0].pair.y;
  2118. ;
  2119. break;}
  2120. case 99:
  2121. #line 804 "gram.yy"
  2122. {
  2123. yyval.spec = yyvsp[-2].spec;
  2124. yyval.spec->flags |= HAS_AT;
  2125. yyval.spec->at.x = yyvsp[0].pair.x;
  2126. yyval.spec->at.y = yyvsp[0].pair.y;
  2127. if (yyval.spec->type != ARC_OBJECT)
  2128. {
  2129. yyval.spec->flags |= HAS_FROM;
  2130. yyval.spec->from.x = yyvsp[0].pair.x;
  2131. yyval.spec->from.y = yyvsp[0].pair.y;
  2132. }
  2133. ;
  2134. break;}
  2135. case 100:
  2136. #line 817 "gram.yy"
  2137. {
  2138. yyval.spec = yyvsp[-2].spec;
  2139. yyval.spec->flags |= HAS_WITH;
  2140. yyval.spec->with = yyvsp[0].pth;
  2141. ;
  2142. break;}
  2143. case 101:
  2144. #line 823 "gram.yy"
  2145. {
  2146. yyval.spec = yyvsp[-2].spec;
  2147. yyval.spec->flags |= HAS_SEGMENT;
  2148. yyval.spec->segment_pos.x += yyvsp[0].pair.x;
  2149. yyval.spec->segment_pos.y += yyvsp[0].pair.y;
  2150. ;
  2151. break;}
  2152. case 102:
  2153. #line 830 "gram.yy"
  2154. {
  2155. yyval.spec = yyvsp[-1].spec;
  2156. if (yyval.spec->flags & HAS_SEGMENT)
  2157. {
  2158. yyval.spec->segment_list = new segment(yyval.spec->segment_pos,
  2159. yyval.spec->segment_is_absolute,
  2160. yyval.spec->segment_list);
  2161. yyval.spec->flags &= ~HAS_SEGMENT;
  2162. yyval.spec->segment_pos.x = yyval.spec->segment_pos.y = 0.0;
  2163. yyval.spec->segment_is_absolute = 0;
  2164. }
  2165. ;
  2166. break;}
  2167. case 103:
  2168. #line 843 "gram.yy"
  2169. {
  2170. yyval.spec = yyvsp[-1].spec;
  2171. yyval.spec->flags |= IS_DOTTED;
  2172. lookup_variable("dashwid", & yyval.spec->dash_width);
  2173. ;
  2174. break;}
  2175. case 104:
  2176. #line 849 "gram.yy"
  2177. {
  2178. yyval.spec = yyvsp[-2].spec;
  2179. yyval.spec->flags |= IS_DOTTED;
  2180. yyval.spec->dash_width = yyvsp[0].x;
  2181. ;
  2182. break;}
  2183. case 105:
  2184. #line 855 "gram.yy"
  2185. {
  2186. yyval.spec = yyvsp[-1].spec;
  2187. yyval.spec->flags |= IS_DASHED;
  2188. lookup_variable("dashwid", & yyval.spec->dash_width);
  2189. ;
  2190. break;}
  2191. case 106:
  2192. #line 861 "gram.yy"
  2193. {
  2194. yyval.spec = yyvsp[-2].spec;
  2195. yyval.spec->flags |= IS_DASHED;
  2196. yyval.spec->dash_width = yyvsp[0].x;
  2197. ;
  2198. break;}
  2199. case 107:
  2200. #line 867 "gram.yy"
  2201. {
  2202. yyval.spec = yyvsp[-1].spec;
  2203. yyval.spec->flags |= IS_DEFAULT_FILLED;
  2204. ;
  2205. break;}
  2206. case 108:
  2207. #line 872 "gram.yy"
  2208. {
  2209. yyval.spec = yyvsp[-2].spec;
  2210. yyval.spec->flags |= IS_FILLED;
  2211. yyval.spec->fill = yyvsp[0].x;
  2212. ;
  2213. break;}
  2214. case 109:
  2215. #line 878 "gram.yy"
  2216. {
  2217. yyval.spec = yyvsp[-1].spec;
  2218. // line chop chop means line chop 0 chop 0
  2219. if (yyval.spec->flags & IS_DEFAULT_CHOPPED)
  2220. {
  2221. yyval.spec->flags |= IS_CHOPPED;
  2222. yyval.spec->flags &= ~IS_DEFAULT_CHOPPED;
  2223. yyval.spec->start_chop = yyval.spec->end_chop = 0.0;
  2224. }
  2225. else if (yyval.spec->flags & IS_CHOPPED)
  2226. {
  2227. yyval.spec->end_chop = 0.0;
  2228. }
  2229. else
  2230. {
  2231. yyval.spec->flags |= IS_DEFAULT_CHOPPED;
  2232. }
  2233. ;
  2234. break;}
  2235. case 110:
  2236. #line 897 "gram.yy"
  2237. {
  2238. yyval.spec = yyvsp[-2].spec;
  2239. if (yyval.spec->flags & IS_DEFAULT_CHOPPED)
  2240. {
  2241. yyval.spec->flags |= IS_CHOPPED;
  2242. yyval.spec->flags &= ~IS_DEFAULT_CHOPPED;
  2243. yyval.spec->start_chop = 0.0;
  2244. yyval.spec->end_chop = yyvsp[0].x;
  2245. }
  2246. else if (yyval.spec->flags & IS_CHOPPED)
  2247. {
  2248. yyval.spec->end_chop = yyvsp[0].x;
  2249. }
  2250. else
  2251. {
  2252. yyval.spec->start_chop = yyval.spec->end_chop = yyvsp[0].x;
  2253. yyval.spec->flags |= IS_CHOPPED;
  2254. }
  2255. ;
  2256. break;}
  2257. case 111:
  2258. #line 917 "gram.yy"
  2259. {
  2260. yyval.spec = yyvsp[-1].spec;
  2261. yyval.spec->flags |= IS_SAME;
  2262. ;
  2263. break;}
  2264. case 112:
  2265. #line 922 "gram.yy"
  2266. {
  2267. yyval.spec = yyvsp[-1].spec;
  2268. yyval.spec->flags |= IS_INVISIBLE;
  2269. ;
  2270. break;}
  2271. case 113:
  2272. #line 927 "gram.yy"
  2273. {
  2274. yyval.spec = yyvsp[-1].spec;
  2275. yyval.spec->flags |= HAS_LEFT_ARROW_HEAD;
  2276. ;
  2277. break;}
  2278. case 114:
  2279. #line 932 "gram.yy"
  2280. {
  2281. yyval.spec = yyvsp[-1].spec;
  2282. yyval.spec->flags |= HAS_RIGHT_ARROW_HEAD;
  2283. ;
  2284. break;}
  2285. case 115:
  2286. #line 937 "gram.yy"
  2287. {
  2288. yyval.spec = yyvsp[-1].spec;
  2289. yyval.spec->flags |= (HAS_LEFT_ARROW_HEAD|HAS_RIGHT_ARROW_HEAD);
  2290. ;
  2291. break;}
  2292. case 116:
  2293. #line 942 "gram.yy"
  2294. {
  2295. yyval.spec = yyvsp[-1].spec;
  2296. yyval.spec->flags |= IS_CLOCKWISE;
  2297. ;
  2298. break;}
  2299. case 117:
  2300. #line 947 "gram.yy"
  2301. {
  2302. yyval.spec = yyvsp[-1].spec;
  2303. yyval.spec->flags &= ~IS_CLOCKWISE;
  2304. ;
  2305. break;}
  2306. case 118:
  2307. #line 952 "gram.yy"
  2308. {
  2309. yyval.spec = yyvsp[-1].spec;
  2310. text_item **p;
  2311. for (p = & yyval.spec->text; *p; p = &(*p)->next)
  2312. ;
  2313. *p = new text_item(yyvsp[0].lstr.str, yyvsp[0].lstr.filename, yyvsp[0].lstr.lineno);
  2314. ;
  2315. break;}
  2316. case 119:
  2317. #line 960 "gram.yy"
  2318. {
  2319. yyval.spec = yyvsp[-1].spec;
  2320. if (yyval.spec->text)
  2321. {
  2322. text_item *p;
  2323. for (p = yyval.spec->text; p->next; p = p->next)
  2324. ;
  2325. p->adj.h = LEFT_ADJUST;
  2326. }
  2327. ;
  2328. break;}
  2329. case 120:
  2330. #line 971 "gram.yy"
  2331. {
  2332. yyval.spec = yyvsp[-1].spec;
  2333. if (yyval.spec->text)
  2334. {
  2335. text_item *p;
  2336. for (p = yyval.spec->text; p->next; p = p->next)
  2337. ;
  2338. p->adj.h = RIGHT_ADJUST;
  2339. }
  2340. ;
  2341. break;}
  2342. case 121:
  2343. #line 982 "gram.yy"
  2344. {
  2345. yyval.spec = yyvsp[-1].spec;
  2346. if (yyval.spec->text)
  2347. {
  2348. text_item *p;
  2349. for (p = yyval.spec->text; p->next; p = p->next)
  2350. ;
  2351. p->adj.v = ABOVE_ADJUST;
  2352. }
  2353. ;
  2354. break;}
  2355. case 122:
  2356. #line 993 "gram.yy"
  2357. {
  2358. yyval.spec = yyvsp[-1].spec;
  2359. if (yyval.spec->text)
  2360. {
  2361. text_item *p;
  2362. for (p = yyval.spec->text; p->next; p = p->next)
  2363. ;
  2364. p->adj.v = BELOW_ADJUST;
  2365. }
  2366. ;
  2367. break;}
  2368. case 123:
  2369. #line 1004 "gram.yy"
  2370. {
  2371. yyval.spec = yyvsp[-2].spec;
  2372. yyval.spec->flags |= HAS_THICKNESS;
  2373. yyval.spec->thickness = yyvsp[0].x;
  2374. ;
  2375. break;}
  2376. case 124:
  2377. #line 1010 "gram.yy"
  2378. {
  2379. yyval.spec = yyvsp[-1].spec;
  2380. yyval.spec->flags |= IS_ALIGNED;
  2381. ;
  2382. break;}
  2383. case 125:
  2384. #line 1018 "gram.yy"
  2385. {
  2386. yyval.lstr = yyvsp[0].lstr;
  2387. ;
  2388. break;}
  2389. case 126:
  2390. #line 1022 "gram.yy"
  2391. {
  2392. yyval.lstr.filename = yyvsp[-2].lstr.filename;
  2393. yyval.lstr.lineno = yyvsp[-2].lstr.lineno;
  2394. yyval.lstr.str = do_sprintf(yyvsp[-2].lstr.str, yyvsp[-1].dv.v, yyvsp[-1].dv.nv);
  2395. a_delete yyvsp[-1].dv.v;
  2396. a_delete yyvsp[-2].lstr.str;
  2397. ;
  2398. break;}
  2399. case 127:
  2400. #line 1033 "gram.yy"
  2401. {
  2402. yyval.dv.v = 0;
  2403. yyval.dv.nv = 0;
  2404. yyval.dv.maxv = 0;
  2405. ;
  2406. break;}
  2407. case 128:
  2408. #line 1039 "gram.yy"
  2409. {
  2410. yyval.dv = yyvsp[-2].dv;
  2411. if (yyval.dv.nv >= yyval.dv.maxv)
  2412. {
  2413. if (yyval.dv.nv == 0)
  2414. {
  2415. yyval.dv.v = new double[4];
  2416. yyval.dv.maxv = 4;
  2417. }
  2418. else
  2419. {
  2420. double *oldv = yyval.dv.v;
  2421. yyval.dv.maxv *= 2;
  2422. yyval.dv.v = new double[yyval.dv.maxv];
  2423. memcpy(yyval.dv.v, oldv, yyval.dv.nv*sizeof(double));
  2424. a_delete oldv;
  2425. }
  2426. }
  2427. yyval.dv.v[yyval.dv.nv] = yyvsp[0].x;
  2428. yyval.dv.nv += 1;
  2429. ;
  2430. break;}
  2431. case 129:
  2432. #line 1064 "gram.yy"
  2433. { yyval.pair = yyvsp[0].pair; ;
  2434. break;}
  2435. case 130:
  2436. #line 1066 "gram.yy"
  2437. {
  2438. position pos = yyvsp[0].pl;
  2439. yyval.pair.x = pos.x;
  2440. yyval.pair.y = pos.y;
  2441. ;
  2442. break;}
  2443. case 131:
  2444. #line 1075 "gram.yy"
  2445. { yyval.pair = yyvsp[0].pair; ;
  2446. break;}
  2447. case 132:
  2448. #line 1077 "gram.yy"
  2449. {
  2450. yyval.pair.x = yyvsp[-2].pair.x + yyvsp[0].pair.x;
  2451. yyval.pair.y = yyvsp[-2].pair.y + yyvsp[0].pair.y;
  2452. ;
  2453. break;}
  2454. case 133:
  2455. #line 1082 "gram.yy"
  2456. {
  2457. yyval.pair.x = yyvsp[-2].pair.x - yyvsp[0].pair.x;
  2458. yyval.pair.y = yyvsp[-2].pair.y - yyvsp[0].pair.y;
  2459. ;
  2460. break;}
  2461. case 134:
  2462. #line 1087 "gram.yy"
  2463. {
  2464. yyval.pair.x = yyvsp[-3].pair.x;
  2465. yyval.pair.y = yyvsp[-1].pair.y;
  2466. ;
  2467. break;}
  2468. case 135:
  2469. #line 1092 "gram.yy"
  2470. {
  2471. yyval.pair.x = (1.0 - yyvsp[-4].x)*yyvsp[-2].pair.x + yyvsp[-4].x*yyvsp[0].pair.x;
  2472. yyval.pair.y = (1.0 - yyvsp[-4].x)*yyvsp[-2].pair.y + yyvsp[-4].x*yyvsp[0].pair.y;
  2473. ;
  2474. break;}
  2475. case 136:
  2476. #line 1097 "gram.yy"
  2477. {
  2478. yyval.pair.x = (1.0 - yyvsp[-5].x)*yyvsp[-3].pair.x + yyvsp[-5].x*yyvsp[-1].pair.x;
  2479. yyval.pair.y = (1.0 - yyvsp[-5].x)*yyvsp[-3].pair.y + yyvsp[-5].x*yyvsp[-1].pair.y;
  2480. ;
  2481. break;}
  2482. case 139:
  2483. #line 1110 "gram.yy"
  2484. { yyval.pair.x = yyvsp[-2].x; yyval.pair.y = yyvsp[0].x; ;
  2485. break;}
  2486. case 140:
  2487. #line 1112 "gram.yy"
  2488. { yyval.pair = yyvsp[-1].pair; ;
  2489. break;}
  2490. case 141:
  2491. #line 1117 "gram.yy"
  2492. { yyval.pl = yyvsp[0].pl; ;
  2493. break;}
  2494. case 142:
  2495. #line 1119 "gram.yy"
  2496. {
  2497. path pth(yyvsp[0].crn);
  2498. if (!pth.follow(yyvsp[-1].pl, & yyval.pl))
  2499. YYABORT;
  2500. ;
  2501. break;}
  2502. case 143:
  2503. #line 1125 "gram.yy"
  2504. {
  2505. path pth(yyvsp[-1].crn);
  2506. if (!pth.follow(yyvsp[0].pl, & yyval.pl))
  2507. YYABORT;
  2508. ;
  2509. break;}
  2510. case 144:
  2511. #line 1131 "gram.yy"
  2512. {
  2513. path pth(yyvsp[-2].crn);
  2514. if (!pth.follow(yyvsp[0].pl, & yyval.pl))
  2515. YYABORT;
  2516. ;
  2517. break;}
  2518. case 145:
  2519. #line 1137 "gram.yy"
  2520. {
  2521. yyval.pl.x = current_position.x;
  2522. yyval.pl.y = current_position.y;
  2523. yyval.pl.obj = 0;
  2524. ;
  2525. break;}
  2526. case 146:
  2527. #line 1146 "gram.yy"
  2528. {
  2529. place *p = lookup_label(yyvsp[0].str);
  2530. if (!p)
  2531. {
  2532. lex_error("there is no place `%1'", yyvsp[0].str);
  2533. YYABORT;
  2534. }
  2535. yyval.pl = *p;
  2536. a_delete yyvsp[0].str;
  2537. ;
  2538. break;}
  2539. case 147:
  2540. #line 1157 "gram.yy"
  2541. {
  2542. yyval.pl.obj = yyvsp[0].obj;
  2543. ;
  2544. break;}
  2545. case 148:
  2546. #line 1161 "gram.yy"
  2547. {
  2548. path pth(yyvsp[0].str);
  2549. if (!pth.follow(yyvsp[-2].pl, & yyval.pl))
  2550. YYABORT;
  2551. ;
  2552. break;}
  2553. case 149:
  2554. #line 1170 "gram.yy"
  2555. { yyval.n = yyvsp[0].n; ;
  2556. break;}
  2557. case 150:
  2558. #line 1172 "gram.yy"
  2559. {
  2560. // XXX Check for overflow (and non-integers?).
  2561. yyval.n = (int)yyvsp[-1].x;
  2562. ;
  2563. break;}
  2564. case 151:
  2565. #line 1180 "gram.yy"
  2566. { yyval.n = 1; ;
  2567. break;}
  2568. case 152:
  2569. #line 1182 "gram.yy"
  2570. { yyval.n = yyvsp[-1].n; ;
  2571. break;}
  2572. case 153:
  2573. #line 1187 "gram.yy"
  2574. {
  2575. int count = 0;
  2576. object *p;
  2577. for (p = olist.head; p != 0; p = p->next)
  2578. if (p->type() == yyvsp[0].obtype && ++count == yyvsp[-1].n)
  2579. {
  2580. yyval.obj = p;
  2581. break;
  2582. }
  2583. if (p == 0)
  2584. {
  2585. lex_error("there is no %1%2 %3", yyvsp[-1].n, ordinal_postfix(yyvsp[-1].n),
  2586. object_type_name(yyvsp[0].obtype));
  2587. YYABORT;
  2588. }
  2589. ;
  2590. break;}
  2591. case 154:
  2592. #line 1204 "gram.yy"
  2593. {
  2594. int count = 0;
  2595. object *p;
  2596. for (p = olist.tail; p != 0; p = p->prev)
  2597. if (p->type() == yyvsp[0].obtype && ++count == yyvsp[-1].n)
  2598. {
  2599. yyval.obj = p;
  2600. break;
  2601. }
  2602. if (p == 0)
  2603. {
  2604. lex_error("there is no %1%2 last %3", yyvsp[-1].n,
  2605. ordinal_postfix(yyvsp[-1].n), object_type_name(yyvsp[0].obtype));
  2606. YYABORT;
  2607. }
  2608. ;
  2609. break;}
  2610. case 155:
  2611. #line 1224 "gram.yy"
  2612. { yyval.obtype = BOX_OBJECT; ;
  2613. break;}
  2614. case 156:
  2615. #line 1226 "gram.yy"
  2616. { yyval.obtype = CIRCLE_OBJECT; ;
  2617. break;}
  2618. case 157:
  2619. #line 1228 "gram.yy"
  2620. { yyval.obtype = ELLIPSE_OBJECT; ;
  2621. break;}
  2622. case 158:
  2623. #line 1230 "gram.yy"
  2624. { yyval.obtype = ARC_OBJECT; ;
  2625. break;}
  2626. case 159:
  2627. #line 1232 "gram.yy"
  2628. { yyval.obtype = LINE_OBJECT; ;
  2629. break;}
  2630. case 160:
  2631. #line 1234 "gram.yy"
  2632. { yyval.obtype = ARROW_OBJECT; ;
  2633. break;}
  2634. case 161:
  2635. #line 1236 "gram.yy"
  2636. { yyval.obtype = SPLINE_OBJECT; ;
  2637. break;}
  2638. case 162:
  2639. #line 1238 "gram.yy"
  2640. { yyval.obtype = BLOCK_OBJECT; ;
  2641. break;}
  2642. case 163:
  2643. #line 1240 "gram.yy"
  2644. { yyval.obtype = TEXT_OBJECT; ;
  2645. break;}
  2646. case 164:
  2647. #line 1245 "gram.yy"
  2648. {
  2649. yyval.pth = new path(yyvsp[0].str);
  2650. ;
  2651. break;}
  2652. case 165:
  2653. #line 1249 "gram.yy"
  2654. {
  2655. yyval.pth = yyvsp[-2].pth;
  2656. yyval.pth->append(yyvsp[0].str);
  2657. ;
  2658. break;}
  2659. case 166:
  2660. #line 1257 "gram.yy"
  2661. {
  2662. yyval.pth = new path(yyvsp[0].crn);
  2663. ;
  2664. break;}
  2665. case 167:
  2666. #line 1264 "gram.yy"
  2667. {
  2668. yyval.pth = yyvsp[0].pth;
  2669. ;
  2670. break;}
  2671. case 168:
  2672. #line 1268 "gram.yy"
  2673. {
  2674. yyval.pth = yyvsp[-1].pth;
  2675. yyval.pth->append(yyvsp[0].crn);
  2676. ;
  2677. break;}
  2678. case 169:
  2679. #line 1276 "gram.yy"
  2680. {
  2681. yyval.pth = yyvsp[0].pth;
  2682. ;
  2683. break;}
  2684. case 170:
  2685. #line 1280 "gram.yy"
  2686. {
  2687. yyval.pth = yyvsp[-3].pth;
  2688. yyval.pth->set_ypath(yyvsp[-1].pth);
  2689. ;
  2690. break;}
  2691. case 171:
  2692. #line 1286 "gram.yy"
  2693. {
  2694. lex_warning("`%1%2 last %3' in `with' argument ignored",
  2695. yyvsp[-3].n, ordinal_postfix(yyvsp[-3].n), object_type_name(yyvsp[-1].obtype));
  2696. yyval.pth = yyvsp[0].pth;
  2697. ;
  2698. break;}
  2699. case 172:
  2700. #line 1292 "gram.yy"
  2701. {
  2702. lex_warning("`last %1' in `with' argument ignored",
  2703. object_type_name(yyvsp[-1].obtype));
  2704. yyval.pth = yyvsp[0].pth;
  2705. ;
  2706. break;}
  2707. case 173:
  2708. #line 1298 "gram.yy"
  2709. {
  2710. lex_warning("`%1%2 %3' in `with' argument ignored",
  2711. yyvsp[-2].n, ordinal_postfix(yyvsp[-2].n), object_type_name(yyvsp[-1].obtype));
  2712. yyval.pth = yyvsp[0].pth;
  2713. ;
  2714. break;}
  2715. case 174:
  2716. #line 1304 "gram.yy"
  2717. {
  2718. lex_warning("initial `%1' in `with' argument ignored", yyvsp[-1].str);
  2719. a_delete yyvsp[-1].str;
  2720. yyval.pth = yyvsp[0].pth;
  2721. ;
  2722. break;}
  2723. case 175:
  2724. #line 1313 "gram.yy"
  2725. { yyval.crn = &object::north; ;
  2726. break;}
  2727. case 176:
  2728. #line 1315 "gram.yy"
  2729. { yyval.crn = &object::east; ;
  2730. break;}
  2731. case 177:
  2732. #line 1317 "gram.yy"
  2733. { yyval.crn = &object::west; ;
  2734. break;}
  2735. case 178:
  2736. #line 1319 "gram.yy"
  2737. { yyval.crn = &object::south; ;
  2738. break;}
  2739. case 179:
  2740. #line 1321 "gram.yy"
  2741. { yyval.crn = &object::north_east; ;
  2742. break;}
  2743. case 180:
  2744. #line 1323 "gram.yy"
  2745. { yyval.crn = &object:: south_east; ;
  2746. break;}
  2747. case 181:
  2748. #line 1325 "gram.yy"
  2749. { yyval.crn = &object::north_west; ;
  2750. break;}
  2751. case 182:
  2752. #line 1327 "gram.yy"
  2753. { yyval.crn = &object::south_west; ;
  2754. break;}
  2755. case 183:
  2756. #line 1329 "gram.yy"
  2757. { yyval.crn = &object::center; ;
  2758. break;}
  2759. case 184:
  2760. #line 1331 "gram.yy"
  2761. { yyval.crn = &object::start; ;
  2762. break;}
  2763. case 185:
  2764. #line 1333 "gram.yy"
  2765. { yyval.crn = &object::end; ;
  2766. break;}
  2767. case 186:
  2768. #line 1335 "gram.yy"
  2769. { yyval.crn = &object::north; ;
  2770. break;}
  2771. case 187:
  2772. #line 1337 "gram.yy"
  2773. { yyval.crn = &object::south; ;
  2774. break;}
  2775. case 188:
  2776. #line 1339 "gram.yy"
  2777. { yyval.crn = &object::west; ;
  2778. break;}
  2779. case 189:
  2780. #line 1341 "gram.yy"
  2781. { yyval.crn = &object::east; ;
  2782. break;}
  2783. case 190:
  2784. #line 1343 "gram.yy"
  2785. { yyval.crn = &object::north_west; ;
  2786. break;}
  2787. case 191:
  2788. #line 1345 "gram.yy"
  2789. { yyval.crn = &object::south_west; ;
  2790. break;}
  2791. case 192:
  2792. #line 1347 "gram.yy"
  2793. { yyval.crn = &object::north_east; ;
  2794. break;}
  2795. case 193:
  2796. #line 1349 "gram.yy"
  2797. { yyval.crn = &object::south_east; ;
  2798. break;}
  2799. case 194:
  2800. #line 1351 "gram.yy"
  2801. { yyval.crn = &object::west; ;
  2802. break;}
  2803. case 195:
  2804. #line 1353 "gram.yy"
  2805. { yyval.crn = &object::east; ;
  2806. break;}
  2807. case 196:
  2808. #line 1355 "gram.yy"
  2809. { yyval.crn = &object::north_west; ;
  2810. break;}
  2811. case 197:
  2812. #line 1357 "gram.yy"
  2813. { yyval.crn = &object::south_west; ;
  2814. break;}
  2815. case 198:
  2816. #line 1359 "gram.yy"
  2817. { yyval.crn = &object::north_east; ;
  2818. break;}
  2819. case 199:
  2820. #line 1361 "gram.yy"
  2821. { yyval.crn = &object::south_east; ;
  2822. break;}
  2823. case 200:
  2824. #line 1363 "gram.yy"
  2825. { yyval.crn = &object::center; ;
  2826. break;}
  2827. case 201:
  2828. #line 1365 "gram.yy"
  2829. { yyval.crn = &object::start; ;
  2830. break;}
  2831. case 202:
  2832. #line 1367 "gram.yy"
  2833. { yyval.crn = &object::end; ;
  2834. break;}
  2835. case 203:
  2836. #line 1372 "gram.yy"
  2837. {
  2838. if (!lookup_variable(yyvsp[0].str, & yyval.x))
  2839. {
  2840. lex_error("there is no variable `%1'", yyvsp[0].str);
  2841. YYABORT;
  2842. }
  2843. a_delete yyvsp[0].str;
  2844. ;
  2845. break;}
  2846. case 204:
  2847. #line 1381 "gram.yy"
  2848. { yyval.x = yyvsp[0].x; ;
  2849. break;}
  2850. case 205:
  2851. #line 1383 "gram.yy"
  2852. {
  2853. if (yyvsp[-1].pl.obj != 0)
  2854. yyval.x = yyvsp[-1].pl.obj->origin().x;
  2855. else
  2856. yyval.x = yyvsp[-1].pl.x;
  2857. ;
  2858. break;}
  2859. case 206:
  2860. #line 1390 "gram.yy"
  2861. {
  2862. if (yyvsp[-1].pl.obj != 0)
  2863. yyval.x = yyvsp[-1].pl.obj->origin().y;
  2864. else
  2865. yyval.x = yyvsp[-1].pl.y;
  2866. ;
  2867. break;}
  2868. case 207:
  2869. #line 1397 "gram.yy"
  2870. {
  2871. if (yyvsp[-1].pl.obj != 0)
  2872. yyval.x = yyvsp[-1].pl.obj->height();
  2873. else
  2874. yyval.x = 0.0;
  2875. ;
  2876. break;}
  2877. case 208:
  2878. #line 1404 "gram.yy"
  2879. {
  2880. if (yyvsp[-1].pl.obj != 0)
  2881. yyval.x = yyvsp[-1].pl.obj->width();
  2882. else
  2883. yyval.x = 0.0;
  2884. ;
  2885. break;}
  2886. case 209:
  2887. #line 1411 "gram.yy"
  2888. {
  2889. if (yyvsp[-1].pl.obj != 0)
  2890. yyval.x = yyvsp[-1].pl.obj->radius();
  2891. else
  2892. yyval.x = 0.0;
  2893. ;
  2894. break;}
  2895. case 210:
  2896. #line 1418 "gram.yy"
  2897. { yyval.x = yyvsp[-2].x + yyvsp[0].x; ;
  2898. break;}
  2899. case 211:
  2900. #line 1420 "gram.yy"
  2901. { yyval.x = yyvsp[-2].x - yyvsp[0].x; ;
  2902. break;}
  2903. case 212:
  2904. #line 1422 "gram.yy"
  2905. { yyval.x = yyvsp[-2].x * yyvsp[0].x; ;
  2906. break;}
  2907. case 213:
  2908. #line 1424 "gram.yy"
  2909. {
  2910. if (yyvsp[0].x == 0.0)
  2911. {
  2912. lex_error("division by zero");
  2913. YYABORT;
  2914. }
  2915. yyval.x = yyvsp[-2].x/yyvsp[0].x;
  2916. ;
  2917. break;}
  2918. case 214:
  2919. #line 1433 "gram.yy"
  2920. {
  2921. if (yyvsp[0].x == 0.0)
  2922. {
  2923. lex_error("modulus by zero");
  2924. YYABORT;
  2925. }
  2926. yyval.x = fmod(yyvsp[-2].x, yyvsp[0].x);
  2927. ;
  2928. break;}
  2929. case 215:
  2930. #line 1442 "gram.yy"
  2931. {
  2932. errno = 0;
  2933. yyval.x = pow(yyvsp[-2].x, yyvsp[0].x);
  2934. if (errno == EDOM)
  2935. {
  2936. lex_error("arguments to `^' operator out of domain");
  2937. YYABORT;
  2938. }
  2939. if (errno == ERANGE)
  2940. {
  2941. lex_error("result of `^' operator out of range");
  2942. YYABORT;
  2943. }
  2944. ;
  2945. break;}
  2946. case 216:
  2947. #line 1457 "gram.yy"
  2948. { yyval.x = -yyvsp[0].x; ;
  2949. break;}
  2950. case 217:
  2951. #line 1459 "gram.yy"
  2952. { yyval.x = yyvsp[-1].x; ;
  2953. break;}
  2954. case 218:
  2955. #line 1461 "gram.yy"
  2956. {
  2957. errno = 0;
  2958. yyval.x = sin(yyvsp[-1].x);
  2959. if (errno == ERANGE)
  2960. {
  2961. lex_error("sin result out of range");
  2962. YYABORT;
  2963. }
  2964. ;
  2965. break;}
  2966. case 219:
  2967. #line 1471 "gram.yy"
  2968. {
  2969. errno = 0;
  2970. yyval.x = cos(yyvsp[-1].x);
  2971. if (errno == ERANGE)
  2972. {
  2973. lex_error("cos result out of range");
  2974. YYABORT;
  2975. }
  2976. ;
  2977. break;}
  2978. case 220:
  2979. #line 1481 "gram.yy"
  2980. {
  2981. errno = 0;
  2982. yyval.x = atan2(yyvsp[-3].x, yyvsp[-1].x);
  2983. if (errno == EDOM)
  2984. {
  2985. lex_error("atan2 argument out of domain");
  2986. YYABORT;
  2987. }
  2988. if (errno == ERANGE)
  2989. {
  2990. lex_error("atan2 result out of range");
  2991. YYABORT;
  2992. }
  2993. ;
  2994. break;}
  2995. case 221:
  2996. #line 1496 "gram.yy"
  2997. {
  2998. errno = 0;
  2999. yyval.x = log10(yyvsp[-1].x);
  3000. if (errno == ERANGE)
  3001. {
  3002. lex_error("log result out of range");
  3003. YYABORT;
  3004. }
  3005. ;
  3006. break;}
  3007. case 222:
  3008. #line 1506 "gram.yy"
  3009. {
  3010. errno = 0;
  3011. yyval.x = pow(10.0, yyvsp[-1].x);
  3012. if (errno == ERANGE)
  3013. {
  3014. lex_error("exp result out of range");
  3015. YYABORT;
  3016. }
  3017. ;
  3018. break;}
  3019. case 223:
  3020. #line 1516 "gram.yy"
  3021. {
  3022. errno = 0;
  3023. yyval.x = sqrt(yyvsp[-1].x);
  3024. if (errno == EDOM)
  3025. {
  3026. lex_error("sqrt argument out of domain");
  3027. YYABORT;
  3028. }
  3029. ;
  3030. break;}
  3031. case 224:
  3032. #line 1526 "gram.yy"
  3033. { yyval.x = yyvsp[-3].x > yyvsp[-1].x ? yyvsp[-3].x : yyvsp[-1].x; ;
  3034. break;}
  3035. case 225:
  3036. #line 1528 "gram.yy"
  3037. { yyval.x = yyvsp[-3].x < yyvsp[-1].x ? yyvsp[-3].x : yyvsp[-1].x; ;
  3038. break;}
  3039. case 226:
  3040. #line 1530 "gram.yy"
  3041. { yyval.x = floor(yyvsp[-1].x); ;
  3042. break;}
  3043. case 227:
  3044. #line 1532 "gram.yy"
  3045. { yyval.x = 1.0 + floor(((rand()&0x7fff)/double(0x7fff))*yyvsp[-1].x); ;
  3046. break;}
  3047. case 228:
  3048. #line 1534 "gram.yy"
  3049. {
  3050. // return a random number in the range [0,1)
  3051. // portable, but not very random
  3052. yyval.x = (rand() & 0x7fff) / double(0x8000);
  3053. ;
  3054. break;}
  3055. case 229:
  3056. #line 1540 "gram.yy"
  3057. { yyval.x = 0; srand((unsigned int)yyvsp[-1].x); ;
  3058. break;}
  3059. case 230:
  3060. #line 1542 "gram.yy"
  3061. { yyval.x = (yyvsp[-2].x < yyvsp[0].x); ;
  3062. break;}
  3063. case 231:
  3064. #line 1544 "gram.yy"
  3065. { yyval.x = (yyvsp[-2].x <= yyvsp[0].x); ;
  3066. break;}
  3067. case 232:
  3068. #line 1546 "gram.yy"
  3069. { yyval.x = (yyvsp[-2].x > yyvsp[0].x); ;
  3070. break;}
  3071. case 233:
  3072. #line 1548 "gram.yy"
  3073. { yyval.x = (yyvsp[-2].x >= yyvsp[0].x); ;
  3074. break;}
  3075. case 234:
  3076. #line 1550 "gram.yy"
  3077. { yyval.x = (yyvsp[-2].x == yyvsp[0].x); ;
  3078. break;}
  3079. case 235:
  3080. #line 1552 "gram.yy"
  3081. { yyval.x = (yyvsp[-2].x != yyvsp[0].x); ;
  3082. break;}
  3083. case 236:
  3084. #line 1554 "gram.yy"
  3085. { yyval.x = (yyvsp[-2].x != 0.0 && yyvsp[0].x != 0.0); ;
  3086. break;}
  3087. case 237:
  3088. #line 1556 "gram.yy"
  3089. { yyval.x = (yyvsp[-2].x != 0.0 || yyvsp[0].x != 0.0); ;
  3090. break;}
  3091. case 238:
  3092. #line 1558 "gram.yy"
  3093. { yyval.x = (yyvsp[0].x == 0.0); ;
  3094. break;}
  3095. }
  3096. /* the action file gets copied in in place of this dollarsign */
  3097. #line 543 "/usr/local/share/bison.simple"
  3098. yyvsp -= yylen;
  3099. yyssp -= yylen;
  3100. #ifdef YYLSP_NEEDED
  3101. yylsp -= yylen;
  3102. #endif
  3103. #if YYDEBUG != 0
  3104. if (yydebug)
  3105. {
  3106. short *ssp1 = yyss - 1;
  3107. fprintf (stderr, "state stack now");
  3108. while (ssp1 != yyssp)
  3109. fprintf (stderr, " %d", *++ssp1);
  3110. fprintf (stderr, "\n");
  3111. }
  3112. #endif
  3113. *++yyvsp = yyval;
  3114. #ifdef YYLSP_NEEDED
  3115. yylsp++;
  3116. if (yylen == 0)
  3117. {
  3118. yylsp->first_line = yylloc.first_line;
  3119. yylsp->first_column = yylloc.first_column;
  3120. yylsp->last_line = (yylsp-1)->last_line;
  3121. yylsp->last_column = (yylsp-1)->last_column;
  3122. yylsp->text = 0;
  3123. }
  3124. else
  3125. {
  3126. yylsp->last_line = (yylsp+yylen-1)->last_line;
  3127. yylsp->last_column = (yylsp+yylen-1)->last_column;
  3128. }
  3129. #endif
  3130. /* Now "shift" the result of the reduction.
  3131. Determine what state that goes to,
  3132. based on the state we popped back to
  3133. and the rule number reduced by. */
  3134. yyn = yyr1[yyn];
  3135. yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  3136. if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  3137. yystate = yytable[yystate];
  3138. else
  3139. yystate = yydefgoto[yyn - YYNTBASE];
  3140. goto yynewstate;
  3141. yyerrlab: /* here on detecting error */
  3142. if (! yyerrstatus)
  3143. /* If not already recovering from an error, report this error. */
  3144. {
  3145. ++yynerrs;
  3146. #ifdef YYERROR_VERBOSE
  3147. yyn = yypact[yystate];
  3148. if (yyn > YYFLAG && yyn < YYLAST)
  3149. {
  3150. int size = 0;
  3151. char *msg;
  3152. int x, count;
  3153. count = 0;
  3154. /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
  3155. for (x = (yyn < 0 ? -yyn : 0);
  3156. x < (sizeof(yytname) / sizeof(char *)); x++)
  3157. if (yycheck[x + yyn] == x)
  3158. size += strlen(yytname[x]) + 15, count++;
  3159. msg = (char *) malloc(size + 15);
  3160. if (msg != 0)
  3161. {
  3162. strcpy(msg, "parse error");
  3163. if (count < 5)
  3164. {
  3165. count = 0;
  3166. for (x = (yyn < 0 ? -yyn : 0);
  3167. x < (sizeof(yytname) / sizeof(char *)); x++)
  3168. if (yycheck[x + yyn] == x)
  3169. {
  3170. strcat(msg, count == 0 ? ", expecting `" : " or `");
  3171. strcat(msg, yytname[x]);
  3172. strcat(msg, "'");
  3173. count++;
  3174. }
  3175. }
  3176. yyerror(msg);
  3177. free(msg);
  3178. }
  3179. else
  3180. yyerror ("parse error; also virtual memory exceeded");
  3181. }
  3182. else
  3183. #endif /* YYERROR_VERBOSE */
  3184. yyerror("parse error");
  3185. }
  3186. goto yyerrlab1;
  3187. yyerrlab1: /* here on error raised explicitly by an action */
  3188. if (yyerrstatus == 3)
  3189. {
  3190. /* if just tried and failed to reuse lookahead token after an error, discard it. */
  3191. /* return failure if at end of input */
  3192. if (yychar == YYEOF)
  3193. YYABORT;
  3194. #if YYDEBUG != 0
  3195. if (yydebug)
  3196. fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  3197. #endif
  3198. yychar = YYEMPTY;
  3199. }
  3200. /* Else will try to reuse lookahead token
  3201. after shifting the error token. */
  3202. yyerrstatus = 3; /* Each real token shifted decrements this */
  3203. goto yyerrhandle;
  3204. yyerrdefault: /* current state does not do anything special for the error token. */
  3205. #if 0
  3206. /* This is wrong; only states that explicitly want error tokens
  3207. should shift them. */
  3208. yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
  3209. if (yyn) goto yydefault;
  3210. #endif
  3211. yyerrpop: /* pop the current state because it cannot handle the error token */
  3212. if (yyssp == yyss) YYABORT;
  3213. yyvsp--;
  3214. yystate = *--yyssp;
  3215. #ifdef YYLSP_NEEDED
  3216. yylsp--;
  3217. #endif
  3218. #if YYDEBUG != 0
  3219. if (yydebug)
  3220. {
  3221. short *ssp1 = yyss - 1;
  3222. fprintf (stderr, "Error: state stack now");
  3223. while (ssp1 != yyssp)
  3224. fprintf (stderr, " %d", *++ssp1);
  3225. fprintf (stderr, "\n");
  3226. }
  3227. #endif
  3228. yyerrhandle:
  3229. yyn = yypact[yystate];
  3230. if (yyn == YYFLAG)
  3231. goto yyerrdefault;
  3232. yyn += YYTERROR;
  3233. if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  3234. goto yyerrdefault;
  3235. yyn = yytable[yyn];
  3236. if (yyn < 0)
  3237. {
  3238. if (yyn == YYFLAG)
  3239. goto yyerrpop;
  3240. yyn = -yyn;
  3241. goto yyreduce;
  3242. }
  3243. else if (yyn == 0)
  3244. goto yyerrpop;
  3245. if (yyn == YYFINAL)
  3246. YYACCEPT;
  3247. #if YYDEBUG != 0
  3248. if (yydebug)
  3249. fprintf(stderr, "Shifting error token, ");
  3250. #endif
  3251. *++yyvsp = yylval;
  3252. #ifdef YYLSP_NEEDED
  3253. *++yylsp = yylloc;
  3254. #endif
  3255. yystate = yyn;
  3256. goto yynewstate;
  3257. yyacceptlab:
  3258. /* YYACCEPT comes here. */
  3259. if (yyfree_stacks)
  3260. {
  3261. free (yyss);
  3262. free (yyvs);
  3263. #ifdef YYLSP_NEEDED
  3264. free (yyls);
  3265. #endif
  3266. }
  3267. return 0;
  3268. yyabortlab:
  3269. /* YYABORT comes here. */
  3270. if (yyfree_stacks)
  3271. {
  3272. free (yyss);
  3273. free (yyvs);
  3274. #ifdef YYLSP_NEEDED
  3275. free (yyls);
  3276. #endif
  3277. }
  3278. return 1;
  3279. }
  3280. #line 1562 "gram.yy"
  3281. // bison defines const to be empty unless __STDC__ is defined, which it
  3282. // isn't under cfront
  3283. #ifdef const
  3284. #undef const
  3285. #endif
  3286. static struct
  3287. {
  3288. const char *name;
  3289. double val;
  3290. int scaled; // non-zero if val should be multiplied by scale
  3291. } defaults_table[] = {
  3292. { "arcrad", .25, 1 },
  3293. { "arrowht", .1, 1 },
  3294. { "arrowwid", .05, 1 },
  3295. { "circlerad", .25, 1 },
  3296. { "boxht", .5, 1 },
  3297. { "boxwid", .75, 1 },
  3298. { "boxrad", 0.0, 1 },
  3299. { "dashwid", .05, 1 },
  3300. { "ellipseht", .5, 1 },
  3301. { "ellipsewid", .75, 1 },
  3302. { "moveht", .5, 1 },
  3303. { "movewid", .5, 1 },
  3304. { "lineht", .5, 1 },
  3305. { "linewid", .5, 1 },
  3306. { "textht", 0.0, 1 },
  3307. { "textwid", 0.0, 1 },
  3308. { "scale", 1.0, 0 },
  3309. { "linethick", -1.0, 1 }, // in points (<0 is default); now scaled
  3310. { "fillval", .5, 0 },
  3311. { "arrowhead", 1.0, 0 },
  3312. { "maxpswid", 8.5, 0 },
  3313. { "maxpsht", 11.0, 0 },
  3314. };
  3315. static place *
  3316. lookup_label(const char *label)
  3317. {
  3318. saved_state *state = current_saved_state;
  3319. PTABLE(place) *tbl = current_table;
  3320. for (;;)
  3321. {
  3322. place *pl = tbl->lookup(label);
  3323. if (pl)
  3324. return pl;
  3325. if (!state)
  3326. return 0;
  3327. tbl = state->tbl;
  3328. state = state->prev;
  3329. }
  3330. }
  3331. static void
  3332. define_label(const char *label, const place *pl)
  3333. {
  3334. place *p = new place;
  3335. *p = *pl;
  3336. current_table->define(label, p);
  3337. }
  3338. int
  3339. lookup_variable(const char *name, double *val)
  3340. {
  3341. place *pl = lookup_label(name);
  3342. if (pl)
  3343. {
  3344. *val = pl->x;
  3345. return 1;
  3346. }
  3347. return 0;
  3348. }
  3349. void
  3350. define_variable(const char *name, double val)
  3351. {
  3352. place *p = new place;
  3353. p->obj = 0;
  3354. p->x = val;
  3355. p->y = 0.0;
  3356. current_table->define(name, p);
  3357. if (strcmp(name, "scale") == 0)
  3358. {
  3359. // When the scale changes, reset all scaled pre-defined variables to
  3360. // their default values.
  3361. for (unsigned int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
  3362. if (defaults_table[i].scaled)
  3363. define_variable(defaults_table[i].name, val*defaults_table[i].val);
  3364. }
  3365. }
  3366. // called once only (not once per parse)
  3367. void
  3368. parse_init (void)
  3369. {
  3370. current_direction = RIGHT_DIRECTION;
  3371. current_position.x = 0.0;
  3372. current_position.y = 0.0;
  3373. // This resets everything to its default value.
  3374. reset_all();
  3375. }
  3376. static void
  3377. reset (const char *nm)
  3378. {
  3379. for (unsigned int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
  3380. if (strcmp(nm, defaults_table[i].name) == 0)
  3381. {
  3382. double val = defaults_table[i].val;
  3383. if (defaults_table[i].scaled)
  3384. {
  3385. double scale;
  3386. lookup_variable("scale", &scale);
  3387. val *= scale;
  3388. }
  3389. define_variable(defaults_table[i].name, val);
  3390. return;
  3391. }
  3392. lex_error("`%1' is not a predefined variable", nm);
  3393. }
  3394. static void
  3395. reset_all (void)
  3396. {
  3397. // We only have to explicitly reset the pre-defined variables that
  3398. // aren't scaled because `scale' is not scaled, and changing the
  3399. // value of `scale' will reset all the pre-defined variables that
  3400. // are scaled.
  3401. for (unsigned int i = 0; i < sizeof(defaults_table)/sizeof(defaults_table[0]); i++)
  3402. if (!defaults_table[i].scaled)
  3403. define_variable(defaults_table[i].name, defaults_table[i].val);
  3404. }
  3405. // called after each parse
  3406. void
  3407. parse_cleanup (void)
  3408. {
  3409. while (current_saved_state != 0)
  3410. {
  3411. delete current_table;
  3412. current_table = current_saved_state->tbl;
  3413. saved_state *tem = current_saved_state;
  3414. current_saved_state = current_saved_state->prev;
  3415. delete tem;
  3416. }
  3417. assert(current_table == &top_table);
  3418. PTABLE_ITERATOR(place) iter(current_table);
  3419. const char *key;
  3420. place *pl;
  3421. while (iter.next(&key, &pl))
  3422. if (pl->obj != 0)
  3423. {
  3424. position pos = pl->obj->origin();
  3425. pl->obj = 0;
  3426. pl->x = pos.x;
  3427. pl->y = pos.y;
  3428. }
  3429. while (olist.head != 0)
  3430. {
  3431. object *tem = olist.head;
  3432. olist.head = olist.head->next;
  3433. delete tem;
  3434. }
  3435. olist.tail = 0;
  3436. current_direction = RIGHT_DIRECTION;
  3437. current_position.x = 0.0;
  3438. current_position.y = 0.0;
  3439. }
  3440. static const char *
  3441. ordinal_postfix(int n)
  3442. {
  3443. if (n < 10 || n > 20)
  3444. switch (n % 10)
  3445. {
  3446. case 1:
  3447. return "st";
  3448. case 2:
  3449. return "nd";
  3450. case 3:
  3451. return "rd";
  3452. }
  3453. return "th";
  3454. }
  3455. static const char *
  3456. object_type_name(object_type type)
  3457. {
  3458. switch (type)
  3459. {
  3460. case BOX_OBJECT:
  3461. return "box";
  3462. case CIRCLE_OBJECT:
  3463. return "circle";
  3464. case ELLIPSE_OBJECT:
  3465. return "ellipse";
  3466. case ARC_OBJECT:
  3467. return "arc";
  3468. case SPLINE_OBJECT:
  3469. return "spline";
  3470. case LINE_OBJECT:
  3471. return "line";
  3472. case ARROW_OBJECT:
  3473. return "arrow";
  3474. case MOVE_OBJECT:
  3475. return "move";
  3476. case TEXT_OBJECT:
  3477. return "\"\"";
  3478. case BLOCK_OBJECT:
  3479. return "[]";
  3480. case OTHER_OBJECT:
  3481. case MARK_OBJECT:
  3482. default:
  3483. break;
  3484. }
  3485. return "object";
  3486. }
  3487. static char *
  3488. format_number(const char *form, double n)
  3489. {
  3490. if (form == 0)
  3491. form = "%g";
  3492. else
  3493. {
  3494. // this is a fairly feeble attempt at validation of the format
  3495. int nspecs = 0;
  3496. for (const char *p = form; *p != '\0'; p++)
  3497. if (*p == '%')
  3498. {
  3499. if (p[1] == '%')
  3500. p++;
  3501. else
  3502. nspecs++;
  3503. }
  3504. if (nspecs > 1)
  3505. {
  3506. lex_error("bad format `%1'", form);
  3507. return strsave(form);
  3508. }
  3509. }
  3510. sprintf(sprintf_buf, form, n);
  3511. return strsave(sprintf_buf);
  3512. }
  3513. static char *
  3514. do_sprintf(const char *form, const double *v, int nv)
  3515. {
  3516. string result;
  3517. int i = 0;
  3518. string one_format;
  3519. while (*form)
  3520. {
  3521. if (*form == '%')
  3522. {
  3523. one_format += *form++;
  3524. for (; *form != '\0' && strchr("#-+ 0123456789.", *form) != 0; form++)
  3525. one_format += *form;
  3526. if (*form == '\0' || strchr("eEfgG%", *form) == 0)
  3527. {
  3528. lex_error("bad sprintf format");
  3529. result += one_format;
  3530. result += form;
  3531. break;
  3532. }
  3533. if (*form == '%')
  3534. {
  3535. one_format += *form++;
  3536. one_format += '\0';
  3537. sprintf(sprintf_buf, one_format.contents());
  3538. }
  3539. else
  3540. {
  3541. if (i >= nv)
  3542. {
  3543. lex_error("too few arguments to sprintf");
  3544. result += one_format;
  3545. result += form;
  3546. break;
  3547. }
  3548. one_format += *form++;
  3549. one_format += '\0';
  3550. sprintf(sprintf_buf, one_format.contents(), v[i++]);
  3551. }
  3552. one_format.clear();
  3553. result += sprintf_buf;
  3554. }
  3555. else
  3556. result += *form++;
  3557. }
  3558. result += '\0';
  3559. return strsave(result.contents());
  3560. }