00001
00007 #ifndef _FIND_H
00008 #define _FIND_H
00009
00010 #include <stdarg.h>
00011 #include <stdlib.h>
00012 #include "object.h"
00013 #include "match.h"
00014 #include "convert.h"
00015
00016 struct s_object_list;
00017
00018
00019 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;
00020 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,
00021 FT_LAT=9, FT_LONG=10, FT_INSVC=11, FT_OUTSVC=12, FT_FLAGS=13, FT_MODULE=14, FT_GROUPID=15} FINDTYPE;
00022
00023 typedef struct s_findlist {
00024 unsigned int result_size;
00025 unsigned int hit_count;
00026 char result[1];
00027 } FINDLIST;
00028
00029 typedef union {
00030 int64 integer;
00031 void *pointer;
00032 double real;
00033 char string[256];
00034 } FINDVALUE;
00036 typedef int (*COMPAREFUNC)(void*, FINDVALUE);
00037 typedef void (*FOUNDACTION)(FINDLIST *, struct s_object_list *);
00038 typedef unsigned int PGMCONSTFLAGS;
00040 #define CF_SIZE 0x0001
00041 #define CF_ID 0x0002
00042 #define CF_CLASS 0x0004
00043 #define CF_RANK 0x0008
00044 #define CF_CLOCK 0x0010
00045 #define CF_PARENT 0x0020
00046 #define CF_PROPERTY 0x0040
00047 #define CF_NAME 0x0080
00048 #define CF_LAT 0x0100
00049 #define CF_LONG 0x0200
00050 #define CF_INSVC 0x0400
00051 #define CF_OUTSVC 0x0800
00052 #define CF_FLAGS 0x1000
00053 #define CF_MODULE 0x2000
00054 #define CF_GROUPID 0x4000
00055 #define CF_CONSTANT 0x8000
00057 typedef struct s_findpgm {
00058 PGMCONSTFLAGS constflags;
00059 COMPAREFUNC op;
00060 unsigned short target;
00061 FINDVALUE value;
00062 FOUNDACTION pos, neg;
00063 struct s_findpgm *next;
00064 } FINDPGM;
00065
00066
00067 #ifdef __cplusplus
00068 extern "C" {
00069 #endif
00070
00071 FINDLIST *find_objects(FINDLIST *list, ...);
00072 FINDLIST *findlist_copy(FINDLIST *list);
00073 void findlist_add(FINDLIST *list, struct s_object_list *obj);
00074 void findlist_del(FINDLIST *list, struct s_object_list *obj);
00075 void findlist_clear(FINDLIST *list);
00076 struct s_object_list *find_first(FINDLIST *list);
00077 struct s_object_list *find_next(FINDLIST *list, struct s_object_list *obj);
00078 int find_makearray(FINDLIST *list, struct s_object_list ***objs);
00079 FINDLIST *find_runpgm(FINDLIST *list, FINDPGM *pgm);
00080 FINDPGM *find_mkpgm(char *search);
00081 PGMCONSTFLAGS find_pgmconstants(FINDPGM *pgm);
00082 char *find_file(char *name, char *path, int mode);
00083 FINDPGM *find_make_invariant(FINDPGM *pgm, int mode);
00084
00085 #ifdef __cplusplus
00086 }
00087 #endif
00088
00089 #define FL_NEW (FINDLIST*)(0)
00090 #define FL_GROUP (FINDLIST*)(-1)
00091
00092
00093 #define FF_EXIST (0x00)
00094 #define FF_WRITE (0x02)
00095 #define FF_READ (0x04)
00096 #define FF_RW (FF_WRITE|FF_READ)
00097
00098 #endif
00099