[BACK]Return to stdfn.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot

Annotation of OpenXM_contrib/gnuplot/stdfn.h, Revision 1.1.1.3

1.1       maekawa     1: /*
1.1.1.3 ! ohara       2:  * $Id: stdfn.h,v 1.17.2.3 2002/10/15 19:33:49 lhecking Exp $
1.1       maekawa     3:  *
                      4:  */
                      5:
                      6: /* GNUPLOT - stdfn.h */
                      7:
                      8: /*[
                      9:  * Copyright 1986 - 1993, 1998   Thomas Williams, Colin Kelley
                     10:  *
                     11:  * Permission to use, copy, and distribute this software and its
                     12:  * documentation for any purpose with or without fee is hereby granted,
                     13:  * provided that the above copyright notice appear in all copies and
                     14:  * that both that copyright notice and this permission notice appear
                     15:  * in supporting documentation.
                     16:  *
                     17:  * Permission to modify the software is granted, but not the right to
                     18:  * distribute the complete modified source code.  Modifications are to
                     19:  * be distributed as patches to the released version.  Permission to
                     20:  * distribute binaries produced by compiling modified sources is granted,
                     21:  * provided you
                     22:  *   1. distribute the corresponding source modifications from the
                     23:  *    released version in the form of a patch file along with the binaries,
                     24:  *   2. add special version identification to distinguish your version
                     25:  *    in addition to the base release version number,
                     26:  *   3. provide your name and address as the primary contact for the
                     27:  *    support of your modified version, and
                     28:  *   4. retain our contact information in regard to use of the base
                     29:  *    software.
                     30:  * Permission to distribute the released version of the source code along
                     31:  * with corresponding source modifications in the form of a patch file is
                     32:  * granted with same provisions 2 through 4 for binary distributions.
                     33:  *
                     34:  * This software is provided "as is" without express or implied warranty
                     35:  * to the extent permitted by applicable law.
                     36: ]*/
                     37:
                     38: /* get prototypes or declarations for string and stdlib functions and deal
                     39:    with missing functions like strchr. */
                     40:
                     41: /* we will assume the ANSI/Posix/whatever situation as default.
                     42:    the header file is called string.h and the index functions are called
                     43:    strchr, strrchr. Exceptions have to be listed explicitly */
                     44:
                     45: #ifndef STDFN_H
                     46: #define STDFN_H
                     47:
                     48: #include <ctype.h>
                     49: #include <stdio.h>
                     50:
                     51: #include "syscfg.h"
                     52:
                     53: #ifndef NO_STRING_H
                     54: # include <string.h>
                     55: #else
                     56: # include <strings.h>
                     57: #endif
                     58:
                     59: #ifdef HAVE_BCOPY
                     60: # ifdef NO_MEMCPY
                     61: #  define memcpy(d,s,n) bcopy((s),(d),(n))
                     62: # endif
                     63: # ifdef NO_MEMMOVE
                     64: #  define memmove(d,s,n) bcopy((s),(d),(n))
                     65: # endif
                     66: #endif /* HAVE_BCOPY */
                     67:
                     68: #ifdef NO_STRCHR
                     69: # ifdef strchr
                     70: #  undef strchr
                     71: # endif
                     72: #ifdef HAVE_INDEX
                     73: # define strchr index
                     74: #endif
                     75: # ifdef strrchr
                     76: #  undef strrchr
                     77: # endif
                     78: # ifdef HAVE_RINDEX
                     79: #  define strrchr rindex
                     80: # endif
                     81: #endif
                     82:
                     83: #ifdef NO_STDLIB_H
                     84: # ifdef HAVE_MALLOC_H
                     85: #  include <malloc.h>
                     86: # else
                     87: void free();
                     88: char *malloc();
                     89: char *realloc();
                     90: # endif /* HAVE_MALLOC_H */
                     91: char *getenv();
                     92: int system();
                     93: double atof();
                     94: int atoi();
                     95: long atol();
                     96: double strtod();
                     97: #else /* !NO_STDLIB_H */
                     98: # include <stdlib.h>
                     99: # ifndef VMS
                    100: #  ifndef EXIT_FAILURE
                    101: #   define EXIT_FAILURE (1)
                    102: #  endif
                    103: #  ifndef EXIT_SUCCESS
                    104: #   define EXIT_SUCCESS (0)
                    105: #  endif
                    106: # else /* VMS */
                    107: #  ifdef VAXC            /* replacement values suppress some messages */
                    108: #   ifdef  EXIT_FAILURE
                    109: #    undef EXIT_FAILURE
                    110: #   endif
                    111: #   ifdef  EXIT_SUCCESS
                    112: #    undef EXIT_SUCCESS
                    113: #   endif
                    114: #  endif /* VAXC */
                    115: #  ifndef  EXIT_FAILURE
                    116: #   define EXIT_FAILURE  0x10000002
                    117: #  endif
                    118: #  ifndef  EXIT_SUCCESS
                    119: #   define EXIT_SUCCESS  1
                    120: #  endif
                    121: # endif /* VMS */
                    122: #endif /* !NO_STDLIB_H */
                    123:
                    124: #ifdef HAVE_UNISTD_H
                    125: # include <unistd.h>
                    126: #else
                    127: # ifdef HAVE_LIBC_H /* NeXT uses libc instead of unistd */
                    128: #  include <libc.h>
                    129: # endif
                    130: #endif /* HAVE_UNISTD_H */
                    131:
                    132: #ifndef NO_ERRNO_H
                    133: # include <errno.h>
                    134: #endif
                    135: # ifdef EXTERN_ERRNO
                    136: extern int errno;
                    137: #endif
                    138:
                    139: #ifndef NO_SYS_TYPES_H
                    140: # include <sys/types.h>
                    141: #endif
                    142:
                    143: #ifdef HAVE_SYS_STAT_H
                    144: # include <sys/stat.h>
                    145:
                    146: /* This is all taken from GNU fileutils lib/filemode.h */
                    147:
                    148: #if !S_IRUSR
                    149: # if S_IREAD
                    150: #  define S_IRUSR S_IREAD
                    151: # else
                    152: #  define S_IRUSR 00400
                    153: # endif
                    154: #endif
                    155:
                    156: #if !S_IWUSR
                    157: # if S_IWRITE
                    158: #  define S_IWUSR S_IWRITE
                    159: # else
                    160: #  define S_IWUSR 00200
                    161: # endif
                    162: #endif
                    163:
                    164: #if !S_IXUSR
                    165: # if S_IEXEC
                    166: #  define S_IXUSR S_IEXEC
                    167: # else
                    168: #  define S_IXUSR 00100
                    169: # endif
                    170: #endif
                    171:
                    172: #ifdef STAT_MACROS_BROKEN
                    173: # undef S_ISBLK
                    174: # undef S_ISCHR
                    175: # undef S_ISDIR
                    176: # undef S_ISFIFO
                    177: # undef S_ISLNK
                    178: # undef S_ISMPB
                    179: # undef S_ISMPC
                    180: # undef S_ISNWK
                    181: # undef S_ISREG
                    182: # undef S_ISSOCK
                    183: #endif /* STAT_MACROS_BROKEN.  */
                    184:
                    185: #if !defined(S_ISBLK) && defined(S_IFBLK)
                    186: # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
                    187: #endif
                    188: #if !defined(S_ISCHR) && defined(S_IFCHR)
                    189: # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
                    190: #endif
                    191: #if !defined(S_ISDIR) && defined(S_IFDIR)
                    192: # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
                    193: #endif
                    194: #if !defined(S_ISREG) && defined(S_IFREG)
                    195: # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
                    196: #endif
                    197: #if !defined(S_ISFIFO) && defined(S_IFIFO)
                    198: # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
                    199: #endif
                    200: #if !defined(S_ISLNK) && defined(S_IFLNK)
                    201: # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
                    202: #endif
                    203: #if !defined(S_ISSOCK) && defined(S_IFSOCK)
                    204: # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
                    205: #endif
                    206: #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
                    207: # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
                    208: # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
                    209: #endif
                    210: #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
                    211: # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
                    212: #endif
                    213:
                    214: #endif /* HAVE_SYS_STAT_H */
                    215:
                    216: #ifndef NO_LIMITS_H
                    217: # include <limits.h>
                    218: #else
                    219: # ifdef HAVE_VALUES_H
                    220: #  include <values.h>
                    221: # endif /* HAVE_VALUES_H */
                    222: #endif /* !NO_LIMITS_H */
                    223:
