Release coccinelle-0.1.11rc1
[bpt/coccinelle.git] / docs / manual / python.tex
1 \documentclass{article}
2 \usepackage{listings}
3
4 \begin{document}
5 \section{Python API from SmPL}
6 \label{sec:python-api}
7
8 \subsection{Output mode}
9 \label{sec:output}
10
11 \begin{tabular}{lp{8cm}}
12 \texttt{-pyoutput coccilib.output.Console}& To output on the console \\
13 \texttt{-pyoutput coccilib.output.Gtk} & To output on a Gtk frame \\
14 \end{tabular}
15
16 \subsection{Org mode}
17 \label{sec:orgmode}
18
19 \begin{tabular}{lp{8cm}}
20 \texttt{cocci.print\_main}& For the main position \\
21 \texttt{cocci.print\_sec} & For the secondary position \\
22 \texttt{cocci.print\_secs}& For a set of secondary positions \\
23 \end{tabular}
24
25 \begin{lstlisting}
26 def print_main(p, msg="", color="ovl-face1") :
27 print "* TODO [[view:%s::face=%s::linb=%s::colb=%s::cole=%s][%s %s::%s]]" % (p[0].file,color,p[0].line,p[0].column,p[0].column_end,msg,p[0].file,p[0].line)
28
29 def print_sec(p, msg="", color="ovl-face2") :
30 print "[[view:%s::face=%s::linb=%s::colb=%s::cole=%s][%s]]" % (p[0].file,color,p[0].line,p[0].column,p[0].column_end,msg)
31
32 def print_secs(ps, msg="", color="ovl-face2") :
33 for i in ps:
34 print "[[view:%s::face=%s::linb=%s::colb=%s::cole=%s][%s]]" % (i.file,color,i.line,i.column,i.column_end,msg)
35 \end{lstlisting}
36
37 %\subsection{Trac}
38 %\label{sec:trac}
39
40
41 \end{document}
42
43 %%% Local Variables:
44 %%% mode: LaTeX
45 %%% TeX-master: "python"
46 %%% coding: latin-9
47 %%% TeX-PDF-mode: t
48 %%% ispell-local-dictionary: "american"
49 %%% End: