TSE: Grep: Chris Antos' grep

24 views
Skip to first unread message

knud van eeden

unread,
Nov 26, 2022, 12:53:52 PM11/26/22
to SemWare TSE Pro Text Editor, Guy Rouillier
Guy,


1. As e.g. using grep3230.zip is thus certainly not complete.

2. And also running dlg222.zip from Dieter Koessl is also not immediately working after running instdlg.bat.

3. Would it therefore be possible to send a zipped directory of your running Chris Antos' GREP (thus including those Dieter Koessl dialog boxes especially).

Thanks in advance,
with friendly greetings
Knud van Eeden





Guy Rouillier

unread,
Nov 27, 2022, 2:17:59 AM11/27/22
to knud van eeden, SemWare TSE Pro Text Editor
Knud, please see our email exchange from earlier this year: 9/22/2022 and 9/23/2022 titled "Re[2]: [TSE] Re[2]: TSE: grep macro by Chris Antos: How to compile successfully?"  Rather than zip up my directory, I included instructions on how to build directly from the downloads on the Semware website.  Let me know if you no longer have that email or attachment, and I'll resend.

--
Guy Rouillier

knud van eeden

unread,
Nov 27, 2022, 8:18:40 AM11/27/22
to SemWare TSE Pro Text Editor

Guy wrote:
> Knud, please see our email exchange from earlier this year: 9/22/2022 and 9/23/2022 titled "Re[2]: [TSE] Re[2]: TSE: grep macro by Chris Antos: How to compile 
> successfully?"  Rather than zip up my directory, I included instructions on how to build directly from the downloads on the Semware website.  Let me know if you no longer 
>  have that email or attachment, and I'll resend.

These instructions do not really work here.

Troubleshooting Chris Antos' TSE software is EXTREMELY demanding and cumbersome, the most complex constructions and dependencies, possible duplicates (e.g. in this grep implementation), very difficult.

I spent e.g. something like a week trying, even with the help of Chris himself, e.g. to get gethlp40.zip up and running. It showed it expected the software in some specific directory and did not warn when it was not there.

So better to have a real working Chris Antos' grep example thus and working from there.

===

These are your instructions, adapted from Linux for Windows, and using JPSoft tcc.exe as command executable:

(1) TSE comes with a grep.s macro from Semware. The
    alternate grep discussed here also exists in a file
    called grep.s. so the names will collide.  For now,
    rename TSE's original grep file to grep.org, or some
    other name of your choice. If you want to continue to
    use both, you'll need to rename one or the other. I
    primarily use this alternate, so I've renamed the TSE
    original to tsegrep.s.

(2) Download the following files from the "old" Semware web
    site:


(3) Inside your TSE installation mac directory, create a
    directory "grep". Move the zip files from (2) into that
    directory.

     cdd f:\wordproc\tse32_v44200\macdownlo\

     md grep

     copy grep3230.zip grep
     copy dlg222.zip grep
     copy dlg222p.zip grep
     copy gethlp40.zip grep

(4) Inside the grep directory, unzip the following:

     cd grep

     pkunzipc -extract -dir grep3230.zip
     pkunzipc -extract -dir dlg222.zip
     pkunzipc -extract -dir gethlp40.zip

     Warning for duplicates, rename e.g. to the name of the current package

      09/04/2002  01:20           4.041  dialogDUPLICATEDLG222.si
      21/04/2005  01:22             363  file_idDUPLICATEDLG222.diz
      19/05/2002  17:32             353  FILE_IDDUPLICATEGETHLP40.DIZ
      19/05/2002  14:56           1.205  guiincDUPLICATEGETHLP40.inc

Delete the .mac files packaged with these zip files:

 del *.mac /s

(5) Make the following file name changes. This is necessary
    because Linux is case-sensitive, while Windows is not.


     ren GETHELP.K32 gethelp.k32

(6) Edit dialog.s, and find the following line.  At the time
    I'm writing this, the line is 227:

     String Paint[] = "DialogP"                      // name of paint module

     Change to:

     String Paint[] = "dialogp"                      // name of paint module

