mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-24 00:00:17 +00:00
cvalue.c:printValue renamed to cosmoV_printValue
This commit is contained in:
parent
0df56bd42a
commit
4816e64612
@ -18,7 +18,7 @@ int cosmoB_print(CState *state, int nargs, CValue *args)
|
||||
CObjString *str = cosmoV_toString(state, args[i]);
|
||||
printf("%s", cosmoO_readCString(str));
|
||||
} else { // else, thats pretty expensive for primitives, just print the raw value
|
||||
printValue(args[i]);
|
||||
cosmoV_printValue(args[i]);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
@ -62,7 +62,7 @@ static int constInstruction(const char *name, CChunk *chunk, int offset)
|
||||
printf("%-16s [%05d] - ", name, index);
|
||||
CValue val = chunk->constants.values[index];
|
||||
|
||||
printValue(val);
|
||||
cosmoV_printValue(val);
|
||||
|
||||
return offset + 1 + (sizeof(uint16_t) / sizeof(INSTRUCTION)); // consume opcode + uint
|
||||
}
|
||||
@ -128,7 +128,7 @@ int disasmInstr(CChunk *chunk, int offset, int indent)
|
||||
CObjFunction *cobjFunc = (CObjFunction *)cosmoV_readRef(val);
|
||||
offset += 3; // we consumed the opcode + u16
|
||||
|
||||
printValue(val);
|
||||
cosmoV_printValue(val);
|
||||
printf("\n");
|
||||
|
||||
// list the upvalues/locals that are captured
|
||||
|
@ -715,13 +715,13 @@ void printObject(CObj *o)
|
||||
case COBJ_ERROR: {
|
||||
CObjError *err = (CObjError *)o;
|
||||
printf("%p -> ", (void *)o);
|
||||
printValue(err->err);
|
||||
cosmoV_printValue(err->err);
|
||||
break;
|
||||
}
|
||||
case COBJ_METHOD: {
|
||||
CObjMethod *method = (CObjMethod *)o;
|
||||
printf("%p -> ", (void *)method);
|
||||
printValue(method->func);
|
||||
cosmoV_printValue(method->func);
|
||||
break;
|
||||
}
|
||||
case COBJ_CLOSURE: {
|
||||
@ -733,7 +733,7 @@ void printObject(CObj *o)
|
||||
case COBJ_UPVALUE: {
|
||||
CObjUpval *upval = (CObjUpval *)o;
|
||||
printf("%p -> ", (void *)upval->val);
|
||||
printValue(*upval->val);
|
||||
cosmoV_printValue(*upval->val);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -203,7 +203,7 @@ void cosmoV_printStack(CState *state)
|
||||
printf("==== [[ stack dump ]] ====\n");
|
||||
for (CValue *top = state->top - 1; top >= state->stack; top--) {
|
||||
printf("%d: ", (int)(top - state->stack));
|
||||
printValue(*top);
|
||||
cosmoV_printValue(*top);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
@ -288,9 +288,9 @@ void cosmoT_printTable(CTable *tbl, const char *name)
|
||||
for (int i = 0; i < cap; i++) {
|
||||
CTableEntry *entry = &tbl->table[i];
|
||||
if (!(IS_NIL(entry->key))) {
|
||||
printValue(entry->key);
|
||||
cosmoV_printValue(entry->key);
|
||||
printf(" - ");
|
||||
printValue(entry->val);
|
||||
cosmoV_printValue(entry->val);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ const char *cosmoV_typeStr(CValue val)
|
||||
}
|
||||
}
|
||||
|
||||
void printValue(CValue val)
|
||||
void cosmoV_printValue(CValue val)
|
||||
{
|
||||
switch (GET_TYPE(val)) {
|
||||
case COSMO_TNUMBER:
|
||||
|
@ -119,7 +119,7 @@ void initValArray(CState *state, CValueArray *val, size_t startCapacity);
|
||||
void cleanValArray(CState *state, CValueArray *array); // cleans array
|
||||
void appendValArray(CState *state, CValueArray *array, CValue val);
|
||||
|
||||
void printValue(CValue val);
|
||||
void cosmoV_printValue(CValue val);
|
||||
COSMO_API bool cosmoV_equal(CState *state, CValue valA, CValue valB);
|
||||
COSMO_API CObjString *cosmoV_toString(CState *state, CValue val);
|
||||
COSMO_API cosmo_Number cosmoV_toNumber(CState *state, CValue val);
|
||||
|
Loading…
Reference in New Issue
Block a user