Input, output, error and memory allocation functions More...
Go to the source code of this file.
Functions | |
void | readXML () |
Open file and parse XML. | |
void | printIndata () |
Output matrices for checking by user. | |
void | error (char *error_msg) |
Basic error output and exit function. | |
double * | mem1d_d (int dimx) |
Dimensions an initialized 1-D array of doubles. | |
int * | mem1d_i (int dimx) |
Dimensions an initialized 1-D array of int. | |
int ** | mem2d1_i (int dimx) |
Dimensions a initialized 1-D array of int pointers, ready to be allocated using mem1d_i() . | |
void | free2d1_i (int **ptr, int dimx) |
Frees the ragged array allocated by mem2d1_i(). | |
char ** | mem2d1_c (int dimx) |
Dimensions a initialized 1-D array of character pointers, ready to be allocated using asprintf. | |
void | free2d1_c (char **ptr, int dimx) |
Frees the ragged array allocated by mem2d1_c(). | |
int ** | mem2d_i (int dimx, int dimy) |
Dimensions an initialized 2-D array of int. | |
void | free2d_i (int **ptr, int dimx) |
double ** | mem2d_d (int dimx, int dimy) |
Dimensions an initialized 2-D array of doubles. | |
void | free2d_d (double **ptr, int dimx) |
double *** | mem3d_d (int dimx, int dimy, int dimz) |
Dimensions an initialized 3-D array of doubles. | |
void | free3d_d (double ***ptr, int dimx, int dimy) |
int *** | mem3d_i (int dimx, int dimy, int dimz) |
Dimensions an initialized 3-D array of int. | |
void | free3d_i (int ***ptr, int dimx, int dimy) |
void | help () |
Default help output. | |
Input, output, error and memory allocation functions
Definition in file io.c.
void error | ( | char * | error_msg | ) |
Basic error output and exit function.
Note that no freeing is done, possibly leading to memory leaks.
error_msg | the error message |
Definition at line 612 of file io.c.
Referenced by main(), mem1d_d(), mem1d_i(), mem2d1_c(), mem2d1_i(), mem2d_d(), mem2d_i(), mem3d_d(), mem3d_i(), parseNewick(), phyloToLineage(), readArgs(), and readXML().
void free2d1_c | ( | char ** | ptr, |
int | dimx | ||
) |
Frees the ragged array allocated by mem2d1_c().
dimx | The dimensions of the vector |
void free2d1_i | ( | int ** | ptr, |
int | dimx | ||
) |
Frees the ragged array allocated by mem2d1_i().
dimx | The dimensions of the vector |
Definition at line 670 of file io.c.
Referenced by main().
double* mem1d_d | ( | int | dimx | ) |
Dimensions an initialized 1-D array of doubles.
To free, just use free().
dimx | The dimensions of the vector |
Definition at line 628 of file io.c.
References error().
Referenced by parseNewick(), and readXML().
int* mem1d_i | ( | int | dimx | ) |
Dimensions an initialized 1-D array of int.
To free, just use free().
dimx | The dimensions of the vector |
Definition at line 643 of file io.c.
References error().
Referenced by parseNewick(), phyloToLineage(), and readXML().
char** mem2d1_c | ( | int | dimx | ) |
Dimensions a initialized 1-D array of character pointers, ready to be allocated using asprintf.
The result will be a `ragged' matrix. To free, use free2d1_c() .
dimx | The dimensions of the vector |
Definition at line 685 of file io.c.
References error().
Referenced by parseNewick(), and readXML().
int** mem2d1_i | ( | int | dimx | ) |
Dimensions a initialized 1-D array of int pointers, ready to be allocated using mem1d_i() .
The result will be a `ragged' matrix. To free, use free2d1_i() .
dimx | The dimensions of the vector |
Definition at line 658 of file io.c.
References error().
Referenced by phyloToLineage().
double** mem2d_d | ( | int | dimx, |
int | dimy | ||
) |
int** mem2d_i | ( | int | dimx, |
int | dimy | ||
) |
Dimensions an initialized 2-D array of int.
Free with free2d_i()
Definition at line 712 of file io.c.
References error().
Referenced by phyloToLineage().
double*** mem3d_d | ( | int | dimx, |
int | dimy, | ||
int | dimz | ||
) |
int*** mem3d_i | ( | int | dimx, |
int | dimy, | ||
int | dimz | ||
) |
Dimensions an initialized 3-D array of int.
Free with free3d_i()
Definition at line 793 of file io.c.
References error().
Referenced by phyloToLineage(), and readXML().
void readXML | ( | ) |
Open file and parse XML.
Derived from mini-xml website examples.
Definition at line 13 of file io.c.
References Area, Cfg, DataFile, Dist, error(), Extant, free2d1_c(), mem1d_d(), mem1d_i(), mem2d1_c(), mem2d_d(), mem3d_d(), mem3d_i(), Phylo, Phylos, RealTime, RUN_BATCH, Sasprintf, SpaceName, Spaces, config::startSpace, Taxa, Taxon, and Times.
Referenced by main().