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

Last change on this file since 240 was 240, checked in by umoeller, 23 years ago

Misc fixes.

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