/* 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 94304 endcopyright */ /* * CommandLoop.h * * PCR command line and read-eval-print. * * Demers April 15, 1990 11:43:47 am PDT */ #ifndef _XR_COMMAND_LOOP_ #define _XR_COMMAND_LOOP_ 1 #ifndef _XR_BASIC_TYPES_ # include "xr/BasicTypes.h" #endif #ifndef _XR_COMMAND_LINE_ # include "xr/CommandLine.h" #endif /* * The global handles ... */ extern XR_CLHandle XR_globalCLHandle; /* Starts out as handle on original PCR command line arguments. Gets modified as result of package setup code. */ extern XR_CLProcsHandle XR_globalCLProcsHandle; /* Procs for sequentially-executed command-line or command-file argument groups. PCR components (GC, IL, ...) register procs here during setup. */ extern XR_MesaProc XR_stdOutCLMsgSink; /* Closure for void (*sink)(char *buf, int nBytes, XR_MesaProc self) A message sink for stdout. Used in initial call to CLApply on global handles. Monitored, so it may also be used by clients. */ /* * Global state for command proc execution ... may be used by procs * that don't get the call environment passed to them, provided * they expect to be invoked only thru the global commander thread. */ extern XR_CLCallEnv XR_GetTopLevelCLCallEnv(); extern XR_CLCallEnv XR_SetTopLevelCLCallEnv(/* XR_CLCallEnv clce */); /* Call environment at top of command stack. */ extern XR_JmpBuf XR_GetTopLevelJumpBuf(); /* An XR_longjmp here simulates return from current command line proc. */ extern void XR_StoreTopLevelCLErrorHandler(/* XR_MesaProc handler */); /* A CLProc may store a handler for command errors. The handler is a closure for (int) (*handler)(int prevResult, XR_MesaProc self) The result returned by the handler is returned from the enclosing call to CommandLine.h.XR_CLApply. A NIL handler just propagates the error result. */ /* * Some global PCR state * (possibly this doesn`t belong here, but ...) */ extern int XR_SetPCRFileName(/* char *fn */); /* Set name of PCR symbols file. Setting it to NIL turns of symbol table initialization and thus disables dynamic loading. */ extern char * XR_GetPCRFileName(); /* Get name of PCR symbols file. */ extern int XR_SetTmpDirectory(/* char *dirName */); /* Set name for tmp file directory. */ extern char * XR_GetTmpDirectory(); /* Get name for tmp file directory. */ extern int XR_SetDBXScriptName(/* char *n */); /* Set name for dbx script. Setting to NIL turns it off. */ extern char * XR_GetDBXScriptName(); /* Get name of dbx script. */ /* * Utilities ... */ extern int XR_CLCallProc(/* XR_UntypedProc proc, int argc, XR_Pointer *argv, XR_Pointer *resultP */); /* Call proc with args. If resultP != NIL, store result (assumed to be 1 word) in *resultP. Return 0 (success) -1 (argc too big -- promise to support argc <= 6) < -1 (other failure). */ /* * OBSOLETE, but still in use as of April 9, 1990, sigh ... */ typedef XR_Pointer (**CommandProc)(/* char *cmd, XR_Pointer clientData, CommandProc self */); /* Called with entire arg group as a string ... so it has to reparse it! */ extern void XR_register(/* char *key, CommandProc proc, char *doc, XR_Pointer clientData */); /* Register given command proc as processor for given command. */ extern char * XR_get_loader_directory(); /* Return immutable string = name of loader temp directory. Equivalent to XR_GetTmpDirectory(). */ extern char * XR_GetCurrentCommand(); /* Return command currently being executed by a CommandProc, or set by SetCurrentCommand. */ extern void XR_SetCurrentCommand(/* char *c */); /* Set command to be returned by GetCurrentCommand. */ #endif /* _XR_COMMAND_LOOP_ */