Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
DaveClark
DaveClark
4 Posts
ACCEPTED ANSWER

Pinned topic Using Prolog and Epilog with Metal C

‏2011-01-14T15:50:42Z |
I am trying to use my own prolog and epilog routines to allow me to interface to assembler code that already has a stack that is very similar to that required for Metal C.

The problem I have is that although using epilog and prolog inserts my save area stack mechanism for external routines into the generated assembler, it does not insert it at all points that the METAL C generated Assembler code use the NAB techniques to use stack storage. This seems to be where in the generated code I have a label like @@BGN@4 DS 0H

e.g. The following C/Assembler

  • /*-------------------------------------------------------------------
  • *
  • * Function : resetExtracted
  • *

  • *
  • * Description :
  • *
  • * Reset the extracted flag for current node and all children
  • *
  • *-------------------------------------------------------------------
  • static void resetExtracted(
resetExtracted DS 0F
STM 14,4,12(13)
LR 15,13
L 13,8(,13)
ST 15,4(,13)
@@BGN@4 DS 0H
LA 0,144
ALR 0,13
ST 0,#NAB_4-@@AUTO@4(,13)
USING @@AUTO@4,13
LARL 3,@@LIT@4
USING @@LIT@4,3
STMH 14,4,80(13)
  • value_t value_ptr / IN pointer to parent node *
  • )
  • #pragma environment (resetExtracted,nolib);
  • {
  • if (value_ptr != NULL) {
USING @@PARMD@4,1
ICM 14,B'1111',@300value_ptr@118
BRE @4L360
  • value_ptr->status &= 0xff ??' STATUSEXTRACTED;
NI 48(14),254

I need to be able to get my code to manage our stack mechanism it at this point as well.

Any idea appreciated

Dave Clark
Updated on 2011-01-14T17:31:03Z at 2011-01-14T17:31:03Z by DaveClark
  • SystemAdmin
    SystemAdmin
    196 Posts
    ACCEPTED ANSWER

    Re: Using Prolog and Epilog with Metal C

    ‏2011-01-14T16:57:22Z  in response to DaveClark
    Dave,

    I am not entirely sure I understand your question. The code sample you placed here looks to be the default prolog code generated by the compiler for function "resetExtracted".
    Are you questioning why your prolog code wasn't used here?
    Which release of the compiler are you using?
    You can add these directives in your source to apply your prolog/epilog to a function:

    #pragma prolog(resetExtracted, "yourprolog")
    #pragma epilog(resetExtracted, "yourepilog")

    If you prefer to use the PROLOG and EPILOG compile options, starting with the V1R11 compiler you can code them in this form to apply your prolog/epilog to ALL functions defined in your source file:

    PROLOG(ALL("yourprolog"))
    EPILOG(ALL("yourepilog"))
  • DaveClark
    DaveClark
    4 Posts
    ACCEPTED ANSWER

    Re: Using Prolog and Epilog with Metal C

    ‏2011-01-14T17:31:03Z  in response to DaveClark
    Well in the sample I gave above I had coded PROLOG(CSAVE) on 1.10 system. The external entry points were correct and included my PROLOG, but the internal functions did not.

    Switching to a 1.11 system and manual (!) and using the PROLOG(ALL(CSAVE)) has done what I wanted.

    Thanks

    Dave