about the "str" module

crux-00011: $SRC/str/README.str

* "str": dynamically allocated strings

  The "str" functions provide basic resizable string.

* The "str" interface

  The interface is largely self evident.

  A string is properly declared and initialized this way:

      #include "str/str.h"

      struct str a_str = {0};

  int str_length (struct str *);
    Return the length of a string.

  char * str_view (struct str *, int pos, int l);
   Return a character pointer into a string.
   The pointer returned is invalidated by any
   call to a "str_" function that might change the
   size of this string.

  void str_set_length (struct str *, int l);
   Change the size of a string, appending 0s as needed.

  void str_set (struct str *, int l, char * s);
  void str_set0 (struct str *, char * s);
  void str_adjoin (struct str *, char c);
  void str_append (struct str *, int l, char * s);
  void str_append0 (struct str *, char *);
  void str_copy (struct str *, struct str *);
  void str_cat (struct str *, struct str *);
    Ways to build strings.

  void str_trim (struct str *);
    Internally, strings may allocate more memory
    than is needed.  This function trims a string
    to use minimal memory.  (See the function ar_trim
    in utils/README.ar)

  int str_overlaps (struct str * s, int l, char * c);
    Return 1 if c[0..(l-1)] is contained in s.
    Panic if c and/or l are known to be invalid.
    Otherwise return 0.


    This file is part of Crux.

    Crux is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Crux is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Crux.  If not, see <http://www.gnu.org/licenses/>.