- NSIS Discussion
- A \ at end of line
Archive: A \ at end of line
bluenet
5th October 2004 14:18 UTC
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:
Yathosho
5th October 2004 14:29 UTC
what are you trying to do? be more specific please!
RobGrant
5th October 2004 14:37 UTC
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???? :)
bluenet
5th October 2004 15:20 UTC
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.
saivert
5th October 2004 15:23 UTC
[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
bluenet
5th October 2004 16:28 UTC
Oh my god, I use ; to comment the \, but why ...
Afrow UK
5th October 2004 18:42 UTC
You still haven't told us what you want to do???
-Stu
bluenet
6th October 2004 02:04 UTC
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.
deguix
6th October 2004 02:17 UTC
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
bluenet
6th October 2004 04:01 UTC
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.
deguix
7th October 2004 00:51 UTC
Thanks! I'll examine your changes, test the functions, convert these to LogicLib, and include them on the next version of StrFunc.
deguix
13th October 2004 23:07 UTC
Bluenet, test the new version of StrFunc already included on NSIS. Is it working correctly now?
bluenet
17th October 2004 12:17 UTC
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!
deguix
17th October 2004 16:33 UTC
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 :).