HP3000-L Archives

March 1999, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"ABOOTORAB,MICHAEL (HP-PaloAlto,ex1)" <[log in to unmask]>
Reply To:
ABOOTORAB,MICHAEL (HP-PaloAlto,ex1)
Date:
Thu, 18 Mar 1999 13:20:00 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (79 lines)
Hi,

I need to do the same thing for a very large COBOL program ,
I want programmers be able to put their "XL"s in front of the big XL
and intercept the code while they are working on a source that resides
in the big xl,, however since the binding is done only in one direction
it will cause unresolved externals.

any way I can do this and not use "C"? ( I don't have anything against C
but its easier to sell a COBOL solution)

Thanks

Michael Abootorab


Re:

> The approach I have taken is to have 1 main program where 99%
> of the code resides, and a small executable library (XL) for each
> client.  The XL will have 1 function - Custom() containing all
> of the client specific code.
...
> This is working, but now my problem:
> Once I am inside the Custom() function in the XL I would like to be
> able to call functions back in the mainprog.

An alternative solution would be to invert things, so that the
main() and custom() are in the main program, and the XL contains the
99% of the code ... but this means the XL needs to be able to "find"
the custom() routine.  This can be done as follows:

The (big) XL contains one new typedef, one new "global" variable,
and one new routine:

    typedef int (*custom_function_ptr_type) (int32 xxx);
    ...
    custom_function_ptr_type custom_function;
    ...
    void register_custom_function (custom_function_ptr_type new_func)
       {
       custom_function = new_func;
       }
    ...

and calls to "custom (xxx)" are replaced with:

    (*custom_function) (xxx);

and the old "main()" in the XL is changed to "real_main ()".

and, in the new main program do:

   ...
   ...include extern declarations for functions in XL that custom() wants
   ...to call...
   ...

   typedef int (*custom_function_ptr_type) (int32 xxx);
   void register_custom_function (custom_function_ptr_type new_func);

   void custom (int32 xxx)
      {
      ...
      }

   main ()
      {
      register_custom_function (&custom);

      real_main ();
      }

Hope this helps.

--
Stan Sieler                                          [log in to unmask]
                                     http://www.allegro.com/sieler.html

ATOM RSS1 RSS2