/* begincopyright Copyright (c) 1988 Xerox Corporation. All rights reserved. Use and copying of this software and preparation of derivative works based upon this software are permitted. Any distribution of this software or derivative works must comply with all applicable United States export control laws. This software is made available AS IS, and Xerox Corporation makes no warranty about the software, its performance or its conformity to any specification. Any person obtaining a copy of this software is requested to send their name and post office or electronic mail address to: PCR Coordinator Xerox PARC 3333 Coyote Hill Rd. Palo Alto, CA endcopyright */ /* * ThreadsMsg.h * * Demers, April 10, 1990 5:20:13 pm PDT */ #ifndef _XR_THREADS_MSG_ #define _XR_THREADS_MSG_ 1 /* * Well-known pseudo-file descriptors */ #define XR_MSG_STDIN (-2) #define XR_MSG_STDOUT (-3) /* * Output formatting to memory ... */ extern char * XR_SPrintF(/* buf, fmt, arg, ... */); /* char *buf; char *fmt; int arg; Similar to Unix(tm) sprintf(3). Result is address of terminating null added to buf. */ /* * Output formatting to sink proc ... */ extern void XR_PPrintF(/* sink, fmt, arg, ... */); /* XR_MesaProc sink; (* called by (*(sink->mp_proc))(string, length, sink) *) char *fmt; int arg; Similar to Unix(tm) printf(3), but output is to sink proc. */ /* * Output formatting to file ... */ extern void XR_FPrintF(/* int d, char *fmt, word arg1, ... */); extern void XR_Msg(/* int d, char *fmt, word arg1, ... */); /* Formatted print; d is XR_MSG_STDOUT or an XR_Fildes. Nonstandard format code "%?" prints processor+thread. */ extern int XR_MsgWrite(/* buf, nBytes */); /* char *buf; int nBytes; Like write(stdout, buf, nBytes); */ extern int XR_MsgRead(/* buf, nBytes */); /* char *buf; int nBytes; like read(stdin, buf, nBytes); */ /* * Verbosity level support ... */ extern int XR_verbosity; #define XR_VERBOSITY_SILENT 0 #define XR_VERBOSITY_ERROR 2 #define XR_VERBOSITY_QUIET 4 #define XR_VERBOSITY_WARNING 6 #define XR_VERBOSITY_NORMAL 8 #define XR_VERBOSITY_LOG 10 #define XR_VERBOSITY_STATS 12 #define XR_VERBOSITY_VERBOSE 15 #define XR_VERBOSE(level) \ ( XR_verbosity >= (level) ) #define XR_VMsg \ XR_FPrintF(XR_MSG_STDOUT, #define XR_PanicVMsg \ XR_FPrintF(XR_MSG_STDOUT, #define XR_ErrorVMsg \ if( XR_VERBOSE(XR_VERBOSITY_ERROR) ) XR_FPrintF(XR_MSG_STDOUT, #define XR_QuietVMsg \ if( XR_VERBOSE(XR_VERBOSITY_QUIET) ) XR_FPrintF(XR_MSG_STDOUT, #define XR_WarningVMsg \ if( XR_VERBOSE(XR_VERBOSITY_WARNING) ) XR_FPrintF(XR_MSG_STDOUT, #define XR_NormalVMsg \ if( XR_VERBOSE(XR_VERBOSITY_NORMAL) ) XR_FPrintF(XR_MSG_STDOUT, #define XR_EchoVMsg \ if( XR_VERBOSE(XR_VERBOSITY_LOG) ) XR_FPrintF(XR_MSG_STDOUT, #define XR_LogVMsg \ if( XR_VERBOSE(XR_VERBOSITY_LOG) ) XR_FPrintF(XR_MSG_STDOUT, #define XR_StatsVMsg \ if( XR_VERBOSE(XR_VERBOSITY_STATS) ) XR_FPrintF(XR_MSG_STDOUT, #define XR_VerboseVMsg \ if( XR_VERBOSE(XR_VERBOSITY_VERBOSE) ) XR_FPrintF(XR_MSG_STDOUT, #endif _XR_THREADS_MSG_