Use [] instead of [0] in structures.
[ilari-esolangs.git] / vat.h
blobfe5eadc5505406f42f550a831c2ce76cc40a007c
1 #ifndef _vat__h__included__
2 #define _vat__h__included__
4 #include <stdlib.h>
5 #include "lock.h"
7 struct message;
8 struct object;
10 /* Vat. */
11 struct vat;
13 /******************************************************************************
15 * DESCRIPTION:
16 * Grab queue lock.
18 * PARAMETERS:
19 * vat The vat to manipulate.
21 *****************************************************************************/
22 void vat_grab_queue_lock();
24 /******************************************************************************
26 * DESCRIPTION:
27 * Ungrab queue lock.
29 * PARAMETERS:
30 * vat The vat to manipulate.
32 *****************************************************************************/
33 void vat_ungrab_queue_lock();
35 /******************************************************************************
37 * DESCRIPTION:
38 * Queue message into vat message queue.
40 * PARAMETERS:
41 * vat The vat to use.
42 * message The message to queue.
44 *****************************************************************************/
45 void vat_queue_message(struct vat* vat, struct message* message);
47 /******************************************************************************
49 * DESCRIPTION:
50 * Perform full mark and sweep GC on vat.
52 * PARAMETERS:
53 * vat The vat to use.
55 * RETURN VALUE:
56 * 1 if objects still remain, 0 if vat is now empty.
58 *****************************************************************************/
59 unsigned vat_perform_gc(struct vat* vat);
61 /******************************************************************************
63 * DESCRIPTION:
64 * Get maximum number of locals.
66 * PARAMETERS:
67 * vat The vat to use.
69 * RETURN VALUE:
70 * Maximum locals count.
72 *****************************************************************************/
73 size_t vat_maxlocals(struct vat* vat);
75 /******************************************************************************
77 * DESCRIPTION:
78 * Create vat.
80 * PARAMETERS:
81 * maxlocals Maximum locals count.
83 * RETURN VALUE:
84 * The vat.
86 *****************************************************************************/
87 struct vat* vat_create(size_t maxlocals);
89 /******************************************************************************
91 * DESCRIPTION:
92 * Destroy vat, and all objects in it.
94 * PARAMETERS:
95 * vat The vat to destroy.
97 *****************************************************************************/
98 void vat_destroy(struct vat* vat);
100 /******************************************************************************
102 * DESCRIPTION:
103 * Add object to vat.
105 * PARAMETERS:
106 * vat The vat to manipulate.
107 * object The object to add.
109 *****************************************************************************/
110 void vat_add_object(struct vat* vat, struct object* object);
112 /******************************************************************************
114 * DESCRIPTION:
115 * Deque message from vat message queue.
117 * PARAMETERS:
118 * vat The vat to manipulate.
120 * RETURN VALUE:
121 * Message dequed.
123 *****************************************************************************/
124 struct message* vat_deque_message(struct vat* vat);
126 #endif