1.1.1.3 ! ohara     224: /* ctime etc, should also define time_t and struct tm */
        !           225: #ifndef NO_TIME_H
        !           226: # include <time.h>
        !           227: #endif
        !           228:
        !           229: #ifndef HAVE_TIME_T_IN_TIME_H
        !           230: # define time_t long
1.1       maekawa   231: #endif
                    232:
                    233: #if defined(PIPES) && (defined(VMS) || (defined(OSK) && defined(_ANSI_EXT))) || defined(PIPES) && defined(AMIGA_SC_6_1)
                    234: FILE *popen __PROTO((char *, char *));
                    235: int pclose __PROTO((FILE *));
                    236: #endif
                    237:
                    238: #ifndef NO_FLOAT_H
                    239: # include <float.h>
                    240: #endif
                    241:
                    242: #ifndef NO_LOCALE_H
                    243: # include <locale.h>
                    244: #endif
                    245:
                    246: #ifndef NO_MATH_H
                    247: # include <math.h>
1.1.1.3 ! ohara     248: #endif
        !           249:
        !           250: /* Normally in <math.h> */
        !           251: #ifndef M_PI
        !           252: # define M_PI 3.14159265358979323846
        !           253: #endif
        !           254: #ifndef M_PI_2
        !           255: # define M_PI_2 1.57079632679489661923
        !           256: #endif
        !           257:
        !           258: #ifndef HAVE_STRCASECMP
        !           259: # ifdef HAVE_STRICMP
        !           260: #  define strcasecmp stricmp
        !           261: # else
        !           262: int gp_stricmp __PROTO((const char *, const char *));
        !           263: #  define strcasecmp gp_stricmp
        !           264: # endif
