Hello Timothy!
Nice to see you as a new user here at WebBoard!
Hello Fritz!
Nice to see you back!
I don't want to interfere with your discussion but
please let me do some comments.
(Fritz, I know you wrote from memory!)
>// 1. Check if adress file is open; if not open it
>
>#61=File_Check("adr.txt")
>if(#61 > 0) { File_Open("adr.txt") }
File_Check() returns -1 if file isn't already open.
==> if(#61 < 0)
But perhaps you meant File_Exist() ?
if (File_Exist("adr.txt")) {
File_Open("adr.txt")
#61=Buf_Num
} else {
// do some error handling
}
The File_Open() handles it automatically if the file is already
loaded.
>// 2. (a) check for file containing letter body
> (b) copy contents to a TReg, say, @9
> (c) switch back to adr.txt
>
>#62=File_Check("body.txt")
>if(#62 > 0) {
> File_Open("body.txt")
> Reg_Copy_Block(9,0,File_Size)
> Buf_Switch(#61) // switch back to adr.txt
> }
Or something like this:
if (File_Exist("body.txt")) {
Reg_Load(9, "body.txt") // load file contents directly into text
register
} else {
// do some error handling
}
>// 4. merge adresses and body of text
>
>repeat(ALL) {
>Search("\adress{|m}",ADVANCE+ERRBREAK) //a. match entire adress entry
>Block_Begin(BOL_Pos) //b. mark it as block and
Doesn't that include "\adress" too?
>Match_Paren()
>Reg_Copy_Block(10,Block_Begin,Cur_Pos+1) //c. copy it to TREG @10
Perhaps this way:
Search("\adress|H7B",ADVANCE+ERRBREAK) // search address (incl.
open curly brace)
Block_Begin(Cur_Pos) // set block begin just
after open brace
Char(-1) // pos. on open brace
Match_Paren() // and search closing one
Block_End(Cur_Pos) // set block begin just
before closing brace
Reg_Copy_Block(10,Block_Begin,Block_End) // copy it to TREG @10
Block_Begin(CLEAR) // clear block markers
Happy programming!
Christian
|
|