/* list.h								*/

  /*  Following constant will NOT appear as a string in executable	*/
  /*  unless some code references it "properly"				*/
#define LISTH_VERSION "list.h  version 1.0  19 Feb 02"

#ifndef PC
#define PC 0
#endif
#ifndef VMS
#define VMS 0
#endif
#ifndef HP
#define HP 0
#endif
#ifndef IBM
#define IBM 0
#endif
#ifndef SUN
#define SUN 0
#endif
#ifndef SOL
#define SOL 0
#endif
#ifndef IRIX
#define IRIX 0
#endif
#ifndef ULTRIX
#define ULTRIX 0
#endif
#ifndef OSF
#define OSF 0
#endif

#include <errno.h>  
#include <stdio.h>  
#include <stdlib.h>  
#include <string.h>

#if ! PC
#include <signal.h>
#endif

  /*  Status for exiting program					*/
  /*  Must be something like this in some .h file, but don't know where	*/
  /*  Found a reference to EXIT_SUCCESS & EXIT_FAILURE.  Hmmm		*/
#ifdef EXIT_SUCCESS
#define OK_EXIT EXIT_SUCCESS
#else
#define OK_EXIT 0
#endif
#ifdef EXIT_FAILURE
#define ERROR_EXIT EXIT_FAILURE
#else
#define ERROR_EXIT 1
#endif

  /*  Function re-definitions						*/
#if HP || IBM
#define jdbopen_ jdbopen
#define jdbreada_ jdbreada
#define jdbread_ jdbread
#define jdbclose_ jdbclose
#define jdbcomments_ jdbcomments
#define jdblevel_ jdblevel
#define jdbattributes_ jdbattributes
#elif PC
#define getchar getch
#endif

#include OPTIONS

  /*  Sizes are defgb's; = default.h except for datumsize, up from 80	*/
  /*  compile-time definition of OPTIONS will point to default.h        */
#define MIN_NVALS 250	/* NB:  this is NVAR from inner.h (as of Nov 01)*/
#ifdef NVALS
#if NVALS < MIN_NVALS
#undef NVALS
#endif
#endif
#ifndef NVALS
#define NVALS MIN_NVALS
#endif

  /*  The fooling w/DATUMSIZE is probably dumb, but it IS historically	*/
  /*  consistent							*/
#define MIN_DATUMSIZE 120
#ifdef DATUMSIZE 
#if DATUMSIZE < MIN_DATUMSIZE
#undef DATUMSIZE
#endif
#endif
#ifndef DATUMSIZE
#define DATUMSIZE MIN_DATUMSIZE
#endif

#if PC
#define CR '\r'
#else
#define CR '\n'
#endif
#define SPACE ' '
#define MISSING_VAL_STRING "nd"
#define MISSING_VAL_NUMERIC "-9999.0"
#define DEFAULT_FIELD_WIDTH 7
#define SCREEN_COLS 80
#define SCREEN_ROWS 24

  /*  Original list did an unconditional /bin/stty opost at exit	*/
  /*  despite not setting -opost at the beginning.  As of Feb 02, do	*/
  /*  not understand opost matter.  WJS					*/
#if SUN || ULTRIX
  char *setup_term_command = "/bin/stty cbreak";
  char *reset_term_command = "/bin/stty -cbreak opost";
#elif IRIX || IBM || OSF || SOL || HP
  char *setup_term_command = "/bin/stty -icanon min 1 time 0";
  char *reset_term_command = "/bin/stty icanon opost";
#elif VMS
  char *setup_term_command = "SET TERM/PASTHRU";
  char *reset_term_command = "SET TERM/NOPASTHRU";
#else
  char *setup_term_command = "";
  char *reset_term_command = "";
#endif

  /*  Buffer sizing considerations.					*/
  /*    1)  Although the name and value buffers are logically different	*/
  /*	    sizes, we use them to hold right-justified fields, and we	*/
  /*	    right justify both to the same size.  Accordingly the	*/
  /*	    buffers need to be the same size (or the application needs	*/
  /*	    to be recoded from "right justify all, output all" logic	*/
  /*	    to "right justify 1, output 1" logic which would permit 1	*/
  /*	    buffer, reused for every right-justified field)		*/
  /*	2)  We append the attribute string to the name in the name	*/
  /*	    buffer before right justifying, so the buffer needs to be	*/
  /*	    big enough for that						*/
  /*	3)  There is no logical connection between the output field	*/
  /*	    width to which we are right justifying, and the data field	*/
  /*	    width.  For example, somebody could request that data	*/
  /*	    fields that never exceed 10 bytes in size should always be	*/
  /*	    displayed in 20 character fields.  We don't know the widths	*/
  /*	    until we call jdbopen, but we must supply jdbopen with a	*/
  /*	    buffer.  We should provide a temporary buffer big enough	*/
  /*	    to hold the jdbopen data, find the widths, then dynamically	*/
  /*	    allocate buffers of the correct size and copy the temp	*/
  /*	    buffer into that.  We don't do this.  Aside from eating my	*/
  /*	    hat if the max requested width exceeds this buffer size, we	*/
  /*	    fail safe by leaving that column left justified		*/
  /*	4)  Each buffer needs to be at least DEFAULT_FIELD_WIDTH in	*/
  /*	    size.  They are.						*/
  /*	5)  The value buffer needs to be big enough to hold		*/
  /*	    MISSING_VAL_NUMERIC.  It is					*/
  /*	6)  DEFAULT_MAXOLEN is size of output line if dynamic sizing	*/
  /*	    disabled and size of increment by which to increase buffer	*/
  /*	    if dynamic sizing IS enabled.  It must also be big enough	*/
  /*	    to hold the object spec.					*/
#define DEFAULT_MAXOLEN 4096
#define OLEN_SANITY_LIMIT 10000000
#define MAXVALBUFSIZE DATUMSIZE + 1
  /* + 2 in next line is for the []s we add to bracket the attrib list	*/
#define MAXNAMEBUFSIZE VARNAMESIZE + TOTATTRSIZE + 2 + 1
#if MAXVALBUFSIZE > MAXNAMEBUFSIZE
#define BUFSIZE MAXVALBUFSIZE
#else
#define BUFSIZE MAXNAMEBUFSIZE
#endif

#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE !FALSE
#endif
#define FLAG_UNDEFINED -1
#if TRUE == FALSE || TRUE == FLAG_UNDEFINED || FALSE == FLAG_UNDEFINED
#error "Incompatible values for TRUE/FALSE/UNDEFINED"
#endif

#define DEFAULT_FFLAG 0
#define DEFAULT_RFLAG 0
#if DEFAULT_FFLAG != 0 && DEFAULT_RFLAG != 0
#error "Incompatible flag defaults"
#endif

#define DEFAULT_OSEP ','
