[macruby-changes] [4498] MacRuby/trunk/bs.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Sep 8 18:36:42 PDT 2010
Revision: 4498
http://trac.macosforge.org/projects/ruby/changeset/4498
Author: lsansonetti at apple.com
Date: 2010-09-08 18:36:41 -0700 (Wed, 08 Sep 2010)
Log Message:
-----------
ignore elements nesting function_pointers (instead of raising an exception)
Modified Paths:
--------------
MacRuby/trunk/bs.c
Modified: MacRuby/trunk/bs.c
===================================================================
--- MacRuby/trunk/bs.c 2010-09-08 04:20:03 UTC (rev 4497)
+++ MacRuby/trunk/bs.c 2010-09-09 01:36:41 UTC (rev 4498)
@@ -447,6 +447,7 @@
bs_element_function_pointer_t *func_ptr;
bool success;
CFStringRef cf_path;
+ bool nested_func_ptr;
if (callback == NULL)
return false;
@@ -508,12 +509,12 @@
func = NULL;
func_ptr = NULL;
+ func_ptr_arg_depth = -1;
+ nested_func_ptr = false;
klass = NULL;
method = NULL;
protocol_name = NULL;
- func_ptr_arg_depth = -1;
-
while (true) {
const char *name;
unsigned int namelen;
@@ -545,11 +546,21 @@
bs_element = NULL;
+ atom = bs_xml_element(name, namelen);
+ if (atom == NULL)
+ continue;
+
+ if (nested_func_ptr) {
+ // FIXME: elements nesting function_pointers aren't supported yet by the
+ // parser, so we just ignore them.
+ if (node_type == XML_READER_TYPE_END_ELEMENT
+ && (atom->val == BS_XML_FUNCTION || atom->val == BS_XML_METHOD)) {
+ nested_func_ptr = false;
+ }
+ continue;
+ }
+
if (node_type == XML_READER_TYPE_ELEMENT) {
- atom = bs_xml_element(name, namelen);
- if (atom == NULL)
- continue;
-
switch (atom->val) {
case BS_XML_DEPENDS_ON:
{
@@ -912,8 +923,11 @@
bs_arg->type = get_type_attribute(reader);
if (get_boolean_attribute(reader, "function_pointer", false)) {
- if (func_ptr != NULL) /* FIXME */
- BAIL("internal error, nested function pointers detected");
+ if (func_ptr != NULL) {
+ func_ptr = NULL;
+ nested_func_ptr = true;
+ break;
+ }
bs_arg->function_pointer = (bs_element_function_pointer_t *)
calloc(1, sizeof(bs_element_function_pointer_t));
ASSERT_ALLOC(bs_arg->function_pointer);
@@ -995,8 +1009,11 @@
}
if (get_boolean_attribute(reader, "function_pointer", false)) {
- if (func_ptr != NULL) /* FIXME */
- BAIL("internal error, nested function pointers detected");
+ if (func_ptr != NULL) {
+ func_ptr = NULL;
+ nested_func_ptr = true;
+ break;
+ }
bs_retval->function_pointer = (bs_element_function_pointer_t *)
calloc(1, sizeof(bs_element_function_pointer_t));
ASSERT_ALLOC(bs_retval->function_pointer);
@@ -1075,10 +1092,6 @@
}
}
else if (node_type == XML_READER_TYPE_END_ELEMENT) {
- atom = bs_xml_element(name, namelen);
- if (atom == NULL)
- continue;
-
switch (atom->val) {
case BS_XML_INFORMAL_PROTOCOL:
{
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100908/2c5139b6/attachment.html>
More information about the macruby-changes
mailing list