1.1       maekawa   265: #endif
                    266:
                    267: #ifndef HAVE_STRNICMP
                    268: # ifdef HAVE_STRNCASECMP
                    269: #  define strnicmp strncasecmp
                    270: # else
                    271: int strnicmp __PROTO((char *, char *, int));
                    272: # endif
                    273: #endif
                    274:
                    275: /* Argument types for select() */
1.1.1.2   maekawa   276: /* These may need some work ... */
                    277: #ifndef fd_set_size_t
                    278: # define fd_set_size_t size_t
                    279: #endif
                    280: #ifndef SELECT_FD_SET_CAST
                    281: # define SELECT_FD_SET_CAST
                    282: #endif
1.1       maekawa   283:
                    284: #ifndef GP_GETCWD
                    285: # if defined(HAVE_GETCWD)
                    286: #  define GP_GETCWD(path,len) getcwd (path, len)
                    287: # else
                    288: #  define GP_GETCWD(path,len) getwd (path)
                    289: # endif
                    290: #endif
                    291:
                    292: #ifndef GP_SLEEP
                    293: # ifdef __ZTC__
                    294: #  define GP_SLEEP(delay) usleep ((unsigned long) (delay))
                    295: # else
                    296: #  define GP_SLEEP(delay) sleep ((unsigned int) (delay))
                    297: # endif
                    298: #endif
                    299:
                    300: /* Misc. defines */
                    301:
                    302: /* Null character */
                    303: #define NUL ('\0')
                    304:
                    305: /* Definitions for debugging */
                    306: /* #define NDEBUG */
                    307: #include <assert.h>
                    308:
                    309: #ifdef DEBUG
                    310: # define DEBUG_WHERE do { fprintf(stderr,"%s:%d ",__FILE__,__LINE__); } while (0)
                    311: # define FPRINTF(a) do { DEBUG_WHERE; fprintf a; } while (0)
                    312: #else
                    313: # define DEBUG_WHERE     /* nought */
                    314: # define FPRINTF(a)      /* nought */
                    315: #endif /* DEBUG */
                    316:
                    317: #endif /* STDFN_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>