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