#ifndef nil
#define	nil		((void*)0)
#endif
#ifndef nelem
#define	nelem(x)	(sizeof(x)/sizeof((x)[0]))
#endif

void	pm_main(int, char*[]);
void	pm_syscallinit(void);
void	pm_siginit(void);
void	pm_threadinit(void);
void	pm_waitinit(void);
int	pm_checkkids(void);
void	pm_oserror(void);
void pm_osrerrstr(char*, uint);
void	pm_panic(char*, ...);

extern	int	pm_debug;
enum
{
	PmDebugExit = 1<<0,
	PmDebugNote = 1<<1,
	PmDebugExec = 1<<2,
	PmDebugFd = 1<<3,
	PmDebugWait = 1<<4,
	PmDebugNs = 1<<5,
	PmDebugStartup = 1<<6,
	PmDebugFs = 1<<7,
	PmDebugPanic = 1<<8,
};
void pm_dprint(int, char*, ...);
void pm_dwrite(char*);
void pm_setdebug(char*);

/*
 * mem routines
 */
extern  void*   pm_memccpy(void*, const void*, int, ulong);
extern  void*   pm_memset(void*, int, ulong);
extern  int     pm_memcmp(const void*, const void*, ulong);
extern  void*   pm_memcpy(void*, const void*, ulong);
extern  void*   pm_memmove(void*, const void*, ulong);
extern  void*   pm_memchr(const void*, int, ulong);
extern	void	pm_memrandom(void*, int);

/*
 * string routines
 */
extern  int	pm_gettokens(char*, char**, int, char*);
extern  char*   pm_strcat(char*, char*);
extern  char*   pm_strchr(char*, int);
extern  int     pm_strcmp(char*, char*);
extern  char*   pm_strcpy(char*, char*);
extern  char*   pm_strecpy(char*, char*, char*);
extern  char*   pm_strdup(char*);
extern  char*   pm_strncat(char*, char*, long);
extern  char*   pm_strncpy(char*, char*, long);
extern  int     pm_strncmp(char*, char*, long);
extern  char*   pm_strpbrk(char*, char*);
extern  char*   pm_strrchr(char*, int);
extern  char*   pm_strtok(char*, char*);
extern  long    pm_strlen(char*);
extern  long    pm_strspn(char*, char*);
extern  long    pm_strcspn(char*, char*);
extern  char*   pm_strstr(char*, char*);
extern  int     pm_cistrncmp(char*, char*, int);
extern  int     pm_cistrcmp(char*, char*);
extern  char*   pm_cistrstr(char*, char*);
extern	int		pm_tokenize(char*, char**, int);

enum
{
	PM_UTFmax		= 3,		/* maximum bytes per rune */
	PM_Runesync	= 0x80,		/* cannot represent part of a UTF sequence (<) */
	PM_Runeself	= 0x80,		/* rune and UTF sequences are the same (<) */
	PM_Runeerror	= 0x80		/* decoding error in UTF */
};

/*
 * new rune routines
 */
extern	int	pm_runetochar(char*, Rune*);
extern	int	pm_chartorune(Rune*, char*);
extern	int	pm_runelen(long);
extern	int	pm_runenlen(Rune*, int);
extern	int	pm_fullrune(char*, int);
extern	char*	pm_utfecpy(char*, char*, char*);
extern	int	pm_utflen(char*);
extern	int	pm_utfnlen(char*, long);
extern	char*	pm_utfrune(char*, long);
extern	char*	pm_utfrrune(char*, long);
extern	char*	pm_utfutf(char*, char*);

extern	Rune*	pm_runestrcat(Rune*, Rune*);
extern	Rune*	pm_runestrchr(Rune*, Rune);
extern	int	pm_runestrcmp(Rune*, Rune*);
extern	Rune*	pm_runestrcpy(Rune*, Rune*);
extern	Rune*	pm_runestrncpy(Rune*, Rune*, long);
extern	Rune*	pm_runestrecpy(Rune*, Rune*, Rune*);
extern	Rune*	pm_runestrdup(Rune*);
extern	Rune*	pm_runestrncat(Rune*, Rune*, long);
extern	int	pm_runestrncmp(Rune*, Rune*, long);
extern	Rune*	pm_runestrrchr(Rune*, Rune);
extern	long	pm_runestrlen(Rune*);
extern	Rune*	pm_runestrstr(Rune*, Rune*);

extern	Rune	pm_tolowerrune(Rune);
extern	Rune	pm_totitlerune(Rune);
extern	Rune	pm_toupperrune(Rune);
extern	int	pm_isalpharune(Rune);
extern	int	pm_islowerrune(Rune);
extern	int	pm_isspacerune(Rune);
extern	int	pm_istitlerune(Rune);
extern	int	pm_isupperrune(Rune);

/*
 * malloc
 */
extern	void*	pm_malloc(ulong);
extern	void*	pm_mallocz(ulong, int);
extern	void	pm_free(void*);
extern	ulong	pm_msize(void*);
extern	void*	pm_calloc(ulong, ulong);
extern	void*	pm_realloc(void*, ulong);
extern	void		pm_setmalloctag(void*, ulong);
extern	void		pm_setrealloctag(void*, ulong);
extern	ulong	pm_getmalloctag(void*);
extern	ulong	pm_getrealloctag(void*);
extern	void*	pm_malloctopoolblock(void*);

/*
 * print routines
 */
typedef	struct	PmFconv	PmFconv;
struct	PmFconv
{
	char*	out;		/* pointer to next output */
	char*	eout;		/* pointer to end */
	int	f1;
	int	f2;
	int	f3;
	int	chr;
};
extern	char*	pm_doprint(char*, char*, char*, va_list);
extern	int	pm_print(char*, ...);
extern	char*	pm_seprint(char*, char*, char*, ...);
extern	int	pm_snprint(char*, int, char*, ...);
extern	int	pm_sprint(char*, char*, ...);
extern	int	pm_fprint(int, char*, ...);

