Page 387 - Programming Microcontrollers in C
P. 387

372    Chapter 7  Advanced Topics

                        unsigned next;
                   }Entry;

                   #define ALEN                 30
                   #define NLEN                 16
                   #define DLEN                 35
                   #define EEPROMLEN            768
                   #define DATAPROM             EEPROMLEN-DLEN*sizeof( Entry)
                   #define END                  0xff


                   typedef struct {
                        Entry header[DLEN];
                        unsigned data[DATAPROM];
                   }Epro;


                   #define NEXT_OPEN epro->data[0]
                   #define START_OF_LIST epro->data[1]
                   #define LIST_ENTRIES epro->data[2]

                   void saveit(char *,char *,Epro *);
                   void printout(Epro *);
                   void printafter(Epro *);
                   void reset(Epro *);
                   int encode(char *,unsigned *,int);
                   int decode(unsigned *,char *);
                   void get(char *,int);
                   int numbdup(char * const, unsigned *, int);
                   void putbcd(char *,char *);
                   #ifndef DOS
                   void inituart(void);
                   void putchar(int);
                   int getchar(void);
                   void puts(char *);
                   #endif


                   #endif
                              Listing 7-11: Phone Book Header File
   382   383   384   385   386   387   388   389   390   391   392