mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-16 16:34:47 -04:00
Fixed a misleading error message.
This commit is contained in:
parent
c947390476
commit
5955df2576
@ -124,7 +124,6 @@ public final class ElementTypeDescriptionCustom extends ElementTypeDescription {
|
|||||||
throw new NodeException(Lang.get("err_recursiveNestingAt_N0", circuit.getOrigin()));
|
throw new NodeException(Lang.get("err_recursiveNestingAt_N0", circuit.getOrigin()));
|
||||||
|
|
||||||
if (isGeneric()) {
|
if (isGeneric()) {
|
||||||
try {
|
|
||||||
Context args;
|
Context args;
|
||||||
if (containingVisualElement != null) {
|
if (containingVisualElement != null) {
|
||||||
args = containingVisualElement.getGenericArgs();
|
args = containingVisualElement.getGenericArgs();
|
||||||
@ -136,8 +135,10 @@ public final class ElementTypeDescriptionCustom extends ElementTypeDescription {
|
|||||||
if (containingVisualElement.getGenericArgs() != null)
|
if (containingVisualElement.getGenericArgs() != null)
|
||||||
args.declareVar("args", containingVisualElement.getGenericArgs());
|
args.declareVar("args", containingVisualElement.getGenericArgs());
|
||||||
s.execute(args);
|
s.execute(args);
|
||||||
} catch (HGSEvalException e) {
|
} catch (HGSEvalException | ParserException |IOException e) {
|
||||||
throw new NodeException(Lang.get("err_evaluatingGenericsCode_N_N_N", circuit.getOrigin(), containingVisualElement, argsCode), e);
|
final NodeException ex = new NodeException(Lang.get("err_evaluatingGenericsCode_N_N", containingVisualElement, argsCode), e);
|
||||||
|
ex.setOrigin(circuit.getOrigin());
|
||||||
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -169,15 +170,14 @@ public final class ElementTypeDescriptionCustom extends ElementTypeDescription {
|
|||||||
genS.execute(mod);
|
genS.execute(mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (HGSEvalException e) {
|
} catch (HGSEvalException | ParserException | IOException e) {
|
||||||
throw new NodeException(Lang.get("err_evaluatingGenericsCode_N_N_N", circuit.getOrigin(), ve, gen), e);
|
final NodeException ex = new NodeException(Lang.get("err_evaluatingGenericsCode_N_N", ve, gen), e);
|
||||||
|
ex.setOrigin(circuit.getOrigin());
|
||||||
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ModelCreator(c, library, true, new NetList(netList, errorVisualElement), subName, depth, errorVisualElement);
|
return new ModelCreator(c, library, true, new NetList(netList, errorVisualElement), subName, depth, errorVisualElement);
|
||||||
} catch (IOException | ParserException e) {
|
|
||||||
throw new NodeException(Lang.get("err_evaluatingGenericsCode"), e);
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
return new ModelCreator(circuit, library, true, new NetList(netList, errorVisualElement), subName, depth, errorVisualElement);
|
return new ModelCreator(circuit, library, true, new NetList(netList, errorVisualElement), subName, depth, errorVisualElement);
|
||||||
}
|
}
|
||||||
@ -210,18 +210,18 @@ public final class ElementTypeDescriptionCustom extends ElementTypeDescription {
|
|||||||
/**
|
/**
|
||||||
* @return the generics field default value
|
* @return the generics field default value
|
||||||
*/
|
*/
|
||||||
public String getDeclarationDefault() {
|
public String getDeclarationDefault() throws NodeException {
|
||||||
if (declarationDefault == null)
|
if (declarationDefault == null)
|
||||||
declarationDefault = createDeclarationDefault();
|
declarationDefault = createDeclarationDefault();
|
||||||
return declarationDefault;
|
return declarationDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createDeclarationDefault() {
|
private String createDeclarationDefault() throws NodeException {
|
||||||
TreeSet<String> nameSet = new TreeSet<>();
|
TreeSet<String> nameSet = new TreeSet<>();
|
||||||
for (VisualElement ve : circuit.getElements()) {
|
for (VisualElement ve : circuit.getElements()) {
|
||||||
String gen = ve.getElementAttributes().get(Keys.GENERIC).trim();
|
String gen = ve.getElementAttributes().get(Keys.GENERIC).trim();
|
||||||
try {
|
|
||||||
if (!gen.isEmpty()) {
|
if (!gen.isEmpty()) {
|
||||||
|
try {
|
||||||
Parser p = new Parser(gen);
|
Parser p = new Parser(gen);
|
||||||
p.enableRefReadCollection();
|
p.enableRefReadCollection();
|
||||||
p.parse(false);
|
p.parse(false);
|
||||||
@ -236,9 +236,11 @@ public final class ElementTypeDescriptionCustom extends ElementTypeDescription {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (ParserException | IOException e) {
|
} catch (ParserException | IOException e) {
|
||||||
return "";
|
final NodeException ex = new NodeException(Lang.get("err_evaluatingGenericsCode_N_N", ve, gen), e);
|
||||||
|
ex.setOrigin(circuit.getOrigin());
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -24,6 +24,7 @@ import de.neemann.digital.draw.shapes.ShapeFactory;
|
|||||||
import de.neemann.digital.gui.Main;
|
import de.neemann.digital.gui.Main;
|
||||||
import de.neemann.digital.gui.Settings;
|
import de.neemann.digital.gui.Settings;
|
||||||
import de.neemann.digital.gui.components.modification.*;
|
import de.neemann.digital.gui.components.modification.*;
|
||||||
|
import de.neemann.digital.hdl.hgs.ParserException;
|
||||||
import de.neemann.digital.lang.Lang;
|
import de.neemann.digital.lang.Lang;
|
||||||
import de.neemann.digital.undo.*;
|
import de.neemann.digital.undo.*;
|
||||||
import de.neemann.gui.*;
|
import de.neemann.gui.*;
|
||||||
@ -1026,8 +1027,13 @@ public class CircuitComponent extends JComponent implements ChangedListener, Lib
|
|||||||
if (elementType instanceof ElementTypeDescriptionCustom) {
|
if (elementType instanceof ElementTypeDescriptionCustom) {
|
||||||
ElementTypeDescriptionCustom customDescr = (ElementTypeDescriptionCustom) elementType;
|
ElementTypeDescriptionCustom customDescr = (ElementTypeDescriptionCustom) elementType;
|
||||||
if (customDescr.isGeneric()) {
|
if (customDescr.isGeneric()) {
|
||||||
if (element.getElementAttributes().get(Keys.GENERIC).isEmpty())
|
if (element.getElementAttributes().get(Keys.GENERIC).isEmpty()) {
|
||||||
|
try {
|
||||||
element.getElementAttributes().set(Keys.GENERIC, customDescr.getDeclarationDefault());
|
element.getElementAttributes().set(Keys.GENERIC, customDescr.getDeclarationDefault());
|
||||||
|
} catch (NodeException ex) {
|
||||||
|
new ErrorMessage(Lang.get("msg_errParsingGenerics")).addCause(ex).show(CircuitComponent.this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1024,9 +1024,11 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
|
|||||||
<string name="err_NameOfIOIsInvalidOrNotUnique_N">Der Signalname "{0}" ist ungültig oder mehrfach verwendet!</string>
|
<string name="err_NameOfIOIsInvalidOrNotUnique_N">Der Signalname "{0}" ist ungültig oder mehrfach verwendet!</string>
|
||||||
<string name="err_substitutingError">Fehler bei der Substitution von Elementen für die Analyse.</string>
|
<string name="err_substitutingError">Fehler bei der Substitution von Elementen für die Analyse.</string>
|
||||||
<string name="err_genericCircuitsAreNotYetSupported">Generische Schaltungen werden noch nicht unterstützt.</string>
|
<string name="err_genericCircuitsAreNotYetSupported">Generische Schaltungen werden noch nicht unterstützt.</string>
|
||||||
<string name="err_evaluatingGenericsCode_N_N_N">Fehler bei der Auswertung des generischen Codes der Schaltung. Datei {0}; Komponente: {1}; Code:
|
<string name="err_evaluatingGenericsCode_N_N">Fehler bei der Auswertung des generischen Codes der Schaltung. Code:
|
||||||
{2}</string>
|
{1}
|
||||||
<string name="err_evaluatingGenericsCode">Fehler bei der Auswertung des generischen Codes der Schaltung.</string>
|
in Komponente: {0}
|
||||||
|
</string>
|
||||||
|
<string name="msg_errParsingGenerics">Fehler bei der Analyse des generischen Codes.</string>
|
||||||
|
|
||||||
<string name="key_AddrBits">Adress-Bits</string><!-- ROM, RAMDualPort, RAMSinglePort, RAMSinglePortSel, EEPROM -->
|
<string name="key_AddrBits">Adress-Bits</string><!-- ROM, RAMDualPort, RAMSinglePort, RAMSinglePortSel, EEPROM -->
|
||||||
<string name="key_AddrBits_tt">Anzahl der Adress-Bits, die verwendet werden.</string>
|
<string name="key_AddrBits_tt">Anzahl der Adress-Bits, die verwendet werden.</string>
|
||||||
|
@ -1016,9 +1016,10 @@
|
|||||||
<string name="err_NameOfIOIsInvalidOrNotUnique_N">The signal name "{0}" is invalid or used multiple times!</string>
|
<string name="err_NameOfIOIsInvalidOrNotUnique_N">The signal name "{0}" is invalid or used multiple times!</string>
|
||||||
<string name="err_substitutingError">Error when substituting components for the analysis.</string>
|
<string name="err_substitutingError">Error when substituting components for the analysis.</string>
|
||||||
<string name="err_genericCircuitsAreNotYetSupported">Generic circuits are not yet supported.</string>
|
<string name="err_genericCircuitsAreNotYetSupported">Generic circuits are not yet supported.</string>
|
||||||
<string name="err_evaluatingGenericsCode_N_N_N">Error in the evaluation of the generic code of the circuit. File {0}; Component: {1}; Code
|
<string name="err_evaluatingGenericsCode_N_N">Error in the evaluation of the generic code of the circuit. Code
|
||||||
{2}</string>
|
{1}
|
||||||
<string name="err_evaluatingGenericsCode">Error in the evaluation of the generic code of the circuit.</string>
|
at Component: {0}</string>
|
||||||
|
<string name="msg_errParsingGenerics">Error while parsing generics code.</string>
|
||||||
|
|
||||||
<string name="key_AddrBits">Address Bits</string><!-- ROM, RAMDualPort, RAMSinglePort, RAMSinglePortSel, EEPROM -->
|
<string name="key_AddrBits">Address Bits</string><!-- ROM, RAMDualPort, RAMSinglePort, RAMSinglePortSel, EEPROM -->
|
||||||
<string name="key_AddrBits_tt">Number of address bits used.</string>
|
<string name="key_AddrBits_tt">Number of address bits used.</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user