mirror of
https://github.com/CPunch/Cosmo.git
synced 2026-06-25 02:40:05 +00:00
started cundump.c:cosmoD_undump(); minor fixes
This commit is contained in:
15
src/cdump.c
15
src/cdump.c
@@ -92,18 +92,12 @@ static void writeCObjFunction(DumpState *dstate, CObjFunction *obj)
|
||||
writeVector(dstate, obj->chunk.lineInfo, sizeof(int) * obj->chunk.count);
|
||||
|
||||
/* write constants */
|
||||
writeSize(dstate, obj->chunk.constants.count);
|
||||
for (int i = 0; i < obj->chunk.constants.count; i++) {
|
||||
writeCValue(dstate, obj->chunk.constants.values[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#define WRITE_VAR(dstate, type, expression) \
|
||||
{ \
|
||||
type _tmp = expression; \
|
||||
writeBlock(dstate, &_tmp, sizeof(_tmp)); \
|
||||
break; \
|
||||
}
|
||||
|
||||
static void writeCObj(DumpState *dstate, CObj *obj)
|
||||
{
|
||||
/*
|
||||
@@ -132,6 +126,13 @@ static void writeCObj(DumpState *dstate, CObj *obj)
|
||||
}
|
||||
}
|
||||
|
||||
#define WRITE_VAR(dstate, type, expression) \
|
||||
{ \
|
||||
type _tmp = expression; \
|
||||
writeBlock(dstate, &_tmp, sizeof(_tmp)); \
|
||||
break; \
|
||||
}
|
||||
|
||||
static void writeCValue(DumpState *dstate, CValue val)
|
||||
{
|
||||
CosmoType t = GET_TYPE(val);
|
||||
|
||||
Reference in New Issue
Block a user