/*
Copyright (c) 1993 Xerox Corporation. All rights reserved.
*/
/*
$Id$
$Date$
*
*/
/* Chauser, October 28, 1993 3:33 pm PDT */
#ifndef ←←PCR←Base←h
# define ←←PCR←Base←h 1
#include <config/PCR←StdTypes.h>
#include <base/PCR←BaseArgs.h>
#include <stdarg.h>
/*
* Startup
*/
extern /* readonly */ PCR←BaseArgs←Templates
PCR←Base←startArgsTemplates;
extern /* readonly */ const char *
PCR←Base←cmdName;
extern /* readonly */ int
PCR←Base←startNArgs;
extern /* readonly */ const char **
PCR←Base←startArgs;
extern PCR←ERes
PCR←Base←Start(
const char * cmdName,
int nArgs,
const char ** args,
PCR←ProcPtr proc,
PCR←Any data,
char *msgBuf, int msgBufLen
);
/*
Startup.
The cmdName is used as a source of symbol information
to initialize dynamic loading. It may be NIL, in which case
dynamic loading is disabled (unless proc enables it
using the PCR←IL.h interface).
The args are used to configure PCR itself..
N.B. args[0] is *not* the command name.
If arg parsing fails, or the startup fails for any other reason,
return an error with an appropriate message stored in msgBuf.
Otherwise, (*proc)(data) is invoked in an initial thread.
If (*proc)(data) returns, the equivalent of PCR←Base←Exit(0)
occurs.
This call never returns successfully.
*/
/*
* System message printing
*
* These may be called at any time, though it is not recommended
* that they be used from threads for performance reasons.
*
* They are the *only* way to print before PCR←Base←Start has been called.
*
* The only format specifications allowed are
* %c %s %d %o %x
*/
extern int
PCR←Base←vsprintf(char *s, const char *fmt, va←list ap);
extern int
PCR←Base←sprintf(char *s, const char *fmt, ...);
extern int
PCR←Base←vprintf(const char *fmt, va←list ap);
extern int
PCR←Base←printf(const char *fmt, ...);
extern int
PCR←Base←Msg(const char *fmt, ...);
/*
* Shutdown
*/
extern void
PCR←Base←AtExit(
PCR←ProcPtr proc,
PCR←Any data
);
/*
Registered AtExit procs are called by PCR←Base←Exit(...).
??? Is it okay to call AtExit before calling Start ???
*/
extern void
PCR←Base←Exit(int status);
/*
* Finding a full path name for an executable file
*/
typedef PCR←ERes PCR←Base←AccessProc(const char *path, PCR←Any data);
extern PCR←ERes
PCR←Base←FindFileUsingSearchRules(
const char *cmdName,
const char *cwd,
char *buf,
int buflen,
PCR←Base←AccessProc access,
PCR←Any accessData
);
/*
* PCR←Base←FindFileUsingSearchRues uses the OS-specific search rules
* to try to find the full path name of a file with cmdName as its name.
* The caller must supply the current working directory, and buf
* into which the answer is stored (if it fits). The access procedure
* should return PCR←ERes←okay if the path name given to it is
* acceptable to the client.
* Return values:
* PCR←ERes←okay -- buf contains a path name accepted by accept
* EINVAL -- relative cmdName and null cwd
* EINVAL -- null buf or 0 buflen
* ERANGE -- some enumerated full path wouldn't fit in buf
*/
/*
* System panic messages.
*
* Avoid these except for catastrophic failures!
*/
typedef void PCR←Base←PanicFunc(const char *fmt, ...);
extern PCR←Base←PanicFunc *
PCR←Base←←Panic(const char *file, int line);
extern void
PCR←Base←Panic(const char *fmt, ...);
#define PCR←Base←Panic \
(*(PCR←Base←←Panic(←←FILE←←, ←←LINE←←)))
extern void
PCR←Base←←NYI(const char *file, int line, PCR←Bool fatal);
extern void
PCR←Base←NYI(PCR←Bool fatal);
#define PCR←Base←NYI(fatal) \
PCR←Base←←NYI(←←FILE←←, ←←LINE←←,(fatal))
#endif /* !←←PCR←Base←h */
/*
$Log$
*/