anjuta r3970 - in trunk: . libanjuta/interfaces manuals/reference/libanjuta
- From: sgranjoux svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r3970 - in trunk: . libanjuta/interfaces manuals/reference/libanjuta
- Date: Fri, 30 May 2008 20:21:58 +0000 (UTC)
Author: sgranjoux
Date: Fri May 30 20:21:58 2008
New Revision: 3970
URL: http://svn.gnome.org/viewvc/anjuta?rev=3970&view=rev
Log:
* libanjuta/interfaces/anjuta-idl-compiler.pl,
libanjuta/interfaces/libanjuta.idl,
manuals/reference/libanjuta/libanjuta-sections.txt:
Keep comment for enum and structures
Declare class typedef first
Allow to document Anjuta shell variable using define
Add a documentation sample in IAnjutaProjectManager interface
* manuals/reference/libanjuta/writing-plugins.sgml:
Fix a detail in the previous patch
Modified:
trunk/ChangeLog
trunk/libanjuta/interfaces/anjuta-idl-compiler.pl
trunk/libanjuta/interfaces/libanjuta.idl
trunk/manuals/reference/libanjuta/libanjuta-sections.txt
trunk/manuals/reference/libanjuta/writing-plugins.sgml
Modified: trunk/libanjuta/interfaces/anjuta-idl-compiler.pl
==============================================================================
--- trunk/libanjuta/interfaces/anjuta-idl-compiler.pl (original)
+++ trunk/libanjuta/interfaces/anjuta-idl-compiler.pl Fri May 30 20:21:58 2008
@@ -261,6 +261,18 @@
$linenum++;
next;
}
+ my $define_hr = {};
+ if (is_define($line, $define_hr))
+ {
+ die "Parse error at $idl_file:$linenum: Defines should only be in interface"
+ if (current_level(@level) ne "interface");
+ die "Parse error at $idl_file:$linenum: Class name expected"
+ if ($current_class eq "");
+ my $comments_in = get_comments();
+ compile_define($data_hr, $current_class, $comments_in, $define_hr);
+ $linenum++;
+ next;
+ }
if (is_block_end($line))
{
if (current_level(@level) eq "interface")
@@ -449,6 +461,19 @@
return 0;
}
+sub is_define
+{
+ my ($line, $define_hr) = @_;
+ if ($line =~ /^\s*#define\s+([\w_][\w\d_]*)\s+(.*)\s*$/)
+ {
+ $define_hr->{'name'} = $1;
+ $define_hr->{'value'} = $2;
+ ## print "Define: $line\n";
+ return 1;
+ }
+ return 0;
+}
+
sub normalize_namespace
{
my ($current_class, $text) = @_;
@@ -575,6 +600,20 @@
}
}
+sub compile_define
+{
+ my ($data_hr, $current_class, $comments, $define_hr) = @_;
+ my $class_hr = $data_hr->{$current_class};
+ if (!defined($class_hr->{"__defines"}))
+ {
+ $class_hr->{"__defines"} = [];
+ }
+ my $defines_lr = $class_hr->{'__defines'};
+
+ $define_hr->{'__comments'} = $comments;
+ push (@$defines_lr, $define_hr);
+}
+
sub compile_typedef
{
my ($data_hr, $current_class, $comments, $typedef) = @_;
@@ -992,6 +1031,7 @@
{
$answer .= "#include <$module_name/interfaces/$parent_include>\n";
}
+
$answer .=
"
G_BEGIN_DECLS
@@ -1022,12 +1062,36 @@
$answer .= "\n";
}
+ $answer .=
+"#define ${macro_name}_ERROR ${prefix}_error_quark()
+
+";
+
+ ## Added defines;
+ my $defines_lr = $class_hr->{"__defines"};
+ if (defined ($defines_lr))
+ {
+ foreach my $d (@$defines_lr)
+ {
+ my $comments_out = $d->{'__comments'};
+ my $name = $d->{'name'};
+ my $value = $d->{'value'};
+ $answer .= "${comments_out}#define\t${macro_name}_${name}\t${value}\n\n";
+ }
+ $answer .= "\n";
+ }
+
+ $answer .=
+"typedef struct _$class $class;
+typedef struct _${class}Iface ${class}Iface;\n\n";
+
## Added enums;
if (defined ($enums_hr))
{
foreach my $e (sort keys %$enums_hr)
{
- $answer .= "typedef enum {\n";
+ my $comments_out = $enums_hr->{$e}->{'__comments'};
+ $answer .= "${comments_out}typedef enum {\n";
foreach my $d (@{$enums_hr->{$e}->{"__data"}})
{
$answer .= "\t${macro_name}_$d\n";
@@ -1041,7 +1105,8 @@
{
foreach my $s (sort keys %$structs_hr)
{
- $answer .= "typedef struct _${class}$s ${class}$s;\n";
+ my $comments_out = $structs_hr->{$s}->{'__comments'};
+ $answer .= "${comments_out}typedef struct _${class}$s ${class}$s;\n";
$answer .= "struct _${class}$s {\n";
foreach my $d (@{$structs_hr->{$s}->{"__data"}})
{
@@ -1051,11 +1116,7 @@
$answer .= "};\n\n";
}
}
-
- $answer .=
-"#define ${macro_name}_ERROR ${prefix}_error_quark()
-";
## Added Typedefs
my $typedefs_lr = $class_hr->{"__typedefs"};
if (defined ($typedefs_lr))
@@ -1069,9 +1130,7 @@
}
$answer .=
-"typedef struct _$class $class;
-typedef struct _${class}Iface ${class}Iface;
-
+"
struct _${class}Iface {
$parent_iface g_iface;
Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl (original)
+++ trunk/libanjuta/interfaces/libanjuta.idl Fri May 30 20:21:58 2008
@@ -2710,6 +2710,20 @@
*/
interface IAnjutaProjectManager
{
+ /**
+ * IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI
+ *
+ * Anjuta shell value set by project manager to the project root uri.
+ */
+ #define PROJECT_ROOT_URI "project_root_uri"
+
+ /**
+ * IANJUTA_PROJECT_MANAGER_CURRENT_URI
+ *
+ * Anjuta shell value set by project manager to the current uri.
+ */
+ #define CURRENT_URI "project_manager_current_uri"
+
enum ElementType
{
UNKNOWN,
Modified: trunk/manuals/reference/libanjuta/libanjuta-sections.txt
==============================================================================
--- trunk/manuals/reference/libanjuta/libanjuta-sections.txt (original)
+++ trunk/manuals/reference/libanjuta/libanjuta-sections.txt Fri May 30 20:21:58 2008
@@ -1396,12 +1396,14 @@
IANJUTA_TYPE_PROJECT_MANAGER_CAPABILITIES
IANJUTA_TYPE_PROJECT_MANAGER_ELEMENT_TYPE
IANJUTA_TYPE_PROJECT_MANAGER_TARGET_TYPE
-IAnjutaProjectManagerCapabilities
-IAnjutaProjectManagerElementType
-IAnjutaProjectManagerTargetType
IANJUTA_PROJECT_MANAGER_ERROR
+IANJUTA_PROJECT_MANAGER_PROJECT_ROOT_URI
+IANJUTA_PROJECT_MANAGER_CURRENT_URI
IAnjutaProjectManager
IAnjutaProjectManagerIface
+IAnjutaProjectManagerCapabilities
+IAnjutaProjectManagerElementType
+IAnjutaProjectManagerTargetType
ianjuta_project_manager_element_type_get_type
ianjuta_project_manager_target_type_get_type
ianjuta_project_manager_error_quark
@@ -1414,6 +1416,7 @@
ianjuta_project_manager_get_children
ianjuta_project_manager_get_element_type
ianjuta_project_manager_get_elements
+ianjuta_project_manager_get_packages
ianjuta_project_manager_get_parent
ianjuta_project_manager_get_selected
ianjuta_project_manager_get_target_type
Modified: trunk/manuals/reference/libanjuta/writing-plugins.sgml
==============================================================================
--- trunk/manuals/reference/libanjuta/writing-plugins.sgml (original)
+++ trunk/manuals/reference/libanjuta/writing-plugins.sgml Fri May 30 20:21:58 2008
@@ -217,7 +217,7 @@
#include "hello-world.h"
/* Parent class. Part of standard class definition */
-gpointer parent_class;
+static gpointer parent_class;
</programlisting>
</para>
<para>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]