Author Topic: Api Declaration  (Read 9918 times)

0 Members and 1 Guest are viewing this topic.

Aurel

  • Guest
Re: Api Declaration
« Reply #15 on: February 25, 2013, 05:47:31 AM »
Quote
I found a sensitivity to variable names with _leading underscores
Hi Charles...
Yes i forget to tell you this and also problem sometimes is when variable name
begins with upper case not with lowercase i hope that you fix this to.
Yeah...awinh is a mosaic of different things and styles because is picked from many
source codes around( some of them are from XBLite)
and need cleaning.. ::)

Aurel

  • Guest
Re: Api Declaration
« Reply #16 on: February 25, 2013, 06:29:33 AM »
Charles..
It looks that Len() now work fine but problem with RECT is still here >:(
Why work with old dll ...size 409kb but not work with this new 455kb ?

X

Aurel

  • Guest
Re: Api Declaration
« Reply #17 on: February 25, 2013, 06:41:32 AM »
In attachment is oxygen.dll version which work with awinh.inc.
This same version of dll is used by Peter in his oxyMap Tutorial 1 with include sw.inc (18kb).

X

Charles Pegge

  • Guest
Re: Api Declaration
« Reply #18 on: February 25, 2013, 08:09:24 AM »
Hi Aurel, I had to reconfigure the early compiler passes in the recent Oxygen version.

Have you tried moving #lookahead down to the start of your subs and functions. Personally I prefer working without it as I find programs easier to debug when subs and functions are parsed in their natural order, with minimum need for declarations.

Charles



JRS

  • Guest
Re: Api Declaration
« Reply #19 on: February 25, 2013, 09:15:28 AM »
Quote
Personally I prefer working without it as I find programs easier to debug when subs and functions are parsed in their natural order, with minimum need for declarations.

SB works the same way. You must use a CALL for forward referenced functions.

JRS

  • Guest
Re: Api Declaration
« Reply #20 on: February 25, 2013, 09:45:13 AM »
Quote
We can live without dot notation but the problem is how to reference all the calls available, without huge headers.

I don't see users writing full blown COM applications with SB and DLLC. The concept is dynamically scripting only the functionality you need for your application from multiple API resources without the linking, headers and whatever else to get it all to play together. Jose's typelib browser generates direct call functions for PB which should be enough info to make the call with DLLC.

Notice the SBx wrapping functions that encapsulate a DYC or SB IUP extension module function and presents itself as a high level SB language function with all the relaxed syntax benefits (no DIMS, DECLARES, DEFINES and TYPELESS variables that know what they are when referenced) for a nature extension to the core language and named whatever the user so desires. (see SBx include for the SBx_buttons example)

Peter had mentioned before I started converting the SokoMouse game to SB that I may have issues getting Bass sound integrated with the game. I did a quick Google search for an API to play .wav files and MS MM had just what I needed with just one call. This is what I'm talking about with using dynamic scripting. You build your custom SBx DLLC based wrapper function once and included it from your custom library whenever you need that functionality again somewhere else.
« Last Edit: February 25, 2013, 01:28:37 PM by JRS »

Aurel

  • Guest
Re: Api Declaration
« Reply #21 on: February 25, 2013, 10:21:50 AM »
Quote
Have you tried moving #lookahead down to the start of your subs and functions

No.
I think that is better to have #lookahead on top and i think that this is not problem in #lookahead.
But of course i can move #lookahead down and try ... ;)

Aurel

  • Guest
Re: Api Declaration
« Reply #22 on: February 25, 2013, 10:32:33 AM »
Yes i move down #lookahead in awinh.inc and new dll finaly work.. :)
I think that you say me that i must move #lookahead in main program not in include file ::)
Thanks.. :)

Charles , I see that new dll need little bit more time to compile same program then old dll.
Is this connected with size of dll ?

Charles Pegge

  • Guest
Re: Api Declaration
« Reply #23 on: February 25, 2013, 03:29:42 PM »
Glad it worked, Aurel. I had the same Rect error. This is because rect is used in one or more of the lookaheads, and needs to be defined first.

Yes it takes slightly longer to compile. There are additional early passes. But when the code has very large headers with thousands of declarations, the compilation speed has improved by a factor of 10 or more. You can see it when you try Kent's VB Api: ProjectsB/WinApiVB6


Charles

Charles Pegge

  • Guest
Re: Api Declaration
« Reply #24 on: February 26, 2013, 03:02:50 AM »

