1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2026-04-21 22:17:15 +00:00

Add longjmp library to slean up PLASM

This commit is contained in:
David Schmenk
2017-12-21 21:00:35 -08:00
parent 5206d23a63
commit 3c1be6c92f
7 changed files with 261 additions and 242 deletions
+16 -16
View File
@@ -53,30 +53,30 @@ def id_lookup(nameptr, len)
if idptr
return idptr
fin
return parse_err(@undecl_id)
exit_err(@undecl_id)
return 0
end
def idglobal_lookup(nameptr, len)
return idmatch(nameptr, len, idglobal_tbl, globals)
end
def idlocal_add(namestr, len, type, size)
if idmatch(namestr, len, @idlocal_tbl, locals); return parse_err(@dup_id); fin
if idmatch(namestr, len, @idlocal_tbl, locals); return exit_err(@dup_id); fin
lastlocal=>idval = framesize
lastlocal->idtype = type | LOCAL_TYPE
nametostr(namestr, len, lastlocal + idname)
locals++
lastlocal = lastlocal + idrecsz + len
if lastlocal > idlocal_tbl + idlocal_tblsz
prstr(@local_sym_overflw)
exit
exit_err(@local_sym_overflw)
fin
framesize = framesize + size
if framesize > 255
return parse_err(@local_overflw)
return exit_err(@local_overflw)
fin
return TRUE
end
def iddata_add(namestr, len, type, size)
if idmatch(namestr, len, idglobal_tbl, globals); return parse_err(@dup_id); fin
if idmatch(namestr, len, idglobal_tbl, globals); return exit_err(@dup_id); fin
lastglobal=>idval = datasize
lastglobal->idtype = type
nametostr(namestr, len, lastglobal + idname)
@@ -99,7 +99,7 @@ def iddata_size(type, varsize, initsize)#0
fin
end
def idglobal_add(namestr, len, type, value)
if idmatch(namestr, len, idglobal_tbl, globals); return parse_err(@dup_id); fin
if idmatch(namestr, len, idglobal_tbl, globals); return exit_err(@dup_id); fin
lastglobal=>idval = value
lastglobal->idtype = type
nametostr(namestr, len, lastglobal + idname)
@@ -150,7 +150,7 @@ end
// Flags are:
//
def ctag_new
if codetag >= ctag_max; return parse_err(@ctag_full); fin
if codetag >= ctag_max; return exit_err(@ctag_full); fin
codetag = codetag + 1
ctag_tbl:[codetag] = 0 // Unresolved, nothing to update yet
return codetag | IS_CTAG
@@ -159,7 +159,7 @@ def ctag_resolve(ctag)#0
word updtptr, nextptr
ctag = ctag & MASK_CTAG // Better be a ctag!
if ctag_tbl:[ctag] & IS_RESOLVED;parse_err(@dup_id); return; fin
if ctag_tbl:[ctag] & IS_RESOLVED;exit_err(@dup_id); return; fin
updtptr = ctag_tbl:[ctag] & MASK_CTAG
while updtptr
//
@@ -299,7 +299,7 @@ def emit_llw(offset)#0
end
def emit_lab(tag, offset)#0
if tag & IS_CTAG and offset
parse_err(@no_ctag_offst)
exit_err(@no_ctag_offst)
else
emit_op($68)
emit_addr(tag+offset)
@@ -307,7 +307,7 @@ def emit_lab(tag, offset)#0
end
def emit_law(tag, offset)#0
if tag & IS_CTAG and offset
parse_err(@no_ctag_offst)
exit_err(@no_ctag_offst)
else
emit_op($6A)
emit_addr(tag+offset)
@@ -337,7 +337,7 @@ def emit_dlw(offset)#0
end
def emit_sab(tag, offset)#0
if tag & IS_CTAG and offset
parse_err(@no_ctag_offst)
exit_err(@no_ctag_offst)
else
emit_op($78)
emit_addr(tag+offset)
@@ -345,7 +345,7 @@ def emit_sab(tag, offset)#0
end
def emit_saw(tag, offset)#0
if tag & IS_CTAG and offset
parse_err(@no_ctag_offst)
exit_err(@no_ctag_offst)
else
emit_op($7A)
emit_addr(tag+offset)
@@ -353,7 +353,7 @@ def emit_saw(tag, offset)#0
end
def emit_dab(tag, offset)#0
if tag & IS_CTAG and offset
parse_err(@no_ctag_offst)
exit_err(@no_ctag_offst)
else
emit_op($7C)
emit_addr(tag+offset)
@@ -361,7 +361,7 @@ def emit_dab(tag, offset)#0
end
def emit_daw(tag, offset)#0
if tag & IS_CTAG and offset
parse_err(@no_ctag_offst)
exit_err(@no_ctag_offst)
else
emit_op($7E)
emit_addr(tag+offset)
@@ -380,7 +380,7 @@ def emit_localaddr(offset)#0
end
def emit_globaladdr(tag, offset)#0
if tag & IS_CTAG and offset
parse_err(@no_ctag_offst)
exit_err(@no_ctag_offst)
else
emit_op($26)
emit_addr(tag+offset)