diff options
author | David Schweinsberg <[email protected]> | 2016-01-04 18:25:38 -0800 |
---|---|---|
committer | David Schweinsberg <[email protected]> | 2016-01-04 18:25:38 -0800 |
commit | 732313e8447c7d76986478d8fcd8ba716f8894c7 (patch) | |
tree | f7b3325563956526f84dc34d6ebf331376ef939c | |
parent | 49b6c2a3a3d852a31c8a09ae49e1ab953eec318b (diff) |
Added SLF4J & Logback
-rw-r--r-- | nbproject/build-impl.xml | 19 | ||||
-rw-r--r-- | nbproject/genfiles.properties | 4 | ||||
-rw-r--r-- | nbproject/project.properties | 23 | ||||
-rw-r--r-- | nbproject/project.xml | 1 | ||||
-rw-r--r-- | resources/logback.xml | 12 | ||||
-rw-r--r-- | src/net/java/dev/typecast/cff/T2Interpreter.java | 26 |
6 files changed, 63 insertions, 22 deletions
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index a4f4e40..7817d0a 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -128,6 +128,7 @@ is divided into following sections: <condition property="have.sources"> <or> <available file="${src.dir}"/> + <available file="${src.resources.dir}"/> </or> </condition> <condition property="netbeans.home+have.tests"> @@ -230,6 +231,7 @@ is divided into following sections: </target> <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check"> <fail unless="src.dir">Must set src.dir</fail> + <fail unless="src.resources.dir">Must set src.resources.dir</fail> <fail unless="test.src.dir">Must set test.src.dir</fail> <fail unless="build.dir">Must set build.dir</fail> <fail unless="dist.dir">Must set dist.dir</fail> @@ -251,7 +253,7 @@ is divided into following sections: </target> <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${src.dir}:${src.resources.dir}" name="srcdir"/> <attribute default="${build.classes.dir}" name="destdir"/> <attribute default="${javac.classpath}" name="classpath"/> <attribute default="${javac.processorpath}" name="processorpath"/> @@ -292,7 +294,7 @@ is divided into following sections: </target> <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${src.dir}:${src.resources.dir}" name="srcdir"/> <attribute default="${build.classes.dir}" name="destdir"/> <attribute default="${javac.classpath}" name="classpath"/> <attribute default="${javac.processorpath}" name="processorpath"/> @@ -325,7 +327,7 @@ is divided into following sections: </target> <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${src.dir}" name="srcdir"/> + <attribute default="${src.dir}:${src.resources.dir}" name="srcdir"/> <attribute default="${build.classes.dir}" name="destdir"/> <attribute default="${javac.classpath}" name="classpath"/> <sequential> @@ -923,12 +925,13 @@ is divided into following sections: <include name="*"/> </dirset> </pathconvert> - <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> + <j2seproject3:depend srcdir="${src.dir}:${src.resources.dir}:${build.generated.subdirs}"/> </target> <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> <copy todir="${build.classes.dir}"> <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> + <fileset dir="${src.resources.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> </copy> </target> <target if="has.persistence.xml" name="-copy-persistence-xml"> @@ -949,7 +952,7 @@ is divided into following sections: <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> <j2seproject3:force-recompile/> - <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/> + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}:${src.resources.dir}"/> </target> <target name="-post-compile-single"> <!-- Empty placeholder for easier customization. --> @@ -1218,6 +1221,9 @@ is divided into following sections: <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}"> <filename name="**/*.java"/> </fileset> + <fileset dir="${src.resources.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}"> + <filename name="**/*.java"/> + </fileset> <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> <include name="**/*.java"/> <exclude name="*.java"/> @@ -1228,6 +1234,9 @@ is divided into following sections: <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> <filename name="**/doc-files/**"/> </fileset> + <fileset dir="${src.resources.dir}" excludes="${excludes}" includes="${includes}"> + <filename name="**/doc-files/**"/> + </fileset> <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> <include name="**/doc-files/**"/> </fileset> diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 953d39e..df85af3 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,6 +1,6 @@ build.xml.data.CRC32=c32ad9b4 build.xml.script.CRC32=fb22312b build.xml.stylesheet.CRC32=ba5d3624 -nbproject/build-impl.xml.data.CRC32=ca6f3ced -nbproject/build-impl.xml.script.CRC32=b6ebaf69 +nbproject/build-impl.xml.data.CRC32=4abaea21 +nbproject/build-impl.xml.script.CRC32=b73367bc nbproject/[email protected] diff --git a/nbproject/project.properties b/nbproject/project.properties index 2929f66..776bad8 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,3 +1,6 @@ +file.reference.logback-classic-1.1.3.jar=../../lib/logback-classic-1.1.3.jar +file.reference.logback-core-1.1.3.jar=../../lib/logback-core-1.1.3.jar +file.reference.slf4j-api-1.7.13.jar=../../lib/slf4j-api-1.7.13.jar #Thu Dec 10 17:14:49 PST 2015 jnlp.offline-allowed=false javadoc.splitindex=true @@ -7,7 +10,9 @@ javadoc.author=false build.sysclasspath=ignore javac.target=1.8 build.generated.dir=${build.dir}/generated -run.classpath=${javac.classpath}\:${build.classes.dir}\:${file.reference.jlfgr-1_0.jar} +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} application.args= debug.test.classpath=${run.test.classpath} jnlp.descriptor=application @@ -15,6 +20,7 @@ build.dir=build javac.deprecation=true jnlp.signed=false application.splash= +src.resources.dir=resources test.src.dir=test junit.selected.version=3 jar.archive.disabled=${jnlp.enabled} @@ -33,8 +39,10 @@ manifest.file=manifest.mf javac.source=1.8 run.jvmargs=-Dapple.laf.useScreenMenuBar\=true manifest.custom.permissions= -run.test.classpath=${javac.test.classpath}\:${build.test.classes.dir} -file.reference.jlfgr-1_0.jar=lib/jlfgr-1_0.jar +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +file.reference.jlfgr-1_0.jar=../../lib/jlfgr-1_0.jar build.generated.sources.dir=${build.dir}/generated-sources jnlp.signing= javadoc.notree=false @@ -47,7 +55,11 @@ main.class=net.java.dev.typecast.app.editor.Main dist.javadoc.dir=${dist.dir}/javadoc javadoc.additionalparam= auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml -javac.classpath= +javac.classpath=\ + ${file.reference.jlfgr-1_0.jar}:\ + ${file.reference.logback-classic-1.1.3.jar}:\ + ${file.reference.logback-core-1.1.3.jar}:\ + ${file.reference.slf4j-api-1.7.13.jar} javadoc.noindex=false manifest.custom.codebase= annotation.processing.enabled.in.editor=false @@ -64,7 +76,8 @@ annotation.processing.run.all.processors=true excludes= application.title=Typecast jnlp.codebase.type=local -javac.processorpath=${javac.classpath} +javac.processorpath=\ + ${javac.classpath} build.test.results.dir=${build.dir}/test/results endorsed.classpath= javadoc.use=true diff --git a/nbproject/project.xml b/nbproject/project.xml index 5eff858..2c64b18 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -7,6 +7,7 @@ <minimum-ant-version>1.6.5</minimum-ant-version> <source-roots> <root id="src.dir"/> + <root id="src.resources.dir" name="Resources"/> </source-roots> <test-roots> <root id="test.src.dir"/> diff --git a/resources/logback.xml b/resources/logback.xml new file mode 100644 index 0000000..e29aa69 --- /dev/null +++ b/resources/logback.xml @@ -0,0 +1,12 @@ +<configuration> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern> + </encoder> + </appender> + + <root level="debug"> + <appender-ref ref="STDOUT" /> + </root> +</configuration> diff --git a/src/net/java/dev/typecast/cff/T2Interpreter.java b/src/net/java/dev/typecast/cff/T2Interpreter.java index baa4732..a8cb5a5 100644 --- a/src/net/java/dev/typecast/cff/T2Interpreter.java +++ b/src/net/java/dev/typecast/cff/T2Interpreter.java @@ -20,6 +20,8 @@ package net.java.dev.typecast.cff; import java.util.ArrayList; import net.java.dev.typecast.ot.Point; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Type 2 Charstring Interpreter. Operator descriptions are quoted from @@ -41,6 +43,8 @@ public class T2Interpreter { private static final int SUBR_STACK_LIMIT = 10; private static final int TRANSIENT_ARRAY_ELEMENT_COUNT = 32; + static final Logger logger = LoggerFactory.getLogger(T2Interpreter.class); + private final Number[] _argStack = new Number[ARGUMENT_STACK_LIMIT]; private int _argStackIndex = 0; private final SubrPair[] _subrStack = new SubrPair[SUBR_STACK_LIMIT]; @@ -1130,11 +1134,12 @@ public class T2Interpreter { * Pop a value off the argument stack */ private Number popArg() { -// System.out.print("popArg: " + _argStack[_argStackIndex - 1] + " ("); -// for (int i = 0; i < _argStackIndex - 1; ++i) { -// System.out.print(" " + _argStack[i]); -// } -// System.out.println(")"); + if (logger.isTraceEnabled()) { + logger.trace( + "popArg: {} {}", + _argStack[_argStackIndex - 1], + java.util.Arrays.copyOfRange(_argStack, 0, _argStackIndex - 1)); + } return _argStack[--_argStackIndex]; } @@ -1143,11 +1148,12 @@ public class T2Interpreter { */ private void pushArg(Number n) { _argStack[_argStackIndex++] = n; -// System.out.print("pushArg: " + n + " ("); -// for (int i = 0; i < _argStackIndex - 1; ++i) { -// System.out.print(" " + _argStack[i]); -// } -// System.out.println(")"); + if (logger.isTraceEnabled()) { + logger.trace( + "pushArg: {} {}", + n, + java.util.Arrays.copyOfRange(_argStack, 0, _argStackIndex - 1)); + } } /** |