The integrated GREP facility in Turbo Pascal 7.0 doesn't work all the way as usual.
Playing a little with the parameters, it is possible in the Message window to get a list of files with a match (and the no. of matches), using -C+.
But the normal list with each line (with line number) in matching files doesn't work.
I too use DOSBox with Turbo Pascal 7.0 and discovered the same thing.
What I found so far is that this is related somehow to the way stdin/stdout works under DOSBox.
I found that a GREP search creates two files: $$PIPE$$.TP$ and $$MSG$$$.TP$ and I think the latter contains the search result, but Turbo Pascal cannot retrieve it.
I experimented a bit with the GREP2MSG.PAS file (located in TP7's BIN directory) but still have not found a solution.
Another quirk running under DOSBox I discovered (and I suspect this problem is not unique to Turbo Pascal):
Copy a file, for example using Windows Explorer, into a folder which a session of Turbo Pascal is using.
Go to File | Open and one cannot find the file just copied.
Exit Turbo Pascal (and DOSBox if it is not configured to auto close with the application its running).
Now Restart DOSBox/Turbo Pascal and now one can find the file just copied.
Not sure why the bad attitude toward other-than-game-users of DOSBox. I can understand why DOSBox developers do not want any liability for unintended side effects, etc.
But, as a programmer myself, I would view the information provided from other-than-game users as potentially useful and may provide clues to any open issues with running games.
raydela wrote:Copy a file, for example using Windows Explorer, into a folder which a session of Turbo Pascal is using.
Go to File | Open and o […] Show full quote
Copy a file, for example using Windows Explorer, into a folder which a session of Turbo Pascal is using.
Go to File | Open and one cannot find the file just copied.
Exit Turbo Pascal (and DOSBox if it is not configured to auto close with the application its running).
Now Restart DOSBox/Turbo Pascal and now one can find the file just copied.
This is caused by DOSBox's internal directory cache. If you change the contents of mounted folders outside of DOSBox then you need to refresh the cache (Ctrl-F4 by default) for DOSBox to "see" the changes.
raydela wrote:
Not sure why the bad attitude toward other-than-game-users of DOSBox.
Well, I don't really see any "bad" attitude in this case. You might get a similar reaction if you take your new hammer back to the hardware store and mention that it doesn't work well when trying to pound in screws.
This is caused by DOSBox's internal directory cache. If you change the contents of mounted folders outside of DOSBox then you need to refresh the cache (Ctrl-F4 by default) for DOSBox to "see" the changes.
So any changes made to folders by the application running under DOSBox can be seen immediately without pressing Ctrl-F4?
(Just wondering if this was the answer to the Turbo Pascal/GREP issue -- maybe Turbo Pascal can't see the search results file in order to retrieve it.)
The problem with GREP is that DOSBox does not convert tabs to spaces in INT 21/02, and the GREP2MSG program is confused when it finds tab characters. A cheap hack is to change tabs to a single space:
1 case 0x02: /* Write character to STDOUT */ 2 { 3 Bit8u c=reg_dl;Bit16u n=1; 4+ if (c==9) c=0x20; 5 DOS_WriteFile(STDOUT,&c,&n); 6 //Not in the official specs, but happens nonetheless. (last written character) 7- reg_al = c;// reg_al=(c==9)?0x20:c; //Officially: tab to spaces 8+ reg_al = c; 9 } 10 break;
To do it properly, the output function would have to keep track of the column so the appropriate number of spaces can be written out.
Thanks for figuring it out.
That is pretty cheap indeed. Wouldn't the write (while not being redirected) end up at int10_teletype in the end which would do the expansion? Now that would be lost as well.
Looking at this again, you don't need separate E_space and E_tab variables.
The original E variable will work.
Also, even though the Pos(...) function specifies that the sub-string argument must be of string type, I found the following will work when the sLine contains tab(s).