1#!/usr/bin/env wish 2 3# le titre 4wm title . mdump3 5 6# le cadre 7frame .top -borderwidth 10 -background white 8pack .top -side top -fill x 9 10# les boutons de commande 11set but [button .top.dump -text "Dump" -command Dump -background red] 12button .top.quit -text "Quitter" -command exit -background red 13pack .top.quit .top.dump -side left 14 15# le label d'entree du fichier a dumper 16label .top.l -text " Fichier MED : " -padx 0 -background white 17entry .top.file -width 20 -relief sunken \ 18 -textvariable file 19pack .top.l -side left 20pack .top.file -side left -fill x -expand true 21 22# le mode de stockage des donnees en memoire / lecture ent�te seulement 23frame .option1 -background white 24label .option1.o -text " Mode d'affichage des donn�es : " -padx 1 \ 25 -background white 26set choix_stockage FULL_INTERLACE 27set f [frame .option1.ms -borderwidth 5 -background white ] 28radiobutton $f.1 -variable choix_stockage -text " LECTURE ENTETE " \ 29 -value LECTURE_EN_TETE_SEULEMENT 30radiobutton $f.2 -variable choix_stockage -text " NON ENTRELACE " \ 31 -value NO_INTERLACE 32radiobutton $f.3 -variable choix_stockage -text " ENTRELACE " \ 33 -value FULL_INTERLACE 34pack $f.1 -side left 35pack $f.2 -side right 36pack $f.3 -side right 37pack .option1.o -side left 38pack $f -side left 39pack .option1 -side top -fill x 40 41# Le mode de connectivite 42frame .option2 -background white 43label .option2.o -text " Mode de connectivit� : " -padx 0 -background white 44set choix_connectivite NODALE 45set mc [frame .option2.mc -borderwidth 5 -background white] 46radiobutton $mc.1 -variable choix_connectivite -text " CONNECTIVITE NODALE " \ 47 -value NODALE 48radiobutton $mc.2 -variable choix_connectivite \ 49 -text " CONNECTIVITE DESCENDANTE " -value DESCENDANTE 50pack $mc.1 -side left 51pack $mc.2 -side right 52pack .option2.o -side left 53pack $mc -side left 54pack .option2 -side top -fill x 55 56# Lecture complete ou non ? 57# frame .option4 -background white 58# label .option4.o -text " Mode de lecture : " -padx 0 -background white 59# set choix_lecture LECTURE_COMPLETE 60# set mc [frame .option4.mc -borderwidth 5 -background white] 61# radiobutton $mc.1 -variable choix_lecture -text " LECTURE COMPLETE " \ 62# -value LECTURE_COMPLETE 63# radiobutton $mc.2 -variable choix_lecture \ 64# -text " LECTURE DES EN-TETES SEULEMENT " -value LECTURE_EN_TETE_SEULEMENT 65# pack $mc.1 -side left 66# pack $mc.2 -side right 67# pack .option4.o -side left 68# pack $mc -side left 69# pack .option4 -side top -fill x 70 71# Affichage complet ou structure seulement ? 72frame .option0 -background white 73label .option0.o -text " Affichage : " -padx 0 -background white 74set choix_structure "" 75set af [frame .option0.mc -borderwidth 5 -background white] 76radiobutton $af.1 -variable choix_structure -text " AFFICHAGE COMPLET " \ 77 -value "" 78radiobutton $af.2 -variable choix_structure \ 79 -text " STRUCTURE SEULEMENT " -value "--structure" 80pack $af.1 -side left 81pack $af.2 -side right 82pack .option0.o -side left 83pack $af -side left 84pack .option0 -side top -fill x 85 86# le numero de maillage 87frame .option3 -background white 88label .option3.o -text " Numero de maillage : " -padx 0 -background white 89set numero 0 90entry .option3.numero -width 10 -relief sunken \ 91 -textvariable numero 92pack .option3.o -side left 93pack .option3.numero -side left -fill x -expand true 94pack .option3 -side top -fill both 95 96# la fenetre d'affichage 97frame .t -background white 98set log [text .t.log -width 80 -height 80 \ 99 -borderwidth 2 -relief raised -setgrid true \ 100 -yscrollcommand {.t.scroll set} -background cyan] 101scrollbar .t.scroll -command {.t.log yview} 102pack .t.scroll -side right -fill y 103pack .t.log -side left -fill both -expand true 104pack .t -side top -fill both -expand true 105 106# les touches du clavier 107bind .top.file <Return> Dump 108focus .top.file 109 110# la commande dump 111proc Dump { } { 112 global exec_path choix_structure file input log but choix_structure choix_connectivite choix_stockage numero choix_lecture 113 114# on suppose que bindir c'est $prefix/bin ce qui malheureusement peut ne pas etre le cas si l'utilisateur utilise l'option de configure !!! 115# il faudrait peut-etre comparer /usr/local/bin et ${exec_prefix}/bin pour etre sur ! 116 set cmd "@prefix@/bin/mdump3" 117 118 # if { $choix_lecture == "LECTURE_EN_TETE_SEULEMENT" } { 119 # if [catch {open "|$cmd $choix_structure $file $numero $choix_connectivite $choix_lecture |& cat"} input] { 120 # $log insert end $input\n 121 # } else { 122 # $but config -text Stop -command Stop 123 # $log insert end $file\n 124 # fileevent $input readable Log 125 # } 126 # } else { 127 128 if [catch {open "|$cmd $choix_structure $file $choix_connectivite $choix_stockage $numero |& cat"} input] { 129 $log insert end $input\n 130 } else { 131 $but config -text Stop -command Stop 132 $log insert end $file\n 133 fileevent $input readable Log 134 } 135 136 # } 137} 138 139proc Log { } { 140 global input log 141 if [eof $input] { 142 Stop 143 } else { 144 gets $input line 145 $log insert end $line\n 146 $log see end 147 } 148} 149 150proc Stop { } { 151 global input but 152 catch {close $input} 153 $but config -text "Dump" -command Dump 154} 155 156