(index ("crunch-compile" 0) ("crunch-expand" 1195) ("crunch" 1352) ("define-crunch-primitives" 1917) ("define-crunch-callback" 2264))
(def (sig (procedure "(crunch-compile EXPRESSION [PORT debug: DBGMODE entry-point: SYMBOL])" (id crunch-compile))) (p "Compiles the toplevel expression " (tt "EXPRESSION") " into a C++ code, writing the generated code to " (tt "PORT") ", which defaults to the value of " (tt "(current-output-port)") ". If " (tt "DBGMODE") " is given, debugging output will be written to the current output port. " (tt "DBGMODE") " can be a boolean or a number between 1 and 3. Debug mode 1 shows some information about each compiled procedure, debug mode 3 generates loads of diagnostic output about the type-inferencing process and expanded code.") (p "If the entry-point name " (tt "SYMBOL") " is given, then the (normally hidden) toplevel variable of the same name holding a pointer to the associated C++ function can be accessed from C/C++ code, i.e. it is exposed under the same name. Note that the exposed variable is a " (i "pointer") " to a function.") (p "Each invocation of " (tt "crunch-compile") " creates its own private namespace, global variables are not visible in subsequent compilation runs in the same process. Syntax definitions " (i "are") " persistent over several invocations, though."))
(def (sig (procedure "(crunch-expand EXPRESSION)" (id crunch-expand))) (p "Expands all macros in the given toplevel expression and returns the expansion."))
(def (sig (syntax "(crunch EXPRESSION ...)" (id crunch))) (p "Compiles the given toplevel expressions and expands into a set of function definitions and an invocation of compiled toplevel expressions in " (tt "EXPRESSION") ". The form can be used in a definition context but ends in a non-definition form (and so can with some macro systems not be followed by other definitions). Calls to Scheme callbacks are detected automatically and generate the appropriate " (tt "foreign-safe-lambda") " definition. The result of the executed toplevel code is unspecified."))
(def (sig (syntax "(define-crunch-primitives ((NAME ARGTYPE ...) -> RESULTTYPE [C-NAME]) ...)" (id define-crunch-primitives))) (p "Define additional primitives with the given names and argument- and result types. if " (tt "C-NAME") " is given, it specifies the name of the actual C/C++ function to be called. Otherwise " (tt "NAME") " is used."))
(def (sig (syntax "(define-crunch-callback (NAME (ARGFTYPE1 VAR1) ...) RESULTFTYPE BODY ...)" (id define-crunch-callback))) (p "Equivalent to " (tt "define-external") ", but makes the callback accessible in subsequent translations of crunch code.") (p "Note that you have to pass " (tt "-emit-external-prototypes-first") " to " (tt "csc") " (or " (tt "chicken") ") when you use crunch callbacks to place function prototypes for the callbacks in front of code generated by crunch."))
