#ifndef INSERT_H
#define INSERT_H

#include<stdarg.h> 

#define BUFINC 10024

struct myinsert {
  long INCR;
  long strg_size, strg_len;
  char* strg, *tmp, stmp[10], *IndString;
}; 


int ci_strcmp(const char *a, const char *b);
/* case insensitive string compare */

/* These insert functions work with any number of buffers at the same time */

struct myinsert InitInsert(int i); 
/* i: size increment of allocation buffer; use i = 0 for the default value */

struct myinsert AddToIndent(struct myinsert ins, int n);
/* Adds n blank spaces to default indentation; n may be negative. */

struct myinsert CInsert(char c, struct myinsert ins);

struct myinsert SInsert(char* s, struct myinsert ins);

inline void CInsert2(char c, struct myinsert* ins);

inline void SInsert2(char* s, struct myinsert* ins);


struct myinsert FSInsert(struct myinsert ins, const char *str, ...);
/* Same as SInsert except it can use a printf formatted string */

char* GetInsertBuf(struct myinsert* s);
/*gets the result; this should be deallocated with free() if no longer needed*/

void Empty(struct myinsert* s);
/* Use this function if buffer should be reused. It empties the buffer without
   deallocating it. Resets also indentation. */

void FreeIns(struct myinsert* s);
/* Does not deallocate the buffer, which is the responsibility of the user. */

/* These insert functions work with ONE buffer ONLY at a time */

void init_insert();

void cinsert(char c);

void sinsert(char* s);

char* get_insert_buf();

void empty_buf(); /* empties the buffer without deallocating it */

#endif
