/*

mjackets.h

$Revision: 1.5 $
$Modtime:   12 Apr 1996 10:35:40  $
Modifications:  CJB 21-Jun-04 - DR #503401 - Intrinsic m_send_msgl is
  		missing an arguement (using C) - added mode parameter
		to m_send_msgl function

Header file for Midas C/FORTRAN jackets.

*/

#ifndef _mjackets_h

#include <stdlib.h>
#include <string.h>
#include "mtypes.h"
#include "fcinterface.h"
#include "headers.h"
//#include "semlib.h"
//#include "shmlib.h"
#include "type5000.h"
#include "packetdef.h"

/* Macros */

#if _VMS

#include <descrip.h>

typedef struct dsc$descriptor VAXstring;
/* V is a VAXstring descriptor
   S is a C character pointer
   L is the length of the string.  For input strings this will be its
     valid length; for output strings, maximum allowable storage.
*/
#define	MAKEVAXSTRING(V, S, L) ((V).dsc$w_length = (L),\
				(V).dsc$b_dtype  = DSC$K_DTYPE_T,\
				(V).dsc$b_class  = DSC$K_CLASS_S,\
				(V).dsc$a_pointer = (S))
#endif


/* Function Prototypes */

/* CMDLINE */

#if !_FDS
int_4  m_ppick(const int_4 n);
char  *m_upick(const int_4 n);
char  *m_apick(const int_4 n);
int_4  m_uapick(const int_4 n, char *aval, int_4 flags, int_4 la);
real_8 m_dpick(const int_4 n);
real_4 m_fpick(const int_4 n);
int_4  m_lpick(const int_4 n);
int_2  m_ipick(const int_4 n);
int_1  m_bpick(const int_4 n);
char   m__pick(const int_4 n ,char *aval, real_8 *dval, int_4 la);
int_u4 m_spick(const int_4 n);
int_4  m_tpick(const int_4 n, real_8 *time1, real_8 *time2);
complex_16 m_cpick(const int_4 n);
int_4  m_qpick(char *ostr, int_4 los);
int_4  m_pick(const int_4 n, void *buf, const int_4 buflen, const int_4 mode,
              char *type);
int_4  m_get_switch(const char *str);
int_4  m_get_pswitch(const char *str);
int_4  m_get_uswitch(const char *str,char *ostr, int_4 los);
int_u4 m_get_sswitch(const char *str);
real_8 m_get_dswitch(const char *str);
int_4  m_get_switch_def(const char *str, int_4 def);
int_u4 m_get_sswitch_def(const char *str, int_4 def);
real_8 m_get_dswitch_def(const char *str, real_8 def);
#endif

/* COMMOLINK functions */

int_4  m_lock(int_4 lockid, int_4 mode, int_4 wait);
void   m_pause(const real_4 time);
#if !_FDS
void   m_map_buffer(int_4 secflag);
void   m_map_section(int_4 section, int_4 flag);
void   m_checkin(void); /* in xmlibc.c */
void   m_sync(void);
void   m_return(void);
int_4  m_import(const char *symbol, char *content, int_4 slen, int_4 clen);
void   m_beep(int_4 n, real_4 delay);
int_4  m_delete(const char *file_spec);
void   m_directory(const char *path, const char *filename, const char *ext);
int_4  m_file(const char *operation, int_4 unit, const char *name);
int_4  m_form_path(int_4 iaux, const char *id, char *string, int_4 ls);
int_4  m_get_default(char *string, int_4 ls);
int_4  m_get_input(const char *prompt, char *string, int_4 *length, int_4 ls);
int_4  m_ldirectory(const char *path, const char *fname, const char *,
                    char *fullname, int_4 *i, int_4 *j, int_4 *k, int_4 lf);
int_4  m_remote_name(const char *namein, char *nameout, int_4 engine,
                     int_4 *blksize,int_4 ln);
int_4  m_rename(const char *filespec1, const char *filespec2);
int_4  m_spawn(int_4 flag);
#endif

/* CONTROLS finctions */

#if !_FDS
bool_4 m_do(int_4 lper, int_4 *ldo);
void   m_todo(real_8 size);
void   m_didnt(int_4 ldidnt);
int_4  m_mwinit(const char *name, int_4 init, const char *str);
int_4  m_lwinit(const char *name, int_4 vdef, int_4 vmin, int_4 vmax,
                int_4 vinc);
