Conversation
678d0a8 to
ead95a7
Compare
|
I'm sorta lukewarm on this. Prior experiences with homegrown (s)printf implementations have been a mixed bag. I mean, I get the appeal but complex features need to pay for themselves and I'm not quite seeing that. Is there one killer feature in particular that made you start on this? |
Hi @bnoordhuis I understand your concerns, I have invested a hefty amount of work into this, both for pleasure (I like to hack
As you have noticed, Fabrice and I tried hard to avoid depending on other packages to keep the project self contained and reliable. (*) Implementing |
|
@chqrlie I don't have much time this week and (maybe) next week (school holidays) but I'll try to review this at the first possible opportunity. |
Thank you. I have not plugged |
ead95a7 to
c31580b
Compare
3be1340 to
0b5f76d
Compare
- add `js_snprintf`, `js_printf`... to handle extra conversions: - support for wxx length modifier - support for `%b` and `%B` - `%oa` and `%#oa` to convert `JSAtom` values - `%ps` to convert `JSString` values - add `dbuf_vprintf_fun` replaceable `dbuf_printf` handler - change `JS_DumpString` to `JS_FormatString` to convert `JSSAtom` to quoted strings - change `JS_AtomGetStrRT` to `JS_FormatAtom` to convert `JSAtom` to strings - change `JS_AtomGetStr` to return direct string pointer for builtin atoms - remove `print_atom` - use custom conversions for trace messages and error messages - add support for `%b`, `%B` and `w` length modifier in `std.printf` - remove error handlers: `JS_ThrowTypeErrorAtom` and `JS_ThrowSyntaxErrorAtom` - add `is_lower_ascii()` and `to_lower_ascii()` - add floating point conversions and wide string conversions - unbreak compilation: prevent name collision on pow10 - minimize `vsnprintf` calls in `dbuf_vprintf_default`
0b5f76d to
0536b42
Compare
|
Sorry, I dropped the ball on this one. It was around the time I fell ill last year. It definitely needs a rebase now. There are conflicts all over the place. |
Yes, I'll try and fix that this week. |
|
I had a quick look-over and I think I'm not a huge fan of rolling so many changes into a single commit. Consider how it affects git-revert, git-bisect, etc. Also: drag to review - time to land tends to grow exponentially with change size. Is there a way to do this in a more piecemeal fashion? |
Yes, I agree, assessing some of these subtle patches is a headache and assessing the main chunk (printf replacement) is much worse so it is important to separate these patches into identifiable failure points in future git dissect attempts.
Definitely. I am travelling right now but will try posting separate PRs for the preliminary work. |
Add custom printf version
js_snprintf,js_printf... to handle extra conversions:%band%B%oaand%#oato convertJSAtomvalues%psto convertJSStringvaluesdbuf_vprintf_funreplaceabledbuf_printfhandlerJS_DumpStringtoJS_FormatStringto convertJSSAtomto quoted stringsJS_AtomGetStrRTtoJS_FormatAtomto convertJSAtomto stringsJS_AtomGetStrto return direct string pointer for builtin atomsprint_atom%b,%Bandwlength modifier instd.printfJS_ThrowTypeErrorAtomandJS_ThrowSyntaxErrorAtomis_lower_ascii()andto_lower_ascii()vsnprintfcalls indbuf_vprintf_default