You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is in our power to fix -- it seems subtly related to the way the C/C++ highlighter that we delegate to works -- but it does not look good.
The following is highlighted correctly:
targetC {
threading: true,
cmake-include: "include/federate__receiver_extension.cmake",
keepalive: true,
tracing: true,
compile-definitions: {
EXECUTABLE_PREAMBLE: "",
WORKERS_NEEDED_FOR_FEDERATE: "2",
NUMBER_OF_FEDERATES: "2",
FEDERATED: "",
FEDERATED_CENTRALIZED: ""
},
_fed_setup: "include/_federate__receiver_preamble.h"
}
preamble {=// #ifdef __cplusplus
{
// #endif#include"core/federated/federate.h"#include"core/federated/net_common.h"#include"core/federated/net_util.h"#include"core/federated/clock-sync.h"#include"core/threaded/reactor_threaded.h"#include"core/utils/util.h"externfederate_instance_t_fed;
// #ifdef __cplusplus
}
// #endif=}
reactorReceiver(
stp_offset: time=10msec// Used in the decentralized variant of the test
) {
inputin: intstatereaction_invoked_correctly: bool= false
reaction(in) {=lf_print("Received %d at (%lld, %u).",
in->value,
lf_time_logical_elapsed(),
lf_tag().microstep);
if (lf_time_logical_elapsed() ==USEC(1)) {
lf_print("Requesting stop at (%lld, %u).",
lf_time_logical_elapsed(),
lf_tag().microstep);
lf_request_stop();
// The receiver should receive a message at tag// (1 usec, 1) and trigger this reactionself->reaction_invoked_correctly= true;
}
tag_t_1usec1= (tag_t) { .time=USEC(1) +lf_time_start(), .microstep=1u };
if (lf_tag_compare(lf_tag(), _1usec1) >0) {
self->reaction_invoked_correctly= false;
}
=}
reaction(shutdown) {=// Sender should have requested stop earlier than the receiver.// Therefore, the shutdown events must occur at (1000, 0) on the// receiver.if (lf_time_logical_elapsed() !=USEC(1) ||lf_tag().microstep!=1) {
lf_print_error_and_exit("Receiver failed to stop the federation at the right time. ""Stopping at (%lld, %u).",
lf_time_logical_elapsed(),
lf_tag().microstep);
} elseif (self->reaction_invoked_correctly== false) {
lf_print_error_and_exit("Receiver reaction(in) was not invoked the correct number of times. ""Stopping at (%lld, %u).",
lf_time_logical_elapsed(),
lf_tag().microstep);
}
lf_print("SUCCESS: Successfully stopped the federation at (%lld, %u).",
lf_time_logical_elapsed(),
lf_tag().microstep);
=}
}
reactorNetworkReceiver_0 {
outputmsg: intlogicalactionnetworkMessage_0: intreaction(networkMessage_0) ->msg {=msg->physical_time_of_arrival=self->_lf__networkMessage_0.physical_time_of_arrival;
lf_set(msg, networkMessage_0->value);
=}
}
@_fed_config(network_message_actions="networkMessage_0", dependencyPairs="")
mainreactor {
receiver=newReceiver()
nr_federate__receiver=newNetworkReceiver_0()
nr_federate__receiver.msg->receiver.in
}
But the following is not handled correctly:
targetC {
threading: true,
cmake-include: "include/federate__receiver_extension.cmake",
keepalive: true,
tracing: true,
compile-definitions: {
EXECUTABLE_PREAMBLE: "",
WORKERS_NEEDED_FOR_FEDERATE: "2",
NUMBER_OF_FEDERATES: "2",
FEDERATED: "",
FEDERATED_CENTRALIZED: ""
},
_fed_setup: "include/_federate__receiver_preamble.h"
}
preamble {=// #ifdef __cplusplusextern"C" {
// #endif#include"core/federated/federate.h"#include"core/federated/net_common.h"#include"core/federated/net_util.h"#include"core/federated/clock-sync.h"#include"core/threaded/reactor_threaded.h"#include"core/utils/util.h"externfederate_instance_t_fed;
// #ifdef __cplusplus
}
// #endif=}
reactorReceiver(
stp_offset: time=10msec// Used in the decentralized variant of the test
) {
inputin: intstatereaction_invoked_correctly: bool= false
reaction(in) {=lf_print("Received %d at (%lld, %u).",
in->value,
lf_time_logical_elapsed(),
lf_tag().microstep);
if (lf_time_logical_elapsed() ==USEC(1)) {
lf_print("Requesting stop at (%lld, %u).",
lf_time_logical_elapsed(),
lf_tag().microstep);
lf_request_stop();
// The receiver should receive a message at tag// (1 usec, 1) and trigger this reactionself->reaction_invoked_correctly= true;
}
tag_t_1usec1= (tag_t) { .time=USEC(1) +lf_time_start(), .microstep=1u };
if (lf_tag_compare(lf_tag(), _1usec1) >0) {
self->reaction_invoked_correctly= false;
}
=}
reaction(shutdown) {=// Sender should have requested stop earlier than the receiver.// Therefore, the shutdown events must occur at (1000, 0) on the// receiver.if (lf_time_logical_elapsed() !=USEC(1) ||lf_tag().microstep!=1) {
lf_print_error_and_exit("Receiver failed to stop the federation at the right time. ""Stopping at (%lld, %u).",
lf_time_logical_elapsed(),
lf_tag().microstep);
} elseif (self->reaction_invoked_correctly== false) {
lf_print_error_and_exit("Receiver reaction(in) was not invoked the correct number of times. ""Stopping at (%lld, %u).",
lf_time_logical_elapsed(),
lf_tag().microstep);
}
lf_print("SUCCESS: Successfully stopped the federation at (%lld, %u).",
lf_time_logical_elapsed(),
lf_tag().microstep);
=}
}
reactorNetworkReceiver_0 {
outputmsg: intlogicalactionnetworkMessage_0: intreaction(networkMessage_0) ->msg {=msg->physical_time_of_arrival=self->_lf__networkMessage_0.physical_time_of_arrival;
lf_set(msg, networkMessage_0->value);
=}
}
@_fed_config(network_message_actions="networkMessage_0", dependencyPairs="")
mainreactor {
receiver=newReceiver()
nr_federate__receiver=newNetworkReceiver_0()
nr_federate__receiver.msg->receiver.in
}
The entire file after the preamble is highlighted as if it were plain C.
Note the extern "C" appearing in the preamble. That is the only difference.
The text was updated successfully, but these errors were encountered:
I'm not sure if this is in our power to fix -- it seems subtly related to the way the C/C++ highlighter that we delegate to works -- but it does not look good.
The following is highlighted correctly:
But the following is not handled correctly:
The entire file after the preamble is highlighted as if it were plain C.
Note the
extern "C"
appearing in the preamble. That is the only difference.The text was updated successfully, but these errors were encountered: