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