#ifndef SDI_DEFINES_H
#define SDI_DEFINES_H

/* Includeheader

	Name:		SDI_defines
	Versionstring:	$VER: SDI_defines.h 1.22 (18.11.96)
	Author:		SDI
	Distribution:	PD
	Description:	standard defines and Makros and the version string

 1.0	: aus ...SDI.h Files aufgebaut
 1.1	: SDI_ERROR eingefügt
 1.2	: INFO's verbessert
 1.3	: SDI_ERROR entfernt
 1.4	: INFO_ERR berichtigt
 1.5	: wenn DATE nicht definiert, dann DATE == __DATE2__
 1.6	: DEBUG Teile eingeführt
 1.7	: DEBUG's etwas geändert
 1.8	: OS_VERSION und TEST_OS eingeführt
 1.9   10.08.95 : OS_VERSION verkürzt
 1.10  18.08.95 : DEBUG_BREAKS ergänzt
 1.11  23.09.95 : NOVERSION ergänzt
 1.12  15.10.95 : jetzt STRPTR version
 1.13  05.02.96 : isprintSDI, isHEXNum entfernt
 1.14  13.04.96 : Versionsstring in Header
 1.15  28.05.96 : ENDCODE eingebaut
 1.16  05.06.96 : Protos für End und extern def für version auch ohne
 	die defines, ausgenommen mit NOCODE define, TEST_OS, OS_VERSION
 	entfernt
 1.17  12.06.96 : RETURN_WARN instead of RETURN_ERROR in ENDCODE
 1.18  06.07.96 : ENDCODE: PrintFault behind end --> allows selecting output
 1.19  21.08.96 : added __SASC __AMIGADATE__ support
 1.20  24.08.96 : better SAS-C support
 1.21  04.09.96 : changed error with SAS date having the brackets already
 1.22  18.11.96 : converted to english, C++ comments to C ones
*/

#include <exec/types.h>

/* ========================== spart <stdlib.h> ========================== */

extern void exit(int);

/* ============== Defines für GetCharHEX und GetCharSTRING ============== */

#define PATTERN_BACK		351  /* '_' bei Ausgabe */
#define PATTERN			'?'
#define PATTERN_VORZ		92   /* '\'		*/
#define BACK_MAX		256

/* ========================== sonstige Makros =========================== */

/* <pragma/exec_lib.h>, <dos/dos.h> */

#define CTRL_C		(SetSignal (0L,0L) & SIGBREAKF_CTRL_C)

/* ===================== Makros für Infotextausgabe ===================== */

/* <pragma/dos_lib.h>, <dos/dos.h> */

#define IS_PAR_HELP	(argc > 1 && argv[1][0] == '?')
 
#define INFO_OK  {PutStr(NAME " : "); PutStr(Info_Head);	\
		PutStr(Info_Text); exit(RETURN_FAIL);}
#define INFO_ERR {PutStr(NAME " : "); PutStr(Info_Head);	\
		PrintFault(ERROR_REQUIRED_ARG_MISSING,0); exit(RETURN_FAIL);}

/* ======================== Zeichendefinitionen ========================= */

#define BS	 8
#define ESC	27

/* ========================== Debug - Defines =========================== */

/*
#define DEBUG			// Standard Debugging
#define DEBUG_LOOP		// innerhalb von Schleifen
#define DEBUG_INC_FUNC		// Ausgaben der Includefunktionen
#define DEBUG_BREAKS		// für Breakpoints mit Wait
#define DEBUG_OLD		// DEBUG defines which aren't needed actually
*/

/* ================================= SAS C ============================== */

#ifdef __SASC
  extern struct ExecBase	*SysBase;
  extern struct DosLibrary	*DOSBase;
  #include <dos/dosextens.h>

  #define TestOS if(DOSBase->dl_lib.lib_Version < DosVersion)	\
  		   exit(RETURN_FAIL)
#endif

/* ===================== Versionsstring und EndCode ===================== */

#ifndef NOCODE
  extern STRPTR version;		// Proto für Version
  extern void End(UBYTE);		// Proto für End

  #if !defined(NOVERSION) && defined(NAME)
    #ifndef AUTHOR
      #define AUTHOR "by SDI"
    #endif
    #ifndef VERSION
      #define VERSION "1"
    #endif
    #ifndef REVISION
      #define REVISION "0"
    #endif
    #ifndef DATE
      #ifdef __MAXON__
        #define DATE __DATE2__
      #elif defined(__SASC)
        #define DATE __AMIGADATE__
      #endif
    #endif
    #ifdef __MAXON__
      #define SDI_DATE "(" DATE ")"
    #elif defined(__SASC)
      #define SDI_DATE DATE
    #endif

    #ifndef DISTRIBUTION
      #define DISTRIBUTION "(PD) "
    #endif
    STRPTR version = (STRPTR) "$VER: " NAME " " VERSION "." REVISION " "
    SDI_DATE " " DISTRIBUTION AUTHOR;

  #endif /* !NOVERSION && NAME */

  #if defined(ENDCODE) || defined(ENDCODE_NOCTRLC)
    #ifdef __MAXON__
      #define __inline
      inline
    #endif
      void __inline end(void);
    void End(UBYTE err)
    {
      #ifndef ENDCODE_NOCTRLC
      if(CTRL_C)
      {
        err = RETURN_WARN;
        SetIoErr(ERROR_BREAK);
      }
      #endif

      end();

      if(err)		PrintFault(IoErr(), 0);
      exit(err);
    }
  #endif /* ENDCODE && ENDCODE_NOCTRLC */
#endif /* NOCODE */

#endif /* SDI_DEFINES_H */

