naspro

view permafrost/src/types.h @ 178:7169a8909d53

Added Permafrost + small changes
author Stefano D'Angelo <zanga.mail@gmail.com>
date Sun May 02 14:19:58 2010 +0300 (2010-05-02)
parents
children
line source
1 /*
2 * Permafrost - Physical modelling framework
3 *
4 * Copyright (C) 2009, 2010 Stefano D'Angelo <zanga.mail@gmail.com>
5 *
6 * See the COPYING file for license conditions.
7 */
9 #ifndef _TYPES_H_
10 #define _TYPES_H_
12 #include <stddef.h>
14 typedef struct _list * list_t;
15 typedef struct _expr * expr_t;
17 enum port_type
18 {
19 port_type_input,
20 port_type_output,
21 port_type_w,
22 port_type_k
23 };
25 enum port_sync
26 {
27 port_sync_unknown,
28 port_sync_sync,
29 port_sync_async
30 };
32 enum conn_elem_type
33 {
34 conn_elem_type_value,
35 conn_elem_type_port,
36 conn_elem_type_in,
37 conn_elem_type_out
38 };
40 enum delay_buf_type
41 {
42 delay_buf_type_none,
43 delay_buf_type_single,
44 delay_buf_type_fixed,
45 delay_buf_type_var
46 };
48 struct const_v
49 {
50 char *id;
51 double value;
52 };
54 struct ext_func
55 {
56 char *id;
57 char *f_id;
58 char *d_id;
59 unsigned long n_args;
60 char *include;
61 char *lib;
62 };
64 struct port
65 {
66 enum port_sync sync;
67 enum port_type type;
68 char *id;
69 };
71 struct component
72 {
73 union
74 {
75 char *id;
76 struct
77 {
78 char is_macro;
79 void *p;
80 } t;
81 } type;
82 char *id;
83 };
85 struct conn_elem
86 {
87 enum conn_elem_type type;
88 union
89 {
90 struct
91 {
92 char *component;
93 char *port;
94 } id;
95 struct
96 {
97 struct component *component;
98 struct port *port;
99 } p;
100 double value;
101 } c;
102 };
104 struct connection
105 {
106 struct conn_elem output;
107 struct conn_elem input;
108 };
110 struct stmt
111 {
112 union
113 {
114 struct
115 {
116 char *id;
117 char out;
118 } id;
119 struct port *port;
120 } out;
121 expr_t expr;
122 };
124 struct block
125 {
126 char *id;
127 list_t ports;
128 list_t stmts;
129 };
131 struct system
132 {
133 char *id;
134 list_t ports;
135 list_t components;
136 list_t connections;
137 };
139 struct expr_signal_id
140 {
141 char *id;
142 char in;
143 };
145 struct delay
146 {
147 expr_t delay;
148 expr_t delay_max;
149 };
151 struct scheduled_expr
152 {
153 struct component *component;
154 struct port *port;
155 char is_output;
156 expr_t expr;
157 list_t refs;
158 list_t df_refs;
159 list_t is_refd;
160 char is_df_refd;
161 size_t df_refd_count;
162 list_t delays;
163 enum delay_buf_type db_type;
164 double delay_min;
165 size_t index;
166 };
168 struct scheduled_system
169 {
170 struct system *system;
171 list_t exprs;
172 list_t schedule;
173 list_t schedule_d;
174 char has_single_delay;
175 char has_fixed_delay;
176 char has_var_delay;
177 char uses_sample_rate;
178 };
180 #endif /* !_TYPES_H_ */