/*
	AutoGenerated on  8-MAR-2001 10:42:24.92


    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 ---------------------------------------------------------------------------

Copyright 1994-2000 (c) Jérôme Lauret <jlauret@mail.chem.sunysb.edu>

*/

#include <ssdef.h>
#include <stsdef.h>

#ifdef __STDC__
#define __GNU_HACKS_string(foo) #foo
#define __GNU_HACKS_const __const
#else   
#define __GNU_HACKS_string(foo) "foo"
#define __GNU_HACKS_const
#endif

#ifdef __GNUC__
# define GLOBALREF(TYPE,NAME) 		TYPE NAME __asm("_$$PsectAttributes_GLOBALSYMBOL$$" __GNU_HACKS_string(NAME))
# define GLOBALDEF(TYPE,NAME,VALUE) 	TYPE NAME __asm("_$$PsectAttributes_GLOBALSYMBOL$$" __GNU_HACKS_string(NAME)) = VALUE
# define GLOBALVALUEREF(TYPE,NAME) 	__GNU_HACKS_const TYPE NAME[1] __asm("_$$PsectAttributes_GLOBALVALUE$$" __GNU_HACKS_string(NAME))
# define GLOBALVALUEDEF(TYPE,NAME,VALUE) __GNU_HACKS_const TYPE NAME[1] __asm("_$$PsectAttributes_GLOBALVALUE$$" __GNU_HACKS_string(NAME)) = {VALUE}
#else
# define GLOBALREF(TYPE,NAME)		globalref TYPE NAME
# define GLOBALDEF(TYPE,NAME,VALUE)	globaldef TYPE NAME = VALUE
# define GLOBALVALUEDEF(TYPE,NAME,VALUE) globalvalue TYPE NAME = VALUE
# define GLOBALVALUEREF(TYPE,NAME)	globalvalue TYPE NAME
#endif

#pragma nostandard
	GLOBALVALUEREF(unsigned int,DELTREE__BUGCHK);
	GLOBALVALUEREF(unsigned int,DELTREE__BADCOUNT);
	GLOBALVALUEREF(unsigned int,DELTREE__SLOGFAIL);
	GLOBALVALUEREF(unsigned int,DELTREE__CHDIR);
	GLOBALVALUEREF(unsigned int,DELTREE__INSFMEM);
	GLOBALVALUEREF(unsigned int,DELTREE__NOROOT);
	GLOBALVALUEREF(unsigned int,DELTREE__CREATFAIL);
	GLOBALVALUEREF(unsigned int,DELTREE__UGLIX);
	GLOBALVALUEREF(unsigned int,DELTREE__NOTATREE);
	GLOBALVALUEREF(unsigned int,DELTREE__MISSING);
	GLOBALVALUEREF(unsigned int,DELTREE__CLKINIT);
	GLOBALVALUEREF(unsigned int,DELTREE__PRV);
	GLOBALVALUEREF(unsigned int,DELTREE__IOERROR);
	GLOBALVALUEREF(unsigned int,DELTREE__NODIR);
	GLOBALVALUEREF(unsigned int,DELTREE__TOODEEP);
	GLOBALVALUEREF(unsigned int,DELTREE__DEEPFAIL);
	GLOBALVALUEREF(unsigned int,DELTREE__NOPROT);
	GLOBALVALUEREF(unsigned int,DELTREE__NODELE);
	GLOBALVALUEREF(unsigned int,DELTREE__NOTSET);
	GLOBALVALUEREF(unsigned int,DELTREE__CHECKFAIL);
	GLOBALVALUEREF(unsigned int,DELTREE__DPRCS);
	GLOBALVALUEREF(unsigned int,DELTREE__VERSION);
	GLOBALVALUEREF(unsigned int,DELTREE__NOTFND);
	GLOBALVALUEREF(unsigned int,DELTREE__CHDFAIL);
	GLOBALVALUEREF(unsigned int,DELTREE__DEEPDIR);
	GLOBALVALUEREF(unsigned int,DELTREE__GETENV);
	GLOBALVALUEREF(unsigned int,DELTREE__PRSRVD);
	GLOBALVALUEREF(unsigned int,DELTREE__NOTEXISTS);
	GLOBALVALUEREF(unsigned int,DELTREE__IGNORE);
	GLOBALVALUEREF(unsigned int,DELTREE__DEBUG);
	GLOBALVALUEREF(unsigned int,DELTREE__BEGIN);
	GLOBALVALUEREF(unsigned int,DELTREE__DEEPOK);
	GLOBALVALUEREF(unsigned int,DELTREE__DELETED);
	GLOBALVALUEREF(unsigned int,DELTREE__STAT);
