replaced libart with new polygon code
[swftools.git] / lib / art / art_misc.c
1 /* Libart_LGPL - library of basic graphic primitives
2  * Copyright (C) 1998 Raph Levien
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /* Various utility functions RLL finds useful. */
21
22 #include "config.h"
23 #include "art_misc.h"
24
25 #ifdef HAVE_UINSTD_H
26 #include <unistd.h>
27 #endif
28 #include <stdio.h>
29 #include <stdarg.h>
30
31 /**
32  * art_die: Print the error message to stderr and exit with a return code of 1.
33  * @fmt: The printf-style format for the error message.
34  *
35  * Used for dealing with severe errors.
36  **/
37 void
38 art_die (const char *fmt, ...)
39 {
40   va_list ap;
41
42   va_start (ap, fmt);
43   vfprintf (stderr, fmt, ap);
44   va_end (ap);
45   exit (1);
46 }
47
48 /**
49  * art_warn: Print the warning message to stderr.
50  * @fmt: The printf-style format for the warning message.
51  *
52  * Used for generating warnings.
53  **/
54 void
55 art_warn (const char *fmt, ...)
56 {
57   va_list ap;
58
59   fprintf(stderr, "warn: ");
60   va_start (ap, fmt);
61   vfprintf (stderr, fmt, ap);
62   va_end (ap);
63 }
64
65 /**
66  * art_dprint: Print the debug message to stderr.
67  * @fmt: The printf-style format for the debug message.
68  *
69  * Used for generating debug output.
70  **/
71 void
72 art_dprint (const char *fmt, ...)
73 {
74   va_list ap;
75
76   va_start (ap, fmt);
77   vfprintf (stderr, fmt, ap);
78   va_end (ap);
79 }
80