Mon 16 Mar 11:09:06 CET 2026
This commit is contained in:
parent
dff2a1d065
commit
6e2bda3868
22
src/code.h
Normal file
22
src/code.h
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef _CODE_H
|
||||||
|
#define _CODE_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
Code area is bottom of heap memory
|
||||||
|
*/
|
||||||
|
#define CODESTORE0(M,addr,cmd) M->data[addr]=(unsigned char)cmd
|
||||||
|
#define CODESTORE1N(M,addr,cmd,x) { CODESTORE0(M,addr,cmd); *((number_t *)&M->data[addr+1])=(number_t)x; }
|
||||||
|
#define CODESTORE1I(M,addr,cmd,x) { CODESTORE0(M,addr,cmd); *((index_t *)&M->data[addr+1])=x; }
|
||||||
|
#define CODESTORE1A(M,addr,cmd,x) { CODESTORE0(M,addr,cmd); *((address_t*)&M->data[addr+1])=x; }
|
||||||
|
|
||||||
|
|
||||||
|
#define CODEADD0(M,cmd) M->data[M->bottom++]=(unsigned char)cmd
|
||||||
|
#define CODEADD1N(M,cmd,x) { CODEADD0(M,cmd); *((number_t *)&M->data[M->bottom])=(number_t)x; M->bottom+=number_s; }
|
||||||
|
#define CODEADD1I(M,cmd,x) { CODEADD0(M,cmd); *((index_t *)&M->data[M->bottom])=x; M->bottom+=index_s;}
|
||||||
|
#define CODEADD1A(M,cmd,x) { CODEADD0(M,cmd); *((address_t*)&M->data[M->bottom])=x; M->bottom+=address_s;}
|
||||||
|
#define CODEADDREADVAR(M,R,name) { address_t addr=Allocate(M,R, name, MVAR, 1, NULL); if (addr<0) return error(R,EVAR); CODEADD0(M,READ); *((address_t*)&M->data[M->bottom])=addr; M->bottom+=address_s; }
|
||||||
|
|
||||||
|
index_t CompileExpr(lexer_t *lex, mem_t *M, reg_t *R);
|
||||||
|
void CompileInstr(lexer_t *lex, mem_t *M, reg_t *R);
|
||||||
|
int Compile(lexer_t *lex, char *buffer ,context_t *C, int runnable /* pstate */);
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user