#pragma standard


/*
 There are 2 ways one can implement the signal handler within both GCC and DEC-C :
 1) Still use lib$signal() --> if you get it to work with GCC, let me know
 2) Use hack$signal with the _msg_hack symbols.
*/


#ifndef __GNUC__
	/* Use lib$signal() and hack symbols	*/
#	define hack$signal	 lib$signal
#	define hack$establish(a) lib$establish(a)
#	define hack$revert()	 lib$revert()
#	define hack$exit(a) 	 exit(a)

#	define DELTREE__BUGCHK_msg_hack DELTREE__BUGCHK
#	define DELTREE__BADCOUNT_msg_hack DELTREE__BADCOUNT
#	define DELTREE__SLOGFAIL_msg_hack DELTREE__SLOGFAIL
#	define DELTREE__CHDIR_msg_hack DELTREE__CHDIR
#	define DELTREE__INSFMEM_msg_hack DELTREE__INSFMEM
#	define DELTREE__NOROOT_msg_hack DELTREE__NOROOT
#	define DELTREE__CREATFAIL_msg_hack DELTREE__CREATFAIL
#	define DELTREE__UGLIX_msg_hack DELTREE__UGLIX
#	define DELTREE__NOTATREE_msg_hack DELTREE__NOTATREE
#	define DELTREE__MISSING_msg_hack DELTREE__MISSING
#	define DELTREE__CLKINIT_msg_hack DELTREE__CLKINIT
#	define DELTREE__PRV_msg_hack DELTREE__PRV
#	define DELTREE__IOERROR_msg_hack DELTREE__IOERROR
#	define DELTREE__NODIR_msg_hack DELTREE__NODIR
#	define DELTREE__TOODEEP_msg_hack DELTREE__TOODEEP
#	define DELTREE__DEEPFAIL_msg_hack DELTREE__DEEPFAIL
#	define DELTREE__NOPROT_msg_hack DELTREE__NOPROT
#	define DELTREE__NODELE_msg_hack DELTREE__NODELE
#	define DELTREE__NOTSET_msg_hack DELTREE__NOTSET
#	define DELTREE__CHECKFAIL_msg_hack DELTREE__CHECKFAIL
#	define DELTREE__DPRCS_msg_hack DELTREE__DPRCS
#	define DELTREE__VERSION_msg_hack DELTREE__VERSION
#	define DELTREE__NOTFND_msg_hack DELTREE__NOTFND
#	define DELTREE__CHDFAIL_msg_hack DELTREE__CHDFAIL
#	define DELTREE__DEEPDIR_msg_hack DELTREE__DEEPDIR
#	define DELTREE__GETENV_msg_hack DELTREE__GETENV
#	define DELTREE__PRSRVD_msg_hack DELTREE__PRSRVD
#	define DELTREE__NOTEXISTS_msg_hack DELTREE__NOTEXISTS
#	define DELTREE__IGNORE_msg_hack DELTREE__IGNORE
#	define DELTREE__DEBUG_msg_hack DELTREE__DEBUG
#	define DELTREE__BEGIN_msg_hack DELTREE__BEGIN
#	define DELTREE__DEEPOK_msg_hack DELTREE__DEEPOK
#	define DELTREE__DELETED_msg_hack DELTREE__DELETED
#	define DELTREE__STAT_msg_hack DELTREE__STAT
#else
	/* Extraneous #define is for GCC support only	*/
