cvsuser     04/09/28 03:35:20

  Modified:    src      dynext.c
  Log:
  - Parrot_lib_%s_load can now return NULL, in which case parrot
    creates a library handle.
  
  - a little bit more documentation
  
  Revision  Changes    Path
  1.31      +15 -6     parrot/src/dynext.c
  
  Index: dynext.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/dynext.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -w -r1.30 -r1.31
  --- dynext.c  8 Sep 2004 00:33:58 -0000       1.30
  +++ dynext.c  28 Sep 2004 10:35:20 -0000      1.31
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: dynext.c,v 1.30 2004/09/08 00:33:58 dan Exp $
  +$Id: dynext.c,v 1.31 2004/09/28 10:35:20 jrieks Exp $
   
   =head1 NAME
   
  @@ -221,6 +221,15 @@
   once C<Parrot_lib_%s_init()> gets called (if exists) to perform thread
   specific setup. In both functions C<%s> is the name of the library.
   
  +If Parrot_lib_%s_load() succeeds, it should either return a
  +ParrotLibrary PMC, which is then used as the handle for this library
  +or NULL, in which case parrot creates a handle for the library.
  +
  +If either Parrot_lib_%s_load() or Parrot_lib_%s_init() detects an error
  +condition, an exception should be thrown.
  +
  +TODO: fetch Parrot_lib load/init handler exceptions
  +
   =cut
   
   */
  @@ -230,9 +239,12 @@
                   PMC *(*load_func)(Interp *),
                   void (*init_func)(Interp *, PMC *))
   {
  -    PMC *lib_pmc;
  +    PMC *lib_pmc = NULL;
   
  -    if (!load_func) {
  +    if (load_func)
  +        lib_pmc = (*load_func)(interpreter);
  +
  +    if (!load_func || !lib_pmc) {
           /* seems to be a native/NCI lib */
           /*
            * this PMC should better be constant, but then all the contents
  @@ -241,9 +253,6 @@
            */
           lib_pmc = pmc_new(interpreter, enum_class_ParrotLibrary);
       }
  -    else {
  -        lib_pmc = (*load_func)(interpreter);
  -    }
       /*
        *  call init, if it exists
        */
  
  
  

Reply via email to