Author Topic: c++ interface translate  (Read 2103 times)

TouEnMasm

  • Member
  • *****
  • Posts: 1403
    • EditMasm
c++ interface translate
« on: February 06, 2016, 03:16:26 AM »
i am working on the translation for masm of c++ interface.
One (win10) isn't very easy to understand
Quote
interface DX_DECLARE_INTERFACE("2cd906a8-12e2-11dc-9fed-001143a055f9") ID2D1Brush  : public ID2D1Resource
{
   
   
    //
    // Sets the opacity for when the brush is drawn over the entire fill of the brush.
    //
    STDMETHOD_(void, SetOpacity)(
        FLOAT opacity
        ) PURE;
   
   
    //
    // Sets the transform that applies to everything drawn by the brush.
    //
    STDMETHOD_(void, SetTransform)(
        _In_ CONST D2D1_MATRIX_3X2_F *transform
        ) PURE;
   
    STDMETHOD_(FLOAT, GetOpacity)(
        ) CONST PURE;
   
    STDMETHOD_(void, GetTransform)(
        _Out_ D2D1_MATRIX_3X2_F *transform
        ) CONST PURE;
   
    COM_DECLSPEC_NOTHROW
    void
    SetTransform(
        CONST D2D1_MATRIX_3X2_F &transform
        ) 
    {
        SetTransform(&transform);
    }
}; // interface ID2D1Brush
The SetTransform is repeated twice,The first is the normal form of an Interface Function and the second look like the declaration of an api.
How to interpret This?.
The second SetTransform is it part of the interface or not ?.
Is this form correct ?

Quote
;+-----------------------------------------------------------------------------
;
;  Interface:
;      ID2D1Brush
;
;  Synopsis:
;      The root brush interface. All brushes can be used to fill or pen a geometry.
; The SetTransform is said overloaded
;
;------------------------------------------------------------------------------
sIID_ID2D1Brush TEXTEQU <{02cd906a8H,012e2H,011dcH,{09fH,0edH,000H,011H,043H,0a0H,055H,0f9H}}>

ID2D1Brush_SetOpacity TYPEDEF  PROTO :XMASM ,opacity:REAL4
FID2D1Brush_SetOpacity TYPEDEF PTR  ID2D1Brush_SetOpacity

ID2D1Brush_SetTransform TYPEDEF  PROTO :XMASM ,transform:XMASM
FID2D1Brush_SetTransform TYPEDEF PTR  ID2D1Brush_SetTransform

ID2D1Brush_GetTransform TYPEDEF  PROTO :XMASM ,transform:XMASM
FID2D1Brush_GetTransform TYPEDEF PTR  ID2D1Brush_GetTransform


      INTERFACE_ID2D1Brush   MACRO
      SetOpacity      FID2D1Brush_SetOpacity  ?
      SetTransform      FID2D1Brush_SetTransform  ?
      GetOpacity                      comethod1 ?
      GetTransform      FID2D1Brush_GetTransform  ?
      ENDM

STID2D1Brush   STRUCT
   INTERFACE_ID2D1Resource
   INTERFACE_ID2D1Brush
STID2D1Brush   ENDS

 
ID2D1Brush MACRO  Function:REQ, args:VARARG
   ; definition de la macro locale InvokeInterface
    LOCAL InvokeInterface, arg
    FOR arg, <args>     ;verifier que edx n'est pas dans la liste d'arguments args
        IFIDNI <&arg>, <PPVREGISTER>   ;
            .ERR <%PPVREGISTER is not allowed as a coinvoke parameter>
        ENDIF
    ENDM
    IFIDNI <&pInterface>, <PPVREGISTER>
        .ERR <PPVREGISTER is not allowed as a coinvoke parameter>
    ENDIF
   ;InvokeInterface = concatene ...CATSTR(concatene) MACRO instruction MASM32   
   ;---------- on doit mettre ppv en premier argument -----------------------------------
    InvokeInterface CATSTR <invoke (STID2D1Brush PTR[PPVREGISTER]).>,<&Function,ppvID2D1Brush>
    IFNB <args>     ; add the list of parameter arguments if any
        InvokeInterface CATSTR InvokeInterface, <, >, <&args>
    ENDIF
   ;   forme les lignes de codes
    mov PPVREGISTER, ppvID2D1Brush
    mov PPVREGISTER, [PPVREGISTER]
    InvokeInterface
ENDM      


Fa is a musical note to play with CL

qWord

  • Member
  • *****
  • Posts: 1476
  • The base type of a type is the type itself
    • SmplMath macros
Re: c++ interface translate
« Reply #1 on: February 06, 2016, 04:40:57 AM »
The second SetTransform is it part of the interface or not ?.
It is not part of the COM interface. It is just an wrapper for c++ programmers.
MREAL macros - when you need floating point arithmetic while assembling!

TouEnMasm

  • Member
  • *****
  • Posts: 1403
    • EditMasm
Re: c++ interface translate
« Reply #2 on: February 06, 2016, 07:30:53 PM »
Thanks for answer,Iknow now the translate is correct.
Fa is a musical note to play with CL