home *** CD-ROM | disk | FTP | other *** search
-
-
- IHandler.c
-
- (c) 1991 by Uwe Röhm
-
- 24. Mar 1991
-
-
- --- deutsch ---
- Bei der Durchforstung meiner Platte habe ich diese Routinen zur
- Programmierung eines Inputhandlers unter Kickstart 1.3 entdeckt:
- IHandler.c - allgemeine Supportroutinen zum Verwalten eines
- Inputhandlers. Benötigt IHandler.h
- IHandler.h - Prototypes und priv. Strukturen zu IHandler.c
- IH-Test.c - Kurzes Testprogram für obrige Routinen.
-
- Die Routinen aus IHandler.c übernehmen die vollständige Verwaltung
- (sprich: Starten und Beenden) eines Inputhandlers. Um möglichst frei
- von Seiteneffekten zu sein, benutze ich eine private Übergabestruktur,
- die von der Routine "InitIHandler()" initialisiert wird. Alle darin
- enthaltenen Felder bis auf does_control und WriteBuffer sind privat!
- Die beiden genannten Felder sollten je nach Aufgabenstellung und Inputhandler
- ausgetauscht/ergänzt werden, da sie dem eigentlichen Inputhandler als
- Parameter und Arbeitsvariablen dienen (vgl. Source).
-
- Allgemeine Vorgehensweise:
- Aufruf von InitIHandler()
- Ausfüllen der Program-spezifischen Felder
- Aufruf von LaunchIHandler()
- Aufruf CatchIHandler()
- Aufruf von CloseIHandler()
- Letzte Funktion gibt belegten Speicher wieder frei und schließt Resourcen.
- (siehe auch IH-Test.c).
-
- Der im Source enthaltene Inputhandler ist nur ein sinnloses Beispiel,
- der frei verändert werden darf/muß/soll. Soweit getestet laufen die
- Routinen auch unter 2.0x, obwohl für und unter 1.3 programmiert.
-
- --- english ---
- Searching on my harddisk I found the following support routines
- for easy use of an inputhandler:
- IHandler.c - support functions for an own inputhandler. Needs IHandler.h
- IHandler.h - prototypes and privat structure for IHandler.c
- IH-Test.c - small test-program for the functions
-
- With the included functions you can easy start und stop an own inputhandler
- without thinking off how to do so. Just program your handler, the rest
- will be done via the routines.
- To protect myself against double use of variables I use an own struct
- which is except of the fields does_control and WriteBuffer privat!
- The mentioned fields should be changed according to your special
- requirements because they are used as arguments for the inputhandler
- (see source-file).
-
- How to use it:
- Call InitIHandler()
- <Fill your own fields>
- Call LaunchIHandler()
- Call CatchIHandler()
- Call CloseIHandler()
- The last function CloseIHandler() frees private memory and resources
- (see also IH-Test.c).
-
- The included inputhandler just is a silly example without any deeper
- meaning. You should program your own or just change this one. Be aware
- of the right function-name!
- I tested my code for kickstart 2.0x and it worked fine - which was
- a little bit surprising as I programed it for and under 1.3!
-