mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-02-07 21:30:48 +00:00
Only add accessed externals to the Extern Symbol Directory
This commit is contained in:
parent
2fea8165b2
commit
cf9f20e0c9
@ -256,6 +256,17 @@ int id_type(char *name, int len)
|
||||
parse_error("Undeclared identifier");
|
||||
return (0);
|
||||
}
|
||||
int id_access(char *name, int len)
|
||||
{
|
||||
int i;
|
||||
if ((i = idglobal_lookup(name, len)) >= 0)
|
||||
{
|
||||
idglobal_type[i] |= ACCESSED_TYPE;
|
||||
return (idglobal_type[i]);
|
||||
}
|
||||
parse_error("Undeclared external function");
|
||||
return (0);
|
||||
}
|
||||
int tag_new(int type)
|
||||
{
|
||||
if (type & EXTERN_TYPE)
|
||||
@ -409,13 +420,13 @@ void emit_esd(void)
|
||||
printf(";\n; EXTERNAL/ENTRY SYMBOL DICTIONARY\n;\n");
|
||||
for (i = 0; i < globals; i++)
|
||||
{
|
||||
if (idglobal_type[i] & EXTERN_TYPE)
|
||||
if (idglobal_type[i] & ACCESSED_TYPE) // Only refer to accessed externals
|
||||
{
|
||||
emit_dci(&idglobal_name[i][1], idglobal_name[i][0]);
|
||||
printf("\t%s\t$10\t\t\t; EXTERNAL SYMBOL FLAG\n", DB);
|
||||
printf("\t%s\t%d\t\t\t; ESD INDEX\n", DW, idglobal_tag[i]);
|
||||
}
|
||||
else if (idglobal_type[i] & EXPORT_TYPE)
|
||||
else if (idglobal_type[i] & EXPORT_TYPE)
|
||||
{
|
||||
emit_dci(&idglobal_name[i][1], idglobal_name[i][0]);
|
||||
printf("\t%s\t$08\t\t\t; ENTRY SYMBOL FLAG\n", DB);
|
||||
|
@ -542,6 +542,13 @@ def ctag_new
|
||||
ctag_tbl=>[codetag] = 0 // Unresolved, nothing to update yet
|
||||
return codetag | IS_CTAG
|
||||
end
|
||||
def fixup_new(tag, type, size)#0
|
||||
fixup_tag->[fixup_cnt] = tag
|
||||
fixup_type->[fixup_cnt] = type
|
||||
fixup_size->[fixup_cnt] = size
|
||||
fixup_cnt++
|
||||
if fixup_cnt >= FIXUPNUM; exit_err(ERR_OVER|ERR_ID|ERR_TABLE); fin
|
||||
end
|
||||
//
|
||||
// Generate/add to a sequence of code
|
||||
//
|
||||
@ -839,7 +846,7 @@ def buildESD#2
|
||||
dirptr->0 = $08
|
||||
dirptr=>1 = (ctag_tbl[idptr=>idval] & MASK_CTAG) + MODADDR
|
||||
dirptr = dirptr + 3
|
||||
elsif idptr=>idtype & EXTERN_TYPE
|
||||
elsif idptr=>idtype & (EXTERN_TYPE|ACCESSED_TYPE) == EXTERN_TYPE|ACCESSED_TYPE
|
||||
dirptr = dirptr + stodci(idptr=>idname, dirptr)
|
||||
dirptr->0 = $10
|
||||
dirptr->1 = symnum
|
||||
|
@ -414,6 +414,8 @@ t_opseq *parse_value(t_opseq *codeseq, int rvalue, int *stackdepth)
|
||||
{
|
||||
cfnparms = funcparms_cnt(type);
|
||||
cfnvals = funcvals_cnt(type);
|
||||
if (type & EXTERN_TYPE)
|
||||
id_access(tokenstr, tokenlen);
|
||||
}
|
||||
}
|
||||
else if (scantoken == LAMBDA_TOKEN)
|
||||
|
@ -283,6 +283,9 @@ def parse_value(codeseq, rvalue)#2
|
||||
if type & FUNC_TYPE
|
||||
cfnparms = idptr->funcparms
|
||||
cfnvals = idptr->funcvals
|
||||
if type & EXTERN_TYPE
|
||||
idptr=>idtype = idptr=>idtype | ACCESSED_TYPE
|
||||
fin
|
||||
fin
|
||||
break
|
||||
is INT_TKN
|
||||
|
@ -126,6 +126,9 @@ const STR_TYPE = $0080
|
||||
const PREDEF_TYPE = $0100
|
||||
const EXTERN_TYPE = $0200
|
||||
const EXPORT_TYPE = $0400
|
||||
const ACCESSED_TYPE = $0800
|
||||
const FIXUP_BYTE = $00
|
||||
const FIXUP_WORD = $80
|
||||
//
|
||||
// Keywords
|
||||
//
|
||||
@ -230,7 +233,8 @@ const IDGLOBALSZ = 2048
|
||||
const IDLOCALSZ = 512
|
||||
const FIXUPNUM = 2048
|
||||
word codetag = -1
|
||||
word idglobal_tbl, idlocal_tbl, ctag_tbl, fixup_tbl
|
||||
word idglobal_tbl, idlocal_tbl, ctag_tbl
|
||||
word fixup_tag, fixup_type, fixup_size
|
||||
word pending_seq
|
||||
word globals, lastglobal, lastlocal, savelast
|
||||
word codebufsz, datasize, framesize, savesize
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define EXPORT_TYPE (1 << 12)
|
||||
#define PREDEF_TYPE (1 << 13)
|
||||
#define FUNC_TYPE (ASM_TYPE | DEF_TYPE | PREDEF_TYPE)
|
||||
#define ACCESSED_TYPE (1 << 15)
|
||||
#define FUNC_PARMS (0x0F << 16)
|
||||
#define FUNC_VALS (0x0F << 20)
|
||||
#define FUNC_PARMVALS (FUNC_PARMS|FUNC_VALS)
|
||||
@ -44,5 +45,6 @@ int idconst_add(char *name, int len, int value);
|
||||
int id_tag(char *name, int len);
|
||||
int id_const(char *name, int len);
|
||||
int id_type(char *name, int len);
|
||||
int id_access(char *name, int len);
|
||||
void idglobal_size(int type, int size, int constsize);
|
||||
int tag_new(int type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user