int_4  m_fwinit(const char *name, real_4 vdef, real_4 vmin, real_4 vmax,
                real_4 vinc);
int_4  m_dwinit(const char *name, real_8 vdef, real_8 vmin, real_8 vmax,
                real_8 vinc);
int_4  m_mwget(const int_4 id, int_4 *val);
int_4  m_lwget(const int_4 id, int_4 *val);
int_4  m_fwget(const int_4 id, real_4 *val);
int_4  m_dwget(const int_4 id, real_8 *val);
void   m_mwput(const int_4 id, const int_4 val);
void   m_lwput(const int_4 id, const int_4 val);
void   m_fwput(const int_4 id, const real_4 val);
void   m_dwput(const int_4 id, const real_8 val);
void   m_dwputu(const int_4 id, const real_8 val);
int_4  m_wgetid(const int_4 id);
#endif

/* CONVERT functions */

void  m_convert(const char *machine, void *buffer, const char *type, int_4 n);
void  m_convert_to(const char *machine, void *buffer, const char *type,
                   int_4 n);

/* EASYIO functions */

#if !_FDS
void   m_init(HEADER *hcb, const char *name, const char *types,
              const char *formats, int_4 *modifiers);
void   m_open(HEADER *hcb, int_4 funcmask);
void   m_close(HEADER *hcb);
void   m_grab(HEADER *hcb, void *bbuf, real_8 start, int_4 nget, int_4 *ngot);
void   m_grabx(HEADER *hcb, void *bbuf, int_4 *ngot);
void   m_shove(HEADER *hcb, void *bbuf, real_8 start, int_4 ntoput,
               int_4 *nput);
void   m_filad(HEADER *hcb, void *bbuf, int_4 nput);
void   m_inok(HEADER *hcb);
void   m_inokw(HEADER *hcb);
void   m_existence(HEADER *hcb,int_4 dir);
void   m_allocate(HEADER *hcb);
void   m_initialize(HEADER *hcb);
void   m_propagate(const HEADER *hcb1, HEADER *hcb2);
void   m_hcbfunc(HEADER *hcb, int_4 func, int_4 *args);
void   m_force1000(HEADER *hcb);
void   m_force2000(HEADER *hcb, int_4 frame);
int_4  m_xfer_length(int_4 bpe, int_4 lbbuf);
void   m_update_header(HEADER *hcb);
int_4  m_get_qualifier(HEADER *hcb, const char *qualifier);
int_4  m_get_uqualifier(HEADER *hcb, const char *qualifier, char *string,
                        int_4 ls);
void   m_seek(HEADER *hcb, real_8 *rseek);
#endif

/* HARDIO functions */

#if !_FDS
void  m_fclose(HEADER *hcb);
void  m_fcreate(HEADER *hcb);
void  m_fopen(HEADER *hcb);
void  m_fread(HEADER *hcb, void *bbuf, real_8 offset, int_4 nget, int_4 *ngot);
void  m_fwrite(HEADER *hcb, void *bbuf, real_8 offset, int_4 nget, int_4 *ngot);
#endif

/* HWLIB */

#if !_FDS
void  m_hw_getinfo(char *name, char *type, char *port, char *trans,
                   int_4 L1, int_4 L2, int_4 L3, int_4 L4);
void  m_hw_menu(const char *name);
int_4 m_hwf_alias(HEADER *hcb, const char *key, char *string, int_4 ls);
int_4 m_hwf_close(HEADER *hcb);
int_4 m_hwf_command(HEADER *hcb, const char *key, char *string, int_4 ls);
int_4 m_hwf_open(HEADER *hcb);
#endif

/* KEYWORD functions */

#if !_FDS
int_4  m_put_keyword(HEADER *hcb, const char *key, const char *key_string);
int_4  m_get_keyword(HEADER *hcb, const char *key, char *key_string,
                     int_4 klen, int_4 slen);
int_4  m_del_keyword(HEADER *hcb, const char *key);
int_4  m_repl_keyword(HEADER *hcb, const char *key, const char *keystring);
int_4  m_scope_keyword(HEADER *hcb, const char *tags, int_4 tlen);
int_4  m_scope_keyword_quiet(HEADER *hcb, const char *tags, int_4 tlen);
int_4  m_del_keydata(HEADER *hcb, const char *key, int_4 mode);
int_4  m_find_keydata(HEADER *hcb, char *key, void *buf, int_4 *mbuf,
                      int_4 mode, char *type, int_4 lk);
int_4  m_get_keydata(HEADER *hcb, char *key, void *buf, int_4 mbuf,
                     int_4 mode, char *type, int_4 lk);
int_4  m_put_keydata(HEADER *hcb, char *key, void *buf, int_4 mbuf,
                     int_4 mode, char *type, int_4 lk);
#endif

/* MATH functions */

#if _UNIX
#define m$calc                  m$calc_
#define m$deq                   m$deq_
#define m$deqt                  m$deqt_
#define m$power2ge              m$power2ge_
#define m$power2le              m$power2le_
#define m$reformat              m$reformat_
#define m$retype                m$retype_
#define m$recast                m$recast_
#define m$bitshift              m$bitshift_
#define m$window                m$window_
#define m$window_id             m$window_id_
#define m$window_by_id          m$window_by_id_
#define m$rfft                  m$rfft_
#define m$cfft                  m$cfft_
#define m$fftsize               m$fftsize_
#define m$fftsize_best          m$fftsize_best_
#define m$interp                m$interp_
#define m$interpd               m$interpd_
#define m$finterp               m$finterp_
#define m$finterpd              m$finterpd_
#endif

int_4 m_calc(const char *string, real_8 *buf, int_4 nbuf, const char *type,
             int_4 mode);
int_4 m_deq(const real_8 d1, const real_8 d2);
int_4 m_deqt(const real_8 d1, const real_8 d2, const real_4 tol);
int_4 m_power2ge(const int_4 n);
int_4 m_power2le(const int_4 n);
void  m_reformat(void *bufin, const char *formin, void *bufout,
                 const char *typeout, int_4 count);
void  m_retype(void *bufin, int_4 typein, void *bufout, int_4 typeout,
               int_4 count);
int_4 m_recast(void *bufin, const char *typein, int_4 lenin, void *bufout,
               char *typeout, int_4 lenout);
void  m_bitshift(void *buf, int_4 nbits, int_4 nbs, int_1 insert);
int_4 m_window(real_4 *buf, const char *name, int_4 npts);
int_4 m_window_id(const char *name);
void  m_window_by_id(real_4 *buf, int_4 id, int_4 npts);
void  m_rfft(real_4 *buf, int_4 npts, int_4 flag);
void  m_cfft(complex_8 *buf, int_4 npts, int_4 flag);
int_4 m_fftsize(int_4 nfft, int_4 rcflag, int_4 dir);
int_4 m_fftsize_best(int_4 nfft, int_4 rcflag, int_4 dir);
void  m_interp(int_4 nin, real_8 tstri, real_8 tdeli, real_4 *tvin,
               int_4 nout, real_8 tstro, real_8 tdelo, real_4 *tvout,
               int_4 ncomp, int_4 norder, int_4 *nerr);
void  m_interpd(int_4 nin, real_8 tstri, real_8 tdeli, real_8 *tvin,
                int_4 nout, real_8 tstro, real_8 tdelo, real_8 *tvout,
                int_4 ncomp, int_4 norder, int_4 *nerr);
void  m_finterp(HEADER *hcb, int_4 nout, real_8 tstro, real_8 tdelo,
                real_4 *tvout, int_4 ncomp, int_4 norder, int_4 *nerr);
void  m_finterpd(HEADER *hcb, int_4 nout, real_8 tstro, real_8 tdelo,
                 real_8 *tvout, int_4 ncomp, int_4 norder, int_4 *nerr);


/* MEMORY functions */

#if !_FDS
void  m_stmalloc(int_4 nbytes, int_4 *location);
void  m_stmfree(int_4 nbytes, int_4 location);
#endif

/* MESSAGES functions */

void  m_expand_htype(const char *types, int_4 *index, int_4 length,
                     int_4 *nelem, char *type, int_4 *bpe);
