00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #define YYBISON 1
00048
00049
00050 #define YYBISON_VERSION "2.3"
00051
00052
00053 #define YYSKELETON_NAME "yacc.c"
00054
00055
00056 #define YYPURE 0
00057
00058
00059 #define YYLSP_NEEDED 0
00060
00061
00062
00063
00064 #ifndef YYTOKENTYPE
00065 # define YYTOKENTYPE
00066
00067
00068 enum htmltokentype {
00069 T_end_br = 258,
00070 T_end_img = 259,
00071 T_row = 260,
00072 T_end_row = 261,
00073 T_html = 262,
00074 T_end_html = 263,
00075 T_end_table = 264,
00076 T_end_cell = 265,
00077 T_end_font = 266,
00078 T_string = 267,
00079 T_error = 268,
00080 T_BR = 269,
00081 T_br = 270,
00082 T_IMG = 271,
00083 T_img = 272,
00084 T_table = 273,
00085 T_cell = 274,
00086 T_font = 275
00087 };
00088 #endif
00089
00090 #define T_end_br 258
00091 #define T_end_img 259
00092 #define T_row 260
00093 #define T_end_row 261
00094 #define T_html 262
00095 #define T_end_html 263
00096 #define T_end_table 264
00097 #define T_end_cell 265
00098 #define T_end_font 266
00099 #define T_string 267
00100 #define T_error 268
00101 #define T_BR 269
00102 #define T_br 270
00103 #define T_IMG 271
00104 #define T_img 272
00105 #define T_table 273
00106 #define T_cell 274
00107 #define T_font 275
00108
00109
00110
00111
00112
00113 #line 17 "../../lib/common/htmlparse.y"
00114
00115
00116 #include "render.h"
00117 #include "htmltable.h"
00118 #include "htmllex.h"
00119
00120 extern int htmlparse(void);
00121
00122 typedef struct sfont_t {
00123 htmlfont_t *cfont;
00124 struct sfont_t *pfont;
00125 } sfont_t;
00126
00127 static struct {
00128 htmllabel_t* lbl;
00129 htmltbl_t* tblstack;
00130 #ifdef OLD
00131 Dt_t* paras;
00132 #endif
00133 Dt_t* fitemList;
00134 Dt_t* fparaList;
00135 agxbuf* str;
00136 sfont_t* fontstack;
00137 } HTMLstate;
00138
00139
00140
00141
00142
00143 static void
00144 free_ritem(Dt_t* d, pitem* p,Dtdisc_t* ds)
00145 {
00146 dtclose (p->u.rp);
00147 free (p);
00148 }
00149
00150
00151
00152
00153
00154 static void
00155 free_item(Dt_t* d, void* p,Dtdisc_t* ds)
00156 {
00157 free (p);
00158 }
00159
00160
00161
00162
00163 static void
00164 cleanTbl (htmltbl_t* tp)
00165 {
00166 dtclose (tp->u.p.rows);
00167 free_html_data (&tp->data);
00168 free (tp);
00169 }
00170
00171
00172
00173
00174 static void
00175 cleanCell (htmlcell_t* cp)
00176 {
00177 if (cp->child.kind == HTML_TBL) cleanTbl (cp->child.u.tbl);
00178 else if (cp->child.kind == HTML_TEXT) free_html_text (cp->child.u.txt);
00179 free_html_data (&cp->data);
00180 free (cp);
00181 }
00182
00183
00184
00185
00186 static void
00187 free_citem(Dt_t* d, pitem* p,Dtdisc_t* ds)
00188 {
00189 cleanCell (p->u.cp);
00190 free (p);
00191 }
00192
00193 static Dtdisc_t rowDisc = {
00194 offsetof(pitem,u),
00195 sizeof(void*),
00196 offsetof(pitem,link),
00197 NIL(Dtmake_f),
00198 (Dtfree_f)free_ritem,
00199 NIL(Dtcompar_f),
00200 NIL(Dthash_f),
00201 NIL(Dtmemory_f),
00202 NIL(Dtevent_f)
00203 };
00204 static Dtdisc_t cellDisc = {
00205 offsetof(pitem,u),
00206 sizeof(void*),
00207 offsetof(pitem,link),
00208 NIL(Dtmake_f),
00209 (Dtfree_f)free_item,
00210 NIL(Dtcompar_f),
00211 NIL(Dthash_f),
00212 NIL(Dtmemory_f),
00213 NIL(Dtevent_f)
00214 };
00215
00216 #ifdef OLD
00217 typedef struct {
00218 Dtlink_t link;
00219 const char* s;
00220 char c;
00221 } sitem;
00222 #endif
00223
00224 typedef struct {
00225 Dtlink_t link;
00226 textitem_t ti;
00227 } fitem;
00228
00229 typedef struct {
00230 Dtlink_t link;
00231 htextpara_t lp;
00232 } fpara;
00233
00234 #ifdef OLD
00235 static void
00236 free_sitem(Dt_t* d, sitem* p,Dtdisc_t* ds)
00237 {
00238 free (p);
00239 }
00240 #endif
00241
00242 static void
00243 free_fitem(Dt_t* d, fitem* p, Dtdisc_t* ds)
00244 {
00245 if (p->ti.str)
00246 free (p->ti.str);
00247 if (p->ti.font)
00248 free_html_font (p->ti.font);
00249 free (p);
00250 }
00251
00252 static void
00253 free_fpara(Dt_t* d, fpara* p, Dtdisc_t* ds)
00254 {
00255 textitem_t* ti;
00256
00257 if (p->lp.nitems) {
00258 int i;
00259 ti = p->lp.items;
00260 for (i = 0; i < p->lp.nitems; i++) {
00261 if (ti->str) free (ti->str);
00262 if (ti->font) free_html_font (ti->font);
00263 ti++;
00264 }
00265 free (p->lp.items);
00266 }
00267 free (p);
00268 }
00269
00270 #ifdef OLD
00271 static Dtdisc_t strDisc = {
00272 offsetof(sitem,s),
00273 sizeof(char*),
00274 offsetof(sitem,link),
00275 NIL(Dtmake_f),
00276 (Dtfree_f)free_sitem,
00277 NIL(Dtcompar_f),
00278 NIL(Dthash_f),
00279 NIL(Dtmemory_f),
00280 NIL(Dtevent_f)
00281 };
00282 #endif
00283
00284 static Dtdisc_t fstrDisc = {
00285 0,
00286 0,
00287 offsetof(fitem,link),
00288 NIL(Dtmake_f),
00289 (Dtfree_f)free_item,
00290 NIL(Dtcompar_f),
00291 NIL(Dthash_f),
00292 NIL(Dtmemory_f),
00293 NIL(Dtevent_f)
00294 };
00295
00296
00297 static Dtdisc_t fparaDisc = {
00298 0,
00299 0,
00300 offsetof(fpara,link),
00301 NIL(Dtmake_f),
00302 (Dtfree_f)free_item,
00303 NIL(Dtcompar_f),
00304 NIL(Dthash_f),
00305 NIL(Dtmemory_f),
00306 NIL(Dtevent_f)
00307 };
00308
00309 #ifdef OLD
00310 static void
00311 appendStrList(const char* p,int v)
00312 {
00313 sitem* sp = NEW(sitem);
00314 sp->s = strdup(p);
00315 sp->c = v;
00316 dtinsert (HTMLstate.paras, sp);
00317 }
00318 #endif
00319
00320
00321
00322 static htmlfont_t *
00323 dupFont (htmlfont_t *f)
00324 {
00325 if (f) f->cnt++;
00326 return f;
00327 }
00328
00329
00330
00331
00332 static void
00333 appendFItemList (agxbuf *ag)
00334 {
00335 fitem *fi = NEW(fitem);
00336
00337 fi->ti.str = strdup(agxbuse(ag));
00338 fi->ti.font = dupFont (HTMLstate.fontstack->cfont);
00339 dtinsert(HTMLstate.fitemList, fi);
00340 }
00341
00342
00343
00344 static void
00345 appendFLineList (int v)
00346 {
00347 int cnt;
00348 fpara *ln = NEW(fpara);
00349 fitem *fi;
00350 Dt_t *ilist = HTMLstate.fitemList;
00351
00352 cnt = dtsize(ilist);
00353 ln->lp.nitems = cnt;
00354 ln->lp.just = v;
00355 if (cnt) {
00356 int i = 0;
00357 ln->lp.items = N_NEW(cnt, textitem_t);
00358
00359 fi = (fitem*)dtflatten(ilist);
00360 for (; fi; fi = (fitem*)dtlink(fitemList,(Dtlink_t*)fi)) {
00361 ln->lp.items[i] = fi->ti;
00362 i++;
00363 }
00364 }
00365
00366 dtclear(ilist);
00367
00368 dtinsert(HTMLstate.fparaList, ln);
00369 }
00370
00371 #ifdef OLD
00372
00373
00374
00375
00376 static htmltxt_t*
00377 mkText (const char* lastl)
00378 {
00379 int cnt;
00380 textpara_t* lp;
00381 sitem* sp;
00382 Dt_t* paras = HTMLstate.paras;
00383 htmltxt_t* tp = NEW(htmltxt_t);
00384
00385 if (paras)
00386 cnt = dtsize (paras);
00387 else
00388 cnt = 0;
00389 if (lastl) cnt++;
00390
00391 tp->nparas = cnt;
00392 tp->para = N_NEW(cnt+1,textpara_t);
00393
00394 lp = tp->para;
00395 if (paras) {
00396 sp = (sitem*)dtflatten(paras);
00397 for (; sp; sp = (sitem*)dtlink(paras,(Dtlink_t*)sp)) {
00398 lp->str = (char*)(sp->s);
00399 lp->xshow = NULL;
00400 lp->just = sp->c;
00401 lp++;
00402 }
00403 }
00404 if (lastl) {
00405 lp->str = strdup(lastl);
00406 lp->just = '\0';
00407 }
00408
00409 if (paras) dtclear (paras);
00410
00411 return tp;
00412 }
00413 #endif
00414
00415 static htmltxt_t*
00416 mkText(void)
00417 {
00418 int cnt;
00419 Dt_t * ipara = HTMLstate.fparaList;
00420 fpara *fl ;
00421 htmltxt_t *hft = NEW(htmltxt_t);
00422
00423 if (dtsize (HTMLstate.fitemList))
00424 appendFLineList (UNSET_ALIGN);
00425
00426 cnt = dtsize(ipara);
00427 hft->nparas = cnt;
00428
00429 if (cnt) {
00430 int i = 0;
00431 hft->paras = N_NEW(cnt,htextpara_t);
00432 for(fl=(fpara *)dtfirst(ipara); fl; fl=(fpara *)dtnext(ipara,fl)) {
00433 hft->paras[i] = fl->lp;
00434 i++;
00435 }
00436 }
00437
00438 dtclear(ipara);
00439
00440 return hft;
00441 }
00442
00443
00444
00445
00446 static void addRow (void)
00447 {
00448 Dt_t* dp = dtopen(&cellDisc, Dtqueue);
00449 htmltbl_t* tbl = HTMLstate.tblstack;
00450 pitem* sp = NEW(pitem);
00451 sp->u.rp = dp;
00452 dtinsert (tbl->u.p.rows, sp);
00453 }
00454
00455
00456
00457
00458 static void setCell (htmlcell_t* cp, void* obj, int kind)
00459 {
00460 pitem* sp = NEW(pitem);
00461 htmltbl_t* tbl = HTMLstate.tblstack;
00462 pitem* rp = (pitem*)dtlast (tbl->u.p.rows);
00463 Dt_t* row = rp->u.rp;
00464 sp->u.cp = cp;
00465 dtinsert (row, sp);
00466 cp->child.kind = kind;
00467
00468 if(kind == HTML_TEXT)
00469 cp->child.u.txt = (htmltxt_t*)obj;
00470 else if (kind == HTML_IMAGE)
00471 cp->child.u.img = (htmlimg_t*)obj;
00472 else
00473 cp->child.u.tbl = (htmltbl_t*)obj;
00474 }
00475
00476 #ifdef OLD
00477
00478
00479
00480
00481
00482
00483
00484 static htmlfont_t* setFont (htmlfont_t* fp, htmlfont_t* curf)
00485 {
00486 if (curf) {
00487 if (curf->size < 0.0) curf->size = fp->size;
00488 if (!curf->color) curf->color = fp->color;
00489 else if (fp->color) free (fp->color);
00490 if (!curf->name) curf->name = fp->name;
00491 else if (fp->name) free (fp->name);
00492 free (fp);
00493 return curf;
00494 }
00495 else
00496 return fp;
00497 }
00498
00499
00500
00501
00502 static void fontText (htmlfont_t* fp, htmltxt_t* cp)
00503 {
00504 cp->font = setFont (fp, cp->font);
00505 }
00506
00507
00508
00509
00510 static void fontTable (htmlfont_t* fp, htmltbl_t* cp)
00511 {
00512 cp->font = setFont (fp, cp->font);
00513 }
00514 #endif
00515
00516
00517
00518
00519 static htmllabel_t* mkLabel (void* obj, int kind)
00520 {
00521 htmllabel_t* lp = NEW(htmllabel_t);
00522
00523 lp->kind = kind;
00524 if (kind == HTML_TEXT)
00525 lp->u.txt = (htmltxt_t*)obj;
00526 else
00527 lp->u.tbl = (htmltbl_t*)obj;
00528 return lp;
00529 }
00530
00531
00532
00533
00534
00535 static void
00536 freeFontstack(void)
00537 {
00538 sfont_t* s;
00539 sfont_t* next;
00540
00541 for (s = HTMLstate.fontstack; (next = s->pfont); s = next) {
00542 free_html_font (s->cfont);
00543 free(s);
00544 }
00545 }
00546
00547
00548
00549
00550
00551
00552
00553 static void cleanup (void)
00554 {
00555 htmltbl_t* tp = HTMLstate.tblstack;
00556 htmltbl_t* next;
00557
00558 if (HTMLstate.lbl) {
00559 free_html_label (HTMLstate.lbl,1);
00560 HTMLstate.lbl = NULL;
00561 }
00562 cellDisc.freef = (Dtfree_f)free_citem;
00563 while (tp) {
00564 next = tp->u.p.prev;
00565 cleanTbl (tp);
00566 tp = next;
00567 }
00568 cellDisc.freef = (Dtfree_f)free_item;
00569
00570 fstrDisc.freef = (Dtfree_f)free_fitem;
00571 dtclear (HTMLstate.fitemList);
00572 fstrDisc.freef = (Dtfree_f)free_item;
00573
00574 fparaDisc.freef = (Dtfree_f)free_fpara;
00575 dtclear (HTMLstate.fparaList);
00576 fparaDisc.freef = (Dtfree_f)free_item;
00577
00578 freeFontstack();
00579 }
00580
00581
00582
00583
00584 static int nonSpace (char* s)
00585 {
00586 char c;
00587
00588 while ((c = *s++)) {
00589 if (c != ' ') return 1;
00590 }
00591 return 0;
00592 }
00593
00594
00595
00596
00597 static void
00598 pushFont (htmlfont_t *f)
00599 {
00600 sfont_t *ft = NEW(sfont_t);
00601 htmlfont_t* curfont = HTMLstate.fontstack->cfont;
00602
00603 if (curfont) {
00604 if (!f->color && curfont->color)
00605 f->color = strdup(curfont->color);
00606 if ((f->size < 0.0) && (curfont->size >= 0.0))
00607 f->size = curfont->size;
00608 if (!f->name && curfont->name)
00609 f->name = strdup(curfont->name);
00610 }
00611
00612 ft->cfont = dupFont (f);
00613 ft->pfont = HTMLstate.fontstack;
00614 HTMLstate.fontstack = ft;
00615 }
00616
00617
00618
00619 static void
00620 popFont (void)
00621 {
00622 sfont_t* curfont = HTMLstate.fontstack;
00623 sfont_t* prevfont = curfont->pfont;
00624
00625 free_html_font (curfont->cfont);
00626 free (curfont);
00627 HTMLstate.fontstack = prevfont;
00628 }
00629
00630
00631
00632
00633 #ifndef YYDEBUG
00634 # define YYDEBUG 0
00635 #endif
00636
00637
00638 #ifdef YYERROR_VERBOSE
00639 # undef YYERROR_VERBOSE
00640 # define YYERROR_VERBOSE 1
00641 #else
00642 # define YYERROR_VERBOSE 0
00643 #endif
00644
00645
00646 #ifndef YYTOKEN_TABLE
00647 # define YYTOKEN_TABLE 0
00648 #endif
00649
00650 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00651 typedef union YYSTYPE
00652 #line 535 "../../lib/common/htmlparse.y"
00653 {
00654 int i;
00655 htmltxt_t* txt;
00656 htmlcell_t* cell;
00657 htmltbl_t* tbl;
00658 htmlfont_t* font;
00659 htmlimg_t* img;
00660 }
00661
00662 #line 663 "y.tab.c"
00663 YYSTYPE;
00664 # define htmlstype YYSTYPE
00665 # define YYSTYPE_IS_DECLARED 1
00666 # define YYSTYPE_IS_TRIVIAL 1
00667 #endif
00668
00669
00670
00671
00672
00673
00674
00675 #line 676 "y.tab.c"
00676
00677 #ifdef short
00678 # undef short
00679 #endif
00680
00681 #ifdef YYTYPE_UINT8
00682 typedef YYTYPE_UINT8 htmltype_uint8;
00683 #else
00684 typedef unsigned char htmltype_uint8;
00685 #endif
00686
00687 #ifdef YYTYPE_INT8
00688 typedef YYTYPE_INT8 htmltype_int8;
00689 #elif (defined __STDC__ || defined __C99__FUNC__ \
00690 || defined __cplusplus || defined _MSC_VER)
00691 typedef signed char htmltype_int8;
00692 #else
00693 typedef short int htmltype_int8;
00694 #endif
00695
00696 #ifdef YYTYPE_UINT16
00697 typedef YYTYPE_UINT16 htmltype_uint16;
00698 #else
00699 typedef unsigned short int htmltype_uint16;
00700 #endif
00701
00702 #ifdef YYTYPE_INT16
00703 typedef YYTYPE_INT16 htmltype_int16;
00704 #else
00705 typedef short int htmltype_int16;
00706 #endif
00707
00708 #ifndef YYSIZE_T
00709 # ifdef __SIZE_TYPE__
00710 # define YYSIZE_T __SIZE_TYPE__
00711 # elif defined size_t
00712 # define YYSIZE_T size_t
00713 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00714 || defined __cplusplus || defined _MSC_VER)
00715 # include <stddef.h>
00716 # define YYSIZE_T size_t
00717 # else
00718 # define YYSIZE_T unsigned int
00719 # endif
00720 #endif
00721
00722 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00723
00724 #ifndef YY_
00725 # if YYENABLE_NLS
00726 # if ENABLE_NLS
00727 # include <libintl.h>
00728 # define YY_(msgid) dgettext ("bison-runtime", msgid)
00729 # endif
00730 # endif
00731 # ifndef YY_
00732 # define YY_(msgid) msgid
00733 # endif
00734 #endif
00735
00736
00737 #if ! defined lint || defined __GNUC__
00738 # define YYUSE(e) ((void) (e))
00739 #else
00740 # define YYUSE(e)
00741 #endif
00742
00743
00744 #ifndef lint
00745 # define YYID(n) (n)
00746 #else
00747 #if (defined __STDC__ || defined __C99__FUNC__ \
00748 || defined __cplusplus || defined _MSC_VER)
00749 static int
00750 YYID (int i)
00751 #else
00752 static int
00753 YYID (i)
00754 int i;
00755 #endif
00756 {
00757 return i;
00758 }
00759 #endif
00760
00761 #if ! defined htmloverflow || YYERROR_VERBOSE
00762
00763
00764
00765 # ifdef YYSTACK_USE_ALLOCA
00766 # if YYSTACK_USE_ALLOCA
00767 # ifdef __GNUC__
00768 # define YYSTACK_ALLOC __builtin_alloca
00769 # elif defined __BUILTIN_VA_ARG_INCR
00770 # include <alloca.h>
00771 # elif defined _AIX
00772 # define YYSTACK_ALLOC __alloca
00773 # elif defined _MSC_VER
00774 # include <malloc.h>
00775 # define alloca _alloca
00776 # else
00777 # define YYSTACK_ALLOC alloca
00778 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00779 || defined __cplusplus || defined _MSC_VER)
00780 # include <stdlib.h>
00781 # ifndef _STDLIB_H
00782 # define _STDLIB_H 1
00783 # endif
00784 # endif
00785 # endif
00786 # endif
00787 # endif
00788
00789 # ifdef YYSTACK_ALLOC
00790
00791 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
00792 # ifndef YYSTACK_ALLOC_MAXIMUM
00793
00794
00795
00796
00797 # define YYSTACK_ALLOC_MAXIMUM 4032
00798 # endif
00799 # else
00800 # define YYSTACK_ALLOC YYMALLOC
00801 # define YYSTACK_FREE YYFREE
00802 # ifndef YYSTACK_ALLOC_MAXIMUM
00803 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00804 # endif
00805 # if (defined __cplusplus && ! defined _STDLIB_H \
00806 && ! ((defined YYMALLOC || defined malloc) \
00807 && (defined YYFREE || defined free)))
00808 # include <stdlib.h>
00809 # ifndef _STDLIB_H
00810 # define _STDLIB_H 1
00811 # endif
00812 # endif
00813 # ifndef YYMALLOC
00814 # define YYMALLOC malloc
00815 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00816 || defined __cplusplus || defined _MSC_VER)
00817 void *malloc (YYSIZE_T);
00818 # endif
00819 # endif
00820 # ifndef YYFREE
00821 # define YYFREE free
00822 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00823 || defined __cplusplus || defined _MSC_VER)
00824 void free (void *);
00825 # endif
00826 # endif
00827 # endif
00828 #endif
00829
00830
00831 #if (! defined htmloverflow \
00832 && (! defined __cplusplus \
00833 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00834
00835
00836 union htmlalloc
00837 {
00838 htmltype_int16 htmlss;
00839 YYSTYPE htmlvs;
00840 };
00841
00842
00843 # define YYSTACK_GAP_MAXIMUM (sizeof (union htmlalloc) - 1)
00844
00845
00846
00847 # define YYSTACK_BYTES(N) \
00848 ((N) * (sizeof (htmltype_int16) + sizeof (YYSTYPE)) \
00849 + YYSTACK_GAP_MAXIMUM)
00850
00851
00852
00853 # ifndef YYCOPY
00854 # if defined __GNUC__ && 1 < __GNUC__
00855 # define YYCOPY(To, From, Count) \
00856 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00857 # else
00858 # define YYCOPY(To, From, Count) \
00859 do \
00860 { \
00861 YYSIZE_T htmli; \
00862 for (htmli = 0; htmli < (Count); htmli++) \
00863 (To)[htmli] = (From)[htmli]; \
00864 } \
00865 while (YYID (0))
00866 # endif
00867 # endif
00868
00869
00870
00871
00872
00873
00874 # define YYSTACK_RELOCATE(Stack) \
00875 do \
00876 { \
00877 YYSIZE_T htmlnewbytes; \
00878 YYCOPY (&htmlptr->Stack, Stack, htmlsize); \
00879 Stack = &htmlptr->Stack; \
00880 htmlnewbytes = htmlstacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00881 htmlptr += htmlnewbytes / sizeof (*htmlptr); \
00882 } \
00883 while (YYID (0))
00884
00885 #endif
00886
00887
00888 #define YYFINAL 17
00889
00890 #define YYLAST 61
00891
00892
00893 #define YYNTOKENS 21
00894
00895 #define YYNNTS 23
00896
00897 #define YYNRULES 38
00898
00899 #define YYNSTATES 59
00900
00901
00902 #define YYUNDEFTOK 2
00903 #define YYMAXUTOK 275
00904
00905 #define YYTRANSLATE(YYX) \
00906 ((unsigned int) (YYX) <= YYMAXUTOK ? htmltranslate[YYX] : YYUNDEFTOK)
00907
00908
00909 static const htmltype_uint8 htmltranslate[] =
00910 {
00911 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00912 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00913 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00914 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00915 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00916 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00917 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00918 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00919 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00920 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00921 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00922 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00923 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00924 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00925 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00926 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00927 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00928 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00929 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00930 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00931 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00932 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00933 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00934 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00935 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00936 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
00937 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
00938 15, 16, 17, 18, 19, 20
00939 };
00940
00941 #if YYDEBUG
00942
00943
00944 static const htmltype_uint8 htmlprhs[] =
00945 {
00946 0, 0, 3, 7, 11, 13, 15, 18, 20, 22,
00947 24, 28, 30, 32, 35, 37, 39, 42, 43, 50,
00948 52, 56, 58, 59, 61, 64, 65, 70, 72, 75,
00949 76, 81, 82, 87, 88, 93, 94, 98, 101
00950 };
00951
00952
00953 static const htmltype_int8 htmlrhs[] =
00954 {
00955 22, 0, -1, 7, 23, 8, -1, 7, 32, 8,
00956 -1, 1, -1, 24, -1, 24, 25, -1, 25, -1,
00957 29, -1, 28, -1, 26, 24, 27, -1, 20, -1,
00958 11, -1, 15, 3, -1, 14, -1, 12, -1, 29,
00959 12, -1, -1, 33, 18, 31, 34, 9, 33, -1,
00960 30, -1, 26, 30, 27, -1, 29, -1, -1, 35,
00961 -1, 34, 35, -1, -1, 5, 36, 37, 6, -1,
00962 38, -1, 37, 38, -1, -1, 19, 32, 39, 10,
00963 -1, -1, 19, 23, 40, 10, -1, -1, 19, 43,
00964 41, 10, -1, -1, 19, 42, 10, -1, 17, 4,
00965 -1, 16, -1
00966 };
00967
00968
00969 static const htmltype_uint16 htmlrline[] =
00970 {
00971 0, 561, 561, 562, 563, 566, 569, 570, 573, 574,
00972 575, 578, 581, 584, 585, 588, 589, 592, 592, 613,
00973 614, 617, 618, 621, 622, 625, 625, 628, 629, 632,
00974 632, 633, 633, 634, 634, 635, 635, 638, 639
00975 };
00976 #endif
00977
00978 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00979
00980
00981 static const char *const htmltname[] =
00982 {
00983 "$end", "error", "$undefined", "T_end_br", "T_end_img", "T_row",
00984 "T_end_row", "T_html", "T_end_html", "T_end_table", "T_end_cell",
00985 "T_end_font", "T_string", "T_error", "T_BR", "T_br", "T_IMG", "T_img",
00986 "T_table", "T_cell", "T_font", "$accept", "html", "fonttext", "text",
00987 "textitem", "sfont", "nfont", "br", "string", "table", "@1", "fonttable",
00988 "opt_space", "rows", "row", "@2", "cells", "cell", "@3", "@4", "@5",
00989 "@6", "image", 0
00990 };
00991 #endif
00992
00993 # ifdef YYPRINT
00994
00995
00996 static const htmltype_uint16 htmltoknum[] =
00997 {
00998 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
00999 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
01000 275
01001 };
01002 # endif
01003
01004
01005 static const htmltype_uint8 htmlr1[] =
01006 {
01007 0, 21, 22, 22, 22, 23, 24, 24, 25, 25,
01008 25, 26, 27, 28, 28, 29, 29, 31, 30, 32,
01009 32, 33, 33, 34, 34, 36, 35, 37, 37, 39,
01010 38, 40, 38, 41, 38, 42, 38, 43, 43
01011 };
01012
01013
01014 static const htmltype_uint8 htmlr2[] =
01015 {
01016 0, 2, 3, 3, 1, 1, 2, 1, 1, 1,
01017 3, 1, 1, 2, 1, 1, 2, 0, 6, 1,
01018 3, 1, 0, 1, 2, 0, 4, 1, 2, 0,
01019 4, 0, 4, 0, 4, 0, 3, 2, 1
01020 };
01021
01022
01023
01024
01025 static const htmltype_uint8 htmldefact[] =
01026 {
01027 0, 4, 22, 0, 15, 14, 0, 11, 0, 5,
01028 7, 22, 9, 8, 19, 0, 0, 1, 13, 2,
01029 6, 0, 8, 0, 0, 16, 3, 17, 12, 10,
01030 20, 0, 25, 0, 23, 0, 22, 24, 22, 0,
01031 27, 21, 18, 38, 0, 31, 29, 0, 33, 26,
01032 28, 37, 0, 0, 36, 0, 32, 30, 34
01033 };
01034
01035
01036 static const htmltype_int8 htmldefgoto[] =
01037 {
01038 -1, 3, 8, 9, 10, 21, 29, 12, 13, 14,
01039 31, 15, 16, 33, 34, 35, 39, 40, 53, 52,
01040 55, 47, 48
01041 };
01042
01043
01044
01045 #define YYPACT_NINF -9
01046 static const htmltype_int8 htmlpact[] =
01047 {
01048 24, -9, 18, 3, -9, -9, 16, -9, 4, 18,
01049 -9, 18, -9, 22, -9, 19, 21, -9, -9, -9,
01050 -9, 18, 23, 9, 26, -9, -9, -9, -9, -9,
01051 -9, 36, -9, 17, -9, 25, 30, -9, -6, -1,
01052 -9, 23, -9, -9, 39, -9, -9, 35, -9, -9,
01053 -9, -9, 37, 38, -9, 40, -9, -9, -9
01054 };
01055
01056
01057 static const htmltype_int8 htmlpgoto[] =
01058 {
01059 -9, -9, 8, -4, -7, -2, 27, -9, -8, 41,
01060 -9, 11, 20, -9, 28, -9, -9, 14, -9, -9,
01061 -9, -9, -9
01062 };
01063
01064
01065
01066
01067
01068 #define YYTABLE_NINF -36
01069 static const htmltype_int8 htmltable[] =
01070 {
01071 11, 22, 20, 17, -35, 49, 4, 23, 5, 6,
01072 43, 44, 19, 22, 7, 22, 20, 23, 38, 18,
01073 28, 4, 32, 5, 6, 1, 36, 26, 41, 7,
01074 4, 2, 5, 6, 25, 25, 11, 28, 7, 27,
01075 -21, 32, 4, 51, 38, 54, 45, 56, 57, 46,
01076 58, 30, 24, 50, 0, 0, 42, 0, 0, 0,
01077 0, 37
01078 };
01079
01080 static const htmltype_int8 htmlcheck[] =
01081 {
01082 2, 9, 9, 0, 10, 6, 12, 11, 14, 15,
01083 16, 17, 8, 21, 20, 23, 23, 21, 19, 3,
01084 11, 12, 5, 14, 15, 1, 9, 8, 36, 20,
01085 12, 7, 14, 15, 12, 12, 38, 11, 20, 18,
01086 18, 5, 12, 4, 19, 10, 38, 10, 10, 38,
01087 10, 24, 11, 39, -1, -1, 36, -1, -1, -1,
01088 -1, 33
01089 };
01090
01091
01092
01093 static const htmltype_uint8 htmlstos[] =
01094 {
01095 0, 1, 7, 22, 12, 14, 15, 20, 23, 24,
01096 25, 26, 28, 29, 30, 32, 33, 0, 3, 8,
01097 25, 26, 29, 24, 30, 12, 8, 18, 11, 27,
01098 27, 31, 5, 34, 35, 36, 9, 35, 19, 37,
01099 38, 29, 33, 16, 17, 23, 32, 42, 43, 6,
01100 38, 4, 40, 39, 10, 41, 10, 10, 10
01101 };
01102
01103 #define htmlerrok (htmlerrstatus = 0)
01104 #define htmlclearin (htmlchar = YYEMPTY)
01105 #define YYEMPTY (-2)
01106 #define YYEOF 0
01107
01108 #define YYACCEPT goto htmlacceptlab
01109 #define YYABORT goto htmlabortlab
01110 #define YYERROR goto htmlerrorlab
01111
01112
01113
01114
01115
01116
01117 #define YYFAIL goto htmlerrlab
01118
01119 #define YYRECOVERING() (!!htmlerrstatus)
01120
01121 #define YYBACKUP(Token, Value) \
01122 do \
01123 if (htmlchar == YYEMPTY && htmllen == 1) \
01124 { \
01125 htmlchar = (Token); \
01126 htmllval = (Value); \
01127 htmltoken = YYTRANSLATE (htmlchar); \
01128 YYPOPSTACK (1); \
01129 goto htmlbackup; \
01130 } \
01131 else \
01132 { \
01133 htmlerror (YY_("syntax error: cannot back up")); \
01134 YYERROR; \
01135 } \
01136 while (YYID (0))
01137
01138
01139 #define YYTERROR 1
01140 #define YYERRCODE 256
01141
01142
01143
01144
01145
01146
01147 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
01148 #ifndef YYLLOC_DEFAULT
01149 # define YYLLOC_DEFAULT(Current, Rhs, N) \
01150 do \
01151 if (YYID (N)) \
01152 { \
01153 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
01154 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
01155 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
01156 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
01157 } \
01158 else \
01159 { \
01160 (Current).first_line = (Current).last_line = \
01161 YYRHSLOC (Rhs, 0).last_line; \
01162 (Current).first_column = (Current).last_column = \
01163 YYRHSLOC (Rhs, 0).last_column; \
01164 } \
01165 while (YYID (0))
01166 #endif
01167
01168
01169
01170
01171
01172
01173 #ifndef YY_LOCATION_PRINT
01174 # if YYLTYPE_IS_TRIVIAL
01175 # define YY_LOCATION_PRINT(File, Loc) \
01176 fprintf (File, "%d.%d-%d.%d", \
01177 (Loc).first_line, (Loc).first_column, \
01178 (Loc).last_line, (Loc).last_column)
01179 # else
01180 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
01181 # endif
01182 #endif
01183
01184
01185
01186
01187 #ifdef YYLEX_PARAM
01188 # define YYLEX htmllex (YYLEX_PARAM)
01189 #else
01190 # define YYLEX htmllex ()
01191 #endif
01192
01193
01194 #if YYDEBUG
01195
01196 # ifndef YYFPRINTF
01197 # include <stdio.h>
01198 # define YYFPRINTF fprintf
01199 # endif
01200
01201 # define YYDPRINTF(Args) \
01202 do { \
01203 if (htmldebug) \
01204 YYFPRINTF Args; \
01205 } while (YYID (0))
01206
01207 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
01208 do { \
01209 if (htmldebug) \
01210 { \
01211 YYFPRINTF (stderr, "%s ", Title); \
01212 html_symbol_print (stderr, \
01213 Type, Value); \
01214 YYFPRINTF (stderr, "\n"); \
01215 } \
01216 } while (YYID (0))
01217
01218
01219
01220
01221
01222
01223
01224 #if (defined __STDC__ || defined __C99__FUNC__ \
01225 || defined __cplusplus || defined _MSC_VER)
01226 static void
01227 html_symbol_value_print (FILE *htmloutput, int htmltype, YYSTYPE const * const htmlvaluep)
01228 #else
01229 static void
01230 html_symbol_value_print (htmloutput, htmltype, htmlvaluep)
01231 FILE *htmloutput;
01232 int htmltype;
01233 YYSTYPE const * const htmlvaluep;
01234 #endif
01235 {
01236 if (!htmlvaluep)
01237 return;
01238 # ifdef YYPRINT
01239 if (htmltype < YYNTOKENS)
01240 YYPRINT (htmloutput, htmltoknum[htmltype], *htmlvaluep);
01241 # else
01242 YYUSE (htmloutput);
01243 # endif
01244 switch (htmltype)
01245 {
01246 default:
01247 break;
01248 }
01249 }
01250
01251
01252
01253
01254
01255
01256 #if (defined __STDC__ || defined __C99__FUNC__ \
01257 || defined __cplusplus || defined _MSC_VER)
01258 static void
01259 html_symbol_print (FILE *htmloutput, int htmltype, YYSTYPE const * const htmlvaluep)
01260 #else
01261 static void
01262 html_symbol_print (htmloutput, htmltype, htmlvaluep)
01263 FILE *htmloutput;
01264 int htmltype;
01265 YYSTYPE const * const htmlvaluep;
01266 #endif
01267 {
01268 if (htmltype < YYNTOKENS)
01269 YYFPRINTF (htmloutput, "token %s (", htmltname[htmltype]);
01270 else
01271 YYFPRINTF (htmloutput, "nterm %s (", htmltname[htmltype]);
01272
01273 html_symbol_value_print (htmloutput, htmltype, htmlvaluep);
01274 YYFPRINTF (htmloutput, ")");
01275 }
01276
01277
01278
01279
01280
01281
01282 #if (defined __STDC__ || defined __C99__FUNC__ \
01283 || defined __cplusplus || defined _MSC_VER)
01284 static void
01285 html_stack_print (htmltype_int16 *bottom, htmltype_int16 *top)
01286 #else
01287 static void
01288 html_stack_print (bottom, top)
01289 htmltype_int16 *bottom;
01290 htmltype_int16 *top;
01291 #endif
01292 {
01293 YYFPRINTF (stderr, "Stack now");
01294 for (; bottom <= top; ++bottom)
01295 YYFPRINTF (stderr, " %d", *bottom);
01296 YYFPRINTF (stderr, "\n");
01297 }
01298
01299 # define YY_STACK_PRINT(Bottom, Top) \
01300 do { \
01301 if (htmldebug) \
01302 html_stack_print ((Bottom), (Top)); \
01303 } while (YYID (0))
01304
01305
01306
01307
01308
01309
01310 #if (defined __STDC__ || defined __C99__FUNC__ \
01311 || defined __cplusplus || defined _MSC_VER)
01312 static void
01313 html_reduce_print (YYSTYPE *htmlvsp, int htmlrule)
01314 #else
01315 static void
01316 html_reduce_print (htmlvsp, htmlrule)
01317 YYSTYPE *htmlvsp;
01318 int htmlrule;
01319 #endif
01320 {
01321 int htmlnrhs = htmlr2[htmlrule];
01322 int htmli;
01323 unsigned long int htmllno = htmlrline[htmlrule];
01324 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
01325 htmlrule - 1, htmllno);
01326
01327 for (htmli = 0; htmli < htmlnrhs; htmli++)
01328 {
01329 fprintf (stderr, " $%d = ", htmli + 1);
01330 html_symbol_print (stderr, htmlrhs[htmlprhs[htmlrule] + htmli],
01331 &(htmlvsp[(htmli + 1) - (htmlnrhs)])
01332 );
01333 fprintf (stderr, "\n");
01334 }
01335 }
01336
01337 # define YY_REDUCE_PRINT(Rule) \
01338 do { \
01339 if (htmldebug) \
01340 html_reduce_print (htmlvsp, Rule); \
01341 } while (YYID (0))
01342
01343
01344
01345 int htmldebug;
01346 #else
01347 # define YYDPRINTF(Args)
01348 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
01349 # define YY_STACK_PRINT(Bottom, Top)
01350 # define YY_REDUCE_PRINT(Rule)
01351 #endif
01352
01353
01354
01355 #ifndef YYINITDEPTH
01356 # define YYINITDEPTH 200
01357 #endif
01358
01359
01360
01361
01362
01363
01364
01365
01366 #ifndef YYMAXDEPTH
01367 # define YYMAXDEPTH 10000
01368 #endif
01369
01370
01371
01372 #if YYERROR_VERBOSE
01373
01374 # ifndef htmlstrlen
01375 # if defined __GLIBC__ && defined _STRING_H
01376 # define htmlstrlen strlen
01377 # else
01378
01379 #if (defined __STDC__ || defined __C99__FUNC__ \
01380 || defined __cplusplus || defined _MSC_VER)
01381 static YYSIZE_T
01382 htmlstrlen (const char *htmlstr)
01383 #else
01384 static YYSIZE_T
01385 htmlstrlen (htmlstr)
01386 const char *htmlstr;
01387 #endif
01388 {
01389 YYSIZE_T htmllen;
01390 for (htmllen = 0; htmlstr[htmllen]; htmllen++)
01391 continue;
01392 return htmllen;
01393 }
01394 # endif
01395 # endif
01396
01397 # ifndef htmlstpcpy
01398 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
01399 # define htmlstpcpy stpcpy
01400 # else
01401
01402
01403 #if (defined __STDC__ || defined __C99__FUNC__ \
01404 || defined __cplusplus || defined _MSC_VER)
01405 static char *
01406 htmlstpcpy (char *htmldest, const char *htmlsrc)
01407 #else
01408 static char *
01409 htmlstpcpy (htmldest, htmlsrc)
01410 char *htmldest;
01411 const char *htmlsrc;
01412 #endif
01413 {
01414 char *htmld = htmldest;
01415 const char *htmls = htmlsrc;
01416
01417 while ((*htmld++ = *htmls++) != '\0')
01418 continue;
01419
01420 return htmld - 1;
01421 }
01422 # endif
01423 # endif
01424
01425 # ifndef htmltnamerr
01426
01427
01428
01429
01430
01431
01432
01433 static YYSIZE_T
01434 htmltnamerr (char *htmlres, const char *htmlstr)
01435 {
01436 if (*htmlstr == '"')
01437 {
01438 YYSIZE_T htmln = 0;
01439 char const *htmlp = htmlstr;
01440
01441 for (;;)
01442 switch (*++htmlp)
01443 {
01444 case '\'':
01445 case ',':
01446 goto do_not_strip_quotes;
01447
01448 case '\\':
01449 if (*++htmlp != '\\')
01450 goto do_not_strip_quotes;
01451
01452 default:
01453 if (htmlres)
01454 htmlres[htmln] = *htmlp;
01455 htmln++;
01456 break;
01457
01458 case '"':
01459 if (htmlres)
01460 htmlres[htmln] = '\0';
01461 return htmln;
01462 }
01463 do_not_strip_quotes: ;
01464 }
01465
01466 if (! htmlres)
01467 return htmlstrlen (htmlstr);
01468
01469 return htmlstpcpy (htmlres, htmlstr) - htmlres;
01470 }
01471 # endif
01472
01473
01474
01475
01476
01477
01478
01479
01480 static YYSIZE_T
01481 htmlsyntax_error (char *htmlresult, int htmlstate, int htmlchar)
01482 {
01483 int htmln = htmlpact[htmlstate];
01484
01485 if (! (YYPACT_NINF < htmln && htmln <= YYLAST))
01486 return 0;
01487 else
01488 {
01489 int htmltype = YYTRANSLATE (htmlchar);
01490 YYSIZE_T htmlsize0 = htmltnamerr (0, htmltname[htmltype]);
01491 YYSIZE_T htmlsize = htmlsize0;
01492 YYSIZE_T htmlsize1;
01493 int htmlsize_overflow = 0;
01494 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01495 char const *htmlarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01496 int htmlx;
01497
01498 # if 0
01499
01500
01501 YY_("syntax error, unexpected %s");
01502 YY_("syntax error, unexpected %s, expecting %s");
01503 YY_("syntax error, unexpected %s, expecting %s or %s");
01504 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01505 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01506 # endif
01507 char *htmlfmt;
01508 char const *htmlf;
01509 static char const htmlunexpected[] = "syntax error, unexpected %s";
01510 static char const htmlexpecting[] = ", expecting %s";
01511 static char const htmlor[] = " or %s";
01512 char htmlformat[sizeof htmlunexpected
01513 + sizeof htmlexpecting - 1
01514 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01515 * (sizeof htmlor - 1))];
01516 char const *htmlprefix = htmlexpecting;
01517
01518
01519
01520 int htmlxbegin = htmln < 0 ? -htmln : 0;
01521
01522
01523 int htmlchecklim = YYLAST - htmln + 1;
01524 int htmlxend = htmlchecklim < YYNTOKENS ? htmlchecklim : YYNTOKENS;
01525 int htmlcount = 1;
01526
01527 htmlarg[0] = htmltname[htmltype];
01528 htmlfmt = htmlstpcpy (htmlformat, htmlunexpected);
01529
01530 for (htmlx = htmlxbegin; htmlx < htmlxend; ++htmlx)
01531 if (htmlcheck[htmlx + htmln] == htmlx && htmlx != YYTERROR)
01532 {
01533 if (htmlcount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01534 {
01535 htmlcount = 1;
01536 htmlsize = htmlsize0;
01537 htmlformat[sizeof htmlunexpected - 1] = '\0';
01538 break;
01539 }
01540 htmlarg[htmlcount++] = htmltname[htmlx];
01541 htmlsize1 = htmlsize + htmltnamerr (0, htmltname[htmlx]);
01542 htmlsize_overflow |= (htmlsize1 < htmlsize);
01543 htmlsize = htmlsize1;
01544 htmlfmt = htmlstpcpy (htmlfmt, htmlprefix);
01545 htmlprefix = htmlor;
01546 }
01547
01548 htmlf = YY_(htmlformat);
01549 htmlsize1 = htmlsize + htmlstrlen (htmlf);
01550 htmlsize_overflow |= (htmlsize1 < htmlsize);
01551 htmlsize = htmlsize1;
01552
01553 if (htmlsize_overflow)
01554 return YYSIZE_MAXIMUM;
01555
01556 if (htmlresult)
01557 {
01558
01559
01560
01561 char *htmlp = htmlresult;
01562 int htmli = 0;
01563 while ((*htmlp = *htmlf) != '\0')
01564 {
01565 if (*htmlp == '%' && htmlf[1] == 's' && htmli < htmlcount)
01566 {
01567 htmlp += htmltnamerr (htmlp, htmlarg[htmli++]);
01568 htmlf += 2;
01569 }
01570 else
01571 {
01572 htmlp++;
01573 htmlf++;
01574 }
01575 }
01576 }
01577 return htmlsize;
01578 }
01579 }
01580 #endif
01581
01582
01583
01584
01585
01586
01587
01588 #if (defined __STDC__ || defined __C99__FUNC__ \
01589 || defined __cplusplus || defined _MSC_VER)
01590 static void
01591 htmldestruct (const char *htmlmsg, int htmltype, YYSTYPE *htmlvaluep)
01592 #else
01593 static void
01594 htmldestruct (htmlmsg, htmltype, htmlvaluep)
01595 const char *htmlmsg;
01596 int htmltype;
01597 YYSTYPE *htmlvaluep;
01598 #endif
01599 {
01600 YYUSE (htmlvaluep);
01601
01602 if (!htmlmsg)
01603 htmlmsg = "Deleting";
01604 YY_SYMBOL_PRINT (htmlmsg, htmltype, htmlvaluep, htmllocationp);
01605
01606 switch (htmltype)
01607 {
01608
01609 default:
01610 break;
01611 }
01612 }
01613
01614
01615
01616
01617 #ifdef YYPARSE_PARAM
01618 #if defined __STDC__ || defined __cplusplus
01619 int htmlparse (void *YYPARSE_PARAM);
01620 #else
01621 int htmlparse ();
01622 #endif
01623 #else
01624 #if defined __STDC__ || defined __cplusplus
01625 int htmlparse (void);
01626 #else
01627 int htmlparse ();
01628 #endif
01629 #endif
01630
01631
01632
01633
01634 int htmlchar;
01635
01636
01637 YYSTYPE htmllval;
01638
01639
01640 int htmlnerrs;
01641
01642
01643
01644
01645
01646
01647
01648 #ifdef YYPARSE_PARAM
01649 #if (defined __STDC__ || defined __C99__FUNC__ \
01650 || defined __cplusplus || defined _MSC_VER)
01651 int
01652 htmlparse (void *YYPARSE_PARAM)
01653 #else
01654 int
01655 htmlparse (YYPARSE_PARAM)
01656 void *YYPARSE_PARAM;
01657 #endif
01658 #else
01659 #if (defined __STDC__ || defined __C99__FUNC__ \
01660 || defined __cplusplus || defined _MSC_VER)
01661 int
01662 htmlparse (void)
01663 #else
01664 int
01665 htmlparse ()
01666
01667 #endif
01668 #endif
01669 {
01670
01671 int htmlstate;
01672 int htmln;
01673 int htmlresult;
01674
01675 int htmlerrstatus;
01676
01677 int htmltoken = 0;
01678 #if YYERROR_VERBOSE
01679
01680 char htmlmsgbuf[128];
01681 char *htmlmsg = htmlmsgbuf;
01682 YYSIZE_T htmlmsg_alloc = sizeof htmlmsgbuf;
01683 #endif
01684
01685
01686
01687
01688
01689
01690
01691
01692
01693
01694 htmltype_int16 htmlssa[YYINITDEPTH];
01695 htmltype_int16 *htmlss = htmlssa;
01696 htmltype_int16 *htmlssp;
01697
01698
01699 YYSTYPE htmlvsa[YYINITDEPTH];
01700 YYSTYPE *htmlvs = htmlvsa;
01701 YYSTYPE *htmlvsp;
01702
01703
01704
01705 #define YYPOPSTACK(N) (htmlvsp -= (N), htmlssp -= (N))
01706
01707 YYSIZE_T htmlstacksize = YYINITDEPTH;
01708
01709
01710
01711 YYSTYPE htmlval;
01712
01713
01714
01715
01716 int htmllen = 0;
01717
01718 YYDPRINTF ((stderr, "Starting parse\n"));
01719
01720 htmlstate = 0;
01721 htmlerrstatus = 0;
01722 htmlnerrs = 0;
01723 htmlchar = YYEMPTY;
01724
01725
01726
01727
01728
01729
01730 htmlssp = htmlss;
01731 htmlvsp = htmlvs;
01732
01733 goto htmlsetstate;
01734
01735
01736
01737
01738 htmlnewstate:
01739
01740
01741 htmlssp++;
01742
01743 htmlsetstate:
01744 *htmlssp = htmlstate;
01745
01746 if (htmlss + htmlstacksize - 1 <= htmlssp)
01747 {
01748
01749 YYSIZE_T htmlsize = htmlssp - htmlss + 1;
01750
01751 #ifdef htmloverflow
01752 {
01753
01754
01755
01756 YYSTYPE *htmlvs1 = htmlvs;
01757 htmltype_int16 *htmlss1 = htmlss;
01758
01759
01760
01761
01762
01763
01764 htmloverflow (YY_("memory exhausted"),
01765 &htmlss1, htmlsize * sizeof (*htmlssp),
01766 &htmlvs1, htmlsize * sizeof (*htmlvsp),
01767
01768 &htmlstacksize);
01769
01770 htmlss = htmlss1;
01771 htmlvs = htmlvs1;
01772 }
01773 #else
01774 # ifndef YYSTACK_RELOCATE
01775 goto htmlexhaustedlab;
01776 # else
01777
01778 if (YYMAXDEPTH <= htmlstacksize)
01779 goto htmlexhaustedlab;
01780 htmlstacksize *= 2;
01781 if (YYMAXDEPTH < htmlstacksize)
01782 htmlstacksize = YYMAXDEPTH;
01783
01784 {
01785 htmltype_int16 *htmlss1 = htmlss;
01786 union htmlalloc *htmlptr =
01787 (union htmlalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (htmlstacksize));
01788 if (! htmlptr)
01789 goto htmlexhaustedlab;
01790 YYSTACK_RELOCATE (htmlss);
01791 YYSTACK_RELOCATE (htmlvs);
01792
01793 # undef YYSTACK_RELOCATE
01794 if (htmlss1 != htmlssa)
01795 YYSTACK_FREE (htmlss1);
01796 }
01797 # endif
01798 #endif
01799
01800 htmlssp = htmlss + htmlsize - 1;
01801 htmlvsp = htmlvs + htmlsize - 1;
01802
01803
01804 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01805 (unsigned long int) htmlstacksize));
01806
01807 if (htmlss + htmlstacksize - 1 <= htmlssp)
01808 YYABORT;
01809 }
01810
01811 YYDPRINTF ((stderr, "Entering state %d\n", htmlstate));
01812
01813 goto htmlbackup;
01814
01815
01816
01817
01818 htmlbackup:
01819
01820
01821
01822
01823
01824 htmln = htmlpact[htmlstate];
01825 if (htmln == YYPACT_NINF)
01826 goto htmldefault;
01827
01828
01829
01830
01831 if (htmlchar == YYEMPTY)
01832 {
01833 YYDPRINTF ((stderr, "Reading a token: "));
01834 htmlchar = YYLEX;
01835 }
01836
01837 if (htmlchar <= YYEOF)
01838 {
01839 htmlchar = htmltoken = YYEOF;
01840 YYDPRINTF ((stderr, "Now at end of input.\n"));
01841 }
01842 else
01843 {
01844 htmltoken = YYTRANSLATE (htmlchar);
01845 YY_SYMBOL_PRINT ("Next token is", htmltoken, &htmllval, &htmllloc);
01846 }
01847
01848
01849
01850 htmln += htmltoken;
01851 if (htmln < 0 || YYLAST < htmln || htmlcheck[htmln] != htmltoken)
01852 goto htmldefault;
01853 htmln = htmltable[htmln];
01854 if (htmln <= 0)
01855 {
01856 if (htmln == 0 || htmln == YYTABLE_NINF)
01857 goto htmlerrlab;
01858 htmln = -htmln;
01859 goto htmlreduce;
01860 }
01861
01862 if (htmln == YYFINAL)
01863 YYACCEPT;
01864
01865
01866
01867 if (htmlerrstatus)
01868 htmlerrstatus--;
01869
01870
01871 YY_SYMBOL_PRINT ("Shifting", htmltoken, &htmllval, &htmllloc);
01872
01873
01874 if (htmlchar != YYEOF)
01875 htmlchar = YYEMPTY;
01876
01877 htmlstate = htmln;
01878 *++htmlvsp = htmllval;
01879
01880 goto htmlnewstate;
01881
01882
01883
01884
01885
01886 htmldefault:
01887 htmln = htmldefact[htmlstate];
01888 if (htmln == 0)
01889 goto htmlerrlab;
01890 goto htmlreduce;
01891
01892
01893
01894
01895
01896 htmlreduce:
01897
01898 htmllen = htmlr2[htmln];
01899
01900
01901
01902
01903
01904
01905
01906
01907
01908 htmlval = htmlvsp[1-htmllen];
01909
01910
01911 YY_REDUCE_PRINT (htmln);
01912 switch (htmln)
01913 {
01914 case 2:
01915 #line 561 "../../lib/common/htmlparse.y"
01916 { HTMLstate.lbl = mkLabel((htmlvsp[(2) - (3)].txt),HTML_TEXT); }
01917 break;
01918
01919 case 3:
01920 #line 562 "../../lib/common/htmlparse.y"
01921 { HTMLstate.lbl = mkLabel((htmlvsp[(2) - (3)].tbl),HTML_TBL); }
01922 break;
01923
01924 case 4:
01925 #line 563 "../../lib/common/htmlparse.y"
01926 { cleanup(); YYABORT; }
01927 break;
01928
01929 case 5:
01930 #line 566 "../../lib/common/htmlparse.y"
01931 { (htmlval.txt) = mkText(); }
01932 break;
01933
01934 case 8:
01935 #line 573 "../../lib/common/htmlparse.y"
01936 { appendFItemList(HTMLstate.str);}
01937 break;
01938
01939 case 9:
01940 #line 574 "../../lib/common/htmlparse.y"
01941 {appendFLineList((htmlvsp[(1) - (1)].i));}
01942 break;
01943
01944 case 11:
01945 #line 578 "../../lib/common/htmlparse.y"
01946 { pushFont ((htmlvsp[(1) - (1)].font)); }
01947 break;
01948
01949 case 12:
01950 #line 581 "../../lib/common/htmlparse.y"
01951 { popFont (); }
01952 break;
01953
01954 case 13:
01955 #line 584 "../../lib/common/htmlparse.y"
01956 { (htmlval.i) = (htmlvsp[(1) - (2)].i); }
01957 break;
01958
01959 case 14:
01960 #line 585 "../../lib/common/htmlparse.y"
01961 { (htmlval.i) = (htmlvsp[(1) - (1)].i); }
01962 break;
01963
01964 case 17:
01965 #line 592 "../../lib/common/htmlparse.y"
01966 {
01967 if (nonSpace(agxbuse(HTMLstate.str))) {
01968 htmlerror ("Syntax error: non-space string used before <TABLE>");
01969 cleanup(); YYABORT;
01970 }
01971 (htmlvsp[(2) - (2)].tbl)->u.p.prev = HTMLstate.tblstack;
01972 (htmlvsp[(2) - (2)].tbl)->u.p.rows = dtopen(&rowDisc, Dtqueue);
01973 HTMLstate.tblstack = (htmlvsp[(2) - (2)].tbl);
01974 (htmlvsp[(2) - (2)].tbl)->font = dupFont (HTMLstate.fontstack->cfont);
01975 (htmlval.tbl) = (htmlvsp[(2) - (2)].tbl);
01976 }
01977 break;
01978
01979 case 18:
01980 #line 603 "../../lib/common/htmlparse.y"
01981 {
01982 if (nonSpace(agxbuse(HTMLstate.str))) {
01983 htmlerror ("Syntax error: non-space string used after </TABLE>");
01984 cleanup(); YYABORT;
01985 }
01986 (htmlval.tbl) = HTMLstate.tblstack;
01987 HTMLstate.tblstack = HTMLstate.tblstack->u.p.prev;
01988 }
01989 break;
01990
01991 case 19:
01992 #line 613 "../../lib/common/htmlparse.y"
01993 { (htmlval.tbl) = (htmlvsp[(1) - (1)].tbl); }
01994 break;
01995
01996 case 20:
01997 #line 614 "../../lib/common/htmlparse.y"
01998 { (htmlval.tbl)=(htmlvsp[(2) - (3)].tbl); }
01999 break;
02000
02001 case 25:
02002 #line 625 "../../lib/common/htmlparse.y"
02003 { addRow (); }
02004 break;
02005
02006 case 29:
02007 #line 632 "../../lib/common/htmlparse.y"
02008 { setCell((htmlvsp[(1) - (2)].cell),(htmlvsp[(2) - (2)].tbl),HTML_TBL); }
02009 break;
02010
02011 case 31:
02012 #line 633 "../../lib/common/htmlparse.y"
02013 { setCell((htmlvsp[(1) - (2)].cell),(htmlvsp[(2) - (2)].txt),HTML_TEXT); }
02014 break;
02015
02016 case 33:
02017 #line 634 "../../lib/common/htmlparse.y"
02018 { setCell((htmlvsp[(1) - (2)].cell),(htmlvsp[(2) - (2)].img),HTML_IMAGE); }
02019 break;
02020
02021 case 35:
02022 #line 635 "../../lib/common/htmlparse.y"
02023 { setCell((htmlvsp[(1) - (1)].cell),mkText(),HTML_TEXT); }
02024 break;
02025
02026 case 37:
02027 #line 638 "../../lib/common/htmlparse.y"
02028 { (htmlval.img) = (htmlvsp[(1) - (2)].img); }
02029 break;
02030
02031 case 38:
02032 #line 639 "../../lib/common/htmlparse.y"
02033 { (htmlval.img) = (htmlvsp[(1) - (1)].img); }
02034 break;
02035
02036
02037
02038 #line 2039 "y.tab.c"
02039 default: break;
02040 }
02041 YY_SYMBOL_PRINT ("-> $$ =", htmlr1[htmln], &htmlval, &htmlloc);
02042
02043 YYPOPSTACK (htmllen);
02044 htmllen = 0;
02045 YY_STACK_PRINT (htmlss, htmlssp);
02046
02047 *++htmlvsp = htmlval;
02048
02049
02050
02051
02052
02053
02054 htmln = htmlr1[htmln];
02055
02056 htmlstate = htmlpgoto[htmln - YYNTOKENS] + *htmlssp;
02057 if (0 <= htmlstate && htmlstate <= YYLAST && htmlcheck[htmlstate] == *htmlssp)
02058 htmlstate = htmltable[htmlstate];
02059 else
02060 htmlstate = htmldefgoto[htmln - YYNTOKENS];
02061
02062 goto htmlnewstate;
02063
02064
02065
02066
02067
02068 htmlerrlab:
02069
02070 if (!htmlerrstatus)
02071 {
02072 ++htmlnerrs;
02073 #if ! YYERROR_VERBOSE
02074 htmlerror (YY_("syntax error"));
02075 #else
02076 {
02077 YYSIZE_T htmlsize = htmlsyntax_error (0, htmlstate, htmlchar);
02078 if (htmlmsg_alloc < htmlsize && htmlmsg_alloc < YYSTACK_ALLOC_MAXIMUM)
02079 {
02080 YYSIZE_T htmlalloc = 2 * htmlsize;
02081 if (! (htmlsize <= htmlalloc && htmlalloc <= YYSTACK_ALLOC_MAXIMUM))
02082 htmlalloc = YYSTACK_ALLOC_MAXIMUM;
02083 if (htmlmsg != htmlmsgbuf)
02084 YYSTACK_FREE (htmlmsg);
02085 htmlmsg = (char *) YYSTACK_ALLOC (htmlalloc);
02086 if (htmlmsg)
02087 htmlmsg_alloc = htmlalloc;
02088 else
02089 {
02090 htmlmsg = htmlmsgbuf;
02091 htmlmsg_alloc = sizeof htmlmsgbuf;
02092 }
02093 }
02094
02095 if (0 < htmlsize && htmlsize <= htmlmsg_alloc)
02096 {
02097 (void) htmlsyntax_error (htmlmsg, htmlstate, htmlchar);
02098 htmlerror (htmlmsg);
02099 }
02100 else
02101 {
02102 htmlerror (YY_("syntax error"));
02103 if (htmlsize != 0)
02104 goto htmlexhaustedlab;
02105 }
02106 }
02107 #endif
02108 }
02109
02110
02111
02112 if (htmlerrstatus == 3)
02113 {
02114
02115
02116
02117 if (htmlchar <= YYEOF)
02118 {
02119
02120 if (htmlchar == YYEOF)
02121 YYABORT;
02122 }
02123 else
02124 {
02125 htmldestruct ("Error: discarding",
02126 htmltoken, &htmllval);
02127 htmlchar = YYEMPTY;
02128 }
02129 }
02130
02131
02132
02133 goto htmlerrlab1;
02134
02135
02136
02137
02138
02139 htmlerrorlab:
02140
02141
02142
02143
02144 if ( 0)
02145 goto htmlerrorlab;
02146
02147
02148
02149 YYPOPSTACK (htmllen);
02150 htmllen = 0;
02151 YY_STACK_PRINT (htmlss, htmlssp);
02152 htmlstate = *htmlssp;
02153 goto htmlerrlab1;
02154
02155
02156
02157
02158
02159 htmlerrlab1:
02160 htmlerrstatus = 3;
02161
02162 for (;;)
02163 {
02164 htmln = htmlpact[htmlstate];
02165 if (htmln != YYPACT_NINF)
02166 {
02167 htmln += YYTERROR;
02168 if (0 <= htmln && htmln <= YYLAST && htmlcheck[htmln] == YYTERROR)
02169 {
02170 htmln = htmltable[htmln];
02171 if (0 < htmln)
02172 break;
02173 }
02174 }
02175
02176
02177 if (htmlssp == htmlss)
02178 YYABORT;
02179
02180
02181 htmldestruct ("Error: popping",
02182 htmlstos[htmlstate], htmlvsp);
02183 YYPOPSTACK (1);
02184 htmlstate = *htmlssp;
02185 YY_STACK_PRINT (htmlss, htmlssp);
02186 }
02187
02188 if (htmln == YYFINAL)
02189 YYACCEPT;
02190
02191 *++htmlvsp = htmllval;
02192
02193
02194
02195 YY_SYMBOL_PRINT ("Shifting", htmlstos[htmln], htmlvsp, htmllsp);
02196
02197 htmlstate = htmln;
02198 goto htmlnewstate;
02199
02200
02201
02202
02203
02204 htmlacceptlab:
02205 htmlresult = 0;
02206 goto htmlreturn;
02207
02208
02209
02210
02211 htmlabortlab:
02212 htmlresult = 1;
02213 goto htmlreturn;
02214
02215 #ifndef htmloverflow
02216
02217
02218
02219 htmlexhaustedlab:
02220 htmlerror (YY_("memory exhausted"));
02221 htmlresult = 2;
02222
02223 #endif
02224
02225 htmlreturn:
02226 if (htmlchar != YYEOF && htmlchar != YYEMPTY)
02227 htmldestruct ("Cleanup: discarding lookahead",
02228 htmltoken, &htmllval);
02229
02230
02231 YYPOPSTACK (htmllen);
02232 YY_STACK_PRINT (htmlss, htmlssp);
02233 while (htmlssp != htmlss)
02234 {
02235 htmldestruct ("Cleanup: popping",
02236 htmlstos[*htmlssp], htmlvsp);
02237 YYPOPSTACK (1);
02238 }
02239 #ifndef htmloverflow
02240 if (htmlss != htmlssa)
02241 YYSTACK_FREE (htmlss);
02242 #endif
02243 #if YYERROR_VERBOSE
02244 if (htmlmsg != htmlmsgbuf)
02245 YYSTACK_FREE (htmlmsg);
02246 #endif
02247
02248 return YYID (htmlresult);
02249 }
02250
02251
02252 #line 642 "../../lib/common/htmlparse.y"
02253
02254
02255 #ifdef OLD
02256 htmllabel_t*
02257 simpleHTML (char* txt)
02258 {
02259 htmltxt_t* tobj = mkText (txt);
02260 htmllabel_t* l = mkLabel(tobj,HTML_TEXT);
02261 return l;
02262 }
02263 #endif
02264
02265
02266
02267
02268
02269 htmllabel_t*
02270 parseHTML (char* txt, int* warn, int charset)
02271 {
02272 unsigned char buf[SMALLBUF];
02273 agxbuf str;
02274 htmllabel_t* l;
02275 sfont_t dfltf;
02276
02277 dfltf.cfont = NULL;
02278 dfltf.pfont = NULL;
02279 HTMLstate.fontstack = &dfltf;
02280 HTMLstate.tblstack = 0;
02281 HTMLstate.lbl = 0;
02282 HTMLstate.fitemList = dtopen(&fstrDisc, Dtqueue);
02283 HTMLstate.fparaList = dtopen(&fparaDisc, Dtqueue);
02284
02285 agxbinit (&str, SMALLBUF, buf);
02286 HTMLstate.str = &str;
02287
02288 if (initHTMLlexer (txt, &str, charset)) {
02289 *warn = 2;
02290 l = NULL;
02291 }
02292 else {
02293 htmlparse();
02294 *warn = clearHTMLlexer ();
02295 l = HTMLstate.lbl;
02296 }
02297
02298 dtclose (HTMLstate.fitemList);
02299 dtclose (HTMLstate.fparaList);
02300
02301 HTMLstate.fitemList = NULL;
02302 HTMLstate.fparaList = NULL;
02303 HTMLstate.fontstack = NULL;
02304
02305 agxbfree (&str);
02306
02307 return l;
02308 }
02309
02310