home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/devices.h>
- #include <exec/memory.h>
- #include <devices/timer.h>
- #include <functions.h>
- #include <stdio.h>
- #include <libraries/dos.h>
- #include <intuition/intuition.h>
-
- #include "hackercore.h"
-
- #include "chatter.h"
- #include "channels.h"
-
- extern struct timerequest *CreateTimer();
-
- struct timerequest *tr = NULL;
-
- struct IntuiMessage *msg;
-
- extern int gab_interval;
- extern int minimum_timer_interval, maximum_timer_interval;
-
- short KeepGoing;
-
- extern struct Window *win;
-
- #define CheckMsg(m) (m->mp_MsgList.lh_Head->ln_Succ != 0L)
-
- extern struct SMUS_IOAudio *SMUS_GetMsg();
-
- extern long beep_sigmask;
-
- loop()
- {
- ULONG waitflags;
- ULONG timermask;
- struct SMUS_IOAudio *audio_msg_ptr;
-
- KeepGoing = YES;
-
- timermask = (1 << (long)tr->tr_node.io_Message.mn_ReplyPort->mp_SigBit);
-
- determine_and_set_wait_seconds();
-
- /* main loop */
-
- while (KeepGoing)
- {
- /* wait for an event */
- /* (we want for -1 to reduce the overhead of looking up all our
- * sigbits */
-
- waitflags = Wait(-1L);
-
- /* timer message */
- if (waitflags & timermask)
- {
- /* if there's really a timer message */
- if (GetMsg(tr->tr_node.io_Message.mn_ReplyPort) != (struct Message *)NULL)
- {
- blather(GAB_EVERY_SO_OFTEN);
- determine_and_set_wait_seconds();
- }
- }
-
- while ((audio_msg_ptr = SMUS_GetMsg()) != NULL)
- StopChannelNote(audio_msg_ptr->channelp);
-
- if (waitflags & beep_sigmask)
- blather(GAB_BEEP);
-
- if (waitflags & SIGBREAKF_CTRL_C)
- KeepGoing = NO;
-
- if (CheckMsg(win->UserPort) && (msg = (struct IntuiMessage *)GetMsg(win->UserPort)))
- {
- switch(msg->Class)
- {
- case CLOSEWINDOW:
- KeepGoing = NO;
- break;
-
- case NEWPREFS:
- blather(GAB_NEW_PREFERENCES);
- break;
-
- case DISKINSERTED:
- blather(GAB_DISKIN);
- break;
-
- case DISKREMOVED:
- blather(GAB_DISKOUT);
- break;
-
- case ACTIVEWINDOW:
- blather(GAB_WINDOWACTIVE);
- break;
-
- case INACTIVEWINDOW:
- blather(GAB_WINDOWINACTIVE);
- break;
-
- case MENUPICK:
- ProcessMenu(msg->Code);
- break;
-
- default:
- printf("default %lx\n",msg->Class);
- break;
- }
- ReplyMsg(msg);
- }
- }
- AbortIO(tr);
- }
-
- Quit()
- {
- KeepGoing = NO;
- }
-