scandsp/src/dspparser.cxx
// ===========================================================================
// Extract from the given options string those which are mergable, i.e.
// /D and /I options.
//
Extract from the given options string those which are mergable, i.e.
D and /I options.
Extract from the given options string those which are mergable i . e . D and / I options .
static void mergableOptions(const string &opts, string &mrg, bool &hasNonMrg)
{
    hasNonMrg = false;
    const char *op = opts.c_str();
    const char *p = op;
    bool merging = true;
    int mergeOptionPhase = 0;
    const char *copied_so_far = op;
    mrg = "";
    for (;;) {
	const char ch = *p;
	bool ending = false;
	bool go_on_merging = merging;
	if (ch == '/') {
	    go_on_merging = p[1] == 'D' || p[1] == 'I';
	    ending = go_on_merging != merging;
	    if (go_on_merging) {
		mergeOptionPhase = 1;
	    }
	}
	else if (ch == '\0') {
	    ending = true;
	}
	else if (mergeOptionPhase = 1) {
	    mergeOptionPhase = 2;
	}
	else if (isspace(ch)) {
	    if (mergeOptionPhase == 2) {
		mergeOptionPhase = 3;
	    }
	    if (mergeOptionPhase == 4) {
		mergeOptionPhase = 5;
	    }
	}
	else if (mergeOptionPhase == 2 || mergeOptionPhase == 3) {
	    mergeOptionPhase = 4;
	}
	else if (mergeOptionPhase == 5) {
	    go_on_merging = false;
	    ending = (go_on_merging != merging);
	}
	if (ending) {
	    if (merging) {
		for (const char *cp = copied_so_far; cp < p; cp += 1) {
		    mrg.append(1, *cp);
		}
	    }
	    else {
		if (p > copied_so_far) {
		    hasNonMrg = true;
		}
		copied_so_far = p;
	    }
	    merging = go_on_merging;
	    if (ch == '\0') {
		break;
	    }
	}
	p += 1;
	if (ch == '\'' || ch == '"') {
	    for (;;) {
		const char ch2 = *p;
		if (ch2 == '\0') {
		    break;
		}
		p += 1;
		if (ch2 == ch) {
		    break;
		}
	    }
	}
    }
}
static void mergableOptions ( const string & opts , string & mrg , bool & hasNonMrg ) { hasNonMrg = false ; const char * op = opts . c_str ( ) ; const char * p = op ; bool merging = true ; int mergeOptionPhase = 0 ; const char * copied_so_far = op ; mrg = " " ; for ( ; ; ) { const char ch = * p ; bool ending = false ; bool go_on_merging = merging ; if ( ch == ' ' ) { go_on_merging = p [ 1 ] == ' ' || p [ 1 ] == ' ' ; ending = go_on_merging != merging ; if ( go_on_merging ) { mergeOptionPhase = 1 ; } } else if ( ch == ' \0 ' ) { ending = true ; } else if ( mergeOptionPhase = 1 ) { mergeOptionPhase = 2 ; } else if ( isspace ( ch ) ) { if ( mergeOptionPhase == 2 ) { mergeOptionPhase = 3 ; } if ( mergeOptionPhase == 4 ) { mergeOptionPhase = 5 ; } } else if ( mergeOptionPhase == 2 || mergeOptionPhase == 3 ) { mergeOptionPhase = 4 ; } else if ( mergeOptionPhase == 5 ) { go_on_merging = false ; ending = ( go_on_merging != merging ) ; } if ( ending ) { if ( merging ) { for ( const char * cp = copied_so_far ; cp < p ; cp += 1 ) { mrg . append ( 1 , * cp ) ; } } else { if ( p > copied_so_far ) { hasNonMrg = true ; } copied_so_far = p ; } merging = go_on_merging ; if ( ch == ' \0 ' ) { break ; } } p += 1 ; if ( ch == ' \' ' || ch == ' ' ) { for ( ; ; ) { const char ch2 = * p ; if ( ch2 == ' \0 ' ) { break ; } p += 1 ; if ( ch2 == ch ) { break ; } } } } }
Extract from the given options string those which are mergable, i.e.
Extract from the given options string those which are mergable i . e .
// the D or I // whitespace following D or I // whitespace following file or definition // non-whitespace follows D or I // non-whitespace follows complete mergable option // Advance to next character, skipping quoted stuff.