error.h revision 34f9b3eef6fdadbda0a846aa4d68691ac40eace5
/* : : generated by proto : : */
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
/*
* Glenn Fowler
* AT&T Research
*
* option, error and message formatter external definitions
*/
#ifndef _ERROR_H
#if !defined(__PROTO__)
#include <prototyped.h>
#endif
#if !defined(__LINKAGE__)
#define __LINKAGE__ /* 2004-08-11 transition */
#endif
#define _ERROR_H
#include <ast.h>
#include <option.h>
#include <errno.h>
#define ERROR_VERSION 20070319L
#if !defined(errno) && defined(__DYNAMIC__)
#endif
#define ERROR_debug(n) (-(n))
#define ERROR_exit(n) ((n)+ERROR_ERROR)
#define ERROR_warn(n) (ERROR_WARNING)
#ifndef ERROR_catalog
#define ERROR_catalog(t) t
#endif
#ifndef ERROR_dictionary
#define ERROR_dictionary(t) t
#endif
#ifndef ERROR_translate
#define ERROR_translate(l,i,d,m) (ERROR_translating()?errorx((const char*)l,(const char*)i,(const char*)d,(const char*)m):(m))
#endif
#define ERROR_INFO 0 /* info message -- no err_id */
/*
* errorpush()/errorpop() are obsolete -- use errorctx() instead
*/
#ifndef ERROR_CONTEXT_T
#define ERROR_CONTEXT_T Error_info_t
#endif
#define errorpush(p,f) (*(p)= *ERROR_CONTEXT_BASE,*ERROR_CONTEXT_BASE=error_info.empty,error_info.context=(Error_context_t*)(p),error_info.flags=(f))
#define errorpop(p) (*ERROR_CONTEXT_BASE= *(p))
typedef struct Error_info_s Error_info_t;
typedef struct Error_context_s Error_context_t;
#define ERROR_CONTEXT \
int errors; /* >= ERROR_ERROR count */ \
int flags; /* context flags */ \
int line; /* input|output line number */ \
int warnings; /* ERROR_WARNING count */ \
char* file; /* input|output file name */ \
char* id; /* command id */
struct Error_context_s /* context stack element */
{
};
struct Error_info_s /* error state */
{
int fd; /* write(2) fd */
/* the rest are implicitly initialized */
int clear; /* default clear ERROR_* flags */
int core; /* level>=core -> core dump */
int indent; /* debug trace indent level */
int init; /* initialized */
int last_errno; /* last reported errno */
int mask; /* multi level debug trace mask */
int set; /* default set ERROR_* flags */
int trace; /* debug trace level */
char* version; /* ERROR_SOURCE command version */
ERROR_CONTEXT /* top of context stack */
unsigned long time; /* debug time trace */
char* (*translate) __PROTO__((const char*, const char*, const char*, const char*)); /* format translator */
const char* catalog; /* message catalog */
};
#ifndef errno
#endif
#if _BLD_ast && defined(__EXPORT__)
#endif
#if !_BLD_ast && defined(__IMPORT__)
#endif
#define error_info (*_error_infop_)
#define __MANGLE__ __LINKAGE__
#if _BLD_ast && defined(__EXPORT__)
#endif
#ifndef errorx
#endif
#define __MANGLE__ __LINKAGE__
#endif