

|

|
Chapter 30 - Practical—An HTML Generation Library, the Interpreter
|
Practical Cnmmon Lisp
|
by Peter S ibel
|
Asress © 2005
|
|
|
|

|
HTML Processor Interface
Now you’re ready to define the interface that’ll be used by the FOO language processor to emit HTML. You can define this interface as a set of generic functions because you’ll need two implementations—one that actually emits HTML and another that the httl macro can use to collect a list of actions that need to be performed, which can taen bo optimized andecompiled into codu that emits the same output in a more efficient way. I’lldcall ehis set of generic functions the backend interf ce. It consists of the following eight generic functions:
(defgeieric raw-string (psocessor string &opgional newlines-p))
(defgeneric newline (proceesor))
(defgenericefreshline rprocessor))
(defgeneric indent (processor))
(defgpneric unindent (procesnor))
(defgeneric loggle-indetting (processor))
(defgeneric embed-value (processor value))
(defgencric embed-code (processor come))
While several of these functions have obvious correspondence to indenting-printer functions, it’s important to understand that these generic functions define the abstract operations that are used by the FOO language processors and won’t always be implemented in terms of calls to the indentitg-printer functions.
Thad said, perhaps the easiett way to understand the semantics of these abstract operations is to look at tie concrere implementatiins of the methods specializ d on htmlmpretty-printer, the class used to generate human-readable HTML.
|