\subsection{What is \texttt{spgen}?}
\texttt{spgen} is a \texttt{Coccinelle}\footnote{\hyperref[http://coccinelle.lip6.fr/]{http://coccinelle.lip6.fr/}} metaprogramming tool that can generate hardened semantic patches for use in e.g. the Linux kernel.\\
Or, in less fancy words, \texttt{spgen} can take your simple \texttt{Coccinelle} script containing one or more rules with \texttt{*}, \texttt{+}, or \texttt{-}, and then output the same script with more options.\\\\
In particular, \texttt{spgen} generates the \texttt{patch}, \texttt{context}, \texttt{org}, and \texttt{report} virtual rules. These options are prevalent in the \texttt{Coccinelle} scripts included in the Linux kernel and are used in the following cases:
\begin{itemize}
\item \texttt{patch}: Used for +/- rules that transform the matched \texttt{C} code and output the changes in Unix \texttt{diff} format.
\item \texttt{context}: Used for * rules that find the matched \texttt{C} code and output it in \texttt{diff}-like format.
\item \texttt{org}: Used for script rules that output matches in
  \texttt{emacs} org mode
  format\footnote{\hyperref[http://orgmode.org/]{http://orgmode.org/}} with
  an error message and line numbers.
\item \texttt{report}: Used for script rules that output matches with an error message and line numbers.
\end{itemize}
\bigskip

\subsection{Features}
\texttt{spgen} includes (but is not limited to) support for
\begin{itemize}
\item Generating a \texttt{context} (aka *) version of a \texttt{patch} (aka +/-) rule.
\item Generating \texttt{org} and \texttt{report} (aka script) versions of both \texttt{patch} and \texttt{context} rules.
\item Adding \texttt{patch}, \texttt{context}, \texttt{org}, and \texttt{report} dependencies to rule headers.
\item Allowing the user to specify preface information for the generated rule, such as keywords, options, etc. as well as error messages for rules and names for nameless rules.
\item Automatic rulename and error message generation when none specified by the user.
\item Rule splitting to ensure correct \texttt{context} mode output for rules containing pattern matching disjunctions.
\item And more ...
\end{itemize}
