OSDN Git Service

c741ac5122b74003351a60db6fb793ba3f1ab15b
[pf3gnuchains/gcc-fork.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 /* As a special exception, if you link this library with other files,
21    some of which are compiled with GCC, to produce an executable,
22    this library does not by itself cause the resulting executable
23    to be covered by the GNU General Public License.
24    This exception does not however invalidate any other reasons why
25    the executable file might be covered by the GNU General Public License.  */
26
27 #ifndef __rts_h_
28 #define __rts_h_
29
30 typedef enum
31 {
32   UNUSED,
33   Process,
34   Signal,
35   Buffer,
36   Event,
37   Synonym,
38   Exception,
39   LAST_AND_UNUSED,
40 } TaskingEnum;
41
42 typedef void (*EntryPoint) ();
43
44 typedef struct
45 {
46   char       *name;
47   short      *value;
48   int         value_defined;
49   EntryPoint  entry;
50   unsigned char /*TaskingEnum*/ type;
51 } TaskingStruct;
52
53 /* how an INSTANCE is implemented */
54 typedef struct
55 {
56   short ptype;
57   short pcopy;
58 } INSTANCE;
59
60 /* interface to underlaying os */
61 typedef enum
62 {
63   wait_wait,
64   wait_buffer_send,
65   wait_buffer_receive,
66   wait_buffer_free,
67   wait_event_delay,
68   wait_event_free,
69 } Delay_Reason;
70
71 extern INSTANCE __whoami ();
72 extern void *__xmalloc_ ();
73
74 #define THIS  __whoami()
75 /* for easier changing to something different,
76    i.e. allocate_memory */
77 #define MALLOC(ADDR,SIZE)  ADDR = __xmalloc_(SIZE)
78 #define FREE(ADDR)         free (ADDR)
79
80 /* definitions for EVENTS */
81 typedef struct EVENTQUEUE
82 {
83   struct EVENTQUEUE    *forward;       /* next in the list */
84   struct EVENTQUEUE   **listhead;      /* pointer to EVENT location */
85   int                   priority;      /* prio for DELAY or DELAY CASE */
86   INSTANCE              this;          /* specify the instance is delayed */
87   struct EVENTQUEUE    *startlist;     /* start of the list */
88   struct EVENTQUEUE    *chain;         /* list of all events in an DELAY CASE */
89   int                   is_continued;  /* indicates a continue action on that event */
90   INSTANCE              who_continued; /* indicates who continued */
91 } Event_Queue;
92
93 typedef struct
94 {
95   Event_Queue     **ev;
96   unsigned long     maxqueuelength;
97 } Event_Descr;
98
99 /* definitions for BUFFERS */
100 struct BUFFERQUEUE;
101
102 typedef struct BUFFER_WAIT_QUEUE
103 {
104   struct BUFFER_WAIT_QUEUE   *forward;
105   struct BUFFERQUEUE        **bufferaddr;
106   INSTANCE                    this;
107   struct BUFFER_WAIT_QUEUE   *startlist;
108   struct BUFFER_WAIT_QUEUE   *chain;
109   int                         is_sent;
110   INSTANCE                    who_sent;     /* instance which have
111                                                send a buffer */
112   unsigned long               datalen;
113   void                       *dataptr;
114 } Buffer_Wait_Queue;
115
116 typedef struct BUFFER_SEND_QUEUE
117 {
118   struct BUFFER_SEND_QUEUE   *forward;
119   int                         priority;
120   INSTANCE                    this;
121   int                         is_delayed;
122   unsigned long               datalen;
123   void                       *dataptr;
124 } Buffer_Send_Queue;
125
126 typedef struct BUFFERQUEUE
127 {
128   Buffer_Wait_Queue    *waitqueue;
129   unsigned long         waitqueuelength;
130   Buffer_Send_Queue    *sendqueue;
131   unsigned long         sendqueuelength;
132 } Buffer_Queue;
133
134 typedef struct
135 {
136   Buffer_Queue    **buf;
137   unsigned long     maxqueuelength;
138 } Buffer_Descr;
139
140 /* descriptor for data */
141 typedef struct
142 {
143   void         *ptr;
144   int           length;
145 } Data_Descr;
146
147 /* time format runtime delivers */
148 typedef struct
149 {
150     unsigned long       secs;
151     unsigned long       nanosecs;
152 } RtsTime;
153
154 extern void __rtstime (RtsTime *t);
155 extern int __delay_this (Delay_Reason reason, RtsTime *t, char *file, int lineno);
156 extern void __continue_that (INSTANCE ins, int prio, char *file, int lineno);
157
158 #endif /* __rts_h_ */