da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/* : : generated by proto : : */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/***********************************************************************
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* This software is part of the ast package *
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner* Copyright (c) 1985-2010 AT&T Intellectual Property *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* and is licensed under the *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Common Public License, Version 1.0 *
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin* by AT&T Intellectual Property *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* A copy of the License is available at *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* http://www.opensource.org/licenses/cpl1.0.txt *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Information and Software Systems Research *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* AT&T Research *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Florham Park NJ *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Glenn Fowler <gsf@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* David Korn <dgk@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Phong Vo <kpv@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin***********************************************************************/
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Glenn Fowler
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * AT&T Research
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * option, error and message formatter external definitions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef _ERROR_H
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if !defined(__PROTO__)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <prototyped.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if !defined(__LINKAGE__)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define __LINKAGE__ /* 2004-08-11 transition */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define _ERROR_H
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <ast.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <option.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <errno.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_VERSION 20070319L
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if !defined(errno) && defined(__DYNAMIC__)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define errno __DYNAMIC__(errno)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_debug(n) (-(n))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_exit(n) ((n)+ERROR_ERROR)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_system(n) (((n)+ERROR_ERROR)|ERROR_SYSTEM)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_usage(n) ((((n)?2:0)+ERROR_ERROR)|ERROR_USAGE)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_warn(n) (ERROR_WARNING)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef ERROR_catalog
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_catalog(t) t
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef ERROR_dictionary
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_dictionary(t) t
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef ERROR_translate
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_translating() (error_info.translate&&(ast.locale.set&(1<<AST_LC_MESSAGES)))
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define ERROR_translate(l,i,d,m) (ERROR_translating()?errorx((const char*)(l),(const char*)(i),(const char*)(d),(const char*)(m)):(char*)(m))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_INFO 0 /* info message -- no err_id */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_WARNING 1 /* warning message */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_ERROR 2 /* error message -- no err_exit */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_FATAL 3 /* error message with err_exit */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_NOEXEC EXIT_NOEXEC /* shell convention */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_NOENT EXIT_NOTFOUND /* shell convention */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_PANIC ERROR_LEVEL /* panic message with err_exit */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_LEVEL 0x00ff /* level portion of status */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_SYSTEM 0x0100 /* report system errno message */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_OUTPUT 0x0200 /* next arg is error fd */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_SOURCE 0x0400 /* next 2 args are FILE,LINE */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_USAGE 0x0800 /* usage message */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_PROMPT 0x1000 /* omit trailing newline */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_NOID 0x2000 /* omit err_id */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_LIBRARY 0x4000 /* library routine error */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_INTERACTIVE 0x0001 /* context is interactive */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_SILENT 0x0002 /* context is silent */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_NOTIFY 0x0004 /* main(-sig,0,ctx) on signal */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_FREE 0x0010 /* free context on pop */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_POP 0x0020 /* pop context */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_PUSH 0x0040 /* push context */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_SET 0x0080 /* set context */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * errorpush()/errorpop() are obsolete -- use errorctx() instead
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef ERROR_CONTEXT_T
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_CONTEXT_T Error_info_t
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_CONTEXT_BASE ((Error_context_t*)&error_info.context)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#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))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define errorpop(p) (*ERROR_CONTEXT_BASE= *(p))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Error_info_s Error_info_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Error_context_s Error_context_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_CONTEXT \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ERROR_CONTEXT_T* context; /* prev context stack element */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int errors; /* >= ERROR_ERROR count */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int flags; /* context flags */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int line; /* input|output line number */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int warnings; /* ERROR_WARNING count */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char* file; /* input|output file name */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char* id; /* command id */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstruct Error_context_s /* context stack element */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ERROR_CONTEXT
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin};
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstruct Error_info_s /* error state */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int fd; /* write(2) fd */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin void (*exit) __PROTO__((int)); /* error exit */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ssize_t (*write) __PROTO__((int, const __V_*, size_t)); /* error output */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* the rest are implicitly initialized */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int clear; /* default clear ERROR_* flags */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int core; /* level>=core -> core dump */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int indent; /* debug trace indent level */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int init; /* initialized */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int last_errno; /* last reported errno */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int mask; /* multi level debug trace mask */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int set; /* default set ERROR_* flags */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int trace; /* debug trace level */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char* version; /* ERROR_SOURCE command version */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int (*auxilliary) __PROTO__((Sfio_t*, int, int)); /* aux info to append */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ERROR_CONTEXT /* top of context stack */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Error_context_t empty; /* empty context stack element */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin unsigned long time; /* debug time trace */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char* (*translate) __PROTO__((const char*, const char*, const char*, const char*)); /* format translator */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin const char* catalog; /* message catalog */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin};
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef errno
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int errno; /* system call error status */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if _BLD_ast && defined(__EXPORT__)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef __MANGLE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define __MANGLE__ __LINKAGE__ __EXPORT__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if !_BLD_ast && defined(__IMPORT__)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef __MANGLE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define __MANGLE__ __LINKAGE__ __IMPORT__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Error_info_t* _error_infop_;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define error_info (*_error_infop_)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef __MANGLE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define __MANGLE__ __LINKAGE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if _BLD_ast && defined(__EXPORT__)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef __MANGLE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define __MANGLE__ __LINKAGE__ __EXPORT__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ void error __PROTO__((int, ...));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int errormsg __PROTO__((const char*, int, ...));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ int errorf __PROTO__((__V_*, __V_*, int, ...));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ void errorv __PROTO__((const char*, int, va_list));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef errorx
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ char* errorx __PROTO__((const char*, const char*, const char*, const char*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern __MANGLE__ Error_info_t* errorctx __PROTO__((Error_info_t*, int, int));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef __MANGLE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define __MANGLE__ __LINKAGE__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif