source: PSPA/madxPSPA/src/mad_cmdpar.h @ 455

Last change on this file since 455 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 4.2 KB
Line 
1#ifndef MAD_CMDPAR_H
2#define MAD_CMDPAR_H
3
4// types
5
6struct command;
7struct element;
8struct expression;
9struct expr_list;
10struct double_array;
11struct char_p_array;
12struct el_list;
13struct var_list;
14
15struct command_parameter        /* holds one command parameter */
16{
17  char name[NAME_L];
18  int type;                           /* 0 logical 1 integer 2 double
19                                         3 string 4 constraint */
20                                      /* 11 int array 12 double array
21                                         13 string array */
22  int c_type;                         /* for type 4:
23                                         1 min, 2 max, 3 both, 4 value */
24  double double_value;                /* type 0, 1, 2, 4 */
25  double c_min;                       /* type 4 */
26  double c_max;                       /* type 4 */
27  struct expression* expr;            /* type 1, 2, 4 */
28  struct expression* min_expr;        /* type 4 */
29  struct expression* max_expr;        /* type 4 */
30  char* string;                       /* type 3 */
31  int stamp;
32  struct double_array* double_array;  /* type 11, 12 */
33  struct expr_list* expr_list;        /* type 11, 12 */
34  struct char_p_array* m_string;      /* type 13 */
35  struct command_parameter* call_def; /* contains definitions for "bare"
36                                         parameter input, e.g. option,echo */
37};
38
39struct command_parameter_list /* contains list of command parameter pointers */
40{
41  int stamp;
42  char name[NAME_L];
43  int  max,                               /* max. pointer array size */
44       curr;                              /* current occupation */
45  struct command_parameter** parameters;  /* command_parameter pointer list */
46};
47
48// interface
49
50struct command_parameter*       new_command_parameter(char* name, int type);
51struct command_parameter_list*  new_command_parameter_list(int length);
52struct command_parameter*       clone_command_parameter(struct command_parameter*);
53struct command_parameter*       delete_command_parameter(struct command_parameter*);
54struct command_parameter_list*  delete_command_parameter_list(struct command_parameter_list*);
55struct command_parameter*       store_comm_par_def(char* toks[], int start, int end);
56
57struct expression* command_par_expr(const char* parameter, struct command*);
58double  command_par_special(const char* parameter, struct element*);
59char*   command_par_string(const char* parameter, struct command*);
60double  command_par_value(const char* parameter, struct command*);
61int     command_par_value2(const char* parameter, struct command*, double* val);
62struct double_array* command_par_array(const char* parameter, struct command*);
63int     command_par_vector(const char* parameter, struct command*, double* vector);
64void    set_command_par_value(const char* parameter, struct command*, double val);
65void    store_comm_par_value(const char* parameter, double val, struct command*);
66char*   alias(char* par_string);
67void    fill_par_var_list(struct el_list*, struct command_parameter*, struct var_list*);
68int     decode_par(struct in_cmd* cmd, int start, int number, int pos, int log);
69void    store_set(struct command*, int flag);
70void    dump_command_parameter(struct command_parameter*);
71void    export_comm_par(struct command_parameter*, char* string);
72void    grow_command_parameter_list(struct command_parameter_list*);
73void    print_command_parameter(struct command_parameter*);
74int     par_present(char* par, struct command*, struct command_list*);
75void    store_comm_par_vector(const char* parameter, double* val, struct command*);
76void    add_cmd_parameter_clone(struct command*, struct command_parameter*,char* par_name,int inf);
77void    add_cmd_parameter_new(struct command*,double par_value,char* par_name,int inf);
78void    comm_para(char* name, int* n_int, int* n_double, int* n_string, int* int_array, double* double_array, char* strings, int* string_lengths);
79int     log_val(char* name, struct command*);
80
81// void    set_command_par_string(char* parameter, struct command*, char* val); // not used...
82
83// used by Fortran
84double  get_value (char* name, char* par);
85int     get_string(char* name, char* par, char* string);
86int     get_vector(char* name, char* par, double* vector);
87void    set_value (char* name, char* par, double* value);
88
89#endif // MAD_CMDPAR_H
90
Note: See TracBrowser for help on using the repository browser.