![]() |
|
Functions | |
apop_name * | apop_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_name * | apop_name_copy (apop_name *in) |
int | apop_name_find (const apop_name *n, const char *name, const char type) |
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.
n | An existing, allocated apop_name structure. |
add_me | A 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 |
add_me
is NULL
, return -1. apop_name* apop_name_alloc | ( | void | ) |
Allocates a name structure
malloc
fails, return NULL
. Copy one apop_name structure to another. That is, all data is duplicated. Usage:
\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
).
n | the apop_name object to search. |
name | the name you seek; see above. |
type | 'c' , 'r' , or 't' . Default is 'c' . |
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_print | ( | apop_name * | n | ) |
Prints the given list of names to STDOUT. Useful for debugging, and not much else.
n | The apop_name structure |
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.
n1 | The first set of names (no default, must not be NULL ) |
nadd | The second set of names, which will be appended after the first. (no default, if NULL , a no-op) |
type1 | Either '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') |
typeadd | Either '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) |