Topic: Contents of Tregs not found (1 of 4), Read 17 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Saturday, August 21, 2004 04:10 PM

I tried to set up a dialog box in order to compose a column
search in files structured according to the following pattern:


&CVM _3 #quom 8214000000
&IN __ #in 7000500000
&PROSCENIVM __ #proscaenio 120050S000
&HIC _2 #hic 6000000000
&IVPPITER N_ #Iouem 13N040S000
&INVOCO __ #inuocarunt 5114CAP0BN


The macro is supposed to find strings like "14CAP0BN" in the last
line (cols 46--53), but what i get is a message
"cannot find |@(5)|@(6)|@(7)|@(8)".

This is the macro:


// search for subordination codes at cols 46--53

I. Dialog box

reg_set(5,"1") //default modus: indicative
reg_set(6,"|d") // default tense: none
reg_set(7,"|f|f|f|f") // default PNDG: none
reg_set(8,"BN") // default subordination code: relative

#1=Dialog_Input_1(5,"`sentence code:`,

`Modus (1 / 3):`,
`??`,
`Tense (1 - 6):`,
`??`,
`PNDG`,
`??`,
`Subordination Code:`,
`??`,
",SCREEN+CENTER+SET,0,0)

//5=modus, 6=tempus, 7=PNDG, 8=sub-code


if(#1==0){breakout(extra)}


// II. Search pattern

repeat(all){
sb("|@(5)|@(6)|@(7)|@(8)",CP,file_size,ERRBREAK+COLSET,46,53)
V()
EOL()
}
return()

Thanks for any help.

Fritz

 


Topic: Contents of Tregs not found (2 of 4), Read 18 times
Conf: VEDIT Macro Language Support
From: Christian Ziemski
Date: Saturday, August 21, 2004 04:35 PM

Fritz:

On Sat, 21 Aug 2004 16:10:16 -0400, you wrote:

>reg_set(6,"|d")
>...
>sb("|@(5)|@(6)|@(7)|@(8)",CP,file_size,ERRBREAK+COLSET,46,53)

That doesn't work the way you think.

The pattern codes ("|d" in this example) isn't evaluated when passed via text register!
The Search() searches for the two characters "|" and "d" here.

You have to build the search command in another text register "manually" and then call that register (at least I'm doing those things this way.)


For example:

Reg_Set(103, 'sb("')
Reg_Set(103, @6, APPEND)
// Reg_Set(103, .... , APPEND)
Reg_Set(103, '",CP,file_size,ERRBREAK+COLSET,46,53)', APPEND)
//...
Call(103)


Christian

 


Topic: Re: Contents of Tregs not found (3 of 4), Read 17 times
Conf: VEDIT Macro Language Support
From: Ted Green
Date: Saturday, August 21, 2004 05:35 PM

At 04:36 PM 8/21/2004, you wrote:
>From: "Christian Ziemski"
>>reg_set(6,"|d")
>>...
>>sb("|@(5)|@(6)|@(7)|@(8)",CP,file_size,ERRBREAK+COLSET,46,53)
>
>That doesn't work the way you think.
>
>The pattern codes ("|d" in this example) isn't evaluated when passed via text register!
>The Search() searches for the two characters "|" and "d" here.

Correct. The contents of an indirection from "|@" is treated as literal characters. This started around VEDIT version 5.0 and is certainly the way we want to keep it.

Ted.


Ted.
-------------------------------------------------------------------------
Ted Green (ted@...) Greenview Data, Inc.
Web: www.... Fax: 734-996-1308 PO Box 1586, Ann Arbor, MI 48106
Tel: (734) 996-1300 Desk: 734-369-3550 VEDIT - Text/Data/Binary Editor
-------------------------------------------------------------------------
www.SpamStopsHere.com ranked #1 in accuracy by Network Computing Magazine

 


Topic: Re: Contents of Tregs not found (4 of 4), Read 18 times
Conf: VEDIT Macro Language Support
From: Fritz Heberlein
Date: Sunday, August 22, 2004 06:58 AM

Christian:

> You have to build the search command in another text register "manually" and
> then call that register (at least I'm doing those things this way.)

>
> For example:
>
> Reg_Set(103, 'sb("')
> Reg_Set(103, @6, APPEND)
> // Reg_Set(103, .... , APPEND)
> Reg_Set(103, '",CP,file_size,ERRBREAK+COLSET,46,53)', APPEND)
> //...
> Call(103)
>
Thanks for your help! In the meantime, i have studied other of your macros
like filegrep.vdm and i think i have got it (more or less :))

I think this is a topic which should be covered by the programming guide in the
manual.

Thanks again,

Fritz