Main Page | File List | File Members

runpdftex.h File Reference

the API of wrapper to run pdftex as a library call More...

Go to the source code of this file.

Defines

#define RUNPDFTEX_VERSION_MAJOR   0
 major version number
#define RUNPDFTEX_VERSION_MINOR   2
 minor version number

Typedefs

typedef runpdftex_data_struct runpdftex_data_t
 runpdftex_data_t is the type to be used by applications

Enumerations

enum  runpdftex_status_t {
  RUNPDFTEX_STATUS_OK = 0, RUNPDFTEX_NO_MEM_ERROR, RUNPDFTEX_CFG_ERROR, RUNPDFTEX_INVALID_INPUT,
  RUNPDFTEX_SYSTEM_ERROR, RUNPDFTEX_PDFTEX_ERROR
}
 runpdftex_status_t is the type to indicate errors that can occur with runpdftex. More...

Functions

runpdftex_data_trunpdftex_create (void)
 creates a runpdftex_data_t object to be passed to other runpdftex functions.
runpdftex_status_t runpdftex_set_tex_file (runpdftex_data_t *data, const char *tex_file)
 set the tex file to be compiled by pdftex.
runpdftex_status_t runpdftex_set_working_dir (runpdftex_data_t *data, const char *working_dir)
 set the working dir where compilation by pdftex will take place.
runpdftex_status_t runpdftex_add_option (runpdftex_data_t *data, const char *opt)
 add options that will be passed to pdftex.
runpdftex_status_t runpdftex_run (runpdftex_data_t *data)
 execute pdftex with the parameters stored in the runpdftex_data_t object.
runpdftex_status_t runpdftex_get_status (runpdftex_data_t *data)
 get the error status of a runpdftex_data_t object.
const char * runpdftex_get_status_str (runpdftex_data_t *data)
 get the error string of a runpdftex_data_t object.
void runpdftex_destroy (runpdftex_data_t *data)
 destroys the runpdftex_data_t object created by runpdftex_create().


Detailed Description

the API of wrapper to run pdftex as a library call

Definition in file runpdftex.h.


Enumeration Type Documentation

enum runpdftex_status_t
 

runpdftex_status_t is the type to indicate errors that can occur with runpdftex.

In most cases it is returned by a function, and also stored within the runpdftex_data_t object that was passed to the function. The error of an object can be retrieved using runpdftex_get_status(), and a more descriptive error string is available via runpdftex_get_status_str(). When an error occurs with a runpdftex_data_t object, further manipulation on this object won't have any effect: most functions simply return the error code stored within the object and do nothing else.

Enumeration values:
RUNPDFTEX_STATUS_OK  OK, no error detected yet.
RUNPDFTEX_NO_MEM_ERROR  error with memory allocation (malloc/strdup failure)
RUNPDFTEX_CFG_ERROR  error with pdftex config
RUNPDFTEX_INVALID_INPUT  error with input parameters
RUNPDFTEX_SYSTEM_ERROR  error with system calls
RUNPDFTEX_PDFTEX_ERROR  error with running pdftex

Definition at line 23 of file runpdftex.h.


Function Documentation

runpdftex_status_t runpdftex_add_option runpdftex_data_t data,
const char *  opt
 

add options that will be passed to pdftex.

Parameters:
data pointer to a runpdftex_data_t object
opt a string containing the option. The string will be checked as follows:
  • consists of chars from [a-zA-Z0-9_.-]
  • starts with '-'
  • the string is listed as allowed option in the config file
Returns:
0 if OK, otherwise the error code of data
Multiple calls of runpdftex_add_option() will concatenate the specified options.

runpdftex_data_t* runpdftex_create void   ) 
 

creates a runpdftex_data_t object to be passed to other runpdftex functions.

Returns:
a pointer to an object of type runpdftex_data_t; never returns NULL. When memory allocation fails, a pointer to a special object will be returned. This object has error status set to RUNPDFTEX_NO_MEM_ERROR (and hence it's not an error to call more runpdftex functions on this object - nothing will happen).

void runpdftex_destroy runpdftex_data_t data  ) 
 

destroys the runpdftex_data_t object created by runpdftex_create().

Parameters:
data pointer to a runpdftex_data_t object

runpdftex_status_t runpdftex_get_status runpdftex_data_t data  ) 
 

get the error status of a runpdftex_data_t object.

Parameters:
data pointer to a runpdftex_data_t object
Returns:
the error code of data (0 if no error detected)

const char* runpdftex_get_status_str runpdftex_data_t data  ) 
 

get the error string of a runpdftex_data_t object.

Parameters:
data pointer to a runpdftex_data_t object
Returns:
the error string of data

runpdftex_status_t runpdftex_run runpdftex_data_t data  ) 
 

execute pdftex with the parameters stored in the runpdftex_data_t object.

Parameters:
data pointer to a runpdftex_data_t object
Returns:
0 if OK, otherwise the error code of data

runpdftex_status_t runpdftex_set_tex_file runpdftex_data_t data,
const char *  tex_file
 

set the tex file to be compiled by pdftex.

Parameters:
data pointer to a runpdftex_data_t object
tex_file a string containing path to the tex file. The string will be checked as follows:
  • consists of chars from [a-zA-Z0-9_./-]
  • is not too long
  • is an absolute path (starts with '/' on Unix)
  • doesn't contain any '..' (parent dir) component
  • has '.tex' extension
  • filename without path (ie the part after the last path separator) consists of chars from [a-zA-Z0-9_.-] and starts with a char from [a-zA-Z0-9]
  • points to a readable file
Returns:
0 if OK, otherwise the error code of data
Later call of runpdftex_set_tex_file() will override the value set by previous call (if any) on the same runpdftex_data_t object.

runpdftex_status_t runpdftex_set_working_dir runpdftex_data_t data,
const char *  working_dir
 

set the working dir where compilation by pdftex will take place.

Parameters:
data pointer to a runpdftex_data_t object
working_dir a string containing path to the working dir. The string will be checked as follows:
  • consists of chars from [a-zA-Z0-9_./ -]
  • is not too long
  • is an absolute path (starts with '/' on Unix)
  • doesn't contain any '..' (parent dir) component
  • points to a writable directory
Returns:
0 if OK, otherwise the error code of data
Later call of runpdftex_set_working_dir() will override the value set by previous call (if any) on the same runpdftex_data_t object.

Attention:
it's the caller's responsibility to ensure that tex file and working dir are correct and safe (ie a third-party cannot modify or mess around with them)


Generated on Wed Mar 14 09:34:11 2007 for runpdftex by  doxygen 1.4.2