fixed version number
[CleanReadLine.git] / ReadLine.dcl
1 definition module ReadLine
2
3 import StdClass
4
5 :: Maybe a = Nothing | Just a
6 :: HistoryItem = {line :: String, timestamp :: String}
7 :: HistoryState = {entries :: [HistoryItem], offset :: Int, flags :: Int}
8
9 instance toString HistoryItem
10 instance toString HistoryState
11
12 //Maybe functions
13 isNothing :: !(Maybe .x) -> Bool
14 isJust :: !(Maybe .x) -> Bool
15 fromJust :: !(Maybe .x) -> .x
16
17 //Non-library functions
18 setReadLineName :: !String !*env -> *env
19
20 //Readline
21 readLine :: !String !Bool !*env -> (!Maybe String, !*env)
22
23 //Initializing History and State Management
24 usingHistory :: !*env -> *env
25 historyGetHistoryState :: !*env -> (!HistoryState, !*env)
26 historySetHistoryState :: !HistoryState !*env -> *env
27
28 //History List Management
29 addHistory :: !String !*env -> *env
30 addHistoryTime :: !String !*env -> *env
31 removeHistory :: !Int !*env -> (!HistoryItem, !*env)
32 replaceHistoryEntry :: !Int !String !*env -> (!HistoryItem, !*env)
33 clearHistory :: !*env -> *env
34 stifleHistory :: !Int !*env -> *env
35 unstifleHistory :: !*env -> *env
36 historyIsStifled :: !*env -> (!Int, !*env)
37
38 //Information About the History List
39 historyList :: !*env -> (![HistoryItem], !*env)
40 whereHistory :: !*env -> (!Int, !*env)
41 currentHistory :: !*env -> (!Maybe HistoryItem, !*env)
42 historyGet :: !Int !*env -> (!Maybe HistoryItem, !*env)
43 historyGetTime :: HistoryItem -> String
44 historyTotalBytes :: !*env -> (!Int, !*env)
45
46 //Moving Around the History List
47 historySetPos :: !Int !*env -> (!Int, !*env)
48 previousHistory :: !*env -> (!Maybe HistoryItem, !*env)
49 nextHistory :: !*env -> (!Maybe HistoryItem, !*env)
50
51 //Searching the History List
52 historySearch :: !String !Int !*env-> (!Int, !*env)
53 historySearchPrefix :: !String !Int !*env-> (!Int, !*env)
54 historySearchPos :: !String !Int !Int !*env-> (!Int, !*env)
55
56 //Managing the History File
57 readHistory :: !String !*env -> (!Bool, !*env)
58 readHistoryRange :: !String !Int !Int !*env -> (!Bool, !*env)
59 writeHistory :: !String !*env -> (!Bool, !*env)
60 appendHistory :: !Int !String !*env -> (!Bool, !*env)
61 historyTruncateFile :: !String !Int !*env -> (!Bool, !*env)
62
63 //History Expansion
64 historyExpand :: !String !*env -> (!String, !Int, !*env)
65 getHistoryEvent :: !String !Int !Int !*env -> (!Maybe String, !Int, !*env)
66 historyTokenize :: !String !*env -> ([String], !*env)
67 historyArgExtract :: !Int !Int !String !*env -> (!Maybe String, !*env)