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 117,659 of 117,927   
   dxf to dxf   
   Re: Conditional compilation   
   02 Nov 25 11:32:01   
   
   From: dxforth@gmail.com   
      
   On 1/11/2025 11:37 am, dxf wrote:   
   > On 1/11/2025 12:45 am, Gerry Jackson wrote:   
   >> On 30/10/2025 19:46, albert@spenarnc.xs4all.nl wrote:   
   >> ...   
   >>> - never comment out conditional compilation.   
   >>   
   >> Why? I've shown that it can be done using \, that means that any use of   
   [IF] etc in the rest of the comment line is not executed   
   >   
   > This in fact was my intent during a debug session i.e. the [IF] was moved   
   > elsewhere temporarily.  I didn't want to delete the original as it was   
   > always going to be restored - hence my adding a preceding \ (which didn't   
   > work as I had hoped).  I knew what I wanted to do.  It's just that the   
   > existing tools didn't allow me.   
      
   Below is hack that implements it.  To what extent it's useful in debugging is   
   for each to determine.  I'm less excited about [ELSE] as a comment tool due   
   to potential clashes.  I have a simple one-liner for that (* *).  Again, it's   
   not something a screen user tends to use.   
      
   \ Original   
   : [ELSE] ( -- )   
     1  BEGIN   
       BL WORD COUNT ( 2DUP UPPER)  DUP IF   
         2DUP S" [IF]" COMPARE IF   
           2DUP S" [ELSE]" COMPARE IF   
             S" [THEN]" COMPARE 0=   
           ELSE  2DROP DUP 1 =  THEN   
         ELSE  2DROP 1  THEN  +   
       ELSE  2DROP REFILL  AND  THEN   
       ?DUP 0=   
     UNTIL   
    IMMEDIATE   
      
   : [IF]  0= IF  POSTPONE [ELSE] THEN ; IMMEDIATE   
      
   : [THEN ; IMMEDIATE   
      
   \ Modified to recognize '\' in skipped code   
   : [ELSE] ( -- )   
     1  BEGIN  BEGIN   
       BL WORD COUNT ( 2DUP UPPER)  DUP IF  [ 1 CS-ROLL ]   
         2DUP S" \" COMPARE 0= WHILE  2DROP  POSTPONE \  REPEAT   
         2DUP S" [IF]" COMPARE IF   
           2DUP S" [ELSE]" COMPARE IF   
             S" [THEN]" COMPARE 0=   
           ELSE  2DROP DUP 1 =  THEN   
         ELSE  2DROP 1  THEN  +   
       ELSE  2DROP REFILL  AND  THEN   
       ?DUP 0=   
     UNTIL   
    IMMEDIATE   
      
   --- 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