int_4 m_get_msg(void *mqh, void *buf, int_4 nbuf, real_4 wait, int_u4 mask);
int_4 m_get_msgl(char *name, int_4 *sid, int_4 *rid, int_4 *info,
                 int_4 *ndata, char *types, void *buf, const int_4 nbuf,
                 const real_4 wait, const int_4 mask, int_4 ln, int_4 lt);
void  m_init_msg(int_4 mode);
void  m_send_msg(void *mqh, void *buf, int_4 reader, int_u4 flag);
void  m_send_msge(void *mqh, void *buf, int_4 reader, int_u4 flag,
                  int_4 intrys, real_4 ifwait, int_4 ieflags);
/* DR #503401 */
void  m_send_msgl(const char *name, const int_4 sid, const int_4 rid,
                  const int_4 info, const int_4 mode, const int_4 ndata,
                  const char *types, const void *buf, const int_4 mask);
/* DR #503401 */

/* PACKETIO functions */

#if !_FDS

void m_prep_pkt(HEADER *hcb, const PKS *pkh, PKDSTRUCT *pkds, const int_4 ovcat,
                const int_4 ovlen);
void m_get_pkt(HEADER *hcb, PKDSTRUCT *pkds);
void m_send_pkt(HEADER *hcb, PKS *pks, PKDSTRUCT *pkds, const int_4 ovcat,
                const int_4 ovlen);
void m_pkt_show_reg(HEADER *hcb);
void m_disp_pkt_map(void);
void m_pkt_init(HEADER *hcb);
void m_pkt_propagate(HEADER *hin, HEADER *hout);
void m_pkt_file_reg(HEADER *hcb);
void m_pkt_map_resolve(void);
void m_pkt_map_search(const char *fname, int_4 *addr, int_4 *status);
void m_pkt_register(HEADER *hcb);
void m_pkt_hdrmod(HEADER *hcb);
void m_chk_pkt_type(HEADER *hcb, const int_4 flag);
void m_prop_except(HEADER *hcb);
void m_brdg_except(HEADER *hcb);
void m_pkt_except(const char *string, char *xcmp, int_4 *xv1, int_4 *xv2,
                  int_4 lxcmp);
void m_chk_pkt_flags(HEADER *hcb, const char *aflag, int_4 *inv_act);
void m_hm_flag(HEADER *hcb);
void m_convert_pkt_rep(HEADER *hcb, const char *cvrep);
#endif

/* PIPEIO functions */

#if !_FDS

int_4  m_pheadloc(int_4 np);
void   m_pindices(const HEADER *hcb, real_8 *psize, real_8 *pread,
                  real_8 *pwrite);
#endif

/* RESULTS functions */

#if !_FDS
void   m_arslt(const char *name, char *aval, int_4 nlen, int_4 alen);
void   m_drslt(const char *name, real_8 dval, int_4 nlen);
void   m_frslt(const char *name, real_4 fval, int_4 nlen);
void   m_lrslt(const char *name, int_4 lval, int_4 nlen);
void   m_irslt(const char *name, int_2 ival, int_4 nlen);
void   m_brslt(const char *name, int_1 bval, int_4 nlen);
void   m_trslt(const char *name, real_8 time1, real_8 time2, int_4 nlen);
int_4  m_get_result(const char *label, void *buf, int_4 buflen, int_4 modemask,
                    char *type, int_4 *attrmask);
int_4  m_put_result(const char *label, void *buf, int_4 buflen, int_4 modemask,
                    const char *type, int_4 attrmask);
int_4  m_del_result(const char *filter, int_u1 attrmask);
char   m_rdisp(const char *name, const int_4 mask);
int_4  m_rattr_mask2str(const int_4 attrmask, char *attrstr, int_4 ls);
int_4  m_rattr_str2mask(const char *attrstr, int_4 *mask);
char   m_rfind(const char *label, char *aval, real_8 *dval,int_4 llen,
               int_4 alen);
int_4  m_rgood(const char *label, char *type,int_4 *iname, int_4 *jname);
int_4  m_str2result(const char *label, const char *value_str, int_4 attrmask);
void   m_rcast(const char *type, const char *name, real_8 value);
#endif

/* SHELL */

#if !_FDS
void   m_load_bitmasks(HEADER *hcb, const char *cmdopt, int_4 lcmdopt);
void   m_verify(void);
#endif

