10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2 PDFlib Language BindingsNote It is strongly recommended to take a look at the starter examples which are contained in allPDFlib packages. They provide a convenient starting point for your own application development,and cover many important aspects of PDFlib programming.2.1 Cobol BindingThe PDFlib API functions for Cobol are not available under the standard C names, butuse abbreviated function names instead. The short function names are not documentedhere, but can be found in a separate cross-reference listing (xref.txt). For example, insteadof using PDF_load_font( ) the short form PDLODFNT must be used.PDFlib clients written in Cobol are statically linked to the PDFLBCOB object. It in turndynamically loads the PDLBDLCB Load Module (DLL), which in turn dynamically loadsthe PDFlib Load Module (DLL) upon the first call to PDNEW (which corresponds to PDF_new( )). The instance handle of the newly allocated PDFlib internal structure is stored inthe P parameter which must be provided to each call that follows.The PDLBDLCB load module provides the interfaces between the 8-character Cobolfunctions and the core PDFlib routines. It also provides the mapping between PDFlib’sasynchronous exception handling and the monolithic »check each function’s returncode« method that Cobol expects.Note PDLBDLCB and PDFLIB must be made available to the COBOL program through the use of aSTEPLIB.Data types. The data types used in the PDFlib Reference must be mapped to Coboldata types as in the following samples:05 PDFLIB-A4-WIDTH USAGE COMP-1 VALUE 5.95E+2. // float05 WS-INT PIC S9(9) BINARY. // int05 WS-FLOAT COMP-1. // float05 WS-STRING PIC X(128). // const char *05 P PIC S9(9) BINARY. // long *05 RETURN-RC PIC S9(9) BINARY. // int *All Cobol strings passed to the PDFlib API should be defined with one extra byte of storagefor the expected LOW-VALUES (NULL) terminator.Return values. The return value of PDFlib API functions will be supplied in an additionalret parameter which is passed by reference. It will be filled with the result of therespective function call. A zero return value means the function call executed just fine;other values signal an error, and PDF generation cannot be continued.Functions which do not return any result (C functions with a void return type) don’tuse this additional parameter.Error handling. PDFlib exception handling is not available in the Cobol language binding.Instead, all API functions support an additional return code (rc) parameter whichsignals errors. The rc parameter is passed by reference, and will be used to report problems.A non-zero value indicates that the function call failed.2.1 Cobol Binding 25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!