Bugs in PA_SetVariable() and PA_GetVariable()

View: New views
3 Messages — Rating Filter:   Alert me  

Bugs in PA_SetVariable() and PA_GetVariable()

by Jiro Harada :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I found that bugs in PluginSDK have not been fixed for one and a half  
years. The bugs was reported by Rob Laveaux in this mailing list on  
Aug 02, 2006.

For more information about these bugs:
http://www.nabble.com/Why-doesn't-PA_SetVariable-work-in-compiled- 
mode--td5614328.html

These bugs were discovered first in PluginSDK 2004.3. And they are  
also existing in PluginSDK 2004.7(the latest version). If you use  
PA_SetVariable() or PA_GetVariable(), you have to fix by yourself as  
follows:


void PA_SetVariable( char* variableName, PA_Variable variable, char  
clearOldValue )
{
        EngineBlock eb;

        eb.fHandle = (PA_Handle) &variable;
        eb.fError  = 0;

        eb.fClearOldVariable = clearOldValue;

        /*
        if( PA_IsCompiled() )
        {
                long variableNameLen = strlen( variableName );
                eb.fName[0] = (char)variableNameLen;
                PA_MoveBlock( variableName, eb.fName+1, variableNameLen );
        }
        else
        */

        FromUserString( variableName, eb.fName );
       
        if ( StripInterprocessVariableName( eb.fName ) )
                Call4D( EX_SET_INTERPROCESS_VARIABLE, &eb );
        else
                Call4D( EX_SET_VARIABLE, &eb );

        sErrorCode = (PA_ErrorCode) eb.fError;
}

PA_Variable PA_GetVariable( char* variableName )
{
        PA_Variable vb;
        EngineBlock eb;
        char interprocess = 0;

        eb.fHandle = (PA_Handle) &vb;
        eb.fError = 0;

        /*
        if (PA_IsCompiled())
        {
                // PString to CString: Could be 0 in the variable name
                memcpy(eb.fName,variableName,variableName[0]+1);
                eb.fName[variableName[0]+1]=0;
        }
        else
        */

        FromUserString( variableName, eb.fName );

        interprocess = StripInterprocessVariableName( eb.fName );

        if ( interprocess )
                Call4D( EX_GET_INTERPROCESS_VARIABLE, &eb );
        else
                Call4D( EX_GET_VARIABLE, &eb );

        sErrorCode = (PA_ErrorCode) eb.fError;
       
        return vb;
}

Jiro Harada
Ronri Kobo, Inc.

**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/     
   

    Did you know?  The 4D Partner Program now gives you
    access to Hotfix releases as soon as they are available!
    To learn more, go to http://www.4D.com/support/partner.html

To Unsubscribe:                      mailto:4D-Plugins-off@...
***********************************************************************


Re: Bugs in PA_SetVariable() and PA_GetVariable()

by Matthias Schmidt-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jiro San konnichiha,

thanks for sharing this information :-)

so you changed the code from 4DPluginAPI.c and commented the
if( PA_IsCompiled() ) part out.
Any other changes?

Although I use the 4D Plugin API the file says revision 2004.6

wishing you alll the best
Matthias

Am/On Thu, 21 Feb 2008 13:27:54 +0900 schrieb/wrote Jiro Harada:

