Blitz (50/193)

From:Curt Esser
Date:9 Aug 2000 at 00:56:39
Subject:Re: Investigator

Hi all,
----- Original Message -----
From: "David McMinn" <D.Mcminn@eee.rgu.ac.uk>
>
> > My main prog is just a string of (x)include statements. Would it be
> > possible to get it to recognise these and follow the includes to get a
> > total report for the whole thing?
>
> Probably :)

Yes, it should be able to do this - it really amounts to just recognizing
another token, then taking a different action if it is found...

Blitz libraries #0 and #1 contain all the compiler tokens, like "If",
"EndIf", "Xinclude", etc...

(No, you won't find 'em in your libraries drawer, or in Acidlibs - they are
built into the compiler itself)

>
> > If Curt doesn't have the time, I'll try & give it a go, but I'm
> > hopeless when it comes to recursion and I'll need a LOT of guidance
> > with the simplest stuff (like how do I recognise the Xinclude
> > token??).

I'd do it like David suggested below...

> As for detecting the XInclude token, save a program from Blitz that has
only
> the line XInclude "blah". Now load it up in a hex editor. The first 2
bytes
> should be the token for XInclude.

> An alternative to recursion might be to scan the files for XInclude's
first and
> stick all the filenames of the sources into a list. You could then process
the
> list separately, one file at a time. Disadvantage here would be that the
source
> would need to be scanned twice, making it a lot slower.

I think it would actually be handier if it gave you a separate list of the
commands used in each individual Include file? Anyway, read on, the
following method would work for either way, and no recursion involved (I
don't think, I never got the hang of recursion...)

I would suggest simply having it scan through the main source once, adding
the usual tokens to the list as before, and adding any Xinclude filenames
(and don't forget also plain Include) to
a separate list.

Then, once the first source was completely scanned, it could optionally give
the report for it and clear the list - or simply save the current stats.

Either way, it could then scan through all the Xincluded files and either
give a report on each, or simply a grand total at the end.

This method wouldn't slow things down, would be easier to program (at least
for me...), and would have the advantage that if any of the Xincludes
contained Includes of it's own, these would be processed too (assuming
Blitz supports this sort of Include "nesting"?)

As I don't have the time right now, I'd be more than happy for anybody to
have a go at it.

As long as I get a copy when it is done ;)

I think the source was included with the archive, but if not write me and
I'll pass it along.

It's rather a mess, but has lots of comments, so you should be able to
figure out what is going on.

And David, I either missed your posting about how to skip the "internal"
tokens, or possibly didn't understand it.

Would you mind re-posting it? (Or if you are going to do the modifications
Tony wanted, possibly add it into the code?)

Later.....
Curt Esser

camge@amigaonline.net
http://members.tripod.com/~DoctorPix/ (Pictures)
http://members.xoom.com/Curt_Esser/ (Amiga stuff)

He who is not busy being born is busy dying.-- Bob Dylan

---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie