From: Jaime E. V. <vi...@us...> - 2006-06-27 14:03:00
|
Update of /cvsroot/maxima/maxima/interfaces/xmaxima/Tkmaxima In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv10288/Tkmaxima Modified Files: Paths.tcl Tkmaxima.tcl Log Message: Integration of omplotdata into xmaxima. If the name of an external file is given, it will be parsed exactly as it was done by omplotdata, but the syntax of that file is now slightly different. The new version of src/plot.lisp will use that syntax and call xmaxima, rather than omplotdata. Old versions of plot.lisp will continue to work with omplotdata. The parsing of command-line options was completely rewritten, to allow for the new ways of calling xmaxima, and to use a simpler tcl syntax that will make it easier to maintain. Options to be passed to maxima are now being stored in the array maxima_priv (with the opts key). Index: Paths.tcl =================================================================== RCS file: /cvsroot/maxima/maxima/interfaces/xmaxima/Tkmaxima/Paths.tcl,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- Paths.tcl 11 Feb 2006 15:24:23 -0000 1.20 +++ Paths.tcl 27 Jun 2006 14:02:57 -0000 1.21 @@ -305,7 +305,6 @@ proc vMAXSetMaximaCommand {} { global maxima_priv tcl_platform env - set maxima_opts [lMaxInitSetOpts] set maxima_priv(localMaximaServer) "" if {[info exists maxima_priv(xmaxima_maxima)] && \ @@ -364,7 +363,7 @@ set command {} lappend command $exe - eval lappend command $maxima_opts + eval lappend command $maxima_priv(opts) # FIXME: This is gcl specific so -lisp option is bogus if {$tcl_platform(os) == "Windows 95"} { Index: Tkmaxima.tcl =================================================================== RCS file: /cvsroot/maxima/maxima/interfaces/xmaxima/Tkmaxima/Tkmaxima.tcl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Tkmaxima.tcl 13 Oct 2004 12:08:58 -0000 1.3 +++ Tkmaxima.tcl 27 Jun 2006 14:02:57 -0000 1.4 @@ -51,143 +51,59 @@ # Source Tkmaxima/Prefs.tcl ;# can be autoloaded # Source Tkmaxima/RunMaxima.tcl ;# can be autoloaded -## source preamble.tcl - -## source Readdata.tcl - -## source Getdata1.tcl - -## source Macros.tcl - -## source Proxy.tcl - -## source Send-some.tcl - -## source Plotting.tcl - -## source Fonts.tcl - -## source Private.tcl - -## source Getopt.tcl - -## source Parse.tcl - -## source Textinsert.tcl - -## source Printops.tcl - -## source Push.tcl - -## source Plotconf.tcl - -## source Rk.tcl - -## source Adams.tcl - -## source Plotdf.tcl - -## source Plot2d.tcl - -## source Plot3d.tcl - -## source NPlot3d.tcl - -# obsolete patchold.tcl - -## source EOctave.tcl - -## source EOpenplot.tcl - -## source EMaxima.tcl - -## source EHref.tcl - -## source Browser.tcl - -## source Wmenu.tcl - -## source Tryftp2.tcl - -## source Myhtml.tcl - -## source Myhtml1.tcl - -## source Base64.tcl - -## source Bitmaps.tcl - -## source Tryembed.tcl - -## source OpenMath.tcl - -## source NConsole.tcl - -## source String.tcl - -## source CMMenu.tcl - -## source Prefs.tcl - -## source RunMaxima.tcl - -proc vMaxUsage {} { +# Source Tkmaxima/Menu.tcl +# Source Tkmaxima/Paths.tcl +# Source Tkmaxima/Gui.tcl +# Source Tkmaxima/Tkmaxima.tcl - set usage {} - - lappend usage \ - [mc "Usage: xmaxima \[options\] \[url\]"] \ - [mc " If given, \[url\] will be opened in the help browser instead"] \ - [mc " of the default starting page."] \ - [mc "options:"] \ - [mc " --help: Display this usage message."] \ - [mc " -l <lisp>, --lisp=<lisp>: Use lisp implementation <lisp>."] \ - [mc " --use-version=<version>: Launch maxima version <version>."] +proc vMaxUsage {script {error {}}} { + set msg [mc "$error\n\nUsage: $script \[options\] \[filenames\] - tide_notify [join $usage "\n"] +Known options: + -help, -h: Display this message + -url site: Start browser at site + -use-version ver, -u ver: Launch maxima version ver + -lisp flavor, -l flavor: Use lisp implementation flavor +"] + tk_messageBox -type ok -icon info -title "Usage" -message $msg -parent . + exit } proc lMaxInitSetOpts {} { - global maxima_priv argv argv0 env - - set maxima_opts {} - if { [lsearch $argv "--help"] > -1 } { - vMaxUsage - exit 0 - } - set lisp_pos [lsearch -exact $argv "--lisp=*"] - if { $lisp_pos > -1 } { - set arg [lindex $argv $lisp_pos] - set prefix_end [expr [string length "--lisp="] - 1] - set lisp [string replace $arg 0 $prefix_end] - lappend maxima_opts -l $lisp - set argv [lreplace $argv $lisp_pos $lisp_pos] - } - set lisp_pos [lsearch -exact $argv "-l"] - if { $lisp_pos > -1 } { - set lisp [lindex $argv [expr $lisp_pos + 1]] - lappend maxima_opts -l $lisp - set argv [lreplace $argv $lisp_pos [expr $lisp_pos + 1]] - } - set version_pos [lsearch -exact $argv "--use-version=*"] - if { $version_pos > -1 } { - set arg [lindex $argv $version_pos] - set prefix_end [expr [string length "--use-version="] - 1] - set version [string replace $arg 0 $prefix_end] - lappend maxima_opts -u $version - set argv [lreplace $argv $lisp_pos $version_pos] - } - if { [llength $argv] == 1 } { - set maxima_priv(firstUrl) [lindex $argv 0] - } elseif { [llength $argv] > 1 } { - tide_failure [M [mc "Error: arguments %s not understood."] "$argv"] - exit 1 + global maxima_priv argv argv0 + set maxima_priv(opts) {} + set maxima_priv(plotfile) {} + set state key + foreach arg $argv { + switch -- $state { + key { + switch -regexp -- $arg { + {^-h(elp)?$} {vMaxUsage $argv0} + {^-url$} {set state url} + {^-u(se-version)?$} {set state version} + {^-l(isp)?$} {set state lisp} + {^--$} {set state noopts} + {^-.*} {vMaxUsage $argv0 "Unknown option $arg"} + default { + lappend maxima_priv(plotfile) $arg + set state file + } + } + } + file { + switch -glob -- $arg { + -* {vMaxUsage $argv0 "Misplaced option $arg"} + default {lappend plotfile $arg} + } + } + url {set maxima_priv(firstUrl) $arg; set state key} + version {lappend maxima_priv(opts) -u $arg; set state key} + lisp {lappend maxima_priv(opts) -l $arg; set state key} + noopts {lappend file $arg} + } } - - return $maxima_opts } - object_class MAXTkmaxima { method create {} { @@ -217,19 +133,6 @@ wm withdraw . wm title . xmaxima - setMaxDir - - cMAXINITBeforeIni - if {[file isfile ~/xmaxima.ini]} { - if {[catch {uplevel "#0" [list source ~/xmaxima.ini] } err]} { - tide_failure [M [mc "Error sourcing %s\n%s"] \ - [file native ~/xmaxima.ini] \ - $err] - } - - } - cMAXINITAfterIni - set fr .maxima MAXGui gui set w [gui install $fr] @@ -276,6 +179,3 @@ } - - - |