[comp.sys.amiga.tech] rexxarplib

will@waf2000.UUCP (Will Fiveash) (06/01/90)

I am having trouble getting the rexxarplib function FileList to work as
advertised.  When I specify that I want directories only I get both files
and directories, e.g.: FileList(dirpat, filelist,'D',E ).  Xoper reports
that I am using rexxarplib v2.3. Any help would be appreciated.  

BTW, I have programmed a man command in ARexx that will search Man:  and
its subdirectories for <filename>*.  If no arguement is given then the Arp
file requestor is used to browse Man:.  Let me know if you want the source.

--
	Will Fiveash
UUCP:home  ...!cs.utexas.edu!ut-emx!waf2000!will
UUCP:work  ...!cs.utexas.edu!ibmchs!auschs!fiveash.austin.ibm.com!will

lphillips@lpami.wimsey.bc.ca (Larry Phillips) (06/02/90)

In <03248.AA03248@waf2000.UUCP>, will@waf2000.UUCP (Will Fiveash) writes:
>I am having trouble getting the rexxarplib function FileList to work as
>advertised.  When I specify that I want directories only I get both files
>and directories, e.g.: FileList(dirpat, filelist,'D',E ).  Xoper reports
>that I am using rexxarplib v2.3. Any help would be appreciated.  
>
>BTW, I have programmed a man command in ARexx that will search Man:  and
>its subdirectories for <filename>*.  If no arguement is given then the Arp
>file requestor is used to browse Man:.  Let me know if you want the source.

I'd like to see it.

I just tried the FileList() on my rexxarplib, and indeed it does what you say.
I have never noticed this, because I use showdir(). Here's a few examples...

; get contents of current dir (minimum required)

	x = showdir('')

; get contents of specified directory

	x = showdir('dh0:')

; get list of directories in specified directory

	x = showdir('dh0:','d')

; get list of files in specified directory, separated by '0A'x
; this is handy for directories containing names with spaces in them

	x = showdir('dh0:','f','0a'x)


-larry

--
The raytracer of justice recurses slowly, but it renders exceedingly fine.
+-----------------------------------------------------------------------+ 
|   //   Larry Phillips                                                 |
| \X/    lphillips@lpami.wimsey.bc.ca -or- uunet!van-bc!lpami!lphillips |
|        COMPUSERVE: 76703,4322  -or-  76703.4322@compuserve.com        |
+-----------------------------------------------------------------------+

aips@rulcvx.LeidenUniv.nl (W. Jaffe) (06/11/90)

Hello world,

I have an interesting problem. I wonder if it has any value
to check whether an AllocMem of 1Kb fails. 
In my opinion it is an absolute waste of time and space to do
such a check, because the system would have crashed long before
only 1Kb was left. Intuition don't like a low memory environment.
Also, it is absolute nonsense to check an OpenLibrary(graphics.library)
call. If it is not there, you can better go to a repair shop.
Of course, I like to know how others think about this subject.

Greetings from Raymond and Erwin.
The Orega Programming Group Holland,
P.o.box 499,
2280 AL Rijswijk, Holland.

 

cmcmanis@stpeter.Eng.Sun.COM (Chuck McManis) (06/12/90)

In article <839@rulcvx.LeidenUniv.nl> (W. Jaffe) writes:
>I have an interesting problem. I wonder if it has any value
>to check whether an AllocMem of 1Kb fails. 
>In my opinion it is an absolute waste of time and space to do
>such a check,  ...

Consider that doing such a check in assembly language is two
instructions (Test and branch) which takes very little time and
very little space.

>	       ,,, because the system would have crashed long before
>only 1Kb was left. Intuition don't like a low memory environment.

You have to think to yourself, "Is this a good thing?" (that Intuition
doesn't like low memory) And the other thing you have to think about
is "What if Intuition has already allocated all the memory it needs?"

You see the reason you ask these two questions is simple. In the first
case, it is clearly a bug that Intuition doesn't deal with low memory
conditions. Given that, you can presume that Commodore will eventually
fix it (possibly in 2.0 :-)). That would mean that now Intuition is
merely grinding along with 768 bytes free and the user is getting the
maximum possible use out of their system and suddenly _your_ program
crashes the system because it didn't check to see if it really got
the 1Kb it asked for. No don't you feel silly? And from the users
perspective it will sound like "Gee, this stupid programmer couldn't
spare 4 bytes and 11 machine cycles to see if is AllocMem() succeeded,
instead he crashes my system!" They are not going to like you my
friend. 

The second question deals more with the "rip-cord" effect of memory
management. One way of "fixing" intuitions problems will be to give
it its own memory pool to play with. That would mean the AllocMem
results might fail when Intuition had all of the memory it needed. 
Again, for a few cycles, and even fewer bytes you've screwed the
user by deciding not to check your results. 

>Also, it is absolute nonsense to check an OpenLibrary(graphics.library)
>call. If it is not there, you can better go to a repair shop.
>Of course, I like to know how others think about this subject.

