PDA

View Full Version : con what?



hcrisp
03-18-2009, 04:22 PM
Something strange happens when I accidentally type "con" at the WAVE prompt. It goes into line continuation mode and I can't get out of it. What is happening and how can I exit without killing WAVE?



WAVE> con
- end

end
^
%%%Syntax error.
At: con.pro, Line 1
- stop
- quit
; ... nothing stops WAVE except closing the window!

ed
03-19-2009, 06:35 AM
Interesting. I'll let the PV-WAVE experts reply, but here is another data point. On my machine, I see this behavior:


WAVE> con
% Error opening file: con.cpr.
Permission denied
% Execution halted at $MAIN$ .
WAVE> which, 'con'
con
con
con
con
con
con
WAVE>

totallyunimodular
03-19-2009, 09:08 AM
I cannot reproduce what you show either. I do see a difference in behavior on Windows between the Home Window vs the DOS console window. What OS are you using and which version of PV-WAVE?

fik
03-19-2009, 11:33 AM
You should be able to reproduce this on PV-WAVE consol (32-bit). I am getting the same result on windows XP with PV-WAVE 9.01. The same thing is happening if you invoke PV-WAVE from DOS command line and type ?con? on the wave prompt you will observe this as well. WAVE doesn?t respond to keyboard.



WAVE> which, 'con'
% Compiled module: FILE_IN_PATH.
.\con
C:\...\wave\demo\gallery3\con
.
.
.
.
C:\...\ip-1_0\lib\std\con
WAVE>

totallyunimodular
03-19-2009, 01:46 PM
fik,

Thanks for reporting your findngs: I do see the same thing as you but I cannot reproduce what the original poster reported. Either way, there is clearly an issue with entering "con" as a procedure call on Windows. On Unix/Linux systems the expected behavior is seen:

WAVE> con
% Attempt to call undefined procedure/function: CON.
% Execution halted at $MAIN$ .

totallyunimodular
03-24-2009, 11:54 AM
FYI that there is a bug report filed on this issue now (which we call "CRs", or Change Requests). In the meantime, the only practical advice I can give is to make a cpr.pro file and place it somewhere in your PV-WAVE path, with contents like



MESSAGE, 'con is an executive command that needs to be called from MAIN and preceeded by a dot (e.g. .con)', /Informational


This will at least prevent the current PV-WAVE session from becoming unusable in the event of a typo :(

Note that in the case of using the DOS-based Console window, I am not seeing that issuing the con command actually causes the session to hang. If I do a Ctrl-z after calling con the prompt comes back and I can continue to use it:

9.00> con
% Error encountered reading from file. Unit: 100
File: con.cpr
% Execution halted at $MAIN$ .
9.00> print, 'hello world'
hello world
9.00> plot, indgen(10)

hcrisp
03-25-2009, 12:48 PM
Did you mean, make a "con.pro" file? Did you actually try it?

I tried and Windows XP won't allow it. If I try to create a text file called "con.pro", "con.txt", or "con.cpr", it gives the error "Cannot rename New Text Document: A file with the name you specified already exists. Specify a different file name." This occurs no matter what folder I start in (even root). I can assure you that no such file exists. I did this without WAVE running.

Google has all kinds of sites talking about this:
http://www.google.com/search?hl=en&q=can+you+create+a+file+named+con
First links says, "CON is for keyboard input. It's a special file, used as input stream by keyboard."

I am using WAVE 8.00 console and I do get the infinite-line-continuation behavior.

totallyunimodular
03-26-2009, 07:40 AM
Yes and No. I had assumed a simple call to MESSAGE would work and did not know about the Windows reserved words. It looks like other reserved words are problematic as well. For example, AUX results in the same hanging session as some users are reporting with CON. And NUL results in

WAVE> nul
% Error encountered reading from file. Unit: 100
File: nul.cpr
% Execution halted at $MAIN$ .

whereas the expected behavior in the event of calling an undefined function is

WAVE> null
% Attempt to call undefined procedure/function: NULL.
% Execution halted at $MAIN$ .

So, I suspect that this (Windows reserved words) is the issue and there are likely some difference between the behavior in PV-WAVE from the DOS console vs the Home Window, which is a Microsoft Foundation Class widget. Thanks for catching this and reporting back.

hcrisp
03-27-2009, 01:48 PM
Reserved device names are indeed the problem. Here is the full list:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9
(see http://msdn.microsoft.com/en-us/library/aa365247.aspx)

I get errors only with CON, AUX, NUL, COM1, and COM3.

totallyunimodular
03-30-2009, 10:20 AM
Interestingly, R crashes the same way when trying to source files with reserved names. For example, try something like

R> source('does_not_exist.r')

and you'll get

Error in file(file, "r", encoding = encoding) :
cannot open the connection
In addition: Warning message:
In file(file, "r", encoding = encoding) :
cannot open file 'does_not_exist.r': No such file or directory

But, try
R> source('com3.r')
or
R> source ('aux.r')

and the R session completely hangs.

MATLAB on the other hand catches the reserved keyword...

MATLAB> load('does_not_exist')
??? Error using ==> load
Unable to read file does_not_exist: No such file or directory.

MATLAB> load('com3')
??? Error using ==> load
com3: Reserved DOS device.

Seems like a fundamental Windows gotcha that 3rd party software vendors may or may not account for. Again, thanks for reporting the issue and you can ask about CR 001-00-017445 to follow the issue.