/* TYPE 4000 functions */

int_4  m_vrbclr(VRB *vrb,int_4 mode);
int_4  m_vrbcpy(VRB *vrb1, VRB *vrb2, int_4 mode);
int_4  m_vrbdel(VRB *vrb, char *key,int_4, int_4 lk);
int_4  m_vrbfind(VRB *vrb, char *key, int_4 lkey, void *lbuf, int_4 mbuf,
                 int_4 mode, char *type);
int_4  m_vrbfree(VRB *vrb,int_4 mode);
#if !_FDS
int_4  m_vrbfunc(HEADER *hcb, VRB *vrb, int_4 nrec, real_8 offset, int_4 func);
#endif
int_4  m_vrbget(VRB *hcb, char *key, int_4 lkey, void *data, int_4 bytes,
                int_4 mode, char *type);
int_4  m_vrbhdr_pack(KEYSTRUCT *kh, int_4 lkey, int_4 ltag, int_4 ldata,
                     char *type);
int_4  m_vrbhdr_unpack(KEYSTRUCT *kh, int_4 lkey, int_4 ltag, int_4 ldata,
                       char *type);
int_4  m_vrbinit(VRB *vrb, int_4 mode, int_4 lrec);
int_4  m_vrbput(VRB *hcb, char *key, int_4 lkey, void *data, int_4 bytes,
                int_4 mode, char *type);

/* TYPE 5000 functions */

void  m_addcomp(HEADER *hcb, const char *name, const char *format,
                const int_4 type, const int_4 units);
void  m_addsrec(HEADER *hcb, const char *name, const char *format);
void  m_addsubr(HEADER *hcb, const char *name, const char *format);
#if !_FDS
void  m_addt6srec(HEADER *hcb, const char *name, const char *format,
                  const real_8 minval, const real_8 maxval, const int_4 nel,
                  const int_4 units, const int_4 uprefix);
void  m_addt6subr(HEADER *hcb, const char *name, const char *format,
                  const real_8 minval, const real_8 maxval, const int_4 nel,
                  const int_4 units, const int_4 uprefix);
#endif
void  m_car_to_geo(real_8 *v, const int_4 mode, const int_4 nrec);
void  m_car_to_sph(real_8 *v, const int_4 mode, const int_4 nrec);
void  m_conversion_factor(const int_4 units1, const int_4 units2,
                          real_8 *factor);
void  m_convert_units(const int_4 units1, const int_4 type, int_4 *units2);
void  m_crf_to_crf(real_8 *v, const int_4 mode, const int_4 nrec,
                   const real_8 a, const real_8 b);
void  m_crf_to_ecr(real_8 *v, const int_4 mode, const int_4 nrec,
                   const real_8 a);
void  m_dvadd(real_8 *a, const int_4 isk, const real_8 add, const int_4 nrec);
void  m_dvscale(real_8 *a, const int_4 isk, const real_8 add, const int_4 nrec);
void  m_eci_to_ecr(real_8 *v, const int_4 mode, const int_4 nrec, real_8 *gha);
void  m_ecr_to_crf(real_8 *v, const int_4 mode, const int_4 nrec,
                   const real_8 a);
void  m_ecr_to_eci(real_8 *v, const int_4 mode, const int_4 nrec, real_8 *gha);
void  m_ecr_to_top(real_8 *v, const int_4 mode, const int_4 nrec,
                   const real_8 *a);
void  m_epoch_hour_angle(const real_8 time, real_8 *year, real_8 *second,
                         real_8 *rag);
void  m_geo_to_car(real_8 *v, const int_4 mode, const int_4 nrec);
void  m_grab5n(HEADER *hcb, void *buf, const real_8 start, const int_4 nget,
               int_4 *ngot, char *list);
void  m_grabt(HEADER *hcb, void *buf, const real_8 start, const int_4 nget,
              int_4 *ngot, HEADER *hcbt);
void  m_grabxt(HEADER *hcb, void *buf, int_4 *ngot, HEADER *hcbt);
void  m_matrix_cpy(const TRANSMATRIX *a, TRANSMATRIX *b);
void  m_matrix_dump(const TRANSMATRIX *a);
void  m_matrix_idn(TRANSMATRIX *a);
void  m_matrix_inv(const TRANSMATRIX *a, TRANSMATRIX *b);
void  m_matrix_mul(const TRANSMATRIX *a, const TRANSMATRIX *b, TRANSMATRIX *c);
void  m_matrix_mula(const real_8 *a, real_8 *b, const int_4 isk,
                    const int_4 nrec);
