Searching for objects
[GridLAB-D Core]


Defines

#define ACCEPT   { _n+=_m; _p+=_m; _m=0; }
#define ADDALL(L)   ((L).hit_count=object_get_count(),memset((L).result,0xff,(L).result_size))
#define ADDOBJ(L, N)   (!FOUND((L),(N))?((L).result[(N)>>3]|=(1<<((N)&0x7)),++((L).hit_count)):(L).hit_count)
#define COPY(X)   {size--; (X)[_n++]=*_p++;}
#define COUNT(L)   ((L).hit_count)
#define DELALL(L)   ((L).hit_count=object_get_count(),memset((L).result,0x00,(L).result_size))
#define DELOBJ(L, N)   (FOUND((L),(N))?((L).result[(N)>>3]&=~(1<<((N)&0x7)),--((L).hit_count)):(L).hit_count)
#define DONE   return _n;
#define FOUND(L, N)   (((L).result[(N)>>3]&(1<<((N)&0x7)))!=0)
#define HERE   (_p+_m)
#define LITERAL(X)   ((_m+=literal(HERE,(X)))>0)
#define OR   {_m=0;}
#define PARSER   char *_p
#define REJECT   { return 0; }
#define SIZE(L)   ((L).result_size)
#define START   int _m=0, _n=0;
#define TERM(X)   ((_m+=(X))>0)
#define VALUE(X, T, M)   ((X).isconstant?(X).value.constant.M:*((X).value.ref.T))
#define WHITE   (_m+=white(HERE))

Functions

int compare_integer16_eq (void *a, FINDVALUE b)
int compare_integer16_ge (void *a, FINDVALUE b)
int compare_integer16_gt (void *a, FINDVALUE b)
int compare_integer16_le (void *a, FINDVALUE b)
int compare_integer16_li (void *a, FINDVALUE b)
int compare_integer16_lt (void *a, FINDVALUE b)
int compare_integer16_ne (void *a, FINDVALUE b)
int compare_integer16_nl (void *a, FINDVALUE b)
int compare_integer32_eq (void *a, FINDVALUE b)
int compare_integer32_ge (void *a, FINDVALUE b)
int compare_integer32_gt (void *a, FINDVALUE b)
int compare_integer32_le (void *a, FINDVALUE b)
int compare_integer32_li (void *a, FINDVALUE b)
int compare_integer32_lt (void *a, FINDVALUE b)
int compare_integer32_ne (void *a, FINDVALUE b)
int compare_integer32_nl (void *a, FINDVALUE b)
int compare_integer64_eq (void *a, FINDVALUE b)
int compare_integer64_ge (void *a, FINDVALUE b)
int compare_integer64_gt (void *a, FINDVALUE b)
int compare_integer64_le (void *a, FINDVALUE b)
int compare_integer64_li (void *a, FINDVALUE b)
int compare_integer64_lt (void *a, FINDVALUE b)
int compare_integer64_ne (void *a, FINDVALUE b)
int compare_integer64_nl (void *a, FINDVALUE b)
int compare_integer_eq (void *a, FINDVALUE b)
int compare_integer_ge (void *a, FINDVALUE b)
int compare_integer_gt (void *a, FINDVALUE b)
int compare_integer_le (void *a, FINDVALUE b)
int compare_integer_li (void *a, FINDVALUE b)
int compare_integer_lt (void *a, FINDVALUE b)
int compare_integer_ne (void *a, FINDVALUE b)
int compare_integer_nl (void *a, FINDVALUE b)
int compare_pointer_eq (void *a, FINDVALUE b)
int compare_pointer_ge (void *a, FINDVALUE b)
int compare_pointer_gt (void *a, FINDVALUE b)
int compare_pointer_le (void *a, FINDVALUE b)
int compare_pointer_li (void *a, FINDVALUE b)
int compare_pointer_lt (void *a, FINDVALUE b)
int compare_pointer_ne (void *a, FINDVALUE b)
int compare_pointer_nl (void *a, FINDVALUE b)
int compare_real_eq (void *a, FINDVALUE b)
int compare_real_ge (void *a, FINDVALUE b)
int compare_real_gt (void *a, FINDVALUE b)
int compare_real_le (void *a, FINDVALUE b)
int compare_real_li (void *a, FINDVALUE b)
int compare_real_lt (void *a, FINDVALUE b)
int compare_real_ne (void *a, FINDVALUE b)
int compare_real_nl (void *a, FINDVALUE b)
int compare_string_eq (void *a, FINDVALUE b)
int compare_string_ge (void *a, FINDVALUE b)
int compare_string_gt (void *a, FINDVALUE b)
int compare_string_le (void *a, FINDVALUE b)
int compare_string_li (void *a, FINDVALUE b)
int compare_string_lt (void *a, FINDVALUE b)
int compare_string_ne (void *a, FINDVALUE b)
int compare_string_nl (void *a, FINDVALUE b)
char * find_file (char *name, char *path, int mode)
 Search for a file in the specified path (or in GLPATH environment variable) access flags: 0 = exist only, 2 = write, 4 = read, 6 = read/write.
