Archive: A \ at end of line


A \ at end of line
My code:

Name "Temp"
OutFile ".\temp.exe"
ShowInstDetails show

Page instfiles

Section
Push "aaa"
Call temp
SectionEnd

Function temp ;Convert \\ -> \
Exch $R0
DetailPrint "$R0"
Pop $R0
FunctionEnd
Compiler don't give any error, and have a empty output. :rolleyes:

what are you trying to do? be more specific please!


Yeah what do you want? Your Exch $R0 puts the null $R0 value on top of the stack and sets $R0 to be "aaa", then you DetailPrint which I believe shows up in a box on the installer if you ask it to, then you pop $R0 which makes $R0 the top value on the stack (i.e. null).

Why???? :)


This code work, output a string "aaa"

Name "Temp"
OutFile ".\temp.exe"
ShowInstDetails show

Page instfiles

Section
Push "aaa"
Call temp
SectionEnd

Function temp
Exch $R0
DetailPrint "$R0"
Pop $R0
FunctionEnd
I think the compiler should give me a error waring or a correctly result.

[b]Problem solved[/b]
A "\" at the end of line tells makensis to concatenate the next line to the line with the "\" at the end.

Do this instead:


Function temp ;Convert "\\" -> "\"
Exch $R0
DetailPrint "$R0"
Pop $R0
FunctionEnd

Oh my god, I use ; to comment the \, but why ...


You still haven't told us what you want to do???

-Stu


Sorry for my wrong, I guess a ; before a backslash would make compiler ignore the backslash, but in fact, the next line will still effectively be concatenated the end of current line. So Exch $R0 be commented. So I guess is a bug, bu didn't.


That's a feature, not a bug. See, you can make comments like this: (I think this is correct, correct me if it's wrong)

;Test \
Test2 \
Test3

Thanks, I known.

Hi, deguix, these is a suggest for String Functions Header File. I find some string function not support double width character such as Chinese. I modified StrLoc, StrRep to improve this, would you have a look and continue develope it? The reason I wrote in file header.


Thanks! I'll examine your changes, test the functions, convert these to LogicLib, and include them on the next version of StrFunc.


Bluenet, test the new version of StrFunc already included on NSIS. Is it working correctly now?


Test some function, StrIOToNSIS and StrNSISToIO still have problem, I rewrite the two function here

Function StrIOToNSIS
Exch $R0
Push $R1
Push $R2
Push $R3
Push $R4
StrLen $R2 $R0
${For} $R1 0 $R2
StrCpy $R3 $R0 2 $R1
${If} $R3 == "\r"
StrCpy $R4 "$\r"
${ElseIf} $R3 == "\n"
StrCpy $R4 "$\n"
${ElseIf} $R3 == "\t"
StrCpy $R4 "$\t"
${Else}
StrCpy $R4 ""
${EndIf}
${If} $R4 != ""
StrCpy $R3 $R0 $R1
IntOp $R1 $R1 + 2
StrCpy $R0 $R0 "" $R1
StrCpy $R0 "$R3$R4$R0"
IntOp $R2 $R2 - 1
IntOp $R1 $R1 - 2
${EndIf}
${Next}
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd

Function StrNSISToIO
Exch $R0
Push $R1
Push $R2
Push $R3
Push $R4
StrLen $R2 $R0
${For} $R1 0 $R2
StrCpy $R3 $R0 1 $R1
${If} $R3 == "$\r"
StrCpy $R4 "\r"
${ElseIf} $R3 == "$\n"
StrCpy $R4 "\n"
${ElseIf} $R3 == "$\t"
StrCpy $R4 "\t"
${ElseIf} $R3 == "\"
StrCpy $R4 "\\"
${Else}
StrCpy $R4 ""
${EndIf}
${If} $R4 != ""
StrCpy $R3 $R0 $R1
IntOp $R1 $R1 + 1
StrCpy $R0 $R0 "" $R1
StrCpy $R0 "$R3$R4$R0"
IntOp $R2 $R2 + 1
${EndIf}
${Next}
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Exch $R0
FunctionEnd

Work fine!


If you warned me before of that, this fix would be already included with StrFunc. Now it will take much longer to happen. But thanks for warning me anyways, I'll be including that to the next version :).