Home > Community > Forums > PCB SKILL > Override or hook read-only function - how?

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Override or hook read-only function - how? 

Last post Wed, Feb 22 2006 11:18 AM by archive. 3 replies.
Started by archive 22 Feb 2006 11:18 AM. Topic has 3 replies and 1803 views
Page 1 of 1 (4 items)
Sort Posts:
  • Wed, Feb 22 2006 11:18 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    Override or hook read-only function - how? Reply

    This is more in the nature of a general Skill question, but this topic seems to be the most active, so forgive the intrusion.

    Does anyone know if there's a means to hook or override native code function objects? For example, if I wanted to log all invocations of the various ipc* functions it would be handy to be able to place a routine of my own in the control flow, grab and log the args and then pass control to the "real" ipc routine.

    All the ipc* functions show up as being read-only and any attempt at assigning a new function to the symbol results in an error.

    Any input or insight will be appreciated.

    Steve


    Originally posted in cdnusers.org by shirsch
    • Post Points: 0
  • Wed, Feb 22 2006 1:23 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Override or hook read-only function - how? Reply

    Here is an example that may be useful.
    The ipc356_out command is called when you select File -> Export -> IPC356 from the main Allegro menu. You want to do something a little different then the generic ipc356_out function.

    First you would need to build the function you do wish to execute (some special extracta routines or specialized database reads, perhaps using a customized form UI). Let's say that you call this compiled Skill function "my_IPC_out".

    You can use the axlCmdRegister utility to "create" a user-defined Allegro command or, in this case, you would use this utility to redefine the existing Allegro command.

    axlCmdRegister("ipc356_out" 'my_IPC_out)

    Now when you enter ipc356_out from the Allegro command line the compiled function "my_IPC_out is executed. If you want to call the custom function from the Allegro menu you could ....

    axlCmdRegister("ipc356_private" 'my_IPC_out)

    and then modify your Allegro menu from ....
    MENUITEM "IP&C 356...", "ipc356 out"
    to ....
    MENUITEM "IP&C 356...", "ipc356_private"


    Originally posted in cdnusers.org by AshCan
    • Post Points: 0
  • Wed, Feb 22 2006 1:25 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Override or hook read-only function - how? Reply

    Or you could just use:
    axlCmdRegister("ipc356 out" 'my_IPC_out)
    and make no Allegro menu changes.


    Originally posted in cdnusers.org by AshCan
    • Post Points: 0
  • Wed, Feb 22 2006 1:43 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Override or hook read-only function - how? Reply

    I think the function you are after is clearFnWriteProtect

    However, this will not work with system functions, such as ipcBeginProcess. I doubt that you can (or would want to) hijack these commands directly.


    Originally posted in cdnusers.org by Dave Elder
    • Post Points: 0
Page 1 of 1 (4 items)
Sort Posts:
Started by archive at 22 Feb 2006 11:18 AM. Topic has 3 replies.