home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume19 / xfig / part06 / fig.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-27  |  7.6 KB  |  297 lines

  1. /*
  2.  * FIG : Facility for Interactive Generation of figures
  3.  * Copyright (c) 1985 by Supoj Sutanthavibul
  4.  *
  5.  * "Permission to use, copy, modify, distribute, and sell this software and its
  6.  * documentation for any purpose is hereby granted without fee, provided that
  7.  * the above copyright notice appear in all copies and that both the copyright
  8.  * notice and this permission notice appear in supporting documentation. 
  9.  * No representations are made about the suitability of this software for 
  10.  * any purpose.  It is provided "as is" without express or implied warranty."
  11.  */
  12.  
  13. #include <X11/Xos.h>
  14.  
  15. #if XtSpecificationRelease > 4
  16. #include <X11/Xfuncs.h>
  17. #else
  18.  
  19. /* The following is just a copy of X11/Xosdefs.h and X11/Xfuncs.h (and copyright
  20.    notice).  I include it here so xfig can still be compiled under X11R4, since
  21.    these files only comes with R5, and I'd like people to still be able to 
  22.    compile xfig under R4. */
  23.  
  24. /*
  25.  * O/S-dependent (mis)feature macro definitions
  26.  *
  27.  * $XConsortium: Xosdefs.h,v 1.7 91/07/19 23:22:19 rws Exp $
  28.  *
  29.  * Copyright 1991 Massachusetts Institute of Technology
  30.  *
  31.  * Permission to use, copy, modify, distribute, and sell this software and its
  32.  * documentation for any purpose is hereby granted without fee, provided that
  33.  * the above copyright notice appear in all copies and that both that
  34.  * copyright notice and this permission notice appear in supporting
  35.  * documentation, and that the name of M.I.T. not be used in advertising or
  36.  * publicity pertaining to distribution of the software without specific,
  37.  * written prior permission.  M.I.T. makes no representations about the
  38.  * suitability of this software for any purpose.  It is provided "as is"
  39.  * without express or implied warranty.
  40.  *
  41.  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  42.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  43.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  44.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  45.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  46.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  47.  */
  48.  
  49. #ifndef _XOSDEFS_H_
  50. #define _XOSDEFS_H_
  51.  
  52. /*
  53.  * X_NOT_STDC_ENV means does not have ANSI C header files.  Lack of this
  54.  * symbol does NOT mean that the system has stdarg.h.
  55.  *
  56.  * X_NOT_POSIX means does not have POSIX header files.  Lack of this
  57.  * symbol does NOT mean that the POSIX environment is the default.
  58.  * You may still have to define _POSIX_SOURCE to get it.
  59.  */
  60.  
  61. #ifdef NOSTDHDRS
  62. #define X_NOT_POSIX
  63. #define X_NOT_STDC_ENV
  64. #endif
  65.  
  66. #ifdef sony
  67. #ifndef SYSTYPE_SYSV
  68. #define X_NOT_POSIX
  69. #endif
  70. #endif
  71.  
  72. #ifdef UTEK
  73. #define X_NOT_POSIX
  74. #define X_NOT_STDC_ENV
  75. #endif
  76.  
  77. #ifdef CRAY
  78. #define X_NOT_POSIX
  79. #endif
  80.  
  81. #ifdef vax
  82. #ifndef ultrix            /* assume vanilla BSD */
  83. #define X_NOT_POSIX
  84. #define X_NOT_STDC_ENV
  85. #endif
  86. #endif
  87.  
  88. #ifdef luna
  89. #define X_NOT_POSIX
  90. #define X_NOT_STDC_ENV
  91. #endif
  92.  
  93. #ifdef Mips
  94. #define X_NOT_POSIX
  95. #define X_NOT_STDC_ENV
  96. #endif
  97.   
  98. #ifdef USL
  99. #ifdef SYSV /* (release 3.2) */
  100. #define X_NOT_POSIX
  101. #define X_NOT_STDC_ENV
  102. #endif
  103. #endif
  104.  
  105. #ifdef SYSV386
  106. #ifdef SYSV
  107. #define X_NOT_POSIX
  108. #define X_NOT_STDC_ENV
  109. #endif
  110. #endif
  111.  
  112. #ifdef MOTOROLA
  113. #ifdef SYSV
  114. #define X_NOT_STDC_ENV
  115. #endif
  116. #endif
  117.  
  118. #endif /* _XOSDEFS_H_ */
  119. /*
  120.  * $XConsortium: Xfuncs.h,v 1.8 91/04/17 09:27:52 rws Exp $
  121.  * 
  122.  * Copyright 1990 by the Massachusetts Institute of Technology
  123.  *
  124.  * Permission to use, copy, modify, and distribute this software and its
  125.  * documentation for any purpose and without fee is hereby granted, provided 
  126.  * that the above copyright notice appear in all copies and that both that 
  127.  * copyright notice and this permission notice appear in supporting 
  128.  * documentation, and that the name of M.I.T. not be used in advertising
  129.  * or publicity pertaining to distribution of the software without specific, 
  130.  * written prior permission. M.I.T. makes no representations about the 
  131.  * suitability of this software for any purpose.  It is provided "as is"
  132.  * without express or implied warranty.
  133.  *
  134.  */
  135.  
  136. #ifndef _XFUNCS_H_
  137. #define _XFUNCS_H_
  138.  
  139. #ifdef X_USEBFUNCS
  140. void bcopy();
  141. void bzero();
  142. int bcmp();
  143. #else
  144. #if (__STDC__ && !defined(X_NOT_STDC_ENV) && !defined(sun) && !defined(macII)) || defined(SVR4) || defined(hpux) || defined(_IBMR2)
  145. #include <string.h>
  146. #define bcopy(b1,b2,len) memmove(b2, b1, (size_t)(len))
  147. #define bzero(b,len) memset(b, 0, (size_t)(len))
  148. #define bcmp(b1,b2,len) memcmp(b1, b2, (size_t)(len))
  149. #else
  150. #ifdef sgi
  151. #include <bstring.h>
  152. #else
  153. #ifdef SYSV
  154. #include <memory.h>
  155. #if defined(_XBCOPYFUNC) && !defined(macII)
  156. #define bcopy _XBCOPYFUNC
  157. #define _XNEEDBCOPYFUNC
  158. #endif
  159. void bcopy();
  160. #define bzero(b,len) memset(b, 0, len)
  161. #define bcmp(b1,b2,len) memcmp(b1, b2, len)
  162. #else /* bsd */
  163. void bcopy();
  164. void bzero();
  165. int bcmp();
  166. #endif /* SYSV */
  167. #endif /* sgi */
  168. #endif /* __STDC__ and relatives */
  169. #endif /* X_USEBFUNCS */
  170.  
  171. #endif /* _XFUNCS_H_ */
  172.  
  173. #endif /* XtSpecificationRelease > 4 */
  174.  
  175. #ifndef X_NOT_STDC_ENV
  176. #include <string.h>
  177. #define index strchr
  178. #define rindex strrchr
  179. #else  /* X_NOT_STDC_ENV IS defined */
  180. #ifdef SYSV
  181. #include <string.h>
  182. #define index strchr
  183. #define rindex strrchr
  184. #else  /* NOT SYSV */
  185. #include <strings.h>
  186. #define strchr index
  187. #define strrchr rindex
  188. #endif  /* SYSV */
  189. #endif  /* X_NOT_STDC_ENV */
  190.  
  191. #include <sys/stat.h>
  192.  
  193. #if defined(__convex__) && defined(__STDC__)
  194. #define S_IFDIR _S_IFDIR
  195. #define S_IWRITE _S_IWRITE
  196. #endif
  197.  
  198. #ifndef SYSV
  199. #ifndef SVR4
  200. #include <fcntl.h>
  201. #endif
  202. #endif
  203.  
  204. #include <pwd.h>
  205. #include <signal.h>
  206. #include <stdio.h>
  207. #include <ctype.h>
  208. #include <errno.h>
  209.  
  210. extern int    errno;
  211. extern int    sys_nerr;
  212. extern char    *sys_errlist[];
  213.  
  214. #include <math.h>    /* for sin(), cos() etc */
  215.  
  216. #if defined(SYS) && defined(SYSV386)
  217. #if defined(__STDC__)
  218. #ifdef ISC
  219. extern double atof(char const *);
  220. #endif  /* ISC */
  221. #ifdef SCO
  222. extern double atof(const char *);
  223. #else  /* NOT SCO */
  224. extern double atof();
  225. #endif /* SCO */
  226. #else  /* NOT __STDC__ */
  227. extern double atof();
  228. #endif /* __STDC__ */
  229. #else  /* NOT defined(SYS) && defined(SYSV386) */
  230. #ifdef X_NOT_STDC_ENV
  231. #if defined(sun) && !defined(sparc) || defined(titan)
  232. extern double atof();
  233. extern char *getenv();
  234. #endif /* (sun) !(sparc) (titan) */
  235. #else  /* NOT X_NOT_STDC_ENV */
  236. #include <stdlib.h>    /* for atof() and getenv() */
  237. #endif /* X_NOT_STDC_ENV */
  238. #endif /* defined(SYS) && defined(SYSV386) */
  239.  
  240. #if defined(SYSV) || defined(SVR4) || defined(__osf__) || defined(USE_DIRENT)
  241. #define u_int uint
  242. #define USE_DIRENT
  243. #define DIRSTRUCT    struct dirent
  244. #else
  245. #define DIRSTRUCT    struct direct
  246. #endif
  247.  
  248. /* define PATH_MAX if not already defined */
  249. /* taken from the X11R5 server/os/osfonts.c file */
  250. #ifndef X_NOT_POSIX
  251. #ifdef _POSIX_SOURCE
  252. #include <limits.h>
  253. #else
  254. #if !defined(sun) || defined(sparc)
  255. #define _POSIX_SOURCE
  256. #include <limits.h>
  257. #undef _POSIX_SOURCE
  258. #endif /* !defined(sun) || defined(sparc) */
  259. #endif /* _POSIX_SOURCE */
  260. #endif /* X_NOT_POSIX */
  261.  
  262. #ifndef PATH_MAX
  263. #include <sys/param.h>
  264. #ifdef MAXPATHLEN
  265. #define PATH_MAX MAXPATHLEN
  266. #else
  267. #define PATH_MAX 1024
  268. #endif /* MAXPATHLEN */
  269. #endif /* PATH_MAX */
  270.  
  271. #ifndef M_PI
  272. #define M_PI    3.14159265358979323846
  273. #define M_PI_2    1.57079632679489661923
  274. #endif
  275.  
  276. #ifndef M_2PI
  277. #define M_2PI    6.28318530717958647692
  278. #endif
  279.  
  280. #define        min2(a, b)    (((a) < (b)) ? (a) : (b))
  281. #define        max2(a, b)    (((a) > (b)) ? (a) : (b))
  282. #define        min3(a,b,c)    ((((a<b)?a:b)<c)?((a<b)?a:b):c)
  283. #define        max3(a,b,c)    ((((a>b)?a:b)>c)?((a>b)?a:b):c)
  284. #define        round(a)    (int)(((a)<0.0)?(a)-.5:(a)+.5)
  285. #define        signof(a)    (((a) < 0) ? -1 : 1)
  286.  
  287. #define        DEF_NAME    "unnamed.fig"
  288.  
  289. /* include only Xlib.h and Intrinsic.h here - use figx.h for widget stuff */
  290.  
  291. #include <X11/Xlib.h>
  292. #include <X11/Intrinsic.h>
  293.  
  294. #ifdef NOSTRSTR
  295. extern char *strstr();
  296. #endif
  297.