home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / misc / FD2Pragma.lha / Source / SDI_defines.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  4.7 KB  |  166 lines

  1. #ifndef SDI_DEFINES_H
  2. #define SDI_DEFINES_H
  3.  
  4. /* Includeheader
  5.  
  6.     Name:        SDI_defines
  7.     Versionstring:    $VER: SDI_defines.h 1.23 (02.01.97)
  8.     Author:        SDI
  9.     Distribution:    PD
  10.     Description:    standard defines and Makros and the version string
  11.  
  12.  1.0    : aus ...SDI.h Files aufgebaut
  13.  1.1    : SDI_ERROR eingefügt
  14.  1.2    : INFO's verbessert
  15.  1.3    : SDI_ERROR entfernt
  16.  1.4    : INFO_ERR berichtigt
  17.  1.5    : wenn DATE nicht definiert, dann DATE == __DATE2__
  18.  1.6    : DEBUG Teile eingeführt
  19.  1.7    : DEBUG's etwas geändert
  20.  1.8    : OS_VERSION und TEST_OS eingeführt
  21.  1.9   10.08.95 : OS_VERSION verkürzt
  22.  1.10  18.08.95 : DEBUG_BREAKS ergänzt
  23.  1.11  23.09.95 : NOVERSION ergänzt
  24.  1.12  15.10.95 : jetzt STRPTR version
  25.  1.13  05.02.96 : isprintSDI, isHEXNum entfernt
  26.  1.14  13.04.96 : Versionsstring in Header
  27.  1.15  28.05.96 : ENDCODE eingebaut
  28.  1.16  05.06.96 : Protos für End und extern def für version auch ohne
  29.      die defines, ausgenommen mit NOCODE define, TEST_OS, OS_VERSION
  30.      entfernt
  31.  1.17  12.06.96 : RETURN_WARN instead of RETURN_ERROR in ENDCODE
  32.  1.18  06.07.96 : ENDCODE: PrintFault behind end --> allows selecting output
  33.  1.19  21.08.96 : added __SASC __AMIGADATE__ support
  34.  1.20  24.08.96 : better SAS-C support
  35.  1.21  04.09.96 : changed error with SAS date having the brackets already
  36.  1.22  18.11.96 : converted to english, C++ comments to C ones
  37.  1.23  02.01.97 : corrected some stuff
  38. */
  39.  
  40. #include <exec/types.h>
  41.  
  42. /* ========================== spart <stdlib.h> ========================== */
  43.  
  44. extern void exit(int);
  45.  
  46. /* ============== Defines für GetCharHEX und GetCharSTRING ============== */
  47.  
  48. #define PATTERN_BACK        351  /* '_' bei Ausgabe */
  49. #define PATTERN            '?'
  50. #define PATTERN_VORZ        92   /* '\'        */
  51. #define BACK_MAX        256
  52.  
  53. /* ========================== sonstige Makros =========================== */
  54.  
  55. /* <pragma/exec_lib.h>, <dos/dos.h> */
  56.  
  57. #define CTRL_C        (SetSignal (0L,0L) & SIGBREAKF_CTRL_C)
  58.  
  59. /* ===================== Makros für Infotextausgabe ===================== */
  60.  
  61. /* <pragma/dos_lib.h>, <dos/dos.h> */
  62.  
  63. #define IS_PAR_HELP    (argc > 1 && argv[1][0] == '?')
  64.  
  65. #define INFO_OK  {PutStr(NAME " : "); PutStr(Info_Head);    \
  66.         PutStr(Info_Text); exit(RETURN_FAIL);}
  67. #define INFO_ERR {PutStr(NAME " : "); PutStr(Info_Head);    \
  68.         PrintFault(ERROR_REQUIRED_ARG_MISSING,0); exit(RETURN_FAIL);}
  69.  
  70. /* ======================== Zeichendefinitionen ========================= */
  71.  
  72. #define BS     8
  73. #define ESC    27
  74.  
  75. /* ========================== Debug - Defines =========================== */
  76.  
  77. /*
  78. #define DEBUG            // Standard Debugging
  79. #define DEBUG_LOOP        // innerhalb von Schleifen
  80. #define DEBUG_INC_FUNC        // Ausgaben der Includefunktionen
  81. #define DEBUG_BREAKS        // für Breakpoints mit Wait
  82. #define DEBUG_OLD        // DEBUG defines which aren't needed actually
  83. */
  84.  
  85. /* ================================= SAS C ============================== */
  86.  
  87. #ifdef __SASC
  88.   extern struct ExecBase    *SysBase;
  89.   extern struct DosLibrary    *DOSBase;
  90.   #include <dos/dosextens.h>
  91.  
  92.   #define TestOS if(DOSBase->dl_lib.lib_Version < DosVersion)    \
  93.              exit(RETURN_FAIL)
  94. #endif
  95.  
  96. /* A word about variable DosVersion: In my startup code for MaxonC++ I
  97. include not the normal OpenLibrary("dos.library",0) but
  98. OpenLibrary("dos.library", DosVersion). If no DosVersion is given, this
  99. variable defaults to 33. Else you can give the value by creating a global
  100. variable ULONG DosVersion = 37; This lets the program not start, when the
  101. required dos is not available. (Better then others, which crash) */
  102.  
  103. /* ===================== Versionsstring und EndCode ===================== */
  104.  
  105. #ifndef NOCODE
  106.   extern STRPTR version;        /* Proto for Version */
  107.   extern void End(UBYTE);        /* Proto for End */
  108.  
  109.   #if !defined(NOVERSION) && defined(NAME)
  110.     #ifndef AUTHOR
  111.       #define AUTHOR "by SDI"
  112.     #endif
  113.     #ifndef VERSION
  114.       #define VERSION "1"
  115.     #endif
  116.     #ifndef REVISION
  117.       #define REVISION "0"
  118.     #endif
  119.     #ifndef DATE
  120.       #ifdef __MAXON__
  121.         #define DATE __DATE2__
  122.       #elif defined(__SASC)
  123.         #define DATE __AMIGADATE__
  124.       #endif
  125.     #endif
  126.     #ifdef __MAXON__
  127.       #define SDI_DATE "(" DATE ")"
  128.     #elif defined(__SASC)
  129.       #define SDI_DATE DATE
  130.     #endif
  131.  
  132.     #ifndef DISTRIBUTION
  133.       #define DISTRIBUTION "(PD) "
  134.     #endif
  135.     STRPTR version = (STRPTR) "$VER: " NAME " " VERSION "." REVISION " "
  136.     SDI_DATE " " DISTRIBUTION AUTHOR;
  137.  
  138.   #endif /* !NOVERSION && NAME */
  139.  
  140.   #if defined(ENDCODE) || defined(ENDCODE_NOCTRLC)
  141.     #ifdef __MAXON__
  142.       #define __inline
  143.       inline
  144.     #endif
  145.       void __inline end(void);
  146.     void End(UBYTE err)
  147.     {
  148.       #ifndef ENDCODE_NOCTRLC
  149.       if(CTRL_C)
  150.       {
  151.         err = RETURN_WARN;
  152.         SetIoErr(ERROR_BREAK);
  153.       }
  154.       #endif
  155.  
  156.       end();
  157.  
  158.       if(err)        PrintFault(IoErr(), 0);
  159.       exit(err);
  160.     }
  161.   #endif /* ENDCODE && ENDCODE_NOCTRLC */
  162. #endif /* NOCODE */
  163.  
  164. #endif /* SDI_DEFINES_H */
  165.  
  166.