fig.h

Go to the documentation of this file.
00001 /*
00002  * FIG : Facility for Interactive Generation of figures
00003  * Copyright (c) 1985-1988 by Supoj Sutanthavibul
00004  * Parts Copyright (c) 1989-2002 by Brian V. Smith
00005  * Parts Copyright (c) 1991 by Paul King
00006  *
00007  * Any party obtaining a copy of these files is granted, free of charge, a
00008  * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
00009  * nonexclusive right and license to deal in this software and
00010  * documentation files (the "Software"), including without limitation the
00011  * rights to use, copy, modify, merge, publish and/or distribute copies of
00012  * the Software, and to permit persons who receive copies from any such 
00013  * party to do so, with the only requirement being that this copyright 
00014  * notice remain intact.
00015  *
00016  */
00017 
00018 #ifndef FIG_H
00019 #define FIG_H
00020 
00021 extern  char    *my_strdup();
00022 
00023 /* For the X stuff, include only Xlib.h and Intrinsic.h here - 
00024    use figx.h for widget stuff */
00025 
00026 #if defined(ultrix) || defined(__bsdi__) || defined(Mips) || defined(apollo)
00027 #include <sys/types.h>  /* for stat structure */
00028 #endif
00029 #include <sys/stat.h>
00030 
00031 #if defined(__convex__) && defined(__STDC__)
00032 #define S_IFDIR _S_IFDIR
00033 #define S_IWRITE _S_IWRITE
00034 #endif
00035 
00036 #ifndef SYSV
00037 #ifndef SVR4
00038 #include <fcntl.h>
00039 #endif
00040 #endif
00041 
00042 #include <pwd.h>
00043 #include <signal.h>
00044 #include <stdio.h>
00045 #include <ctype.h>
00046 #include <errno.h>
00047 
00048 #ifdef NEED_STRERROR
00049 extern char     *strerror();
00050 #  if !defined(__bsdi__) && !defined(__NetBSD__) && !defined(__GNU_LIBRARY__)
00051       extern int        errno;
00052       extern int        sys_nerr;
00053 #     if ( !(defined(BSD) && (BSD - 0 >= 199306)) && !defined(__NetBSD__) && \
00054            !defined(__GNU_LIBRARY__) && !defined(__FreeBSD__) && !defined(__GLIBC__))
00055          extern char    *sys_errlist[];
00056 #     endif
00057 #  endif
00058 #endif /* NEED_STRERROR */
00059 
00060 extern char    *mktemp();
00061 
00062 #include <math.h>       /* for sin(), cos() etc */
00063 
00064 #include <X11/Xlib.h>
00065 #include <X11/Intrinsic.h>
00066 
00067 #include <X11/Xos.h>
00068 
00069 /* for those who have an older (R4) Xos.h, we need to include unistd.h here */
00070 
00071 /*
00072  * Get open(2) constants
00073  */
00074 #ifdef X_NOT_POSIX
00075 #include <fcntl.h>
00076 #ifdef USL
00077 #include <unistd.h>
00078 #endif /* USL */
00079 #ifdef CRAY
00080 #include <unistd.h>
00081 #endif /* CRAY */
00082 #ifdef MOTOROLA
00083 #include <unistd.h>
00084 #endif /* MOTOROLA */
00085 #ifdef SYSV386
00086 #include <unistd.h>
00087 #endif /* SYSV386 */
00088 #include <sys/file.h>
00089 #else /* X_NOT_POSIX */
00090 #if !defined(_POSIX_SOURCE) && defined(macII)
00091 #define _POSIX_SOURCE
00092 #include <fcntl.h>
00093 #undef _POSIX_SOURCE
00094 #else
00095 #include <fcntl.h>
00096 #endif
00097 #include <unistd.h>
00098 #endif /* X_NOT_POSIX else */
00099 
00100 #if XtSpecificationRelease > 4
00101 #include <X11/Xfuncs.h>
00102 #else
00103 
00104 /* The following is just a copy of X11/Xosdefs.h and X11/Xfuncs.h (and copyright
00105    notice).  I include it here so xfig can still be compiled under X11R4, since
00106    these files only comes with R5, and I'd like people to still be able to 
00107    compile xfig under R4. */
00108 
00109 /*
00110  * O/S-dependent (mis)feature macro definitions
00111  *
00112  * $XConsortium: Xosdefs.h,v 1.7 91/07/19 23:22:19 rws Exp $
00113  *
00114  * Copyright 1991 Massachusetts Institute of Technology
00115  *
00116  * Any party obtaining a copy of these files is granted, free of charge, a
00117  * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
00118  * nonexclusive right and license to deal in this software and
00119  * documentation files (the "Software"), including without limitation the
00120  * rights to use, copy, modify, merge, publish and/or distribute copies of
00121  * the Software, and to permit persons who receive copies from any such 
00122  * party to do so, with the only requirement being that this copyright 
00123  * notice remain intact.
00124  *
00125  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
00126  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
00127  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00128  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
00129  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
00130  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00131  */
00132 
00133 #ifndef _XOSDEFS_H_
00134 #define _XOSDEFS_H_
00135 
00136 /*
00137  * X_NOT_STDC_ENV means does not have ANSI C header files.  Lack of this
00138  * symbol does NOT mean that the system has stdarg.h.
00139  *
00140  * X_NOT_POSIX means does not have POSIX header files.  Lack of this
00141  * symbol does NOT mean that the POSIX environment is the default.
00142  * You may still have to define _POSIX_SOURCE to get it.
00143  */
00144 
00145 #ifdef NOSTDHDRS
00146 #define X_NOT_POSIX
00147 #define X_NOT_STDC_ENV
00148 #endif
00149 
00150 #ifdef sony
00151 #ifndef SYSTYPE_SYSV
00152 #define X_NOT_POSIX
00153 #endif
00154 #endif
00155 
00156 #ifdef UTEK
00157 #define X_NOT_POSIX
00158 #define X_NOT_STDC_ENV
00159 #endif
00160 
00161 #ifdef CRAY
00162 #define X_NOT_POSIX
00163 #endif
00164 
00165 #ifdef vax
00166 #ifndef ultrix                  /* assume vanilla BSD */
00167 #define X_NOT_POSIX
00168 #define X_NOT_STDC_ENV
00169 #endif
00170 #endif
00171 
00172 #ifdef luna
00173 #define X_NOT_POSIX
00174 #define X_NOT_STDC_ENV
00175 #endif
00176 
00177 #ifdef Mips
00178 #define X_NOT_POSIX
00179 #define X_NOT_STDC_ENV
00180 #endif
00181   
00182 #ifdef USL
00183 #ifdef SYSV /* (release 3.2) */
00184 #define X_NOT_POSIX
00185 #define X_NOT_STDC_ENV
00186 #endif
00187 #endif
00188 
00189 #ifdef SYSV386
00190 #ifdef SYSV
00191 #define X_NOT_POSIX
00192 #define X_NOT_STDC_ENV
00193 #endif
00194 #endif
00195 
00196 #ifdef MOTOROLA
00197 #ifdef SYSV
00198 #define X_NOT_STDC_ENV
00199 #endif
00200 #endif
00201 
00202 #endif /* _XOSDEFS_H_ */
00203 /*
00204  * $XConsortium: Xfuncs.h,v 1.8 91/04/17 09:27:52 rws Exp $
00205  * 
00206  * Copyright 1990 by the Massachusetts Institute of Technology
00207  *
00208  * Permission to use, copy, modify, and distribute this software and its
00209  * documentation for any purpose and without fee is hereby granted, provided 
00210  * that the above copyright notice appear in all copies and that both that 
00211  * copyright notice and this permission notice appear in supporting 
00212  * documentation, and that the name of M.I.T. not be used in advertising
00213  * or publicity pertaining to distribution of the software without specific, 
00214  * written prior permission. M.I.T. makes no representations about the 
00215  * suitability of this software for any purpose.  It is provided "as is"
00216  * without express or implied warranty.
00217  *
00218  */
00219 
00220 #ifndef _XFUNCS_H_
00221 #define _XFUNCS_H_
00222 
00223 #ifdef X_USEBFUNCS
00224 void bcopy();
00225 void bzero();
00226 int bcmp();
00227 #else
00228 #if (__STDC__ && !defined(X_NOT_STDC_ENV) && !defined(sun) && !defined(macII)) || defined(SVR4) || defined(hpux) || defined(_IBMR2)
00229 #include <string.h>
00230 #define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len))
00231 #define bzero(b,len) memset(b, 0, (size_t)(len))
00232 #define bcmp(b1,b2,len) memcmp(b1, b2, (size_t)(len))
00233 #else
00234 #ifdef sgi
00235 #include <bstring.h>
00236 #else
00237 #ifdef SYSV
00238 #include <memory.h>
00239 #if defined(_XBCOPYFUNC) && !defined(macII)
00240 #define bcopy _XBCOPYFUNC
00241 #define _XNEEDBCOPYFUNC
00242 #endif
00243 void bcopy();
00244 #define bzero(b,len) memset(b, 0, len)
00245 #define bcmp(b1,b2,len) memcmp(b1, b2, len)
00246 #else /* bsd */
00247 void bcopy();
00248 void bzero();
00249 int bcmp();
00250 #endif /* SYSV */
00251 #endif /* sgi */
00252 #endif /* __STDC__ and relatives */
00253 #endif /* X_USEBFUNCS */
00254 
00255 #endif /* _XFUNCS_H_ */
00256 
00257 #endif /* XtSpecificationRelease > 4 */
00258 
00259 #ifdef X_NOT_STDC_ENV
00260 #ifdef SYSV
00261 #include <string.h>
00262 #else  /* NOT SYSV */
00263 #include <strings.h>
00264 #ifndef strchr
00265 #define strchr index
00266 #endif
00267 #ifndef strrchr
00268 #define strrchr rindex
00269 #endif
00270 #endif  /* SYSV */
00271 #endif  /* X_NOT_STDC_ENV */
00272 
00273 #if defined(SYSV) && defined(SYSV386)
00274 #if defined(__STDC__)
00275 #ifdef ISC
00276 extern double atof(char const *);
00277 #endif  /* ISC */
00278 #ifdef SCO
00279 #ifdef SCO324
00280 #include <stdlib.h>   /* for atof() and getenv(), maybe required for all SCO's ? */
00281 #else /* NOT SCO 3.2r4 */
00282 extern double atof(const char *);
00283 #endif /* SCO 3.2r4 */
00284 #else  /* NOT SCO */
00285 extern double atof();
00286 #endif /* SCO */
00287 #else  /* NOT __STDC__ */
00288 extern double atof();
00289 #endif /* __STDC__ */
00290 #else  /* NOT defined(SYSV) && defined(SYSV386) */
00291 #ifdef X_NOT_STDC_ENV
00292 #if defined(ultrix) || defined(sun) && !defined(sparc) || defined(titan) || \
00293         (defined(ibm032) && !defined(_AIX))
00294 extern double atof();
00295 extern char *getenv();
00296 #endif /* (sun) !(sparc) (titan) */
00297 #else  /* NOT X_NOT_STDC_ENV */
00298 #include <stdlib.h>     /* for atof() and getenv() */
00299 #endif /* X_NOT_STDC_ENV */
00300 #endif /* defined(SYSV) && defined(SYSV386) */
00301 
00302 /* 
00303 #if defined(SYSV) || defined(SVR4) || defined(__osf__) || defined(USE_DIRENT)
00304 #define u_int uint
00305 #define USE_DIRENT
00306 #define DIRSTRUCT       struct dirent
00307 #else
00308 #define DIRSTRUCT       struct direct
00309 #endif
00310 */
00311 #ifdef HAVE_NO_DIRENT
00312 #define DIRSTRUCT struct direct
00313 #else
00314 #define DIRSTRUCT struct dirent
00315 #endif
00316 
00317 /* taken from the X11R5 server/os/osfonts.c file */
00318 #ifndef X_NOT_POSIX
00319   #ifdef _POSIX_SOURCE
00320     #include <limits.h>
00321   #else
00322     #if !defined(sun) || defined(sparc) || (defined(SVR4) && defined(i386))
00323       #define _POSIX_SOURCE
00324       #include <limits.h>
00325       #undef _POSIX_SOURCE
00326     #endif /* !defined(sun) || defined(sparc) */
00327   #endif /* _POSIX_SOURCE */
00328 #endif /* X_NOT_POSIX */
00329 
00330 /* define PATH_MAX if not already defined */
00331 #ifndef PATH_MAX
00332   #include <sys/param.h>
00333   #ifndef PATH_MAX
00334     #ifdef MAXPATHLEN
00335       #define PATH_MAX MAXPATHLEN
00336     #else
00337       #define PATH_MAX 1024
00338     #endif /* MAXPATHLEN */
00339   #endif
00340 #endif /* PATH_MAX */
00341 
00342 
00343 
00344 /* use my own PI because GNUC has a long double and others have something else */
00345 #undef M_PI
00346 #undef M_PI_2
00347 #undef M_2PI
00348 #define M_PI    3.14159265358979323846
00349 #define M_PI_2  1.57079632679489661923
00350 #define M_2PI   6.28318530717958647692
00351 
00352 #define         min2(a, b)      (((a) < (b)) ? (a) : (b))
00353 #define         max2(a, b)      (((a) > (b)) ? (a) : (b))
00354 #define         min3(a,b,c)     ((((a<b)?a:b)<c)?((a<b)?a:b):c)
00355 #define         max3(a,b,c)     ((((a>b)?a:b)>c)?((a>b)?a:b):c)
00356 #define         round(a)        (int)(((a)<0.0)?(a)-.5:(a)+.5)
00357 #define         signof(a)       (((a) < 0) ? -1 : 1)
00358 
00359 #ifdef USE_INLINE
00360 #define INLINE __inline
00361 #else
00362 #define INLINE
00363 #endif /* USE_INLINE */
00364 
00365 #endif /* FIG_H */
00366 
00367 #ifdef NOSTRSTR
00368 extern char *strstr();
00369 #endif
00370 
00371 #if defined(SYSV) || defined(SVR4)
00372 extern  void            srand48();
00373 extern  long            lrand48();
00374 extern  double          drand48();
00375 #define srandom(seed)   srand48((seed))
00376 #define random()        lrand48()
00377 #define frandom()       drand48()
00378 
00379 #elif defined(BSD)  /* not SYSV/SVR4, check for BSD */
00380 #define srandom(seed)   srand48((long)(seed))
00381 #define random()        lrand48()
00382 #define frandom()       drand48()
00383 
00384 #elif (defined(linux) && !defined(glibc) && !defined(__GLIBC__))
00385 extern  long            random();
00386 extern  void            srandom(unsigned int);
00387 
00388 #elif !defined(__osf__) 
00389 extern  void            srandom();
00390 
00391 #endif
00392 
00393 #ifndef frandom
00394 #define frandom()       (random()*(1./2147483648.))
00395 #endif

Generated on Sun Mar 4 15:03:49 2007 for Scilab [trunk] by  doxygen 1.5.1