source: CIVL/examples/backend/showTrans.cvl@ 7759ec0

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 7759ec0 was 7759ec0, checked in by Manchun Zheng <zmanchun@…>, 11 years ago

minor correction to improve test coverage.

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

  • Property mode set to 100644
File size: 727 bytes
Line 
1#include <civlc.cvh>
2
3typedef struct point{
4 int x;
5 int y;
6} point_t;
7
8int times2(int k, int t){
9 return 2*k*t;
10}
11
12void f(){
13 $atomic{
14 int x=0;
15
16 x++;
17 }
18}
19
20void main(){
21 int a=2;
22 int *b=&a;
23 void (*g)(void)=&f;
24 $proc p=$spawn f();
25 int c[2][2];
26 $domain(2) dom=($domain(2)){1 .. 4#2, 1 .. 4#2};
27 point_t pt;
28
29 a=a>0?times2(3, a*5):times2(a, a+6);
30 pt.x=1;
31 pt.y=pt.x+5;
32 $wait(p);
33 p=$spawn g();
34 $wait(p);
35 a=times2(a*a, a);
36 a=$next_time_count();
37 *b=$next_time_count();
38 $for(int i, j: dom)
39 c[(i-1)/2][(j-1)/2] = i*10 + j;
40 dom=($domain(2)){0 .. 1, 0 .. 1};
41 $parfor(int i, j: dom)
42 times2(i, j);
43 b=(int*)$malloc($root, sizeof(int)*2);
44 b[0]=c[0][0];
45 b[1]=c[1][1];
46 $free(b);
47}
Note: See TracBrowser for help on using the repository browser.