home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,482 of 117,927   
   albert@spenarnc.xs4all.nl to dxforth@gmail.com   
   Re: Numeric string output - conspicuousl   
   10 May 24 11:49:46   
   
   In article <663d66dd$1@news.ausics.net>, dxf   wrote:   
   >On 10/05/2024 12:57 am, Anton Ertl wrote:   
   >> dxf  writes:   
   >>>> With that word you could write !SETTINGS as:   
   >>>>   
   >>>> \ Save settings to file   
   >>>> : .SETTINGS ( -- )   
   >>>>   ." [options]"   
   >>>>   ."  -s" send.s @  .   
   >>>>   ."  -c" char.s @  .   
   >>>>   ."  -d" wspace @  .   
   >>>>   cspace @  dup 3 <> and  ?dup if   
   >>>>     [char] , emit  .   
   >>>>   then   
   >>>>   ."  -t" tone @  .   
   >>>>   ."  -o" compress @ 0= and type   
   >>>>   ."  -p" punct @  .   
   >>>>   ."  -l" lsignal @ 0<> and type   
   >>>>   ."  -u" volume @  .   
   >>>>   cr ;   
   >>>>   
   >>>> : !settings ( -- )   
   >>>>   ['] .settings dxf's-default-file @ outfile-execute ;   
   >>>>   
   >>>> This allows you to test .SETTINGS interactively and eliminates the   
   >>>> need for words like WRITE, WRITECHR and WRITECR.   
   >>>   
   >>> And have it disappear off the screen   
   >>   
   >> The output of .SETTINGS is a single line.  You have a screen that   
   >> cannot display that and your system does not support scrolling back?   
   >>   
   >> But even if you prefer to work in such a deprived environment, the   
   >> advantage that you need just one additional word instead of a whole   
   >> bunch is still there.   
   >   
   >All this assumes one needs to see on screen what goes to disk.  That's   
   >exceptional in my experience.   
   >   
   >The fact remains forth has separate words for console and disk output:   
   >TYPE and WRITE-FILE.  These take adr/len strings as arguments.  The   
   >numeric primitive for that is (.) and friends.  Gforth uses numeric   
   >primitives to build "." but won't make it available to users to send   
   >directly to disk.  Standard Forth isn't much better.   
      
   This may not be so separate (in a Forth I'm familiar with ..)   
      
   : TYPE DUP OUT +! 1 WRITE-FILE THROW ;   
   : ETYPE 2 WRITE-FILE THROW ;   
   [ and : EMIT DSP@ 1 TYPE DROP ; ]   
      
   The 1 and 2 refer to standardout and standarderror (unix).   
   In windows version they are named STDOUT and STDERR.   
   >   
   >   
      
   Groetjes Albert   
   --   
   Don't praise the day before the evening. One swallow doesn't make spring.   
   You must not say "hey" before you have crossed the bridge. Don't sell the   
   hide of the bear until you shot it. Better one bird in the hand than ten in   
   the air. First gain is a cat purring.            - the Wise from Antrim -   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca