Example - Translating Function Prototype Declarations

The following example shows how the Header-to-copy utility translates function prototype declarations in C source code to their equivalent COBOL copyfile form.

C source:

extern XFontStruct *XLoadQueryFont(
extern void XrmInitialize(
extern char *XFetchBytes(
extern int (*XSetAfterFunction(
extern XtAppContext XtCreateApplicationContext(
extern void XtInitializeWidgetClass(
XmColorProc XmGetColorCalculation(void);

COBOL output:

 program-id. "c_typefefs" is external.
     call-convention default-convention-val is defaultconv.
$set constant XtCreateApplicationContext "XtCreateApplicationContext"
 entry XtCreateApplicationContext default-conv
  returning   data-pinter
$set constant XtInitializeWidgetClass "XtInitializeWidgetClass"
 entry XtInitializeWidgetClass default-conv 
  using       by value   data-pointer
$set constant XmGetColorCalculation "XmGetColorCalculation"
 entry XmGetColorCalculation default-conv 
  returning   proc-pointer
end program "c_typedefs".

This output is slightly different to previous phases. The entry names are specified using constants rather than by literals, and the call conventions are specified by entries in the Special Names paragraph.