From fa084ef30438e78d824b4fdc81cb9e1a50bd5437 Mon Sep 17 00:00:00 2001 From: izydorst Date: Fri, 15 Aug 2003 23:17:11 +0000 Subject: [PATCH] system vector interception fixes git-svn-id: svn://svn.cc65.org/cc65/trunk@2339 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- doc/geos.sgml | 2 +- samples/geos/vector-demo.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/geos.sgml b/doc/geos.sgml index 0539e490b..14acb7d48 100644 --- a/doc/geos.sgml +++ b/doc/geos.sgml @@ -1607,7 +1607,7 @@ void example = {

It is possible to intercept and hook in the GEOS Kernal using vectors. Here is a little example: -void (*oldVector)(void); +void_func oldVector; void NewVectorHandler(void) { // do something and at the end call the old vector routine diff --git a/samples/geos/vector-demo.c b/samples/geos/vector-demo.c index a558e1f2a..cddb943d2 100644 --- a/samples/geos/vector-demo.c +++ b/samples/geos/vector-demo.c @@ -5,8 +5,7 @@ unsigned char x,y; -void (*oldMouseVector)(); -void (*oldKeyVector)(); +void_func oldMouseVector, oldKeyVector; void foo1 (void) { // do something on mouse press/release @@ -28,15 +27,15 @@ void foo2 (void) { void hook_into_system(void) { // hook into system vectors - preserve old value - oldMouseVector = (void (*)())mouseVector; - mouseVector = (int)foo1; - oldKeyVector = (void (*)())keyVector; - keyVector = (int)foo2; + oldMouseVector = mouseVector; + mouseVector = foo1; + oldKeyVector = keyVector; + keyVector = foo2; } void remove_hooks(void) { - mouseVector = (int)oldMouseVector; - keyVector = (int)oldKeyVector; + mouseVector = oldMouseVector; + keyVector = oldKeyVector; } int main(void) { -- 2.39.5