extern	int	pm_fmtinstall(int, int (*)(va_list*, PmFconv*));
extern	int	pm_numbconv(va_list*, PmFconv*);
extern	void	pm_strconv(char*, PmFconv*);
extern	void	pm_Strconv(Rune*, PmFconv*);
extern	int	pm_fltconv(va_list*, PmFconv*);
extern	int	pm_encodeconv(va_list*, PmFconv*);

/*
 * quoted strings
 */
extern	char	*pm_unquotestrdup(char*);
extern	Rune	*pm_unquoterunestrdup(Rune*);
extern	char	*pm_quotestrdup(char*);
extern	Rune	*pm_quoterunestrdup(Rune*);
extern	int	pm_quotestrconv(va_list*, PmFconv*);
extern	int	pm_quoterunestrconv(va_list*, PmFconv*);
extern	void	pm_quotefmtinstall(void);
extern	int	(*pm_doquote)(int);

/*
 * random number
 */
extern	void	pm_srand(long);
extern	int	pm_rand(void);
extern	int	pm_nrand(int);
extern	long	pm_lrand(void);
extern	long	pm_lnrand(long);
extern	double	pm_frand(void);
extern	ulong	pm_truerand(void);			/* uses /dev/random */
extern	ulong	pm_ntruerand(ulong);		/* uses /dev/random */
extern	ulong	pm_fastrand(void);			/* uses /dev/random extended by a prng */

/*
 * math
 */
extern	ulong	pm_getfcr(void);
extern	void	pm_setfsr(ulong);
extern	ulong	pm_getfsr(void);
extern	void	pm_setfcr(ulong);
extern	double	pm_NaN(void);
extern	double	pm_Inf(int);
extern	int	pm_isNaN(double);
extern	int	pm_isInf(double, int);
extern	ulong	pm_umuldiv(ulong, ulong, ulong);
extern	long	pm_muldiv(long, long, long);

extern	double	pm_pow(double, double);
extern	double	pm_atan2(double, double);
extern	double	pm_fabs(double);
extern	double	pm_atan(double);
extern	double	pm_log(double);
extern	double	pm_log10(double);
extern	double	pm_exp(double);
extern	double	pm_floor(double);
extern	double	pm_ceil(double);
extern	double	pm_hypot(double, double);
extern	double	pm_sin(double);
extern	double	pm_cos(double);
extern	double	pm_tan(double);
extern	double	pm_asin(double);
extern	double	pm_acos(double);
extern	double	pm_sinh(double);
extern	double	pm_cosh(double);
extern	double	pm_tanh(double);
extern	double	pm_sqrt(double);
extern	double	pm_fmod(double, double);

#define	PM_HUGE	3.4028234e38
#define	PM_PIO2	1.570796326794896619231e0
#define	PM_PI	(PIO2+PIO2)

/*
 * Time-of-day
 */

typedef
struct PmTm
{
	int	sec;
	int	min;
	int	hour;
	int	mday;
	int	mon;
	int	year;
	int	wday;
	int	yday;
	char	zone[4];
	int	tzoff;
} PmTm;

extern	PmTm*	pm_gmtime(long);
extern	PmTm*	pm_localtime(long);
extern	char*	pm_asctime(PmTm*);
extern	char*	pm_ctime(long);
extern	double	pm_cputime(void);
extern	long	pm_times(long*);
extern	long	pm_tm2sec(PmTm*);
extern	vlong	pm_nsec(void);
extern	ulong	pm_msec(void);	/* arbitrary epoch */

/*
 * one-of-a-kind
 */
enum
{
	PM_PNPROC		= 1,
	PM_PNGROUP		= 2,
};

extern	void	pm__assert(char*, char*, int);
extern	int	pm_abs(int);
extern	int	pm_atexit(void(*)(void));
extern	void	pm_atexitdont(void(*)(void));
extern	int	pm_atnotify(int(*)(void*, char*), int);
extern	double	pm_atof(char*);
extern	int	pm_atoi(char*);
extern	long	pm_atol(char*);
extern	vlong	pm_atoll(char*);
extern	double	pm_charstod(int(*)(void*), void*);
extern	char*	pm_cleanname(char*);
extern	int	pm_decrypt(void*, void*, int);
extern	int	pm_dec64(uchar*, int, char*, int);
extern	int	pm_enc64(char*, int, uchar*, int);
extern	int	pm_dec32(uchar*, int, char*, int);
extern	int	pm_enc32(char*, int, uchar*, int);
extern	int	pm_encrypt(void*, void*, int);
extern	void	pm_exits(char*);
extern	void	pm_freeenviron(char**);
extern	double	pm_frexp(double, int*);
extern	ulong	pm_getcallerpc(void*);
extern	char*	pm_getenv(char*);
extern	char**	pm_getenviron(void);
extern	int	pm_getfields(char*, char**, int, int, char*);
extern	char*	pm_getuser(void);
extern	char*	pm_getwd(char*, int);
extern	int	pm_iounit(int);
extern	long	pm_labs(long);
extern	double	pm_ldexp(double, int);
extern	void	pm_longjmp(pm_jmp_buf, int);
extern	char*	pm_mktemp(char*);
extern	double	pm_modf(double, double*);
extern	int	pm_netcrypt(void*, void*);
extern	void	pm_perror(char*);
extern	int	pm_postnote(int, int, char *);
extern	double	pm_pow10(int);
extern	int	pm_putenv(char*, char*);
extern	void	pm_qsort(void*, long, long, int (*)(void*, void*));
/* setjmp is in 9pm/u.h so it can be #defined if necessary */
extern	double	pm_strtod(char*, char**);
extern	long	pm_strtol(char*, char**, int);
extern	ulong	pm_strtoul(char*, char**, int);
extern	vlong	pm_strtoll(char*, char**, int);
extern	uvlong	pm_strtoull(char*, char**, int);
extern	void	pm_sysfatal(char*, ...);
extern	void	pm_syslog(int, char*, char*, ...);
extern	long	pm_time(long*);
extern	int	pm_tolower(int);
extern	int	pm_toupper(int);


