xref: /plan9/sys/src/cmd/gs/src/gsutil.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1992, 1993, 1999 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gsutil.h,v 1.8 2004/08/04 19:36:12 stefan Exp $ */
18 /* Prototypes for procedures in gsutil.c */
19 
20 #ifndef gsutil_INCLUDED
21 #  define gsutil_INCLUDED
22 
23 /* ------ Unique IDs ------ */
24 
25 /* Generate a block of unique IDs. */
26 gs_id gs_next_ids(const gs_memory_t *mem, uint count);
27 
28 /* ------ Memory utilities ------ */
29 
30 /* Transpose an 8 x 8 block of bits. */
31 /* line_size is the raster of the input data; */
32 /* dist is the distance between output bytes. */
33 /* Dot matrix printers need this. */
34 /* Note that with a negative dist value, */
35 /* this will rotate an 8 x 8 block 90 degrees counter-clockwise. */
36 void memflip8x8(const byte * inp, int line_size, byte * outp, int dist);
37 
38 /* Get an unsigned, big-endian 32-bit value. */
39 ulong get_u32_msb(const byte *p);
40 
41 /* ------ String utilities ------ */
42 
43 /* Compare two strings, returning -1 if the first is less, */
44 /* 0 if they are equal, and 1 if first is greater. */
45 /* We can't use memcmp, because we always use unsigned characters. */
46 int bytes_compare(const byte * str1, uint len1,
47 		  const byte * str2, uint len2);
48 
49 /* Test whether a string matches a pattern with wildcards. */
50 /* If psmp == NULL, use standard parameters: '*' = any substring, */
51 /* '?' = any character, '\\' quotes next character, don't ignore case. */
52 typedef struct string_match_params_s {
53     int any_substring;		/* '*' */
54     int any_char;		/* '?' */
55     int quote_next;		/* '\\' */
56     bool ignore_case;
57     bool slash_equiv;	/* '\\' is equivalent to '/' for Windows filename matching */
58 } string_match_params;
59 extern const string_match_params string_match_params_default;
60 bool string_match(const byte * str, uint len,
61 		  const byte * pstr, uint plen,
62 		  const string_match_params * psmp);
63 
64 /* graphical object tags */
65 typedef enum {
66     GS_DEVICE_DOESNT_SUPPORT_TAGS = 0, /* default */
67     GS_UNKNOWN_TAG = 0x1,
68     GS_TEXT_TAG = 0x2,
69     GS_IMAGE_TAG = 0x4,
70     GS_PATH_TAG = 0x8,
71     GS_UNTOUCHED_TAG = 0x10
72 } gs_object_tag_type_t;
73 
74 /* accessors for object tags */
75 gs_object_tag_type_t gs_current_object_tag(void);
76 
77 #include "gxstate.h"
78 
79 void gs_set_object_tag(gs_state * pgs, const gs_object_tag_type_t tag);
80 void gs_enable_object_tagging(void);
81 
82 #endif /* gsutil_INCLUDED */
83