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,440 of 117,927   
   sjack to All   
   Re: Numeric string output - conspicuousl   
   30 Apr 24 10:16:41   
   
   From: sjack@dontemail.me   
      
   Frog code (Fig not standard):   
   [#] pno.d -- Pictured Numeric Output exploits   
   --.   
   [r] #>S  ( -- s )   
   -- Pictured numeric returning (counted) string   
   : #>S    #> HOLD 1- ;   
      
   -- String, S , in Frog code is single address pointing to byte   
   -- counted string.   
   --      <# ... #>  ( a u ) TYPE   
   --      <# ... #>S ( a )   TELL   
   --.   
   [r] S<#  ( n -- d ) Immediate   
   -- Macro for Single-number pictured numeric   
   : S<#   "ZERO <#" EVAL ; IMM   
      
   -- Frog leaves '<#' to work with double number and   
   -- uses macro 'S<#' as indicament of working with single number.   
   --    666. <# ... #>  TYPE   
   --    666 S<# ... #>S TELL   
   --.   
   [r] PNO buffer   
   The PNO can be any buffer by pointing HLD to the buffer's end and   
   using an alternative to '>#' :   
      
   mpad 256 + tmp!   
   tmp@ hld !   
   "[m" holds   
   27 hold   
   "world" holds   
   46 hold   
   "[0;33;40mhello" holds   
   27 hold   
   i. hld @ tmp@ om type  --> hello.world  ( yellow on black )   
   --.   
   [r] Source input buffer   
   -- Source input buffer is ring buffer for strings   
   : <#IB 256 SIB + DUP HLD ! TMP! ;   
   : IB#> 2DROP HLD @ TMP@ OM ;   
   : SIB#>S HLD @ TMP@ OM HOLD 1- ;   
      
   -- sib ( u -- u a )   
   : <#IB 256 SIB + DUP HLD ! TMP! ;   
   : IB#> 2DROP HLD @ TMP@ OM ;   
   : SIB#>S HLD @ TMP @ OM hold 1- ;   
      
   <#ib "[m" holds        27 hold SIB#>S   
   <#ib "[0;33;40m" holds 27 hold SIB#>S   
   2dup   
   1 text Hello World!   
   i. tell pad tell tell --> Hello World!  ( yellow on black)   
   1 text How are you?   
   i. tell pad tell tell --> How are you?  ( yellow on black)   
   --.   
   [s]   
   OM	( a1 a2 -- a1 u ) over -   
   tell	( a ) count type   
   sib     ( u -- u a ) \ a is buffer from ring of size u+2; last chr is null   
                        \ used for counted string, null terminated string or   
                        \ both.   
   i.                   \ print ' --> '   
   --.   
   [#] //   
      
   --- 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