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 /* locale stuff */ 80 81 #if !_hdr_locale 82 83 struct lconv 84 { 85 char* decimal_point; 86 char* thousands_sep; 87 char* grouping; 88 char* int_curr_symbol; 89 char* currency_symbol; 90 char* mon_decimal_point; 91 char* mon_thousands_sep; 92 char* mon_grouping; 93 char* positive_sign; 94 char* negative_sign; 95 char int_frac_digits; 96 char frac_digits; 97 char p_cs_precedes; 98 char p_sep_by_space; 99 char n_cs_precedes; 100 char n_sep_by_space; 101 char p_sign_posn; 102 char n_sign_posn; 103 }; 104 105 #endif 106 107 #if _BLD_ast && defined(__EXPORT__) 108 #define extern __EXPORT__ 109 #endif 110 111 #if !_UWIN /* for ast54 compatibility */ 112 113 #undef getenv 114 #define getenv _ast_getenv 115 116 #undef setenviron 117 #define setenviron _ast_setenviron 118 119 extern char* getenv(const char*); 120 121 #endif 122 123 #undef localeconv 124 #define localeconv _ast_localeconv 125 126 #undef setlocale 127 #define setlocale _ast_setlocale 128 129 #undef strerror 130 #define strerror _ast_strerror 131 132 extern struct lconv* localeconv(void); 133 extern char* setenviron(const char*); 134 extern char* setlocale(int, const char*); 135 extern char* strerror(int); 136 137 #define AST_MESSAGE_SET 3 /* see <mc.h> mcindex() */ 138 139 /* 140 * maintain this order when adding categories 141 */ 142 143 #define AST_LC_ALL 0 144 #define AST_LC_COLLATE 1 145 #define AST_LC_CTYPE 2 146 #define AST_LC_MESSAGES 3 147 #define AST_LC_MONETARY 4 148 #define AST_LC_NUMERIC 5 149 #define AST_LC_TIME 6 150 #define AST_LC_IDENTIFICATION 7 151 #define AST_LC_ADDRESS 8 152 #define AST_LC_NAME 9 153 #define AST_LC_TELEPHONE 10 154 #define AST_LC_XLITERATE 11 155 #define AST_LC_MEASUREMENT 12 156 #define AST_LC_PAPER 13 157 #define AST_LC_COUNT 14 158 #define AST_LC_LANG 255 159 160 #define AST_LC_internal 1 161 #define AST_LC_test (1L<<26) 162 #define AST_LC_setenv (1L<<27) 163 #define AST_LC_find (1L<<28) 164 #define AST_LC_debug (1L<<29) 165 #define AST_LC_setlocale (1L<<30) 166 #define AST_LC_translate (1L<<31) 167 168 #ifndef LC_ALL 169 #define LC_ALL (-AST_LC_ALL) 170 #endif 171 #ifndef LC_COLLATE 172 #define LC_COLLATE (-AST_LC_COLLATE) 173 #endif 174 #ifndef LC_CTYPE 175 #define LC_CTYPE (-AST_LC_CTYPE) 176 #endif 177 #ifndef LC_MESSAGES 178 #define LC_MESSAGES (-AST_LC_MESSAGES) 179 #endif 180 #ifndef LC_MONETARY 181 #define LC_MONETARY (-AST_LC_MONETARY) 182 #endif 183 #ifndef LC_NUMERIC 184 #define LC_NUMERIC (-AST_LC_NUMERIC) 185 #endif 186 #ifndef LC_TIME 187 #define LC_TIME (-AST_LC_TIME) 188 #endif 189 #ifndef LC_ADDRESS 190 #define LC_ADDRESS (-AST_LC_ADDRESS) 191 #endif 192 #ifndef LC_IDENTIFICATION 193 #define LC_IDENTIFICATION (-AST_LC_IDENTIFICATION) 194 #endif 195 #ifndef LC_NAME 196 #define LC_NAME (-AST_LC_NAME) 197 #endif 198 #ifndef LC_TELEPHONE 199 #define LC_TELEPHONE (-AST_LC_TELEPHONE) 200 #endif 201 #ifndef LC_XLITERATE 202 #define LC_XLITERATE (-AST_LC_XLITERATE) 203 #endif 204 #ifndef LC_MEASUREMENT 205 #define LC_MEASUREMENT (-AST_LC_MEASUREMENT) 206 #endif 207 #ifndef LC_PAPER 208 #define LC_PAPER (-AST_LC_PAPER) 209 #endif 210 #ifndef LC_LANG 211 #define LC_LANG (-AST_LC_LANG) 212 #endif 213 214 #undef extern 215 216 #undef strcoll 217 #if _std_strcoll 218 #define strcoll _ast_info.collate 219 #else 220 #define strcoll strcmp 221 #endif 222 223 typedef struct 224 { 225 226 char* id; 227 228 struct 229 { 230 uint32_t serial; 231 uint32_t set; 232 } locale; 233 234 long tmp_long; 235 size_t tmp_size; 236 short tmp_short; 237 char tmp_char; 238 wchar_t tmp_wchar; 239 240 int (*collate)(const char*, const char*); 241 242 int tmp_int; 243 void* tmp_pointer; 244 245 int mb_cur_max; 246 int (*mb_len)(const char*, size_t); 247 int (*mb_towc)(wchar_t*, const char*, size_t); 248 size_t (*mb_xfrm)(char*, const char*, size_t); 249 int (*mb_width)(wchar_t); 250 int (*mb_conv)(char*, wchar_t); 251 252 uint32_t env_serial; 253 uint32_t mb_sync; 254 uint32_t version; 255 256 int (*mb_alpha)(wchar_t); 257 258 char pad[936 - sizeof(void*)]; 259 260 } _Ast_info_t; 261 262 #if _BLD_ast && defined(__EXPORT__) 263 #define extern extern __EXPORT__ 264 #endif 265 #if !_BLD_ast && defined(__IMPORT__) 266 #define extern extern __IMPORT__ 267 #endif 268 269 extern _Ast_info_t _ast_info; 270 271 #undef extern 272 273 /* largefile hackery -- ast uses the large versions by default */ 274 275 #if _typ_ino64_t 276 #undef ino_t 277 #define ino_t ino64_t 278 #endif 279 #if _typ_off64_t 280 #undef off_t 281 #define off_t off64_t 282 #endif 283 #if !defined(ftruncate) && _lib_ftruncate64 284 #define ftruncate ftruncate64 285 extern int ftruncate64(int, off64_t); 286 #endif 287 #if !defined(lseek) && _lib_lseek64 288 #define lseek lseek64 289 extern off64_t lseek64(int, off64_t, int); 290 #endif 291 #if !defined(truncate) && _lib_truncate64 292 #define truncate truncate64 293 extern int truncate64(const char*, off64_t); 294 #endif 295 296 /* direct macro access for bsd crossover */ 297 298 #if !defined(__cplusplus) 299 300 #if !defined(memcpy) && !defined(_lib_memcpy) && defined(_lib_bcopy) 301 #define memcpy(t,f,n) (bcopy(f,t,n),(t)) 302 #endif 303 304 #if !defined(memzero) && !defined(_lib_memzero) 305 #if defined(_lib_memset) || !defined(_lib_bzero) 306 #define memzero(b,n) memset(b,0,n) 307 #else 308 #define memzero(b,n) (bzero(b,n),(b)) 309 #endif 310 #endif 311 312 #endif 313 314 #if !defined(remove) 315 extern int remove(const char*); 316 #endif 317 318 #if !defined(rename) 319 extern int rename(const char*, const char*); 320 #endif 321 322 #if !defined(strchr) && !defined(_lib_strchr) && defined(_lib_index) 323 #define strchr(s,c) index(s,c) 324 #endif 325 326 #if !defined(strrchr) && !defined(_lib_strrchr) && defined(_lib_rindex) 327 #define strrchr(s,c) rindex(s,c) 328 #endif 329 330 /* and now introducing prototypes botched by the standard(s) */ 331 332 #if _BLD_ast && defined(__EXPORT__) 333 #define extern __EXPORT__ 334 #endif 335 336 #undef getpgrp 337 #define getpgrp() _ast_getpgrp() 338 extern int _ast_getpgrp(void); 339 340 #undef extern 341 342 /* 343 * and finally, standard interfaces hijacked by ast 344 * _AST_STD_I delays headers that require <ast_map.h> 345 */ 346 347 #include <ast_map.h> 348 349 #undef _AST_STD_I 350 351 #if _AST_GETOPT_H < 0 352 #undef _AST_GETOPT_H 353 #include <ast_getopt.h> 354 #endif 355 356 #if _GETOPT_H < 0 357 #undef _GETOPT_H 358 #include <getopt.h> 359 #endif 360 361 #if _REGEX_H < 0 362 #undef _REGEX_H 363 #include <regex.h> 364 #endif 365 366 #endif 367