Пример #1
0
static RECPOS get_free()
{
    RECPOS  r, rt;

    r = pci->dx.ff;
    if ( r != NULLREC )
    {  
        if( read_if(r, (char *)&rt, sizeof( RECPOS )))
        {
            pci->dx.ff = rt;
        }
        else 
        {
            DD("error in file %s line %d:\n", __FILE__, __LINE__);
            getchar();
            exit(0);
        }
    }
    else
    {
        r = filelength (pci->ixfile);
    }

    return r;
} 
Пример #2
0
int
initifstat(void)
{
	field_view *v;
	read_if();
	for (v = views_if; v->name != NULL; v++)
		add_view(v);

	return(1);
}
Пример #3
0
static bool load_cache(RECPOS r)
{
    cache_ptr = new_cache();
    if(!read_if(r, (char *)&BUFBLOCK(cache_ptr), sizeof(BLOCK))) 
    {
        DD("error in file %s line %d:\n", __FILE__, __LINE__);
        return FALSE;
    } 
    else 
    {
        return TRUE;
    }
} 
Пример #4
0
AST_stmt* readASTStmt(BufferedReader *reader) {
    uint8_t type = reader->readByte();
    if (VERBOSITY("parsing") >= 2)
        printf("type = %d\n", type);
    if (type == 0)
        return NULL;

    uint8_t checkbyte = reader->readByte();
    assert(checkbyte == 0xae);

    switch (type) {
        case AST_TYPE::Assign:
            return read_assign(reader);
        case AST_TYPE::AugAssign:
            return read_augassign(reader);
        case AST_TYPE::Break:
            return read_break(reader);
        case AST_TYPE::ClassDef:
            return read_classdef(reader);
        case AST_TYPE::Continue:
            return read_continue(reader);
        case AST_TYPE::Expr:
            return read_expr(reader);
        case AST_TYPE::For:
            return read_for(reader);
        case AST_TYPE::FunctionDef:
            return read_functiondef(reader);
        case AST_TYPE::Global:
            return read_global(reader);
        case AST_TYPE::If:
            return read_if(reader);
        case AST_TYPE::Import:
            return read_import(reader);
        case AST_TYPE::ImportFrom:
            return read_importfrom(reader);
        case AST_TYPE::Pass:
            return read_pass(reader);
        case AST_TYPE::Print:
            return read_print(reader);
        case AST_TYPE::Return:
            return read_return(reader);
        case AST_TYPE::While:
            return read_while(reader);
        case AST_TYPE::With:
            return read_with(reader);
        default:
            fprintf(stderr, "Unknown stmt node type (parser.cpp:" STRINGIFY(__LINE__) "): %d\n", type);
            exit(1);
            break;
    }
}
Пример #5
0
int open_index(const char *name, IX_DESC *pix, int dup)
{
    pci = pix;
    //open_if(name);
    pci->ixfile = open_if(name);
    pci->duplicate = dup;
    if(!read_if(0L,(char *)&(pix->root), (sizeof(BLOCK) + sizeof(IX_DISK)))) 
    {
        DD("error in file %s line %d:\n", __FILE__, __LINE__);
        return IX_FAIL;
    }
    if (!cache_init)
    {
        init_cache();
        cache_init = 1;
    }

    first_key(pix);

    return ( IX_OK );
} 
Пример #6
0
static void read_directive(CppContext *ctx) {
    Token *tok;
    if (read_if(ctx, "define"))       read_define(ctx);
    else if (read_if(ctx, "undef"))   read_undef(ctx);
    else if (read_if(ctx, "if"))      handle_cond_incl(ctx, COND_IF);
    else if (read_if(ctx, "elif"))    handle_cond_incl(ctx, COND_ELIF);
    else if (read_if(ctx, "else"))    handle_cond_incl(ctx, COND_ELSE);
    else if (read_if(ctx, "ifdef"))   handle_cond_incl(ctx, COND_IFDEF);
    else if (read_if(ctx, "ifndef"))  handle_cond_incl(ctx, COND_IFNDEF);
    else if (read_if(ctx, "endif"))   handle_cond_incl(ctx, COND_ENDIF);
    else if (read_if(ctx, "include")) handle_include(ctx);
    else if (read_if(ctx, "line"))    handle_line_directive(ctx);
    else if (read_if(ctx, "pragma"))  handle_pragma(ctx);
    else if ( (tok = read_if(ctx, "error")) ) {
        read_error_directive(ctx, tok);
    } else {
        tok = read_cpp_token(ctx);
        if (tok && tok->toktype == TOKTYPE_NEWLINE)
            // 6.10.7 NULL directive.  Do nothing.
            return;
        error_token(tok, "unsupported preprocessor directive: '%s'", token_to_string(tok));
    }
}