Oz and Mozart Users Mailing List

Re: 'Indent' for Oz Programs?


From: Denys Duchier (Denys.Duchier@ps.uni-sb.de)
Date: Wed Jul 31 2002 - 11:57:56 CEST


twoonkio@dso.org.sg (Tan Woon Kiong) writes:

> I am looking for an indentation utility that indents Oz programs (much
> like the 'Indent' program for C). Is there such a utility?

You can use emacs to reindent your program for you using
M-x oz-indent-buffer. This can be done with a script.

For example, start with a script like this:

#! /bin/sh
echo "Formatting $1"
emacs --load=ozindent.el --eval="(ozindent \"$1\")" --kill --batch

and create the auxiliary elisp file ozindent.el containing the
following code:

(setq load-path (cons "/usr/local/oz/share/elisp" load-path))
(require 'oz)
(defun ozindent (file)
  (find-file file)
  (oz-mode)
  (oz-indent-buffer)
  (save-buffer)
  (kill-emacs))

That works fine, as long as the code to indent already has useful line
breaks.

Cheers,

-- 
Dr. Denys Duchier			Denys.Duchier@ps.uni-sb.de
Forschungsbereich Programmiersysteme	(Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45	http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50			Phone: +49 681 302 5618
66041 Saarbruecken, Germany		Fax:   +49 681 302 5615

- Please send submissions to users@mozart-oz.org and administriva mail to users-request@mozart-oz.org. The Mozart Oz web site is at http://www.mozart-oz.org/.



This archive was generated by hypermail 2b29.