mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 23:37:38 +02:00
WIP
This commit is contained in:
parent
9579a803bf
commit
b7d13e6899
1 changed files with 7 additions and 6 deletions
|
@ -186,12 +186,13 @@ typedef struct {gc_header_type hdr; tag_type tag; double value;} double_type;
|
|||
|
||||
/* Define string type */
|
||||
typedef struct {gc_header_type hdr; tag_type tag; int len; char *str;} string_type;
|
||||
// TODO: new way to allocate strings, but this requires changes to
|
||||
// all functions that allocate strings, the GC, cgen, and maybe more.
|
||||
#define make_string(cs, len, s) string_type cs; \
|
||||
{ cs.tag = string_tag; cs.len = len; \
|
||||
cs.str = alloca(sizeof(char) * (len + 1)); \
|
||||
strcpy(cs.str, s);}
|
||||
//// TODO: new way to allocate strings, but this requires changes to
|
||||
//// all functions that allocate strings, the GC, cgen, and maybe more.
|
||||
//// Because these strings are (at least for now) allocaed on the stack.
|
||||
//#define make_string(cs, len, s) string_type cs; \
|
||||
//{ cs.tag = string_tag; cs.len = len; \
|
||||
// cs.str = alloca(sizeof(char) * (len + 1)); \
|
||||
// strcpy(cs.str, s);}
|
||||
// TODO: all of the dhalloc below needs to go away...
|
||||
#define make_string(cv,s) string_type cv; cv.tag = string_tag; \
|
||||
{ int len = strlen(s); cv.str = dhallocp; \
|
||||
|
|
Loading…
Add table
Reference in a new issue