added proper GPL notice to some files

This commit is contained in:
hneemann 2018-03-02 08:29:25 +01:00
parent f85eea58f9
commit 942c074056
5 changed files with 50 additions and 11 deletions

View File

@ -1,3 +1,8 @@
/*
* Copyright (c) 2016 Helmut Neemann, Rüdiger Heintz
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.core.arithmetic; package de.neemann.digital.core.arithmetic;
import de.neemann.digital.core.*; import de.neemann.digital.core.*;
@ -10,8 +15,6 @@ import static de.neemann.digital.core.element.PinInfo.input;
/** /**
* A barrel shifter * A barrel shifter
*
* @author heintz
*/ */
public class BarrelShifter extends Node implements Element { public class BarrelShifter extends Node implements Element {

View File

@ -1,7 +1,12 @@
/*
* Copyright (c) 2016 Helmut Neemann, Rüdiger Heintz
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.core.arithmetic; package de.neemann.digital.core.arithmetic;
/** /**
* @author heintz * the barrel shifter mode
*/ */
public enum BarrelShifterMode { public enum BarrelShifterMode {
/** /**

View File

@ -1,10 +1,15 @@
/*
* Copyright (c) 2016 Helmut Neemann, Rüdiger Heintz
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.core.arithmetic; package de.neemann.digital.core.arithmetic;
import de.neemann.digital.core.ObservableValue; import de.neemann.digital.core.ObservableValue;
/** /**
* @author heintz * the barrel shifter direction
*/ */
public enum LeftRightFormat { public enum LeftRightFormat {
/** /**

View File

@ -1,3 +1,8 @@
/*
* Copyright (c) 2016 Helmut Neemann, Rüdiger Heintz
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.gui.components; package de.neemann.digital.gui.components;
import de.neemann.digital.core.*; import de.neemann.digital.core.*;
@ -19,9 +24,6 @@ import java.util.Arrays;
/** /**
* Dialog to edit a single value. * Dialog to edit a single value.
* Used to enter a multi bit input value. * Used to enter a multi bit input value.
*
* @author hneemann
* @author Rüdiger Heintz
*/ */
public final class SingleValueDialog extends JDialog implements ModelStateObserverTyped { public final class SingleValueDialog extends JDialog implements ModelStateObserverTyped {

View File

@ -1,3 +1,8 @@
/*
* Copyright (c) 2016 Helmut Neemann
* Use of this source code is governed by the GPL v3 license
* that can be found in the LICENSE file.
*/
package de.neemann.digital.lang; package de.neemann.digital.lang;
import de.neemann.digital.integration.Resources; import de.neemann.digital.integration.Resources;
@ -11,7 +16,6 @@ import java.util.HashSet;
import java.util.Map; import java.util.Map;
/** /**
* Created by hneemann on 20.10.16.
*/ */
public class TestLang extends TestCase { public class TestLang extends TestCase {
private static final String SOURCEPATH = "/home/hneemann/Dokumente/Java/digital/src/main/java"; private static final String SOURCEPATH = "/home/hneemann/Dokumente/Java/digital/src/main/java";
@ -52,7 +56,7 @@ public class TestLang extends TestCase {
HashSet<String> keys = new HashSet<>(); HashSet<String> keys = new HashSet<>();
parseTree(new File(sources), keys); parseTree(new File(sources), keys);
// check also test code. Is needed because documentation generation uses language key also. // check also test code. Is needed because documentation generation uses language key also.
parseTree(new File(Resources.getRoot(),"../java"), keys); parseTree(new File(Resources.getRoot(), "../java"), keys);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (String key : map.keySet()) { for (String key : map.keySet()) {
@ -64,8 +68,8 @@ public class TestLang extends TestCase {
} }
} }
} }
if (sb.length()>0) if (sb.length() > 0)
fail("there are unused language keys: "+sb.toString()); fail("there are unused language keys: " + sb.toString());
} }
private void parseTree(File file, HashSet<String> keys) throws IOException { private void parseTree(File file, HashSet<String> keys) throws IOException {
@ -85,6 +89,8 @@ public class TestLang extends TestCase {
} }
private void checkSourceFile(File f, HashSet<String> keys) throws IOException { private void checkSourceFile(File f, HashSet<String> keys) throws IOException {
int state = 0;
try (BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(f), "utf-8"))) { try (BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(f), "utf-8"))) {
int linecount = 0; int linecount = 0;
String line; String line;
@ -95,8 +101,26 @@ public class TestLang extends TestCase {
} catch (AssertionFailedError e) { } catch (AssertionFailedError e) {
throw new AssertionFailedError(e.getMessage() + " in line " + linecount); throw new AssertionFailedError(e.getMessage() + " in line " + linecount);
} }
switch (state) {
case 0:
if (line.trim().equals("* Use of this source code is governed by the GPL v3 license"))
state = 1;
break;
case 1:
if (line.trim().equals("* that can be found in the LICENSE file."))
state = 2;
else
state = 0;
break;
}
} }
} }
if (state != 2)
throw new IOException("found file without proper license notice: " + f+ "\n\n"
+"Every java file must contain the lines\n\n"
+"* Use of this source code is governed by the GPL v3 license\n"
+"* that can be found in the LICENSE file.");
} }
private static final String PATTERN = "Lang.get(\""; private static final String PATTERN = "Lang.get(\"";