Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

prprint.cpp File Reference

#include "../sexpress/sexpress.hpp"
#include "../sexpress/sstring.hpp"
#include "prprint.hpp"

Include dependency graph for prprint.cpp:

Go to the source code of this file.

Functions

bool pretty_print (SReference ref, prettyprint_callback_function fun, void *userdata, int indent, int margin, int indentstep)
 Pretty print an S-expression.


Function Documentation

bool pretty_print SReference  ref,
prettyprint_callback_function  fun,
void *  userdata,
int  indent = 0,
int  margin = 75,
int  indentstep = 4
 

Pretty print an S-expression.

Lists are printed on one line if they fit the line, otherwise they get printed one item per line, indented.

Parameters:
ref is the expression to print
fun is the function which is capable of printing strings; actually, it can do anything with the string, e.g. printing, storing, converting to graphics etc.
userdata is arbitrary data to pass to the callback function, such as a stream (FILE*) or whatever you need
indent is the starting indentation
margin is the right margin
indentstep is how many spaces to use to indent inner blocks

Definition at line 30 of file prprint.cpp.

References SString::c_str(), SExpressionCons::Car(), SExpressionCons::Cdr(), SReference::DynamicCastGetPtr(), SReference::IsEmptyList(), SString::length(), and pretty_print().

Referenced by pretty_print().


Generated on Tue Dec 18 00:40:05 2007 for InteLib by  doxygen 1.4.1