main
test-branch
|
Last change
on this file since bb03188 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
|
| Rev | Line | |
|---|
| [7329898] | 1 | #include <civlc.cvh>
|
|---|
| 2 |
|
|---|
| [2e13620] | 3 | $abstract int random(int x, int y);
|
|---|
| 4 |
|
|---|
| [d66b03b] | 5 | $scope root = $here;
|
|---|
| 6 |
|
|---|
| [7329898] | 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(){
|
|---|
| [7759ec0] | 17 | $atomic{
|
|---|
| [7329898] | 18 | int x=0;
|
|---|
| 19 |
|
|---|
| 20 | x++;
|
|---|
| [7759ec0] | 21 | }
|
|---|
| [7329898] | 22 | }
|
|---|
| 23 |
|
|---|
| [2e13620] | 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 |
|
|---|
| [7329898] | 32 | void main(){
|
|---|
| 33 | int a=2;
|
|---|
| 34 | int *b=&a;
|
|---|
| 35 | void (*g)(void)=&f;
|
|---|
| [e6fd645] | 36 | $proc p=$spawn g();
|
|---|
| [7329898] | 37 | int c[2][2];
|
|---|
| 38 | $domain(2) dom=($domain(2)){1 .. 4#2, 1 .. 4#2};
|
|---|
| [2e13620] | 39 | point_t pt;
|
|---|
| 40 | double db;
|
|---|
| [7329898] | 41 |
|
|---|
| [7759ec0] | 42 | a=a>0?times2(3, a*5):times2(a, a+6);
|
|---|
| [2e13620] | 43 | db=(double)a;
|
|---|
| [7329898] | 44 | pt.x=1;
|
|---|
| 45 | pt.y=pt.x+5;
|
|---|
| [2e13620] | 46 | pt.x=reverse(pt).x;
|
|---|
| [7329898] | 47 | $wait(p);
|
|---|
| 48 | p=$spawn g();
|
|---|
| 49 | $wait(p);
|
|---|
| [2e13620] | 50 | a=random(a, a+2);
|
|---|
| [7329898] | 51 | a=times2(a*a, a);
|
|---|
| 52 | a=$next_time_count();
|
|---|
| 53 | *b=$next_time_count();
|
|---|
| [2e13620] | 54 | a=-(a+*b*6);
|
|---|
| [7329898] | 55 | $for(int i, j: dom)
|
|---|
| 56 | c[(i-1)/2][(j-1)/2] = i*10 + j;
|
|---|
| [827239f] | 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);
|
|---|
| [7329898] | 59 | dom=($domain(2)){0 .. 1, 0 .. 1};
|
|---|
| 60 | $parfor(int i, j: dom)
|
|---|
| 61 | times2(i, j);
|
|---|
| [2e13620] | 62 | *b=*(&c[0][0]+1);
|
|---|
| [d66b03b] | 63 | b=(int*)$malloc(root, sizeof(int)*2);
|
|---|
| [7329898] | 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.