Numworks Epsilon  1.4.1
Graphing Calculator Operating System
events.cpp
Go to the documentation of this file.
1 #include <ion/events.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include "display.h"
5 
6 namespace Ion {
7 namespace Events {
8 
9 static int sLogAfterNumberOfEvents = -1;
10 static int sEventCount = 0;
11 
12 Event getEvent(int * timeout) {
14  while (!(event.isDefined() && event.isKeyboardEvent())) {
15  int c = getchar();
16  if (c == EOF) {
17  printf("Finished processing %d events\n", sEventCount);
19  break;
20  }
21  event = Ion::Events::Event(c);
22  }
23  if (sEventCount++ > sLogAfterNumberOfEvents && sLogAfterNumberOfEvents >= 0) {
24  char filename[32];
25  sprintf(filename, "event%d.png", sEventCount);
27 #if DEBUG
28  printf("Event %d is %s\n", sEventCount, event.name());
29 #endif
30  }
31  return event;
32 }
33 
34 namespace Blackbox {
35 
36 void dumpEventCount(int i) {
37  printf("Current event index: %d\n", sEventCount);
38 }
39 
40 void logAfter(int numberOfEvents) {
41  sLogAfterNumberOfEvents = numberOfEvents;
42 }
43 
44 }
45 
46 }
47 }
Event getEvent(int *timeout)
Definition: events.cpp:12
#define EOF
Definition: stdio.h:6
constexpr Event None
Definition: events.h:215
c(generic_all_nodes)
void logAfter(int numberOfEvents)
Definition: events.cpp:40
void writeFrameBufferToFile(const char *filename)
Definition: display.cpp:52
Definition: backlight.h:6
void dumpEventCount(int i)
Definition: events.cpp:36
constexpr Event Termination
Definition: events.h:216