1 | /* $Id: stringh.h 23 2001-01-16 19:49:10Z umoeller $ */
|
---|
2 |
|
---|
3 |
|
---|
4 | /*
|
---|
5 | *@@sourcefile stringh.h:
|
---|
6 | * header file for stringh.c. See notes there.
|
---|
7 | *
|
---|
8 | * Note: Version numbering in this file relates to XWorkplace version
|
---|
9 | * numbering.
|
---|
10 | *
|
---|
11 | *@@include #define INCL_DOSDATETIME
|
---|
12 | *@@include #include <os2.h>
|
---|
13 | *@@include #include "stringh.h"
|
---|
14 | */
|
---|
15 |
|
---|
16 | /*
|
---|
17 | * Copyright (C) 1997-2000 Ulrich Mller.
|
---|
18 | * This file is part of the "XWorkplace helpers" source package.
|
---|
19 | * This is free software; you can redistribute it and/or modify
|
---|
20 | * it under the terms of the GNU General Public License as published
|
---|
21 | * by the Free Software Foundation, in version 2 as it comes in the
|
---|
22 | * "COPYING" file of the XWorkplace main distribution.
|
---|
23 | * This program is distributed in the hope that it will be useful,
|
---|
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
26 | * GNU General Public License for more details.
|
---|
27 | */
|
---|
28 |
|
---|
29 | #if __cplusplus
|
---|
30 | extern "C" {
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #ifndef STRINGH_HEADER_INCLUDED
|
---|
34 | #define STRINGH_HEADER_INCLUDED
|
---|
35 |
|
---|
36 | PSZ strhdup(const char *pszSource);
|
---|
37 |
|
---|
38 | PSZ strhistr(const char *string1, const char *string2);
|
---|
39 |
|
---|
40 | ULONG strhncpy0(PSZ pszTarget,
|
---|
41 | const char *pszSource,
|
---|
42 | ULONG cbSource);
|
---|
43 |
|
---|
44 | ULONG strhCount(const char *pszSearch, CHAR c);
|
---|
45 |
|
---|
46 | BOOL strhIsDecimal(PSZ psz);
|
---|
47 |
|
---|
48 | PSZ strhSubstr(const char *pBegin, const char *pEnd);
|
---|
49 |
|
---|
50 | PSZ strhExtract(PSZ pszBuf,
|
---|
51 | CHAR cOpen,
|
---|
52 | CHAR cClose,
|
---|
53 | PSZ *ppEnd);
|
---|
54 |
|
---|
55 | PSZ strhQuote(PSZ pszBuf,
|
---|
56 | CHAR cQuote,
|
---|
57 | PSZ *ppEnd);
|
---|
58 |
|
---|
59 | ULONG strhStrip(PSZ psz);
|
---|
60 |
|
---|
61 | PSZ strhins(const char *pcszBuffer,
|
---|
62 | ULONG ulInsertOfs,
|
---|
63 | const char *pcszInsert);
|
---|
64 |
|
---|
65 | ULONG strhFindReplace(PSZ *ppszBuf,
|
---|
66 | PULONG pulOfs,
|
---|
67 | const char *pcszSearch,
|
---|
68 | const char *pcszReplace);
|
---|
69 |
|
---|
70 | ULONG strhWords(PSZ psz);
|
---|
71 |
|
---|
72 | PSZ APIENTRY strhThousandsULong(PSZ pszTarget, ULONG ul, CHAR cThousands);
|
---|
73 | typedef PSZ APIENTRY STRHTHOUSANDSULONG(PSZ pszTarget, ULONG ul, CHAR cThousands);
|
---|
74 | typedef STRHTHOUSANDSULONG *PSTRHTHOUSANDSULONG;
|
---|
75 |
|
---|
76 | PSZ strhThousandsDouble(PSZ pszTarget, double dbl, CHAR cThousands);
|
---|
77 |
|
---|
78 | PSZ strhVariableDouble(PSZ pszTarget, double dbl, PSZ pszUnits,
|
---|
79 | CHAR cThousands);
|
---|
80 |
|
---|
81 | VOID strhFileDate(PSZ pszBuf,
|
---|
82 | FDATE *pfDate,
|
---|
83 | ULONG ulDateFormat,
|
---|
84 | CHAR cDateSep);
|
---|
85 |
|
---|
86 | VOID strhFileTime(PSZ pszBuf,
|
---|
87 | FTIME *pfTime,
|
---|
88 | ULONG ulTimeFormat,
|
---|
89 | CHAR cTimeSep);
|
---|
90 |
|
---|
91 | VOID APIENTRY strhDateTime(PSZ pszDate,
|
---|
92 | PSZ pszTime,
|
---|
93 | DATETIME *pDateTime,
|
---|
94 | ULONG ulDateFormat,
|
---|
95 | CHAR cDateSep,
|
---|
96 | ULONG ulTimeFormat,
|
---|
97 | CHAR cTimeSep);
|
---|
98 | typedef VOID APIENTRY STRHDATETIME(PSZ pszDate,
|
---|
99 | PSZ pszTime,
|
---|
100 | DATETIME *pDateTime,
|
---|
101 | ULONG ulDateFormat,
|
---|
102 | CHAR cDateSep,
|
---|
103 | ULONG ulTimeFormat,
|
---|
104 | CHAR cTimeSep);
|
---|
105 | typedef STRHDATETIME *PSTRHDATETIME;
|
---|
106 |
|
---|
107 | #define STRH_BEGIN_CHARS "\x0d\x0a "
|
---|
108 | #define STRH_END_CHARS "\x0d\x0a /-"
|
---|
109 |
|
---|
110 | BOOL strhGetWord(PSZ *ppszStart,
|
---|
111 | const char *pLimit,
|
---|
112 | const char *pcszBeginChars,
|
---|
113 | const char *pcszEndChars, // = "\x0d\x0a /-";
|
---|
114 | PSZ *ppszEnd);
|
---|
115 |
|
---|
116 | BOOL strhIsWord(const char *pcszBuf,
|
---|
117 | const char *p,
|
---|
118 | ULONG cbSearch,
|
---|
119 | const char *pcszBeginChars,
|
---|
120 | const char *pcszEndChars);
|
---|
121 |
|
---|
122 | PSZ strhFindWord(const char *pszBuf,
|
---|
123 | const char *pszSearch,
|
---|
124 | const char *pcszBeginChars,
|
---|
125 | const char *pcszEndChars);
|
---|
126 |
|
---|
127 | PSZ strhFindEOL(const char *pcszSearchIn, ULONG *pulOffset);
|
---|
128 |
|
---|
129 | PSZ strhFindNextLine(PSZ pszSearchIn, PULONG pulOffset);
|
---|
130 |
|
---|
131 | BOOL strhBeautifyTitle(PSZ psz);
|
---|
132 |
|
---|
133 | PSZ strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib);
|
---|
134 |
|
---|
135 | PSZ strhGetNumAttribValue(const char *pszSearchIn,
|
---|
136 | const char *pszTag,
|
---|
137 | PLONG pl);
|
---|
138 |
|
---|
139 | PSZ strhGetTextAttr(const char *pszSearchIn, const char *pszTag, PULONG pulOffset);
|
---|
140 |
|
---|
141 | PSZ strhFindEndOfTag(const char *pszBeginOfTag);
|
---|
142 |
|
---|
143 | ULONG strhGetBlock(const char *pszSearchIn,
|
---|
144 | PULONG pulSearchOffset,
|
---|
145 | PSZ pszTag,
|
---|
146 | PSZ *ppszBlock,
|
---|
147 | PSZ *ppszAttribs,
|
---|
148 | PULONG pulOfsBeginTag,
|
---|
149 | PULONG pulOfsBeginBlock);
|
---|
150 |
|
---|
151 | /* ******************************************************************
|
---|
152 | *
|
---|
153 | * Miscellaneous
|
---|
154 | *
|
---|
155 | ********************************************************************/
|
---|
156 |
|
---|
157 | VOID strhArrayAppend(PSZ *ppszRoot,
|
---|
158 | const char *pcszNew,
|
---|
159 | PULONG pcbRoot);
|
---|
160 |
|
---|
161 | PSZ strhCreateDump(PBYTE pb,
|
---|
162 | ULONG ulSize,
|
---|
163 | ULONG ulIndent);
|
---|
164 |
|
---|
165 | /* ******************************************************************
|
---|
166 | *
|
---|
167 | * Wildcard matching
|
---|
168 | *
|
---|
169 | ********************************************************************/
|
---|
170 |
|
---|
171 | #define FNM_MATCH 0
|
---|
172 | #define FNM_NOMATCH 1
|
---|
173 | #define FNM_ERR 2
|
---|
174 |
|
---|
175 | #define FNM_NOESCAPE 16
|
---|
176 | #define FNM_PATHNAME 32
|
---|
177 | #define FNM_PERIOD 64
|
---|
178 |
|
---|
179 | #define _FNM_STYLE_MASK 15
|
---|
180 |
|
---|
181 | #define _FNM_POSIX 0
|
---|
182 | #define _FNM_OS2 1
|
---|
183 | #define _FNM_DOS 2
|
---|
184 |
|
---|
185 | #define _FNM_IGNORECASE 128
|
---|
186 | #define _FNM_PATHPREFIX 256
|
---|
187 |
|
---|
188 | BOOL strhMatchOS2(const unsigned char* pcszMask, const unsigned char* pcszName);
|
---|
189 |
|
---|
190 | /* ******************************************************************
|
---|
191 | *
|
---|
192 | * Fast string searches
|
---|
193 | *
|
---|
194 | ********************************************************************/
|
---|
195 |
|
---|
196 | void* strhmemfind(const void *in_block,
|
---|
197 | size_t block_size,
|
---|
198 | const void *in_pattern,
|
---|
199 | size_t pattern_size,
|
---|
200 | size_t *shift,
|
---|
201 | BOOL *repeat_find);
|
---|
202 |
|
---|
203 | char* strhtxtfind (const char *string,
|
---|
204 | const char *pattern);
|
---|
205 |
|
---|
206 | #endif
|
---|
207 |
|
---|
208 | #if __cplusplus
|
---|
209 | }
|
---|
210 | #endif
|
---|
211 |
|
---|