(7) Create an executable file called build.bat with the
    following contents. The dashes below are delimiters
    here; do not include them in build.sh:

    First create a subdirectory, as I do not want these
    files copied to my main mac directory, as this is
    only testing.

     md DDD
     move *.* DDD
     del *.*

     copy build.bat DDD

     cd DDD

This is the content of build.bat:
-----------------
sc32 dialog.s
sc32 grep.s
REM
copy *.mac ..
copy grep.hlp ..
-----------------

If using Linux:
For the curious, the command lines define -dWIN32=0 because
various macro files include a test checking for this
define. Running this macro under Linux requires the same
sections of code, so the easiest workaround is to just
create the define at compile time.

After creating this file, make it executable with the
following command:

If using Linux:
chmod +x build.sh

Now run it:

build.bat

Here there was an error:

--- cut here: begin --------------------------------------------------
File: F:\WORDPROC\tse32_v44200\MACDOWNLO\grep\DDD\dialog.s
Compiling............................................................
Error   2335  (1333,22)  Undefined symbol 'DlgMsgText' encountered

SAL Compiler V4.50 (bcc version)
Copyright 1991-2021 SemWare Corp.  All rights reserved worldwide.
--- cut here: end ----------------------------------------------------

Solution:

add at the top of the dialog.s file this text, save and recompile.

STRING DlgMsgText[255] = ""

---

Pay attention to the printed messages, looking for reported
errors. If you do not see any errors, then the macro and
help files should be ready to use. Verify with a directory
listing of the mac directory.  You should see the followng
files with recent dates:

cd ..

dir grep.hlp
dir dialog.mac
dir dialogp.mac
dir gethelp.mac
dir grep.mac

(8) To test, open up a text file in the editor. From the
    main menu, select Macro - Execute, and then enter grep
    into the Execute macro: prompt.  You should see a popup
    dialog box with Grep in the title, and a list of Search
    and Grep options on the bottom.

If you want to use this version of grep, you will want to
modify your UI file to assign a key combination to execute
it.


knud van eeden

unread,
Nov 27, 2022, 8:41:18 AM11/27/22
to SemWare TSE Pro Text Editor
>>Guy wrote:
>> Knud, please see our email exchange from earlier this year: 9/22/2022 and 9/23/2022 titled "Re[2]: [TSE] Re[2]: TSE: grep macro by Chris Antos: How to compile 
>> successfully?"  Rather than zip up my directory, I included instructions on how to build directly from the downloads on the Semware website.  Let me know if you no longer 
>>  have that email or attachment, and I'll resend.

>These instructions do not really work here.
>Troubleshooting Chris Antos' TSE software is EXTREMELY demanding and cumbersome, the most complex constructions and dependencies, possible duplicates (e.g. in this >grep implementation), very difficult.
>I spent e.g. something like a week trying, even with the help of Chris himself, e.g. to get gethlp40.zip up and running. It showed it expected the software in some specific >directory and did not warn when it was not there.
>So better to have a real working Chris Antos' grep example thus and working from there.

===

latest instructions:

sc32 dialogp.s
add at the top of the dialog.s (and aimilarly in dialogp.s) file this text, save and recompile.

STRING DlgMsgText[255] = ""

---

Pay attention to the printed messages, looking for reported
errors. If you do not see any errors, then the macro and
help files should be ready to use. Verify with a directory
listing of the mac directory.  You should see the followng
files with recent dates:

cd ..

dir grep.hlp
dir dialog.mac
dir dialogp.mac
dir gethelp.mac
dir grep.mac

Result:

27/11/2022  14:04          15.623  dialog.mac
27/11/2022  14:36           5.487  dialogp.mac
27/11/2022  14:04          25.301  gethelp.mac
14/04/2001  23:08          12.636  grep.hlp
27/11/2022  14:04          24.077  grep.mac

(8) To test, open up a text file in the editor. From the
    main menu, select Macro - Execute, and then enter grep
    into the Execute macro: prompt.  You should see a popup
    dialog box with Grep in the title, and a list of Search
    and Grep options on the bottom.

