Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/ghostscr...
File: iapi.h
/* Copyright (C) 2001-2019 Artifex Software, Inc.
[0] Fix | Delete
All Rights Reserved.
[1] Fix | Delete
[2] Fix | Delete
This software is provided AS-IS with no warranty, either express or
[3] Fix | Delete
implied.
[4] Fix | Delete
[5] Fix | Delete
This software is distributed under license and may not be copied,
[6] Fix | Delete
modified or distributed except as expressly authorized under the terms
[7] Fix | Delete
of the license contained in the file LICENSE in this distribution.
[8] Fix | Delete
[9] Fix | Delete
Refer to licensing information at http://www.artifex.com or contact
[10] Fix | Delete
Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato,
[11] Fix | Delete
CA 94945, U.S.A., +1(415)492-9861, for further information.
[12] Fix | Delete
*/
[13] Fix | Delete
[14] Fix | Delete
[15] Fix | Delete
[16] Fix | Delete
/*
[17] Fix | Delete
* Public API for Ghostscript interpreter
[18] Fix | Delete
* for use both as DLL and for static linking.
[19] Fix | Delete
*
[20] Fix | Delete
* Should work for Windows, OS/2, Linux, Mac.
[21] Fix | Delete
*
[22] Fix | Delete
* DLL exported functions should be as similar as possible to imain.c
[23] Fix | Delete
* You will need to include "ierrors.h".
[24] Fix | Delete
*
[25] Fix | Delete
* Current problems:
[26] Fix | Delete
* 1. Ghostscript does not support multiple instances.
[27] Fix | Delete
* 2. Global variables in gs_main_instance_default()
[28] Fix | Delete
* and gsapi_instance_counter
[29] Fix | Delete
*/
[30] Fix | Delete
[31] Fix | Delete
/* Exported functions may need different prefix
[32] Fix | Delete
* GSDLLEXPORT marks functions as exported
[33] Fix | Delete
* GSDLLAPI is the calling convention used on functions exported
[34] Fix | Delete
* by Ghostscript
[35] Fix | Delete
* GSDLLCALL is used on callback functions called by Ghostscript
[36] Fix | Delete
* When you include this header file in the caller, you may
[37] Fix | Delete
* need to change the definitions by defining these
[38] Fix | Delete
* before including this header file.
[39] Fix | Delete
* Make sure you get the calling convention correct, otherwise your
[40] Fix | Delete
* program will crash either during callbacks or soon after returning
[41] Fix | Delete
* due to stack corruption.
[42] Fix | Delete
*/
[43] Fix | Delete
[44] Fix | Delete
#ifndef iapi_INCLUDED
[45] Fix | Delete
# define iapi_INCLUDED
[46] Fix | Delete
[47] Fix | Delete
#ifdef __cplusplus
[48] Fix | Delete
extern "C" {
[49] Fix | Delete
#endif
[50] Fix | Delete
[51] Fix | Delete
#if defined(_WINDOWS_) || defined(__WINDOWS__)
[52] Fix | Delete
# ifndef _Windows
[53] Fix | Delete
# define _Windows
[54] Fix | Delete
# endif
[55] Fix | Delete
#endif
[56] Fix | Delete
[57] Fix | Delete
#ifdef _Windows
[58] Fix | Delete
# ifndef GSDLLEXPORT
[59] Fix | Delete
/* We don't need both the "__declspec(dllexport)" declaration
[60] Fix | Delete
* and the listing in the .def file - having both results in
[61] Fix | Delete
* a linker warning on x64 builds (but is incorrect on x86, too)
[62] Fix | Delete
*/
[63] Fix | Delete
# if 0
[64] Fix | Delete
# define GSDLLEXPORT __declspec(dllexport)
[65] Fix | Delete
# else
[66] Fix | Delete
# define GSDLLEXPORT
[67] Fix | Delete
# endif
[68] Fix | Delete
# endif
[69] Fix | Delete
# ifndef GSDLLAPI
[70] Fix | Delete
# define GSDLLAPI __stdcall
[71] Fix | Delete
# endif
[72] Fix | Delete
# ifndef GSDLLCALL
[73] Fix | Delete
# define GSDLLCALL __stdcall
[74] Fix | Delete
# endif
[75] Fix | Delete
#endif /* _Windows */
[76] Fix | Delete
[77] Fix | Delete
#if defined(OS2) && defined(__IBMC__)
[78] Fix | Delete
# ifndef GSDLLAPI
[79] Fix | Delete
# define GSDLLAPI _System
[80] Fix | Delete
# endif
[81] Fix | Delete
# ifndef GSDLLCALL
[82] Fix | Delete
# define GSDLLCALL _System
[83] Fix | Delete
# endif
[84] Fix | Delete
#endif /* OS2 && __IBMC */
[85] Fix | Delete
[86] Fix | Delete
#ifdef __MACOS__
[87] Fix | Delete
# pragma export on
[88] Fix | Delete
#endif
[89] Fix | Delete
[90] Fix | Delete
#ifndef GSDLLEXPORT
[91] Fix | Delete
# define GSDLLEXPORT
[92] Fix | Delete
#endif
[93] Fix | Delete
#ifndef GSDLLAPI
[94] Fix | Delete
# define GSDLLAPI
[95] Fix | Delete
#endif
[96] Fix | Delete
#ifndef GSDLLCALL
[97] Fix | Delete
# define GSDLLCALL
[98] Fix | Delete
#endif
[99] Fix | Delete
[100] Fix | Delete
#if defined(__IBMC__)
[101] Fix | Delete
# define GSDLLAPIPTR * GSDLLAPI
[102] Fix | Delete
# define GSDLLCALLPTR * GSDLLCALL
[103] Fix | Delete
#else
[104] Fix | Delete
# define GSDLLAPIPTR GSDLLAPI *
[105] Fix | Delete
# define GSDLLCALLPTR GSDLLCALL *
[106] Fix | Delete
#endif
[107] Fix | Delete
[108] Fix | Delete
#ifndef display_callback_DEFINED
[109] Fix | Delete
# define display_callback_DEFINED
[110] Fix | Delete
typedef struct display_callback_s display_callback;
[111] Fix | Delete
#endif
[112] Fix | Delete
[113] Fix | Delete
#ifndef gs_memory_DEFINED
[114] Fix | Delete
# define gs_memory_DEFINED
[115] Fix | Delete
typedef struct gs_memory_s gs_memory_t;
[116] Fix | Delete
#endif
[117] Fix | Delete
[118] Fix | Delete
#ifndef gx_device_DEFINED
[119] Fix | Delete
# define gx_device_DEFINED
[120] Fix | Delete
typedef struct gx_device_s gx_device;
[121] Fix | Delete
#endif
[122] Fix | Delete
[123] Fix | Delete
typedef struct gsapi_revision_s {
[124] Fix | Delete
const char *product;
[125] Fix | Delete
const char *copyright;
[126] Fix | Delete
long revision;
[127] Fix | Delete
long revisiondate;
[128] Fix | Delete
} gsapi_revision_t;
[129] Fix | Delete
[130] Fix | Delete
/* Get version numbers and strings.
[131] Fix | Delete
* This is safe to call at any time.
[132] Fix | Delete
* You should call this first to make sure that the correct version
[133] Fix | Delete
* of the Ghostscript is being used.
[134] Fix | Delete
* pr is a pointer to a revision structure.
[135] Fix | Delete
* len is the size of this structure in bytes.
[136] Fix | Delete
* Returns 0 if OK, or if len too small (additional parameters
[137] Fix | Delete
* have been added to the structure) it will return the required
[138] Fix | Delete
* size of the structure.
[139] Fix | Delete
*/
[140] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[141] Fix | Delete
gsapi_revision(gsapi_revision_t *pr, int len);
[142] Fix | Delete
[143] Fix | Delete
/*
[144] Fix | Delete
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
[145] Fix | Delete
* Ghostscript supports only one instance.
[146] Fix | Delete
* The current implementation uses a global static instance
[147] Fix | Delete
* counter to make sure that only a single instance is used.
[148] Fix | Delete
* If you try to create two instances, the second attempt
[149] Fix | Delete
* will return < 0 and set pinstance to NULL.
[150] Fix | Delete
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
[151] Fix | Delete
*/
[152] Fix | Delete
/* Create a new instance of Ghostscript.
[153] Fix | Delete
* This instance is passed to most other API functions.
[154] Fix | Delete
* The caller_handle will be provided to callback functions.
[155] Fix | Delete
*/
[156] Fix | Delete
[157] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[158] Fix | Delete
gsapi_new_instance(void **pinstance, void *caller_handle);
[159] Fix | Delete
[160] Fix | Delete
/*
[161] Fix | Delete
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
[162] Fix | Delete
* Ghostscript supports only one instance.
[163] Fix | Delete
* The current implementation uses a global static instance
[164] Fix | Delete
* counter to make sure that only a single instance is used.
[165] Fix | Delete
* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
[166] Fix | Delete
*/
[167] Fix | Delete
/* Destroy an instance of Ghostscript
[168] Fix | Delete
* Before you call this, Ghostscript must have finished.
[169] Fix | Delete
* If Ghostscript has been initialised, you must call gsapi_exit()
[170] Fix | Delete
* before gsapi_delete_instance.
[171] Fix | Delete
*/
[172] Fix | Delete
GSDLLEXPORT void GSDLLAPI
[173] Fix | Delete
gsapi_delete_instance(void *instance);
[174] Fix | Delete
[175] Fix | Delete
/* Set the callback functions for stdio
[176] Fix | Delete
* The stdin callback function should return the number of
[177] Fix | Delete
* characters read, 0 for EOF, or -1 for error.
[178] Fix | Delete
* The stdout and stderr callback functions should return
[179] Fix | Delete
* the number of characters written.
[180] Fix | Delete
* If a callback address is NULL, the real stdio will be used.
[181] Fix | Delete
*/
[182] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[183] Fix | Delete
gsapi_set_stdio(void *instance,
[184] Fix | Delete
int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len),
[185] Fix | Delete
int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len),
[186] Fix | Delete
int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len));
[187] Fix | Delete
[188] Fix | Delete
/* Set the callback function for polling.
[189] Fix | Delete
* This is used for handling window events or cooperative
[190] Fix | Delete
* multitasking. This function will only be called if
[191] Fix | Delete
* Ghostscript was compiled with CHECK_INTERRUPTS
[192] Fix | Delete
* as described in gpcheck.h.
[193] Fix | Delete
* The polling function should return 0 if all is well,
[194] Fix | Delete
* and negative if it wants ghostscript to abort.
[195] Fix | Delete
* The polling function must be fast.
[196] Fix | Delete
*/
[197] Fix | Delete
GSDLLEXPORT int GSDLLAPI gsapi_set_poll(void *instance,
[198] Fix | Delete
int (GSDLLCALLPTR poll_fn)(void *caller_handle));
[199] Fix | Delete
[200] Fix | Delete
/* Set the display device callback structure.
[201] Fix | Delete
* If the display device is used, this must be called
[202] Fix | Delete
* after gsapi_new_instance() and before gsapi_init_with_args().
[203] Fix | Delete
* See gdevdisp.h for more details.
[204] Fix | Delete
*/
[205] Fix | Delete
GSDLLEXPORT int GSDLLAPI gsapi_set_display_callback(
[206] Fix | Delete
void *instance, display_callback *callback);
[207] Fix | Delete
[208] Fix | Delete
/* Set the string containing the list of default device names
[209] Fix | Delete
* for example "display x11alpha x11 bbox". Allows the calling
[210] Fix | Delete
* application to influence which device(s) gs will try in order
[211] Fix | Delete
* to select the default device
[212] Fix | Delete
*
[213] Fix | Delete
* *Must* be called after gsapi_new_instance() and before
[214] Fix | Delete
* gsapi_init_with_args().
[215] Fix | Delete
*/
[216] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[217] Fix | Delete
gsapi_set_default_device_list(void *instance, char *list, int listlen);
[218] Fix | Delete
[219] Fix | Delete
/* Returns a pointer to the current default device string
[220] Fix | Delete
* *Must* be called after gsapi_new_instance().
[221] Fix | Delete
*/
[222] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[223] Fix | Delete
gsapi_get_default_device_list(void *instance, char **list, int *listlen);
[224] Fix | Delete
[225] Fix | Delete
/* Set the encoding used for the args. By default we assume
[226] Fix | Delete
* 'local' encoding. For windows this equates to whatever the current
[227] Fix | Delete
* codepage is. For linux this is utf8.
[228] Fix | Delete
*
[229] Fix | Delete
* Use of this API (gsapi) with 'local' encodings (and hence without calling
[230] Fix | Delete
* this function) is now deprecated!
[231] Fix | Delete
*/
[232] Fix | Delete
GSDLLEXPORT int GSDLLAPI gsapi_set_arg_encoding(void *instance,
[233] Fix | Delete
int encoding);
[234] Fix | Delete
[235] Fix | Delete
enum {
[236] Fix | Delete
GS_ARG_ENCODING_LOCAL = 0,
[237] Fix | Delete
GS_ARG_ENCODING_UTF8 = 1,
[238] Fix | Delete
GS_ARG_ENCODING_UTF16LE = 2
[239] Fix | Delete
};
[240] Fix | Delete
[241] Fix | Delete
/* Initialise the interpreter.
[242] Fix | Delete
* This calls gs_main_init_with_args() in imainarg.c
[243] Fix | Delete
* 1. If quit or EOF occur during gsapi_init_with_args(),
[244] Fix | Delete
* the return value will be gs_error_Quit. This is not an error.
[245] Fix | Delete
* You must call gsapi_exit() and must not call any other
[246] Fix | Delete
* gsapi_XXX functions.
[247] Fix | Delete
* 2. If usage info should be displayed, the return value will be gs_error_Info
[248] Fix | Delete
* which is not an error. Do not call gsapi_exit().
[249] Fix | Delete
* 3. Under normal conditions this returns 0. You would then
[250] Fix | Delete
* call one or more gsapi_run_*() functions and then finish
[251] Fix | Delete
* with gsapi_exit().
[252] Fix | Delete
*/
[253] Fix | Delete
GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *instance,
[254] Fix | Delete
int argc, char **argv);
[255] Fix | Delete
[256] Fix | Delete
#ifdef __WIN32__
[257] Fix | Delete
GSDLLEXPORT int GSDLLAPI gsapi_init_with_argsA(void *instance,
[258] Fix | Delete
int argc, char **argv);
[259] Fix | Delete
[260] Fix | Delete
GSDLLEXPORT int GSDLLAPI gsapi_init_with_argsW(void *instance,
[261] Fix | Delete
int argc, wchar_t **argv);
[262] Fix | Delete
#endif
[263] Fix | Delete
[264] Fix | Delete
/*
[265] Fix | Delete
* The gsapi_run_* functions are like gs_main_run_* except
[266] Fix | Delete
* that the error_object is omitted.
[267] Fix | Delete
* If these functions return <= -100, either quit or a fatal
[268] Fix | Delete
* error has occured. You then call gsapi_exit() next.
[269] Fix | Delete
* The only exception is gsapi_run_string_continue()
[270] Fix | Delete
* which will return gs_error_NeedInput if all is well.
[271] Fix | Delete
*/
[272] Fix | Delete
[273] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[274] Fix | Delete
gsapi_run_string_begin(void *instance,
[275] Fix | Delete
int user_errors, int *pexit_code);
[276] Fix | Delete
[277] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[278] Fix | Delete
gsapi_run_string_continue(void *instance,
[279] Fix | Delete
const char *str, unsigned int length, int user_errors, int *pexit_code);
[280] Fix | Delete
[281] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[282] Fix | Delete
gsapi_run_string_end(void *instance,
[283] Fix | Delete
int user_errors, int *pexit_code);
[284] Fix | Delete
[285] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[286] Fix | Delete
gsapi_run_string_with_length(void *instance,
[287] Fix | Delete
const char *str, unsigned int length, int user_errors, int *pexit_code);
[288] Fix | Delete
[289] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[290] Fix | Delete
gsapi_run_string(void *instance,
[291] Fix | Delete
const char *str, int user_errors, int *pexit_code);
[292] Fix | Delete
[293] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[294] Fix | Delete
gsapi_run_file(void *instance,
[295] Fix | Delete
const char *file_name, int user_errors, int *pexit_code);
[296] Fix | Delete
[297] Fix | Delete
#ifdef __WIN32__
[298] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[299] Fix | Delete
gsapi_run_fileA(void *instance,
[300] Fix | Delete
const char *file_name, int user_errors, int *pexit_code);
[301] Fix | Delete
[302] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[303] Fix | Delete
gsapi_run_fileW(void *instance,
[304] Fix | Delete
const wchar_t *file_name, int user_errors, int *pexit_code);
[305] Fix | Delete
#endif
[306] Fix | Delete
[307] Fix | Delete
/* Retrieve the memory allocator for the interpreter instance */
[308] Fix | Delete
GSDLLEXPORT gs_memory_t * GSDLLAPI
[309] Fix | Delete
gsapi_get_device_memory(void *instance);
[310] Fix | Delete
[311] Fix | Delete
/* Set the device */
[312] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[313] Fix | Delete
gsapi_set_device(void *instance, gx_device *pdev);
[314] Fix | Delete
[315] Fix | Delete
/* Exit the interpreter.
[316] Fix | Delete
* This must be called on shutdown if gsapi_init_with_args()
[317] Fix | Delete
* has been called, and just before gsapi_delete_instance().
[318] Fix | Delete
*/
[319] Fix | Delete
GSDLLEXPORT int GSDLLAPI
[320] Fix | Delete
gsapi_exit(void *instance);
[321] Fix | Delete
[322] Fix | Delete
/* function prototypes */
[323] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_revision)(
[324] Fix | Delete
gsapi_revision_t *pr, int len);
[325] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_new_instance)(
[326] Fix | Delete
void **pinstance, void *caller_handle);
[327] Fix | Delete
typedef void (GSDLLAPIPTR PFN_gsapi_delete_instance)(
[328] Fix | Delete
void *instance);
[329] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_set_stdio)(void *instance,
[330] Fix | Delete
int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len),
[331] Fix | Delete
int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len),
[332] Fix | Delete
int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len));
[333] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_set_poll)(void *instance,
[334] Fix | Delete
int(GSDLLCALLPTR poll_fn)(void *caller_handle));
[335] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_set_display_callback)(
[336] Fix | Delete
void *instance, display_callback *callback);
[337] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_set_default_device_list)(
[338] Fix | Delete
void *instance, char *list, int listlen);
[339] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_get_default_device_list)(
[340] Fix | Delete
void *instance, char **list, int *listlen);
[341] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_init_with_args)(
[342] Fix | Delete
void *instance, int argc, char **argv);
[343] Fix | Delete
#ifdef __WIN32__
[344] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_init_with_argsA)(
[345] Fix | Delete
void *instance, int argc, char **argv);
[346] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_init_with_argsW)(
[347] Fix | Delete
void *instance, int argc, wchar_t **argv);
[348] Fix | Delete
#endif
[349] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_set_arg_encoding)(
[350] Fix | Delete
void *instance, int encoding);
[351] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_run_string_begin)(
[352] Fix | Delete
void *instance, int user_errors, int *pexit_code);
[353] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_run_string_continue)(
[354] Fix | Delete
void *instance, const char *str, unsigned int length,
[355] Fix | Delete
int user_errors, int *pexit_code);
[356] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_run_string_end)(
[357] Fix | Delete
void *instance, int user_errors, int *pexit_code);
[358] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_run_string_with_length)(
[359] Fix | Delete
void *instance, const char *str, unsigned int length,
[360] Fix | Delete
int user_errors, int *pexit_code);
[361] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_run_string)(
[362] Fix | Delete
void *instance, const char *str,
[363] Fix | Delete
int user_errors, int *pexit_code);
[364] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_run_file)(void *instance,
[365] Fix | Delete
const char *file_name, int user_errors, int *pexit_code);
[366] Fix | Delete
#ifdef __WIN32__
[367] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_run_fileA)(void *instance,
[368] Fix | Delete
const char *file_name, int user_errors, int *pexit_code);
[369] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_run_fileW)(void *instance,
[370] Fix | Delete
const wchar_t *file_name, int user_errors, int *pexit_code);
[371] Fix | Delete
#endif
[372] Fix | Delete
typedef gs_memory_t * (GSDLLAPIPTR PFN_gsapi_get_device_memory)(void *instance);
[373] Fix | Delete
typedef gs_memory_t * (GSDLLAPIPTR PFN_gsapi_set_device)(void *instance, gx_device *pdev);
[374] Fix | Delete
typedef int (GSDLLAPIPTR PFN_gsapi_exit)(void *instance);
[375] Fix | Delete
[376] Fix | Delete
#ifdef __MACOS__
[377] Fix | Delete
#pragma export off
[378] Fix | Delete
#endif
[379] Fix | Delete
[380] Fix | Delete
#ifdef __cplusplus
[381] Fix | Delete
} /* extern 'C' protection */
[382] Fix | Delete
#endif
[383] Fix | Delete
[384] Fix | Delete
#endif /* iapi_INCLUDED */
[385] Fix | Delete
[386] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function