


#ifndef __INC_STRING
#define __INC_STRING

#include "panic.h"
#include "misc.h"



typedef struct {
  char *data;
  int mxlen;
} StringHeader;

typedef StringHeader *String;


#define NULLSTRING       ((String) NULL)



extern String  strNew(int mxlen);
extern void    strFree(String str);
extern String  strClear(String str);
extern String  strNewCopy(String str);
extern String  strMake(char *s);
extern int     strLen(String str);
extern int     strCmp(String a, String b);
extern int     strMaxLen(String str);
extern char   *strGet(String str);
extern char    strRef(String str, int i);


extern String  strInit_(String *dest, char *s);
#define strInit(dest, s)          strInit_(&(dest), (s))
extern String  strCopy_(String *dest, String src);
#define strCopy(dest, src)        strCopy_(&(dest), (src))
extern String  strCat_(String *dest, String src);
#define strCat(dest, src)         strCat_(&(dest), (src))
extern String  strAddChar_(String *dest, char ch);
#define strAddChar(dest, ch)      strAddChar_(&(dest), (ch))
extern int     strNewLen_(String *dest, int newlen);
#define strNewLen(dest, newlen)   strNewLen_(&(dest), (newl))



/* probably need strSubStr, strInsert, find-substring,
   strToInt, strToFloat, strPrintF (using vsprintf) ... */

#endif 
