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