#define MISC

$PACKAGE = "MISC";

#include <time.h>
#define ref(a) &(a)                         

~require 
   	misc.inc

String
ctime
	in: ref(time_t)			# clock value


#define echo(x) {\
	write(wafeToClient,x,strlen(x)); \
	if (count+1 != argc) write(wafeToClient," ",1);}

void
echo
	callmultiple
	in: String			# strings 
	post: write(wafeToClient, "\n",1);
 


#define getChannel() wafeExtraClient

int
getChannel
	const:				# None



#####   terminate wafe  #####

#include <signal.h>

void 
kill vulgo quit 
	const: wafeClientPid	
	const: SIGTERM
	pre: if (wafeClientPid)		# None
	post: wafeExit(0);


void 
kill
    pre: localVar2 -= HANDLERMAX;
    in: int                      		# process id
    in: (int) signalType	         	# signalType



#####   register handler  #####

void
wafeRegisterCmd vulgo register
	in: (int)handlerType	# stdin | stdout | stderr | xioerr | ..signal..
	in: String		# tcl-command



void
wafeSetCommunicationVariableCmd vulgo setCommunicationVariable
	in: XtNewString(String)		# variable name
	in: int				# length
	in: XtNewString(String)		# tcl command to be executed


#####   unregister handler  #####

void
wafeUnregisterCmd vulgo unregister
	in: (int)handlerType		# stdin | stdout | stderr | xioerr


XtInputId
wafeAddInputCmd vulgo addInput 
	in: int				# fileno
	in: (XtPointer)SourceInputMask	# read | write | except | none
	in: String    			# TclVariable 
	in: String 			# TclCommand

void
wafeRemoveInputCmd vulgo removeInput
	in: XtInputId			# input id

#define fileNo(s,w) \
 ((Tcl_GetOpenFile(wafeInterpreter, (s), w, 1, &f) != TCL_OK) ? -1 : fileno(f))

int
fileNo vulgo fileno
	pre: { FILE* f;
	in: String			# string identifying file
	in: (int)FileNoReadWrite 	# read | write
	post: }

int 
alias
	in: String			# new command
	in: String			# old command

void
DBUG_PUSH
	in: String			# new debug options

void
DBUG_POP 
