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