Bug 552065: Add deprecation information to GIR

* giscanner/ast.py: Add deprecation attributes.
	* giscanner/girwriter.py: Write out deprecation data.
	* girepository/girparser.c: Relax parsing; deprecated
	attribute now includes freeform string.
	* giscanner/scannerlexer.l: Parse Deprecated.
	* giscanner/transformer.py: Look for deprecated attribute
	on functions.
	* tests/scanner/*: Add a Deprecated test.

svn path=/trunk/; revision=603
This commit is contained in:
Colin Walters 2008-09-15 14:46:19 +00:00
parent 7a55bd25d9
commit 0ab7337756

View File

@ -634,7 +634,7 @@ start_glib_boxed (GMarkupParseContext *context,
((GIrNode *)boxed)->name = g_strdup (name); ((GIrNode *)boxed)->name = g_strdup (name);
boxed->gtype_name = g_strdup (typename); boxed->gtype_name = g_strdup (typename);
boxed->gtype_init = g_strdup (typeinit); boxed->gtype_init = g_strdup (typeinit);
if (deprecated && strcmp (deprecated, "1") == 0) if (deprecated)
boxed->deprecated = TRUE; boxed->deprecated = TRUE;
else else
boxed->deprecated = FALSE; boxed->deprecated = FALSE;
@ -706,7 +706,7 @@ start_function (GMarkupParseContext *context,
((GIrNode *)function)->name = g_strdup (name); ((GIrNode *)function)->name = g_strdup (name);
function->symbol = g_strdup (symbol); function->symbol = g_strdup (symbol);
function->parameters = NULL; function->parameters = NULL;
if (deprecated && strcmp (deprecated, "1") == 0) if (deprecated)
function->deprecated = TRUE; function->deprecated = TRUE;
else else
function->deprecated = FALSE; function->deprecated = FALSE;
@ -1138,7 +1138,7 @@ start_enum (GMarkupParseContext *context,
((GIrNode *)enum_)->name = g_strdup (name); ((GIrNode *)enum_)->name = g_strdup (name);
enum_->gtype_name = g_strdup (typename); enum_->gtype_name = g_strdup (typename);
enum_->gtype_init = g_strdup (typeinit); enum_->gtype_init = g_strdup (typeinit);
if (deprecated && strcmp (deprecated, "1") == 0) if (deprecated)
enum_->deprecated = TRUE; enum_->deprecated = TRUE;
else else
enum_->deprecated = FALSE; enum_->deprecated = FALSE;
@ -1280,7 +1280,7 @@ start_member (GMarkupParseContext *context,
value_->value = parse_value (value); value_->value = parse_value (value);
if (deprecated && strcmp (deprecated, "1") == 0) if (deprecated)
value_->deprecated = TRUE; value_->deprecated = TRUE;
else else
value_->deprecated = FALSE; value_->deprecated = FALSE;
@ -1330,7 +1330,7 @@ start_constant (GMarkupParseContext *context,
ctx->current_typed = (GIrNode*) constant; ctx->current_typed = (GIrNode*) constant;
if (deprecated && strcmp (deprecated, "1") == 0) if (deprecated)
constant->deprecated = TRUE; constant->deprecated = TRUE;
else else
constant->deprecated = FALSE; constant->deprecated = FALSE;
@ -1408,7 +1408,7 @@ start_errordomain (GMarkupParseContext *context,
domain->getquark = g_strdup (getquark); domain->getquark = g_strdup (getquark);
domain->codes = g_strdup (codes); domain->codes = g_strdup (codes);
if (deprecated && strcmp (deprecated, "1") == 0) if (deprecated)
domain->deprecated = TRUE; domain->deprecated = TRUE;
else else
domain->deprecated = FALSE; domain->deprecated = FALSE;
@ -1460,7 +1460,7 @@ start_interface (GMarkupParseContext *context,
((GIrNode *)iface)->name = g_strdup (name); ((GIrNode *)iface)->name = g_strdup (name);
iface->gtype_name = g_strdup (typename); iface->gtype_name = g_strdup (typename);
iface->gtype_init = g_strdup (typeinit); iface->gtype_init = g_strdup (typeinit);
if (deprecated && strcmp (deprecated, "1") == 0) if (deprecated)
iface->deprecated = TRUE; iface->deprecated = TRUE;
else else
iface->deprecated = FALSE; iface->deprecated = FALSE;
@ -1516,7 +1516,7 @@ start_class (GMarkupParseContext *context,
iface->gtype_name = g_strdup (typename); iface->gtype_name = g_strdup (typename);
iface->gtype_init = g_strdup (typeinit); iface->gtype_init = g_strdup (typeinit);
iface->parent = g_strdup (parent); iface->parent = g_strdup (parent);
if (deprecated && strcmp (deprecated, "1") == 0) if (deprecated)
iface->deprecated = TRUE; iface->deprecated = TRUE;
else else
iface->deprecated = FALSE; iface->deprecated = FALSE;
@ -1918,7 +1918,7 @@ start_struct (GMarkupParseContext *context,
struct_ = (GIrNodeStruct *) g_ir_node_new (G_IR_NODE_STRUCT); struct_ = (GIrNodeStruct *) g_ir_node_new (G_IR_NODE_STRUCT);
((GIrNode *)struct_)->name = g_strdup (name); ((GIrNode *)struct_)->name = g_strdup (name);
if (deprecated && strcmp (deprecated, "1") == 0) if (deprecated)
struct_->deprecated = TRUE; struct_->deprecated = TRUE;
else else
struct_->deprecated = FALSE; struct_->deprecated = FALSE;
@ -1969,7 +1969,7 @@ start_union (GMarkupParseContext *context,
((GIrNode *)union_)->name = g_strdup (name); ((GIrNode *)union_)->name = g_strdup (name);
union_->gtype_name = g_strdup (typename); union_->gtype_name = g_strdup (typename);
union_->gtype_init = g_strdup (typeinit); union_->gtype_init = g_strdup (typeinit);
if (deprecated && strcmp (deprecated, "1") == 0) if (deprecated)
union_->deprecated = TRUE; union_->deprecated = TRUE;
else else
union_->deprecated = FALSE; union_->deprecated = FALSE;