Ejemplo n.º 1
0
static void add_constant( char *string )
/**************************************/
{
    char *tmp;
    char *one = "1";

    tmp = strchr( string, '=' );
    if( tmp == NULL ) {
        tmp = strchr( string, '#' );
        if( tmp == NULL ) {
            tmp = one;
        } else {
            *tmp = '\0';
            tmp++;
        }
    } else {
        *tmp = '\0';
        tmp++;
    }

    if( isvalidident( string ) == ERROR ) {
        AsmError( SYNTAX_ERROR ); // fixme
        return;
    }

    StoreConstant( string, tmp, FALSE ); // don't allow it to be redef'd
}
Ejemplo n.º 2
0
static void add_constant( const char *string, bool underscored )
/**************************************************************/
{
    char    name[MAX_LINE_LEN];
    char    *tmp;
    char    c;

    tmp = name;
    if( underscored ) {
        *tmp++ = '_'; *tmp++ = '_';
    }
    while( (c = *string) != '\0' ) {
        ++string;
        if( c == '=' || c == '#' )
            break;
        *tmp++ = c;
    }
    if( underscored ) {
        *tmp++ = '_'; *tmp++ = '_';
    }
    *tmp = '\0';
    if( *string == '\0' )
        string = "1";

    if( isvalidident( name ) ) {
        AsmError( SYNTAX_ERROR ); // fixme
        return;
    }

    StoreConstant( name, string, false ); // don't allow it to be redef'd
}