cvalue.c:printValue renamed to cosmoV_printValue

This commit is contained in:
cpunch 2023-12-28 22:52:20 -06:00
parent 0df56bd42a
commit 4816e64612
8 changed files with 12 additions and 12 deletions

View File

@ -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");

View File

@ -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

View File

@ -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:

View File

@ -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");
}
}

View File

@ -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");
}
}

View File

@ -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:

View File

@ -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);

View File

@ -340,7 +340,7 @@ void callCValue(CState *state, CValue func, int args, int nresults, int offset)
#ifdef VM_DEBUG
printf("\n");
printIndent(state->frameCount - 1);
printValue(func);
cosmoV_printValue(func);
printf("(%d args)\n", args);
#endif