1 /* 2 * BEGIN illumos section 3 * This is an unstable interface; changes may be made 4 * without notice. 5 * END illumos section 6 */ 7 /*********************************************************************** 8 * * 9 * This software is part of the ast package * 10 * Copyright (c) 1985-2012 AT&T Intellectual Property * 11 * and is licensed under the * 12 * Eclipse Public License, Version 1.0 * 13 * by AT&T Intellectual Property * 14 * * 15 * A copy of the License is available at * 16 * http://www.eclipse.org/org/documents/epl-v10.html * 17 * (with md5 checksum b35adb5213ca9657e911e9befb180842) * 18 * * 19 * Information and Software Systems Research * 20 * AT&T Research * 21 * Florham Park NJ * 22 * * 23 * Glenn Fowler <gsf@research.att.com> * 24 * David Korn <dgk@research.att.com> * 25 * Phong Vo <kpv@research.att.com> * 26 * * 27 ***********************************************************************/ 28 #pragma prototyped 29 /* 30 * Advanced Software Technology Library 31 * AT&T Research 32 * 33 * a union of standard headers that works 34 * with local extensions enabled 35 * and local omission compensation 36 */ 37 38 #ifndef _AST_STD_H 39 #define _AST_STD_H 1 40 #define _AST_STD_I 1 41 42 #include <ast_common.h> 43 44 #if _BLD_ast 45 #define _BLD_aso 1 46 #define _BLD_cdt 1 47 #define _BLD_sfio 1 48 #if !_UWIN 49 #define _BLD_vmalloc 1 50 #endif 51 #endif 52 53 #ifdef _SFSTDIO_H 54 #define _SKIP_SFSTDIO_H 55 #else 56 #define _SFSTDIO_H 57 #ifndef FILE 58 #ifndef _SFIO_H 59 struct _sfio_s; 60 #endif 61 #define FILE struct _sfio_s 62 #ifndef __FILE_typedef 63 #define __FILE_typedef 1 64 #endif 65 #ifndef _FILEDEFED 66 #define _FILEDEFED 1 67 #endif 68 #endif 69 #endif 70 71 #include <ast_lib.h> 72 #include <ast_sys.h> 73 #include <ast_getopt.h> /* <stdlib.h> does this */ 74 #include <ast_fcntl.h> 75 #include <ast_limits.h> 76 #include <ast_botch.h> 77 78 #ifdef _SKIP_SFSTDIO_H 79 #undef _SKIP_SFSTDIO_H 80 #else 81 #undef _SFSTDIO_H 82 #undef FILE 83 #endif 84 85 /* locale stuff */ 86 87 #if !_hdr_locale 88 89 struct lconv 90 { 91 char* decimal_point; 92 char* thousands_sep; 93 char* grouping; 94 char* int_curr_symbol; 95 char* currency_symbol; 96 char* mon_decimal_point; 97 char* mon_thousands_sep; 98 char* mon_grouping; 99 char* positive_sign; 100 char* negative_sign; 101 char int_frac_digits; 102 char frac_digits; 103 char p_cs_precedes; 104 char p_sep_by_space; 105 char n_cs_precedes; 106 char n_sep_by_space; 107 char p_sign_posn; 108 char n_sign_posn; 109 }; 110 111 #endif 112 113 #if _BLD_ast && defined(__EXPORT__) 114 #define extern __EXPORT__ 115 #endif 116 117 #if !_UWIN /* for ast54 compatibility */ 118 119 #undef getenv 120 #define getenv _ast_getenv 121 122 #undef setenviron 123 #define setenviron _ast_setenviron 124 125 extern char* getenv(const char*); 126 127 #endif 128 129 #undef localeconv 130 #define localeconv _ast_localeconv 131 132 #undef setlocale 133 #define setlocale _ast_setlocale 134 135 #undef strerror 136 #define strerror _ast_strerror 137 138 extern struct lconv* localeconv(void); 139 extern char* setenviron(const char*); 140 extern char* setlocale(int, const char*); 141 extern char* strerror(int); 142 143 #define AST_MESSAGE_SET 3 /* see <mc.h> mcindex() */ 144 145 /* 146 * maintain this order when adding categories 147 */ 148 149 #define AST_LC_ALL 0 150 #define AST_LC_COLLATE 1 151 #define AST_LC_CTYPE 2 152 #define AST_LC_MESSAGES 3 153 #define AST_LC_MONETARY 4 154 #define AST_LC_NUMERIC 5 155 #define AST_LC_TIME 6 156 #define AST_LC_IDENTIFICATION 7 157 #define AST_LC_ADDRESS 8 158 #define AST_LC_NAME 9 159 #define AST_LC_TELEPHONE 10 160 #define AST_LC_XLITERATE 11 161 #define AST_LC_MEASUREMENT 12 162 #define AST_LC_PAPER 13 163 #define AST_LC_COUNT 14 164 #define AST_LC_LANG 255 165 166 #define AST_LC_internal 1 167 #define AST_LC_test (1L<<26) 168 #define AST_LC_setenv (1L<<27) 169 #define AST_LC_find (1L<<28) 170 #define AST_LC_debug (1L<<29) 171 #define AST_LC_setlocale (1L<<30) 172 #define AST_LC_translate (1L<<31) 173 174 #ifndef LC_ALL 175 #define LC_ALL (-AST_LC_ALL) 176 #endif 177 #ifndef LC_COLLATE 178 #define LC_COLLATE (-AST_LC_COLLATE) 179 #endif 180 #ifndef LC_CTYPE 181 #define LC_CTYPE (-AST_LC_CTYPE) 182 #endif 183 #ifndef LC_MESSAGES 184 #define LC_MESSAGES (-AST_LC_MESSAGES) 185 #endif 186 #ifndef LC_MONETARY 187 #define LC_MONETARY (-AST_LC_MONETARY) 188 #endif 189 #ifndef LC_NUMERIC 190 #define LC_NUMERIC (-AST_LC_NUMERIC) 191 #endif 192 #ifndef LC_TIME 193 #define LC_TIME (-AST_LC_TIME) 194 #endif 195 #ifndef LC_ADDRESS 196 #define LC_ADDRESS (-AST_LC_ADDRESS) 197 #endif 198 #ifndef LC_IDENTIFICATION 199 #define LC_IDENTIFICATION (-AST_LC_IDENTIFICATION) 200 #endif 201 #ifndef LC_NAME 202 #define LC_NAME (-AST_LC_NAME) 203 #endif 204 #ifndef LC_TELEPHONE 205 #define LC_TELEPHONE (-AST_LC_TELEPHONE) 206 #endif 207 #ifndef LC_XLITERATE 208 #define LC_XLITERATE (-AST_LC_XLITERATE) 209 #endif 210 #ifndef LC_MEASUREMENT 211 #define LC_MEASUREMENT (-AST_LC_MEASUREMENT) 212 #endif 213 #ifndef LC_PAPER 214 #define LC_PAPER (-AST_LC_PAPER) 215 #endif 216 #ifndef LC_LANG 217 #define LC_LANG (-AST_LC_LANG) 218 #endif 219 220 #undef extern 221 222 #undef strcoll 223 #if _std_strcoll 224 #define strcoll _ast_info.collate 225 #else 226 #define strcoll strcmp 227 #endif 228 229 typedef struct 230 { 231 232 char* id; 233 234 struct 235 { 236 uint32_t serial; 237 uint32_t set; 238 } locale; 239 240 long tmp_long; 241 size_t tmp_size; 242 short tmp_short; 243 char tmp_char; 244 wchar_t tmp_wchar; 245 246 int (*collate)(const char*, const char*); 247 248 int tmp_int; 249 void* tmp_pointer; 250 251 int mb_cur_max; 252 int (*mb_len)(const char*, size_t); 253 int (*mb_towc)(wchar_t*, const char*, size_t); 254 size_t (*mb_xfrm)(char*, const char*, size_t); 255 int (*mb_width)(wchar_t); 256 int (*mb_conv)(char*, wchar_t); 257 258 uint32_t env_serial; 259 uint32_t mb_sync; 260 uint32_t version; 261 262 int (*mb_alpha)(wchar_t); 263 264 char pad[936 - sizeof(void*)]; 265 266 } _Ast_info_t; 267 268 #if _BLD_ast && defined(__EXPORT__) 269 #define extern extern __EXPORT__ 270 #endif 271 #if !_BLD_ast && defined(__IMPORT__) 272 #define extern extern __IMPORT__ 273 #endif 274 275 extern _Ast_info_t _ast_info; 276 277 #undef extern 278 279 /* largefile hackery -- ast uses the large versions by default */ 280 281 #if _typ_ino64_t 282 #undef ino_t 283 #define ino_t ino64_t 284 #endif 285 #if _typ_off64_t 286 #undef off_t 287 #define off_t off64_t 288 #endif 289 #if !defined(ftruncate) && _lib_ftruncate64 290 #define ftruncate ftruncate64 291 extern int ftruncate64(int, off64_t); 292 #endif 293 #if !defined(lseek) && _lib_lseek64 294 #define lseek lseek64 295 extern off64_t lseek64(int, off64_t, int); 296 #endif 297 #if !defined(truncate) && _lib_truncate64 298 #define truncate truncate64 299 extern int truncate64(const char*, off64_t); 300 #endif 301 302 /* direct macro access for bsd crossover */ 303 304 #if !defined(__cplusplus) 305 306 #if !defined(memcpy) && !defined(_lib_memcpy) && defined(_lib_bcopy) 307 #define memcpy(t,f,n) (bcopy(f,t,n),(t)) 308 #endif 309 310 #if !defined(memzero) && !defined(_lib_memzero) 311 #if defined(_lib_memset) || !defined(_lib_bzero) 312 #define memzero(b,n) memset(b,0,n) 313 #else 314 #define memzero(b,n) (bzero(b,n),(b)) 315 #endif 316 #endif 317 318 #endif 319 320 #if !defined(remove) 321 extern int remove(const char*); 322 #endif 323 324 #if !defined(rename) 325 extern int rename(const char*, const char*); 326 #endif 327 328 #if !defined(strchr) && !defined(_lib_strchr) && defined(_lib_index) 329 #define strchr(s,c) index(s,c) 330 #endif 331 332 #if !defined(strrchr) && !defined(_lib_strrchr) && defined(_lib_rindex) 333 #define strrchr(s,c) rindex(s,c) 334 #endif 335 336 /* and now introducing prototypes botched by the standard(s) */ 337 338 #if _BLD_ast && defined(__EXPORT__) 339 #define extern __EXPORT__ 340 #endif 341 342 #undef getpgrp 343 #define getpgrp() _ast_getpgrp() 344 extern int _ast_getpgrp(void); 345 346 #undef extern 347 348 /* 349 * and finally, standard interfaces hijacked by ast 350 * _AST_STD_I delays headers that require <ast_map.h> 351 */ 352 353 #include <ast_map.h> 354 355 #undef _AST_STD_I 356 357 #if _AST_GETOPT_H < 0 358 #undef _AST_GETOPT_H 359 #include <ast_getopt.h> 360 #endif 361 362 #if _GETOPT_H < 0 363 #undef _GETOPT_H 364 #include <getopt.h> 365 #endif 366 367 #if _REGEX_H < 0 368 #undef _REGEX_H 369 #include <regex.h> 370 #endif 371 372 #endif 373