]> git.saurik.com Git - wxWidgets.git/blobdiff - src/regex/regc_locale.c
Use the data scheme to load resources in the WebKitGTK+ implementation, rather than...
[wxWidgets.git] / src / regex / regc_locale.c
index d68a88a5b114b565c8771f442d4a2e9320e59867..de95cb33e79d90c23015cef7621ea4940b88e04e 100644 (file)
  *
  * wxWidgets:
  *  The Scriptics license can be found in the file COPYRIGHT. Modifications
- *  for wxWidgets are under the wxWidgets licence, see README for details.
+ *  for wxWidgets are under the wxWindows licence, see README for details.
  */
 
+#ifndef CONST
 #define CONST const
+#endif
 
 /* ASCII character-name table */
 
@@ -24,101 +26,101 @@ static struct cname {
     chr *name;
     char code;
 } cnames[] = {
-    {_T("NUL"),                 '\0'},
-    {_T("SOH"),                 '\001'},
-    {_T("STX"),                 '\002'},
-    {_T("ETX"),                 '\003'},
-    {_T("EOT"),                 '\004'},
-    {_T("ENQ"),                 '\005'},
-    {_T("ACK"),                 '\006'},
-    {_T("BEL"),                 '\007'},
-    {_T("alert"),               '\007'},
-    {_T("BS"),                  '\010'},
-    {_T("backspace"),           '\b'},
-    {_T("HT"),                  '\011'},
-    {_T("tab"),                 '\t'},
-    {_T("LF"),                  '\012'},
-    {_T("newline"),             '\n'},
-    {_T("VT"),                  '\013'},
-    {_T("vertical-tab"),        '\v'},
-    {_T("FF"),                  '\014'},
-    {_T("form-feed"),           '\f'},
-    {_T("CR"),                  '\015'},
-    {_T("carriage-return"),     '\r'},
-    {_T("SO"),                  '\016'},
-    {_T("SI"),                  '\017'},
-    {_T("DLE"),                 '\020'},
-    {_T("DC1"),                 '\021'},
-    {_T("DC2"),                 '\022'},
-    {_T("DC3"),                 '\023'},
-    {_T("DC4"),                 '\024'},
-    {_T("NAK"),                 '\025'},
-    {_T("SYN"),                 '\026'},
-    {_T("ETB"),                 '\027'},
-    {_T("CAN"),                 '\030'},
-    {_T("EM"),                  '\031'},
-    {_T("SUB"),                 '\032'},
-    {_T("ESC"),                 '\033'},
-    {_T("IS4"),                 '\034'},
-    {_T("FS"),                  '\034'},
-    {_T("IS3"),                 '\035'},
-    {_T("GS"),                  '\035'},
-    {_T("IS2"),                 '\036'},
-    {_T("RS"),                  '\036'},
-    {_T("IS1"),                 '\037'},
-    {_T("US"),                  '\037'},
-    {_T("space"),               ' '},
-    {_T("exclamation-mark"),    '!'},
-    {_T("quotation-mark"),      '"'},
-    {_T("number-sign"),         '#'},
-    {_T("dollar-sign"),         '$'},
-    {_T("percent-sign"),        '%'},
-    {_T("ampersand"),           '&'},
-    {_T("apostrophe"),          '\''},
-    {_T("left-parenthesis"),    '('},
-    {_T("right-parenthesis"),   ')'},
-    {_T("asterisk"),            '*'},
-    {_T("plus-sign"),           '+'},
-    {_T("comma"),               ','},
-    {_T("hyphen"),              '-'},
-    {_T("hyphen-minus"),        '-'},
-    {_T("period"),              '.'},
-    {_T("full-stop"),           '.'},
-    {_T("slash"),               '/'},
-    {_T("solidus"),             '/'},
-    {_T("zero"),                '0'},
-    {_T("one"),                 '1'},
-    {_T("two"),                 '2'},
-    {_T("three"),               '3'},
-    {_T("four"),                '4'},
-    {_T("five"),                '5'},
-    {_T("six"),                 '6'},
-    {_T("seven"),               '7'},
-    {_T("eight"),               '8'},
-    {_T("nine"),                '9'},
-    {_T("colon"),               ':'},
-    {_T("semicolon"),           ';'},
-    {_T("less-than-sign"),      '<'},
-    {_T("equals-sign"),         '='},
-    {_T("greater-than-sign"),   '>'},
-    {_T("question-mark"),       '?'},
-    {_T("commercial-at"),       '@'},
-    {_T("left-square-bracket"), '['},
-    {_T("backslash"),           '\\'},
-    {_T("reverse-solidus"),     '\\'},
-    {_T("right-square-bracket"), ']'},
-    {_T("circumflex"),          '^'},
-    {_T("circumflex-accent"),   '^'},
-    {_T("underscore"),          '_'},
-    {_T("low-line"),            '_'},
-    {_T("grave-accent"),        '`'},
-    {_T("left-brace"),          '{'},
-    {_T("left-curly-bracket"),  '{'},
-    {_T("vertical-line"),       '|'},
-    {_T("right-brace"),         '}'},
-    {_T("right-curly-bracket"), '}'},
-    {_T("tilde"),               '~'},
-    {_T("DEL"),                 '\177'},
+    {wxT("NUL"),                 '\0'},
+    {wxT("SOH"),                 '\001'},
+    {wxT("STX"),                 '\002'},
+    {wxT("ETX"),                 '\003'},
+    {wxT("EOT"),                 '\004'},
+    {wxT("ENQ"),                 '\005'},
+    {wxT("ACK"),                 '\006'},
+    {wxT("BEL"),                 '\007'},
+    {wxT("alert"),               '\007'},
+    {wxT("BS"),                  '\010'},
+    {wxT("backspace"),           '\b'},
+    {wxT("HT"),                  '\011'},
+    {wxT("tab"),                 '\t'},
+    {wxT("LF"),                  '\012'},
+    {wxT("newline"),             '\n'},
+    {wxT("VT"),                  '\013'},
+    {wxT("vertical-tab"),        '\v'},
+    {wxT("FF"),                  '\014'},
+    {wxT("form-feed"),           '\f'},
+    {wxT("CR"),                  '\015'},
+    {wxT("carriage-return"),     '\r'},
+    {wxT("SO"),                  '\016'},
+    {wxT("SI"),                  '\017'},
+    {wxT("DLE"),                 '\020'},
+    {wxT("DC1"),                 '\021'},
+    {wxT("DC2"),                 '\022'},
+    {wxT("DC3"),                 '\023'},
+    {wxT("DC4"),                 '\024'},
+    {wxT("NAK"),                 '\025'},
+    {wxT("SYN"),                 '\026'},
+    {wxT("ETB"),                 '\027'},
+    {wxT("CAN"),                 '\030'},
+    {wxT("EM"),                  '\031'},
+    {wxT("SUB"),                 '\032'},
+    {wxT("ESC"),                 '\033'},
+    {wxT("IS4"),                 '\034'},
+    {wxT("FS"),                  '\034'},
+    {wxT("IS3"),                 '\035'},
+    {wxT("GS"),                  '\035'},
+    {wxT("IS2"),                 '\036'},
+    {wxT("RS"),                  '\036'},
+    {wxT("IS1"),                 '\037'},
+    {wxT("US"),                  '\037'},
+    {wxT("space"),               ' '},
+    {wxT("exclamation-mark"),    '!'},
+    {wxT("quotation-mark"),      '"'},
+    {wxT("number-sign"),         '#'},
+    {wxT("dollar-sign"),         '$'},
+    {wxT("percent-sign"),        '%'},
+    {wxT("ampersand"),           '&'},
+    {wxT("apostrophe"),          '\''},
+    {wxT("left-parenthesis"),    '('},
+    {wxT("right-parenthesis"),   ')'},
+    {wxT("asterisk"),            '*'},
+    {wxT("plus-sign"),           '+'},
+    {wxT("comma"),               ','},
+    {wxT("hyphen"),              '-'},
+    {wxT("hyphen-minus"),        '-'},
+    {wxT("period"),              '.'},
+    {wxT("full-stop"),           '.'},
+    {wxT("slash"),               '/'},
+    {wxT("solidus"),             '/'},
+    {wxT("zero"),                '0'},
+    {wxT("one"),                 '1'},
+    {wxT("two"),                 '2'},
+    {wxT("three"),               '3'},
+    {wxT("four"),                '4'},
+    {wxT("five"),                '5'},
+    {wxT("six"),                 '6'},
+    {wxT("seven"),               '7'},
+    {wxT("eight"),               '8'},
+    {wxT("nine"),                '9'},
+    {wxT("colon"),               ':'},
+    {wxT("semicolon"),           ';'},
+    {wxT("less-than-sign"),      '<'},
+    {wxT("equals-sign"),         '='},
+    {wxT("greater-than-sign"),   '>'},
+    {wxT("question-mark"),       '?'},
+    {wxT("commercial-at"),       '@'},
+    {wxT("left-square-bracket"), '['},
+    {wxT("backslash"),           '\\'},
+    {wxT("reverse-solidus"),     '\\'},
+    {wxT("right-square-bracket"), ']'},
+    {wxT("circumflex"),          '^'},
+    {wxT("circumflex-accent"),   '^'},
+    {wxT("underscore"),          '_'},
+    {wxT("low-line"),            '_'},
+    {wxT("grave-accent"),        '`'},
+    {wxT("left-brace"),          '{'},
+    {wxT("left-curly-bracket"),  '{'},
+    {wxT("vertical-line"),       '|'},
+    {wxT("right-brace"),         '}'},
+    {wxT("right-curly-bracket"), '}'},
+    {wxT("tilde"),               '~'},
+    {wxT("DEL"),                 '\177'},
     {NULL,                      0}
 };
 
