[7] | 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>
|
---|
[113] | 11 | *@@include #include "helpers\stringh.h"
|
---|
[7] | 12 | */
|
---|
| 13 |
|
---|
| 14 | /*
|
---|
| 15 | * Copyright (C) 1997-2000 Ulrich Mller.
|
---|
[14] | 16 | * This file is part of the "XWorkplace helpers" source package.
|
---|
| 17 | * This is free software; you can redistribute it and/or modify
|
---|
[7] | 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 STRINGH_HEADER_INCLUDED
|
---|
| 32 | #define STRINGH_HEADER_INCLUDED
|
---|
| 33 |
|
---|
[123] | 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
|
---|
[122] | 45 |
|
---|
[115] | 46 | PSZ XWPENTRY strhcpy(PSZ string1, const char *string2);
|
---|
[7] | 47 |
|
---|
[240] | 48 | APIRET XWPENTRY strhCopyBuf(PSZ pszTarget,
|
---|
| 49 | PCSZ pcszSource,
|
---|
| 50 | ULONG cbTarget);
|
---|
| 51 |
|
---|
[91] | 52 | #if defined(__DEBUG_MALLOC_ENABLED__) && !defined(DONT_REPLACE_STRINGH_MALLOC) // setup.h, helpers\memdebug.c
|
---|
[115] | 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__)
|
---|
[91] | 59 | #else
|
---|
[115] | 60 | PSZ XWPENTRY strhdup(const char *pcszSource,
|
---|
| 61 | unsigned long *pulLength);
|
---|
[91] | 62 | #endif
|
---|
| 63 |
|
---|
[115] | 64 | int XWPENTRY strhcmp(const char *p1, const char *p2);
|
---|
[38] | 65 |
|
---|
[115] | 66 | int XWPENTRY strhicmp(const char *p1, const char *p2);
|
---|
[56] | 67 |
|
---|
[115] | 68 | PSZ XWPENTRY strhistr(const char *string1, const char *string2);
|
---|
[7] | 69 |
|
---|
[115] | 70 | ULONG XWPENTRY strhncpy0(PSZ pszTarget,
|
---|
| 71 | const char *pszSource,
|
---|
| 72 | ULONG cbSource);
|
---|
[7] | 73 |
|
---|
[245] | 74 | size_t XWPENTRY strlcpy(char *dst,
|
---|
| 75 | const char *src,
|
---|
| 76 | size_t siz);
|
---|
| 77 |
|
---|
| 78 | size_t strlcat(char *dst,
|
---|
| 79 | const char *src,
|
---|
| 80 | size_t siz);
|
---|
| 81 |
|
---|
[153] | 82 | ULONG XWPENTRY strhlen(PCSZ pcsz);
|
---|
| 83 |
|
---|
[143] | 84 | ULONG XWPENTRY strhSize(PCSZ pcsz);
|
---|
| 85 |
|
---|
[115] | 86 | ULONG XWPENTRY strhCount(const char *pszSearch, CHAR c);
|
---|
[7] | 87 |
|
---|
[115] | 88 | BOOL XWPENTRY strhIsDecimal(PSZ psz);
|
---|
[7] | 89 |
|
---|
[91] | 90 | #if defined(__DEBUG_MALLOC_ENABLED__) && !defined(DONT_REPLACE_STRINGH_MALLOC) // setup.h, helpers\memdebug.c
|
---|
[115] | 91 | PSZ XWPENTRY strhSubstrDebug(const char *pBegin, // in: first char
|
---|
| 92 | const char *pEnd, // in: last char (not included)
|
---|
| 93 | const char *pcszSourceFile,
|
---|
| 94 | unsigned long ulLine,
|
---|
| 95 | const char *pcszFunction);
|
---|
[91] | 96 | #define strhSubstr(a, b) strhSubstrDebug((a), (b), __FILE__, __LINE__, __FUNCTION__)
|
---|
| 97 | #else
|
---|
[115] | 98 | PSZ XWPENTRY strhSubstr(const char *pBegin, const char *pEnd);
|
---|
[91] | 99 | #endif
|
---|
[7] | 100 |
|
---|
[161] | 101 | PSZ XWPENTRY strhExtract(PCSZ pszBuf,
|
---|
[115] | 102 | CHAR cOpen,
|
---|
| 103 | CHAR cClose,
|
---|
[161] | 104 | PCSZ *ppEnd);
|
---|
[7] | 105 |
|
---|
[115] | 106 | PSZ XWPENTRY strhQuote(PSZ pszBuf,
|
---|
| 107 | CHAR cQuote,
|
---|
| 108 | PSZ *ppEnd);
|
---|
[7] | 109 |
|
---|
[115] | 110 | ULONG XWPENTRY strhStrip(PSZ psz);
|
---|
[7] | 111 |
|
---|
[115] | 112 | PSZ XWPENTRY strhins(const char *pcszBuffer,
|
---|
| 113 | ULONG ulInsertOfs,
|
---|
| 114 | const char *pcszInsert);
|
---|
[12] | 115 |
|
---|
[115] | 116 | ULONG XWPENTRY strhFindReplace(PSZ *ppszBuf,
|
---|
| 117 | PULONG pulOfs,
|
---|
| 118 | const char *pcszSearch,
|
---|
| 119 | const char *pcszReplace);
|
---|
[12] | 120 |
|
---|
[115] | 121 | ULONG XWPENTRY strhWords(PSZ psz);
|
---|
[7] | 122 |
|
---|
| 123 | #define STRH_BEGIN_CHARS "\x0d\x0a "
|
---|
| 124 | #define STRH_END_CHARS "\x0d\x0a /-"
|
---|
| 125 |
|
---|
[115] | 126 | BOOL XWPENTRY strhGetWord(PSZ *ppszStart,
|
---|
| 127 | const char *pLimit,
|
---|
| 128 | const char *pcszBeginChars,
|
---|
| 129 | const char *pcszEndChars, // = "\x0d\x0a /-";
|
---|
| 130 | PSZ *ppszEnd);
|
---|
[7] | 131 |
|
---|
[115] | 132 | BOOL XWPENTRY strhIsWord(const char *pcszBuf,
|
---|
| 133 | const char *p,
|
---|
| 134 | ULONG cbSearch,
|
---|
| 135 | const char *pcszBeginChars,
|
---|
| 136 | const char *pcszEndChars);
|
---|
[13] | 137 |
|
---|
[115] | 138 | PSZ XWPENTRY strhFindWord(const char *pszBuf,
|
---|
| 139 | const char *pszSearch,
|
---|
| 140 | const char *pcszBeginChars,
|
---|
| 141 | const char *pcszEndChars);
|
---|
[7] | 142 |
|
---|
[115] | 143 | PSZ XWPENTRY strhFindEOL(const char *pcszSearchIn, ULONG *pulOffset);
|
---|
[7] | 144 |
|
---|
[115] | 145 | PSZ XWPENTRY strhFindNextLine(PSZ pszSearchIn, PULONG pulOffset);
|
---|
[7] | 146 |
|
---|
[178] | 147 | ULONG XWPENTRY strhBeautifyTitle(PSZ psz);
|
---|
[237] | 148 | typedef ULONG XWPENTRY STRHBEAUTIFYTITLE(PSZ psz);
|
---|
| 149 | typedef STRHBEAUTIFYTITLE *PSTRHBEAUTIFYTITLE;
|
---|
[7] | 150 |
|
---|
[178] | 151 | ULONG strhBeautifyTitle2(PSZ pszTarget,
|
---|
| 152 | PCSZ pcszSource);
|
---|
| 153 |
|
---|
[245] | 154 | BOOL XWPENTRY strhKillChar(PSZ psz,
|
---|
| 155 | CHAR c,
|
---|
| 156 | PULONG pulLength);
|
---|
| 157 |
|
---|
[115] | 158 | PSZ XWPENTRY strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib);
|
---|
[7] | 159 |
|
---|
[115] | 160 | PSZ XWPENTRY strhGetNumAttribValue(const char *pszSearchIn,
|
---|
| 161 | const char *pszTag,
|
---|
| 162 | PLONG pl);
|
---|
[7] | 163 |
|
---|
[115] | 164 | PSZ XWPENTRY strhGetTextAttr(const char *pszSearchIn, const char *pszTag, PULONG pulOffset);
|
---|
[7] | 165 |
|
---|
[115] | 166 | PSZ XWPENTRY strhFindEndOfTag(const char *pszBeginOfTag);
|
---|
[7] | 167 |
|
---|
[115] | 168 | ULONG XWPENTRY strhGetBlock(const char *pszSearchIn,
|
---|
| 169 | PULONG pulSearchOffset,
|
---|
[147] | 170 | const char *pszTag,
|
---|
[115] | 171 | PSZ *ppszBlock,
|
---|
| 172 | PSZ *ppszAttribs,
|
---|
| 173 | PULONG pulOfsBeginTag,
|
---|
| 174 | PULONG pulOfsBeginBlock);
|
---|
[7] | 175 |
|
---|
| 176 | /* ******************************************************************
|
---|
[14] | 177 | *
|
---|
| 178 | * Miscellaneous
|
---|
| 179 | *
|
---|
[7] | 180 | ********************************************************************/
|
---|
| 181 |
|
---|
[81] | 182 | VOID XWPENTRY strhArrayAppend(PSZ *ppszRoot,
|
---|
| 183 | const char *pcszNew,
|
---|
| 184 | ULONG cbNew,
|
---|
| 185 | PULONG pcbRoot);
|
---|
[7] | 186 |
|
---|
[115] | 187 | PSZ XWPENTRY strhCreateDump(PBYTE pb,
|
---|
| 188 | ULONG ulSize,
|
---|
| 189 | ULONG ulIndent);
|
---|
[7] | 190 |
|
---|
| 191 | /* ******************************************************************
|
---|
[14] | 192 | *
|
---|
| 193 | * Fast string searches
|
---|
| 194 | *
|
---|
[7] | 195 | ********************************************************************/
|
---|
| 196 |
|
---|
[115] | 197 | void* XWPENTRY strhmemfind(const void *in_block,
|
---|
| 198 | size_t block_size,
|
---|
| 199 | const void *in_pattern,
|
---|
| 200 | size_t pattern_size,
|
---|
| 201 | size_t *shift,
|
---|
| 202 | BOOL *repeat_find);
|
---|
[7] | 203 |
|
---|
[115] | 204 | char* XWPENTRY strhtxtfind (const char *string,
|
---|
| 205 | const char *pattern);
|
---|
[7] | 206 |
|
---|
| 207 | #endif
|
---|
| 208 |
|
---|
| 209 | #if __cplusplus
|
---|
| 210 | }
|
---|
| 211 | #endif
|
---|
| 212 |
|
---|