[Lsb-messages] /var/www/bzr/lsb/devel/libtodb2 r28: Use AIreturn instead of Ireturn

Denis Silakov denis.silakov at rosalab.ru
Wed Mar 21 09:22:26 UTC 2012


------------------------------------------------------------
revno: 28
committer: Denis Silakov <denis.silakov at rosalab.ru>
branch nick: libtodb2
timestamp: Wed 2012-03-21 13:22:26 +0400
message:
  Use AIreturn instead of Ireturn
modified:
  collapse_funcptr.pl
  get_data_info.pl
  get_int_info.pl
  headertodb2/prepare_sql.pl
  headertodb2/settings.pm
  int_to_db.pl
  mksymsize
  process_guessed_ints.pl
  set_appearedin.pl
-------------- next part --------------
=== modified file 'collapse_funcptr.pl'
--- a/collapse_funcptr.pl	2008-01-29 06:53:22 +0000
+++ b/collapse_funcptr.pl	2012-03-21 09:22:26 +0000
@@ -39,7 +39,7 @@
 			$dbh->do( "update ArchType set ATbasetype=$newTid where ATbasetype=$Tid" );
 			$dbh->do( "delete from TypeMember where TMmemberof=$Tid" );
 			$dbh->do( "update TypeMember set TMtypeid=$newTid where TMtypeid=$Tid" );
-			$dbh->do( "update Interface set Ireturn=$newTid where Ireturn=$Tid" );
+			$dbh->do( "update ArchInt set AIreturn=$newTid where AIreturn=$Tid" );
 			$dbh->do( "update Parameter set Ptype=$newTid where Ptype=$Tid" );
 		}
 		else {

=== modified file 'get_data_info.pl'
--- a/get_data_info.pl	2008-01-29 06:53:22 +0000
+++ b/get_data_info.pl	2012-03-21 09:22:26 +0000
@@ -62,7 +62,7 @@
 	chomp;
 	my @int = split( /\t/ );
 	my $Iname = $int[0];
-	my $Ireturn = $int[3];
+	my $AIreturn = $int[3];
 
 	if( !$versions{$Iname} ) {
 		print STDERR "Skipping interface $Iname - it is present only in debug info\n" if( !$quiet );
@@ -71,10 +71,10 @@
 		my $Iversion = $versions{$Iname};
 
 		my $returnTtype = "";
-		($Ireturn, $returnTtype) = getTypeType( $Ireturn );
+		($AIreturn, $returnTtype) = getTypeType( $AIreturn );
 
-		print INT_DATA "$Iname;$Iversion;$Ireturn;$returnTtype\n";
-		$return_types{$Iname} = $Ireturn;
+		print INT_DATA "$Iname;$Iversion;$AIreturn;$returnTtype\n";
+		$return_types{$Iname} = $AIreturn;
 	}
 }
 

=== modified file 'get_int_info.pl'
--- a/get_int_info.pl	2009-01-14 10:33:39 +0000
+++ b/get_int_info.pl	2012-03-21 09:22:26 +0000
@@ -66,7 +66,7 @@
     chomp;
     my @int = split( /\t/ );
     my $Iname;
-    my $Ireturn;
+    my $AIreturn;
     my $Iparamnumber;
 
     #FOR c++
