Changeset 1002


Ignore:
Timestamp:
Jan 18, 2004, 10:09:31 AM (22 years ago)
Author:
bird
Message:

No constructors to initate data in the datasegment. Added generator and new values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/locale/locale_ctype.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1001 r1002  
    55    For conditions of distribution and use, see the file COPYING.
    66
    7     Default character type bits for "C" locale.
     7    Default character type bits for "C" locale (default = ASCII).
    88*/
    99
     
    1313#include <string.h>
    1414
    15 
    16 /*
    17     Locale support implementation through OS/2 Unicode API.
    18     Copyright (c) 2003 InnoTek Systemberatung GmbH
    19 
    20     For conditions of distribution and use, see the file COPYING.
    21 
    22     Global locale information structure.
    23 */
    24 
    2515struct __locale_ctype __locale_ctype =
    2616{
    2717  cflags:
    2818  {
    29     0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
    30     0x10, 0x30, 0x30, 0x30, 0x30, 0x30, 0x10, 0x10,
    31     0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
    32     0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
    33     0xa0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
    34     0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
    35     0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c,
    36     0x8c, 0x8c, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
    37     0xc0, 0x89, 0x89, 0x89, 0x89, 0x89, 0x89, 0x81,
    38     0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
    39     0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,
    40     0x81, 0x81, 0x81, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
    41     0xc0, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0x82,
    42     0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
    43     0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82,
    44     0x82, 0x82, 0x82, 0xc0, 0xc0, 0xc0, 0xc0, 0x10,
    45     /* Second half of the table is empty according to ANSI C */
    46     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    47     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    48     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    49     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    50     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    51     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    52     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    53     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    54     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    55     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    56     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    57     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    58     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    59     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    60     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    61     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    62   }
     19    0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020,
     20    0x8020, 0x8068, 0x8028, 0x8028, 0x8028, 0x8028, 0x8020, 0x8020,
     21    0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020,
     22    0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020,
     23    0x8848, 0x8c10, 0x8c10, 0x8c10, 0xac10, 0x8c10, 0x8c10, 0x8c10,
     24    0x8c10, 0x8c10, 0x8c10, 0xac10, 0x8c10, 0x8c10, 0x8c10, 0x8c10,
     25    0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84,
     26    0x9e84, 0x9e84, 0x8c10, 0x8c10, 0xac10, 0xac10, 0xac10, 0x8c10,
     27    0x8c10, 0x8f81, 0x8f81, 0x8f81, 0x8f81, 0x8f81, 0x8f81, 0x8f01,
     28    0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01,
     29    0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01,
     30    0x8f01, 0x8f01, 0x8f01, 0x8c10, 0x8c10, 0x8c10, 0xac10, 0x8c10,
     31    0xac10, 0x8f82, 0x8f82, 0x8f82, 0x8f82, 0x8f82, 0x8f82, 0x8f02,
     32    0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02,
     33    0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02,
     34    0x8f02, 0x8f02, 0x8f02, 0x8c10, 0xac10, 0x8c10, 0xac10, 0x8020,
     35  },
     36  upcase:
     37  {
     38    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
     39    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     40    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
     41    0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
     42    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
     43    0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
     44    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
     45    0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
     46    0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
     47    0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
     48    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
     49    0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
     50    0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
     51    0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
     52    0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
     53    0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
     54  },
     55  locase:
     56  {
     57    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
     58    0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     59    0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
     60    0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
     61    0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
     62    0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
     63    0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
     64    0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
     65    0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
     66    0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
     67    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
     68    0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
     69    0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
     70    0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
     71    0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
     72    0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
     73  },
     74  mbcsprefix:
     75  {
     76    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     77    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     78    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     79    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     80    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     81    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     82    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     83    0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     84  },
     85  uconv: 0,
     86  locale: 0,
     87  mbcs: 0x0
    6388};
    6489
     
    7297{ return __locale_ctype.upcase [_c & 0xff]; }
    7398
    74 static void __attribute__((constructor)) __locale_ctype_init ()
     99
     100#if 0 /* code for regenerating that table. */
     101
     102#define __INTERNAL_DEFS
     103#include <locale.h>
     104#include <ctype.h>
     105#include <stdio.h>
     106
     107int main()
    75108{
    76   int i;
     109    int i;
     110    setlocale(LC_CTYPE, "en_US");
     111    /*setlocale(LC_CTYPE, "ASCII"); - doesn't work in OS/2 */
     112    printf("/*\n"
     113           "    Locale support implementation through OS/2 Unicode API.\n"
     114           "    Copyright (c) 2003 InnoTek Systemberatung GmbH\n"
     115           "\n"
     116           "    For conditions of distribution and use, see the file COPYING.\n"
     117           "\n"
     118           "    Default character type bits for \"C\" locale.\n"
     119           "*/\n"
     120           "\n"
     121           "#define __INTERNAL_DEFS\n"
     122           "#include \"libc-alias.h\"\n"
     123           "#include <sys/locale.h>\n"
     124           "#include <string.h>\n"
     125           "\n"
     126           "\n"
     127           "struct __locale_ctype __locale_ctype =\n"
     128           "{\n"
     129           "  cflags:\n"
     130           "  {");
     131    for (i = 0; i < /*sizeof(__locale_ctype.cflags) / sizeof(__locale_ctype.cflags[0])*/ 128; i++)
     132    {
     133        if (i % 8)
     134            printf("0x%03x, ", (int)__locale_ctype.cflags[i]);
     135        else
     136            printf("\n    0x%03x, ", (int)__locale_ctype.cflags[i]);
     137    }
     138    printf("\n  },\n"
     139           "  upcase:\n"
     140           "  {");
     141    for (i = 0; i < /*sizeof(__locale_ctype.upcase) / sizeof(__locale_ctype.upcase[0]) */ 128; i++)
     142    {
     143        if (i % 8)
     144            printf("0x%02x, ", (int)__locale_ctype.upcase[i]);
     145        else
     146            printf("\n    0x%02x, ", (int)__locale_ctype.upcase[i]);
     147    }
     148    printf("\n  },\n"
     149           "  locase:\n"
     150           "  {");
     151    for (i = 0; i < /*sizeof(__locale_ctype.locase) / sizeof(__locale_ctype.locase[0])*/ 128; i++)
     152    {
     153        if (i % 8)
     154            printf("0x%02x, ", (int)__locale_ctype.locase[i]);
     155        else
     156            printf("\n    0x%02x, ", (int)__locale_ctype.locase[i]);
     157    }
     158    printf("\n  },\n"
     159           "  mbcsprefix:\n"
     160           "  {");
     161    for (i = 0; i < sizeof(__locale_ctype.mbcsprefix) / sizeof(__locale_ctype.mbcsprefix[0]); i++)
     162    {
     163        if (i % 8)
     164            printf("0x%02x, ", (int)__locale_ctype.mbcsprefix[i]);
     165        else
     166            printf("\n    0x%02x, ", (int)__locale_ctype.mbcsprefix[i]);
     167    }
     168    printf("\n  },\n"
     169           "  uconv: 0,\n"
     170           "  locale: 0,\n"
     171           "  mbcs: 0x%x\n"
     172           "};\n",
     173           (int)__locale_ctype.mbcs);
    77174
    78   __locale_ctype.uconv = NULL;
     175    return 0;
     176}
    79177
    80   for (i = 0; i < 256; i++)
    81   {
    82     __locale_ctype.upcase [i] = (i >= 'a' && i <= 'z') ? i & 0xdf : i;
    83     __locale_ctype.locase [i] = (i >= 'A' && i <= 'Z') ? i | 0x20 : i;
    84   }
    85 
    86   /* There are no prefix MBCS codes */
    87   memset (&__locale_ctype.mbcsprefix, 0x55, sizeof (__locale_ctype.mbcsprefix));
    88 }
     178#endif
Note: See TracChangeset for help on using the changeset viewer.