cvs: php4 /ext/satellite typemanager.c
| From: | David Eriksson | Date: | Tue, 20 Feb 2001 15:35:55 +0000 |
| Subject: | cvs: php4 /ext/satellite typemanager.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-4148@lists.php.net to get a copy of this message | ||
eriksson Tue Feb 20 07:35:55 2001 EDT
Modified files:
/php4/ext/satellite typemanager.c
Log:
Patch for inherited interfaces by Daniel Stodden <stodden@in.tum.de>
Index: php4/ext/satellite/typemanager.c
diff -u php4/ext/satellite/typemanager.c:1.2 php4/ext/satellite/typemanager.c:1.3
--- php4/ext/satellite/typemanager.c:1.2 Fri Sep 1 15:29:00 2000
+++ php4/ext/satellite/typemanager.c Tue Feb 20 07:35:55 2001
@@ -17,7 +17,7 @@
*/
/*
- * $Id: typemanager.c,v 1.2 2000/09/01 22:29:00 eriksson Exp $
+ * $Id: typemanager.c,v 1.3 2001/02/20 15:35:55 eriksson Exp $
* vim: syntax=c tabstop=2 shiftwidth=2
*/
@@ -219,19 +219,63 @@
return pException;
}
+
+
+/*
+ find an operation in an interface tree,
+ recursing into inherited interfaces
+*/
+static CORBA_boolean
+findoperation_recurse( IDL_tree tree, const char *name,
+ IdlInfo *pIdlInfo )
+{
+ IDL_tree inherited;
+ CORBA_boolean success;
+
+ success = orbit_find_type( IDL_INTERFACE(tree).body,
+ name, IDLN_OP_DCL,
+ pIdlInfo );
+ if ( success )
+ return CORBA_TRUE;
+
+ for ( inherited = IDL_INTERFACE(tree).inheritance_spec;
+ inherited != NULL;
+ inherited = IDL_LIST(inherited).next ) {
+ IDL_tree ident = IDL_LIST(inherited).data;
+ InterfaceType *iface;
+
+ iface = TypeManager_FindInterface( IDL_IDENT(ident).repo_id );
+ success = findoperation_recurse( iface->mIdlInfo.mType,
+ name,
+ pIdlInfo );
+ orbit_delete( iface );
+
+ if ( success )
+ return CORBA_TRUE;
+
+ zend_error( E_WARNING, "operation %s not found in iface %s\n",
+ name, IDL_IDENT(ident).repo_id );
+ }
+
+ return CORBA_FALSE;
+}
+
/* find an operation in an interface based on case-insensitive name */
-OperationType * InterfaceType_FindOperation(InterfaceType * pInterface,
- const char * name)
+OperationType * InterfaceType_FindOperation( InterfaceType * pInterface,
+ const char * name )
{
- OperationType * pOperation = orbit_new(OperationType);
- CORBA_boolean success = orbit_find_type(
- pInterface->mIdlInfo.mType, name, IDLN_OP_DCL, &pOperation->mIdlInfo);
- if (!success)
- {
- orbit_delete(pOperation);
- pOperation = NULL;
- }
- return pOperation;
+ OperationType *pOperation = orbit_new(OperationType);
+ IDL_tree tree = pInterface->mIdlInfo.mType;
+ CORBA_boolean success;
+
+ success = findoperation_recurse( tree, name,
+ &pOperation->mIdlInfo );
+
+ if ( success )
+ return pOperation;
+
+ orbit_delete(pOperation);
+ return NULL;
}
/* find an attribute in an interface based on case-insensitive name */