Changeset 14381 for src/Pugs/Prim.hs

Show
Ignore:
Timestamp:
10/17/06 08:27:08 (2 years ago)
Author:
audreyt
svk:copy_cache_prev:
21206
Message:

* Pugs.Prim: New "printf" builtin.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim.hs

    r14369 r14381  
    11031103op2 "IO::say" = op2Print hPutStrLn 
    11041104op2 "IO::print" = op2Print hPutStr 
     1105op2 "printf" = op3 "IO::printf" (VHandle stdout) 
    11051106op2 "BUILDALL" = cascadeMethod reverse "BUILD" 
    11061107op2 "Pugs::Internals::install_pragma_value" = \x y -> do 
     
    13371338        modeOf 2 = SeekFromEnd 
    13381339        modeOf m = error ("Unknown seek mode: " ++ (show m)) 
     1340op3 "IO::printf" = \x y z -> do 
     1341    rv      <- evalExp $ App (_Var "&sprintf") Nothing [Val y, Val z] 
     1342    op2Print hPutStr x rv 
    13391343op3 other = \_ _ _ -> fail ("Unimplemented 3-ary op: " ++ other) 
    13401344 
     
    19331937\\n   Bool      pre     print   safe ()\ 
    19341938\\n   Bool      pre     print   safe (List)\ 
     1939\\n   Bool      pre     IO::printf   unsafe (IO: Str, List)\ 
     1940\\n   Bool      pre     printf   safe (Str, List)\ 
    19351941\\n   Str       pre     Pugs::Internals::sprintf safe   (Str, Num|Rat|Int|Str)\ 
    19361942\\n   Bool      pre     IO::say unsafe (IO)\