Added cosmoV_pushFString(), and cosmoO_pushVFString().

cosmoV_error now pushes the error string onto the stack, as well as uses cosmoO_VFString to format strings.
cosmoV_concat is now entirely self contained, and is now stack based. Push the CValues you want to concat into strings onto the stack and call cosmoV_concat with the # of values you pushed.
This commit is contained in:
2020-12-22 15:13:11 -06:00
parent de3a89ad4f
commit 31a852a127
5 changed files with 92 additions and 28 deletions

View File

@@ -154,6 +154,15 @@ CObjString *cosmoO_takeString(CState *state, char *str, size_t sz);
// allocates a CObjStruct pointing directly to *str
CObjString *cosmoO_allocateString(CState *state, const char *str, size_t sz, uint32_t hash);
/*
formats strings to push onto the VM stack, formatting supported:
'%d' - decimal numbers [int]
'%f' - floating point [double]
'%s' - strings [const char*]
*/
CObjString *cosmoO_pushVFString(CState *state, const char *format, va_list args);
COSMO_API void printObject(CObj *o);
const char *cosmoO_typeStr(CObj* obj);