Archive: !define and CRLF escape codes


!define and CRLF escape codes
  I got a notion in my head and wanted to try it out.

Create a multiline !define.


## Declaration

>Var /GLOBAL NULL
>!define NULL `$NULL\\R\\NStrCpy $NULL 0`

>## Example
Pop ${NULL}
DetailPrint $NULL

>## Becomes
Pop $NULL
StrCpy $NULL 0
DetailPrint $NULL
>
At the moment this doesn't appear possible without building my own processor. The idea is an interesting whimsy and I thought I'd share in the hopes that the concept can be discussed. This might make for some interesting macros in the future if implemented.

Request Ticket

first off, a macro can't help you?

the problem with this is, what if you want a newline in the define, !define sometext "foo$\nBar" ? This is far more common, so you would need to come up with another way to escape it. I don't think $\0 does anything, so maybe we could use that


A macro would work IF the macro could be included inline. It would also make the code easier to read than mentally parsing the meta characters in your head like the previous !define example.

At this time though, adding an inline !includemacro causes a compiler error.


## Definitions

Var /GLOBAL NULL
!define NULL `!insertmacro NULL`
!macro NULL
$NULL
StrCpy $NULL 0
!macroend

Section
## Example
Pop ${NULL}
DetailPrint $NULL

## Becomes
Pop !insertmacro NULL # Compile Error here: Pop expects 1 parameters, got 2.
DetailPrint $NULL

## Then
Pop $NULL
StrCpy $NULL 0
DetailPrint $NULL

Quit
SectionEnd
>


!macro NULL op
${op} $NULL
StrCpy $NULL 0
!macroend


!insertmacro NULL pop
DetailPrint $NULL