Safe Haskell | None |
---|
- gen_stringInit :: (IvoryStruct name, SingI len) => Label name (Array len (Stored Uint8)) -> Label name (Stored (Ix len)) -> String -> Init (Struct name)
- stringInit :: IvoryString str => String -> Init str
- stringCapacity :: forall ref str s. (IvoryString str, IvoryRef ref) => ref s str -> Sint32
- stringLength :: (IvoryString str, IvoryRef ref, IvoryExpr (ref s (Stored (Ix (Capacity str)))), IvoryExpr (ref s str)) => ref s str -> ref s (Stored (Ix (Capacity str)))
- stringData :: (IvoryString str, IvoryRef ref, IvoryExpr (ref s (Array (Capacity str) (Stored Uint8))), IvoryExpr (ref s (CArray (Stored Uint8))), IvoryExpr (ref s str)) => ref s str -> ref s (CArray (Stored Uint8))
- memcmp :: Def (`[ConstRef s1 (CArray (Stored Uint8)), ConstRef s2 (CArray (Stored Uint8)), Sint32]` :-> Sint32)
- memcpy :: Def (`[Ref s1 (CArray (Stored Uint8)), ConstRef s2 (CArray (Stored Uint8)), Sint32]` :-> Sint32)
- istr_len :: IvoryString str => ConstRef s str -> Ivory eff (Ix (Capacity str))
- istr_copy :: IvoryString str => Ref s1 str -> ConstRef s2 str -> Ivory eff ()
- istr_convert :: (IvoryString str1, IvoryString str2) => Ref s1 str1 -> ConstRef s2 str2 -> Ivory eff IBool
- do_istr_eq :: Def (`[ConstRef s1 (CArray (Stored Uint8)), Sint32, ConstRef s2 (CArray (Stored Uint8)), Sint32]` :-> IBool)
- istr_eq :: (IvoryString str1, IvoryString str2) => ConstRef s1 str1 -> ConstRef s2 str2 -> Ivory eff IBool
- string_copy :: Def (`[Ref s1 (CArray (Stored Uint8)), Sint32, ConstRef s2 (CArray (Stored Uint8)), Sint32]` :-> Sint32)
- string_copy_z :: Def (`[Ref s1 (CArray (Stored Uint8)), Sint32, ConstRef s2 (CArray (Stored Uint8)), Sint32]` :-> Sint32)
- istr_from_sz :: forall s1 s2 eff len str. (SingI len, IvoryString str) => Ref s1 str -> ConstRef s2 (Array len (Stored Uint8)) -> Ivory eff ()
- sz_from_istr :: forall s1 s2 eff len str. (SingI len, IvoryString str) => Ref s1 (Array len (Stored Uint8)) -> ConstRef s2 str -> Ivory eff ()
- copy_istring :: Def (`[Ref s (CArray (Stored IChar)), IString, Uint32]` :-> ())
- class (IvoryType dest, IvoryType src) => Strcpy dest src where
- strncmp :: Def (`[ConstRef s1 (CArray (Stored IChar)), ConstRef s2 (CArray (Stored IChar)), Uint32]` :-> Sint32)
- strncpy :: Def (`[Ref s1 (CArray (Stored IChar)), ConstRef s2 (CArray (Stored IChar)), Uint32]` :-> ())
- strncpy_uint8 :: Def (`[Ref s1 (CArray (Stored Uint8)), ConstRef s2 (CArray (Stored IChar)), Uint32]` :-> ())
- stdlibStringModule :: Module
Documentation
gen_stringInit :: (IvoryStruct name, SingI len) => Label name (Array len (Stored Uint8)) -> Label name (Stored (Ix len)) -> String -> Init (Struct name)Source
stringInit :: IvoryString str => String -> Init strSource
stringCapacity :: forall ref str s. (IvoryString str, IvoryRef ref) => ref s str -> Sint32Source
stringLength :: (IvoryString str, IvoryRef ref, IvoryExpr (ref s (Stored (Ix (Capacity str)))), IvoryExpr (ref s str)) => ref s str -> ref s (Stored (Ix (Capacity str)))Source
stringData :: (IvoryString str, IvoryRef ref, IvoryExpr (ref s (Array (Capacity str) (Stored Uint8))), IvoryExpr (ref s (CArray (Stored Uint8))), IvoryExpr (ref s str)) => ref s str -> ref s (CArray (Stored Uint8))Source
memcmp :: Def (`[ConstRef s1 (CArray (Stored Uint8)), ConstRef s2 (CArray (Stored Uint8)), Sint32]` :-> Sint32)Source
Binding to the C memcmp function.
memcpy :: Def (`[Ref s1 (CArray (Stored Uint8)), ConstRef s2 (CArray (Stored Uint8)), Sint32]` :-> Sint32)Source
Binding to the C memcpy function.
istr_len :: IvoryString str => ConstRef s str -> Ivory eff (Ix (Capacity str))Source
Return the length of a string.
istr_copy :: IvoryString str => Ref s1 str -> ConstRef s2 str -> Ivory eff ()Source
Copy one string into another of the same type.
istr_convert :: (IvoryString str1, IvoryString str2) => Ref s1 str1 -> ConstRef s2 str2 -> Ivory eff IBoolSource
Copy one string to another of a possibly different type. If the destination string is too small, the output may be truncated. This returns true if the string fit, and false if it was truncated to fit the destination.
TODO: Implement this once it's needed.
do_istr_eq :: Def (`[ConstRef s1 (CArray (Stored Uint8)), Sint32, ConstRef s2 (CArray (Stored Uint8)), Sint32]` :-> IBool)Source
Internal function to compare strings for equality.
istr_eq :: (IvoryString str1, IvoryString str2) => ConstRef s1 str1 -> ConstRef s2 str2 -> Ivory eff IBoolSource
Compare strings (of possibly different types) for equality. Returns true if the strings are the same length and contain the same bytes.
string_copy :: Def (`[Ref s1 (CArray (Stored Uint8)), Sint32, ConstRef s2 (CArray (Stored Uint8)), Sint32]` :-> Sint32)Source
Primitive function to do a bounded string copy.
string_copy_z :: Def (`[Ref s1 (CArray (Stored Uint8)), Sint32, ConstRef s2 (CArray (Stored Uint8)), Sint32]` :-> Sint32)Source
Primitive function to do a bounded null-terminated string copy.
istr_from_sz :: forall s1 s2 eff len str. (SingI len, IvoryString str) => Ref s1 str -> ConstRef s2 (Array len (Stored Uint8)) -> Ivory eff ()Source
Copy the contents of a fixed-size C string into an Ivory
string. If the source string is not null terminated (and
therefore corrupt), this will copy no more than len
characters.
FIXME: This should return false if the string was truncated. (Can we actually detect this at compile-time? I think we should be able to...)
sz_from_istr :: forall s1 s2 eff len str. (SingI len, IvoryString str) => Ref s1 (Array len (Stored Uint8)) -> ConstRef s2 str -> Ivory eff ()Source
Copy an Ivory string to a fixed-size, null-terminated C string. The destination string is always properly terminated, but may be truncated if the buffer is too small.
FIXME: This should return false if the string was truncated. (Can we actually detect this at compile-time? I think we should be able to...)
copy_istring :: Def (`[Ref s (CArray (Stored IChar)), IString, Uint32]` :-> ())Source
Safely copy an IString (string literal) into a character array. The resulting string will always be null terminated.
class (IvoryType dest, IvoryType src) => Strcpy dest src whereSource
Type class to generate the correct call to a string function to copy one C string to another.
strncmp :: Def (`[ConstRef s1 (CArray (Stored IChar)), ConstRef s2 (CArray (Stored IChar)), Uint32]` :-> Sint32)Source
Binding to the C strncmp function.
strncpy :: Def (`[Ref s1 (CArray (Stored IChar)), ConstRef s2 (CArray (Stored IChar)), Uint32]` :-> ())Source
strncpy_uint8 :: Def (`[Ref s1 (CArray (Stored Uint8)), ConstRef s2 (CArray (Stored IChar)), Uint32]` :-> ())Source
stdlibStringModule :: ModuleSource
Ivory module definition.