]> gitweb.factorcode.org Git - factor.git/commitdiff
prettyprint CALLBACK: defs
authorJoe Groff <arcata@gmail.com>
Mon, 21 Sep 2009 19:14:12 +0000 (14:14 -0500)
committerJoe Groff <arcata@gmail.com>
Mon, 21 Sep 2009 19:14:12 +0000 (14:14 -0500)
basis/alien/prettyprint/prettyprint.factor

index 69b9f3777646d1e7a7cb54fd9668497f2115b96a..eea3515c8f38cd2c55fd8b4f9005f3c73af11732 100644 (file)
@@ -38,8 +38,8 @@ M: typedef-word synopsis*
 : pprint-function-arg ( type name -- )
     [ pprint-c-type ] [ text ] bi* ;
 
-: pprint-function-args ( word -- )
-    [ def>> fourth ] [ stack-effect in>> ] bi zip [ ] [
+: pprint-function-args ( types names -- )
+    zip [ ] [
         unclip-last
         [ [ first2 "," append pprint-function-arg ] each ] dip
         first2 pprint-function-arg
@@ -55,6 +55,29 @@ M: alien-function-word synopsis*
         [ definer. ]
         [ def>> first pprint-c-type ]
         [ pprint-word ]
-        [ <block "(" text pprint-function-args ")" text block> ]
+        [
+            <block "(" text
+            [ def>> fourth ] [ stack-effect in>> ] bi
+            pprint-function-args
+            ")" text block>
+        ]
     } cleave ;
 
+M: alien-callback-type-word definer
+    "callback-abi" word-prop "stdcall" =
+    \ STDCALL-CALLBACK: \ CALLBACK: ? 
+    f ;
+M: alien-callback-type-word definition drop f ;
+M: alien-callback-type-word synopsis*
+    {
+        [ seeing-word ]
+        [ definer. ]
+        [ def>> first pprint-c-type ]
+        [ pprint-word ]
+        [
+            <block "(" text 
+            [ def>> second ] [ "callback-effect" word-prop in>> ] bi
+            pprint-function-args
+            ")" text block>
+        ]
+    } cleave ;