Previous Topic Next topic Print topic


Examples

The examples in this topic are code fragments, and not the complete code generated by H2cpy.

The examples generate extra COBOL data items in addition to those specified in the code fragments. These extra data items are included in the output COBOL copy file because they are general COBOL typedefs that correspond to equivalent C data types. The size of these data items depends on the environment you are using.

       77 char                pic s9(2)   comp-5 is typedef.
       77 uns-char            pic  9(2)   comp-5 is typedef.
       77 short               pic s9(4)   comp-5 is typedef.
       77 uns-short           pic  9(4)   comp-5 is typedef.
       77 int                 pic s9(9)   comp-5 is typedef.
       77 uns-int             pic  9(9)   comp-5 is typedef.
       77 long                pic s9(9)   comp-5 is typedef.
       77 uns-long            pic  9(9)   comp-5 is typedef.
       77 l-long              pic s9(18)  comp-5 is typedef.
       77 uns-l-long          pic  9(18)  comp-5 is typedef.
       77 d-l-float                       comp-2 is typedef.
       77 d-float                         comp-2 is typedef.
       77 float                           comp-1 is typedef.
       77 proc-pointer        procedure-pointer is typedef.
       77 data-pointer                    pointer is typedef.
       77 void                pic  9(2)   comp-5 is typedef.
Note: C header files that require other header files that have been previously processed in the same run cannot be processed on their own by the C compiler. Similarly, H2cpy can only translate a standalone header file, or a complete set of header files. Any macro-names that need specifying in the C compiler command line, and any macros predefined by a particular compiler, might need specifying on the H2cpy command line. For example, Microsoft-specific predefined macros include:
  • CHAR_UNSIGNED
  • _CPPUNWIND
  • _DLL
  • _M_IX86
  • _MSC_VER
  • _MT
  • _WIN32
  • _CPPRTTI
  • _M_ALPHA
  • _M_MPPC
  • _M_MRXOOO
  • _M_MPPC
  • _MFC_VER
  • _MT

Do not specify the __cplusplus macro as H2cpy is not suitable for C++ headers.

ANSI C-predefined macros that might need to be specified on the command line using the -D option include:

  • __DATE__
  • __FILE__
  • __LINE__
  • __STDC__
  • __TIME__
  • __TIMESTAMP__
Previous Topic Next topic Print topic