beginning python splits

This commit is contained in:
John Whitington
2021-08-10 13:40:37 +01:00
parent 5f8a0766ad
commit af576c0208
5 changed files with 221 additions and 327 deletions

View File

@@ -1,36 +1,45 @@
/* CHAPTER 0. Preliminaries */
# CHAPTER 0. Preliminaries
/* The function cpdf_startup(argv) must be called before using the library. */
void cpdf_startup(char **);
def loadDLL(f):
"""Load the libpycpdf DLL from a given file, and set up pycpdflib."""
/* Return the version of the cpdflib library as a string */
char *cpdf_version();
class Pdf:
"""The type of PDF documents."""
/*
* Some operations have a fast mode. The default is 'slow' mode, which works
* even on old-fashioned files. For more details, see section 1.13 of the
* CPDF manual. These functions set the mode globally.
*/
void cpdf_setFast();
void cpdf_setSlow();
class CPDFError(Exception):
"""Any function may raise an exception CPDFError, carrying a string
describing what went wrong"""
/*
* Errors. cpdf_lastError and cpdf_lastErrorString hold information about the
* last error to have occurred. They should be consulted after each call. If
* cpdf_lastError is non-zero, there was an error, and cpdf_lastErrorString
* gives details. If cpdf_lastError is zero, there was no error on the most
* recent cpdf call.
*/
extern int cpdf_lastError;
extern char *cpdf_lastErrorString;
def lastError():
"""Return the last error. Not usually used directly, since pycpdflib
functions raise exceptions."""
/* cpdf_clearError clears the current error state. */
void cpdf_clearError(void);
def lastErrorString():
"""Return the last error string. Not usually used directly, since pycpdflib
functions raise exceptions."""
/*
* cpdf_onExit is a debug function which prints some information about
* resource usage. This can be used to detect if PDFs or ranges are being
* deallocated properly. Contrary to its name, it may be run at any time.
*/
void cpdf_onExit(void);
def checkerror():
"""Raise an exception if the last function call resulted in an error. Not
used directly, since pycpdflib functions will raise the exception
directly."""
def version():
"""Returns the version number of the pycpdflib library."""
def setFast():
""" Some operations have a fast mode. The default is 'slow' mode, which
works even on old-fashioned files. For more details, see section 1.13 of
the CPDF manual. These functions set the mode globally. """
def setSlow():
""" Some operations have a fast mode. The default is 'slow' mode, which
works even on old-fashioned files. For more details, see section 1.13 of
the CPDF manual. These functions set the mode globally. """
def clearError():
""" clearError clears the current error state. """
def onExit():
""" onExit is a debug function which prints some information about
resource usage. This can be used to detect if PDFs or ranges are being
deallocated properly."""