Pajdeg  0.2.2
Pajdeg
Files | Data Structures | Typedefs | Functions
Pajdeg PostScript Implementation

Files

file  pd_ps_implementation.h
 

Data Structures

struct  pd_ps_env_s
 

Typedefs

typedef struct pd_ps_env_spd_ps_env
 

Functions

pd_ps_env pd_ps_create (void)
 
void pd_ps_destroy (pd_ps_env pse)
 
void pd_ps_set_cmap (pd_ps_env pse, PDCMapRef cmap)
 
PDCMapRef pd_ps_get_cmap (pd_ps_env pse)
 
PDBool pd_ps_execute_postscript (pd_ps_env pse, char *stream, PDSize len)
 
PDDictionaryRef pd_ps_get_results (pd_ps_env pse)
 
void * pd_ps_get_operand (pd_ps_env pse, PDSize index)
 

Detailed Description

The PostScript implementation in Pajdeg is a simplified interpreter which is used to process e.g. CMap (ToUnicode) content.


Data Structure Documentation

struct pd_ps_env_s

Data Fields

PDScannerRef scanner
 
PDDictionaryRef userdict
 
PDDictionaryRef operators
 
pd_stack operands
 
pd_stack dicts
 
pd_stack execs
 
PDBool failure
 
PDBool mpbool
 
PDBool explicitCMap
 
PDCMapRef cmap
 
PDDictionaryRef resources
 

Typedef Documentation

typedef struct pd_ps_env_s* pd_ps_env

A PostScript interpreter environment.

Function Documentation

pd_ps_env pd_ps_create ( void  )

Create a new PostScript environment for interpreting.

Returns
A clean environment
void pd_ps_destroy ( pd_ps_env  pse)

Destroy a PostScript environment.

Parameters
pseEnvironment that is no longer needed
PDBool pd_ps_execute_postscript ( pd_ps_env  pse,
char *  stream,
PDSize  len 
)

Execute the given stream of data of the given length (in bytes), inside the given PostScript environment. The same PostScript environment can be used to execute multiple pieces of data.

Parameters
pseThe PostScript environment
streamThe stream of ASCII characters representing a PostScript program
lenThe length of the stream, in bytes
Returns
Boolean value indicating whether the execution was successful (true) or not (false)
PDCMapRef pd_ps_get_cmap ( pd_ps_env  pse)

Get the CMap object currently being defined in the PostScript environment.

Parameters
pseThe PostScript environment
Returns
CMap object or NULL if none is being defined currently
void* pd_ps_get_operand ( pd_ps_env  pse,
PDSize  index 
)

Get the operand at the given index (zero-based) of the operand stack. The operand stack contains all results that have not been consumed by other operations yet. For example, executing "/MyFontName /CID findresource" after executing a CMap resource definition for a font named "MyFontName" will put the "MyFontName" dictionary at the top of the operand stack. This can then be obtained using PDDictionaryRef myCMapDict = pd_ps_get_operand(pse, 0); from which the actual PDCMap object is in the "#cmap#" key.

Parameters
pseThe PostScript environment
indexThe index (zero-based) in the stack which should be fetched
Returns
The object at the given index, or NULL if the index was beyond the size of the operand stack
PDDictionaryRef pd_ps_get_results ( pd_ps_env  pse)

Get the results of the PostScript execution(s) for the given environment.

Parameters
pseThe PostScript environment
Returns
A PDDictionary containing the root user dictionary
void pd_ps_set_cmap ( pd_ps_env  pse,
PDCMapRef  cmap 
)

Set the explicit CMap object for the PostScript environment. This will force the system to use this CMap object, rather than creating a new one, for the first "begincmap" encountered. Subsequent (if multiple) "begincmap" executions will create additional CMaps as normal.

Parameters
pseThe PostScript environment
cmapThe CMap object