Author: mvidner Date: Fri Nov 9 16:04:35 2007 New Revision: 41933 URL: http://svn.opensuse.org/viewcvs/yast?rev=41933&view=rev Log: Allow nil in UI::ChangeWidget again (#340523). Improved error reporting for cases where it is rightly disallowed. Modified: trunk/core/VERSION trunk/core/base/tools/devtools/generateYCPWrappers trunk/core/libyui/src/Y2UINamespace.h trunk/core/package/yast2-core.changes Modified: trunk/core/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/VERSION?rev=41933&r1=41932&r2=41933&view=diff ============================================================================== --- trunk/core/VERSION (original) +++ trunk/core/VERSION Fri Nov 9 16:04:35 2007 @@ -1 +1 @@ -2.16.2 +2.16.3 Modified: trunk/core/base/tools/devtools/generateYCPWrappers URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/base/tools/devtools/generateYCPWrappers?rev=41933&r1=41932&r2=41933&view=diff ============================================================================== --- trunk/core/base/tools/devtools/generateYCPWrappers (original) +++ trunk/core/base/tools/devtools/generateYCPWrappers Fri Nov 9 16:04:35 2007 @@ -1,5 +1,10 @@ #!/usr/bin/perl -w +# example: +# /* TYPEINFO: boolean (symbol, symbol, any) */ +# YCPValue ChangeWidget ( const YCPSymbol & widget_id, const YCPSymbol & property, const YCPValue & /*nil*/ new_value ); + + my $header_file = shift; my $call_file = shift; my $register_file = shift; @@ -50,6 +55,11 @@ open ( CALL, "> $call_file" ) or die "Cannot open output file"; open ( REGISTER, "> $register_file" ) or die "Cannot open output file"; +my $generated = "\t// This file is generated by generateYCPwrappers from $header_file\n\n"; +print CALL $generated; +print REGISTER $generated; + +print CALL "\t\tstatic const char * err_fmt = \"Parameter %d is nil, %s is required\";\n"; my $position = 0; while (@exports) @@ -66,21 +76,23 @@ while (@params) { - my @par = split (" ", shift (@params) ); - my $type = $par [0]; - if ( $type =~ /const/ ) - { - $type = $par [1]; - } - $type =~ s/^YCP(\w+)&?/$1/; - - push (@tests, "if (m_param$paramcount->isVoid()) {y2error(\"ERROR: Parameter $paramcount is nil, ".$type." is required\"); return YCPVoid();}"); - - $type = "m_param" . $paramcount . "->as" . $type . "()" ; - push @cppparams, $type; - $paramcount++; + my $par = shift (@params); + $par =~ m{(const\s*)?YCP(\w+)\s*(&\s*)?(/\*nil\*/)?}; + my $type = $2; + if (defined $4) { # #340523 + push (@tests, "// m_param$paramcount may be nil"); + } + else { + push (@tests, "if (m_param$paramcount->isVoid()) {ycp2error(err_fmt, $paramcount, \"$type\"); return YCPVoid();}"); + + } + $type = "m_param" . $paramcount . "->as" . $type . "()" ; + push @cppparams, $type; + $paramcount++; } - print CALL "\t\tcase $position: ". join (" ", @tests) . " return m_instance->$func_name (" . join (", ", @cppparams) . "); \n" ; + print CALL "\t\tcase $position: // $func_name\n" . + "\t\t\t". join ("\n\t\t\t", @tests) . "\n" . + "\t\t\treturn m_instance->$func_name (" . join (", ", @cppparams) . "); \n" ; print REGISTER "\tenterSymbol (new SymbolEntry (this, $position, " ; print REGISTER "\"$func_name\", SymbolEntry::c_function, Type::fromSignature (\"$signature\") ) );\n"; @@ -91,7 +103,3 @@ close ( CALL ); close ( REGISTER ); - - -0 - Modified: trunk/core/libyui/src/Y2UINamespace.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Y2UINamespace.h?rev=41933&r1=41932&r2=41933&view=diff ============================================================================== --- trunk/core/libyui/src/Y2UINamespace.h (original) +++ trunk/core/libyui/src/Y2UINamespace.h Fri Nov 9 16:04:35 2007 @@ -180,17 +180,14 @@ /* TYPEINFO: boolean() */ YCPValue CloseDialog(); - // TODO DECL_NIL? /* TYPEINFO: boolean (symbol, symbol, any) */ - YCPValue ChangeWidget ( const YCPSymbol & widget_id, const YCPSymbol & property, const YCPValue & new_value ); + YCPValue ChangeWidget ( const YCPSymbol & widget_id, const YCPSymbol & property, const YCPValue & /*nil*/ new_value ); - // TODO DECL_NIL? /* TYPEINFO: boolean (term, symbol, any) */ - YCPValue ChangeWidget ( const YCPTerm & widget_id, const YCPSymbol & property, const YCPValue & new_value ); + YCPValue ChangeWidget ( const YCPTerm & widget_id, const YCPSymbol & property, const YCPValue & /*nil*/ new_value ); - // TODO DECL_NIL? /* TYPEINFO: boolean (term, term, any) */ - YCPValue ChangeWidget ( const YCPTerm & widget_id, const YCPTerm & property, const YCPValue & new_value ); + YCPValue ChangeWidget ( const YCPTerm & widget_id, const YCPTerm & property, const YCPValue & /*nil*/ new_value ); /* TYPEINFO: any (symbol, symbol) */ YCPValue QueryWidget ( const YCPSymbol & widget_id, const YCPSymbol & property ); Modified: trunk/core/package/yast2-core.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/package/yast2-core.changes?rev=41933&r1=41932&r2=41933&view=diff ============================================================================== --- trunk/core/package/yast2-core.changes (original) +++ trunk/core/package/yast2-core.changes Fri Nov 9 16:04:35 2007 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Nov 9 16:04:19 CET 2007 - mvidner@suse.cz + +- Allow nil in UI::ChangeWidget again (#340523). Improved error + reporting for cases where it is rightly disallowed. +- 2.16.3 + +------------------------------------------------------------------- Fri Nov 2 14:03:37 CET 2007 - mvidner@suse.cz - Do not look for YCP scripts under the current working -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org