Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to pprint via %W from Scm_Vprintf sometimes doesn't work #1058

Open
shirok opened this issue Jul 23, 2024 · 1 comment
Open

Call to pprint via %W from Scm_Vprintf sometimes doesn't work #1058

shirok opened this issue Jul 23, 2024 · 1 comment

Comments

@shirok
Copy link
Owner

shirok commented Jul 23, 2024

E.g. we use %W in hash table's ptiner, but it doesn't seem working even when called from outer pprint.

If we make a cproc that just calls Scm_Printf with %W, it does work. So something is lost inadvertently in the layers of printing method.

Might be related with #938 .

@shirok
Copy link
Owner Author

shirok commented Jul 24, 2024

For the objects other than lists and vectors, pprint first renders it to a string with the default writer and then use the resulting string for layout. The context is lost there.

shirok added a commit that referenced this issue Jul 26, 2024
to ease further modification.
This is a step toward #1058
shirok added a commit that referenced this issue Jul 26, 2024
`pprint` calls built-in writer for non-aggregate objects to obtain
rendered output.  The built-in writer used to call '%pretty-print' in
pass2 if :print-pretty is true, that caused infinite loop.  So we had
a check to avoid it in the pputil side. However, we don't need it
if the built-in writer knows when it should call '%pretty-print'.

Related: #1058

Note: If this version of pputil is used with older versions of Gauche,
it goes to infinite recursion.  So gauche.pputil is added to preload.
shirok added a commit that referenced this issue Jul 26, 2024
That is, solving #1032 in the
pprint level, not the built-in hash-table print handler.

This can avoid complications of recursing pprint and Scm_Printf: #1058

The built-in hash-table print handler is switched back to the simpler
version.  It doesn't need to worry about system's boot stage (#1057).

This commit is just basic stuff.  We'll make the display prettier later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant