1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
module ICurry.Extended.Goodies(
isExternal, isGlobal,
isPublic, isPrivate,
escapeSpecials
) where
import ICurry.Extended.Types
isExternal :: IEFunction -> Bool
isExternal f = case f of
IEFunction _ _ (IEExternal _ _) -> True
_ -> False
isGlobal :: IEFunction -> Bool
isGlobal f = case f of
IEFunction _ _ (IEFuncBody [] (IESimpleBlock _ (IEFCall ((mn,ln),_) es))) ->
mn == "Global" && ln == "global" && length es == 2
_ -> False
escapeSpecials :: String -> String
escapeSpecials = concatMap replaceBadChars
where
replaceBadChars c = case c of
'_' -> "_u"
',' -> "_c"
'.' -> "_d"
':' -> "_n"
'#' -> "_h"
'+' -> "_p"
'-' -> "_m"
'*' -> "_y"
'/' -> "_v"
'\'' -> "_t"
'<' -> "_l"
'>' -> "_g"
'=' -> "_e"
'(' -> "_o"
')' -> "_s"
'[' -> "_b"
']' -> "_k"
'&' -> "_a"
'|' -> "_i"
'$' -> "_r"
'!' -> "_x"
'?' -> "_j"
'\\' -> "_z"
'^' -> "_f"
otherwise -> [c]
isPublic :: IEVisibility -> Bool
isPublic Public = True
isPublic Private = False
isPrivate :: IEVisibility -> Bool
isPrivate Private = True
isPrivate Public = False
|