* optabs.c (init_traps): Register trap_rtx as a GC root.
[official-gcc.git] / libchill / rts.h
blob3a9a26cb2ac9df76118116dcf33c60edad995472
1 /* GNU CHILL compiler regression test file
2 Copyright (C) 1992, 1993 Free Software Foundation, Inc.
4 This file is part of GNU CC.
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.
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.
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, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, if you link this library with other files,
22 some of which are compiled with GCC, to produce an executable,
23 this library does not by itself cause the resulting executable
24 to be covered by the GNU General Public License.
25 This exception does not however invalidate any other reasons why
26 the executable file might be covered by the GNU General Public License. */
28 #ifndef __rts_h_
29 #define __rts_h_
31 typedef enum
33 UNUSED,
34 Process,
35 Signal,
36 Buffer,
37 Event,
38 Synonym,
39 Exception,
40 LAST_AND_UNUSED,
41 } TaskingEnum;
43 typedef void (*EntryPoint) ();
45 typedef struct
47 char *name;
48 short *value;
49 int value_defined;
50 EntryPoint entry;
51 unsigned char /*TaskingEnum*/ type;
52 } TaskingStruct;
54 /* how an INSTANCE is implemented */
55 typedef struct
57 short ptype;
58 short pcopy;
59 } INSTANCE;
61 /* interface to underlaying os */
62 typedef enum
64 wait_wait,
65 wait_buffer_send,
66 wait_buffer_receive,
67 wait_buffer_free,
68 wait_event_delay,
69 wait_event_free,
70 } Delay_Reason;
72 extern INSTANCE __whoami ();
73 extern void *__xmalloc_ ();
75 #define THIS __whoami()
76 /* for easier changing to something different,
77 i.e. allocate_memory */
78 #define MALLOC(ADDR,SIZE) ADDR = __xmalloc_(SIZE)
79 #define FREE(ADDR) free (ADDR)
81 /* definitions for EVENTS */
82 typedef struct EVENTQUEUE
84 struct EVENTQUEUE *forward; /* next in the list */
85 struct EVENTQUEUE **listhead; /* pointer to EVENT location */
86 int priority; /* prio for DELAY or DELAY CASE */
87 INSTANCE this; /* specify the instance is delayed */
88 struct EVENTQUEUE *startlist; /* start of the list */
89 struct EVENTQUEUE *chain; /* list of all events in an DELAY CASE */
90 int is_continued; /* indicates a continue action on that event */
91 INSTANCE who_continued; /* indicates who continued */
92 } Event_Queue;
94 typedef struct
96 Event_Queue **ev;
97 unsigned long maxqueuelength;
98 } Event_Descr;
100 /* definitions for BUFFERS */
101 struct BUFFERQUEUE;
103 typedef struct BUFFER_WAIT_QUEUE
105 struct BUFFER_WAIT_QUEUE *forward;
106 struct BUFFERQUEUE **bufferaddr;
107 INSTANCE this;
108 struct BUFFER_WAIT_QUEUE *startlist;
109 struct BUFFER_WAIT_QUEUE *chain;
110 int is_sent;
111 INSTANCE who_sent; /* instance which have
112 send a buffer */
113 unsigned long datalen;
114 void *dataptr;
115 } Buffer_Wait_Queue;
117 typedef struct BUFFER_SEND_QUEUE
119 struct BUFFER_SEND_QUEUE *forward;
120 int priority;
121 INSTANCE this;
122 int is_delayed;
123 unsigned long datalen;
124 void *dataptr;
125 } Buffer_Send_Queue;
127 typedef struct BUFFERQUEUE
129 Buffer_Wait_Queue *waitqueue;
130 unsigned long waitqueuelength;
131 Buffer_Send_Queue *sendqueue;
132 unsigned long sendqueuelength;
133 } Buffer_Queue;
135 typedef struct
137 Buffer_Queue **buf;
138 unsigned long maxqueuelength;
139 } Buffer_Descr;
141 /* descriptor for data */
142 typedef struct
144 void *ptr;
145 int length;
146 } Data_Descr;
148 /* time format runtime delivers */
149 typedef struct
151 unsigned long secs;
152 unsigned long nanosecs;
153 } RtsTime;
155 extern void __rtstime (RtsTime *t);
156 extern int __delay_this (Delay_Reason reason, RtsTime *t, char *file, int lineno);
157 extern void __continue_that (INSTANCE ins, int prio, char *file, int lineno);
159 #endif /* __rts_h_ */