Subversion Repositories shark

Rev

Rev 1502 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1502 giacomo 1
 
1606 tullio 2
/*
3
 * This program is free software; you can redistribute it and/or modify
4
 * it under the terms of the GNU General Public License as published by
5
 * the Free Software Foundation; either version 2 of the License, or
6
 * (at your option) any later version.
7
 *
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 * GNU General Public License for more details.
12
 *
13
 * You should have received a copy of the GNU General Public License
14
 * along with this program; if not, write to the Free Software
15
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 *
17
 */
18
 
1502 giacomo 19
#include <kernel/kern.h>
20
#include <tracer.h>
21
 
22
#define PWCET_Automatic_Ipoint(a) TRACER_LOGEVENT(FTrace_EVT_ipoint,(a),0);
23
 
24
/* here are the bezier curves defined
25
format:
26
{startpoint, endpoint, controlpoint1, controlpoint}
27
.
28
.
29
. */
30
int curveno = 20;
31
int data[20][4][2] = {
32
        {{123,321},{ 23,432},{345,120},{123, 98}},
33
        {{567, 31},{ 23, 24},{ 35,421},{123,398}},
34
        {{  0, 21},{623,532},{145,323},{153, 68}},
35
        {{253,321},{ 23,432},{745,525},{423,198}},
36
        {{123,456},{ 23,482},{  0,123},{123,128}},
37
        {{322, 21},{223,232},{ 45,224},{123,98}},
38
        {{423, 32},{123,332},{144,329},{123,98}},
39
        {{276, 35},{ 23,492},{476,423},{123,98}},
40
        {{783,121},{723,139},{ 78,528},{123,98}},
41
        {{723,221},{623, 98},{734,683},{123,98}},
42
        {{ 60,421},{523,132},{364,753},{123,98}},
43
        {{100,521},{423,432},{633,623},{123,98}},
44
        {{ 23,371},{323,599},{343,533},{123,98}},
45
        {{123,123},{123,  0},{343,403},{123,98}},
46
        {{253,321},{490, 32},{347,393},{123,98}},
47
        {{ 68,321},{260,272},{674,283},{123,98}},
48
        {{500,321},{245,373},{ 98,173},{123,98}},
49
        {{423,321},{198,532},{306, 63},{123,98}},
50
        {{197,321},{203,432},{307,443},{123,98}},
51
        {{143,321},{293,132},{334,393},{123,98}}
52
};
53
#define STEPWIDTH 0.01 /* draws 1/STEPWIDTH +1 points between SP and EP */
54
#define XSIZE 800
55
#define YSIZE 600
56
 
57
char screen[YSIZE][XSIZE];
58
int xco[4],yco[4];
59
 
60
void init()
61
{ /*FB1*/PWCET_Automatic_Ipoint( 3157);   /*FB2*/{
62
        int y,x;
63
 
64
 
65
         { /*forx1*/for (x = 0; x < XSIZE;x++)  { /*forx2*/PWCET_Automatic_Ipoint( 3158);    /*forx3*/{
66
                 { /*forx1*/for (y = 0;y < YSIZE;y++)  { /*forx2*/PWCET_Automatic_Ipoint( 3159);    /*forx3*/{
67
                        screen[y][x] = 255;
68
                } } /*forx4*/PWCET_Automatic_Ipoint( 3160);    /*forx5*/ } /*forx6*/
69
        } } /*forx4*/PWCET_Automatic_Ipoint( 3161);    /*forx5*/ } /*forx6*/
70
 
71
}PWCET_Automatic_Ipoint( 3162);   /*FB3*/} /*FB4*/
72
 
73
void rand_init()
74
{ /*FB1*/PWCET_Automatic_Ipoint( 33519);   /*FB2*/{
75
        int i,j,x,y;
76
 
77
 
78
 
79
         { /*forx1*/for (i=0;i<20;i++)
80
                 { /*forx1*/ { /*forx2*/PWCET_Automatic_Ipoint( 33520);    /*forx3*/for (j=0;j<4;j++)  { /*forx2*/PWCET_Automatic_Ipoint( 33521);    /*forx3*/{
81
                        x=rand()%XSIZE;
82
                        y=rand()%YSIZE;
83
                        data[i][j][0]=x;
84
                        data[i][j][1]=y;
85
                } } /*forx4*/PWCET_Automatic_Ipoint( 33522);    /*forx5*/ } /*forx6*/ } /*forx4*/PWCET_Automatic_Ipoint( 33523);    /*forx5*/ } /*forx6*/
86
 
87
 
88
}PWCET_Automatic_Ipoint( 33524);   /*FB3*/} /*FB4*/
89
 
90
void pepe(){ /*FB1*/PWCET_Automatic_Ipoint( 64662);   /*FB2*/{
91
  int a;
92
 
93
    a=a+2;
94
  }PWCET_Automatic_Ipoint( 64663);   /*FB3*/} /*FB4*/
95
 
96
int bezier()
97
{ /*FB1*/PWCET_Automatic_Ipoint( 23955);   /*FB2*/{
98
        int i,y,x;
99
  float k;
100
  init();
101
 
102
         { /*forx1*/for (i = 0;i < curveno;i++)  { /*forx2*/PWCET_Automatic_Ipoint( 23956);    /*forx3*/{
103
                xco[3] = data[i][0][0];
104
                yco[3] = data[i][0][1];
105
                xco[2] = 3*(data[i][2][0] - data[i][0][0]);
106
                yco[2] = 3*(data[i][2][1] - data[i][0][1]);
107
                xco[1] = 3*(data[i][3][0] - data[i][2][0]) - xco[2];
108
                yco[1] = 3*(data[i][3][1] - data[i][2][1]) - yco[2];
109
                xco[0] = data[i][1][0] - data[i][0][0] - xco[2]- xco[1];
110
                yco[0] = data[i][1][1] - data[i][0][1] - yco[2]- yco[1];
111
 
112
 
113
                 { /*forx1*/for (k = 0;k <=1;k+=0.01)  { /*forx2*/PWCET_Automatic_Ipoint( 23957);    /*forx3*/{
114
                        x = (int)(((float)xco[0]*k*k*k)+((float)xco[1]*k*k)+((float)xco[2]*k)+(float)xco[3]);
115
                        y = (int)(((float)yco[0]*k*k*k)+((float)yco[1]*k*k)+((float)yco[2]*k)+(float)yco[3]);
116
                        if ((x < XSIZE)&&(x > 0)&&(y < YSIZE)&&(y > 0))  { /*if1*/ PWCET_Automatic_Ipoint( 23958);    /*if2*/ {
117
 
118
                                screen[y][x] = 0;
119
                        } } /*if3*/ PWCET_Automatic_Ipoint( 23959);    /*ifxxx2*/
120
                } } /*forx4*/PWCET_Automatic_Ipoint( 23960);    /*forx5*/ } /*forx6*/
121
        } } /*forx4*/PWCET_Automatic_Ipoint( 23961);    /*forx5*/ } /*forx6*/
122
  if (1==0) { /*if1*/ PWCET_Automatic_Ipoint( 23962);    /*if2*/ {
123
    k++;
124
    pepe();
125
  } } /*if3*/ PWCET_Automatic_Ipoint( 23963);    /*ifxxx2*/
126
 
127
 
128
         { /*returnE1*/PWCET_Automatic_Ipoint( 23964);    /*returnE2*/return 0; } /*returnE3*/
129
}PWCET_Automatic_Ipoint( 23965);   /*FB3*/} /*FB4*/
130
 
131
 
132
int instrumented_function(){ /*FB1*/PWCET_Automatic_Ipoint( 18549);   /*FB2*/{
133
 
134
        rand_init();
135
        bezier();
136
         { /*returnE1*/PWCET_Automatic_Ipoint( 18550);    /*returnE2*/return 0; } /*returnE3*/
137
}PWCET_Automatic_Ipoint( 18551);   /*FB3*/} /*FB4*/