mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-05 08:10:05 +00:00
minor formatting fixes
This commit is contained in:
parent
8df4cc65e3
commit
5d805e258b
@ -9,7 +9,6 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
// ================================================================ [BASELIB]
|
// ================================================================ [BASELIB]
|
||||||
// ================================================================
|
|
||||||
|
|
||||||
int cosmoB_print(CState *state, int nargs, CValue *args)
|
int cosmoB_print(CState *state, int nargs, CValue *args)
|
||||||
{
|
{
|
||||||
@ -164,7 +163,6 @@ void cosmoB_loadLibrary(CState *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================ [OBJECT.*]
|
// ================================================================ [OBJECT.*]
|
||||||
// ================================================================
|
|
||||||
|
|
||||||
int cosmoB_osetProto(CState *state, int nargs, CValue *args)
|
int cosmoB_osetProto(CState *state, int nargs, CValue *args)
|
||||||
{
|
{
|
||||||
@ -255,7 +253,6 @@ COSMO_API void cosmoB_loadObjLib(CState *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================ [OS.*]
|
// ================================================================ [OS.*]
|
||||||
// ================================================================
|
|
||||||
|
|
||||||
// os.read()
|
// os.read()
|
||||||
int cosmoB_osRead(CState *state, int nargs, CValue *args)
|
int cosmoB_osRead(CState *state, int nargs, CValue *args)
|
||||||
@ -353,7 +350,6 @@ COSMO_API void cosmoB_loadOSLib(CState *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================ [STRING.*]
|
// ================================================================ [STRING.*]
|
||||||
// ================================================================
|
|
||||||
|
|
||||||
// string.sub
|
// string.sub
|
||||||
int cosmoB_sSub(CState *state, int nargs, CValue *args)
|
int cosmoB_sSub(CState *state, int nargs, CValue *args)
|
||||||
@ -629,7 +625,6 @@ void cosmoB_loadStrLib(CState *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================ [MATH]
|
// ================================================================ [MATH]
|
||||||
// ================================================================
|
|
||||||
|
|
||||||
// math.abs
|
// math.abs
|
||||||
int cosmoB_mAbs(CState *state, int nargs, CValue *args)
|
int cosmoB_mAbs(CState *state, int nargs, CValue *args)
|
||||||
@ -847,7 +842,6 @@ void cosmoB_loadMathLib(CState *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================ [VM.*]
|
// ================================================================ [VM.*]
|
||||||
// ================================================================
|
|
||||||
|
|
||||||
// vm.__getter["globals"]
|
// vm.__getter["globals"]
|
||||||
int cosmoB_vgetGlobal(CState *state, int nargs, CValue *args)
|
int cosmoB_vgetGlobal(CState *state, int nargs, CValue *args)
|
||||||
|
@ -56,7 +56,6 @@ int addConstant(CState *state, CChunk *chunk, CValue value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================ [WRITE TO CHUNK]
|
// ================================================================ [WRITE TO CHUNK]
|
||||||
// ================================================================
|
|
||||||
|
|
||||||
void writeu8Chunk(CState *state, CChunk *chunk, INSTRUCTION i, int line)
|
void writeu8Chunk(CState *state, CChunk *chunk, INSTRUCTION i, int line)
|
||||||
{
|
{
|
||||||
@ -71,8 +70,8 @@ void writeu8Chunk(CState *state, CChunk *chunk, INSTRUCTION i, int line)
|
|||||||
|
|
||||||
void writeu16Chunk(CState *state, CChunk *chunk, uint16_t i, int line)
|
void writeu16Chunk(CState *state, CChunk *chunk, uint16_t i, int line)
|
||||||
{
|
{
|
||||||
|
static const int sz = sizeof(uint16_t) / sizeof(INSTRUCTION);
|
||||||
INSTRUCTION *buffer = (INSTRUCTION *)(&i);
|
INSTRUCTION *buffer = (INSTRUCTION *)(&i);
|
||||||
int sz = sizeof(uint16_t) / sizeof(INSTRUCTION);
|
|
||||||
|
|
||||||
for (int i = 0; i < sz; i++) {
|
for (int i = 0; i < sz; i++) {
|
||||||
writeu8Chunk(state, chunk, buffer[i], line);
|
writeu8Chunk(state, chunk, buffer[i], line);
|
||||||
|
@ -108,7 +108,6 @@ static ParseRule *getRule(CTokenType type);
|
|||||||
static CObjFunction *endCompiler(CParseState *pstate);
|
static CObjFunction *endCompiler(CParseState *pstate);
|
||||||
|
|
||||||
// ================================================================ [FRONT END/TALK TO LEXER]
|
// ================================================================ [FRONT END/TALK TO LEXER]
|
||||||
// ================================================================
|
|
||||||
|
|
||||||
static void initCompilerState(CParseState *pstate, CCompilerState *ccstate, FunctionType type,
|
static void initCompilerState(CParseState *pstate, CCompilerState *ccstate, FunctionType type,
|
||||||
CCompilerState *enclosing)
|
CCompilerState *enclosing)
|
||||||
@ -269,7 +268,6 @@ static bool blockFollow(CToken token)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================ [WRITE TO CHUNK]
|
// ================================================================ [WRITE TO CHUNK]
|
||||||
// ================================================================
|
|
||||||
|
|
||||||
CChunk *getChunk(CParseState *pstate)
|
CChunk *getChunk(CParseState *pstate)
|
||||||
{
|
{
|
||||||
@ -460,7 +458,6 @@ static bool isLast(CParseState *pstate, Precedence pType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================ [PARSER]
|
// ================================================================ [PARSER]
|
||||||
// ================================================================
|
|
||||||
|
|
||||||
static void number(CParseState *pstate, bool canAssign, Precedence prec)
|
static void number(CParseState *pstate, bool canAssign, Precedence prec)
|
||||||
{
|
{
|
||||||
|
@ -59,8 +59,7 @@ struct CState
|
|||||||
|
|
||||||
CValue *top; // top of the stack
|
CValue *top; // top of the stack
|
||||||
CObjObject *protoObjects[COBJ_MAX]; // proto object for each COBJ type [NULL = no default proto]
|
CObjObject *protoObjects[COBJ_MAX]; // proto object for each COBJ type [NULL = no default proto]
|
||||||
CObjString
|
CObjString *iStrings[ISTRING_MAX]; // strings used internally by the VM, eg. __init, __index
|
||||||
*iStrings[ISTRING_MAX]; // strings used internally by the VM, eg. __init, __index & friends
|
|
||||||
CCallFrame callFrame[FRAME_MAX]; // call frames
|
CCallFrame callFrame[FRAME_MAX]; // call frames
|
||||||
CValue stack[STACK_MAX]; // stack
|
CValue stack[STACK_MAX]; // stack
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user