@@ -634,9 +636,9 @@ static struct cclass {
  */
 
 #define Tcl_UniChar wxChar
-Tcl_UniChar Tcl_UniCharToUpper(int ch) { return wxToupper(ch); }
-Tcl_UniChar Tcl_UniCharToLower(int ch) { return wxTolower(ch); }
-Tcl_UniChar Tcl_UniCharToTitle(int ch) { return wxToupper(ch); }
+Tcl_UniChar Tcl_UniCharToUpper(int ch) { return wxCRT_ToupperNative(ch); }
+Tcl_UniChar Tcl_UniCharToLower(int ch) { return wxCRT_TolowerNative(ch); }
+Tcl_UniChar Tcl_UniCharToTitle(int ch) { return wxCRT_ToupperNative(ch); }
 
 #endif  /* !wxUSE_UNICODE */
 
@@ -703,7 +705,7 @@ element(v, startp, endp)
 
     /* search table */
     for (cn=cnames; cn->name!=NULL; cn++) {
-       if (wxStrlen_(cn->name)==len && wxStrncmp(cn->name, startp, len)==0) {
+       if (wxCRT_StrlenNative(cn->name)==len && wxCRT_StrncmpNative(cn->name, startp, len)==0) {
            break;                      /* NOTE BREAK OUT */
        }
     }
@@ -850,8 +852,8 @@ cclass(v, startp, endp, cases)
      */
 
     static chr *classNames[] = {
-       _T("alnum"), _T("alpha"), _T("ascii"), _T("blank"), _T("cntrl"), _T("digit"), _T("graph"),
-       _T("lower"), _T("print"), _T("punct"), _T("space"), _T("upper"), _T("xdigit"), NULL
+       wxT("alnum"), wxT("alpha"), wxT("ascii"), wxT("blank"), wxT("cntrl"), wxT("digit"), wxT("graph"),
+       wxT("lower"), wxT("print"), wxT("punct"), wxT("space"), wxT("upper"), wxT("xdigit"), NULL
     };
 
     enum classes {
@@ -871,9 +873,9 @@ cclass(v, startp, endp, cases)
      * Remap lower and upper to alpha if the match is case insensitive.
      */
 
-    if (cases && len == 5 && (wxStrncmp(_T("lower"), np, 5) == 0
-           || wxStrncmp(_T("upper"), np, 5) == 0)) {
-       np = _T("alpha");
+    if (cases && len == 5 && (wxCRT_StrncmpNative(wxT("lower"), np, 5) == 0
+           || wxCRT_StrncmpNative(wxT("upper"), np, 5) == 0)) {
+       np = wxT("alpha");
     }
 
     /*
@@ -882,7 +884,7 @@ cclass(v, startp, endp, cases)
 
     index = -1;
     for (namePtr=classNames,i=0 ; *namePtr!=NULL ; namePtr++,i++) {
-       if ((wxStrlen_(*namePtr) == len) && (wxStrncmp(*namePtr, np, len) == 0)) {
+       if ((wxCRT_StrlenNative(*namePtr) == len) && (wxCRT_StrncmpNative(*namePtr, np, len) == 0)) {
            index = i;
            break;
        }
@@ -1057,11 +1059,11 @@ int cases;                      /* case-independent? */
     /* find the name */
     len = endp - startp;
     np = startp;
-    if (cases && len == 5 && (wxStrncmp(_T("lower"), np, 5) == 0 ||
-                                    wxStrncmp(_T("upper"), np, 5) == 0))
-            np = _T("alpha");
+    if (cases && len == 5 && (wxCRT_StrncmpNative(wxT("lower"), np, 5) == 0 ||
+                                    wxCRT_StrncmpNative(wxT("upper"), np, 5) == 0))
+            np = wxT("alpha");
     for (cc = cclasses; cc->name != NULL; cc++)
-            if (wxStrlen_(cc->name) == len && wxStrncmp(cc->name, np, len) == 0)
+            if (wxCRT_StrlenNative(cc->name) == len && wxCRT_StrncmpNative(cc->name, np, len) == 0)
                     break;          /* NOTE BREAK OUT */
     if (cc->name == NULL) {
             ERR(REG_ECTYPE);