main
test-branch
|
Last change
on this file since beab7f2 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 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 |
|
|---|
| 5 | $scope root = $here;
|
|---|
| 6 |
|
|---|
| 7 | typedef struct point{
|
|---|
| 8 | int x;
|
|---|
| 9 | int y;
|
|---|
| 10 | } point_t;
|
|---|
| 11 |
|
|---|
| 12 | int times2(int k, int t){
|
|---|
| 13 | return 2*k*t;
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | void f(){
|
|---|
| 17 | $atomic{
|
|---|
| 18 | int x=0;
|
|---|
| 19 |
|
|---|
| 20 | x++;
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | point_t reverse(point_t old){
|
|---|
| 25 | point_t new;
|
|---|
| 26 |
|
|---|
| 27 | new.x=old.y;
|
|---|
| 28 | new.y=old.x;
|
|---|
| 29 | return new;
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | void main(){
|
|---|
| 33 | int a=2;
|
|---|
| 34 | int *b=&a;
|
|---|
| 35 | void (*g)(void)=&f;
|
|---|
| 36 | $proc p=$spawn g();
|
|---|
| 37 | int c[2][2];
|
|---|
| 38 | $domain(2) dom=($domain(2)){1 .. 4#2, 1 .. 4#2};
|
|---|
| 39 | point_t pt;
|
|---|
| 40 | double db;
|
|---|
| 41 |
|
|---|
| 42 | a=a>0?times2(3, a*5):times2(a, a+6);
|
|---|
| 43 | db=(double)a;
|
|---|
| 44 | pt.x=1;
|
|---|
| 45 | pt.y=pt.x+5;
|
|---|
| 46 | pt.x=reverse(pt).x;
|
|---|
| 47 | $wait(p);
|
|---|
| 48 | p=$spawn g();
|
|---|
| 49 | $wait(p);
|
|---|
| 50 | a=random(a, a+2);
|
|---|
| 51 | a=times2(a*a, a);
|
|---|
| 52 | a=$next_time_count();
|
|---|
| 53 | *b=$next_time_count();
|
|---|
| 54 | a=-(a+*b*6);
|
|---|
| 55 | $for(int i, j: dom)
|
|---|
| 56 | c[(i-1)/2][(j-1)/2] = i*10 + j;
|
|---|
| 57 | $assert($forall (int i | i >= 0 && i < 2) c[i][i] >= 0);
|
|---|
| 58 | $assert($exists (int i | i >= 0 && i < 2) c[i][i] >= 0);
|
|---|
| 59 | dom=($domain(2)){0 .. 1, 0 .. 1};
|
|---|
| 60 | $parfor(int i, j: dom)
|
|---|
| 61 | times2(i, j);
|
|---|
| 62 | *b=*(&c[0][0]+1);
|
|---|
| 63 | b=(int*)$malloc(root, sizeof(int)*2);
|
|---|
| 64 | b[0]=c[0][0];
|
|---|
| 65 | b[1]=c[1][1];
|
|---|
| 66 | $free(b);
|
|---|
| 67 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.