Пример #1
0
static void GetAsmLine( void )
/****************************/
{
    unsigned    AsmErrLine;
    TOKEN       LastToken;
    char        buf[ MAX_ASM_LINE_LEN + 1 ];

    PPCTL_ENABLE_EOL();
    AsmErrLine = TokenLoc.line;
    *buf = '\0';
    if( strcmp( Buffer, "_emit" ) == 0 ) {
        strcpy( buf, AsmSysDefineByte() );
        NextToken();
    }
    LastToken = T_DOT;
    for( ;; ) {
        if( EndOfAsmStmt() )
            break;
        if(( LastToken != T_DOT ) && ( LastToken != T_BAD_CHAR ) && ( CurToken != T_XOR ))
            strncat( buf, " ", MAX_ASM_LINE_LEN );
        strncat( buf, Buffer, MAX_ASM_LINE_LEN );
        LastToken = CurToken;
        NextToken();
    }
    buf[ MAX_ASM_LINE_LEN ] = '\0';
    if( *buf != '\0' ) {
        TokenLoc.line = AsmErrLine;
        AsmSysLine( buf );
    }
    PPCTL_DISABLE_EOL();
}
Пример #2
0
static void getAsmLine( VBUF *buff )
{
    char line[256];

    if( endOfAsmStmt() )
        return;
    /* reserve at least MAX_INSTR_SIZE bytes in the buffer */
    VbufReqd( buff, ((AsmCodeAddress+MAX_INSTR_SIZE) + (MAX_INSTR_SIZE-1)) & ~(MAX_INSTR_SIZE-1) );
    AsmCodeBuffer = VbufBuffer( buff );
    ensureBufferReflectsCurToken();
    if( isId( CurToken ) && strcmp( Buffer, "__emit" ) == 0 ) {
        strcpy( line, AsmSysDefineByte() );
        strcat( line, " " );
        NextToken();
        ensureBufferReflectsCurToken();
    } else {
        line[0] = '\0';
    }
    for(;;) {
        if( endOfAsmStmt() ) break;
        strncat( line, Buffer, sizeof(line)-1 );
        switch( CurToken ) {
        case T_ALT_XOR:
        case T_ALT_EXCLAMATION:
        case T_ALT_AND_AND:
        case T_ALT_OR_OR:
            strncat( line, " ", sizeof(line)-1 );
            break;
        default:
            if( isId( CurToken ) )
                strncat( line, " ", sizeof(line)-1 );
            break;
        }
        NextToken();
        ensureBufferReflectsCurToken();
    }
    if( line[0] != '\0' ) {
        AsmLine( line );
    }
    VbufSetLen( buff, AsmCodeAddress );
    if( CurToken == T_SEMI_COLON ) {
        // ; .ASM comment
        for(;;) {
            NextToken();
            if( CurToken == T_EOF ) break;
            if( CurToken == T_NULL ) break;
        }
    }
}