source: trunk/include/helpers/stringh.h@ 94

Last change on this file since 94 was 91, checked in by umoeller, 24 years ago

Misc changes

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 7.9 KB
Line 
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 M”ller.
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
28extern "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 PSZ APIENTRY strhThousandsULong(PSZ pszTarget, ULONG ul, CHAR cThousands);
94 typedef PSZ APIENTRY STRHTHOUSANDSULONG(PSZ pszTarget, ULONG ul, CHAR cThousands);
95 typedef STRHTHOUSANDSULONG *PSTRHTHOUSANDSULONG;
96
97 PSZ strhThousandsDouble(PSZ pszTarget, double dbl, CHAR cThousands);
98
99 PSZ strhVariableDouble(PSZ pszTarget, double dbl, PSZ pszUnits,
100 CHAR cThousands);
101
102 VOID strhFileDate(PSZ pszBuf,
103 FDATE *pfDate,
104 ULONG ulDateFormat,
105 CHAR cDateSep);
106
107 VOID strhFileTime(PSZ pszBuf,
108 FTIME *pfTime,
109 ULONG ulTimeFormat,
110 CHAR cTimeSep);
111
112 VOID APIENTRY strhDateTime(PSZ pszDate,
113 PSZ pszTime,
114 DATETIME *pDateTime,
115 ULONG ulDateFormat,
116 CHAR cDateSep,
117 ULONG ulTimeFormat,
118 CHAR cTimeSep);
119 typedef VOID APIENTRY STRHDATETIME(PSZ pszDate,
120 PSZ pszTime,
121 DATETIME *pDateTime,
122 ULONG ulDateFormat,
123 CHAR cDateSep,
124 ULONG ulTimeFormat,
125 CHAR cTimeSep);
126 typedef STRHDATETIME *PSTRHDATETIME;
127
128 #define STRH_BEGIN_CHARS "\x0d\x0a "
129 #define STRH_END_CHARS "\x0d\x0a /-"
130
131 BOOL strhGetWord(PSZ *ppszStart,
132 const char *pLimit,
133 const char *pcszBeginChars,
134 const char *pcszEndChars, // = "\x0d\x0a /-";
135 PSZ *ppszEnd);
136
137 BOOL strhIsWord(const char *pcszBuf,
138 const char *p,
139 ULONG cbSearch,
140 const char *pcszBeginChars,
141 const char *pcszEndChars);
142
143 PSZ strhFindWord(const char *pszBuf,
144 const char *pszSearch,
145 const char *pcszBeginChars,
146 const char *pcszEndChars);
147
148 PSZ strhFindEOL(const char *pcszSearchIn, ULONG *pulOffset);
149
150 PSZ strhFindNextLine(PSZ pszSearchIn, PULONG pulOffset);
151
152 BOOL strhBeautifyTitle(PSZ psz);
153
154 PSZ strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib);
155
156 PSZ strhGetNumAttribValue(const char *pszSearchIn,
157 const char *pszTag,
158 PLONG pl);
159
160 PSZ strhGetTextAttr(const char *pszSearchIn, const char *pszTag, PULONG pulOffset);
161
162 PSZ strhFindEndOfTag(const char *pszBeginOfTag);
163
164 ULONG strhGetBlock(const char *pszSearchIn,
165 PULONG pulSearchOffset,
166 PSZ pszTag,
167 PSZ *ppszBlock,
168 PSZ *ppszAttribs,
169 PULONG pulOfsBeginTag,
170 PULONG pulOfsBeginBlock);
171
172 /* ******************************************************************
173 *
174 * Miscellaneous
175 *
176 ********************************************************************/
177
178 VOID XWPENTRY strhArrayAppend(PSZ *ppszRoot,
179 const char *pcszNew,
180 ULONG cbNew,
181 PULONG pcbRoot);
182
183 PSZ strhCreateDump(PBYTE pb,
184 ULONG ulSize,
185 ULONG ulIndent);
186
187 /* ******************************************************************
188 *
189 * Wildcard matching
190 *
191 ********************************************************************/
192
193 #define FNM_MATCH 0
194 #define FNM_NOMATCH 1
195 #define FNM_ERR 2
196
197 #define FNM_NOESCAPE 16
198 #define FNM_PATHNAME 32
199 #define FNM_PERIOD 64
200
201 #define _FNM_STYLE_MASK 15
202
203 #define _FNM_POSIX 0
204 #define _FNM_OS2 1
205 #define _FNM_DOS 2
206
207 #define _FNM_IGNORECASE 128
208 #define _FNM_PATHPREFIX 256
209
210 BOOL strhMatchOS2(const unsigned char* pcszMask, const unsigned char* pcszName);
211
212 /* ******************************************************************
213 *
214 * Fast string searches
215 *
216 ********************************************************************/
217
218 void* strhmemfind(const void *in_block,
219 size_t block_size,
220 const void *in_pattern,
221 size_t pattern_size,
222 size_t *shift,
223 BOOL *repeat_find);
224
225 char* strhtxtfind (const char *string,
226 const char *pattern);
227
228#endif
229
230#if __cplusplus
231}
232#endif
233
Note: See TracBrowser for help on using the repository browser.