[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing occam



Hi,

I rolled some a2ps style files together a while ago, which I use to print
my students assignments. It does some basic syntax highlighting on
keywords, comments and the like.

There are two different style files, one for occam (occam.ssh), and
another which includes the various new keywords introduced in KRoC
(kroc.ssh)

On unix:
  - Drop kroc.ssh and occam.ssh into a ~/.a2ps directory
  - run a2ps with -Eoccam or -Ekroc

Hope that helps,
  Christian


On Wed, 2 Jun 2004, Philippe Lemaire wrote:

> Good morning,
>
> the only Pretty Printer I have (had) only works under TDS...
> WinF seems not to have the function.
>
> Which freewares are able to allow pretty printing ?
>
>
> Thanks in advance,
>
> Philippe
>
>
>
# Style sheet for kroc(tm)
# Copyright (c) 2003 Christian L. Jacobsen <clj3@xxxxxxxxx>
# $Id: occam.ssh 179 2003-03-07 18:04:43Z clj3 $
#

#
# This file will hopefully become part of a2ps.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.  If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
style kroc is
	version is 0.1
	written by "Christian L. Jacobsen <clj3@xxxxxxxxx>"

	documentation is
		"This stylesheet is for the Kent Retargetable occam Compiler (KRoC)"
		"which is a compiler for the parallel programming language occam."
		"The compiler can be found at:"
		"href(http://wotug.ukc.ac.uk/kroc/)href(http://wotug.ukc.ac.uk/kroc/)href"
	end documentation

	ancestors are
		occam
	end ancestors

	keywords in Keyword are
		REAL
	end keywords

	keywords in Keyword_strong are
		CHAN, OF, INITIAL, PORT, MOBILE, SHARED, FORKING, XOR, RECURSIVE, REC,
		STEP, RESCHEDULE, FORK, CLONE, CLAIM, EXTERNAL, DEFINED, NOALIAS, NOUSAGE,
		"#IF", "#ENDIF", "#ELIF", "#ELSE", "#WARNING", "#ERROR", DEFINE, UNDEFINE
	end keywords
end style
# Style sheet for occam(tm)
# Copyright (c) 2002 Christian L. Jacobsen <clj3@xxxxxxxxx>
# $Id: occam.ssh 182 2003-03-12 10:56:27Z clj3 $
#

#
# This file will hopefully become part of a2ps.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.  If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#

style occam is
	version is 0.2
	written by "Christian L. Jacobsen <clj3@xxxxxxxxx>"
	# requires a2ps a2ps-version-number

	first alphabet is
		"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#"
	second alphabet is
	 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.#$%"
	case sensitive

	documentation is
		"This stylesheet is specifically targeted at occam(r) 2.1."
		"The specification for occam 2.1, the \"occam(r) 2.1 reference manual\""
		"(from which this stylesheet was made) can be found at the following URL:"
		"href(http://wotug.ukc.ac.uk/occam/)href(http://wotug.ukc.ac.uk/occam/)href"
		""
		"If you are using the KRoC compiler, you should use the KRoC " 
		"stylesheet instead as this has support for KRoCs much richer"
		"superset of occam 2.1"
		""
		"This stylesheet does not highlight strings in any special way. This is"
		"to avoid the strings being highlighted using a non fixed width font."
	end documentation

	# Data types and constants
	keywords in Keyword are
		ANY, BOOL, BYTE, FALSE, INT, INT16, INT32, INT64, 
		MOSTNEG, MOSTPOS, REAL32, REAL64, TIMER, TRUE
	end keywords

	# Keywords not constants or operators
	keywords in Keyword_strong are
		ALT, ASM, AT, CASE, "CHAN OF", DATA, ELSE, FOR, FROM,
		IF, INLINE, IS, OFFSETOF, PACKED, PAR, PLACE, PLACED, 
		"PORT OF", PRI, PROCESSOR, PROTOCOL, RECORD, RESHAPES,
		RESULT, RETYPES, SEQ, SKIP, STOP, TYPE, VAL, VALOF, WHILE,
		"#PRAGMA", "#USE", "#INCLUDE"
	end keywords

	# Operators
	# I would like if these looked slightly different than the above two,
	# This is not that easy though, as there seem to be no faces specifier
	# which would be appropriate for operators. Maybe I should just merge 
	# them with the keywords
	operators in Keyword_strong are
		AFTER, AND, BITAND, BITNOT, BITOR, BYTESIN, MINUS, NOT,
		OR, PLUS, REM, ROUND, SIZE, TIMES, TRUNC
	end operators

	operators are
		(/(PROC|FUNCTION)([[:blank:]]+)([^ \t(]+)/
		\1 Keyword_strong, \2 Plain, \3 Label_strong)
	end operators

	sequences are
		"--" Comment,
		"-->" Plain #, #This is a comment with a diagram in it... ie want no italics
#		"\"" Plain String "\"" Plain
#			exceptions are
#				"*\""
#			end exceptions
	end sequences
end style