h6. [[OS SWI Calls]] h6(. » OS_PrettyPrint h2. OS_PrettyPrint h5. (SWI &44) |_<^{width:4em}. Entry | | |<^. R0 |<^. Pointer to NUL terminated string to write | |<^. R1 |<^. Pointer to dictionary (0 = [[RISC OS Default Dictionary|RISC OS dictionary]]) | |<^. R2 |<^. Pointer to NUL terminated special string | |_<^{width:4em}. Exit | | |<^. R0 |<^. Preserved| |<^. R1 |<^. Preserved (but see RO6 note below)| |<^. R2 |<^. Preserved| h4. Use The purpose of this call is to write an indirect string, with formatting, to all of the active output streams. h4. Notes Due to a serious bug in every version of PrettyPrint since RISC OS 2.00, it is important to not end the string with a tab character – tabs must be followed by at least one visible character. Starting with a tab is fine. Compacted text uses an escape character in the print string to indicate a dictionary entry. It is followed immediately by a byte which is the dictionary entry number. If this byte is in the range 1-255, then the appropriate string in the dictionary is substituted. If it's 0, then the special string pointed to by R2 is substituted. (This is used in particular by the [[*Help|*Help]] command.) The format of a dictionary is a linear list of entries, which can recursively refer to other dictionary entries; each entry is a length byte (counting itself) followed by a 0 terminated string, so an empty string has a length byte of 2. A length byte of zero terminates the dictionary. A length byte of 1 is not allowed. This call acts like [[OS_Write0]] with several differences: * It will break a line at a space if the next word will not fit on the line, except at hard spaces * Compacted text is handled * CR causes a newline to be generated * TAB causes tabulation to the next multiple of eight columns * ASCII 31 acts as a hard space for formatting, but is output as 32 * ESC (ASCII 27) indicates that a dictionary entry should be substituted The RISC OS 6 version of PrettyPrint will return the address of the default dictionary in R1 if R0, R1 and R2 are zero on entry. h4. See also * [[OS_Write0]] * [[RISC OS Default Dictionary]] * [[*Help|*Help]]