Exemple #1
0
void MacExpandStart (Macro* M)
/* Start expanding a macro */
{
    MacExp* E;

    /* Check the argument */
    PRECONDITION (M && (M->Style != MAC_STYLE_DEFINE || DisableDefines == 0));

    /* We cannot expand an incomplete macro */
    if (M->Incomplete) {
        Error ("Cannot expand an incomplete macro");
        return;
    }

    /* Don't allow too many nested macro expansions - otherwise it is possible
     * to force an endless loop and assembler crash.
     */
    if (MacExpansions >= MAX_MACEXPANSIONS) {
        Error ("Too many nested macro expansions");
        return;
    }

    /* Create a structure holding expansion data */
    E = NewMacExp (M);

    /* Call the apropriate subroutine */
    switch (M->Style) {
        case MAC_STYLE_CLASSIC: StartExpClassic (E);    break;
        case MAC_STYLE_DEFINE:  StartExpDefine (E);     break;
        default:                Internal ("Invalid macro style: %d", M->Style);
    }
}
Exemple #2
0
void MacExpandStart (void)
/* Start expanding the macro in SVal */
{
    /* Search for the macro */
    Macro* M = HT_FindEntry (&MacroTab, &SVal);
    CHECK (M != 0);

    /* Call the apropriate subroutine */
    switch (M->Style) {
    	case MAC_STYLE_CLASSIC:	StartExpClassic (M);	break;
	case MAC_STYLE_DEFINE:	StartExpDefine (M);	break;
	default:   	      	Internal ("Invalid macro style: %d", M->Style);
    }
}