void  m_matrix_mulab(const real_8 *a, real_8 *b, const int_4 isk,
                     const int_4 nrec);
void  m_matrix_mulpva(const real_8 *a, real_8 *b, const int_4 isk,
                      const int_4 nrec);
void  m_matrix_rot(TRANSMATRIX *a, const real_8 angle, const int_4 type);
void  m_matrix_top2ecr(TRANSMATRIX *m, const real_8 *a);
void  m_matrix_trn(TRANSMATRIX *a);
void  m_sph_to_car(real_8 *v, const int_4 mode, const int_4 nrec);
int_4 m_sub_find(HEADER *hcb, const char *name);
int_4 m_sub_offset(HEADER *hcb, const int_4 index);
char *m_sub_format(HEADER *hcb, const int_4 index);
char *m_sub_name(HEADER *hcb, const int_4 index);
void  m_top_to_ecr(real_8 *v, const int_4 mode, const int_4 nrec,
                   const real_8 *a);
void  m_top_to_top(real_8 *v, const int_4 mode, const int_4 nrec,
                   const real_8 *a, const real_8 *b);
void  m_transfer(HEADER *ha, void *a, HEADER *hb, void *b,
                 const int_4 nrec, const int_4 mode);
void  m_transform(HEADER *hcb, const char *list, const char *frame,
                  const char *coord, const char *units);
#if !_FDS
void  m_open_t6subrecords(HEADER *hcb);
void  m_update_t6subrecords(HEADER *hcb);
void  m_get_t6subrecord(HEADER *hcb, int_4 n, int_4 t6subr);
void  m_put_t6subrecord(HEADER *hcb, int_4 n, int_4 t6subr);
#endif

/* UTILITIES functions */

int_4  m_search(const char *string, const char *sub);
int_4  m_searchb(const char *string, const char *sub);
int_4  m_lengthq(const char *string, int_4 length);
int_4  m_parse(const char *string, int_4 ind, char *ostring, int_4 los);
int_4  m_trim_quotes(const char *sq, char *sr, int_4 lsr);
void   m_lowercase(char *string);
void   m_uppercase(char *string);
void   m_wordwrap(const char *str, int_4 start, int_4 margin, int_4 consume,
                  int_4 *wrap, int_4 *new);
void   m_wrapnextlines(int_4 lun, char *str);
int_4  m_chk(const void *m1, const void *m2, int_4 n);
int_4  m_d2a(real_8 dval, char *string, int_4 length);
int_4  m_d2a_form(real_8 dval, char *string, const char *form, int_4 length,
                  int_4 flength);
int_4  m_f2a(real_4 fval, char *string, int_4 length);
int_4  m_l2a(int_4 lval, char *string, int_4 length);
void   m_f2d(real_4 *fval, real_8 *dval);
void   m_d2f(real_8 *dval, real_4 *fval);
int_4  m_dms2deg(const char *dms_str, real_8 *deg, int_4 len);
int_4  m_deg2dm(real_8 deg, char *dm_str, int_4 len);
int_4  m_deg2dms(real_8 deg, char *dms_str, int_4 len);
#if !_FDS
int_4  m_a2d(const char *prompt, real_8 *dval, int_4 length);
int_4  m_logical(const char *expression,const int_4 mode);
#endif
int_4  m_spa(const char *format);
int_4  m_bps(const char *format);
int_4  m_bpa(const char *format);
int_4  m_bpe(HEADER *hcb);
#if !_FDS
void   m_msglog(const char *msg, int_4 severity);
void   m_message(const char *prefix, const char *string);
#endif
void   m_error(const char *s);
void   m_warning(const char *s);
void   m_info(const char *s);
void   m_advisory(const char *s);
void   m_inactive(const char *s);
void   m_syscon(const char *s);
void   m_emergency(const char *s);
int_4  m_type(const char *str);
int_4  m_npt(char *type);
#if !_FDS
void   m_index(HEADER *hcb, int_4 addressing, real_8 *start, real_8 *end);
void   m_align(HEADER *hcb1 ,HEADER *hcb2, int_4 addressing, real_8 *size,
               real_8 *start);
