How to use -printerror and -formaterror

Forum for discussion about the Windows IDE of Hollywood
Post Reply
User avatar
Clyde
Posts: 341
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

How to use -printerror and -formaterror

Post by Clyde »

I am have trouble the new Hollywood 9 console arguments -printerror (and -formaterror).

I created this faulty script (see missing "n" of the word "Function"):

Code: Select all

Local Functio p_myDebugPrint(p1)
    DebugPrint(p1)
EndFunction
On Windows in the standard command prompt I run the script like this and get the error message in a popup:

Code: Select all

Hollywood test.hws
Now, when I run the script with the -printerror parameter, no popup dialog is shown (which is correct) but there is also no output in the command prompt:

Code: Select all

Hollywood test.hws -printerror
How is that intend to work?

Additionally, do you have an example on how to use -formaterror? I don't get the documentation, sorry. ;-) This does not work ("syntax error") also not when enclosing the last parameter in ""):

Code: Select all

Hollywood test.hws -printerror -formaterror @_hwerror<line>:<file>*<message>
Thanks!
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc

User avatar
airsoftsoftwair
Posts: 4789
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: How to use -printerror and -formaterror

Post by airsoftsoftwair »

Clyde wrote:
Fri Apr 02, 2021 3:52 pm
Now, when I run the script with the -printerror parameter, no popup dialog is shown (which is correct) but there is also no output in the command prompt:
This is because Windows distinguishes between console and Windows programs. Windows programs such as Hollywood.exe don't have access to the current console's stdout etc. handles. That's why Hollywood comes with a separate version just for the console. It's called Hollywood_Console.exe and it's in the same directory as the other Hollywood.exe, which is the same program but using the Windows instead of the console subsystem. So you have to use Hollywood_Console.exe if you want to capture stdout output.
Clyde wrote:
Fri Apr 02, 2021 3:52 pm
Additionally, do you have an example on how to use -formaterror? I don't get the documentation, sorry. ;-) This does not work ("syntax error") also not when enclosing the last parameter in ""):
You mustn't pass any parameters to -formaterror. It's just a boolean argument that doesn't accept parameters. The error format used by -formaterror is fixed and will always be like this:

Code: Select all

@_hwerror<line>:<file>*<message> 

User avatar
Clyde
Posts: 341
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: How to use -printerror and -formaterror

Post by Clyde »

Perfect, thanks a lot for the clarification! I was aware of that file but wasn't sure when to use it. Now it seems obvious to me ... It seems those infos you posted are not in the documentation, are they? Maybe you could add that.

Another thing regarding this, which should probably be posted in the "Wishlist" section: Currently, if there are more than one sytnax errors in the file you only get the first error. If you correct that and run/compile you get the next error. It would be nice to get the whole list of errors (one on each line) at once. Is that possible?

Thanks!
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc

User avatar
airsoftsoftwair
Posts: 4789
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: How to use -printerror and -formaterror

Post by airsoftsoftwair »

Clyde wrote:
Sat Apr 03, 2021 1:25 pm
Perfect, thanks a lot for the clarification! I was aware of that file but wasn't sure when to use it. Now it seems obvious to me ... It seems those infos you posted are not in the documentation, are they? Maybe you could add that.
Well, that's rather special interest. People using the IDE normally don't have to mess with those executables so I don't want to unnecessarily confuse them.
Clyde wrote:
Sat Apr 03, 2021 1:25 pm
Another thing regarding this, which should probably be posted in the "Wishlist" section: Currently, if there are more than one sytnax errors in the file you only get the first error. If you correct that and run/compile you get the next error. It would be nice to get the whole list of errors (one on each line) at once. Is that possible?
It's possible but certainly won't come. This would mean that the parser would have to go on parsing even when a syntax error has occurred. Other programming languages do that and I've never liked that because all the other errors that come after the initial one can obviously be very confusing because as soon as there is a syntax error all sorts of misinterpretations can happen so all errors after the initial one can be very random.

Post Reply