Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Declined Inverting @FILEARRAY

May
3,515
5
Arrays provide many nice features. However, at this time we have no simple method to write the contents of an array into a file. Accordingly, I propose the function
@ARRAYFILE[arrayname,filename[,w|a[,n]]]
which would write the contents of arrayname into filename. The optional arguments would be interpreted thus:
w write (or overwrite)
a append
n write n elements instead of all elements if n is less than the number of elements
--
Steve
 
Arrays provide many nice features. However, at this time we have no simple method to write the contents of an array into a file. Accordingly, I propose the function
@ARRAYFILE[arrayname,filename[,w|a[,n]]]
which would write the contents of arrayname into filename. The optional arguments would be interpreted thus:
w write (or overwrite)
a append
n write n elements instead of all elements if n is less than the number of elements
--
Steve

How would that work with multidimensional arrays?
 
How would that work with multidimensional arrays?

In a more generic direction: It might be nice if plugins had some interface to read and write array variables -- beyond calling Set_Cmd(), ExpandVariables() et al.
 
> In a more generic direction: It might be nice if plugins had some
interface to

> read and write array variables -- beyond calling Set_Cmd(),
ExpandVariables()


There is no other interface to the array variables -- that's the same thing
that internal commands use.

Why do plugins need a special interface?

Rex Conn
JP Software
 
On Thu, 07 Oct 2010 23:21:40 -0400, rconn <> wrote:

|Why do plugins need a special interface?

I'm not saying plugins need a special interface, but it's precisely
ExpandVariables() that makes getting an array into a file difficult. It's easy
to get a file into an array regardless of what characters might be in it, but if
you try to get an array back into a file, say with @FILEWRITE or @FILEWRITEB,
you get errors on references to variables and variable functions ... requiring
SETDOS /X-4 (perhaps more) ... just an extra gyration for the user.
 
There is no other interface to the array variables -- that's the same thing that internal commands use.

I guess I was assuming you had some internal call which returned a pointer to a given element.

Why do plugins need a special interface?

Special characters / recursive expansion is one difficulty. It also seems like a fairly complicated (slow) mechanism for doing complicated, repetitive tasks like searching or sorting. But if I'm asking for something which you yourself don't have, then never mind.

How about a tweak to ExpandVariables(): If fRecurse is some magic value, say -999, then no recursive expansion is done, and no alias expansion for the first arg?
 
----- Original Message -----
From: rconn
To: [email protected]
Sent: Thursday, 2010. October 7. 07:44
Subject: RE: [Suggestions-t-2345] Re: Inverting @FILEARRAY


Quote:
Originally Posted by Steve F�bi�n
Arrays provide many nice features. However, at this time we have no simple method to write the contents of an array into a file. Accordingly, I propose the function
@ARRAYFILE[arrayname,filename[,w|a[,n]]]
which would write the contents of arrayname into filename. The optional arguments would be interpreted thus:
w write (or overwrite)
a append
n write n elements instead of all elements if n is less than the number of elements
--
Steve

How would that work with multidimensional arrays?

It need not, the same way as @filearray and @execarray are restricted to one-dimensional arrays.
--
Steve
 
Back
Top