Rangi
7a587eb7d6
Use midrule action values for captures' terminated status
...
Bison 3.1 introduces "typed midrule values", which would write
`<captureTerminated>{ ... }` and `$$` instead of `{ ... }` and
`$<captureTerminated>[1-9]`, but rgbds supports 3.0 or even lower.
2021-04-20 17:10:08 +02:00
Rangi
7ac8bd6e24
Return a marker token at the end of any buffer
...
Removes the lexer hack mentioned in #778
2021-04-20 17:10:08 +02:00
Rangi
459773b3f0
Update some whitespace after Hungarian prefixes were removed
...
Keep the parameter alignment and 100-char line limit
2021-04-19 16:47:39 -04:00
ISSOtm
6d0a3c75e9
Get rid of Hungarian notation for good
...
Bye bye it was not nice knowing ya
2021-04-19 22:12:10 +02:00
Rangi
52797b6f68
Implement SIZEOF("Section") and STARTOF("Section") ( #766 )
...
Updates the object file revision to 8
Fixes #765
2021-04-17 18:36:26 -04:00
Rangi
5108c5643c
Let charmap_ConvertNext advance its output pointer
2021-04-17 18:18:34 -04:00
Rangi
2005ed1df9
Implement CHARLEN and CHARSUB
...
Fixes #786
2021-04-17 18:18:34 -04:00
Rangi
d43408f4f3
Allow OPT to modify -W
...
Warning flags are processed individually;
PUSHO and POPO (re)store all the warning states.
2021-04-18 00:11:18 +02:00
Rangi
2c30ab8731
Allow OPT to modify -L
...
-L is a Boolean flag option, so you specify 'OPT L' or 'OPT !L'.
2021-04-18 00:11:18 +02:00
Rangi
ee5da4468d
Fix interpolation/STRFMT overflow issues ( #838 )
...
Widths and fractional widths greater than 255 would overflow a
uint8_t and wrap around to smaller values.
Total formatted lengths greater than the avilable buffer size
would overflow it and potentially corrupt memory.
Fixes #830
Closes #831
2021-04-17 00:52:55 -04:00
Rangi
503c3b5364
Revert "Fix interpolation/STRFMT overflow issues"
...
This reverts commit 992be3fd9b .
2021-04-16 22:19:37 -04:00
Rangi
992be3fd9b
Fix interpolation/STRFMT overflow issues
...
Widths and fractional widths greater than 255 would overflow a
uint8_t and wrap around to smaller values.
Total formatted lengths greater than the avilable buffer size
would overflow it and potentially corrupt memory.
Fixes #830
Closes #831
2021-04-16 22:00:17 -04:00
Rangi
c278a361da
Remove the unused calchash djb2 hash function
...
Note that hashmap.c uses its own FNV-1a hash function
2021-04-13 17:41:12 +02:00
Rangi
a2f52867ad
Rename print to printChar
...
This clarifies its usage, for printing a single character
in error messages.
2021-04-13 17:41:12 +02:00
Rangi
49aac2961d
Warn about backwards FOR loops with -Wbackwards-for (-Wall)
...
Fixes #816
2021-03-31 10:00:21 -04:00
ISSOtm
60019cf476
Fix a bunch of Clang warnings
...
As reported by #789
Should avoid relying on 32-bit int (for implicit conversions)
and account for more extreme uses of RGBDS.
2021-03-10 10:56:57 +01:00
daid
5d6e0677d9
Fix error-related issues ( #773 )
...
* Mark `error` as a `format` function, to properly scan its format
* Fix the call to error() from parser.y:
- Use '%s' to avoid passing an arbitrary format
- Simplify yyerror overall
* Fix size parameter of %.*s format being an int... bonkers standard.
* Report the number of arguments required and provided on a STRFMT mismatch
* Add an assert to check for a very unlikely bug
2021-03-02 16:34:19 +01:00
Rangi
56071599e7
Allow trailing commas in bare lists
...
This applies to macro arguments, DB, DW, DL, DS,
PRINT, PRINTLN, EXPORT, PURGE, and OPT.
It also removes support for empty entries in DB/DW/DL.
(Deprecating it would require keeping parser support,
which is ambiguous with trailing commas.)
Fixes #753
2021-03-02 11:48:20 +01:00
Rangi
0774f5eb9d
Rename math.c/mymath.h to fixpoint.c/.h
...
This also changes the functions' prefix
from "math_" to "fix_".
2021-03-02 11:40:03 +01:00
Rangi
1dafc1c762
Allow empty macro arguments, with a warning
...
Fixes #739
2021-02-28 10:38:49 -08:00
Rangi
d4028fff10
Prevent ELIF or ELSE after an ELSE
...
Fixes #749
2021-02-25 04:39:49 +01:00
dannye
929e2a4490
rgbasm: Report conflicting file/line number for duplicate sections
2021-02-23 20:08:59 +01:00
Rangi
8c0275480c
Allow ds to take multiple values to repeat for a count ( #725 )
...
Fixes #722
2021-02-16 22:01:23 -05:00
Rangi
76d6ef8695
Implement LOAD UNION and LOAD FRAGMENT
...
Fix #632
2021-02-17 03:42:06 +01:00
Rangi
ee20d9010e
Make @ relative to the start of a ds even at link time
...
Fix #737
2021-02-16 22:47:07 +01:00
Rangi
cb61da8842
-Wmacro-shift warns about shifting macro arguments too far ( #741 )
...
Fixes #735
2021-02-16 16:31:01 -05:00
Rangi
ebb5aab6db
Correct some comments
...
nPCOffset no longer exists, and the lexer only
returns T_NEWLINE for EOF in raw mode.
2021-02-14 16:16:52 +01:00
ISSOtm
b3c0db218d
Remove "EOF-newline" lexer hack
...
In preparation for an upcoming change
Makes for nicer error messages, complaining about EOF instead of newlines
The hack had to be kept for the lexer raw mode to avoid a bug;
see the relevant code comment for more info.
2021-02-11 12:48:37 +01:00
Rangi
e3d355d976
Attempt to recover from syntax errors with bison
...
Fixes #595
2021-01-22 15:54:24 +01:00
ISSOtm
a679e02246
Get rid of asm.h and localasm.h
...
No need to make them global
2021-01-22 13:34:16 +01:00
ISSOtm
fa0fa4d5ac
Significantly overhaul OPT code
...
Simplify the mess that was option setting (2 redundant variables !?)
Move options to a separate file
Have "modules" own their options, and OPT only access them (less redundancy)
Simplify code, respect naming conventions better
2021-01-22 10:41:09 +01:00
ISSOtm
1487eebe79
Remove time counter
...
Nobody uses that, and it requires running extra code for each line
2021-01-22 08:51:57 +01:00
Rangi
fb39c3a70e
Consistently refer to "directives", not "pseudo-ops"
...
Some docs and warnings already referred to SECTION and
db/dw/dl "directives", but others used "pseudo-ops".
2021-01-19 15:03:22 +01:00
Rangi
df16e64fc6
Handle MACRO and REPT/FOR bodies differently
...
Fixes #697
2021-01-15 02:16:37 +01:00
Rangi
cab9cb06a3
Store IF depth relative to each fstack context
...
This disallows starting/ending an IF inside an
INCLUDEd file or a macro expansion
2021-01-09 20:12:14 +01:00
Rangi
62bea23c49
Implement BREAK to exit REPT and FOR loops
...
Fixes #684
2021-01-08 21:13:23 +01:00
Rangi
7e3fc1db03
Fix Actions CI for MSVC
...
Fixes #616
2021-01-04 02:01:25 +01:00
Rangi
77279984a5
Implement STRRPL
...
Fixes #660
STRRPL(str, "", new) does nothing
(warn about it with -Wempty-strrpl)
2021-01-04 00:20:35 +01:00
Rangi
9d2d5cfcfe
Implement REDEF to allow redefining EQUS string equates
...
Fixes #677
2021-01-02 01:49:00 +01:00
Rangi
895ec5564d
Update mathematical functions ( #675 )
...
Document the existing `ROUND`, `CEIL`, and `FLOOR` functions
Also update the trig function docs for searchability
Implement `POW` and `LOG`
Addresses part of #675
Implement ** for integer exponents
** has higher precedence than -, like Python, so -3**4 == -(3**4) == 81
2021-01-02 01:39:20 +01:00
Rangi
7bb6f71f0b
Change FOREACH to FOR ( #680 )
2021-01-02 00:46:26 +01:00
Rangi
10e3f1a02b
Deprecate built-in _PI
...
Fixes #670
2021-01-01 19:18:17 +01:00
Rangi
c0ce1da4c3
Implement STRFMT and more printf-like format specifiers for string interpolation ( #646 )
...
Fixes #570
Fixes #178
Use errors for inapplicable format spec flags instead of -Wstring-format
2020-12-29 22:53:15 +01:00
Rangi
6874f694e5
Implement FOREACH ( #658 )
...
This acts like `REPT` with a variable automatically
incremented across a range of values
Fixes #432
2020-12-29 21:30:42 +01:00
Rangi
ad6f17cd93
Support SOURCE_DATE_EPOCH for reproducible builds
...
See https://reproducible-builds.org/docs/source-date-epoch/
Fixes #286
2020-12-19 01:09:45 +01:00
Rangi
f31deb5010
Fix STRUPR and STRLWR after 5aabb915ec
...
Fixes #647
2020-12-15 20:18:45 +01:00
ISSOtm
8f2a894b88
Add anonymous labels
...
Fix #497
2020-12-14 10:14:40 +01:00
Rangi
0e40543757
Implement \# to expand to all unshifted macro arguments
...
Fixes #596
2020-12-14 00:12:36 +01:00
ISSOtm
0d9de01f9d
Make charmap-converting a non-UTF8 string non-fatal
2020-12-12 14:16:50 +01:00
Rangi
165bd8cb71
Allow 'dw' and 'dl' to apply to characters of strings
...
Fixes #568
The old behavior of `dw "string"` can be replicated with `dw ("string")`; likewise for dl
2020-12-11 11:02:20 +01:00