No matching definitions.

c-dsl/pp

src/c-dsl/pp.tur
defn

c-include

(c-include [header :cstr] :cstr)

emit a #include directive for a local or system header.

headerheader filename string (without angle brackets or quotes)

"#include \"header\""

(c-include "mylib.h")  ; => "#include \"mylib.h\""

Since: P1

defn

c-include-sys

(c-include-sys [header :cstr] :cstr)

emit a #include directive for a system header.

headersystem header filename string (without angle brackets)

"#include <header>"

(c-include-sys "stdio.h")  ; => "#include <stdio.h>"

Since: P1

defn

c-define

(c-define [name :cstr value :cstr] :cstr)

emit a simple #define directive.

namemacro name string
valuereplacement string

"#define name value"

(c-define "PI" "3.14159f")  ; => "#define PI 3.14159f"

Since: P1

defn

c-define-fn

(c-define-fn [signature :cstr body :cstr] :cstr)

emit a function-like #define directive.

signaturemacro signature string including params (e.g. "MAX(a,b)")
bodymacro body string

"#define signature body"

(c-define-fn "MAX(a,b)" "((a)>(b)?(a):(b))")
  ; => "#define MAX(a,b) ((a)>(b)?(a):(b))"

Since: P1

defn

c-undef

(c-undef [name :cstr] :cstr)

emit a #undef directive.

namemacro name to undefine

"#undef name"

Since: P1

defn

c-ifdef

(c-ifdef [guard :cstr body :cstr] :cstr)

emit an #ifdef / #endif guarded block.

guardpreprocessor symbol name string
bodybody string to wrap

"#ifdef guard\nbody\n#endif"

(c-ifdef "DEBUG" (c-call-stmt "printf" ...))

Since: P1

defn

c-ifndef

(c-ifndef [guard :cstr body :cstr] :cstr)

emit an #ifndef / #endif guarded block.

guardpreprocessor symbol name string
bodybody string to wrap

"#ifndef guard\nbody\n#endif"

(c-ifndef "MY_HEADER_H" "#define MY_HEADER_H\n...")

Since: P1

defn

c-if-pp

(c-if-pp [cond :cstr body :cstr] :cstr)

emit a #if / #endif guarded block.

condpreprocessor condition expression string
bodybody string to wrap

"#if cond\nbody\n#endif"

Since: P1

defn

c-static-assert

(c-static-assert [expr :cstr msg :cstr] :cstr)

emit a static_assert declaration.

exprcompile-time expression string
msgassertion message string (with quotes if needed)

"static_assert(expr, msg);"

(c-static-assert "sizeof(int32_t) == 4" "\"int32_t must be 4 bytes\"")

Since: P1

defn

c-pragma

(c-pragma [args :cstr] :cstr)

emit a #pragma directive.

argspragma arguments string

"#pragma args"

(c-pragma "once")  ; => "#pragma once"

Since: P1