Added missing file.
[tinycc/k1w1.git] / tcccstring.h
blob824fc30628d3b1d618418fbe90bc6690fc2b409a
1 /*
2 * String utility functions for TCC
3 *
4 * Copyright (c) 2001-2004 Fabrice Bellard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef __TCCCSTRING_H__
21 #define __TCCCSTRING_H__
23 #include "tcc.h"
25 /* CString handling */
26 void cstr_realloc(CString *cstr, int new_size);
27 /* add a byte */
28 static inline void cstr_ccat(CString *cstr, int ch)
30 int size;
31 size = cstr->size + 1;
32 if (size > cstr->size_allocated)
33 cstr_realloc(cstr, size);
34 ((unsigned char *)cstr->data)[size - 1] = ch;
35 cstr->size = size;
38 void cstr_cat(CString *cstr, const char *str);
39 void cstr_wccat(CString *cstr, int ch);
40 void cstr_new(CString *cstr);
41 void cstr_free(CString *cstr);
42 #define cstr_reset(cstr) cstr_free(cstr)
43 void add_char(CString *cstr, int c);
45 #endif /* __TCCCSTRING_H__ */