* rts.h: Update with missing code.
[gcc.git] / libchill / rts.h
1 /* GNU CHILL compiler regression test file
2 Copyright (C) 1992, 1993 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 #ifndef __rts_h_
21 #define __rts_h_
22
23 typedef enum
24 {
25 UNUSED,
26 Process,
27 Signal,
28 Buffer,
29 Event,
30 Synonym,
31 Exception,
32 LAST_AND_UNUSED,
33 } TaskingEnum;
34
35 typedef void (*EntryPoint) ();
36
37 typedef struct
38 {
39 char *name;
40 short *value;
41 int value_defined;
42 EntryPoint entry;
43 unsigned char /*TaskingEnum*/ type;
44 } TaskingStruct;
45
46 /* how an INSTANCE is implemented */
47 typedef struct
48 {
49 short ptype;
50 short pcopy;
51 } INSTANCE;
52
53 /* interface to underlaying os */
54 typedef enum
55 {
56 wait_wait,
57 wait_buffer_send,
58 wait_buffer_receive,
59 wait_buffer_free,
60 wait_event_delay,
61 wait_event_free,
62 } Delay_Reason;
63
64 extern INSTANCE __whoami ();
65 extern void *__xmalloc_ ();
66
67 #define THIS __whoami()
68 /* for easier changing to something different,
69 i.e. allocate_memory */
70 #define MALLOC(ADDR,SIZE) ADDR = __xmalloc_(SIZE)
71 #define FREE(ADDR) free (ADDR)
72
73 /* definitions for EVENTS */
74 typedef struct EVENTQUEUE
75 {
76 struct EVENTQUEUE *forward; /* next in the list */
77 struct EVENTQUEUE **listhead; /* pointer to EVENT location */
78 int priority; /* prio for DELAY or DELAY CASE */
79 INSTANCE this; /* specify the instance is delayed */
80 struct EVENTQUEUE *startlist; /* start of the list */
81 struct EVENTQUEUE *chain; /* list of all events in an DELAY CASE */
82 int is_continued; /* indicates a continue action on that event */
83 INSTANCE who_continued; /* indicates who continued */
84 } Event_Queue;
85
86 typedef struct
87 {
88 Event_Queue **ev;
89 unsigned long maxqueuelength;
90 } Event_Descr;
91
92 /* definitions for BUFFERS */
93 struct BUFFERQUEUE;
94
95 typedef struct BUFFER_WAIT_QUEUE
96 {
97 struct BUFFER_WAIT_QUEUE *forward;
98 struct BUFFERQUEUE **bufferaddr;
99 INSTANCE this;
100 struct BUFFER_WAIT_QUEUE *startlist;
101 struct BUFFER_WAIT_QUEUE *chain;
102 int is_sent;
103 INSTANCE who_sent; /* instance which have
104 send a buffer */
105 unsigned long datalen;
106 void *dataptr;
107 } Buffer_Wait_Queue;
108
109 typedef struct BUFFER_SEND_QUEUE
110 {
111 struct BUFFER_SEND_QUEUE *forward;
112 int priority;
113 INSTANCE this;
114 int is_delayed;
115 unsigned long datalen;
116 void *dataptr;
117 } Buffer_Send_Queue;
118
119 typedef struct BUFFERQUEUE
120 {
121 Buffer_Wait_Queue *waitqueue;
122 unsigned long waitqueuelength;
123 Buffer_Send_Queue *sendqueue;
124 unsigned long sendqueuelength;
125 } Buffer_Queue;
126
127 typedef struct
128 {
129 Buffer_Queue **buf;
130 unsigned long maxqueuelength;
131 } Buffer_Descr;
132
133 /* descriptor for data */
134 typedef struct
135 {
136 void *ptr;
137 int length;
138 } Data_Descr;
139
140 /* time format runtime delivers */
141 typedef struct
142 {
143 unsigned long secs;
144 unsigned long nanosecs;
145 } RtsTime;
146
147 extern void __rtstime (RtsTime *t);
148 extern int __delay_this (Delay_Reason reason, RtsTime *t, char *file, int lineno);
149 extern void __continue_that (INSTANCE ins, int prio, char *file, int lineno);
150
151 #endif /* __rts_h_ */