OBJECTfind_first (FINDLIST *list)
 Returns the first object currently in the the search list return.
int find_makearray (FINDLIST *list, OBJECT ***objs)
 Makes an array from the objects currently in the search list result.
FINDPGMfind_mkpgm (char *expression)
OBJECTfind_next (FINDLIST *list, OBJECT *obj)
 Return the next object in the currenet search list.
FINDLISTfind_objects (FINDLIST *start,...)
 Search for objects that match criteria start may be a previous search result, or FT_NEW.
PGMCONSTFLAGS find_pgmconstants (FINDPGM *pgm)
FINDLISTfind_runpgm (FINDLIST *list, FINDPGM *pgm)
FINDLISTnew_list (unsigned int n)
void syntax_error (char *p)


Function Documentation

char* find_file ( char *  name,
char *  path,
int  mode 
)

Search for a file in the specified path (or in GLPATH environment variable) access flags: 0 = exist only, 2 = write, 4 = read, 6 = read/write.

Returns:
the first occurance of the file having the desired access mode
Parameters:
name  the name of the file to find
path  the path to search (or NULL to search the GLPATH environment)
mode  the file access mode to use, see access() for valid modes

Definition at line 1113 of file find.c.

References module_get_exe_path().

Referenced by load_tzspecs(), and unit_init().

OBJECT* find_first ( FINDLIST list  )  [read]

Returns the first object currently in the the search list return.

Returns:
a pointer to the first object
Parameters:
list  the search list to scan

Definition at line 438 of file find.c.

References find_next().

Referenced by aggregate_mkgroup(), aggregate_value(), cmex_object_list(), find_makearray(), find_runpgm(), and random_apply().

int find_makearray ( FINDLIST list,
OBJECT ***  objs 
)

Makes an array from the objects currently in the search list result.

Returns:
The number of objects found
Parameters:
list  the search list to scan
objs  the object found

Definition at line 420 of file find.c.

References find_first(), find_next(), and s_findlist::hit_count.

OBJECT* find_next ( FINDLIST list,
OBJECT obj 
) [read]

Return the next object in the currenet search list.

Returns:
a pointer to the next object
Parameters:
list  the search list to scan
obj  the current object

Definition at line 446 of file find.c.

References FOUND, s_object_list::id, s_object_list::next, and object_get_first().

Referenced by aggregate_value(), cmex_object_list(), find_first(), find_makearray(), find_runpgm(), and random_apply().

FINDLIST* find_objects ( FINDLIST start,
  ... 
)

Search for objects that match criteria start may be a previous search result, or FT_NEW.

FT_NEW starts a new search (starting with all objects)

Searches criteria may be as follows:

find_objects(FT_NEW, ftype, compare, value[, ...], NULL);

and may be grouped using AND and OR.

The criteria list must be terminated by NULL or FT_END.

Values of ftype are:

Extended values of ftype are:

Values of compare are:

Conjunctions are AND and OR, and can be used to do complex searches

OBJECT *find_first(FINDLIST *list) returns the first object in the result list

OBJECT *find_next(FINDLIST *list, OBJECT *previous) returns the next object in the result list

Returns:
a pointer for FINDLIST structure used by find_first(), find_next, and find_makearray()

Definition at line 282 of file find.c.

References ADDALL, ADDOBJ, AND, DELALL, DELOBJ, find_mkpgm(), find_runpgm(), FL_GROUP, FL_NEW, FT_CLASS, FT_CLOCK, FT_END, FT_ID, FT_INSVC, FT_LAT, FT_LONG, FT_MODULE, FT_NAME, FT_OUTSVC, FT_PARENT, FT_PROPERTY, FT_RANK, FT_SIZE, s_object_list::id, new_list(), s_object_list::next, NOT, object_get_count(), object_get_first(), OR, output_error(), and s_object_list::parent.

Referenced by cmex_object_list(), and random_apply().


GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy