1 |
(* $Id$ *) |
(* $Id$ *) |
2 |
|
|
3 |
type to_do = LATEX | PS | XML | DRAWING | EMPTY |
type to_do = LATEX | PS | XML | DRAWING | ANIMATE | EMPTY |
4 |
|
|
5 |
type to_open = SOURCE | INTERACTIVE_MODE |
type to_open = SOURCE | INTERACTIVE_MODE |
6 |
|
|
20 |
|
|
21 |
let draw () = |
let draw () = |
22 |
let f = new Drawing.figure (!xwin,!ywin) in |
let f = new Drawing.figure (!xwin,!ywin) in |
23 |
Geom.draw_figure Geom.my_figure f; |
Geom.draw_figure Geom.my_figure f Drawing.DRAW; |
24 |
while true do f#action() done |
while true do f#action() done |
25 |
|
|
26 |
let draw2 () = |
let draw2 () = |
27 |
let |
let f = new Drawing.figure (!xwin,!ywin) in |
28 |
f = new Drawing.figure (!xwin,!ywin) |
Geom.draw_figure Geom.my_figure f Drawing.DRAW; |
29 |
in |
f |
|
Geom.draw_figure Geom.my_figure f |
|
|
; |
|
|
f |
|
30 |
|
|
31 |
let redraw f = |
let redraw f = |
32 |
begin |
begin |
33 |
f#purge; |
f#purge; |
34 |
f#redraw(); |
f#redraw(); |
35 |
Geom.draw_figure Geom.my_figure f |
Geom.draw_figure Geom.my_figure f Drawing.DRAW |
36 |
end |
end |
37 |
|
|
38 |
|
let anime () = |
39 |
|
let f = new Drawing.figure (!xwin,!ywin) in |
40 |
|
Geom.draw_figure Geom.my_figure f Drawing.ANIMATION; |
41 |
|
while true do f#action() done |
42 |
|
|
43 |
|
let anime2 () = |
44 |
|
let f = new Drawing.figure (!xwin,!ywin) in |
45 |
|
Geom.draw_figure Geom.my_figure f Drawing.ANIMATION; |
46 |
|
f |
47 |
|
|
48 |
|
let continue_animation f = |
49 |
|
begin |
50 |
|
f#redraw(); |
51 |
|
Geom.draw_figure Geom.my_figure f Drawing.ANIMATION |
52 |
|
end |
53 |
|
|
54 |
let analyse_file s = |
let analyse_file s = |
55 |
let ch_in = open_in s in |
let ch_in = open_in s in |
64 |
let print_mess_error type_of_mess mess = |
let print_mess_error type_of_mess mess = |
65 |
begin |
begin |
66 |
print_string ("\t% "^type_of_mess^":\n"); |
print_string ("\t% "^type_of_mess^":\n"); |
67 |
print_string ("\t% "^mess^"\n") |
print_string ("\t% "^mess^"\n"); |
68 |
|
print_string ("# ") |
69 |
end |
end |
70 |
|
|
71 |
let rec analyse_stdin f = |
let rec analyse_stdin f = |
75 |
let result = Parser.start Lexer.token lexbuf in |
let result = Parser.start Lexer.token lexbuf in |
76 |
begin |
begin |
77 |
Abrlex.add_abr_for_im result Geom.my_figure f; |
Abrlex.add_abr_for_im result Geom.my_figure f; |
78 |
redraw f; |
continue_animation f; |
79 |
print_string "# "; |
print_string "# "; |
80 |
flush stdout |
flush stdout |
81 |
end |
end |
82 |
done |
done |
83 |
with Lexer.Shutdown -> (print_string "Bye...\n";flush stdout) |
with Lexer.Shutdown -> (print_string "Bye...\n";flush stdout;exit 0) |
84 |
| Lexer.Eof -> |
| Lexer.Eof -> |
85 |
begin |
begin |
86 |
print_string "\n# "; |
print_string "\n# "; |
148 |
print_string "\t GeOCaml Interactive Mode\n\n"; |
print_string "\t GeOCaml Interactive Mode\n\n"; |
149 |
print_string "# "; |
print_string "# "; |
150 |
flush stdout; |
flush stdout; |
151 |
let f = draw2 () in |
let f = anime2 () in |
152 |
analyse_stdin f |
analyse_stdin f |
153 |
end |
end |
154 |
); |
); |
155 |
match !todo with |
match !todo with |
156 |
| DRAWING -> draw () |
| DRAWING -> draw () |
157 |
|
| ANIMATE -> anime () |
158 |
| PS -> GeoPs.make_postcript sources (* GeoPs.output/write !? *) |
| PS -> GeoPs.make_postcript sources (* GeoPs.output/write !? *) |
159 |
| XML -> write_xml () (* GeoXml.write/write !? *) |
| XML -> write_xml () (* GeoXml.write/write !? *) |
160 |
| LATEX -> () |
| LATEX -> () |