Skip to content

Commit

Permalink
cvalue.c:printValue renamed to cosmoV_printValue
Browse files Browse the repository at this point in the history
  • Loading branch information
CPunch committed Dec 29, 2023
1 parent 0df56bd commit 4816e64
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/cbaselib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions src/cdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/cobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/cstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
4 changes: 2 additions & 2 deletions src/ctable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cvalue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/cvalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/cvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 4816e64

Please sign in to comment.