From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,25aa3c7e1b59f7b5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-14 06:37:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Literate Programming [was: A case where ...] Date: 14 Jan 2002 09:34:03 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: <3C34BF2C.6030500@mail.com> <3C34D252.4070307@mail.com> <5ee5b646.0201040829.18db8001@posting.google.com> <3C35E733.6030603@mail.com> <3C35FE2A.9020802@mail.com> <3C3C1438.FBF10FC3@baesystems.com> <3C3EB43E.B82E92CA@baesystems.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1011019090 11959 128.183.220.71 (14 Jan 2002 14:38:10 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 14 Jan 2002 14:38:10 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: archiver1.google.com comp.lang.ada:18903 Date: 2002-01-14T14:38:10+00:00 List-Id: "Nick Roberts" writes: > What I think just be might be a worthwhile feature to add to a future > revision would be some kind of line-oriented Ada 'on/off switch'. > > A file could then contain e.g. > > === docbook > > The next function returns the opposite direction > to the one given as its parameter. > > === ada > > function Opposite (Way: in Direction) return Direction; > > === docbook > > The next function ... > > This would mean that normal text files could be used to contain mixed > content, including Ada source code, and yet any standard Ada compiler could > directly compile such files. It is tempting to put documentation in the code files, and it works well when the system has only a few code files. But when you have 100 files, most of them small child subprograms, where do you look for the documentation that describes the whole system? I prefer to keep documentation in a separate file, but in the same directory as the code (or at least the same directory tree), and build it from the same makefile (I use LaTeX for documents). > This would be a huge advantage over having to pre-process ('tangle') > the files before compiling them, which tends to render the automatic > 'make' tools supplied with Ada systems useless. Preprocessors do not render Ada make tools useless. The preprocessor just requires it's own 'make' step, which is easy to handle with a generic make (such as gnu make). The generic makefile does two things; check that all the preprocessed files are up-to-date, and then invoke the Ada make to check that the object files are up-to-date. I've used this technique with GNAT and ObjectAda. One thing preprocessors do screw up is the interface between an editor and the compiled information, used for cross-referencing code. For example, Emacs Ada mode + GNAT normally allows a single keystroke to bring up the source code for any definition. However, if the GNAT preprocessor is used, that keystroke brings up the preprocessor _output_ file, but we want the preprocessor _input_ file. In this particular case, the GNAT compiler and preprocessor already provide the necessary information; the Emacs Ada mode does not properly use it (one of these days I'll fix it :). -- -- Stephe