6 |
|
|
7 |
let toopen = ref INTERACTIVE_MODE |
let toopen = ref INTERACTIVE_MODE |
8 |
|
|
9 |
let todo = ref EMPTY |
(* Par défaut, affichage graphique *) |
10 |
|
|
11 |
|
let todo = ref DRAWING |
12 |
|
|
13 |
let sources = ref "" |
let sources = ref "" |
14 |
|
|
24 |
while true do f#action() done |
while true do f#action() done |
25 |
|
|
26 |
let draw2 () = |
let draw2 () = |
27 |
let f = new Drawing.figure (!xwin,!ywin) in |
let |
28 |
Geom.draw_figure Geom.my_figure f; |
f = new Drawing.figure (!xwin,!ywin) |
29 |
|
in |
30 |
|
Geom.draw_figure Geom.my_figure f |
31 |
|
; |
32 |
f |
f |
33 |
|
|
34 |
let redraw f = |
let redraw f = |
78 |
| e -> (print_mess_error "Erreur !" (Abrlex.treat_exception e);flush stdout;analyse_stdin f) |
| e -> (print_mess_error "Erreur !" (Abrlex.treat_exception e);flush stdout;analyse_stdin f) |
79 |
|
|
80 |
|
|
|
let make_postcript () = |
|
|
let channel = open_out ((!sources)^".xml") in |
|
|
output_string channel Xml.version; |
|
|
(*output_string channel Xml.doctype;*) |
|
|
Xmlexpansed.open_balise "figure" "" channel; |
|
|
Geom.write_figure2 Geom.my_figure channel; |
|
|
Xmlexpansed.close_balise "figure" channel; |
|
|
close_out channel; |
|
|
Sys.command ("./postcript.sh "^(!sources)^".xml");() |
|
81 |
|
|
82 |
let write_xml () = |
let write_xml () = |
83 |
let channel = open_out ((!sources)^".xml") in |
let channel = open_out ((!sources)^".xml") in |
89 |
close_out channel |
close_out channel |
90 |
|
|
91 |
let options_list = |
let options_list = |
92 |
[("--hwin",Arg.Int (fun y -> ywin := y),"définit la hauteur de la fenêtre graphique"); |
[ |
93 |
("--lwin",Arg.Int (fun x -> xwin := x),"définit la largeur de la fenêtre graphique"); |
("--hwin", |
94 |
("--ps",Arg.Unit(fun () -> todo := PS),"génère un fichier Postcript"); |
Arg.Int (fun y -> ywin := y), |
95 |
("--tex",Arg.Unit(fun () -> todo := LATEX),"génère un fichier LaTeX"); |
"définit la hauteur de la fenêtre graphique") |
96 |
("--xml",Arg.Unit(fun () -> todo := XML),"génère un fichier XML"); |
; |
97 |
("--gr",Arg.Unit(fun () -> todo := DRAWING),"utilise l'affichage graphique")] |
("--lwin", |
98 |
|
Arg.Int (fun x -> xwin := x),"définit la largeur de la fenêtre graphique") |
99 |
|
; |
100 |
|
("--ps", |
101 |
|
Arg.Unit(fun () -> todo := PS),"génère un fichier Postcript") |
102 |
|
; |
103 |
|
("--tex", |
104 |
|
Arg.Unit(fun () -> todo := LATEX),"génère un fichier LaTeX") |
105 |
|
; |
106 |
|
("--xml", |
107 |
|
Arg.Unit(fun () -> todo := XML),"génère un fichier XML") |
108 |
|
; |
109 |
|
("--gr", |
110 |
|
Arg.Unit(fun () -> todo := DRAWING),"utilise l'affichage graphique")] |
111 |
|
|
112 |
let use_message = "Usage : "^Sys.argv.(0)^"[options] fichier source" |
let use_message = "Usage : "^Sys.argv.(0)^"[options] fichier source" |
113 |
|
|
140 |
); |
); |
141 |
match !todo with |
match !todo with |
142 |
| DRAWING -> draw () |
| DRAWING -> draw () |
143 |
| PS -> make_postcript () |
| PS -> GeoPs.make_postcript sources (* GeoPs.output/write !? *) |
144 |
| XML -> write_xml () |
| XML -> write_xml () (* GeoXml.write/write !? *) |
145 |
| LATEX -> () |
| LATEX -> () |
146 |
| EMPTY -> () |
| EMPTY -> () |
147 |
end |
end |