[Gambas-user] A fine afternoon for a good rant

Cedron Dawg cedron at exede.net
Thu Feb 28 21:19:41 CET 2019


You gotta admit that that is not obvious.

Anyway, the source I sent you is pretty much an evdev wrapper.  The only things joystick specific about it are the file names it looks for and how the return values are handled, e.g. the Gambas events raised.


----- Original Message -----
Le 28/02/2019 à 20:11, Cedron Dawg a écrit :
> 
> /*--- Set the Return Array  ????? Not sure this is right at all
> */
>          void* theReturnArray;
>          char* theListEntry;
>          int   f;
>          
>          GB.New( &theReturnArray, "String[]", NULL, NULL );
> 
>          for( f = 0; f < theFoundCount; f++ )
>          {
>              theListEntry = GB.NewString( theList[f], 0 );
>              theReturnArray->Add( theListEntry );
>              GB.Free( theListEntry );
>          }
> 
>          GB.ReturnObject( &theReturnArray );
> 

It's not right:

   void* theReturnArray;
   char* theListEntry;
   int   f;

   GB.Array.New(&theReturnArray, GB_T_STRING, theFoundCount);

   for( f = 0; f < theFoundCount; f++ )
   {
      theListEntry = GB.NewZeroString(theList[f]);
      *((char **)GB.Array.Get(theReturnedArray, f) = theListEntry;
   }

   GB.ReturnObject( &theReturnArray );

Regards,

-- 
Benoît Minisini

----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----


More information about the User mailing list