[futurebasic] Re: [FB] More Serious Help

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1998 : Group Archive : Group : All Groups

From: tedd@...
Date: Mon, 26 Oct 1998 11:07:38 -0400
>So, I set this up as follows. I called it using
>
>CALL gJumpTablePtr&( %cmd%, %param1%, param2&, param3&, %param4%)
>
>with
>
>gJumpTablePtr& = LINE "myJumpTable"
>
>and the jumptable looking like this, in the first segment:
>"myJumpTable"
>ENTERPROC( gCmd%)
> DIM param1%, param2&, param3&, param4%
> SELECT gCmd%
>  CASE _testFunction
>   POP WORD( @param1%) : POP LONG( @param2&)
>   POP LONG( @param3&) : POP WORD( @param4%)
>...
> END SELECT
>EXITPROC
>RETURN

jonathan:

Okay. I think I see what you're trying to do. Which is, from anywhere in
your program you want to "CALL gJumpTablePtr&( %cmd%, %param1%, param2&,
param3&, %param4%)" and have values for your params be changed depending
upon the value of gCmd%. Is that right? If so, I would use the following
logic:

1. In globals, define:

   DIM gJumpTablePtr&
   DIM gCmd%
   DIM gParam1%
   DIM gParam2&
   DIM gParam3&
   DIM gParam4%

2. In an include file, define your jump table:

   LOCAL FN jumpTable
      SELECT gCmd%
        CASE _testFunction
	   gParam1% = 1 '(or whatever)
           gParam2& = 2
           gParam3& = 3
           gParam4% = 4
        CASE...

3. At the end of the above include file, place:

   gJumpTablePtr& = @FN jumpTable

4. In all of the include files that use the jump table, place the following
code at the begining:

   DEF FN jumpTable USING gJumpTablePtr& Ptr&

5. Then when you want to update your parameters, use:

   gCmd% = _testFunction (or whatever)
   CALL gJumpTablePtr&

6. And, the values of gParam1% ... gParam4& would change accordingly.

Hope this helps. If not, then please explain the program again, because I
didn't get it.

tedd







___________________________________________________________________
<mailto:tedd@...>	               http://sperling.com/