Browse Source

Interface enhancements.

woollybah 10 years ago
parent
commit
913ca2e65e
3 changed files with 22 additions and 3 deletions
  1. 2 3
      blitz.mod/blitz_debug.h
  2. 16 0
      blitz.mod/blitz_object.c
  3. 4 0
      blitz.mod/blitz_object.h

+ 2 - 3
blitz.mod/blitz_debug.h

@@ -36,10 +36,8 @@ struct BBDebugDecl{
 	union{
 		BBString*	const_value;
 #if ( __WORDSIZE == 64 )
-//		BBInt64		local_offset;
 		BBInt64		field_offset;
 #else
-//		int			local_offset;
 		int			field_offset;
 #endif
 		void		*var_address;
@@ -49,7 +47,8 @@ struct BBDebugDecl{
 enum{
 	BBDEBUGSCOPE_FUNCTION=1,
 	BBDEBUGSCOPE_USERTYPE=2,
-	BBDEBUGSCOPE_LOCALBLOCK=3
+	BBDEBUGSCOPE_LOCALBLOCK=3,
+	BBDEBUGSCOPE_USERINTERFACE=4,
 };
 
 struct BBDebugScope{

+ 16 - 0
blitz.mod/blitz_object.c

@@ -4,6 +4,7 @@
 #define REG_GROW 256
 
 static BBClass **reg_base,**reg_put,**reg_end;
+static BBClass **ireg_base,**ireg_put,**ireg_end;
 
 static BBDebugScope debugScope={
 	BBDEBUGSCOPE_USERTYPE,
@@ -113,6 +114,21 @@ BBClass **bbObjectRegisteredTypes( int *count ){
 	return reg_base;
 }
 
+void bbObjectRegisterInterface( BBInterface * ifc ){
+	if( ireg_put==ireg_end ){
+		int len=ireg_put-ireg_base,new_len=len+REG_GROW;
+		ireg_base=(BBInterface**)bbMemExtend( ireg_base,len*sizeof(BBInterface*),new_len*sizeof(BBInterface*) );
+		ireg_end=ireg_base+new_len;
+		ireg_put=ireg_base+len;
+	}
+	*ireg_put++=ifc;
+}
+
+BBInterface **bbObjectRegisteredInterfaces( int *count ){
+	*count=ireg_put-ireg_base;
+	return ireg_base;
+}
+
 BBObject * bbInterfaceDowncast(BBOBJECT o, BBINTERFACE ifc) {
 	int i;
 

+ 4 - 0
blitz.mod/blitz_object.h

@@ -42,6 +42,7 @@ struct BBObject{
 };
 
 struct BBInterface {
+	BBClass*	clas;
 	const char *name;
 };
 
@@ -70,6 +71,9 @@ BBObject*	bbObjectDowncast( BBObject *o,BBClass *t );
 void		bbObjectRegisterType( BBClass *clas );
 BBClass**	bbObjectRegisteredTypes( int *count );
 
+void bbObjectRegisterInterface( BBInterface * ifc );
+BBInterface **bbObjectRegisteredInterfaces( int *count );
+
 BBObject * bbInterfaceDowncast(BBOBJECT o, BBINTERFACE ifc);
 void * bbObjectInterface(BBOBJECT o, BBINTERFACE ifc);