Sylvie
197f6cb0ba
No need for .c_str() with keywordDict lookups ( #1505 )
2024-09-18 12:23:05 +02:00
Rangi42
9b3d19c3f2
Prefer snprintf to sprintf
...
This also simplifies advancing `ptr`
2024-09-15 00:01:09 -04:00
Rangi42
02439b18c0
\# will always be defined inside macros
...
This lets the case structure here match the other branches
2024-09-15 00:00:00 -04:00
Sylvie
122ef95d9c
Implement . string constant for the current label scope ( #1499 )
2024-09-13 21:20:01 +02:00
Sylvie
bfb96b038d
Make error messages for "undefined" built-ins more accurate ( #1501 )
2024-09-11 17:54:23 +02:00
Rangi42
1adf68d018
Refer to "label scope", not "symbol scope"
2024-09-10 21:38:50 +02:00
Rangi42
750e69c5a6
More asserts like the one in addLabel
2024-09-10 21:38:50 +02:00
Rangi42
6e83a14143
Consistently handle auto-scoping of local symbols
2024-09-10 21:38:50 +02:00
Rangi42
cff05435ad
Remove redundant and sometimes inaccurate comments
2024-09-10 21:38:50 +02:00
Rangi42
3b59e8963e
Rename variables to avoid C++ reserved "_[A-Z]" prefix
2024-09-10 21:38:50 +02:00
Rangi42
56af572bfd
Refactor symbol value getters for less redundancy
2024-09-10 21:38:50 +02:00
Rangi42
6bc2446966
Rephrase error messages for consistency
2024-09-10 21:38:50 +02:00
Rangi42
155e7287db
Store a pointer to the scoped label, not just its name
2024-09-10 21:38:50 +02:00
Sylvie
1dcc000572
Report locations for RGBLINK errors with conflicting objects ( #1494 )
...
This requires updating the object file format to record the
fstack context for sections themselves, not just for patches.
2024-09-10 19:23:48 +02:00
Rangi42
8cd0e66297
Revert "Implement INCLUDE_ONCE directive ( #1481 )"
...
This reverts commit 5f07095f6d .
2024-09-08 11:30:31 -04:00
sukus
5f07095f6d
Implement INCLUDE_ONCE directive ( #1481 )
...
Identify files by (device, inode), not by path, so that symlinks,
relative paths, case-insensitive paths, or other edge cases
do not result in double includes.
2024-09-08 00:02:02 -04:00
Rangi42
11f0e88b30
Factor out common sanity checks for section union and fragment
2024-09-06 21:55:28 -04:00
Rangi42
d917df406d
Use camelCase instead of lowercase for static functions
2024-09-06 21:48:57 -04:00
Sylvie
323028d9f2
RGBLINK lists local symbols when encountering an unknown symbol reference ( #1496 )
2024-09-06 21:31:13 -04:00
Rangi42
068ad93427
Allow syntax cpl a
2024-09-06 21:35:17 +02:00
ISSOtm
610f04beeb
Fix condition for assuming at EOF
...
Part of that condition's purpose is to ensure that we read the correct
lexer state; but it's possible now for the fstack to be non-empty
*before* the lexer state is registered, i.e. if there is an error
in the function that registers it.
This causes a NULL pointer deref.
2024-09-05 17:48:52 +02:00
Eldred Habert
80d37f9988
Implement --input-tileset ( #1464 )
...
As discussed in https://github.com/gbdev/rgbds/issues/575#issuecomment-1991456862
2024-09-04 15:20:01 -04:00
Sylvie
1283b0b6a6
Allow dollar signs in identifiers ( #1493 )
2024-09-03 23:09:06 +02:00
Rangi42
a098213053
Rearrange switches so default cases are last
2024-09-01 13:00:04 -04:00
Sylvie
6b8d33529e
Improve string/interpolation formatting ( #1491 )
...
- The '#' component for type 's' now escapes the string characters
- The '#' component for type 'f' now prints a precision suffix
- The new 'q' component specifies a precision value
2024-09-01 12:54:26 -04:00
Sylvie
2fb76ce584
Traverse the charmap trie to reconstruct mappings instead of saving them ( #1487 )
2024-09-01 15:22:56 +02:00
Rangi42
15f0871683
Update some names and comments
2024-08-27 14:04:52 -04:00
Rangi42
26fcff831d
Run clang-format
2024-08-27 01:49:05 -04:00
Rangi42
b77ba1d87d
Forward declare struct Section to avoid a nested header include
2024-08-26 22:58:38 -04:00
ISSOtm
8286d9c462
Check that there is enough room to write a patch when linking
...
Prevents segfaulting if a patch's offset is too large
2024-08-26 22:58:38 -04:00
Rangi42
fbe28e0def
Remove outdated "absolute data" terminology in function names
2024-08-26 22:58:38 -04:00
ISSOtm
23272f028f
Update the best proto-pal relative size when a new best is found
...
*facepalm*
2024-08-23 13:35:48 +02:00
ISSOtm
77129b9e80
Fix a false positive reported by scan-build
...
Arguably this also makes the logic a little clearer, so might as well
2024-08-23 01:34:36 +02:00
Sylvie
44332ff4be
Charmaps cannot map an empty string ( #1486 )
2024-08-22 13:21:16 -04:00
Sylvie
0e8a17ce82
Report any section overflows at the end of assembly ( #1482 )
...
* Report any section overflows at the end of assembly
* Immediately handle overflow of the 32-bit size counter
2024-08-22 18:51:52 +02:00
Sylvie
b438c83bda
Implement a '#' prefix for raw identifiers that may alias keywords ( #1480 )
...
* Implement a '#' prefix for raw identifiers that may alias keywords
* Review comments
* Disallow hashless raw identifiers in interpolations
* Run clang-format
2024-08-21 19:31:44 +02:00
Sylvie
57c3d74b9e
Use a custom generic tagged union Either instead of std::variant for efficiency ( #1476 )
...
* Implement custom generic tagged union `Either`
This should be more efficient than `std::variant`, while still
keeping runtime safety as it `assert`s when `get`ting values.
* Use `Either` for RPN expressions
* Use `Either` for file stack node data
* Use `Either` for `File` buffer
* Use `Either` for `STRFMT` args
* Use `Either` for RGBLINK symbol values
* Support an equivalent of `std::monostate` for `Either`
* Use `Either` for lexer tokens
* Use `Either` for symbol values
* Use `Either` for lexer mmap/buffer state
2024-08-20 21:19:11 +02:00
Sylvie
7d98b9a900
Add RGBFIX tests for MBC names ( #1477 )
...
RGBFIX tests are now based on .flags files
The .bin and .err files are optional
2024-08-20 21:15:37 +02:00
Sylvie
8c96293b11
Test the RGBASM state file output ( #1472 )
2024-08-19 20:13:27 +02:00
Sylvie
356367bfd3
Allow mirroring only the X or Y axes ( #1468 )
2024-08-18 21:47:39 -04:00
Rangi42
ee3a93a442
Test macro args \0 and \<0>
2024-08-18 21:38:45 -04:00
ISSOtm
86140b5b2f
Correctly apply section fragment offsets to contained symbols
2024-08-18 19:44:04 +02:00
ISSOtm
369296693c
Avoid softlock if linker script contains a comment but no newline
2024-08-18 19:44:04 +02:00
ISSOtm
47b2e0e912
Trap bad __at() values too
...
Those set the section type earlier than the linker script,
so a check needs to be performed there too
2024-08-18 19:44:04 +02:00
ISSOtm
28733fe312
Implement floating bank in linker script
...
Turns out that we can solve being unable to choose a bank to change
the PC of, by simply refusing to choose!
2024-08-18 19:44:04 +02:00
ISSOtm
e45a422da3
Clarify error message when a section lacks a type
...
The previous commit has made this precision possible
2024-08-18 19:44:04 +02:00
ISSOtm
9fd4ba90cc
Trap invalid section types in RGBDS objs
2024-08-18 19:44:04 +02:00
ISSOtm
e548ecc6fa
Report attempts to assign a SDCC area in a way inconsistent with its data
...
This actually avoids breaking the (segfaulting) invariant that
a section whose type "has data" has as many bytes of `->data` as
its `->size`.
2024-08-18 19:44:04 +02:00
ISSOtm
00b0914436
Reserve space to avoid file sym array realloc
...
This line was missing; in its absence, as soon as the array reallocs,
all registered symbol pointers are invalidated, leading to a crash
(e.g. when generating a sym file).
Made the reallocation check into a hard error, too.
Since fileSymbols gets registered with each section, we would have to
change that, and then it cascades throughout all of RGBLINK.
This will be handled correctly in the Rust port.
2024-08-18 19:44:04 +02:00
Ruben Zwietering
60c03ec1e3
Clear the old line buffer when filling the next one in nextLine
2024-08-18 19:44:04 +02:00