1/* $RCSfile: str.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:27 $ 2 * 3 * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2000, 4 * by Larry Wall and others 5 * 6 * You may distribute under the terms of either the GNU General Public 7 * License or the Artistic License, as specified in the README file. 8 * 9 * $Log: str.h,v $ 10 */ 11 12struct string { 13 char * str_ptr; /* pointer to malloced string */ 14 double str_nval; /* numeric value, if any */ 15 int str_len; /* allocated size */ 16 int str_cur; /* length of str_ptr as a C string */ 17 union { 18 STR *str_next; /* while free, link to next free str */ 19 } str_link; 20 char str_pok; /* state of str_ptr */ 21 char str_nok; /* state of str_nval */ 22}; 23 24#define Nullstr Null(STR*) 25 26/* the following macro updates any magic values this str is associated with */ 27 28#define STABSET(x) (x->str_link.str_magic && stabset(x->str_link.str_magic,x)) 29 30EXT STR **tmps_list; 31EXT long tmps_max INIT(-1); 32 33double str_2num ( STR *str ); 34char * str_2ptr ( STR *str ); 35char * str_append_till ( STR *str, char *from, int delim, char *keeplist ); 36void str_cat ( STR *str, char *ptr ); 37void str_chop ( STR *str, char *ptr ); 38void str_dec ( STR *str ); 39void str_free ( STR *str ); 40char * str_gets ( STR *str, FILE *fp ); 41void str_grow ( STR *str, int len ); 42void str_inc ( STR *str ); 43int str_len ( STR *str ); 44STR * str_make ( char *s ); 45STR * str_mortal ( STR *oldstr ); 46void str_ncat ( STR *str, char *ptr, int len ); 47STR * str_new ( int len ); 48STR * str_nmake ( double n ); 49void str_nset ( STR *str, char *ptr, int len ); 50void str_numset ( STR *str, double num ); 51void str_replace ( STR *str, STR *nstr ); 52void str_scat ( STR *dstr, STR *sstr ); 53void str_set ( STR *str, char *ptr ); 54void str_sset ( STR *dstr, STR *sstr ); 55