From d9bb12dc1faeee541c8a41eea4df8cf64aeae9fd Mon Sep 17 00:00:00 2001
From: Nelson Lossing <lnellos@gmail.com>
Date: Mon, 24 Feb 2014 17:36:45 +0100
Subject: [PATCH 1/1] add template to describe transformer

---
 pipstransfo.bib | 11 +++++++++
 pipstransfo.tex | 63 ++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 73 insertions(+), 1 deletion(-)

diff --git a/pipstransfo.bib b/pipstransfo.bib
index a58ca61..e8e63c0 100644
--- a/pipstransfo.bib
+++ b/pipstransfo.bib
@@ -1,4 +1,15 @@
 
+@book{aho_compilers_2007,
+	address = {Boston},
+	title = {Compilers: principles, techniques, \& tools},
+	isbn = {0321486811  9780321486813 0321491696 9780321491695},
+	shorttitle = {Compilers},
+	language = {English},
+	publisher = {{Pearson/Addison} Wesley},
+	author = {Aho, Alfred V and Lam, Monica S. and Sethi, Ravi and Ullman, Jeffrey},
+	year = {2007}
+}
+
 @book{darte_scheduling_2000,
 	address = {Boston},
 	title = {Scheduling and automatic parallelization},
diff --git a/pipstransfo.tex b/pipstransfo.tex
index f7be25f..60b8709 100644
--- a/pipstransfo.tex
+++ b/pipstransfo.tex
@@ -9,14 +9,73 @@
 \usepackage{hyperref}
 \usepackage{xspace}
 
-\newcommand\PIPS{PIPS\xspace}
+\usepackage{makeidx}
+
+\usepackage{etoolbox}
+
+\newcommand{\PIPS}{PIPS\xspace}
+
+% Patch the sectioning commands to provide a hook to be used later
+\preto{\chapter}{\def\leveltitle{\chaptertitle}}
+\preto{\section}{\def\leveltitle{\sectiontitle}}
+\preto{\subsection}{\def\leveltitle{\subsectiontitle}}
+\preto{\subsubsection}{\def\leveltitle{\subsubsectiontitle}}
+
+\makeatletter
+% \@sect is called with normal sectioning commands
+% Argument #8 to \@sect is the title
+% Thus \section{Title} will do \gdef\sectiontitle{Title}
+\pretocmd{\@sect}
+  {\expandafter\gdef\leveltitle{#8}}
+  {}{}
+% \@ssect is called with *-sectioning commands
+% Argument #5 to \@ssect is the title
+\pretocmd{\@ssect}
+  {\expandafter\gdef\leveltitle{#5}}
+  {}{}
+% \@chapter is called by \chapter (without *)
+% Argument #2 to \@chapter is the title
+\pretocmd{\@chapter}
+  {\expandafter\gdef\leveltitle{#2}}
+  {}{}
+% \@schapter is called with \chapter*
+% Argument #1 to \@schapter is the title
+\pretocmd{\@schapter}
+  {\expandafter\gdef\leveltitle{#1}}
+  {}{}
+\makeatother
+
+\newcommand{\PIPSPass}{Pass Name in \PIPS : }
+\newcommand{\PIPSExamples}{Validation folder in \PIPS : }
+\newcommand{\BookRef}{Reference: }
+\newcommand{\NameCommun}[1]{\subsection{#1}\index{\sectiontitle!\subsectiontitle}}
+\newcommand{\NamePipsPass}[1]{\xspace#1\index{\sectiontitle!\subsectiontitle!#1}\xspace}
+
 
 \title{\PIPS~--- List of code transformations}
 
+\makeindex
+
 \begin{document}
 
 \chapter{Summary}
 
+\section{Section Name}
+
+\NameCommun{Commun Transformation Name}
+Description...
+
+\PIPSPass \NamePipsPass{toto}, \NamePipsPass{toto2}, \NamePipsPass{toto3}
+
+\PIPSExamples toto
+
+\BookRef \cite[p. xxx]{darte_scheduling_2000},
+\cite[p. xxx]{wolfe_high_1996},
+\cite[p. xxx]{zima_supercompilers_1990},
+\cite[p. xxx]{dowd_high_1998},
+\cite[p. xxx]{aho_compilers_2007},
+\cite[p. xxx]{allen_optimizing_2001}
+
 \section{SGuelton}
 
 \begin{itemize}
@@ -217,4 +276,6 @@ A prologue and an epilogue are added to copy old variable values to new variable
 \bibliographystyle{alpha}
 \bibliography{\jobname}
 
+\printindex
+
 \end{document}
-- 
2.20.1