Commit Graph

787 Commits

Author SHA1 Message Date
Sylvie
9783671399 Simplify some C++ abstractions (#1518)
* Remove namespaces
* Prefer `bool operator==`, not `friend auto operator==`
* Prefer not to use `using`
* Use a `constexpr` function instead of a template for `flipTable`
2024-09-26 00:07:27 -04:00
Rangi42
dd20012e88 Release 0.9.0-rc1 2024-09-18 10:15:38 -04:00
Sylvie
9ef2e43bf7 Track local label scope, string equated as .. (#1504) 2024-09-18 09:52:30 -04:00
Sylvie
122ef95d9c Implement . string constant for the current label scope (#1499) 2024-09-13 21:20:01 +02:00
Rangi42
1adf68d018 Refer to "label scope", not "symbol scope" 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
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
Sylvie
323028d9f2 RGBLINK lists local symbols when encountering an unknown symbol reference (#1496) 2024-09-06 21:31:13 -04: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
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
Rangi42
15f0871683 Update some names and comments 2024-08-27 14:04:52 -04:00
Rangi42
b77ba1d87d Forward declare struct Section to avoid a nested header include 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
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
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
356367bfd3 Allow mirroring only the X or Y axes (#1468) 2024-08-18 21:47:39 -04:00
Sylvie
0cd79c33ef Fix RGBGFX reversal (#1425)
* Print all OoB tilemap IDs before aborting

* Rename `nbTileInstances` to `mapSize`

* Check that reversing doesn't overflow the tile array

---------

Co-authored-by: ISSOtm <me@eldred.fr>
2024-08-08 19:40:41 +02:00
Sylvie
e93190d491 Implement BITWIDTH and TZCOUNT functions (#1450) 2024-08-07 10:39:30 -04:00
Sylvie
7435630d6a Error messages note when a symbol has been purged (#1453) 2024-08-06 15:35:06 -04:00
Sylvie
fc8707886c Output exported numeric constants to sym file (#1439) 2024-08-06 10:58:35 -04:00
Sylvie
2706f94788 Multiple fixes and enhancements to RPN behavior: (#1448)
- FIX: `Label & const` was not actually doing the `& const` masking
  (fixes #1446)
- ADD: `LOW(Label)` can be constant if `Label` is aligned to 8 or more bits
  (resolves #1444)
- ADD: `!expr` can be constant 0 if `expr` has any non-zero bits
  (resolves #1447)
- `LOW()` and `HIGH()` have their own RPN operator values
  (resolves #1445)

The change to RPN values means that the object file version was incremented.

This also refactors unary operators and functions, combining their
evaluation similarly to binary ones.
2024-08-06 13:54:55 +02:00
Sylvie
2f8f99bd94 Implement -Wpurge= (#1443) 2024-08-05 12:50:48 -04:00
Sylvie
f304e1dd7f Implement state file output for RGBASM (#1435) 2024-08-05 12:41:40 -04:00
Sylvie
9a5b3f0902 Implement multi-value charmaps (#1429) 2024-08-04 23:32:08 +02:00
Sylvie
8af9e9d465 Add rgbgfx -r 0 to infer a width (#1437) 2024-08-04 20:31:05 +02:00
ISSOtm
f4d0f01f91 Fix max number of palettes wrapping around after 255 2024-08-02 16:14:43 +02:00
Rangi42
4e0f794c23 More refactoring and renaming 2024-07-26 20:12:51 -04:00
Sylvie
6a65cbc9ed Some refactoring and reformatting (#1431) 2024-07-26 11:51:27 -04:00
Rangi42
556c8a968a Release 0.8.0 2024-06-28 14:53:17 -04:00
Sylvie
240ab8ed1c Keep the object version as RGB9; only increment the revision to 10 (#1413) 2024-06-21 16:47:49 +02:00
Sylvie
623c3f662c Allow NUL characters in strings (#1405) 2024-06-18 14:26:18 -04:00
Rangi42
39e9315e8a Use a smaller size for the lexer buffer
Large sizes are more efficient when it's actually buffered,
but most of the time `mmap` is used instead, and the extra size
just slows down allocation of lexer states.
2024-05-17 20:59:42 -04:00
Sylvie
352551d4f8 Allow padding to coexist with overlay file (#1395) 2024-05-17 11:14:44 +02:00
Sylvie
e2633d5b66 Use the standard stream buffer size for the lexer buffer (#1396) 2024-05-17 11:02:36 +02:00
Rangi42
b8387427a6 Use consistent RGBDS_<PROG>_<NAME>_HPP header guard convention 2024-04-14 21:50:05 -04:00
Sylvie
a234da42a6 Replace assert with assume for release build optimization (#1390) 2024-04-02 11:09:31 -04:00
Sylvie
1d39e5ed56 Use std::variant for RPN expression value (#1389) 2024-04-01 16:47:15 +02:00
Rangi42
14b72222b1 Remove the deprecated -H/-h/-L/-l options 2024-03-28 17:26:42 -04:00
Rangi42
106e516962 Split the .peek() method into its next-char and lookahead cases 2024-03-28 15:37:25 -04:00
Rangi42
6f74e4fb9c Remove the suboptimal .canPeek() and .peek() methods 2024-03-28 14:49:36 -04:00
Rangi42
83c0634f15 Refactor peekInternal to be a LexerState method 2024-03-28 13:21:28 -04:00
Rangi42
4172d330b9 Refactor BufferedContent and Expansion to have methods
Use a buffer size that is a power of two for fast modulus
2024-03-28 12:57:23 -04:00
ISSOtm
20b7b591d4 Run clang-format
Fix some small style inconsistencies
2024-03-28 01:41:25 +01:00
ISSOtm
e5078aba3b Clean up #includes
Remove unused headers, and avoid relying on transitive inclusions

`include-what-you-use` has been very useful for this!
2024-03-28 01:25:38 +01:00
ISSOtm
cae7b5dcf6 Use standard attribute syntax instead of IBM __attribute__
Move format attrs to proper standard location

For some reason, GCC 13 is more lax than earlier versions...
2024-03-27 20:01:12 -04:00
Rangi42
506911d7d0 Refactor to avoid redundant obj_CheckAssertions function 2024-03-27 16:19:01 -04:00