Edits

Brian K. White brian at aljex.com
Thu Sep 1 12:09:36 PDT 2005


----- Original Message ----- 
From: "Jeff Harrison" <jeffaharrison at yahoo.com>
To: "Tony Ryder" <tryder at westnet.com.au>; "FPlist" 
<filepro-list at lists.celestial.com>
Sent: Thursday, September 01, 2005 10:17 AM
Subject: Re: Edits


> --- Tony Ryder <tryder at westnet.com.au> wrote:
>
>> I am having trouble trying to create an edit that
>> would remove double
>> quotes.
>>
>> I have tried "/"" but I receive an error unbalanced
>> punctuation.
>>
>> Tony Ryder
>>
>
> I think this belongs in the "You can't do that" thread
> :-)
>
> Have you looked at the xlate command?  I think you
> will need to use that.

Closest I can think of is one that allows everything but quotes, something 
like:
noquote:{ " "-"!" } | { "#"-"~" }

But it would be "noquote" not "unquote" because I can't think of a way to 
strip the quotes.
I always do it in processing with xlate as you say.

I make it into a little gosub and re-use it.

if:
then: n = 10 ; gosub unqt ; csv("10") = n
if:
then: n = 11 ; gosub unqt ; csv("11") = n
[...]
if:
then: end
unqt if: '****** remove quotes
then: xlate(n,chr("34"),"") ; return


And this is topical for the function thread.
This a perfect example of a task that would be more convenient as a function 
than what you have to do now as a gosub plus a variable, I don't care what 
John says.

As a function, it could be like this:
I imagine using special label syntax to label a function, like @uf____  for 
@ User Function nnnn
where you can make up values for nnnn
and it becomes a triggered block of code just like other @labels that starts 
withan @label and end with an end or return.
and system fields like @a1 - @a9 for the arguments

if:
then: csv("10") = unqt(10)
if:
then: csv("11") = unqt(11)
[...]
if:
then: end
@ufunqt if: '****** remove quotes
then: return xlate(@a1,chr("34"),"")

I don't think we'd have to prototype functions either, why I didn't show a 
function declare like "func name (size,edit)(size,edit)(size,edit)"
to define/declare a function named name that takes 3 arguments for example. 
but maybe it could be beneficial but optional like defining the size & edit 
of a variable.

And this is only one variable. If the function needed several values the 
difference would be even more pronounced.

If the function needs more than a single return value, it should be possible 
to do work on data in fields given as arguments the way for example the 
file-io functions do.
They return a return value, but they do their work on data in fields given 
as function arguments.

Something like

if:
then: unqt(10)
if:
then: unqt(11)
[...]
@ufunqt if: '****** remove quotes
then: (@a1) = xlate((@a1),chr("34"),"")
if:
then: end

I'm not sure exactly what the syntax should look like for litteral values vs 
field & variable names vs field & variable contents, probably not like this 
but probably it's not a problem to work out a syntax that accounts for the 
different needs and without resorting to mapping an array.

Another way a function is handier than a gosub is it could be used directly 
in expressions instead of needing to break up a job into more steps just so 
you can use a gosub on a variable and then use the variable in an 
expression.

Brian K. White  --  brian at aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro  BBx    Linux  SCO  FreeBSD    #callahans  Satriani  Filk!



More information about the Filepro-list mailing list