00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef V_os_h
00015 #define V_os_h 1
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef __STDC__
00037 #error __FILE__ requires an ANSI C compiler
00038 #endif
00039
00040
00041
00042
00043
00044
00045 #define _XOPEN_SOURCE
00046
00047 #include <limits.h>
00048 #include <stdarg.h>
00049 #include <stdio.h>
00050 #include <stdlib.h>
00051 #include <string.h>
00052 #include <time.h>
00053 #include <unistd.h>
00054
00055
00056
00057
00058
00059
00060 #undef SunOS_4
00061 #undef SunOS_5
00062 #if defined (sun) || defined (__sun)
00063 #ifdef SVR4
00064 #define SunOS_5
00065 #else
00066 #define SunOS_4
00067 #endif
00068 #endif
00069
00070
00071
00072
00073
00074
00075
00076
00077 #if defined (SunOS_4)
00078 #define DBL_MAX (1.797693134862315708e+308)
00079 #define FLT_MAX ((float)3.40282346638528860e+38)
00080 #else
00081 #include <float.h>
00082 #endif
00083
00084
00085 #if defined (SunOS_4) && ! defined (PATH_MAX)
00086 #define PATH_MAX _POSIX_PATH_MAX
00087 #endif
00088
00089
00090 #if defined (SunOS_4)
00091 extern int _filbuf (FILE *);
00092 extern int fclose (FILE *);
00093 extern int fflush (FILE *);
00094 extern int fgetc (FILE *);
00095 extern int fprintf (FILE *, const char *, ...);
00096 extern int fputc (int, FILE *);
00097 extern int fputs (const char *, FILE *);
00098 extern size_t fread (void *, size_t, size_t, FILE *);
00099 extern int fscanf (FILE *, const char *, ...);
00100 extern int fseek (FILE *, long int, int);
00101 extern size_t fwrite (const void *, size_t, size_t, FILE *);
00102 extern int printf (const char *, ...);
00103 extern void rewind (FILE *);
00104 extern int scanf (const char *, ...);
00105
00106 extern int sscanf (const char *, const char *, ...);
00107 extern int ungetc (int, FILE *);
00108 extern int vsprintf (char *, const char *, va_list);
00109 #endif
00110
00111
00112 #if defined (SunOS_4)
00113 #define EXIT_SUCCESS 0
00114 #define EXIT_FAILURE 1
00115 #endif
00116
00117
00118 #if defined (SunOS_4)
00119 extern double strtod (const char *, char **);
00120 extern long strtol (const char *, char **, int);
00121 #endif
00122
00123
00124 #if defined (SunOS_4)
00125 extern int sys_nerr;
00126 extern char *sys_errlist[];
00127 #define strerror(e) ((e) >= sys_nerr ? "Unknown" : sys_errlist[e])
00128 #endif
00129
00130
00131 #if defined (SunOS_4)
00132 extern void *memchr (const void *, int, size_t);
00133 extern int memcmp (const void *, const void *, size_t);
00134 extern void *memcpy (void *, const void *, size_t);
00135 extern void *memmove (void *, const void *, size_t);
00136 extern void *memset (void *, int, size_t);
00137 #endif
00138
00139
00140 #if defined (SunOS_4)
00141 extern time_t time (time_t *);
00142 #endif
00143
00144
00145
00146
00147
00148
00149
00150
00151 #if defined (sun) || defined (sgi) || defined (_XPG4)
00152 extern void srand48 (long);
00153 extern double drand48 (void);
00154 extern long mrand48 (void);
00155 #define VRandomSeed(seed) srand48 ((long) seed)
00156 #define VRandomDouble() ((VDouble) drand48 ())
00157 #define VRandomLong() ((VLong) mrand48 ())
00158 #else
00159 #define VRandomSeed(seed) srand ((int) seed)
00160 #ifdef RAND_MAX
00161 #define VRandomDouble() ((unsigned int) rand () / (VDouble) RAND_MAX+1)
00162 #else
00163 #define VRandomDouble() ((unsigned int) rand () / (VDouble) 0x80000000)
00164 #endif
00165 #define VRandomLong() ((VLong) rand())
00166 #endif
00167
00168
00169
00170
00171
00172
00173
00174
00175 #define VRcsId(str) static char *rcsid = (0 ? (char *) & rcsid : (str))
00176
00177
00178 #endif