Old TDRP API for C

This API is included for backward compatibility. Use of this old API is discouraged because it will eventually be discontinued.

/*************************************************************************
 * TDRP_load_from_args()
 *
 * Loads up TDRP using the command line args for control.
 *
 * Check TDRP_usage() for command line actions associated with
 * this function.
 *
 *   argc, argv: command line args
 *
 *   TDRPtable *table: table obtained from _tdrp_init().
 *
 *   void *params: this is actually of type *_tdrp_struct,
 *     as declared in _tdrp.h.
 *     This function loads the values of the parameters into this structure.
 * 
 *   char **override_list: A null-terminated list of overrides to the
 *     parameter file.
 *     An override string has exactly the format of the
 *     parameter file itself.
 *
 *   char **params_path_p: if non-NULL, this is set to point to the
 *                         path of the params file used.
 *
 *  Returns 0 on success, -1 on failure.
 */

extern int TDRP_load_from_args(int argc, char **argv,
			       TDRPtable *table, void *params,
			       char **override_list,
			       char **params_path_p);

/*************************************************************************
 * TDRP_load()
 *
 * Loads up TDRP for a given module.
 *
 * This version of load gives the programmer the option to load up more
 * than one module for a single application. It is a lower-level
 * routine than tdrpLoadFromArgs(), and hence more flexible, but
 * the programmer must do more work.
 *
 *   char *param_file_path: the parameter file to be read in.
 *
 *   TDRPtable *table: table obtained from _tdrp_init().
 *
 *   void *params: this is actually of type *_tdrp_struct,
 *     as declared in _tdrp.h.
 *     This function loads the values of the parameters into this structure.
 * 
 *   char **override_list: A null-terminated list of overrides to the
 *     parameter file.
 *     An override string has exactly the format of the
 *     parameter file itself.
 *
 *  expand_env: flag to control environment variable expansion during
 *                tokenization.
 *              If TRUE, environment expansion is set on.
 *              If FALSE, environment expansion is set off.
 *
 *  Returns 0 on success, -1 on failure.
 */

extern int TDRP_load(char *param_file_path,
		     TDRPtable *table, void *params,
		     char **override_list,
		     int expand_env, int debug);

/**********************************************************
 * TDRP_load_defaults()
 *
 * Loads up TDRP for a given module using defaults only.
 *
 * See TDRP_load() for details.
 *
 * Returns 0 on success, -1 on failure.
 */

extern int TDRP_load_defaults(TDRPtable *table, void *params,
			      int expand_env);

/***********************************************************
 * TDRP_sync()
 *
 * Syncs the user struct data back into the parameter table,
 * in preparation for printing.
 */

extern void TDRP_sync(TDRPtable *table, void *params);

/*************
 * TDRP_print()
 * 
 * Print params file
 *
 * The modes supported are:
 *
 *   PRINT_SHORT:   main comments only, no help or descriptions
 *                  structs and arrays on a single line
 *   PRINT_NORM:    short + descriptions and help
 *   PRINT_LONG:    norm  + arrays and structs expanded
 *   PRINT_VERBOSE: long  + private params included
 */

extern void TDRP_print(FILE *out, TDRPtable *table,
		       char *module, tdrp_print_mode_t mode);
     
/***********************************************************
 * TDRP_check_all_set()
 *
 * Return TRUE if all set, FALSE if not.
 *
 * If out is non-NULL, prints out warning messages for those
 * parameters which are not set.
 */

extern int TDRP_check_all_set(FILE *out,
			      TDRPtable *table, void *params);

/***********************************************************
 * TDRP_free_all()
 *
 * Frees up memory associated with a module and its table
 */

extern void TDRP_free_all(TDRPtable *table, void *params);

/**********************
 * TDRP_array_realloc()
 *
 * Realloc 1D array.
 *
 * If size is increased, the values from the last array entry is
 * copied into the new space.
 *
 * Returns 0 on success, -1 on error.
 */

extern int TDRP_array_realloc(TDRPtable *table, void *params,
			      char *param_name, int new_array_n);

/************************
 * TDRP_array2D_realloc()
 *
 * Realloc 2D array.
 *
 * If size is increased, the values from the last array entry is
 * copied into the new space.
 *
 * Returns 0 on success, -1 on error.
 */

extern int TDRP_array2D_realloc(TDRPtable *table, void *params,
				char *param_name,
				int new_array_n1, int new_array_n2);

/***********************************************************
 * TDRP_str_replace()
 *
 * Replace a string.
 */

extern void TDRP_str_replace(char **s1, char *s2);

/**********************
 * TDRP_init_override()
 *
 * Initialize the override list
 */

extern void TDRP_init_override(tdrp_override_t *override);

/*********************
 * TDRP_add_override()
 *
 * Add a string to the override list
 */

extern void TDRP_add_override(tdrp_override_t *override, char *override_str);

/**********************
 * TDRP_free_override()
 *
 * Free up the override list
 */

extern void TDRP_free_override(tdrp_override_t *override);

/*********************************************************
 * TDRP_usage()
 *
 * Prints out usage message for TDRP args as passed in to
 * TDRP_load_from_args()
 */

extern void TDRP_usage(FILE *out);