gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
ant - new tasks for making parallel code stages display in a pdf
authorDoni Pracner <quinnuendo@gmail.com>
Thu, 4 Dec 2014 00:30:44 +0000 (01:30 +0100)
committerDoni Pracner <quinnuendo@gmail.com>
Thu, 4 Dec 2014 00:30:44 +0000 (01:30 +0100)
build.xml
lib/tex/comparison-end.tex [new file with mode: 0644]
lib/tex/comparison-start.tex [new file with mode: 0644]

index f8bde04..206065d 100644 (file)
--- a/build.xml
+++ b/build.xml
             includes="*/*.wsl"/>
     </target>
 
             includes="*/*.wsl"/>
     </target>
 
+
+    <!-- output a comparison Latex file and compile it -->
+
+    <target name="output-comparison-pdf-single">
+        <basename property="file.name" file="${filename}" suffix=".obj"/>
+        <echo append='true' file="${samples.temp.dir}/tex/comparison.tex">
+        \section{${file.name}}
+        \begin{paracol}{4}
+        \lstinputlisting[style=mj]{../${file.name}.mj}
+        \switchcolumn
+        \lstinputlisting[style=decoded]{../${file.name}.obj.decoded}
+        \switchcolumn
+        \lstinputlisting[style=wsl,lastline=200]{../${file.name}.wsl}
+        \switchcolumn
+        \lstinputlisting[style=wslt,lastline=200]{../${file.name}${transf.wsl.ext}}
+        \end{paracol}
+        </echo>
+    </target>
+    
+    <target name="output-comparison-pdf"
+        description="Makes a parallel display in Latex and produces a pdf (tex dir in temp dir)" >
+
+        <copy file="lib/tex/comparison-start.tex" overwrite="true" 
+            tofile="${samples.temp.dir}/tex/comparison.tex"/>
+        <foreach param="filename" target="output-comparison-pdf-single" inheritall="true">
+            <path>
+            <fileset dir='${samples.temp.dir}'>
+                <include name="*.obj"/>
+            </fileset>
+            </path>
+        </foreach>
+        <concat destfile="${samples.temp.dir}/tex/comparison.tex" append="true">
+            <filelist dir="lib/tex" files="comparison-end.tex"/>
+        </concat>
+        <antcall target="output-comparison-compile"/>
+    </target>
+    
+    <target name="output-comparison-compile">
+        <exec command="pdflatex comparison.tex"
+              dir="${samples.temp.dir}/tex"/>
+    </target>
+
     <!-- jedit specific flags; needs to be the first or the last 10 lines
     :noTabs=true:
     -->
     <!-- jedit specific flags; needs to be the first or the last 10 lines
     :noTabs=true:
     -->
diff --git a/lib/tex/comparison-end.tex b/lib/tex/comparison-end.tex
new file mode 100644 (file)
index 0000000..87d10d7
--- /dev/null
@@ -0,0 +1,2 @@
+
+\end{document}
diff --git a/lib/tex/comparison-start.tex b/lib/tex/comparison-start.tex
new file mode 100644 (file)
index 0000000..5fdc2c0
--- /dev/null
@@ -0,0 +1,81 @@
+\documentclass[a4paper,landscape]{article}
+
+\usepackage[top=2cm, bottom=1.5cm, left=1cm, right=1cm]{geometry}
+
+\usepackage{graphicx}
+
+\usepackage{listings}
+
+\usepackage{paracol}
+
+\usepackage{courier}
+
+\usepackage[bookmarks,pdffitwindow=false,unicode=true]{hyperref}
+
+
+\lstloadlanguages{Java}
+
+\lstdefinelanguage{wsl}{
+       morekeywords = {CALL,IF,THEN,ELSE,FI,SKIP,ACTIONS,ENDACTIONS,PRINT,END,WHILE,VAR,ARRAY,PRINFLUSH,HEAD,TAIL,BEGIN,POP,PUSH,DO,OD,WHERE,ENDVAR,PROC},
+    comment=[s]{C:"}{"},
+       sensitive = true
+}
+
+\lstset{
+       basicstyle=\footnotesize\ttfamily,
+        breaklines=true,
+        keywordstyle=\textbf,
+        columns=[l]fixed,
+        tabsize=2,
+%        breakatwhitespace=true
+%        prebreak=\P,
+%        postbreak=\ding{229}\space,
+       showstringspaces=true
+}
+
+\lstdefinestyle{mj}{
+  %style=codeblock,
+  numbers=left,
+  language=Java
+}
+
+\lstdefinestyle{decoded}{
+  %style=codeblock,
+       breakatwhitespace=false
+}
+
+\lstdefinestyle{wsl}{
+       language=wsl,
+       basicstyle=\scriptsize\ttfamily
+}
+
+\lstdefinestyle{wslt}{
+  style=wsl,
+  basicstyle=\footnotesize\ttfamily
+}
+
+\columnratio{0.2, 0.1,0.4,0.3}
+
+\title{Comparison of various stages of code in MJC2WSL}
+
+\author{automatically generated}
+
+\begin{document}
+
+\maketitle
+
+\tableofcontents
+
+\newpage
+
+\emph{Outputs longer than 200 lines are cut off.}
+
+\begin{paracol}{4}
+Original code - MicroJava
+\switchcolumn
+Compiled into bytecode and decoded
+\switchcolumn
+Translated bytecode to WSL
+\switchcolumn
+Automatically transformed WSL
+\end{paracol}
\ No newline at end of file
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner