Diff for /gforth/prims2x.fs between versions 1.110 and 1.111

version 1.110, 2002/08/20 07:59:01 version 1.111, 2002/08/20 16:59:01
Line 78  variable line-start \ pointer to start o Line 78  variable line-start \ pointer to start o
 0 line !  0 line !
 2variable filename \ filename of original input file  2variable filename \ filename of original input file
 0 0 filename 2!  0 0 filename 2!
   2variable out-filename \ filename of the output file (for sync lines)
   0 0 out-filename 2!
 2variable f-comment  2variable f-comment
 0 0 f-comment 2!  0 0 f-comment 2!
 variable skipsynclines \ are sync lines ("#line ...") invisible to the parser?  variable skipsynclines \ are sync lines ("#line ...") invisible to the parser?
 skipsynclines on   skipsynclines on
   variable out-nls \ newlines in output (for output sync lines)
   0 out-nls !
   
 : th ( addr1 n -- addr2 )  : th ( addr1 n -- addr2 )
     cells + ;      cells + ;
Line 121  skipsynclines on Line 125  skipsynclines on
             0              0
         recover endtry          recover endtry
         r> to outfile-id throw          r> to outfile-id throw
         abort          1 (bye) \ abort
     endif ;      endif ;
   
 : quote ( -- )  : quote ( -- )
     [char] " emit ;      [char] " emit ;
   
   \ count output lines to generate sync lines for output
   
   : count-nls ( addr u -- )
       bounds u+do
           i c@ nl-char = negate out-nls +!
       loop ;
   
   :noname ( addr u -- )
       2dup count-nls
       defers type ;
   is type
   
 variable output          \ xt ( -- ) of output word for simple primitives  variable output          \ xt ( -- ) of output word for simple primitives
 variable output-combined \ xt ( -- ) of output word for combined primitives  variable output-combined \ xt ( -- ) of output word for combined primitives
   
Line 647  stack inst-stream IP Cell Line 663  stack inst-stream IP Cell
 : type-c-code ( c-addr u xt -- )  : type-c-code ( c-addr u xt -- )
     \ like TYPE, but replaces "INST_TAIL;" with tail code produced by xt      \ like TYPE, but replaces "INST_TAIL;" with tail code produced by xt
     { xt }      { xt }
       ." {" cr
       ." #line " c-line @ . quote c-filename 2@ type quote cr
     begin ( c-addr1 u1 )      begin ( c-addr1 u1 )
         2dup s" INST_TAIL;" search          2dup s" INST_TAIL;" search
     while ( c-addr1 u1 c-addr3 u3 )      while ( c-addr1 u1 c-addr3 u3 )
Line 655  stack inst-stream IP Cell Line 673  stack inst-stream IP Cell
         2r> 10 /string          2r> 10 /string
         \ !! resync #line missing          \ !! resync #line missing
     repeat      repeat
     2drop type ;      2drop type
       ." #line " out-nls @ 2 + . quote out-filename 2@ type quote cr
       ." }" cr ;
   
 : print-entry ( -- )  : print-entry ( -- )
     ." LABEL(" prim prim-c-name 2@ type ." )" ;      ." LABEL(" prim prim-c-name 2@ type ." )" ;
           
 : output-c ( -- )   : output-c ( -- ) 
  print-entry ."  /* " prim prim-name 2@ type ."  ( " prim prim-stack-string 2@ type ." ) */" cr      print-entry ."  /* " prim prim-name 2@ type ."  ( " prim prim-stack-string 2@ type ." ) */" cr
  ." /* " prim prim-doc 2@ type ."  */" cr      ." /* " prim prim-doc 2@ type ."  */" cr
  ." NAME(" quote prim prim-name 2@ type quote ." )" cr \ debugging      ." NAME(" quote prim prim-name 2@ type quote ." )" cr \ debugging
  ." {" cr      ." {" cr
  ." DEF_CA" cr      ." DEF_CA" cr
  print-declarations      print-declarations
  ." NEXT_P0;" cr      ." NEXT_P0;" cr
  flush-tos      flush-tos
  fetches      fetches
  print-debug-args      print-debug-args
  stack-pointer-updates      stack-pointer-updates
  ." {" cr      prim prim-c-code 2@ ['] output-c-tail type-c-code
  ." #line " c-line @ . quote c-filename 2@ type quote cr      output-c-tail2
  prim prim-c-code 2@ ['] output-c-tail type-c-code      ." }" cr
  ." }" cr      cr
  output-c-tail2  
  ." }" cr  
  cr  
 ;  ;
   
 : disasm-arg { item -- }  : disasm-arg { item -- }
Line 1026  stack inst-stream IP Cell Line 1043  stack inst-stream IP Cell
     part-fetches      part-fetches
     print-debug-args      print-debug-args
     prim add-depths \ !! right place?      prim add-depths \ !! right place?
     ." {" cr  
     ." #line " c-line @ . quote c-filename 2@ type quote cr  
     prim prim-c-code 2@ ['] output-combined-tail type-c-code      prim prim-c-code 2@ ['] output-combined-tail type-c-code
     ." }" cr  
     part-output-c-tail      part-output-c-tail
     ." }" cr ;      ." }" cr ;
   

Removed from v.1.110  
changed lines
  Added in v.1.111


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>