From 5745ab4f2ce6b70e6b0b7961c704192c521ac287 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Mon, 15 Oct 2018 09:13:41 +0200 Subject: [PATCH] Fixed cli options and NaN handling in VCD loader --- com.minres.scviewer.database.sqlite/pom.xml | 2 +- com.minres.scviewer.database.test/pom.xml | 2 +- com.minres.scviewer.database.text/pom.xml | 2 +- com.minres.scviewer.database.ui.swt/pom.xml | 2 +- .../minres/scviewer/database/vcd/VCDFileParser.java | 5 ++++- .../com/minres/scviewer/database/vcd/VCDSignal.java | 7 ++++++- com.minres.scviewer.database/pom.xml | 2 +- .../minres/scviewer/e4/application/E4LifeCycle.java | 11 +++++++---- .../e4/application/handlers/OpenHandler.java | 13 +------------ com.minres.scviewer.e4.product/scviewer.product | 6 ++++++ com.minres.scviewer.feature/pom.xml | 2 +- com.minres.scviewer.target/pom.xml | 2 +- com.minres.scviewer.ui/pom.xml | 2 +- com.minres.scviewer.updateSite/pom.xml | 2 +- 14 files changed, 33 insertions(+), 27 deletions(-) diff --git a/com.minres.scviewer.database.sqlite/pom.xml b/com.minres.scviewer.database.sqlite/pom.xml index 7c1250c..e7c3d17 100644 --- a/com.minres.scviewer.database.sqlite/pom.xml +++ b/com.minres.scviewer.database.sqlite/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 1.0.0-SNAPSHOT + 2.0.0-SNAPSHOT ../com.minres.scviewer.parent eclipse-plugin diff --git a/com.minres.scviewer.database.test/pom.xml b/com.minres.scviewer.database.test/pom.xml index fad1edf..977912e 100644 --- a/com.minres.scviewer.database.test/pom.xml +++ b/com.minres.scviewer.database.test/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 1.0.0-SNAPSHOT + 2.0.0-SNAPSHOT ../com.minres.scviewer.parent eclipse-test-plugin diff --git a/com.minres.scviewer.database.text/pom.xml b/com.minres.scviewer.database.text/pom.xml index 5f4fe8f..94123fe 100644 --- a/com.minres.scviewer.database.text/pom.xml +++ b/com.minres.scviewer.database.text/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 1.0.0-SNAPSHOT + 2.0.0-SNAPSHOT ../com.minres.scviewer.parent eclipse-plugin diff --git a/com.minres.scviewer.database.ui.swt/pom.xml b/com.minres.scviewer.database.ui.swt/pom.xml index 6b6a315..de49454 100644 --- a/com.minres.scviewer.database.ui.swt/pom.xml +++ b/com.minres.scviewer.database.ui.swt/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 1.0.0-SNAPSHOT + 2.0.0-SNAPSHOT ../com.minres.scviewer.parent \ No newline at end of file diff --git a/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java b/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java index c714dec..a527e17 100644 --- a/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java +++ b/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java @@ -184,7 +184,10 @@ class VCDFileParser { int netWidth = traceBuilder.getNetWidth(net); if(netWidth<0) { - traceBuilder.appendTransition(net, currentTime, Double.parseDouble(value)); + if("nan".equals(value)) + traceBuilder.appendTransition(net, currentTime, Double.NaN); + else + traceBuilder.appendTransition(net, currentTime, Double.parseDouble(value)); } else { BitVector decodedValues = new BitVector(netWidth); if (value.equals("z") && netWidth > 1) { diff --git a/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java b/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java index b297534..3620c57 100644 --- a/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java +++ b/com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDSignal.java @@ -10,6 +10,7 @@ *******************************************************************************/ package com.minres.scviewer.database.vcd; +import java.util.Map.Entry; import java.util.NavigableMap; import java.util.TreeMap; @@ -106,7 +107,11 @@ public class VCDSignal extends HierNode implements ISig @Override public T getWaveformEventsBeforeTime(Long time) { - return values.floorEntry(time).getValue(); + Entry e = values.floorEntry(time); + if(e==null) + return null; + else + return values.floorEntry(time).getValue(); } @Override diff --git a/com.minres.scviewer.database/pom.xml b/com.minres.scviewer.database/pom.xml index 48149fe..b91d796 100644 --- a/com.minres.scviewer.database/pom.xml +++ b/com.minres.scviewer.database/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 1.0.0-SNAPSHOT + 2.0.0-SNAPSHOT ../com.minres.scviewer.parent eclipse-plugin diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java index 707989f..2b4e79f 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/E4LifeCycle.java @@ -64,10 +64,13 @@ public class E4LifeCycle { @PostContextCreate void postContextCreate(IApplicationContext appContext, final IEventBroker eventBroker) { final String[] args = (String[])appContext.getArguments().get(IApplicationContext.APPLICATION_ARGS); - Options opt = new Options(args, 1); - opt.getSet().addOption("c", Separator.BLANK, Multiplicity.ONCE); - if (!opt.check(Options.DEFAULT_SET, true, true)) { - System.exit(1); + Options opt = new Options(args, 0); + opt.getSet() + .addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE) + .addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE); + if (!opt.check(Options.DEFAULT_SET, true, false)) { + System.err.println(opt.getCheckErrors()); + System.exit(1); } final String confFile =opt.getSet().isSet("c")?opt.getSet().getOption("c").getResultValue(0):""; diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/OpenHandler.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/OpenHandler.java index d9396f8..df60b5d 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/OpenHandler.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/OpenHandler.java @@ -30,31 +30,20 @@ public class OpenHandler { @Execute public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){ FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI); -// dialog.setFilterExtensions (new String []{"vcd", "txdb", "txlog"}); dialog.setFilterExtensions (new String []{Messages.OpenHandler_0}); dialog.open(); String path = dialog.getFilterPath(); for(String fileName: dialog.getFileNames()){ File file = new File(path+File.separator+fileName); if(file.exists()){ -// MPart part = MBasicFactory.INSTANCE.createPart(); -// part.setLabel(fileName); -// part.setContributionURI("bundleclass://com.minres.scviewer.e4.application/"+ WaveformViewerPart.class.getName()); MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$ part.setLabel(file.getName()); - - MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$ partStack.getChildren().add(part); partService.showPart(part, PartState.ACTIVATE); -// Object o = part.getObject(); -// if(o instanceof WaveformViewerPart) -// ((WaveformViewerPart)o).setPartInput(file); IEclipseContext ctx=part.getContext(); ctx.modify("input", file); //$NON-NLS-1$ - ctx.declareModifiable("input"); //$NON-NLS-1$ - - + ctx.modify("config", ""); //$NON-NLS-1$ } } } diff --git a/com.minres.scviewer.e4.product/scviewer.product b/com.minres.scviewer.e4.product/scviewer.product index 615d49f..3031c32 100644 --- a/com.minres.scviewer.e4.product/scviewer.product +++ b/com.minres.scviewer.e4.product/scviewer.product @@ -34,6 +34,9 @@ + org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 + org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 + org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 @@ -71,6 +74,7 @@ + @@ -92,6 +96,7 @@ + @@ -120,6 +125,7 @@ + diff --git a/com.minres.scviewer.feature/pom.xml b/com.minres.scviewer.feature/pom.xml index a67671a..323a625 100644 --- a/com.minres.scviewer.feature/pom.xml +++ b/com.minres.scviewer.feature/pom.xml @@ -5,7 +5,7 @@ com.minres.scviewer com.minres.scviewer.parent - 1.0.0-SNAPSHOT + 2.0.0-SNAPSHOT ../com.minres.scviewer.parent \ No newline at end of file diff --git a/com.minres.scviewer.target/pom.xml b/com.minres.scviewer.target/pom.xml index 2e5538b..75a143f 100644 --- a/com.minres.scviewer.target/pom.xml +++ b/com.minres.scviewer.target/pom.xml @@ -12,7 +12,7 @@ com.minres.scviewer com.minres.scviewer.parent - 1.0.0-SNAPSHOT + 2.0.0-SNAPSHOT ../com.minres.scviewer.parent diff --git a/com.minres.scviewer.ui/pom.xml b/com.minres.scviewer.ui/pom.xml index 11f1e01..7552419 100644 --- a/com.minres.scviewer.ui/pom.xml +++ b/com.minres.scviewer.ui/pom.xml @@ -4,7 +4,7 @@ com.minres.scviewer com.minres.scviewer.parent - 1.0.0-SNAPSHOT + 2.0.0-SNAPSHOT ../com.minres.scviewer.parent eclipse-plugin diff --git a/com.minres.scviewer.updateSite/pom.xml b/com.minres.scviewer.updateSite/pom.xml index eb71dbd..b3a3c1e 100644 --- a/com.minres.scviewer.updateSite/pom.xml +++ b/com.minres.scviewer.updateSite/pom.xml @@ -6,7 +6,7 @@ com.minres.scviewer com.minres.scviewer.parent - 1.0.0-SNAPSHOT + 2.0.0-SNAPSHOT ../com.minres.scviewer.parent