/* 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←