;;;------------------------------------------------------------------
;;;- Module : WebCLIPSHTML -
;;;- -
;;;- The purpose of this module is to provide CLIPS functions that -
;;;- generate HTML (V3.2) to a web server. This module must be -
;;;- imported by other CLIPS programs. -
;;;- -
;;;- Source File : WCHTML.CLP -
;;;- -
;;;- Who | Date | Description -
;;;- ---------------+-----------+---------------------------------- -
;;;- M.Giordano | 31-Jul-97 | Create -
;;;- M.Giordano | 19-Dec-97 | Changed str-cat to sym-cat -
;;;- -
;;;- -
;;;- Note : -
;;;- -
;;;- For performance critical programs the FormatArgs function call -
;;;- can be replaced with (sym-cat " " (implode$ ?args)). The side -
;;;- effect is an extra space in the first tag. For example : -
;;;- -
;;;-
would become
-
;;;- -
;;;- Some browsers may complain about this format, so to be able to -
;;;- use the widest possible set of browsers, this functionality -
;;;- is provided. -
;;;- -
;;;------------------------------------------------------------------
(defmodule WebCLIPSHTML
(export deffunction ?ALL))
;
;;- General function to format arguments passed to a function.
;
(deffunction FormatArgs ($?args)
(if (> (length$ ?args) 0)
then
(return (sym-cat " " (implode$ ?args)))
else
(return "")))
;
;;- General function to URL encode arguments passed to a function.
;
(deffunction URLEncode ($?args)
(loop-for-count (?count 1 (length$ ?args)) do
(printout t (nth ?count ?args) "+" ))
TRUE)
;;;------------------------------------------------------------------
;;;- -
;;;- Header tags -
;;;- -
;;;------------------------------------------------------------------
(deffunction HTMLHeader (?title)
(printout t "" crlf
"" ?title ""))
(deffunction BodyTag ($?bodyargs)
(printout t "" crlf))
;
;;- tag support (stand alone)
;
(deffunction HeadStart ($?dummy)
(printout t ))
;
;;- tag support (stand alone)
;
(deffunction HeadEnd ($?dummy)
(printout t ))
;
;;- tag support
;
(deffunction HeadStartTag ($?dummy)
)
;
;;- tag support
;
(deffunction HeadEndTag ($?dummy)
)
;
;;- tag support (stand alone)
;
(deffunction ScriptEnd ($?dummy)
(printout t ))
;
;;- tag support
;
(deffunction ScriptEndTag ($?dummy)
)
;
;;- tag support (stand alone) JavaScript specific
;
(deffunction JavaScriptEnd ($?dummy)
(printout t ))
;
;;- tag support JavaScript specific
;
(deffunction JavaScriptEndTag ($?dummy)
)
;
;;- tag support (stand alone) VBScript specific
;
(deffunction VBScriptEnd ($?dummy)
(printout t ))
;
;;- tag support VBScript specific
;
(deffunction VBScriptEndTag ($?dummy)
)
;
;;- tag support (stand alone)
;
(deffunction Base (?URL)
(printout t "" ))
;
;;-