1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/* Copyright (C) 2001-2019 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
Refer to licensing information at http://www.artifex.com or contact
Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato,
CA 94945, U.S.A., +1(415)492-9861, for further information.
*/
/* Prototypes for procedures in gsutil.c */
#ifndef gsutil_INCLUDED
# define gsutil_INCLUDED
#include "std.h"
#include "gstypes.h"
/* ------ Unique IDs ------ */
/* Generate a block of unique IDs. */
gs_id gs_next_ids(const gs_memory_t *mem, uint count);
/* ------ Memory utilities ------ */
/* Transpose an 8 x 8 block of bits. */
/* line_size is the raster of the input data; */
/* dist is the distance between output bytes. */
/* Dot matrix printers need this. */
/* Note that with a negative dist value, */
/* this will rotate an 8 x 8 block 90 degrees counter-clockwise. */
void memflip8x8(const byte * inp, int line_size, byte * outp, int dist);
#ifdef PACIFY_VALGRIND
/* A variant that does the same thing, but allows for undefined
* bits at the end of a line. */
void memflip8x8_eol(const byte * inp, int line_size, byte * outp, int dist, int bits);
#endif
/* Get an unsigned, big-endian 32-bit value. */
ulong get_u32_msb(const byte *p);
/* Put an unsigned, big-endian 32-bit value. */
void
put_u32_msb(byte *p, const ulong n, const int offs);
/* ------ String utilities ------ */
/* Compare two strings, returning -1 if the first is less, */
/* 0 if they are equal, and 1 if first is greater. */
/* We can't use memcmp, because we always use unsigned characters. */
int bytes_compare(const byte * str1, uint len1,
const byte * str2, uint len2);
/* Test whether a string matches a pattern with wildcards. */
/* If psmp == NULL, use standard parameters: '*' = any substring, */
/* '?' = any character, '\\' quotes next character, don't ignore case. */
typedef struct string_match_params_s {
int any_substring; /* '*' */
int any_char; /* '?' */
int quote_next; /* '\\' */
bool ignore_case;
bool slash_equiv; /* '\\' is equivalent to '/' for Windows filename matching */
} string_match_params;
extern const string_match_params string_match_params_default;
bool string_match(const byte * str, uint len,
const byte * pstr, uint plen,
const string_match_params * psmp);
#endif /* gsutil_INCLUDED */
|