about the "str" module

crux-00031: $SRC/tupt/README.tupt

* "tupt": reference counted dynamically allocated xpr arrays

  The interface is largely self evident.

  A string is properly declared and initialized this way:

      #include "strt/strt.h"
      #include "xpr/xpr.h"
      #include "tup/tup.h"
      #include "tupt/tupt.h"


      struct tupt a_tupt;

      a_tupt = tupt_new ();

  Such strings are initially created with a reference count
  of 1.

  The reference count can be incremented or decremented:

	tupt_ref (r);
        tupt_unref (r);

  The current reference count is available to facilitate
  copy-on-write algorithms.

	int x = tupt_refs (r);

  The "tup/tup.h"  functions are translated to tupt versions:

    int tupt_length (tupt);
      Return the length of a tup.

    struct xpr_ref const * tup_view_ro (tupt, int pos, int l);
    struct xpr_ref * tup_view_rw (tupt, int pos, int l);
      Return a pointer to elements of a tup.

    void tup_set_length (tupt, int l);
      Change the length of a tup, nil padding if needed.

    void tup_trim (tupt);
      Compact a tup in memory if it is allocated larger than
      it needs to be.

    void tup_copy (tupt, tupt);
       Copy a tup.

/*

    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
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    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/>.

*/