| ###################################################################### | | ----- |\/| Useful phrases |\/| ----- | saveTSclone | Saves Timestamped clone . Useful when doing dangerous things bye R0 DMP cr ev >R0 R0 DMP | sF6 . useful for executing when ' save bombs Dnames 4 _partition ' blMV 'm | names in ' _d dictionary . ' _d is initialized to ' R 2 sigdig dup @ --cab ! _i | set floating display precision & return previous CoSyDir Dir fileDialog >t0> | fullPaths >t0> | get file name(s) rShow `D@ .r closeWdo | CLOSE WINDOW ec Words # | .. blpad `_ > conn 10 _-+ ,/ at reverse ec Words ` compile con | ' :?? 'm Xwords flip >t0> | s" context: ~sys" v@ blVM t0 s" context: ~doubles" v@ >t1 t1 blVM 4 _partition ' blMV 'm ` \4thCoSy\CoSy\CoSy.csy startJob | F> str>lst | dsc "blMV | \/ | SEARCHES | \/ | | NB: examples below generally have whatever phrase I last searched for . s" svg " ?? | Help on any phrase in CoSy scripts . | if embeded " use s/" and remember to double " \\" . `( sys CoSySource )` Dv@ | list of scripts searched | 20190819 ` a> :?? | returns only those lines connected w the definition not uses . ec Help | RevaForth help | Empty arg gives overview . ` flow-control Help res> >t0> blVM ' Help 'm | clean up the ` uses: words & show Help on each ` pi See ` con Words | >t0> | defined words containg phrase . use "bl for all words Xwords >t0> | all words in all contexts t0 flip 1 _at "bl MV blVM ` pi con ` text Dv@ daylncut >t0> s" grade" con ( ` refs- con ) reverse ` text Dv@ lfVM ` svg con res> >t0> | useful after editing list of "See also:" refs in help t0 blVM ' Help 'm s" help " shell> R0 lfVM s" earth" con R0 Dv@ s" ( " toksplt s" morse" con t0 ' ?? 'm `( r@ rr@ rpick )` ' See 'm | see x86 code for word , here several related | /\ | SEARCHES | /\ | | \/ | convenient lists . Execute w F6 to display and set ` resvar to name | ` ToDo -> ` ref -> ` Addrs -> | /\ | convenient lists | /\ | F6 to display and set ` resvar holds name | | ctrl-s in res to save to ` resvar | | == | ` BROWSER -> | address of browser used by ' cF9 to open URLs ` LanguageLinks -> | an informal listing of interesting relevant sites ` C:/4thCoSy/CoSy/CoSy.csy F> str>lst `( text )` >t0> v@ >t1> | t0 Dv! t1 lfVM ` http con ` Fact Dv@ ` Planets v@ | .avgTemp v@ `( Fact Fact )` -> >t0> | non Script of basic physical units and conversions . t0 lfVM ` hec con 200. 2.47105 f/ _f `_ d1 ?? | set dialog size & position | `( sys )` Dv@ d1 @ _i d1 @ _getPos `( sys Tui posXY )` Dv! | Stores current upper left corner for restart s" _" 69 _take s" | " s" |" ,L braket | create line below \/ | | _____________________________________________________________________ | | ~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/ | | \/ | ---- Editing MultiLine text , eg: fns w ` tstScript ---- | \/ | ` script0 -> ` script0 -> rUpdate | show , edit final startup script . set display parameters rGet ` script0 Dv! ` script0 Dv@ ^eval | execute ` script0 startup script | normally executed on start up EoDefs mark EoDefs ec Words | .. ` af conn 10 _-+ ,/ at reverse ` tstScript -> | Test script for interactively editing multiline fns ` tstScript Dv@ Eval | save . Then execute to redefine . forgettst | ============================================================= | | in .r Window | really need test for if one is initialized . text> >t1> res> >t1> ` tstScript -> | Dv@ >t1> ` tstScript Dv@ Eval rGet >T0> Eval fileDialog >t0> | get file name ` C:/4thCoSy/CoSy/math.f F> Eval | for various rand & math fns . ` C:/4thCoSy/Physics/general.f | F> Eval `( sys CoSySource )` Dv@ { dup F> lfVM ` gra con ,L } 'm `( sys needsList )` Dv@ lfVM "bl ' prt>f 'L ` ./CoSy/util.f ` ./CoSy/CoSy.f | >Fn> F> >Ft> rUpdate | CoSy.f ` ./CoSy/Furniture.f | >Fn> F> >Ft> rUpdate ` ./CoSy/SaveRestore.f ` ./CoSy/Derived.f ` ./CoSy/ParameterPushing.f ` ./lib/math/floats ` C:/4thCoSy/lib/math/doubles ` C:/4thCoSy/CoSy/math.f | F> Eval ` C:/4thCoSy/CoSy/AcntFns.f F> ` ./CoSy/sort.f ` ./CoSy/Tui.f | F> ` ./CoSy/Job.f | F> ` ./src/reva.f ` ./src/revacore.asm ` ./lib/util/disasm ` ./lib/debugger ` ./lib/date/calendar F> ` ./lib/math/floats ` ./lib/ui/gui | F> ` ./lib/ui/iup ` ./src/macros ` ./lib/alg/enum rShow R0 | simple clever ( because it took me so long to think of it ) soln to getting name before ' rShow | 20201227.2211 R0 >Fn> F> >Ft> rUpdate R0 Ft rUpdate rGet >Ft> lf>nl Fn >F | Write to file Ft Fn ` .bk cL >F Fn | F> rGet >T0> Ft lfVM ` cosystart con Ft lfVM >t0> s" f( " conn >t1> t0 t1 at ,L flip Ft daylncut ` exception con t1 t0 t1 at ,L flip R0 dsc >t0> t0 fmtI dsc ` ,1 cL ` .r Dv@ JobHndlt_ setcaret ` text >Fn> Dv@ >Ft> rUpdate rGet >t1> t0 Dv! Ft Fn ` bk cL >F Fn F> Fn ymdhm cL >F | clone TS backup Ft lfVM Fn F> nlVM ,L >t0> #' | compare cur txt w file t0 ' match ./ `D@ .r JobHndld_ _getSize `( .r Tui SIZE )` Dv! `D@ .r JobHndld_ _getPos `( .r Tui posXY )` Dv! s" LUCIDA CONSOLE::14" `( .r Tui FONT )` Dv! `D@ .r closeWdo | CLOSE WINDOW | -- Fn F> t0 ` bk cL >F rGet lfVM Ft lfVM .. s" : at!" conn 10 _-+ ' at 'R t1 lfVM ` sort con bye ` r Words t0 | F> `( .r Tui )` Dv@ t1 rShow t1 `( .r text )` Dv! | Save string in ` .r | `( .r text )` Dv@ `D@ .r dup setWdo showWdo | create & show : Show "lf MV s" .r text" blVM Dv! s" .r" Dv@ dup setWdo showWdo ; `D@ .r showWdo | show again if hidden t0 "lf MV dup `( .r text )` Dv! t1 `D@ .r JobHndlt settxt | assign new text & show `D@ .r JobHndlt gettxt `( .r text )` Dv! | retrieve changed text from window `( .r text )` Dv@ lf>nl t0 >F i( 0 0 )i `D@ .r `( Tui hndl )` v! ` closeWdo ?? res> blVM ' Help 'm t1 lf>nl t0 >F ' lf>nl _i res> `( .r text )` Dv! | Save string in ` .r `D@ .r dup setWdo showWdo | create & show `D@ .r showWdo | show again if hidden t0 "lf MV dup `( .r text )` Dv! `D@ .r JobHndlt settxt | assign new text & show `D@ .r JobHndlt gettxt `( .r text )` Dv! | retrieve changed text from window `D@ .r closeWdo | close it `( .r text )` Dv@ lf>nl t0 >F t0 s" dir examples " shell> | /\ | ---- Editing MultiLine text , eg: fns w ` tstScript ---- | /\ | | ###################################################################### | | \/ | SEARCHING MULTIPLE TEXT FILES | \/ | fileDialog >t0> | Log files as selected by fileDialog : ` C:/4thCoSy/CoSy|y2015.txt|y2016.txt|y2017.txt|y2018.txt|y2019.txt|y2020.txt >t0> t0 fullPaths >t0> | collect the names of archived ` text files | CoSyDir dup ` /b cL dir nlVM ` .txt con ` y20 con ` xact ncon ' cL 'R >t0> t0 4 _at F> rUpdate t0 { F> daylncut s" _delta " con } 'm dae >t1> | finding all days in files containg phrase t0 { F> lfVM ` grap con } 'm dae >t1> | finding all lines in files containg phrase t1 { ` helmar con } 'm | of those find ones containing ` helmar ` TekLogArk -> | 2012 - 2014 | First log notes s" ./CoSy/y2015.txt" F> >t0> | example of single file search t0 daylncut s" job" con | search for occurace of phrase | ` C:\4thCoSy\lib/b Dir | /\ | SEARCHING MULTIPLE TEXT FILES | /\ | | ###################################################################### | |\/| |\/| |\/| DOS & NETWORK COMMUNICATION & SYNCHRONIZATION | |\/| |\/| fileDialog >t0> | browse for a file name . s" dir /? " shell> | help for windows dir cmd . s" dir C:/4thCoSy/CoSy/" dosslash^ shell> | using dosslash^ to use forward slashes s" dir " CoSyDir cL shell> | dir defaults to dir Reva started in . s" C:/CoSy/tmp.txt" F> | return contents of text file | got problems | s" CoSy\\ReadMe.txt" ' shell onvan | execute file with its associated app . | | note use of non-resulting ' shell . ` shell> bombs CoSy when task done . | copying to another machine on network s" dir \\CoSy2013\4thCoSy\CoSy\ " shell> | useful to check connection . s" dir CoSy\\*.f /b /s " shell> >t0> | get full source file names , t0 "nl toksplt -1 _i cut* >t0> | split on nl . drop empty last row | Alternatively w short names but selecting from all files s" dir CoSy\\ /b " shell> VMnl -1 _i cut* >t0> | get naked dir and return | as list of strings . Note cannot use ` dosslash^ to avoid doubling of backslash t0 s" .f" con >t0> | select *.f CoSy source files t0 s" .f~" ncon >t0> | I keep a few links to CoSy lists I sometimes want to retrieve something from | like the environment on my netbook . For instance to copy my ` ToDo list | to when I'm going shopping , or returning . I'll execute one of the strings | below to set R0 , then restore that file | \/ | RESTORING AN ITEM FROM FILES | \/ | fileDialog >t0> | browse for file name or names | NB . ' fileDialog sometimes bombs | /\ | | For CoSy dictionary ` SAVE files | s" C:/4thCoSy/CoSy/CoSy.csy" s" C:/4thCoSy/CoSy/CoSy.bk" s" //COSYSTICK/c/4thCoSy/CoSy/CoSy.csy" s" D:/CoSy.csy" F> str>lst ` T0 v@ R0 >t0> t0 F> >t1> rho | check shapes for integrity . t1 str>lst >t0> rho' t0 ` text v@ t0 ` text >t1> v@ | Stick in whatever object you want s" needs" words> >t0> s" : text> " ?? see text> text> >T0> T0 textwdo @ z" VALUE" ` T0 Dv@ van zt IupStoreAttribute _i : >text ( str -- ) textwdo @ z" VALUE" --bca van zt IupStoreAttribute _i ; T0 >text ` .\CoSy\CoSy.csy F>/\ >t0> ` help v@ ` help Dv! R0 R t1 v! | replace local of object copy with one from file read . | /\ | RESTORING AN ITEM FROM A *.csy FILE | /\ | s" |/\\| " i( 1 80 )i take rho | s" |/\\| " s" |\\/| " ,L { i( 2 80 )i take } 'm |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| | ###################################################################### | | ~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~ | | \/ | ---- SAVING MAIN TEXT WINDOWS for publishing ---- | \/ | text> ` C:/CoSyWeb/4thCoSy/Code/CoSy/WorkLog.txt >F CoSyDir `( ToDo text help state )` >t0> t0 { dup Dv@ swap CoSyDir swap s" .txt" cL cL >F ev } 'm s" help" Dv@ s" \4thCoSy\CoSy\help.txt" >F `D@ state s" \4thCoSy\CoSy\state.txt" >F s" dir cosy" shell> | 20210327.1722 long dead | https://github.com/CoSyBob/CoSy/blob/4thCoSy/LanguageLinks.txt | /\ | ---- SAVING MAIN TEXT WINDOWS for GITHUB publishing ---- | /\ | | ~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\ | |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| | ###################################################################### | | ###################################################################### | | \/ \/ \/ | for checking Allocate - Free matching | \/ \/ \/ | ` AF1 ?? AF1 |ymd.hm| str>pad_ type AF0 | >t0> | turn on off allocates frees AF1 s" ab" lst>stk AF0 s" " words> t0 DMP AF> +-splt >t0> #' ,/ | ' = acrossI t0 i( 1 -1 )i s" ac" ?? AF> fmtI 10972264 DMP AF> +/ AF> rho AF> i0 >i R0 ' rho eachM> R0 ' -i across t1 | /\ /\ /\ | for checking Allocate - Free matching | /\ /\ /\ | | ###################################################################### | | ###################################################################### | | ###################################################################### | | ###################################################################### | revaver _str |>| | ###################################################################### | | ======================================================================= | | NOTE : the ` script0 variable is executed upon start up . | Most importantly this script sets the parameters for the IUP TUI . ` script0 -> | Startup script . Remember to cS in it to save changes . ` ref Dv@ vm s" visa" con | return lines in ` ref containing s" visa" | F6 | ###################################################################### | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | s" =" 70 _take s" | " enc braket | ====================================================================== | | ###################################################################### | | /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ | | ###################################################################### | | ###################################################################### |