source: trunk/include/helpers/xstring.h@ 101

Last change on this file since 101 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: 9.1 KB
Line 
1
2/*
3 *@@sourcefile xstring.h:
4 * header file for xstring.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 "xstring.h"
12 */
13
14/*
15 * Copyright (C) 1999-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 XSTRING_HEADER_INCLUDED
32 #define XSTRING_HEADER_INCLUDED
33
34 #ifndef XWPENTRY
35 #error You must define XWPENTRY to contain the standard linkage for the XWPHelpers.
36 #endif
37
38 /*
39 *@@ XSTRING:
40 *
41 *@@added V0.9.6 (2000-11-01) [umoeller]
42 */
43
44 typedef struct _XSTRING
45 {
46 PSZ psz; // ptr to string or NULL
47 ULONG ulLength; // length of *psz
48 ULONG cbAllocated; // memory allocated in *psz
49 // (>= ulLength + 1)
50 ULONG ulDelta; // allocation delta (0 = none)
51 // V0.9.9 (2001-03-07) [umoeller]
52
53 // if memory debugging is enabled, enable the following
54 // extra fields globally... even if the caller doesn't
55 // want the replacement calls, the xstr* implementations
56 // are compiled with these fields, so they must always be
57 // present V0.9.14 (2001-08-01) [umoeller]
58 #if defined(__XWPMEMDEBUG__) // setup.h only
59 const char *file;
60 unsigned long line;
61 const char *function;
62 #endif
63
64 } XSTRING, *PXSTRING;
65
66 #if defined(__DEBUG_MALLOC_ENABLED__) && !defined(DONT_REPLACE_XSTR_MALLOC) // setup.h, helpers\memdebug.c
67 #define xstrInit(a, b) xstrInitDebug((a), (b), __FILE__, __LINE__, __FUNCTION__)
68 void XWPENTRY xstrInitDebug(PXSTRING pxstr,
69 ULONG ulPreAllocate,
70 const char *file,
71 unsigned long line,
72 const char *function);
73 typedef void XWPENTRY XSTRINITDEBUG(PXSTRING pxstr,
74 ULONG ulPreAllocate,
75 const char *file,
76 unsigned long line,
77 const char *function);
78 typedef XSTRINITDEBUG *PXSTRINITDEBUG;
79 #else
80 void XWPENTRY xstrInit(PXSTRING pxstr, ULONG ulPreAllocate);
81 typedef void XWPENTRY XSTRINIT(PXSTRING pxstr, ULONG ulPreAllocate);
82 typedef XSTRINIT *PXSTRINIT;
83 #endif
84
85 /* void XWPENTRY xstrInit(PXSTRING pxstr, ULONG ulPreAllocate);
86 typedef void XWPENTRY XSTRINIT(PXSTRING pxstr, ULONG ulPreAllocate);
87 typedef XSTRINIT *PXSTRINIT; */
88
89 void XWPENTRY xstrInitSet(PXSTRING pxstr, PSZ pszNew);
90 typedef void XWPENTRY XSTRINITSET(PXSTRING pxstr, PSZ pszNew);
91 typedef XSTRINITSET *PXSTRINITSET;
92
93 void XWPENTRY xstrInitCopy(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate);
94 typedef void XWPENTRY XSTRINITCOPY(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate);
95 typedef XSTRINITCOPY *PXSTRINITCOPY;
96
97 void XWPENTRY xstrClear(PXSTRING pxstr);
98 typedef void XWPENTRY XSTRCLEAR(PXSTRING pxstr);
99 typedef XSTRCLEAR *PXSTRCLEAR;
100
101 ULONG XWPENTRY xstrReserve(PXSTRING pxstr, ULONG ulBytes);
102 typedef ULONG XWPENTRY XSTRRESERVE(PXSTRING pxstr, ULONG ulBytes);
103 typedef XSTRRESERVE *PXSTRRESERVE;
104
105 PXSTRING XWPENTRY xstrCreate(ULONG ulPreAllocate);
106 typedef PXSTRING XWPENTRY XSTRCREATE(ULONG ulPreAllocate);
107 typedef XSTRCREATE *PXSTRCREATE;
108
109 VOID XWPENTRY xstrFree(PXSTRING *ppxstr);
110 typedef VOID XWPENTRY XSTRFREE(PXSTRING *ppxstr);
111 typedef XSTRFREE *PXSTRFREE;
112
113 ULONG XWPENTRY xstrset(PXSTRING pxstr, PSZ pszNew);
114 typedef ULONG XWPENTRY XSTRSET(PXSTRING pxstr, PSZ pszNew);
115 typedef XSTRSET *PXSTRSET;
116
117 ULONG XWPENTRY xstrcpy(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
118 typedef ULONG XWPENTRY XSTRCPY(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
119 typedef XSTRCPY *PXSTRCPY;
120
121 ULONG XWPENTRY xstrcpys(PXSTRING pxstr, const XSTRING *pcstrSource);
122 typedef ULONG XWPENTRY XSTRCPYS(PXSTRING pxstr, const XSTRING *pcstrSource);
123 typedef XSTRCPYS *PXSTRCPYS;
124
125 ULONG XWPENTRY xstrcat(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
126 typedef ULONG XWPENTRY XSTRCAT(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
127 typedef XSTRCAT *PXSTRCAT;
128
129 ULONG XWPENTRY xstrcatc(PXSTRING pxstr, CHAR c);
130 typedef ULONG XWPENTRY XSTRCATC(PXSTRING pxstr, CHAR c);
131 typedef XSTRCATC *PXSTRCATC;
132
133 ULONG XWPENTRY xstrcats(PXSTRING pxstr, const XSTRING *pcstrSource);
134 typedef ULONG XWPENTRY XSTRCATS(PXSTRING pxstr, const XSTRING *pcstrSource);
135 typedef XSTRCATS *PXSTRCATS;
136
137 /*
138 *@@ xstrIsString:
139 * returns TRUE if psz contains something.
140 *
141 *@@added V0.9.6 (2000-10-16) [umoeller]
142 */
143
144 #define xstrIsString(psz) ( (psz != 0) && (*(psz) != 0) )
145
146 ULONG XWPENTRY xstrrpl(PXSTRING pxstr,
147 ULONG ulFirstReplOfs,
148 ULONG cReplLen,
149 const char *pcszReplaceWith,
150 ULONG cReplaceWithLen);
151 typedef ULONG XWPENTRY XSTRRPL(PXSTRING pxstr,
152 ULONG ulFirstReplOfs,
153 ULONG cReplLen,
154 const char *pcszReplaceWith,
155 ULONG cReplaceWithLen);
156 typedef XSTRRPL *PXSTRRPL;
157
158 PSZ XWPENTRY xstrFindWord(const XSTRING *pxstr,
159 ULONG ulOfs,
160 const XSTRING *pstrFind,
161 size_t *pShiftTable,
162 PBOOL pfRepeatFind,
163 const char *pcszBeginChars,
164 const char *pcszEndChars);
165 typedef PSZ XWPENTRY XSTRFINDWORD(const XSTRING *pxstr,
166 ULONG ulOfs,
167 const XSTRING *pstrFind,
168 size_t *pShiftTable,
169 PBOOL pfRepeatFind,
170 const char *pcszBeginChars,
171 const char *pcszEndChars);
172 typedef XSTRFINDWORD *PXSTRFINDWORD;
173
174 ULONG XWPENTRY xstrFindReplace(PXSTRING pxstr,
175 PULONG pulOfs,
176 const XSTRING *pstrSearch,
177 const XSTRING *pstrReplace,
178 size_t *pShiftTable,
179 PBOOL pfRepeatFind);
180 typedef ULONG XWPENTRY XSTRFINDREPLACE(PXSTRING pxstr,
181 PULONG pulOfs,
182 const XSTRING *pstrSearch,
183 const XSTRING *pstrReplace,
184 size_t *pShiftTable,
185 PBOOL pfRepeatFind);
186 typedef XSTRFINDREPLACE *PXSTRFINDREPLACE;
187
188 ULONG XWPENTRY xstrFindReplaceC(PXSTRING pxstr,
189 PULONG pulOfs,
190 const char *pcszSearch,
191 const char *pcszReplace);
192 typedef ULONG XWPENTRY XSTRFINDREPLACEC(PXSTRING pxstr,
193 PULONG pulOfs,
194 const char *pcszSearch,
195 const char *pcszReplace);
196 typedef XSTRFINDREPLACEC *PXSTRFINDREPLACEC;
197
198 ULONG XWPENTRY xstrEncode(PXSTRING pxstr, const char *pcszEncode);
199 typedef ULONG XWPENTRY XSTRENCODE(PXSTRING pxstr, const char *pcszEncode);
200 typedef XSTRENCODE *PXSTRENCODE;
201
202 ULONG XWPENTRY xstrDecode(PXSTRING pxstr);
203 typedef ULONG XWPENTRY XSTRDECODE(PXSTRING pxstr);
204 typedef XSTRDECODE *PXSTRDECODE;
205
206 // V0.9.9 (2001-01-29) [lafaix]: constants added
207 #define CRLF2LF TRUE
208 #define LF2CRLF FALSE
209
210 VOID XWPENTRY xstrConvertLineFormat(PXSTRING pxstr, BOOL fToCFormat);
211 typedef VOID XWPENTRY XSTRCONVERTLINEFORMAT(PXSTRING pxstr, BOOL fToCFormat);
212 typedef XSTRCONVERTLINEFORMAT *PXSTRCONVERTLINEFORMAT;
213
214#endif
215
216#if __cplusplus
217}
218#endif
219
Note: See TracBrowser for help on using the repository browser.