00001 /*----------------------------------------------------------------------------- 00002 * / 00003 * / apeNEXT locale for nlcc 00004 * / 00005 * / $Id: locale.h,v 1.14 2005/06/08 14:06:53 pleiter Exp $ 00006 * / 00007 * / ISO/IEC 9899:1999 (E) Standard 00008 * / <locale.h> 00009 * / 00010 * / IMPLEMENTATION for APEnext: possible (locale.h) 00011 * /---------------------------------------------------------------------------*/ 00012 00013 /*------------------------------------------------------------------------------ 00014 * / NAME 00015 * / locale.h - category macros 00016 * / 00017 * / SYNOPSIS 00018 * / #include <locale.h> 00019 * / 00020 * / DESCRIPTION 00021 * / The <locale.h> header provides a definition for structure lconv, 00022 * / which includes at least the following members: 00023 * / 00024 * / char *currency_symbol 00025 * / char *decimal_point 00026 * / char frac_digits 00027 * / char *grouping 00028 * / char *int_curr_symbol 00029 * / char int_frac_digits 00030 * / char *mon_decimal_point 00031 * / char *mon_grouping 00032 * / char *mon_thousands_sep 00033 * / char *negative_sign 00034 * / char n_cs_precedes 00035 * / char n_sep_by_space 00036 * / char n_sign_posn 00037 * / char *positive_sign 00038 * / char p_cs_precedes 00039 * / char p_sep_by_space 00040 * / char p_sign_posn 00041 * / char *thousands_sep 00042 * / 00043 * / The <locale.h> header defines NULL (as defined in <stddef.h>) 00044 * / and at least the following as macros: 00045 * / LC_ALL 00046 * / LC_COLLATE 00047 * / LC_CTYPE 00048 * / LC_MESSAGES 00049 * / LC_MONETARY 00050 * / LC_NUMERIC 00051 * / LC_TIME 00052 * / which expand to distinct integral-constant expressions, for use as 00053 * / the first argument to the setlocale() function. 00054 * / 00055 * / Function prototypes must be provided for use with an ISO C compiler. 00056 * / 00057 * / RETURN VALUE 00058 * / 00059 * / Notes 00060 * / 00061 * / IMPLEMENTATION for APEnext: possible but might not needed (locale.h) 00062 /*------------------------------------------------------------------------------*/ 00063 00064 #ifndef _LOCALE_H_ 00065 #define _LOCALE_H_ 00066 00067 #include <nlibc.h> 00068 00069 /*-------------------------------------------------------------------------------- 00070 * / NAME 00071 * / struct lconv - struct contains variables given below 00072 * / 00073 * / SYNOPSIS 00074 * / struct lconv {} 00075 * / 00076 * / DESCRIPTION 00077 * / The lconv structure contains following variables 00078 * / 00079 * / RETURN VALUE 00080 * / 00081 * / Notes 00082 * / 00083 * / IMPLEMENTATION for APEnext: possible (might not be needed) (struct lconv) 00084 * /-----------------------------------------------------------------------------*/ 00085 typedef struct lconv{ 00086 // ELEMENT "C" LOCALE LOCALE CATEGORY 00087 // -------------------------- [Numeric Conventions] --------------------- 00088 // decimal point 00089 char *decimal_point; // "." LC_NUMERIC 00090 // separator for digits left of decimal 00091 char *thousands_sep; // "" LC_NUMERIC 00092 // currency symbol 00093 /* digit grouping size: 00094 Each element is the number of digits in each group; 00095 elements with higher indices are farther left. 00096 An element with value CHAR_MAX means that no further grouping is done. 00097 An element with value 0 means that the previous element is used 00098 for all groups farther left. */ 00099 char *grouping; // "" LC_NUMERIC 00100 00101 // -------------------------- [Monetary Conventions] -------------------- 00102 char *currency_symbol; // "" LC_MONETARY 00103 // decimal point 00104 char *mon_decimal_point; // "" LC_MONETARY 00105 // digit grouping sizes 00106 char *mon_grouping; // "" LC_MONETARY 00107 // separator for digits left of decimal 00108 char *mon_thousands_sep; // "" LC_MONETARY 00109 // string indicating negative quantities 00110 char *negative_sign; // "" LC_MONETARY 00111 // string indicating positive quantities 00112 char *positive_sign; // "" LC_MONETARY 00113 00114 // -------------------------- [International Monetary Conventions] ------ 00115 // international currency symbol and separator 00116 char *int_curr_symbol; // "" LC_MONETARY 00117 // (international) digits right of decimal 00118 char int_frac_digits; // CHAR_MAX LC_MONETARY 00119 00120 /* Positive and negative sign positions: 00121 0 Parentheses surround the quantity and currency_symbol. 00122 1 The sign string precedes the quantity and currency_symbol. 00123 2 The sign string follows the quantity and currency_symbol. 00124 3 The sign string immediately precedes the currency_symbol. 00125 4 The sign string immediately follows the currency_symbol. */ 00126 // for negative monetary quantities: 00127 // currency symbol precedes quantity 00128 char n_cs_precedes; // CHAR_MAX LC_MONETARY 00129 // currency symbol separated by blank 00130 char n_sep_by_space; // CHAR_MAX LC_MONETARY 00131 // position of positive symbol 00132 char n_sign_posn; // CHAR_MAX LC_MONETARY 00133 00134 // for positive monetary quantities: 00135 // currency symbol precedes quantity 00136 char p_cs_precedes; // CHAR_MAX LC_MONETARY 00137 // currency symbol separated by blank 00138 char p_sep_by_space; // CHAR_MAX LC_MONETARY 00139 // position of positive symbol 00140 char p_sign_posn; // CHAR_MAX LC_MONETARY 00141 00142 // Novel C 00143 int country; // internal representations... 00144 int language; // ibid 00145 char name[8]; // as returned from setlocale(LC_ALL, NULL) 00146 00147 // ------------------------ [Time and Date Conventions] ---------------- 00148 int always_24; // always enforce 24-hour display (Boolean) 00149 char *hour_sep; // hour and seconds separator 00150 char *hour_sans_sec_sep; // hour separator when no seconds displayed 00151 char *date_sep; // month/day/year separator 00152 char *time_fmt; // hours:minutes:seconds format (hh:mm:ss) 00153 char *date_fmt; // month/day/year format (mm/dd/yyyy) 00154 char *full_date_fmt; // weekday, month, day and year format 00155 char *ampm; // delimited string indicating am and pm 00156 char *AMPM; // delimited string indicating AM and PM 00157 char *days; // delimited string of day names 00158 char *day_abbrevs; // delimited string of abbreviated day names 00159 char *months; // delimited string of month names 00160 char *month_abbrevs; // delimited string of abbreviated month names 00161 }; 00162 00163 00164 /* ----------------------------------------------------------------------------- 00165 * / IMPLEMENTATION for APEnext: possible (NULL) 00166 * /---------------------------------------------------------------------------*/ 00167 #ifndef NULL 00168 #define NULL 0ULL 00169 #endif 00170 00171 /* ----------------------------------------------------------------------------- 00172 * / The following are the possibilities for the first argument to setlocale. 00173 * / The code assumes that LC_ALL is the highest value, and zero the lowest. 00174 * / IMPLEMENTATION for APEnext: possible (LC_ALL) 00175 * /---------------------------------------------------------------------------*/ 00176 #ifndef LC_ALL 00177 #define LC_ALL 6 00178 #endif 00179 00180 /* ---------------------------------------------------------------------------- 00181 * / IMPLEMENTATION for APEnext: possible (LC_COLLATE) 00182 * /---------------------------------------------------------------------------*/ 00183 #ifndef LC_COLLATE 00184 #define LC_COLLATE 3 00185 #endif 00186 00187 /* --------------------------------------------------------------------------- 00188 * / IMPLEMENTATION for APEnext: possible (LC_TYPES) 00189 * /--------------------------------------------------------------------------*/ 00190 #ifndef LC_CTYPE 00191 #define LC_CTYPE 0 00192 #endif 00193 00194 /* ---------------------------------------------------------------------------- 00195 * / IMPLEMENTATION for APEnext: possible (LC_MONTARY) 00196 * /--------------------------------------------------------------------------*/ 00197 #ifndef LC_MONETARY 00198 #define LC_MONETARY 4 00199 #endif 00200 00201 /* --------------------------------------------------------------------------- 00202 * / IMPLEMENTATION for APEnext: possible (LC_NUMERIC) 00203 * /--------------------------------------------------------------------------*/ 00204 #ifndef LC_NUMERIC 00205 #define LC_NUMERIC 1 00206 #endif 00207 00208 00209 00210 00211 /* --------------------------------------------------------------------------- 00212 * / IMPLEMENTATION for APEnext: possible (LC_TIME) 00213 * /--------------------------------------------------------------------------*/ 00214 #ifndef LC_TIME 00215 #define LC_TIME 2 00216 #endif 00217 00218 /*---------------------------------------------------------------------------- 00219 * / IMPLEMENTATION for APEnext: possible (LC_MESAGES) 00220 * /--------------------------------------------------------------------------*/ 00221 #ifndef LC_MESSAGES 00222 #define LC_MESSAGES 5 00223 #endif 00224 00225 /* prototypes for functions standard and nonstandard... */ 00226 00227 /*----------------------------------------------------------------------------- 00228 * / NAME 00229 * / setlocale - set program locale 00230 * / 00231 * / SYNOPSIS 00232 * / #include <locale.h> 00233 * / 00234 * / char *setlocale(int category, const char *locale) 00235 * / 00236 * / DESCRIPTION 00237 * / The setlocale() function selects the appropriate piece of the 00238 * / program's locale, as specified by the category and locale 00239 * / arguments, and may be used to change or query the program's 00240 * / entire locale or portions thereof. The value LC_ALL for 00241 * / category names the program's entire locale; other values 00242 * / for category name only a part of the program's locale: 00243 * / 00244 * / LC_COLLATE 00245 * / Affects the behaviour of regular expressions and the 00246 * / collation functions. 00247 * / LC_CTYPE 00248 * / Affects the behaviour of regular expressions, character 00249 * / classification, 00250 * / character c onversion functions and wide-character functions. 00251 * / LC_MESSAGES 00252 * / Affects what strings are expected by commands and utilities as 00253 * / affirmative or negative responses, what strings are given by 00254 * / commands and utilities as affirmative or negative responses, 00255 * / and the content of messages. 00256 * / LC_MONETARY 00257 * / Affects the behaviour of functions that handle monetary values. 00258 * / LC_NUMERIC 00259 * / Affects the radix character for the formatted input/output 00260 * / functions and the string conversion functions. 00261 * / LC_TIME 00262 * / Affects the behaviour of the time conversion functions. 00263 * / 00264 * / RETURN VALUE 00265 * / Upon successful completion, setlocale() returns the string 00266 * / associated with the specified category for the new locale. 00267 * / Otherwise, setlocale() returns a null pointer and the program's 00268 * / locale is not changed. 00269 * / 00270 * / A null pointer for locale causes setlocale() to return a pointer to 00271 * / the string associated with the category for the program's current 00272 * / locale. The program's locale is not changed. 00273 * / 00274 * / The string returned by setlocale() is such that a subsequent 00275 * / call with that string and its associated category will 00276 * / restore that part of the program's locale. The string returned 00277 * / must not be modified by the program, but may be overwritten 00278 * / by a subsequent call to setlocale(). 00279 * / 00280 * / Notes 00281 * / The locale argument is a pointer to a character string containing 00282 * / the required setting of category. The contents of this string are 00283 * / implementation-dependent. In addition, the following preset values 00284 * / of locale are defined for all settings of category: 00285 * / 00286 * / "POSIX" 00287 * / Specifies the minimal environment for C-language translation 00288 * / called POSIX locale. If setlocale() is not invoked, the POSIX 00289 * / locale is the default. 00290 * / "C" 00291 * / Same as POSIX. 00292 * / "" 00293 * / Specifies an implementation-dependent native environment. For 00294 * / XSI-conformant systems, this corresponds to the value of the 00295 * / associated environment variables, LC_* and LANG; see the XBD 00296 * / specification, Locale and the XBD specification, 00297 * / Environment Variables . 00298 * / A null pointer 00299 * / Used to direct setlocale() to query the current internationalised 00300 * / environment and return the name of the locale(). 00301 * / The locale state is common to all threads within a process. 00302 * / 00303 * / IMPLEMENTATION for APEnext: possible (might not needed) (setlocale) 00304 /*-----------------------------------------------------------------------------*/ 00305 char *setlocale( int, const char * ); 00306 00307 00308 /*------------------------------------------------------------------------------- 00309 * / NAME 00310 * / localeconv - determine the program locale 00311 * / 00312 * / SYNOPSIS 00313 * / #include <locale.h> 00314 * / 00315 * / struct lconv *localeconv(void) 00316 * / 00317 * / DESCRIPTION 00318 * / The localeconv() function sets the components of an object with 00319 * / the type struct lconv with the values appropriate for the 00320 * / formatting of numeric quantities (monetary and otherwise) 00321 * / according to the rules of the current locale. 00322 * / The members of the structure with type char * are pointers to 00323 * / strings, any of which (except decimal_point) can point to "", 00324 * / to indicate that the value is not available in the current 00325 * / locale or is of zero length. The members with type char are 00326 * / non-negative numbers, any of which can be {CHAR_MAX} to indicate 00327 * / that the value is not available in the current locale. 00328 * / 00329 * / RETURN VALUE 00330 * / The localeconv() function returns a pointer to the filled-in 00331 * / object. The structure pointed to by the return value must not 00332 * / be modified by the program, but may be overwritten by a 00333 * / subsequent call to localeconv(). In addition, calls to setlocale() 00334 * / with the categories LC_ALL, LC_MONETARY, or LC_NUMERIC may 00335 * / overwrite the contents of the structure. 00336 * / 00337 * / Notes 00338 * / The variables lconv structure are: 00339 * / char *decimal_point 00340 * / The radix character used to format non-monetary quantities. 00341 * / 00342 * / char *thousands_sep 00343 * / The character used to separate groups of digits before the 00344 * / decimal-point character in formatted non-monetary quantities. 00345 * / 00346 * / char *grouping 00347 * / A string whose elements taken as one-byte integer values 00348 * / indicate the size of each group of digits in formatted 00349 * / non-monetary quantities. 00350 * / 00351 * / char *int_curr_symbol 00352 * / The international currency symbol applicable to the current locale. 00353 * / The first three characters contain the alphabetic international 00354 * / currency symbol in accordance with those specified in. 00355 * / The fourth character (immediately preceding the null byte) 00356 * / is the character used to separate the international currency 00357 * / symbol from the monetary quantity. 00358 * / 00359 * / char *currency_symbol 00360 * / The local currency symbol applicable to the current locale. 00361 * / 00362 * / char *mon_decimal_point 00363 * / The radix character used to format monetary quantities. 00364 * / 00365 * / char *mon_thousands_sep 00366 * / The separator for groups of digits before the decimal-point in 00367 * / formatted monetary quantities. 00368 * / 00369 * / char *mon_grouping 00370 * / A string whose elements taken as one-byte integer values indicate 00371 * / the size of each group of digits in formatted monetary quantities. 00372 * / 00373 * / char *positive_sign 00374 * / The string used to indicate a non-negative valued formatted 00375 * / monetary quantity. 00376 * / 00377 * / char *negative_sign 00378 * / The string used to indicate a negative valued formatted monetary 00379 * / quantity. 00380 * / 00381 * / char int_frac_digits 00382 * / The number of fractional digits (those after the decimal-point) 00383 * / to be displayed in an internationally formatted monetary quantity. 00384 * / 00385 * / char frac_digits 00386 * / The number of fractional digits (those after the decimal-point) 00387 * / to be displayed in a formatted monetary quantity. 00388 * / 00389 * / char p_cs_precedes 00390 * / Set to 1 if the currency_symbol or int_curr_symbol precedes 00391 * / the value for a non-negative formatted monetary quantity. Set to 0 00392 * / if the symbol succeeds the value. 00393 * / 00394 * / char p_sep_by_space 00395 * / Set to 0 if no space separates the currency_symbol or 00396 * / int_curr_symbol from the value for a non-negative formatted 00397 * / monetary quantity. Set to 1 if a space separates the symbol 00398 * / from the value; and set to 2 if a space separates the symbol 00399 * / and the sign string, if adjacent. 00400 * / 00401 * / char n_cs_precedes 00402 * / Set to 1 if the currency_symbol or int_curr_symbol precedes the 00403 * / value for a negative formatted monetary quantity. Set to 0 if 00404 * / the symbol succeeds the value. 00405 * / 00406 * / char n_sep_by_space 00407 * / Set to 0 if no space separates the currency_symbol or 00408 * / int_curr_symbol from the value for a negative formatted 00409 * / monetary quantity. Set to 1 if a space separates the symbol from 00410 * / the value; and set to 2 if a space separates the symbol and 00411 * / the sign string, if adjacent. 00412 * / 00413 * / char p_sign_posn 00414 * / Set to a value indicating the positioning of the positive_sign for 00415 * / a non-negative formatted monetary quantity. 00416 * / 00417 * / char n_sign_posn 00418 * / Set to a value indicating the positioning of the negative_sign 00419 * / for a negative formatted monetary quantity. 00420 * / 00421 * / The elements of grouping and mon_grouping are interpreted according 00422 * / to the following: 00423 * / 00424 * / {CHAR_MAX} 00425 * / No further grouping is to be performed. 00426 * / 0 00427 * / The previous element is to be repeatedly used for the remainder 00428 * / of the digits. 00429 * / Other 00430 * / The integer value is the number of digits that comprise the 00431 * / current group. The next element is examined to determine the 00432 * / size of the next group of digits before the current group. 00433 * / 00434 * / The values of p_sign_posn and n_sign_posn are interpreted 00435 * / according to the following: 00436 * / 00437 * / 0 00438 * / Parentheses surround the quantity and currency_symbol 00439 * / or int_curr_symbol. 00440 * / 1 00441 * / The sign string precedes the quantity and currency_symbol 00442 * / or int_curr_symbol. 00443 * / 2 00444 * / The sign string succeeds the quantity and currency_symbol 00445 * / or int_curr_symbol. 00446 * / 3 00447 * / The sign string immediately precedes the currency_symbol 00448 * / or int_curr_symbol. 00449 * / 4 00450 * / The sign string immediately succeeds the currency_symbol 00451 * / or int_curr_symbol. 00452 * / The implementation will behave as if no function in this 00453 * / specification calls localeconv(). 00454 * / 00455 * / IMPLEMENTATION for APEnext: possible (might not needed) (localconv) 00456 /*------------------------------------------------------------------------------*/ 00457 struct lconv *localeconv( void ); 00458 00459 #endif /* _LOCALE_H_ */ 00460 00461 /* @AT */ 00462 00463 00464