Announcement

Collapse
No announcement yet.

call stack question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • call stack question

    Hi people,

    I could really use some help with the following.

    Consider the following code:

    ----

    sub a
    call sub c
    end sub

    sub b
    call sub c
    end sub

    sub c
    do stuff
    end sub

    ----

    Now i need to know in sub c which sub (a or b) made the call to sub c.
    I can do this using passed parameters or a global var construction
    but i was hoping that PB has some way to tell me which sub made the call.
    Anybody have any ideas? Thanks!

    Regards,

    Tom

    ------------------
    [URL=http://www.DiyDataRecovery.nl]
    [URL=http://www.DiyDataRecovery.nl]

  • #2
    Without passing a parameter?

    The only way is to set up a SHARED variable something like CurrentProcedure$ which you must set at each entry and restore on each return

    Other than that, forget it.

    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Better still, why not use use a parameter?

      I know it's just one man's opinion, but I think PB/DOS is stable enough now to support passing parameters.

      Michael Mattias
      Tal Systems Inc. (retired)
      Racine WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        I think it's everybody's opinion that PB/DOS has alweys been stable enough to support passing parameters and way more. Tom has likely his good reasons to try other ways, impossible to tell without knowing the context.

        ------------------
        Davide Vecchi
        [email protected]

        Comment


        • #5
          I have indeed good reasons to wanna do it the way i asked, but it looks like
          that's not possible. I've already implemented a global var construction.
          I must say however that this is kinda lame. When debugging you can check
          the gosub/call stack, so why can't i access that from PB to see what subs
          have been called? Ah well, global vars are good for everything i guess...
          Thanks for the help though.

          Tom

          ------------------
          [URL=http://www.DiyDataRecovery.nl]
          [URL=http://www.DiyDataRecovery.nl]

          Comment

          Working...
          X