tldm-universe/Ardent/UV/gcidir/include/NLSlc.h
2024-09-09 17:51:08 -04:00

819 lines
26 KiB
C
Executable File

#ifndef h_NLSLC
#define h_NLSLC
/******************************************************************************
*
* Include file for NLS locale support
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software, Inc.
* The copyright notice above does not evidence any actual or intented
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description.........................................
* 10/14/98 23801 SAP Change copyrights.
* 08/14/97 21246 DTM Added token DEFAULT_DN_FMT for D2 conversions
* 07/10/97 21083 NDP Added new token NLSLCERR_HKGCINOTINIT.
* 07/03/97 20613 NDP Added various tokens for MR/ML/MD conversion codes.
* 07/03/97 20965 CSM Add error conditions
* 06/30/97 20433 PEJ Added function prototypes required by mc_oc()
* 06/27/97 20965 CSM Add bit field to NLSLCGlobal structure for NLS hooks
* 06/24/97 20613 NDP Modify definitions for NLSLC_USER_MONETARY.
* 06/10/97 20613 NDP Added UserTime, UserNumeric and UserMonetary fields
* to NLSLCGlobal. Added macros to access the new
* fields.
* 05/30/97 20327 MJC Added prototype NLSsrvlcinfo
* 05/28/97 20327 MJC Added prototypes NLSgetsrvlc and NLSsetsrvlc
* 05/20/97 20380 DTM Changes for NLS Locale Support - Collation
* 05/16/97 20613 NDP Removed NLS.h from header.
* 05/16/97 20613 NDP Renamed LC_xxx tokens to UVLC_xxx to avoid clash
* with OS tokens. Removed #include of NLS.h and uv.h.
* 05/01/97 20506 PEJ Add missing semi-colon in NLSLCDBG
* 04/15/97 20430 PEJ Save supplied locale names for GET.LOCALE
* 11/11/96 18242 DTM Code cleanup
* 05/17/96 17706 PEJ Correct compatability #defines
* 05/10/96 17706 PEJ Align NLSlc.h with UVNLSLOC.H
* Removed obselete LC_GENERAL
* 05/03/96 18242 DTM Code Cleanup, Phase I
* 05/02/96 17706 PEJ Corrected environment name to disable NLSLC
* 05/01/96 17706 PEJ Added NLSLC_SORTMASK for sort performance assist
* 04/15/96 17706 PEJ New header for NLS locale support
*
*****************************************************************************/
/*
Constant and structure definitions for locale descriptors
Note that some of the constants are taken from UVNLSLOC.H and so these
have to be kept in step
Perhaps one day we shall generate a uvnlsloc.h automatically
*/
/*
Externally used names
*/
#define NLSLC_UVLANG "UVLANG" /* env variable to set locale */
#define NLSLC_DISABLE "UVNLSLCOFF" /* env variable to disable NLSLC */
#define NLSLC_OFF_LOCALE "OFF" /* name for disabled categories */
#define NLSLC_DEFAULT_CATEGORY "DEFAULT" /* name for default categories */
#define NLSLC_DEFAULT_LOCALE "OFF" /* name for hard wired default locale */
/*
Locales installation directory
use with Mopen to ensure NT portability
*/
#define NLSLC_INSTALL_DIR UV_ROOT( "nls/locales/install" )
/*
Category numbers for real categories (from UVNLSLOC.H)
*/
#define UVLC_INDEX 0
#define UVLC_TIME 1
#define UVLC_NUMERIC 2
#define UVLC_MONETARY 3
#define UVLC_CTYPE 4
#define UVLC_COLLATE 5
#define UVLC_WEIGHTS 6
#define UVLC_HOOKID 7
#define UVLC_HKMAPNAME 8
/*
Alias for 'all' categories (from UVNLSLOC.H)
*/
#define UVLC_ALL -1
/*
Pseudo categories, used for additional features (from UVNLSLOC.H)
*/
#define UVLC_RESTORE -2
#define UVLC_SAVED -2 /* Alternate name used by GET.LOCALE */
#define UVLC_SAVE -3
/*
Category types
*/
#define CT_UNKNOWN 0
#define CT_STRING 1 /* all categories are of this type except ... */
#define CT_TYPE 2 /* UVLC_CTYPE */
#define CT_WEIGHT 3 /* UVLC_WEIGHTS */
/*
Category Pointer - one for each category
*/
typedef struct {
char Type ; /* one of CT_STRING, CT_TYPE, CT_WEIGHT */
char Defaulted ; /* set when category is defaulted */
int Name ; /* index to owning locale name string */
int Count ; /* count of entries within category */
int Bytes ; /* category size in bytes */
int Offset ; /* offset of first entry in lookup table */
} NLSLC_CATPTR ;
/*
** Locale Index - one for each locale
*/
#define NLSLC_NUM_CATEGORIES 8
typedef struct {
int InUse ; /* set when index entry is used */
int Name ; /* index to locale name string */
NLSLC_CATPTR Category[ NLSLC_NUM_CATEGORIES ] ;
} NLSLC_LOCIND ;
/*
** Locale Names - saved for GET.LOCALE
*/
typedef struct {
int Offset[ NLSLC_NUM_CATEGORIES ] ; /* Offset into string space */
} NLSLC_LOCNAM ;
/*
Locale Index Storage - table of locale indexes
*/
#define NLSLC_LOCIND_OFF 0 /* pseudo locale OFF */
#define NLSLC_LOCIND_DEFAULT 1 /* pseudo locale DEFAULT */
typedef struct {
int Size ; /* space allocated to table */
int Count ; /* number of entries in table */
int Free ; /* index of next free entry */
NLSLC_LOCIND Index[ 1 ] ;
} NLSLC_LOCLOC ;
/*
String Pointer Storage - table of string data offsets
*/
typedef struct {
int Size ; /* space allocated to table */
int Count ; /* number of entries in table */
int Free ; /* index of next free entry */
int Ptr[ 1 ] ;
} NLSLC_LOCPTR ;
/*
** String Data Storage - bulk string data
*/
typedef struct {
int Size ; /* space allocated to table */
int Count ; /* number of entries in table */
int Free ; /* index of next free entry */
char Data[ 1 ] ;
} NLSLC_LOCSTR ;
/*
Storage reserved for Unicode values
*/
typedef unsigned short UNICODE ;
/*
Type Information - a single CTYPE entry
*/
typedef struct {
int Property ; /* character property bits */
UNICODE Upper ; /* upper case equivalent */
UNICODE Lower ; /* lower case equivalent */
} NLSLC_CHRTYP ;
/*
Constants and macros for handling properties (from UVNLSLOC.H)
*/
#define LCP_PROP_NEWCASE 0x200
#define LCP_PROP_NEW 0x100
#define LCP_PROP_TRIM 0x080
#define LCP_PROP_NOPRINT 0x040
#define LCP_PROP_ALPHA 0x020
#define LCP_PROP_NUM 0x010
#define LCP_PROP_NUMVALUE 0x00F
/*
** Type Information Storage - bulk CTYPE data
*/
typedef struct {
int Size ; /* space allocated to table */
int Count ; /* number of entries in table */
int Free ; /* index of next free entry */
NLSLC_CHRTYP Info[ 1 ] ;
} NLSLC_LOCTYP ;
/*
Weight Information - a single WEIGHT entry
*/
typedef struct {
int Weights ; /* packed weight values */
} NLSLC_CHRWGT ;
/*
Constants and macros for handling weights (from UVNLSLOC.H)
*/
#define LCW_DFSHIFT 31
#define LCW_BWSHIFT 24
#define LCW_SWSHIFT 9
#define LCW_AWSHIFT 3
#define LCW_CWSHIFT 0
#define LCW_DFMASK 0x0001
#define LCW_BWMASK 0x007F
#define LCW_SWMASK 0x7FFF
#define LCW_AWMASK 0x003F
#define LCW_CWMASK 0x0007
#define LCW_ACCENT_LTR 1
#define LCW_ACCENT_RTL 0
#define LCW_UPPERCASE 1
#define LCW_LOWERCASE 0
#define DEFAULT_WEIGHT( V ) \
( ( (V) >> LCW_DFSHIFT ) & LCW_DFMASK )
#define FULL_WEIGHT( V ) \
( (V) & ~(LCW_DFMASK << LCW_DFSHIFT ) )
#define BLOCK_WEIGHT( V ) \
( ( (V) >> LCW_BWSHIFT ) & LCW_BWMASK )
#define SHARED_WEIGHT( V ) \
( ( (V) >> LCW_SWSHIFT ) & LCW_SWMASK )
#define ACCENT_WEIGHT( V ) \
( ( (V) >> LCW_AWSHIFT ) & LCW_AWMASK )
#define CASE_WEIGHT( V ) \
( ( (V) >> LCW_CWSHIFT ) & LCW_CWMASK )
/*
** Weight Information Storage - bulk WEIGHT data
*/
typedef struct {
int Size ; /* space allocated to table */
int Count ; /* number of entries in table */
int Free ; /* index of next free entry */
NLSLC_CHRWGT Info[ 1 ] ;
} NLSLC_LOCWGT ;
/*
Locale Descriptor - master descriptor for shared memeory structure
*/
typedef struct {
NLSLC_LOCLOC * Locale ; /* pointer to locale index table */
NLSLC_LOCPTR * StringPtr ; /* pointer to string entry lookup */
NLSLC_LOCSTR * String ; /* pointer to bulk string data */
NLSLC_LOCTYP * Type ; /* pointer to bulk ctype data */
NLSLC_LOCWGT * Weight ; /* pointer to bulk weight data */
} NLSLC_LOCDSC ;
/*
Sizing macros for the above structures
(with a little effort these 5 could be amalgamated)
*/
#define NLSLC_LOCLOC_SIZE( P ) \
sizeof( *(P) ) + sizeof( *(P)->Index ) * ( ((P)->Free > 0) ? (P)->Free - 1 : 0 ) ;
#define NLSLC_LOCPTR_SIZE( P ) \
sizeof( *(P) ) + sizeof( *(P)->Ptr ) * ( ((P)->Free > 0) ? (P)->Free - 1 : 0 ) ;
#define NLSLC_LOCSTR_SIZE( P ) \
sizeof( *(P) ) + sizeof( *(P)->Data ) * ( ((P)->Free > 0) ? (P)->Free - 1 : 0 ) ;
#define NLSLC_LOCTYP_SIZE( P ) \
sizeof( *(P) ) + sizeof( *(P)->Info ) * ( ((P)->Free > 0) ? (P)->Free - 1 : 0 ) ;
#define NLSLC_LOCWGT_SIZE( P ) \
sizeof( *(P) ) + sizeof( *(P)->Info ) * ( ((P)->Free > 0) ? (P)->Free - 1 : 0 ) ;
/*
Sort masks to be used to unpack weight values
*/
typedef struct {
int Block ; /* Mask to get block weight */
int Shared ; /* Mask to get shared weight */
int Accent ; /* Mask to get accent weight */
int Case ; /* Mask to get case weight */
int Accent_Dir; /* If using Accent Weights, which direction*/
int Case_First; /* If using case, Upper/Lower first */
int Expansions; /* Are we using expansions */
STRING ExpList; /* List of characters to expand */
STRING ExpChars; /* List of expanded characters */
STRING ExpBefore; /* Whether before or after expansion */
int Contractions; /* Are we using contractions */
STRING ContList; /* List of characters to contract */
STRING ContChars; /* List of what they contract to */
} NLSLC_SORTMASK ;
/*
* Structure for user's copy of dates/times
*/
#define NLSLCT_MAXDAYS 7
#define NLSLCT_MAXMONTHS 12
#define NLSLCT_MAXYEARS 12
#define NLSLCT_MAX_D_OPTIONS 5 /* Max. number of date option modifiers */
#define NLSLCT_MAX_T_OPTIONS 3 /* Max. number of time option modifiers */
#define NLSLCT_HOUR_SEP 0 /* Index of hours separator in time option modifier */
#define NLSLCT_MIN_SEP 1 /* Index of minutes separator in time option modifier */
#define NLSLCT_SEC_SEP 2 /* Index of seconds separator in time option modifier */
#define NLSLCT_DMYORDER_LEN 3 /* Number of chars expected when specifying DMY order */
#define DEFAULT_TI_FMT 1 /* When parsing time conversion code indicates
that TI default from locale should be used */
#define DEFAULT_MT_FMT 2 /* When parsing time conversion code indicates
that T default from locale should be used */
#define DEFAULT_D_FMT 1 /* When parsing date conversion code indicates
that D default from locale should be used */
#define DEFAULT_DI_FMT 2 /* When parsing date conversion code indicates
that DI default from locale should be used */
#define DEFAULT_DN_FMT 3 /* When parsing date conversion code, indicates
that D default from locale should be used, with N as
the limiter on years */
typedef struct {
STRING date;
STRING time;
} NLSLC_TIMEDATE;
typedef struct {
STRING name;
long start;
} NLSLC_ERA_DETAILS;
typedef struct {
int count;
NLSLC_ERA_DETAILS details[1];
} NLSLC_ERA;
typedef struct {
NLSLC_TIMEDATE timedate_fmt;
NLSLC_TIMEDATE fulldate_fmt;
STRING d_fmt;
STRING di_fmt;
STRING t_fmt;
STRING ti_fmt;
uchar *days[NLSLCT_MAXDAYS];
uchar *abdays[NLSLCT_MAXDAYS];
uchar *mons[NLSLCT_MAXMONTHS];
uchar *abmons[NLSLCT_MAXMONTHS];
uchar *years[NLSLCT_MAXYEARS];
uchar *am_str;
uchar *pm_str;
uchar *bc_str;
STRING hdr_d_fmt;
NLSLC_TIMEDATE hdr_t_fmt;
int greg_day1;
int greg_skip;
uchar *dmyorder;
uchar *dmysep;
uchar *deftimesep;
NLSLC_ERA *eras;
} NLSLC_USER_TIME;
/*
* Structure for user's copy of numeric
*/
#define NLSLCN_MAXDIGITS 10
typedef struct {
STRING dec_sep;
STRING thou_sep;
short zero_sup;
short alt_digits_exist;
uchar *alt_digits[NLSLCN_MAXDIGITS];
} NLSLC_USER_NUMERIC;
/*
* Structure for user's copy of monetary
*/
typedef struct {
STRING dec_sep;
STRING thou_sep;
uchar *curr_symbol;
uchar *intl_curr_symbol;
int dec_places;
int intl_dec_places;
uchar *pos_sign;
uchar *neg_sign;
uchar *pos_fmt;
uchar *neg_fmt;
} NLSLC_USER_MONETARY;
/*
Global Locale Structure - all NLSLC globals collected together
*/
typedef struct {
NLSLC_LOCDSC * ShmDesc ; /* pointer to shared memory descriptor */
NLSLC_LOCIND CurLocInd ; /* index for current locale */
NLSLC_LOCIND SavLocInd ; /* index for saved locale */
NLSLC_SORTMASK CurSortMask ; /* sort masks for current locale */
NLSLC_SORTMASK SavSortMask ; /* sort masks for saved locale */
NLSLC_LOCNAM CurLocNam ; /* names for current locale */
NLSLC_LOCNAM SavLocNam ; /* names for saved locale */
NLSLC_USER_TIME UserTime ; /* user copy of time category */
NLSLC_USER_NUMERIC UserNumeric ; /* user copy of numeric category */
NLSLC_USER_MONETARY UserMonetary ; /* user copy of monetary category */
BITMAP sparebits:((8*sizeof(BITMAP))-19),
insidehook:1, /* if 1 executing hook did a fatal */
calliconvhk:2, /* if 1 call ICONV hook & set to 2 */
calloconvhk:2, /* if 1 call OCONV hook & set to 2 */
callctypehk:2, /* if 1 call CTYPE hook & set to 2 */
callmatchhk:2, /* if 1 call MATCH hook & set to 2 */
callsoundhk:2, /* if 1 call SOUND hook & set to 2 */
callcasehk:2, /* if 1 call CASE hook & set to 2 */
callcomphk:2, /* if 1 call COMP hook & set to 2 */
calltrimhk:2, /* if 1 call TRIM hook & set to 2 */
callfmthk:2; /* 1 for normal format, 3 for formatdp */
/* if 1 or 3 call FMT hook & set to 2 */
} NLSLC_GLOBAL ;
/*
Pointer to NLSLC global structure
*/
EXTERN NLSLC_GLOBAL NLSLCGlobal ;
/*
Function definitions for NLSLCBuildLocale (from UVNLSLOC.H)
*/
#define LCF_START_CATEGORY 1
#define LCF_ADD_STRING 2
#define LCF_SECTION_SIZE 3
#define LCF_SECTION_NUMBER 4
#define LCF_ADD_SECTION 5
#define LCF_GET_CHECKSUM 6
#define LCF_END_CATEGORY 7
/*
Structures for locales on disc
*/
/*
Compatability marks, used to validate images read from disc
*/
#define NLSLC_COMPAT_LEVEL 1 /* Compatability level, change this whenever disk
format modified */
#define NLSLC_STRING_MARK ( (NLSLC_COMPAT_LEVEL << 8) | CT_STRING )
#define NLSLC_TYPE_MARK ( (NLSLC_COMPAT_LEVEL << 8) | CT_TYPE )
#define NLSLC_WEIGHT_MARK ( (NLSLC_COMPAT_LEVEL << 8) | CT_WEIGHT )
#define NLSLC_COMPAT_CHECK( D ) \
( (D)->Compat == NLSLC_STRING_MARK || (D)->Compat == NLSLC_TYPE_MARK || (D)->Compat == NLSLC_WEIGHT_MARK )
/*
Raw disc image
*/
typedef struct {
int Compat ; /* Compatability marker */
int Count ; /* Count of following items */
int Offset[ 1 ] ; /* Raw data */
} NLSLC_DSKSTR ;
/*
Some macros to help navigate the raw disc image
*/
#define NLSLC_RAWTEXTOFFSET( D, C ) \
(sizeof( (D)->Compat ) + sizeof( (D)->Count ) + (C) * sizeof( (D)->Offset ))
/*
Index category entries (from UVNLSLOC.H)
*/
#define LCI_TIME 2
#define LCI_NUMERIC 3
#define LCI_MONETARY 4
#define LCI_CTYPE 5
#define LCI_COLLATE 6
#define LCI_WEIGHTS 7
#define LCI_HOOK_LIBID 8
#define LCI_HOOK_MAPNAME 9
/*
Time category entries (from UVNLSLOC.H)
*/
#define LCT_TIMEDATE_FMT 2
#define LCT_FULLDATE_FMT 3
#define LCT_D_FMT 4
#define LCT_DI_FMT 5
#define LCT_T_FMT 6
#define LCT_TI_FMT 7
#define LCT_DAYS 8
#define LCT_ABDAYS 9
#define LCT_MONS 10
#define LCT_ABMONS 11
#define LCT_YEARS 12
#define LCT_AM_STR 13
#define LCT_PM_STR 14
#define LCT_BC_STR 15
#define LCT_ERA_NAMES 16
#define LCT_ERA_STARTS 17
#define LCT_HDR_D_FMT 18
#define LCT_HDR_T_FMT 19
#define LCT_GREG_DAY1 20
#define LCT_GREG_SKIP 21
#define LCT_DMYORDER 22
#define LCT_DMYSEP 23
#define LCT_DEFTIMESEP 24
/*
Numeric category entries (from UVNLSLOC.H)
*/
#define LCN_DEC_SEP 2
#define LCN_THOU_SEP 3
#define LCN_ZERO_SUP 4
#define LCN_ALT_DIGITS 5
/*
Monetary category entries (from UVNLSLOC.H)
*/
#define LCM_DEC_SEP 2
#define LCM_THOU_SEP 3
#define LCM_CURR_SYMBOL 4
#define LCM_INTL_CURR_SYMBOL 5
#define LCM_DEC_PLACES 6
#define LCM_INTL_DEC_PLACES 7
#define LCM_POS_SIGN 8
#define LCM_NEG_SIGN 9
#define LCM_POS_FMT 10
#define LCM_NEG_FMT 11
/*
Collate category entries (from UVNLSLOC.H)
*/
#define LCC_ACCENTED_SORT 2
#define LCC_REVERSE_ACCENTS 3
#define LCC_CASED_SORT 4
#define LCC_LOWERCASE_FIRST 5
#define LCC_EXPANSIONS 6
#define LCC_EXPANDED 7
#define LCC_EXPANDS_BEFORE 8
#define LCC_CONTRACTIONS 9
#define LCC_CONTRACTS_BEFORE 10
#define LCC_WEIGHT_TABLES 11
/*
Useful macros
*/
#define countof( S ) ( sizeof( S ) / sizeof( S[0] ) )
#define ALIGN(x,y) x = (int) (((y) x + (sizeof(y)-1)) & ~(sizeof(y)-1))
#define ALIGNVAR(x,y,z) x = (z *) (((y) x + (sizeof(y)-1)) & ~(sizeof(y)-1))
/*
Macros to check if specific locale category enabled
*/
#define NLSLC_INDEX ( NLSlcmode && NLSLCGlobal.CurLocInd.Category[ UVLC_INDEX ].Type == CT_STRING )
#define NLSLC_TIME ( NLSlcmode && NLSLCGlobal.CurLocInd.Category[ UVLC_TIME ].Type == CT_STRING )
#define NLSLC_NUMERIC ( NLSlcmode && NLSLCGlobal.CurLocInd.Category[ UVLC_NUMERIC ].Type == CT_STRING )
#define NLSLC_MONETARY ( NLSlcmode && NLSLCGlobal.CurLocInd.Category[ UVLC_MONETARY ].Type == CT_STRING )
#define NLSLC_COLLATE ( NLSlcmode && NLSLCGlobal.CurLocInd.Category[ UVLC_COLLATE ].Type == CT_STRING )
#define NLSLC_CTYPE ( NLSlcmode && NLSLCGlobal.CurLocInd.Category[ UVLC_CTYPE ].Type == CT_TYPE )
#define NLSLC_WEIGHT ( NLSlcmode && NLSLCGlobal.CurLocInd.Category[ UVLC_WEIGHTS ].Type == CT_WEIGHT )
/*
* Macros for accessing dates/times in NLSLCGlobal
*/
#define NLSLCT_TIMEDATE_FMT_DATE ( NLSLCGlobal.UserTime.timedate_fmt.date )
#define NLSLCT_TIMEDATE_FMT_TIME ( NLSLCGlobal.UserTime.timedate_fmt.time )
#define NLSLCT_FULLDATE_FMT_DATE ( NLSLCGlobal.UserTime.fulldate_fmt.date )
#define NLSLCT_FULLDATE_FMT_TIME ( NLSLCGlobal.UserTime.fulldate_fmt.time )
#define NLSLCT_D_FMT ( NLSLCGlobal.UserTime.d_fmt )
#define NLSLCT_DI_FMT ( NLSLCGlobal.UserTime.di_fmt )
#define NLSLCT_T_FMT ( NLSLCGlobal.UserTime.t_fmt )
#define NLSLCT_TI_FMT ( NLSLCGlobal.UserTime.ti_fmt )
#define NLSLCT_DAYS(day_number) ( NLSLCGlobal.UserTime.days[day_number] )
#define NLSLCT_ABDAYS(day_number) ( NLSLCGlobal.UserTime.abdays[day_number] )
#define NLSLCT_MONS(month_number) ( NLSLCGlobal.UserTime.mons[month_number] )
#define NLSLCT_ABMONS(month_number) ( NLSLCGlobal.UserTime.abmons[month_number] )
#define NLSLCT_YEARS(year_number) ( NLSLCGlobal.UserTime.years[year_number] )
#define NLSLCT_AM_STR ( NLSLCGlobal.UserTime.am_str )
#define NLSLCT_PM_STR ( NLSLCGlobal.UserTime.pm_str )
#define NLSLCT_BC_STR ( NLSLCGlobal.UserTime.bc_str )
#define NLSLCT_HDR_D_FMT ( NLSLCGlobal.UserTime.hdr_d_fmt )
#define NLSLCT_HDR_T_FMT_DATE ( NLSLCGlobal.UserTime.hdr_t_fmt.date )
#define NLSLCT_HDR_T_FMT_TIME ( NLSLCGlobal.UserTime.hdr_t_fmt.time )
#define NLSLCT_GREG_DAY1 ( NLSLCGlobal.UserTime.greg_day1 )
#define NLSLCT_GREG_SKIP ( NLSLCGlobal.UserTime.greg_skip )
#define NLSLCT_DMYORDER ( NLSLCGlobal.UserTime.dmyorder )
#define NLSLCT_DMYSEP ( NLSLCGlobal.UserTime.dmysep )
#define NLSLCT_DEFTIMESEP ( NLSLCGlobal.UserTime.deftimesep )
#define NLSLCT_ERAS ( NLSLCGlobal.UserTime.eras )
#define NLSLCT_ERAS_COUNT ( NLSLCGlobal.UserTime.eras -> count )
#define NLSLCT_ERA_STARTS(era_number) ( NLSLCGlobal.UserTime.eras -> details[era_number].start )
#define NLSLCT_ERA_NAMES(era_number) ( NLSLCGlobal.UserTime.eras -> details[era_number].name )
/*
* Macros for accessing numerics in NLSLCGlobal
*/
#define NLSLCN_DEC_SEP ( NLSLCGlobal.UserNumeric.dec_sep )
#define NLSLCN_THOU_SEP ( NLSLCGlobal.UserNumeric.thou_sep )
#define NLSLCN_ZERO_SUP ( NLSLCGlobal.UserNumeric.zero_sup )
#define NLSLCN_ALT_EXISTS ( NLSLCGlobal.UserNumeric.alt_digits_exist )
#define NLSLCN_ALT_DIGITS(number) ( NLSLCGlobal.UserNumeric.alt_digits[number] )
/*
* Macros for accessing monetary values in NLSLCGlobal
*/
#define NLSLCM_DEC_SEP ( NLSLCGlobal.UserMonetary.dec_sep )
#define NLSLCM_THOU_SEP ( NLSLCGlobal.UserMonetary.thou_sep )
#define NLSLCM_CURR_SYMBOL ( NLSLCGlobal.UserMonetary.curr_symbol )
#define NLSLCM_INTL_CURR_SYMBOL ( NLSLCGlobal.UserMonetary.intl_curr_symbol )
#define NLSLCM_DEC_PLACES ( NLSLCGlobal.UserMonetary.dec_places )
#define NLSLCM_INTL_DEC_PLACES ( NLSLCGlobal.UserMonetary.intl_dec_places )
#define NLSLCM_POS_SIGN ( NLSLCGlobal.UserMonetary.pos_sign )
#define NLSLCM_NEG_SIGN ( NLSLCGlobal.UserMonetary.neg_sign )
#define NLSLCM_POS_FMT ( NLSLCGlobal.UserMonetary.pos_fmt )
#define NLSLCM_NEG_FMT ( NLSLCGlobal.UserMonetary.neg_fmt )
/*
* The following tokens are used by format(), unformat(), md_oc(), md_ic()
* for MD, ML, MR conversion codes.
*/
/* Special characters used when formatting/unformatting MR/ML conversion
codes and FMT format string. */
#define MASKfill (uchar) '\377'
#define MASKzero (uchar) '\376'
#define MASKstar (uchar) '\375'
/* Alters parsing of format string (aka conversion code) by
parse_fmt_ccode(). Determines whether conversion code is called from
format() or unformat() */
#define FORMAT 0
#define UNFORMAT 1
/* Determines number of digits in thousand groups. Used by
NLSfmt_convert_data(), NLSmd_oc() */
#define DEFAULT_GROUP_SIZE 3 /* Also defined in md_oc.c */
/* Used to determine the direction in which to format a monetary value
(and parse the format string). Used by format_monetary() */
#define FORWARD 0
#define REVERSE 1
/* Error codes returned by parse_fmt_ccode() */
#define FMTE_BAD_CCODE -1
#define FMTE_ZERO_WIDTH -2
#define FMTE_BAD_DATA -3
/* Used to indicate where to insert a Yen symbol in the supplied buffer.
Used by insert_yen_symbol() */
#define YEN_BEFORE 0
#define YEN_AFTER 1
/* Used to indicate the type of sign that has been found for monetary
values. Returned by match_sign() and used by valid_format() */
#define SIGN_PAREN_POS_OPEN 1
#define SIGN_PAREN_POS_CLOSE 2
#define SIGN_POS 3
#define SIGN_PAREN_NEG_OPEN 4
#define SIGN_PAREN_NEG_CLOSE 5
#define SIGN_NEG 6
/* Maximum number of sign symbols in a number - open/close parenthesis pair */
#define SIGN_MAX 2
/* Keys to match_sign() to determine whether to load up the sign
characters from the locale. The values are stored in static storage
in the routine. */
#define SIGN_LOAD 1
#define SIGN_NOLOAD 0
/*
Error codes returned by NLSLC routines
0 : success
positive result code : system call error, the returned value is an errno
negative result code : NLSLC detected error, will be one of the following
(the first few correspond to errors recognised by BASIC)
*/
#define NLSLCERR_NOTIMPLEMENTED -1 /* Functionality not implemented (LCE$NO.LOCALES) */
#define NLSLCERR_NOTFOUND -2 /* Item not found (LCE$BAD.LOCALE) */
#define NLSLCERR_INVALIDCATEGORY -3 /* Invalid locale category (LCE$BAD.CATEGORY) */
#define NLSLCERR_INVALIDENTRY -4 /* Invalid category entry (LCE$NULL.LOCALE) */
#define NLSLCERR_OVERFLOW -5 /* Too many data items */
#define NLSLCERR_MALLOC -6 /* Memory allocation failure */
#define NLSLCERR_TOOFEWDATA -7 /* Not enough data items */
#define NLSLCERR_INVALIDPTR -8 /* Invalid UTF pointer */
#define NLSLCERR_NOTNUMERIC -9 /* Non-numeric character */
#define NLSLCERR_CORRUPTINDEX -10 /* Corrupt locale index */
#define NLSLCERR_OCONVFAILED -11 /* Output conversion failed */
#define NLSLCERR_NULLPTR -12 /* Null pointer passed */
#define NLSLCERR_HKNOINITFN -13 /* Locales hk init fn not found (LCE$HK.INFN.NOTF) */
#define NLSLCERR_LCHKBUTNOMAP -14 /* Locale has hook id but no map (LCE$HK.NO.MAPN) */
#define NLSLCERR_HKMAPNOTFOUND -15 /* Mapname for hookid not found (LCE$HK.MAPN.UNKN) */
#define NLSLCERR_HKGCINOTINIT -16 /* GCI not initialized */
/*
Client/server functions
*/
EXTERN int NLSsetsrvlc(); /* set server locale */
EXTERN int NLSgetsrvlc(); /* get server locale */
EXTERN int NLSsrvlcinfo(); /* get server locale info */
/*
NLS locale service routine definitions
*/
EXTERN int NLSLCFindTimeString();
EXTERN int NLSLCFindNumericString();
EXTERN int NLSLCFindMonetaryString();
EXTERN int NLSLCFindTimeValue();
EXTERN int NLSLCFindNumericValue();
EXTERN int NLSLCFindMonetaryValue();
EXTERN int NLSLCCharToLower();
EXTERN int NLSLCCharToUpper();
EXTERN int NLSLCCharInvert();
EXTERN int NLSLCStrToLower();
EXTERN int NLSLCIsAlphabetic();
EXTERN int NLSLCIsNumeric();
EXTERN int NLSLCIsPrintable();
EXTERN int NLSLCIsTrimable();
/*
Debug macros, these compile to nothing unless turned on by -DNLSLCDBG
*/
#ifdef NLSLCDBG
EXTERN char * NLSLCdebug ;
#define DebugInit NLSLCdebug = getenv( "NLSLCDBG" )
#define Debug if ( NLSLCdebug ) printf
#define NoDebug if ( 0 ) printf
#else
#define Debug if ( 0 ) printf
#define NoDebug if ( 0 ) printf
#endif
#endif /* h_NLSLC */