Files
jsix_import/src/libraries/libc/locale.h
Justin C. Miller 4545256b49 [build] Move headers out of target dirs
The great header shift: It didn't make sense to regenerate headers for
the same module for every target (boot/kernel/user) it appeared in. And
now that core headers are out of src/include, this was going to cause
problems for the new libc changes I've been working on. So I went back
to re-design how module headers work.

Pre-requisites:
- A module's public headers should all be available in one location, not
  tied to target.
- No accidental includes. Another module should not be able to include
  anything (creating an implicit dependency) from a module without
  declaring an explicit dependency.
- Exception to the previous: libc's headers should be available to all,
  at least for the freestanding headers.

New system:
- A new "public_headers" property of module declares all public headers
  that should be available to dependant modules
- All public headers (after possible processing) are installed relative
  to build/include/<module> with the same path as their source
- This also means no "include" dir in modules is necessary. If a header
  should be included as <j6/types.h> then its source should be
  src/libraries/j6/j6/types.h - this caused the most churn as all public
  header sources moved one directory up.
- The "includes" property of a module is local only to that module now,
  it does not create any implicit public interface

Other changes:
- The bonnibel concept of sources changed: instead of sources having
  actions, they themselves are an instance of a (sub)class of Source,
  which provides all the necessary information itself.
- Along with the above, rule names were standardized into <type>.<ext>,
  eg "compile.cpp" or "parse.cog"
- cog and cogflags variables moved from per-target scope to global scope
  in the build files.
- libc gained a more dynamic .module file
2022-02-06 10:18:51 -08:00

97 lines
4.7 KiB
C

#pragma once
/* Localization <locale.h>
This file is part of the Public Domain C Library (PDCLib).
Permission is granted to use, modify, and / or redistribute at will.
*/
#include "j6libc/cpp.h"
#include "j6libc/int.h"
#include "j6libc/null.h"
CPP_CHECK_BEGIN
/* The structure returned by localeconv().
The values for *_sep_by_space:
0 - no space
1 - if symbol and sign are adjacent, a space seperates them from the value;
otherwise a space seperates the symbol from the value
2 - if symbol and sign are adjacent, a space seperates them; otherwise a
space seperates the sign from the value
The values for *_sign_posn:
0 - Parentheses surround value and symbol
1 - sign precedes value and symbol
2 - sign succeeds value and symbol
3 - sign immediately precedes symbol
4 - sign immediately succeeds symbol
*/
struct lconv
{
char * decimal_point; /* decimal point character */ /* LC_NUMERIC */
char * thousands_sep; /* character for seperating groups of digits */ /* LC_NUMERIC */
char * grouping; /* string indicating the size of digit groups */ /* LC_NUMERIC */
char * mon_decimal_point; /* decimal point for monetary quantities */ /* LC_MONETARY */
char * mon_thousands_sep; /* thousands_sep for monetary quantities */ /* LC_MONETARY */
char * mon_grouping; /* grouping for monetary quantities */ /* LC_MONETARY */
char * positive_sign; /* string indicating nonnegative mty. qty. */ /* LC_MONETARY */
char * negative_sign; /* string indicating negative mty. qty. */ /* LC_MONETARY */
char * currency_symbol; /* local currency symbol (e.g. '$') */ /* LC_MONETARY */
char * int_curr_symbol; /* international currency symbol (e.g. "USD" */ /* LC_MONETARY */
char frac_digits; /* fractional digits in local monetary qty. */ /* LC_MONETARY */
char p_cs_precedes; /* if currency_symbol precedes positive qty. */ /* LC_MONETARY */
char n_cs_precedes; /* if currency_symbol precedes negative qty. */ /* LC_MONETARY */
char p_sep_by_space; /* if it is seperated by space from pos. qty. */ /* LC_MONETARY */
char n_sep_by_space; /* if it is seperated by space from neg. qty. */ /* LC_MONETARY */
char p_sign_posn; /* positioning of positive_sign for mon. qty. */ /* LC_MONETARY */
char n_sign_posn; /* positioning of negative_sign for mon. qty. */ /* LC_MONETARY */
char int_frac_digits; /* Same as above, for international format */ /* LC_MONETARY */
char int_p_cs_precedes; /* Same as above, for international format */ /* LC_MONETARY */
char int_n_cs_precedes; /* Same as above, for international format */ /* LC_MONETARY */
char int_p_sep_by_space; /* Same as above, for international format */ /* LC_MONETARY */
char int_n_sep_by_space; /* Same as above, for international format */ /* LC_MONETARY */
char int_p_sign_posn; /* Same as above, for international format */ /* LC_MONETARY */
char int_n_sign_posn; /* Same as above, for international format */ /* LC_MONETARY */
};
/* First arguments to setlocale().
NOTE: If you add to / modify these, look at functions/locale/setlocale.c
and keep things in sync.
*/
/* Entire locale */
#define LC_ALL _PDCLIB_LC_ALL
/* Collation (strcoll(), strxfrm()) */
#define LC_COLLATE _PDCLIB_LC_COLLATE
/* Character types (<ctype.h>, <wctype.h>) */
#define LC_CTYPE _PDCLIB_LC_CTYPE
/* Monetary formatting (as returned by localeconv) */
#define LC_MONETARY _PDCLIB_LC_MONETARY
/* Decimal-point character (for printf() / scanf() functions), string
conversions, nonmonetary formatting as returned by localeconv
*/
#define LC_NUMERIC _PDCLIB_LC_NUMERIC
/* Time formats (strftime(), wcsftime()) */
#define LC_TIME _PDCLIB_LC_TIME
/* Messages (not specified but allowed by C99, and specified by POSIX)
(used by perror() / strerror())
*/
#define LC_MESSAGES _PDCLIB_LC_MESSAGES
/* The category parameter can be any of the LC_* macros to specify if the call
to setlocale() shall affect the entire locale or only a portion thereof.
The category locale specifies which locale should be switched to, with "C"
being the minimal default locale, and "" being the locale-specific native
environment. A NULL pointer makes setlocale() return the *current* setting.
Otherwise, returns a pointer to a string associated with the specified
category for the new locale.
*/
char * setlocale( int category, const char * locale );
/* Returns a struct lconv initialized to the values appropriate for the current
locale setting.
*/
struct lconv * localeconv( void );
CPP_CHECK_END