cvsuser     04/05/19 02:32:26

  Modified:    config/gen/makefiles root.in
               .        MANIFEST
  Added:       include/parrot library.h global.h
               src      global.c
  Log:
  - added src/global.c include/parrot/global.h for functions devoted to global PMC 
handling
  - removed src/object.c:find_global, replaced with Parrot_find_global
  - added upcoming include/parrot/library.h which conaints accessor functions for 
parrot's bytecode library
  
  Revision  Changes    Path
  1.1                  parrot/include/parrot/library.h
  
  Index: library.h
  ===================================================================
  /* library.h
   *  Copyright: 2004 The Perl Foundation.  All Rights Reserved.
   *  CVS Info
   *     $Id: library.h,v 1.1 2004/05/19 09:32:16 jrieks Exp $
   *  Overview:
   *      Contains accessor functions for the _parrotlib bytecode interface
   *  Data Structure and Algorithms:
   *  History:
   *  Notes:
   *  References:
   */
  
  #if !defined(PARROT_LIBRARY_H_GUARD)
  #define PARROT_LIBRARY_H_GUARD
  
  void* Parrot_library_query(Parrot_Interp, const char *func_name, ...);
  
  #endif /* PARROT_LIBRARY_H_GUARD */
  
  /*
   * Local variables:
   * c-indentation-style: bsd
   * c-basic-offset: 4
   * indent-tabs-mode: nil
   * End:
   *
   * vim: expandtab shiftwidth=4:
  */
  
  
  
  1.1                  parrot/include/parrot/global.h
  
  Index: global.h
  ===================================================================
  /* global.h
   *  Copyright: 2004 The Perl Foundation.  All Rights Reserved.
   *  CVS Info
   *     $Id: global.h,v 1.1 2004/05/19 09:32:16 jrieks Exp $
   *  Overview:
   *      Contains accessor functions for globals
   *  Data Structure and Algorithms:
   *  History:
   *  Notes:
   *  References:
   */
  
  #if !defined(PARROT_GLOBAL_H_GUARD)
  #define PARROT_GLOBAL_H_GUARD
  
  PMC *Parrot_find_global(Parrot_Interp, STRING *class, STRING *globalname);
  
  #endif /* PARROT_GLOBAL_H_GUARD */
  
  /*
   * Local variables:
   * c-indentation-style: bsd
   * c-basic-offset: 4
   * indent-tabs-mode: nil
   * End:
   *
   * vim: expandtab shiftwidth=4:
  */
  
  
  
  
  
  1.1                  parrot/src/global.c
  
  Index: global.c
  ===================================================================
  /*
  Copyright: 2004 The Perl Foundation.  All Rights Reserved.
  $Id: global.c,v 1.1 2004/05/19 09:32:19 jrieks Exp $
  
  =head1 NAME
  
  src/library.c - Interface to Parrot's bytecode library
  
  =head1 DESCRIPTION
  
  tdb
  
  =head2 Functions
  
  tdb
  
  =over 4
  
  =cut
  
  */
  
  #include "parrot/parrot.h"
  
  /*
  
  =item C<PMC *
  Parrot_find_global(Parrot_Interp interpreter, STRING *class, STRING *globalname)>
  
  =cut
  
  */
  
  PMC *
  Parrot_find_global(Parrot_Interp interpreter, STRING *class, STRING *globalname)
  {
      PMC *stash;
  #if 1
      /*
       * we are cheating a bit and use PerlHash internals to avoid
       * hash lookup duplication
       */
      HashBucket *b;
  #ifdef FIND_DEBUG
      PIO_printf(interpreter, "find_global class '%Ss' meth '%Ss\n",
              class, globalname);
  #endif
      stash = interpreter->globals->stash_hash;
      if (class) {
          b = hash_get_bucket(interpreter,
                  (Hash*) PMC_struct_val(stash), class);
          if (!b)
              return NULL;
          stash = b->value;
          b = hash_get_bucket(interpreter,
                  (Hash*) PMC_struct_val(stash), globalname);
          if (!b)
              return NULL;
          return VTABLE_get_pmc_keyed_int(interpreter, stash,
                  PMC_int_val((PMC*)b->value));
      }
      b = hash_get_bucket(interpreter,
                  (Hash*) PMC_struct_val(stash), globalname);
      if (!b)
          return NULL;
      return b->value;
  
  #else
      if (class) {
          if (!VTABLE_exists_keyed_str(interpreter,
                                       interpreter->globals->stash_hash,
                                       class)) {
              return NULL;
          }
          stash = VTABLE_get_pmc_keyed_str(interpreter,
                                           interpreter->globals->stash_hash,
                                           class);
      }
      else {
          stash = interpreter->globals->stash_hash;
      }
      if (!VTABLE_exists_keyed_str(interpreter, stash, globalname)) {
          return NULL;
      }
      return VTABLE_get_pmc_keyed_str(interpreter,
              stash, globalname);
  #endif
  }
  
  
  /*
  
  =back
  
  =head1 SEE ALSO
  
  F<include/parrot/global.h>
  
  =cut
  
  */
  
  /*
   * Local variables:
   * c-indentation-style: bsd
   * c-basic-offset: 4
   * indent-tabs-mode: nil
   * End:
   *
   * vim: expandtab shiftwidth=4:
  */
  
  
  
  1.211     +2 -1      parrot/config/gen/makefiles/root.in
  
  Index: root.in
  ===================================================================
  RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
  retrieving revision 1.210
  retrieving revision 1.211
  diff -u -w -r1.210 -r1.211
  --- root.in   18 May 2004 09:21:58 -0000      1.210
  +++ root.in   19 May 2004 09:32:22 -0000      1.211
  @@ -1,4 +1,4 @@
  -# $Id: root.in,v 1.210 2004/05/18 09:21:58 leo Exp $
  +# $Id: root.in,v 1.211 2004/05/19 09:32:22 jrieks Exp $
   
   ###############################################################################
   #
  @@ -261,6 +261,7 @@
       $(SRC)/rxstacks$(O) \
       $(SRC)/intlist$(O) \
       $(SRC)/list$(O) \
  +    $(SRC)/global$(O) \
       $(SRC)/embed$(O) \
       $(SRC)/warnings$(O) \
       $(SRC)/packout$(O) \
  
  
  
  1.650     +3 -0      parrot/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /cvs/public/parrot/MANIFEST,v
  retrieving revision 1.649
  retrieving revision 1.650
  diff -u -w -r1.649 -r1.650
  --- MANIFEST  15 May 2004 10:37:01 -0000      1.649
  +++ MANIFEST  19 May 2004 09:32:26 -0000      1.650
  @@ -1752,6 +1752,7 @@
   include/parrot/exit.h                             [devel]include
   include/parrot/extend.h                           [devel]include
   include/parrot/global_setup.h                     [devel]include
  +include/parrot/global.h                           [devel]include
   include/parrot/hash.h                             [devel]include
   include/parrot/headers.h                          [devel]include
   include/parrot/interp_guts.h                      [devel]include
  @@ -1760,6 +1761,7 @@
   include/parrot/io.h                               [devel]include
   include/parrot/jit.h                              [devel]include
   include/parrot/key.h                              [devel]include
  +include/parrot/library.h                          [devel]include
   include/parrot/list.h                             [devel]include
   include/parrot/longopt.h                          [devel]include
   include/parrot/memory.h                           [devel]include
  @@ -2548,6 +2550,7 @@
   src/exit.c                                        []
   src/extend.c                                      []
   src/generic_register.c                            []
  +src/global.c                                      []
   src/global_setup.c                                []
   src/hash.c                                        []
   src/headers.c                                     []
  
  
  

Reply via email to