void   m_talign(HEADER *hcb1 ,HEADER *hcb2, real_8 *astart, real_8 *aoff,
                real_8 *size);
#endif
char  *m_units_name(const int_4 units);
char  *m_format_name(const char *format);
char  *m_comptype_name(const int_4 type);
char  *m_test_format(const char *form, const char *form_allow);
#if !_FDS
char  *m_promote_format(const char *form1, const char *form2, const char *form3);
char  *m_promote_type(const char *type1, const char *type2);
char  *m_promote_type3(const char *type1, const char *type2, const char *type3);
int_4  m_promote_format_override(const char *t1, const char *t2, const char *pfostr, char *type);
int_4  m_nextline(int_4 lun, char *str, int_4 verbose, int_4 ls);
int_4  m_nextline_source(int_4 lun, char *str, int_4 verbose, int_4 *srcln,
                         int_4 ls);
void   m_expand_iotypes(char *types, int_4 *ntypes, int_4 lt);
int_4  m_filenameopt(const char *area, const char *name, const char *ext,
                     char *fullname, const char *option, int lf);
int_4  m_filename(const char *area, const char *name, const char *ext,
                  char *fullname, int lf);
int_4  m_env(const char *key, void *buf, const int_4 elemsize, char *type,
             const int_4 mode);
int_4  m_dsengineid(const char *ceng);
void   m_get_epoch(HEADER *hcb, real_8 *sec, real_8 *frac);
void   m_put_epoch(HEADER *hcb, real_8 sec, real_8 frac, int_4 toQuads);
int_4  m_time_format(const char *str, const char *type, char *strout,
                     real_8 *time1, real_8 *time2, const int_4 warn, int_4 ln);
void   m_secnds(real_4 time, real_4 *elapsed);
void   m_now(real_8 *time1, real_8 *time2);
#endif
int_4  m_tod2sec(const char *tod_str, real_8 *time, int_4 tlen);
#if !_PFC
int_4  m_tod2times(const char *tod_str, real_8 *sec, real_8 *frac, int_4 tlen);
#endif
int_4  m_sec2tod(real_8 time, char *tod_str, int_4 tlen);
#if !_PFC
int_4  m_times2tod(real_8 sec, real_8 frac, char *tod_str, int_4 tlen);
#endif
int_4  m_times2str(const real_8 sec, const real_8 frac, char *type,
                   char *strout, int_4 ln);
void   m_ymd2mjd(int_4 ny, int_4 nm, int_4 nd, int_4 *mjd);
void   m_mjd2ymd(int_4 mjd, int_4 *ny, int_4 *nm, int_4 *nd);
void   m_mjd2ydy(int_4 mjd, int_4 *ny, int_4 *nd);
void   m_ydy2ymd(int_4 ny, int_4 ndoy, int_4 *nm, int_4 *nd);
int_4  m_sec2tspec(real_8 time, char *tspec_str, int_4 mode, int_4 tlen);
int_4  m_subs(const char *in_str, char *out_str, const char *string1,
              const char *string2, int_4 lout);
int_4  m_subsl(const char *in_str, const int_4 inls, char *out_str,
               const char *string1, const int_4 ls1, const char *string2,
	       const int_4 ls2, int_4 lout);
int_4  m_gsub(const char *in_str, char *out_str, const char *string1,
              const char *string2, int_4 lout);
int_4  m_gsubl(const char *in_str, const int_4 inls, char *out_str,
               const char *string1, const int_4 ls1,
               const char *string2, const int_4 ls2, int_4 lout);
int_4  m_trims(const char *in_str, char *out_str, const char *string1,
               const char *string2, int_4 lout);
int_4  m_strim(const char *in_str, char *out_str, int_4 lout);
int_4  m_word(const char *in_str, char *out_str, const int_4 n,
              const char *string, int_4 lout);
int_4  m_element(const char *in_str, char *out_str, const int_4 n,
                 const char *string, int_4 lout);
int_4  m_nelements(const char *in_str, const char *string);
int_4  m_nsearch(const char *in_str, const char *string, const int_4 n);
int_4  m_range(const char *in_str, char *out_str, const int_4 start,
               const int_4 finish, int_4 lout);
