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 strhcpy(PSZ string1, const char *string2);
|
---|
35 |
|
---|
36 | #if defined(__DEBUG_MALLOC_ENABLED__) && !defined(DONT_REPLACE_STRINGH_MALLOC) // setup.h, helpers\memdebug.c
|
---|
37 | PSZ strhdupDebug(const char *pszSource,
|
---|
38 | const char *pcszSourceFile,
|
---|
39 | unsigned long ulLine,
|
---|
40 | const char *pcszFunction);
|
---|
41 | #define strhdup(a) strhdupDebug((a), __FILE__, __LINE__, __FUNCTION__)
|
---|
42 | #else
|
---|
43 | PSZ strhdup(const char *pszSource);
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | int strhcmp(const char *p1, const char *p2);
|
---|
47 |
|
---|
48 | int strhicmp(const char *p1, const char *p2);
|
---|
49 |
|
---|
50 | PSZ strhistr(const char *string1, const char *string2);
|
---|
51 |
|
---|
52 | ULONG strhncpy0(PSZ pszTarget,
|
---|
53 | const char *pszSource,
|
---|
54 | ULONG cbSource);
|
---|
55 |
|
---|
56 | ULONG strhCount(const char *pszSearch, CHAR c);
|
---|
57 |
|
---|
58 | BOOL strhIsDecimal(PSZ psz);
|
---|
59 |
|
---|
60 | #if defined(__DEBUG_MALLOC_ENABLED__) && !defined(DONT_REPLACE_STRINGH_MALLOC) // setup.h, helpers\memdebug.c
|
---|
61 | PSZ strhSubstrDebug(const char *pBegin, // in: first char
|
---|
62 | const char *pEnd, // in: last char (not included)
|
---|
63 | const char *pcszSourceFile,
|
---|
64 | unsigned long ulLine,
|
---|
65 | const char *pcszFunction);
|
---|
66 | #define strhSubstr(a, b) strhSubstrDebug((a), (b), __FILE__, __LINE__, __FUNCTION__)
|
---|
67 | #else
|
---|
68 | PSZ strhSubstr(const char *pBegin, const char *pEnd);
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | PSZ strhExtract(PSZ pszBuf,
|
---|
72 | CHAR cOpen,
|
---|
73 | CHAR cClose,
|
---|
74 | PSZ *ppEnd);
|
---|
75 |
|
---|
76 | PSZ strhQuote(PSZ pszBuf,
|
---|
77 | CHAR cQuote,
|
---|
78 | PSZ *ppEnd);
|
---|
79 |
|
---|
80 | ULONG strhStrip(PSZ psz);
|
---|
81 |
|
---|
82 | PSZ strhins(const char *pcszBuffer,
|
---|
83 | ULONG ulInsertOfs,
|
---|
84 | const char *pcszInsert);
|
---|
85 |
|
---|
86 | ULONG strhFindReplace(PSZ *ppszBuf,
|
---|
87 | PULONG pulOfs,
|
---|
88 | const char *pcszSearch,
|
---|
89 | const char *pcszReplace);
|
---|
90 |
|
---|
91 | ULONG strhWords(PSZ psz);
|
---|
92 |
|
---|
93 | #define STRH_BEGIN_CHARS "\x0d\x0a "
|
---|
94 | #define STRH_END_CHARS "\x0d\x0a /-"
|
---|
95 |
|
---|
96 | BOOL strhGetWord(PSZ *ppszStart,
|
---|
97 | const char *pLimit,
|
---|
98 | const char *pcszBeginChars,
|
---|
99 | const char *pcszEndChars, // = "\x0d\x0a /-";
|
---|
100 | PSZ *ppszEnd);
|
---|
101 |
|
---|
102 | BOOL strhIsWord(const char *pcszBuf,
|
---|
103 | const char *p,
|
---|
104 | ULONG cbSearch,
|
---|
105 | const char *pcszBeginChars,
|
---|
106 | const char *pcszEndChars);
|
---|
107 |
|
---|
108 | PSZ strhFindWord(const char *pszBuf,
|
---|
109 | const char *pszSearch,
|
---|
110 | const char *pcszBeginChars,
|
---|
111 | const char *pcszEndChars);
|
---|
112 |
|
---|
113 | PSZ strhFindEOL(const char *pcszSearchIn, ULONG *pulOffset);
|
---|
114 |
|
---|
115 | PSZ strhFindNextLine(PSZ pszSearchIn, PULONG pulOffset);
|
---|
116 |
|
---|
117 | BOOL strhBeautifyTitle(PSZ psz);
|
---|
118 |
|
---|
119 | PSZ strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib);
|
---|
120 |
|
---|
121 | PSZ strhGetNumAttribValue(const char *pszSearchIn,
|
---|
122 | const char *pszTag,
|
---|
123 | PLONG pl);
|
---|
124 |
|
---|
125 | PSZ strhGetTextAttr(const char *pszSearchIn, const char *pszTag, PULONG pulOffset);
|
---|
126 |
|
---|
127 | PSZ strhFindEndOfTag(const char *pszBeginOfTag);
|
---|
128 |
|
---|
129 | ULONG strhGetBlock(const char *pszSearchIn,
|
---|
130 | PULONG pulSearchOffset,
|
---|
131 | PSZ pszTag,
|
---|
132 | PSZ *ppszBlock,
|
---|
133 | PSZ *ppszAttribs,
|
---|
134 | PULONG pulOfsBeginTag,
|
---|
135 | PULONG pulOfsBeginBlock);
|
---|
136 |
|
---|
137 | /* ******************************************************************
|
---|
138 | *
|
---|
139 | * Miscellaneous
|
---|
140 | *
|
---|
141 | ********************************************************************/
|
---|
142 |
|
---|
143 | VOID XWPENTRY strhArrayAppend(PSZ *ppszRoot,
|
---|
144 | const char *pcszNew,
|
---|
145 | ULONG cbNew,
|
---|
146 | PULONG pcbRoot);
|
---|
147 |
|
---|
148 | PSZ strhCreateDump(PBYTE pb,
|
---|
149 | ULONG ulSize,
|
---|
150 | ULONG ulIndent);
|
---|
151 |
|
---|
152 | /* ******************************************************************
|
---|
153 | *
|
---|
154 | * Wildcard matching
|
---|
155 | *
|
---|
156 | ********************************************************************/
|
---|
157 |
|
---|
158 | #define FNM_MATCH 0
|
---|
159 | #define FNM_NOMATCH 1
|
---|
160 | #define FNM_ERR 2
|
---|
161 |
|
---|
162 | #define FNM_NOESCAPE 16
|
---|
163 | #define FNM_PATHNAME 32
|
---|
164 | #define FNM_PERIOD 64
|
---|
165 |
|
---|
166 | #define FNM_STYLE_MASK 15
|
---|
167 |
|
---|
168 | #define FNM_POSIX 0
|
---|
169 | #define FNM_OS2 1
|
---|
170 | #define FNM_DOS 2
|
---|
171 |
|
---|
172 | #define FNM_IGNORECASE 128
|
---|
173 | #define FNM_PATHPREFIX 256
|
---|
174 |
|
---|
175 | BOOL strhMatchOS2(const char *pcszMask, const char *pcszName);
|
---|
176 |
|
---|
177 | BOOL strhMatchExt(const char *pcszMask,
|
---|
178 | const char *pcszName,
|
---|
179 | unsigned flags);
|
---|
180 |
|
---|
181 | /* ******************************************************************
|
---|
182 | *
|
---|
183 | * Fast string searches
|
---|
184 | *
|
---|
185 | ********************************************************************/
|
---|
186 |
|
---|
187 | void* strhmemfind(const void *in_block,
|
---|
188 | size_t block_size,
|
---|
189 | const void *in_pattern,
|
---|
190 | size_t pattern_size,
|
---|
191 | size_t *shift,
|
---|
192 | BOOL *repeat_find);
|
---|
193 |
|
---|
194 | char* strhtxtfind (const char *string,
|
---|
195 | const char *pattern);
|
---|
196 |
|
---|
197 | #endif
|
---|
198 |
|
---|
199 | #if __cplusplus
|
---|
200 | }
|
---|
201 | #endif
|
---|
202 |
|
---|