[anjuta/sdb-queries: 19/22] libanjuta: Support variable args methods in IDL syntax. Use sequential enumeration for fields.



commit 846eb6a28a12022b1882a150f063dfb3973220f9
Author: Naba Kumar <naba gnome org>
Date:   Wed Jun 2 23:49:19 2010 +0300

    libanjuta: Support variable args methods in IDL syntax. Use sequential enumeration for fields.

 libanjuta/interfaces/anjuta-idl-compiler.pl |   32 ++++++++++++++++++++++----
 libanjuta/interfaces/libanjuta.idl          |   31 +++++++++++++------------
 2 files changed, 43 insertions(+), 20 deletions(-)
---
diff --git a/libanjuta/interfaces/anjuta-idl-compiler.pl b/libanjuta/interfaces/anjuta-idl-compiler.pl
index d48f3e9..1037495 100755
--- a/libanjuta/interfaces/anjuta-idl-compiler.pl
+++ b/libanjuta/interfaces/anjuta-idl-compiler.pl
@@ -757,13 +757,14 @@ sub get_canonical_names
 sub get_arg_type_info
 {
 	my ($type, $info) = @_;
-	if (defined ($type_map->{$type}))
+	if (defined ($type) && defined ($type_map->{$type}))
 	{
 		if (defined ($type_map->{$type}->{$info}))
 		{
 			return $type_map->{$type}->{$info};
 		}
 	}
+	return "";
 }
 
 sub get_return_type_val
@@ -796,6 +797,10 @@ sub get_arg_assert
 		$type = $type_arg;
 		$type =~ s/\s//g;
 	}
+
+	## No asserts if type is not defined.
+	return "" if !defined ($type);
+	
 	if (!defined($force) || $force eq "")
 	{
 		$force = 0;
@@ -1169,14 +1174,24 @@ struct _${class}Iface {
 		my $rettype = normalize_namespace($class, $class_hr->{$m}->{'rettype'});
 		my $args = normalize_namespace($class, $class_hr->{$m}->{'args'});
 		$args = convert_args($args);
-		if ($args ne '')
+
+		## No comma for the last arg if it's "..." variable args */
+		if ($args ne '' && $args !~ /\.\.\.$/)
 		{
 			$args .= ", ";
 		}
 		if ($func !~ /^\:\:/)
 		{
 			$rettype = convert_ret($rettype);
-			$answer .= "\t$rettype (*$func) ($class *obj, ${args}GError **err);\n";
+			## No GError **err arg for functions with variable args */
+			if ($args !~ /\.\.\.$/)
+			{
+				$answer .= "\t$rettype (*$func) ($class *obj, ${args}GError **err);\n";
+			}
+			else
+			{
+				$answer .= "\t$rettype (*$func) ($class *obj, ${args});\n";
+			}
 		}
 	}
 	$answer .=
@@ -1213,14 +1228,21 @@ GType  ${prefix}_get_type        (void);
 		my $rettype = normalize_namespace($class, $class_hr->{$m}->{'rettype'});
 		my $args = normalize_namespace($class, $class_hr->{$m}->{'args'});
 		$args = convert_args($args);
-		if ($args ne '')
+		if ($args ne '' && $args !~ /\.\.\.$/)
 		{
 			$args .= ", ";
 		}
 		if ($func !~ /^\:\:/)
 		{
 			$rettype = convert_ret($rettype);
-			$answer .= "${rettype} ${prefix}_$func ($class *obj, ${args}GError **err);\n\n";
+			if ($args !~ /\.\.\.$/)
+			{
+				$answer .= "${rettype} ${prefix}_$func ($class *obj, ${args}GError **err);\n\n";
+			}
+			else
+			{
+				$answer .= "${rettype} ${prefix}_$func ($class *obj, ${args});\n\n";
+			}
 		}
 	}
 	$answer .=
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index d35cf80..5693a74 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -5269,20 +5269,21 @@ interface IAnjutaSymbol
 	 */
 	enum Field
 	{
-		FIELD_SIMPLE = 0,
-		FIELD_ID = 1,
-		FIELD_NAME = 2,
-		FIELD_FILE_POS = 4,
-		FIELD_FILE_SCOPE = 8,
-		FIELD_SIGNATURE = 16,
-		FIELD_RETURNTYPE = 32,
-		FIELD_FILE_PATH = 64,
-		FIELD_IMPLEMENTATION = 128,
-		FIELD_ACCESS = 256,
-		FIELD_KIND = 512,
-		FIELD_TYPE = 1024,
-		FIELD_TYPE_NAME = 2048,
-		FIELD_END = 4096
+		FIELD_ID,
+		FIELD_NAME,
+		FIELD_FILE_POS,
+		FILED_SCOPE_DEF_ID,
+		FIELD_FILE_SCOPE,
+		FIELD_SIGNATURE,
+		FIELD_RETURNTYPE,
+		FIELD_FILE_PATH,
+		FIELD_IMPLEMENTATION,
+		FIELD_ACCESS,
+		FIELD_KIND,
+		FIELD_TYPE,
+		FIELD_TYPE_NAME,
+		FIELD_IS_CONTAINER,
+		FIELD_END
 	}
 
 	gboolean get_boolean (Field field);
@@ -5347,7 +5348,7 @@ interface IAnjutaSymbolQuery
 	
 	typedef void (*AsyncResult) (IAnjutaIterable* result, gpointer user_data);
 	void set_async (gboolean async_mode);
-	void set_fields (IAnjutaSymbolField info_fields);
+	void set_fields (IAnjutaSymbolField field0, ...);
 	void set_filter (IAnjutaSymbolType filters, gboolean includes_types);
 	void set_file_scope (IAnjutaSymbolQueryFileScope filescope_search);
 	void set_offset (gint offset);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]