home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / lang / odinlib2_7.lzh / ODIN.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-10-16  |  3.6 KB  |  138 lines

  1. /* odin.h */
  2. /* headerfile for odin.library. V2.7 2-Sep-90 */
  3.  
  4. #ifndef ODIN_H
  5. #define ODIN_H 1
  6.  
  7. #ifndef EXEC_NODES_H
  8. #include "exec/nodes.h"
  9. #endif
  10. #ifndef EXEC_LISTS_H
  11. #include "exec/lists.h"
  12. #endif
  13. #ifndef EXEC_PORTS_H
  14. #include "exec/ports.h"
  15. #endif
  16. #ifndef EXEC_SEMAPHORES_H
  17. #include "exec/semaphores.h"
  18. #endif
  19. #ifndef EXEC_LIBRARIES_H
  20. #include "exec/libraries.h"
  21. #endif
  22. #ifndef EXEC_TASKS_H
  23. #include "exec/tasks.h"
  24. #endif
  25. #ifndef LIBRARIES_DOSEXTENS_H
  26. #include "libraries/dosextens.h"
  27. #endif
  28.  
  29. #define ODINNAME "odin.library"
  30.  
  31. struct OdinBase {
  32.     struct Library        odin_LibNode;
  33.     BPTR            odin_SegList;
  34.     UBYTE            odin_Flags;
  35.     /* You MUST ObtainSemaphore() this before using 
  36.      * the WaitList!
  37.      */ 
  38.     struct SignalSemaphore    odin_Sem;    /* signal semaphore */
  39.     struct MinList        odin_WaitList;
  40. };
  41.  
  42. #define odin_Sizeof sizeof(struct OdinBase)
  43.  
  44. /* prefix for envelopes */
  45.  
  46. typedef struct _Env {
  47.     struct MinNode    e_link;        /* first a link for use in e-space */
  48.     STRPTR        e_name;        /* the name of this envelope */
  49.     ULONG        e_len;        /* bytelength of whole envelope */
  50.     struct _Env *    (*e_copyfunc)();/* opt. C-function for copying */
  51.     struct _Env *    (*e_proc)();    /* C-func. to call in Eval() */
  52. } Envelope;
  53.  
  54. #define e_sizeof (ULONG)sizeof(Envelope)
  55.  
  56. /* wait-structure used in WaitList. Used internally */
  57.  
  58. struct WaitStruct {
  59.     struct MinNode    ow_link;
  60.     Envelope    *ow_envelope;
  61.     struct Task    *ow_waittask;
  62.     UBYTE        ow_sigbit;
  63.     BYTE        ow_type;
  64. };
  65.  
  66. #define ow_replyport ow_waittask
  67. #define ow_sizeof (ULONG)sizeof(struct WaitStruct)
  68.  
  69. /* ow_types (used internally) */
  70.  
  71. #define RD_REQUEST 0
  72. #define IN_REQUEST 1
  73. #define ASYNCIN_REQUEST 2
  74. #define ASYNCRD_REQUEST 3
  75.  
  76. /* the et parameter to Eval() */
  77.  
  78. #define EVAL_PROCESS (long)0
  79. #define EVAL_TASK    (long)1
  80.  
  81. /* the struct put to a MsgPort by AsyncIn/Rd */
  82.  
  83. struct EnvMsg {
  84.     struct Message    em_msg;
  85.     Envelope    *em_env;    /* ptr to the returned envelope */
  86. };
  87.  
  88. #ifndef ANSI
  89. /* function returntypes */
  90. #define NoCopyFunc 0L
  91. extern Envelope *In(),*Rd(),*Rdp(),*Inp();
  92. extern void Out();
  93. extern BOOL CopyOut();
  94. extern struct Task *Eval();
  95. extern struct Task *StartTask();
  96. extern struct Process *StartProcess();
  97. extern Envelope *AwaitNamedEnvelope();
  98. extern Envelope *PollNamedEnvelope();
  99. extern BOOL OutEmptyEnvelope();
  100. extern Envelope *CreateEnvelope(),*InitEnvelope();
  101. extern void DisposeEnvelope();
  102. /* version 2 additions */
  103. extern Envelope *TimedIn(), *TimedRd();
  104. extern void AsyncIn(), AsyncRd();
  105. extern Envelope *AwaitTimed();
  106. extern void AsyncRequest();
  107. extern char *UniqueName();
  108.  
  109. #else
  110. /* ANSI function-prototypes, worked with PDC 3.33 */
  111. #define NoCopyFunc (Envelope *(*cf)())0L
  112. extern Envelope *In(Envelope *);
  113. extern Envelope *Rd(Envelope *);
  114. extern Envelope *Rdp(Envelope *);
  115. extern Envelope *Inp(Envelope *);
  116. extern void Out(Envelope *);
  117. extern BOOL CopyOut(Envelope *);
  118. extern struct Task *Eval(Envelope *,long,ULONG,long);
  119. extern struct Task *StartTask(void(),char *,long,long);
  120. extern struct Process *StartProcess(void(),char *,long,long);
  121. extern Envelope *AwaitNamedEnvelope(char *);
  122. extern Envelope *PollNamedEnvelope(char *);
  123. extern BOOL OutEmptyEnvelope(char *);
  124. extern Envelope *CreateEnvelope(char *,ULONG);
  125. extern Envelope *InitEnvelope(Envelope *,char *,ULONG,Envelope *(*copyfunc)());
  126. extern void DisposeEnvelope(Envelope *);
  127. /* version 2 additions */
  128. extern Envelope *TimedIn(Envelope *,ULONG,ULONG);
  129. extern Envelope *TimedRd(Envelope *,ULONG,ULONG);
  130. extern void AsyncIn(Envelope *,struct MsgPort *);
  131. extern void AsyncRd(Envelope *,struct MsgPort *);
  132. extern Envelope *AwaitTimed(char *,ULONG,ULONG);
  133. extern void AsyncRequest(char *,struct MsgPort *);
  134. extern char *UniqueName(char *);
  135. #endif /* ANSI */
  136.  
  137. #endif /* ODIN_H */
  138.