73 if (stringLength >=
size_v(position))
86 return OREF_NULLSTRING;
94 if (
size_v(position) > stringLength)
102 padCount =
size_v(length) - substrLength;
105 if (substrLength != 0)
108 retval->
put(0,
string +
size_v(position), substrLength);
113 retval->
set(substrLength, padChar, padCount);
139 sizeB_t result =
pos(stringData, length, needle, _start - 1, _range);
166 if (_start >= haystack_length || needle_length > _range || needle_length == 0)
172 const char *haypointer = stringData + _start;
176 sizeB_t count = _range - needle_length + 1;
182 if (memcmp(haypointer, needlepointer,
size_v(needle_length)) == 0)
216 if (_start > haystack_length || needle_length > _range || needle_length == 0)
222 const char *haypointer = stringData + _start;
226 sizeB_t count = _range - needle_length + 1;
262 sizeB_t result =
lastPos(stringData, haystackLen, needle, startPos, range);
283 if (needleLen == 0 || haystackLen == 0 || needleLen > range)
293 const char *startPoint = stringData + haystackLen - range;
296 if (matchLocation == NULL)
302 return sizeB_v(matchLocation - stringData + 1);
324 if (needleLen > haystackLen)
329 haystack = haystack + haystackLen - needleLen;
331 sizeB_t count = haystackLen - needleLen + 1;
336 if (memcmp(haystack, needle, needleLen) == 0)
365 if (needleLen == 0 || haystackLen == 0 || needleLen > range)
375 const char *startPoint = stringData + haystackLen - range;
378 if (matchLocation == NULL)
384 return sizeB_v(matchLocation - stringData + 1);
406 if (needleLen > haystackLen)
411 haystack = haystack + haystackLen - needleLen;
413 sizeB_t count = haystackLen - needleLen + 1;
448 if (position >= stringLength)
450 return OREF_NULLSTRING;
472 if (memcmp(start, sepData, sepLength) == 0)
495 const char *sepData =
"\n";
518 for (
size_t i = 0; i < length; i++, start++)
529 const char *stringEnd = start + length;
532 const char *end = start + length - sepSize + 1;
542 size_t stringLen = tmp - start;
545 if (checkCR && *(tmp - 1) ==
'\r')
551 start = tmp + sepSize;
554 if (start < stringEnd)
556 size_t stringLen = stringEnd - start;
583 if (!memcmp(string1, string2, length))
588 while (length-- != 0)
591 if (toupper(*string1) != toupper(*string2))
594 if (toupper(*string1) < toupper(*string2))
628 Retval = toupper(ch) -
'A' + 10;
647 for (
int i = 0; i < 8; i++)
649 if (String[i] ==
'1')
651 Result |= (1<<(7-i));
674 memcpy(Buf+4, String, 4);
676 return "0123456789ABCDEF"[i];
703 return((Nibble1 << 4) | Nibble2);
731 const char *SpaceLocation = NULL;
754 for (; Length != 0; Length--)
758 if (c !=
'\0' && strchr(Set, c) != NULL)
766 SpaceLocation = Current;
770 Residue = (Count % Modulus);
774 else if (Residue != (Count % Modulus))
804 if ((c ==
ch_SPACE || c ==
ch_TAB) || (SpaceFound && ((Count % Modulus) != Residue)))
846 for (; Length != 0; Length--)
851 if (c !=
'\0' && strchr(Set, c) != NULL)
854 if (++Found == Count)
860 *ScannedSize = Scanned;
920 Retval = OREF_NULLSTRING;
939 p[0] = (Val & 0x08) != 0 ?
'1':
'0';
940 p[1] = (Val & 0x04) != 0 ?
'1':
'0';
941 p[2] = (Val & 0x02) != 0 ?
'1':
'0';
942 p[3] = (Val & 0x01) != 0 ?
'1':
'0';
960 while (Length-- != 0)
963 if (*String ==
'\0' || !strchr(Set, *String))
1003 if (*String !=
' ' && *String !=
'\t')
1010 for (; Length != 0; Length--)
1014 if (c !=
'\0' && strchr(Set, c) != NULL)
1020 if (c ==
' ' || c ==
'\t')
1025 Residue = (Count % Modulus);
1029 else if (Residue != (Count % Modulus))
1044 if (c ==
' ' || c ==
'\t')
1048 else if (SpaceFound && (Count % Modulus) != Residue)
1054 *PackedSize = Count;
1081 Option = toupper(Option);
1198 if (Len != 1 || (*Scanp !=
'1' && *Scanp !=
'0'))
1231 for (;Length != 0; Length--)
1233 if (*Scan !=
' ' && *Scan !=
'\t')
1259 for (;Length != 0; Length--)
1261 if (*Scan ==
' ' || *Scan ==
'\t')
1327 *NextString = *String;
1351 sizeB_t matchPos =
pos(hayStack, hayStackLength, needle, 0, hayStackLength);
1352 while (matchPos != 0)
1356 matchPos =
pos(hayStack, hayStackLength, needle, matchPos + needle->
getBLength() - 1, hayStackLength);
1377 while (matchPos != 0)
1381 matchPos =
caselessPos(hayStack, hayStackLength, needle, matchPos + needle->
getBLength() - 1, hayStackLength);
1396 for (
const char *scan =
string; length != 0; length--)
1399 if (*scan == target)
1401 return scan - string;
1438 if (startPos > stringLen)
1448 const char *current = data + startPos - 1;
1449 if (referenceLen == 0)
1466 while (stringRange-- != 0)
1479 while (stringRange-- != 0)
1513 if (length == 0 || count == 0)
1515 return OREF_NULLSTRING;
1517 const char *nextSite = NULL;
1518 const char *
word = data;
1531 return OREF_NULLSTRING;
1534 const char *wordStart =
word;
1535 const char *wordEnd =
word;
1567 if (length == 0 || count == 0)
1572 const char *nextSite = NULL;
1573 const char *
word = data;
1593 const char *wordStart =
word;
1624 return OREF_NULLSTRING;
1626 const char *
word = data;
1627 const char *nextSite = NULL;
1641 return OREF_NULLSTRING;
1656 const char *
word = data;
1657 const char *nextSite = NULL;
1688 const char *
word = data;
1689 const char *nextSite = NULL;
1722 const char *
word = data;
1723 const char *nextSite = NULL;
1756 const char *haystack = data;
1766 if (needleWords > (haystackWords - count + 1) || needleWords == 0 || count > haystackWords)
1771 const char *nextHaystack;
1772 const char *nextNeedle;
1776 for (
stringsize_t i = count - 1; i && haystackWordLength != 0; i--)
1778 haystack = nextHaystack;
1780 haystackWordLength =
nextWord(&haystack, &haystackLength, &nextHaystack);
1783 stringsize_t searchCount = (haystackWords - needleWords - count) + 2;
1787 for (; searchCount; searchCount--)
1790 const char *needlePosition = needle;
1791 const char *haystackPosition = haystack;
1793 const char *nextHaystackPtr = nextHaystack;
1794 const char *nextNeedlePtr = nextNeedle;
1801 for (i = needleWords; i; i--)
1805 if (haystackWordLength != needleWordLength)
1812 if (memcmp(needlePosition, haystackPosition, needleWordLength) != 0)
1821 haystackPosition = nextHaystackPtr;
1822 needlePosition = nextNeedlePtr;
1824 haystackWordLength =
nextWord(&haystackPosition, &haystackScanLength, &nextHaystackPtr);
1826 needleWordLength =
nextWord(&needlePosition, &needleScanLength, &nextNeedlePtr);
1833 haystack = nextHaystack;
1835 haystackWordLength =
nextWord(&haystack, &haystackLength, &nextHaystack);
1862 const char *haystack = data;
1872 if (needleWords > (haystackWords - count + 1) || needleWords == 0 || count > haystackWords)
1877 const char *nextHaystack;
1878 const char *nextNeedle;
1882 for (
stringsize_t i = count - 1; i && haystackWordLength != 0; i--)
1884 haystack = nextHaystack;
1886 haystackWordLength =
nextWord(&haystack, &haystackLength, &nextHaystack);
1889 stringsize_t searchCount = (haystackWords - needleWords - count) + 2;
1893 for (; searchCount; searchCount--)
1896 const char *needlePosition = needle;
1897 const char *haystackPosition = haystack;
1899 const char *nextHaystackPtr = nextHaystack;
1900 const char *nextNeedlePtr = nextNeedle;
1907 for (i = needleWords; i; i--)
1911 if (haystackWordLength != needleWordLength)
1918 if (
caselessCompare(needlePosition, haystackPosition, needleWordLength))
1927 haystackPosition = nextHaystackPtr;
1928 needlePosition = nextNeedlePtr;
1930 haystackWordLength =
nextWord(&haystackPosition, &haystackScanLength, &nextHaystackPtr);
1932 needleWordLength =
nextWord(&needlePosition, &needleScanLength, &nextNeedlePtr);
1939 haystack = nextHaystack;
1941 haystackWordLength =
nextWord(&haystack, &haystackLength, &nextHaystack);
void reportException(wholenumber_t error)
RexxArray * new_array(size_t s)
RexxInteger * new_integer(wholenumber_t v)
codepoint_t optionalPadArgument(RexxObject *o, codepoint_t d, size_t p)
RexxString * stringArgument(RexxObject *object, RexxString *kind, size_t position)
size_t optionalLengthArgument(RexxObject *o, size_t d, size_t p)
char optionalOptionArgument(RexxObject *o, char d, size_t p)
size_t optionalPositionArgument(RexxObject *o, size_t d, size_t p)
#define Error_Incorrect_method_option
#define Error_Incorrect_method_invbin
#define Error_Incorrect_method_invhex
#define Error_Incorrect_method_binblank
#define Error_Incorrect_method_hexblank
#define DATATYPE_UPPERCASE
#define DATATYPE_LOWERCASE
#define DATATYPE_MIXEDCASE
RexxString * new_string(const char *s, stringsizeB_t bl, sizeC_t cl=-1)
#define STRING_COMPOUND_NAME
RexxString * raw_string(stringsizeB_t bl, stringsizeC_t cl=-1)
#define DATATYPE_ALPHANUMERIC
#define DATATYPE_WHOLE_NUMBER
#define DATATYPE_VARIABLE
#define STRING_BAD_VARIABLE
stringsize_t positionArgument(RexxObject *argument, size_t position)
size_t RexxEntry StringLength(RexxThreadContext *c, RexxStringObject s)
static const wholenumber_t MAX_WHOLENUMBER
static wholenumber_t minVal(wholenumber_t n1, wholenumber_t n2)
void put(RexxObject *eref, size_t pos)
size_t append(RexxObject *)
RexxNumberString * plus(RexxObject *)
void queue(RexxObject *obj)
bool numberValue(wholenumber_t &result, size_t precision)
const char * getStringData()
RexxNumberString * numberString()
void set(sizeB_t s, int c, sizeB_t l)
void put(sizeB_t s, const void *b, sizeB_t l)
static void unpackNibble(int Val, char *p)
static RexxInteger * posRexx(const char *stringData, sizeB_t length, RexxString *needle, RexxInteger *pstart, RexxInteger *range)
static RexxString * packHex(const char *String, sizeB_t StringLength)
static RexxInteger * wordIndex(const char *data, sizeB_t length, RexxInteger *position)
static size_t memPos(const char *string, sizeB_t length, char target)
static const char * memcpbrk(const char *String, const char *Set, sizeB_t Length)
static char packByte2(const char *Byte)
static sizeB_t caselessLastPos(const char *stringData, sizeB_t haystackLen, RexxString *needle, sizeB_t _start, sizeB_t range)
static void skipNonBlanks(const char **String, sizeB_t *StringLength)
static RexxString * substr(const char *, sizeB_t, RexxInteger *, RexxInteger *, RexxString *)
static RexxObject * dataType(RexxString *String, char Option)
static const char * locateSeparator(const char *start, const char *end, const char *sepData, sizeB_t sepLength)
static size_t caselessCountStr(const char *hayStack, sizeB_t hayStackLength, RexxString *needle)
static char packNibble(const char *String)
static RexxString * word(const char *data, sizeB_t length, RexxInteger *position)
static void skipBlanks(const char **String, sizeB_t *StringLength)
static RexxInteger * wordPos(const char *data, sizeB_t length, RexxString *phrase, RexxInteger *pstart)
static sizeB_t lastPos(const char *stringData, sizeB_t hastackLen, RexxString *needle, sizeB_t _start, sizeB_t _range)
static bool matchCharacter(char ch, const char *charSet, sizeB_t len)
static RexxInteger * verify(const char *data, sizeB_t stringLen, RexxString *ref, RexxString *option, RexxInteger *_start, RexxInteger *range)
static RexxInteger * wordLength(const char *data, sizeB_t length, RexxInteger *position)
static sizeB_t chGetSm(char *Destination, const char *Source, sizeB_t Length, sizeB_t Count, const char *Set, sizeB_t *ScannedSize)
static RexxInteger * caselessWordPos(const char *data, sizeB_t length, RexxString *phrase, RexxInteger *pstart)
static RexxArray * subWords(const char *data, sizeB_t length, RexxInteger *position, RexxInteger *plength)
static size_t countStr(const char *hayStack, sizeB_t hayStackLength, RexxString *needle)
static int valSet(const char *String, sizeB_t Length, const char *Set, int Modulus, size_t *PackedSize)
static int hexDigitToInt(char ch)
static size_t validateSet(const char *String, sizeB_t Length, const char *Set, int Modulus, bool Hex)
static RexxArray * words(const char *data, sizeB_t length)
static char packByte(const char *String)
static sizeB_t pos(const char *stringData, sizeB_t haystack_length, RexxString *needle, sizeB_t _start, sizeB_t _range)
static RexxString * subWord(const char *data, sizeB_t length, RexxInteger *position, RexxInteger *plength)
static size_t wordCount(const char *String, sizeB_t StringLength)
static sizeB_t nextWord(const char **String, sizeB_t *StringLength, const char **NextString)
static RexxInteger * lastPosRexx(const char *stringData, sizeB_t haystackLen, RexxString *needle, RexxInteger *_start, RexxInteger *_range)
static sizeB_t caselessPos(const char *stringData, sizeB_t haystack_length, RexxString *needle, sizeB_t _start, sizeB_t _range)
static int caselessCompare(const char *, const char *, sizeB_t)
static RexxArray * makearray(const char *start, sizeB_t length, RexxString *separator)
static RexxString * subchar(const char *stringData, sizeB_t stringLength, RexxInteger *positionArg)
stringsize_t stringsizeB_t