浏览代码

Fixed another way to call function pointer fields.
Added brl.retro to test modules.

woollybah 11 年之前
父节点
当前提交
aa7c7d9bc3
共有 3 个文件被更改,包括 16 次插入5 次删除
  1. 12 5
      ctranslator.bmx
  2. 3 0
      decl.bmx
  3. 1 0
      tests/mods.conf

+ 12 - 5
ctranslator.bmx

@@ -444,7 +444,7 @@ Type TCTranslator Extends TTranslator
 	End Method
 		
 	Method TransFunc$( decl:TFuncDecl,args:TExpr[],lhs:TExpr )
-'If decl.ident = "WriteStdout" DebugStop
+'If decl.ident = "_func" DebugStop
 		If decl.IsMethod()
 			If lhs And Not TSelfExpr(lhs) Then
 				If lhs.exprType = TType.stringType Then
@@ -512,10 +512,17 @@ Type TCTranslator Extends TTranslator
 			End If
  
 			' ((brl_standardio_TCStandardIO_obj*)o->clas)->md_Read(o, xxx, xxx)
-			Local obj:String = Bra("struct " + decl.scope.munged + "_obj*")
-			Local class:String = Bra("(" + obj + "o)->clas")
-			'Local class:String = Bra("&" + decl.scope.munged)
-			Return class + "->md_" + decl.ident+TransArgs( args,decl, "o" )
+			If Not (decl.attrs & FUNC_PTR) Then 
+				Local obj:String = Bra("struct " + decl.scope.munged + "_obj*")
+				Local class:String = Bra("(" + obj + "o)->clas")
+				'Local class:String = Bra("&" + decl.scope.munged)
+				Return class + "->md_" + decl.ident+TransArgs( args,decl, "o" )
+			Else
+				Local obj:String = Bra("struct " + decl.scope.munged + "_obj*")
+				'Local class:String = Bra("(" + obj + "o)->clas")
+				'Local class:String = Bra("&" + decl.scope.munged)
+				Return Bra(obj + "o") + "->" + decl.munged+TransArgs( args,decl )
+			End If
 		EndIf
 
 		' built-in functions

+ 3 - 0
decl.bmx

@@ -671,6 +671,9 @@ End Rem
 					If Not func.scope Then
 						func.scope = f.scope
 					End If
+					If Not func.ident Then
+						func.ident = f.ident
+					End If
 				End If
 			End If
 		End If

+ 1 - 0
tests/mods.conf

@@ -51,3 +51,4 @@ brl.httpstream
 pub.oggvorbis
 brl.oggloader
 brl.wavloader
+brl.retro