1 /* Copyright (C) 2001-2012 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., 7 Mt. Lassen Drive - Suite A-134, San Rafael, 13 CA 94903, U.S.A., +1(415)492-9861, for further information. 14 */ 15 16 17 18 #ifndef gsfname_INCLUDED 19 # define gsfname_INCLUDED 20 21 /* 22 * Structure and procedures for parsing file names. 23 * 24 * Define a structure for representing a parsed file name, consisting of 25 * an IODevice name in %'s, a file name, or both. Note that the file name 26 * may be either a gs_string (no terminator) or a C string (null terminator). 27 * 28 * NOTE: You must use parse_[real_]file_name to construct parsed_file_names. 29 * Do not simply allocate the structure and fill it in. 30 */ 31 #ifndef gx_io_device_DEFINED 32 # define gx_io_device_DEFINED 33 typedef struct gx_io_device_s gx_io_device; 34 #endif 35 36 typedef struct gs_parsed_file_name_s { 37 gs_memory_t *memory; /* allocator for terminated name string */ 38 gx_io_device *iodev; 39 const char *fname; 40 uint len; 41 } gs_parsed_file_name_t; 42 43 /* Parse a file name into device and individual name. */ 44 int gs_parse_file_name(gs_parsed_file_name_t *, const char *, uint, 45 const gs_memory_t *); 46 47 /* Parse a real (non-device) file name and convert to a C string. */ 48 int gs_parse_real_file_name(gs_parsed_file_name_t *, const char *, uint, 49 gs_memory_t *, client_name_t); 50 51 /* Convert a file name to a C string by adding a null terminator. */ 52 int gs_terminate_file_name(gs_parsed_file_name_t *, gs_memory_t *, 53 client_name_t); 54 55 /* Free a file name that was copied to a C string. */ 56 void gs_free_file_name(gs_parsed_file_name_t *, client_name_t); 57 58 #endif /* gsfname_INCLUDED */ 59