Changeset 14599 for src/Pugs/Prim.hs

Show
Ignore:
Timestamp:
11/03/06 05:30:51 (2 years ago)
Author:
allbery_b
svk:copy_cache_prev:
41990
Message:

AUTHORS: hello, world\n :)
src/Pugs/Compat.hs: added file time tests
src/Pugs/Internals.hs, src/Pugs/Prim.hs: abstract out guts of "time" for

use in $*BASETIME and file tests

src/Pugs/Run.hs: add $*BASETIME
src/Pugs/AST.hs: document _reserved and filterUserDefinedPad; add $*BASETIME

to _reserved

src/Pugs/Prim.hs: add file time operators -M, -C, -A
src/Pugs/Prim/FileTest.hs: add implementation of file time operators
t/operators/filetest.t: correct existing file time operator tests, add a few

more, add all of them to the plan

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim.hs

    r14574 r14599  
    7373op0 "time"  = const $ do 
    7474    clkt <- guardIO getClockTime 
    75     return $ VRat $ fdiff $ diffClockTimes clkt epochClkT 
    76     where 
    77        epochClkT = toClockTime epoch 
    78        epoch = CalendarTime 2000 January 1 0 0 0 0 Saturday 0 "UTC" 0 False 
    79        -- 10^12 is expanded because the alternatives tried gave type warnings. 
    80        fdiff = \d -> (fromInteger $ tdPicosec d) 
    81                    / (clocksPerSecond * clocksPerSecond) 
    82                    + (fromIntegral $ tdSec d) 
     75    return $ VRat $ pugsTimeSpec clkt 
    8376op0 "times"  = const $ do 
    8477    ProcessTimes _ u s cu cs <- guardIO getProcessTimes 
     
    430423op1 "-z"    = FileTest.sizeIsZero 
    431424op1 "-s"    = FileTest.fileSize 
     425op1 "-M"    = FileTest.fileMTime 
     426op1 "-A"    = FileTest.fileATime 
     427op1 "-C"    = FileTest.fileCTime 
    432428op1 "-f"    = FileTest.isFile 
    433429op1 "-d"    = FileTest.isDirectory 
     
    18241820\\n   Bool      spre    -e      unsafe (Str)\ 
    18251821\\n   Int       spre    -s      unsafe (Str)\ 
     1822\\n   Num       spre    -M      unsafe (Str)\ 
     1823\\n   Num       spre    -A      unsafe (Str)\ 
     1824\\n   Num       spre    -C      unsafe (Str)\ 
    18261825\\n   Bool      spre    -f      unsafe (Str)\ 
    18271826\\n   Bool      spre    -d      unsafe (Str)\