summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/vdmlisting
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/vdmlisting
Initial commit
Diffstat (limited to 'macros/latex/contrib/vdmlisting')
-rw-r--r--macros/latex/contrib/vdmlisting/README9
-rw-r--r--macros/latex/contrib/vdmlisting/vdmlisting.pdfbin0 -> 75045 bytes
-rw-r--r--macros/latex/contrib/vdmlisting/vdmlisting.sty171
-rw-r--r--macros/latex/contrib/vdmlisting/vdmlisting.tex142
4 files changed, 322 insertions, 0 deletions
diff --git a/macros/latex/contrib/vdmlisting/README b/macros/latex/contrib/vdmlisting/README
new file mode 100644
index 0000000000..66383edd17
--- /dev/null
+++ b/macros/latex/contrib/vdmlisting/README
@@ -0,0 +1,9 @@
+VdmListing package
+Copyright 2012--2013 Kenneth Lausdahl (the package)
+Released under the LaTeX Project Public License 1.3 or later
+
+The `vdmlisting' package is an extension for the 'listings'
+package that provides a source code printer for LaTeX.
+This package defines new language definitions and listing
+environments for the three language dialects of the
+Vienna Development Method: VDM-SL, VDM-PP and VDM-RT. \ No newline at end of file
diff --git a/macros/latex/contrib/vdmlisting/vdmlisting.pdf b/macros/latex/contrib/vdmlisting/vdmlisting.pdf
new file mode 100644
index 0000000000..136708dbd5
--- /dev/null
+++ b/macros/latex/contrib/vdmlisting/vdmlisting.pdf
Binary files differ
diff --git a/macros/latex/contrib/vdmlisting/vdmlisting.sty b/macros/latex/contrib/vdmlisting/vdmlisting.sty
new file mode 100644
index 0000000000..619fb34df2
--- /dev/null
+++ b/macros/latex/contrib/vdmlisting/vdmlisting.sty
@@ -0,0 +1,171 @@
+%%
+%% This is file `vdmlisting.sty',
+%%
+%%
+%% Please read the software license in vdmlisting.pdf.
+%%
+%% (w)(c) 2010--2013 Kenneth Lausdahl and/or any other author listed
+%% elsewhere in this file.
+%% (c) 2013 Kenneth Lausdahl
+%%
+%%
+\def\filedate{2013/04/10}
+\def\fileversion{1.0}
+\NeedsTeXFormat{LaTeX2e}
+\AtEndOfPackage{\ProvidesPackage{vdmlisting}
+ [\filedate\space\fileversion\space(Kenneth Lausdahl)]}
+\def\lst@CheckVersion#1{\edef\reserved@a{#1}%
+ \ifx\lst@version\reserved@a \expandafter\@gobble
+ \else \expandafter\@firstofone \fi}
+\let\lst@version\fileversion
+
+\RequirePackage{listings}
+
+%define load option flags
+\newif\ifnotimes
+\newif\ifenablecolors
+
+\DeclareOption{notimes}{
+ \notimestrue
+}
+
+\DeclareOption{color}{
+ \enablecolorstrue
+}
+
+\ProcessOptions\relax
+
+\ifnotimes
+%
+\else
+ \RequirePackage{times}
+\fi
+
+\ifenablecolors
+ \RequirePackage{color}
+ \definecolor{notovered}{rgb}{1,0,0} %red
+% Custom macro used to color uncoverage model parts in listings
+ \newcommand{\vdmnotcovered}[1]{\textcolor{notovered}{#1}}
+\else
+\newcommand{\vdmnotcovered}[1]{#1}
+\fi
+
+%
+%configure listing style and language
+%
+
+\lstdefinelanguage{VDM_SL}
+ {morekeywords={RESULT, abs, all, always, and, as, be, be st, bool, by, card, cases, char, comp, compose,
+conc, dcl, def, definitions, dinter, div, dlmodule, do, dom, dunion, elems, else, elseif, end,
+ error, errs, exists, exists1, exit, exports, ext, false, floor, for, for all, forall, from,
+ functions, hd, if, imports, in, in set, inds, init, inmap, int, inter, inv, inverse, iota,
+ is not yet specified, lambda, len, let, map, measure, merge, mod, module, mu, munion, nat, nat1,
+ nil, not, not in set, of, operations, or, others, post, power, pre, psubset, rat, rd, real, rem,
+ renamed, return, reverse, rng, seq, seq1, set, skip, specified, st, state, struct, subset, then,
+ tixe, tl, to, token, traces, trap, true, types, undefined, union, uselib, values, while, with, wr,
+ yet,mk\_ },
+ sensitive,
+ morecomment=[l]--,
+ morestring=[b]",
+ morestring=[b]',
+ }[keywords,comments,strings]
+
+\lstdefinelanguage{VDM_PP}
+ {morekeywords={\#act, \#active, \#fin, \#req, \#waiting,
+ RESULT, abs, all, always, and, async, atomic, be, be st, bool, by, card, cases, char, class,
+ comp, compose, conc, dcl, def, dinter, div, do, dom, dunion, elems, else, elseif, end, error,
+ errs, exists, exists1, exit, ext, false, floor, for, for all, forall, from, functions, hd, if,
+ in, in set, inds, inmap, instance, instance variables, int, inter, inv, inverse, iota, is,
+ is not yet specified, is subclass of, is subclass responsibility, isofbaseclass, isofclass,
+ lambda, len, let, map, measure, merge, mod, mu, munion, mutex, nat, nat1, new, nil, not, not in set,
+ of, operations, or, others, per, periodic, post, power, pre, private, protected, psubset, public, rat,
+ rd, real, rem, responsibility, return, reverse, rng, samebaseclass, sameclass, self, seq, seq1, set,
+ skip, specified, st, start, startlist, static, subclass, subset, sync, then, thread, threadid, tixe,
+ tl, to, token, traces, trap, true, types, undefined, union, values, variables, while, with, wr, yet,mk\_ },
+ sensitive,
+ morecomment=[l]--,
+ morestring=[b]",
+ morestring=[b]',
+ }[keywords,comments,strings]
+
+\lstdefinelanguage{VDM_RT}
+ {morekeywords={\#act, \#active, \#fin, \#req, \#waiting,
+RESULT, abs, all, always, and, async, atomic, be, be st, bool, by, card, cases,
+char, class, comp, compose, conc, cycles, dcl, def, dinter, div, do, dom, dunion,
+duration, elems, else, elseif, end, error, errs, exists, exists1, exit, ext, false,
+floor, for, for all, forall, from, functions, hd, if, in, in set, inds, inmap, instance,
+ instance variables, int, inter, inv, inverse, iota, is, is not yet specified, is subclass of,
+ is subclass responsibility, isofbaseclass, isofclass, lambda, len, let, map, measure, merge, mod,
+ mu, munion, mutex, nat, nat1, new, nil, not, not in set, of, operations, or, others, per, periodic,
+ post, power, pre, private, protected, psubset, public, rat, rd, real, rem, responsibility, return,
+ reverse, rng, samebaseclass, sameclass, self, seq, seq1, set, skip, specified, st, start, startlist,
+ static, subclass, subset, sync, system, then, thread, threadid, time, tixe, tl, to, token, traces,
+ trap, true, types, undefined, union, values, variables, while, with, wr, yet,mk\_ },
+ sensitive,
+ morecomment=[l]--,
+ morestring=[b]",
+ morestring=[b]',
+ }[keywords,comments,strings]
+
+
+%
+% Define listing for the VDM language
+%
+\lstdefinestyle{overtureLanguageStyle}{basicstyle=\footnotesize\ttfamily,
+ frame=trBL,
+ tabsize=2,
+ linewidth=\textwidth,
+ showstringspaces=false,
+ captionpos=b,
+ frameround=fttt,
+ aboveskip=5mm,
+ belowskip=5mm,
+ framexleftmargin=0mm,
+ framexrightmargin=0mm,
+ escapeinside={(*@}{@*)},
+ language=VDM_SL}
+
+
+% define listing environments
+
+
+
+% Environment definition for VDM blocks
+% The listing environment vdm_al is reset to the default overture style and default dialect each time one of the overture listing environments are used.
+% All listing environments are defined to take an optional parameter of the type \lstset which is applied as the last on in the environment allowing the user to change the defaults if desired:
+%\begin{vdm_al}[\lstset{numbers=left}]
+
+%Default VDM Listing: language is set by the project from which it has been generated from.
+\lstnewenvironment{vdm_al}[1][]{\lstset{style=overtureLanguageStyle}\lstset{language=VDM_RT}\lstset{#1}}
+{}
+
+\lstnewenvironment{vdmsl}[1][]{\lstset{style=overtureLanguageStyle}\lstset{language=VDM_SL}\lstset{#1}}
+{}
+
+\lstnewenvironment{vdmpp}[1][]{\lstset{style=overtureLanguageStyle}\lstset{language=VDM_PP}\lstset{#1}}
+{}
+
+\lstnewenvironment{vdmrt}[1][]{\lstset{style=overtureLanguageStyle}\lstset{language=VDM_RT}\lstset{#1}}
+{}
+
+% Environment definition for test coverage use by VDM Tools
+\lstnewenvironment{vdmrealtimeinfo}{}
+{}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/vdmlisting/vdmlisting.tex b/macros/latex/contrib/vdmlisting/vdmlisting.tex
new file mode 100644
index 0000000000..673b61a6aa
--- /dev/null
+++ b/macros/latex/contrib/vdmlisting/vdmlisting.tex
@@ -0,0 +1,142 @@
+
+
+\documentclass[times]{article}
+
+\usepackage{vdmlisting}
+\usepackage{hyperref}
+\usepackage{vdm}
+\def\vdmlisting{\texttt{vdmlisting}}
+\def\envvdmsl{\texttt{vdmsl}}
+\def\envvdmpp{\texttt{vdmpp}}
+\def\envvdmrt{\texttt{vdmrt}}
+
+\title{The \textbf{\vdmlisting} Package}
+\author{Kenneth Lausdahl\\
+Dept. of Engineering\\
+Aarhus University\\
+Denmark.\\
+\texttt{lausdahl@cs.au.dk}}
+\date{10 April 2013 \\
+Version 1.0}
+
+
+
+
+\begin{document}
+
+
+\maketitle
+\begin{abstract}
+The \vdmlisting package is a Vienna Development Method (VDM) source code printer for \LaTeX . The package uses the listings package and provides a number of new listing environments for the three VDM dialects: VDM-SL,VDM-PP and VDM-RT. If one wants to typeset VDM with a mathematical syntax instead of the ASCII syntax used here then use the \texttt{vdm} package instead.
+\end{abstract}
+
+\tableofcontents
+
+\section{Getting started}
+
+Before using the \vdmlisting package, you should be familiar with the \LaTeX typesetting system and the listings package which this packages depends upon.
+
+\subsection{A minimal example}
+Here is a minimal file for \vdmlisting showing a VDM function:
+
+
+\begin{verbatim}
+ \documentstyle{article}
+ \usepackage{vdmlisting}
+
+ \begin{document}
+ \begin{vdmsl}
+ add : int * int ->
+ add(a,b) == a+b;
+ \end{vdmsl}
+ \end{document}
+\end{verbatim}
+
+
+
+\subsection{Typesetting VDM with listings}
+This package defined three listing environments that can be used to typeset VDM. The environments are defined as:
+
+\begin{verbatim}
+\begin{listing-name}[options]
+ VDM specification
+\end{listing-name}
+\end{verbatim}
+
+\noindent The \texttt{options} are parsed directly to the \texttt{lstlisting} environment and could be used to e.g. set the label or caption like \texttt{label=lst:mymodel,caption=My special specification}. The \texttt{listing-name} may be any of the following:
+
+\begin{description}
+\item[\envvdmsl] The \envvdmsl environment configures the listing environment to use the VDM-SL language definition:
+
+\begin{verbatim}
+\begin{vdmsl}[label=lst:mymodule,caption=My module]
+ module MyModule
+ end MyModule
+\end{vdmsl}
+\end{verbatim}
+ it typesets as follows:
+
+\begin{vdmsl}[label=lst:mymodule,caption=My module]
+ module MyModule
+ end MyModule
+\end{vdmsl}
+
+\item[\envvdmpp] The \envvdmpp environment configures the listing environment to use the VDM-PP language definition:
+
+\begin{verbatim}
+\begin{vdmpp}[label=lst:myclass,caption=My Class]
+ class MyClass
+ end MyClass
+\end{vdmpp}
+\end{verbatim}
+ it typesets as follows:
+
+\begin{vdmpp}[label=lst:myclass,caption=My Class]
+ class MyClass
+ end MyClass
+\end{vdmpp}
+
+\item[\envvdmrt] The \envvdmrt environment configures the listing environment to use the VDM-RT language definition:
+
+\begin{verbatim}
+\begin{vdmrt}[label=lst:myclass,caption=My System]
+ system MySystem
+ end MySystem
+\end{vdmrt}
+\end{verbatim}
+ it typesets as follows:
+
+\begin{vdmrt}[label=lst:myclass,caption=My System]
+ system MySystem
+ end MySystem
+\end{vdmrt}
+
+
+\end{description}
+
+Furthermore, the environments are configured with \texttt{escapeinside=\{(*@\}\{@*)\}} enabling the command \texttt{\textbackslash vdmnotcovered\{ VDM specification\}} to be used to mark execution coverage for the VDM specification displayed.
+
+\section{Package loading}
+As usual in \LaTeX, the package is loaded by \texttt{\textbackslash usepackage[optionsi]\{vdmlisting\}},
+where [optionsi] is optional and gives a comma separated list of options:
+
+\begin{description}
+
+\item[color] This loads the \texttt{color} package and defines the \texttt{vdmnotcovered} command to use a red color.
+
+\item[notimes] This package loads the \texttt{times} package, by default, so if you do not want that to happen use this option to skip the load of \texttt{times}.
+
+\end{description}
+
+
+
+\section{Installing the \vdmlisting \ files}
+
+Place the file {\tt vdmlisting.sty} in your standard directory for \LaTeX\
+style files (your system administrator will know where this is).
+
+
+\section{The License}
+The vdmlisting.sty and vdmlisting.tex file is copyright 2012--2013 Kenneth Lausdahl and is released under the LaTeX Project Public License 1.3 or later.
+
+\end{document}