Changeset 997 for trunk/expgui


Ignore:
Timestamp:
Sep 7, 2010 12:58:41 PM (10 years ago)
Author:
toby
Message:

fix awful bug introduced with prev. code rearangement that should not have been checked in; add ability to read archived files from command line; Add routines to read and write soft constrain records

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    r996 r997  
    5353if {$argv != ""} {
    5454    if {[string match *noshell* [string tolower $argv]]} {
    55         #puts noshell
     55        # I doubt that noshell mode is used by anyone
    5656        set expgui(shell) 0
    57         SetEXPfile [lindex $argv 1]
     57        set expgui(expfile) [lindex $argv 1]
    5858    } else {
    59         SetEXPfile [lindex $argv 0]
    60     }
    61     if {[string match -nocase {.o[0-9a-f][0-9a-f]} \
    62              [file extension $expgui(expfile)]]} {
    63         # this is an archived file -- need to handle this later
    64         tk_dialog .expFileErrorMsg "No archived files yet" \
    65             "At present you must use open (expnam) to open archived files" warning 0 "Continue"
    66         set expgui(expfile) {}
    67     }
     59        set expgui(expfile)  [lindex $argv 0]
     60    }
    6861}
    6962
     
    299292}
    300293#---------------------------------------------------------------------------
     294if {$expgui(expfile) != ""} {
     295    if {[string match -nocase {.o[0-9a-f][0-9a-f]} \
     296             [file extension $expgui(expfile)]]} {
     297        if {[file exists $expgui(expfile)]} {
     298            # this is an archived file -- archive the current .EXP file
     299            set expnam [file rootname $expgui(expfile)]
     300            # get the last archived version
     301            set lastf [lindex [lsort [glob -nocomplain $expnam.{O\[0-9A-F\]\[0-9A-F\]}]] end]
     302            if {$lastf == ""} {
     303                set num 01
     304            } else {
     305                regexp {.*\.O([0-9A-F][0-9A-F])$} $lastf a num
     306                scan $num %x num
     307                if {$num >= 255} {
     308                    set num FF
     309                } else {
     310                    set num [string toupper [format %.2x [incr num]]]
     311                }
     312            }
     313            catch {
     314                set newfile $expnam.O$num
     315                file rename -force $expnam.EXP $newfile
     316                set fp [open $expnam.LST a+]
     317                puts $fp "\n----------------------------------------------"
     318                puts $fp "     Regressing to archive file [file tail $expgui(expfile)]"
     319                puts $fp "     but first archiving [file tail $expnam.EXP] as [file tail $newfile]"
     320                puts $fp "----------------------------------------------\n"
     321                close $fp
     322            }
     323            file copy -force $expgui(expfile) $expnam.EXP
     324            set expgui(expfile) $expnam.EXP
     325        } else {
     326            MyMessageBox -parent . -title "File not found" \
     327                -message "Warning -- Archive file $expgui(expfile) was not found." \
     328                -icon warning -type OK -default ok
     329            set expgui(expfile) {}
     330        }
     331    } else {
     332        SetEXPfile $expgui(expfile)
     333    }
     334}
    301335if {$expgui(expfile) == ""} {
    302336    # place the parent window because the getExpFileName window will be centered above it.
Note: See TracChangeset for help on using the changeset viewer.