| Copyright | (c) roki 2019 |
|---|---|
| License | MIT |
| Maintainer | falgon53@yahoo.co.jp |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Htcc.CRules.Types.CType
Description
The rules of types of C language
Synopsis
- class CType a where
- isFundamental :: a -> Bool
- qualify :: a -> a -> Maybe a
- sizeof :: a -> Natural
- alignof :: a -> Natural
- deref :: a -> Maybe a
- ctorPtr :: Natural -> a -> a
- dctorPtr :: a -> (a, a -> a)
- dctorArray :: a -> (a, a -> a)
- removeAllExtents :: a -> a
- conversion :: a -> a -> a
- implicitInt :: a -> a
Documentation
A data type representing the type of C language
Methods
isFundamental :: a -> Bool Source #
isFundamental returns True only if the type is fundamental type (See also: § 3.9.1), otherwise retunrs False.
qualify :: a -> a -> Maybe a Source #
If the first argument is a type qualifier,
qualify returns a type that qualifies the type of the second argument with that qualifier.
Otherwise Nothing is returned.
sizeof :: a -> Natural Source #
sizeof returns the byte size of the type defined by C language.
alignof :: a -> Natural Source #
alignof returns the alignment of the type defiend by C language.
deref :: a -> Maybe a Source #
deref returns Just x for the underlying type x only if a is CTPtr or CTArray.
Otherwise returns Nothing.
ctorPtr :: Natural -> a -> a Source #
ctorPtr returns a convolution function with \(n\) specified pointers nested
dctorPtr :: a -> (a, a -> a) Source #
dctorPtr deconstructs the nested structure of CTPtr and returns the convolution function
of the original type and CTPtr
dctorArray :: a -> (a, a -> a) Source #
dctorArray deconstructs the nested structure of CTArray and returns the convolution function
of the original type and CTArray
removeAllExtents :: a -> a Source #
removeAllExtents is the same as std::remove_all_extents defined in C++11 <type_traits>
(See also: N3337/§ 20.9.7.4) header.
If type T is a multidimensional array of type X, type X is returned.
Otherwise, it returns type T.
conversion :: a -> a -> a Source #
conversion defines one type from two types according to the implicit conversion defined in §6.3.1.8
implicitInt :: a -> a Source #
implicitInt sets long or short type declarations for type declarations with only modifiers such as long and short.
Otherwise, nothing to do.