File indexing completed on 2025-08-27 09:33:38
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 #ifndef iapi_INCLUDED
0047 # define iapi_INCLUDED
0048
0049 #ifdef __cplusplus
0050 extern "C" {
0051 #endif
0052
0053 #if defined(_WINDOWS_) || defined(__WINDOWS__)
0054 # ifndef _Windows
0055 # define _Windows
0056 # endif
0057 #endif
0058
0059 #ifdef _Windows
0060 # ifndef GSDLLEXPORT
0061
0062
0063
0064
0065 # if 0
0066 # define GSDLLEXPORT __declspec(dllexport)
0067 # else
0068 # define GSDLLEXPORT
0069 # endif
0070 # endif
0071 # ifdef __MINGW32__
0072
0073 # undef GSDLLAPI
0074 # define GSDLLAPI
0075 # endif
0076 # ifndef GSDLLAPI
0077 # define GSDLLAPI __stdcall
0078 # endif
0079 # ifndef GSDLLCALL
0080 # define GSDLLCALL __stdcall
0081 # endif
0082 #endif
0083
0084 #if defined(OS2) && defined(__IBMC__)
0085 # ifndef GSDLLAPI
0086 # define GSDLLAPI _System
0087 # endif
0088 # ifndef GSDLLCALL
0089 # define GSDLLCALL _System
0090 # endif
0091 #endif
0092
0093 #ifdef __MACOS__
0094 # pragma export on
0095 #endif
0096
0097 #ifndef GSDLLEXPORT
0098 # ifdef __GNUC__
0099 # define GSDLLEXPORT __attribute__ ((visibility ("default")))
0100 # else
0101 # define GSDLLEXPORT
0102 # endif
0103 #endif
0104 #ifndef GSDLLAPI
0105 # define GSDLLAPI
0106 #endif
0107 #ifndef GSDLLCALL
0108 # define GSDLLCALL
0109 #endif
0110
0111 #if defined(__IBMC__)
0112 # define GSDLLAPIPTR * GSDLLAPI
0113 # define GSDLLCALLPTR * GSDLLCALL
0114 #else
0115 # define GSDLLAPIPTR GSDLLAPI *
0116 # define GSDLLCALLPTR GSDLLCALL *
0117 #endif
0118
0119 #ifndef display_callback_DEFINED
0120 # define display_callback_DEFINED
0121 typedef struct display_callback_s display_callback;
0122 #endif
0123
0124 #ifndef gs_memory_DEFINED
0125 # define gs_memory_DEFINED
0126 typedef struct gs_memory_s gs_memory_t;
0127 #endif
0128
0129 #ifndef gp_file_DEFINED
0130 # define gp_file_DEFINED
0131 typedef struct gp_file_s gp_file;
0132 #endif
0133
0134 typedef struct gsapi_revision_s {
0135 const char *product;
0136 const char *copyright;
0137 long revision;
0138 long revisiondate;
0139 } gsapi_revision_t;
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151 GSDLLEXPORT int GSDLLAPI
0152 gsapi_revision(gsapi_revision_t *pr, int len);
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168 GSDLLEXPORT int GSDLLAPI
0169 gsapi_new_instance(void **pinstance, void *caller_handle);
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184 GSDLLEXPORT void GSDLLAPI
0185 gsapi_delete_instance(void *instance);
0186
0187
0188
0189
0190
0191
0192
0193
0194 GSDLLEXPORT int GSDLLAPI
0195 gsapi_set_stdio(void *instance,
0196 int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len),
0197 int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len),
0198 int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len));
0199
0200
0201
0202 GSDLLEXPORT int GSDLLAPI
0203 gsapi_set_stdio_with_handle(void *instance,
0204 int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len),
0205 int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len),
0206 int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len),
0207 void *caller_handle);
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218 GSDLLEXPORT int GSDLLAPI gsapi_set_poll(void *instance,
0219 int (GSDLLCALLPTR poll_fn)(void *caller_handle));
0220
0221
0222
0223 GSDLLEXPORT int GSDLLAPI gsapi_set_poll_with_handle(void *instance,
0224 int (GSDLLCALLPTR poll_fn)(void *caller_handle), void *caller_handle);
0225
0226
0227
0228
0229
0230
0231
0232 GSDLLEXPORT int GSDLLAPI gsapi_set_display_callback(
0233 void *instance, display_callback *callback);
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249 typedef int (*gs_callout)(void *instance,
0250 void *callout_handle,
0251 const char *device_name,
0252 int id,
0253 int size,
0254 void *data);
0255
0256
0257
0258
0259
0260 GSDLLEXPORT int GSDLLAPI gsapi_register_callout(
0261 void *instance, gs_callout callout, void *callout_handle);
0262
0263
0264 GSDLLEXPORT void GSDLLAPI gsapi_deregister_callout(
0265 void *instance, gs_callout callout, void *callout_handle);
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275 GSDLLEXPORT int GSDLLAPI
0276 gsapi_set_default_device_list(void *instance, const char *list, int listlen);
0277
0278
0279
0280
0281 GSDLLEXPORT int GSDLLAPI
0282 gsapi_get_default_device_list(void *instance, char **list, int *listlen);
0283
0284
0285
0286
0287
0288
0289
0290
0291 GSDLLEXPORT int GSDLLAPI gsapi_set_arg_encoding(void *instance,
0292 int encoding);
0293
0294 enum {
0295 GS_ARG_ENCODING_LOCAL = 0,
0296 GS_ARG_ENCODING_UTF8 = 1,
0297 GS_ARG_ENCODING_UTF16LE = 2
0298 };
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312 GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *instance,
0313 int argc, char **argv);
0314
0315 #ifdef __WIN32__
0316 GSDLLEXPORT int GSDLLAPI gsapi_init_with_argsA(void *instance,
0317 int argc, char **argv);
0318
0319 GSDLLEXPORT int GSDLLAPI gsapi_init_with_argsW(void *instance,
0320 int argc, wchar_t **argv);
0321 #endif
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332 GSDLLEXPORT int GSDLLAPI
0333 gsapi_run_string_begin(void *instance,
0334 int user_errors, int *pexit_code);
0335
0336 GSDLLEXPORT int GSDLLAPI
0337 gsapi_run_string_continue(void *instance,
0338 const char *str, unsigned int length, int user_errors, int *pexit_code);
0339
0340 GSDLLEXPORT int GSDLLAPI
0341 gsapi_run_string_end(void *instance,
0342 int user_errors, int *pexit_code);
0343
0344 GSDLLEXPORT int GSDLLAPI
0345 gsapi_run_string_with_length(void *instance,
0346 const char *str, unsigned int length, int user_errors, int *pexit_code);
0347
0348 GSDLLEXPORT int GSDLLAPI
0349 gsapi_run_string(void *instance,
0350 const char *str, int user_errors, int *pexit_code);
0351
0352 GSDLLEXPORT int GSDLLAPI
0353 gsapi_run_file(void *instance,
0354 const char *file_name, int user_errors, int *pexit_code);
0355
0356 #ifdef __WIN32__
0357 GSDLLEXPORT int GSDLLAPI
0358 gsapi_run_fileA(void *instance,
0359 const char *file_name, int user_errors, int *pexit_code);
0360
0361 GSDLLEXPORT int GSDLLAPI
0362 gsapi_run_fileW(void *instance,
0363 const wchar_t *file_name, int user_errors, int *pexit_code);
0364 #endif
0365
0366
0367
0368
0369
0370 GSDLLEXPORT int GSDLLAPI
0371 gsapi_exit(void *instance);
0372
0373 typedef enum {
0374 gs_spt_invalid = -1,
0375 gs_spt_null = 0,
0376 gs_spt_bool = 1,
0377
0378 gs_spt_int = 2,
0379 gs_spt_float = 3,
0380 gs_spt_name = 4,
0381 gs_spt_string = 5,
0382 gs_spt_long = 6,
0383 gs_spt_i64 = 7,
0384 gs_spt_size_t = 8,
0385 gs_spt_parsed = 9,
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395 gs_spt_more_to_come = 1<<31
0396 } gs_set_param_type;
0397
0398
0399
0400 GSDLLEXPORT int GSDLLAPI gsapi_set_param(void *instance, const char *param, const void *value, gs_set_param_type type);
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410 GSDLLEXPORT int GSDLLAPI gsapi_get_param(void *instance, const char *param, void *value, gs_set_param_type type);
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432 GSDLLEXPORT int GSDLLAPI gsapi_enumerate_params(void *instance, void **iterator, const char **key, gs_set_param_type *type);
0433
0434 enum {
0435 GS_PERMIT_FILE_READING = 0,
0436 GS_PERMIT_FILE_WRITING = 1,
0437 GS_PERMIT_FILE_CONTROL = 2
0438 };
0439
0440
0441 GSDLLEXPORT int GSDLLAPI
0442 gsapi_add_control_path(void *instance, int type, const char *path);
0443
0444
0445 GSDLLEXPORT int GSDLLAPI
0446 gsapi_remove_control_path(void *instance, int type, const char *path);
0447
0448
0449 GSDLLEXPORT void GSDLLAPI
0450 gsapi_purge_control_paths(void *instance, int type);
0451
0452 GSDLLEXPORT void GSDLLAPI
0453 gsapi_activate_path_control(void *instance, int enable);
0454
0455 GSDLLEXPORT int GSDLLAPI
0456 gsapi_is_path_control_active(void *instance);
0457
0458
0459
0460
0461
0462
0463 #ifndef gp_file_name_sizeof
0464 #define gp_file_name_sizeof 4096
0465 #endif
0466
0467 typedef struct
0468 {
0469 int (*open_file)(const gs_memory_t *mem,
0470 void *secret,
0471 const char *fname,
0472 const char *mode,
0473 gp_file **file);
0474 int (*open_pipe)(const gs_memory_t *mem,
0475 void *secret,
0476 const char *fname,
0477 char *rfname,
0478 const char *mode,
0479 gp_file **file);
0480 int (*open_scratch)(const gs_memory_t *mem,
0481 void *secret,
0482 const char *prefix,
0483 char *rfname,
0484 const char *mode,
0485 int rm,
0486 gp_file **file);
0487 int (*open_printer)(const gs_memory_t *mem,
0488 void *secret,
0489 char *fname,
0490 int binary,
0491 gp_file **file);
0492 int (*open_handle)(const gs_memory_t *mem,
0493 void *secret,
0494 char *fname,
0495 const char *mode,
0496 gp_file **file);
0497 } gsapi_fs_t;
0498
0499 GSDLLEXPORT int GSDLLAPI
0500 gsapi_add_fs(void *instance, gsapi_fs_t *fs, void *secret);
0501
0502 GSDLLEXPORT void GSDLLAPI
0503 gsapi_remove_fs(void *instance, gsapi_fs_t *fs, void *secret);
0504
0505
0506 typedef int (GSDLLAPIPTR PFN_gsapi_revision)(
0507 gsapi_revision_t *pr, int len);
0508 typedef int (GSDLLAPIPTR PFN_gsapi_new_instance)(
0509 void **pinstance, void *caller_handle);
0510 typedef void (GSDLLAPIPTR PFN_gsapi_delete_instance)(
0511 void *instance);
0512 typedef int (GSDLLAPIPTR PFN_gsapi_set_stdio)(void *instance,
0513 int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len),
0514 int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len),
0515 int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len));
0516 typedef int (GSDLLAPIPTR PFN_gsapi_set_poll)(void *instance,
0517 int(GSDLLCALLPTR poll_fn)(void *caller_handle));
0518 typedef int (GSDLLAPIPTR PFN_gsapi_set_display_callback)(
0519 void *instance, display_callback *callback);
0520 typedef int (GSDLLAPIPTR PFN_gsapi_set_default_device_list)(
0521 void *instance, char *list, int listlen);
0522 typedef int (GSDLLAPIPTR PFN_gsapi_get_default_device_list)(
0523 void *instance, char **list, int *listlen);
0524 typedef int (GSDLLAPIPTR PFN_gsapi_init_with_args)(
0525 void *instance, int argc, char **argv);
0526 #ifdef __WIN32__
0527 typedef int (GSDLLAPIPTR PFN_gsapi_init_with_argsA)(
0528 void *instance, int argc, char **argv);
0529 typedef int (GSDLLAPIPTR PFN_gsapi_init_with_argsW)(
0530 void *instance, int argc, wchar_t **argv);
0531 #endif
0532 typedef int (GSDLLAPIPTR PFN_gsapi_set_arg_encoding)(
0533 void *instance, int encoding);
0534 typedef int (GSDLLAPIPTR PFN_gsapi_run_string_begin)(
0535 void *instance, int user_errors, int *pexit_code);
0536 typedef int (GSDLLAPIPTR PFN_gsapi_run_string_continue)(
0537 void *instance, const char *str, unsigned int length,
0538 int user_errors, int *pexit_code);
0539 typedef int (GSDLLAPIPTR PFN_gsapi_run_string_end)(
0540 void *instance, int user_errors, int *pexit_code);
0541 typedef int (GSDLLAPIPTR PFN_gsapi_run_string_with_length)(
0542 void *instance, const char *str, unsigned int length,
0543 int user_errors, int *pexit_code);
0544 typedef int (GSDLLAPIPTR PFN_gsapi_run_string)(
0545 void *instance, const char *str,
0546 int user_errors, int *pexit_code);
0547 typedef int (GSDLLAPIPTR PFN_gsapi_run_file)(void *instance,
0548 const char *file_name, int user_errors, int *pexit_code);
0549 #ifdef __WIN32__
0550 typedef int (GSDLLAPIPTR PFN_gsapi_run_fileA)(void *instance,
0551 const char *file_name, int user_errors, int *pexit_code);
0552 typedef int (GSDLLAPIPTR PFN_gsapi_run_fileW)(void *instance,
0553 const wchar_t *file_name, int user_errors, int *pexit_code);
0554 #endif
0555 typedef int (GSDLLAPIPTR PFN_gsapi_exit)(void *instance);
0556 typedef int (GSDLLAPIPTR PFN_gsapi_set_param)(void *instance, const char *param, const void *value, gs_set_param_type type);
0557
0558 typedef int (GSDLLAPIPTR PFN_gsapi_add_control_path)(void *instance, int type, const char *path);
0559 typedef int (GSDLLAPIPTR PFN_gsapi_remove_control_path)(void *instance, int type, const char *path);
0560 typedef void (GSDLLAPIPTR PFN_gsapi_purge_control_paths)(void *instance, int type);
0561 typedef void (GSDLLAPIPTR PFN_gsapi_activate_path_control)(void *instance, int enable);
0562 typedef int (GSDLLAPIPTR PFN_gsapi_is_path_control_active)(void *instance);
0563 typedef int (GSDLLAPIPTR PFN_gsapi_add_fs)(void *instance, gsapi_fs_t *fs, void *secret);
0564 typedef void (GSDLLAPIPTR PFN_gsapi_remove_fs)(void *instance, gsapi_fs_t *fs, void *secret);
0565
0566 #ifdef __MACOS__
0567 #pragma export off
0568 #endif
0569
0570 #ifdef __cplusplus
0571 }
0572 #endif
0573
0574 #endif