Mercurial > repos > rhope
comparison runtime/builtin.c @ 66:d4b44ae2e34a
New variant of C backend works now
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 06 Jun 2010 20:29:10 -0400 |
parents | 04baa003de5a |
children | f7bcf3db1342 |
comparison
equal
deleted
inserted
replaced
65:1db811fa4744 | 66:d4b44ae2e34a |
---|---|
97 return ret; | 97 return ret; |
98 } | 98 } |
99 | 99 |
100 object * make_String(char * text) | 100 object * make_String(char * text) |
101 { | 101 { |
102 returntype ret; | 102 object * params[1]; |
103 context * ct; | |
104 calldata * cdata; | |
105 object * retobj; | |
106 t_Array * arr = (t_Array *)_internal_array_allocnaked(strlen(text), make_Blueprint(TYPE_UINT8)); | 103 t_Array * arr = (t_Array *)_internal_array_allocnaked(strlen(text), make_Blueprint(TYPE_UINT8)); |
107 arr->payload.Length = arr->payload.Storage; | 104 arr->payload.Length = arr->payload.Storage; |
108 memcpy(((char *)arr) + sizeof(t_Array), text, arr->payload.Length); | 105 memcpy(((char *)arr) + sizeof(t_Array), text, arr->payload.Length); |
109 | 106 |
110 //This is really ugly, but I don't see a good way around it at the moment | 107 params[0] = (object *)arr; |
111 ct = new_context(); | 108 rhope(FUNC_String, params, 1, 1); |
112 cdata = alloc_cdata(ct, 1); | 109 |
113 cdata->params[0] = (object *)arr; | 110 return params[0]; |
114 cdata->num_params = 1; | |
115 cdata->resume = 0; | |
116 ret = f_String(cdata); | |
117 while(ret == TAIL_RETURN) | |
118 ret = cdata->tail_func(cdata); | |
119 if(ret == EXCEPTION_RETURN) | |
120 { | |
121 puts("Exception while building string literal!"); | |
122 exit(-1); | |
123 } | |
124 retobj = cdata->params[0]; | |
125 free_context(ct); | |
126 return retobj; | |
127 } | 111 } |
128 | 112 |
129 | 113 |