1. Re: EUPHORIA Digest - 6 Jun 1998 to 7 Jun 1998 (#1998-21)

Why isn't my posts being acknowledged by the listserv? I have set MSGACK...

At 12:00 AM 6/8/98 -0400, Automatic digest processor wrote:
>Date:    Sun, 7 Jun 1998 09:08:26 -0700
>From:    jshaman at PHREAK.ORG
>Subject: Help me with colors? also... csv file reader.
>
>Is there any way of reading the current screen text mode color under dos or
>a console window into an object?

Find <save_text_image> in %eudir%\doc\library.doc.

>Date:    Sun, 7 Jun 1998 06:51:31 -0400
>From:    Irv <irv at ELLIJAY.COM>
>Subject: Re: File handling
>
>One word: C

Do you mean I should have C? I don't! smile

>Date:    Sun, 7 Jun 1998 07:12:37 -0400
>From:    Irv <irv at ELLIJAY.COM>
>Subject: Re: File retrieval (was: EuPgms by mail)
>
>*** This is terrific! Very fast, too. Thanks, Andy.

You're welcome!

Actually it won't be as fast (but still acceptably fast) if the server were
"used" at that moment, but now it's having too few users sad

[I wrote:]
>>Well, I would like to advertise here... blink
>>
>>    To: pbmserv at demo.bsdi.com
>>    Subject: help
>>
>>will give you a helpfile on using my Play By e-Mail Server. It is FREE!

Hmm, haven't seen lots of new users yet ;-(

>Date:    Sun, 7 Jun 1998 07:30:06 -0400
>From:    Irv <irv at ELLIJAY.COM>
>Subject: Re: File handling
>
>I am puzzled. I just added a command to one of the buttons in
>my GUI database to delete a file: system("delete test.xxx",2)

That should fail, you should use "del" or "erase" but not "delete" blink

>When I click that button, the file gets deleted, and there is
>no flicker or other problem. More surprising, if the file is not found, a
>neat "file not found" appears at the top of the screen without changing from
>mode 256, and you continue on without trouble.

Why not system("del test.xxx >nul", 2); ?

>Date:    Sun, 7 Jun 1998 06:44:27 -0500
>From:    Terry Constant <constant at FLASH.NET>
>Subject: Re: File handling
>
>The main problem with system() is the lack of error reporting if one of
>the commands fail for some reason. I have written two special routines

Ah, how about:

-- untested code!
include get.e
function dosystem(sequence s)   -- add global if put in .e
    object o
    integer f, r
    f = open("$$$TMP$$.BAT", "w")   -- overwrite!
    if f < 0 then
        system(s, 2)
        return -1   -- cannot return errorlevel
    end if
    puts(f, "@echo off\n" & s & "\nrem >$$$TMP$$.ELV\n")  -- overwrite!
    for i = 255 to 0 by -1 do   -- must check downwards
        printf(f, "if errorlevel %d echo %d>>$$$TMP$$.ELV\n")
    end for
    close(f)
    system("$$$TMP$$", 2)   -- .com/.exe may not exist!
    f = open("$$$TMP$$.ELV", "r")
    if f >= 0 then
        o = get(f)
        close(f)
        r = o[2]    -- do not check for errors
    else
        r = -1  -- cannot determine
    end if
    system("del $$$TMP$$.* >nul", 2)    -- caution: del all
    return r
end function

? dosystem("format a: /autotest")   -- NO PROMPTS (viruses: change a: to c:)

>that use system() and the special features of 4Dos to capture stderr

Why not capture stdout as well?

Like Perl's

    $out = `... 2>&1`;   # replace ... with command; 2>&1 to get stderr
    if ($? >> 8) {
        # $? >> 8 is errorlevel
        die "ERROR\n";
    }
    print "output has more than 1024 chars\n" if (length($out) > 1024);
    print $out; # $out is output of the command

I would like to see it cloned in Euphoria! smile

>Date:    Sun, 7 Jun 1998 08:05:08 -0400
>From:    mountains at MINDSPRING.COM
>Subject: Re: File handling
>
>There must be a way. Batch files can branch based on errorlevel.

Which describes pretty much how dosystem() above does it.

>Date:    Mon, 8 Jun 1998 00:59:29 +1000
>From:    "Graeme." <hmi at POWERUP.COM.AU>
>Subject: Re: Wierd Language Syntax idea
>
>>foo[2..4][3]={1,2,3}
>
>Also No.1 on my wish list.

Me too. It will cause an error if
- foo is not a sequence,
- foo is a sequence with less than 4 elements,
- foo's 2nd, 3rd, and/or 4th elements are not sequences,
- foo's 2nd, 3rd, and/or 4th elements have less than 3 elements.

How about also allowing the programmer to trap the error nicely?

>Date:    Mon, 8 Jun 1998 04:09:37 +1200
>From:    Jiri Babor <jbabor at PARADISE.NET.NZ>
>Subject: French Open
>
>(Sorry, Euphorians, I realize this is completely off topic, but I just
>could not find Jesus' private email address)

JesusC - Jesus Consuegra <jconsuegra at REDESTB.ES>

>Date:    Sun, 7 Jun 1998 10:04:20 -0700
>From:    Pete Eberlein <xseal at HARBORSIDE.COM>
>Subject: You have got to read this!

Gee, your subject really looks like a spam! smile

>If you're interested in the true purpose of C++, surf on over to
>http://cc.lut.fi/~jmjt/truth.about.c++.html

I'll use my own server blink

>Date:    Sun, 7 Jun 1998 14:01:04 -0400
>From:    Irv <mountains at MINDSPRING.COM>
>Subject: Re: You have got to read this!
>
>But, Pete, who says you can't write nice structured code in c?
>Look at the example below. I'm sure any good c programmer could tell
>what it does.
[program snipped]

It converts its input to pig latin.

The program was taken from "IOCCC" right? (International Obfuscated C Code
Contest -- find that in the web.)

>Date:    Sun, 7 Jun 1998 15:10:40 -0400
>From:    Robert Craig <rds at EMAIL.MSN.COM>
>Subject: Re: Yet another OO aproach
>
>Re: OO
>
>I encourage people to keep experimenting.

My PBeM Server <pbmserv at demo.bsdi.com>, mostly programmed in C++, uses OO
really lot. For instance, one would make the game "chess with the Queen
moving like Rook and Knight but not Bishop" by just making a new class,
inheriting from the base Chess class, and do only the changes.

I'm not sure how I would do that in the current version of Euphoria, but I
plan to convert existing code to Euphoria once Euphoria for BSD/OS is
available (will it ever be?). Speed is not really of importance since mail
travels take time anyway.

>Re: File Handling
>
>It might be reasonable for me to put out an
>official .e file for those file functions. Thanks Daniel

And a similar .e for win32!!

>for the code you sent via private e-mail. It seems
>to work fine with 8.3 names but it's not aware of
>long filenames. (I'll put it on the Recent Users Contributions page
>later today.)

If I recall correctly, to access LFN you simply put what formerly was in AH
to AL, and AH = 71h or some value. This way you can make/remove/change to
LFN directories, open files, change attributes, delete/rename files, etc.
But the only open function accepted is 6Ch, the "all-in-one" open function.
No 3Ch, no 3Dh.

>Re: exit codes / system
>
>I will do some experiments. I think I can get
>the exit code as part of a new system()-like
>function that does not start a new shell (the way
>the current system() procedure does.)

Great, how? smile

>Date:    Sun, 7 Jun 1998 13:28:14 -0700
>From:    Hawke <mdeland at NWINFO.NET>
>Subject: Re: system command & file/data sharing
>
>I would very much like to be able to.  I'm running a Win95
>network between my computer and my wife's.  it allows us

Isn't it nice to have multiple computers? sad

>me IPX for BASIC... the translation is turtle crawlingly
>slow... shared data i can do, and it opens up unlimited

Isn't it because it's for BASIC* (Bill's Attempt to Seize Industry
Control)? smile

>sharing/locking could be handy, for me, yes

My PBeM Server also uses file locking...

>Date:    Sun, 7 Jun 1998 16:37:16 -0300
>From:    Daniel Berstein <daber at PAIR.COM>
>Subject: DOS 7
>
>I want to code some routines for handling files & directories *with* long
>filenames. The questions are:

See above:

SFN
AH = xxh
AL = unused

LFN
AH = 71h
AL = xxh

Open must be with 6Ch. Again, this is just as far as I remember...

>    2.1 - How can I determine which one must I use?

include misc.e
if platform() = WIN32 then
    -- use 71xxh
else
    -- use xx??h
end if

Of course this would not do LFNs under ex.exe even if in win32. Any better
solutions?

>    Would it be needed to have conditional compilation? Example:
>    if #DOS32 then
>        include exfile.e
>    else
>        include exwfile.ew
>    end if

-- do NOT bind or shroud
include misc.e
if platform() = WIN32 then
    system("copy exwfile.ew temp.e >nul", 2)
else
    system("copy exfile.e temp.e >nul", 2)
end if
include temp.e

>Date:    Sun, 7 Jun 1998 15:46:20 -0500
>From:    Terry Constant <constant at FLASH.NET>
>Subject: Re: Yet another OO aproach
>
>I don't know if the "MyInc." notation is best, I like it. I don't need

I like it too. The problem is that if your include file is renamed, the
notation is automatically renamed.

Another is that Euphoria is case-sensitive but neither DOS's SFNs nor
Win32's LFNs are case-sensitive. SFNs are all-uppercase, limited to 8.3.
LFNs are case-preserved, limited to 255 (or 256?) characters. Note that if
you have a file named "This is a long file name" you can also access it as
"This Is A Long File Name" or any other case combinations, they refer to
the same file. You cannot have two files named "This is a long file name"
and "This Is A Long File Name" in the same directory.

What would your notation look like for a LFN .e(w)?

Using Daniel's #DOS32 notation:
    if #DOS32 then
        include thisis~1.e
    else
        include "This is a long file name.e"
    end if
    object a
    if #DOS32 then
        a = thisis~1.variable
    else
        a = "This is a long file name".variable
    end if

smile

>Date:    Sun, 7 Jun 1998 18:10:06 -0400
>From:    Irv <irv at ELLIJAY.COM>
>Subject: Re: file/data sharing
>
>Function  5Ch   Lock/Unlock File Access   (DOS 3.0+)

I use lock() in my C++ program at my PBeM Server.

Isn't it a standard function? Or is it only available in BSD/OS's g++?

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu