Rangi42
ba104baf3e
Refactor mapFile for Windows
2024-03-09 19:22:06 -05:00
Rangi42
cce7f51235
Remove RPN symbol name length limit
2024-03-09 17:56:30 -05:00
Sylvie
17444e825a
Reduce the header declarations ( #1342 )
...
- Since we have style rules to include foo.hpp at the top of its
corresponding foo.cpp, this takes any headers included by foo.hpp
as being also guaranteed for foo.cpp.
- Use C-style <foo.h> instead of <cfoo>, since the latter only
guarantees putting symbols in the `std` namespace, which we are
not using for C functions (e.g. `printf` not `std::printf`).
- Remove now-unused `__PRETTY_FUNCTION__` reporting
2024-03-09 14:55:39 -05:00
Sylvie
3323cb56fe
Make enum patterns more explicit ( #1343 )
2024-03-09 14:55:17 -05:00
Sylvie
5681be1fd8
Use automatic allocation and std::move for RPN bytes ( #1336 )
2024-03-09 11:12:34 -05:00
Rangi42
0bfade4435
Fix enum: REG_SP == REG_AF == 3
2024-03-08 20:00:29 -05:00
Rangi42
40704b5055
Remove unused yyerror declaration
...
Also reformat some `enum`s
2024-03-08 19:47:57 -05:00
Sylvie
53537cf9af
Remove now-unnecessary enum keyword ( #1338 )
...
C++ does not need it
2024-03-08 19:40:41 -05:00
Rangi42
75cc12bb3d
Use std::optional for fstack paths
2024-03-07 21:41:02 -05:00
Rangi42
563d699394
Avoid an extra operation if !labelScope (thanks, ISSOtm)
2024-03-07 17:33:33 -05:00
Rangi42
aed172071b
Replace some macros with static functions or constants
2024-03-07 16:10:05 -05:00
Rangi42
0f52cd0bab
Use std::reverse for binary digits
2024-03-07 14:48:23 -05:00
Rangi42
2fd95381a6
Get rid of some fixed-size char buffers
2024-03-07 14:36:30 -05:00
Rangi42
184957c0ed
Use fwrite and fputs instead of multiple putc
2024-03-07 12:40:37 -05:00
Rangi42
7663a777d5
Remove 255-character limit on symbol names
2024-03-07 12:40:37 -05:00
Rangi42
097b7c3baf
Use std::string for symbol names
2024-03-07 12:40:33 -05:00
Rangi42
bf45ebb178
Run clang-format to fix some inconsistent style
2024-03-07 11:52:53 -05:00
Rangi42
84bedc7bbe
Use automatic allocation for RPN reasons
2024-03-07 09:58:45 -05:00
Rangi42
e5b7e65e91
Use std::nothrow from <new> with every new allocation
2024-03-07 09:56:15 -05:00
Rangi42
104fd6c70d
Use automatic allocation for some parser values
2024-03-06 22:17:35 -05:00
Sylvie
292adb27a3
Adapt the RGBASM parser to C++ ( #1333 )
...
This uses variants instead of a `%union`, and "complete symbols"
that can call complex constructors.
2024-03-06 20:40:36 -05:00
Rangi42
8c173b4e95
Remove declaration for compatibility with macOS bison 2.3
...
We've required bision 3.0 since October 2022
2024-03-06 17:58:15 -05:00
Rangi42
75105016f7
Make sure that parsed subexpressions are fully defined
...
We were not initializing some expressions, and they were using
the values of the previous expressions instead. This just so
happened to not crash the tests, and to sometimes even give valid
results (although `BANK()` of a non-label symbol being $4B4E4142,
the ASCII balue of "BANK", was something we missed).
2024-03-06 16:00:55 -05:00
Rangi42
f419f206e5
Fix a latent bug with parsing macro args
...
This seems to only have worked by coincidence; `$$` was an
undefined value that happened to equal `$1` already.
2024-03-06 15:14:17 -05:00
Rangi42
82824a4bf2
Avoid using Bison's typed mid-rule actions
...
These work with `%union`, but will not work with C++ `variant`
2024-03-06 14:19:37 -05:00
Rangi42
d1652c0028
Refactor cases for simplicity, and remove redundant comments
2024-03-06 14:10:50 -05:00
Rangi42
053aa80951
Improve some const correctness in RGBASM
2024-03-06 13:53:03 -05:00
Rangi42
585c620945
Rename fail to sectError, since it increments nbSectErrors
2024-03-05 14:36:18 -05:00
Rangi42
bd88787cb3
Use FileStackNode constructor to avoid std::monostate possibility
2024-03-05 14:22:29 -05:00
Sylvie
e74073e480
Run clang-format on everything ( #1332 )
2024-03-04 14:22:49 -05:00
Sylvie
b004648a13
Use std::variant for symbol values ( #1331 )
2024-03-04 08:55:33 -05:00
Rangi42
13904dc536
Remove EQUS callbacks for symbols
...
They're no longer used since `__FILE__` was removed
2024-03-03 21:26:44 -05:00
Sylvie
f8dab23e8f
Use uncommented sizes for pointer-to-array arguments ( #1329 )
...
This is syntactically valid despite not being enforced, and
is a feature we already use elsewhere.
2024-03-03 19:43:08 -05:00
Sylvie
8cf446b14c
Use std::variant for lexer mmap/buffer state ( #1328 )
2024-03-03 18:45:50 -05:00
Rangi42
277ea9be28
Replace RGBASM non-null pointers with references
2024-03-03 00:57:03 -05:00
Rangi42
2e1b0b6421
Remove commented-out C-only macro features
2024-03-02 20:17:22 -05:00
Rangi42
19bb12754b
Use new allocation for expanding \#
2024-03-02 08:04:59 -05:00
Rangi42
dbcb82799e
Use std::vector for capture buffer
2024-03-02 06:46:11 -05:00
Sylvie
a71e4086a2
Use std::string_view for macro bodies ( #1326 )
...
This removes the last use of `strdup`
This required making a lot of related pointers be `const`.
That in turn conflicted with the need to `munmap()` a pointer
eventually, which was similar to the need to eventually `free()`
an `Expansion`'s contents, so I used the same solution of a
`union`. That lets us normally use the `const` pointer for
`const` correctness, and the non-`const` one for the not-really-
mutating destruction cases.
2024-03-02 13:21:28 -05:00
Rangi42
2069a95e0f
Use std::string for macro args
2024-03-02 05:23:15 -05:00
Rangi42
b130c2e27c
Use std::string for STRFMT spec and args
2024-03-02 05:09:43 -05:00
Rangi42
ba00cf5684
Use std::string for section names
2024-03-02 04:47:02 -05:00
Rangi42
b488d3a90f
Use std::optional<std::string> for lexer expansion names
2024-03-02 04:34:42 -05:00
Sylvie
1ac3c0262f
Refactor structs to use methods instead of functions ( #1322 )
2024-03-01 13:11:45 -05:00
Rangi42
e14ba664ea
Remove redundant (void) parameter declarations
2024-03-01 10:41:47 -05:00
Rangi42
91d22f180e
Reorganize the asm parser to be more like the linker script parser
...
Split the declarations into those required for the `%union` and
those only required for the `code`.
Only declare functions on top; define them at the bottom.
2024-02-29 16:23:53 -05:00
Sylvie
043db49676
Replace NULL with nullptr ( #1321 )
2024-02-29 15:06:33 -05:00
Sylvie
eff8c324c8
Remove now-unnecessary struct keyword ( #1320 )
...
C++ acts like structs are `typedef`ed by default
We do have to keep `struct stat`, since there's ambiguity
with the function also called `stat`.
2024-02-29 14:41:58 -05:00
Rangi42
1210a7441f
Use std::visit with Visitor helper instead of std::holds_alternatve
2024-02-29 13:44:08 -05:00
Rangi42
2ff723f943
Use vec.data() instead of &vec[0]
...
In general `vec.data()` is always safe, whereas `&vec[0]`
may fail when `vec` is empty.
2024-02-29 13:44:08 -05:00