[yast-commit] r39848 - in /branches/tmp/mvidner/ui-as-namespace/core/libycp/src: Bytecode.cc StaticDeclaration.cc YExpression.cc YStatement.cc include/ycp/Bytecode.h
Author: mvidner
Date: Tue Jul 31 19:33:36 2007
New Revision: 39848
URL: http://svn.opensuse.org/viewcvs/yast?rev=39848&view=rev
Log:
Catch invalid bytecode only once per import, improve error reporting.
Does away with "Code is no statement: 4".
Modified:
branches/tmp/mvidner/ui-as-namespace/core/libycp/src/Bytecode.cc
branches/tmp/mvidner/ui-as-namespace/core/libycp/src/StaticDeclaration.cc
branches/tmp/mvidner/ui-as-namespace/core/libycp/src/YExpression.cc
branches/tmp/mvidner/ui-as-namespace/core/libycp/src/YStatement.cc
branches/tmp/mvidner/ui-as-namespace/core/libycp/src/include/ycp/Bytecode.h
Modified: branches/tmp/mvidner/ui-as-namespace/core/libycp/src/Bytecode.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mvidner/ui-as-namespace/core/libycp/src/Bytecode.cc?rev=39848&r1=39847&r2=39848&view=diff
==============================================================================
--- branches/tmp/mvidner/ui-as-namespace/core/libycp/src/Bytecode.cc (original)
+++ branches/tmp/mvidner/ui-as-namespace/core/libycp/src/Bytecode.cc Tue Jul 31 19:33:36 2007
@@ -845,8 +845,7 @@
YCodePtr res = 0;
- try
- {
+ // there used to be a try/catch here but it was moved to readFile
switch (code)
{
@@ -1059,13 +1058,6 @@
break;
}
- }
- catch (const Bytecode::Invalid&)
- {
- // there are memory leaks all over the place now
- y2error ("Caught invalid bytecode");
- }
-
return res;
}
@@ -1158,8 +1150,17 @@
#if DO_DEBUG
// y2debug ("Header accepted");
#endif
-
- return readCode (instream);
+
+ try
+ {
+ return readCode (instream);
+ }
+ catch (const Bytecode::Invalid&)
+ {
+ // there are memory leaks all over the place now
+ y2error ("Caught invalid bytecode in '%s'", filename.c_str());
+ return 0;
+ }
}
y2error ("Unsupported version %d.%d.%d"
Modified: branches/tmp/mvidner/ui-as-namespace/core/libycp/src/StaticDeclaration.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mvidner/ui-as-namespace/core/libycp/src/StaticDeclaration.cc?rev=39848&r1=39847&r2=39848&view=diff
==============================================================================
--- branches/tmp/mvidner/ui-as-namespace/core/libycp/src/StaticDeclaration.cc (original)
+++ branches/tmp/mvidner/ui-as-namespace/core/libycp/src/StaticDeclaration.cc Tue Jul 31 19:33:36 2007
@@ -526,7 +526,10 @@
if (decl == 0)
{
ycp2error ("No match for '%s (%s)'", name, type->toString().c_str());
- str.setstate (std::ostream::failbit);
+ ycp2error ("That is a builtin function, so your bytecode");
+ ycp2error ("needs to be recompiled using a recent yast2-core.");
+ delete [] name;
+ throw Bytecode::Invalid();
}
delete [] name;
return decl;
Modified: branches/tmp/mvidner/ui-as-namespace/core/libycp/src/YExpression.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mvidner/ui-as-namespace/core/libycp/src/YExpression.cc?rev=39848&r1=39847&r2=39848&view=diff
==============================================================================
--- branches/tmp/mvidner/ui-as-namespace/core/libycp/src/YExpression.cc (original)
+++ branches/tmp/mvidner/ui-as-namespace/core/libycp/src/YExpression.cc Tue Jul 31 19:33:36 2007
@@ -1727,12 +1727,6 @@
{
Bytecode::popNamespace (m_parameterblock->nameSpace());
}
- if (!m_decl
- || m_type->isError ())
- {
- ycp2error ("Can't find builtin '%s'", m_decl ? StaticDeclaration::Decl2String (m_decl, true).c_str() : m_type->toString().c_str());
- str.setstate (ios::failbit);
- }
// throw away type info
m_type = Type::Void;
}
Modified: branches/tmp/mvidner/ui-as-namespace/core/libycp/src/YStatement.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mvidner/ui-as-namespace/core/libycp/src/YStatement.cc?rev=39848&r1=39847&r2=39848&view=diff
==============================================================================
--- branches/tmp/mvidner/ui-as-namespace/core/libycp/src/YStatement.cc (original)
+++ branches/tmp/mvidner/ui-as-namespace/core/libycp/src/YStatement.cc Tue Jul 31 19:33:36 2007
@@ -1521,9 +1521,9 @@
if (nameSpace() == 0)
{
- ycp2error ("Import '%s' failed\n", name().c_str());
- ycp2error ("No namespace\n");
- return;
+ ycp2error ("Import '%s' failed...\n", name().c_str());
+ ycp2error ("Could not create its namespace\n");
+ throw Bytecode::Invalid();
}
// now load symbols we need from the just imported namespace
Modified: branches/tmp/mvidner/ui-as-namespace/core/libycp/src/include/ycp/Bytecode.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/mvidner/ui-as-namespace/core/libycp/src/include/ycp/Bytecode.h?rev=39848&r1=39847&r2=39848&view=diff
==============================================================================
--- branches/tmp/mvidner/ui-as-namespace/core/libycp/src/include/ycp/Bytecode.h (original)
+++ branches/tmp/mvidner/ui-as-namespace/core/libycp/src/include/ycp/Bytecode.h Tue Jul 31 19:33:36 2007
@@ -67,7 +67,12 @@
static map
participants (1)
-
mvidner@svn.opensuse.org