#	define hack$signal	DELTREE__signal
#	define hack$exit(a)     {hack$signal(a); exit(SS$_NORMAL);}
#	define hack$establish(a) /* a */
#	define hack$revert() 	/* Missing $revert at link time on AXP */
#if !defined($VMS_STATUS_SUCCESS)
#	define $VMS_STATUS_SUCCESS(code) (((code)&STS$M_SUCCESS)  >>STS$V_SUCCESS)
#endif

#	define DELTREE__BUGCHK ((unsigned int) DELTREE__BUGCHK)
#	define DELTREE__BUGCHK_msg_hack "F","BUGCHK","bug Check - Null pointer returned by runtime",0
#	define DELTREE__BADCOUNT ((unsigned int) DELTREE__BADCOUNT)
#	define DELTREE__BADCOUNT_msg_hack "F","BADCOUNT","bad internal counter. Please report",0
#	define DELTREE__SLOGFAIL ((unsigned int) DELTREE__SLOGFAIL)
#	define DELTREE__SLOGFAIL_msg_hack "F","SLOGFAIL","setting logical failed. Please report",0
#	define DELTREE__CHDIR ((unsigned int) DELTREE__CHDIR)
#	define DELTREE__CHDIR_msg_hack "F","CHDIR","chdir() failed while returning to original tree",0
#	define DELTREE__INSFMEM ((unsigned int) DELTREE__INSFMEM)
#	define DELTREE__INSFMEM_msg_hack "F","INSFMEM","insufficient dynamic memory",0
#	define DELTREE__NOROOT ((unsigned int) DELTREE__NOROOT)
#	define DELTREE__NOROOT_msg_hack "F","NOROOT","startup root-directory no longer present",0
#	define DELTREE__CREATFAIL ((unsigned int) DELTREE__CREATFAIL)
#	define DELTREE__CREATFAIL_msg_hack "F","CREATFAIL","process creation failed",0
#	define DELTREE__UGLIX ((unsigned int) DELTREE__UGLIX)
#	define DELTREE__UGLIX_msg_hack "E","UGLIX","first character '-' ? Is that an Uglix command line option ??",0
#	define DELTREE__NOTATREE ((unsigned int) DELTREE__NOTATREE)
#	define DELTREE__NOTATREE_msg_hack "E","NOTATREE","not all tree(s) deleted",0
#	define DELTREE__MISSING ((unsigned int) DELTREE__MISSING)
#	define DELTREE__MISSING_msg_hack "E","MISSING","argument syntax error. The path may be missing either [ or ] OR the path is illegal",0
#	define DELTREE__CLKINIT ((unsigned int) DELTREE__CLKINIT)
#	define DELTREE__CLKINIT_msg_hack "E","CLKINIT","could not initialize timer",0
#	define DELTREE__PRV ((unsigned int) DELTREE__PRV)
#	define DELTREE__PRV_msg_hack "E","PRV","insufficient privilege or file protection violation",0
#	define DELTREE__IOERROR ((unsigned int) DELTREE__IOERROR)
#	define DELTREE__IOERROR_msg_hack "E","IOERROR","IO error on tempfile",0
#	define DELTREE__NODIR ((unsigned int) DELTREE__NODIR)
#	define DELTREE__NODIR_msg_hack "W","NODIR","no directory specified on command line",0
#	define DELTREE__TOODEEP ((unsigned int) DELTREE__TOODEEP)
#	define DELTREE__TOODEEP_msg_hack "W","TOODEEP","directory tree is too deep %s"
#	define DELTREE__DEEPFAIL ((unsigned int) DELTREE__DEEPFAIL)
#	define DELTREE__DEEPFAIL_msg_hack "W","DEEPFAIL","deep tree deletion failed",0
#	define DELTREE__NOPROT ((unsigned int) DELTREE__NOPROT)
#	define DELTREE__NOPROT_msg_hack "W","NOPROT","protection not set %s"
#	define DELTREE__NODELE ((unsigned int) DELTREE__NODELE)
#	define DELTREE__NODELE_msg_hack "W","NODELE","could not delete %s"
#	define DELTREE__NOTSET ((unsigned int) DELTREE__NOTSET)
#	define DELTREE__NOTSET_msg_hack "W","NOTSET","will not elevate priority above authorized priority = %d"
#	define DELTREE__CHECKFAIL ((unsigned int) DELTREE__CHECKFAIL)
#	define DELTREE__CHECKFAIL_msg_hack "W","CHECKFAIL","cannot check %s. Continue"
#	define DELTREE__DPRCS ((unsigned int) DELTREE__DPRCS)
#	define DELTREE__DPRCS_msg_hack "I","DPRCS","process %s detached, pid=%X, priority=%d"
#	define DELTREE__VERSION ((unsigned int) DELTREE__VERSION)
#	define DELTREE__VERSION_msg_hack "I","VERSION","DELTREE Version %s. %s"
#	define DELTREE__NOTFND ((unsigned int) DELTREE__NOTFND)
#	define DELTREE__NOTFND_msg_hack "I","NOTFND","directory not found %s%s"
#	define DELTREE__CHDFAIL ((unsigned int) DELTREE__CHDFAIL)
#	define DELTREE__CHDFAIL_msg_hack "I","CHDFAIL","could not change directory to %s"
#	define DELTREE__DEEPDIR ((unsigned int) DELTREE__DEEPDIR)
#	define DELTREE__DEEPDIR_msg_hack "I","DEEPDIR","dealing with deep directory %s"
#	define DELTREE__GETENV ((unsigned int) DELTREE__GETENV)
#	define DELTREE__GETENV_msg_hack "I","GETENV","getenv() returns %s"
#	define DELTREE__PRSRVD ((unsigned int) DELTREE__PRSRVD)
#	define DELTREE__PRSRVD_msg_hack "I","PRSRVD","top directory %s preserved"
#	define DELTREE__NOTEXISTS ((unsigned int) DELTREE__NOTEXISTS)
#	define DELTREE__NOTEXISTS_msg_hack "I","NOTEXISTS","some directories did not exist",0
#	define DELTREE__IGNORE ((unsigned int) DELTREE__IGNORE)
#	define DELTREE__IGNORE_msg_hack "I","IGNORE",""
#	define DELTREE__DEBUG ((unsigned int) DELTREE__DEBUG)
#	define DELTREE__DEBUG_msg_hack "S","DEBUG","%s %s"
#	define DELTREE__BEGIN ((unsigned int) DELTREE__BEGIN)
#	define DELTREE__BEGIN_msg_hack "S","BEGIN","tree to remove %s"
#	define DELTREE__DEEPOK ((unsigned int) DELTREE__DEEPOK)
#	define DELTREE__DEEPOK_msg_hack "S","DEEPOK","deep tree deletion is a success",0
#	define DELTREE__DELETED ((unsigned int) DELTREE__DELETED)
#	define DELTREE__DELETED_msg_hack "S","DELETED","%s"
#	define DELTREE__STAT ((unsigned int) DELTREE__STAT)
#	define DELTREE__STAT_msg_hack "S","STAT","%ld file(s) deleted in %s seconds"


#ifndef DELTREE_SIGNAL_ROUTINE_HEADER
#define DELTREE_SIGNAL_ROUTINE_HEADER
/* provided DELTREE__signal routine	*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
void	DELTREE__signal(char *sev,char *typ,char *mess,int id, ...)
{
 char buf[2048];
 va_list args;

 va_start(args,id);
 (void) vsprintf(buf,mess,args);
 (void) fprintf(stderr,"%%DELTREE-%s-%s, %s\n",sev,typ,buf);
 if (*sev == 'E') abort();
 if (*sev == 'F') abort();
}
#endif

#endif	/* GNUC or not	*/

