136136 BufferType value[(ArrayLen)]; \
137137 } ReactorName##_##PortName;
138138
139+ #define LF_DEFINE_OUTPUT_VOID_STRUCT (ReactorName , PortName , SourceSize ) \
140+ typedef struct { \
141+ Port super; \
142+ Reaction* sources[(SourceSize)]; \
143+ } ReactorName##_##PortName;
144+
139145#define LF_DEFINE_OUTPUT_CTOR (ReactorName , PortName , SourceSize ) \
140146 void ReactorName##_##PortName##_ctor(ReactorName##_##PortName* self, Reactor* parent, \
141147 OutputExternalCtorArgs external) { \
144150 external.parent_observers_size, external.conns_out, external.conns_out_size); \
145151 }
146152
153+ #define LF_DEFINE_OUTPUT_VOID_CTOR (ReactorName , PortName , SourceSize ) \
154+ void ReactorName##_##PortName##_ctor(ReactorName##_##PortName* self, Reactor* parent, \
155+ OutputExternalCtorArgs external) { \
156+ Port_ctor(&self->super, TRIG_OUTPUT, parent, NULL, 0, external.parent_effects, external.parent_effects_size, \
157+ self->sources, SourceSize, external.parent_observers, external.parent_observers_size, \
158+ external.conns_out, external.conns_out_size); \
159+ }
160+
147161#define LF_PORT_INSTANCE (ReactorName , PortName , PortWidth ) ReactorName##_##PortName PortName[PortWidth];
148162#define LF_PORT_PTR_INSTANCE (ReactorName , PortName ) ReactorName##_##PortName* PortName;
149163#define LF_MULTIPORT_PTR_INSTANCE (ReactorName , PortName , PortWidth ) \
181195 Connection* conns_out[(NumConnsOut)]; \
182196 } ReactorName##_##PortName;
183197
198+ #define LF_DEFINE_INPUT_VOID_STRUCT (ReactorName , PortName , EffectSize , ObserversSize , NumConnsOut ) \
199+ typedef struct { \
200+ Port super; \
201+ Reaction* effects[(EffectSize)]; \
202+ Reaction* observers[(ObserversSize)]; \
203+ Connection* conns_out[(NumConnsOut)]; \
204+ } ReactorName##_##PortName;
205+
184206#define LF_DEFINE_INPUT_CTOR (ReactorName , PortName , EffectSize , ObserverSize , BufferType , NumConnsOut ) \
185207 void ReactorName##_##PortName##_ctor(ReactorName##_##PortName* self, Reactor* parent, \
186208 InputExternalCtorArgs external) { \
189211 (Connection**)&self->conns_out, NumConnsOut); \
190212 }
191213
214+ #define LF_DEFINE_INPUT_VOID_CTOR (ReactorName , PortName , EffectSize , ObserverSize , NumConnsOut ) \
215+ void ReactorName##_##PortName##_ctor(ReactorName##_##PortName* self, Reactor* parent, \
216+ InputExternalCtorArgs external) { \
217+ Port_ctor(&self->super, TRIG_INPUT, parent, NULL, 0, self->effects, (EffectSize), external.parent_sources, \
218+ external.parent_sources_size, self->observers, ObserverSize, (Connection**)&self->conns_out, \
219+ NumConnsOut); \
220+ }
221+
192222#define LF_DEFINE_TIMER_STRUCT (ReactorName , TimerName , EffectSize , ObserversSize ) \
193223 typedef struct { \
194224 Timer super; \
438468 DelayedConnection super; \
439469 BufferType payload_buf[(BufferSize)]; \
440470 bool payload_used_buf[(BufferSize)]; \
441- Port* downstreams[(BufferSize )]; \
471+ Port* downstreams[(DownstreamSize )]; \
442472 } ParentName##_##ConnName;
443473
444474#define LF_DEFINE_DELAYED_CONNECTION_STRUCT_ARRAY (ParentName , ConnName , DownstreamSize , BufferType , BufferSize , \
447477 DelayedConnection super; \
448478 BufferType payload_buf[(BufferSize)][(ArrayLength)]; \
449479 bool payload_used_buf[(BufferSize)]; \
450- Port* downstreams[(BufferSize)]; \
480+ Port* downstreams[(DownstreamSize)]; \
481+ } ParentName##_##ConnName;
482+
483+ #define LF_DEFINE_DELAYED_CONNECTION_STRUCT_VOID (ParentName , ConnName , DownstreamSize ) \
484+ typedef struct { \
485+ DelayedConnection super; \
486+ Port* downstreams[(DownstreamSize)]; \
451487 } ParentName##_##ConnName;
452488
453489#define LF_DEFINE_DELAYED_CONNECTION_CTOR (ParentName , ConnName , DownstreamSize , BufferSize , IsPhysical ) \
456492 sizeof(self->payload_buf[0]), (void*)self->payload_buf, self->payload_used_buf, \
457493 BufferSize); \
458494 }
495+
496+ #define LF_DEFINE_DELAYED_CONNECTION_VOID_CTOR (ParentName , ConnName , DownstreamSize , IsPhysical ) \
497+ void ParentName##_##ConnName##_ctor(ParentName##_##ConnName* self, Reactor* parent, interval_t delay) { \
498+ DelayedConnection_ctor(&self->super, parent, self->downstreams, DownstreamSize, delay, IsPhysical, 0, NULL, NULL, \
499+ 0); \
500+ }
501+
459502// FIXME: Duplicated
460503#define LF_DELAYED_CONNECTION_INSTANCE (ParentName , ConnName , BankWidth , PortWidth ) \
461504 ParentName##_##ConnName ConnName[BankWidth][PortWidth];
@@ -481,12 +524,22 @@ typedef struct FederatedOutputConnection FederatedOutputConnection;
481524 BufferType payload_buf[1][(ArrayLength)]; \
482525 } ReactorName##_##OutputName##_conn;
483526
527+ #define LF_DEFINE_FEDERATED_OUTPUT_CONNECTION_STRUCT_VOID (ReactorName , OutputName ) \
528+ typedef struct { \
529+ FederatedOutputConnection super; \
530+ } ReactorName##_##OutputName##_conn;
531+
484532#define LF_DEFINE_FEDERATED_OUTPUT_CONNECTION_CTOR (ReactorName , OutputName , BufferType , DestinationConnId ) \
485533 void ReactorName##_##OutputName##_conn_ctor(ReactorName##_##OutputName##_conn* self, Reactor* parent, \
486534 FederatedConnectionBundle* bundle) { \
487535 FederatedOutputConnection_ctor(&self->super, parent, bundle, DestinationConnId, (void*)&self->payload_buf, \
488536 sizeof(self->payload_buf[0])); \
489537 }
538+ #define LF_DEFINE_FEDERATED_OUTPUT_CONNECTION_VOID_CTOR (ReactorName , OutputName , DestinationConnId ) \
539+ void ReactorName##_##OutputName##_conn_ctor(ReactorName##_##OutputName##_conn* self, Reactor* parent, \
540+ FederatedConnectionBundle* bundle) { \
541+ FederatedOutputConnection_ctor(&self->super, parent, bundle, DestinationConnId, NULL, 0); \
542+ }
490543
491544#define LF_FEDERATED_OUTPUT_CONNECTION_INSTANCE (ReactorName , OutputName ) ReactorName##_##OutputName##_conn OutputName
492545
@@ -544,6 +597,12 @@ typedef struct FederatedInputConnection FederatedInputConnection;
544597 Port* downstreams[1]; \
545598 } ReactorName##_##InputName##_conn;
546599
600+ #define LF_DEFINE_FEDERATED_INPUT_CONNECTION_STRUCT_VOID (ReactorName , InputName ) \
601+ typedef struct { \
602+ FederatedInputConnection super; \
603+ Port* downstreams[1]; \
604+ } ReactorName##_##InputName##_conn;
605+
547606#define LF_DEFINE_FEDERATED_INPUT_CONNECTION_CTOR (ReactorName , InputName , BufferType , BufferSize , Delay , IsPhysical , \
548607 MaxWait ) \
549608 void ReactorName##_##InputName##_conn_ctor(ReactorName##_##InputName##_conn* self, Reactor* parent) { \
@@ -552,6 +611,12 @@ typedef struct FederatedInputConnection FederatedInputConnection;
552611 sizeof(self->payload_buf[0]), BufferSize); \
553612 }
554613
614+ #define LF_DEFINE_FEDERATED_INPUT_CONNECTION_VOID_CTOR (ReactorName , InputName , Delay , IsPhysical , MaxWait ) \
615+ void ReactorName##_##InputName##_conn_ctor(ReactorName##_##InputName##_conn* self, Reactor* parent) { \
616+ FederatedInputConnection_ctor(&self->super, parent, Delay, IsPhysical, MaxWait, (Port**)&self->downstreams, 1, \
617+ NULL, NULL, 0, 0); \
618+ }
619+
555620#define LF_FEDERATED_INPUT_CONNECTION_INSTANCE (ReactorName , InputName ) ReactorName##_##InputName##_conn InputName
556621
557622#define LF_DEFINE_STARTUP_COORDINATOR_STRUCT (ReactorName , NumNeighbors , NumEvents ) \
0 commit comments