gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control systemdiff --git a/build.xml b/build.xml
--- a/build.xml
+++ b/build.xml
<project name="mjc2wsl" default="all">
<project name="mjc2wsl" default="all">
+ <property file="custom.properties"/>
+ <property environment="env"/>
+
+ <condition property="fermat.dir" value="C:\fermat3">
+ <os family="windows" />
+ </condition>
+
+ <condition property="fermat.dir" value="${user.home}/fermat3">
+ <not><os family="windows" /></not>
+ </condition>
+
+
<property name="java.encoding" value="utf-8" />
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property name="mjc2wsl.class.dir" value="bin" />
<property name="mjc2wsl.src.dir" value="src" />
<property name="mjc2wsl.options" value="" />
<property name="java.encoding" value="utf-8" />
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property name="mjc2wsl.class.dir" value="bin" />
<property name="mjc2wsl.src.dir" value="src" />
<property name="mjc2wsl.options" value="" />
-
- <property name="compiler.class.dir" value="compiler-bin" />
- <property name="compiler.src.dir" value="compiler" />
+
+ <property name="res.dir" value="res" />
+
+ <property name="compiler.class.jar" value="lib/mj.jar" />
+ <property name="compiler.class.dir" value="lib/compiler-bin" />
+ <property name="compiler.src.dir" value="lib/compiler-src" />
+ <property name="compiler.classname.compiler" value="MJ.Compiler" />
+ <property name="compiler.classname.interpreter" value="MJ.Run" />
+ <property name="compiler.classname.decoder" value="MJ.Decode" />
<property name="samples.main.dir" value="samples" />
<property name="samples.main.dir" value="samples" />
- <property name="samples.temp.dir" value="samples-temp" />
-
- <property name="fermat.dir" value="/home/donny/d/donny/fermat3" />
+ <property name="samples.temp.dir" value="temp" />
+
+ <property name="transf.wsl.file" value="src-wsl/transf-min.wsl" />
+ <property name="transf.wsl.ini" value="transf.ini" />
+
+ <property name="log.dir" value="logs" />
+ <property name="log.file.transformations" value="${log.dir}/transformations" />
+ <property name="log.file.mjc2wsl" value="${log.dir}/mjc2wsl" />
<description>
Builder script for mjc2wsl and related tools, runs test
on given samples.
<description>
Builder script for mjc2wsl and related tools, runs test
on given samples.
+
+ Also gives options to chain the tools on individual files.
</description>
</description>
-
- <target name="init">
+
+ <!-- general tasks -->
+
+ <target name="init" depends="init-time">
<mkdir dir="${mjc2wsl.class.dir}"/>
<mkdir dir="${compiler.class.dir}"/>
<mkdir dir="${samples.temp.dir}"/>
<mkdir dir="${mjc2wsl.class.dir}"/>
<mkdir dir="${compiler.class.dir}"/>
<mkdir dir="${samples.temp.dir}"/>
+ <mkdir dir="${log.dir}"/>
<copy todir="${samples.temp.dir}">
<fileset dir="${samples.main.dir}">
<include name="*.mj"/>
<copy todir="${samples.temp.dir}">
<fileset dir="${samples.main.dir}">
<include name="*.mj"/>
</copy>
</target>
</copy>
</target>
- <target name="build" depends="init" description="build the mjv2wsl tool">
+ <target name="init-time">
+ <tstamp>
+ <format property="time" pattern="yy-MM-dd--HH-mm-ss"/>
+ </tstamp>
+ </target>
+
+ <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
+ description="build the tools, run them on the samples to check">
+
+ </target>
+
+ <target name="clean" description="clean up all the generated content">
+ <delete includeemptydirs="true">
+ <fileset dir="${mjc2wsl.class.dir}"/>
+ <fileset dir="${compiler.class.dir}"/>
+ <fileset dir="${samples.temp.dir}"/>
+ <fileset dir="${log.dir}"/>
+ </delete>
+ </target>
+
+
+ <!-- mjc2wsl related tasks -->
+
+ <target name="build" depends="init" description="build the mjc2wsl tool">
<javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
</target>
<javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
</target>
+ <target name="mjc2wsl">
+ <echo message="${filename}" />
+ <java classpath="${mjc2wsl.class.dir}:${res.dir}" classname="mjc2wsl">
+ <arg line="${mjc2wsl.options}" />
+ <arg value="${filename}" />
+ </java>
+ </target>
+
+ <target name="mjc2wsl-samples" depends="build,init-time" description="run the mjc2wsl tool on the samples">
+ <record name="${log.file.mjc2wsl}${time}.txt" emacsmode="true" />
+ <echo>Used options:${mjc2wsl.options}</echo>
+ <foreach param="filename" target="mjc2wsl">
+ <path>
+ <fileset dir='${samples.temp.dir}'>
+ <include name="*.obj"/>
+ </fileset>
+ </path>
+ </foreach>
+ <record name="${log.file.mjc2wsl}${time}.txt" action="stop" />
+ <copy file="${log.file.mjc2wsl}${time}.txt" tofile="${log.file.mjc2wsl}.txt"/>
+ </target>
+
+ <target name="mjc2wsl-samples1" depends="build">
+ <!-- simplistic version when antlib (foreach) is not available -->
+ <antcall target="mjc2wsl">
+ <param name="filename" value="samples-temp/sample0.obj" />
+ </antcall>
+ </target>
+
+
+ <!-- MicroJava related tasks -->
+
+
<target name="mj-build" depends="init" description="build the mj compiler">
<javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
</target>
<target name="mj-build" depends="init" description="build the mj compiler">
<javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
</target>
- <target name="mj-compile">
+ <target name="mj-compile" description="compile a MJ into obj file; given ${filename}">
<echo message="${filename}" />
<echo message="${filename}" />
- <java classpath="${compiler.class.dir}" classname="Compiler">
+ <java classpath="${compiler.class.dir}:${compiler.class.jar}" classname="${compiler.classname.compiler}">
<arg value="${filename}" />
</java>
</target>
<arg value="${filename}" />
</java>
</target>
- <target name="mj-samples" depends="build" description="run the mj compiler on the samples">
+ <target name="mj-samples" description="run the mj compiler on the samples" depends="init">
<foreach param="filename" target="mj-compile">
<path>
<fileset dir='${samples.temp.dir}'>
<foreach param="filename" target="mj-compile">
<path>
<fileset dir='${samples.temp.dir}'>
</foreach>
</target>
</foreach>
</target>
- <target name="mj-samples1" depends="mj-build">
- <!-- simplistic version when antlib (foreach) is not available -->
- <antcall target="mj-compile">
- <param name="filename" value="samples-temp/sample.mj" />
- </antcall>
- <antcall target="mj-compile">
- <param name="filename" value="samples-temp/sample1.mj" />
- </antcall>
- <antcall target="mj-compile">
- <param name="filename" value="samples-temp/sample0.mj" />
- </antcall>
- </target>
-
- <target name="mjc2wsl">
+ <target name="mj-decode" description="decode a MJ obj file given in ${filename}">
<echo message="${filename}" />
<echo message="${filename}" />
- <java classpath="${mjc2wsl.class.dir}" classname="mjc2wsl">
- <arg line="${mjc2wsl.options}" />
+ <java classpath="${compiler.class.dir}:${compiler.class.jar}" classname="${compiler.classname.decoder}">
<arg value="${filename}" />
</java>
</target>
<arg value="${filename}" />
</java>
</target>
- <target name="mjc2wsl-samples" depends="build">
- <foreach param="filename" target="mjc2wsl">
+ <target name="mj-decode-samples" description="decode all of the compiled samples and save into file 'decoded.txt'">
+ <record name="${samples.temp.dir}/decoded.txt" emacsmode="true" loglevel="info"/>
+ <foreach param="filename" target="mj-decode">
<path>
<fileset dir='${samples.temp.dir}'>
<include name="*.obj"/>
</fileset>
</path>
</foreach>
<path>
<fileset dir='${samples.temp.dir}'>
<include name="*.obj"/>
</fileset>
</path>
</foreach>
+ <record name="${samples.temp.dir}/decoded.txt" action="stop"/>
</target>
</target>
- <target name="mjc2wsl-samples1" depends="build">
+ <target name="mj-run" description="run a MJ obj file given in ${filename} with ${inputstring}">
+ <echo message="${filename}" />
+ <java classpath="${compiler.class.dir}:${compiler.class.jar}" classname="${compiler.classname.interpreter}" inputstring="${inputstring}">
+ <arg value="${filename}" />
+ </java>
+ </target>
+
+ <target name="mj-samples1" depends="mj-build">
<!-- simplistic version when antlib (foreach) is not available -->
<!-- simplistic version when antlib (foreach) is not available -->
- <antcall target="mjc2wsl">
- <param name="filename" value="samples-temp/sample0.obj" />
+ <antcall target="mj-compile">
+ <param name="filename" value="samples-temp/sample.mj" />
+ </antcall>
+ <antcall target="mj-compile">
+ <param name="filename" value="samples-temp/sample1.mj" />
+ </antcall>
+ <antcall target="mj-compile">
+ <param name="filename" value="samples-temp/sample0.mj" />
</antcall>
</target>
</antcall>
</target>
-
+
+
+ <!-- wsl related tasks -->
+
<target name="wsl-run" >
<target name="wsl-run" >
- <exec executable="${fermat.dir}/bin/wsl" >
- <env key="PATH" path="${env.PATH}:${fermat.dir}/bin"/>
+ <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
+ <env key="PATH" path="${fermat.dir}/bin:${env.PATH}"/>
<env key="FermaT" path="${fermat.dir}" />
<env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
<env key="FermaT" path="${fermat.dir}" />
<env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
- <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e5.scm" />
+ <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e7.scm" />
<arg value="${filename}"/>
</exec>
</target>
<arg value="${filename}"/>
</exec>
</target>
- <target name="wsl-transf" depends="make-transf-ini"
+ <target name="wsl-transf"
+ description="transform (simplify) a single wsl file generated by mjc2wsl">
+ <delete file="${transf.wsl.ini}"/>
+
+ <antcall target="wsl-run">
+ <param name="filename" value="${transf.wsl.file}" />
+ <param name="inputstring" value="${transf.filename}" />
+ </antcall>
+ </target>
+
+ <target name="wsl-transf-samples" depends="init-time,make-transf-ini-samples"
description="transform (simplify) the wsl files generated by mjc2wsl">
description="transform (simplify) the wsl files generated by mjc2wsl">
+ <record name="${log.file.transformations}${time}.txt" emacsmode="true" />
<antcall target="wsl-run">
<antcall target="wsl-run">
- <param name="filename" value="src-wsl/transf-min.wsl" />
+ <param name="filename" value="${transf.wsl.file}" />
</antcall>
</antcall>
+ <record name="${log.file.transformations}${time}.txt" action="stop" />
+ <copy file="${log.file.transformations}${time}.txt" tofile="${log.file.transformations}.txt"/>
</target>
</target>
- <target name="make-transf-ini">
+ <target name="make-transf-ini-samples">
<fileset dir="${samples.temp.dir}" casesensitive="no" id="generated-wsl-fileset">
<fileset dir="${samples.temp.dir}" casesensitive="no" id="generated-wsl-fileset">
- <patternset id="non.test.sources">
+ <patternset id="non.transformed.sources">
<include name="**/*.wsl"/>
<exclude name="**/*_t.wsl"/>
</patternset>
</fileset>
<include name="**/*.wsl"/>
<exclude name="**/*_t.wsl"/>
</patternset>
</fileset>
- <pathconvert pathsep="${line.separator}" property="generated-wsl-files" refid="generated-wsl-fileset">
-
- </pathconvert>
+ <pathconvert pathsep="${line.separator}"
+ property="generated-wsl-files" refid="generated-wsl-fileset" />
- <echo file="transf.ini">${generated-wsl-files}</echo>
+ <echo file="${transf.wsl.ini}">${generated-wsl-files}</echo>
</target>
</target>
- <target name="all" depends='mj-samples,mjc2wsl-samples' description="build the tools, run them on the samples to check">
+ <!-- Testing tasks -->
+ <target name="test-run"
+ description="run .obj .wsl _t.wsl, given are ${file.dir}, ${file.name} (no extension) and an ${inputstring}">
+ <antcall target="mj-run">
+ <param name="filename" value="${file.dir}/${file.name}.obj" />
+ <param name="inputstring" value="${inputstring}" />
+ </antcall>
+ <antcall target="wsl-run">
+ <param name="filename" value="${file.dir}/${file.name}.wsl" />
+ <param name="inputstring" value="${inputstring}" />
+ </antcall>
+ <antcall target="wsl-run">
+ <param name="filename" value="${file.dir}/${file.name}_t.wsl" />
+ <param name="inputstring" value="${inputstring}" />
+ </antcall>
</target>
</target>
- <target name="clean" description="clean up all the generated content">
- <delete includeemptydirs="true">
- <fileset dir=".">
- <include name="${mjc2wsl.class.dir}/*.class"/>
- <include name="${compiler.class.dir}/*.class"/>
- <include name="${samples.temp.dir}/*"/>
- </fileset>
- <dirset dir=".">
- <include name="${mjc2wsl.class.dir}"/>
- <include name="${compiler.class.dir}"/>
- <include name="${samples.temp.dir}"/>
- </dirset>
- </delete>
+ <target name="test-run-samples-dir"
+ description="run .obj .wsl _t.wsl, in the samples-temp directory; given ${file.name} (no extension) and an ${inputstring}">
+ <antcall target="test-run">
+ <param name="file.dir" value="${samples.temp.dir}"/>
+ </antcall>
</target>
<!-- jedit specific flags; needs to be the first or the last 10 lines
</target>
<!-- jedit specific flags; needs to be the first or the last 10 lines