Changeset 470 for trunk/gsascmds.tcl


Ignore:
Timestamp:
Dec 4, 2009 5:06:42 PM (11 years ago)
Author:
toby
Message:

# on 2001/10/18 23:30:15, toby did:
fix web page display problem in windows-NT
move EXP archiving here & now use the .O?? files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsascmds.tcl

    • Property rcs:date changed from 2001/09/25 23:31:59 to 2001/10/18 23:30:15
    • Property rcs:lines changed from +180 -10 to +62 -9
    • Property rcs:rev changed from 1.38 to 1.39
    r450 r470  
    881881
    882882            # Substitute the HTML filename into the command for %1
    883             regsub %1 $appCmd $url appCmd
     883            # or stick it on the end
     884            if {[string first %1 $appCmd] != -1} {
     885                regsub %1 $appCmd $url appCmd
     886            } else {
     887                append appCmd " " $url
     888            }
    884889           
    885890            # Double up the backslashes for eval (below)
     
    13231328}
    13241329
     1330proc archiveexp {} {
     1331    global expgui tcl_platform
     1332    # is there a file to archive?
     1333    if {![file exists $expgui(expfile)]} return
     1334    set expnam [file rootname $expgui(expfile)]
     1335    # get the last archived version
     1336    set lastf [lindex [lsort [glob $expnam.{O\[0-9A-F\]\[0-9A-F\]}]] end]
     1337    if {$lastf == ""} {
     1338        set num 01
     1339    } else {
     1340        regexp {.*\.O([0-9A-F][0-9A-F])$} $lastf a num
     1341        scan $num %x num
     1342        if {$num >= 255} {
     1343            set num FF
     1344        } else {
     1345            set num [string toupper [format %.2x [incr num]]]
     1346        }
     1347    }
     1348    catch {
     1349        set file $expnam.O$num
     1350        file rename -force $expgui(expfile) $file
     1351        exec echo "\n----------------------------------------------" >> $expnam.LST
     1352        exec echo "     Archiving [file tail $expnam.EXP] as [file tail $file]" >> $expnam.LST
     1353        exec echo "----------------------------------------------\n" >> $expnam.LST
     1354    } errmsg
     1355    if {$errmsg != ""} {
     1356        tk_dialog .warn Confirm "Error archiving the current .EXP file: $errmsg" warning 0 OK
     1357    }
     1358}
     1359
     1360# save and optionally archive the expfile
     1361proc savearchiveexp {} {
     1362    global expgui expmap
     1363    if {$expgui(expfile) == ""} {
     1364        SaveAsFile
     1365        return
     1366    }
     1367    if !$expgui(changed) return
     1368    if {$expgui(archive)} archiveexp
     1369    # add a history record
     1370    exphistory add " EXPGUI [lindex $expgui(Revision) 1] [lindex $expmap(Revision) 1] ($expgui(changed) changes) -- [clock format [clock seconds]]"
     1371    # now save the file
     1372    expwrite $expgui(expfile)
     1373    set expgui(changed) 0
     1374    set expgui(expModifiedLast) [file mtime $expgui(expfile)]
     1375    set expgui(last_History) [string range [string trim [lindex [exphistory last] 1]] 0 50 ]
     1376    wm title . $expgui(expfile)
     1377    set expgui(titleunchanged) 1
     1378    # set convergence criterion
     1379    InitLSvars
     1380}
     1381
    13251382#------------------------------------------------------------------------------
    13261383# GSAS interface routines
     
    13581415    set expnam [file root [file tail $expgui(expfile)]]
    13591416    foreach prog $proglist {
    1360         if {$prog == "expedt" && $expgui(archive)} archiveexp
    13611417        if {$tcl_platform(platform) == "windows"} {
    13621418            append cmd " \"$expgui(gsasexe)/${prog}.exe $expnam \" "
     
    17781834
    17791835    set expgui(includearchived) 0
    1780     if {$tcl_platform(platform) == "unix" && $mode == "old"} {
     1836    if {$mode == "old"} {
    17811837        pack [checkbutton $frmC.ar -text "Include Archived Files" \
    17821838                -variable expgui(includearchived) \
     
    18401896    }
    18411897    # check for archive files
    1842     if {([string match {*.EXP.[0-9][0-9][0-9].gz} $expgui(FileMenuEXPNAM)] || \
    1843             [string match {*.EXP.[0-9][0-9][0-9]} $expgui(FileMenuEXPNAM)]) && \
    1844             $tcl_platform(platform) == "unix" && \
     1898    if {[string match {*.O[0-9A-F][0-9A-F]} $expgui(FileMenuEXPNAM)] && \
    18451899            $mode == "old" && [file exists $expgui(FileMenuEXPNAM)]} {
    18461900        destroy .file
     
    21862240            lappend pairlist [list $file $modified]
    21872241        } elseif {![file isdirectory $file] && $expgui(includearchived) && \
    2188                 ([string match {*.EXP.[0-9][0-9][0-9].gz} $file] ||\
    2189                 [string match {*.EXP.[0-9][0-9][0-9]} $file])} {
     2242                [string match {*.O[0-9A-F][0-9A-F]} $file]} {
    21902243            set modified [file mtime $file]
    21912244            lappend pairlist [list $file $modified]
Note: See TracChangeset for help on using the changeset viewer.