Commit Graph

263 Commits

Author SHA1 Message Date
Feoramund
eb93779f63 Fix duplicate sign printing of complex and quaternion types
Negative zero wasn't being detected (so it would appear as `+-0`), and
`+Inf` was appearing as `++Inf` when imaginary.
2024-06-03 19:51:17 -04:00
gingerBill
f600562ca5 Improve fmt parsing of struct field tags 2024-05-20 14:45:49 +01:00
Jeroen van Rijn
e0d3d68ce5 Fix the way '%32b' and other prefixed numbers are written. 2024-05-20 14:42:13 +02:00
Matias Fernandez
a9629679ed remove extra newline in enumerated array hash fmt 2024-05-18 23:24:05 -04:00
gingerBill
7cf62f00c3 Correct #soa RTTI usage 2024-05-16 16:30:45 +01:00
Feoramund
11180e36ae Amend fmt documentation 2024-05-09 19:38:44 -04:00
Feoramund
5e149d2cae Refactor wprintf
- Extracts common code between C and Python-like syntax into its own
   sub-procedures.
 - Fixes Python-like syntax from treating `}` as a verb.
 - Makes C-like syntax treat ' ' as a missing verb.
 - Fixes EXTRA arguments being formatted with options that were
   previously set, instead using default options now.
 - Makes error messaging more consistent between C and Python-like
   syntax.
 - Requires argument index to be specified immediately before the verb
   in C-like syntax, per the documentation, instead of after `%` _or_
   before the verb.
 - Tracks argument usage through a `bit_set`, allowing for reporting of
   unused arguments even when reordered.
 - Moves exit for C-like syntax if next byte is `%` to beginning of
   block instead of needlessly trying to parse through all options.
 - Pops next unused argument for unspecified formatters like `%i` or
   `{}`, instead of taking the argument after the last one used.
 - Fixes unspecified precision `%.f` from not setting precision to zero,
   per the documentation.
2024-05-09 19:28:04 -04:00
Feoramund
700f9c94bd Combine adjacent sbprint*/to_string calls
The `sbprint*` procs already return a string conversion.
2024-04-28 17:18:46 -04:00
Feoramund
c712de0cd0 Require results for non-buffered print procs 2024-04-28 17:17:01 -04:00
Laytan Laats
cc5faecced wasm: add the fprint procedures to fmt
This makes the `log` package work on wasm
2024-04-28 16:10:04 +02:00
gingerBill
c752d0b541 Fix printing of big endian integers in a bit_field 2024-04-27 09:16:18 +01:00
Damian Tarnawski
2a70faca14 Add printfln and eprintfln functions to fmt_js.odin 2024-04-21 22:37:04 +02:00
gingerBill
d84b29866f Merge pull request #3447 from matias-eduardo/fix-soa-hash-formatting
fix #soa '%#v' formatting
2024-04-19 14:05:15 +01:00
gingerBill
059175de3b Do not print column of a runtime.Source_Code_Location if the column == 0 2024-04-19 13:32:55 +01:00
Matias Fernandez
e296b050ee fix #soa '%#v' formatting 2024-04-17 22:54:30 -04:00
gingerBill
abd5fc606c Fix #3407 2024-04-10 14:12:41 +01:00
gingerBill
a750fc0ba6 Add #row_major matrix[R, C]T
As well as `#column_major matrix[R, C]T` as an alias for just `matrix[R, C]T`.
This is because some libraries require a row_major internal layout but still want to be used with row or major oriented vectors.
2024-03-19 21:05:23 +00:00
gingerBill
0f83ab466f Minor change to spacing when printing a map 2024-03-08 13:20:27 +00:00
gingerBill
5ff6a25bdc Improve formatting for %# on maps 2024-03-07 13:45:52 +00:00
gingerBill
b6b8e640f5 Replace b with _ as it is not needed 2024-03-07 13:41:54 +00:00
gingerBill
573402c97e Begin work on %w - 'w'rite as valid Odin literals 2024-03-07 13:39:44 +00:00
gingerBill
0a5c85f8e3 Merge pull request #3207 from Tetralux/printfln
Add `fmt.*printfln`
2024-02-29 14:04:38 +00:00
gingerBill
5c5b78cbbe Improve bit_field printing 2024-02-22 19:48:44 +00:00
gingerBill
54515af8cc Add field tags to bit_field 2024-02-22 19:41:48 +00:00
gingerBill
5a84a08225 Add general support for bit_fields 2024-02-22 17:24:42 +00:00
gingerBill
a4b8c1ea17 Begin work adding bit_field 2024-02-22 15:55:54 +00:00
gingerBill
8472338bfa Add reflect.enum_name_from_value and reflect.enum_name_from_value_any 2024-02-21 12:43:09 +00:00
Tetralux
b1e608bfba [fmt] Add *printfln()
Adds the following procedures, which just call through to the `printf` versions, with `newline = true`; a new parameter
also added in this commit.
In all cases, `wprintf` is the one that ultimately writes the newline, if requested.