Execute grep.mac, but nothing happens (as usual).

If you want to use this version of grep, you will want to
modify your UI file to assign a key combination to execute
it.

knud van eeden

unread,
Nov 27, 2022, 11:05:34 AM11/27/22
to SemWare TSE Pro Text Editor
>>Guy wrote:
>> Knud, please see our email exchange from earlier this year: 9/22/2022 and 9/23/2022 titled "Re[2]: [TSE] Re[2]: TSE: grep macro by Chris Antos: How to compile
>> successfully?"  Rather than zip up my directory, I included instructions on how to build directly from the downloads on the Semware website.  Let me know if you no longer
>>  have that email or attachment, and I'll resend.

>These instructions do not really work here.
>Troubleshooting Chris Antos' TSE software is EXTREMELY demanding and cumbersome, the most complex constructions and dependencies, possible duplicates (e.g. in this >grep implementation), very difficult.
>I spent e.g. something like a week trying, even with the help of Chris himself, e.g. to get gethlp40.zip up and running. It showed it expected the software in some specific >directory and did not warn when it was not there.
>So better to have a real working Chris Antos' grep example thus and working from there.

===

Current conclusion:

In grep.s you find this to start the 'Dialog' (e.g. Dieter Koessl):

...
#if VARIATION == 2
proc SetCheck(string opt, string opts, integer nid)
ExecMacro(Format("DlgSetData"; nid; iif(Pos(opt, opts), TRUE, FALSE)))
end
...

But it looks out of the box never going to work, because there is no 'DlgSetData' macro file to be found in any of my filenames
and I have all the possible files (e.g. downloaded from Semware) on my system.

So the Dieter Koessl dialog boxes you are not / never going
to see out of the box (because 'VARIATION == 2' is the default) is my current opinion.

Also seems the current Chris Antos' grep.s not be able to
handle very large files (like my work file which is 1
gigabytes and 15 million lines), it showed clearly wrong
results when testing e.g. exclude files.

===

Latest instructions:
REM
REM additional actions to do to get grep.s maybe working
REM
copy dialog.si ..
copy grepdlg.dlg ..
copy grepdlg.si ..
copy guiinc.inc ..
-----------------

If using Linux:
For the curious, the command lines define -dWIN32=0 because
various macro files include a test checking for this
define. Running this macro under Linux requires the same
sections of code, so the easiest workaround is to just
create the define at compile time.

After creating this file, make it executable with the
following command:

If using Linux:
chmod +x build.sh

Now run it:

build.bat

Here there was an error:

--- cut here: begin --------------------------------------------------
File: F:\WORDPROC\tse32_v44200\MACDOWNLO\grep\DDD\dialog.s
Compiling............................................................
Error   2335  (1333,22)  Undefined symbol 'DlgMsgText' encountered

SAL Compiler V4.50 (bcc version)
Copyright 1991-2021 SemWare Corp.  All rights reserved worldwide.
--- cut here: end ----------------------------------------------------

Solution:

add at the top of the dialog.s (and similarly in dialogp.s) file this text, save and recompile.

STRING DlgMsgText[255] = ""

---

Pay attention to the printed messages, looking for reported
errors. If you do not see any errors, then the macro and
help files should be ready to use. Verify with a directory
listing of the mac directory.  You should see the followng
files with recent dates:

cd ..

dir grep.hlp
dir dialog.mac
dir dialogp.mac
dir gethelp.mac
dir grep.mac

Result:

27/11/2022  14:04          15.623  dialog.mac
27/11/2022  14:36           5.487  dialogp.mac
27/11/2022  14:04          25.301  gethelp.mac
14/04/2001  23:08          12.636  grep.hlp
27/11/2022  14:04          24.077  grep.mac

(8) To test, open up a text file in the editor. From the
    main menu, select Macro - Execute, and then enter grep
    into the Execute macro: prompt.  You should see a popup
    dialog box with Grep in the title, and a list of Search
    and Grep options on the bottom.

