source: CIVL/src/include/civl/collate.cvl@ a0320b8

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since a0320b8 was 9372523, checked in by Ziqing Luo <ziqing@…>, 10 years ago

implemented runStatements

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@3446 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.5 KB
Line 
1#ifndef _CIVL_COLLATE_
2#define _CIVL_COLLATE_
3
4#include<collate.cvh>
5#include<civlc.cvh>
6/******************* Definition of datatypes: *******************/
7
8struct _gcollator {
9 // The number of participants of a _gcollator object:
10 int nprocs;
11 // $proc array:
12 $proc procs[];
13 // The length of the queue of collation states:
14 int queue_length;
15 // The queue of collation states. Note that elements in this queue
16 // are references to collate state objects:
17 $gcollate_state queue[];
18};
19
20struct _collator {
21 // The place of the process in a _gcollator who holds this handle:
22 int place;
23 // A handle to the _gcollator object:
24 $gcollator gcollator;
25};
26
27struct _gcollate_state {
28 // An array of markers for whether a process has already arrived
29 // this entry:
30 _Bool arrived[];
31 // An array of markers for whether a process has already departed
32 // from this entry:
33 _Bool departed[];
34 // collate $state:
35 $state state;
36};
37
38struct _collate_state {
39 // The place of the process in a _gcollator who holds this handle:
40 int place;
41 // A reference to a _gcollate_state:
42 $gcollate_state gstate;
43};
44
45
46/******************* Function definitions ***************************/
47$gcollator gcollator_create($scope scope, int nprocs) {
48 $gcollator gcollator = ($gcollator)$malloc(scope, sizeof(struct _gcollator));
49
50 gcollator_obj->nprocs = nprocs;
51 gcollator_obj->procs = (($proc[nprocs])$lambda(int i)$proc_null);
52 gcollator_obj->queue_length = 0;
53 $seq_init(&(gcollator_obj->queue), 0, NULL);
54 return gcollator;
55}
56
57#endif
Note: See TracBrowser for help on using the repository browser.