summaryrefslogtreecommitdiff
path: root/src/pdflib/pdcore/pc_resource.h
blob: d83a27f66a93fbe61ce54613e7352d6cf64c4576 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*---------------------------------------------------------------------------*
 |              PDFlib - A library for generating PDF on the fly             |
 +---------------------------------------------------------------------------+
 | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. |
 +---------------------------------------------------------------------------+
 |                                                                           |
 |    This software is subject to the PDFlib license. It is NOT in the       |
 |    public domain. Extended versions and commercial licenses are           |
 |    available, please check http://www.pdflib.com.                         |
 |                                                                           |
 *---------------------------------------------------------------------------*/

/* $Id: pc_resource.h,v 1.2 2009/10/20 18:12:26 scuri Exp $
 *
 * Resource routines
 *
 */

#ifndef PC_RESOURCE_H
#define PC_RESOURCE_H

#ifdef PC_RESOURCE_C
#if !defined(WIN32) && !defined(AS400) && !defined(MVS)

/* default SearchPath list for UNIX like systems
*/

/* %s: $HOME
*/
static const char *rootdirectories[] =
{
    "/usr/local",
    "%s",
    NULL
};

/*
 * first  %s: root directory
 * second %s: pdc->prodname
 * third  %s: pdc->version without revision: <major>.<minor>
 */
static const char *defsearchpathlist[] =
{
    "%s/PDFlib",
    "%s/PDFlib/%s",
    "%s/PDFlib/%s/%s",
    "%s/PDFlib/%s/%s/resource/cmap",
    "%s/PDFlib/%s/%s/resource/fonts",
    "%s/PDFlib/%s/%s/resource/icc",
    NULL
};

#endif /* !WIN32 && !AS400 && !MVS */
#endif /* PC_RESOURCE_C */

/* pdcore logg classes (maximal PDC_CLASSLIST_SIZE) */
typedef enum
{
    trc_other = 0,      /* other classes */
    trc_api,            /* API function call logging */
    trc_encoding,       /* encoding, cmap end textformat logging */
    trc_digsig,         /* digital signatures */
    trc_filesearch,     /* file search logging */
    trc_font,           /* font logging */
    trc_image,          /* image and template logging */
    trc_memory,         /* memory logging */
    trc_optlist,        /* optlist logging */
    trc_pcos,           /* pcos logging */
    trc_pdi,            /* pdi logging */
    trc_resource,       /* resource logging */
    trc_shadow,         /* shadow logging */
    trc_text,           /* text logging */
    trc_textflow,       /* textflow logging */
    trc_table,          /* table logging */
    trc_user,           /* user logging */
    trc_warning,        /* logging of disabled warnings */
    trc_wordfinder,     /* word finder logging */
    trc_xmp,            /* xmp logging */
    trc_zones,          /* zones logging */

    trc_numclasses      /* number of classes */
}
pdc_logg_class;

/* string code kinds */
typedef enum
{
    strform_readable,
    strform_readable0,
    strform_octal,
    strform_hexa,
    strform_java
}
pdc_strform_kind;


typedef struct pdc_res_s pdc_res;
typedef struct pdc_category_s pdc_category;
typedef struct pdc_reslist_s pdc_reslist;
typedef struct pdc_virtfile_s pdc_virtfile;
typedef struct pdc_loggdef_s pdc_loggdef;


/* -------------------------- resource handling ----------------------------- */

pdc_reslist *pdc_new_reslist(pdc_core *pdc);
void pdc_delete_reslist(pdc_core *pdc);
void pdc_set_resourcefile(pdc_core *pdc, const char *filename);
void pdc_add_resource_ext(pdc_core *pdc, const char *category,
        const char *resname, const char *resvalue, pdc_encoding enc,
        int codepage);
void pdc_add_resource(pdc_core *pdc, const char *category,
        const char *resname, const char *resvalue);
const char *pdc_find_resource(pdc_core *pdc, const char *category,
        const char *name);
const char *pdc_find_resource_nr(pdc_core *pdc, const char *category, int nr);
const char *pdc_get_resourcefile(pdc_core *pdc);



/* ----------------------- virtual file handling ---------------------------- */

void pdc__create_pvf(pdc_core *pdc, const char *filename,
        const void *data, size_t size, const char *optlist);
int pdc__delete_pvf(pdc_core *pdc, const char *filename);
void pdc_lock_pvf(pdc_core *pdc, const char *filename);
void pdc_unlock_pvf(pdc_core *pdc, const char *filename);
void pdc_delete_filesystem(pdc_core *pdc);


/* ----------------------- logging file handling ---------------------------- */

void pdc_delete_logg(pdc_core *pdc);
void pdc_set_logg_options(pdc_core *pdc, const char *optlist);
const char *pdc_print_loggstring(pdc_core *pdc, const char *str, int len);
pdc_bool pdc_enter_api_logg(pdc_core *pdc, const char *funame,
        pdc_bool enter_api, const char *fmt, va_list args);
void pdc_logg_exit_api(pdc_core *pdc, pdc_bool cleanup,
                           const char *fmt, ...);
void pdc_logg_enable(pdc_core *pdc, pdc_bool enable);
pdc_bool pdc_logg_is_enabled(pdc_core *pdc, int level, int pclass);
void pdc_logg(pdc_core *pdc, const char *fmt, ...);
void pdc_logg_cond(pdc_core *pdc, int level, int pclass,
                           const char *fmt, ...);
void pdc_logg_bitarr(pdc_core *pdc, const char *msg, const char *bitarr,
        int nbit);
void pdc_logg_hexdump(pdc_core *pdc, const char *msg,  const char *prefix,
        const char *text, int tlen);
void pdc_warning(pdc_core *pdc, int errnum, const char *parm1,
        const char *parm2, const char *parm3, const char *parm4);

void pdc_logg_unichar(pdc_core *pdc, int unichar, pdc_bool kfill,
        pdc_bool newline);
void pdc_logg_unitext(pdc_core *pdc, pdc_ushort *ustext, int len,
        pdc_bool newline);

int pdc_logg_getlevel(pdc_core *pdc, int pclass);

#endif  /* PC_RESOURCE_H */