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