00001
00006 #ifndef _FIND_H
00007 #define _FIND_H
00008
00009 #include <stdarg.h>
00010 #include <stdlib.h>
00011 #include "object.h"
00012 #include "match.h"
00013 #include "convert.h"
00014
00015 struct s_object_list;
00016
00017
00018 typedef enum {EQ=0,LT=1,GT=2,NE=3,LE=4,GE=5,NOT=6,BETWEEN=7,BEFORE=8,AFTER=9,SAME=10,DIFF=11,MATCH=12,LIKE=13,UNLIKE=14,FINDOP_END} FINDOP;
00019 typedef enum {OR=-2,AND=-1,FT_END=0, FT_ID=1, FT_SIZE=2, FT_CLASS=3, FT_PARENT=4, FT_RANK=5, FT_CLOCK=6, FT_PROPERTY=7, FT_NAME=8,
00020 FT_LAT=9, FT_LONG=10, FT_INSVC=11, FT_OUTSVC=12, FT_FLAGS=13, FT_MODULE=14} FINDTYPE;
00021
00022 typedef struct s_findlist {
00023 unsigned int result_size;
00024 unsigned int hit_count;
00025 char result[1];
00026 } FINDLIST;
00027
00028 typedef union {
00029 int64 integer;
00030 void *pointer;
00031 double real;
00032 char string[256];
00033 } FINDVALUE;
00035 typedef int (*COMPAREFUNC)(void*, FINDVALUE);
00036 typedef void (*FOUNDACTION)(FINDLIST *, struct s_object_list *);
00037 typedef unsigned int PGMCONSTFLAGS;
00039 #define CF_SIZE 0x0001
00040 #define CF_ID 0x0002
00041 #define CF_CLASS 0x0004
00042 #define CF_RANK 0x0008
00043 #define CF_CLOCK 0x0010
00044 #define CF_PARENT 0x0020
00045 #define CF_PROPERTY 0x0040
00046 #define CF_NAME 0x0080
00047 #define CF_LAT 0x0100
00048 #define CF_LONG 0x0200
00049 #define CF_INSVC 0x0400
00050 #define CF_OUTSVC 0x0800
00051 #define CF_FLAGS 0x1000
00052 #define CF_MODULE 0x2000
00053 // 0x4000
00054 #define CF_CONSTANT 0x8000
00056 typedef struct s_findpgm {
00057 PGMCONSTFLAGS constflags;
00058 COMPAREFUNC op;
00059 unsigned short target;
00060 FINDVALUE value;
00061 FOUNDACTION pos, neg;
00062 struct s_findpgm *next;
00063 } FINDPGM;
00064
00065
00066 #ifdef __cplusplus
00067 extern "C" {
00068 #endif
00069
00070 FINDLIST *find_objects(FINDLIST *list, ...);
00071 struct s_object_list *find_first(FINDLIST *list);
00072 struct s_object_list *find_next(FINDLIST *list, struct s_object_list *obj);
00073 int find_makearray(FINDLIST *list, struct s_object_list ***objs);
00074 FINDLIST *find_runpgm(FINDLIST *list, FINDPGM *pgm);
00075 FINDPGM *find_mkpgm(char *search);
00076 PGMCONSTFLAGS find_pgmconstants(FINDPGM *pgm);
00077 char *find_file(char *name, char *path, int mode);
00078 FINDPGM *find_make_invariant(FINDPGM *pgm, int mode);
00079
00080 #ifdef __cplusplus
00081 }
00082 #endif
00083
00084 #define FL_NEW (FINDLIST*)(0)
00085 #define FL_GROUP (FINDLIST*)(-1)
00086
00087
00088 #define FF_EXIST (0x00)
00089 #define FF_WRITE (0x02)
00090 #define FF_READ (0x04)
00091 #define FF_RW (FF_WRITE|FF_READ)
00092
00093 #endif
00094