mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-07-05 04:28:57 +00:00
Fix address initializera
This commit is contained in:
parent
1efd12b15c
commit
c92e659a9b
@ -6,7 +6,7 @@ include(testlib.plh)
|
|||||||
//
|
//
|
||||||
// Structure definition.
|
// Structure definition.
|
||||||
//
|
//
|
||||||
struc
|
struc mystruc
|
||||||
byte cmd
|
byte cmd
|
||||||
word param
|
word param
|
||||||
byte[3]
|
byte[3]
|
||||||
@ -105,4 +105,6 @@ puti(param)
|
|||||||
putln
|
putln
|
||||||
puti(data)
|
puti(data)
|
||||||
putln
|
putln
|
||||||
|
puti(mystruc)
|
||||||
|
putln
|
||||||
done
|
done
|
||||||
|
@ -1054,9 +1054,17 @@ int parse_var(int type)
|
|||||||
}
|
}
|
||||||
int parse_struc(void)
|
int parse_struc(void)
|
||||||
{
|
{
|
||||||
long size;
|
long size;
|
||||||
int type, constsize, offset = 0;
|
int type, constsize, offset = 0;
|
||||||
|
char *idstr, strucid[80];
|
||||||
|
int idlen = 0, struclen = 0;
|
||||||
|
|
||||||
|
if (scan() == ID_TOKEN)
|
||||||
|
{
|
||||||
|
struclen = tokenlen;
|
||||||
|
for (idlen = 0; idlen < struclen; idlen++)
|
||||||
|
strucid[idlen] = tokenstr[idlen];
|
||||||
|
}
|
||||||
while (next_line() == BYTE_TOKEN || scantoken == WORD_TOKEN)
|
while (next_line() == BYTE_TOKEN || scantoken == WORD_TOKEN)
|
||||||
{
|
{
|
||||||
size = 1;
|
size = 1;
|
||||||
@ -1073,8 +1081,7 @@ int parse_struc(void)
|
|||||||
scan();
|
scan();
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
char *idstr;
|
idlen = 0;
|
||||||
int idlen = 0;
|
|
||||||
if (scantoken == ID_TOKEN)
|
if (scantoken == ID_TOKEN)
|
||||||
{
|
{
|
||||||
idstr = tokenstr;
|
idstr = tokenstr;
|
||||||
@ -1100,6 +1107,8 @@ int parse_struc(void)
|
|||||||
if (scantoken != EOL_TOKEN && scantoken != COMMENT_TOKEN)
|
if (scantoken != EOL_TOKEN && scantoken != COMMENT_TOKEN)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
if (struclen)
|
||||||
|
idconst_add(strucid, struclen, offset);
|
||||||
return (scantoken == END_TOKEN);
|
return (scantoken == END_TOKEN);
|
||||||
}
|
}
|
||||||
int parse_vars(int type)
|
int parse_vars(int type)
|
||||||
|
@ -2100,7 +2100,7 @@ def emit_data(vartype, consttype, constval, constsize)
|
|||||||
constsize = constsize - 1
|
constsize = constsize - 1
|
||||||
emit_byte(constsize)
|
emit_byte(constsize)
|
||||||
while constsize > 0
|
while constsize > 0
|
||||||
emit_byte(^chrptr)
|
emit_byte(^chrptr)
|
||||||
chrptr = chrptr + 1
|
chrptr = chrptr + 1
|
||||||
constsize = constsize - 1
|
constsize = constsize - 1
|
||||||
loop
|
loop
|
||||||
@ -2465,7 +2465,8 @@ def iddata_add(namestr, len, type, size)
|
|||||||
end
|
end
|
||||||
def iddata_size(type, varsize, initsize)
|
def iddata_size(type, varsize, initsize)
|
||||||
if varsize > initsize
|
if varsize > initsize
|
||||||
datasize = datasize + emit_data(0, 0, 0, varsize - initsize)
|
datasize = datasize + varsize
|
||||||
|
emit_data(0, 0, 0, varsize - initsize)
|
||||||
else
|
else
|
||||||
datasize = datasize + initsize
|
datasize = datasize + initsize
|
||||||
fin
|
fin
|
||||||
@ -2913,7 +2914,7 @@ def parse_constval(valptr, sizeptr)
|
|||||||
if !idptr; return parse_err(@bad_cnst); fin
|
if !idptr; return parse_err(@bad_cnst); fin
|
||||||
type = idptr->idtype
|
type = idptr->idtype
|
||||||
if type & XADDR_TYPE
|
if type & XADDR_TYPE
|
||||||
if !(mod & 8); return parse_err(@bad_cnst); fin
|
if mod <> 8; return parse_err(@bad_cnst); fin
|
||||||
fin
|
fin
|
||||||
*valptr = idptr=>idval
|
*valptr = idptr=>idval
|
||||||
break
|
break
|
||||||
@ -3666,8 +3667,8 @@ def parse_stmnt
|
|||||||
return TRUE
|
return TRUE
|
||||||
end
|
end
|
||||||
def parse_var(type)
|
def parse_var(type)
|
||||||
byte consttype, constsize, idlen
|
byte consttype, idlen
|
||||||
word idptr, constval, arraysize, size
|
word idptr, constval, arraysize, constsize, size
|
||||||
|
|
||||||
idlen = 0
|
idlen = 0
|
||||||
size = 1
|
size = 1
|
||||||
@ -3706,7 +3707,7 @@ def parse_var(type)
|
|||||||
return parse_err(@bad_decl)
|
return parse_err(@bad_decl)
|
||||||
fin
|
fin
|
||||||
loop
|
loop
|
||||||
iddata_size(PTR_TYPE, size, arraysize)//
|
iddata_size(PTR_TYPE, size, arraysize)
|
||||||
else
|
else
|
||||||
return parse_err(@bad_decl)
|
return parse_err(@bad_decl)
|
||||||
fin
|
fin
|
||||||
@ -3720,8 +3721,20 @@ def parse_var(type)
|
|||||||
return TRUE
|
return TRUE
|
||||||
end
|
end
|
||||||
def parse_struc
|
def parse_struc
|
||||||
word size, type, constsize, offset, idstr, idlen
|
byte strucid[16]
|
||||||
|
byte type, idlen, struclen
|
||||||
|
word size, constsize, offset, idstr
|
||||||
|
|
||||||
|
struclen = 0
|
||||||
|
if scan == ID_TKN
|
||||||
|
struclen = tknlen
|
||||||
|
if struclen > 16
|
||||||
|
struclen = 16
|
||||||
|
fin
|
||||||
|
for idlen = 0 to struclen
|
||||||
|
strucid[idlen] = ^(tknptr + idlen)
|
||||||
|
next
|
||||||
|
fin
|
||||||
offset = 0
|
offset = 0
|
||||||
while nextln == BYTE_TKN or token == WORD_TKN
|
while nextln == BYTE_TKN or token == WORD_TKN
|
||||||
size = 1
|
size = 1
|
||||||
@ -3758,6 +3771,9 @@ def parse_struc
|
|||||||
until token <> COMMA_TKN
|
until token <> COMMA_TKN
|
||||||
if token <> EOL_TKN; return FALSE; fin
|
if token <> EOL_TKN; return FALSE; fin
|
||||||
loop
|
loop
|
||||||
|
if struclen
|
||||||
|
idconst_add(@strucid, struclen, offset)
|
||||||
|
fin
|
||||||
return token == END_TKN
|
return token == END_TKN
|
||||||
end
|
end
|
||||||
def parse_vars
|
def parse_vars
|
||||||
|
Loading…
Reference in New Issue
Block a user