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 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 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 | } XSTRING, *PXSTRING;
|
---|
51 |
|
---|
52 | void XWPENTRY xstrInit(PXSTRING pxstr, ULONG ulPreAllocate);
|
---|
53 | typedef void XWPENTRY XSTRINIT(PXSTRING pxstr, ULONG ulPreAllocate);
|
---|
54 | typedef XSTRINIT *PXSTRINIT;
|
---|
55 |
|
---|
56 | void XWPENTRY xstrInitSet(PXSTRING pxstr, PSZ pszNew);
|
---|
57 | typedef void XWPENTRY XSTRINITSET(PXSTRING pxstr, PSZ pszNew);
|
---|
58 | typedef XSTRINITSET *PXSTRINITSET;
|
---|
59 |
|
---|
60 | void XWPENTRY xstrInitCopy(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate);
|
---|
61 | typedef void XWPENTRY XSTRINITCOPY(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate);
|
---|
62 | typedef XSTRINITCOPY *PXSTRINITCOPY;
|
---|
63 |
|
---|
64 | void XWPENTRY xstrClear(PXSTRING pxstr);
|
---|
65 | typedef void XWPENTRY XSTRCLEAR(PXSTRING pxstr);
|
---|
66 | typedef XSTRCLEAR *PXSTRCLEAR;
|
---|
67 |
|
---|
68 | ULONG XWPENTRY xstrReserve(PXSTRING pxstr, ULONG ulBytes);
|
---|
69 | typedef ULONG XWPENTRY XSTRRESERVE(PXSTRING pxstr, ULONG ulBytes);
|
---|
70 | typedef XSTRRESERVE *PXSTRRESERVE;
|
---|
71 |
|
---|
72 | PXSTRING XWPENTRY xstrCreate(ULONG ulPreAllocate);
|
---|
73 | typedef PXSTRING XWPENTRY XSTRCREATE(ULONG ulPreAllocate);
|
---|
74 | typedef XSTRCREATE *PXSTRCREATE;
|
---|
75 |
|
---|
76 | VOID XWPENTRY xstrFree(PXSTRING pxstr);
|
---|
77 | typedef VOID XWPENTRY XSTRFREE(PXSTRING pxstr);
|
---|
78 | typedef XSTRFREE *PXSTRFREE;
|
---|
79 |
|
---|
80 | ULONG XWPENTRY xstrset(PXSTRING pxstr, PSZ pszNew);
|
---|
81 | typedef ULONG XWPENTRY XSTRSET(PXSTRING pxstr, PSZ pszNew);
|
---|
82 | typedef XSTRSET *PXSTRSET;
|
---|
83 |
|
---|
84 | ULONG XWPENTRY xstrcpy(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
|
---|
85 | typedef ULONG XWPENTRY XSTRCPY(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
|
---|
86 | typedef XSTRCPY *PXSTRCPY;
|
---|
87 |
|
---|
88 | ULONG XWPENTRY xstrcpys(PXSTRING pxstr, const XSTRING *pcstrSource);
|
---|
89 | typedef ULONG XWPENTRY XSTRCPYS(PXSTRING pxstr, const XSTRING *pcstrSource);
|
---|
90 | typedef XSTRCPYS *PXSTRCPYS;
|
---|
91 |
|
---|
92 | ULONG XWPENTRY xstrcat(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
|
---|
93 | typedef ULONG XWPENTRY XSTRCAT(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
|
---|
94 | typedef XSTRCAT *PXSTRCAT;
|
---|
95 |
|
---|
96 | ULONG XWPENTRY xstrcatc(PXSTRING pxstr, CHAR c);
|
---|
97 | typedef ULONG XWPENTRY XSTRCATC(PXSTRING pxstr, CHAR c);
|
---|
98 | typedef XSTRCATC *PXSTRCATC;
|
---|
99 |
|
---|
100 | ULONG XWPENTRY xstrcats(PXSTRING pxstr, const XSTRING *pcstrSource);
|
---|
101 | typedef ULONG XWPENTRY XSTRCATS(PXSTRING pxstr, const XSTRING *pcstrSource);
|
---|
102 | typedef XSTRCATS *PXSTRCATS;
|
---|
103 |
|
---|
104 | /*
|
---|
105 | *@@ xstrIsString:
|
---|
106 | * returns TRUE if psz contains something.
|
---|
107 | *
|
---|
108 | *@@added V0.9.6 (2000-10-16) [umoeller]
|
---|
109 | */
|
---|
110 |
|
---|
111 | #define xstrIsString(psz) ( (psz != 0) && (*(psz) != 0) )
|
---|
112 |
|
---|
113 | ULONG XWPENTRY xstrrpl(PXSTRING pxstr,
|
---|
114 | ULONG ulFirstReplOfs,
|
---|
115 | ULONG cReplLen,
|
---|
116 | const XSTRING *pstrReplaceWith);
|
---|
117 | typedef ULONG XWPENTRY XSTRRPL(PXSTRING pxstr,
|
---|
118 | ULONG ulFirstReplOfs,
|
---|
119 | ULONG cReplLen,
|
---|
120 | const XSTRING *pstrReplaceWith);
|
---|
121 | typedef XSTRRPL *PXSTRRPL;
|
---|
122 |
|
---|
123 | PSZ XWPENTRY xstrFindWord(const XSTRING *pxstr,
|
---|
124 | ULONG ulOfs,
|
---|
125 | const XSTRING *pstrFind,
|
---|
126 | size_t *pShiftTable,
|
---|
127 | PBOOL pfRepeatFind,
|
---|
128 | const char *pcszBeginChars,
|
---|
129 | const char *pcszEndChars);
|
---|
130 | typedef PSZ XWPENTRY XSTRFINDWORD(const XSTRING *pxstr,
|
---|
131 | ULONG ulOfs,
|
---|
132 | const XSTRING *pstrFind,
|
---|
133 | size_t *pShiftTable,
|
---|
134 | PBOOL pfRepeatFind,
|
---|
135 | const char *pcszBeginChars,
|
---|
136 | const char *pcszEndChars);
|
---|
137 | typedef XSTRFINDWORD *PXSTRFINDWORD;
|
---|
138 |
|
---|
139 | ULONG XWPENTRY xstrFindReplace(PXSTRING pxstr,
|
---|
140 | PULONG pulOfs,
|
---|
141 | const XSTRING *pstrSearch,
|
---|
142 | const XSTRING *pstrReplace,
|
---|
143 | size_t *pShiftTable,
|
---|
144 | PBOOL pfRepeatFind);
|
---|
145 | typedef ULONG XWPENTRY XSTRFINDREPLACE(PXSTRING pxstr,
|
---|
146 | PULONG pulOfs,
|
---|
147 | const XSTRING *pstrSearch,
|
---|
148 | const XSTRING *pstrReplace,
|
---|
149 | size_t *pShiftTable,
|
---|
150 | PBOOL pfRepeatFind);
|
---|
151 | typedef XSTRFINDREPLACE *PXSTRFINDREPLACE;
|
---|
152 |
|
---|
153 | ULONG XWPENTRY xstrFindReplaceC(PXSTRING pxstr,
|
---|
154 | PULONG pulOfs,
|
---|
155 | const char *pcszSearch,
|
---|
156 | const char *pcszReplace);
|
---|
157 | typedef ULONG XWPENTRY XSTRFINDREPLACEC(PXSTRING pxstr,
|
---|
158 | PULONG pulOfs,
|
---|
159 | const char *pcszSearch,
|
---|
160 | const char *pcszReplace);
|
---|
161 | typedef XSTRFINDREPLACEC *PXSTRFINDREPLACEC;
|
---|
162 |
|
---|
163 | ULONG XWPENTRY xstrEncode(PXSTRING pxstr, const char *pcszEncode);
|
---|
164 | typedef ULONG XWPENTRY XSTRENCODE(PXSTRING pxstr, const char *pcszEncode);
|
---|
165 | typedef XSTRENCODE *PXSTRENCODE;
|
---|
166 |
|
---|
167 | ULONG XWPENTRY xstrDecode(PXSTRING pxstr);
|
---|
168 | typedef ULONG XWPENTRY XSTRDECODE(PXSTRING pxstr);
|
---|
169 | typedef XSTRDECODE *PXSTRDECODE;
|
---|
170 |
|
---|
171 | // V0.9.9 (2001-01-29) [lafaix]: constants added
|
---|
172 | #define CRLF2LF TRUE
|
---|
173 | #define LF2CRLF FALSE
|
---|
174 |
|
---|
175 | VOID XWPENTRY xstrConvertLineFormat(PXSTRING pxstr, BOOL fToCFormat);
|
---|
176 | typedef VOID XWPENTRY XSTRCONVERTLINEFORMAT(PXSTRING pxstr, BOOL fToCFormat);
|
---|
177 | typedef XSTRCONVERTLINEFORMAT *PXSTRCONVERTLINEFORMAT;
|
---|
178 |
|
---|
179 | #endif
|
---|
180 |
|
---|
181 | #if __cplusplus
|
---|
182 | }
|
---|
183 | #endif
|
---|
184 |
|
---|