source: CIVL/examples/por/heap1.cvl@ 32410ee

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 32410ee was 78fdaf0, checked in by Manchun Zheng <zmanchun@…>, 12 years ago

implement $scope type and constants ($here/$root); changed the implementation of malloc accordingly.

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

  • Property mode set to 100644
File size: 414 bytes
Line 
1#include <civlc.h>
2
3int *p;
4_Bool start = $false;
5
6void f(){
7 $heap fh;
8
9 $when(start);
10 p = (int*) $malloc($root, sizeof(int));
11 h = &fh;
12 //$free(&fh, p);
13}
14
15void g(){
16 $heap gh;
17
18 $when(start);
19 h = &gh;
20 //p = (int*) $malloc(h, sizeof(int));
21 //$free(&gh, p);
22}
23
24void main(){
25 $proc ps[2];
26
27 ps[0] = $spawn f();
28 ps[1] = $spawn g();
29 start = $true;
30 $wait ps[0];
31 $wait ps[1];
32 $free(h, p);
33}
Note: See TracBrowser for help on using the repository browser.