windows.com: typedef interface word to void* immediately so that self-referential pointers in the interface definition parse properly. fix a bug where pointer return values for interface methods couldn't parse

db4
Joe Groff 2010-02-25 16:39:30 -08:00
parent 1bb27b8a21
commit 4358edcae7
2 changed files with 7 additions and 4 deletions

View File

@ -16,6 +16,9 @@ COM-INTERFACE: IUnrelated IUnknown {b06ac3f4-30e4-406b-a7cd-c29cead4552c}
int xPlus ( int y ) int xPlus ( int y )
int xMulAdd ( int mul, int add ) ; int xMulAdd ( int mul, int add ) ;
COM-INTERFACE: ISelfReferential IUnknown {d4f45bf8-f720-4701-a09d-e8e341981121}
ISelfReferential* selfReference ( ) ;
{ GUID: {216fb341-0eb2-44b1-8edb-60b76e353abc} } [ ISimple-iid ] unit-test { GUID: {216fb341-0eb2-44b1-8edb-60b76e353abc} } [ ISimple-iid ] unit-test
{ GUID: {9620ecec-8438-423b-bb14-86f835aa40dd} } [ IInherited-iid ] unit-test { GUID: {9620ecec-8438-423b-bb14-86f835aa40dd} } [ IInherited-iid ] unit-test
{ GUID: {00000000-0000-0000-C000-000000000046} } [ IUnknown-iid ] unit-test { GUID: {00000000-0000-0000-C000-000000000046} } [ IUnknown-iid ] unit-test

View File

@ -3,6 +3,7 @@ effects kernel windows.ole32 parser lexer splitting grouping
sequences namespaces assocs quotations generalizations sequences namespaces assocs quotations generalizations
accessors words macros alien.syntax fry arrays layouts math accessors words macros alien.syntax fry arrays layouts math
classes.struct windows.kernel32 ; classes.struct windows.kernel32 ;
FROM: alien.parser.private => return-type-name ;
IN: windows.com.syntax IN: windows.com.syntax
<PRIVATE <PRIVATE
@ -71,7 +72,7 @@ ERROR: no-com-interface interface ;
: (stack-effect-from-return-and-parameters) ( return parameters -- stack-effect ) : (stack-effect-from-return-and-parameters) ( return parameters -- stack-effect )
swap swap
[ [ second ] map ] [ [ second ] map ]
[ dup void? [ drop { } ] [ name>> 1array ] if ] bi* [ dup void? [ drop { } ] [ return-type-name 1array ] if ] bi*
<effect> ; <effect> ;
: (define-word-for-function) ( function interface n -- ) : (define-word-for-function) ( function interface n -- )
@ -83,17 +84,16 @@ ERROR: no-com-interface interface ;
: define-words-for-com-interface ( definition -- ) : define-words-for-com-interface ( definition -- )
[ [ (iid-word) ] [ iid>> 1quotation ] bi (( -- iid )) define-declared ] [ [ (iid-word) ] [ iid>> 1quotation ] bi (( -- iid )) define-declared ]
[ word>> void* swap typedef ]
[ [
dup family-tree-functions dup family-tree-functions
[ (define-word-for-function) ] with each-index [ (define-word-for-function) ] with each-index
] ] bi ;
tri ;
PRIVATE> PRIVATE>
SYNTAX: COM-INTERFACE: SYNTAX: COM-INTERFACE:
CREATE-C-TYPE CREATE-C-TYPE
void* over typedef
scan-object find-com-interface-definition scan-object find-com-interface-definition
scan string>guid scan string>guid
parse-com-functions parse-com-functions