int_4  m_between(const char *in_str, char *out_str, const int_4 start,
                 const int_4 finish, int_4 lout);
int_4  m_nformat(const char *res_name, const char *format_str, char *out_str,
                 int_4 lout);
int_4  m_head(const char *in_str, char *out_str, int_4 lout);
int_4  m_tail(const char *in_str, char *out_str, int_4 lout);
int_4  m_root(const char *in_str, char *out_str, int_4 lout);
int_4  m_ext(const char *in_str, char *out_str, int_4 lout);
int_4  m_startswith(const char *string, const char *str1);
int_4  m_endswith(const char *string, const char *str1);

int_4  m_length(const char *string, int_4 length);
int_4  m_lengthd(const char *string, int_4 length);
int_4  m_clean(const char *string, char *cstring, int_4 ls, int_4 lcs);
void   m_move(const void *source, void *target, int_4 nbytes);

/* VECTOR functions */

void  m_vinit(void);
void  m_vstype(const char *type);
void  m_vtype(const char *type);
void  m_vtypeq(char *type);
void  m_stype(const char *type);
void  m_stypeq(char *type);
char  m_vpromote(const char *type1, const char *type2);
void  md_vstype(const int_4 type);
void  md_vtype(const int_4 type);
void  md_vtypeq(int_4 *type);
void  md_stype(const int_4 type);
void  md_stypeq(int_4 *type);
int_4 md_vpromote(const int_4 type1, const int_4 type2);
void  m_vmov(void *va, const int_4 ka, void *vb, const int_4 kb,
             const int_4 count);
void  m_cvmov(void *va, const int_4 ka, void *vb, const int_4 kb,
              const int_4 count);
void  m_vmovn(void *va, const int_4 ka, void *vb, const int_4 kb,
              const int_4 count, const int_4 block);
void  m_vmovnb(void *va, const int_4 ka, void *vb, const int_4 kb,
               const int_4 count, const int_4 block);
void  m_vfill(void *va, void *sb, const int_4 count);
void  m_vadd(void *va, void *vb, void *vc, const int_4);
void  m_vsub(void *va, void *vb, void *vc, const int_4);
void  m_vmul(void *va, void *vb, void *vc, const int_4);
void  m_cvmul(void *va, void *vb, void *vc, const int_4, const int_4 flag);
void  m_crvmul(void *va, void *vb, void *vc, const int_4);
void  m_vsadd(void *va, void *sb, void *vc, const int_4 count);
void  m_cvsadd(void *va, void *sb, void *vc, const int_4 count);
void  m_vsmul(void *va, void *sb, void *vc, const int_4 count);
void  m_cvsmul(void *va, void *sb, void *vc, const int_4 count);
void  m_vsum(void *va, void *sb, const int_4 count);
void  m_cvsum(void *va, void *sb, const int_4 count);
void  m_vsums(void *va, void *sb, void *sc, const int_4 count);
void  m_cvsums(void *va, void *sb, void *sc, const int_4 count);
void  m_vblk(void *va, void *vb, const int_4 count, const int_4 block);
void  m_cvblk(void *va, void *vb, const int_4 count, const int_4 block);
void  m_cvpha(void *va, void *vb, const int_4 count);
void  m_cvphad(void *va, void *vb, const int_4 count);
void  m_cvrphad(void *va, void *vb, const int_4 count, const int_4 bins);
void  m_cvmag(void *va, void *vb, const int_4 count);
void  m_cvmag2(void *va, void *vb, const int_4 count);
void  m_cvconj(void *va, void *vb, const int_4 count);
void  m_vlog10(void *va, void *lo_thresh, void *vb, const int_4 count);
void  m_vnorm(void *va, void *vb, const int_4 count);
void  m_cvnorm(void *va, void *vb, const int_4 count);
void  m_vrand(int_4 *seed, void *va, const int_4 count);
void  m_vmxmn(void *va, void *sb, void *sc, int_4 *imax, int_4 *imin,
              const int_4 count);

/* Why is this here? No one should call this routine but the library */

#if _VMS
#if !_FDS
void   m_checkin_shell(void);
#endif
#endif

#define _mjackets_h
#endif
