📄 miscscripts
字号:
#..........................................................................# # L a s t W a v e P a c k a g e 'misc' 2.0## Author Emmanuel Bacry # #..........................................................................# Function that deletes a global array if it is emptysetproc _DeleteEmptyGlobalArray {{&word array}} { if (![var exist 1 $array]) {return} global `$array a` if ([array list a].length==0) {return} var delete 1 $array}# Printing "nice"setproc nice {val} "{{{<val>} {Recursive display of an array or a listv}}}" { _nice val 0} setproc _nice {val n} { if (type(val) == '&array') { names = [listv sort [array list val]] if (n != 0) {printf "\n"} foreach l names { printf " "*n printf "-> %s : " l _nice val.$l n+1 } } elseif (type(val) == '&listv') { if (n != 0) {printf "\n"} foreach l 0:val.length-1 { printf " "*n printf "-> %2d : " l _nice val[l] n+1 } } else { printf "%V\n" val }} setproc Demo {} "{{{} {Command that explains how to run the demos of the different numerical packages}}}" { echo echo ******************************************************************************************** echo *** echo *** Right after this paragraph, you will find the lists of Demo files that are available echo *** for each numerical package. echo *** In order to run one of them just type echo *** echo *** source <DemoName> echo *** echo *** (e.g., 'source DemoMP'). Then just hit the 'carriage return' key. echo *** This will load all the demo commands that are available in the corresponding file. echo *** Most of the files contain several commands corresponding to different demos. echo *** When you source the file, LastWave will print for each command, the syntax of the command echo *** (most of them don\'t have any argument) and a short description of what the demo is about. echo *** echo *** Let us note that the demo files with names ending with the letters 'WT' reproduce some echo *** figures of the book \'A Wavelet Tour in Signal Processing\' by S. Mallat. echo *** echo *** Enjoy LastWave !! echo *** echo *** MY ADVICE IS TO START WITH : echo *** > source DemoSignal echo *** > DemoSignalDisp echo *** global _scriptDirectory list=[package list] foreach l list { l=l[0] demoList=[file list _scriptDirectory[0]+'/'+l+'/'+'Demo*'] if (demoList.length != 0) { l1 = l.length if (l1 <= 10) { l1 = 10-l1 } else { l1 = 0 } printf "- Package $l %s : " " "*l1 foreach ll demoList { printf "%s " ll } printf "\n" } }} setproc StartDemo {{&word name}} "{{{*baseProcName*} {When calling this function it will print a one-line-help that tells you how to \navigate through the demo : 'N' for next step 'R' for repeat and 'P' for previous step. At each step of the demo, the procedure which name \is the '_' character followed by *baseProcName* followed by the step number (starting from 0) is called until such a procedure does not exist in which case the Demo is supposed to be over.}}}" { echo echo **** echo **** Starting Demo '$name' \[#0\] echo **** echo import args 1 System if (System == 'mac') { echo printf "(NOTE : For mac users who are using a single button mouse, this button \corresponds to the left button. The middle (resp right) button is accessed \by holding down the option(or alt) key (resp. cmd key ) while pressing \the mouse button. If it does not work, please read the Important Note in the INSTALL_MACOSX file.)\n" } if (System == 'windows') { echo printf "(NOTE : For windows users who are using a 2-button mouse, these buttons \correspond to the left/right buttons. The middle button is accessed \by holding alt key while pressing \the left mouse button. If it does not work, please read the Important Note in the INSTALL_WINXP file.)\n" } global &array Demo Demo.n = -1 Demo.name = name terminal prompt %{}{ global &array Demo n1 = Demo.n+1 if ([proc slist '_$Demo.name$n1'].length==0) { num = 'last' } else { sprintf num "%d" Demo.n } return Demo.name+' #'+num+' > ' } setproc N {} { global &array Demo Demo.n+=1 if ([proc slist '_$Demo.name$Demo.n'].length==0) { echo printf "*** The demo '%s' is over!\n" Demo.name proc delete %N proc delete %P proc delete %Q proc delete %R terminal prompt %_Prompt return } echo echo **** n1=Demo.n+1 if ([proc slist '_$Demo.name$n1'].length==0) { num = 'last' } else { sprintf num "%d" Demo.n } echo **** Demo '$Demo.name' \[#$num\] echo **** echo apply args %_$Demo.name$Demo.n echo printf "('N' -> go on , 'R' -> repeat same, 'P' -> previous, 'Q' -> quit)\n" echo return } setproc R {} { global &array Demo Demo.n-=1 n } setproc P {} { global &array Demo if (Demo.n >=1) { Demo.n-=2 } else { Demo.n-=1 } n } setproc Q {} { terminal prompt %_Prompt proc delete %N proc delete %P proc delete %Q proc delete %R return } Demo.n+=1 apply args %_$Demo.name$Demo.n echo printf "('N' -> go on , 'R' -> repeat same, 'P' -> previous, 'Q' -> quit)\n" echo return} setproc sendattime {{&int yyyymmdd} {&int hhmmss} {&script sc}} { s = [time 2sec {yyyymmdd hhmmss}] setbinding 'send' terminal time s sc binding activate 'send'}## Convert capital to small letters#setproc _Cap2Small {{&string str}} { l = [str 2ascii str] l = [listv map l %{s}{if (s>=65 && s<=90) {return s+32} else {return s}}] return [str ascii2 l]}## Convert small to capital letters#setproc _Small2Cap {{&string str}} { l = [str 2ascii str] l = [listv map l %{s}{if (s>=65+32 && s<=90+32) {return s-32} else {return s}}] return [str ascii2 l]}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -