]> git.mxchange.org Git - flightgear.git/blobdiff - Time/event.c
Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
[flightgear.git] / Time / event.c
index 8376c4441fc13b017c7a21d0f75b01759e60fd2e..ca362dfb3a4b39b1caf19ea2d532515c30e5bd9d 100644 (file)
 #include <stdio.h>
 
 #ifdef USE_FTIME
+#  include <stdlib.h>
 #  include <sys/timeb.h> /* for ftime() and struct timeb */
 #else
 #  include <sys/time.h>  /* for get/setitimer, gettimeofday, struct timeval */
 #endif /* USE_FTIME */
 
 
-#include "event.h"
+#include <Time/event.h>
 
 
 #define MAX_EVENTS 100    /* size of event table */
@@ -44,7 +45,7 @@
 struct fgEVENT {
     char description[256];
 
-    void (*event)();  /* pointer to function */
+    void (*event)( void );  /* pointer to function */
     int status;       /* status flag */
 
     long interval;    /* interval in ms between each iteration of this event */
@@ -79,13 +80,13 @@ int queue_end;
 
 
 /* initialize the run queue */
-void initq() {
+void initq( void ) {
     queue_front = queue_end = 0;
 }
 
 
 /* return queue empty status */
-int emptyq() {
+int emptyq( void ) {
     if ( queue_front == queue_end ) {
        return(1);
     } else {
@@ -95,7 +96,7 @@ int emptyq() {
 
 
 /* return queue full status */
-int fullq() {
+int fullq( void ) {
     if ( (queue_end + 1) % MAX_RUN_QUEUE == queue_front ) {
        return(1);
     } else {
@@ -120,18 +121,19 @@ void addq(int ptr) {
 
 
 /* remove a member from the front of the queue */
-int popq() {
+int popq( void ) {
     int ptr;
 
-    if ( !emptyq() ) {
+    if ( emptyq() ) {
+       printf("PANIC:  RUN QUEUE IS EMPTY!!!\n");
+       ptr = 0;
+    } else {
        ptr = queue[queue_front];
        /* printf("Popped position %d = %d\n", queue_front, ptr); */
        queue_front = (queue_front + 1) % MAX_RUN_QUEUE;
-       return(ptr);
-    } else {
-       printf("PANIC:  RUN QUEUE IS EMPTY!!!\n");
-       exit(0);
     }
+
+    return(ptr);
 }
 
 
@@ -197,7 +199,7 @@ void fgEventRun(int ptr) {
 
 
 /* Initialize the scheduling subsystem */
-void fgEventInit() {
+void fgEventInit( void ) {
     printf("Initializing event manager\n");
     event_ptr = 0;
     initq();
@@ -206,7 +208,9 @@ void fgEventInit() {
 
 /* Register an event with the scheduler, returns a pointer into the
  * event table */
-int fgEventRegister(char *desc, void (*event)(), int status, int interval) {
+int fgEventRegister(char *desc, void (*event)( void ), int status, 
+                   int interval)
+{
     struct fgEVENT *e;
 
     e = &events[event_ptr];
@@ -239,27 +243,27 @@ int fgEventRegister(char *desc, void (*event)(), int status, int interval) {
 
 
 /* Update the scheduling parameters for an event */
-void fgEventUpdate() {
+void fgEventUpdate( void ) {
 }
 
 
 /* Delete a scheduled event */
-void fgEventDelete() {
+void fgEventDelete( void ) {
 }
 
 
 /* Temporarily suspend scheduling of an event */
-void fgEventSuspend() {
+void fgEventSuspend( void ) {
 }
 
 
 /* Resume scheduling and event */
-void fgEventResume() {
+void fgEventResume( void ) {
 }
 
 
 /* Dump scheduling stats */
-void fgEventPrintStats() {
+void fgEventPrintStats( void ) {
     int i;
 
     if ( event_ptr > 0 ) {
@@ -268,7 +272,7 @@ void fgEventPrintStats() {
        printf("-----------\n");
 
        for ( i = 0; i < event_ptr; i++ ) {
-           printf("  %-20s  int=%.2fs cum=%d min=%d max=%d count=%d ave=%.2f\n",
+           printf("  %-20s  int=%.2fs cum=%ld min=%ld max=%ld count=%ld ave=%.2f\n",
                   events[i].description, 
                   events[i].interval / 1000.0,
                   events[i].cum_time, 
@@ -282,7 +286,7 @@ void fgEventPrintStats() {
 
 /* Add pending jobs to the run queue and run the job at the front of
  * the queue */
-void fgEventProcess() {
+void fgEventProcess( void ) {
 #ifdef USE_FTIME
     struct timeb current;
 #else
@@ -335,9 +339,24 @@ void fgEventProcess() {
 
 
 /* $Log$
-/* Revision 1.4  1997/12/31 17:46:50  curt
-/* Tweaked fg_time.c to be able to use ftime() instead of gettimeofday()
+/* Revision 1.8  1998/01/27 00:48:05  curt
+/* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+/* system and commandline/config file processing code.
 /*
+ * Revision 1.7  1998/01/19 19:27:19  curt
+ * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
+ * This should simplify things tremendously.
+ *
+ * Revision 1.6  1998/01/19 18:40:39  curt
+ * Tons of little changes to clean up the code and to remove fatal errors
+ * when building with the c++ compiler.
+ *
+ * Revision 1.5  1998/01/06 01:20:27  curt
+ * Tweaks to help building with MSVC++
+ *
+ * Revision 1.4  1997/12/31 17:46:50  curt
+ * Tweaked fg_time.c to be able to use ftime() instead of gettimeofday()
+ *
  * Revision 1.3  1997/12/30 22:22:42  curt
  * Further integration of event manager.
  *