Hi John,

Joses TLB browser only deals with Idispatch COM  interfaces, which are particularly horrible. (I don't mean the browser).

The lower level access to COM is through the IUnknown based interfaces (or Punk interfaces if you will). I can cope with those quite easily.

They come from the winapi headers. Speech (SAPI) is the only one which interests me so far.

Charles


JRS

  • Guest
Re: Api Declaration
« Reply #25 on: February 26, 2013, 09:06:50 AM »
Quote
Direct Interfaces - Generates declarations for custom and dual interfaces. Dispatch only interfaces are skipped.

Direct interface is how it all began before PB embraced COM and started adding keywords to handle the low level stuff.

Have you tried generating PB direct COM interface code from Jose's browser yet?

Code: [Select]
' ########################################################################################
' Interface name = ISpeechGrammarRule
' IID = {AFE719CF-5DD1-44F2-999C-7A399F1CFCCC}
' ISpeechGrammarRule Interface
' Attributes = 4160 [&H00001040] [Dual] [Dispatchable]
' Inherited interface = IDispatch
' ########################################################################################

#IF NOT %DEF(%ISpeechGrammarRule_INTERFACE_DEFINED)
    %ISpeechGrammarRule_INTERFACE_DEFINED = 1

INTERFACE ISpeechGrammarRule $IID_ISpeechGrammarRule

   INHERIT IDispatch

   ' =====================================================================================
   METHOD get_Attributes ( _                            ' VTable offset = 28
   ) AS LONG                                            ' [retval][out] *Attributes SpeechRuleAttributes <enum>
   ' =====================================================================================
   METHOD get_InitialState ( _                          ' VTable offset = 32
   ) AS ISpeechGrammarRuleState                         ' [retval][out] **State ISpeechGrammarRuleState <dispinterface>
   ' =====================================================================================
   METHOD get_Name ( _                                  ' VTable offset = 36
   ) AS WSTRING                                         ' [retval][out] *Name VT_BSTR
   ' =====================================================================================
   METHOD get_Id ( _                                    ' VTable offset = 40
   ) AS LONG                                            ' [retval][out] *Id VT_I4 <Long>
   ' =====================================================================================
   METHOD Clear ( _                                     ' VTable offset = 44
   )                                                    ' void
   ' =====================================================================================
   METHOD AddResource ( _                               ' VTable offset = 48
     BYVAL ResourceName AS WSTRING _                    ' [in] ResourceName VT_BSTR
   , BYVAL ResourceValue AS WSTRING _                   ' [in] ResourceValue VT_BSTR
   )                                                    ' void
   ' =====================================================================================
   METHOD AddState ( _                                  ' VTable offset = 52
   ) AS ISpeechGrammarRuleState                         ' [retval][out] **State ISpeechGrammarRuleState <dispinterface>
   ' =====================================================================================

END INTERFACE
« Last Edit: February 26, 2013, 09:50:08 AM by JRS »

Charles Pegge

  • Guest
Re: Api Declaration
« Reply #26 on: February 26, 2013, 10:36:31 AM »
Yes I had a look at speech

I did some work on Idispatch and also creating COM servers many years ago. So I could go back in time to review it. Idispatch was developed for vbscript and other scripting systems originally, but it is not pretty.

JRS

  • Guest
Re: Api Declaration
« Reply #27 on: February 26, 2013, 10:45:27 AM »
I'm not interested in creating a DLLC INCLUDE wrapper for COM interfaces. I just want to look at a typelib dump of a COM component and pick and choose what functions I need out of it for my script application. I will save the created snippet of code in my custom SBx (or whatever you want to call it) for use again without the chore of building the SB wrapper function for it again. DLLC should be a FFI tool with helper functions to satisfy requirements the API interface may require.


Charles Pegge

  • Guest
Re: Api Declaration
« Reply #28 on: February 26, 2013, 11:09:50 AM »
Only need to select the required GUIDs and also pass an  index value to select the methods

But you may need a degree course to understand how to use some of these COM interfaces :)

JRS

  • Guest
Re: Api Declaration
« Reply #29 on: February 26, 2013, 11:25:39 AM »
Quote
But you may need a degree course to understand how to use some of these COM interfaces

All we need to do is show how a couple functions out of a COM interface works scripted, and I'm sure others will think it's a cool way to program and contribute their SB COM wrapper functions to the library pool.  Maybe this would be a worthy project Jose Roca may enjoy as there really isn't anywhere to go with PB any longer.