Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj committed May 20, 2024
1 parent e2f4d45 commit 49f337f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
6 changes: 3 additions & 3 deletions include/reactor-uc/tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ tag_t lf_tag(void *env);
* If the time field of the second tag is greater than 0, then the microstep of the first tag
* is reset to 0 before adding. This models the delay semantics in LF and makes this
* addition operation non-commutative.
* @param a The first tag.
* @param b The second tag.
* @param tag1 The first tag.
* @param tag2 The second tag.
*/
tag_t lf_tag_add(tag_t a, tag_t b);
tag_t lf_tag_add(tag_t tag1, tag_t tag2);

/**
* Compare two tags. Return -1 if the first is less than
Expand Down
9 changes: 5 additions & 4 deletions src/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
#include "reactor-uc/reactor-uc.h"
#include "reactor-uc/scheduler.h"

static void _reset_is_present_recursive(Reactor *reactor) {
// FIXME: How?
}
// static void _reset_is_present_recursive(Reactor *reactor) {
// (void)reactor;
// // FIXME: How?
// }

void Scheduler_prepare_timestep(Scheduler *self) {
self->reaction_queue.reset(&self->reaction_queue);

// FIXME: Improve this expensive resetting of all `is_present` fields of triggers.

Environment *env = self->env;
for (int i = 0; i < env->reactors_size; i++) {
for (size_t i = 0; i < env->reactors_size; i++) {
}
}
void Scheduler_run(Scheduler *self) {
Expand Down
18 changes: 9 additions & 9 deletions src/tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ tag_t lf_tag(void *env) {
return ((Environment *)env)->current_tag;
}

tag_t lf_tag_add(tag_t a, tag_t b) {
if (a.time == NEVER || b.time == NEVER) {
tag_t lf_tag_add(tag_t tag1, tag_t tag2) {
if (tag1.time == NEVER || tag2.time == NEVER) {
return NEVER_TAG;
}
if (a.time == FOREVER || b.time == FOREVER) {
if (tag1.time == FOREVER || tag2.time == FOREVER) {
return FOREVER_TAG;
}
if (b.time > 0) {
a.microstep = 0; // Ignore microstep of first arg if time of second is > 0.
if (tag2.time > 0) {
tag1.microstep = 0; // Ignore microstep of first arg if time of second is > 0.
}
tag_t result = {.time = a.time + b.time, .microstep = a.microstep + b.microstep};
if (result.microstep < a.microstep) {
tag_t result = {.time = tag1.time + tag2.time, .microstep = tag1.microstep + tag2.microstep};
if (result.microstep < tag1.microstep) {
return FOREVER_TAG;
}
if (result.time < a.time && b.time > 0) {
if (result.time < tag1.time && tag2.time > 0) {
return FOREVER_TAG;
}
if (result.time > a.time && b.time < 0) {
if (result.time > tag1.time && tag2.time < 0) {
return NEVER_TAG;
}
return result;
Expand Down

0 comments on commit 49f337f

Please sign in to comment.