source: CIVL/examples/backend/showTrans.cvl@ d6f5e4c

1.23 2.0 main test-branch
Last change on this file since d6f5e4c was e6fd645, checked in by Manchun Zheng <zmanchun@…>, 11 years ago

minor correction

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

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#include <civlc.cvh>
2
3$abstract int random(int x, int y);
4
5typedef struct point{
6 int x;
7 int y;
8} point_t;
9
10int times2(int k, int t){
11 return 2*k*t;
12}
13
14void f(){
15 $atomic{
16 int x=0;
17
18 x++;
19 }
20}
21
22point_t reverse(point_t old){
23 point_t new;
24
25 new.x=old.y;
26 new.y=old.x;
27 return new;
28}
29
30void main(){
31 int a=2;
32 int *b=&a;
33 void (*g)(void)=&f;
34 $proc p=$spawn g();
35 int c[2][2];
36 $domain(2) dom=($domain(2)){1 .. 4#2, 1 .. 4#2};
37 point_t pt;
38 double db;
39
40 a=a>0?times2(3, a*5):times2(a, a+6);
41 db=(double)a;
42 pt.x=1;
43 pt.y=pt.x+5;
44 pt.x=reverse(pt).x;
45 $wait(p);
46 p=$spawn g();
47 $wait(p);
48 a=random(a, a+2);
49 a=times2(a*a, a);
50 a=$next_time_count();
51 *b=$next_time_count();
52 a=-(a+*b*6);
53 $for(int i, j: dom)
54 c[(i-1)/2][(j-1)/2] = i*10 + j;
55 $assert($forall {int i | i >= 0 && i < 2} c[i][i] >= 0);
56 $assert($exists {int i | i >= 0 && i < 2} c[i][i] >= 0);
57 dom=($domain(2)){0 .. 1, 0 .. 1};
58 $parfor(int i, j: dom)
59 times2(i, j);
60 *b=*(&c[0][0]+1);
61 b=(int*)$malloc($root, sizeof(int)*2);
62 b[0]=c[0][0];
63 b[1]=c[1][1];
64 $free(b);
65}
Note: See TracBrowser for help on using the repository browser.