utils
|
00001 /* $Id$ */ 00002 #include <stdio.h> 00003 #define GRVERSION "24052006" 00004 #define COMP_DATE __DATE__ 00005 #define COMP_TIME __TIME__ 00006 #define MAX_PREFIX_COUNT 50 /*This specifies the maximum number of different prefixes. e.g. Ux Rx Qx...*/ 00007 #define PAGE_JMP 100 /*There will be R101 R102 on page 1, R201 R202 on page 2.*/ 00008 #define COUNT_START 0 /*Start the counting from this number+1*/ 00009 #define MAX_PREFIX_SIZE 10 /*Define max prefx length*/ 00010 #define BUFFSIZE 256 00011 #define FILENAMESIZE 100 00012 00013 /*Flag definitions*/ 00014 00015 /* flag bits 00016 * 00017 * bit function 00018 *----------------------- 00019 * 0 pkgskip 00020 * 1 gap detected 00021 * 2 not implemented 00022 * 3 not implemented 00023 * 4 not implemented 00024 * 5 not implemented 00025 * 6 not implemented 00026 * 7 not implemented 00027 */ 00028 00029 #define PAGEJUMP 0x01 00030 #define GAP_DETECTED 0x02 00031 00032 /*Return status of the main program*/ 00033 #define OK 0 00034 #define NO_INPUT_FILE 1 00035 #define FILE_OP_ERROR 2 00036 #define PARSE_ERROR 3 00037 #define OUT_OF_MEMORY 4 00038 00039 /*Return status of get_refdes_from_file()*/ 00040 #define END_OF_FILE 2 00041 #define NOT_REFDES_LINE 3 00042 00043 /*Return status of parse_refdes()*/ 00044 #define REFDES_WITH_VALUE 0 00045 #define REFDES_WITHOUT_VALUE 1 00046 #define REFDES_ERROR -1 00047 00048 /*Return status of refdes_lookup()*/ 00049 #define REFDES_NOT_FOUND -1 00050 00051 /*Return status of seek_value()*/ 00052 #define VALUE_FOUND 1 00053 #define VALUE_NOT_FOUND 0 00054 00055 struct refdes_ 00056 { 00057 char prefix[MAX_PREFIX_SIZE]; 00058 unsigned int value; 00059 int prefixes; 00060 }; 00061 00062 int main(int argc, char *argv[]); 00063 int get_refdes_from_file(FILE *fp,struct refdes_ *refdes, char *buff); 00064 int seek_value(int prefix, FILE *fp, unsigned int value, struct refdes_ *db); 00065 int parse_refdes(struct refdes_ *refdes, char *ref_str); 00066 int refdes_lookup(struct refdes_ *db, struct refdes_ *ref); 00067 void printhelp(void); 00068 void printver(void);