! Given "objbase.h", "ole2.h", or "oleauto.h", generate the Dylan ! declarations needed for the interfaces. ! Copyright: 1996, 1997, 1998 Functional Objects, Inc. All rights reserved. ! $HopeName: D-lib-com!dinterf.pat(trunk.11) $ ! $Date: 2004/03/12 00:09:32 $ @set-switch{t;1}@set-switch{w;1} @set-syntax{L;\-\.\(\)} @set-switch{match;1} ARGV:\N-D\J\=*\n=@define{\\I$1\\I\=@quote{$2}} ARGV:\N-module \n=@set{module-heading;Module\: $1\n@copyright{\:}\n\n} \B=${module-heading;}@set{module-heading;}\N\n\ \/\* This file is automatically generated from @file\; do not edit. \*\/\n\n \/\J\/\+--*\n
=\n\/\/ Adapted from\:\n$0\n header:\/\/\L\W\CCopyright*\n= header:\/\/*\n=$0 header:=@end \/\* File created by * at *\*\/=$0 @define{@read{@mergepath{@inpath;exports.pat;}}} @define{@read{@mergepath{@inpath;interfaces.pat;}}} \N\W\#*\n= type:struct \W\W=@resolve-type{$2$1}@end type:const = \/\* const \*\/ $1@end type:int=\@end type:unsigned long=\@end type:unsigned=\@end type:long int=\@end type:short int=\@end type:short=\@end type:void __RPC_FAR\*=\@end type:void\*=\@end type:PVOID =\@end type:HRESULT=\@end type:SCODE=\@end type:LPUNKNOWN=\@end type:LPBINDCTX=\@end type:LPDATAOBJECT=\@end ! would conflict with streams library type:byte __RPC_FAR\W\*=\@end type:byte=\@end type:I\J\J\J=\@end type:IID __RPC_FAR\W\*=\@end type:OLECHAR __RPC_FAR\*=\@end type:user\J=@fail! avoid warning on these unused types type:=@resolve-type{$2$1}@end type:=@fail stars:\W\*=\* stars:\W__RPC_FAR= stars:=@end optstar:\W\*=$1@end optstar:\W__RPC_FAR= optstar:=@end resolve-type:\A=\< resolve-type:\Z=\> resolve-type:\J_\J=- resolve-type:\*=$1 resolve-type:\*=LP$2@map-name{$3} resolve-type:\*uCLSSPEC\I=LPuCLSSPEC resolve-type:\*=@map-name{$2}\*$1\ @err{Warning - possible undefined type\: \<@map-name{$2}\*$1\>\n} resolve-type:\/\**\*\/=$0 resolve-type:=$1 resolve-type:\S=\S resolve-type:?=@err{failed resolve-type\{$0\}\n}[$0]@end ptr-type:\S=\S ptr-type:\/\**\*\/=$0 ptr-type:ULARGE_INTEGER=PULARGE-INTEGER ptr-type:\*LOGPALETTE=LPLOGPALETTE\* ptr-type:=@fail \/\*\*\*\*\L*\n*\ interface\: =\ \N\n\n\t\/\* ---- $3$4 ---- \*\/\n\n ! in 1995 header files: interface =$1 ! in 1997 header files: MIDL_INTERFACE()\W=$2 ! special hack to make inherit from . ! Is there a better way to do this than duplicating the whole def? interface-defn:ISequentialStream\W\:\Wpublic \{\}=@export-end{}\ @out{\N\n\ define open primary COM-interface @export{\} ( \<$1\>, \\ )\n\ end \\;\n\n\ define C-address ISequentialStream_DW_vtbl \:\: \\n\ @wrap{ c-name\: "ISequentialStream_DW_vtbl"\; end\;}\n\ define C-address @export{\$IID_ISequentialStream} \:\: \\ @wrap{ c-name\: "IID_ISequentialStream"\; end\;}\n\n\ define method initialize ( This \:\: \, \#rest ignore, \#key )\;\ \n\ \ next-method()\;\n\ \ \ This.vtbl \:\= ISequentialStream_DW_vtbl\;\n\ \ \ add-interface(This, \$IID-ISequentialStream)\;\n\ end initialize\;\n\ @set{maybe-export;@maybe-export{ISequentialStream}}@set{N;ISequentialStream}\ @expand-members{$2}\N@export-end{}\ }@end interface-defn:\W\:\Wpublic \{\}=@export-end{}\ @out{\N\n\ define open primary COM-interface @export{\<$1\>} ( \<$2\> )\n\ end \<$1\>\;\n\n\ define C-address $1_DW_vtbl \:\: \\n\ @wrap{ c-name\: "$1_DW_vtbl"\; end\;}\n\ define C-address @export{\$IID_$1} \:\: \\ @wrap{ c-name\: "IID_$1"\; end\;}\n\n\ define method initialize ( This \:\: \<$1\>, \#rest ignore, \#key )\;\ \n\ \ next-method()\;\n\ \ \ This.vtbl \:\= $1_DW_vtbl\;\n\ \ \ add-interface(This, \$IID-$1)\;\n\ end initialize\;\n\ @set{maybe-export;@maybe-export{$1}}@set{N;$1}\ @expand-members{$3}\N@export-end{}\ }@end interface-defn:\W\:\Wpublic \{\}=@export-end{}\ @out{\N\n\ define C-address @export{\$IID_$1} \:\: \\ @wrap{ c-name\: "IID_$1"\; end\;}\n\n\ @set{N;$1}\ @expand-use-only-members{$3}\N@export-end{}\ }@end ! Special case because "_IID_IEnumClass" is not defined in "Uuid.Lib" ! (as of January 1998): interface-defn:IEnumClass\W\:\Wpublic \{\}=@export-end{}\ @out{\N\n@set{N;IEnumClass}\ @expand-use-only-members{$2}\N@export-end{}\ }@end interface-defn:\W\:\Wpublic \{\}=! skip omitted interface interface-defn:=@fail expand-members:\S= expand-members:\G\W(\W)\G\;=\N\n\ define open generic @export{$N\/$2}\ @wrap{\ \(This}@generic-args{$3}\)\ @wrap{\ \=\> (@collect-results{$1\;$3})\;}\n\n\ define C-callable-wrapper@wrap{ of $N\/@map-name{$2}}\n\ \ \ input parameter This \:\: \\;\n\ @received-args{$3}\ @result{$1}${maybe-export}\ \ \ c-name\: "DW_$N_$2",@wrap{ c-modifiers\: "__stdcall"\;}\n\ end\;\n\n\ define inline-only C-function $N_$2\n\ \ \ input parameter This \:\: \\;\n$3\ @result{$1}\ \ \ c-name\: "C_$N_$2"\;\n\ end\;\n\n\ define method $N\/@map-name{$2}\ (This \:\: \@typed-args{$3})\ @wrap{\ \=\> (@collect-results{$1\;$3})}\n\ \ \ $N_$2(This@generic-args{$3})\nend\; expand-use-only-members:\S= expand-use-only-members:\G\W(\W)\G\;=\N\n\ define open generic @export{$N\/$2}\ @wrap{\ \(This}@generic-args{$3}\)\ @wrap{\ \=\> (@collect-results{$1\;$3})\;}\n\n\ define inline-only C-function $N_$2\n\ \ \ input parameter This \:\: \\;\n$3\ @result{$1}\ \ \ c-name\: "C_$N_$2"\;\n\ end\;\n\n\ define method $N\/@map-name{$2}\ (This \:\: \@typed-args{$3})\ @wrap{\ \=\> (@collect-results{$1\;$3})}\n\ \ \ $N_$2(This@generic-args{$3})\nend\; ! don't instantiate abstract class : received-args:\=\ received-args:output parameter \:\: \=\ output parameter $1 \:\: \ received-args:?=? expand-members:*\;=@err{line @line, failed match for expand-members\: *\;\n}\ @exit-status{1} result:\= result:\=\ \ result status \:\: \\;\n result:*=\ \ result value \:\: $1\;\n maybe-export:=\ \ export\: \#t\,\n@end maybe-export:=@end has-external-subclasses:IUnknown=@end has-external-subclasses:IAdviseSink=@end has-external-subclasses:IClassFactory=@end has-external-subclasses:IPersist=@end has-external-subclasses:IOleInPlaceObject=@end has-external-subclasses:IOleInPlaceSite=@end has-external-subclasses:IOleWindow=@end has-external-subclasses:IViewObject2=@end has-external-subclasses:IViewObject=@end has-external-subclasses:IDispatch=@end has-external-subclasses:=@fail collect-results:\A\\;=@set{comma;} collect-results:\A\\;=status \:\: \@set{comma;\,} collect-results:\A\<\>\;=value@dtypespec{\<$1\>\;}@set{comma;\,} collect-results:\Aparameter \:\: \;=$1 \:\: $2@set{comma;\,} collect-results:output parameter \:\: \;=\ ${comma}@wrap{\ @without-p{$1}@drefouttype{$2}}@set{comma;\,} collect-results:\S= collect-results:*\;= ! Dylan result type corresponding to output parameter C FFI type: drefouttype:\=\ \:\:\ \ drefouttype:\\>=\ \:\:\ \ drefouttype:\=\ \:\:\ \ drefouttype:\=\ \:\:\ \ drefouttype:\=\ \:\:\ \ drefouttype:\=\ \:\:\ \ drefouttype:\\*\*\>=\ \:\:\ \ drefouttype:\<*=@end drefouttype:*=@err{line @line, failed match for drefouttype\: $1\n}\ @exit-status{1}@end ! This first pattern is a special case for IMoniker::Reduce which has an ! incorrect "[in]" comment: args:\/\*[unique][out][in]\*\/ IMoniker __RPC_FAR\*__RPC_FAR\*ppmkToLeft=\ \ \ output parameter pmkToLeft \:\: \\;\n ! And another incorrect comment for ICreateTypeInfo::AddRefTypeInfo: args:\/\*\ [in] \*\/ HREFTYPE __RPC_FAR \*\Cphreftype=\ \ \ output parameter phreftype \:\: \\;\n args:\/\*\W[in]\W\*\/\W(\*)()=\ \ \ input parameter $3 \:\: \ \\;\n ! Above line really should be the following when supported: ! function-pointer-type(result-type\: @type{$1})\;\n args:\/\*\W\W\*\/\W\G\W=\ \ \ @arg2{@adjust-direction{$4$1} parameter $3 \:\: @adjust-type{$4$2}\;}\n args:,=;\S= args:\W=\ \ input parameter $2 \:\: $1\;\n args:void\P\W)=@end args:*\,=@err{line @line, failed match for args\: $0\n}@exit-status{1} args:*\P\)=@err{line @line, failed match for args\: $0\n}@exit-status{1} maybe-array:\[\W\]=$0@end maybe-array:=@end adjust-type:\[\]\<\>=$1@resolve-type{\*$2} adjust-type:*=* adjust-direction:\[\]output= adjust-direction:\[\]= link:__stdcall\W= link:STDMETHODCALLTYPE\W= link:__RPC_FAR\W= line:=@end ! arg2 is second-pass processing for C function arguments. ! special case for CreateInstance: arg2:\Aoutput parameter ppvObject \:\: \\;=\ output parameter Object \:\: \\; ! special case for GetObjectStorage: arg2:\Aoutput parameter ppvStorage \:\: \\;=\ output parameter Object \:\: \\; ! not used: !arg2:\Aoutput input parameter \:\: =\ ! input output parameter $1 \:\: $2\; arg2:\Aoutput parameter \:\: =\ output parameter $1 \:\: $2\; arg2:\Aoutput parameter*\;=parameter*\;!@err{@line\: disregarding [out] for $1\n} arg2:\Ainput parameter \:\: \/\* const \*\/

\;=\ \/\* constant \*\/ input parameter $1 \:\: $2\; ! types of potential output parameters in COM: ! OK ! OK ! no ! OK ! no (equivalent to LARGE_INTEGER, but treat as opaque) ! no ! OK ! no! ! no ! no ! OK ! ! types of potential output parameters in COM: ! OK ! changed to ! no ! OK ! OK ! OK ! .pointer-type OK ! no, it's a structure ! OK ! test whether the parameter type is suitable for an `output' parameter. output-type:\=@fail output-type:\=@fail output-type:\=@fail output-type:\=@fail output-type:\=@fail output-type:\=@fail output-type:\=@fail output-type:\=@fail output-type:\=@fail output-type:\=@fail output-type:\=@fail output-type:\\>\;=\@end output-type:\C\\;=\@end output-type:\<*\*\>\;=\<*\*\>@end output-type:=@fail ! scalar data types: scalar:\JDWORD=$0@end scalar:\JWORD=$0@end scalar:\JLONG=$0@end scalar:\JULONG=$0@end scalar:\JINT=$0@end scalar:\JUINT=$0@end scalar:\JSHORT=$0@end scalar:\JUSHORT=$0@end scalar:\JBOOL=$0@end scalar:\JCOLORREF=$0@end scalar:\JLRESULT=$0@end scalar:\JBSTR=$0@end scalar:\JLP\J=$0@end scalar:\JH\J=$0@end scalar:\JLPVOID=$0@end scalar:=@fail typedef \;=@define{scalar\:\\J@hyphenate{$2}\=\$0\@end} hyphenate:\J\_\J=\- ! Can't use output parameters in IViewObject/GetAdvise because ! the caller can pass a NULL address. (see Bug 641) output-arg:pAspects=@fail output-arg:pAdvf=@fail output-arg:ppAdvSink=@fail output-arg:=$1@end output-arg:=@fail without-p:\Ap\J\J=$1$2;\Alp\J\J=$1$2;*=* ! The comment "[out][in]" is currently only used for structure values, ! not scalars, so it doesn't ever correspond to an FFI ! "input output parameter". direction:[out][in]= direction:[out]=output\s direction:[in]=input\s !direction:[in\W,\Wout]=input output direction:[size_is][out]=! pointer to array to be filled in direction:[unique]= direction:[string]= direction:[async]= direction:[size_is]= direction:[length_is]= direction:[switch_is]= direction:[iid_is]= direction:[in][size_is][in]=input\s direction:[

]=@err{line @line, unrecognized attribute\: [$1]\n} direction:=@err{line @line, failed match for direction\: $1\n}\ @exit-status{1} direction:=@end generic-args:\S= generic-args:output parameter *\;= generic-args:

parameter \:\: *\;=,@wrap{ $2} generic-args:=@err{line @line, failed match for generic-args\: $1\n}\ @exit-status{1} typed-args:\S= typed-args:output parameter *\;= typed-args:

parameter \:\: =,@wrap{\ $2$3} ! Dylan method arg specializer corresponding to C FFI type: dtypespec:\=\ \:\:\ $0 dtypespec:\=\ \:\:\ $0 dtypespec:\\J\J\>=\ \:\:\ $0! dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\\;=\ \:\:\ \@end dtypespec:\=\ \:\:\ $0 dtypespec:\\;=\ \:\:\ \@end dtypespec:\=\ \:\:\ $0 dtypespec:\\JID\>=\ \:\:\ $0 dtypespec:\\;=@end! this one is not a pointer dtypespec:\\>=\ \:\:\ $0 dtypespec:\\;=@end! looks like a handle but is really a DWORD dtypespec:\\>=\ \:\:\ $0 dtypespec:function-pointer-type()\;=@end! ??? dtypespec:\<*\;=@end dtypespec:\;=@end dtypespec:*\;=@err{line @line, failed match for dtypespec\: $1\n}\ @exit-status{1}@end members:public\:= members:private\:= members:virtual ()=$1($2)\; members:\/\J\*\*\J\/= members:\S= members:\=0= members:\;= members:*\;=@err{"@file" line @line, unrecognized member\: *\n}\ @exit-status{1} fhead:\/\J\*\*\J\/= fhead:=$1 fhead:\S=\S fhead:\*=\* fhead:__stdcall= fhead:STDMETHODCALLTYPE= fhead:=@end @set-wrap{65;\t\t} wrapped:\s=@wrap{\s$1} number:\W\<\<\W=ash($1,$2)@end number:(\W\W)=$1@end number:-\W=-$1@end number:0x\J=\#x$1@end number:0\J=\#o$1@end number:=$1@end number:\W\+\W=\$@map-name{$1} + $2@end number:\W\P\,=\$@map-name{$1}@end number:=@fail optL:\C\JL=@end;=@end \#define \W\W\n=\ \Ndefine constant @export{\$$1} @tab{40}\= $2\;\n relevant-name:OLEIVERB_\J=$0@end relevant-name:EMBDHLP_\J=$0@end relevant-name:STGM_\J=$0@end relevant-name:=@fail typedef interface $1\;=