DEFINE QUOTE "
DEFINE FNAME file.bin
INCBIN QUOTE _ FNAME _ QUOTE
Currently somewhat works, but the glues are not stripped, so they become part of the resulting string literal including the internal implementation binary value used to mark glues (20 1A 20 -> space, Control character: Substitute, space)
bug: look into glue processing, I think those glues should be processed as they were active during substitution before they have become part of string literal inside quotes.
This was found when discussing different options how to work with bare defines of filenames with Janko, like how to DISPLAY them, and there were some other ideas mentioned:
INCBIN \"FNAME\" ; let substitution replace `\"` with quote and know that it should apply inside as well
; con: what about INCLUDE <FNAME> ? .. add also `\<` and `\>` to substitution rules?
; operators converting things into string literals:
INCBIN STRING(FNAME) ; possible keyword collision with legacy symbol STRING
INCBIN s(FNAME) ; shorter, less likely to collide, probably better variant
INCBIN ""(FNAME) ; but FNAME can contain also `)`, so it would have to be escaped
; (and `)` in filename is not unlikely)
; somehow reusing the current macro args delimiter `<>` ... (it has escaping defined)
; all of these would produce `""` literal, so again no support for `include <system include>`
I guess "fixing" the glue is in the end least invasive, as that is very new feature anyway - if there's something to fix in the first place. So explore first this option. It puts pressure on user to know the trick with DEFINE QUOTE ", but otherwise seems to not need any other extension of anything.
The string literal operators look interesting, but feels like this should be then major change adding all kind of string manipulation operators, so the possible keyword clashes and regressions on legacy code bases are worth it. So string operators smell like v2.x. Glue fix smells like next version.
Currently somewhat works, but the glues are not stripped, so they become part of the resulting string literal including the internal implementation binary value used to mark glues (
20 1A 20-> space, Control character: Substitute, space)bug: look into glue processing, I think those glues should be processed as they were active during substitution before they have become part of string literal inside quotes.
This was found when discussing different options how to work with bare defines of filenames with Janko, like how to
DISPLAYthem, and there were some other ideas mentioned:I guess "fixing" the glue is in the end least invasive, as that is very new feature anyway - if there's something to fix in the first place. So explore first this option. It puts pressure on user to know the trick with
DEFINE QUOTE ", but otherwise seems to not need any other extension of anything.The string literal operators look interesting, but feels like this should be then major change adding all kind of string manipulation operators, so the possible keyword clashes and regressions on legacy code bases are worth it. So string operators smell like v2.x. Glue fix smells like next version.