===

Execute macro grep.s with the parameter -w

That will ask for a search string, then start searching.

===

E.g.

 grep.mac -w <your search string>

 grep.mac -w hello world

That will start to search with 'hello world'

===

This seem to be some parameters possible:

 Options:

  -$ <your search string>      anchor to end of line
  -b <your search string>      block in current file only
  -c <your search string>      current file only
  -d <your search string>      recurse subdirectories
  -i <your search string>      ignore case (treat lower case and upper as identical)
  -l <your search string>      filenames only (only list the names of files that have matches; do not list the matches themselves.)
  -m <your search string>      files in memory
  -p <your directory>          begins the search from the path <your directory>
  -v <your search string>      verbose
  -w <your search string>      match whole words.
  -x <your search string>      regular expressions
  -^ <your search string>      anchor to beginning of line

  -e <your file specification> excludes files that match <your filespecification>

                                E.g. G -e*.bak,*.tmp hello *.*

                               Searches all files in the current directory, except *.bat and *.tmp, for the string "hello".

                                E.g. f:\wordproc\tse32_v44200\macdownlo\grep\grep.mac -mef:\addjob.dok Identifier

                               Searches in all files in memory, but excludes f:\addjob.dok for the string "Identifier"

                                Note: this seems not to work as expected.

                                It excludes the filename in the results, but shows instead non-matching results including
                                from the excluded file.

                                The root cause of the incorrect results
                                seems to be that it can not handle files with many lines, e.g. 1 million or more.

                                 addjob.dok is a very large file (1 gigabytes, 15 million lines)

===

The default is in grep.s is:

// these must be defined to some value
#define VARIATION 2 // VARIATION:  0=Ask, 1=Menu, 2=Dialog

This does not do anything when running grep.mac.

You must thus call grep.mac with parameters to see something happening, e.g.

 grep.mac -w

===

If you want a TSE menu then in grep.s change VARIATION from 2 to 1, save and recompile.

// these must be defined to some value
#define VARIATION 1 // VARIATION:  0=Ask, 1=Menu, 2=Dialog

===

If you want a TSE menu then in grep.s change VARIATION from 2 to 0, save and recompile.

// these must be defined to some value
#define VARIATION 0 // VARIATION:  0=Ask, 1=Menu, 2=Dialog

will now automatically open a TSE ask box when you run grep.mac

===

If you want to use this version of grep, you will want to
modify your UI file to assign a key combination to execute
it.

with friendly greetings
Knud van Eeden


knud van eeden

unread,
Nov 27, 2022, 11:27:30 AM11/27/22
to SemWare TSE Pro Text Editor

So I would suggest if possible to follow your own instructions on clean e.g. TSE 4.48 on a Microsoft Windows machine (possibly amend them where necessary), see that it is running, including thus Dieter Koessl dialog boxes, then send the instructions again, then I will try to reproduce it here.

Note: As Chris Antos' grep is potentially a very useful program it is worth to put effort in it to get it working for everybody. 

Chris Antos' grep has already been advertised and glorified since 2004, including the Dieter Koessl dialog boxes, so it would be great to see it running for everybody who wants that.

I plan to make the installation once the installation steps are successful more smooth and automatic, typically by creating batch files which do about everything regarding the installation and compilation.

So about every zipped file (e.g. from Semware web site macros) should also get its own .bat file(s) in this regard.

===

In general the plan is to automate 

1. using thus .zip files to collect all necessary files (directory + subdirectories)

2. the user being able to extract the final .zip file to an arbitrary directory 
(so not restricted to e.g. the TSE 'mac' directory)

3. The user can (always) run then a batch file (.bat) in that directory to install it. 

4. At the developer end to put each single file in a version control system like Subversion and or Git

5. Optionally collaborate to get it up and running and or edit (git clone, fetch ,pull, push, ..., add, commit, ...)

6. When finished publishing automatically zipping all the necessary files automatically (using a .bat file) in a final .zip file, that then will be published for general user availability and user usage.