>Hello,
>
>I found that bugs in PluginSDK have not been fixed for one and a half
>years. The bugs was reported by Rob Laveaux in this mailing list on
>Aug 02, 2006.
>
>For more information about these bugs:
>http://www.nabble.com/Why-doesn't-PA_SetVariable-work-in-compiled-
>mode--td5614328.html
>
>These bugs were discovered first in PluginSDK 2004.3. And they are
>also existing in PluginSDK 2004.7(the latest version). If you use
>PA_SetVariable() or PA_GetVariable(), you have to fix by yourself as
>follows:
>
>
>void PA_SetVariable( char* variableName, PA_Variable variable, char
>clearOldValue )
>{
> EngineBlock eb;
>
> eb.fHandle = (PA_Handle) &variable;
> eb.fError  = 0;
>
> eb.fClearOldVariable = clearOldValue;
>
> /*
> if( PA_IsCompiled() )
> {
> long variableNameLen = strlen( variableName );
> eb.fName[0] = (char)variableNameLen;
> PA_MoveBlock( variableName, eb.fName+1, variableNameLen );
> }
> else
> */
>
> FromUserString( variableName, eb.fName );
>
> if ( StripInterprocessVariableName( eb.fName ) )
> Call4D( EX_SET_INTERPROCESS_VARIABLE, &eb );
> else
> Call4D( EX_SET_VARIABLE, &eb );
>
> sErrorCode = (PA_ErrorCode) eb.fError;
>}
>
>PA_Variable PA_GetVariable( char* variableName )
>{
> PA_Variable vb;
> EngineBlock eb;
> char interprocess = 0;
>
> eb.fHandle = (PA_Handle) &vb;
> eb.fError = 0;
>
> /*
> if (PA_IsCompiled())
> {
> // PString to CString: Could be 0 in the variable name
> memcpy(eb.fName,variableName,variableName[0]+1);
> eb.fName[variableName[0]+1]=0;
> }
> else
> */
>
> FromUserString( variableName, eb.fName );
>
> interprocess = StripInterprocessVariableName( eb.fName );
>
> if ( interprocess )
> Call4D( EX_GET_INTERPROCESS_VARIABLE, &eb );
> else
> Call4D( EX_GET_VARIABLE, &eb );
>
> sErrorCode = (PA_ErrorCode) eb.fError;
>
> return vb;
>}
>
>Jiro Harada
>Ronri Kobo, Inc.
>
>**********************************************************************
>4D Plugins hosted by 4D, Inc.                      http://www.4D.com/
>
>
>    Did you know?  The 4D Partner Program now gives you
>    access to Hotfix releases as soon as they are available!
>    To learn more, go to http://www.4D.com/support/partner.html
>
>To Unsubscribe:                      mailto:4D-Plugins-off@...
>***********************************************************************
>
>

cheers,

Matthias

------------------------------------------------------------------------
Admilon Consulting GmbH
Am Wiesengrund 9a, 90584 Allersberg, Germany
Geschäftsführer: Peter Frank, Jürgen Krey, Matthias Schmidt
Amtsgericht Nürnberg: HRB 21750
Tel.: +49-9174 - 6646 Fax: +49-9174 - 6647
<http://www.admilon-consulting.de>
-------------------------------------------------------------------------


**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/


    Did you know?  The 4D Partner Program now gives you
    access to Hotfix releases as soon as they are available!
    To learn more, go to http://www.4D.com/support/partner.html

To Unsubscribe:                      mailto:4D-Plugins-off@...
***********************************************************************


Parent Message unknown Re: Bugs in PA_SetVariable() and PA_GetVariable()

by Jiro Harada :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Matthias,

On 2008/02/22, at 13:00, 4D Plugin Talk wrote:

> so you changed the code from 4DPluginAPI.c and commented the
> if( PA_IsCompiled() ) part out.
> Any other changes?
>
> Although I use the 4D Plugin API the file says revision 2004.6


4D Plugin API 2004.7 is used in my plugins.
After I changed ONLY that part, they work fine.
(My plugins do not call every function in 4D Plugin API.)

Best regards,

Jiro Harada
Ronri Kobo, Inc.

**********************************************************************
4D Plugins hosted by 4D, Inc.                      http://www.4D.com/     
   

    Did you know?  The 4D Partner Program now gives you
    access to Hotfix releases as soon as they are available!
    To learn more, go to http://www.4D.com/support/partner.html

To Unsubscribe:                      mailto:4D-Plugins-off@...
***********************************************************************

LightInTheBox - Buy quality products at wholesale price