/*
 *  synchronization
 */
typedef
struct PmLock {
	int	val;
} PmLock;

extern int	pm__tas(int*);

extern	void	pm_lock(PmLock*);
extern	void	pm_unlock(PmLock*);
extern	int	pm_canlock(PmLock*);

typedef struct PmQLp PmQLp;
struct PmQLp
{
	int	inuse;
	PmQLp	*next;
	char	state;
};

typedef
struct PmQLock
{
	PmLock	lk;
	int	locked;
	PmQLp	*head;
	PmQLp 	*tail;
} PmQLock;

extern	void	pm_qlock(PmQLock*);
extern	void	pm_qunlock(PmQLock*);
extern	int	pm_canqlock(PmQLock*);
extern	void	pm__qlockinit(ulong (*)(ulong, ulong));	/* called only by the thread library */

typedef
struct PmRWLock
{
	PmLock	lk;
	int	readers;	/* number of readers */
	int	writer;		/* number of writers */
	PmQLp	*head;		/* list of waiting processes */
	PmQLp	*tail;
} PmRWLock;

extern	void	pm_rlock(PmRWLock*);
extern	int	pm_canrlock(PmRWLock*);
extern	void	pm_runlock(PmRWLock*);
extern	void	pm_wlock(PmRWLock*);
extern	int	pm_canwlock(PmRWLock*);
extern	void	pm_wunlock(PmRWLock*);

typedef
struct PmRef
{
	long ref;	/* this offset is known to assembly routines */
	PmLock lk;
} PmRef;

extern	void	pm_incref(PmRef*);
extern	int	pm_decref(PmRef*);

// extern	void**	pm_privalloc(void);
// extern	void	pm_privfree(void**);

/*
 *  network dialing and authentication
 */
#define PM_NETPATHLEN 40
extern	int	pm_accept(int, char*);
extern	int	pm_announce(char*, char*);
extern	int	pm_dial(char*, char*, char*, int*);
extern	void	pm_setnetmtpt(char*, int, char*);
extern	int	pm_hangup(int);
extern	int	pm_listen(char*, char*);
extern	char*	pm_netmkaddr(char*, char*, char*);
extern	int	pm_reject(int, char*, char*);
extern	int	pm_pushssl(int, char*, char*, char*, int*);
extern	void	pm_initnet(void);

/*
 * system calls
 */
#define	PM_STATMAX	65535U	/* max length of machine-independent stat structure */
#define	PM_DIRMAX	(sizeof(PmDir)+STATMAX)	/* max length of PmDir structure */
#define	PM_ERRMAX	128	/* max length of error string */

#define	PM_MORDER	0x0003	/* mask for bits defining order of mounting */
#define	PM_MREPL	0x0000	/* mount replaces object */
#define	PM_MBEFORE	0x0001	/* mount goes before others in union directory */
#define	PM_MAFTER	0x0002	/* mount goes after others in union directory */
#define	PM_MCREATE	0x0004	/* permit creation in mounted directory */
#define	PM_MCACHE	0x0010	/* cache some data */
#define	PM_MMASK	0x0007	/* all bits on */

#define	PM_OREAD	0	/* open for read */
#define	PM_OWRITE	1	/* write */
#define	PM_ORDWR	2	/* read and write */
#define	PM_OEXEC	3	/* execute, == read but check execute permission */
#define	PM_OTRUNC	16	/* or'ed in (except for exec), truncate file first */
#define	PM_OCEXEC	32	/* or'ed in, close on exec */
#define	PM_ORCLOSE	64	/* or'ed in, remove on close */
#define	PM_OEXCL	0x1000	/* or'ed in, exclusive use (create only) */

#define	PM_AEXIST	0	/* accessible: exists */
#define	PM_AEXEC	1	/* execute access */
#define	PM_AWRITE	2	/* write access */
#define	PM_AREAD	4	/* read access */

/* Segattch */
#define	PM_SG_RONLY	0040	/* read only */
#define	PM_SG_CEXEC	0100	/* detach on exec */

#define	PM_NCONT	0	/* continue after note */
#define PM_NDFLT	1	/* terminate after note */
#define	PM_NSAVE	2	/* clear note but hold state */
#define	PM_NRSTR	3	/* restore saved state */

/* bits in PmQid.type */
#define PM_QTDIR		0x80		/* type bit for directories */
#define PM_QTAPPEND	0x40		/* type bit for append only files */
#define PM_QTEXCL		0x20		/* type bit for exclusive use files */
#define PM_QTMOUNT		0x10		/* type bit for mounted channels */
#define PM_QTAUTH		0x08		/* type bit for authentication file */
#define PM_QTFILE		0x00		/* plain file */

/* bits in PmDir.mode */
#define PM_DMDIR		0x80000000	/* mode bit for directories */
#define PM_DMAPPEND	0x40000000	/* mode bit for append only files */
#define PM_DMEXCL		0x20000000	/* mode bit for exclusive use files */
#define PM_DMMOUNT		0x10000000	/* mode bit for mounted channel */
#define PM_DMAUTH		0x08000000	/* mode bit for authentication file */
#define PM_DMREAD		0x4		/* mode bit for read permission */
#define PM_DMWRITE		0x2		/* mode bit for write permission */
#define PM_DMEXEC		0x1		/* mode bit for execute permission */

