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 RPT_VERSION_MAJOR   1
 major version number
#define RPT_VERSION_MINOR   0
 minor version number

Typedefs

typedef rpt_data_struct rpt_data
 rpt_data is the type to be used by applications

Enumerations

enum  rpt_status_t {
  RPT_STATUS_OK = 0, RPT_NO_MEM_ERROR, RPT_CFG_ERROR, RPT_INVALID_INPUT,
  RPT_SYSTEM_ERROR, RPT_PDFTEX_ERROR
}
 rpt_status_t is the type to indicate errors that can occur with runpdftex. More...

Functions

rpt_datarpt_create (void)
 creates a rpt_data object to be passed to other runpdftex functions.
rpt_status_t rpt_set_tex_file (rpt_data *data, const char *tex_file)
 set the tex file to be compiled by pdftex.
rpt_status_t rpt_set_working_dir (rpt_data *data, const char *working_dir)
 set the working dir where compilation by pdftex will take place.
rpt_status_t rpt_add_option (rpt_data *data, const char *opt)
 add options that will be passed to pdftex.
rpt_status_t rpt_run (rpt_data *data)
 execute pdftex with the parameters stored in the rpt_data object.
rpt_status_t rpt_get_status (rpt_data *data)
 get the error status of a rpt_data object.
const char * rpt_get_status_str (rpt_data *data)
 get the error string of a rpt_data object.
void rpt_destroy (rpt_data *data)
 destroys the rpt_data object created by rpt_create().


Detailed Description

the API of wrapper to run pdftex as a library call

Definition in file runpdftex.h.


Enumeration Type Documentation

enum rpt_status_t
 

rpt_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 rpt_data object that was passed to the function. The error of an object can be retrieved using rpt_get_status(), and a more descriptive error string is available via rpt_get_status_str(). When an error occurs with a rpt_data 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:
RPT_STATUS_OK  OK, no error detected yet.
RPT_NO_MEM_ERROR  error with memory allocation (malloc/strdup failure)
RPT_CFG_ERROR  error with pdftex config
RPT_INVALID_INPUT  error with input parameters
RPT_SYSTEM_ERROR  error with system calls
RPT_PDFTEX_ERROR  error with running pdftex

Definition at line 23 of file runpdftex.h.

00023              {
00024     RPT_STATUS_OK = 0,  
00025     RPT_NO_MEM_ERROR,   
00026     RPT_CFG_ERROR,      
00027     RPT_INVALID_INPUT,  
00028     RPT_SYSTEM_ERROR,   
00029     RPT_PDFTEX_ERROR    
00030 } rpt_status_t;


Function Documentation

rpt_status_t rpt_add_option rpt_data data,
const char *  opt
 

add options that will be passed to pdftex.

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

rpt_data* rpt_create void   ) 
 

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

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

void rpt_destroy rpt_data data  ) 
 

destroys the rpt_data object created by rpt_create().

Parameters:
data pointer to a rpt_data object

rpt_status_t rpt_get_status rpt_data data  ) 
 

get the error status of a rpt_data object.

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

const char* rpt_get_status_str rpt_data data  ) 
 

get the error string of a rpt_data object.

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

rpt_status_t rpt_run rpt_data data  ) 
 

execute pdftex with the parameters stored in the rpt_data object.

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

rpt_status_t rpt_set_tex_file rpt_data data,
const char *  tex_file
 

set the tex file to be compiled by pdftex.

Parameters:
data pointer to a rpt_data 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
  • 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 rpt_set_tex_file() will override the value set by previous call (if any) on the same rpt_data object.

rpt_status_t rpt_set_working_dir rpt_data data,
const char *  working_dir
 

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

Parameters:
data pointer to a rpt_data 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 a full 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 rpt_set_working_dir() will override the value set by previous call (if any) on the same rpt_data 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 Mon Feb 26 13:45:24 2007 for runpdftex by  doxygen 1.4.2