1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-10-18 22:24:28 +00:00

PLASM compiler patch #1

This commit is contained in:
David Schmenk 2018-02-07 12:01:55 -08:00
parent 7f9975c442
commit b986e1da38
6 changed files with 24 additions and 5 deletions

Binary file not shown.

View File

@ -232,6 +232,14 @@ void idglobal_size(int type, int size, int constsize)
else if (size)
emit_data(0, 0, 0, size);
}
void idlocal_size(int size)
{
localsize += size;
if (localsize > 255)
{
parse_error("Local variable size overflow\n");
}
}
int id_tag(char *name, int len)
{
int i;

View File

@ -1170,9 +1170,14 @@ int parse_var(int type, long basesize)
{
if (idlen)
id_add(idstr, idlen, type, size);
else if (!(type & EXTERN_TYPE))
{
if (type & LOCAL_TYPE)
idlocal_size(size);
else
emit_data(0, 0, 0, size);
}
}
return (1);
}
int parse_struc(void)

View File

@ -941,8 +941,12 @@ def parse_var(type, basesize)#0
else
new_iddata(idptr, idlen, type, size)
fin
elsif not (type & (EXTERN_TYPE|LOCAL_TYPE))
emit_fill(size)
elsif not type & EXTERN_TYPE
if type & LOCAL_TYPE
framesize = framesize + size
else
size_iddata(type, size, 0)
fin
fin
fin
end

View File

@ -411,7 +411,7 @@ include "toolsrc/parse.pla"
//
// Look at command line arguments and compile module
//
puts("PLASMA Compiler, Version 1.0\n")
puts("PLASMA Compiler, Version 1.01\n")
arg = argNext(argFirst)
if ^arg and ^(arg + 1) == '-'
opt = arg + 2

View File

@ -46,4 +46,6 @@ int id_tag(char *name, int len);
int id_const(char *name, int len);
int id_type(char *name, int len);
void idglobal_size(int type, int size, int constsize);
void idlocal_size(int size);
void idlocal_size(int size);
int tag_new(int type);