]> www.wagner.pp.ru Git - oss/fgis.git/blob - epu/outtable.h
First checked in version
[oss/fgis.git] / epu / outtable.h
1 #ifndef OUTTABLE_H
2 #define OUTTABLE_H
3 #include <epp.h>
4
5 #define MAX_OUTTABLE_FILES 32
6 /* This structure is used to keep information about 
7    combination of classes. count is count of cells already found,
8    classes are classes. Really each of these structures occupies
9    less then sizeof(struct record) bytes, becouse count of files is
10    usially less than 32 */ 
11 struct record {
12                long int count;
13                unsigned short int classes[MAX_OUTTABLE_FILES];
14               };
15 /* data which outtable functions need to keep between calls */
16 typedef void* FuncData;
17
18 /* Action which function should take */
19 typedef enum {
20     FuncInit, /* Initialize FuncData */
21     FuncIterate,/* Collect data from given record, return non-zero on failure */
22     FuncResult /* Return computed value */
23 } FuncAction;
24
25 /* Type for all data processing functions */
26 typedef double (*OuttableFunc)(FuncAction action,/* what to do */
27           FuncData data, /* pointer to persistent data */
28          struct record *record, /*record to process */
29          int index); /* number of file in record to cope with */
30
31 /* Type for record in functuon-table */
32
33 struct FuncInfo {
34       char name[16]; /* how function is named in command-line */
35       OuttableFunc func; /* actual function to perform operation */
36       int nargs; /* number of file arguments */
37       int datasize; /* How many bytes to allocate for FuncData */
38 };
39
40 struct FuncItem {
41        OuttableFunc func;
42        FuncData data;
43        int index;
44       };
45
46 struct FileInfo {
47        char *name;
48        EPP *epp;
49      };
50
51 extern struct FileInfo openFiles[MAX_OUTTABLE_FILES];
52 extern struct FuncInfo funcTable[];
53 extern EPP* fileinfo[MAX_OUTTABLE_FILES];
54 extern struct FuncItem funcList[MAX_OUTTABLE_FILES];
55 extern double cellArea, zUnit, zOffset;
56 #endif