| 1 |
/* |
| 2 |
* params.h |
| 3 |
* |
| 4 |
* Written by: Stefan Frank |
| 5 |
* Ullrich Hafner |
| 6 |
* |
| 7 |
* This file is part of FIASCO (Fractal Image And Sequence COdec) |
| 8 |
* Copyright (C) 1994-2000 Ullrich Hafner |
| 9 |
*/ |
| 10 |
|
| 11 |
/* |
| 12 |
* $Date: 2000/06/14 20:51:17 $ |
| 13 |
* $Author: hafner $ |
| 14 |
* $Revision: 5.1 $ |
| 15 |
* $State: Exp $ |
| 16 |
*/ |
| 17 |
|
| 18 |
#ifndef PARAMS_H |
| 19 |
#define PARAMS_H |
| 20 |
|
| 21 |
#include <stdio.h> |
| 22 |
|
| 23 |
typedef union pdata_t /* Allow for different */ |
| 24 |
{ /* parameter types. */ |
| 25 |
int b; |
| 26 |
int i; |
| 27 |
float f; |
| 28 |
char *s; |
| 29 |
} pdata_t; |
| 30 |
|
| 31 |
typedef enum {PFLAG = 1, PINT, PFLOAT, PSTR, POSTR} param_e; |
| 32 |
|
| 33 |
typedef struct param_t |
| 34 |
{ |
| 35 |
const char *name; /* Parameter name */ |
| 36 |
const char *argument_name; /* Argument name */ |
| 37 |
char optchar; /* Corresponding command line switch */ |
| 38 |
param_e type; /* Parameter type */ |
| 39 |
pdata_t value; /* Parameter value */ |
| 40 |
const char *default_value; /* Parameters default value */ |
| 41 |
const char *use; /* One line usage. Must contain %s, |
| 42 |
which will be replaced by 'name'. */ |
| 43 |
} param_t; |
| 44 |
|
| 45 |
int |
| 46 |
parseargs (param_t *usr_params, |
| 47 |
int argc, const char **argv, |
| 48 |
const char *synopsis, |
| 49 |
const char *comment, |
| 50 |
const char *non_opt_string, |
| 51 |
const char *path, |
| 52 |
const char *sys_file_name, |
| 53 |
const char *usr_file_name); |
| 54 |
void |
| 55 |
write_parameters (const param_t *params, FILE *output); |
| 56 |
|
| 57 |
void |
| 58 |
ask_and_set (param_t *params, const char *name, const char *msg); |
| 59 |
|
| 60 |
const void * |
| 61 |
parameter_value (const param_t *params, const char *name); |
| 62 |
|
| 63 |
#endif /* not PARAMS_H */ |