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