Page 1 of 1

dc_txt* problems

Posted: Thu Jul 03, 2014 8:52 am
by Janko
Dear Roger,

I digged into dc_txt* functions to replace old clipper memo and text search functions. I've found out significant speed difference, but there are some troubles:
x represents nHandle

1. dc_txtfind(x) returns byte pointer (nBP) which appears to be correct
2. after that I try to extract the line with dc_txtLine(x), which starts at nBP+1 to end of line: I think this is not correct
3. after that function dc_txtLno(x) returns 1, should be in my case 13

Code: Select all


   nHandle:=DC_TxTOpen(arr[i])


	 do while !dc_txteof(nHandle)
	   cFile:=arr[i]
       nLines:=dc_txtCount(nHandle)                              // correct
       nSize:=dc_txtSize(nHandle)                                  // correct
	   cSearch:=arrFP[k,4]
	   nBp:= dc_txtfind(nHandle,arrFP[k,4],.f. )          // correct 
		 if nBp>0

			cVrsta:=dc_txtLine(nHandle)              //  problem
			nVrst:=dc_txtlNo(nHandle)                //  problem
			 if left(cvrsta,2)='//'
				loop
			 endif
			 if arrFP[k,1]==arr[i] .and. arrFP[k,3]==dc_txtLno(nHandle)   
					   loop
			 endif
			 aaDD (arrFPC ,{arrFP[k,1], arrFP[k,2],arrFP[k,4],cVrsta , dc_txtLno(nHandle), arr[i]} )
		 endif

		   dc_txtSkip(nHandle,1)
	 enddo
Could you spend a minute to check. Maybe I am doing something wrong.

JAnko

PS: there is undocumented function cPrgName := dc_objfind( procname(1) ) ???

Re: dc_txt* problems

Posted: Thu Jul 03, 2014 2:10 pm
by rdonnay
Janko -

I originally wrote these functions for Clipper many years ago.

It's possible that DC_TxtFind() is behaving differently under Xbase++.

I will look into this.

DC_ObjFind() is undocumented.
What is it that you are wanting?

Re: dc_txt* problems

Posted: Thu Jul 03, 2014 2:30 pm
by rdonnay
Janko -

After looking at the DC_TxtFind() code, I can see that it was never intended to work synchronously with the other DC_Txt*() functions. It probably should have been given a different name.

Roger

Re: dc_txt* problems

Posted: Thu Jul 03, 2014 9:03 pm
by Janko
Roger,

could you help me with alternative 'find' function that shows correct content of the line and/or correct lineNo?

Kind regards
Janko