home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 073.lha / FileIO / fileio.h < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-02  |  6.2 KB  |  214 lines

  1.  
  2. #ifndef FILEIO_H
  3. #define FILEIO_H
  4.  
  5.  
  6. /* *** fileio.h *************************************************************
  7.  *
  8.  * Amiga Programmers' Suite  --  File IO Include File
  9.  *     from Book 1 of the Amiga Programmers' Suite by RJ Mical
  10.  *
  11.  * Copyright (C) 1986, =Robert J. Mical=
  12.  * All Rights Reserved.
  13.  *
  14.  * Created for Amiga developers.
  15.  * Any or all of this code can be used in any program as long as this
  16.  * entire notice is retained, ok?  Thanks.
  17.  *
  18.  * HISTORY      NAME            DESCRIPTION
  19.  * -----------  --------------  --------------------------------------------
  20.  * 12 Aug 86    RJ >:-{)*       Prepare (clean house) for release
  21.  * 14 Feb 86    =RJ Mical=      Created this file.
  22.  *
  23.  * *********************************************************************** */
  24.  
  25.  
  26. #include <prosuite\prosuite.h>
  27. #include <prosuite\pointers.h>
  28. #include <prosuite\reqsupp.h>
  29. #include "alerts.h"
  30.  
  31.  
  32. /* === General FileIO Declarations ======================================= */
  33. #define MAX_NAME_LENGTH         64      /* Includes terminating NULL */
  34. #define MAX_TOOLTYPE_LENGTH 80      /* Includes terminating NULL */
  35. #define VISIBLE_SELECT_LENGTH   16      /* Buffer for visible chars + '\0' */
  36.  
  37. /* The WBENCH_CODE definition is used to define whether to include 
  38.  * or not include the Workbench-style .info file pattern matching code.
  39.  * If you intend on using Workbench pattern matching, or if you are 
  40.  * going to give the user the option, define this constant.
  41.  * This makes sure that the Workbench-style code is in included in the 
  42.  * FileIO files when they are compiled.
  43.  * To attempt to match Workbench patterns at run time, you must set 
  44.  * the WBENCH_MATCH flag in your FileIOSupport structure.
  45.  * 
  46.  * If you aren't interested in Workbench-style pattern matching 
  47.  * and are interested in saving about 500 bytes of code size, 
  48.  * comment out the WBENCH_CODE definition.
  49.  */
  50. #define WBENCH_CODE
  51.  
  52.  
  53.  
  54. /* === FileIO Support Structure ========================================== */
  55. struct FileIOSupport
  56.     {
  57.     SHORT Flags;
  58.  
  59.     UBYTE *ReqTitle;    /* The text that will be the requester's title */
  60.  
  61.     /* After a successful call to GetFileIOName(), these fields will have
  62.      * the names selected by the user.  You should never have to initialize
  63.      * these fields, only read from them, though initializing them won't hurt.
  64.      */
  65.     UBYTE FileName[MAX_NAME_LENGTH];
  66.     UBYTE DrawerName[MAX_NAME_LENGTH];
  67.     UBYTE DiskName[MAX_NAME_LENGTH];
  68.  
  69.     /* If the LOCK_GOTTEN flag is set, the lock can be found here. */
  70.     ULONG DOSLock;
  71.  
  72.     SHORT NameCount;
  73.     SHORT NameStart;
  74.     SHORT CurrentPick;
  75.     struct Remember *NameKey;
  76.  
  77.     SHORT VolumeIndex;
  78.     SHORT VolumeCount;
  79.     struct Remember *VolumeKey;
  80.  
  81.     SHORT DiskObjectType;
  82.     UBYTE ToolType[MAX_TOOLTYPE_LENGTH];
  83.  
  84.     LONG UserData;      /* Use this for anything you want */
  85.     };
  86.  
  87.  
  88. /* === User FileIO Flag Definitions === */
  89. #define GOOD_FILENAMES      0x0001  /* Clear this if disk has changed */
  90. #define USE_VOLUME_NAMES    0x0002  /* Use volume rather than device names */
  91. #define DISK_HAS_CHANGED    0x0004  /* Disk changed during GetFileIOName() */
  92. #define DOUBLECLICK_OFF     0x0008  /* Inhibit double-clicking */
  93. #define WBENCH_MATCH            0x0010  /* If set check .info files only */
  94. #define MATCH_OBJECTTYPE    0x0020  /* If set with .info check ObjectType */
  95. #define MATCH_TOOLTYPE      0x0040  /* If set with .info check ToolType */
  96.  
  97. /* === System FileIO Flag Definitions === */
  98. #define LOCK_GOTTEN         0x1000  /* Got lock, need to unlock */
  99.  
  100.  
  101.  
  102. /* === Name Table Entry Flags =========================================== */
  103. /* The Name Table Entry consists of the text, null-terminated, followed by 
  104.  * a byte of flag definitions.
  105.  */
  106. /* === Flags Definitions === */
  107. #define NAMED_DIRECTORY 0x01
  108. #define NAMED_PREVIOUS  0x02
  109.  
  110. #define DIR_TEXT_SIZE   3   /* Number of characters for "directory" mark */
  111.  
  112.  
  113.  
  114. /* === OpenRequester ===================================================== */
  115. #define OPENGADGET_CANCEL       0x7FA0
  116. #define OPENGADGET_OK           0x7FA1
  117. #define OPENGADGET_NAMETEXT     0x7FA2
  118. #define OPENGADGET_DRAWERTEXT   0x7FA3
  119. #define OPENGADGET_DISKTEXT     0x7FA4
  120. #define OPENGADGET_SELECTNAME   0x7FA5
  121. #define OPENGADGET_UPGADGET     0x7FA6
  122. #define OPENGADGET_DOWNGADGET   0x7FA7
  123. #define OPENGADGET_PROPGADGET   0x7FA8
  124. #define OPENGADGET_NEXTDISK     0x7FA9
  125. #define OPENGADGET_BACKDROP     0x7FAA
  126.  
  127. #define NAME_ENTRY_COUNT    6   /* These many names in the SelectName box */
  128.  
  129. #define OPEN_NEXTDISK_COUNT 2
  130.  
  131. #define REQTITLE_HEIGHT         8
  132.  
  133. #define OPEN_LEFT               8
  134. #define OPEN_TOP                15
  135. #define OPEN_WIDTH              286
  136. #define OPEN_HEIGHT             (110 + REQTITLE_HEIGHT)
  137. #define OPEN_LINEHEIGHT         10
  138.  
  139. #define OPENSELECT_LEFT         8
  140. #define OPENSELECT_TOP          (15 + REQTITLE_HEIGHT)
  141. #define OPENSELECT_WIDTH        122
  142. #define OPENSELECT_HEIGHT       60
  143.  
  144. #define OPENPROP_MAXHEIGHT      30
  145. #define OPENPROP_TOPHEIGHT      2
  146. #define OPENPROP_BOTTOMHEIGHT   6
  147. #define OPENPROP_MINHEIGHT      8
  148.  
  149.  
  150.  
  151.  
  152. /* === Function Declarations (in alphabetical order) ===================== */
  153. UBYTE *AllocMem();
  154. UBYTE *AllocRemember();
  155.  
  156. struct MsgPort *CreatePort();
  157. UBYTE *CurrentVolumeName();
  158.  
  159. BOOL DirectoryName();
  160. BOOL DoubleClick();
  161.  
  162. UBYTE *FindSuffix();
  163. SHORT FriendlyInfoType();
  164.  
  165. struct DiskObject *GetDiskObject();
  166. struct FileIOSupport *GetFileIOSupport();
  167. BOOL GetFileIOName();
  168. struct IntuiMessage *GetMsg();
  169.  
  170. SHORT HandleSelect();
  171.  
  172. SHORT MakeEntry();
  173. BOOL MatchToolValue();
  174. BOOL MessageInterrupt();
  175.  
  176. UBYTE *OpenLibrary();
  177. struct Screen *OpenScreen();
  178. struct Window *OpenWindow();
  179.  
  180. SHORT RemoveGadget();
  181. BOOL Request();
  182.  
  183.  
  184. /* === String Functions === */
  185. SHORT CompareUpperStrings();
  186. VOID ConcatString();
  187. VOID CopyString();
  188.  
  189. UBYTE *FindSuffix();
  190.  
  191. SHORT IndexString();
  192.  
  193. SHORT StringLength();
  194. BOOL StringsEqual();
  195. UBYTE *StripLeadingSpace();
  196. UBYTE *StripOuterSpace();
  197.  
  198.  
  199.  
  200. /* === And Finally, eglobal inclusion ==================================== */
  201. /* If this is a FileIO source file (as compared with a normal source 
  202.  * from your own program), consider including eglobal.c.
  203.  */
  204. #ifdef FILEIO_SOURCEFILE
  205. #ifndef EGLOBAL_CANCEL
  206. #include "eglobal.c"
  207. #endif /* ... end of EGLOBAL_CANCEL conditional */
  208. #endif /* ... end of FILEIO_SOURCEFILE conditional */
  209.  
  210.  
  211.  
  212. #endif /* of FILEIO_H */
  213.  
  214.