| ###################################################################### | | ----- |\/| Useful phrases |\/| ----- | saveTSclone | Saves Timestamped clone . Useful when doing dangerous things bye | close CoSy . if F6 saves first . sF6 does not . | If cmd wdo persisting , restart with Restart . rShow 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 ec Words | .. blpad `_ fmt conn 10 _-+ ,/ at reverse zic Words ` dir con CoSyDir Dir ` dir :?? fileDialog >t0> | get file name text> daylncut ` electron con ` Refs :?? `(
)` >t0> t0 { dup dsc ` / cL swap 1 _cut cL } 'm reverse blMV
rGet >T0> rShow ` C:/CoSyWeb/y21/Wed.Feb,20210210.html >Fn> F> >Ft> rUpdate rGet >Ft> Fn >F | Write to file Fn F> >Ft> rUpdate Ft Ft ` ss cut enc' >t0> t0 Ft ` ` tokcut { -10 _take } 'm Ft ` ,L braketed Fn F> Ft match rGet >Ft> >T0> | Fn >F Ft ` rUpdate Ft lfVM s/" moz-do-not-send=\"true\"" con Ft s/" moz-do-not-send=\"true\"" ssd >t0> Ft ` tokcut Ft ` ` ,L braketed Ft swap | 20 _-+ Ft swap ' at 'R ` around ?? dup @ _i | \/ | uploading | \/ | text> ` C:/CoSyWeb/y21/Blog.txt >F text> lfVM >t0> | grab the content of the ` text window . split on lineFeeds t0 s" | ======================== | " conn >t1> | indices of all the Daylns | t0 t1 at >t2> { ` , prt>f "bl prtt3> | suck out the dates t3 s/" ,L ' braket 'L >t3> | add HTML for anchor t3 t2 ' cL 'd t0 t1 at! | insert those line back into original t0 `
MV ` C:/CoSyWeb/y21/Blog.html >F | ravel with html line breaks & write to file t0 ` con state> ` C:/CoSyWeb/y21/Blog_state.txt >F rShow res> >t0> t0 t0 "bl ss >t1> t1 45 _i modi ' - _delta 0 :?? | returns only those lines connected w the definition not uses . s/" " Help | RevaForth help | Empty arg gives overview . res> >t0> blVM ' Help 'm | clean up the ` uses: words & show Help on each ` pi See ` con Words | >t0> Xwords >t0> | all words in all contexts t0 flip 1 _at "bl MV blVM ` hex con s" Wdo" Words >t0> | defined words containg phrase . use "bl for all words t0 ' ?? 'm `( r@ rr@ rpick )` ' See 'm | see x86 code for word , here several related words~ ~floats s" f1. " See ` text -> `( daylncut lfVM )` 0 _at Eval >t0> s" vdel " con | \/ | convenient lists . Execute w F6 to display and set ` resvar to name | ` ToDo -> | /\ | 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 R0 lfVM s" earth" con R0 Dv@ s" ( " toksplt s" morse" con ` text Dv@ daylncut >t0> s" iver" con reverse ` text Dv@ lfVM s" end" con res> >t0> | useful after editing list of "See also:" refs in help s" help " shell> ` 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 )` -> | non Script of basic physical units and conversions . R0 lfVM ` con ` C:/4thCoSy/CoSy/math.f F> Eval | for various rand & math fns . ` C:/4thCoSy/Physics/general.f F> | Eval d1 @ getPos `( sys Tui posXY )` Dv! | Stores current upper left corner for restart s" _" 69 _take s" | " s" |" ,L braket | _____________________________________________________________________ | | ~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/~\/ | | \/ | ---- Editing MultiLine text , eg: fns w ` tstScript ---- | \/ | ` script0 -> | show , edit final startup script . set display parameters ` script0 Dv@ ^eval | execute ` script0 startup script | normally executed on start up zic Words | .. ` =c 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 . res> rUpdate | dup ` tstScript Dv! `( .r text )` Dv@ rShow | == | ` between ?? t0 >Ft> Ft rUpdate Ft Fn >F con ' dlb 'm R0 F> R0 >Fn> F> >Ft> Fn Ft rUpdate rGet >Ft> lf>nl Fn >F | Write to file Ft lfVM Fn F> nlVM ,L >t0> #' t0 ' match ./ rGet >t1> t0 Dv! 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@ s" LUCIDA CONSOLE::10" `( .r Tui FONT )` Dv! `D@ .r JobHndld_ _getsize `( .r Tui SIZE )` Dv! `D@ .r JobHndld getPos `( .r Tui posXY )` Dv! `D@ .r closeWdo | CLOSE WINDOW rShow : rGet s" .r" Dv@ JobHndlt gettxt .. `( .r text )` Dv! | retrieve changed text from window s" .r" Dv@ t0 aux> s" text" v! `( .r text )` 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 ?? 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 | \/ | | Log files as selected by fileDialog : ` C:/4thCoSy/CoSy|y2015.txt|y2016.txt|y2017.txt|y2018.txt|y2019.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> t1 lfMV lfMV rUpdate t0 { F> daylncut ` hsort con } 'm dae >t1> | finding all days in files containg phrase t0 { F> lfVM s" sort" 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 | | /\ | 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 rho | ` text v@ T0 10 _take 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 ---- | \/ | `( ToDo text help state )` ( LanguageLinks ) >t0> t0 { dup Dv@ swap CoSyDir swap s" .txt" cL cL >F ev } 'm s" text" Dv@ s" .\CoSy\text.txt" >F s" .\CoSy\text.txt" shell^ s" help" Dv@ s" \4thCoSy\CoSy\help.txt" >F `D@ state s" \4thCoSy\CoSy\state.txt" >F s" dir cosy" shell> https://github.com/CoSyBob/CoSy/blob/4thCoSy/LanguageLinks.txt | /\ | ---- SAVING MAIN TEXT WINDOWS for GITHUB publishing ---- | /\ | | ~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\~/\ | |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| |/\| | ###################################################################### | | ###################################################################### | | \/ \/ \/ | for checking Allocate - Free matching | \/ \/ \/ | t0 L|R cL 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 | ' rho 'm ,/ | ' = acrossI 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 | ====================================================================== | | ###################################################################### | | /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ | | ###################################################################### | | ###################################################################### |