2 * str - string list routines
4 * Copyright (C) 1999-2007 David I. Bell
6 * Calc is open software; you can redistribute it and/or modify it under
7 * the terms of the version 2.1 of the GNU Lesser General Public License
8 * as published by the Free Software Foundation.
10 * Calc is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
13 * Public License for more details.
15 * A copy of version 2.1 of the GNU Lesser General Public License is
16 * distributed with calc under the filename COPYING-LGPL. You should have
17 * received a copy with calc; if not, write to Free Software Foundation, Inc.
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * @(#) $Revision: 30.1 $
21 * @(#) $Id: str.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
22 * @(#) $Source: /usr/local/src/bin/calc/RCS/str.h,v $
24 * Under source code control: 1990/02/15 01:48:36
25 * File existed as early as: before 1990
27 * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
31 #if !defined(__CALCSTRING_H__)
32 #define __CALCSTRING_H__
35 #if defined(CALC_SRC) /* if we are building from the calc source tree */
38 # include <calc/zmath.h>
46 struct string
*s_next
;
49 typedef struct string STRING
;
53 char *h_list
; /* list of strings separated by nulls */
54 size_t h_used
; /* characters used so far */
55 size_t h_avail
; /* characters available for use */
56 long h_count
; /* number of strings */
60 E_FUNC
void initstr(STRINGHEAD
*hp
);
61 E_FUNC
char *addstr(STRINGHEAD
*hp
, char *str
);
62 E_FUNC
char *namestr(STRINGHEAD
*hp
, long n
);
63 E_FUNC
int findstr(STRINGHEAD
*hp
, char *str
);
64 E_FUNC
char *charstr(int ch
);
65 E_FUNC
char *addliteral(char *str
);
66 E_FUNC
long stringindex(char *str1
, char *str2
);
67 E_FUNC STRING
*stralloc(void);
68 E_FUNC
long addstring(char *str
, size_t len
);
69 E_FUNC STRING
*charstring(int ch
);
70 E_FUNC STRING
*makestring(char *str
);
71 E_FUNC STRING
*makenewstring(char *str
);
72 E_FUNC STRING
*findstring(long index
);
73 E_FUNC STRING
*slink(STRING
*);
74 E_FUNC
void sfree(STRING
*);
75 E_FUNC
void fitstring(char *, long, long);
76 E_FUNC
void strprint(STRING
*);
77 E_FUNC
void showstrings(void);
78 E_FUNC
void showliterals(void);
79 EXTERN STRING _nullstring_
;
82 #endif /* !__CALCSTRING_H__ */