source: PSPA/madxPSPA/src/mad_var.h @ 430

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

import madx-5.01.00

File size: 2.0 KB
Line 
1#ifndef MAD_VAR_H
2#define MAD_VAR_H
3
4// types
5
6struct in_cmd;
7struct name_list;
8struct command_list;
9struct expression;
10
11struct constant
12{
13  char name[NAME_L];
14  struct expression* exp;     /* pointer to defining expression (always) */
15  double value;
16  int stamp;
17};
18
19struct variable
20{
21  char name[NAME_L];
22  int status;                 /* 0 value not evaluated, 1 evaluated */
23  int type;                   /* 0 constant, 1 direct, 2 deferred, 3 string */
24  int val_type;               /* 0 int 1 double (0..2) */
25  char* string;               /* pointer to string if 3 */
26  struct expression* expr;    /* pointer to defining expression (0..2) */
27  double value;               /* (0..2) */
28  int stamp;
29};
30
31struct var_list         /* contains list of variable pointers sorted by name */
32{
33  int stamp;
34  char name[NAME_L];
35  int  max,                     /* max. pointer array size */
36       curr;                    /* current occupation */
37  struct name_list* list;       /* index list of names */
38  struct variable** vars;       /* variable pointer list */
39};
40
41// interface
42
43void             enter_variable(struct in_cmd*); /* stores variable contained in cmd */
44struct variable* new_variable(char* name, double val, int val_type, int type, struct expression*, char* string);
45double           variable_value(struct variable*);
46
47struct var_list* new_var_list(int length);
48struct var_list* clone_var_list(struct var_list*);
49struct var_list* delete_var_list(struct var_list*);
50void             add_to_var_list(struct variable*, struct var_list*, int flag);
51struct variable* find_variable(char* name, struct var_list*);
52
53char*   make_string_variable(char* string);
54void    print_global(double delta);
55void    write_vars(struct var_list*, struct command_list*, FILE*);
56void    write_vars_8(struct var_list*, struct command_list*, FILE*);
57void    set_variable(char* name, double* value);
58void    set_stringvar(char* name, char* string);
59double  get_variable(char* name);
60char*   get_varstring(char* name);
61void    get_defined_constants(void);
62
63#endif // MAD_VAR_H
64
Note: See TracBrowser for help on using the repository browser.