v1.2
[CleanReadLine.git] / ReadLine.icl
1 implementation module ReadLine
2
3 import StdEnv
4
5 import code from "readLine.o"
6
7 //Readline
8 readLine :: !String !Bool !*env -> (!String, !*env)
9 readLine s h e = code {
10 ccall cleanReadLine "SI:S:A"
11 }
12
13 setReadLineName :: !String !*env -> !*env
14 setReadLineName s e = code inline {
15 ccall cleanSetReadLineName "S-"
16 }
17
18 //Initializing History and State Management
19 usingHistory :: !*env -> !*env
20 usingHistory e = code inline {
21 ccall cleanUsingHistory "-"
22 }
23
24 //History List Management
25 addHistory :: !String !*env -> !*env
26 addHistory s e = code inline {
27 ccall cleanAddHistory "S-"
28 }
29
30 clearHistory :: !*env -> !*env
31 clearHistory e = code inline{
32 ccall cleanClearHistory "-"
33 }
34
35 //Information About the History List
36
37 //Moving Around the History List
38
39 //Searching the History List
40 historySearch :: !String !Int !*env-> (!Int, !*env)
41 historySearch s i e = code {
42 ccall cleanHistorySearch "SI:I:A"
43 }
44
45 historySearchPrefix :: !String !Int !*env-> (!Int, !*env)
46 historySearchPrefix s i e = code {
47 ccall cleanHistorySearchPrefix "SI:I:A"
48 }
49
50 historySearchPos :: !String !Int !Int !*env-> (!Int, !*env)
51 historySearchPos s i1 i2 e = code {
52 ccall cleanHistorySearchPos "SI:I:A"
53 }
54
55
56 //Managing the History File
57 readHistory :: !String !*env -> (!Bool, !*env)
58 readHistory s e = code {
59 ccall cleanReadHistory "S:I:A"
60 }
61
62 readHistoryRange :: !String !Int !Int !*env -> (!Bool, !*env)
63 readHistoryRange s i1 i2 e = code {
64 ccall cleanReadHistoryRange "SII:I:A"
65 }
66
67 writeHistory :: !String !*env -> (!Bool, !*env)
68 writeHistory s e = code {
69 ccall cleanWriteHistory "S:I:A"
70 }
71
72 appendHistory :: !Int !String !*env -> (!Bool, !*env)
73 appendHistory i s e = code {
74 ccall cleanWriteHistory "IS:I:A"
75 }
76
77 historyTruncateFile :: !String !Int !*env -> (!Bool, !*env)
78 historyTruncateFile i s e = code {
79 ccall cleanWriteHistory "SI:I:A"
80 }