/* rfork */
enum
{
	PM_RFNAMEG		= (1<<0),
	PM_RFENVG		= (1<<1),
	PM_RFFDG		= (1<<2),
	PM_RFNOTEG		= (1<<3),
	PM_RFPROC		= (1<<4),
/*	PM_RFMEM		= (1<<5)	disallowed; use ffork */
	PM_RFNOWAIT	= (1<<6),
	PM_RFCNAMEG	= (1<<10),
	PM_RFCENVG		= (1<<11),
	PM_RFCFDG		= (1<<12),
	PM_RFREND		= (1<<13),
	PM_RFNOMNT		= (1<<14)
};

typedef
struct PmQid
{
	uvlong	path;
	ulong	vers;
	uchar	type;
} PmQid;

typedef
struct PmDir {
	/* system-modified data */
	ushort	type;	/* server type */
	uint	dev;	/* server subtype */
	/* file data */
	PmQid	qid;	/* unique id from server */
	ulong	mode;	/* permissions */
	ulong	atime;	/* last read time */
	ulong	mtime;	/* last write time */
	vlong	length;	/* file length: see <u.h> */
	char	*name;	/* last element of path */
	char	*uid;	/* owner name */
	char	*gid;	/* group name */
	char	*muid;	/* last modifier name */
} PmDir;

typedef
struct PmWaitmsg
{
	int 	pid;		/* of loved one */
	ulong	tm[3];	/* of loved one & descendants */
	char	*msg;
} PmWaitmsg;

typedef
struct PmIOchunk
{
	void	*addr;
	ulong	len;
} PmIOchunk;

extern	void	pm__exits(char*);

extern	void	pm_abort(void);
extern	int	pm_access(char*, int);
// extern	long	pm_alarm(ulong);
extern	int	pm_bind(char*, char*, int);
extern	int	pm_chdir(char*);
extern	int	pm_close(int);
extern	int	pm_create(char*, int, ulong);
extern	int	pm_dup(int, int);
extern	int	pm_errstr(char*, uint);
extern	void	pm_export(int);
extern	int	pm_fauth(int, char*);
extern	int	pm_fstat(int, uchar*, int);
extern	int	pm_fd2path(int, char*, int);
extern	int	pm_fstat(int, uchar*, int);
extern	int	pm_fwstat(int, uchar*, int);
extern	int	pm_fversion(int, int, char*, int);
extern	int	pm_mount(int, int, char*, int, char*);
extern	int	pm_unmount(char*, char*);
extern	int	pm_noted(int);
extern	int	pm_notify(void(*)(void*, char*));
extern	int	pm_open(char*, int);
extern	int	pm_pipe(int*);
extern	long	pm_pread(int, void*, long, vlong);
extern	long	pm_preadv(int, PmIOchunk*, int, vlong);
extern	long	pm_pwrite(int, void*, long, vlong);
extern	long	pm_pwritev(int, PmIOchunk*, int, vlong);
extern	long	pm_read(int, void*, long);
extern	long	pm_readn(int, void*, long);
extern	long	pm_readv(int, PmIOchunk*, int);
extern	int	pm_remove(char*);
extern	int	pm_rfork(int);
extern	int	pm_ffork(int, void(*)(void*), void*, int);
extern	int	pm_sysrfork(int);
extern	void*	pm_sbrk(ulong);
extern	vlong	pm_seek(int, vlong, int);
// extern	long	pm_segattach(int, char*, void*, ulong);
// extern	int	pm_segbrk(void*, void*);
// extern	int	pm_segdetach(void*);
// extern	int	pm_segflush(void*, ulong);
// extern	int	pm_segfree(void*, ulong);
extern	int	pm_sleep(long);
extern	int	pm_stat(char*, uchar*, int);
extern	int	pm_wstat(char*, uchar*, int);
extern	long	pm_write(int, void*, long);
extern	long	pm_writev(int, PmIOchunk*, int);
extern	ulong	pm_rendezvous(ulong, ulong);

extern	PmDir*	pm_dirstat(char*);
extern	PmDir*	pm_dirfstat(int);
extern	int	pm_dirwstat(char*, PmDir*);
extern	int	pm_dirfwstat(int, PmDir*);
extern	long	pm_dirread(int, PmDir**);
extern	void	pm_nulldir(PmDir*);
extern	long	pm_dirreadall(int, PmDir**);
extern	int	pm_getpid(void);
extern	int	pm_getppid(void);
extern	void	pm_rerrstr(char*, uint);
extern	char*	pm_sysname(void);
extern	void	pm_werrstr(char*, ...);

typedef struct PmConf PmConf;
struct PmConf
{
	char pathsep;
	char *osname;
	int ostype;
	char *eve;
	char *rootdir;
	char *_sysname;
};

enum	/* PmConf.ostype */
{
	PmOsPlan9,
	PmOsWindows,
	PmOsUnix
};

extern PmConf pm_conf;