7. Note: Here the .bat file plays thus the role like 'make' files in C, C++ or 'ant' files in Java, in order to automatically compile and collect the files.

Carlo Hogeveen

unread,
Nov 27, 2022, 1:34:01 PM11/27/22
to sem...@googlegroups.com

Knud,

> But it looks out of the box never going to work,
> because there is no 'DlgSetData' macro file
> to be found in any of my filenames

Consider the example macro below, which demonstrates undocumented macro syntax.

Carlo



public proc non_existing_macro()
Warn('But I do exist!')
end non_existing_macro

proc Main()
ExecMacro('non_existing_macro')
PurgeMacro(CurrMacroFilename())
end Main




knud van eeden

unread,
Nov 27, 2022, 6:17:59 PM11/27/22
to SemWare TSE Pro Text Editor
I have pushed that latest Chris Antos' grep3230.zip installation instructions, worked out from your instructions to GitHub.


Feel free (anyone) to do a clone, 
followed by a pull to edit these instructions and possibly edit and push back again. 

Guy Rouillier

unread,
Nov 27, 2022, 10:11:14 PM11/27/22
to SemWare TSE Pro Text Editor
I just installed TSE 4.48 on my Windows Pro 7 64-bit system, and followed my own instructions in build_grep.txt.  They worked without error - no corrections necessary.  I sent Knud a zip of my mac\grep directory.  Knud, let me know if you need anything further from me.  I'm in the U.S., so I'm using U.S. English in Windows (and hence in TSE.) I wonder if any of the issues you are encountering may be because of either a different Windows version or a language other than U.S. English.

I'll try this again in Linux in a couple days when I have some time.  I would like to get all these many files - both Antos's grep macros as well as Koessl's dialog macros - into a git repository.  Hopefully we can tackle that over the winter, when weather may provide us some spare time.

--
Guy Rouillier
--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/semware/1167545671.5190309.1669566446831%40mail.yahoo.com.

knud van eeden

unread,
Nov 28, 2022, 3:58:53 AM11/28/22
to Semware TSE Pro
Thanks a lot Guy,

That is very good news.

I will check further later and come back later about it.

with friendly greetings
Knud van Eeden

knud van eeden

unread,
Nov 28, 2022, 4:50:53 AM11/28/22
to Semware TSE Pro
> Guy wrote:
> I just installed TSE 4.48 on my Windows Pro 7 64-bit system, and followed my own instructions in build_grep.txt.  
> They worked without error - no corrections necessary.  

1. Yes I could get it to run now here also

2. The instructions are a bit more detailed thus:

...

Tested in a clean TSE 4.48

It is thus mandatory to go to your mac directory

Make this directory grep there

copy the 4 below zip files into the grep directory

(4) Inside the grep directory, unzip the following:

grep3230.zip
dlg222.zip
gethlp40.zip
dlg222p.zip <= this should be added

(4a) Unzip the .zip files mandatory in this order as above

(4b) When asked to overwrite the dialog.si file when unzipping 'dlg222.zip' answer 'NO' (that is important, otherwise you get missing variables errors 2 times)

(4c) Note: grep.mac will overwrite the original grep.mac in the mac directory, so you will have to rename the original grep.mac file in the mac directory first. Or rename the new grep.mac file.

(4d) Then create and run this build.bat file:

..\..\sc32 dialog.s
..\..\sc32 dialogp.s
..\..\sc32 gethelp.si
..\..\sc32 grep.s
copy *.mac ..
copy grep.hlp ..

(4e) Note: this batch file should thus run without change, because sc32.exe is indeed 2 directories above. 

(4f) Then start TSE and run that latest 'grep.mac' in the mac directory.

(4g) You should see a Dieter Koessl dialog box to fill in and run Chris Antos' grep.

===

2. The root cause that it worked was that it has been run from the <TSE>\mac directory. 

That seems mandatory. 

Not sure why that mac directory is so important to run from. 

A lot of installations kind of require that it is done in that directory..

