home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / localdef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-20  |  14.8 KB  |  471 lines

  1. #if (defined(__IBMC__) || defined(__IBMCPP__))
  2. #pragma info( none )
  3. #ifndef __CHKHDR__
  4.    #pragma info( none )
  5. #endif
  6. #pragma info( restore )
  7. #endif
  8.  
  9. #ifndef __localdef_h
  10.    #define __localdef_h
  11.  
  12.    #ifdef __cplusplus
  13.       extern "C" {
  14.    #endif
  15.  
  16.    #ifndef  _LNK_CONV
  17.      #ifdef _M_I386
  18.          #define  _LNK_CONV   _Optlink
  19.      #else
  20.        #define  _LNK_CONV
  21.      #endif
  22.    #endif
  23.  
  24.    /********************************************************************/
  25.    /*  <localdef.h> header file                                        */
  26.    /*                                                                  */
  27.    /*  VisualAge for C++ for Windows, Version 3.5                      */
  28.    /*    Licensed Material - Property of IBM                           */
  29.    /*                                                                  */
  30.    /*  5801-ARR and Other Materials                                    */
  31.    /*                                                                  */
  32.    /*  (c) Copyright IBM Corp 1991, 1996. All rights reserved.         */
  33.    /*                                                                  */
  34.    /********************************************************************/
  35.  
  36. #include <limits.h>
  37. #include <lc_core.h>
  38. #include <locale.h>
  39. #include <collate.h>
  40.  
  41.  
  42.  /* _LC_charmap_t
  43.  **
  44.  ** Structure representing CHARMAP class which maps characters to process code
  45.  ** and vice-verse.
  46.  */
  47. typedef struct {
  48.  
  49.     _LC_core_charmap_t core;
  50.  
  51.     char     *cm_csname;           /* codeset name                          */
  52.  
  53.     size_t   cm_mb_cur_max;        /* max encoding length for this codeset  */
  54.     size_t   cm_mb_cur_min;        /* min encoding length for this codeset  */
  55.  
  56.     unsigned char
  57.              cm_max_disp_width;    /* max display width of any char         */
  58.                                    /* in the codeset */
  59.  
  60.     unsigned
  61.         char *cm_cstab;            /* character set id table.               */
  62.  
  63. } _LC_charmap_t;
  64.  
  65.  
  66.  /* _LC_monetary_t
  67.  **
  68.  ** Structure representing MONETARY class which defines the formatting
  69.  ** of monetary quantities for a locale.
  70.  */
  71. typedef        struct {
  72.  
  73.     _LC_core_monetary_t   core;
  74.  
  75.     char *int_curr_symbol;         /* international currency symbol         */
  76.     char *currency_symbol;         /* national currency symbol              */
  77.     char *mon_decimal_point;       /* currency decimal point                */
  78.     char *mon_thousands_sep;       /* currency thousands separator          */
  79.     char *mon_grouping;            /* currency digits grouping              */
  80.     char *positive_sign;           /* currency plus sign                    */
  81.     char *negative_sign;           /* currency minus sign                   */
  82.     signed char int_frac_digits;   /* internat currency fract digits        */
  83.     signed char frac_digits;       /* currency fractional digits            */
  84.     signed char p_cs_precedes;     /* currency plus location                */
  85.     signed char p_sep_by_space;    /* currency plus space ind.              */
  86.     signed char n_cs_precedes;     /* currency minus location               */
  87.     signed char n_sep_by_space;    /* currency minus space ind.             */
  88.     signed char p_sign_posn;       /* currency plus position                */
  89.     signed char n_sign_posn;       /* currency minus position               */
  90.     char *debit_sign;              /* currency debit symbol                 */
  91.     char *credit_sign;             /* currency credit symbol                */
  92.     char *left_parenthesis;        /* currency left parenthesis             */
  93.     char *right_parenthesis;       /* currency right parenthesis            */
  94.  
  95. } _LC_monetary_t;
  96.  
  97.  /* _LC_numeric_t
  98.  **
  99.  ** Structure representing NUMERIC class which defines the formatting
  100.  ** of numeric quantities in a locale.
  101.  */
  102. typedef struct {
  103.  
  104.     _LC_core_numeric_t core;
  105.  
  106.     char     *decimal_point;
  107.     char     *thousands_sep;
  108.     unsigned
  109.         char *grouping;
  110.  
  111. } _LC_numeric_t;
  112.  
  113.  
  114.  /* _LC_resp_t
  115.  **
  116.  ** Structure representing RESPONSE class which defines the content
  117.  ** of affirmative versus negative responses in a locale.
  118.  */
  119. typedef struct  {
  120.  
  121.     _LC_core_resp_t core;
  122.  
  123.     char    *yesexpr;             /* POSIX: Expression for affirmative. */
  124.     char    *noexpr;              /* POSIX: Expression for negative.    */
  125.  
  126. } _LC_resp_t;
  127.  
  128.  /* _LC_syntax_t
  129.  **
  130.  ** Structure representing the SYNTAX class which defines the characters used by
  131.  ** the C/370 compiler that vary across the EBCDIC code pages.
  132.  */
  133. typedef struct {
  134.  
  135.     _LC_core_syntax_t core;
  136.  
  137.     char          *sx_csname;            /* codeset name */
  138.  
  139.     unsigned char *backslash;
  140.     unsigned char *right_brace;
  141.     unsigned char *left_brace;
  142.     unsigned char *right_bracket;
  143.     unsigned char *left_bracket;
  144.     unsigned char *circumflex;
  145.     unsigned char *tilde;
  146.     unsigned char *exclamation_mark;
  147.     unsigned char *number_sign;
  148.     unsigned char *vertical_line;
  149.     unsigned char *dollar_sign;
  150.     unsigned char *commercial_at;
  151.     unsigned char *grave_accent;
  152.  
  153. } _LC_syntax_t;
  154.  
  155.  
  156.  /* _LC_tod_t
  157.  **
  158.  ** Structure representing the TOD class which defines the time zone names
  159.  ** and start and end times for daylight saving.
  160.  */
  161. typedef struct {
  162.  
  163.     _LC_core_tod_t core;
  164.  
  165.     int   tzdiff;     /* Time zone differences in minutes              */
  166.     char *tname;      /* Time zone name                                */
  167.     char *tzname;     /* Daylight saving time zone name                */
  168.     int   dststm;     /* Month of year when daylight saving starts     */
  169.     int   dstenm;     /* Month of year when daylight saving ends       */
  170.     int   dststw;     /* Week of month when daylight saving starts     */
  171.     int   dstenw;     /* Week of month when daylight saving ends       */
  172.     int   dststd;     /* Day of week/month when daylight saving starts */
  173.     int   dstend;     /* Day of week/month when daylight saving ends   */
  174.     int   starttm;    /* Start time in seconds after midnight          */
  175.     int   endtm;      /* End time in seconds after midnight            */
  176.     int   shift;      /* DST time shift, expressed in seconds          */
  177.     char *uctname;    /* Coordinated Universal Time                    */
  178.  
  179. } _LC_tod_t;
  180.  
  181.  
  182.  /* _LC_time_t
  183.  **
  184.  ** Structure representing the TIME class which defines the formatting
  185.  ** of time and date quantities in this locale.
  186.  */
  187. typedef struct {
  188.  
  189.     _LC_core_time_t core;
  190.  
  191.     char *d_fmt;
  192.     char *t_fmt;
  193.     char *d_t_fmt;
  194.     char *t_fmt_ampm;
  195.     char *abday[7];
  196.     char *day[7];
  197.     char *abmon[12];
  198.     char *mon[12];
  199.     char *am_pm[2];
  200.     char *era;
  201.     char *era_year;
  202.     char *era_d_fmt;
  203.     char **alt_digits;
  204.     short num_digits;
  205.     struct dtconv  *nl_dtconv;
  206.  
  207. } _LC_time_t;
  208.  
  209.  
  210.  /* _LC_weight_t
  211.  **
  212.  ** Array of collation weights for a character or collating symbol.
  213.  */
  214. typedef union {
  215.     unsigned                       /* This type is used if the number of  */
  216.         short  n[2];               /* collation orders is <= 2            */
  217.  
  218.     unsigned                       /* This type is used if the number of  */
  219.         short  *p;                 /* collation orders is > 2             */
  220. } _LC_weight_t;
  221.  
  222.  
  223.  /* _LC_collel_t
  224.  **
  225.  ** Collation data for a collation symbol
  226.  */
  227. typedef struct {
  228.  
  229.     char         *ce_sym;          /* value of collation symbol           */
  230.     _LC_weight_t ce_wgt;           /* The weights associated with a       */
  231.                                    /* collating symbol matching ce_sym    */
  232.     collel_t     collel;           /* collating element value             */
  233.     short        collel_idx;       /* Index into collel_t array           */
  234.     short        collel_equiv;     /* Number of equivalent elements       */
  235. } _LC_collel_t;
  236.  
  237.  
  238.  /* _LC_coltbl_t
  239.  **
  240.  ** Array of per-character collation data for locale.
  241.  */
  242. typedef struct {
  243.     _LC_weight_t   ct_wgt;         /* The collation weights for this      */
  244.                                    /* character.                          */
  245.  
  246.     _LC_collel_t   *ct_collel;     /* Pointer to collation symbol array   */
  247.  
  248.     short          collel_idx;     /* Index into collel_t array           */
  249.     short          collel_equiv;   /* Number of equivalent elements       */
  250. } _LC_coltbl_t;
  251.  
  252.  
  253. #if !defined(COLL_WEIGHTS_MAX)
  254.   #define _COLL_WEIGHTS_MAX  6
  255. #else
  256.   #define _COLL_WEIGHTS_MAX COLL_WEIGHTS_MAX
  257. #endif
  258.  /* _LC_subs_t
  259.  **
  260.  ** Substring source and target pair
  261.  */
  262. typedef struct {
  263.  
  264.     _LC_weight_t ss_act;           /* indicates for which orders this */
  265.                                    /* susbstitution string is active. */
  266.     char *ss_src;                  /* source string to match          */
  267.     char *ss_tgt;                  /* target string to replace        */
  268.  
  269. } _LC_subs_t;
  270.  
  271.  /* _LC_colstr_t
  272.  **
  273.  ** Collating element strings
  274.  */
  275. typedef struct {
  276.     char        *collelc;          /* Collating Element string        */
  277.     wchar_t     *collelwc;         /* Collating Element Wide string   */
  278.     collel_t     collel;           /* collating element value         */
  279.     short        collel_idx;       /* Index into collel_t array       */
  280.     short        collel_equiv;     /* Number of equivalent elements   */
  281. } _LC_colstr_t;
  282.  
  283.  /* _LC_collate_t
  284.  **
  285.  ** Structure representing COLLATE class defining the collation rules
  286.  ** for a locale.
  287.  */
  288. typedef struct {
  289.  
  290.     _LC_core_collate_t core;
  291.  
  292.     unsigned                       /* number of collation orders      */
  293.         char    co_nord;           /* supported in this locale        */
  294.  
  295.     _LC_weight_t co_sort;          /* sort order                      */
  296.                                    /* processing flags                */
  297.  
  298.     wchar_t     co_wc_min;         /* min process code                */
  299.     wchar_t     co_wc_max;         /* max process code                */
  300.  
  301.     wchar_t     co_col_min;        /* min coll weight                 */
  302.     wchar_t     co_col_max;        /* max coll weight                 */
  303.  
  304.     _LC_coltbl_t *co_coltbl;       /* array of collation              */
  305.                                    /* weights, symbols                */
  306.     unsigned
  307.         char    co_nsubs;          /* number of sub strs              */
  308.     _LC_subs_t  *co_subs;          /* substitution strs               */
  309.  
  310.     short         ncolstr;         /* number of multi-char strings    */
  311.     _LC_colstr_t  *colstr;         /* Collation strs                  */
  312.  
  313.     const collel_t *colleltbl;     /* Sorted collation table          */
  314.     short          ncollel;        /* number of collel entries        */
  315.  
  316. } _LC_collate_t;
  317.  
  318.  /*
  319.  ** MASKS for the co_sort[] sort modifier array
  320.  */
  321. #define _COLL_FORWARD_MASK   1
  322. #define _COLL_BACKWARD_MASK  2
  323. #define _COLL_NOSUBS_MASK    4
  324. #define _COLL_POSITION_MASK  8
  325.  
  326.  /*
  327.  ** MASKS for the ss_act[] flags
  328.  */
  329. #define _SUBS_ACTIVE         1
  330. #define _SUBS_REGEXP         2
  331.  
  332.  /* _LC_classnm_t
  333.  **
  334.  ** Element mapping class name to a bit-unique mask.
  335.  */
  336. typedef struct {
  337.  
  338.     char           *name;
  339.     unsigned int    mask;
  340.     const collel_t *collist;     /* collel's for chars in class */
  341.     int             colcount;     /* numbers of collel's         */
  342.  
  343. } _LC_classnm_t;
  344.  
  345.  
  346.  /* _LC_ctype_t
  347.  **
  348.  ** Structure representing CTYPE class which defines character
  349.  ** membership in a character class.
  350.  */
  351. typedef struct {
  352.  
  353.   _LC_core_ctype_t core;
  354.  
  355.   /* min and max process code */
  356.   wchar_t      min_wc;
  357.   wchar_t      max_wc;
  358.  
  359.   /* upper, lower translation */
  360.   char         *upperidx;   /* toupper() index array    */
  361.   char         *loweridx;   /* tolower() index array    */
  362.   wchar_t      *upper;      /* toupper() translation    */
  363.   wchar_t      *lower;      /* tolower() translation    */
  364.  
  365.   /* character class membership */
  366.   unsigned
  367.     short      *ctable;       /* masks/upper/lower for CP 0..255   */
  368.   unsigned
  369.     short      *cmask;        /* is() mask for user classes 0..255 */
  370.   unsigned
  371.       int      *mask;         /* isw() masks                       */
  372.   char         *ctypeidx;     /* isw() index array                 */
  373.  
  374.   /* class name mapping */
  375.   unsigned char        nclasses;
  376.   _LC_classnm_t *classnms;
  377.  
  378. } _LC_ctype_t;
  379.  
  380.  
  381.  /* _LC_locale_t
  382.  **
  383.  ** Entry point to locale database.  setlocale() receives a pointer to
  384.  ** this structure from __lc_load().
  385.  */
  386.  
  387.  /**********
  388.  ** IF THIS NUMBER CHANGES, IT MUST ALSO BE CHANGED IN
  389.  ** inc/langinfo.h
  390.  **********/
  391. #define _NL_NUM_ITEMS 51
  392. typedef struct {
  393.  
  394.     _LC_core_locale_t core;
  395.  
  396.     char           *nl_info[_NL_NUM_ITEMS];
  397.     struct lconv   *nl_lconv;
  398.  
  399.     _LC_charmap_t  *lc_charmap;
  400.     _LC_collate_t  *lc_collate;
  401.     _LC_ctype_t    *lc_ctype;
  402.     _LC_monetary_t *lc_monetary;
  403.     _LC_numeric_t  *lc_numeric;
  404.     _LC_resp_t     *lc_resp;
  405.     _LC_time_t     *lc_time;
  406.     _LC_tod_t      *lc_tod;
  407.     _LC_syntax_t   *lc_syntax;
  408.  
  409. } _LC_locale_t;
  410.  
  411. #define _LC_MAX_OBJECTS   256
  412.  
  413. extern _LC_charmap_t  * _IMPORT __lc_charmap;
  414. extern _LC_collate_t  * _IMPORT __lc_collate;
  415. extern _LC_ctype_t    * _IMPORT __lc_ctype;
  416. extern _LC_monetary_t * _IMPORT __lc_monetary;
  417. extern _LC_numeric_t  * _IMPORT __lc_numeric;
  418. extern _LC_resp_t     * _IMPORT __lc_resp;
  419. extern _LC_time_t     * _IMPORT __lc_time;
  420. extern _LC_syntax_t   * _IMPORT __lc_syntax;
  421. extern _LC_tod_t      * _IMPORT __lc_tod;
  422. extern _LC_locale_t   * _IMPORT __lc_locale;
  423.  
  424. typedef struct {
  425.  
  426.     void    *(*malloc_ptr)();      /* Address of malloc function   */
  427.     void     (*free_ptr)();        /* Address of free function     */
  428.     char    *(*_fcvt_ptr)();       /* Address of _fcvt function    */
  429.     int      (*atoi_ptr)();        /* Address of atoi function     */
  430.     void    *pglobal_ptr;          /* Address of PGLOBAL           */
  431.  
  432. } _LC_passvar_t;
  433.  
  434. typedef struct {
  435.  
  436.     _LC_locale_t         **lc_locale;
  437.     _LC_ctype_t          **lc_ctype;
  438.     _LC_charmap_t        **lc_charmap;
  439.     _LC_collate_t        **lc_collate;
  440.     _LC_monetary_t       **lc_monetary;
  441.     _LC_numeric_t        **lc_numeric;
  442.     _LC_time_t           **lc_time;
  443.     _LC_resp_t           **lc_resp;
  444.     _LC_syntax_t         **lc_syntax;
  445.     _LC_tod_t            **lc_tod;
  446.     const unsigned short **_ctype;
  447.     const unsigned char  **_ctype_upperidx;
  448.     const unsigned char  **_ctype_loweridx;
  449.     const wchar_t        **_ctype_upper;
  450.     const wchar_t        **_ctype_lower;
  451.     const unsigned char  **_ctype_ctypeidx;
  452.     const unsigned short **_ctype_cmask;
  453.     const unsigned int   **_ctype_mask;
  454.     int                   *_mb_cur_max;
  455. } _LC_setvar_t;
  456.  
  457.    #ifdef __cplusplus
  458.       }
  459.    #endif
  460.  
  461. #endif
  462.  
  463. #if (defined(__IBMC__) || defined(__IBMCPP__))
  464. #pragma info( none )
  465. #ifndef __CHKHDR__
  466.    #pragma info( restore )
  467. #endif
  468. #pragma info( restore )
  469. #endif
  470.  
  471.