generate.c
static void code_function_definition(GenerateContext *c, ParseTreeNode *node)
{
    System *sys = c->sys;
    uint8_t *base = sys->nextLow;
    size_t codeSize;
    VMVALUE code = codeaddr(c);
    putcbyte(c, OP_FRAME);
    putcbyte(c, F_SIZE + node->u.functionDefinition.localOffset);
    code_statement_list(c, node->u.functionDefinition.bodyStatements);
    if (node->u.functionDefinition.symbol)
        putcbyte(c, OP_RETURNZ);
    else
        putcbyte(c, OP_HALT);
    codeSize = sys->nextLow - base;
    if (node->u.functionDefinition.symbol)
        PlaceSymbol(c, node->u.functionDefinition.symbol, code);
    functions[functionCount].symbol = node->u.functionDefinition.symbol;
    functions[functionCount].code = code;
    functions[functionCount].codeLen = codeSize;
    ++functionCount;
}
/* code_function_definition - generate code for a function definition */
generate code for a function definition
generate code for a function definition
static void code_function_definition(GenerateContext *c, ParseTreeNode *node)
{
    System *sys = c->sys;
    uint8_t *base = sys->nextLow;
    size_t codeSize;
    VMVALUE code = codeaddr(c);
    putcbyte(c, OP_FRAME);
    putcbyte(c, F_SIZE + node->u.functionDefinition.localOffset);
    code_statement_list(c, node->u.functionDefinition.bodyStatements);
    if (node->u.functionDefinition.symbol)
        putcbyte(c, OP_RETURNZ);
    else
        putcbyte(c, OP_HALT);
    codeSize = sys->nextLow - base;
    if (node->u.functionDefinition.symbol)
        PlaceSymbol(c, node->u.functionDefinition.symbol, code);
    functions[functionCount].symbol = node->u.functionDefinition.symbol;
    functions[functionCount].code = code;
    functions[functionCount].codeLen = codeSize;
    ++functionCount;
}
static void code_function_definition ( GenerateContext * c , ParseTreeNode * node ) { System * sys = c -> sys ; uint8_t * base = sys -> nextLow ; size_t codeSize ; VMVALUE code = codeaddr ( c ) ; putcbyte ( c , OP_FRAME ) ; putcbyte ( c , F_SIZE + node -> u . functionDefinition . localOffset ) ; code_statement_list ( c , node -> u . functionDefinition . bodyStatements ) ; if ( node -> u . functionDefinition . symbol ) putcbyte ( c , OP_RETURNZ ) ; else putcbyte ( c , OP_HALT ) ; codeSize = sys -> nextLow - base ; if ( node -> u . functionDefinition . symbol ) PlaceSymbol ( c , node -> u . functionDefinition . symbol , code ) ; functions [ functionCount ] . symbol = node -> u . functionDefinition . symbol ; functions [ functionCount ] . code = code ; functions [ functionCount ] . codeLen = codeSize ; ++ functionCount ; }
code_function_definition - generate code for a function definition
code_function_definition - generate code for a function definition