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);
|
---|
85 | typedef ULONG XWPENTRY XSTRCPY(PXSTRING pxstr, const char *pcszSource);
|
---|
86 | typedef XSTRCPY *PXSTRCPY;
|
---|
87 |
|
---|
88 | ULONG XWPENTRY xstrcat(PXSTRING pxstr, const char *pcszSource);
|
---|
89 | typedef ULONG XWPENTRY XSTRCAT(PXSTRING pxstr, const char *pcszSource);
|
---|
90 | typedef XSTRCAT *PXSTRCAT;
|
---|
91 |
|
---|
92 | ULONG XWPENTRY xstrcatc(PXSTRING pxstr, CHAR c);
|
---|
93 | typedef ULONG XWPENTRY XSTRCATC(PXSTRING pxstr, CHAR c);
|
---|
94 | typedef XSTRCATC *PXSTRCATC;
|
---|
95 |
|
---|
96 | /*
|
---|
97 | *@@ xstrIsString:
|
---|
98 | * returns TRUE if psz contains something.
|
---|
99 | *
|
---|
100 | *@@added V0.9.6 (2000-10-16) [umoeller]
|
---|
101 | */
|
---|
102 |
|
---|
103 | #define xstrIsString(psz) ( (psz != 0) && (*(psz) != 0) )
|
---|
104 |
|
---|
105 | PSZ XWPENTRY xstrFindWord(const XSTRING *pxstr,
|
---|
106 | ULONG ulOfs,
|
---|
107 | const XSTRING *pstrFind,
|
---|
108 | size_t *pShiftTable,
|
---|
109 | PBOOL pfRepeatFind,
|
---|
110 | const char *pcszBeginChars,
|
---|
111 | const char *pcszEndChars);
|
---|
112 | typedef PSZ XWPENTRY XSTRFINDWORD(const XSTRING *pxstr,
|
---|
113 | ULONG ulOfs,
|
---|
114 | const XSTRING *pstrFind,
|
---|
115 | size_t *pShiftTable,
|
---|
116 | PBOOL pfRepeatFind,
|
---|
117 | const char *pcszBeginChars,
|
---|
118 | const char *pcszEndChars);
|
---|
119 | typedef XSTRFINDWORD *PXSTRFINDWORD;
|
---|
120 |
|
---|
121 | ULONG XWPENTRY xstrrpl(PXSTRING pxstr,
|
---|
122 | PULONG pulOfs,
|
---|
123 | const XSTRING *pstrSearch,
|
---|
124 | const XSTRING *pstrReplace,
|
---|
125 | size_t *pShiftTable,
|
---|
126 | PBOOL pfRepeatFind);
|
---|
127 | typedef ULONG XWPENTRY XSTRRPL(PXSTRING pxstr,
|
---|
128 | PULONG pulOfs,
|
---|
129 | const XSTRING *pstrSearch,
|
---|
130 | const XSTRING *pstrReplace,
|
---|
131 | size_t *pShiftTable,
|
---|
132 | PBOOL pfRepeatFind);
|
---|
133 | typedef XSTRRPL *PXSTRRPL;
|
---|
134 |
|
---|
135 | ULONG XWPENTRY xstrcrpl(PXSTRING pxstr,
|
---|
136 | PULONG pulOfs,
|
---|
137 | const char *pcszSearch,
|
---|
138 | const char *pcszReplace);
|
---|
139 | typedef ULONG XWPENTRY XSTRCRPL(PXSTRING pxstr,
|
---|
140 | PULONG pulOfs,
|
---|
141 | const char *pcszSearch,
|
---|
142 | const char *pcszReplace);
|
---|
143 | typedef XSTRCRPL *PXSTRCRPL;
|
---|
144 | #endif
|
---|
145 |
|
---|
146 | #if __cplusplus
|
---|
147 | }
|
---|
148 | #endif
|
---|
149 |
|
---|