~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to incl/pgm.h

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @(#)pgm.h    19.1 (ESO-IPG) 02/25/03 13:49:38 */
 
2
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
3
.TYPE           Header
 
4
.NAME           pgm.h
 
5
.LANGUAGE       C
 
6
.AUTHOR         Francois Ochsenbein [ESO]
 
7
.CATEGORY       Macros for Main routines (main parameters)
 
8
.ENVIRONMENT    
 
9
 
 
10
.COMMENTS       There are several ways to get the parameters of a main 
 
11
                procedure:
 
12
                1) char *NextParm() move in the vector of parameters
 
13
                2) char *GetParmString() find a named parameter,
 
14
                                e.g. GetParmString("x=")
 
15
 
 
16
.VERSION 1.0    20-Feb-1986  Creation by extraction from STESODEF
 
17
.VERSION 1.1    06-Nov-1986  Inclusion of parameter functions (mp_...)
 
18
.VERSION 2.0    01-Jun-1988  Added GetsOption(letter) (eg -Ofile)
 
19
.VERSION 2.1    22-Jun-1989  Added SetParm
 
20
.VERSION 2.2    08-Dec-1989  Added GetParmString, GetParmInt, etc...
 
21
 
 
22
------------------------------------------------------------*/
 
23
 
 
24
#ifndef PGM_DEF
 
25
#define PGM_DEF         0
 
26
 
 
27
#ifndef _TEMPLATES_
 
28
#include <compiler.h>
 
29
#endif
 
30
 
 
31
#define PGM(name)       int main(argc,argv,envp)    /* name Main Program */ \
 
32
                        int argc; char **argv,**envp; /* Main routine */
 
33
 
 
34
#if _TEMPLATES_
 
35
/*===========================================================================
 
36
 *              Function Templates
 
37
 *===========================================================================*/
 
38
int      mp_save        (int argc, char **argv, char **envp);
 
39
int      mp_reset       (void);
 
40
char    *mp_get         (int arg_number);
 
41
char    *mp_next        (void);
 
42
char    *mp_anext       (void);
 
43
char    *mp_flagged     (char flag_char);       /* Example: '<'         */
 
44
int      mp_option      (char option_char);     /* Example: -t80        */
 
45
char    *mp_poption     (char option_flag);     /* Example: -iInput     */
 
46
char    *mp_gs          (char *start_string);   /* Example: name=value  */
 
47
long     mp_gl          (char *start_string);   /* Example: name=number */
 
48
/* double mp_gf         (char *start_string);   /* Example: name=number */
 
49
 
 
50
#else
 
51
char    *mp_get(), *mp_next(), *mp_anext(), *mp_poption(), *mp_gs(), 
 
52
        *mp_flagged();
 
53
long    mp_gl();
 
54
/* double       mp_gf(); */
 
55
#endif
 
56
 
 
57
#define SaveParm(n,p1,p2)       mp_save(n,p1,p2)        /* Save main params */
 
58
#define SaveParms()             SaveParm(argc,argv,envp)/* Save main params */
 
59
#define ResetParms()            mp_reset()
 
60
#define GetParm(n)              mp_get(n)
 
61
#define GetProgramFile()        mp_get(0)
 
62
#define NextParm()              mp_anext()
 
63
#define GetNextParm()           mp_next()
 
64
#define GetFlaggedParm(x)       mp_flagged(x)
 
65
#define GetInputFile()          mp_flagged('<')
 
66
#define GetOutputFile()         mp_flagged('>')
 
67
#define GetTerminalName()       mp_flagged('^')
 
68
#define GetOption(x)            mp_option(x)
 
69
#define GetsOption(x)           mp_poption(x)
 
70
 
 
71
#define GetParmString(s)        mp_gs(s)
 
72
#define GetParmInteger(s)       mp_gl(s)
 
73
#define GetParmFloat(s)         mp_gf(s)
 
74
 
 
75
#endif