Page 1 of 3
Programmers editor with...?
Posted: Thu Jul 28, 2016 5:05 pm
by Roberto Lopez
Hi All,
I'm looking for a text editor supporting (besides file name) a search expression as command line parameter and if it is found, position the cursor there.
I'm googled this, but found nothing...
TIA.
Re: Programmers editor with...?
Posted: Thu Jul 28, 2016 5:27 pm
by serge_girard
We had one on the mainframe: SPF
I have a very very old DOS SPF-PC version, I don't know if it is still working...
Serge
Re: Programmers editor with...?
Posted: Thu Jul 28, 2016 8:43 pm
by trmpluym
Roberto,
Why not create your own using the wonderfull:
c:\hmg.3.4.3\SAMPLES\HFCL\WordScribe
Theo
Re: Programmers editor with...?
Posted: Thu Jul 28, 2016 9:11 pm
by CalScot
I'm looking for a text editor supporting (besides file name) a search expression as command line parameter and if it is found, position the cursor there.
I sometimes still use an old DOS-based program called XyWrite (from about 1987?) from a company called XyQuest.
It's an amazing piece of software, blindingly fast, entirely command-line driven (which is maybe why it never really caught on?) and I think it will do exactly what you're looking for.
I just Googled it and there seem to be Windows versions. I haven't tried them, but they might be a good place to start your search.
Good luck
Re: Programmers editor with...?
Posted: Fri Jul 29, 2016 12:42 am
by andyglezl
Maybe this...
https://www.powergrep.com/manual/commandline.html
o with
findstr /l /n /c:"Darwin" *.docx ...... and somehow open the editor

- findstr-dos.jpg (53.47 KiB) Viewed 9054 times
Re: Programmers editor with...?
Posted: Fri Jul 29, 2016 2:43 am
by Roberto Lopez
Thanks for all the answers.
Some of you could be wandering why I'm asking for this...
I have a big project (more than 400 prgs).
It was created with IDE. So, each event procedure has its own prg file (I'm the culprit of this

).
This approach is very useful and worked fine... until...
I've integrated (joined) this project with another one, so the total prg count raised to about 600...
Then... the project can't be built anymore (building process simply does not work).
Since I've was very rushed (I've needed to make work the new integrated project in a couple of days) I've simply put all the prgs of the new project together in only one.
Then, all worked well, but, since the project is in permanent expansion (five years and counting) every time I add a new event procedure, I must do it manually, to a big prg containing all new ones.
So... jump to the exact point in the file, specifying the procedure name as a parameter could be very helpful...
I'll try your suggestions... Thanks again.
Re: Programmers editor with...?
Posted: Fri Jul 29, 2016 3:56 am
by Tiger
How about this ... ( I got it from Google )
and it works on my PC with notepad++
=============================
script.bat ==>
@ECHO OFF &SETLOCAL
set "LineNr="
for /f "tokens=1*delims=[]" %%a in ('^<"%~1" find /i /n "%~2"') do if not defined LineNr (
set "LineNr=%%a"
SET "Line=%%b"
)
if not defined LineNr (
set "LineNr=1"
SET "Row=1"
GOTO :launch
)
CALL SET "Right=%~2%%Line:*%~2=%%"
CALL SET "Line=%%Line:%Right%=%%"
FOR /f "delims=:" %%a in ('"(echo("%Line%"&@echo()|findstr /o $"') do SET /a Row=%%a-4
GOTO :launch
:launch
START /b CMD /c ""c:\Notepad++\notepad++.exe" -n%LineNr% -c%Row% "%~1""
===================================
a_serch.bat ==>
C:\___HMG\script.bat "c:\_order\PPP_EDIT.Prg" "IF EMPTY(cPrvID)"
======================================
Re: Programmers editor with...?
Posted: Fri Jul 29, 2016 12:51 pm
by Roberto Lopez
Tiger wrote:How about this ... ( I got it from Google )
and it works on my PC with notepad++
Works nicely and extremely fast.
In a 35000 lines prg it found a procedure name near the last line almost instantly.
Thanks!
Re: Programmers editor with...?
Posted: Fri Jul 29, 2016 1:03 pm
by bpd2000
I use FNR, link below to find anything
You click on result files open for editing with associated program, it search sub directory also
https://findandreplace.codeplex.com/

Re: Programmers editor with...?
Posted: Sat Jul 30, 2016 11:59 pm
by Roberto Lopez
Tiger wrote:How about this ... ( I got it from Google )
and it works on my PC with notepad++
=============================
script.bat ==>
@ECHO OFF &SETLOCAL
set "LineNr="
for /f "tokens=1*delims=[]" %%a in ('^<"%~1" find /i /n "%~2"') do if not defined LineNr (
set "LineNr=%%a"
SET "Line=%%b"
)
<...>
C:\___HMG\script.bat "c:\_order\PPP_EDIT.Prg" "IF EMPTY(cPrvID)"
======================================
Trying to solve this at Harbour level (I mean, find the line number for a search string to pass it as a parameter to the editor) resulted extremely slow for large files, at least, using the unique method I know to do that:
Code: Select all
cBuffer := MEMOREAD('very.large.file.prg')
cSearch := 'MyProcedureName'
nLines = MLCOUNT( cBuffer , 80 )
FOR nCurrLine = 1 TO nLines
cTemp := MEMOLINE( cBuffer , 80 , nCurrLine)
IF cSearch $ cTemp
MSGINFO( STR( nCurrLine ) )
EXIT
ENDIF
NEXT
Is there any way to do that in Harbour faster?
TIA