No matching definitions.

c-dsl/fns

src/c-dsl/fns.tur
defn

c-param

(c-param [name :cstr type :cstr] :cstr)

format a single function parameter declaration.

nameparameter name string
typeTurmeric type keyword or C type string

"C-type name"

(c-param "x" ":int")    ; => "int32_t x"
  (c-param "s" ":cstr")   ; => "char* s"

Since: P1

defn

c-defn

(c-defn [name :cstr params :int ret :cstr body :cstr] :cstr)

emit a C function definition.

namefunction name string
paramscons list of parameter strings (from c-param)
retreturn type keyword or C type string
bodyfunction body string (use c-stmts for multi-statement bodies)

Complete C function definition string.

(c-defn "square"
    (cons (c-param "x" ":int") 0)
    ":int"
    (c-return (c-binop "*" "x" "x")))
  ; => "int32_t square(int32_t x) {\n    return (x * x);\n}"

Since: P1

defn

c-defn-static

(c-defn-static [name :cstr params :int ret :cstr body :cstr] :cstr)

emit a static C function definition.

namefunction name string
paramscons list of parameter strings
retreturn type keyword or C type string
bodyfunction body string

Since: P1

defn

c-defn-inline

(c-defn-inline [name :cstr params :int ret :cstr body :cstr] :cstr)

emit a static inline C function definition.

namefunction name string
paramscons list of parameter strings
retreturn type keyword or C type string
bodyfunction body string

Since: P1

defn

c-call

(c-call [fn-name :cstr args :int] :cstr)

emit a C function call expression.

fn-namefunction name string
argscons list of argument expression strings

"fn_name(arg1, arg2, ...)"

(c-call "printf" (cons "\"%d\\n\"" (cons "x" 0)))
  ; => "printf(\"%d\\n\", x)"

Since: P1

defn

c-declare

(c-declare [ret :cstr name :cstr params :int] :cstr)

emit a forward declaration for a C function.

retreturn type keyword or C type string
namefunction name string
paramscons list of type strings (types only, no names required)

"ret name(params);"

(c-declare ":int" "add" (cons "int32_t" (cons "int32_t" 0)))
  ; => "int32_t add(int32_t, int32_t);"

Since: P1

defn

c-extern

(c-extern [ret :cstr name :cstr params :int] :cstr)

emit an extern declaration for a C function.

retreturn type keyword or C type string
namefunction name string
paramscons list of type strings

"extern ret name(params);"

Since: P1

Internal definitions
__c-defn-impl-- build a function definition with an optional prefix.