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