No matching definitions.

c-dsl/types

src/c-dsl/types.tur
defn

c-type

(c-type [t :cstr] :cstr)

map a Turmeric type keyword string to a C99 type string.

ttype keyword (e.g. ":int", ":float", ":cstr", ":void")

The corresponding C type string. Unknown keywords with a leading colon have the colon stripped; others are returned as-is.

(c-type ":int")    ; => "int32_t"
  (c-type ":float")  ; => "float"
  (c-type ":cstr")   ; => "char*"
  (c-type ":void")   ; => "void"

Since: P1

defn

c-ptr-type

(c-ptr-type [inner :cstr] :cstr)

create a C pointer type string.

innerTurmeric type keyword or bare C type string

"<C-type>*"

(c-ptr-type ":int")   ; => "int32_t*"
  (c-ptr-type ":void")  ; => "void*"

Since: P1

defn

c-arr-type

(c-arr-type [inner :cstr n :int] :cstr)

create a C fixed-size array type fragment.

innerelement type keyword or bare C type string
narray length

"<C-type>[n]"

(c-arr-type ":uint8" 16)  ; => "uint8_t[16]"

Since: P1

defn

c-fn-type

(c-fn-type [param-types :int ret :cstr] :cstr)

create a C function-pointer type string.

param-typesVec[cstr] of type keyword or C type strings, built with
(vec-of ...). (Was a cons list prior to v0.2.0.)
retreturn type keyword or C type string

"<ret>(*)(p1, p2, ...)"

(c-fn-type (vec-of ":int" ":int") ":int")
  ; => "int32_t(*)(int32_t, int32_t)"

Since: P1

defn

c-const-type

(c-const-type [t :cstr] :cstr)

prepend "const " to a type string.

tC type string (already mapped via c-type if needed)

"const <t>"

(c-const-type "char*")  ; => "const char*"

Since: P1

defn

c-volatile-type

(c-volatile-type [t :cstr] :cstr)

prepend "volatile " to a type string.

tC type string

"volatile <t>"

Since: P1