Incorporated variable length identifiers.

Courtesy Johan Stevenson
This commit is contained in:
sater 1984-05-18 13:04:34 +00:00
parent 7ac5028864
commit d34532e79d
3 changed files with 16 additions and 7 deletions

View file

@ -187,9 +187,12 @@ offset *newrom() {
return((offset *) newcore(MAXROM*sizeof(offset)));
}
sym_p newsym() {
return((sym_p) newcore(sizeof(sym_t)));
sym_p newsym(len) int len; {
/*
* sym_t includes a 2 character s_name at the end
* extend this structure with len-2 characters
*/
return((sym_p) newcore(sizeof(sym_t) - 2 + len));
}
argb_p newargb() {

View file

@ -37,6 +37,7 @@ unsigned hash(string) char *string; {
sym_p symlookup(name,status,flags) char *name; int status,flags; {
register sym_p *spp,sp;
register i;
static short genfrag = 32767;
spp = &symhash[hash(name)%NSYMHASH];
@ -58,8 +59,13 @@ sym_p symlookup(name,status,flags) char *name; int status,flags; {
* symbol not found, enter in table
*/
*spp = sp = newsym();
strncpy(sp->s_name,name,IDL);
i = strlen(name) + 1;
if (i & 1)
i++;
if (i > IDL)
i = IDL;
*spp = sp = newsym(i);
strncpy(sp->s_name,name,i);
sp->s_flags = flags;
if (status == DEFINING)
sp->s_flags |= SYMDEF;

View file

@ -1,14 +1,14 @@
/* $Header$ */
#define IDL 8
#define IDL 100
struct sym {
sym_p s_next;
char s_name[IDL];
offset *s_rom;
short s_flags;
short s_frag;
offset s_value;
char s_name[2]; /* to be extended up to IDL */
};
/* contents of .s_flags */