/*TITLE customer data base include file */

/****keyword-flag*** "%v %f %n" */
/* "5 16-May-92,8:06:18 CUSTDATA.H" */

/****revision-history****/
/*1 CUSTDATA.H 8-Apr-91,20:53:28 Include file for customer database.          */
/*2 CUSTDATA.H 10-Apr-91,10:39:34 Added long_value to the FieldValue          */
/*       union, to allow the year-to-date value to be represented exactly.    */
/*     Added new structure DiskCustomerRecord, to reduce the disk storage     */
/*       requirements by storing only the important information in each       */
/*       record.                                                              */
/*     Added prototypes for blank_trim & memory_record_to_disk.               */
/*3 CUSTDATA.H 10-Apr-91,16:40:22 Added "int" to field_type declaration.      */
/*     Added field_name array for editing.                                    */
/*4 CUSTDATA.H 11-Apr-91,12:20:26 Added prototype for disk_record_to_memory.  */
/*5 CUSTDATA.H 16-May-92,8:06:18 Added prototypes for                         */
/*       initialization and edit routines.                                    */
/****revision-history****/

#define FIELD_COUNT 9
#define BATCH_SIZE 100
#define ZIP_BLOCK_COUNT 150
#define ZIP_BLOCK_ENTRIES 100

#define MAX_ASCII_FIELD_LENGTH 15

#define LAST_NAME_LENGTH 15
#define FIRST_NAME_LENGTH 9
#define ADDRESS1_LENGTH 15
#define ADDRESS2_LENGTH 15
#define CITY_LENGTH 12
#define STATE_LENGTH 2
#define ZIP_LENGTH 9

#define ASCII_DATE_LENGTH 10
#define ASCII_CENTS_LENGTH 10

#define BINARY_DATE_LENGTH 2
#define BINARY_DOLLARS_LENGTH 2

enum fieldtype {TEXT,DATE,CENTS};
typedef enum fieldtype FieldType;

typedef union
{
	char *char_pointer;
	int	int_value;
	long long_value;
} FieldValue;

typedef struct
{
	FieldType field_type;
	char field_length;
	FieldValue field_value;
} FieldDefinition;

typedef struct
{
	FieldDefinition field[FIELD_COUNT];
} CustomerRecord;

typedef struct
{
	long disk_field[FIELD_COUNT];
} DiskCustomerRecord;

#define CUSTOMER_ARRAY_OBJECT_NUMBER 1

void blank_trim(char *string);

void memory_record_to_disk(DiskCustomerRecord *disk_customer, 
CustomerRecord *memory_customer);

void disk_record_to_memory(CustomerRecord *memory_customer,
DiskCustomerRecord *disk_customer);

extern int field_type[FIELD_COUNT];
extern char *field_name[FIELD_COUNT];

void initialize_quantum_file(void);

void edit_customer_records(void);


