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