diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /support/util/dbuf_string.h | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'support/util/dbuf_string.h')
| -rw-r--r-- | support/util/dbuf_string.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/support/util/dbuf_string.h b/support/util/dbuf_string.h new file mode 100644 index 0000000..70e9562 --- /dev/null +++ b/support/util/dbuf_string.h @@ -0,0 +1,69 @@ +/* + dbuf_string.h - Append formatted string to the dynamic buffer + version 1.2.2, March 20th, 2012 + + Copyright (c) 2002-2012 Borut Razem + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#ifndef __DBUF_STRING_H +#define __DBUF_STRING_H + +#include <stdarg.h> +#include <stdio.h> +#include "dbuf.h" + +/* Attribute `nonnull' was valid as of gcc 3.3. */ +#ifndef ATTRIBUTE_NONNULL +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) +# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m))) +# else +# define ATTRIBUTE_NONNULL(m) +# endif /* GNUC >= 3.3 */ +#endif /* ATTRIBUTE_NONNULL */ + +/* The __-protected variants of `format' and `printf' attributes + are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ +#ifndef ATTRIBUTE_PRINTF +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m) +#else +# define ATTRIBUTE_PRINTF(m, n) +# endif /* GNUC >= 2.7 */ +#endif /* ATTRIBUTE_PRINTF */ + +#ifdef __cplusplus +extern "C" { +#endif + +int dbuf_append_str(struct dbuf_s *dbuf, const char *str); +int dbuf_prepend_str(struct dbuf_s *dbuf, const char *str); +int dbuf_append_char(struct dbuf_s *dbuf, char chr); +int dbuf_prepend_char(struct dbuf_s *dbuf, char chr); +int dbuf_vprintf(struct dbuf_s *dbuf, const char *format, va_list args); +int dbuf_printf (struct dbuf_s *dbuf, const char *format, ...) ATTRIBUTE_PRINTF(2, 3); +size_t dbuf_getline(struct dbuf_s *dbuf, FILE *infp); +size_t dbuf_chomp (struct dbuf_s *dbuf); +void dbuf_write (struct dbuf_s *dbuf, FILE *dest); +void dbuf_write_and_destroy (struct dbuf_s *dbuf, FILE *dest); + +#ifdef __cplusplus +} +#endif + +#endif /* __DBUF_STRING_H */ |
