10 #define MAX_DEPTH 1024 /* maximum value of scope */
12 symtab_t
*symtab
[MAX_DEPTH
];
17 memset(symtab
, 0, MAX_DEPTH
*sizeof(symtab_t
));
21 putsym(char *name
, int scope
, int addr
, int dim
, int size
)
23 symtab_t
*node
= calloc(1, sizeof(symtab_t
));
25 node
->name
= name
; /* the scanner strduped it. */
26 node
->offset
= data_location(size
);
31 node
->next
= symtab
[scope
];
32 symtab
[scope
] = node
; /* lazy user proof :-) */
38 getsym(char *name
, int scope
)
43 for (i
= scope
; i
>= 0; --i
)
44 for (p
= symtab
[i
]; p
; p
= p
->next
)
45 if (strcmp(p
->name
, name
) == 0)
52 scoperem_aux(symtab_t
*node
)
57 scoperem_aux(node
->next
);
65 scoperem_aux(symtab
[scope
]);