############################################################# # std.mac # standard macros (copied from or inspired by ESRF stlocal.mac) # author: d smilgies 2/2002 ############################################################# p "executed std.mac" ################################################################ # setup facilty # edit setup.mac and gsetup.mac from within SPEC # smi 8/01 ################################################################ # SETUP MACROS ############## # edit setup.mac and gsetup.mac files using standard text editor global EDITOR global SETUP global GSETUP # define EDITOR variable in "setup" : # EDITOR="/usr/bin/gedit" (suggested for RedHat LINUX) # EDITOR="kedit" (suggested for SUSE LINUX) SETUP=sprintf("%s/%s/setup.mac",SPECD,SPEC) GSETUP=sprintf("%s/gsetup.mac",SPECD) def setup '{ # wait for motors and counting to stop and update all positions, # before invoking setup waitall sync unix(sprintf("%s %s",EDITOR,SETUP)) # update all settings after change of setup resetup reconfig }' def gsetup '{ # wait for motors and counting to stop and update all positions, # before invoking setup waitall sync unix(sprintf("%s %s",EDITOR,GSETUP)) # update all settings after change of gsetup regsetup reconfig }' # update settings from setup.mac def resetup '{ global SETUP if(SETUP=="") {p "no setup macro found";exit} else {qdofile(SETUP)} }' # update settings from setup.mac and gsetup.mac def regsetup '{ global SETUP global GSETUP if(GSETUP=="") {p "no gsetup macro found";exit} else {qdofile(GSETUP)} if(SETUP=="") {p "no setup macro found";exit} else {qdofile(SETUP)} }' # user_config # make sure that gsetup.mac and setup.mac are invoked each time you config # affects config and reconfig def user_config '{ # remark: I found that gsetup should not be invoked each time after config - dms 4/02 # qdofile(sprintf("%s/gsetup.mac",SPECD)) qdofile(sprintf("%s/%s/setup.mac",SPECD,SPEC)) }' # udo # load macrofile from SPECD/umacros # source: ESRF def udo '{ if(file_info(sprintf("%s/umacros/$1",SPECD),"-r") ==1) qdofile(sprintf("%s/umacros/$1",SPECD)) else qdofile(sprintf("%s/umacros/$1.mac",SPECD)) }' ############# end setup macros ############################################ ########################################################################### # file editing in LINUX # edit a file with EDITOR def edi '{ if($#<1) {p "usage: edi file";exit} unix(sprintf("%s %s",EDITOR,"$1")) }' # edit a macro file with EDITOR and execute it afterwards def medi '{ if($#<1) {p "usage: edi file";exit} unix(sprintf("%s %s",EDITOR,"$1")) qdo "$1" p "$1","updated" }' # umedi # edit a macrofile from SPECD/umacros # note: you need appropriate file system permissions or to log in as specadm def umedi '{ if($#<1) {p "usage: edi file";exit} if(file_info(sprintf("%s/umacros/$1",SPECD),"-r") ==1) { unix(sprintf("%s %s",EDITOR,sprintf("%s/umacros/$1",SPECD))) qdofile(sprintf("%s/umacros/$1",SPECD)) } else { unix(sprintf("%s %s",EDITOR,sprintf("%s/umacros/$1.mac",SPECD))) qdofile(sprintf("%s/umacros/$1.mac",SPECD)) } p SPECD "\/umacros\/" "$1","updated" }' # browse a file using UNIX more def more '{ if($#<1) {p "usage: more file";exit} unix(sprintf("more %s","$1")) }' # example: inspect look-up table for PCI card addresses # more /proc/pci ################ end editing macros ######################################### ############################################################################# # printing macros #def laser '{ # p "click on window to be printed" # u xwd | xpr -device ps -scale 2 | lp -dEast #}' #(xpr only in X11 directory of HPUX, have to find replacement for LINUX) def pon '{ # name of output file PRINTER="G-line" # delete previous output file u rm G-line # redirect ASCII output to file PRINTER p "redirecting ASCII output to printer queue \"gline@gtest\" " p "end redirection and print using \"poff\" " onp }' def poff '{ # stop redirection offp # print file PRINTER on specified queue (default: gline@gtest corresponding to hops.chess.cornell.edu) u lpr -Pgline@gtest G-line }' # useful LINUX printer commands # lpr prints to the default queue # lpq show printer queue # lprm [job] removes [job] from the printer queue # lpc status shows the status of the queue # the queue can be specified with the -Pqueue keyword (see above: poff) ################ end of printing macros #################################### ############################################################################# # plotting macros # useful variables def PEAK 'pl_xMAX' def CM 'pl_COM' # show all plot variables def plotvar 'lsdef *pl*' # change of plot y-axis and replot data def linplot "setplot 1155; plot" def logplot "setplot 1187; plot" def zeroplot "setplot 1171;plot" ################ end of plotting macros #####################################