From 732313e8447c7d76986478d8fcd8ba716f8894c7 Mon Sep 17 00:00:00 2001 From: David Schweinsberg Date: Mon, 4 Jan 2016 18:25:38 -0800 Subject: Added SLF4J & Logback --- nbproject/build-impl.xml | 19 ++++++++++++----- nbproject/genfiles.properties | 4 ++-- nbproject/project.properties | 23 ++++++++++++++++----- nbproject/project.xml | 1 + resources/logback.xml | 12 +++++++++++ src/net/java/dev/typecast/cff/T2Interpreter.java | 26 +++++++++++++++--------- 6 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 resources/logback.xml 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: + @@ -230,6 +231,7 @@ is divided into following sections: Must set src.dir + Must set src.resources.dir Must set test.src.dir Must set build.dir Must set dist.dir @@ -251,7 +253,7 @@ is divided into following sections: - + @@ -292,7 +294,7 @@ is divided into following sections: - + @@ -325,7 +327,7 @@ is divided into following sections: - + @@ -923,12 +925,13 @@ is divided into following sections: - + + @@ -949,7 +952,7 @@ is divided into following sections: Must select some files in the IDE or set javac.includes - + @@ -1218,6 +1221,9 @@ is divided into following sections: + + + @@ -1228,6 +1234,9 @@ is divided into following sections: + + + 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/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48 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 @@ 1.6.5 + 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 @@ + + + + + %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n + + + + + + + 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)); + } } /** -- cgit v1.2.3