@libgs/linux-ia32 0.0.0-stage → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/include/iapi.h ADDED
@@ -0,0 +1,574 @@
1
+ /* Copyright (C) 2001-2023 Artifex Software, Inc.
2
+ All Rights Reserved.
3
+
4
+ This software is provided AS-IS with no warranty, either express or
5
+ implied.
6
+
7
+ This software is distributed under license and may not be copied,
8
+ modified or distributed except as expressly authorized under the terms
9
+ of the license contained in the file LICENSE in this distribution.
10
+
11
+ Refer to licensing information at http://www.artifex.com or contact
12
+ Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
13
+ CA 94129, USA, for further information.
14
+ */
15
+
16
+
17
+
18
+ /*
19
+ * Public API for Ghostscript interpreter
20
+ * for use both as DLL and for static linking.
21
+ *
22
+ * Should work for Windows, OS/2, Linux, Mac.
23
+ *
24
+ * DLL exported functions should be as similar as possible to imain.c
25
+ * You will need to include "ierrors.h".
26
+ *
27
+ * Current problems:
28
+ * 1. Ghostscript does not support multiple instances.
29
+ * 2. Global variables in gs_main_instance_default()
30
+ * and gsapi_instance_counter
31
+ */
32
+
33
+ /* Exported functions may need different prefix
34
+ * GSDLLEXPORT marks functions as exported
35
+ * GSDLLAPI is the calling convention used on functions exported
36
+ * by Ghostscript
37
+ * GSDLLCALL is used on callback functions called by Ghostscript
38
+ * When you include this header file in the caller, you may
39
+ * need to change the definitions by defining these
40
+ * before including this header file.
41
+ * Make sure you get the calling convention correct, otherwise your
42
+ * program will crash either during callbacks or soon after returning
43
+ * due to stack corruption.
44
+ */
45
+
46
+ #ifndef iapi_INCLUDED
47
+ # define iapi_INCLUDED
48
+
49
+ #ifdef __cplusplus
50
+ extern "C" {
51
+ #endif
52
+
53
+ #if defined(_WINDOWS_) || defined(__WINDOWS__)
54
+ # ifndef _Windows
55
+ # define _Windows
56
+ # endif
57
+ #endif
58
+
59
+ #ifdef _Windows
60
+ # ifndef GSDLLEXPORT
61
+ /* We don't need both the "__declspec(dllexport)" declaration
62
+ * and the listing in the .def file - having both results in
63
+ * a linker warning on x64 builds (but is incorrect on x86, too)
64
+ */
65
+ # if 0
66
+ # define GSDLLEXPORT __declspec(dllexport)
67
+ # else
68
+ # define GSDLLEXPORT
69
+ # endif
70
+ # endif
71
+ # ifdef __MINGW32__
72
+ /* export stdcall functions as "name" instead of "_name@ordinal" */
73
+ # undef GSDLLAPI
74
+ # define GSDLLAPI
75
+ # endif
76
+ # ifndef GSDLLAPI
77
+ # define GSDLLAPI __stdcall
78
+ # endif
79
+ # ifndef GSDLLCALL
80
+ # define GSDLLCALL __stdcall
81
+ # endif
82
+ #endif /* _Windows */
83
+
84
+ #if defined(OS2) && defined(__IBMC__)
85
+ # ifndef GSDLLAPI
86
+ # define GSDLLAPI _System
87
+ # endif
88
+ # ifndef GSDLLCALL
89
+ # define GSDLLCALL _System
90
+ # endif
91
+ #endif /* OS2 && __IBMC */
92
+
93
+ #ifdef __MACOS__
94
+ # pragma export on
95
+ #endif
96
+
97
+ #ifndef GSDLLEXPORT
98
+ # ifdef __GNUC__
99
+ # define GSDLLEXPORT __attribute__ ((visibility ("default")))
100
+ # else
101
+ # define GSDLLEXPORT
102
+ # endif
103
+ #endif
104
+ #ifndef GSDLLAPI
105
+ # define GSDLLAPI
106
+ #endif
107
+ #ifndef GSDLLCALL
108
+ # define GSDLLCALL
109
+ #endif
110
+
111
+ #if defined(__IBMC__)
112
+ # define GSDLLAPIPTR * GSDLLAPI
113
+ # define GSDLLCALLPTR * GSDLLCALL
114
+ #else
115
+ # define GSDLLAPIPTR GSDLLAPI *
116
+ # define GSDLLCALLPTR GSDLLCALL *
117
+ #endif
118
+
119
+ #ifndef display_callback_DEFINED
120
+ # define display_callback_DEFINED
121
+ typedef struct display_callback_s display_callback;
122
+ #endif
123
+
124
+ #ifndef gs_memory_DEFINED
125
+ # define gs_memory_DEFINED
126
+ typedef struct gs_memory_s gs_memory_t;
127
+ #endif
128
+
129
+ #ifndef gp_file_DEFINED
130
+ # define gp_file_DEFINED
131
+ typedef struct gp_file_s gp_file;
132
+ #endif
133
+
134
+ typedef struct gsapi_revision_s {
135
+ const char *product;
136
+ const char *copyright;
137
+ long revision;
138
+ long revisiondate;
139
+ } gsapi_revision_t;
140
+
141
+ /* Get version numbers and strings.
142
+ * This is safe to call at any time.
143
+ * You should call this first to make sure that the correct version
144
+ * of the Ghostscript is being used.
145
+ * pr is a pointer to a revision structure.
146
+ * len is the size of this structure in bytes.
147
+ * Returns 0 if OK, or if len too small (additional parameters
148
+ * have been added to the structure) it will return the required
149
+ * size of the structure.
150
+ */
151
+ GSDLLEXPORT int GSDLLAPI
152
+ gsapi_revision(gsapi_revision_t *pr, int len);
153
+
154
+ /*
155
+ * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
156
+ * On non-threading capable platforms, Ghostscript supports only
157
+ * one instance. The current implementation uses a global static
158
+ * instance counter to make sure that only a single instance is
159
+ * used. If you try to create two instances, the second attempt
160
+ * will return < 0 and set pinstance to NULL.
161
+ * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
162
+ */
163
+ /* Create a new instance of Ghostscript.
164
+ * This instance is passed to most other API functions.
165
+ * The caller_handle will be provided to callback functions.
166
+ */
167
+
168
+ GSDLLEXPORT int GSDLLAPI
169
+ gsapi_new_instance(void **pinstance, void *caller_handle);
170
+
171
+ /*
172
+ * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
173
+ * On non-threading capable platforms, Ghostscript supports only
174
+ * one instance. The current implementation uses a global static
175
+ * instance counter to make sure that only a single instance is
176
+ * used.
177
+ * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
178
+ */
179
+ /* Destroy an instance of Ghostscript
180
+ * Before you call this, Ghostscript must have finished.
181
+ * If Ghostscript has been initialised, you must call gsapi_exit()
182
+ * before gsapi_delete_instance.
183
+ */
184
+ GSDLLEXPORT void GSDLLAPI
185
+ gsapi_delete_instance(void *instance);
186
+
187
+ /* Set the callback functions for stdio
188
+ * The stdin callback function should return the number of
189
+ * characters read, 0 for EOF, or -1 for error.
190
+ * The stdout and stderr callback functions should return
191
+ * the number of characters written.
192
+ * If a callback address is NULL, the real stdio will be used.
193
+ */
194
+ GSDLLEXPORT int GSDLLAPI
195
+ gsapi_set_stdio(void *instance,
196
+ int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len),
197
+ int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len),
198
+ int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len));
199
+
200
+ /* Does the same as the above, but using the caller_handle given here,
201
+ * rather than the default one specified at gsapi_new_instance time. */
202
+ GSDLLEXPORT int GSDLLAPI
203
+ gsapi_set_stdio_with_handle(void *instance,
204
+ int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len),
205
+ int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len),
206
+ int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len),
207
+ void *caller_handle);
208
+
209
+ /* Set the callback function for polling.
210
+ * This is used for handling window events or cooperative
211
+ * multitasking. This function will only be called if
212
+ * Ghostscript was compiled with CHECK_INTERRUPTS
213
+ * as described in gpcheck.h.
214
+ * The polling function should return 0 if all is well,
215
+ * and negative if it wants ghostscript to abort.
216
+ * The polling function must be fast.
217
+ */
218
+ GSDLLEXPORT int GSDLLAPI gsapi_set_poll(void *instance,
219
+ int (GSDLLCALLPTR poll_fn)(void *caller_handle));
220
+
221
+ /* Does the same as the above, but using the caller_handle given here,
222
+ * rather than the default one specified at gsapi_new_instance time. */
223
+ GSDLLEXPORT int GSDLLAPI gsapi_set_poll_with_handle(void *instance,
224
+ int (GSDLLCALLPTR poll_fn)(void *caller_handle), void *caller_handle);
225
+
226
+ /* Set the display device callback structure.
227
+ * If the display device is used, this must be called
228
+ * after gsapi_new_instance() and before gsapi_init_with_args().
229
+ * See gdevdisp.h for more details.
230
+ * DEPRECATED: Use the gsapi_register_callback mechanism instead.
231
+ */
232
+ GSDLLEXPORT int GSDLLAPI gsapi_set_display_callback(
233
+ void *instance, display_callback *callback);
234
+
235
+ /* The callout mechanism allows devices to query "callers" (users of the
236
+ * DLL) in device specific ways. The callout function pointer type will
237
+ * be called with:
238
+ * callout_handle = the value given at registration
239
+ * device_name = the name of the current device
240
+ * id = An integer, guaranteed to be unique within the
241
+ * callouts from a given device, identifying the
242
+ * purpose of this call.
243
+ * size = device/id specific, but typically the size of 'data'.
244
+ * data = device/id specific, but typically the pointer to
245
+ * an in/out data block.
246
+ * Returns an error code (gs_error_unknownerror (-1) if unclaimed,
247
+ * non-negative on success, standard gs error numbers recommended).
248
+ */
249
+ typedef int (*gs_callout)(void *instance,
250
+ void *callout_handle,
251
+ const char *device_name,
252
+ int id,
253
+ int size,
254
+ void *data);
255
+
256
+ /* Register a handler for gs callouts.
257
+ * This must be called after gsapi_new_instance() and (typically)
258
+ * before gsapi_init_with_args().
259
+ */
260
+ GSDLLEXPORT int GSDLLAPI gsapi_register_callout(
261
+ void *instance, gs_callout callout, void *callout_handle);
262
+
263
+ /* Deregister a handler for gs callouts. */
264
+ GSDLLEXPORT void GSDLLAPI gsapi_deregister_callout(
265
+ void *instance, gs_callout callout, void *callout_handle);
266
+
267
+ /* Set the string containing the list of default device names
268
+ * for example "display x11alpha x11 bbox". Allows the calling
269
+ * application to influence which device(s) gs will try in order
270
+ * to select the default device
271
+ *
272
+ * *Must* be called after gsapi_new_instance() and before
273
+ * gsapi_init_with_args().
274
+ */
275
+ GSDLLEXPORT int GSDLLAPI
276
+ gsapi_set_default_device_list(void *instance, const char *list, int listlen);
277
+
278
+ /* Returns a pointer to the current default device string
279
+ * *Must* be called after gsapi_new_instance().
280
+ */
281
+ GSDLLEXPORT int GSDLLAPI
282
+ gsapi_get_default_device_list(void *instance, char **list, int *listlen);
283
+
284
+ /* Set the encoding used for the args. By default we assume
285
+ * 'local' encoding. For windows this equates to whatever the current
286
+ * codepage is. For linux this is utf8.
287
+ *
288
+ * Use of this API (gsapi) with 'local' encodings (and hence without calling
289
+ * this function) is now deprecated!
290
+ */
291
+ GSDLLEXPORT int GSDLLAPI gsapi_set_arg_encoding(void *instance,
292
+ int encoding);
293
+
294
+ enum {
295
+ GS_ARG_ENCODING_LOCAL = 0,
296
+ GS_ARG_ENCODING_UTF8 = 1,
297
+ GS_ARG_ENCODING_UTF16LE = 2
298
+ };
299
+
300
+ /* Initialise the interpreter.
301
+ * This calls gs_main_init_with_args() in imainarg.c
302
+ * 1. If quit or EOF occur during gsapi_init_with_args(),
303
+ * the return value will be gs_error_Quit. This is not an error.
304
+ * You must call gsapi_exit() and must not call any other
305
+ * gsapi_XXX functions.
306
+ * 2. If usage info should be displayed, the return value will be gs_error_Info
307
+ * which is not an error. Do not call gsapi_exit().
308
+ * 3. Under normal conditions this returns 0. You would then
309
+ * call one or more gsapi_run_*() functions and then finish
310
+ * with gsapi_exit().
311
+ */
312
+ GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *instance,
313
+ int argc, char **argv);
314
+
315
+ #ifdef __WIN32__
316
+ GSDLLEXPORT int GSDLLAPI gsapi_init_with_argsA(void *instance,
317
+ int argc, char **argv);
318
+
319
+ GSDLLEXPORT int GSDLLAPI gsapi_init_with_argsW(void *instance,
320
+ int argc, wchar_t **argv);
321
+ #endif
322
+
323
+ /*
324
+ * The gsapi_run_* functions are like gs_main_run_* except
325
+ * that the error_object is omitted.
326
+ * If these functions return <= -100, either quit or a fatal
327
+ * error has occured. You then call gsapi_exit() next.
328
+ * The only exception is gsapi_run_string_continue()
329
+ * which will return gs_error_NeedInput if all is well.
330
+ */
331
+
332
+ GSDLLEXPORT int GSDLLAPI
333
+ gsapi_run_string_begin(void *instance,
334
+ int user_errors, int *pexit_code);
335
+
336
+ GSDLLEXPORT int GSDLLAPI
337
+ gsapi_run_string_continue(void *instance,
338
+ const char *str, unsigned int length, int user_errors, int *pexit_code);
339
+
340
+ GSDLLEXPORT int GSDLLAPI
341
+ gsapi_run_string_end(void *instance,
342
+ int user_errors, int *pexit_code);
343
+
344
+ GSDLLEXPORT int GSDLLAPI
345
+ gsapi_run_string_with_length(void *instance,
346
+ const char *str, unsigned int length, int user_errors, int *pexit_code);
347
+
348
+ GSDLLEXPORT int GSDLLAPI
349
+ gsapi_run_string(void *instance,
350
+ const char *str, int user_errors, int *pexit_code);
351
+
352
+ GSDLLEXPORT int GSDLLAPI
353
+ gsapi_run_file(void *instance,
354
+ const char *file_name, int user_errors, int *pexit_code);
355
+
356
+ #ifdef __WIN32__
357
+ GSDLLEXPORT int GSDLLAPI
358
+ gsapi_run_fileA(void *instance,
359
+ const char *file_name, int user_errors, int *pexit_code);
360
+
361
+ GSDLLEXPORT int GSDLLAPI
362
+ gsapi_run_fileW(void *instance,
363
+ const wchar_t *file_name, int user_errors, int *pexit_code);
364
+ #endif
365
+
366
+ /* Exit the interpreter.
367
+ * This must be called on shutdown if gsapi_init_with_args()
368
+ * has been called, and just before gsapi_delete_instance().
369
+ */
370
+ GSDLLEXPORT int GSDLLAPI
371
+ gsapi_exit(void *instance);
372
+
373
+ typedef enum {
374
+ gs_spt_invalid = -1,
375
+ gs_spt_null = 0, /* void * is NULL */
376
+ gs_spt_bool = 1, /* void * is a pointer to an int (0 false,
377
+ * non-zero true). */
378
+ gs_spt_int = 2, /* void * is a pointer to an int */
379
+ gs_spt_float = 3, /* void * is a float * */
380
+ gs_spt_name = 4, /* void * is a char * */
381
+ gs_spt_string = 5, /* void * is a char * */
382
+ gs_spt_long = 6, /* void * is a long * */
383
+ gs_spt_i64 = 7, /* void * is an int64_t * */
384
+ gs_spt_size_t = 8, /* void * is a size_t * */
385
+ gs_spt_parsed = 9, /* void * is a pointer to a char * to be parsed */
386
+
387
+ /* Setting a typed param causes it to be instantly fed to to the
388
+ * device. This can cause the device to reinitialise itself. Hence,
389
+ * setting a sequence of typed params can cause the device to reset
390
+ * itself several times. Accordingly, if you OR the type with
391
+ * gs_spt_more_to_come, the param will held ready to be passed into
392
+ * the device, and will only actually be sent when the next typed
393
+ * param is set without this flag (or on device init). Not valid
394
+ * for get_typed_param. */
395
+ gs_spt_more_to_come = 1<<31
396
+ } gs_set_param_type;
397
+ /* gs_spt_parsed allows for a string such as "<< /Foo 0 /Bar true >>" or
398
+ * "[ 1 2 3 ]" etc to be used so more complex parameters can be set. */
399
+
400
+ GSDLLEXPORT int GSDLLAPI gsapi_set_param(void *instance, const char *param, const void *value, gs_set_param_type type);
401
+
402
+ /* Called to get a value. value points to storage of the appropriate
403
+ * type. If value is passed as NULL on entry, then the return code is
404
+ * the number of bytes storage required for the type. Thus to read a
405
+ * name/string/parsed value, call once with value=NULL, then obtain
406
+ * the storage, and call again with value=the storage to get a nul
407
+ * terminated string. (nul terminator is included in the count - hence
408
+ * an empty string requires 1 byte storage). Returns gs_error_undefined
409
+ * (-21) if not found. */
410
+ GSDLLEXPORT int GSDLLAPI gsapi_get_param(void *instance, const char *param, void *value, gs_set_param_type type);
411
+
412
+ /* Enumerator to list all the parameters.
413
+ * Caller defines void *iter = NULL, and calls with &iter.
414
+ * Each call, iter is updated to reflect the position within the
415
+ * enumeration, so passing iterator back in gets the next key. The call
416
+ * returns negative values for errors, 0 for success, and 1 for "no more
417
+ * keys".
418
+ *
419
+ * void *iter = NULL;
420
+ * gs_set_param_type type;
421
+ * const char *key;
422
+ * int code;
423
+ * while ((code = gsapi_enumerate_params(inst, &iter, &key, &type)) == 0) {
424
+ * // Process key
425
+ * }
426
+ *
427
+ * Note that the ordering of enumerations is NOT defined. key is valid
428
+ * until the next call to gsapi_enumerate_params. Only one enumeration
429
+ * at a time (starting a new enumeration will invalidate any previous
430
+ * enumeration).
431
+ */
432
+ GSDLLEXPORT int GSDLLAPI gsapi_enumerate_params(void *instance, void **iterator, const char **key, gs_set_param_type *type);
433
+
434
+ enum {
435
+ GS_PERMIT_FILE_READING = 0,
436
+ GS_PERMIT_FILE_WRITING = 1,
437
+ GS_PERMIT_FILE_CONTROL = 2
438
+ };
439
+
440
+ /* Add a path to one of the sets of permitted paths. */
441
+ GSDLLEXPORT int GSDLLAPI
442
+ gsapi_add_control_path(void *instance, int type, const char *path);
443
+
444
+ /* Remove a path from one of the sets of permitted paths. */
445
+ GSDLLEXPORT int GSDLLAPI
446
+ gsapi_remove_control_path(void *instance, int type, const char *path);
447
+
448
+ /* Purge all the paths from the one of the sets of permitted paths. */
449
+ GSDLLEXPORT void GSDLLAPI
450
+ gsapi_purge_control_paths(void *instance, int type);
451
+
452
+ GSDLLEXPORT void GSDLLAPI
453
+ gsapi_activate_path_control(void *instance, int enable);
454
+
455
+ GSDLLEXPORT int GSDLLAPI
456
+ gsapi_is_path_control_active(void *instance);
457
+
458
+ /* Details of gp_file can be found in gp.h.
459
+ * Users wanting to use this function should include
460
+ * that file. Not included here to avoid bloating the
461
+ * API inclusions for the majority of people who won't
462
+ * want it. */
463
+ #ifndef gp_file_name_sizeof
464
+ #define gp_file_name_sizeof 4096
465
+ #endif
466
+
467
+ typedef struct
468
+ {
469
+ int (*open_file)(const gs_memory_t *mem,
470
+ void *secret,
471
+ const char *fname,
472
+ const char *mode,
473
+ gp_file **file);
474
+ int (*open_pipe)(const gs_memory_t *mem,
475
+ void *secret,
476
+ const char *fname,
477
+ char *rfname, /* 4096 bytes */
478
+ const char *mode,
479
+ gp_file **file);
480
+ int (*open_scratch)(const gs_memory_t *mem,
481
+ void *secret,
482
+ const char *prefix,
483
+ char *rfname, /* 4096 bytes */
484
+ const char *mode,
485
+ int rm,
486
+ gp_file **file);
487
+ int (*open_printer)(const gs_memory_t *mem,
488
+ void *secret,
489
+ char *fname, /* 4096 bytes */
490
+ int binary,
491
+ gp_file **file);
492
+ int (*open_handle)(const gs_memory_t *mem,
493
+ void *secret,
494
+ char *fname, /* 4096 bytes */
495
+ const char *mode,
496
+ gp_file **file);
497
+ } gsapi_fs_t;
498
+
499
+ GSDLLEXPORT int GSDLLAPI
500
+ gsapi_add_fs(void *instance, gsapi_fs_t *fs, void *secret);
501
+
502
+ GSDLLEXPORT void GSDLLAPI
503
+ gsapi_remove_fs(void *instance, gsapi_fs_t *fs, void *secret);
504
+
505
+ /* function prototypes */
506
+ typedef int (GSDLLAPIPTR PFN_gsapi_revision)(
507
+ gsapi_revision_t *pr, int len);
508
+ typedef int (GSDLLAPIPTR PFN_gsapi_new_instance)(
509
+ void **pinstance, void *caller_handle);
510
+ typedef void (GSDLLAPIPTR PFN_gsapi_delete_instance)(
511
+ void *instance);
512
+ typedef int (GSDLLAPIPTR PFN_gsapi_set_stdio)(void *instance,
513
+ int (GSDLLCALLPTR stdin_fn)(void *caller_handle, char *buf, int len),
514
+ int (GSDLLCALLPTR stdout_fn)(void *caller_handle, const char *str, int len),
515
+ int (GSDLLCALLPTR stderr_fn)(void *caller_handle, const char *str, int len));
516
+ typedef int (GSDLLAPIPTR PFN_gsapi_set_poll)(void *instance,
517
+ int(GSDLLCALLPTR poll_fn)(void *caller_handle));
518
+ typedef int (GSDLLAPIPTR PFN_gsapi_set_display_callback)(
519
+ void *instance, display_callback *callback);
520
+ typedef int (GSDLLAPIPTR PFN_gsapi_set_default_device_list)(
521
+ void *instance, char *list, int listlen);
522
+ typedef int (GSDLLAPIPTR PFN_gsapi_get_default_device_list)(
523
+ void *instance, char **list, int *listlen);
524
+ typedef int (GSDLLAPIPTR PFN_gsapi_init_with_args)(
525
+ void *instance, int argc, char **argv);
526
+ #ifdef __WIN32__
527
+ typedef int (GSDLLAPIPTR PFN_gsapi_init_with_argsA)(
528
+ void *instance, int argc, char **argv);
529
+ typedef int (GSDLLAPIPTR PFN_gsapi_init_with_argsW)(
530
+ void *instance, int argc, wchar_t **argv);
531
+ #endif
532
+ typedef int (GSDLLAPIPTR PFN_gsapi_set_arg_encoding)(
533
+ void *instance, int encoding);
534
+ typedef int (GSDLLAPIPTR PFN_gsapi_run_string_begin)(
535
+ void *instance, int user_errors, int *pexit_code);
536
+ typedef int (GSDLLAPIPTR PFN_gsapi_run_string_continue)(
537
+ void *instance, const char *str, unsigned int length,
538
+ int user_errors, int *pexit_code);
539
+ typedef int (GSDLLAPIPTR PFN_gsapi_run_string_end)(
540
+ void *instance, int user_errors, int *pexit_code);
541
+ typedef int (GSDLLAPIPTR PFN_gsapi_run_string_with_length)(
542
+ void *instance, const char *str, unsigned int length,
543
+ int user_errors, int *pexit_code);
544
+ typedef int (GSDLLAPIPTR PFN_gsapi_run_string)(
545
+ void *instance, const char *str,
546
+ int user_errors, int *pexit_code);
547
+ typedef int (GSDLLAPIPTR PFN_gsapi_run_file)(void *instance,
548
+ const char *file_name, int user_errors, int *pexit_code);
549
+ #ifdef __WIN32__
550
+ typedef int (GSDLLAPIPTR PFN_gsapi_run_fileA)(void *instance,
551
+ const char *file_name, int user_errors, int *pexit_code);
552
+ typedef int (GSDLLAPIPTR PFN_gsapi_run_fileW)(void *instance,
553
+ const wchar_t *file_name, int user_errors, int *pexit_code);
554
+ #endif
555
+ typedef int (GSDLLAPIPTR PFN_gsapi_exit)(void *instance);
556
+ typedef int (GSDLLAPIPTR PFN_gsapi_set_param)(void *instance, const char *param, const void *value, gs_set_param_type type);
557
+
558
+ typedef int (GSDLLAPIPTR PFN_gsapi_add_control_path)(void *instance, int type, const char *path);
559
+ typedef int (GSDLLAPIPTR PFN_gsapi_remove_control_path)(void *instance, int type, const char *path);
560
+ typedef void (GSDLLAPIPTR PFN_gsapi_purge_control_paths)(void *instance, int type);
561
+ typedef void (GSDLLAPIPTR PFN_gsapi_activate_path_control)(void *instance, int enable);
562
+ typedef int (GSDLLAPIPTR PFN_gsapi_is_path_control_active)(void *instance);
563
+ typedef int (GSDLLAPIPTR PFN_gsapi_add_fs)(void *instance, gsapi_fs_t *fs, void *secret);
564
+ typedef void (GSDLLAPIPTR PFN_gsapi_remove_fs)(void *instance, gsapi_fs_t *fs, void *secret);
565
+
566
+ #ifdef __MACOS__
567
+ #pragma export off
568
+ #endif
569
+
570
+ #ifdef __cplusplus
571
+ } /* extern 'C' protection */
572
+ #endif
573
+
574
+ #endif /* iapi_INCLUDED */
@@ -0,0 +1,72 @@
1
+ /* Copyright (C) 2001-2023 Artifex Software, Inc.
2
+ All Rights Reserved.
3
+
4
+ This software is provided AS-IS with no warranty, either express or
5
+ implied.
6
+
7
+ This software is distributed under license and may not be copied,
8
+ modified or distributed except as expressly authorized under the terms
9
+ of the license contained in the file LICENSE in this distribution.
10
+
11
+ Refer to licensing information at http://www.artifex.com or contact
12
+ Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
13
+ CA 94129, USA, for further information.
14
+ */
15
+
16
+
17
+ /* Definition of error codes */
18
+
19
+ #ifndef ierrors_INCLUDED
20
+ # define ierrors_INCLUDED
21
+
22
+ #include "gserrors.h"
23
+
24
+ /*
25
+ * DO NOT USE THIS FILE IN THE GRAPHICS LIBRARY.
26
+ * THIS FILE IS PART OF THE POSTSCRIPT INTERPRETER.
27
+ * USE gserrors.h IN THE LIBRARY.
28
+ */
29
+
30
+ /*
31
+ * A procedure that may return an error always returns
32
+ * a non-negative value (zero, unless otherwise noted) for success,
33
+ * or negative for failure.
34
+ * We use ints rather than an enum to avoid a lot of casting.
35
+ */
36
+
37
+ /* Define the error name table */
38
+ extern const char *const gs_error_names[];
39
+
40
+ /* ------ PostScript Level 1 errors ------ */
41
+
42
+ #define LEVEL1_ERROR_NAMES\
43
+ "unknownerror", "dictfull", "dictstackoverflow", "dictstackunderflow",\
44
+ "execstackoverflow", "interrupt", "invalidaccess", "invalidexit",\
45
+ "invalidfileaccess", "invalidfont", "invalidrestore", "ioerror",\
46
+ "limitcheck", "nocurrentpoint", "rangecheck", "stackoverflow",\
47
+ "stackunderflow", "syntaxerror", "timeout", "typecheck", "undefined",\
48
+ "undefinedfilename", "undefinedresult", "unmatchedmark", "VMerror"
49
+
50
+ /* ------ Additional Level 2 errors (also in DPS) ------ */
51
+
52
+ #define LEVEL2_ERROR_NAMES\
53
+ "configurationerror", "undefinedresource", "unregistered"
54
+
55
+ /* ------ Additional DPS errors ------ */
56
+
57
+ #define DPS_ERROR_NAMES\
58
+ "invalidcontext", "invalidid"
59
+
60
+ #define PDF_ERROR_NAMES\
61
+ "pdf_stackoverflow", "pdf_circular_reference"
62
+
63
+ #define ERROR_NAMES\
64
+ LEVEL1_ERROR_NAMES, LEVEL2_ERROR_NAMES, DPS_ERROR_NAMES, PDF_ERROR_NAMES
65
+
66
+ /*
67
+ * Define which error codes require re-executing the current object.
68
+ */
69
+ #define GS_ERROR_IS_INTERRUPT(ecode)\
70
+ ((ecode) == gs_error_interrupt || (ecode) == gs_error_timeout)
71
+
72
+ #endif /* ierrors_INCLUDED */
package/index.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ const path = require("node:path");
3
+
4
+ /**
5
+ * The libgs library and its headers.
6
+ * @type {{path: string, files: string[], include: string, headers: string[]}}
7
+ * The directory of the libraries and their names, and the directory of the
8
+ * headers and their names.
9
+ */
10
+ module.exports = {
11
+ path: path.join(__dirname, "lib"),
12
+ files: ["gs.a"],
13
+ include: path.join(__dirname, "include"),
14
+ headers: ["gdevdsp.h","gserrors.h","iapi.h","ierrors.h"],
15
+ };
package/lib/gs.a ADDED
@@ -0,0 +1,4 @@
1
+ [diffend] Oversized file quarantined before diffing.
2
+ name: package/lib/gs.a
3
+ size: 95137238 bytes
4
+ sha256: 7d265760ca7afb2b0e9991d242c0e934051d9ca57cfe61844c50a2ab8b81bf77
package/package.json CHANGED
@@ -1,6 +1,25 @@
1
1
  {
2
2
  "name": "@libgs/linux-ia32",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.17.0",
4
+ "description": "Ghostscript library (libgs) for linux ia32",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/NickNaso/libgs.git"
8
+ },
9
+ "main": "index.js",
10
+ "files": [
11
+ "index.js",
12
+ "lib",
13
+ "include"
14
+ ],
15
+ "preferUnplugged": true,
16
+ "os": [
17
+ "linux"
18
+ ],
19
+ "libc": [
20
+ "glibc"
21
+ ],
22
+ "cpu": [
23
+ "ia32"
24
+ ]
25
+ }