/* core.h */ /* Have deliberately chosen NOT to have INNEROPTIONS in here, so */ /* think hard before changing mind about that... */ /* Note that there is a system core.h file (which presumably deals */ /* with core dump files). Presumably no conflict. Even if there */ /* would be, presumably one can get both into one's program by */ /* using "core.h" and/or fooling with -I on compile */ /* Anticipate multiple attempted loads of core.h */ #ifndef BASE_COREH_VERSION #define BASE_COREH_VERSION "core.h version 2.0e 22 Sep 2012" /* 22 Sep 12. v 2.0e WJS */ /* mergeparams1 defns */ /* 13 Jul 12. v 2.0e WJS */ /* More JDB_CONDITIONs */ /* [Begin 2.0e] */ /* 4 Nov 09. v 2.0d WJS */ /* Another 2 JDB_CONDITIONs */ /* [Begin 2.0d] */ /* 1 Sep 09. v 2.0c WJS */ /* GET_LONG_FROM_STRING */ /* [Begin 2.0c] */ /* 3 Jul 09. v 2.0b WJS */ /* DCTSEARCH_COMMENT_CHAR */ /* [Begin 2.0b] */ /* 1 Apr 09. v 2.0a WJS */ /* Define LINUX if undefined */ /* [Begin 2.0a] */ /* 5 Aug 08. v 2.0 WJS */ /* GET_NUMBER_FROM_STRING */ /* Per the numbering oddity below, let's go to 2.0 now */ /* [Begin 2.0] */ /* 18 Jan 08. v 1.6 WJS */ /* For some reason, BASE_COREH_VERSION was defined to 1.8 17 Aug */ /* after the 18 Aug 07 mod. ?? */ /* Another JDB_CONDITION */ /* 18 Aug 07. v 1.6 WJS */ /* DCTSEARCH_* */ /* [Begin 1.6] */ /* 23 Jun 07. v 1.5a WJS */ /* ILLEGAL_LEVEL; ILLEGAL_VARNUM */ /* 10 Jun 07. v 1.5a WJS */ /* Another JDB_CONDITION */ /* [Begin 1.5a] */ /* 27 Apr 07. v 1.5 WJS */ /* Try to get an ID for default.h into our ID scheme */ /* 16 Dec 06. v 1.5 WJS */ /* DEFAULT_TRIGRAM_CHAR */ /* QUERY_STRING_CHAR */ /* 8 Dec 06. v 1.5 WJS */ /* WJSTBL character defns */ /* ILLEGAL_VARNAME_CHARS */ /* 6 Dec 06. v 1.5 WJS */ /* Another JDB_CONDITION */ /* 6 Oct 06. v 1.5 WJS */ /* JDB_CONDITION_* defns per the plaintive defgb comment */ /* " -999 not parametrized since it would need to */ /* be coordinated w/jdb" */ /* Think it's about time!! */ /* [Begin 1.5] */ /* 14 Jul 06. v 1.4c WJS */ /* ADD_INTO_FIXED_LEN_BUFFER */ /* Mod copy_into_fixed_len_buffer to copy_into_buffer per name */ /* change in utils.c */ /* [Begin 1.4c] */ /* 3 Jun 05. v 1.4b WJS */ /* Add function declaration for copy_into_fixed_len_buffer (used */ /* by macro of same name). A waste if user doesn't use macro, */ /* and a problem if user doesn't use macro and wants own func- */ /* tion w/same name, but will take that chance */ /* [Begin 1.4b] */ /* 5 Apr 05. v 1.4a WJS */ /* Allow user to specifiy MAX_SERV_DCT_BUF in default.h */ /* [Begin 1.4a] */ /* 30 Aug 04. v 1.4 WJS */ /* jdb function defn stuff should not be in here, since that would */ /* require everything to use library. */ /* 25 Aug 04. v 1.4 WJS */ /* MAX_SERV_DCT_BUF */ /* [Begin 1.4] */ /* 13 Jul 04. v 1.3 WJS */ /* W_EXTEND ("width extender" char. Needed in all width input */ /* processing) */ /* [Begin 1.3] */ /* 25 Mar 04. v 1.2 WJS */ /* stat.h */ /* 20 Feb 04. v 1.2 WJS */ /* Some OS-wide defns: PIPECHAR, INP_REDIRECT_CHAR, */ /* OUTP_REDIRECT_CHAR, & DIRSEP */ /* 11 Feb 04. v 1.2 WJS */ /* JGOFS_ERR_PREFIX */ /* MAXLEN_PROGRAM_ID_STRING */ /* pwd.h (needed for "approved" way to get user name) */ /* Include error_exit_defn.h in here */ /* [Begin 1.2] */ /* 16 Jan 04. v 1.1 WJS */ /* MISSING_VALUE_REAL, NULL_DEVICE */ #include #include #include #include #include #include #include #include #include #include #include /* Get (most) site-specific parameters via -DOPTIONS switch. Allow */ /* user to put an ID in the file pointed to by -DOPTIONS, and */ /* get that ID into the COREH_VERSION ID */ /* (OPTIONS usually points to default.h) */ #include OPTIONS #ifndef OPTIONS_VERSION #define OPTIONS_VERSION "No OPTIONS ident" #endif #define COREH_VERSION BASE_COREH_VERSION"/"OPTIONS_VERSION #ifndef FALSE /* Not sure where the system defns of these are on Bob's box, if */ /* anywhere and we gotta have them. C defines FALSE but doesn't */ /* care about TRUE, so define latter in terms of former in case */ /* there are system differences (eg, VMS generally likes -1 for */ /* TRUE...) */ #define FALSE 0 #define TRUE !FALSE #endif #if FALSE || !TRUE #error "Bad TRUE/FALSE values got into program at compile time" #endif #define NOT_VALID -1 /* We use -1 as different from TRUE & FALSE. Check this is OK */ #if (TRUE == NOT_VALID) || (FALSE == NOT_VALID) #error "TRUE/FALSE value conflicts w/something we assume is neither" #endif #ifndef CYGWIN #define CYGWIN FALSE #endif #ifndef HP #define HP FALSE #endif #ifndef IBM #define IBM FALSE #endif #ifndef IRIX #define IRIX FALSE #endif #ifndef LINUX #define LINUX FALSE #endif #ifndef OSF #define OSF FALSE #endif #ifndef PC #define PC FALSE #endif #ifndef SOL #define SOL FALSE #endif #ifndef SUN #define SUN FALSE #endif #ifndef ULTRIX #define ULTRIX FALSE #endif #ifndef VMS #define VMS FALSE #endif double strtod(); extern char **environ; typedef signed char Logical; /* NB: occasionally gets -1, */ /* hence need signed */ char *copy_into_buffer(); #define COPY_INTO_FIXED_LEN_BUFFER(dest,source,errmsg) \ copy_into_buffer((dest),sizeof((dest)),(source),errmsg) char *add_to_buffer(); #define ADD_INTO_FIXED_LEN_BUFFER(dest,source,errmsg) \ add_to_buffer((dest),sizeof((dest)),(source),errmsg) /* Next macros gets as much of a number out of a string as strtoX */ /* will give, and then sets a status indicating if that number was */ /* all that there was in the string. In particular, macro allows */ /* for trailing blanks. Coded (and coded as a macro) for efficiency */ /* to try to avoid testing for blanks, since that condition is */ /* presumably rare */ #define GET_NUMBER_FROM_STRING(number,string,used_whole_string) \ { \ char *end_string; \ (number) = strtod((string),&end_string); \ (used_whole_string) = (*end_string == '\0'); \ if ( ! (used_whole_string)) { \ if (*end_string == ' ') { \ while ( *(++end_string) == ' ' ) ; \ (used_whole_string) = (*end_string == '\0'); \ } \ } \ } /* Note the implied conversion if number is not a long */ #define GET_INTEGER_FROM_STRING(number,string,used_whole_string) \ { \ char *end_string; \ (number) = strtol((string),&end_string,0); \ (used_whole_string) = (*end_string == '\0'); \ if ( ! (used_whole_string)) { \ if (*end_string == ' ') { \ while ( *(++end_string) == ' ' ) ; \ (used_whole_string) = (*end_string == '\0'); \ } \ } \ } /* This size is used by a number of serv & dct buffers, most re- */ /* lating to pieces of .objects entries. No real reason they should */ /* all be the same size, but one step at a time! */ #define DEFAULT_MAX_SERV_DCT_BUF 1025 #ifndef MAX_SERV_DCT_BUF #define MAX_SERV_DCT_BUF DEFAULT_MAX_SERV_DCT_BUF #endif #if VMS #define STDOUT_NAME "SYS$OUTPUT:" #define STDERR_NAME "SYS$ERROR:" #define NULL_DEVICE "NL:" #define strcasecmp strcasecmp_wjs #include #include /* Looks like waitpid stuff not in VMS until v 7... */ /* Define WNOHANG here; a dummy waitpid() function in */ /* wjsdummyunixlib (mult defns if defined here) */ #define WNOHANG 1 /* Defined in wait.h for VMS v 7 but not 6 */ #else #define STDOUT_NAME "/dev/stdout" #define STDERR_NAME "/dev/stderr" #define NULL_DEVICE "/dev/null" #include #include #include #endif /* Next value is supposed to be an illegal major/minor device ID */ /* as returned by the stat/fstat/lstat series of system calls. No */ /* biggie if it turns out to be legal - only used as a flag to */ /* prevent superfluous stat calls */ #define NO_SUCH_DEVICE 0 /* ATTRIB_SEP Character which separates entries in */ /* a variable attribute list. Note this is a */ /* a character, not a string. Embedded */ /* whitespace (for example) is significant */ /* within an attribute string */ /* ATTR_DELIM Characters that surround variable */ /* attribute list */ /* DEFAULT_TRIGRAM_CHAR Character whose presence is associated */ /* with a "trigrammed" string (see doc for */ /* trigram routine in outer_utils.c) */ /* JGOFS_ERR_PREFIX String whose presence in a JGOFS-for- */ /* matted data stream indicates an error cond- */ /* ition. Typically followed by stream of */ /* information about the error. */ /* MISSING_VALUE_REAL Floating point number that represents */ /* various data anomalies when data is */ /* represented in floating point form */ /* MISSING_VALUE_STRING String that represents various data */ /* anomalies when data is presented in string */ /* form */ /* W_EXTEND Trailing character in variable name */ /* which pads name length to output datum */ /* length. Alternate to specifying [width] */ /* attribute */ #define ATTRIB_SEP ';' #define ATTR_DELIM "[]" #define DEFAULT_TRIGRAM_CHAR '%' #define JGOFS_ERR_PREFIX "&x" #define MISSING_VALUE_REAL -9999. #define MISSING_VALUE_STRING "nd" #define W_EXTEND '_' /* Some characters from the "outside world" */ /* DIRSEP Character in a file spec that indicates */ /* a directory name has just concluded */ /* INP_REDIRECT_CHAR Character which indicates input */ /* redirection to shell */ /* OUTP_REDIRECT_CHAR Character which indicates output */ /* redirection to shell */ /* PIPECHAR Character which indicates I/O piping to */ /* shell */ /* QUERY_STRING_CHAR Char in URL that separates PATH_INFO */ /* from QUERY_STRING */ #define DIRSEP '/' #define INP_REDIRECT_CHAR '<' #define OUTP_REDIRECT_CHAR '>' #define PIPECHAR '|' #define QUERY_STRING_CHAR '?' /* MAXLEVELS Cannot be bigger than 10 (Email from Glenn ~20 Feb 96) */ /* Somewhere, system assumes max level is 1 character long */ /* (0-9; hence size of 10). Don't see point in allowing */ /* it to be smaller, hence not configurable */ /* The "somewhere" might be the jdb routines which look at */ /* 1 char after the &v, or &d, or whatever */ #define MAXLEVELS 10 #define MAXLEN_PROGRAM_ID_STRING 256 /* error_exit_defn.h v 1.0 20 Apr 99 WJS */ /* Define error exit status for program. Problem from my per- */ /* spective was that too many "things" used 1 (which, by the way, is */ /* defined in stdlib.h as EXIT_FAILURE, so 1 is in fact standard in */ /* some way). I wanted a status that meant that the program had in- */ /* deed begun and chosen to fail. For example, if you try to exe- */ /* cute a program in a child process and give the wrong file spec, you */ /* will get a 1 back from whatever component tried to find the pro- */ /* gram, which is too easily confused with the program exiting with */ /* a 1. */ /* Because the wait system service, which reports child process */ /* termination information, only reports the low order 8 bits of exit */ /* status, I wanted a number < 255. 0 is reserved for success. */ /* 250 chosen after looking through a couple of errno.h files for */ /* unused statuses between 1 & 255. No guarantee that it will stay */ /* unused, of course. 255 ruled out because perl die function uses it */ #ifndef ERROR_EXIT_STATUS #define ERROR_EXIT_STATUS 250 #endif #if ERROR_EXIT_STATUS < 0 #error "ERROR_EXIT_STATUS < 0 will most likely be interpreted as pos #" #endif #if ERROR_EXIT_STATUS == 0 #error "ERROR_EXIT_STATUS = 0 conflicts with normal exit status" #endif #if ERROR_EXIT_STATUS > 255 #error "ERROR_EXIT_STATUS > 255 causes trouble when issued from child processes" #endif /* jdb routines return non-negatives for "normal", so vals here */ /* must be < 0 */ /* Use defns below if you really care about a particular condition */ /* In particular, test for EOF */ /* Otherwise, use the condition analysis functions provided in jdb. */ /* In fact, it's probably best practice to use those functions until */ /* you get an abnormal indication, and only then test for these vals */ #define JDB_CONDITION_ERROR -999 /* Original, "catch-all" */ #define JDB_CONDITION_INTERNAL_BUFOVF -998 #define JDB_CONDITION_BADATTRLIST -997 #define JDB_CONDITION_DATA_BUFOVF -996 #define JDB_CONDITION_NOPIPES -995 #define JDB_CONDITION_BADFORK -994 #define JDB_CONDITION_DCTSEARCHFAILURE -993 #define JDB_CONDITION_VARNOTFOUND -992 #define JDB_CONDITION_COMMENT_BUF_OUT_OF_MEM -991 #define JDB_CONDITION_NO_CLOSE_PAREN -990 #define JDB_CONDITION_BADOBJECTSPEC -989 #define JDB_CONDITION_HANDLEOUTOFRANGE -988 #define JDB_CONDITION_NOMEM_FOR_UNITSTRUCT -987 #define JDB_CONDITION_NOMEM_FOR_COMM_BUFFER -986 #define JDB_CONDITION_NAMEBUF_OVF -985 #define JDB_CONDITION_SINGLE_ATTR_BUF_OVF -984 #define JDB_CONDITION_PARPTR_OVF -983 #define JDB_CONDITION_EOF -1 /* dctsearch stuff */ #ifndef DCTSEARCH_EXTENDED_ERROR_INFO #define DCTSEARCH_EXTENDED_ERROR_INFO TRUE #endif #define DCTSEARCH_COMMENT_CHAR '#' #define DCTSEARCH_DEFAULT_METHOD "def" #define DCTSEARCH_STATUS_UNTESTED '.' #define DCTSEARCH_STATUS_WILLNOTBETESTED '-' /* Due to user flag */ /* specified to dctsearch */ #define DCTSEARCH_STATUS_OK 'E' /* File exists & is accessible */ #define DCTSEARCH_STATUS_NOSUCHFILE 'N' /* ... or its dirs inaccessible */ #define DCTSEARCH_STATUS_NOACCESS 'A' /* Exists; not accessible */ #define DCTSEARCH_STATUS_IOERR 'R' /* "_OK" file; read problem */ /* Order in which status histories appear */ #define DCTSEARCH_USEROBJ_HISTORY 0 #define DCTSEARCH_OBJ_HISTORY 1 #define DCTSEARCH_REMOBJ_HISTORY 2 #define DCTSEARCH_METHOD_HISTORY 3 #define DCTSEARCH_DATFILE_HISTORY 4 #define DCTSEARCH_DEFMETHOD_HISTORY 5 #define DCTSEARCH_NUMBER_HISTORIES 6 #define DCTSEARCH_HISTORY_DELIMITERS "[]" /* May be same chars */ #define DCTSEARCH_HISTORY_SEPARATOR '/' /* mergeparams1 return statuses */ #define MP1_OK 0 #define MP1_NO_INPUT 1 #define MP1_NO_SIGNIF_INPUT 2 #define MP1_SYNTAX_ERROR_ARG1 3 #define MP1_SYNTAX_ERROR_ARG2 4 #define MP1_MALLOC_FAILURE 5 /* Params for building a "wjstbl" (see doc in lookup_wjstbl in utils)*/ /* These characters must not conflict with characters that can */ /* appear in table entries, and routines that build tables should */ /* check. Easiest way to do this is to make them binary, but */ /* not sure if this can be done w/white space character, which is */ /* sometimes used to terminate a scanf */ /* Routines that decode tables do not need to know these */ /* characters since the separator is the first character of */ /* a table and the white space character is the last. If used */ /* when decoding, be sure table being decoded was built with them */ #define DEFAULT_WJSTBL_WHITE_SPACE '\v' #define DEFAULT_WJSTBL_SEPARATOR 1 /* White space & separator character for optional files. See doc in */ /* defgb_nonconfig.h & create_wjstbl. Only spec these if the default */ /* characters are somewhere in opt file data */ #ifndef WJSTBL_WHITE_SPACE /* Must be a c "white space" character */ #define WJSTBL_WHITE_SPACE DEFAULT_WJSTBL_WHITE_SPACE #endif #ifndef WJSTBL_SEPARATOR #define WJSTBL_SEPARATOR DEFAULT_WJSTBL_SEPARATOR #endif #define DEFAULT_ILLEGAL_VARNAME_CHARS "!@#$%&?" #ifndef ILLEGAL_VARNAME_CHARS #define ILLEGAL_VARNAME_CHARS DEFAULT_ILLEGAL_VARNAME_CHARS #endif /* Might want to distinguish between "illegal" and "not supplied" */ /* Latter is around in places (eg path_info_routines.h) and has been */ /* -1 for a while. Interesting problem about keeping these things */ /* straight if they are not in the same .h file */ #define ILLEGAL_LEVEL -2 #define ILLEGAL_VARNUM -2 #endif