Ignore:
Timestamp:
Apr 10, 2025, 7:33:31 AM (9 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
7e4f226
Parents:
931f1b4
Message:

updates to string type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/collections/string_res.cfa

    r931f1b4 r9018dcf  
    1010// Created On       : Fri Sep 03 11:00:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr  6 07:38:02 2025
    13 // Update Count     : 111
     12// Last Modified On : Wed Apr  9 08:44:17 2025
     13// Update Count     : 128
    1414//
    1515
     
    190190const char * DEBUG_string_heap_start( VbyteHeap * heap ) {
    191191        return heap->StartVbyte;
    192 }
    193 
    194 // Returns the size of the string in bytes
    195 size_t len(const string_res & s) with(s) {
    196         return Handle.lnth;
    197192}
    198193
     
    756751}
    757752
    758 int find(const string_res & s, char search) {
     753// int find$( const string_res & s, ssize_t start, ssize_t len, const string_res & k, ssize_t kstart, ssize_t klen ) {
     754//     if ( start < 0 ) start = s.Handle.lnth + start;          // adjust negative starting locations
     755//     if ( kstart < 0 ) kstart = k.Handle.lnth + kstart;
     756
     757//      if ( start + len > s.Handle.lnth ) return start + 1;  // cannot be there
     758//      if ( kstart + len > k.Handle.lnth ) return start + 1;
     759//      if ( klen > len ) return start + 1;
     760
     761//      int i, r;
     762
     763//      for ( i = max( start, 1 ); ; i += 1 ) {
     764//              if ( i > s.Handle.lnth - k.Handle.lnth + 1 ) {
     765//                      r = s.Handle.lnth + 1;
     766//                      break;
     767//          } // exit
     768//              if ( HeapArea->ByteCmp( s.Handle.s, i, k.Handle.lnth, k.Handle.s, 1, k.Handle.lnth ) == 0 ) {
     769//                      r = i;
     770//                      break;
     771//          } // exit
     772//      } // for
     773//      return r;
     774// }
     775
     776int find( const string_res & s, char search ) {
    759777        return findFrom(s, 0, search);
    760778}
    761779
    762 int findFrom(const string_res & s, size_t fromPos, char search) {
     780int findFrom( const string_res & s, size_t fromPos, char search ) {
    763781        // FIXME: This paricular overload (find of single char) is optimized to use memchr.
    764782        // The general overload (find of string, memchr applying to its first character) and `contains` should be adjusted to match.
Note: See TracChangeset for help on using the changeset viewer.