fixed #include -> #include in certain cases, found a new bug

This commit is contained in:
pommicket 2022-02-08 22:17:28 -05:00
parent d7a9a565a9
commit c548b12bbb
4 changed files with 4922 additions and 2 deletions

View file

@ -1 +1,16 @@
/* #include "tests/parse_stb_image.h" */ /* #include "tests/parse_stb_truetype.h" */
/*
; @NONSTANDARD:
; the following does not work:
; typedef struct T Type;
; struct T{
; int m;
; };
; ...
; Type *x = ...;
; x->m; *trying to access member of incomplete struct
This needs to be fixed because otherwise you can't do:
struct A { struct B *blah; }
struct B { struct A *blah; }
*/

View file

@ -797,6 +797,7 @@ function translation_phase_4
global 1000 dat_directive_include_text global 1000 dat_directive_include_text
local inc_filename local inc_filename
temp_out = &dat_directive_include_text temp_out = &dat_directive_include_text
memset(temp_out, 0, 1000)
inc_filename = malloc(4000) inc_filename = malloc(4000)
pptoken_skip(&in) pptoken_skip(&in)
macro_replacement_to_terminator(filename, &line_number, &in, &temp_out, 10) macro_replacement_to_terminator(filename, &line_number, &in, &temp_out, 10)

File diff suppressed because it is too large Load diff

View file

@ -322,7 +322,7 @@ function memccpy
memccpy_advance(&dest, &src, terminator) memccpy_advance(&dest, &src, terminator)
return dest return dest
; like C, but returns 0 ; like C, but doesn't return anything
; also, you can copy overlapping regions as long as dest < src. ; also, you can copy overlapping regions as long as dest < src.
function memcpy function memcpy
argument dest argument dest
@ -340,6 +340,18 @@ function memcpy
n -= 1 n -= 1
goto memcpy_loop goto memcpy_loop
; like C, but doesn't return anything
function memset
argument dest
argument c
argument n
:memset_loop
if n == 0 goto return_0
*1dest = c
dest += 1
n -= 1
goto memset_loop
function strlen function strlen
argument s argument s
local p local p