source: PSPA/madxPSPA/src/mad_expr.h @ 478

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

import madx-5.01.00

File size: 2.0 KB
Line 
1#ifndef MAD_EXPR_H
2#define MAD_EXPR_H
3
4// types
5
6struct int_array;
7struct double_array;
8struct el_list;
9struct var_list;
10
11struct expression
12{
13  char name[NAME_L];
14  char* string;                 /* expression in string form */
15  int status;                   /* status flag: 0 not evaluated
16                                                1 evaluated */
17  struct int_array* polish;     /* pointer to Polish notation, or NULL */
18  double value;                 /* actual value */
19  int stamp;
20};
21
22struct expr_list
23{
24  int stamp;
25  char name[NAME_L];
26  int  max,                     /* max. pointer array size */
27       curr;                    /* current occupation */
28  struct expression** list;     /* expression pointer list */
29};
30
31// interface
32
33struct expression* make_expression(int n, char** toks);
34struct expression* new_expression(char* in_string, struct int_array*);
35struct expression* clone_expression(struct expression*);
36struct expression* delete_expression(struct expression*);
37struct expression* scale_expr(struct expression*, double scale);
38struct expression* compound_expr(struct expression*, double v1, char* oper, struct expression*, double v2);
39double             expr_combine(struct expression*, double v1, char* oper, struct expression*, double v2, struct expression**);
40double             expression_value(struct expression*, int flag); /* recursive */
41void               dump_expression(struct expression*);
42
43struct expr_list* new_expr_list(int length);
44struct expr_list* clone_expr_list(struct expr_list*);
45struct expr_list* delete_expr_list(struct expr_list*);
46void              grow_expr_list(struct expr_list*);
47void              fill_expr_list(char** toks, int s_start, int s_end, struct expr_list*);
48void              fill_expr_var_list(struct el_list*, struct expression*, struct var_list*);
49void              update_vector(struct expr_list*, struct double_array*);
50
51double  double_from_expr(char** toks, int s_start, int s_end);
52int     loc_expr(char** items, int nit, int start, int* end);
53int     scan_expr(int c_item, char** item);
54
55#endif // MAD_EXPR_H
56
Note: See TracBrowser for help on using the repository browser.