From 72f72d64a422d6628c4796f5c0bf2e508f134214 Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Wed, 4 May 2011 16:05:14 +0900 Subject: Adding upstream version 0.5.1 --- Str.h | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Str.h (limited to 'Str.h') diff --git a/Str.h b/Str.h new file mode 100644 index 0000000..af0b2de --- /dev/null +++ b/Str.h @@ -0,0 +1,83 @@ +/* $Id: Str.h,v 1.5 2003/01/20 15:30:19 ukai Exp $ */ +/* + * String manipulation library for Boehm GC + * + * (C) Copyright 1998-1999 by Akinori Ito + * + * This software may be redistributed freely for this purpose, in full + * or in part, provided that this entire copyright notice is included + * on any copies of this software and applications and derivations thereof. + * + * This software is provided on an "as is" basis, without warranty of any + * kind, either expressed or implied, as to any matter including, but not + * limited to warranty of fitness of purpose, or merchantability, or + * results obtained from use of this software. + */ +#ifndef GC_STR_H +#define GC_STR_H +#include +#include +#ifdef __EMX__ +#define strcasecmp stricmp +#define strncasecmp strnicmp +#endif + +typedef struct _Str { + char *ptr; + int length; + int area_size; +} *Str; + +Str Strnew(); +Str Strnew_size(int); +Str Strnew_charp(char *); +Str Strnew_charp_n(char *, int); +Str Strnew_m_charp(char *, ...); +Str Strdup(Str); +void Strclear(Str); +void Strfree(Str); +void Strcopy(Str, Str); +void Strcopy_charp(Str, char *); +void Strcopy_charp_n(Str, char *, int); +void Strcat_charp_n(Str, char *, int); +void Strcat(Str, Str); +void Strcat_charp(Str, char *); +void Strcat_m_charp(Str, ...); +Str Strsubstr(Str, int, int); +void Strinsert_char(Str, int, char); +void Strinsert_charp(Str, int, char *); +void Strdelete(Str, int, int); +void Strtruncate(Str, int); +void Strlower(Str); +void Strupper(Str); +void Strchop(Str); +void Strshrink(Str, int); +void Strshrinkfirst(Str, int); +void Strremovefirstspaces(Str); +void Strremovetrailingspaces(Str); +Str Stralign_left(Str, int); +Str Stralign_right(Str, int); +Str Stralign_center(Str, int); + +Str Sprintf(char *fmt, ...); + +Str Strfgets(FILE *); +Str Strfgetall(FILE *); + +void Strgrow(Str s); + +#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) +#define Strcmp(x,y) strcmp((x)->ptr,(y)->ptr) +#define Strcmp_charp(x,y) strcmp((x)->ptr,(y)) +#define Strncmp(x,y,n) strncmp((x)->ptr,(y)->ptr,(n)) +#define Strncmp_charp(x,y,n) strncmp((x)->ptr,(y),(n)) +#define Strcasecmp(x,y) strcasecmp((x)->ptr,(y)->ptr) +#define Strcasecmp_charp(x,y) strcasecmp((x)->ptr,(y)) +#define Strncasecmp(x,y,n) strncasecmp((x)->ptr,(y)->ptr,(n)) +#define Strncasecmp_charp(x,y,n) strncasecmp((x)->ptr,(y),(n)) + +#define Strlastchar(s) ((s)->length>0?(s)->ptr[(s)->length-1]:'\0') +#define Strinsert(s,n,p) Strinsert_charp((s),(n),(p)->ptr) +#define Strshrinkfirst(s,n) Strdelete((s),0,(n)) +#define Strfputs(s,f) fwrite((s)->ptr,1,(s)->length,(f)) +#endif /* not GC_STR_H */ -- cgit v1.2.3 From 6db339b3d7a391f196e7c4b725a4ed0bd00f31cf Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Wed, 4 May 2011 16:23:02 +0900 Subject: Adding upstream version 0.5.2 --- Str.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Str.h') diff --git a/Str.h b/Str.h index af0b2de..f345c74 100644 --- a/Str.h +++ b/Str.h @@ -1,4 +1,4 @@ -/* $Id: Str.h,v 1.5 2003/01/20 15:30:19 ukai Exp $ */ +/* $Id: Str.h,v 1.6 2006/04/07 13:35:35 inu Exp $ */ /* * String manipulation library for Boehm GC * @@ -28,7 +28,7 @@ typedef struct _Str { int area_size; } *Str; -Str Strnew(); +Str Strnew(void); Str Strnew_size(int); Str Strnew_charp(char *); Str Strnew_charp_n(char *, int); -- cgit v1.2.3 From 1d0ba25a660483da1272a31dd077ed94441e3d9f Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Sat, 2 Jan 2021 09:20:37 +0900 Subject: New upstream version 0.5.3+git20210102 --- Str.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Str.h') diff --git a/Str.h b/Str.h index f345c74..248815d 100644 --- a/Str.h +++ b/Str.h @@ -30,22 +30,22 @@ typedef struct _Str { Str Strnew(void); Str Strnew_size(int); -Str Strnew_charp(char *); -Str Strnew_charp_n(char *, int); -Str Strnew_m_charp(char *, ...); +Str Strnew_charp(const char *); +Str Strnew_charp_n(const char *, int); +Str Strnew_m_charp(const char *, ...); Str Strdup(Str); void Strclear(Str); void Strfree(Str); void Strcopy(Str, Str); -void Strcopy_charp(Str, char *); -void Strcopy_charp_n(Str, char *, int); -void Strcat_charp_n(Str, char *, int); +void Strcopy_charp(Str, const char *); +void Strcopy_charp_n(Str, const char *, int); +void Strcat_charp_n(Str, const char *, int); void Strcat(Str, Str); -void Strcat_charp(Str, char *); +void Strcat_charp(Str, const char *); void Strcat_m_charp(Str, ...); Str Strsubstr(Str, int, int); void Strinsert_char(Str, int, char); -void Strinsert_charp(Str, int, char *); +void Strinsert_charp(Str, int, const char *); void Strdelete(Str, int, int); void Strtruncate(Str, int); void Strlower(Str); -- cgit v1.2.3