[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.2

1.1       maekawa     1: /*
1.1.1.2 ! maekawa     2:  * $Id: stdfn.h,v 1.17.2.1 1999/10/15 16:04:51 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:
                    224: #ifdef NO_TIME_H
                    225: # ifndef time_t /* should be #defined by config.h, then... */
                    226: #  define time_t long
                    227: # endif
                    228: #else
                    229: # include <time.h> /* ctime etc, should also define time_t and struct tm */
                    230: #endif
                    231:
                    232: #if defined(PIPES) && (defined(VMS) || (defined(OSK) && defined(_ANSI_EXT))) || defined(PIPES) && defined(AMIGA_SC_6_1)
                    233: FILE *popen __PROTO((char *, char *));
                    234: int pclose __PROTO((FILE *));
                    235: #endif
                    236:
                    237: #ifndef NO_FLOAT_H
                    238: # include <float.h>
                    239: #endif
                    240:
                    241: #ifndef NO_LOCALE_H
                    242: # include <locale.h>
                    243: #endif
                    244:
                    245: #ifndef NO_MATH_H
                    246: # include <math.h>
                    247: #endif
                    248:
                    249: #ifndef HAVE_STRNICMP
                    250: # ifdef HAVE_STRNCASECMP
                    251: #  define strnicmp strncasecmp
                    252: # else
                    253: int strnicmp __PROTO((char *, char *, int));
                    254: # endif
                    255: #endif
                    256:
                    257: /* Argument types for select() */
1.1.1.2 ! maekawa   258: /* These may need some work ... */
        !           259: #ifndef fd_set_size_t
        !           260: # define fd_set_size_t size_t
        !           261: #endif
        !           262: #ifndef SELECT_FD_SET_CAST
        !           263: # define SELECT_FD_SET_CAST
        !           264: #endif
1.1       maekawa   265:
                    266: #ifndef GP_GETCWD
                    267: # if defined(HAVE_GETCWD)
                    268: #  define GP_GETCWD(path,len) getcwd (path, len)
                    269: # else
                    270: #  define GP_GETCWD(path,len) getwd (path)
                    271: # endif
                    272: #endif
                    273:
                    274: #ifndef GP_SLEEP
                    275: # ifdef __ZTC__
                    276: #  define GP_SLEEP(delay) usleep ((unsigned long) (delay))
                    277: # else
                    278: #  define GP_SLEEP(delay) sleep ((unsigned int) (delay))
                    279: # endif
                    280: #endif
                    281:
                    282: /* Misc. defines */
                    283:
                    284: /* Null character */
                    285: #define NUL ('\0')
                    286:
                    287: /* Definitions for debugging */
                    288: /* #define NDEBUG */
                    289: #include <assert.h>
                    290:
                    291: #ifdef DEBUG
                    292: # define DEBUG_WHERE do { fprintf(stderr,"%s:%d ",__FILE__,__LINE__); } while (0)
                    293: # define FPRINTF(a) do { DEBUG_WHERE; fprintf a; } while (0)
                    294: #else
                    295: # define DEBUG_WHERE     /* nought */
                    296: # define FPRINTF(a)      /* nought */
                    297: #endif /* DEBUG */
                    298:
                    299: #endif /* STDFN_H */

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