#include "ioserv.h"  /* NAME_LIST_ENTRY_TYPE */

#ifndef cal_included
#define cal_included

#define sqr(x) ((x)*(x))       /* arrdep.c  timslip.c */
#define SECONDS_PER_DAY 86400L /* "            "       vrefabs.c  refabs.c */
#define MINUTES_PER_DAY 1440   /* "            "          "           "    */

#define   JUMP_UP    1    /* arrdep.c, timslip.c */
#define   JUMP_DOWN -1    /*    "          "     */
                                            
#define TURN_LEFT  2      /* timslip.c */
#define TURN_RIGHT -2

typedef struct            /* arrdep.c */
{
   double t, u, v;
} VELOCITY_TYPE;

#if 0
typedef struct            /* refabsbt.c, refabs.c */
{
   double u, v, t;
} VELOCITY_TYPE;

typedef struct            /* refabsbt.c, refabs.c */
{
   double x, y, t;
} FIX_TYPE;
#endif

typedef struct
{
   double t, x, y;
} FIX_TYPE;

/*---------------------------

    FUNCTIONS:

*/
#if PROTOTYPE_ALLOWED
#ifndef VREFABS  /* VREFABS has its own read_ref() */
/* -- read_ref.c -- */
int read_ref(FILE *fp_ref, VELOCITY_TYPE *ref);
#endif
/* -- fix2vel.c -- */
int fix_to_velocity(FIX_TYPE *fix0, FIX_TYPE *fix1, VELOCITY_TYPE *ship);
/* -- brent.c -- */
double brent(double ax, double bx, double cx, double (*func) (), double tol, double *xmin);

#else
#ifndef VREFABS  /* VREFABS has its own read_ref() */
int read_ref();
#endif
int fix_to_velocity();
double brent();

#endif

#endif /* ifndef cal_included */
