home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 454.lha / Din_v1.0 / Include / libraries / din.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-06  |  5.1 KB  |  189 lines

  1. #ifndef LIBRARIES_DIN_H
  2. #define LIBRARIES_DIN_H 1
  3. /*
  4. **  $Filename: libraries/din.h $
  5. **  $Release: 1.0 revision 3 $
  6. **  $Revision: 3 $
  7. **  $Date: 10 Nov 90 $
  8. **
  9. **    Data INterface specifications
  10. **
  11. **  © Copyright 1990 Jorrit Tyberghein.
  12. **    All Right reserved
  13. */
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include <exec/types.h>
  17. #endif
  18.  
  19. #ifndef EXEC_NODES_H
  20. #include <exec/nodes.h>
  21. #endif
  22.  
  23. #ifndef EXEC_LISTS_H
  24. #include <exec/lists.h>
  25. #endif
  26.  
  27. #ifndef EXEC_SEMAPHORES_H
  28. #include <exec/semaphores.h>
  29. #endif
  30.  
  31. #ifndef EXEC_LIBRARIES_H
  32. #include <exec/libraries.h>
  33. #endif
  34.  
  35. #ifndef GRAPHICS_RASTPORT_H
  36. #include <graphics/rastport.h>
  37. #endif
  38.  
  39. #define DINNAME        "din.library"
  40. #define DINVERSION    36L
  41. #define DINREVISION    3L
  42.  
  43. /*
  44.  * DinBase. This structure is completely private. Don't depend on
  45.  * anything in this structure.
  46.  * You may read the ObjectList to supply the user with a DinObject
  47.  * directory, but make sure that you use LockDinBase before you
  48.  * start reading.
  49.  */
  50. struct DinBase
  51.   {
  52.     struct Library Library;
  53.     UBYTE Flags,pad0;
  54.     struct List ObjectList;
  55.     struct SignalSemaphore Lock;
  56.     ULONG SegList;
  57.   };
  58.  
  59.  
  60. /*
  61.  * The DinObject. ALL fields in this structure are private, unless stated
  62.  * otherwise. Private fields are subject to changes in future versions.
  63.  * Do NOT depend on the size of this structure.
  64.  * It is safer that you ask for a copy of this structure with InfoDinObject
  65.  */
  66. struct DinObject
  67.   {
  68.     struct Node Node;
  69.     UWORD Type;             /* READ ONLY. see below */
  70.     ULONG Flags;            /* READ ONLY. see below */
  71.     APTR PhysObject;        /* READ ONLY. Pointer to physical object */
  72.                             /* corresponding with this DinObject. */
  73.     ULONG Size;             /* READ ONLY. Size of PhysObject */
  74.     struct Task *Owner;     /* READ ONLY. NULL means no owner */
  75.     struct SignalSemaphore Lock;
  76.     struct SignalSemaphore rwLock;
  77.     struct SignalSemaphore delLock;
  78.     struct List LinkList;
  79.   };
  80.  
  81. /*
  82.  * Copy of the DinObject structure obtained by InfoDinObject.
  83.  * Do NOT depend on the size of this structure, use FreeInfoDinObject to free it.
  84.  */
  85. struct InfoDinObject
  86.   {
  87.     struct Node Node;
  88.     UWORD Type;
  89.     ULONG Flags;
  90.     APTR PhysObject;
  91.     ULONG Size;
  92.     struct Task *Owner;
  93.   };
  94.  
  95.  
  96. /*
  97.  * DinObject types.
  98.  */
  99. #define OBJECTDUMMY     0   /* For a dummy object */
  100. #define OBJECTLIST      1   /* Not implemented yet */
  101. #define OBJECTTEXT      2   /* DinObject represents a number of text lines */
  102. #define OBJECTDATA      3   /* Binary data, no interpretation */
  103. #define OBJECTIMAGE     4   /* Graphical object */
  104. #define OBJECTSAMPLE    5   /* Sound sample object, not implemented yet */
  105. #define OBJECTACK       6   /* Acknowledgement object */
  106.  
  107. /*
  108.  * Flags for DinObject
  109.  */
  110. #define OB_READONLY     1   /* Object is readonly. Only the owner can write */
  111.                             /* on it */
  112. #define OB_DISABLED     2   /* This object is not available for use. All links */
  113.                             /* will fail */
  114. #define OB_READY        4   /* Object is ready to use. All links will succeed */
  115.                             /* and previous waiting links will be activated */
  116. #define OB_DUMMY        8   /* Private */
  117. #define OB_DELETED      16  /* Object is deleted */
  118.  
  119.  
  120. /*
  121.  * The Link structure. ALL fields in this structure are private, unless stated
  122.  * otherwise.
  123.  * Do NOT depend on the size of this structure.
  124.  */
  125. struct DinLink
  126.   {
  127.     struct Node Node;
  128.     struct DinObject *Ob;   /* READ ONLY */
  129.     ULONG Flags;            /* READ ONLY. see below */
  130.     struct Task *Task;
  131.     BYTE SigBit;            /* READ ONLY. Use this to wait for notify signals */
  132.     UBYTE pad0;
  133.   };
  134.  
  135. /*
  136.  * DinLink flags
  137.  */
  138. #define LNK_READY       1   /* Private */
  139. #define LNK_WAITING4OB  2   /* If set the object does not exist yet */
  140. #define LNK_NOTIFYBITS  124
  141. #define LNK_KILLED      4   /* When a signal arrives, you must test this flag */
  142.                             /* to see if the object is removed. */
  143. #define LNK_CHANGE      8   /* When a signal arrives, you can test this flag */
  144.                             /* to see if the object has changed */
  145. #define LNK_NEW         16  /* Our object has just arrived */
  146. #define LNK_ENABLE      32  /* The object is enabled */
  147. #define LNK_DISABLE     64  /* The object is disabled */
  148.  
  149.  
  150. /*
  151.  * Physical object for one line of text. This structure is used in ObjectText
  152.  */
  153. struct ObjectLine
  154.   {
  155.     struct ObjectLine *Next;
  156.     char FirstByte;         /* First byte of string, other bytes follow. */
  157.                             /* String is NULL-terminated */
  158.   };
  159.  
  160. /*
  161.  * The physical text object. This structure is public
  162.  */
  163. struct ObjectText
  164.   {
  165.     ULONG Lines;            /* The number of lines in this object */
  166.     struct ObjectLine *FirstLine;
  167.   };
  168.  
  169. /*
  170.  * Physical object for simple data.
  171.  */
  172. struct ObjectData
  173.   {
  174.     ULONG Size;             /* Size of data */
  175.     APTR Data;              /* Pointer to data */
  176.   };
  177.  
  178. /*
  179.  * Physical object for a graphical image. This structure is public
  180.  */
  181. struct ObjectImage
  182.   {
  183.     struct RastPort *rp;    /* RPort for your image */
  184.     struct Rectangle Rect;  /* This rectangle defines a rectangle in the */
  185.                             /* RPort for your image */
  186.   };
  187.  
  188. #endif
  189.