Esempio n. 1
0
int main(){
    int i, j;
    char *title = malloc(64);
    WORD r;
    bool is_x[] = {
        false, true
    };
    char *str[] = {
        "", "0", "aaa", "GR", "GR8", "GR20",
        "GR0", "GR1", "GR2", "GR3", "GR4", "GR5", "GR6", "GR7"
    };
    static CERR cerr_getgr[] = {
        { 120, "GR0 in operand x" },
    };

    cerr_init();    /* エラーの初期化 */
    addcerrlist(ARRAYSIZE(cerr_getgr), cerr_getgr);
    for(i = 0; i <= 1; i++) {
        title = (is_x[i] == false) ? "Generel Register" : "Index Register";
        printf("== %s ==\n", title);
        for(j = 0; j < ARRAYSIZE(str); j++) {
            cerr->num = 0;
            r = getgr(str[j], is_x[i]);
            printf("%s\t#%04X", str[j], r);
            if(cerr->num > 0) {
                printf("\tError - %d\t%s", cerr->num, cerr->msg);
            }
            printf("\n");
        }
    }
    freecerr();
    return 0;
}
Esempio n. 2
0
int main(){
    CERRLIST *p;
    /* エラーの追加 */
    addcerrlist(ARRAYSIZE(cerr_0), cerr_0);
    addcerrlist(ARRAYSIZE(cerr_1), cerr_1);
    addcerrlist(ARRAYSIZE(cerr_2), cerr_2);
    addcerrlist(ARRAYSIZE(cerr_3), cerr_3);
    addcerrlist(ARRAYSIZE(cerr_4), cerr_4);
    addcerrlist(ARRAYSIZE(cerr_5), cerr_5);
    for(p = cerrlist; p != NULL; p = p->next) {
        printf("%d: %s\n", p->cerr->num, p->cerr->msg);
    }
    return 0;
}
Esempio n. 3
0
int main(){
    int i, j;
    int code[] = {
        101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
        111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
        121, 122, 123, 124, 201, 202, 203, 204, 205, 206, 207, 999
    };
    const char *str[] = {NULL, "foobar"};
    addcerrlist(ARRAYSIZE(cerr_utest), cerr_utest);
    /* エラーの初期化 */
    cerr = malloc_chk(sizeof(CERR), "cerr");
    for(i = 0; i < ARRAYSIZE(str); i++) {
        for(j = 0; j < ARRAYSIZE(code); j++) {
            setcerr(code[j], str[i]);
            printf("%d: %s - %d\t%s\n", code[j], str[i], cerr->num, cerr->msg);
        }
    }
    freecerr();
    return 0;
}
Esempio n. 4
0
/* assemble.hで定義された関数群 */
void addcerrlist_tok()
{
    addcerrlist(ARRAYSIZE(cerr_linetok), cerr_linetok);
    addcerrlist(ARRAYSIZE(cerr_opdtok), cerr_opdtok);
}