Exemple #1
0
/**
 * Display the integer into a byte (FR:octet).
 *
 * @param n
 *		A char.
 */
void displayByte(char n) {
	int mask;
	mask = 0x80 ; /*<<<<< 0x8;*/
	while (mask)
	{
		putBinary('0' + ((n & mask) != 0));
		mask >>= 1;
		if(mask == 0xFF00000) putBinary('\'');/*<<<<<*/
	}
}
Exemple #2
0
static void putSrcFile( REWRITE *r, TOKEN_LOCN *locn )
{
    uint_32 srcfile_index;

    srcfile_index = newSrcFileHandle( r, locn->src_file );
    putToken( r, T_REWRITE_MODS );
    putByte( r, CODE_FILE );
    putBinary( r, (uint_8*)&srcfile_index, sizeof( srcfile_index ) );
    locn->line = 0;
    locn->column = 0;
}
Exemple #3
0
/**
 * Display the integer into bytes (FR:octets).
 *
 * @param n
 *		An unsigned integer.
 */
void displayValue(unsigned int n) {
	char *n_addr;
	unsigned int mask;
	n_addr = (char *) &n;
	mask = 0xFF000000; /* <<<<<< 0xF00000 */
	while(mask) {
		displayByte(*n_addr++);
		mask >>= 8;   /* <<<<<< 4*/
		if (mask) putBinary('\'');
	}
	printf("\n");
}
Exemple #4
0
static void saveToken( REWRITE *r, TOKEN_LOCN *locn )
{
    putSrcLocn( r, locn );
    switch( CurToken ) {
    case T_STRING:
    case T_LSTRING:
    case T_ID:
    case T_BAD_CHAR:
        putToken( r, CurToken );
        putString( r, Buffer );
        break;
    case T_BAD_TOKEN:
        putToken( r, CurToken );
        putBinary( r, (uint_8*)&BadTokenInfo, sizeof( BadTokenInfo ) );
        break;
    case T_SAVED_ID:
        putToken( r, T_ID );
        putString( r, NameStr( SavedId ) );
        break;
    case T_CONSTANT:
        putToken( r, CurToken );
        putBinary( r, (uint_8*)&ConstType, sizeof( ConstType ) );
        switch( ConstType ) {
        case TYP_LONG_DOUBLE:
        case TYP_DOUBLE:
        case TYP_FLOAT:
            putString( r, Buffer );
            break;
        default:
            putBinary( r, (uint_8*)&Constant64, sizeof( Constant64 ) );
            break;
        }
        break;
    default:
        putToken( r, CurToken );
        break;
    }
}
Exemple #5
0
static void putSrcLocn( REWRITE *r, TOKEN_LOCN *locn )
{
    SRCFILE currfile;
    uint_32 absolute;
    uint_8 code_byte;

    currfile = SrcFileCurrent();
    if( currfile != locn->src_file ) {
        locn->src_file = currfile;
        putSrcFile( r, locn );
    }
    putToken( r, T_REWRITE_MODS );
    if( ( TokenLine - locn->line ) > 127 ) {
        putByte( r, CODE_ABS );
        absolute = TokenLine | MASK_ABS_LINE;
        putBinary( r, (uint_8*)&absolute, sizeof( absolute ) );
        locn->line = TokenLine;
    } else if( ( TokenLine - locn->line ) > 0 ) {
        code_byte = ( TokenLine - locn->line ) | MASK_DELTA_LINE;
        putByte( r, code_byte );
        locn->line = TokenLine;
    }
    if( ( TokenColumn - locn->column ) > 127 ) {
        putByte( r, CODE_ABS );
        absolute = TokenColumn;
        putBinary( r, (uint_8*)&absolute, sizeof( absolute ) );
        locn->column = TokenColumn;
    } else if( ( TokenColumn - locn->column ) > 0 ) {
        code_byte = TokenColumn - locn->column;
        putByte( r, code_byte );
        locn->column = TokenColumn;
    } else {                        // this guards against token at same col.
        putByte( r, CODE_ABS );
        absolute = TokenColumn;
        putBinary( r, (uint_8*)&absolute, sizeof( absolute ) );
        locn->column = TokenColumn;
    }
}
Exemple #6
0
static void putToken( REWRITE *r, TOKEN token )
{
    putBinary( r, (uint_8 *)&token, sizeof( token ) );
}