Output == Description == This page describes the HOP output functions. In particular, it describes the ++format++ function that enables formatted I/Os such as CommonLisp's ++format++ or C's ++sprintf++. ~~ Note: Many thanks to Scott G. Miller who is the author of [[http://srfi.schemers.org/srfi-28|SRFI-28]]. Most of the documentation of this function is copied from the SRFI documentation. == Synopsis == === Server & Client === (format template arg ...) (tprint arg ...) === Client === (trace arg ...) (hop-debug) (hop-debug-set! val) == Examples == format, tprint, trace == Server & Client Definitions == === ++(format template arg ...)++ === format format ^ arguments ^ type ^ description ^ | template | string | A string denoting the //template//. | | arg | obj | optional argument. | The function ++format++ constructs a string of characters built from its template and its optional arguments. The function ++format++ accepts a message template (a Scheme String), and processes it, replacing any escape sequences in order with one or more characters, the characters themselves dependent on the semantics of the escape sequence encountered. ~~ An escape sequence is a two character sequence in the string where the first character is a tilde ++~++. Each escape code's meaning is as follows: * ++~a++ The corresponding value is inserted into the string as if printed with display. * ++~s++ The corresponding value is inserted into the string as if printed with write. * ++~%++ A newline is inserted. * ++~~++ A tilde ++~++ is inserted. The sequences ++~a++ and ++~s++, when encountered, require a corresponding Scheme value to be present after the format string. The values provided as operands are used by the escape sequences in order. It is an error if fewer values are provided than escape sequences that require them. The sequences ++~%++ and ++~~++ require no corresponding value. Examples: (format "Hello, ~a" "World!") ⇒ "Hello, World!" (format "Error, list is too short:~% ~s" '(one "two" 3)) ⇒ "Error, list is too short:\n (one \"two\" 3)" === ++(tprint arg ...)++ === tprint tprint ^ arguments ^ type ^ description ^ | arg | obj | optional argument. | The function ++tprint++ displays, on the **server error console**, its arguments, preceded by the filename and line number of the source code containing the call to ++tprint++. This function is used for debugging purposes. ~~ Client side implementation of ++tprint++ uses the ++trace/tprint++ service of the ,( "TRACE" (make-file-path (hop-weblets-directory) "trace/etc/trace.wiki")) weblet. == Client Definition == === ++(trace arg ...)++ === trace ^ arguments ^ type ^ description ^ | arg | obj | optional argument. | The function ++trace++ displays its arguments on the **server console**, provided the parameter ++hop-verbose++ is greater or equal to ++1++ and ++hop-debug++ is greater to 1. ~~ The ++trace++ function actually invokes the eponymous service of the ,( "TRACE" (make-file-path (hop-weblets-directory) "trace/etc/trace.wiki"))++ weblet. This weblet allows some users customizations. === ++(hop-debug)++ === === ++(hop-debug-set! arg)++ === hop-debug hop-debug-set! ^ arguments ^ type ^ description ^ | arg | int | debug level. | Gets (respec. sets) the HOP client side debug value. The value is an integer value. A value smaller or equal to 0 disable debugging. == See also == format, tprint, trace