@@ -78,7 +78,7 @@
     if($int[0] eq "")
     {#Cpp-language class methods
         $Iname = $int[5];
-        $Ireturn = $int[7];
+        $AIreturn = $int[7];
         $Istatic = $int[10];
         $Iparamnumber = $int[12];
         $IshortName = $int[4];
@@ -103,10 +103,10 @@
             my $Iversion = $versions{$Iname};
 
             my $returnTtype = "";
-            ($Ireturn, $returnTtype) = getTypeType( $Ireturn );
+            ($AIreturn, $returnTtype) = getTypeType( $AIreturn );
 
-            print INT_MAIN "$Iname;$Iversion;$Ireturn;$returnTtype;$IshortName;$IclassName;$Iaccess;$Istatic;\n";
-            $return_types{$Iname} = $Ireturn;
+            print INT_MAIN "$Iname;$Iversion;$AIreturn;$returnTtype;$IshortName;$IclassName;$Iaccess;$Istatic;\n";
+            $return_types{$Iname} = $AIreturn;
 
             for( my $i=1; $i <= $Iparamnumber; $i++ ) {
                 my $param = $int[$i+12];
@@ -119,7 +119,7 @@
     else
     {#C-language functions
         $Iname = $int[3];
-        $Ireturn = $int[6];
+        $AIreturn = $int[6];
         $Iparamnumber = $int[11];
         if( $processed{$Iname} and $processed{$Iname} == $Iparamnumber ) {
             print STDERR "Skipping already processed '$Iname'\n";
@@ -135,10 +135,10 @@
             my $Iversion = $versions{$Iname};
 
             my $returnTtype = "";
-            ($Ireturn, $returnTtype) = getTypeType( $Ireturn );
+            ($AIreturn, $returnTtype) = getTypeType( $AIreturn );
 
-            print INT_MAIN "$Iname;$Iversion;$Ireturn;$returnTtype\n";
-            $return_types{$Iname} = $Ireturn;
+            print INT_MAIN "$Iname;$Iversion;$AIreturn;$returnTtype\n";
+            $return_types{$Iname} = $AIreturn;
 
             for( my $i=1; $i <= $Iparamnumber; $i++ ) {
                 my $param = $int[$i+11];

=== modified file 'headertodb2/prepare_sql.pl'
--- a/headertodb2/prepare_sql.pl	2011-09-05 06:33:47 +0000
+++ b/headertodb2/prepare_sql.pl	2012-03-21 09:22:26 +0000
@@ -451,7 +451,8 @@
     
     ($curTid) = $dbh->selectrow_array("SELECT Tid FROM Type WHERE Tname='$Tname' AND Ttype='$Ttype'");
     if( $curTid ) {
-        ($curReturn) = $dbh->selectrow_array("SELECT Ireturn FROM Interface WHERE Iname='$Iname' AND Ilibrary='$library'");
+	# Note: changes of ret type can be tracked in the DB, if necessary, but this should be done manually
+        ($curReturn) = $dbh->selectrow_array("SELECT DISTINCT AIreturn FROM Interface JOIN ArchInt ON AIint=Iid WHERE Iname='$Iname' AND Ilibrary='$library' LIMIT 1");
         if( $curReturn == $curTid ) {
             next;
         }
@@ -471,7 +472,7 @@
         ($Iname) = $xh->fetchrow_array();
     }
 
-    print "UPDATE Interface SET Ireturn=\@Tid WHERE Iname='$Iname' AND Ilibrary='$library';\n";
+    print "UPDATE Interface JOIN ArchInt ON AIint=Iid SET AIreturn=\@Tid WHERE Iname='$Iname' AND Ilibrary='$library';\n";
 
 }
 close( RETTYPES );
@@ -488,7 +489,7 @@
     else {
         print "SET \@Tid=(SELECT Tid FROM Type WHERE Tname='$Tname' AND Ttype='$Ttype');\n";
     }
-    print "UPDATE Interface SET Ireturn=\@Tid WHERE Iname='$Iname' AND Ilibrary='$library';\n";
+    print "UPDATE Interface JOIN ArchInt ON AIint=Iid SET AIreturn=\@Tid WHERE Iname='$Iname' AND Ilibrary='$library';\n";
 
 }
 close( VAR_RETN );

=== modified file 'headertodb2/settings.pm'
--- a/headertodb2/settings.pm	2008-07-28 15:06:40 +0000
+++ b/headertodb2/settings.pm	2012-03-21 09:22:26 +0000
@@ -72,7 +72,7 @@
 
 # File with functions return types
 # Format: (function name; function version (obtained from debug libraries, see --func-list option); type of return value; ttype of return value).
-# In terms of DB fields: (Iname;AIversion;Ireturn;Ttype)
+# In terms of DB fields: (Iname;AIversion;AIreturn;Ttype)
 our $name_file_func_retn = 'res_func_retn';
 
 # File with header names
@@ -90,7 +90,7 @@
 
 # File with global variables types (i.e. 'return types' of 'Data' interfaces).
 # Format: (variable name; variable version (obtained from debug libraries, see --func-list option); type of variable; ttype of variable).
-# In terms of DB fields: (Iname;Iversion;Ireturn;Ttype)
+# In terms of DB fields: (Iname;AIversion;AIreturn;Ttype)
 our $name_file_var_retn = 'res_var_retn';
 
 # File with types information.

=== modified file 'int_to_db.pl'
--- a/int_to_db.pl	2008-04-29 15:18:15 +0000
+++ b/int_to_db.pl	2012-03-21 09:22:26 +0000
@@ -81,17 +81,17 @@
 
 while( <INT_INFO> ) {
 # 	@line = split( ';' );
-	my ($Iname,$Iversion,$Ireturn,$IretType) = split( ';' );
+	my ($Iname,$Iversion,$AIreturn,$IretType) = split( ';' );
 	chomp($IretType);
 	my $Tid = 0;
 	my @row;
 
-	if( $Ireturn ) {
-	    $type_Q->execute($Ireturn, $IretType) or die "Can't get record for return type $IretType '$Ireturn': ".DBI->errstr ;
+	if( $AIreturn ) {
+	    $type_Q->execute($AIreturn, $IretType) or die "Can't get record for return type $IretType '$AIreturn': ".DBI->errstr ;
 	    @row = $type_Q->fetchrow_array();
 
 	    if( !@row ) {
-		    print STDERR "Can't find Type record for '$Ireturn' $IretType\n";
+		    print STDERR "Can't find Type record for '$AIreturn' $IretType\n";
 		    next;
 	    }
 
@@ -128,7 +128,7 @@
 	    $Iunmangled = "'$Iunmangled'";
 	}
 	
-	my $insert = "INSERT INTO Interface (Iid,Iname,Itype,Iheader,Ireturn,Icandidatefor,Iunmangled,Ilibrary) VALUES (0, '$Iname', 'Function', $Hid, $Tid, ";
+	my $insert = "INSERT INTO Interface (Iid,Iname,Itype,Iheader,Icandidatefor,Iunmangled,Ilibrary) VALUES (0, '$Iname', 'Function', $Hid, ";
 	$insert.= "'4.0', $Iunmangled, '$LibName'); ";
 
 	print $insert."\n";
@@ -143,7 +143,7 @@
 	    $Iversion = 0;
 	}
 	
-	$insert = "INSERT INTO ArchInt (AIarch,AIint,AIversion,AIappearedin,AIwithdrawnin) VALUES($ArchId,\@Iid,$Iversion_id,'',NULL);";
+	$insert = "INSERT INTO ArchInt (AIarch,AIint,AIversion,AIreturn,AIappearedin,AIwithdrawnin) VALUES($ArchId,\@Iid,$Iversion_id,$Tid'',NULL);";
 	print $insert."\n";
 
 	$index++;

=== modified file 'mksymsize'
--- a/mksymsize	2008-09-17 12:17:07 +0000
+++ b/mksymsize	2012-03-21 09:22:26 +0000
@@ -122,7 +122,8 @@
 
 my $query=<<Equery
 SELECT * FROM Interface
-LEFT JOIN Type on Tid = Ireturn
+LEFT JOIN ArchInt ON AIint=Iid
+LEFT JOIN Type on Tid = AIreturn
 JOIN Library on Ilibrary = Lname
 WHERE Iname = ? AND Ilibrary = ?
 Equery
@@ -144,13 +145,13 @@
 			my $int_found = '';
 			if ($int_info && $int_info->{Iid}){
 				$int_found = 1;
-				unless ($int_info->{Ireturn}){
+				unless ($int_info->{AIreturn}){
 					#This may be not quite correct.  Return type may be incorrectly set - we leave such interfaces as is.
 					print<<Einsert
 INSERT INTO Type(Tid,Tname,Ttype,Tlibrary) VALUES(0,'dummy type for $int of library $lib','$typeType','$lib');
 SET \@Tid=(SELECT last_insert_id());
 INSERT INTO ArchType(ATaid,ATtid,ATsize,ATappearedin) VALUES($archID,\@Tid,$ints{$int}->{$lib},'$ver');
-UPDATE Interface SET Ireturn = \@Tid where Iid = $int_info->{Iid};
+UPDATE ArchInt SET AIreturn = \@Tid where AIint = $int_info->{Iid};
 
 Einsert
 					;

=== modified file 'process_guessed_ints.pl'
--- a/process_guessed_ints.pl	2008-01-29 06:53:22 +0000
+++ b/process_guessed_ints.pl	2012-03-21 09:22:26 +0000
@@ -52,7 +52,7 @@
    	or die "Couldn't connect to database: " . DBI->errstr;
 
 my $int_Q = $dbh->prepare(
-'select Iid, Itype, Istandard, Irefspec, Ireturn, Idocumented, Icomment, Icandidatefor, Ideprecatedsince, Iunmangled,
+'select Iid, Itype, Istandard, Irefspec, Iheader, Idocumented, Icomment, Icandidatefor, Ideprecatedsince, Iunmangled,
 	 Isrcbin, Iurl, Ilibrary, Istatic, Ivirtual, Iaccess, Ifkind, Icharge, Iclass, Ishortname
 	 from Interface where Iname = ? and Ilibrary = ? ')
 	or die "Couldn't prepare interface request query: " . DBI->errstr;; # args: interface name and library
@@ -75,7 +75,7 @@
    	or die "Couldn't prepare header request query: " . DBI->errstr;
 
 my $int_I = $dbh->prepare(
-'insert into Interface values(0,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)')
+'insert into Interface values(0,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)')
    	or die "Couldn't prepare interface insertion query: " . DBI->errstr;
 
 my $parameter_I = $dbh->prepare(
@@ -136,7 +136,7 @@
 	my $Istandard = $row[2];
 	my $Irefspec = $row[3];
 	my $Iheader = getHeaderId( $newName );
-	my $Ireturn = $row[4];
+#	my $Iheader = $row[4];
 	my $Idocumented = $row[5];
 	my $Icomment = $row[6];
 	my $Icandidatefor = $row[7];
@@ -153,7 +153,7 @@
 	my $Iclass = $row[18];
 	my $Ishortname = $row[19];
 
-	$int_I->execute( $newName, $Itype, $Istandard, $Irefspec, $Iheader, $Ireturn, $Idocumented, $Icomment, $Icandidatefor,
+	$int_I->execute( $newName, $Itype, $Istandard, $Irefspec, $Iheader, $Idocumented, $Icomment, $Icandidatefor,
 						$Iisdeprecated, $Iunmangled, $Isrcbin, $Iurl, $Ilibrary, $Istatic, $Ivirtual,
 						$Iaccess, $Ifkind, $Icharge, $Iclass, $Ishortname)
 				or die "Couldn't execute int_I statement: ".$int_I->errstr;

=== modified file 'set_appearedin.pl'
--- a/set_appearedin.pl	2010-02-08 13:48:49 +0000
+++ b/set_appearedin.pl	2012-03-21 09:22:26 +0000
@@ -108,8 +108,10 @@
 my $params_Q = $dbh->prepare(
 "select Tid, Ttype from Type where Tid in (select distinct Ptype from Parameter left join Interface
 	on Pint=Iid where Ilibrary='$LibName')
-	union select Tid, Ttype from Interface left join Type on Tid=Ireturn
-	where Ilibrary='$LibName' and Ireturn>0")
+	union select Tid, Ttype from Interface 
+	left join ArchInt on AIint=Iid
+	left join Type on Tid=AIreturn
+	where Ilibrary='$LibName' and AIreturn>0")
    	or die "Couldn't get parameters information: ".DBI->errstr;
 
 $params_Q->execute() or die DBI->errstr;



More information about the lsb-messages mailing list