home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / monitors / rsys / rsyssrc.lha / RSysPre.h < prev    next >
C/C++ Source or Header  |  1993-09-25  |  10KB  |  420 lines

  1. /*
  2. ***************************************************************************
  3. *
  4. * Datei:
  5. *    RSysPre.h
  6. *
  7. * Inhalt:
  8. *
  9. *      --- Globale Routinen ---
  10. *
  11. *
  12. *      --- Lokale  Routinen ---
  13. *
  14. *
  15. * Bemerkungen:
  16. *    Dise Datei wird vorkompiliert (Zeitgewinn beim Übersetzen
  17. *    einzelner Module.
  18. *
  19. * Erstellungsdatum:
  20. *    19-Jul-93    Rolf Böhme
  21. *
  22. * Änderungen:
  23. *    19-Jul-93    Rolf Böhme    Erstellung
  24. *
  25. ***************************************************************************
  26. */
  27.  
  28. #include <clib/icon_protos.h>
  29. #include <clib/alib_protos.h>
  30. #include <clib/exec_protos.h>
  31. #include <clib/gadtools_protos.h>
  32. #include <clib/graphics_protos.h>
  33. #include <clib/intuition_protos.h>
  34. #include <clib/dos_protos.h>
  35. #include <clib/expansion_protos.h>
  36. #include <clib/asl_protos.h>
  37. #include <clib/commodities_protos.h>
  38. #include <clib/wb_protos.h>
  39. #include <clib/diskfont_protos.h>
  40. #include <clib/utility_protos.h>
  41. #include <clib/translator_protos.h>
  42. #include <clib/iffparse_protos.h>
  43. #include <clib/macros.h>
  44. #include <clib/layers_protos.h>
  45. #include <clib/keymap_protos.h>
  46.  
  47. #include <pragmas/icon_lib.h>
  48. #include <pragmas/exec_lib.h>
  49. #include <pragmas/gadtools_lib.h>
  50. #include <pragmas/graphics_lib.h>
  51. #include <pragmas/intuition_lib.h>
  52. #include <pragmas/dos_lib.h>
  53. #include <pragmas/expansion_lib.h>
  54. #include <pragmas/asl_lib.h>
  55. #include <pragmas/commodities_lib.h>
  56. #include <pragmas/wb_lib.h>
  57. #include <pragmas/diskfont_lib.h>
  58. #include <pragmas/utility_lib.h>
  59. #include <pragmas/translator_lib.h>
  60.  
  61. #include <devices/audio.h>
  62. #include <devices/input.h>
  63. #include <devices/inputevent.h>
  64. #include <devices/timer.h>
  65. #include <devices/trackdisk.h>
  66. #include <devices/narrator.h>
  67. #include <devices/prtbase.h>
  68. #include <devices/printer.h>
  69.  
  70. #include <dos/exall.h>
  71. #include <dos/rdargs.h>
  72. #include <dos/dostags.h>
  73. #include <dos/dosextens.h>
  74. #include <dos/filehandler.h>
  75.  
  76. #include <exec/alerts.h>
  77. #include <exec/devices.h>
  78. #include <exec/execbase.h>
  79. #include <exec/interrupts.h>
  80. #include <exec/io.h>
  81. #include <exec/memory.h>
  82. #include <exec/types.h>
  83.  
  84. #include <graphics/displayinfo.h>
  85. #include <graphics/gfx.h>
  86. #include <graphics/gfxbase.h>
  87. #include <graphics/gfxmacros.h>
  88. #include <graphics/text.h>
  89.  
  90. #include <hardware/cia.h>
  91. #include <hardware/intbits.h>
  92. #include <hardware/custom.h>
  93.  
  94. #include <intuition/classes.h>
  95. #include <intuition/classusr.h>
  96. #include <intuition/gadgetclass.h>
  97. #include <intuition/imageclass.h>
  98. #include <intuition/intuition.h>
  99. #include <intuition/intuitionbase.h>
  100. #include <intuition/preferences.h>
  101.  
  102. #include <libraries/dos.h>
  103. #include <libraries/dosextens.h>
  104. #include <libraries/expansionbase.h>
  105. #include <libraries/gadtools.h>
  106. #include <libraries/asl.h>
  107. #include <libraries/commodities.h>
  108. #include <libraries/diskfont.h>
  109. #include <libraries/translator.h>
  110. #include <libraries/iffparse.h>
  111.  
  112. #include <workbench/startup.h>
  113. #include <workbench/workbench.h>
  114.  
  115. #include <limits.h>
  116. #include <fcntl.h>
  117. #include <stdio.h>
  118. #include <stdlib.h>
  119. #include <string.h>
  120. #include <time.h>
  121. #include <stdarg.h>
  122. #include <ctype.h>
  123.  
  124. #include <libraries/amigaguide.h>
  125. #include <clib/amigaguide_protos.h>
  126. #include <pragmas/amigaguide_pragma.h>
  127.  
  128. #include "RSysDebug.h"
  129.  
  130. #define NAME        "RSys"
  131. #define VERSION    "1.3"
  132. #define DATE        __DATE__
  133. #define TIME        __TIME__
  134. #define COPYRIGHT "(c) by Rolf Boehme (GiftWare and PD)"
  135.  
  136. #define UNSETLVPOS                -1
  137. #define NO_CASE                    0
  138. #define CASE                        1
  139. #define HOTKEYS                    7
  140. #define MAXSHOW                    10
  141. #define SYSTEMINFO                12
  142. #define TITLELEN                    15
  143. #define PWDLEN                     20
  144. #define ENVLEN                     20
  145. #define PARTSIZE                    20
  146. #define MAXSTRLEN                 30
  147. #define BUFSIZE               60
  148. #define PATTERNLEN                50
  149. #define SEC                         50
  150. #define HELPLINESIZE             50
  151. #define PATHPARTWIDTH            80
  152. #define PARSEPATLEN                102
  153. #define MAXFULLNAME                108
  154. #define MAXLINESIZE                150
  155. #define MAXWRITESIZE             200
  156. #define CRCTABSIZE                256
  157. #define MAXLARGEMEM                512
  158. #define FRAC                        8192
  159. #define FULL                        65536
  160.  
  161. #define CRC16                 0
  162. #define CRC32                 1
  163.  
  164.    /*
  165.     * Window-Gadgets-Counter
  166.     */
  167. #define ChgPri_CNT            5
  168. #define ShowFont_TNUM         1
  169. #define CRC_CNT               5
  170. #define Crypt_CNT             8
  171. #define Formatter_CNT         8
  172. #define FindFile_CNT          10
  173. #define FormatDisk_CNT        10
  174. #define SaveAWindow_CNT       3
  175. #define MemMonitor_CNT        13
  176. #define SearchStr_CNT         3
  177. #define Sys_CNT               19
  178.  
  179. #define NOSCREENTITLECHANGE    ((UBYTE *)(-1))
  180.  
  181. #define R13                         TRUE
  182. #define CRY                         FALSE
  183.  
  184. #define ESC                         '\33'
  185.  
  186. #define ACTION_TOKEN             "#"
  187.  
  188. #define COUNT_FLAGS                (GD_HandlerInpGad+1)
  189. #define KEY_RELEASE                0x80
  190. #define KEY_HELP                    0x5F
  191. #define KEY_q                        0x10
  192. #define KEY_ESC                    0x45
  193.  
  194. #define custom                     (*(struct Custom *)0xDFF000)
  195.  
  196. #define EVT_HOTKEY                1L
  197.  
  198. #define CNTMASK                    LDF_DEVICES
  199. #define MASK                        (CNTMASK|LDF_READ)
  200. #define B2C(x)                     ((VOID *)(((LONG)(x))<<2))
  201.  
  202. #define ID_PORT_NAME             (UBYTE *)"RSys.rendezvous"
  203.  
  204. #define STRINGEND                 '\0'
  205.  
  206. #define KILL                        TRUE
  207. #define NO_KILL                    FALSE
  208.  
  209. #define YES                         TRUE
  210. #define NO                            FALSE
  211.  
  212. #define SORT                        TRUE
  213. #define NO_SORT                    FALSE
  214.  
  215. #define SPEAK                        TRUE
  216. #define NO_SPEAK                    FALSE
  217.  
  218. #define ErrorHandle(str,nr1,nr2,kill) ErrorHandleFull(str,nr1,nr2,kill,__FILE__,__FUNC__,__LINE__)
  219.  
  220. #define CTRLKEYS (AMIGAKEYS | IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT | \
  221. IEQUALIFIER_CAPSLOCK | IEQUALIFIER_CONTROL | IEQUALIFIER_LALT | IEQUALIFIER_RALT |\
  222. IEQUALIFIER_NUMERICPAD)
  223.  
  224.     /*
  225.      * Dieses Template wird von der Funktion ReadArgs()
  226.      * verwendet, um die Argumente auf der Kommandozeile
  227.      * zu parsen. Es erscheint auch, wenn man das
  228.      * Programm RSys mit dem Parameter "?" aufruft
  229.     * Aus RSys.c
  230.      */
  231. #define TEMPLATE \
  232. (UBYTE *)"T=TASKS/S,L=LIBRARIES/S,M=MEMORY/S,P=PORTS/S,V=VOLUMES/S,\
  233. A=ASSIGNS/S,F=FONTS/S,R=RESOURCES/S,I=INTERRUPTS/S,W=WINDOWS/S,\
  234. S=SCREENS/S,H=INPUTHDL/S"
  235.  
  236. #define CTRL_C_RECEIVED          (mask & SIGBREAKF_CTRL_C)
  237. #define ID_PORT_SIG_RECEIVED     (mask & (1L << SysIdPort->mp_SigBit))
  238. #define BROKER_PORT_SIG_RECEIVED (mask & (1L << broker_mp->mp_SigBit))
  239. #define WINDOW_PORT_SIG_RECEIVED (mask & (1L << SysWnd->UserPort->mp_SigBit))
  240.  
  241. #define ESC_PRESSED        ((class == IDCMP_VANILLAKEY) && (code==ESC))
  242. #define MENU_PRESSED       ((class == IDCMP_MENUPICK  ) && (MENUNUM(code) == 0) && (ITEMNUM(code) == 0))
  243.  
  244. #define ICONIFY_REQUESTED  (Flags.wb_start && (ESC_PRESSED || MENU_PRESSED))
  245.  
  246.    /*
  247.     * Aus RSysTreeHunks.c
  248.     */
  249. #define RKEY    ((struct Remember **)&dekey)
  250. #define SIZEDE sizeof(struct diskhunkentry)
  251.  
  252. #define IS_SET(pos)    (mask&(1L<<(pos)))
  253. #define SET(pos)        (mask|=(1L<<(pos)))
  254. #define UNSET(pos)    (mask&=(~(1L<<(pos))))
  255.  
  256. #define IDIR         "\303"
  257. #define ILASTDIR     "\300"
  258. #define ISUBDIR     "\304 "
  259. #define ILEVEL      "\263  "
  260.  
  261. #define ADIR         "+"
  262. #define ALASTDIR     "\\"
  263. #define ASUBDIR     "- "
  264. #define ALEVEL      "|  "
  265.  
  266.    /*
  267.     * Aus RSysCRC.c
  268.     */
  269.      /*
  270.       * The width of the cell ring is defined here. A word of warning: never
  271.       * encrypt a file and forget the access password, since it will be
  272.       * extremely hard to break the code (with 30 cells there are 256^30
  273.       * possible values each cell may be initialized to which means that
  274.       * you could have to try more than 1.7e+72 combinations for each single
  275.       * password character before actually finding the matching password).
  276.       * See `Random sequence generation by cellular automata' by Steven
  277.       * Wolfram (Institute for Advanced Study; Advances in Applied
  278.       * Mathematics) for more information.
  279.       */
  280.  
  281. #define CELL_WIDTH 30
  282.  
  283.    /*
  284.     * Aus RSysClip.c
  285.     */
  286. #define ID_FTXT  MAKE_ID('F','T','X','T')
  287. #define ID_CHRS  MAKE_ID('C','H','R','S')
  288.  
  289.    /*
  290.     * Aus RSysCheckOffsets.c
  291.     */
  292. #define FKEY                ((struct Remember **)&FKey)
  293. #define ALLOCF(size)     AllocRemember(FKEY,(size),MEMF_CLEAR)
  294. #define FREEF(flag)        FreeRemember(FKEY,(flag))
  295.  
  296. #define MAGIC_ROM_END    ((ULONG)0x01000000)
  297. #define MAGIC_ROM_SIZE    ((ULONG)(*((ULONG *)0x00FFFFEC)))
  298.  
  299. #define FUNCOFFS sizeof(struct func)
  300.  
  301. #define LIBCNT   sizeof(libs)/sizeof(struct _liblist)
  302. #define DEVCNT   sizeof(devs)/sizeof(struct _devlist)
  303.  
  304.    /*
  305.     * Aus RSysFormatFind.c
  306.     */
  307. #define DF 0
  308. #define FI 1
  309. #define DI 2
  310.  
  311. #define DEVKEY     ((struct Remember **)&DevKey)
  312. #define FILEKEY    ((struct Remember **)&FileKey)
  313.  
  314. #define CMDFMT "%s DRIVE %s NAME \"%s\" %s %s %s %s"
  315.  
  316.    /*
  317.     * Aus RSysSpecialList.c
  318.     */
  319. #define MAX_BROKER_ENTRIES 40
  320.  
  321.    /*
  322.     * Aus RSysSignalTrap.c
  323.     */
  324. #define _NUMSIG                15
  325. #define _FSTSIG                0
  326.  
  327.    /*
  328.     * Aus RSysHunks.c
  329.     */
  330. #define ERKEY    ((struct Remember **)&hekey)
  331. #define ESIZEDE sizeof(struct hunkentry)
  332.  
  333.    /*
  334.     * Aus RSysSaveWindow.c
  335.     */
  336.  
  337.     /* Current compression mode. */
  338.  
  339. #define DUMP        0
  340. #define RUN        1
  341.  
  342.     /* ByteRun compression data. */
  343.  
  344. #define MINRUN        3
  345. #define MAXRUN        128
  346. #define MAXDAT        128
  347.  
  348.     /* Chunk types. */
  349.  
  350. #define ID_ILBM        MAKE_ID('I','L','B','M')
  351. #define ID_ANNO        MAKE_ID('A','N','N','O')
  352. #define ID_BMHD        MAKE_ID('B','M','H','D')
  353. #define ID_CMAP        MAKE_ID('C','M','A','P')
  354. #define ID_CAMG        MAKE_ID('C','A','M','G')
  355. #define ID_BODY        MAKE_ID('B','O','D','Y')
  356.  
  357.     /* Masking technique. */
  358.  
  359. #define mskNone        0
  360.  
  361.     /* Compression techniques. */
  362.  
  363. #define cmpNone        0
  364. #define cmpByteRun1    1
  365.  
  366.    /*
  367.     * Aus RSysSummaryLists.c
  368.     */
  369. #define MEMTYPELEN 15
  370. #define NONE (WORD)(0xFFFF)
  371.  
  372. #define CNT_DEVELOPER (sizeof(manu)/sizeof(struct Manufacturer))
  373.  
  374. #define GFXF_AA_ALICE    4
  375. #define GFXF_AA_LISA        8
  376. #define GFXF_AA_MLISA    16    /* internal use only */
  377.  
  378.    /*
  379.     * Aus RSysGfxIntuiLists.c
  380.     */
  381. #define SETFLAG(gad,flag) ((((gad)->GadgetType)&(flag))==(flag))
  382.  
  383.    /*
  384.     * Aus RSysDosLists.c
  385.     */
  386. #define BPTR_TO_C(strtag, var)  ((struct strtag *)(BADDR( (ULONG) var)))
  387. #define C_TO_BPTR(var)              (((ULONG)var)>>2)
  388.  
  389.    /* 
  390.     * Aus RSysInitData.c
  391.     */
  392. #define HWKEY           ((struct Remember **)&HWKey)
  393. #define ALLOCHW(size)   AllocRemember(HWKEY, (size), MEMF_CLEAR)
  394.  
  395. #define LOKEY           ((struct Remember **)&LOKey)
  396. #define ALLOCLO(size)   AllocRemember(LOKEY, (size), MEMF_CLEAR)
  397.  
  398. #define VMKEY           ((struct Remember **)&VMKey)
  399. #define ALLOCVM(size)   AllocRemember(VMKEY, (size), MEMF_CLEAR)
  400.  
  401.    /* 
  402.     * Aus RSysMonitor.c
  403.     */
  404. #define LINESIZE        16L
  405. #define LINECOUNT       32L
  406. #define BLOCKSIZE       512L
  407. #define DISPLAYCOUNT    4
  408.  
  409. #define MONKEY             ((struct Remember **)&MonKey)
  410. #define AllocMonMem(size)  AllocRemember(MONKEY,(size),MEMF_CLEAR);
  411.  
  412.    /* 
  413.     * Aus RSysInit.c
  414.     */
  415. #define GTMN_NewLookMenus    GT_TagBase+67 /* ti_Data is boolean */
  416. #define NEWLEN 24
  417.  
  418. #define LOCK      TRUE
  419. #define UNLOCK    FALSE
  420.