PIPS
vararg.c
Go to the documentation of this file.
1 /*
2 
3  $Id: vararg.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 #include <stdio.h>
28 #include <stdarg.h>
29 #include <string.h>
30 
31 #include "genC.h"
32 
33 extern void gpips_user_error_message(char *);
34 extern void gpips_user_warning_message(char *);
35 
36 void
37 gpips_user_error(const char * calling_function_name,
38  const char * format,
39  va_list * args)
40 {
42  string_buffer_printf(eb, "user error in %s: ", calling_function_name);
43 
44  va_list acpy;
45  va_copy(acpy, *args);
46  string_buffer_printf_alist(eb, (const string) format, &acpy);
47  va_end(acpy);
48 
49  string ebs = string_buffer_to_string(eb);
50  string_buffer_free(&eb);
51 
53 }
54 
55 void
56 gpips_user_warning(const char * calling_function_name,
57  const char * format,
58  va_list * args)
59 {
61  string_buffer_printf(wb, "user warning in %s: ", calling_function_name);
62 
63  va_list acpy;
64  va_copy(acpy, *args);
65  string_buffer_printf_alist(wb, (const string) format, &acpy);
66  va_end(acpy);
67 
68  string wbs = string_buffer_to_string(wb);
69  string_buffer_free(&wb);
70 
72 }
void gpips_user_warning(const char *calling_function_name, const char *format, va_list *args)
Definition: vararg.c:56
void gpips_user_error_message(char *)
void gpips_user_warning_message(char *)
void gpips_user_error(const char *calling_function_name, const char *format, va_list *args)
Definition: vararg.c:37
void string_buffer_printf(string_buffer, const string,...)
append a formatted string to sb
string string_buffer_to_string(const string_buffer)
return malloc'ed string from string buffer sb
void string_buffer_free(string_buffer *)
free string buffer structure, also free string contents according to the dup field
Definition: string_buffer.c:82
void string_buffer_printf_alist(string_buffer, const string, va_list *)
formatted alist version
string_buffer string_buffer_make(bool dup)
allocate a new string buffer
Definition: string_buffer.c:58
internally defined structure.
Definition: string_buffer.c:47