Merge pull request #3 from dopefishh/standard-maybe
[CleanReadLine.git] / ReadLine.dcl
1 definition module ReadLine
2
3 import StdClass
4 from Data.Maybe import :: Maybe
5
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 //Non-library functions
13 setReadLineName :: !String !*env -> *env
14
15 //Readline
16 readLine :: !String !Bool !*env -> (!Maybe String, !*env)
17
18 //Initializing History and State Management
19 usingHistory :: !*env -> *env
20 historyGetHistoryState :: !*env -> (!HistoryState, !*env)
21 historySetHistoryState :: !HistoryState !*env -> *env
22
23 //History List Management
24 addHistory :: !String !*env -> *env
25 addHistoryTime :: !String !*env -> *env
26 removeHistory :: !Int !*env -> (!HistoryItem, !*env)
27 replaceHistoryEntry :: !Int !String !*env -> (!HistoryItem, !*env)
28 clearHistory :: !*env -> *env
29 stifleHistory :: !Int !*env -> *env
30 unstifleHistory :: !*env -> *env
31 historyIsStifled :: !*env -> (!Int, !*env)
32
33 //Information About the History List
34 historyList :: !*env -> (![HistoryItem], !*env)
35 whereHistory :: !*env -> (!Int, !*env)
36 currentHistory :: !*env -> (!Maybe HistoryItem, !*env)
37 historyGet :: !Int !*env -> (!Maybe HistoryItem, !*env)
38 historyGetTime :: HistoryItem -> String
39 historyTotalBytes :: !*env -> (!Int, !*env)
40
41 //Moving Around the History List
42 historySetPos :: !Int !*env -> (!Int, !*env)
43 previousHistory :: !*env -> (!Maybe HistoryItem, !*env)
44 nextHistory :: !*env -> (!Maybe HistoryItem, !*env)
45
46 //Searching the History List
47 historySearch :: !String !Int !*env-> (!Int, !*env)
48 historySearchPrefix :: !String !Int !*env-> (!Int, !*env)
49 historySearchPos :: !String !Int !Int !*env-> (!Int, !*env)
50
51 //Managing the History File
52 readHistory :: !String !*env -> (!Bool, !*env)
53 readHistoryRange :: !String !Int !Int !*env -> (!Bool, !*env)
54 writeHistory :: !String !*env -> (!Bool, !*env)
55 appendHistory :: !Int !String !*env -> (!Bool, !*env)
56 historyTruncateFile :: !String !Int !*env -> (!Bool, !*env)
57
58 //History Expansion
59 historyExpand :: !String !*env -> (!String, !Int, !*env)
60 getHistoryEvent :: !String !Int !Int !*env -> (!Maybe String, !Int, !*env)
61 historyTokenize :: !String !*env -> ([String], !*env)
62 historyArgExtract :: !Int !Int !String !*env -> (!Maybe String, !*env)