about summary refs log tree commit diff
path: root/converter/other/fiasco/params.h
blob: 85b0b648fb1bc3edafd5fd04507acec01f84022c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *  params.h
 *
 *  Written by:     Stefan Frank
 *          Ullrich Hafner
 *
 *  This file is part of FIASCO (Fractal Image And Sequence COdec)
 *  Copyright (C) 1994-2000 Ullrich Hafner
 */

/*
 *  $Date: 2000/06/14 20:51:17 $
 *  $Author: hafner $
 *  $Revision: 5.1 $
 *  $State: Exp $
 */

#ifndef PARAMS_H
#define PARAMS_H

#include <stdio.h>

typedef union pdata_t           /* Allow for different */
{                   /* parameter types. */
    int    b;
    int    i;
    float  f;
    char  *s;
} pdata_t;

typedef enum {PFLAG = 1, PINT, PFLOAT, PSTR, POSTR} param_e;

typedef struct param_t
{
    const char  *name;           /* Parameter name */
    const char  *argument_name;      /* Argument name */
    char         optchar;            /* Corresponding command line switch */
    param_e      type;           /* Parameter type */
    pdata_t      value;          /* Parameter value */
    const char  *default_value;      /* Parameters default value */
    const char  *use;            /* One line usage. Must contain %s,
                                    which will be replaced by 'name'. */
} param_t;

int
parseargs (param_t *usr_params,
           int argc, const char **argv,
           const char *synopsis,
           const char *comment,
           const char *non_opt_string,
           const char *path,
           const char *sys_file_name,
           const char *usr_file_name);
void
write_parameters (const param_t *params, FILE *output);

void
ask_and_set (param_t *params, const char *name, const char *msg);

const void *
parameter_value (const param_t *params, const char *name);

#endif /* not PARAMS_H */