mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-08 07:31:32 +00:00
Make sure 32 significant characters for import/export IDs
This commit is contained in:
parent
d48ccdf979
commit
726609a573
@ -43,7 +43,7 @@ int id_match(char *name, int len, char *id)
|
||||
{
|
||||
if (len == id[0])
|
||||
{
|
||||
if (len > 16) len = 16;
|
||||
if (len > ID_LEN) len = ID_LEN;
|
||||
while (len--)
|
||||
{
|
||||
if (toupper(name[len]) != id[1 + len])
|
||||
@ -99,11 +99,11 @@ int idconst_add(char *name, int len, int value)
|
||||
parse_error("global label already defined\n");
|
||||
return (0);
|
||||
}
|
||||
if (len > ID_LEN) len = ID_LEN;
|
||||
name[len] = '\0';
|
||||
emit_idconst(name, value);
|
||||
name[len] = c;
|
||||
idconst_name[consts][0] = len;
|
||||
if (len > ID_LEN) len = ID_LEN;
|
||||
while (len--)
|
||||
idconst_name[consts][1 + len] = toupper(name[len]);
|
||||
idconst_value[consts] = value;
|
||||
@ -128,11 +128,11 @@ int idlocal_add(char *name, int len, int type, int size)
|
||||
parse_error("local label already defined\n");
|
||||
return (0);
|
||||
}
|
||||
if (len > ID_LEN) len = ID_LEN;
|
||||
name[len] = '\0';
|
||||
emit_idlocal(name, localsize);
|
||||
name[len] = c;
|
||||
idlocal_name[locals][0] = len;
|
||||
if (len > ID_LEN) len = ID_LEN;
|
||||
while (len--)
|
||||
idlocal_name[locals][1 + len] = toupper(name[len]);
|
||||
idlocal_type[locals] = type | LOCAL_TYPE;
|
||||
@ -159,10 +159,10 @@ int idglobal_add(char *name, int len, int type, int size)
|
||||
parse_error("global label already defined\n");
|
||||
return (0);
|
||||
}
|
||||
name[len] = '\0';
|
||||
name[len] = c;
|
||||
idglobal_name[globals][0] = len;
|
||||
if (len > ID_LEN) len = ID_LEN;
|
||||
//name[len] = '\0';
|
||||
//name[len] = c;
|
||||
idglobal_name[globals][0] = len;
|
||||
while (len--)
|
||||
idglobal_name[globals][1 + len] = toupper(name[len]);
|
||||
idglobal_type[globals] = type;
|
||||
@ -213,8 +213,8 @@ int idfunc_add(char *name, int len, int type, int tag)
|
||||
printf("Global variable count overflow\n");
|
||||
return (0);
|
||||
}
|
||||
idglobal_name[globals][0] = len;
|
||||
if (len > ID_LEN) len = ID_LEN;
|
||||
idglobal_name[globals][0] = len;
|
||||
while (len--)
|
||||
idglobal_name[globals][1 + len] = toupper(name[len]);
|
||||
idglobal_type[globals] = type;
|
||||
|
@ -449,6 +449,7 @@ end
|
||||
def idmatch(nameptr, len, idptr, idcnt)
|
||||
byte i
|
||||
|
||||
if len > ID_LEN; len = ID_LEN; fin
|
||||
while idcnt
|
||||
if len == idptr->idname
|
||||
i = 1; while i <= len and nameptr->[i - 1] == idptr->idname.[i]; i++; loop
|
||||
@ -516,6 +517,7 @@ def size_iddata(type, varsize, initsize)#0
|
||||
end
|
||||
def new_idglobal(nameptr, len, type, value, cparms, cvals)#0
|
||||
if idmatch(nameptr, len, idglobal_tbl, globals); exit_err(ERR_DUP|ERR_ID); fin
|
||||
if len > ID_LEN; len = ID_LEN; fin
|
||||
lastglobal=>idval = value
|
||||
lastglobal=>idtype = type
|
||||
lastglobal->funcparms = cparms
|
||||
@ -588,6 +590,7 @@ def init_idglobal#0
|
||||
end
|
||||
def new_idlocal(nameptr, len, type, size)#0
|
||||
if idmatch(nameptr, len, @idlocal_tbl, locals); exit_err(ERR_DUP|ERR_ID); fin
|
||||
if len > ID_LEN; len = ID_LEN; fin
|
||||
lastlocal=>idval = framesize
|
||||
lastlocal=>idtype = type | LOCAL_TYPE
|
||||
nametostr(nameptr, len, lastlocal + idname)
|
||||
|
@ -292,6 +292,7 @@ word lineno
|
||||
//
|
||||
// Parser variables
|
||||
//
|
||||
const ID_LEN = 32 // Significant ID characters
|
||||
const LVALUE = 0
|
||||
const RVALUE = 1
|
||||
const LAMBDANUM = 16
|
||||
|
@ -911,7 +911,7 @@ end
|
||||
//
|
||||
def lookupextern(esd, index)#1
|
||||
word sym, addr
|
||||
byte str[16]
|
||||
byte str[33]
|
||||
while ^esd
|
||||
sym = esd
|
||||
esd = sym + dcitos(sym, @str)
|
||||
|
@ -946,7 +946,7 @@ end
|
||||
//
|
||||
def lookupextern(esd, index)#1
|
||||
word sym, addr
|
||||
byte str[16]
|
||||
byte str[33]
|
||||
sym = lookupidx(esd, index)
|
||||
if sym
|
||||
addr = lookuptbl(sym, symtbl)
|
||||
|
@ -988,7 +988,7 @@ end
|
||||
//
|
||||
def lookupextern(esd, index)#1
|
||||
word sym, addr
|
||||
byte str[16]
|
||||
byte str[33]
|
||||
sym = lookupidx(esd, index)
|
||||
if sym
|
||||
addr = lookuptbl(sym, symtbl)
|
||||
|
@ -1003,7 +1003,7 @@ end
|
||||
//
|
||||
def lookupextern(esd, index)#1
|
||||
word sym, addr
|
||||
byte str[16]
|
||||
byte str[33]
|
||||
sym = lookupidx(esd, index)
|
||||
if sym
|
||||
addr = lookuptbl(sym, symtbl)
|
||||
|
@ -1014,7 +1014,7 @@ end
|
||||
//
|
||||
def lookupextern(esd, index)#1
|
||||
word sym, addr
|
||||
byte str[16]
|
||||
byte str[33]
|
||||
sym = lookupidx(esd, index)
|
||||
if sym
|
||||
addr = lookuptbl(sym, symtbl)
|
||||
|
@ -712,7 +712,7 @@ end
|
||||
asm cout(c)#0
|
||||
LDA ESTKL,X
|
||||
INX
|
||||
JMP $FFD2
|
||||
JMP $FFD2
|
||||
end
|
||||
asm cin()#1
|
||||
DEX
|
||||
@ -839,7 +839,7 @@ end
|
||||
//
|
||||
def lookupextern(esd, index)#1
|
||||
word sym, addr
|
||||
byte str[16]
|
||||
byte str[33]
|
||||
while ^esd
|
||||
sym = esd
|
||||
esd = sym + dcitos(sym, @str)
|
||||
|
Loading…
Reference in New Issue
Block a user