~ubuntu-branches/ubuntu/lucid/swftools/lucid

« back to all changes in this revision

Viewing changes to src/parser.yy.c

  • Committer: Bazaar Package Importer
  • Author(s): Fabrice Coutadeur
  • Date: 2009-04-30 05:22:19 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090430052219-l1n64qofzeq5pej8
Tags: 0.9.0-0ubuntu1
* New upstream release (LP: #369931)
  - patches/01_manpages: edited to match updated version of src/pdf2swf.1 and
    src/wav2swf.1
  - patches/02_faq: edited to match updated version of FAQ
  - patches/04_makefile: edited to delete the patch on lib/Makefile.in and 
    src/Makefile.in (applied upstream)
  - deleted patch 99_configure_for_python2.5_and_2.6 (applied upstream)
  - debian/swftools.doc: deleted installation of TODO and 
    pdf2swf/HOWTO_pdf2swf as they don't exist anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
#define FLEX_SCANNER
10
10
#define YY_FLEX_MAJOR_VERSION 2
11
11
#define YY_FLEX_MINOR_VERSION 5
12
 
#define YY_FLEX_SUBMINOR_VERSION 33
 
12
#define YY_FLEX_SUBMINOR_VERSION 35
13
13
#if YY_FLEX_SUBMINOR_VERSION > 0
14
14
#define FLEX_BETA
15
15
#endif
31
31
 
32
32
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33
33
 
34
 
#if __STDC_VERSION__ >= 199901L
 
34
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35
35
 
36
36
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37
37
 * if you want the limit (max/min) macros for int types. 
94
94
 
95
95
#else   /* ! __cplusplus */
96
96
 
97
 
#if __STDC__
 
97
/* C99 requires __STDC__ to be defined as 1. */
 
98
#if defined (__STDC__)
98
99
 
99
100
#define YY_USE_CONST
100
101
 
101
 
#endif  /* __STDC__ */
 
102
#endif  /* defined (__STDC__) */
102
103
#endif  /* ! __cplusplus */
103
104
 
104
105
#ifdef YY_USE_CONST
178
179
 
179
180
#define unput(c) yyunput( c, (yytext_ptr)  )
180
181
 
181
 
/* The following is because we cannot portably get our hands on size_t
182
 
 * (without autoconf's help, which isn't available because we want
183
 
 * flex-generated scanners to compile on their own).
184
 
 */
185
 
 
186
182
#ifndef YY_TYPEDEF_YY_SIZE_T
187
183
#define YY_TYPEDEF_YY_SIZE_T
188
 
typedef unsigned int yy_size_t;
 
184
typedef size_t yy_size_t;
189
185
#endif
190
186
 
191
187
#ifndef YY_STRUCT_YY_BUFFER_STATE
586
582
#include <stdio.h>
587
583
#include "../lib/q.h"
588
584
#include "parser.h"
 
585
#include "../lib/utf8.h"
589
586
 
590
587
//RVALUE         {NUMBER}|{PERCENT}|{NAME}|\"{STRING}\"|{DIM}
591
588
//<a>.                {printf("<a>%s\n", yytext);}
612
609
 
613
610
static char*prefix = 0;
614
611
 
615
 
static char utf8buf[16];
616
 
static char* getUTF8(unsigned int charnum)
617
 
{
618
 
    memset(utf8buf, 0, sizeof(utf8buf));
619
 
 
620
 
    if(charnum < 0x80) {
621
 
        utf8buf[0] = charnum;
622
 
        return utf8buf;
623
 
    } else if(charnum <0x800) {
624
 
        /* 0000 0080-0000 07FF   110xxxxx 10xxxxxx */
625
 
        utf8buf[0] = 0xc0 | (charnum >> 6);
626
 
        utf8buf[1] = 0x80 | (charnum & 0x3f);
627
 
        return utf8buf;
628
 
    } else if(charnum < 0x10000) {
629
 
        /* 0000 0800-0000 FFFF   1110xxxx 10xxxxxx 10xxxxxx */
630
 
        utf8buf[0] = 0xe0 | (charnum >> 12);
631
 
        utf8buf[1] = 0x80 |((charnum >> 6)&0x3f);
632
 
        utf8buf[2] = 0x80 |((charnum     )&0x3f);
633
 
        return utf8buf;
634
 
    } else if(charnum < 0x200000) {
635
 
        /* 0001 0000-001F FFFF   11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
636
 
        utf8buf[0] = 0xf0 | (charnum >> 18);
637
 
        utf8buf[1] = 0x80 |((charnum >> 12)&0x3f);
638
 
        utf8buf[2] = 0x80 |((charnum >> 6 )&0x3f);
639
 
        utf8buf[3] = 0x80 |((charnum      )&0x3f);
640
 
        return utf8buf;
641
 
    } else if(charnum < 0x4000000) {
642
 
        /* 0020 0000-03FF FFFF   111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
643
 
        utf8buf[0] = 0xf8 | (charnum >> 24);
644
 
        utf8buf[1] = 0x80 |((charnum >> 18)&0x3f);
645
 
        utf8buf[2] = 0x80 |((charnum >> 12)&0x3f);
646
 
        utf8buf[3] = 0x80 |((charnum >> 6 )&0x3f);
647
 
        utf8buf[4] = 0x80 |((charnum      )&0x3f);
648
 
        return utf8buf;
649
 
    } else if(charnum < 0x80000000) {
650
 
        /* 0400 0000-7FFF FFFF   1111110x 10xxxxxx ... 10xxxxxx */
651
 
        utf8buf[0] = 0xfc | (charnum >> 30);
652
 
        utf8buf[1] = 0x80 |((charnum >> 24)&0x3f);
653
 
        utf8buf[2] = 0x80 |((charnum >> 18)&0x3f);
654
 
        utf8buf[3] = 0x80 |((charnum >> 12)&0x3f);
655
 
        utf8buf[4] = 0x80 |((charnum >> 6 )&0x3f);
656
 
        utf8buf[5] = 0x80 |((charnum      )&0x3f);
657
 
        return utf8buf;
658
 
    } else {
659
 
        fprintf(stderr, "Illegal character: 0x%08x\n", charnum);
660
 
        return utf8buf;
661
 
    }
662
 
}
663
 
 
664
612
static void unescapeString(string_t * tmp)
665
613
{
666
614
    char *p, *p1;
667
615
    /* fixme - this routine expects the string to be
668
616
       null-terminated */
669
617
 
670
 
    for (p1=tmp->str; (p=strchr(p1, '\\')); p1 = p+1) 
 
618
    for (p1=(char*)tmp->str; (p=strchr(p1, '\\')); p1 = p+1) 
671
619
    {
672
620
        int nr=2;
673
621
        int new=1;
786
734
}
787
735
 
788
736
#define MAX_INCLUDE_DEPTH 16
789
 
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
790
 
int line_stack[MAX_INCLUDE_DEPTH];
791
 
int column_stack[MAX_INCLUDE_DEPTH];
792
 
int include_stack_ptr = 0;
 
737
static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
 
738
static int line_stack[MAX_INCLUDE_DEPTH];
 
739
static int column_stack[MAX_INCLUDE_DEPTH];
 
740
static int include_stack_ptr = 0;
793
741
 
794
 
void handleInclude(char*text, int len)
 
742
static void handleInclude(char*text, int len)
795
743
{
796
744
    text+=9;len-=9;
797
745
    while(len >=1 && (text[0] == ' ' || text[0] == '\t')) {
798
746
        text++;len--;
799
747
    }
800
 
    while(len >= 1 && (text[len-1] == ' ' || text[len-1] == '\n')) {
 
748
    while(len >= 1 && 
 
749
          (text[len-1] == ' ' || 
 
750
           text[len-1] == '\r' || 
 
751
           text[len-1] == '\n')) {
801
752
        len--;
802
753
    }
803
754
    if(len >= 2 && text[0] == '"' && text[len-1] == '"') {
831
782
#define s(type) {store(type, line, column, yytext, yyleng);}
832
783
 
833
784
 
834
 
#line 835 "parser.yy.c"
 
785
#line 786 "parser.yy.c"
835
786
 
836
787
#define INITIAL 0
837
788
#define R 1
851
802
 
852
803
static int yy_init_globals (void );
853
804
 
 
805
/* Accessor methods to globals.
 
806
   These are made visible to non-reentrant scanners for convenience. */
 
807
 
 
808
int yylex_destroy (void );
 
809
 
 
810
int yyget_debug (void );
 
811
 
 
812
void yyset_debug (int debug_flag  );
 
813
 
 
814
YY_EXTRA_TYPE yyget_extra (void );
 
815
 
 
816
void yyset_extra (YY_EXTRA_TYPE user_defined  );
 
817
 
 
818
FILE *yyget_in (void );
 
819
 
 
820
void yyset_in  (FILE * in_str  );
 
821
 
 
822
FILE *yyget_out (void );
 
823
 
 
824
void yyset_out  (FILE * out_str  );
 
825
 
 
826
int yyget_leng (void );
 
827
 
 
828
char *yyget_text (void );
 
829
 
 
830
int yyget_lineno (void );
 
831
 
 
832
void yyset_lineno (int line_number  );
 
833
 
854
834
/* Macros after this point can all be overridden by user definitions in
855
835
 * section 1.
856
836
 */
893
873
/* This used to be an fputs(), but since the string might contain NUL's,
894
874
 * we now use fwrite().
895
875
 */
896
 
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
 
876
#define ECHO fwrite( yytext, yyleng, 1, yyout )
897
877
#endif
898
878
 
899
879
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
904
884
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
905
885
                { \
906
886
                int c = '*'; \
907
 
                size_t n; \
 
887
                int n; \
908
888
                for ( n = 0; n < max_size && \
909
889
                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
910
890
                        buf[n] = (char) c; \
989
969
        register char *yy_cp, *yy_bp;
990
970
        register int yy_act;
991
971
    
992
 
#line 264 "parser.lex"
993
 
 
994
 
 
995
 
#line 996 "parser.yy.c"
 
972
#line 219 "parser.lex"
 
973
 
 
974
 
 
975
#line 976 "parser.yy.c"
996
976
 
997
977
        if ( !(yy_init) )
998
978
                {
1074
1054
 
1075
1055
case 1:
1076
1056
YY_RULE_SETUP
1077
 
#line 266 "parser.lex"
 
1057
#line 221 "parser.lex"
1078
1058
{c();BEGIN(0);}
1079
1059
        YY_BREAK
1080
1060
case 2:
1081
1061
YY_RULE_SETUP
1082
 
#line 267 "parser.lex"
 
1062
#line 222 "parser.lex"
1083
1063
{c();}
1084
1064
        YY_BREAK
1085
1065
case 3:
1086
1066
/* rule 3 can match eol */
1087
1067
YY_RULE_SETUP
1088
 
#line 268 "parser.lex"
 
1068
#line 223 "parser.lex"
1089
1069
{c();}
1090
1070
        YY_BREAK
1091
1071
case 4:
1094
1074
(yy_c_buf_p) = yy_cp -= 1;
1095
1075
YY_DO_BEFORE_ACTION; /* set up yytext again */
1096
1076
YY_RULE_SETUP
1097
 
#line 269 "parser.lex"
 
1077
#line 224 "parser.lex"
1098
1078
{s(TWIP);c();BEGIN(0);}
1099
1079
        YY_BREAK
1100
1080
case 5:
1103
1083
(yy_c_buf_p) = yy_cp -= 1;
1104
1084
YY_DO_BEFORE_ACTION; /* set up yytext again */
1105
1085
YY_RULE_SETUP
1106
 
#line 270 "parser.lex"
 
1086
#line 225 "parser.lex"
1107
1087
{s(NUMBER);c();BEGIN(0);}
1108
1088
        YY_BREAK
1109
1089
case 6:
1110
1090
/* rule 6 can match eol */
1111
1091
YY_RULE_SETUP
1112
 
#line 271 "parser.lex"
 
1092
#line 226 "parser.lex"
1113
1093
{c();}
1114
1094
        YY_BREAK
1115
1095
case 7:
1116
1096
/* rule 7 can match eol */
1117
1097
YY_RULE_SETUP
1118
 
#line 272 "parser.lex"
 
1098
#line 227 "parser.lex"
1119
1099
{c();}
1120
1100
        YY_BREAK
1121
1101
case 8:
1122
1102
YY_RULE_SETUP
1123
 
#line 273 "parser.lex"
 
1103
#line 228 "parser.lex"
1124
1104
{s(STRING);c();BEGIN(0);}
1125
1105
        YY_BREAK
1126
1106
case 9:
1128
1108
(yy_c_buf_p) = yy_cp -= 1;
1129
1109
YY_DO_BEFORE_ACTION; /* set up yytext again */
1130
1110
YY_RULE_SETUP
1131
 
#line 274 "parser.lex"
 
1111
#line 229 "parser.lex"
1132
1112
{c();printf("unterminated string in line %d: %s\n", line, yytext);exit(1);yyterminate();}
1133
1113
        YY_BREAK
1134
1114
case 10:
1135
1115
/* rule 10 can match eol */
1136
1116
YY_RULE_SETUP
1137
 
#line 275 "parser.lex"
 
1117
#line 230 "parser.lex"
1138
1118
{s(ASSIGNMENT);prefix="<plus>";c();BEGIN(R);}
1139
1119
        YY_BREAK
1140
1120
case 11:
1141
1121
/* rule 11 can match eol */
1142
1122
YY_RULE_SETUP
1143
 
#line 276 "parser.lex"
 
1123
#line 231 "parser.lex"
1144
1124
{s(ASSIGNMENT);prefix="<minus>";c();BEGIN(R);}
1145
1125
        YY_BREAK
1146
1126
case 12:
1147
1127
/* rule 12 can match eol */
1148
1128
YY_RULE_SETUP
1149
 
#line 277 "parser.lex"
 
1129
#line 232 "parser.lex"
1150
1130
{s(ASSIGNMENT);c();BEGIN(R);}
1151
1131
        YY_BREAK
1152
1132
/* values which appear only on the right-hand side of assignments, like: x=50% */
1153
1133
case 13:
1154
1134
YY_RULE_SETUP
1155
 
#line 279 "parser.lex"
 
1135
#line 234 "parser.lex"
1156
1136
{s(IDENTIFIER);c();BEGIN(0);}
1157
1137
        YY_BREAK
1158
1138
 
1159
1139
case 14:
1160
1140
/* rule 14 can match eol */
1161
1141
YY_RULE_SETUP
1162
 
#line 281 "parser.lex"
 
1142
#line 236 "parser.lex"
1163
1143
{handleInclude(yytext, yyleng);}
1164
1144
        YY_BREAK
1165
1145
case 15:
1166
1146
YY_RULE_SETUP
1167
 
#line 282 "parser.lex"
 
1147
#line 237 "parser.lex"
1168
1148
{s(COMMAND);c();}
1169
1149
        YY_BREAK
1170
1150
case 16:
1171
1151
/* rule 16 can match eol */
1172
1152
YY_RULE_SETUP
1173
 
#line 283 "parser.lex"
 
1153
#line 238 "parser.lex"
1174
1154
{s(RAWDATA);c();}
1175
1155
        YY_BREAK
1176
1156
case 17:
1177
1157
YY_RULE_SETUP
1178
 
#line 284 "parser.lex"
 
1158
#line 239 "parser.lex"
1179
1159
{s(IDENTIFIER);c();}
1180
1160
        YY_BREAK
1181
1161
case 18:
1182
1162
YY_RULE_SETUP
1183
 
#line 285 "parser.lex"
 
1163
#line 240 "parser.lex"
1184
1164
{c();BEGIN(BINARY);}
1185
1165
        YY_BREAK
1186
1166
case 19:
1187
1167
/* rule 19 can match eol */
1188
1168
YY_RULE_SETUP
1189
 
#line 286 "parser.lex"
 
1169
#line 241 "parser.lex"
1190
1170
{c();}
1191
1171
        YY_BREAK
1192
1172
case 20:
1193
1173
YY_RULE_SETUP
1194
 
#line 287 "parser.lex"
 
1174
#line 242 "parser.lex"
1195
1175
{char c,c1=yytext[0];
1196
1176
                             printf("Syntax error in line %d, %d: %s", line, column, yytext);
1197
1177
                             while(1) {
1210
1190
case YY_STATE_EOF(INITIAL):
1211
1191
case YY_STATE_EOF(R):
1212
1192
case YY_STATE_EOF(BINARY):
1213
 
#line 301 "parser.lex"
 
1193
#line 256 "parser.lex"
1214
1194
{c();
1215
1195
                             if ( --include_stack_ptr < 0 ) {
1216
1196
                                s(END);
1225
1205
        YY_BREAK
1226
1206
case 21:
1227
1207
YY_RULE_SETUP
1228
 
#line 314 "parser.lex"
 
1208
#line 269 "parser.lex"
1229
1209
YY_FATAL_ERROR( "flex scanner jammed" );
1230
1210
        YY_BREAK
1231
 
#line 1232 "parser.yy.c"
 
1211
#line 1212 "parser.yy.c"
1232
1212
 
1233
1213
        case YY_END_OF_BUFFER:
1234
1214
                {
1458
1438
 
1459
1439
                /* Read in more data. */
1460
1440
                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1461
 
                        (yy_n_chars), num_to_read );
 
1441
                        (yy_n_chars), (size_t) num_to_read );
1462
1442
 
1463
1443
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1464
1444
                }
1482
1462
        else
1483
1463
                ret_val = EOB_ACT_CONTINUE_SCAN;
1484
1464
 
 
1465
        if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
 
1466
                /* Extend the array by 50%, plus the number we really need. */
 
1467
                yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
 
1468
                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
 
1469
                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 
1470
                        YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
 
1471
        }
 
1472
 
1485
1473
        (yy_n_chars) += number_to_move;
1486
1474
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1487
1475
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1910
1898
                (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1911
1899
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
1912
1900
                                                                );
1913
 
                
 
1901
                if ( ! (yy_buffer_stack) )
 
1902
                        YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
 
1903
                                                                  
1914
1904
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1915
1905
                                
1916
1906
                (yy_buffer_stack_max) = num_to_alloc;
1928
1918
                                                                ((yy_buffer_stack),
1929
1919
                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
1930
1920
                                                                );
 
1921
                if ( ! (yy_buffer_stack) )
 
1922
                        YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1931
1923
 
1932
1924
                /* zero only the new slots.*/
1933
1925
                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1972
1964
 
1973
1965
/** Setup the input buffer state to scan a string. The next call to yylex() will
1974
1966
 * scan from a @e copy of @a str.
1975
 
 * @param str a NUL-terminated string to scan
 
1967
 * @param yystr a NUL-terminated string to scan
1976
1968
 * 
1977
1969
 * @return the newly allocated buffer state object.
1978
1970
 * @note If you want to scan bytes that may contain NUL values, then use
2226
2218
 
2227
2219
#define YYTABLES_NAME "yytables"
2228
2220
 
2229
 
#line 314 "parser.lex"
 
2221
#line 269 "parser.lex"
2230
2222
 
2231
2223
 
2232
2224