adif.h
Go to the documentation of this file.
/***************************************************************************
adif.h - description
-------------------
begin : Wed May 15 2002
copyright : (C) 2002 by ARRL
email : MSimcik@localhost.localdomain
revision : $Id$
***************************************************************************/
#ifndef __ADIF_H
#define __ADIF_H
#include "tqsllib.h"
#include <stdio.h>
#include <stdlib.h>
#define TQSL_ADIF_FIELD_NAME_LENGTH_MAX 64
#define TQSL_ADIF_FIELD_SIZE_LENGTH_MAX 10
#define TQSL_ADIF_FIELD_TYPE_LENGTH_MAX 1
#ifndef TQSL_ADIF_BOOLEAN
typedef enum {
TQSL_FALSE,
TQSL_TRUE
} TQSL_ADIF_BOOLEAN;
#endif
typedef void * tQSL_ADIF;
typedef enum {
TQSL_ADIF_RANGE_TYPE_NONE,
TQSL_ADIF_RANGE_TYPE_MINMAX,
TQSL_ADIF_RANGE_TYPE_ENUMERATION
} TQSL_ADIF_RANGE_TYPE;
typedef enum {
TQSL_ADIF_GET_FIELD_SUCCESS,
TQSL_ADIF_GET_FIELD_NO_NAME_MATCH,
TQSL_ADIF_GET_FIELD_NO_TYPE_MATCH,
TQSL_ADIF_GET_FIELD_NO_RANGE_MATCH,
TQSL_ADIF_GET_FIELD_NO_ENUMERATION_MATCH,
TQSL_ADIF_GET_FIELD_NO_RESULT_ALLOCATION,
TQSL_ADIF_GET_FIELD_NAME_LENGTH_OVERFLOW,
TQSL_ADIF_GET_FIELD_DATA_LENGTH_OVERFLOW,
TQSL_ADIF_GET_FIELD_SIZE_OVERFLOW,
TQSL_ADIF_GET_FIELD_TYPE_OVERFLOW,
TQSL_ADIF_GET_FIELD_ERRONEOUS_STATE,
TQSL_ADIF_GET_FIELD_EOF
} TQSL_ADIF_GET_FIELD_ERROR;
typedef struct {
char name[TQSL_ADIF_FIELD_NAME_LENGTH_MAX + 1];
char type[TQSL_ADIF_FIELD_TYPE_LENGTH_MAX + 1];
TQSL_ADIF_RANGE_TYPE rangeType;
unsigned int max_length;
long signed min_value;
long signed max_value;
const char **enumStrings;
void *userPointer;
} tqsl_adifFieldDefinitions;
typedef struct {
char name[TQSL_ADIF_FIELD_NAME_LENGTH_MAX + 1];
char size[TQSL_ADIF_FIELD_SIZE_LENGTH_MAX + 1];
char type[TQSL_ADIF_FIELD_TYPE_LENGTH_MAX + 1];
unsigned char *data;
unsigned int adifNameIndex;
void *userPointer;
} tqsl_adifFieldResults;
/* function prototypes */
#ifdef __cplusplus
extern "C" {
#endif
DLLEXPORT const char* CALLCONVENTION tqsl_adifGetError(TQSL_ADIF_GET_FIELD_ERROR status);
DLLEXPORT int CALLCONVENTION tqsl_beginADIF(tQSL_ADIF *adifp, const char *filename);
DLLEXPORT int CALLCONVENTION tqsl_getADIFField(tQSL_ADIF adif, tqsl_adifFieldResults *field, TQSL_ADIF_GET_FIELD_ERROR *status,
const tqsl_adifFieldDefinitions *adifFields, const char * const *typesDefined,
unsigned char *(*allocator)(size_t) );
DLLEXPORT int CALLCONVENTION tqsl_getADIFLine(tQSL_ADIF adif, int *lineno);
DLLEXPORT int CALLCONVENTION tqsl_endADIF(tQSL_ADIF *adifp);
DLLEXPORT int CALLCONVENTION tqsl_adifMakeField(const char *fieldname, char type, const unsigned char *value, int len,
unsigned char *buf, int buflen);
#ifdef __cplusplus
}
#endif
#endif /* __ADIF_H */