src/timer/riscos/SDL_systimer.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/src/timer/riscos/SDL_systimer.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/src/timer/riscos/SDL_systimer.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -37,34 +37,34 @@
     1.4  /* Timer  SDL_arraysize(Timer ),start/reset time */
     1.5  static Uint32 timerStart;
     1.6  /* Timer running function */
     1.7 -void RISCOS_CheckTimer ();
     1.8 +void RISCOS_CheckTimer();
     1.9  #else
    1.10  #include <pthread.h>
    1.11  extern Uint32 riscos_main_thread;
    1.12  extern int riscos_using_threads;
    1.13 -extern Uint32 SDL_ThreadID ();
    1.14 -extern Uint32 SDL_EventThreadID (void);
    1.15 +extern Uint32 SDL_ThreadID();
    1.16 +extern Uint32 SDL_EventThreadID(void);
    1.17  #endif
    1.18  
    1.19  
    1.20 -extern void RISCOS_BackgroundTasks (void);
    1.21 +extern void RISCOS_BackgroundTasks(void);
    1.22  
    1.23  /* The first ticks value of the application */
    1.24  clock_t start;
    1.25  
    1.26  void
    1.27 -SDL_StartTicks (void)
    1.28 +SDL_StartTicks(void)
    1.29  {
    1.30      /* Set first ticks value */
    1.31 -    start = clock ();
    1.32 +    start = clock();
    1.33  }
    1.34  
    1.35  Uint32
    1.36 -SDL_GetTicks (void)
    1.37 +SDL_GetTicks(void)
    1.38  {
    1.39      clock_t ticks;
    1.40  
    1.41 -    ticks = clock () - start;
    1.42 +    ticks = clock() - start;
    1.43  
    1.44  
    1.45  #if CLOCKS_PER_SEC == 1000
    1.46 @@ -84,17 +84,17 @@
    1.47  }
    1.48  
    1.49  void
    1.50 -SDL_Delay (Uint32 ms)
    1.51 +SDL_Delay(Uint32 ms)
    1.52  {
    1.53      Uint32 now, then, elapsed;
    1.54  #if !SDL_THREADS_DISABLED
    1.55      int is_event_thread;
    1.56      if (riscos_using_threads) {
    1.57          is_event_thread = 0;
    1.58 -        if (SDL_EventThreadID ()) {
    1.59 -            if (SDL_EventThreadID () == SDL_ThreadID ())
    1.60 +        if (SDL_EventThreadID()) {
    1.61 +            if (SDL_EventThreadID() == SDL_ThreadID())
    1.62                  is_event_thread = 1;
    1.63 -        } else if (SDL_ThreadID () == riscos_main_thread)
    1.64 +        } else if (SDL_ThreadID() == riscos_main_thread)
    1.65              is_event_thread = 1;
    1.66      } else
    1.67          is_event_thread = 1;
    1.68 @@ -104,20 +104,20 @@
    1.69      /*      for non event threads */
    1.70  
    1.71      /* Set the timeout interval - Linux only needs to do this once */
    1.72 -    then = SDL_GetTicks ();
    1.73 +    then = SDL_GetTicks();
    1.74  
    1.75      do {
    1.76          /* Do background tasks required while sleeping as we are not multithreaded */
    1.77  #if SDL_THREADS_DISABLED
    1.78 -        RISCOS_BackgroundTasks ();
    1.79 +        RISCOS_BackgroundTasks();
    1.80  #else
    1.81          /* For threaded build only run background tasks in event thread */
    1.82          if (is_event_thread)
    1.83 -            RISCOS_BackgroundTasks ();
    1.84 +            RISCOS_BackgroundTasks();
    1.85  #endif
    1.86  
    1.87          /* Calculate the time interval left (in case of interrupt) */
    1.88 -        now = SDL_GetTicks ();
    1.89 +        now = SDL_GetTicks();
    1.90          elapsed = (now - then);
    1.91          then = now;
    1.92          if (elapsed >= ms) {
    1.93 @@ -127,7 +127,7 @@
    1.94  #if !SDL_THREADS_DISABLED
    1.95          /* Need to yield to let other threads have a go */
    1.96          if (riscos_using_threads)
    1.97 -            pthread_yield ();
    1.98 +            pthread_yield();
    1.99  #endif
   1.100  
   1.101      }
   1.102 @@ -139,27 +139,27 @@
   1.103  /* Non-threaded version of timer */
   1.104  
   1.105  int
   1.106 -SDL_SYS_TimerInit (void)
   1.107 +SDL_SYS_TimerInit(void)
   1.108  {
   1.109      return (0);
   1.110  }
   1.111  
   1.112  void
   1.113 -SDL_SYS_TimerQuit (void)
   1.114 +SDL_SYS_TimerQuit(void)
   1.115  {
   1.116 -    SDL_SetTimer (0, NULL);
   1.117 +    SDL_SetTimer(0, NULL);
   1.118  }
   1.119  
   1.120  int
   1.121 -SDL_SYS_StartTimer (void)
   1.122 +SDL_SYS_StartTimer(void)
   1.123  {
   1.124 -    timerStart = SDL_GetTicks ();
   1.125 +    timerStart = SDL_GetTicks();
   1.126  
   1.127      return (0);
   1.128  }
   1.129  
   1.130  void
   1.131 -SDL_SYS_StopTimer (void)
   1.132 +SDL_SYS_StopTimer(void)
   1.133  {
   1.134      /* Don't need to do anything as we use SDL_timer_running
   1.135         to detect if we need to check the timer */
   1.136 @@ -167,23 +167,23 @@
   1.137  
   1.138  
   1.139  void
   1.140 -RISCOS_CheckTimer ()
   1.141 +RISCOS_CheckTimer()
   1.142  {
   1.143      if (SDL_timer_running
   1.144 -        && SDL_GetTicks () - timerStart >= SDL_alarm_interval) {
   1.145 +        && SDL_GetTicks() - timerStart >= SDL_alarm_interval) {
   1.146          Uint32 ms;
   1.147  
   1.148 -        ms = SDL_alarm_callback (SDL_alarm_interval);
   1.149 +        ms = SDL_alarm_callback(SDL_alarm_interval);
   1.150          if (ms != SDL_alarm_interval) {
   1.151              if (ms) {
   1.152 -                SDL_alarm_interval = ROUND_RESOLUTION (ms);
   1.153 +                SDL_alarm_interval = ROUND_RESOLUTION(ms);
   1.154              } else {
   1.155                  SDL_alarm_interval = 0;
   1.156                  SDL_timer_running = 0;
   1.157              }
   1.158          }
   1.159          if (SDL_alarm_interval)
   1.160 -            timerStart = SDL_GetTicks ();
   1.161 +            timerStart = SDL_GetTicks();
   1.162      }
   1.163  }
   1.164  
   1.165 @@ -198,47 +198,47 @@
   1.166  static SDL_Thread *timer = NULL;
   1.167  
   1.168  static int
   1.169 -RunTimer (void *unused)
   1.170 +RunTimer(void *unused)
   1.171  {
   1.172      while (timer_alive) {
   1.173          if (SDL_timer_running) {
   1.174 -            SDL_ThreadedTimerCheck ();
   1.175 +            SDL_ThreadedTimerCheck();
   1.176          }
   1.177 -        SDL_Delay (1);
   1.178 +        SDL_Delay(1);
   1.179      }
   1.180      return (0);
   1.181  }
   1.182  
   1.183  /* This is only called if the event thread is not running */
   1.184  int
   1.185 -SDL_SYS_TimerInit (void)
   1.186 +SDL_SYS_TimerInit(void)
   1.187  {
   1.188      timer_alive = 1;
   1.189 -    timer = SDL_CreateThread (RunTimer, NULL);
   1.190 +    timer = SDL_CreateThread(RunTimer, NULL);
   1.191      if (timer == NULL)
   1.192          return (-1);
   1.193 -    return (SDL_SetTimerThreaded (1));
   1.194 +    return (SDL_SetTimerThreaded(1));
   1.195  }
   1.196  
   1.197  void
   1.198 -SDL_SYS_TimerQuit (void)
   1.199 +SDL_SYS_TimerQuit(void)
   1.200  {
   1.201      timer_alive = 0;
   1.202      if (timer) {
   1.203 -        SDL_WaitThread (timer, NULL);
   1.204 +        SDL_WaitThread(timer, NULL);
   1.205          timer = NULL;
   1.206      }
   1.207  }
   1.208  
   1.209  int
   1.210 -SDL_SYS_StartTimer (void)
   1.211 +SDL_SYS_StartTimer(void)
   1.212  {
   1.213 -    SDL_SetError ("Internal logic error: RISC OS uses threaded timer");
   1.214 +    SDL_SetError("Internal logic error: RISC OS uses threaded timer");
   1.215      return (-1);
   1.216  }
   1.217  
   1.218  void
   1.219 -SDL_SYS_StopTimer (void)
   1.220 +SDL_SYS_StopTimer(void)
   1.221  {
   1.222      return;
   1.223  }