1 /****************************************************************************/
3 /* Chaine de CAO & VLSI AVERTEC */
5 /* Produit : AVERTEC global tools */
6 /* Fichier : mbk_fileextract.h */
8 /* © copyright 2000 AVERTEC */
9 /* Tous droits reserves */
11 /* Auteur(s) : Antony PINTO */
13 /****************************************************************************/
15 #ifndef MBK_FILEEXTRACT_H
16 #define MBK_FILEEXTRACT_H
26 typedef struct label_list
33 typedef struct extract_rules
35 struct extract_rules
*NEXT
; /* next rule(s) */
36 char *BEGIN
; /* mark begin for rule recognition */
37 char *END
; /* mark end for rule recognition */
38 int TYPE
; /* recognition type : line or array */
39 char **TOKEN
; /* list of token to be recognised */
40 int NBTOKEN
; /* number of token */
41 int ACTIVATED
; /* rule activated or not */
42 int LINE
; /* line # in case of table recognition */
43 label_list
*LBLLIST
; /* list of label recognised */
44 int NBELT
; /* nb token found in a line for a table */
45 int NBELT1ST
; /* nb token found in the 1st line for a */
50 typedef struct label_table
52 struct label_table
*NEXT
;
62 int FLAG
; /* is label found */
66 typedef struct label_ref
73 #define RULE_UNACTIVATED ((int) 0)
74 #define RULE_ACTIVATED ((int) 1)
76 #define RULE_TYPE_LINE ((int) 4)
77 #define RULE_TYPE_TABLE ((int) 5)
79 #define MFE_CHAR_IN_LINE ((int) 3000)
80 #define MFE_LINE_SIZE (sizeof(char)*MFE_CHAR_IN_LINE)
82 #define LABL_FOUND ((int) 0)
83 #define LABL_NOTFOUND ((int) 1)
86 #define RULE_TYPE_ERR ((int) 6) /* rule type */
87 #define RULE_BEGE_ERR ((int) 7) /* begin an end mark */
88 #define RULE_RULE_ERR ((int) 8) /* token */
89 #define RULE_TOOT_ERR ((int) 9) /* too much token */
90 #define RULE_UTOK_ERR ((int) 10) /* unknown token */
91 #define RULE_MATC_ERR ((int) 11) /* match error */
92 #define RULE_FTOK_ERR ((int) 12) /* miss token err */
93 #define LABL_UTBL_ERR ((int) 31) /* unknown table */
94 #define LABL_ULBL_ERR ((int) 32) /* unknown label */
95 #define LABL_LEXI_WAR ((int) 33) /* existant label */
96 #define LABL_PLBL_ERR ((int) 34) /* label probleme */
97 #define MFE_LONGLINE_ERR ((int) 55)
99 int mfe_addrule(extract_rules
**ruleslist
, char *rule
);
100 int mfe_delrule(extract_rules
**ruleslist
, extract_rules
*rule
);
101 void mfe_freerules(extract_rules
**ruleslist
);
102 void mfe_duprules(extract_rules
**ruleslist
, extract_rules
*rule
);
103 /* be carefull label must be nameallocated */
104 int mfe_addlabel(label_ref
**table
, char *label
, int nbmc
);
105 int mfe_dellabel(label_ref
**table
, char *label
);
106 void mfe_freelabels(label_ref
**table
, int cleanmc
);
107 void mfe_duplabels(label_ref
**newr
, label_ref
*ref
);
109 int mfe_fileextractlabel(char *filename
, extract_rules
*rules
, label_ref
*ref
, int nbmc
);
111 int mfe_labelvalue(label_ref
*ref
, char *label
, double *value
, int nbmc
);
112 void mfe_cleanLabel(label_ref
*ref
);