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

Last change on this file since 18 was 18, checked in by umoeller, 25 years ago

Tons of updates.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 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 } 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 PXSTRING XWPENTRY xstrCreate(ULONG ulPreAllocate);
69 typedef PXSTRING XWPENTRY XSTRCREATE(ULONG ulPreAllocate);
70 typedef XSTRCREATE *PXSTRCREATE;
71
72 VOID XWPENTRY xstrFree(PXSTRING pxstr);
73 typedef VOID XWPENTRY XSTRFREE(PXSTRING pxstr);
74 typedef XSTRFREE *PXSTRFREE;
75
76 ULONG XWPENTRY xstrset(PXSTRING pxstr, PSZ pszNew);
77 typedef ULONG XWPENTRY XSTRSET(PXSTRING pxstr, PSZ pszNew);
78 typedef XSTRSET *PXSTRSET;
79
80 ULONG XWPENTRY xstrcpy(PXSTRING pxstr, const char *pcszSource);
81 typedef ULONG XWPENTRY XSTRCPY(PXSTRING pxstr, const char *pcszSource);
82 typedef XSTRCPY *PXSTRCPY;
83
84 ULONG XWPENTRY xstrcat(PXSTRING pxstr, const char *pcszSource);
85 typedef ULONG XWPENTRY XSTRCAT(PXSTRING pxstr, const char *pcszSource);
86 typedef XSTRCAT *PXSTRCAT;
87
88 ULONG XWPENTRY xstrcatc(PXSTRING pxstr, CHAR c);
89 typedef ULONG XWPENTRY XSTRCATC(PXSTRING pxstr, CHAR c);
90 typedef XSTRCATC *PXSTRCATC;
91
92 /*
93 *@@ xstrIsString:
94 * returns TRUE if psz contains something.
95 *
96 *@@added V0.9.6 (2000-10-16) [umoeller]
97 */
98
99 #define xstrIsString(psz) ( (psz != 0) && (*(psz) != 0) )
100
101 PSZ XWPENTRY xstrFindWord(const XSTRING *pxstr,
102 ULONG ulOfs,
103 const XSTRING *pstrFind,
104 size_t *pShiftTable,
105 PBOOL pfRepeatFind,
106 const char *pcszBeginChars,
107 const char *pcszEndChars);
108 typedef PSZ XWPENTRY XSTRFINDWORD(const XSTRING *pxstr,
109 ULONG ulOfs,
110 const XSTRING *pstrFind,
111 size_t *pShiftTable,
112 PBOOL pfRepeatFind,
113 const char *pcszBeginChars,
114 const char *pcszEndChars);
115 typedef XSTRFINDWORD *PXSTRFINDWORD;
116
117 ULONG XWPENTRY xstrrpl(PXSTRING pxstr,
118 PULONG pulOfs,
119 const XSTRING *pstrSearch,
120 const XSTRING *pstrReplace,
121 size_t *pShiftTable,
122 PBOOL pfRepeatFind);
123 typedef ULONG XWPENTRY XSTRRPL(PXSTRING pxstr,
124 PULONG pulOfs,
125 const XSTRING *pstrSearch,
126 const XSTRING *pstrReplace,
127 size_t *pShiftTable,
128 PBOOL pfRepeatFind);
129 typedef XSTRRPL *PXSTRRPL;
130
131 ULONG XWPENTRY xstrcrpl(PXSTRING pxstr,
132 PULONG pulOfs,
133 const char *pcszSearch,
134 const char *pcszReplace);
135 typedef ULONG XWPENTRY XSTRCRPL(PXSTRING pxstr,
136 PULONG pulOfs,
137 const char *pcszSearch,
138 const char *pcszReplace);
139 typedef XSTRCRPL *PXSTRCRPL;
140#endif
141
142#if __cplusplus
143}
144#endif
145
Note: See TracBrowser for help on using the repository browser.