| 1 |  | 
|---|
| 2 | /* | 
|---|
| 3 | *@@sourcefile nls.h: | 
|---|
| 4 | *      header file for nls.c. See notes there. | 
|---|
| 5 | * | 
|---|
| 6 | *      Note: Version numbering in this file relates to XWorkplace version | 
|---|
| 7 | *            numbering. | 
|---|
| 8 | * | 
|---|
| 9 | *@@include #define INCL_DOSDATETIME | 
|---|
| 10 | *@@include #include <os2.h> | 
|---|
| 11 | *@@include #include "helpers\nls.h" | 
|---|
| 12 | */ | 
|---|
| 13 |  | 
|---|
| 14 | /* | 
|---|
| 15 | *      Copyright (C) 1997-2001 Ulrich Mller. | 
|---|
| 16 | *      This file is part of the "XWorkplace helpers" source package. | 
|---|
| 17 | *      This is free software; you can redistribute it and/or modify | 
|---|
| 18 | *      it under the terms of the GNU General Public License as published | 
|---|
| 19 | *      by the Free Software Foundation, in version 2 as it comes in the | 
|---|
| 20 | *      "COPYING" file of the XWorkplace main distribution. | 
|---|
| 21 | *      This program is distributed in the hope that it will be useful, | 
|---|
| 22 | *      but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 23 | *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 24 | *      GNU General Public License for more details. | 
|---|
| 25 | */ | 
|---|
| 26 |  | 
|---|
| 27 | #if __cplusplus | 
|---|
| 28 | extern "C" { | 
|---|
| 29 | #endif | 
|---|
| 30 |  | 
|---|
| 31 | #ifndef NLS_HEADER_INCLUDED | 
|---|
| 32 | #define NLS_HEADER_INCLUDED | 
|---|
| 33 |  | 
|---|
| 34 | #include "helpers\simples.h" | 
|---|
| 35 | // V0.9.19 (2002-06-13) [umoeller] | 
|---|
| 36 |  | 
|---|
| 37 | /* ****************************************************************** | 
|---|
| 38 | * | 
|---|
| 39 | *   DBCS support | 
|---|
| 40 | * | 
|---|
| 41 | ********************************************************************/ | 
|---|
| 42 |  | 
|---|
| 43 | #define TYPE_SBCS           0x0000 | 
|---|
| 44 | #define TYPE_DBCS_1ST       0x0001 | 
|---|
| 45 | #define TYPE_DBCS_2ND       0x0002 | 
|---|
| 46 |  | 
|---|
| 47 | ULONG XWPENTRY nlsQueryCodepage(VOID); | 
|---|
| 48 |  | 
|---|
| 49 | BOOL XWPENTRY nlsDBCS(VOID); | 
|---|
| 50 |  | 
|---|
| 51 | ULONG XWPENTRY nlsQueryDBCSChar(PCSZ pcszString, | 
|---|
| 52 | ULONG ulOfs); | 
|---|
| 53 |  | 
|---|
| 54 | PSZ XWPENTRY nlschr(PCSZ p, char c); | 
|---|
| 55 |  | 
|---|
| 56 | PSZ XWPENTRY nlsrchr(PCSZ p, char c); | 
|---|
| 57 |  | 
|---|
| 58 | /* ****************************************************************** | 
|---|
| 59 | * | 
|---|
| 60 | *   Country-dependent formatting | 
|---|
| 61 | * | 
|---|
| 62 | ********************************************************************/ | 
|---|
| 63 |  | 
|---|
| 64 | #ifdef OS2_INCLUDED | 
|---|
| 65 |  | 
|---|
| 66 | /* | 
|---|
| 67 | *@@ COUNTRYSETTINGS: | 
|---|
| 68 | *      structure used for returning country settings | 
|---|
| 69 | *      with nlsQueryCountrySettings. | 
|---|
| 70 | */ | 
|---|
| 71 |  | 
|---|
| 72 | typedef struct _COUNTRYSETTINGS | 
|---|
| 73 | { | 
|---|
| 74 | ULONG   ulDateFormat, | 
|---|
| 75 | // date format: | 
|---|
| 76 | // --  0   mm.dd.yyyy  (English) | 
|---|
| 77 | // --  1   dd.mm.yyyy  (e.g. German) | 
|---|
| 78 | // --  2   yyyy.mm.dd  (Japanese) | 
|---|
| 79 | // --  3   yyyy.dd.mm | 
|---|
| 80 | ulTimeFormat; | 
|---|
| 81 | // time format: | 
|---|
| 82 | // --  0   12-hour clock | 
|---|
| 83 | // --  >0  24-hour clock | 
|---|
| 84 | CHAR    cDateSep, | 
|---|
| 85 | // date separator (e.g. '/') | 
|---|
| 86 | cTimeSep, | 
|---|
| 87 | // time separator (e.g. ':') | 
|---|
| 88 | cDecimal, | 
|---|
| 89 | // decimal separator (e.g. '.') | 
|---|
| 90 | cThousands; | 
|---|
| 91 | // thousands separator (e.g. ',') | 
|---|
| 92 | } COUNTRYSETTINGS, *PCOUNTRYSETTINGS; | 
|---|
| 93 |  | 
|---|
| 94 | /* | 
|---|
| 95 | *@@ COUNTRYAMPM: | 
|---|
| 96 | * | 
|---|
| 97 | *@@added V1.0.1 (2003-01-17) [umoeller] | 
|---|
| 98 | */ | 
|---|
| 99 |  | 
|---|
| 100 | typedef struct _COUNTRYAMPM | 
|---|
| 101 | { | 
|---|
| 102 | CHAR            sz2359[10], | 
|---|
| 103 | sz1159[10]; | 
|---|
| 104 | } COUNTRYAMPM, *PCOUNTRYAMPM; | 
|---|
| 105 |  | 
|---|
| 106 | /* | 
|---|
| 107 | *@@ COUNTRYSETTINGS: | 
|---|
| 108 | *      second structure to finally get the AM/PM | 
|---|
| 109 | *      stuff right too. I suspect people have used | 
|---|
| 110 | *      this structure in XCenter DLLs and such so | 
|---|
| 111 | *      I cannot easily change it... hence a second | 
|---|
| 112 | *      one. | 
|---|
| 113 | * | 
|---|
| 114 | *@@changed V1.0.1 (2003-01-17) [umoeller] | 
|---|
| 115 | */ | 
|---|
| 116 |  | 
|---|
| 117 | typedef struct _COUNTRYSETTINGS2 | 
|---|
| 118 | { | 
|---|
| 119 | COUNTRYSETTINGS cs; | 
|---|
| 120 | COUNTRYAMPM     ampm; | 
|---|
| 121 | } COUNTRYSETTINGS2, *PCOUNTRYSETTINGS2; | 
|---|
| 122 |  | 
|---|
| 123 | VOID XWPENTRY nlsQueryCountrySettings(PCOUNTRYSETTINGS2 pcs); | 
|---|
| 124 |  | 
|---|
| 125 | PSZ XWPENTRY nlsThousandsULong(PSZ pszTarget, ULONG ul, CHAR cThousands); | 
|---|
| 126 | typedef PSZ XWPENTRY NLSTHOUSANDSULONG(PSZ pszTarget, ULONG ul, CHAR cThousands); | 
|---|
| 127 | typedef NLSTHOUSANDSULONG *PNLSTHOUSANDSULONG; | 
|---|
| 128 |  | 
|---|
| 129 | PSZ XWPENTRY nlsThousandsDouble(PSZ pszTarget, double dbl, CHAR cThousands); | 
|---|
| 130 |  | 
|---|
| 131 | PSZ XWPENTRY nlsVariableDouble(PSZ pszTarget, | 
|---|
| 132 | double dbl, | 
|---|
| 133 | PCSZ pszUnits, | 
|---|
| 134 | CHAR cThousands); | 
|---|
| 135 |  | 
|---|
| 136 | VOID XWPENTRY nlsDate(const COUNTRYSETTINGS2 *pcs2, | 
|---|
| 137 | PSZ pszDate, | 
|---|
| 138 | USHORT year, | 
|---|
| 139 | BYTE month, | 
|---|
| 140 | BYTE day); | 
|---|
| 141 |  | 
|---|
| 142 | VOID XWPENTRY nlsTime(const COUNTRYSETTINGS2 *pcs, | 
|---|
| 143 | PSZ pszTime, | 
|---|
| 144 | BYTE hours, | 
|---|
| 145 | BYTE minutes, | 
|---|
| 146 | BYTE seconds); | 
|---|
| 147 |  | 
|---|
| 148 | VOID XWPENTRY nlsFileDate(PSZ pszBuf, | 
|---|
| 149 | const FDATE *pfDate, | 
|---|
| 150 | const COUNTRYSETTINGS2 *pcs); | 
|---|
| 151 |  | 
|---|
| 152 | VOID XWPENTRY nlsFileTime(PSZ pszBuf, | 
|---|
| 153 | const FTIME *pfTime, | 
|---|
| 154 | const COUNTRYSETTINGS2 *pcs); | 
|---|
| 155 |  | 
|---|
| 156 | VOID XWPENTRY nlsDateTime(PSZ pszDate, | 
|---|
| 157 | PSZ pszTime, | 
|---|
| 158 | const DATETIME *pDateTime, | 
|---|
| 159 | ULONG ulDateFormat, | 
|---|
| 160 | CHAR cDateSep, | 
|---|
| 161 | ULONG ulTimeFormat, | 
|---|
| 162 | CHAR cTimeSep); | 
|---|
| 163 | typedef VOID XWPENTRY NLSDATETIME(PSZ pszDate, | 
|---|
| 164 | PSZ pszTime, | 
|---|
| 165 | const DATETIME *pDateTime, | 
|---|
| 166 | ULONG ulDateFormat, | 
|---|
| 167 | CHAR cDateSep, | 
|---|
| 168 | ULONG ulTimeFormat, | 
|---|
| 169 | CHAR cTimeSep); | 
|---|
| 170 | typedef NLSDATETIME *PNLSDATETIME; | 
|---|
| 171 |  | 
|---|
| 172 | VOID XWPENTRY nlsDateTime2(PSZ pszDate, | 
|---|
| 173 | PSZ pszTime, | 
|---|
| 174 | const DATETIME *pDateTime, | 
|---|
| 175 | const COUNTRYSETTINGS2 *pcs2); | 
|---|
| 176 | typedef VOID XWPENTRY NLSDATETIME2(PSZ pszDate, | 
|---|
| 177 | PSZ pszTime, | 
|---|
| 178 | const DATETIME *pDateTime, | 
|---|
| 179 | const COUNTRYSETTINGS2 *pcs2); | 
|---|
| 180 | typedef NLSDATETIME2 *PNLSDATETIME2; | 
|---|
| 181 |  | 
|---|
| 182 | #endif | 
|---|
| 183 |  | 
|---|
| 184 | ULONG nlsUpper(PSZ psz); | 
|---|
| 185 |  | 
|---|
| 186 | #endif | 
|---|
| 187 |  | 
|---|
| 188 | #if __cplusplus | 
|---|
| 189 | } | 
|---|
| 190 | #endif | 
|---|
| 191 |  | 
|---|