Patterns in static

Apophenia

Functions
apop_name.c File Reference

Functions

apop_nameapop_name_alloc (void)
 
int apop_name_add (apop_name *n, char const *add_me, char type)
 
void apop_name_print (apop_name *n)
 
void apop_name_free (apop_name *free_me)
 
void apop_name_stack (apop_name *n1, apop_name *nadd, char type1, char typeadd)
 
apop_nameapop_name_copy (apop_name *in)
 
int apop_name_find (const apop_name *n, const char *name, const char type)
 

Function Documentation

int apop_name_add ( apop_name n,
char const *  add_me,
char  type 
)

Adds a name to the apop_name structure. Puts it at the end of the given list.

Parameters
nAn existing, allocated apop_name structure.
add_meA string. If NULL, do nothing; return -1.
type'r': add a row name
'c': add a column name
't': add a text category name
'h': add a title (or a header. 't' is taken).
'v': add (or overwrite) the vector name
Returns
Returns the number of rows/cols/depvars after you have added the new one. But if add_me is NULL, return -1.
apop_name* apop_name_alloc ( void  )

Allocates a name structure

Returns
An allocated, empty name structure. In the very unlikely event that malloc fails, return NULL.
apop_name* apop_name_copy ( apop_name in)

Copy one apop_name structure to another. That is, all data is duplicated. Usage:

1 apop_name *out = apop_name_copy(in);
\param in    the input names
\return       a structure that this function will allocate and fill
int apop_name_find ( const apop_name n,
const char *  name,
const char  type 
)

Finds the position of an element in a list of names.

The function uses case-insensitive search (POSIX's strcasecmp).

Parameters
nthe apop_name object to search.
namethe name you seek; see above.
type'c', 'r', or 't'. Default is 'c'.
Returns
The position of findme. If 'c', then this may be -1, meaning the vector name. If not found, returns -2. On error, e.g. name==NULL, returns -2.
void apop_name_free ( apop_name free_me)

Erases an apop_name structure.

void apop_name_print ( apop_name n)

Prints the given list of names to STDOUT. Useful for debugging, and not much else.

Parameters
nThe apop_name structure
void apop_name_stack ( apop_name n1,
apop_name nadd,
char  type1,
char  typeadd 
)

Append one list of names to another.

Notice that if the first list is empty, then this is a copy function. If the second is NULL, it is a no-op.

Parameters
n1The first set of names (no default, must not be NULL)
naddThe second set of names, which will be appended after the first. (no default, if NULL, a no-op)
type1Either 'c', 'r', 't', or 'v' stating whether you are merging the columns, rows, or text. If 'v', then ignore typeadd and just overwrite the target vector name with the source name. (default = 'r')
typeaddEither 'c', 'r', 't', or 'v' stating whether you are merging the columns, rows, or text. If 'v', then overwrite the target with the source vector name. (default = type1)

Autogenerated by doxygen on Sun Oct 26 2014 (Debian 0.999b+ds3-2).