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))); return((offset *) newcore(MAXROM*sizeof(offset)));
} }
sym_p newsym() { sym_p newsym(len) int len; {
/*
return((sym_p) newcore(sizeof(sym_t))); * 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() { 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; { sym_p symlookup(name,status,flags) char *name; int status,flags; {
register sym_p *spp,sp; register sym_p *spp,sp;
register i;
static short genfrag = 32767; static short genfrag = 32767;
spp = &symhash[hash(name)%NSYMHASH]; 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 * symbol not found, enter in table
*/ */
*spp = sp = newsym(); i = strlen(name) + 1;
strncpy(sp->s_name,name,IDL); if (i & 1)
i++;
if (i > IDL)
i = IDL;
*spp = sp = newsym(i);
strncpy(sp->s_name,name,i);
sp->s_flags = flags; sp->s_flags = flags;
if (status == DEFINING) if (status == DEFINING)
sp->s_flags |= SYMDEF; sp->s_flags |= SYMDEF;

View file

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