about the "fmt" module

crux-00016: $SRC/fmt/README.fmt

* "fmt": Converting numbers to strings

  The "fmt" functions convert integers and floats
  to strings.



* The "fmt" interface

  fmt_int (strt s, int i);
  fmt_int_x (strt s, int i);
  fmt_int_X (strt s, int i);
  fmt_int_o (strt s, int i);
    Convert i to a string, appending to s.

    Conversion is in decimal, hex, hex (with uppercase digits),
    or octal.

  fmt_float (strt s, float f);
  fmt_float_e (strt s, float f);
    Convert f to a string, appending to s.

    Conversion is in in either decimal or exponential notation.




  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
    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/>.

*/