- printfln
- fprintfln
- eprintfln
- aprintfln
- tprintfln
- bprintfln
- caprintfln
- ctprintfln
- sbprintfln
- wprintfln
2024-02-18 16:14:59 +00:00
gingerBill
539cec7496 Move Tracking_Allocator to its own file. 2024-02-01 13:01:38 +00:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
gingerBill
9a9625f885 Fix #3053 2024-01-26 13:04:47 +00:00
Dragos Popescu
90d1f9ab27 Removed return value of assertf. assertf now correctly responds to -disable-assert. Added log.assert and log.assertf. All asserts now do the @cold trick, first added to builtin.assert 2024-01-23 20:56:13 +02:00
Jeroen van Rijn
89084befb0 Remove unnecessary []byte -> []byte conversion. 2023-12-30 21:59:33 +01:00
gingerBill
55f3e99f63 Fix %g in fmt, and make %v default to %g for floats 2023-12-21 17:05:24 +00:00
Yawning Angel
29c80c238d core: Fixed build constraints
Multiple constraints on the same line are combined with logical OR,
while combining multiple negated constraints needs to be done with
logical AND (each constraint on a separate line).
2023-12-17 23:02:46 +09:00
Laytan Laats
e2cecafa66 allow integer verbs in fmt_bit_set 2023-11-07 21:09:42 +01:00
gingerBill
e206d6ba35 Add allocator parameter to fmt's aprint and aprintln 2023-11-03 13:26:33 +00:00
Jeroen van Rijn
1287e8c734 Merge pull request #2839 from Tetralux/aprintf-ally
[fmt] Add allocator parameter to `fmt.aprintf`
2023-10-02 11:23:26 +02:00
Tetralux
7a6ac3ea92 [fmt] Add allocator parameter to fmt.aprintf
This allows you to do `fmt.aprintf("Hello, %v!", name, allocator = ally)`.
2023-10-02 02:46:26 +00:00
gingerBill
14adcb9db8 Use or_break and or_continue where appropriate in the core library 2023-09-30 15:34:39 +01:00
Laytan Laats
d47b0eeee7 update doc 2023-09-12 16:51:21 +02:00
Laytan Laats
287beaff35 use KiB etc. instead of KB 2023-09-12 16:49:42 +02:00
Laytan Laats
735cfcd290 Add formatting of bytes into the best unit of measurement 2023-09-01 19:17:07 +02:00
gingerBill
515163864f Add optional flush := true to many of the core:fmt procedures 2023-08-22 17:24:12 +01:00
gingerBill
49ab935ae9 Disallow for in in favour of for _ in 2023-08-08 14:56:12 +01:00
gingerBill
c91898a888 Remove #relative slices; Replace with #relative multi-pointers 2023-08-05 16:05:39 +01:00
gingerBill
44ea82f845 Clean up usage of using throughout core and vendor 2023-07-31 11:46:40 +01:00
gingerBill
6c6f9f7d25 Fix fmt implementation for js 2023-06-26 15:55:35 +01:00
gingerBill
19ea090633 Merge pull request #2584 from odin-lang/new-io
New and Improved `io.Stream` interface
2023-06-23 12:12:17 +01:00
gingerBill
9b54b99bf6 Use positional and named arguments within the core library 2023-06-21 01:17:05 +01:00