Patterns in static

Apophenia

Macros | Functions
apop_output.c File Reference

Macros

#define Output_vars   output_name, output_pipe, output_type, output_append
 
#define Output_declares   char const * output_name, FILE * output_pipe, char output_type, char output_append
 
#define Dispatch_output
 

Functions

int apop_prep_output (char const *output_name, FILE **output_pipe, char *output_type, char *output_append)
 
void apop_data_show (const apop_data *in)
 
void p_fn (FILE *f, double data)
 
void apop_vector_print (gsl_vector *data, Output_declares)
 
void apop_vector_show (const gsl_vector *data)
 
void apop_data_print (const apop_data *data, Output_declares)
 
void apop_matrix_print (const gsl_matrix *data, Output_declares)
 
void apop_matrix_show (const gsl_matrix *data)
 

Detailed Description

Some printing and output interface functions.

Macro Definition Documentation

#define Dispatch_output
Value:
char const *apop_varad_var(output_name, NULL); \
FILE * apop_varad_var(output_pipe, NULL); \
char apop_varad_var(output_type, 0); \
char apop_varad_var(output_append, 0); \
Apop_stopif(apop_prep_output(output_name, &output_pipe, &output_type, &output_append), \
return, 0, "Trouble preparing to write output.");
#define Apop_stopif(test, onfail, level,...)
Definition: apop.h:1004
int apop_prep_output(char const *output_name, FILE **output_pipe, char *output_type, char *output_append)
Definition: apop_output.c:60

Function Documentation

int apop_prep_output ( char const *  output_name,
FILE **  output_pipe,
char *  output_type,
char *  output_append 
)

If you're reading this, it is probably because you were referred by another function that uses this internally. You should never call this function directly, but do read this documentation.

There are four settings that affect how output happens, which can be set when you call the function that sent you to this documentation, e.g:

1 apop_data_print(your_data, .output_type ='f', .output_append = 'w');
Parameters
output_nameThe name of the output file, if any. For a database, the table to write.
output_pipeIf you have already opened a file and have a FILE* on hand, use this instead of giving the file name.
output_type'p' = pipe, 'f'= file, 'd' = database, 's' = stdout
output_append'a' = append (default), 'w' = write over.

At the end, output_name, output_pipe, and output_type are all set. Notably, the local output_pipe will have the correct location for the calling function to fprintf to.

  • Tip: if writing to the database, you can get a major speed boost by wrapping the call in a begin/commit wrapper:
1 apop_query("begin;");
2 apop_data_print(your_data, .output_name="dbtab", .output_type='d');
3 apop_query("commit;");

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