Getting all these TSE .mac and so on in that mac directory might overwrite original files, 
which it does here also (grep.mac gets normally overwritten).

It will also complicate matters when migrating to a new TSE version, 
because one has to take into account all those newly installed user programs.

knud van eeden

unread,
Nov 28, 2022, 5:09:50 AM11/28/22
to Semware TSE Pro
> Guy wrote:
> I just installed TSE 4.48 on my Windows Pro 7 64-bit system, and followed my own instructions in build_grep.txt.  
> They worked without error - no corrections necessary.  

It shows that the root cause is my working version of TSE (which is 4.42.00).

When I run the instructions even outside the mac directory, it works in a clean 4.42.00, running the same grep.mac in my 4.42.00 does not work.

So it is an issue with installed macros on my work TSE 4.42.00 and or changed configurations or similar.

So installing it in the mac directory seems not necessary.

knud van eeden

unread,
Nov 28, 2022, 10:17:45 AM11/28/22
to Semware TSE Pro
Guy wrote:
> I would like to get all these many files - both Antos's grep macros as well as Koessl's dialog macros - into a git repository.  Hopefully we can tackle that over the winter, when 
> weather may provide us some spare time.

===

1. It is already winter ;-)

It took me 5 minutes using my git.tse.s TSE macro from within TSE.

===

2, I did a 'push' of all the 150+ files related to grep3230.zip to github 
    (to be found there in the directory GREP3230).


===

3. The steps to bulk upload your whole directories 

     a. E.g. the whole Semware TSE C / C++ development environment as a specific example, so that could be uploaded in a few minutes if so wished some time.

     b. Your recompiled and tested .zip files (downloaded from https://semware.com/html/tseprofiles.php
      1. The plan is to use on github directories that start with the name of the .zip
         (e.g. if grep3230.zip you name the directory GREP3230, 
               if gethlp40.zip you name the directory GETHLP40
               and so on..

  c. One time you clone the github directory

      1. you must create a completely clean directory on your disk, with no version control
         
          (e.g. MkDir( "c:\TEMP\DDD01" )

      2. Then you clone (once only) from the remote directory to this local directory)
          (e.g. my GitHub remote directory is: https://github.com/knudvaneeden/ddd.git 

 
          git clone ...

      3. Now your directory is ready for action, after doing this clone

      4. Files you want to put under version control you copy into that local directory c:\TEMP\DDD01
              
          1. First you do git add ...

          2. Then you do git commit ...

      5. If you want to have directories on your remote repository, just create these in your local
         directory

          1. E.g. MkDir( "c:\TEMP\GREP3230\" )

          2. Then copy all your files into this directory, as usual using 'copy <source> <directory' from
             e.g. the DOS command line

          3. Then you do 'git add .' to have all the files in the root and its subdirectory included

          4. You do a commit

      6. When ready you can do git push from within that directory c:\TEMP\DDD01 to upload all those files
         to your remote directory.

      7. When somebody else want to work on these files he/she can do a clone of that remote directory
         first as described above, then edit the files, then when ready do a git push to put the result
         back from his/her local directory.

      8. From then on one can thus do a push to send and a pull to receive, e.g. updates.
         Changes by anybody will be automatically merged.

Guy Rouillier

unread,
Nov 29, 2022, 1:07:03 AM11/29/22
to Semware TSE Pro
>> 1. It is already winter ;-)

Not until December 21, 2022. :)

--
Guy Rouillier

knud van eeden

unread,
Nov 29, 2022, 3:44:18 PM11/29/22
to Semware TSE Pro
>> Knud wrote:
>> 1. It is already winter ;-)

> Guy wrote:
> Not until December 21, 2022. :)

It was thus meant as an allegory.
In other words sometimes events arrive quicker than expected ;-)

Guy Rouillier

unread,
Nov 29, 2022, 4:32:06 PM11/29/22
to SemWare TSE Pro Text Editor

On 11/27/2022 11:05:30 AM, "'knud van eeden' via SemWare TSE Pro text editor" <sem...@googlegroups.com> wrote:


