Re: Yapp (yet another pretty print)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hello Pete, you wrote:

> I've just cleaned up my version of pretty print.
>
> If anyone wants to give it a whirl let me know if there is anything
> you don't like: There's not much benefit if you throw it a short
> string, it needs a big table type thing to shine.
>
> Pete

It's very nice. With your version it is e.g. possible, to print a big
table in a way, so that much information can be seen at the same time,
which makes comparison much easier (faster and more reliable). It seems
to be near to the version of pretty print, I've been looking for.
But: Without putting it on the User Contributions Page, you can't get
Micro $$ for it. smile

<snip>

> global procedure prntEx(integer file, object o, integer maxln,
> 						integer pauze, integer fmt, object nest)
> -- file: 1 for screen, 0 leaves result in global sequence 'pres'.
> -- o is the object to be printed
> -- maxln (defaults to 78 if 0 is passed) for splitting long lines
> -- pauze (suggested 23, or 0 for no pausing) prompts every n lines
> -- fmt 0 prints text strings as eg "abc",
> --     1 as {97, 98, 99},
> --     3 as {97a, 98b, 99c}
> -- nest	indicates nesting levels to force new lines,
> --      or can be passed as {indent, nest_level}
> --
> 	ofile=file
> 	if maxln=0 then maxln=78 end if
> 	maxlen=maxln
> 	pline=repeat(9,maxlen+1)	-- space for \n
> 	pause=pauze
> 	format=fmt
> 	pres=""
> 	nindent=2
                ^
I changed this to 1.

> 	if sequence(nest) then
> 		nindent=nest[1]
> 		nest=nest[2]
> 	elsif nest=0 then
> 		nindent=1
> 	end if
> 	if prnf(o,0,0,1,nest) then end if
> 	if nest>=0 then
> 		sput("\n")
> 	elsif plen then
> 		spurge()
> 	end if
> end procedure
> 	
> global procedure prnt(object o, object nest)
                    ^
I changed this to pp. smile

> 	prntEx(1,o,78,23,0,nest)
> end procedure

I don't have the time to make extensive tests at the moment. But I
will use your version on a regular basis, instead of the official
pretty_print(), to gather some experience.

Many thanks, and best regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  |    |\      _,,,---,,_
 \ /  against HTML in       |    /,`.-'`'    -.  ;-;;,_
  X   e-mail and news,      |   |,4-  ) )-,_..;\ (  `'-'
 / \  and unneeded MIME     |  '---''(_/--'  `-'\_)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu