source: CIVL/examples/backend/printExpr.cvl@ beab7f2

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.5 KB
Line 
1#include <civlc.cvh>
2#include <seq.cvh>
3
4typedef struct Point{
5 double x;
6 double y;
7} Point;
8
9typedef struct Line{
10 Point start;
11 Point end;
12} Line;
13
14typedef union MyUnion{
15 int a;
16 double b;
17} MyUnion;
18
19$input int x;
20$input int y;
21$input MyUnion MU;
22$input double dx;
23$input double dy;
24$input int _A[];
25$input _Bool B;
26$input $proc p;
27$input Point pt;
28$assume(p != $self);
29$input $scope sc;
30$scope root = $here;
31$assume(sc != root);
32$assume(dx!=0);
33$proc p1;
34$abstract int random(int t);
35
36void structs(){
37 Point p0={0,0}, p1={1,1}, p2;
38 Line l0={p0, p1}, l1={p1,p2}, l2={p2, p0};
39 Line lines[3];
40
41 //$assume(y>=0 && y<3);
42 //lines[y]=l1;
43 p2.x=2;
44 p2.y=2;
45 lines[0]=l0;
46 lines[1]=l1;
47 lines[2]=l2;
48}
49
50int call(int f(int), int arg){
51 return f(arg);
52}
53
54int sum(int n){
55 int result=0;
56
57 for(int i=1; i<=n; i++)
58 result+=i;
59 return result;
60}
61
62void main(){
63 int (*k)(int)=&sum;
64 int A[10];
65 int*p;
66 int n, n1, n2, n3, n4, n5, n6, n7, n8, n9;
67 _Bool b, b1, b2, b3;
68 double d1,d2;
69 int null;
70 MyUnion mu;
71
72 A[1]=8;
73 A[2]=9;
74 A[3]=7;
75 n=A[2];
76 $assume(0<=x && x<10);
77 A[x]=9;
78 n=A[x];
79 n=x+y;
80 n=$seq_length((void *)&_A);
81 b = x && y;
82 b=x<y;
83 b=x<=y;
84 b=(_Bool)x;
85 $assume(x!=0);
86 n1=y/x;
87 d1=dy/dx;
88 n2=y%x;
89 n3=x*y;
90 n4=-y;
91 b1=x!=y;
92 b2=!B;
93 b3= B || b1;
94 n5=x-y;
95 b=x==y;
96 n6=pt.x;
97 n7=random(n);
98 n8=x*x*x*x*x;
99 n9=MU.a;
100 d2=MU.b;
101 mu.a=n6;
102 structs();
103 p=(int*)$malloc(root, sizeof(int)*10);
104 call(k, 2);
105 p1=$spawn sum(1);
106 p[5]=5;
107 $wait(p1);
108 $free(p);
109}
Note: See TracBrowser for help on using the repository browser.