Haru Free PDF Library
hpdf_utils.h
Go to the documentation of this file.
1 /*
2  * << Haru Free PDF Library >> -- fpdf_utils.h
3  *
4  * URL: http://libharu.org
5  *
6  * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
7  * Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org>
8  *
9  * Permission to use, copy, modify, distribute and sell this software
10  * and its documentation for any purpose is hereby granted without fee,
11  * provided that the above copyright notice appear in all copies and
12  * that both that copyright notice and this permission notice appear
13  * in supporting documentation.
14  * It is provided "as is" without express or implied warranty.
15  *
16  */
17 
18 #ifndef _HPDF_UTILS_H
19 #define _HPDF_UTILS_H
20 
21 #include "hpdf_config.h"
22 #include "hpdf_types.h"
23 #include "hpdf_page_sizes.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28 
30 HPDF_AToI (const char* s);
31 
32 
34 HPDF_AToF (const char* s);
35 
36 
37 char*
38 HPDF_IToA (char* s,
39  HPDF_INT32 val,
40  char* eptr);
41 
42 
43 char*
44 HPDF_IToA2 (char *s,
45  HPDF_UINT32 val,
46  HPDF_UINT len);
47 
48 
49 char*
50 HPDF_FToA (char *s,
51  HPDF_REAL val,
52  char *eptr);
53 
54 
55 HPDF_BYTE*
57  const HPDF_BYTE* in,
58  HPDF_UINT n);
59 
60 
61 HPDF_BYTE*
62 HPDF_StrCpy (char* out,
63  const char* in,
64  char* eptr);
65 
66 
69  const HPDF_BYTE* s2,
70  HPDF_UINT n);
71 
72 
74 HPDF_StrCmp (const char* s1,
75  const char* s2);
76 
77 
78 const char*
79 HPDF_StrStr (const char *s1,
80  const char *s2,
81  HPDF_UINT maxlen);
82 
83 
84 void*
85 HPDF_MemSet (void* s,
86  HPDF_BYTE c,
87  HPDF_UINT n);
88 
89 
91 HPDF_StrLen (const char* s,
92  HPDF_INT maxlen);
93 
94 
97  HPDF_INT16 bottom,
98  HPDF_INT16 right,
99  HPDF_INT16 top);
100 
101 
104  HPDF_INT16 y);
105 
106 
107 HPDF_Rect
109  HPDF_REAL bottom,
110  HPDF_REAL right,
111  HPDF_REAL top);
112 
113 
114 void
116 
121 const char*
123 
133 
136 
139 
142 
145 
148 
149 
150 #ifdef __cplusplus
151 }
152 #endif /* __cplusplus */
153 
154 #define HPDF_NEEDS_ESCAPE(c) (c < 0x20 || \
155  c > 0x7e || \
156  c == '\\' || \
157  c == '%' || \
158  c == '#' || \
159  c == '/' || \
160  c == '(' || \
161  c == ')' || \
162  c == '<' || \
163  c == '>' || \
164  c == '[' || \
165  c == ']' || \
166  c == '{' || \
167  c == '}' ) \
168 
169 #define HPDF_IS_WHITE_SPACE(c) (c == 0x00 || \
170  c == 0x09 || \
171  c == 0x0A || \
172  c == 0x0C || \
173  c == 0x0D || \
174  c == 0x20 ) \
175 
176 /*----------------------------------------------------------------------------*/
177 /*----- macros for debug -----------------------------------------------------*/
178 
179 #ifdef LIBHPDF_DEBUG_TRACE
180 #ifndef HPDF_PTRACE_ON
181 #define HPDF_PTRACE_ON
182 #endif /* HPDF_PTRACE_ON */
183 #endif /* LIBHPDF_DEBUG_TRACE */
184 
185 #ifdef HPDF_PTRACE_ON
186 #define HPDF_PTRACE(ARGS) HPDF_PRINTF ARGS
187 #else
188 #define HPDF_PTRACE(ARGS) /* do nothing */
189 #endif /* HPDF_PTRACE */
190 
191 #ifdef LIBHPDF_DEBUG
192 #define HPDF_PRINT_BINARY(BUF, LEN, CAPTION) HPDF_PrintBinary(BUF, LEN, CAPTION)
193 #else
194 #define HPDF_PRINT_BINARY(BUF, LEN, CAPTION) /* do nothing */
195 #endif
196 
197 #endif /* _HPDF_UTILS_H */
198 
enum _HPDF_PageSizes HPDF_PageSizes
signed int HPDF_INT
Definition: hpdf_types.h:44
unsigned short HPDF_UINT16
Definition: hpdf_types.h:63
unsigned int HPDF_UINT
Definition: hpdf_types.h:45
unsigned int HPDF_UINT32
Definition: hpdf_types.h:57
float HPDF_REAL
Definition: hpdf_types.h:79
signed int HPDF_INT32
Definition: hpdf_types.h:56
unsigned char HPDF_BYTE
Definition: hpdf_types.h:74
double HPDF_DOUBLE
Definition: hpdf_types.h:84
signed short HPDF_INT16
Definition: hpdf_types.h:62
const char * HPDF_StrStr(const char *s1, const char *s2, HPDF_UINT maxlen)
char * HPDF_IToA2(char *s, HPDF_UINT32 val, HPDF_UINT len)
HPDF_UINT HPDF_StrLen(const char *s, HPDF_INT maxlen)
HPDF_Point HPDF_ToPoint(HPDF_INT16 x, HPDF_INT16 y)
HPDF_INT HPDF_MemCmp(const HPDF_BYTE *s1, const HPDF_BYTE *s2, HPDF_UINT n)
HPDF_BYTE * HPDF_MemCpy(HPDF_BYTE *out, const HPDF_BYTE *in, HPDF_UINT n)
HPDF_DOUBLE HPDF_AToF(const char *s)
HPDF_Rect HPDF_ToRect(HPDF_REAL left, HPDF_REAL bottom, HPDF_REAL right, HPDF_REAL top)
const char * HPDF_PageSizeName(HPDF_PageSizes size)
Return name of predefined page size.
char * HPDF_FToA(char *s, HPDF_REAL val, char *eptr)
void * HPDF_MemSet(void *s, HPDF_BYTE c, HPDF_UINT n)
char * HPDF_IToA(char *s, HPDF_INT32 val, char *eptr)
void HPDF_UInt16Swap(HPDF_UINT16 *value)
HPDF_Box HPDF_ToBox(HPDF_INT16 left, HPDF_INT16 bottom, HPDF_INT16 right, HPDF_INT16 top)
HPDF_TransMatrix HPDF_Matrix_Translate(HPDF_TransMatrix m, HPDF_REAL dx, HPDF_REAL dy)
HPDF_TransMatrix HPDF_Matrix_Multiply(HPDF_TransMatrix m, HPDF_TransMatrix n)
Multiply transformation matrices.
HPDF_TransMatrix HPDF_Matrix_RotateDeg(HPDF_TransMatrix m, HPDF_REAL degrees)
HPDF_INT HPDF_AToI(const char *s)
HPDF_INT HPDF_StrCmp(const char *s1, const char *s2)
HPDF_TransMatrix HPDF_Matrix_Rotate(HPDF_TransMatrix m, HPDF_REAL angle)
HPDF_TransMatrix HPDF_Matrix_Skew(HPDF_TransMatrix m, HPDF_REAL a, HPDF_REAL b)
HPDF_TransMatrix HPDF_Matrix_Scale(HPDF_TransMatrix m, HPDF_REAL sx, HPDF_REAL sy)
HPDF_BYTE * HPDF_StrCpy(char *out, const char *in, char *eptr)
Definition: hpdf_types.h:105
Definition: hpdf_types.h:110
Definition: hpdf_types.h:240