Also seems the current Chris Antos' grep.s not be able to
handle very large files (like my work file which is 1
gigabytes and 15 million lines), it showed clearly wrong
results when testing e.g. exclude files.

You raise a good point.  I don't know the history behind the grep implementation.  I like the dialog box to gather the search values, and I also like the context window for displaying search results.  But I don't understand why the macro does its own file searching.  I'd like to reuse the UI, but replace the actual grep part by invoking an external grep program.  A compiled program will likely be faster, and will not have the file length limits you are encountering.  Indeed, this is the approach that TSE's grep macro uses; it invokes the grep.exe included with TSE.  We could support multiple grep programs: TSE's grep.exe and GNU grep at a minimum.

-- 
Guy Rouillier


knud van eeden

unread,
Nov 29, 2022, 5:33:07 PM11/29/22
to Semware TSE Pro
>> Knud wrote:
>> Also seems the current Chris Antos' grep.s not be able to
>> handle very large files (like my work file which is 1
>> gigabytes and 15 million lines), it showed clearly wrong
>> results when testing e.g. exclude files.

> Guy wrote:

===

> You raise a good point.  I don't know the history behind the grep implementation.  

I guess Chris (Antos) has spent a log of time implementing this grep program. It pulls in the full stack and arsenal of possibilities of TSE (.si, .inc, .s, external dialog, #DEFINE, backwards compatibility, you name it, ...).

===

> I like the dialog box to gather the search values, and 

As I can not get grep.s to work in my work 4.42 (it is an old .ui version that I use long not upgraded, I will have to upgrade it when I upgrade to 4.49, also e.g. Carlo's Unicode program I do not get to work) I fell back on setting 
VARIATION 1 and recompiling
which opens the normal TSE menu instead of Dieter Koessl menu.
The functionality with that TSE menu is the same as the Dieter Koessl' menu so that is a very good workaround.

---

> I also like the context window for displaying search results.  

Yes, that is a very strong point for Chris Antos' grep installation.

===

> But I don't understand why the macro does its own file searching.  

Yes, that is the way it works thus.

===

> I'd like to reuse the UI, but replace the actual grep part by invoking an external grep program.  

My first impression is that it is a tingle-tangle bit of spaghetti program due to inserting all kind of #IFDEF and so 
on for backward compatibility with older TSE versions) so not sure if that is 
going to be an easy job changing anything in general. Very difficult to debug
is my current opinion.

Of course it is a very powerful program on its own with impressive possibilities 
(e.g. the possibility to 'exclude' filenames is very handy).

===

> A compiled program will likely be faster, and will not have the file length limits you are encountering.  

I use Semware grep.exe usually and that works very good also and is stable.

Should I really have to go for it I can e.g. use Cygwin grep.exe (not used that lately). All those Cygwin programs are extremely stable and can handle the largest of files.
But for now not directly necessary thus as using Semware grep.exe thus most of the times without issues.

===

> Indeed, this is the approach that TSE's grep macro uses; it invokes the grep.exe included with TSE.  

Yes, also a very good working grep program.

===

We could support multiple grep programs: TSE's grep.exe and GNU grep at a minimum.

I assume that grep.s from Semware is the best choice. It should not be a big deal to choose the grep executable (from a list, or better store it in tse.ini and using GetProfileStr( sectionS, "executableGrepS", "grep.exe" ) which will default to tse.ini.

===

Let me check grep.s now:

it shows this source code.

proc WhenLoaded()
    find_editor_program("grep.exe", grep)
    find_editor_program("tee32.exe", tee32)
end

So that should be a piece of cake taking something like let say a day or two to make grep.exe variable, e.g.

1. Choosing a different path to grep.exe, e.g.

"grep.exe" from Semware TSE
and further e.g.

"\CYGWIN\bin\grep.exe" from Cygwin 
"\BORLAND\BCC102\bin\grep.exe" from Embarcadero C++
"\GNU\bin\grep.exe from GNU
and further 
"\CRiSP\bin.win64\grep.exe"
"\CPP\MINGW\msys\1.0\bin\grep.exe"
"\JULIA\Git\bin\grep.exe"
"\octave-4.2.0-w64\bin\grep.exe"
"\PCREGREP\pcre2grep.exe"

2. One will have to find the correct parameters for the different grep implementations,
which have same effect as TSE grep.exe thus

E.g. In TSE grep.exe -i0xs which means search ignore case (=i), do only show filenames (=0), do regular expression search (=x) and search subdirectories also (=s).

So what one have to choose e.g. in GNU grep.exe similarly.

Storing that maybe as a hard coded as a key value list or List() or even external file to choose from.

knud van eeden

unread,
Nov 29, 2022, 5:54:59 PM11/29/22
to Semware TSE Pro
Status": Update:

I have created a directory 'GREPSEMWARE'on github now and pushed it:

https://github.com/knudvaneeden/ddd/blob/TRUNK/GREPSEMWARE/

I wil  try to do the below (some day, but expected soon).

with friendly greetings
Knud van Eeden

---

>> Guy wrote:
>> I'd like to reuse the UI, but replace the actual grep part by invoking an external grep program.  
>> A compiled program will likely be faster, and will not have the file length limits you are encountering.  
>> We could support multiple grep programs: TSE's grep.exe and GNU grep at a minimum.

===

> Knud wrote:
> I assume that grep.s from Semware is the best choice. It should not be a big deal to choose the grep executable (from a list, or better store it in tse.ini and using "
> GetProfileStr( sectionS, "executableGrepS", "grep.exe" ) which will default to tse.ini.
>Let me check grep.s now:
> it shows this source code.
> proc WhenLoaded()
>    find_editor_program("grep.exe", grep)
> end
> So that should be a piece of cake taking something like let say a day or two to make grep.exe 
> variable, e.g.
> Choosing a different path to grep.exe, e.g.
> "grep.exe" from Semware TSE
> and further e.g.
> "\CYGWIN\bin\grep.exe" from Cygwin 
> "\BORLAND\BCC102\bin\grep.exe" from Embarcadero C++
> "\GNU\bin\grep.exe from GNU
> and further 
> "\CRiSP\bin.win64\grep.exe"
> "\CPP\MINGW\msys\1.0\bin\grep.exe"
> "\JULIA\Git\bin\grep.exe"
> "\octave-4.2.0-w64\bin\grep.exe"
> "\PCREGREP\pcre2grep.exe"
> 2. One will have to find the correct parameters for the different grep implementations,
> which have same effect as TSE grep.exe thus
> E.g. In TSE grep.exe -i0xs which means search ignore case (=i), do only show filenames (=0), do 
> regular expression search (=x) and search subdirectories also (=s).
> So what one have to choose e.g. in GNU grep.exe similarly.
> Storing that maybe as a hard coded as a key value list or List() or even external file to choose from.


--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion on the web visit

knud van eeden

unread,
Dec 1, 2022, 10:09:41 PM12/1/22
to Semware TSE Pro
Status: Update:


I have implement a proof of concept of grepsemware.s
to include other grep implementations.

That kind of works, but if you want to load the file at the found line, that will not work as the filename and line number are in a different format.

But I do not plan to proceed with it.

Because it shows that for each grep implementation (e.g. GNU, Cygwin, ...) one would have to parse the different output of the grep search.

That is probably all too involved and not seeing the immediate benefit of it, as the native mac\grep.s in combination with grep.s from Semware does the job very good.

with friendly greetings
Knud van Eeden


knud van eeden

unread,
Dec 1, 2022, 10:11:03 PM12/1/22
to Semware TSE Pro
But if you should want to implement it further, grepsemware.s works already thus kind of.

You could do a clone, then edit, then push to github
and further develop it.



Guy Rouillier

unread,
Dec 1, 2022, 11:37:54 PM12/1/22
to Semware TSE Pro
Thanks, I'll take a look - over winter. :) I've got a bunch of other priorities I need to address first.

--
Guy Rouillier
Reply all
Reply to author
Forward
0 new messages