libsc  2.8.7
The SC library provides support for parallel scientific applications.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sc_string.h
Go to the documentation of this file.
1 /*
2  This file is part of the SC Library.
3  The SC Library provides support for parallel scientific applications.
4 
5  Copyright (C) 2010 The University of Texas System
6  Additional copyright (C) 2011 individual authors
7 
8  The SC Library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  The SC Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with the SC Library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 */
23 
24 #ifndef SC_STRING_H
25 #define SC_STRING_H
26 
27 #include <sc.h>
28 
36 #define SC_STRING_SIZE 4088
37 
44 typedef struct sc_string
45 {
46  /* None of the member variables are public.
47  * We provide the declaration here in sc_string.h
48  * so the object can be declared on the stack.
49  */
50  int printed;
52 }
54 
61 
68 int sc_string_putc (sc_string_t * scs, int c);
69 
76 int sc_string_puts (sc_string_t * scs, const char *s);
77 
86 int sc_string_putf (sc_string_t * scs, const char *fmt, ...)
87  __attribute__ ((format (printf, 2, 3)));
88 
98 int sc_string_putv (sc_string_t * scs, const char *fmt,
99  va_list ap);
100 
107 const char *sc_string_get_content (sc_string_t * scs, int *length);
108 
109 #endif /* !SC_STRING_H */
Support for process management (memory allocation, logging, etc.)
struct sc_string sc_string_t
This is a simple type for growing a string by printf-like commands.
int sc_string_putv(sc_string_t *scs, const char *fmt, va_list ap)
Append to the string object using a format string and a vararg pointer.
const char * sc_string_get_content(sc_string_t *scs, int *length)
Access content of the string buffer.
int sc_string_putc(sc_string_t *scs, int c)
Append a single character to the string buffer object.
int sc_string_putf(sc_string_t *scs, const char *fmt,...)
Append to the string object using a format string and arguments.
int sc_string_puts(sc_string_t *scs, const char *s)
Append a string to the string buffer object.
#define SC_STRING_SIZE
This defines the maximum string storage including the trailing '\0'.
Definition: sc_string.h:36
void sc_string_init(sc_string_t *scs)
Initialize to an empty string.
This is a simple type for growing a string by printf-like commands.
Definition: sc_string.h:45
int printed
Opaque object: do not access.
Definition: sc_string.h:50
char buffer[SC_STRING_SIZE]
Opaque object: do not access.
Definition: sc_string.h:51