At 04:40 PM 9/20/2002 -0400, you wrote:
>Hi Ben,
>
>If the VFSMgr.h file
>
>#ifdef BUILDING_VFSMGR_DISPATCH
> #define VFSMGR_TRAP(VFSMgrSelectorNum)
>#else
> #define VFSMGR_TRAP(sel) \
> _SYSTEM_API(_CALL_WITH_SELECTOR)(_SYSTEM_TABLE, sysTrapVFSMgr, sel)
>#endif
>
>#define _OS_CALL_WITH_SELECTOR(table, vector, selector) \
> = { 0x7400 + selector, 0x4E40 + table, vector }
>
>when I call
>
>// selector = 1
>VFSMGR_TRAP(1);
>
>I get this during compile.
>
>Error : expression syntax error
>Starter.c line 880 = { 0x7400 + 1, 0x4E40 + 15, 0xA348 }
>
>How do you use VFSMGR_TRAP()??
You're playing with magic syntax :)
When a function in the CW compiler is defined like
void foo() = { 0xFFFF, 0x1234, 0x2341 }
this tells the compiler to insert those bytes directly into the object code
when you try to call that function. The VFSMGR_TRAP macro, then, is only
useful for defining these "stub functions".
Selector-based routines, like the VFS library, work by setting register D2
to a selector value, then calling the selector trap. So, in inline
assembly, this would be
asm { moveq #1, D2; TRAP #15; DW 0xA348 }
To do this bypassing the trap, you would have to write something like
asm { moveq #1, D2; move funcptr, a0; jsr (a0) }
Note: I've not tried this out, so you'll have to do some debugging and
discovery on your own.
--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/