1 /* Copyright (C) 1992, 1993, 1999 artofcode LLC.  All rights reserved.
2 
3   This program is free software; you can redistribute it and/or modify it
4   under the terms of the GNU General Public License as published by the
5   Free Software Foundation; either version 2 of the License, or (at your
6   option) any later version.
7 
8   This program is distributed in the hope that it will be useful, but
9   WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   General Public License for more details.
12 
13   You should have received a copy of the GNU General Public License along
14   with this program; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA, 02111-1307.
16 
17 */
18 
19 /*$Id: gsutil.h,v 1.3.6.2.2.1 2003/01/17 00:49:03 giles Exp $ */
20 /* Prototypes for procedures in gsutil.c */
21 
22 #ifndef gsutil_INCLUDED
23 #  define gsutil_INCLUDED
24 
25 /* ------ Unique IDs ------ */
26 
27 /* Generate a block of unique IDs. */
28 gs_id gs_next_ids(P1(uint count));
29 
30 /* ------ Memory utilities ------ */
31 
32 /* Transpose an 8 x 8 block of bits. */
33 /* line_size is the raster of the input data; */
34 /* dist is the distance between output bytes. */
35 /* Dot matrix printers need this. */
36 /* Note that with a negative dist value, */
37 /* this will rotate an 8 x 8 block 90 degrees counter-clockwise. */
38 void memflip8x8(P4(const byte * inp, int line_size, byte * outp, int dist));
39 
40 /* Get an unsigned, big-endian 32-bit value. */
41 ulong get_u32_msb(P1(const byte *p));
42 
43 /* ------ String utilities ------ */
44 
45 /* Compare two strings, returning -1 if the first is less, */
46 /* 0 if they are equal, and 1 if first is greater. */
47 /* We can't use memcmp, because we always use unsigned characters. */
48 int bytes_compare(P4(const byte * str1, uint len1,
49 		     const byte * str2, uint len2));
50 
51 /* Test whether a string matches a pattern with wildcards. */
52 /* If psmp == NULL, use standard parameters: '*' = any substring, */
53 /* '?' = any character, '\\' quotes next character, don't ignore case. */
54 typedef struct string_match_params_s {
55     int any_substring;		/* '*' */
56     int any_char;		/* '?' */
57     int quote_next;		/* '\\' */
58     bool ignore_case;
59     bool slash_equiv;	/* '\\' is equivalent to '/' for Windows filename matching */
60 } string_match_params;
61 extern const string_match_params string_match_params_default;
62 bool string_match(P5(const byte * str, uint len,
63 		     const byte * pstr, uint plen,
64 		     const string_match_params * psmp));
65 
66 #endif /* gsutil_INCLUDED */
67