9 | | Generally, the structure of the program is arranged by branches where alsproc.c is the root of the tree and branches are things like scn parsing, sup reading, navigation reading, etcetera. Output formats are modular, making them very easy to add and remove. |
| 9 | Generally, the structure of the program is arranged by branches where alsproc.c is the root of the tree and branches are things like scn parsing, sup reading, navigation reading, etcetera. Output formats are modular, making them very easy to add and remove. Parameters passed to the program externally should be passed around internally using pointers to a config_struct structure, to help avoid dramatic changes in the API on a regular basis among other things, any developer should be sure to use it. The broadness of its use could be expanded at the time of writing. |
| 10 | |
| 11 | |
| 12 | '''Output''' |
| 13 | Output modules can be added by defining 3 functions and a structure instance: functions for each of opening, writing, and closing; and a structure to hold pointers to those functions. Access to these should be exposed in a header file, while actual code should be contained in their own source file. ''out_txt'' is a good example of an output module, which outputs point data to a .txt file simply translating points to human readable text using fprintf, it can be copied and used as a template for any future modules. Once you have a module, edit output.c and add a clause for your module in open_output_stream which translates config->output_format to your structure holding pointers to your functions, and stores the result in out->fmt. |
| 14 | |
| 15 | {{{ |
| 16 | else if (strcmp(config->output_format, "netcdf")==0) |
| 17 | out->fmt = &NETCDF_FORMAT; |
| 18 | }}} |
| 19 | |