HELP COMPILEHERE                                Aaron Sloman, March 2000
Updated 14 Nov 2000

LIB COMPILEHERE

This defines an autoloadable macro "compilehere" which can be used
to compile a collection of files from one file, in a location
independent manner.

E.g. suppose there is a file called 'main.p' and it is required to
compile three more files called 'first.p', 'second.p', 'third.p'.

Then it suffices to do

compilehere
    first.p
    second.p
    third.p
    ;

The macro uses the global variable popfilename, set by the compiler,
to work out the directory in which the file containing it is
located and prepends that directory to the other file names.

They can therefore be in sub-directories if required, e.g.

compilehere
    sub/first.p
    sub/second.p
    sub/third.p
    ;

There should be no blank lines, and the final line should contain
a semi-colon.

The macro uses rdstringto.


NB: PROBLEM FOR EMACS USERS

(This problem was reported by Brian Logan.)

If you are an Emacs user compiling from an emacs buffer and the code
in the buffer uses compilehere then compilehere will not work, because
when emacs sends the lines of code to Pop-11, Pop-11 does not know which
file was the original source.

There are (at least) two solutions to this:

(1) Use the emacs pop-mode command 'load-file' instead of
    'compile-region' or 'compile-buffer', as load-file doesn't use a
    temporary file for communication with pop.

Alternatively:

(2) Before compiling from an emacs buffer if the file in the buffer
    uses "compilehere" insert a line of the following form at the top
    of the file, or at the top of the region to be compiled:

    <filename> -> popfilename;

where <filename> is a string containing the name of the original file.
This will not cause pop-11 to compile that file, but it will compile
any related files referred to by "compilehere". It should also fix
wrong file names printed in warning messages by prwarning.


--- $poplocal/local/help/compilehere
--- Copyright University of Birmingham 2000. All rights reserved. ------
