Annotation of OpenXM/src/cfep/Samples/ray.rr, Revision 1.1.1.1
1.1 takayama 1: def test2() {
2: glib_init_send("0;[glib3_ray_init]");
3: glib_init_send("0;[glib_flush]");
4: glib_send("0;[glib3_ray]");
5: glib_send("0;[glib_flush]");
6: }
7: def myline(X,Y,X2,Y2,C) {
8: X = rtostr(deval(X)); Y = rtostr(deval(Y));
9: X2 = rtostr(deval(X2)); Y2=rtostr(deval(Y2));
10: CC = C[0]*(256*256)+C[1]*256+C[0];
11: CC=rtostr(CC); print(C,0); print(CC);
12: glib_send("1; [glib_line,"+X+","+Y+","+X2+","+Y2+","+CC+"]");
13: }
14: def t_encode1(X) {
15: return [
16: ior(0xf8,iand(0x3,ishift(X,6))),
17: ior(0xf0,iand(0x7,ishift(X,3))),
18: ior(0xf0,iand(0x7,X))];
19: }
20: def t_encode_str(S) {
21: Ans = [ ];
22: Codes = strtoascii(S);
23: N = length(Codes);
24: for (I=0; I<N; I++) {
25: T = t_encode1(Codes[I]);
26: Ans = cons(T[0],Ans);
27: Ans = cons(T[1],Ans);
28: Ans = cons(T[2],Ans);
29: }
30: return reverse(Ans);
31: }
32: def t_encode(S) {
33: return asciitostr(t_encode_str(S));
34: }
35: def glib_send(S) {
36: S=S+"\n";
37: N=length(strtoascii(S))+1;
38: C=t_encode("{1<"+rtostr(N)+" "+S+" >}");
39: ctrl("hex",1);
40: output(); ctrl("hex",0);
41: print(C); output(); /* channel 1 にコマンドを送る */
42: }
43: def glib_init_send(S) {
44: S=S+"\n";
45: N=length(strtoascii(S))+1;
46: C=t_encode("{2<"+rtostr(N)+" "+S+" >}");
47: ctrl("hex",1);
48: output(); ctrl("hex",0);
49: print(C); output(); /* channel 2 にコマンドを送る. OpenGL 初期化 */
50: }
51: test2();
52:
53:
54:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>