1 /* $Id: Str.h,v 1.6 2006/04/07 13:35:35 inu Exp $ */
3 * String manipulation library for Boehm GC
5 * (C) Copyright 1998-1999 by Akinori Ito
7 * This software may be redistributed freely for this purpose, in full
8 * or in part, provided that this entire copyright notice is included
9 * on any copies of this software and applications and derivations thereof.
11 * This software is provided on an "as is" basis, without warranty of any
12 * kind, either expressed or implied, as to any matter including, but not
13 * limited to warranty of fitness of purpose, or merchantability, or
14 * results obtained from use of this software.
21 #define strcasecmp stricmp
22 #define strncasecmp strnicmp
33 Str Strnew_charp(char *);
34 Str Strnew_charp_n(char *, int);
35 Str Strnew_m_charp(char *, ...);
39 void Strcopy(Str, Str);
40 void Strcopy_charp(Str, char *);
41 void Strcopy_charp_n(Str, char *, int);
42 void Strcat_charp_n(Str, char *, int);
43 void Strcat(Str, Str);
44 void Strcat_charp(Str, char *);
45 void Strcat_m_charp(Str, ...);
46 Str Strsubstr(Str, int, int);
47 void Strinsert_char(Str, int, char);
48 void Strinsert_charp(Str, int, char *);
49 void Strdelete(Str, int, int);
50 void Strtruncate(Str, int);
54 void Strshrink(Str, int);
55 void Strshrinkfirst(Str, int);
56 void Strremovefirstspaces(Str);
57 void Strremovetrailingspaces(Str);
58 Str Stralign_left(Str, int);
59 Str Stralign_right(Str, int);
60 Str Stralign_center(Str, int);
62 Str Sprintf(char *fmt, ...);
65 Str Strfgetall(FILE *);
69 #define Strcat_char(x,y) (((x)->length+1>=(x)->area_size)?Strgrow(x),0:0,(x)->ptr[(x)->length++]=(y),(x)->ptr[(x)->length]=0)
70 #define Strcmp(x,y) strcmp((x)->ptr,(y)->ptr)
71 #define Strcmp_charp(x,y) strcmp((x)->ptr,(y))
72 #define Strncmp(x,y,n) strncmp((x)->ptr,(y)->ptr,(n))
73 #define Strncmp_charp(x,y,n) strncmp((x)->ptr,(y),(n))
74 #define Strcasecmp(x,y) strcasecmp((x)->ptr,(y)->ptr)
75 #define Strcasecmp_charp(x,y) strcasecmp((x)->ptr,(y))
76 #define Strncasecmp(x,y,n) strncasecmp((x)->ptr,(y)->ptr,(n))
77 #define Strncasecmp_charp(x,y,n) strncasecmp((x)->ptr,(y),(n))
79 #define Strlastchar(s) ((s)->length>0?(s)->ptr[(s)->length-1]:'\0')
80 #define Strinsert(s,n,p) Strinsert_charp((s),(n),(p)->ptr)
81 #define Strshrinkfirst(s,n) Strdelete((s),0,(n))
82 #define Strfputs(s,f) fwrite((s)->ptr,1,(s)->length,(f))
83 #endif /* not GC_STR_H */