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