Changeset 381
- Timestamp:
- Dec 4, 2009 5:05:13 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/readexp.tcl
- Property rcs:date changed from 2001/04/03 19:10:54 to 2001/04/17 22:44:59
- Property rcs:lines changed from +8 -3 to +19 -33
- Property rcs:rev changed from 1.24 to 1.25
r376 r381 5 5 # The GSAS data is read from an EXP file. 6 6 # ... reading an EXP file into an array 7 # returns -1 on error 8 # returns 0 if the file is old-style UNIX format (no CR/LF) 9 # returns 1 if the file is 80 char/line + cr/lf 10 # returns 2 if the file is sequential but not fixed-record length 7 11 proc expload {expfile} { 8 12 global exparray … … 12 16 "Unable to open file $expfile" error 0 "Exit" ; return -1 13 17 } 18 fconfigure $fil -translation lf 14 19 set len [gets $fil line] 15 20 if {[string length $line] != $len} { … … 38 43 while {$len > 0} { 39 44 set key [string range $line 0 11] 40 set exparray($key) [string range $line 12 end] 45 set exparray($key) [string range $line 12 79] 46 if {$len != 81 || [string range $line end end] != "\r"} {set fmt 2} 41 47 set len [gets $fil line] 42 48 } … … 962 968 makeexprec "${key} EPHAS" 963 969 # expedt defaults this to "F", but I think "T" is better 964 global tcl_platform 965 if {[string match "IRIX*" $tcl_platform(os)]} { 966 setexp "${key} EPHAS" "T" 50 1 967 } else { 968 setexp "${key} EPHAS" "Y" 50 1 969 } 970 setexp "${key} EPHAS" "Y" 50 1 970 971 if $expgui(debug) {puts "Warning: creating a ${key} EPHAS record"} 971 972 } … … 981 982 } 982 983 foextract-set { 983 global tcl_platform984 if {[string match "IRIX*" $tcl_platform(os)]} {985 if $value {986 setexp "${key} EPHAS" "T" 50 1987 } else {988 setexp "${key} EPHAS" "F" 50 1989 }990 } else {991 984 # the flag has changed to "Y/N" in the latest versions 992 985 # of GSAS 993 if $value { 994 setexp "${key} EPHAS" "Y" 50 1 995 } else { 996 setexp "${key} EPHAS" "N" 50 1 997 } 986 if $value { 987 setexp "${key} EPHAS" "Y" 50 1 988 } else { 989 setexp "${key} EPHAS" "N" 50 1 998 990 } 999 991 } … … 2011 2003 # write the .EXP file 2012 2004 proc expwrite {expfile} { 2013 global tcl_platformexparray2005 global exparray 2014 2006 set blankline \ 2015 2007 " " 2016 2008 set fp [open ${expfile} w] 2009 fconfigure $fp -translation crlf 2017 2010 set keylist [lsort [array names exparray]] 2018 2011 # reorder the keys so that VERSION comes 1st 2019 2012 set pos [lsearch -exact $keylist { VERSION}] 2020 2013 set keylist "{ VERSION} [lreplace $keylist $pos $pos]" 2021 if {$tcl_platform(platform) == "windows"} { 2022 foreach key $keylist { 2023 puts $fp [string range \ 2024 "$key$exparray($key)$blankline" 0 79] 2025 } 2026 } else { 2027 foreach key $keylist { 2028 puts -nonewline $fp [string range \ 2029 "$key$exparray($key)$blankline" 0 79] 2030 } 2014 foreach key $keylist { 2015 puts $fp [string range \ 2016 "$key$exparray($key)$blankline" 0 79] 2031 2017 } 2032 2018 close $fp
Note: See TracChangeset
for help on using the changeset viewer.