home *** CD-ROM | disk | FTP | other *** search
- /* riscos.h -- Jonix RISC OS polling library
- */
-
- #define riscos
- #include "swis.h"
- #define riscos_TIMESLICE 5 // cs
- #define riscos_WAIT 15 // cs
-
- unsigned int riscos_TASKHANDLE = 0;
- int riscos_LAST = 0;
- int *riscos_POLLBLOCK;
-
- void riscos_initialise (void)
- {
- int messages[1]={0};
- riscos_TASKHANDLE = _swi (Wimp_Initialise, _IN(0)|_IN(1)|_IN(2)|_IN(3)|_RETURN(1),
- 310, 0x4b534154, "Jonix", messages);
- riscos_POLLBLOCK = (int *) malloc (256);
- _swi (OS_ReadMonotonicTime, _OUT(0), &riscos_LAST);
- }
-
- void riscos_shutdown (void)
- {
- _swi (Wimp_CloseDown, _IN(0)|_IN(1), riscos_TASKHANDLE, 0x4b534154);
- }
-
- void riscos_poll (FILE *fin)
- {
- int current_time, action;
- _swi (OS_ReadMonotonicTime, _OUT(0), ¤t_time);
- if ((riscos_LAST + riscos_TIMESLICE) < current_time)
- {
- _swi (Wimp_PollIdle, _IN(0)|_IN(1)|_IN(2)|_OUT(0), 0, riscos_POLLBLOCK, current_time + riscos_WAIT, &action);
- _swi (OS_ReadMonotonicTime, _OUT(0), &riscos_LAST);
- }
- }
-