BIBA(3) Biba Tools BIBA(3) NAME biba - library for representing large automata SYNOPSIS #include int init_aut(int pr,int mm,int cm,int lock); int create_aut(int *add,char *path,aut *A); int open_aut(char *path,aut *A); uint_32 new_state(aut *A); uint_32 clone(aut *A,uint_32 s); int set_dest(aut *A,uint_32 s,int a,uint_32 t); uint_32 dest(aut *A,uint_32 s,int a); int stdeg(aut *A,uint_32 s); uint_32 next_dest(aut *A,uint_32 s,int *p,uint_8 *lbl); int set_final(aut *A,uint_32 s,int f); int is_final(aut *A,uint_32 s); int store_field(int arr,int e,int fd,void *field); int_64 read_field(int arr,int e,int fd,void *field); int_64 add_field(int arr,int e,int fd,int_64 to_add); DESCRIPTION biba is a library for representing large automata with support for user-level paging. The API is composed by three blocks of services: initializaton, state and low level services. INITIALIZATION init_aut(int pr,int mm,int cm,int lock); Initializaes the API providing some paging parame- ters. The paging ratio pr is the maximum ratio between virtual memory and real memory sizes. The maximum physical memory mm is the maximum amount of physical memory that biba is allowed to alloc in megabytes. The comfortable memory cm limit is the amount of memory in megabytes that biba is allowed to alloc to maintain if possible a paging ratio 1. The lock flag is used to ask biba to system lock all memory pages demanded from the operating sys- tem. This parameter usually must be 1, otherwise the "physical" memory we're talking about will be in fact system virtual memory. int create_aut(int *add,char *path,aut *A); Create a new automaton, returning a descriptor for it in A. This operation is quite similar to create a file for read and writing (truncating it). The parameter add points to an array describing addi- tional fields to be appended to each state, just like flags or counters (the format of this array is currently documented only in the source code), and the path parameter is a basename to wich will pe Biba Tools March 6, 1998 1 appended ".st" and ".ed" in order to create the files that will contain the states and edges of this newly created automaton. The initial state of this automaton can be defined through the field A.initial of the A structure. The return value is 0 for success, or an error code otherwise. The error codes are currently documented only at the source code level. int open_aut(char *path,aut *A); Open for read and writing an existing automaton, given by the basename path, and returns a descrip- tor for it in A. The return value is 0 for suc- cess, or an error code otherwise. The error codes are currently documented only at the source code level. STATE SERVICES uint_32 new_state(aut *A); Alloc a new state for automaton A, initially with- out outgoing edges, returns the identifier of the new state. uint_32 clone(aut *A,uint_32 s); Clone state s of automaton A, returns the identi- fier of the clone. int set_dest(aut *A,uint_32 s,int a,uint_32 t); Set the destination of the edge with label a from state s of automaton A as being t uint_32 dest(aut *A,uint_32 s,int a); Returns the destination of the edge with label a from state s of automaton A, or NIL if this edge is undefined. int stdeg(aut *A,uint_32 s); Returns the output degree of state s of automaton A. uint_32 next_dest(aut *A,uint_32 s,int *p,uint_8 *lbl); Used to traverse all edges outgoing from state s of automaton A. The variable p must be initialized with -1. Each call of next_dest will return the destination of the next edge from s (in order of labels). If lbl is non-null, it will contain the label of the edge. When all edges were visited, returns NIL. int set_final(aut *A,uint_32 s,int f); Set the final state flag of state s from automaton A as being f (1 or 0). Biba Tools March 6, 1998 2 int is_final(aut *A,uint_32 s); Returns the value of the final flag of state s of automaton A. When a new state is allocated, the value of this flag is 0. LOW LEVEL int store_field(int arr,int e,int fd,void *field); Store the value *field in the fd field of the e entry of array arr. This service is mainly used to change state additional fields defined at an automaton creation. Please refer the example pro- grams in order to use this service. int_64 read_field(int arr,int e,int fd,void *field); Read in *field the value of the fd field of the e entry of array arr. This service is mainly used to read state additional fields defined at an automa- ton creation. When this field contains an integer of any type, its value is also returned as the function return value. Please refer the example programs in order to use this service. int_64 add_field(int arr,int e,int fd,int_64 to_add); Similar to read_field, but adds to the field the value to_add before, interpreted as being of the same type of the referred field. SEE ALSO biba(1), reduce(1), suffaut(1) AUTHOR Ricardo Ueda Karpischek (ueda@ime.usp.br) Biba Tools March 6, 1998 3