Browse Source
- UM_realloc was moved from a macro to an actual function to handle error results - NODE_STATE nodes have a new value in the node's union, sType which describes the type of statement the node is. - 'prntint' statements are the only statement avalible for now, they allow printing the value of expressions to the console. - fixed a bug in ulex.c/identifierType - main.c was updated to show the prntint statement. - uparse.c was refactored a bit, including some debugging prints for nowremotes/origin/HEAD
11 changed files with 134 additions and 57 deletions
@ -1,29 +0,0 @@
|
||||
|10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ] |
||||
|0000 |
||||
@number [ &started $1 ] |
||||
|0100 |
||||
#0006 #0002 #0015 MUL2 |
||||
#0003 #0006 MUL2 |
||||
ADD2 |
||||
ADD2 |
||||
|
||||
;print-decimal JSR2 |
||||
BRK |
||||
@print-decimal |
||||
#00 .number/started STZ |
||||
DUP2 #2710 DIV2 DUP2 ,&digit JSR #2710 MUL2 SUB2 |
||||
DUP2 #03e8 DIV2 DUP2 ,&digit JSR #03e8 MUL2 SUB2 |
||||
DUP2 #0064 DIV2 DUP2 ,&digit JSR #0064 MUL2 SUB2 |
||||
DUP2 #000a DIV2 DUP2 ,&digit JSR #000a MUL2 SUB2 |
||||
,&digit JSR |
||||
.number/started LDZ ,&end JCN |
||||
LIT '0 .Console/char DEO |
||||
&end |
||||
JMP2r |
||||
&digit |
||||
SWP POP |
||||
DUP .number/started LDZ ORA #02 JCN |
||||
POP JMP2r |
||||
LIT '0 ADD .Console/char DEO |
||||
#01 .number/started STZ |
||||
JMP2r |
@ -0,0 +1,18 @@
|
||||
#include "umem.h" |
||||
|
||||
void* UM_realloc(void *buf, size_t size) { |
||||
void *newBuf; |
||||
|
||||
/* if the size is 0, just free it :) */ |
||||
if (size == 0) { |
||||
free(buf); |
||||
return NULL; |
||||
} |
||||
|
||||
if (!(newBuf = realloc(buf, size))) { |
||||
printf("Failed to reallocate memory!\n"); |
||||
exit(EXIT_FAILURE); |
||||
} |
||||
|
||||
return newBuf; |
||||
} |
Loading…
Reference in new issue