Beispiel #1
0
void sc_changeFile(char *s)               /* name of source file to open */
{
    register int slen;

    if (*s)                                 /* any filename ? */
    {
        if (!gs_fileSp--)                          /* no more entries ? */
            rss_fatal(0, 0, "more than 10 nested #include directives");

                                            /* save the name and line nr. 
                                               of the file */
        gs_fileStack[gs_fileSp].fname = rss_strdup(s); 
        gs_fileStack[gs_fileSp].former_linenr = yylineno;

        gs_filenames = rss_realloc(gs_filenames, /* room for new filename */
                        filenames_len +
                        (slen = strlen(s)) +
                        2);
                                            /* append name */
        sprintf(gs_filenames + filenames_len, "%s\n", s);
        filenames_len += slen + 1;          /* new length of string */

        yylineno = 0;                       /* start at new file */
    }

    util_setSourceName(gs_fileStack[gs_fileSp].fname);
}
Beispiel #2
0
int p_nextCall(void)
{
    register int opcode;

    switch (opcode = rss_getOpcode(gp_bin))
    {
        case op_push_imm:
        case op_jmp:
        case op_jmp_false:
        case op_jmp_true:
        case op_push_strconst:
        case op_push_var:
        case op_pop_var:
        case op_copy_var:
        case op_inc:
        case op_dec:
            fseek(gp_bin, sizeof(int16_t), SEEK_CUR);
        return 0;                         /* close, but no cigar */

        case op_push_1_jmp_end:
        case op_call_rss:
        case op_asp:
            fseek(gp_bin, sizeof(char), SEEK_CUR);
        return 0;                         /* close, but no cigar */

        case op_push_0:
        case op_push_reg:
        case op_umin:
        case op_atoi:
        case op_itoa:
        case op_atol:
        case op_mul:
        case op_div:
        case op_mod:
        case op_add:
        case op_sub:
        case op_eq:
        case op_neq:
        case op_sm:
        case op_gr:
        case op_younger:
        case op_older:
        case op_smeq:
        case op_greq:
        case op_exit:
        case op_ret:
        case op_band:
        case op_bor:
        case op_bnot:
        case op_xor:
        case op_shl:
        case op_shr:
        case op_pop_reg:
                                            /* no argument with opcodes */
        return 0;                         /* close, but no cigar */

        case op_call:
        return 1;                         /* cigar! check this argument */

        case op_frame:                  /* next byte: # bytes to skip */
            fseek(gp_bin, (int)rss_getOpcode(gp_bin), SEEK_CUR);
        return 0;                         /* close, but no cigar */

        default:
            rss_fatal(0, 0,
                "at offset 0x%lx:\n"
                "*INTERNAL ICM-COMP COMPILER ERROR / INVALID BIM-FILE*\n"
                "In function p_nextCall: unrecognized opcode "
                                                    "0x%x encountered\n",
                ftell(gp_bin),
                opcode
            );
    }

    return 0;
}