Merge branch 'release/2.16.1'

This commit is contained in:
Eyck Jentzsch 2022-06-12 20:58:31 +02:00
commit 3a931d59d5
30 changed files with 246 additions and 213 deletions

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<version>3.0.0-SNAPSHOT</version> <version>3.0.0-SNAPSHOT</version>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<version>1.1.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<version>1.1.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<version>1.1.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>

View File

@ -78,24 +78,24 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
return streams; return streams;
} }
@Override // @Override
public boolean canLoad(File inputFile) { // public boolean canLoad(File inputFile) {
if (!inputFile.isDirectory() && inputFile.exists()) { // if (!inputFile.isDirectory() && inputFile.exists()) {
try(InputStream stream = new FileInputStream(inputFile)){ // try(InputStream stream = new FileInputStream(inputFile)){
byte[] buffer = new byte[x.length]; // byte[] buffer = new byte[x.length];
int readCnt = stream.read(buffer, 0, x.length); // int readCnt = stream.read(buffer, 0, x.length);
if (readCnt == x.length) { // if (readCnt == x.length) {
for (int i = 0; i < x.length; i++) // for (int i = 0; i < x.length; i++)
if (buffer[i] != x[i]) // if (buffer[i] != x[i])
return false; // return false;
} // }
return true; // return true;
} catch (Exception e) { // } catch (Exception e) {
return false; // return false;
} // }
} // }
return false; // return false;
} // }
@Override @Override
public void load(IWaveformDb db, File file) throws InputFormatException { public void load(IWaveformDb db, File file) throws InputFormatException {

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>

View File

@ -59,14 +59,14 @@ import com.minres.scviewer.database.tx.ITx;
public class TextDbLoader implements IWaveformDbLoader { public class TextDbLoader implements IWaveformDbLoader {
enum FileType { NONE, PLAIN, GZIP, LZ4}; enum FileType { NONE, PLAIN, GZIP, LZ4};
/** the file size limit of a zipped txlog where the loader starts to use a file mapped database */ /** the file size limit of a zipped txlog where the loader starts to use a file mapped database */
private static final long MEMMAP_LIMIT=256l*1024l*1024l; private static final long MEMMAP_LIMIT=256l*1024l*1024l;
private static final long MAPDB_INITIAL_ALLOC = 512l*1024l*1024l; private static final long MAPDB_INITIAL_ALLOC = 512l*1024l*1024l;
private static final long MAPDB_INCREMENTAL_ALLOC = 128l*1024l*1024l; private static final long MAPDB_INCREMENTAL_ALLOC = 128l*1024l*1024l;
/** The max time. */ /** The max time. */
private Long maxTime = 0L; private Long maxTime = 0L;
@ -185,46 +185,25 @@ public class TextDbLoader implements IWaveformDbLoader {
return relationTypes.values(); return relationTypes.values();
} }
/**
* Can load.
*
* @param inputFile the input file
* @return true, if successful
*/
@Override
public boolean canLoad(File inputFile) {
if (!inputFile.isDirectory() && inputFile.exists()) {
FileType fType = getFileType(inputFile);
try(InputStream stream = fType==FileType.GZIP ? new GZIPInputStream(new FileInputStream(inputFile)) :
fType==FileType.LZ4? new FramedLZ4CompressorInputStream(new FileInputStream(inputFile)) : new FileInputStream(inputFile)){
byte[] buffer = new byte[x.length];
int readCnt = stream.read(buffer, 0, x.length);
if (readCnt == x.length) {
for (int i = 0; i < x.length; i++)
if (buffer[i] != x[i])
return false;
}
return true;
} catch (Exception e) {
return false;
}
}
return false;
}
/** /**
* Checks if is gzipped. * Checks if is gzipped.
* *
* @param f the f * @param f the f
* @return true, if is gzipped * @return true, if is gzipped
*/ */
private static FileType getFileType(File f) { static FileType getFileType(File f) {
try (InputStream is = new FileInputStream(f)) { try (InputStream is = new FileInputStream(f)) {
byte[] signature = new byte[4]; byte[] signature = new byte[4];
int nread = is.read(signature); // read the gzip signature int nread = is.read(signature); // read the gzip signature
if(nread > 2 && signature[0] == (byte) 0x1f && signature[1] == (byte) 0x8b) if(nread >= 2 &&
signature[0] == (byte) 0x1f &&
signature[1] == (byte) 0x8b)
return FileType.GZIP; return FileType.GZIP;
else if(nread>4 && signature[0] == (byte) 0x04 && signature[1] == (byte) 0x22 && signature[2] == (byte) 0x4d && signature[3] == (byte) 0x18) else if(nread>=4 &&
signature[0] == (byte) 0x04 &&
signature[1] == (byte) 0x22 &&
signature[2] == (byte) 0x4d &&
signature[3] == (byte) 0x18)
return FileType.LZ4; return FileType.LZ4;
else else
return FileType.PLAIN; return FileType.PLAIN;
@ -264,14 +243,15 @@ public class TextDbLoader implements IWaveformDbLoader {
} }
TextDbParser parser = new TextDbParser(this); TextDbParser parser = new TextDbParser(this);
try { try {
parser.txSink = mapDb.hashMap("transactions", Serializer.LONG, Serializer.JAVA).create(); parser.txSink = mapDb.hashMap("transactions", Serializer.LONG, Serializer.JAVA).create();
InputStream is = new BufferedInputStream(new FileInputStream(file)); InputStream is = new BufferedInputStream(new FileInputStream(file));
parser.parseInput(fType==FileType.GZIP ? new GZIPInputStream(is) : fType==FileType.LZ4? new FramedLZ4CompressorInputStream(is) : is); parser.parseInput(fType==FileType.GZIP ? new GZIPInputStream(is) : fType==FileType.LZ4? new FramedLZ4CompressorInputStream(is) : is);
transactions = parser.txSink;
} catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) { } catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
} catch (Exception e) { } catch (Exception e) {
throw new InputFormatException(e.toString()); throw new InputFormatException(e.toString());
} finally {
transactions = parser.txSink;
} }
txStreams.values().parallelStream().forEach(TxStream::calculateConcurrency); txStreams.values().parallelStream().forEach(TxStream::calculateConcurrency);
} }
@ -351,20 +331,22 @@ public class TextDbLoader implements IWaveformDbLoader {
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
* @throws InputFormatException Signals that the input format is wrong * @throws InputFormatException Signals that the input format is wrong
*/ */
void parseInput(InputStream inputStream) throws IOException, InputFormatException { void parseInput(InputStream inputStream) throws InputFormatException {
reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); try {
String curLine = reader.readLine(); reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
String nextLine = null; String curLine = reader.readLine();
while ((nextLine = reader.readLine()) != null && curLine != null) { String nextLine = null;
curLine = parseLine(curLine, nextLine, false); while ((nextLine = reader.readLine()) != null && curLine != null) {
} curLine = parseLine(curLine, nextLine, false);
if (curLine != null) }
parseLine(curLine, nextLine, true); if (curLine != null)
for(Entry<Long, ScvTx> e: transactionById.entrySet()) { parseLine(curLine, nextLine, true);
ScvTx scvTx = e.getValue(); for(Entry<Long, ScvTx> e: transactionById.entrySet()) {
scvTx.endTime=loader.maxTime; ScvTx scvTx = e.getValue();
txSink.put(e.getKey(), scvTx); scvTx.endTime=loader.maxTime;
} txSink.put(e.getKey(), scvTx);
}
} catch(IOException e) {}
} }
/** /**
@ -397,80 +379,86 @@ public class TextDbLoader implements IWaveformDbLoader {
* @throws InputFormatException Signals that the input format is wrong * @throws InputFormatException Signals that the input format is wrong
*/ */
private String parseLine(String curLine, String nextLine, boolean last) throws IOException, InputFormatException { private String parseLine(String curLine, String nextLine, boolean last) throws IOException, InputFormatException {
String[] tokens = curLine.split("\\s+"); if(curLine.charAt(0)=='t') {
if ("tx_record_attribute".equals(tokens[0]) && tokens.length>4) { String[] tokens = curLine.split(" ");
Long id = Long.parseLong(tokens[1]); //if ("tx_record_attribute".equals(tokens[0]) && tokens.length>4) {
String name = tokens[2].substring(1, tokens[2].length()-1); if (curLine.charAt(5)=='c' && tokens.length>4) {
DataType type = DataType.valueOf(tokens[3]); Long id = Long.parseLong(tokens[1]);
String remaining = tokens.length > 5 ? String.join(" ", Arrays.copyOfRange(tokens, 5, tokens.length)) : ""; String name = tokens[2].substring(1, tokens[2].length()-1);
TxAttributeType attrType = getAttrType(name, type, AssociationType.RECORD); DataType type = DataType.valueOf(tokens[3]);
transactionById.get(id).attributes.add(new TxAttribute(attrType, getAttrString(attrType, remaining))); String remaining = tokens.length > 5 ? String.join(" ", Arrays.copyOfRange(tokens, 5, tokens.length)) : "";
} else if ("tx_begin".equals(tokens[0]) && tokens.length>4) { TxAttributeType attrType = getAttrType(name, type, AssociationType.RECORD);
Long id = Long.parseLong(tokens[1]); transactionById.get(id).attributes.add(new TxAttribute(attrType, getAttrString(attrType, remaining)));
Long genId = Long.parseLong(tokens[2]); //} else if ("tx_begin".equals(tokens[0]) && tokens.length>4) {
TxGenerator gen = loader.txGenerators.get(genId); } else if (curLine.charAt(3)=='b' && tokens.length>4) {
ScvTx scvTx = new ScvTx(id, gen.stream.getId(), genId, Long id = Long.parseLong(tokens[1]);
Long.parseLong(tokens[3]) * stringToScale(tokens[4])); Long genId = Long.parseLong(tokens[2]);
loader.maxTime = loader.maxTime > scvTx.beginTime ? loader.maxTime : scvTx.beginTime; TxGenerator gen = loader.txGenerators.get(genId);
if (nextLine != null && nextLine.charAt(0) == 'a') { ScvTx scvTx = new ScvTx(id, gen.stream.getId(), genId,
int idx = 0; Long.parseLong(tokens[3]) * stringToScale(tokens[4]));
while (nextLine != null && nextLine.charAt(0) == 'a') { loader.maxTime = loader.maxTime > scvTx.beginTime ? loader.maxTime : scvTx.beginTime;
String[] attrTokens = nextLine.split("\\s+"); if (nextLine != null && nextLine.charAt(0) == 'a') {
TxAttributeType attrType = gen.beginAttrs.get(idx); int idx = 0;
TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1])); while (nextLine != null && nextLine.charAt(0) == 'a') {
scvTx.attributes.add(attr); String[] attrTokens = nextLine.split("\\s+");
idx++; TxAttributeType attrType = gen.beginAttrs.get(idx);
nextLine = reader.readLine(); TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1]));
scvTx.attributes.add(attr);
idx++;
nextLine = reader.readLine();
}
} }
} transactionById.put(id, scvTx);
transactionById.put(id, scvTx); //} else if ("tx_end".equals(tokens[0]) && tokens.length>4) {
} else if ("tx_end".equals(tokens[0]) && tokens.length>4) { } else if (curLine.charAt(3)=='e' && tokens.length>4) {
Long id = Long.parseLong(tokens[1]); Long id = Long.parseLong(tokens[1]);
ScvTx scvTx = transactionById.get(id); ScvTx scvTx = transactionById.get(id);
assert Long.parseLong(tokens[2]) == scvTx.generatorId; assert Long.parseLong(tokens[2]) == scvTx.generatorId;
scvTx.endTime = Long.parseLong(tokens[3]) * stringToScale(tokens[4]); scvTx.endTime = Long.parseLong(tokens[3]) * stringToScale(tokens[4]);
loader.maxTime = loader.maxTime > scvTx.endTime ? loader.maxTime : scvTx.endTime; loader.maxTime = loader.maxTime > scvTx.endTime ? loader.maxTime : scvTx.endTime;
TxGenerator gen = loader.txGenerators.get(scvTx.generatorId); TxGenerator gen = loader.txGenerators.get(scvTx.generatorId);
TxStream stream = loader.txStreams.get(gen.stream.getId()); TxStream stream = loader.txStreams.get(gen.stream.getId());
if (scvTx.beginTime == scvTx.endTime) { if (scvTx.beginTime == scvTx.endTime) {
stream.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime)); stream.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
gen.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime)); gen.addEvent(new TxEvent(loader, EventKind.SINGLE, id, scvTx.beginTime));
} else { } else {
stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime)); stream.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
gen.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime)); gen.addEvent(new TxEvent(loader, EventKind.BEGIN, id, scvTx.beginTime));
stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime)); stream.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
gen.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime)); gen.addEvent(new TxEvent(loader, EventKind.END, id, scvTx.endTime));
}
if (nextLine != null && nextLine.charAt(0) == 'a') {
int idx = 0;
while (nextLine != null && nextLine.charAt(0) == 'a') {
String[] attrTokens = nextLine.split("\\s+");
TxAttributeType attrType = gen.endAttrs.get(idx);
TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1]));
scvTx.attributes.add(attr);
idx++;
nextLine = reader.readLine();
} }
if (nextLine != null && nextLine.charAt(0) == 'a') {
int idx = 0;
while (nextLine != null && nextLine.charAt(0) == 'a') {
String[] attrTokens = nextLine.split("\\s+");
TxAttributeType attrType = gen.endAttrs.get(idx);
TxAttribute attr = new TxAttribute(attrType, getAttrString(attrType, attrTokens[1]));
scvTx.attributes.add(attr);
idx++;
nextLine = reader.readLine();
}
}
txSink.put(scvTx.getId(), scvTx);
transactionById.remove(id);
//} else if ("tx_relation".equals(tokens[0]) && tokens.length>3) {
} else if (curLine.charAt(5)=='l' && tokens.length>3) {
Long tr2 = Long.parseLong(tokens[2]);
Long tr1 = Long.parseLong(tokens[3]);
String relType = tokens[1].substring(1, tokens[1].length() - 1);
if (!loader.relationTypes.containsKey(relType))
loader.relationTypes.put(relType, RelationTypeFactory.create(relType));
ScvRelation rel = new ScvRelation(loader.relationTypes.get(relType), tr1, tr2);
loader.relationsOut.put(tr1, rel);
loader.relationsIn.put(tr2, rel);
} }
txSink.put(scvTx.getId(), scvTx); } else if (curLine.length()>13 && "scv_tr_stream".equals(curLine.substring(0, 13))) {
transactionById.remove(id);
} else if ("tx_relation".equals(tokens[0]) && tokens.length>3) {
Long tr2 = Long.parseLong(tokens[2]);
Long tr1 = Long.parseLong(tokens[3]);
String relType = tokens[1].substring(1, tokens[1].length() - 1);
if (!loader.relationTypes.containsKey(relType))
loader.relationTypes.put(relType, RelationTypeFactory.create(relType));
ScvRelation rel = new ScvRelation(loader.relationTypes.get(relType), tr1, tr2);
loader.relationsOut.put(tr1, rel);
loader.relationsIn.put(tr2, rel);
} else if ("scv_tr_stream".equals(tokens[0])) {
Matcher matcher = scv_tr_stream.matcher(curLine); Matcher matcher = scv_tr_stream.matcher(curLine);
if (matcher.matches()) { if (matcher.matches()) {
Long id = Long.parseLong(matcher.group(1)); Long id = Long.parseLong(matcher.group(1));
TxStream stream = new TxStream(loader, id, matcher.group(2), matcher.group(3)); TxStream stream = new TxStream(loader, id, matcher.group(2), matcher.group(3));
add(id, stream); add(id, stream);
} }
} else if ("scv_tr_generator".equals(tokens[0])) { } else if (curLine.length()>16 && "scv_tr_generator".equals(curLine.substring(0, 16))) {
Matcher matcher = scv_tr_generator.matcher(curLine); Matcher matcher = scv_tr_generator.matcher(curLine);
if ((matcher.matches())) { if ((matcher.matches())) {
Long id = Long.parseLong(matcher.group(1)); Long id = Long.parseLong(matcher.group(1));
@ -478,21 +466,21 @@ public class TextDbLoader implements IWaveformDbLoader {
generator = new TxGenerator(loader, id, matcher.group(2), stream); generator = new TxGenerator(loader, id, matcher.group(2), stream);
add(id, generator); add(id, generator);
} }
} else if ("begin_attribute".equals(tokens[0])) { } else if (curLine.length()>15 && "begin_attribute".equals(curLine.substring(0, 15))) {
Matcher matcher = begin_attribute.matcher(curLine); Matcher matcher = begin_attribute.matcher(curLine);
if ((matcher.matches())) { if ((matcher.matches())) {
TxAttributeType attrType = getAttrType(matcher.group(2), DataType.valueOf(matcher.group(3)), TxAttributeType attrType = getAttrType(matcher.group(2), DataType.valueOf(matcher.group(3)),
AssociationType.BEGIN); AssociationType.BEGIN);
generator.beginAttrs.add(attrType); generator.beginAttrs.add(attrType);
} }
} else if ("end_attribute".equals(tokens[0])) { } else if (curLine.length()>13 && "end_attribute".equals(curLine.substring(0, 13))) {
Matcher matcher = end_attribute.matcher(curLine); Matcher matcher = end_attribute.matcher(curLine);
if ((matcher.matches())) { if ((matcher.matches())) {
TxAttributeType attrType = getAttrType(matcher.group(2), DataType.valueOf(matcher.group(3)), TxAttributeType attrType = getAttrType(matcher.group(2), DataType.valueOf(matcher.group(3)),
AssociationType.END); AssociationType.END);
generator.endAttrs.add(attrType); generator.endAttrs.add(attrType);
} }
} else if (")".equals(tokens[0])) { } else if (curLine.charAt(0) == ')') {
generator = null; generator = null;
} else if(!last) } else if(!last)
throw new InputFormatException("Don't know what to do with: '" + curLine + "'"); throw new InputFormatException("Don't know what to do with: '" + curLine + "'");

