Z-encode underscores as "zu" (the previous owner of "zu", namely '^',
has been moved to "zc").
* Tuples (,,,) are coded as Z3T
* Tuples (,,,) are coded as Z3T
-* Alphabetic characters (upper and lower), digits, and '_'
+* Alphabetic characters (upper and lower) and digits
all translate to themselves;
except 'Z', which translates to 'ZZ'
and 'z', which translates to 'zz'
all translate to themselves;
except 'Z', which translates to 'ZZ'
and 'z', which translates to 'zz'
alreadyEncoded :: String -> Bool
alreadyEncoded s = all ok s
where
alreadyEncoded :: String -> Bool
alreadyEncoded s = all ok s
where
ok ' ' = True -- This is a bit of a lie; if we really wanted spaces
-- in names we'd have to encode them. But we do put
-- spaces in ccall "occurrences", and we don't want to
ok ' ' = True -- This is a bit of a lie; if we really wanted spaces
-- in names we'd have to encode them. But we do put
-- spaces in ccall "occurrences", and we don't want to
str = _UNPK_ fast_str
unencodedChar :: Char -> Bool -- True for chars that don't need encoding
str = _UNPK_ fast_str
unencodedChar :: Char -> Bool -- True for chars that don't need encoding
-unencodedChar '_' = True
unencodedChar 'Z' = False
unencodedChar 'z' = False
unencodedChar c = ISALPHANUM c
unencodedChar 'Z' = False
unencodedChar 'z' = False
unencodedChar c = ISALPHANUM c
encode_ch 'z' = "zz"
encode_ch '&' = "za"
encode_ch '|' = "zb"
encode_ch 'z' = "zz"
encode_ch '&' = "za"
encode_ch '|' = "zb"
encode_ch '$' = "zd"
encode_ch '=' = "ze"
encode_ch '>' = "zg"
encode_ch '$' = "zd"
encode_ch '=' = "ze"
encode_ch '>' = "zg"
encode_ch '\\' = "zr"
encode_ch '/' = "zs"
encode_ch '*' = "zt"
encode_ch '\\' = "zr"
encode_ch '/' = "zs"
encode_ch '*' = "zt"
encode_ch '%' = "zv"
encode_ch c = ['z', 'x', intToDigit hi, intToDigit lo]
where
encode_ch '%' = "zv"
encode_ch c = ['z', 'x', intToDigit hi, intToDigit lo]
where