Operating Systems/OS_Assg2_pipes-main/myexpos/xsm/machine.c
int machine_get_address_int(int write)
{
    int token, address, ret_addr;
    YYSTYPE token_info;

    /* Skip the opening square bracket */
    tokenize_next_token(&token_info);
    token = tokenize_next_token(&token_info);

    switch (token)
    {
    case TOKEN_REGISTER:
        address = registers_get_integer(token_info.str);
        break;

    case TOKEN_NUMBER:
        address = token_info.val;
        break;

    default:
        machine_register_exception("Invalid memory derefence", EXP_ILLINSTR);
    }

    /* Neglect the closing bracket */
    tokenize_next_token(&token_info);

    ret_addr = machine_translate_address(address, write, OPER_FETCH, machine_get_mode());
    return ret_addr;
}
/* Returns the address in the instruction */
Returns the address in the instruction
Returns the address in the instruction
int machine_get_address_int(int write)
{
    int token, address, ret_addr;
    YYSTYPE token_info;
    tokenize_next_token(&token_info);
    token = tokenize_next_token(&token_info);
    switch (token)
    {
    case TOKEN_REGISTER:
        address = registers_get_integer(token_info.str);
        break;
    case TOKEN_NUMBER:
        address = token_info.val;
        break;
    default:
        machine_register_exception("Invalid memory derefence", EXP_ILLINSTR);
    }
    tokenize_next_token(&token_info);
    ret_addr = machine_translate_address(address, write, OPER_FETCH, machine_get_mode());
    return ret_addr;
}
int machine_get_address_int ( int write ) { int token , address , ret_addr ; YYSTYPE token_info ; tokenize_next_token ( & token_info ) ; token = tokenize_next_token ( & token_info ) ; switch ( token ) { case TOKEN_REGISTER : address = registers_get_integer ( token_info . str ) ; break ; case TOKEN_NUMBER : address = token_info . val ; break ; default : machine_register_exception ( " " , EXP_ILLINSTR ) ; } tokenize_next_token ( & token_info ) ; ret_addr = machine_translate_address ( address , write , OPER_FETCH , machine_get_mode ( ) ) ; return ret_addr ; }
Returns the address in the instruction
Returns the address in the instruction
/* Skip the opening square bracket */ /* Neglect the closing bracket */