• No replies
4 Posts

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)
LARL 3,@@LIT@4
STMH 14,4,80(13)
  • value_t value_ptr / IN pointer to parent node *
  • )
  • #pragma environment (resetExtracted,nolib);
  • {
  • if (value_ptr != NULL) {
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
    195 Posts

    Re: Using Prolog and Epilog with Metal C


    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:

  • DaveClark
    4 Posts

    Re: Using Prolog and Epilog with Metal C

    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.