home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 514b.lha / ToolLib_v8.1 / tool.h < prev    next >
C/C++ Source or Header  |  1991-06-08  |  7KB  |  237 lines

  1. /*-----------------------------------------------------------------------*
  2.    tool.h version 8.1 - © 1990-91 Jaba Development
  3.  
  4.    Author   : Jan van den Baard
  5.  *-----------------------------------------------------------------------*/
  6. #ifndef TOOL_H
  7. #define TOOL_H  1
  8.  
  9. #ifndef EXEC_TYPES_H
  10. #include <exec/types.h>
  11. #endif
  12. #ifndef EXEC_MEMORY_H
  13. #include <exec/memory.h>
  14. #endif
  15. #ifndef EXEC_PORTS_H
  16. #include <exec/ports.h>
  17. #endif
  18. #ifndef EXEC_IO_H
  19. #include <exec/io.h>
  20. #endif
  21. #ifndef DEVICES_TIMER_H
  22. #include <devices/timer.h>
  23. #endif
  24. #ifndef EXEC_LIBRARIES_H
  25. #include <exec/libraries.h>
  26. #endif
  27. #ifndef LIBRARIES_DOS_H
  28. #include <libraries/dos.h>
  29. #endif
  30. #ifndef LIBRARIES_DOSEXTENS_H
  31. #include <libraries/dosextens.h>
  32. #endif
  33. #ifndef INTUITION_INTUITION_H
  34. #include <intuition/intuition.h>
  35. #endif
  36. #ifndef INTUITION_INTUITIONBASE_H
  37. #include <intuition/intuitionbase.h>
  38. #endif
  39.  
  40. struct ToolBase
  41.  {
  42.   struct Library        LibNode;
  43.   struct ExecBae       *SysBase;
  44.   struct DosLibrary    *DOSBase;
  45.   struct IntuitionBase *IntuitionBase;
  46.   struct GfxBase       *GfxBase;
  47.  
  48.   /* from here on it's private USE AT YOUR OWN RISK !!! */
  49.  
  50.   LONG                  SegList;
  51.  };
  52.  
  53. #define TOOL_VERSION    8
  54. #define TOOL_REVISION   1
  55.  
  56. struct TimeDelay
  57.  {
  58.   struct MsgPort     *td_UserPort;
  59.   struct MsgPort     *td_ReplyPort;
  60.   struct timerequest *td_TimeRequest;
  61.  };
  62.  
  63. #define LONGALLIGN(s)   (((s)+7)&-8)
  64.  
  65. /*
  66.  *   The MemoryBlock, MemoryItem, BlockList and ItemList structures
  67.  *   are PRIVATE structures used by the memory routines of the library.
  68.  *   DO NOT SCREW ARROUND WITH THESE STRUCTURES BECAUSE THEY MIGHT CHANGE
  69.  *   IN FUTURE RELEASES OF THE LIBRARY !!!!!!!!!
  70.  */
  71. struct MemoryBlock
  72. {
  73.  struct MemoryBlock *mb_Next;
  74.  struct MemoryBlock *mb_Previous;
  75.  ULONG               mb_Requirements;
  76.  ULONG               mb_BytesUsed;
  77. };
  78.  
  79. struct MemoryItem
  80. {
  81.  struct MemoryItem  *mi_Next;
  82.  struct MemoryItem  *mi_Previous;
  83.  struct MemoryBlock *mi_Block;
  84.  ULONG               mi_Size;
  85. };
  86.  
  87. struct BlockList
  88. {
  89.  struct MemoryBlock *bl_First;
  90.  struct MemoryBlock *bl_End;
  91.  struct MemoryBlock *bl_Last;
  92. };
  93.  
  94. struct ItemList
  95. {
  96.  struct MemoryItem *il_First;
  97.  struct MemoryItem *il_End;
  98.  struct MemoryItem *il_Last;
  99. };
  100.  
  101. /*
  102.  * YOU MAY ONLY USE THIS STRUCTURE TO PASS TO THE MEMORY ROUTINES OF
  103.  * THE LIBRARY. DO NOT CHANGE THE CONTENTS OF A MEMORYCHAIN STRUCTURE
  104.  * IN YOUR PROGRAMS BECAUSE THIS STRUCTURE MAY CHANGE IN FUTURE RELEASES
  105.  * OF THE LIBRARY !!!!!!!!!
  106.  */
  107. struct MemoryChain
  108. {
  109.  struct BlockList   mc_Blocks;
  110.  struct ItemList    mc_Items;
  111.  ULONG              mc_BlockSize;
  112. };
  113.  
  114. #define MINDATE     32
  115. #define ALL         0
  116. #define ONLY_DAY    1
  117. #define ONLY_DATE   2
  118. #define ONLY_TIME   3
  119.  
  120. #define NO_CASE     0
  121. #define CASE        1
  122.  
  123. #define ENTRY_FILE      0
  124. #define ENTRY_DIR       1
  125. #define ENTRY_DEV       2
  126.  
  127. #define DIRBLOCK        (5 * 1024)
  128.  
  129. struct EntryInfo
  130. {
  131.     struct EntryInfo    *ei_Next;
  132.     struct EntryInfo    *ei_Previous;
  133.     USHORT               ei_Type;
  134.     UBYTE                ei_Name[32];
  135.     LONG                 ei_SizeBytes;
  136.     LONG                 ei_SizeBlocks;
  137.     LONG                 ei_ProtectionBits;
  138.     struct DateStamp     ei_Date;
  139. };
  140.  
  141. struct Directory
  142. {
  143.     struct EntryInfo     *dr_First;
  144.     struct EntryInfo     *dr_End;
  145.     struct EntryInfo     *dr_Last;
  146.     struct FileInfoBlock *dr_InfoBlock;
  147.     BPTR                 dr_Lock;
  148.     ULONG                dr_NumEntries;
  149.     struct MemoryChain   dr_DirMem;
  150. };
  151.  
  152. #define FREQ_OK             0
  153. #define FREQ_CANT_OPEN      1
  154. #define FREQ_FILE_ERROR     2
  155. #define FREQ_CANCELED       3
  156.  
  157. struct FileRequester
  158. {
  159.  char             *fr_HeadLine;
  160.  char             *fr_FileName;
  161.  char             *fr_DirName;
  162.  char             *fr_DontShow;
  163.  USHORT            fr_LeftEdge;
  164.  USHORT            fr_TopEdge;
  165.  struct Window    *fr_Caller;
  166.  struct Screen    *fr_Screen;
  167.  struct Directory *fr_Directory;
  168.  USHORT            fr_Flags;
  169.  USHORT            fr_Colors[4];
  170.  BPTR              fr_Handle;
  171.  LONG              fr_Reserved;
  172. };
  173.  
  174. #define FREQ_WIDTH      260
  175. #define FREQ_HEIGHT     140
  176.  
  177. #define FR_NoPreserve      1
  178. #define FR_NoDevs          2
  179. #define FR_NoSort          4
  180. #define FR_CustColor       8
  181. #define FR_ReturnOld       16
  182. #define FR_ReturnNew       32
  183. #define FR_ReturnReadWrite 64
  184. #define FR_NoInfo          128
  185. #define FR_ReturnVoid      0
  186.  
  187. struct MsgPort *CreatePort(const char *, long);
  188. void DeletePort(struct MsgPort *);
  189. struct IORequest *CreateExtIO(struct MsgPort *, long);
  190. void DeleteExtIO(struct IORequest *);
  191. struct IOStdReq *CreateStdIO(struct MsgPort *);
  192. void DeleteStdIO(struct IOStdReq *);
  193. struct TimeDelay *CreateTimeDelay(struct MsgPort *, long, long);
  194. long DoTimeDelay(struct TimeDelay *);
  195. void DeleteTimeDelay(struct TimeDelay *);
  196. void QuickSort(char *, long, long, long *);
  197. void SwapMem(char *, char *, long);
  198. long TestBits(long , long);
  199. void SelectGadget(struct Window *, struct Gadget *, struct Requester *);
  200. void DeSelectGadget(struct Window *, struct Gadget *, struct Requester *);
  201. void MutualExclude(struct Window *, struct Gadget *, struct Gadget *, struct Requester *);
  202. void MutualInclude(struct Window *, struct Gadget *, struct Gadget *, struct Requester *);
  203. void EraseGadget(struct Window *, struct Gadget *, struct Requester *);
  204. void GadgetOn(struct Window *, struct Gadget *, struct Requester *);
  205. void GadgetOff(struct Window *, struct Gadget *, struct Requester *);
  206. long SelectTest(struct Gadget *);
  207. void ShadowGadget(struct Window *, struct Gadget *, struct Requester *, long);
  208. void OnGList(struct Window *, struct Gadget *, struct Requester *, long);
  209. void OffGList(struct Window *, struct Gadget *, struct Requester *, long);
  210. void SelectGList(struct Window *, struct Gadget *, struct Requester *, long);
  211. void DeSelectGList(struct Window *, struct Gadget *, struct Requester *, long);
  212. void ShadowGList(struct Window *, struct Gadget *, struct Requester *, long, long);
  213. void EraseGList(struct Window *, struct Gadget *, struct Requester *, long);
  214. void InitMemoryChain(struct MemoryChain *, long);
  215. void *AllocItem(struct MemoryChain *, long, long);
  216. void FreeItem(struct MemoryChain *, void *, long);
  217. void FreeMemoryChain(struct MemoryChain *);
  218. void Format(char *, char *f, ...);
  219. long WriteFormat(BPTR, char *, ...);
  220. long MatchPattern(char *, char *, long);
  221. long Isolate(char *, char *);
  222. void BstrToCstr(BPTR *, char *);
  223. long GetDate(struct DateStamp *, char *, long);
  224. long OpenDir(struct Directory *, char *);
  225. struct EntryInfo *GetEntry(struct Directory *);
  226. void CloseDir(struct Directory *);
  227. void FreeDir(struct Directory *);
  228. char *IoErrToStr();
  229. struct FileRequester *AllocFreq();
  230. void FreeFreq(struct FileRequester *);
  231. long FileRequest(struct FileRequester *);
  232. long FormatText(struct RastPort *, char *, ...);
  233. #ifndef NO_PRAGMAS
  234. #include <tool_pragmas.h>
  235. #endif
  236. #endif
  237.