From: "Oliver Roese" Newsgroups: comp.os.msdos.djgpp Subject: Rhide: How to configure the searching facilities! Date: Mon, 23 Nov 1998 15:31:32 +0100 Organization: Xenologics Networks & Communications GmbH Lines: 100 Message-ID: <73brtu$av5@tim.xenologics.com> NNTP-Posting-Host: ip206.xnc.de X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-Mimeole: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Since the beginning Rhide had a interface to grep, but it never worked for me. Recently i found out what went wrong: Grep.exe is started with a parameter missing (the -H parameter is needed.) To correct this you have to overwrite the "RHIDE_GREP" variable in Rhide. For example, if you add the following two line to your [rhide]-section of your djgpp.env (or to your rhide.env): SEARCH_DIRS=%DJDIR%/include %DJDIR%/lang/cxx $(INCLUDE_DIRS) . RHIDE_GREP=grep.exe -Hnwi $(prompt arguments for GREP) $(addsuffix /*.h,$(SEARCH_DIRS)) you can search case-insensitive for words in all *.h-files in all standard includedirectories and in the current one. That works, but there are two free search tools available, that may integrate with Rhide: "ID-Utils" and "Ctags". ("Id-Utils" is available from any djgpp-mirror for example from ftp://teeri.oulu.fi/pub/msdos/programming/djgpp2/ Look for "Idu32b.zip" and "Idu32d.zip". A good tagfilegenerator is available from http://fly.hiwaay.net/~darren/ctags/.) Wouldnt it be nice to use them? It is possible to use "Id-Utils", but there are some drawbacks: 1) "lid.exe" can handle only one database at a time. 2) "lid.exe" dont understand C-syntax. If you search a common symbol your message-window will be flooded with a lot of references. The most attractiv tool is ctags.exe. However i had difficulties to convert tagfiles to errormessages, suitable for rhide. At the end i wrote a gawk-script. If you want to use ctags in this way you have to download and install gawk. (Look for "gwk303b.zip" and "gkw303d.zip" at any djgpp-mirror). A different awk will not work! Sorry for the unconvenience, but i couldnt figure out a better way. But i am sure you never want to miss it, after using it once. Then add the following to your djgpp.env: [rhide] .... SEARCH_DIRS=%DJDIR%/include %DJDIR%/lang/cxx $(INCLUDE_DIRS) . #RHIDE_GREP=grep.exe -Hnwi $(prompt arguments for GREP) $(addsuffix /*.h,$(SEARCH_DIRS)) #RHIDE_GREP=lid.exe -Rgrep $(prompt arguments for LID) RHIDE_GREP=gawk -f%DJDIR%/bin/tag2err.awk rexp=$(prompt arguments for GAWK) $(addsuffix /tags,$(SEARCH_DIRS)) #if you use "lid.exe" [lid] IDPATH=%DJDIR%/include/ID Convert the following to a file tag2err.awk and place it in a convenient place, presumably %DJDIR%/bin. #tag2err.awk #Searches a regular expression (given on the commandline) in a tagfile #produced by ctags and generates "gnu-style" errormessages, #which Rhide can handle. #"gawk -f/tag2err.awk rexp= ..." #searches for in all 's. BEGIN\ { #A Gawk extension. IGNORECASE=1 } #Modify given regular expression to match only whole words. $1~("^" rexp "$")\ { if (rexp == "") #Avoid annoying delays. exit fn = $2 #This works for strings generated by "Exuberant-Tags" too. #You can get it for free from http://fly.hiwaay.net/~darren/ctags/. #"gensub" is another Gawk-extension. pat=gensub(/[^\t ]+[\t ]+[^\t ]+[\t ]+\/\^?([^$/]*)\$?\/.+/, "\\1", -1,$0) lc = 0 while ((getline < fn) == 1) { lc++ if (index($0,pat) == 1) { print (fn ":" lc ":" $0) } } #Make the file available for the next cycle. close(fn) } I hope i have helped you. :-)