1. Euphoria 2.4 Featured Bug?

Hello all!

I committed one of those absent-minded screwups today, and in doing so, I
think I may have found either a
really cool feature or a really minor bug in the ex.exe interpreter
(possibly in exw.exe as well, although I haven't tested that theory).

I had just come over to Windows from Linux, to test out my code on Windows
XP.  I wanted to call the program
from outside its home folder, so I entered the following at the XP command
prompt:

ex eudoxy/eudoxy

Note that I entered the path *as though* I were in Linux.  The fact I did
this didn't dawn on me, because ex located and ran eudoxy.ex despite my
trans-OS issues.  However, I became puzzled when the following code produced
the message "Error:  Could not determine eudoxy.exe's home directory":

-- start code

cmd = command_line()
sWhereAmI = reverse(cmd[2])
loc = find('\\', sWhereAmI)
if loc != 0 then
  sWhereAmI = reverse(sWhereAmI[loc .. length(sWhereAmI)])
else
  puts(1, "Error: Could not determine eudoxy.exe's home directory.\n")
  -- This shouldn't happen.
end if

-- end code

Note that this will be released in bound form, hence the "exe."

A look in an ex.err file revealed this:

    cmd = {
            {67'C',58':',92'\',69'E',85'U',80'P',72'H',79'O',82'R',73'I',
65'A',92'\',66'B',73'I',78'N',92'\',69'E',88'X',46'.',69'E',88'X',69'E'},
            {101'e',117'u',100'd',111'o',120'x',121'y',47'/',101'e',117'u',
100'd',111'o',120'x',121'y'}

Notice two things:  First, the *Nixish separator, /, was preserved in
cmd[2].  Secondly, although the interpreter automagically added the .ex to
the end of "eudoxy," it did not add it to the end of the file name as given
in cmd[2].  From this, it appears that where the second element of
command_line() is concerned, I:

1.  Cannot assume that the path separator will be "\" in WinDos.
2.  Cannot assume that the name of a source code file will end with the
correct Euphoria extension.

Is this old news that I missed in my absence, or something new?

Now, I looked through the docs, and I did not see any mention of this
behavior.  If this is supposed to be the normal behavior of the interpreter,
it may be a good idea to state that in the documentation.  It would take a
real idiot to use "/" in DOS ... but I've proven to myself that such idiots
exist.


Travis Beaty
Osage, Iowa.

new topic     » topic index » view message » categorize

2. Re: Euphoria 2.4 Featured Bug?

Travis Beaty wrote:
> ex eudoxy/eudoxy
> 
> Note that I entered the path *as though* I were in Linux.  The fact I did
> this didn't dawn on me, because ex located and ran eudoxy.ex despite my
> trans-OS issues. 

DOS/Windows seems to support both forward and backslash
in some cases, although backslash is clearly the standard.
Euphoria is not doing anything special to support this.
After adding ".ex", it just passes your filename,
with forward slash, through to the O/S (and it works).

> However, I became puzzled when the following code produced
> the message "Error:  Could not determine eudoxy.exe's home directory":
> 
> -- start code
> 
> cmd = command_line()
> sWhereAmI = reverse(cmd[2])
> loc = find('\\', sWhereAmI)
> if loc != 0 then
>   sWhereAmI = reverse(sWhereAmI[loc .. length(sWhereAmI)])
> else
>   puts(1, "Error: Could not determine eudoxy.exe's home directory.\n")
>   -- This shouldn't happen.
> end if
> 
> -- end code

command_line() shows you the command line.
If the user types '/', that's what you'll see.

> 1. Cannot assume that the path separator will be "\" in WinDos.

If your program gives an error message to the user
when he types forward slash, I think that's ok.
Users are expected to type backslash on DOS/Windows.

> 2. Cannot assume that the name of a source code file will end with the
> correct Euphoria extension.

".ex", ".exw" etc. are just *conventions*.
They are added automatically when no extension is provided.
If you provide the full filename, with extension, you can
execute any file you like.

Regards,
    Rob Craig
    Rapid Deployment Software
    http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Euphoria 2.4 Featured Bug?

> 
>> ex eudoxy/eudoxy
>> 
>> Note that I entered the path *as though* I were in Linux.  The fact I did
>> this didn't dawn on me, because ex located and ran eudoxy.ex despite my
>> trans-OS issues. 
> 
> 
> DOS/Windows seems to support both forward and backslash
> in some cases, although backslash is clearly the standard.
> Euphoria is not doing anything special to support this.
> After adding ".ex", it just passes your filename,
> with forward slash, through to the O/S (and it works).
> 

DOS has a switch to allow forward slashes be used as alias for 
backslashes. That swiych is user-modifiable thru int #21 AH=#37
(don't have the docs at hand to give you the specifics). The switch is 
in the state the last app to modify it lef it.
I guess DOS 7 or other newer DOS emulations support this call.

CChris

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu