/usr/share/xcrysden/Tcl/addOption.tcl is in xcrysden-data 1.5.60-1build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | #############################################################################
# Author: #
# ------ #
# Anton Kokalj Email: Tone.Kokalj@ijs.si #
# Department of Physical and Organic Chemistry Phone: x 386 1 477 3523 #
# Jozef Stefan Institute Fax: x 386 1 477 3811 #
# Jamova 39, SI-1000 Ljubljana #
# SLOVENIA #
# #
# Source: $XCRYSDEN_TOPDIR/Tcl/addOption.tcl
# ------ #
# Copyright (c) 1996-2003 by Anton Kokalj #
#############################################################################
#
#
# addOption --unknown /path/converterProgram -xterm
proc addOption {option converterProgram description {args {}}} {
global addOption
lappend addOption(optionList) $option
lappend addOption(converterList) $converterProgram
lappend addOption(description) $description
#
# here some preprocessing of the args
# ... insert HERE ...
lappend addOption(args) $args
lappend addOption(usage) [format " %s <file>\n%s\n" $option $description]
}
proc addOption:parse {option filedir} {
global addOption system
if { ! [info exists addOption(optionList)] } {
#wm withdraw .title
if { [winfo exists .title] } {
destroy .tilte
}
ErrorDialog "bad option \"$option\""
XCrySDenUsage
}
set head [file rootname [file tail $filedir]]
set ind [lsearch $addOption(optionList) $option]
if { $ind >= 0 } {
set converter [lindex $addOption(converterList) $ind]
#
# take care of args (tey to be done)
if { [eval xcCatchExec $converter $filedir > $system(SCRDIR)/$head.xsf] } {
exit 1
}
ViewMol .
xsfOpen $system(SCRDIR)/$head.xsf
} else {
ErrorDialog "ERROR: Bad option: $option"
XCrySDenUsage
}
}
proc addOption:register {} {
global system env
if { [file exists $system(TOPDIR)/addOptions] } {
source $system(TOPDIR)/addOptions
}
}
proc addOption:printCustomUsage {} {
global addOption
if { ! [info exists addOption(optionList)] } {
return
}
puts stderr "-----------------------"
puts stderr " Custom User options"
puts stderr "-----------------------\n"
foreach usage $addOption(usage) {
puts stderr $usage
}
puts stderr {}
}
proc addOption:hardcoded {converter {filedir {}} {openwhat {}} {viewmol_exists {}}} {
global system
if { $filedir == {} } {
set filedir [tk_getOpenFile -defaultextension .xsf \
-filetypes {
{ {All Files} {.*} }
} -initialdir $system(PWD) -title $openwhat]
if { $filedir == "" } {
return
}
set viewmol_exists 1
}
set head [file rootname [file tail $filedir]]
if { [eval xcCatchExec $converter $filedir > $system(SCRDIR)/$head.xsf] } {
exit 1
}
if { $viewmol_exists == "" } {
ViewMol .
}
xsfOpen $system(SCRDIR)/$head.xsf
}
|