extern char *pm_argv0;
#define	PM_ARGBEGIN	for((argv0||(argv0=*argv)),argv++,argc--;\
			    argv[0] && argv[0][0]=='-' && argv[0][1];\
			    argc--, argv++) {\
				char *_args, *_argt;\
				Rune _argc;\
				_args = &argv[0][1];\
				if(_args[0]=='-' && _args[1]==0){\
					argc--; argv++; break;\
				}\
				_argc = 0;\
				while(*_args && (_args += chartorune(&_argc, _args)))\
				switch(_argc)
#define	PM_ARGEND		SET(_argt);USED(_argt); USED(_argc); USED(_args);}USED(argv); USED(argc);
#define	PM_ARGF()		(_argt=_args, _args="",\
				(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
#define	PM_EARGF(x)	(_argt=_args, _args="",\
				(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))

#define	PM_ARGC()		_argc

#ifndef  NODEFINE

/*
 * This is a terrible terrible thing that I've done.
 * If C had proper namespaces, we wouldn't be having this discussion.
 * I am truly sorry.  Please forgive me.   -rsc
 */
 
#undef  ARGBEGIN
#define ARGBEGIN             PM_ARGBEGIN
#undef  ARGEND
#define ARGEND               PM_ARGEND
#undef  ARGF
#define ARGF                 PM_ARGF
#undef  EARGF
#define EARGF                PM_EARGF
#undef  ARGC
#define ARGC                 PM_ARGC
#undef argv0
#define argv0                pm_argv0

#undef	FPdbleword
#define	FPdbleword           PmFPdbleword
#undef  Fconv
#define Fconv                PmFconv
#undef  Tm
#define Tm                   PmTm
#undef  Lock
#define Lock                 PmLock
#undef  QLp
#define QLp                  PmQLp
#undef  QLock
#define QLock                PmQLock
#undef Ref
#define Ref		PmRef
#undef  RWLock
#define RWLock               PmRWLock
#undef  Qid
#define Qid                  PmQid
#undef  Dir
#define Dir                  PmDir
#undef  Waitmsg
#define Waitmsg              PmWaitmsg
#undef  IOchunk
#define IOchunk              PmIOchunk

#undef   AEXEC                                    
#define  AEXEC                PM_AEXEC            
#undef   AEXIST                                   
#define  AEXIST               PM_AEXIST           
#undef   AREAD                                    
#define  AREAD                PM_AREAD            
#undef   AWRITE                                   
#define  AWRITE               PM_AWRITE           
#undef   DIRMAX                                   
#define  DIRMAX               PM_DIRMAX           
#undef   DMAPPEND                                 
#define  DMAPPEND             PM_DMAPPEND         
#undef   DMAUTH                                   
#define  DMAUTH               PM_DMAUTH           
#undef   DMDIR                                    
#define  DMDIR                PM_DMDIR            
#undef   DMEXCL                                   
#define  DMEXCL               PM_DMEXCL           
#undef   DMEXEC                                   
#define  DMEXEC               PM_DMEXEC           
#undef   DMMOUNT                                  
#define  DMMOUNT              PM_DMMOUNT          
#undef   DMREAD                                   
#define  DMREAD               PM_DMREAD           
#undef   DMWRITE                                  
#define  DMWRITE              PM_DMWRITE          
#undef   ERRMAX                                   
#define  ERRMAX               PM_ERRMAX           
#undef   HUGE                                     
#define  HUGE                 PM_HUGE             
#undef   MAFTER                                   
#define  MAFTER               PM_MAFTER           
#undef   MBEFORE                                  
#define  MBEFORE              PM_MBEFORE          
#undef   MCACHE                                   
#define  MCACHE               PM_MCACHE           
#undef   MCREATE                                  
#define  MCREATE              PM_MCREATE          
#undef   MMASK                                    
#define  MMASK                PM_MMASK            
#undef   MORDER                                   
#define  MORDER               PM_MORDER           
#undef   MREPL                                    
#define  MREPL                PM_MREPL            
#undef   NCONT                                    
#define  NCONT                PM_NCONT            
#undef   NDFLT                                    
#define  NDFLT                PM_NDFLT            
#undef   NETPATHLEN                               
#define  NETPATHLEN           PM_NETPATHLEN       
#undef   NRSTR                                    
#define  NRSTR                PM_NRSTR            
#undef   NSAVE                                    
#define  NSAVE                PM_NSAVE            
#undef   OCEXEC                                   
#define  OCEXEC               PM_OCEXEC           
#undef   OEXCL                                    
#define  OEXCL                PM_OEXCL            
#undef   OEXEC                                    
#define  OEXEC                PM_OEXEC            
#undef   ORCLOSE                                  
#define  ORCLOSE              PM_ORCLOSE          
#undef   ORDWR                                    
#define  ORDWR                PM_ORDWR            
#undef   OREAD                                    
#define  OREAD                PM_OREAD            
#undef   OTRUNC                                   
#define  OTRUNC               PM_OTRUNC           
#undef   OWRITE                                   
#define  OWRITE               PM_OWRITE           
#undef   PI                                       
#define  PI                   PM_PI               
#undef   PIO2                                     
#define  PIO2                 PM_PIO2             
#undef   PNGROUP                                  
#define  PNGROUP              PM_PNGROUP          
#undef   PNPROC                                   
#define  PNPROC               PM_PNPROC           
#undef   QTAPPEND                                 
#define  QTAPPEND             PM_QTAPPEND         
#undef   QTAUTH                                   
#define  QTAUTH               PM_QTAUTH           
#undef   QTDIR                                    
#define  QTDIR                PM_QTDIR            
#undef   QTEXCL                               
#define  QTEXCL               PM_QTEXCL           
#undef   QTFILE                                   
#define  QTFILE               PM_QTFILE           
#undef   QTMOUNT                                  
#define  QTMOUNT              PM_QTMOUNT          
#undef   RFCENVG                                  
#define  RFCENVG              PM_RFCENVG          
#undef   RFCFDG                                   
#define  RFCFDG               PM_RFCFDG           
#undef   RFCNAMEG                                 
#define  RFCNAMEG             PM_RFCNAMEG         
#undef   RFENVG                                   
#define  RFENVG               PM_RFENVG           
#undef   RFFDG                                    
#define  RFFDG                PM_RFFDG            
#undef   RFMEM                                    
#define  RFMEM                PM_RFMEM            
#undef   RFNAMEG                                  
#define  RFNAMEG              PM_RFNAMEG          
#undef   RFNOMNT                                  
#define  RFNOMNT              PM_RFNOMNT          
#undef   RFNOTEG                                  
#define  RFNOTEG              PM_RFNOTEG          
#undef   RFNOWAIT                                 
#define  RFNOWAIT             PM_RFNOWAIT         
#undef   RFPROC                                   
#define  RFPROC               PM_RFPROC           
#undef   RFREND                                   
#define  RFREND               PM_RFREND           
#undef   Runeerror                                
#define  Runeerror            PM_Runeerror        
#undef   Runeself                                 
#define  Runeself             PM_Runeself         
#undef   Runesync                                 
#define  Runesync             PM_Runesync         
#undef   SG_CEXEC                                 
#define  SG_CEXEC             PM_SG_CEXEC         
#undef   SG_RONLY                                 
#define  SG_RONLY             PM_SG_RONLY         
#undef   STATMAX                                  
#define  STATMAX              PM_STATMAX          
#undef   UTFmax                                   
#define  UTFmax               PM_UTFmax           

#undef  Inf
#define Inf			pm_Inf
#undef  NaN
#define NaN			pm_NaN
#undef  Strconv
#define Strconv			pm_Strconv
#undef  _assert
#define _assert			pm__assert
#undef  _exits
#define _exits			pm__exits
#undef  _qlockinit
#define _qlockinit			pm__qlockinit
#undef  _sysfatal
#define _sysfatal			pm__sysfatal
#undef  _tas
#define _tas			pm__tas
#undef  abort
#define abort			pm_abort
#undef  abs
#define abs			pm_abs
#undef  accept
#define accept			pm_accept
#undef  access
#define access			pm_access
#undef  acos
#define acos			pm_acos
#undef  alarm
#define alarm			pm_alarm
#undef  announce
#define announce			pm_announce
#undef  asctime
#define asctime			pm_asctime
#undef  asin
#define asin			pm_asin
#undef  assert
#define assert			pm_assert
#undef  atan
#define atan			pm_atan
#undef  atan2
#define atan2			pm_atan2
#undef  atexit
#define atexit			pm_atexit
#undef  atexitdont
#define atexitdont			pm_atexitdont
#undef  atnotify
#define atnotify			pm_atnotify
#undef  atof
#define atof			pm_atof
#undef  atoi
#define atoi			pm_atoi
#undef  atol
#define atol			pm_atol
#undef  atoll
#define atoll			pm_atoll
#undef  bind
#define bind			pm_bind
#undef  brk
#define brk			pm_brk
#undef  calloc
#define calloc			pm_calloc
#undef  canlock
#define canlock			pm_canlock
#undef  canilock
#define canilock			pm_canilock
#undef  canqlock
#define canqlock			pm_canqlock
#undef  canrlock
#define canrlock			pm_canrlock
#undef  canwlock
#define canwlock			pm_canwlock
#undef  ceil
#define ceil			pm_ceil
#undef  charstod
#define charstod			pm_charstod
#undef  chartorune
#define chartorune			pm_chartorune
#undef  chdir
#define chdir			pm_chdir
#undef  cistrcmp
#define cistrcmp			pm_cistrcmp
#undef  cistrncmp
#define cistrncmp			pm_cistrncmp
#undef  cistrstr
#define cistrstr			pm_cistrstr
#undef  cleanname
#define cleanname			pm_cleanname
#undef  close
#define close			pm_close
#undef  cos
#define cos			pm_cos
#undef  cosh
#define cosh			pm_cosh
#undef  cputime
#define cputime			pm_cputime
#undef  create
#define create			pm_create
#undef  ctime
#define ctime			pm_ctime
#undef  decrypt
#define decrypt			pm_decrypt
#undef  decref
#define decref			pm_decref
#undef  dial
#define dial			pm_dial
#undef  dirfstat
#define dirfstat			pm_dirfstat
#undef  dirfwstat
#define dirfwstat			pm_dirfwstat
#undef  dirread
#define dirread			pm_dirread
#undef  dirreadall
#define dirreadall			pm_dirreadall
#undef  dirstat
#define dirstat			pm_dirstat
#undef  dirwstat
#define dirwstat			pm_dirwstat
#undef  doprint
#define doprint			pm_doprint
#undef  doquote
#define doquote			pm_doquote
#undef  dup
#define dup			pm_dup
#undef  dec32
#define dec32			pm_dec32
#undef  dec64
#define dec64			pm_dec64
#undef  enc32
#define enc32			pm_enc32
#undef  enc64
#define enc64			pm_enc64
#undef  encodeconv
#define encodeconv			pm_encodeconv
#undef  encrypt
#define encrypt			pm_encrypt
#undef  errstr
#define errstr			pm_errstr
#undef  exits
#define exits			pm_exits
#undef  exp
#define exp			pm_exp
#undef  export
#define export			pm_export
#undef  fabs
#define fabs			pm_fabs
#undef  fastrand
#define fastrand			pm_fastrand
#undef  fauth
#define fauth			pm_fauth
#undef  fd2path
#define fd2path			pm_fd2path
#undef  fd2path
#define fd2path			pm_fd2path
#undef  ffork
#define ffork			pm_ffork
#undef  floor
#define floor			pm_floor
#undef  fltconv
#define fltconv			pm_fltconv
#undef  fmod
#define fmod			pm_fmod
#undef  fmtinstall
#define fmtinstall			pm_fmtinstall
#undef  fprint
#define fprint			pm_fprint
#undef  free
#define free			pm_free
#undef  freeenviron
#define freeenviron			pm_freeenviron
#undef  frand
#define frand			pm_frand
#undef  frexp
#define frexp			pm_frexp
#undef  fstat
#define fstat			pm_fstat
#undef  fullrune
#define fullrune			pm_fullrune
#undef  fwstat
#define fwstat			pm_fwstat
#undef  getcallerpc
#define getcallerpc			pm_getcallerpc
#undef  getenv
#define getenv			pm_getenv
#undef  getenviron
#define getenviron			pm_getenviron
#undef  getfcr
#define getfcr			pm_getfcr
#undef  getfields
#define getfields			pm_getfields
#undef  getfsr
#define getfsr			pm_getfsr
#undef  getmalloctag
#define getmalloctag			pm_getmalloctag
#undef  getpid
#define getpid			pm_getpid
#undef  getppid
#define getppid			pm_getppid
#undef  getrealloctag
#define getrealloctag			pm_getrealloctag
#undef  gettokens
#define gettokens			pm_gettokens
#undef  getuser
#define getuser			pm_getuser
#undef  getwd
#define getwd			pm_getwd
#undef  gmtime
#define gmtime			pm_gmtime
#undef  hangup
#define hangup			pm_hangup
#undef  hypot
#define hypot			pm_hypot
#undef  ilock
#define ilock			pm_ilock
#undef  incref
#define incref			pm_incref
#undef  initnet
#define initnet			pm_initnet
#undef  iounit
#define iounit			pm_iounit
#undef  isInf
#define isInf			pm_isInf
#undef  isNaN
#define isNaN			pm_isNaN
#undef  isalpharune
#define isalpharune			pm_isalpharune
#undef  islowerrune
#define islowerrune			pm_islowerrune
#undef  isspacerune
#define isspacerune			pm_isspacerune
#undef  istitlerune
#define istitlerune			pm_istitlerune
#undef  isupperrune
#define isupperrune			pm_isupperrune
#undef  iunlock
#define iunlock			pm_iunlock
#undef  jmp_buf
#define jmp_buf			pm_jmp_buf
#undef  labs
#define labs			pm_labs
#undef  ldexp
#define ldexp			pm_ldexp
#undef  listen
#define listen			pm_listen
#undef  lnrand
#define lnrand			pm_lnrand
#undef  localtime
#define localtime			pm_localtime
#undef  lock
#define lock			pm_lock
#undef  log
#define log			pm_log
#undef  log10
#define log10			pm_log10
#undef  longjmp
#define longjmp			pm_longjmp
#undef  lrand
#define lrand			pm_lrand
#undef  main
#define main			pm_main
#undef  malloc
#define malloc			pm_malloc
#undef  malloctopoolblock
#define malloctopoolblock			pm_malloctopoolblock
#undef  mallocz
#define mallocz			pm_mallocz
#undef  memccpy
#define memccpy			pm_memccpy
#undef  memset
#define memset			pm_memset
#undef  memcmp
#define memcmp			pm_memcmp
#undef  memcpy
#define memcpy			pm_memcpy
#undef  memmove
#define memmove			pm_memmove
#undef  memchr
#define memchr			pm_memchr
#undef  memrandom
#define memrandom			pm_memrandom
#undef  mktemp
#define mktemp			pm_mktemp
#undef  modf
#define modf			pm_modf
#undef  mount
#define mount			pm_mount
#undef  msec
#define msec			pm_msec
#undef  msize
#define msize			pm_msize
#undef  muldiv
#define muldiv			pm_muldiv
#undef  netcrypt
#define netcrypt			pm_netcrypt
#undef  netmkaddr
#define netmkaddr			pm_netmkaddr
#undef  noted
#define noted			pm_noted
#undef  notejmp
#define notejmp			pm_notejmp
#undef  notify
#define notify			pm_notify
#undef  nrand
#define nrand			pm_nrand
#undef  nsec
#define nsec			pm_nsec
#undef  ntruerand
#define ntruerand			pm_ntruerand
#undef  nulldir
#define nulldir			pm_nulldir
#undef  numbconv
#define numbconv			pm_numbconv
#undef  open
#define open			pm_open
#undef	oserror
#define	oserror			pm_oserror
#undef	osrerrstr
#define	osrerrstr			pm_osrerrstr
#undef  perror
#define perror			pm_perror
#undef  pipe
#define pipe			pm_pipe
#undef  postnote
#define postnote			pm_postnote
#undef  pow
#define pow			pm_pow
#undef  pow10
#define pow10			pm_pow10
#undef  pread
#define pread			pm_pread
#undef  preadv
#define preadv			pm_preadv
#undef  print
#define print			pm_print
#undef  pushssl
#define pushssl			pm_pushssl
#undef  putenv
#define putenv			pm_putenv
#undef  pwrite
#define pwrite			pm_pwrite
#undef  pwritev
#define pwritev			pm_pwritev
#undef  qlock
#define qlock			pm_qlock
#undef  qsort
#define qsort			pm_qsort
#undef  qunlock
#define qunlock			pm_qunlock
#undef  quotefmtinstall
#define quotefmtinstall			pm_quotefmtinstall
#undef  quoterunestrconv
#define quoterunestrconv			pm_quoterunestrconv
#undef  quoterunestrdup
#define quoterunestrdup			pm_quoterunestrdup
#undef  quotestrconv
#define quotestrconv			pm_quotestrconv
#undef  quotestrdup
#define quotestrdup			pm_quotestrdup
#undef  rand
#define rand			pm_rand
#undef  read
#define read			pm_read
#undef  readn
#define readn			pm_readn
#undef  readv
#define readv			pm_readv
#undef  realloc
#define realloc			pm_realloc
#undef  reject
#define reject			pm_reject
#undef  remove
#define remove			pm_remove
#undef  rendsleep
#define rendsleep			pm_rendsleep
#undef  rendwakeup
#define rendwakeup			pm_rendwakeup
#undef  rendezvous
#define rendezvous			pm_rendezvous
#undef  rerrstr
#define rerrstr			pm_rerrstr
#undef  rfork
#define rfork			pm_rfork
#undef  rlock
#define rlock			pm_rlock
#undef  runelen
#define runelen			pm_runelen
#undef  runenlen
#define runenlen			pm_runenlen
#undef  runestrcat
#define runestrcat			pm_runestrcat
#undef  runestrchr
#define runestrchr			pm_runestrchr
#undef  runestrcmp
#define runestrcmp			pm_runestrcmp
#undef  runestrcpy
#define runestrcpy			pm_runestrcpy
#undef  runestrdup
#define runestrdup			pm_runestrdup
#undef  runestrecpy
#define runestrecpy			pm_runestrecpy
#undef  runestrlen
#define runestrlen			pm_runestrlen
#undef  runestrncat
#define runestrncat			pm_runestrncat
#undef  runestrncmp
#define runestrncmp			pm_runestrncmp
#undef  runestrncpy
#define runestrncpy			pm_runestrncpy
#undef  runestrrchr
#define runestrrchr			pm_runestrrchr
#undef  runestrstr
#define runestrstr			pm_runestrstr
#undef  runetochar
#define runetochar			pm_runetochar
#undef  runlock
#define runlock			pm_runlock
#undef  sbrk
#define sbrk			pm_sbrk
#undef  seek
#define seek			pm_seek
#undef  seprint
#define seprint			pm_seprint
#undef  setfcr
#define setfcr			pm_setfcr
#undef  setfsr
#define setfsr			pm_setfsr
#undef  setjmp
#define setjmp			pm_setjmp
#undef  setmalloctag
#define setmalloctag			pm_setmalloctag
#undef  setnetmtpt
#define setnetmtpt			pm_setnetmtpt
#undef  setproc
#define setproc			pm_setproc
#undef  setrealloctag
#define setrealloctag			pm_setrealloctag
#undef  sin
#define sin			pm_sin
#undef  sinh
#define sinh			pm_sinh
#undef  sleep
#define sleep			pm_sleep
#undef  snprint
#define snprint			pm_snprint
#undef  splhi
#define splhi			pm_splhi
#undef  splx
#define splx			pm_splx
#undef  sprint
#define sprint			pm_sprint
#undef  sqrt
#define sqrt			pm_sqrt
#undef  srand
#define srand			pm_srand
#undef  stat
#define stat			pm_stat
#undef  strcat
#define strcat			pm_strcat
#undef  strchr
#define strchr			pm_strchr
#undef  strcmp
#define strcmp			pm_strcmp
#undef  strconv
#define strconv			pm_strconv
#undef  strcpy
#define strcpy			pm_strcpy
#undef  strcspn
#define strcspn			pm_strcspn
#undef  strdup
#define strdup			pm_strdup
#undef  strdup
#define strdup			pm_strdup
#undef  strecpy
#define strecpy			pm_strecpy
#undef  strecpy
#define strecpy			pm_strecpy
#undef  strlen
#define strlen			pm_strlen
#undef  strncat
#define strncat			pm_strncat
#undef  strncmp
#define strncmp			pm_strncmp
#undef  strncpy
#define strncpy			pm_strncpy
#undef  strpbrk
#define strpbrk			pm_strpbrk
#undef  strrchr
#define strrchr			pm_strrchr
#undef  strspn
#define strspn			pm_strspn
#undef  strtod
#define strtod			pm_strtod
#undef  strtok
#define strtok			pm_strtok
#undef  strtol
#define strtol			pm_strtol
#undef  strtoll
#define strtoll			pm_strtoll
#undef  strtoull
#define strtoull			pm_strtoull
#undef  strconv
#define strconv			pm_strconv
#undef  strdup
#define strdup			pm_strdup
#undef  strecpy
#define strecpy			pm_strecpy
#undef  strtod
#define strtod			pm_strtod
#undef  strtol
#define strtol			pm_strtol
#undef  strtoll
#define strtoll			pm_strtoll
#undef  strtoul
#define strtoul			pm_strtoul
#undef  strtoull
#define strtoull			pm_strtoull
#undef  strstr
#define strstr			pm_strstr
#undef  sysfatal
#define sysfatal			pm_sysfatal
#undef  syslog
#define syslog			pm_syslog
#undef  sysname
#define sysname			pm_sysname
#undef  tan
#define tan			pm_tan
#undef  tanh
#define tanh			pm_tanh
#undef  time
#define time			pm_time
#undef  times
#define times			pm_times
#undef  tm2sec
#define tm2sec			pm_tm2sec
#undef  tokenize
#define tokenize			pm_tokenize
#undef  tolower
#define tolower			pm_tolower
#undef  tolowerrune
#define tolowerrune			pm_tolowerrune
#undef  totitlerune
#define totitlerune			pm_totitlerune
#undef  toupper
#define toupper			pm_toupper
#undef  toupperrune
#define toupperrune			pm_toupperrune
#undef  umuldiv
#define umuldiv			pm_umuldiv
#undef  truerand
#define truerand			pm_truerand
#undef  unlock
#define unlock			pm_unlock
#undef  unmount
#define unmount			pm_unmount
#undef  unquoterunestrdup
#define unquoterunestrdup			pm_unquoterunestrdup
#undef  unquotestrdup
#define unquotestrdup			pm_unquotestrdup
#undef  utfecpy
#define utfecpy			pm_utfecpy
#undef  utflen
#define utflen			pm_utflen
#undef  utfnlen
#define utfnlen			pm_utfnlen
#undef  utfrrune
#define utfrrune			pm_utfrrune
#undef  utfrune
#define utfrune			pm_utfrune
#undef  utfutf
#define utfutf			pm_utfutf
#undef  werrstr
#define werrstr			pm_werrstr
#undef  wlock
#define wlock			pm_wlock
#undef  write
#define write			pm_write
#undef  writev
#define writev			pm_writev
#undef  wstat
#define wstat			pm_wstat
#undef  wunlock
#define wunlock			pm_wunlock
                                                  
#endif /* !NODEFINE */
