Monika Sester <monika.sester@ifp.uni-stuttgart.de> writes:
> Date: 11 Jan 1995 10:33:41 GMT
> Organization: Institut fuer Photogrammetrie
>
> hi,
> my program is producing new programs which it is able to execute.
> however they don't look very nice.
> is there a possibility to justify the code of the newly produced
> program directly from my program ?
> i.e. is there a routine like the compilation-routine, which does this
> justification ?
>
> compile('new_file.p');
> justify('new_file.p');
You can read the new file into VED
ENTER ved new_file.p
then mark the whole file
ENTER mbe
Then get it justified, provided that the file already has linebreaks
in the right places:
ENTER tidy
This can be put together in a procedure, to be run with VED running.
define justify(file);
lvars file;
edit(file);
ved_mbe();
ved_tidy();
enddefine;
The problem is getting the linebreaks in the right places when you
generate the file. This needs a bit of thought. One way is to
use the following lists
vedopeners
All words in this list apart from parentheses and brackets
could be preceded by a newline.
vedclosers
Ditto. They should also be followed by a newline (after the
following semi-colon if there is one).
vedbackers
precede by a newline, and put a newline after "then"
put a new line before "vars", "lvars", "dlocal", "global".
I think this will produce rather more white space than some people
would like, and it would also not cope with breaking up complex
expressions with lots of nesting.
One difficulty is that defining new syntax words in Pop-11 can
produce all sorts of new forms that need their own formatting
conventions. One advantage of Lisp is that its syntax is so
impoverished that one can write generic formatters fairly easily.
Aaron
---
--
Aaron Sloman, (WWW page: http://www.cs.bham.ac.uk/~axs )
School of Computer Science, The University of Birmingham, B15 2TT, England
EMAIL A.Sloman@cs.bham.ac.uk OR A.Sloman@bham.ac.uk
Phone: +44-(0)121-414-4775 Fax: +44-(0)121-414-4281
|