Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#pragma once
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/*
18 * standalone mini error interface
19 */
20
21#include <stdarg.h>
22#include <errno.h>
23
24 typedef struct Error_info_s {
25 int errors;
26 int indent;
27 int line;
29 int trace;
30 char *file;
31 char *id;
33
34#define ERROR_INFO 0 /* info message -- no err_id */
35#define ERROR_WARNING 1 /* warning message */
36#define ERROR_ERROR 2 /* error message -- no err_exit */
37#define ERROR_FATAL 3 /* error message with err_exit */
38#define ERROR_PANIC ERROR_LEVEL /* panic message with err_exit */
39
40#define ERROR_LEVEL 0x00ff /* level portion of status */
41#define ERROR_SYSTEM 0x0100 /* report system errno message */
42#define ERROR_USAGE 0x0800 /* usage message */
43
44/* support for extra API misuse warnings if available */
45#ifdef __GNUC__
46 #define PRINTF_LIKE(index, first) __attribute__((format(printf, index, first)))
47#else
48 #define PRINTF_LIKE(index, first) /* nothing */
49#endif
50
52
53 extern void setTraceLevel (int);
54 extern void setErrorLine (int);
55 extern void setErrorFileLine (char*, int);
56 extern void setErrorId (char*);
57 extern void setErrorErrors (int);
58 extern int getErrorErrors (void);
59
60 extern void error(int, const char *, ...) PRINTF_LIKE(2, 3);
61 extern void errorf(void *, void *, int, const char *, ...) PRINTF_LIKE(4, 5);
62 extern void errorv(const char *, int, const char *, va_list);
63
64#undef PRINTF_LIKE
65
66#ifdef __cplusplus
67}
68#endif
void setTraceLevel(int)
Definition error.c:33
void setErrorFileLine(char *, int)
Definition error.c:26
void error(int, const char *,...)
Definition error.c:83
void errorf(void *, void *, int, const char *,...)
Definition error.c:92
int getErrorErrors(void)
Definition error.c:32
Error_info_t error_info
Definition error.c:23
struct Error_info_s Error_info_t
void setErrorErrors(int)
Definition error.c:31
void setErrorId(char *)
Definition error.c:30
void setErrorLine(int)
Definition error.c:25
#define PRINTF_LIKE(index, first)
Definition error.h:48
void errorv(const char *, int, const char *, va_list)
Definition error.c:35
int trace
Definition error.h:29
int indent
Definition error.h:26
char * id
Definition error.h:31
int warnings
Definition error.h:28
char * file
Definition error.h:30
int line
Definition error.h:27
int errors
Definition error.h:25