diff options
author | Simon Marlow <simonmar@microsoft.com> | 2006-04-07 02:05:11 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2006-04-07 02:05:11 +0000 |
commit | 0065d5ab628975892cea1ec7303f968c3338cbe1 (patch) | |
tree | 8e2afe0ab48ee33cf95009809d67c9649573ef92 /docs/storage-mgt/code.sty | |
parent | 28a464a75e14cece5db40f2765a29348273ff2d2 (diff) | |
download | haskell-0065d5ab628975892cea1ec7303f968c3338cbe1.tar.gz |
Reorganisation of the source tree
Most of the other users of the fptools build system have migrated to
Cabal, and with the move to darcs we can now flatten the source tree
without losing history, so here goes.
The main change is that the ghc/ subdir is gone, and most of what it
contained is now at the top level. The build system now makes no
pretense at being multi-project, it is just the GHC build system.
No doubt this will break many things, and there will be a period of
instability while we fix the dependencies. A straightforward build
should work, but I haven't yet fixed binary/source distributions.
Changes to the Building Guide will follow, too.
Diffstat (limited to 'docs/storage-mgt/code.sty')
-rw-r--r-- | docs/storage-mgt/code.sty | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/docs/storage-mgt/code.sty b/docs/storage-mgt/code.sty new file mode 100644 index 0000000000..f5ec2f59ee --- /dev/null +++ b/docs/storage-mgt/code.sty @@ -0,0 +1,83 @@ +
+% I have enclosed code.sty, which achieves 99% of what you want without
+% the need for a separate preprocessor. At the start of your document
+% you write "\makeatactive". From then on, inline code is written as @\x
+% -> x_1 & y@. The only difference with what you are used to, is that
+% instead of
+%
+% @
+% foo :: Int -> Int
+% foo = \n -> n+1
+% @
+%
+% you have to write
+%
+% \begin{code}
+% foo :: Int -> Int
+% foo = \n -> n+1
+% \end{code}
+%
+% and that you cannot use @ in \section{} and \caption{}. For the paper that occured twice, in which case I had to replace @...@ b y \texttt{...}.
+%
+%
+% code.sty --- nice verbatim mode for code
+
+\def\icode{%
+ \relax\ifmmode\hbox\else\leavevmode\null\fi
+ \bgroup
+ %\begingroup
+ \@noligs
+ \verbatim@font
+ \verb@eol@error
+ \let\do\@makeother \dospecials
+ \@vobeyspaces
+ \frenchspacing
+ \@icode}
+\def\@icode#1{%
+ \catcode`#1\active
+ \lccode`\~`#1%
+ \lowercase{\let~\icode@egroup}}
+\def\icode@egroup{%
+ %\endgroup}
+ \egroup}
+
+% The \makeatactive command:
+% makes @ active, in such a way that @...@ behaves as \icode@...@:
+{
+\catcode`@=\active
+\gdef\makeatactive{
+ \catcode`@=\active \def@{\icode@}
+ % Since @ becomes active, it has to be taken care of in verbatim-modes:
+ \let\olddospecials\dospecials \def\dospecials{\do\@\olddospecials}}
+}
+% \gdef\makeatother{\g@remfrom@specials{\@}\@makeother\@}
+\gdef\makeatother{\@makeother\@}
+
+\newcommand\codetabwidth{42pt}
+{\catcode`\^^I=\active%
+\gdef\@vobeytab{\catcode`\^^I\active\let^^I\@xobeytab}}
+\def\@xobeytab{\leavevmode\penalty10000\hskip\codetabwidth}
+
+\begingroup \catcode `|=0 \catcode `[= 1
+\catcode`]=2 \catcode `\{=12 \catcode `\}=12
+\catcode`\\=12 |gdef|@xcode#1\end{code}[#1|end[code]]
+|endgroup
+\def\@code{\trivlist \item\relax
+ \if@minipage\else\vskip\parskip\fi
+ \leftskip\@totalleftmargin\rightskip\z@skip
+ \parindent\z@\parfillskip\@flushglue\parskip\z@skip
+ \@@par
+ \@tempswafalse
+ \def\par{%
+ \if@tempswa
+ \leavevmode \null \@@par\penalty\interlinepenalty
+ \else
+ \@tempswatrue
+ \ifhmode\@@par\penalty\interlinepenalty\fi
+ \fi}%
+ \obeylines \verbatim@font \@noligs
+ \let\do\@makeother \dospecials
+ \everypar \expandafter{\the\everypar \unpenalty}%
+}
+\def\code{\@code \frenchspacing\@vobeytab\@vobeyspaces \@xcode}
+\def\endcode{\if@newlist \leavevmode\fi\endtrivlist}
|