#ifndef _PROTO_H
#define _PROTO_H

#include "header.h"

LABEL *LoadLabel(char *);
DATASET * LoadDataset(DATASET *dataset, char *fname);
FIELD *FindField(char *name, LIST * labels);
FIELD *FindFieldInLabel(char *name, LABEL * l);
FRAGMENT *LoadFragment(char *fname, TABLE *table);

DATA ConvertASCIItoData(char *ascii, int i);
DATA ConvertField(char *ptr, FIELD *f);
LIST *LoadFilenames(char *path, char *prefix);

DATA ConvertData(PTR ptr, FIELD *f);
DATA ConvertFieldData(PTR ptr, FIELD *f);
DATA ConvertVarData(PTR ptr, VARDATA *v);
int EquivalentData(DATA d1, DATA d2, FIELD *f);
int CompareData(DATA d1, DATA d2, FIELD *f);

/* TBLBUFF *NewTblBuff(TABLE * t, size_t reccount, size_t overcount); */
PTR GetFirstRec(TABLE * t);
PTR find_jump(TABLE * t, FIELD * f, DATA d, PTR beg, PTR end);
PTR find_until(TABLE * t, FIELD * f, PTR beg, PTR end);
PTR find_select(TABLE * t, PTR beg, PTR end);

int sequence_keys(SEQ * keyseq, TABLE ** tables, int num_tables);
SLICE ** init_slices(TABLE ** tables, int tcount, SEQ keyseq);

LIST * ConvertOutput(char *output_str, LIST *tables);
char * find_file(char *fname);
short ConvertVaxVarByteCount(PTR raw, VARDATA *vdata);

#endif /* _PROTO_H */