File: data.c

package info (click to toggle)
icmake 7.18.00-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 2,840 kB
  • sloc: ansic: 7,784; makefile: 3,811; sh: 319; cpp: 83
file content (256 lines) | stat: -rw-r--r-- 8,837 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256

/*
                                D A T A . C
*/

#include "iccomp.h"

char
    *filenames,
    *funstring[] =                          /* only one_arg  */
    {
        "arghead",
        "argtail",
        "ascii",
        "ascii",

        "change_base",
        "chdir",
        "change_ext",
        "cmdhead",
        "cmdtail",
        "change_path",

        "echo",
        "element",
        "exec",
        "execute",
        "exists",

        "strtok",
        "fgets",
        "fprintf",

        "get_base",
        "getch",
        "gets",
        "get_ext",
        "get_path",

        "makelist",

        "printf",
        "putenv",

        "sizeoflist",
        "stat",
        "element",                          /* f_str_el */
        "strlwr",
        "strupr",
        "system",
    },
    icm_comp[]          = "ICM-COMP:",
    illegal_argcount[]  = "%s(): too few arguments",
    illegal_cast[]      = "illegal cast",
    illegal_type[]      = "illegal type for %s",
    init_expr_not_const[] = "initialization expression must be const",
    lvalue_needed[]     = "lvalue needed for %s",
    nullstring[]        = "",
    *opstring[] =
    {
        NULL,                               /*     op_jmp, */
        NULL,                               /*     op_jmp_false, */
        NULL,                               /*     op_jmp_true, */
        NULL,                               /*     op_push_1_jmp_end, */
        NULL,                               /*     op_push_0, */
        NULL,                               /*     op_push_imm, */
        NULL,                               /*     op_push_strconst, */
        NULL,                               /*     op_push_var, */
        NULL,                               /*     op_push_reg, */
        NULL,                               /*     op_pop_var, */
        "(unary) -",                        /* op_umin, */
        "(int)",                            /* op_atoi, */
        "(string)",                         /* op_itoa, */
        "(list)",                           /* op_atol, */
        "*",                        /* op_mul, */
        "/",                        /* op_div, */
        "%%",                       /* op_mod, */
        "+",                        /* op_add, */
        "-",                        /* op_sub, */
        "==",                       /* op_eq, */
        "!=",                       /* op_neq, */
        "<",                        /* op_sm, */
        ">",                        /* op_gr, */
        "younger",                  /* op_younger, */
        "older",                    /* op_older, */
        "<=",                       /* op_smeq, */
        ">=",                       /* op_greq, */
        NULL,                               /* op_call */
        NULL,                               /* op_asp */
        NULL,                               /* op_ret */
        NULL,                               /* op_copy_var */
        "++",                       /* op_inc */
        "--",                       /* op_dec */
        NULL,                               /* op_call */
        NULL,                               /* op_frame */
        NULL,                               /* op_ret */
        NULL,                               /* op_pop_ */
        "&",                                /* op_band */
        "|",                                /* op_bor */
        "~",                                /* op_bnot */
        "^",                                /* op_xor */
        "<<",                               /* op_shl */
        ">>",                               /* op_shr */
    },
    *source_name,
    *lexstring,                          /* resizing STRING buffer */
    *stringbuf,                          /* final STRING */
    type_conflict[] = "conflicting operand types for %s";

E_TYPE_
    vartype;

E_TYPE_
    optype[] =
    {
        0,                                  /*     op_jmp, */
        0,                                  /*     op_jmp_false, */
        0,                                  /*     op_jmp_true, */
        0,                                  /*     op_push_1_jmp_end, */
        0,                                  /*     op_push_0, */
        0,                                  /*     op_push_imm, */
        0,                                  /*     op_push_strconst, */
        0,                                  /*     op_push_var, */
        0,                                  /*     op_push_reg, */
        0,                                  /*     op_pop_var, */
        e_int | e_list | e_bool,            /* op_umin, */
        e_str,                              /* op_atoi, */
        e_int | e_bool,                     /* op_itoa, */
        e_str,                              /* op_atol, */
        e_int | e_bool,                     /* op_mul,  */
        e_int | e_bool,                     /* op_div,  */
        e_int | e_bool,                     /* op_mod,  */
        ALLTYPES,                           /* op_add, */
        ALLTYPES,                           /* op_sub, */
        ALLTYPES,                           /* op_eq, */
        ALLTYPES,                           /* op_neq, */
        e_int | e_bool | e_str,             /* op_sm, */
        e_int | e_bool | e_str,             /* op_gr, */
        e_str,                              /* op_younger, */
        e_str,                              /* op_older, */
        e_int | e_bool | e_str,             /* op_smeq, */
        e_int | e_bool | e_str,             /* op_greq, */
        0,                                  /* op_call */
        0,                                  /* op_asp */
        0,                                  /* op_ret */
        0,                                  /* op_copy_var */
        e_int,                              /* op_inc */
        e_int,                              /* op_dec */
        0,                                  /* op_call */
        0,                                  /* op_frame */
        0,                                  /* op_ret */
        0,                                  /* op_pop_ */
        e_int,                              /* op_band */
        e_int,                              /* op_bor */
        e_int,                              /* op_bnot */
        e_int,                              /* op_xor */
        e_int,                              /* op_shl */
        e_int,                              /* op_shr */
    };

FILE
    *s_bin;

int
    initialization = 0,
    parse_error = err_code_or_vars_expected,
    (*yylex_input)(char *, int) =           /* pointer to yylex input to use */
                            yylex_file;     /* start reading from file       */

OPCODE_
    lastop = op_hlt;

STRINGTAB_
    *stringtab;

SYMTAB_
    local,
    funtab,
    global,
    *entertab = &global;

HIDDEN_FUNCTION_
    hidden[he_] =
    {
        {
            "h_older",                      /* name */
                                            /* source of the hidden function */
            "list h_older(int attrib, string mask, string file)"
            "{"
            "   int"
            "       idx;"
            "   list"
            "       source,"
            "       dest;"
            "   string"
            "       s;"
            ""
            "   source = makelist(attrib, mask);"
            "   for (idx = sizeof(source); idx--; )"
            "   {"
            "       s = element(idx, source);"
            "       if (s older file)"
            "           dest += (list)s;"
            "   }"
            "   return (dest);"
            "}",

            e_reg | e_list,                 /* returntype */
            0,                              /* must be 0, set to 1 if called */
            3,                              /* number of arguments */
        },

        {
            "h_younger",

            "list h_younger(int attrib, string mask, string file)"
            "{"
            "   int"
            "       idx;"
            "   list"
            "       source,"
            "       dest;"
            "   string"
            "       s;"
            ""
            "   source = makelist(attrib, mask);"
            "   for (idx = sizeof(source); idx--; )"
            "   {"
            "       s = element(idx, source);"
            "       if (s younger file)"
            "           dest += (list)s;"
            "   }"
            "   return (dest);"
            "}",

            e_reg | e_list,
            0,
            3,
        },
    };

size_t
    break_ok,
    dead_sp,
    errcount,
    hidden_called,
    nestlevel,
    n_params,
    n_strings,
    n_symbols,
    sem_err,
    stringsize;

unsigned *dead;

ESTRUC_ global_init;             /* code for initializing globals */