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

sprintf issues #349

Closed
porres opened this issue Aug 24, 2017 · 15 comments
Closed

sprintf issues #349

porres opened this issue Aug 24, 2017 · 15 comments

Comments

@porres
Copy link
Owner

porres commented Aug 24, 2017

  • Update the help file

  • Revise the code...

For whatever '%' argument we create in max, it generates an inlet, no matter if it's a valid thing - that's not the case in Pd, where it verifies if it's a 'valid' argument. So it should get whatever it receives instead of doing this checking.

BTW, the code has this:

/* CHECKED: max creates as many inlets, as there are %-signs, no matter
if they are valid, or not -- if not, it prints ``can't convert'' errors
for any input... */

And here's a list of issues:

screen shot 2017-08-24 at 16 00 03

references:
https://www.tutorialspoint.com/c_standard_library/c_function_sprintf.htm
https://en.wikipedia.org/wiki/C_data_types
https://www.gnu.org/software/libc/manual/html_node/Table-of-Output-Conversions.html

@porres porres mentioned this issue Aug 24, 2017
@porres
Copy link
Owner Author

porres commented Aug 24, 2017

The test patch

sprintf-test.pd.zip

@porres
Copy link
Owner Author

porres commented Jan 31, 2019

With 8e56237 I was able to remove the %a and %A options from cyclone and include %p

@porres
Copy link
Owner Author

porres commented Jan 31, 2019

with 737fb0a I seem to have enabled "hi" and "hu"

update

screen shot 2019-01-31 at 05 01 14

download test patch
sprintf-test.pd.zip

@porres
Copy link
Owner Author

porres commented Jan 31, 2019

with 9bc4a57 I'm now able to load %F

update:

screen shot 2019-01-31 at 11 40 39

download file:
sprintf-test.pd.zip

@porres
Copy link
Owner Author

porres commented Jan 31, 2019

with d3c835a I'm now able to use "%lf" and "%lF"
screen shot 2019-01-31 at 12 04 30
sprintf-test.pd.zip

@porres
Copy link
Owner Author

porres commented Jan 31, 2019

With e341338 I tried adding new formats that start with "%L", like "%Lf", etc. It only did work to prevent errors, but "%Lf" and "%LF" actually blow up PD, and the others just output zero... hence, I commented it out.

These seem to be a bit buggy in Max, but with Pd 64 bits around the corner, I think long integers/float could be useful in Pd ;)

@porres
Copy link
Owner Author

porres commented Jan 31, 2019

this is wrong! It doesn't go over 2ˆ63
screen shot 2019-01-31 at 18 07 09

@porres
Copy link
Owner Author

porres commented Jan 31, 2019

I updated the help file with 71af21a

Here's a review of which issues we still have:

  • generate inlet for whatever '%' argument is created (or maybe not) - Pd only creates for 'valid' patterns and prints errors when it isn't.

  • I couldn't include long double patterns (%lf, %lE, etc). %Lf" and "%LF" blow up PD, and the others output zero.

  • %lu is limited to 2ˆ63

  • Patterns %hhi, %hhu, %lli and %llu are still missing.

references:
https://linux.die.net/man/3/printf
https://www.tutorialspoint.com/c_standard_library/c_function_sprintf.htm
https://en.wikipedia.org/wiki/C_data_types
https://www.gnu.org/software/libc/manual/html_node/Table-of-Output-Conversions.html
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/integral-types-table

@porres
Copy link
Owner Author

porres commented Feb 1, 2019

Been getting weird freezes when using %c and scrolling with a number box input. Sometimes it freezes. This time it also came with a .tcl error (tested with 0.49-1 on macOS Mojave)
screen shot 2019-02-01 at 02 45 31

EDIT: Not seemingly happening in Pd 0.50-2

@porres
Copy link
Owner Author

porres commented Feb 1, 2019

btw, we've also been discussing [makefilename] in vanilla pure-data/pure-data#549

@porres
Copy link
Owner Author

porres commented May 2, 2020

  • [sprintf %.2#x] blows up Pd - old bug

"#" doesn't work in Max

@porres
Copy link
Owner Author

porres commented May 2, 2020

"[sprintf]: slot skipped ('j' modifier not supported in a format pattern)" is not an error given in Max

@porres
Copy link
Owner Author

porres commented May 2, 2020

  • remove %p that was included in 8e56237

@porres
Copy link
Owner Author

porres commented May 2, 2020

remove %p that was included in 8e56237

done with af9bfa0

@porres
Copy link
Owner Author

porres commented May 2, 2020

I guess I'll reboot this issue, cause it became too messy

@porres porres closed this as completed May 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant