home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
monitors
/
rsys
/
source.lha
/
src
/
RSysHandlerList.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-09
|
4KB
|
143 lines
/*
***************************************************************************
*
* Datei:
* RSysHandlerList.c
*
* Inhalt:
* void MakeHandlerList(void);
*
* Bemerkungen:
* Erzeugung einer Liste von Inputhandlern.
*
* Erstellungsdatum:
* 07-Jul-93 Rolf Böhme
*
* Änderungen:
* 07-Jul-93 Rolf Böhme Erstellung
*
***************************************************************************
*/
#include "RSysDebug.h"
#include "RSysFunc.h"
/*
* MakeHandlerList() erzeugt eine Liste aller angemeldeten
* InputHandler im System. Dazu muß ein Dummy-Handler
* installiert werden und über diesen werden die anderen
* InputHandler gefunden. Es existiert keine (!) öffentliche
* Liste mit allen InputHandlern.
*/
void
MakeHandlerList(void)
{
int count = 0,
i = 0;
struct MsgPort *InputDevPort = NULL;
struct IOStdReq *InputRequestBlock = NULL;
struct Interrupt HandlerStuff;
struct Node *LoopNode,
*StartNode,
*node;
DPOS;
if (InputDevPort = (struct MsgPort *)CreatePort((UBYTE *) "RSys-Check-Port", NULL))
{
if (InputRequestBlock = (struct IOStdReq *)CreateStdIO(InputDevPort))
{
if (!OpenDevice((UBYTE *) "input.device", 0,
(struct IORequest *) InputRequestBlock, 0))
{
HandlerStuff.is_Code = NULL;
HandlerStuff.is_Data = NULL;
HandlerStuff.is_Node.ln_Pri = -127;
HandlerStuff.is_Node.ln_Name = "RSys-Check-Handler";
InputRequestBlock->io_Command = IND_ADDHANDLER;
InputRequestBlock->io_Data = (APTR) & HandlerStuff;
DoIO((struct IORequest *) InputRequestBlock);
/*
* Da InputHandler über Interrupts gesteuert werden
* ist hier zum Auslesen ein Disable()/Enable()-
* Paar zu verwenden
*/
Disable();
for (LoopNode = (struct Node *) & (HandlerStuff.is_Node);
LoopNode && LoopNode->ln_Pred;
LoopNode = LoopNode->ln_Pred) ;
StartNode = LoopNode->ln_Succ;
for (node = StartNode; node->ln_Succ;
node = node->ln_Succ)
if (node != (struct Node *) & (HandlerStuff.is_Node))
count++;
Enable();
countentries = count;
if(NOT(NoEntries()))
{
Entries = AllocScrollEntries(countentries);
Disable();
for (LoopNode = (struct Node *) & (HandlerStuff.is_Node);
LoopNode && LoopNode->ln_Pred;
LoopNode = LoopNode->ln_Pred) ;
StartNode = LoopNode->ln_Succ;
for (node = StartNode; node->ln_Succ && (i < countentries);
node = node->ln_Succ)
if (node != (struct Node *) & (HandlerStuff.is_Node))
{
savestrcpy(Entries[i].se_obj_id.fullname, node,
PARTSIZE, NT_INTERRUPT);
sprintf(Entries[i].se_Entry,
EntryAttr[INPUTHDL].ea_dataformat,
Entries[i].se_obj_id.fullname,
node->ln_Pri,
(long)((struct Interrupt *) node)->is_Data,
(long)((struct Interrupt *) node)->is_Code);
i++;
}
countentries = i;
Enable();
CreateEntryList(SORT);
}
InputRequestBlock->io_Command = IND_REMHANDLER;
InputRequestBlock->io_Data = (APTR) & HandlerStuff;
DoIO((struct IORequest *) InputRequestBlock);
CloseDevice((struct IORequest *) InputRequestBlock);
}
else
ErrorHandle(DEVICE_ERR, OPEN_FAIL, NO_KILL);
DeleteStdIO(InputRequestBlock);
}
else
ErrorHandle(MISC_ERR, CREATE_FAIL, NO_KILL);
DeletePort(InputDevPort);
}
else
ErrorHandle(PORT_ERR, CREATE_FAIL, NO_KILL);
return;
}