#include "event.h" #include "regex.h" #include "simulate.h" /* input event streams */ template static void FileInputEvent::CreateInputStream(InputInterface *iface) { double time = iface->peekNextTime(); if (time == INFINITY) { delete iface; return; } if (time < s.currentTime) { DIE("tried to include a file with events of the past"); } s.addEvent(new FileInputEvent(iface, time)); } template void FileInputEvent::vexecute() { iface->readFileUntil(time); CreateInputStream(iface); } /* command loop */ bool executeTracepoints() { // the main loop of the program char *str = NULL; size_t _foo; // loop over trace commands while (getline(&str, &_foo, stdin) > 0) { // parse request if (!regex::parseRequest(str)) DIE("Invalid tracepoint format"); // proceed time if a run command was given if (regex::targetTimeOffset != 0.0) { if (!s.proceedTime(s.currentTime + tracepoints::targetTimeOffset)) fprintf(stderr, "Warning: network is dead\n"); // reset target time targetTimeOffset = 0.0; // reset spike output list BOOST_FOREARCH(SpikeMUX *i, s.spikeOIfList) { delete i; } s.spikeOIfList.empty(); } free(str); str = NULL; } return true; }