[slang-users] C Structure help ...

Ben Duncan linux4ms at aim.com
Fri Jun 8 12:14:45 EDT 2007


And another question .....

What are the advantages/disadvantages of using passed values
versus POP'd values ?

i.e.:

static int
apgn_replace(char *value, int *attribute)
{
    APGN_Type *p;

    SLang_MMT_Type *mmt;

    ..........

    if (NULL == (mmt = SLang_pop_mmt (APGN_Type_Id)))
      {
         SLang_free_mmt (mmt);
         return -2;
      }
    p = SLang_object_from_mmt (mmt);
    replace(p->apgn_db, value, *atribute, 0)
    ............

Where INSTRINSICS are defined as:
...

MAKE_INTRINSIC_SI("apgn_store", apgn_store),
....

********   versus  *********

static int
apgn_replace( VOID )
{
     char *value ;
     int  attribute ;
     SLang_MMT_Type *mmt;

     if ( SLang_pop_integer ( &attribute ) != 0 )
     {
      SLang_verror (SL_INVALID_PARM, "\n Incorrect parameters!\n ");
      return -1 ;
     }

     if ( SLpop_string ( &value ) != 0 )
     {
      SLang_verror (SL_INVALID_PARM, "\n Incorrect parameters!\n ");
      return -1 ;
     }

     ......
     .............

Where THE INSTRINSICS is defined as:
...

MAKE_INTRINSIC_O("apgn_store", apgn_store),
....

Thanks


-- 
Ben Duncan  - Business Network Solutions, Inc. 336 Elton Road  Jackson MS, 39212 

"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor


More information about the slang-users-l mailing list