home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6574.LZX / include / locale.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-04  |  4.2 KB  |  141 lines

  1. /* Copyright (c) 1992-1993 SAS Institute, Inc., Cary, NC USA */
  2. /* All Rights Reserved */
  3.  
  4.  
  5. #ifndef _LOCALE_H
  6. #define _LOCALE_H 1
  7.  
  8. #ifndef _COMMNULL_H
  9. #include <sys/commnull.h>
  10. #endif
  11.  
  12. #ifndef _COMMSIZE_H
  13. #include <sys/commsize.h>
  14. #endif
  15.  
  16. #ifndef _COMMCHAR_H
  17. #include <sys/commchar.h>
  18. #endif
  19.  
  20. #define LC_COLLATE  0
  21. #define LC_CTYPE    1
  22. #define LC_NUMERIC  2
  23. #define LC_TIME     3
  24. #define LC_MONETARY 4
  25. #define LC_ALL      5
  26.  
  27.  
  28. struct lconv {
  29.     char *decimal_point;
  30.     char *thousands_sep;
  31.     char *grouping;
  32. #define LCONVM int_curr_symbol
  33.     char *int_curr_symbol;
  34.     char *currency_symbol;
  35.     char *mon_decimal_point;
  36.     char *mon_thousands_sep;
  37.     char *mon_grouping;
  38.     char *positive_sign;
  39.     char *negative_sign;
  40.     char int_frac_digits;
  41.     char frac_digits;
  42.     char p_cs_precedes;
  43.     char p_sep_by_space;
  44.     char n_cs_precedes;
  45.     char n_sep_by_space;
  46.     char p_sign_posn;
  47.     char n_sign_posn;
  48. };
  49.  
  50.  
  51. struct __lconvn {            /* lconv from LC_NUMERIC */
  52.     char *decimal_point;
  53.     char *thousands_sep;
  54.     char *grouping;
  55. };
  56.  
  57. struct __lconvm {            /* lconv from LC_MONETARY */
  58.     char *int_curr_symbol;
  59.     char *currency_symbol;
  60.     char *mon_decimal_point;
  61.     char *mon_thousands_sep;
  62.     char *mon_grouping;
  63.     char *positive_sign;
  64.     char *negative_sign;
  65.     char int_frac_digits;
  66.     char frac_digits;
  67.     char p_cs_precedes;
  68.     char p_sep_by_space;
  69.     char n_cs_precedes;
  70.     char n_sep_by_space;
  71.     char p_sign_posn;
  72.     char n_sign_posn;
  73. };
  74.  
  75.  
  76. struct __locale {
  77.     struct __locale *nxtlc;    /* next locale pointer            */
  78.     char *lcname;        /* locale name             LC_ALL     */
  79.     char **abswday;        /* abbreviated weekday names     LC_TIME    */
  80.     char **swday;        /* full weekday names        LC_TIME    */
  81.     char **absmon;        /* abbrev. month names        LC_TIME */
  82.     char **smon;        /* full month names        LC_TIME    */
  83.     char **sampm;        /* names for am. and pm.    LC_TIME */
  84.     char *stzone;        /* name for timezone        LC_TIME */
  85.     int *lccomp;        /* collating sequence         LC_COLLATE? */
  86.     int *ixfrm;                /* translate table        LC_COLLATE */
  87.     char decpt;                /* decimal point char        LC_NUMERIC */
  88.     char mb_cur_max;            /* maximum number of bytes in
  89.                        wide character        LC_CTYPE */
  90.     char mb_state;        /* flag for state-dep mappings  LC_CTYPE */
  91.                         /* mblen function        LC_CTYPE */
  92.     int  (*mblen)(const char *, size_t);
  93.     int  mblen_state;            /* mblen shift state         LC_CTYPE */
  94.                         /* mbtowc function        LC_CTYPE */
  95.     int  (*mbtowc)(wchar_t *,const char *, size_t);
  96.     int  mbtowc_state;            /* mbtowc shift state         LC_CTYPE */
  97.                         /* wctomb function        LC_CTYPE */
  98.     int  (*wctomb)(char *, wchar_t);
  99.     int  wctomb_state;            /* wctomb shift state         LC_CTYPE */
  100.                         /* mbstowcs function        LC_CTYPE */
  101.     size_t  (*mbstowcs)(wchar_t *,const char *, size_t);
  102.     int  mbstowcs_state;    /* mbstowcs shift state     LC_CTYPE */
  103.                         /* wcstombs function        LC_CTYPE */
  104.     size_t  (*wcstombs)(char *, const wchar_t *,size_t);
  105.     int  wcstombs_state;    /* wcstombs shift state        LC_CTYPE */
  106.     struct __lconvn    *lconvn; /* structure for lconv        LC_NUMERIC */
  107.     struct __lconvm    *lconvm; /* structure for lconv        LC_MONETARY */
  108. };
  109.  
  110.  
  111. extern struct __locale *__clocale[];    /* current locale for each category */
  112. extern struct lconv  __clconv;            /* current lconv array */
  113. extern char __decpt;            /* current decimal point character */
  114. #define DECPT __decpt
  115. extern char __mb_cur_max;
  116. extern struct __locale *__flocale;      /* first locale in linked list ("C") */
  117. extern struct __locale *__llocale;      /* last locale in linked list */
  118.  
  119. extern char *setlocale(int, const char *);
  120. extern struct lconv *localeconv(void);
  121. extern struct __locale *readlocale(const char *);
  122.  
  123.  
  124. /***
  125. *     Error messages when reading a locale, stored in lclerror
  126. ***/
  127.  
  128. #define _LCLNAME        1    /* pathname for locale file too long */
  129. #define _LCLOPEN        2    /* Unable to open locale file */
  130. #define _LCLCOLL        3    /* multiple collate spec */
  131. #define _LCLCTYPE       4    /* multiple c types spec */
  132. #define _LCLNUMERIC    5    /* multiple numeric spec */
  133. #define _LCLTIME        6    /* multiple time spec */
  134. #define _LCLMONETARY    7    /* multiple monetary spec */
  135. #define _LCLREAD        8    /* Error reading locale file */
  136. #define _LCLEND        9    /* Missing END record */
  137.  
  138. extern int    __lclerror;
  139.  
  140. #endif
  141.