Nonsense? Isn't that a fairly strong word? What about trying to open
Version 36 of the library and only version 34 is present? Eh? What
happens when someone substitutes a disk based graphics.library
on their system which has a custom video display system and you
can't load it into memory ? Again, 4 bytes and 11 cycles. That's
all we ask. 

When you hold these opinions you need to ask yourself, "Why would
this occur, and if I ignore it what are the consequences?" Well
on the Amiga the "Why" portion varies but the consequences are
usually fatal. I would ask you "Why not?" it is easy to check
these things and it makes your software much more reliable. Your
reasons above don't outweigh the question of reliability.


--
--Chuck McManis						    Sun Microsystems
uucp: {anywhere}!sun!cmcmanis   BIX: <none>   Internet: cmcmanis@Eng.Sun.COM
These opinions are my own and no one elses, but you knew that didn't you.
"I tell you this parrot is bleeding deceased!"

jesup@cbmvax.commodore.com (Randell Jesup) (06/12/90)

In article <839@rulcvx.LeidenUniv.nl> aips@rulcvx.LeidenUniv.nl (W. Jaffe) writes:

>I have an interesting problem. I wonder if it has any value
>to check whether an AllocMem of 1Kb fails. 
>In my opinion it is an absolute waste of time and space to do
>such a check, because the system would have crashed long before
>only 1Kb was left. Intuition don't like a low memory environment.

	It has great value.  Checking for allocation failure means you can
recover or at least fail gracefully instead of crashing the machine, and
perhaps losing the user's work in another program.  ALL allocations can fail,
and it doesn't mean the system is dead (though it may not be able to do things
like move windows until memory gets freed).  Sometimes lack of memory is
very temporary, due to a large allocation that is freed quickly, or if your
program or some other program notices a failure, and backs out of an operation,
freeing up memory it had already allocated.

	This is known as good programming practice.

>Also, it is absolute nonsense to check an OpenLibrary(graphics.library)
>call. If it is not there, you can better go to a repair shop.

	You have a better point here, though if you supply a version other
than 0 you need to check the result.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"

jbickers@templar.actrix.co.nz (John Bickers) (06/12/90)

Quoted from - aips@rulcvx.LeidenUniv.nl (W. Jaffe):
> I have an interesting problem. I wonder if it has any value
> to check whether an AllocMem of 1Kb fails. 
> In my opinion it is an absolute waste of time and space to do
> such a check, because the system would have crashed long before
> only 1Kb was left. Intuition don't like a low memory environment.

    Yes (it has value). I have seen Intuition cope (sort of) with low RAM
    conditions - menus stop appearing, and the suchlike. I think the worst
    offender guru-wise is loading a program and running out of RAM before
    the load is complete, isn't it?

    Early on, I read someone from... Aegis... say that they allocated a
    "rip-cord" chunk of RAM in order to be able to inform the user RAM was
    out should this happen later. It was in an interview in CBM's magazine.
    Seems like a good idea, if you can't just print an error to the command
    line, or even terminate silently.

> Also, it is absolute nonsense to check an OpenLibrary(graphics.library)
> call. If it is not there, you can better go to a repair shop.

    I wouldn't say its *absolute* nonsense, though there are reasons for
    not bothering to check. However, if you care about what revision of the
    graphics library is present (one way to check for which KS you're
    running under?) you'll want to check.

    You'll also want to check in case some other piece of software has
    crapped out that library somehow. In the early stages of writing the
    code, you might also want to check just to catch spelling errors.

    Plus it's just general defensive programming, along the lines of why
    people bother to check for errors at all, or why some people use
    <=, >=, etc comparison operators instead of just == in loops. Etc.

> Greetings from Raymond and Erwin.
--
*** John Bickers, TAP, NZAmigaUG.         jbickers@templar.actrix.co.nz ***
***     Let them figure it out, Come on and step across,                ***
***     Just remind yourself,   We are here to code.   - munged Devo    ***

farren@well.sf.ca.us (Mike Farren) (06/12/90)

aips@rulcvx.LeidenUniv.nl (W. Jaffe) writes:
>I have an interesting problem. I wonder if it has any value
>to check whether an AllocMem of 1Kb fails. 
>In my opinion it is an absolute waste of time and space to do
>such a check, because the system would have crashed long before
>only 1Kb was left. Intuition don't like a low memory environment.
>Also, it is absolute nonsense to check an OpenLibrary(graphics.library)
>call. If it is not there, you can better go to a repair shop.

You are correct, now.  You might not be correct next year.  There are a
LOT of things that you can get away with in any given setup that you might
not be able to get away with the next time the system is updated.  An
example is my port of the Amiga version of Crystal Quest.  I was told
about a failure under what was then 1.4, right after last year's DevCon.
I don't remember the exact details, but it involves exactly the situation
that you describe, with OpenLibrary and a library which was resident under
1.3, but not under 1.4, and a subsequent failure when you used the boot
disk I had provided.  Once I did the error checking right, it worked fine
(and still does, I am told, under 2.0 - a fact of which I am quite proud).

Far better to check things which "never" fail than to miss just one...

-- 
Mike Farren 				     farren@well.sf.ca.us