View File

@ -11,14 +11,18 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database.text; package com.minres.scviewer.database.text;
import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import org.apache.commons.compress.compressors.lz4.FramedLZ4CompressorInputStream;
import com.minres.scviewer.database.IWaveformDbLoader; import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformDbLoaderFactory; import com.minres.scviewer.database.IWaveformDbLoaderFactory;
import com.minres.scviewer.database.text.TextDbLoader.FileType;
/** /**
* The Class TextDbLoader. * The Class TextDbLoader.
@ -52,21 +56,17 @@ public class TextDbLoaderFactory implements IWaveformDbLoaderFactory {
*/ */
@Override @Override
public boolean canLoad(File inputFile) { public boolean canLoad(File inputFile) {
if (!inputFile.isDirectory() && inputFile.exists()) { FileType fType = TextDbLoader.getFileType(inputFile);
boolean gzipped = isGzipped(inputFile); try (InputStream is = new FileInputStream(inputFile)) {
try(InputStream stream = gzipped ? new GZIPInputStream(new FileInputStream(inputFile)) : new FileInputStream(inputFile)){ InputStream plainIs = fType==FileType.GZIP ? new GZIPInputStream(is) : fType==FileType.LZ4? new FramedLZ4CompressorInputStream(is) : is;
byte[] buffer = new byte[x.length]; byte[] buffer = new byte[x.length];
int readCnt = stream.read(buffer, 0, x.length); int readCnt = plainIs.read(buffer, 0, x.length);
if (readCnt == x.length) { if (readCnt == x.length) {
for (int i = 0; i < x.length; i++) for (int i = 0; i < x.length; i++)
if (buffer[i] != x[i]) if (buffer[i] != x[i]) return false;
return false;
}
return true;
} catch (Exception e) {
return false;
} }
} return true;
} catch (IOException e) {}
return false; return false;
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<version>4.0.0-SNAPSHOT</version> <version>4.0.0-SNAPSHOT</version>

View File

@ -356,7 +356,7 @@ public class SignalPainter extends TrackPainter {
public RealStencil(IEventList entries, Object left, boolean continous) { public RealStencil(IEventList entries, Object left, boolean continous) {
this.continous=continous; this.continous=continous;
Collection<EventEntry> values = entries.entrySet(); Collection<EventEntry> values = entries.entrySet();
minVal=(Double) left; minVal=((DoubleVal) left).value;
range=2.0; range=2.0;
if(!values.isEmpty()) { if(!values.isEmpty()) {
double maxVal=minVal; double maxVal=minVal;

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>

View File

@ -66,34 +66,6 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
} }
/**
* Can load.
*
* @param inputFile the input file
* @return true, if successful
*/
@Override
public boolean canLoad(File inputFile) {
if(!inputFile.isDirectory() || inputFile.exists()) {
String name = inputFile.getName();
if(!(name.endsWith(".vcd") ||
name.endsWith(".vcdz") ||
name.endsWith(".vcdgz") ||
name.endsWith(".vcd.gz")) )
return false;
boolean gzipped = isGzipped(inputFile);
try(InputStream stream = gzipped ? new GZIPInputStream(new FileInputStream(inputFile)) : new FileInputStream(inputFile)){
byte[] buffer = new byte[8];
if (stream.read(buffer, 0, buffer.length) == buffer.length) {
return buffer[0]=='$';
}
} catch (Exception e) {
return false;
}
}
return false;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see com.minres.scviewer.database.ITrDb#load(java.io.File) * @see com.minres.scviewer.database.ITrDb#load(java.io.File)
*/ */

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>

View File

@ -48,13 +48,6 @@ public interface IWaveformDbLoader {
*/ */
public void removePropertyChangeListener(PropertyChangeListener l) ; public void removePropertyChangeListener(PropertyChangeListener l) ;
/**
* Can load the given file.
*
* @param inputFile the input file
* @return true, if successful
*/
public boolean canLoad(File inputFile);
/** /**
* Load. * Load.
* *

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: SCViewer Help Bundle-Name: SCViewer Help
Bundle-SymbolicName: com.minres.scviewer.e4.application.help;singleton:=true Bundle-SymbolicName: com.minres.scviewer.e4.application.help;singleton:=true
Bundle-Version: 2.16.0 Bundle-Version: 2.16.1
Bundle-Vendor: MINRES Technologies GmbH Bundle-Vendor: MINRES Technologies GmbH
Automatic-Module-Name: com.minres.scviewer.e4.application.help Automatic-Module-Name: com.minres.scviewer.e4.application.help
Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-RequiredExecutionEnvironment: JavaSE-11

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
Bundle-Version: 2.16.0 Bundle-Version: 2.16.1
Bundle-Vendor: %Bundle-Vendor Bundle-Vendor: %Bundle-Vendor
Require-Bundle: javax.inject;bundle-version="1.0.0", Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="3.11.1", org.eclipse.core.runtime;bundle-version="3.11.1",

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<packaging>eclipse-plugin</packaging> <packaging>eclipse-plugin</packaging>

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>releng/com.minres.scviewer.target</module> <module>releng/com.minres.scviewer.target</module>
@ -69,7 +69,7 @@
<artifact> <artifact>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.target</artifactId> <artifactId>com.minres.scviewer.target</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
</artifact> </artifact>
</target> </target>
<executionEnvironment>org.eclipse.justj.openjdk.hotspot.jre.minimal-15</executionEnvironment> <executionEnvironment>org.eclipse.justj.openjdk.hotspot.jre.minimal-15</executionEnvironment>

View File

@ -6,11 +6,11 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<artifactId>com.minres.scviewer.e4.product</artifactId> <artifactId>com.minres.scviewer.e4.product</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<packaging>eclipse-repository</packaging> <packaging>eclipse-repository</packaging>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<build> <build>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?> <?pde version="3.5"?>
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.16.0" useFeatures="true" includeLaunchers="true"> <product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.16.1" useFeatures="true" includeLaunchers="true">
<configIni use="default"> <configIni use="default">
</configIni> </configIni>

View File

@ -12,7 +12,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<build> <build>
@ -67,9 +67,9 @@
<appArgLine>-application org.eclipse.ant.core.antRunner -buildfile packaging-p2-composite.ant p2.composite.add -Dsite.label="SCViewer Software Repository" -Dproject.build.directory=${project.build.directory} -DunqualifiedVersion=${unqualifiedVersion} -Dsoftware.download.area="${software.download.area}/SCViewer-GHP/repository"</appArgLine> <appArgLine>-application org.eclipse.ant.core.antRunner -buildfile packaging-p2-composite.ant p2.composite.add -Dsite.label="SCViewer Software Repository" -Dproject.build.directory=${project.build.directory} -DunqualifiedVersion=${unqualifiedVersion} -Dsoftware.download.area="${software.download.area}/SCViewer-GHP/repository"</appArgLine>
<repositories> <repositories>
<repository> <repository>
<id>2020-03</id> <id>2021-12</id>
<layout>p2</layout> <layout>p2</layout>
<url>http://download.eclipse.org/releases/2020-03/</url> <url>http://download.eclipse.org/releases/2021-12/</url>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>

View File

@ -0,0 +1,80 @@
#Written by SCViewer
#Mon Jan 03 21:01:50 CET 2022
SHOWN_WAVEFORM0=duv.addr_ack
SHOWN_WAVEFORM11.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM2=duv.bus_addr[7\:0]
SHOWN_WAVEFORM1=duv.addr_req
SHOWN_WAVEFORM8=tr.addr_req
SHOWN_WAVEFORM7=tr.addr_ack
SHOWN_WAVEFORM9=tr.addr_stream
SHOWN_WAVEFORM4=duv.clk
SHOWN_WAVEFORM16.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM3=duv.bus_data[7\:0]
SHOWN_WAVEFORM14.WAVEFORM_SELECTED=FALSE
SHOWN_WAVEFORM6=duv.rw
SHOWN_WAVEFORM5=duv.data_rdy
SHOWN_WAVEFORM8.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM3.WAVE_DISPLAY=DEFAULT
SHOWN_CURSOR1=100000000
SHOWN_CURSOR0=10000000
SHOWN_WAVEFORM12.WAVEFORM_SELECTED=FALSE
SHOWN_WAVEFORM5.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM11.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM0.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM12.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM16.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORMS=17
SHOWN_WAVEFORM15.WAVE_DISPLAY=DEFAULT
SCALING_FACTOR=1000000
SHOWN_CURSORS=2
SHOWN_WAVEFORM14.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM13.WAVEFORM_SELECTED=FALSE
SHOWN_WAVEFORM0.WAVEFORM_SELECTED=TRUE
SHOWN_WAVEFORM7.WAVEFORM_SELECTED=FALSE
SHOWN_WAVEFORM13.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM6.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM15.WAVEFORM_SELECTED=FALSE
SHOWN_WAVEFORM2.WAVEFORM_SELECTED=TRUE
DATABASE_FILE1=C\:\\Users\\eyck\\git\\SCViewer\\tests\\com.minres.scviewer.database.test\\inputs\\my_db.txlog
DATABASE_FILE0=C\:\\Users\\eyck\\git\\SCViewer\\tests\\com.minres.scviewer.database.test\\inputs\\my_db.vcd
SHOWN_WAVEFORM9.WAVEFORM_SELECTED=FALSE
SHOWN_WAVEFORM7.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM9.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM7.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM12.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM10.WAVEFORM_SELECTED=FALSE
SHOWN_WAVEFORM9.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM4.WAVEFORM_SELECTED=TRUE
SHOWN_WAVEFORM5.WAVE_DISPLAY=DEFAULT
DATABASE_FILES=2
SHOWN_WAVEFORM1.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM4.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM13.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM10.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM5.WAVEFORM_SELECTED=TRUE
SHOWN_WAVEFORM14.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM15.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM6.WAVEFORM_SELECTED=TRUE
SHOWN_WAVEFORM1.WAVEFORM_SELECTED=TRUE
SHOWN_WAVEFORM16=tr.rw
SHOWN_WAVEFORM11.WAVEFORM_SELECTED=FALSE
SHOWN_WAVEFORM4.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM1.VALUE_DISPLAY=DEFAULT
TX_DETAILS_SHOWN=false
SHOWN_WAVEFORM2.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM2.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM11=tr.bus_data[7\:0]
SHOWN_WAVEFORM10=tr.bus_addr[7\:0]
SHOWN_WAVEFORM15=tr.pipelined_stream
SHOWN_WAVEFORM0.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM14=tr.data_stream
SHOWN_WAVEFORM13=tr.data_rdy
SHOWN_WAVEFORM12=tr.clk
SHOWN_WAVEFORM10.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM8.WAVEFORM_SELECTED=FALSE
SHOWN_WAVEFORM3.VALUE_DISPLAY=DEFAULT
SHOWN_WAVEFORM6.WAVE_DISPLAY=DEFAULT
BASE_LINE_TIME=0
SHOWN_WAVEFORM16.WAVEFORM_SELECTED=FALSE
SHOWN_WAVEFORM8.WAVE_DISPLAY=DEFAULT
SHOWN_WAVEFORM3.WAVEFORM_SELECTED=TRUE

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.16.0</version> <version>2.16.1</version>
<relativePath>../..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<packaging>eclipse-test-plugin</packaging> <packaging>eclipse-test-plugin</packaging>