Apparently, TCC does not call onig_set_default_syntax() when it sets the regular expression syntax. It would be nice if it did. Then plugins could specify ONIG_SYNTAX_DEFAULT and not have to worry about getting it right (or whether the user has used OPTION to change the syntax). As it is I QueryOptionValue() and set it myself in every function that uses Onig.
Could you add that call to the startup and OPTION routines?
I do it like this.
Could you add that call to the startup and OPTION routines?
I do it like this.
Code:
VOID GetRegexSyntax ( VOID ) {
WCHAR szResponse[16];
OnigSyntaxType *psyntax = ONIG_SYNTAX_PERL;
if ( QueryOptionValue( L"RegularExpressions", szResponse ) )
psyntax = ONIG_SYNTAX_PERL;
else {
if ( !lstrcmpi(szResponse, L"PERL" ) ) psyntax = ONIG_SYNTAX_PERL;
if ( !lstrcmpi(szResponse, L"RUBY" ) ) psyntax = ONIG_SYNTAX_RUBY;
if ( !lstrcmpi(szResponse, L"JAVA" ) ) psyntax = ONIG_SYNTAX_JAVA;
if ( !lstrcmpi(szResponse, L"GREP" ) ) psyntax = ONIG_SYNTAX_GREP;
if ( !lstrcmpi(szResponse, L"POSIX") ) psyntax = ONIG_SYNTAX_POSIX_EXTENDED;
if ( !lstrcmpi(szResponse, L"GNU" ) ) psyntax = ONIG_SYNTAX_GNU_REGEX;
}
onig_set_default_syntax(psyntax);
}