Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the lisp-preprocessor Reference Manual, generated automatically by Declt version 3.0 "Montgomery Scott" on Tue Dec 22 14:15:36 2020 GMT+0.
• Introduction | What lisp-preprocessor is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
Common Lisp embedded template engine
#include <stdio.h>
int main(void) {
#{ :indent
(loop :for i :from 0 :below 10
:do (format t "printf(\"Loop: %d\", ~D);~%" i)) #}
return 0;
}
(lisp-preprocessor:run-template-into-file #p"input" #p"output")
#include <stdio.h>
int main(void) {
printf("Loop: %d", 0);
printf("Loop: %d", 1);
printf("Loop: %d", 2);
printf("Loop: %d", 3);
printf("Loop: %d", 4);
printf("Loop: %d", 5);
printf("Loop: %d", 6);
printf("Loop: %d", 7);
printf("Loop: %d", 8);
printf("Loop: %d", 9);
return 0;
}
(let ((compiland (compile-template "#{ (princ (string-capitalize $arg)) #}" :arguments '($arg))))
(run-template-into-string compiland "test"))
; => "Test"
compiland is a string or pathname, or a compiled template function.
* (compile-template "foo #{ (princ \"bar\") #} baz") ; => #<FUNCTION (LAMBDA (#:STREAM)) {...}>
* (run-template-into-stream * *standard-output*)
foo bar baz
* (compile-template "foo {{{ (princ \"bar\" }}} baz" :template-begin "{{{" :template-end "}}}")
* (run-template-into-stream * *standard-output*)
foo bar baz
* (run-template-into-stream (compile-template "#{ (princ (list ? ??)) #}" :arguments '(? ??)) *standard-output* "foo" "bar")
(foo bar)
#{ template #}
Keep indentation of start position
#{ :indent [offset]
...
#}
// input
int main(void) {
#{ :indent
(loop :for i :from 0 :below 10
:do (format t "printf(\"Loop: %d\", ~D);~%" i)) #}
return 0;
}
// output
int main(void) {
printf("Loop: %d", 0);
printf("Loop: %d", 1);
printf("Loop: %d", 2);
printf("Loop: %d", 3);
printf("Loop: %d", 4);
printf("Loop: %d", 5);
printf("Loop: %d", 6);
printf("Loop: %d", 7);
printf("Loop: %d", 8);
printf("Loop: %d", 9);
return 0;
}
Chop whitespace before and after the template
#{ :chop #}
;;; input
(defun foo (#{ (format t "~{~(~A~)~^ ~}" (loop :for symbol :in '(a b c) :collect symbol)) #}
#{ :chop #}
#{ (format t " ~{~(~A~)~^ ~}" (loop :for symbol :in '(x y z) :collect symbol)) #})
(values a b c x y z))
;;; output
(defun foo (a b c x y z)
(values a b c x y z))
MIT
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The lisp-preprocessor system |
cxxxr
MIT
Common Lisp embedded template engine
lisp-preprocessor.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The lisp-preprocessor.asd file | ||
• The lisp-preprocessor/packages.lisp file | ||
• The lisp-preprocessor/stream.lisp file | ||
• The lisp-preprocessor/lisp-preprocessor.lisp file |
Next: The lisp-preprocessor/packages․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
lisp-preprocessor.asd
lisp-preprocessor (system)
Next: The lisp-preprocessor/stream․lisp file, Previous: The lisp-preprocessor․asd file, Up: Lisp files [Contents][Index]
lisp-preprocessor (system)
packages.lisp
Next: The lisp-preprocessor/lisp-preprocessor․lisp file, Previous: The lisp-preprocessor/packages․lisp file, Up: Lisp files [Contents][Index]
packages.lisp (file)
lisp-preprocessor (system)
stream.lisp
Previous: The lisp-preprocessor/stream․lisp file, Up: Lisp files [Contents][Index]
stream.lisp (file)
lisp-preprocessor (system)
lisp-preprocessor.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The lisp-preprocessor.in-template package | ||
• The lisp-preprocessor package | ||
• The lisp-preprocessor.stream package |
Next: The lisp-preprocessor package, Previous: Packages, Up: Packages [Contents][Index]
packages.lisp (file)
with-indent (macro)
invoke-with-indent (function)
Next: The lisp-preprocessor․stream package, Previous: The lisp-preprocessor․in-template package, Up: Packages [Contents][Index]
packages.lisp (file)
Previous: The lisp-preprocessor package, Up: Packages [Contents][Index]
packages.lisp (file)
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported special variables | ||
• Exported macros | ||
• Exported functions | ||
• Exported classes |
Next: Exported macros, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
lisp-preprocessor.lisp (file)
Next: Exported functions, Previous: Exported special variables, Up: Exported definitions [Contents][Index]
lisp-preprocessor.lisp (file)
stream.lisp (file)
Next: Exported classes, Previous: Exported macros, Up: Exported definitions [Contents][Index]
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
Previous: Exported functions, Up: Exported definitions [Contents][Index]
stream.lisp (file)
fundamental-output-stream (class)
0
emitter-column (generic function)
(setf emitter-column) (generic function)
0
emitter-indent (generic function)
(setf emitter-indent) (generic function)
:stream
*standard-output*
emitter-stream (generic function)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal special variables | ||
• Internal functions | ||
• Internal generic functions |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
stream.lisp (file)
lisp-preprocessor.lisp (file)
Next: Internal generic functions, Previous: Internal special variables, Up: Internal definitions [Contents][Index]
stream.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
stream.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
lisp-preprocessor.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
automatically generated reader method
stream.lisp (file)
automatically generated writer method
stream.lisp (file)
automatically generated reader method
stream.lisp (file)
automatically generated writer method
stream.lisp (file)
automatically generated reader method
stream.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L |
---|
Jump to: | F L |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
A B C E F G I L M R W |
---|
Jump to: | (
A B C E F G I L M R W |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | *
+
C I S |
---|
Jump to: | *
+
C I S |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C E L P S |
---|
Jump to: | C E L P S |
---|