Pristine Ack-5.5
[Ack-5.5.git] / h / ocm_proc.h
1 /* $Id: ocm_proc.h,v 1.4 1994/06/24 10:08:36 ceriel Exp $ */
2 /*
3  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4  * See the copyright notice in the ACK home directory, in the file "Copyright".
5  */
6 /*      process.h - Define administration types and functions
7  *
8  *      This file is to be included by implementors of the higher
9  *      level routines
10  *
11  */
12 #include "ocm_parco.h"
13
14 #ifndef ptrdiff /* This type must be able to hold a pointer difference */
15 #if EM_WSIZE <EM_PSIZE
16 #define ptrdiff long
17 #else
18 #define ptrdiff int     /* Define as long int if necessary */
19 #endif
20 #endif
21
22 #define nil     0
23 void *alloc(), free();
24
25 typedef ptrdiff wordsize, identification;
26
27 wordsize top_size();
28 int top_save();
29 void top_load();                /* Primitives */
30
31 struct procgroup;
32
33 struct process {
34         struct process *next;   /* Next process in the same group */
35         struct procgroup *down; /* Process group running under this process */
36         void *stack;            /* Pointer to the saved stack top */
37         identification id;      /* Coroutine identification */
38 };
39
40 #define init_between    __i_b__ /* These names are hidden */
41 #define save_between    __s_b__
42 #define load_betweens   __l_b__
43 #define delete_between  __d_b__
44
45 void init_between(), save_between(), load_betweens(), delete_between();
46
47 struct procgroup {
48         struct process **active;/* Active process within this group */
49         struct procgroup *up;   /* The group that this group belongs to */
50         struct process *first;  /* List of processes belonging to this group */
51         void *s_brk;            /* Point where the stack is split */
52         void *between;          /* Stack space between s_brk and up->s_brk */
53 };
54
55 #define group           __grp__ /* Ignore this please */
56 #define highest_group   __hgrp__
57
58 extern struct procgroup *group;         /* Current running group */
59 extern struct procgroup *highest_group; /* highest group that has been seen
60                                          * while searching for a process
61                                          */