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* A copy of the License is available at *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Information and Software Systems Research *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* AT&T Research *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Florham Park NJ *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Glenn Fowler <gsf@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* David Korn <dgk@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Phong Vo <kpv@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin***********************************************************************/
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Glenn Fowler
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * AT&T Research
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * option, error and message formatter external definitions
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_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#define ERROR_ERROR 2 /* error message -- no err_exit */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_NOENT EXIT_NOTFOUND /* shell convention */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_PANIC ERROR_LEVEL /* panic message with err_exit */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_LEVEL 0x00ff /* level portion of status */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_SYSTEM 0x0100 /* report system errno message */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_SOURCE 0x0400 /* next 2 args are FILE,LINE */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_LIBRARY 0x4000 /* library routine error */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_INTERACTIVE 0x0001 /* context is interactive */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_NOTIFY 0x0004 /* main(-sig,0,ctx) on signal */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * errorpush()/errorpop() are obsolete -- use errorctx() instead
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ERROR_CONTEXT_BASE ((Error_context_t*)&error_info.context)
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 ERROR_CONTEXT_T* context; /* prev context stack element */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin ssize_t (*write)(int, const void*, size_t); /* error output */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /* the rest are implicitly initialized */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int (*auxilliary)(Sfio_t*, int, int); /* aux info to append */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Error_context_t empty; /* empty context stack element */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char* (*translate)(const char*, const char*, const char*, const char*); /* format translator */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define extern extern __EXPORT__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define extern extern __IMPORT__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define extern __EXPORT__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern void error(int, ...);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern int errormsg(const char*, int, ...);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern int errorf(void*, void*, int, ...);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern char* errorx(const char*, const char*, const char*, const char*);