cvsuser     03/08/18 05:26:30

  Modified:    .        interpreter.c
               languages/imcc parser_util.c
  Log:
  PackFile-14: simplify compreg
  
  Revision  Changes    Path
  1.196     +10 -10    parrot/interpreter.c
  
  Index: interpreter.c
  ===================================================================
  RCS file: /cvs/public/parrot/interpreter.c,v
  retrieving revision 1.195
  retrieving revision 1.196
  diff -u -w -r1.195 -r1.196
  --- interpreter.c     16 Aug 2003 13:21:46 -0000      1.195
  +++ interpreter.c     18 Aug 2003 12:26:28 -0000      1.196
  @@ -1,7 +1,7 @@
   /* interpreter.c
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: interpreter.c,v 1.195 2003/08/16 13:21:46 leo Exp $
  + *     $Id: interpreter.c,v 1.196 2003/08/18 12:26:28 leo Exp $
    *  Overview:
    *     The interpreter api handles running the operations
    *  Data Structure and Algorithms:
  @@ -1009,7 +1009,7 @@
   
   void Parrot_compreg(Parrot_Interp interpreter, STRING *type, PMC *func)
   {
  -    PMC* key, *hash;
  +    PMC* key, *hash, *nci;
       PMC* iglobals = interpreter->iglobals;
       hash = VTABLE_get_pmc_keyed_int(interpreter, interpreter->iglobals,
               IGLOBALS_COMPREG_HASH);
  @@ -1019,22 +1019,22 @@
           VTABLE_set_pmc_keyed_int(interpreter, iglobals,
                   (INTVAL)IGLOBALS_COMPREG_HASH, hash);
       }
  +    nci = pmc_new(interpreter, enum_class_Compiler);
       key = key_new_string(interpreter, type);
  -    VTABLE_set_pmc_keyed(interpreter, hash, key, func);
  +    VTABLE_set_pmc_keyed(interpreter, hash, key, nci);
  +    /* build native call interface fir the C sub in "func" */
  +    VTABLE_set_string_keyed(interpreter, nci, func,
  +            string_from_cstring(interpreter, "pIt", 0));
   }
   
   
   static void setup_default_compreg(Parrot_Interp interpreter)
   {
  -    STRING *pasm1 = string_make(interpreter, "PASM1", 5, NULL,0,NULL);
  -    PMC * nci;
  +    STRING *pasm1 = string_from_cstring(interpreter, "PASM1", 0);
  +
       Parrot_csub_t p = (Parrot_csub_t) PDB_compile;
  -    nci = pmc_new(interpreter, enum_class_Compiler);
       /* register the nci ccompiler object */
  -    Parrot_compreg(interpreter, pasm1, nci);
  -    /* build native call interface */
  -    VTABLE_set_string_keyed(interpreter, nci, (PMC*)F2DPTR(p),
  -            string_make(interpreter, "pIt", 3, NULL,0,NULL));
  +    Parrot_compreg(interpreter, pasm1, (PMC*)F2DPTR(p));
   }
   
   INTVAL
  
  
  
  1.24      +5 -14     parrot/languages/imcc/parser_util.c
  
  Index: parser_util.c
  ===================================================================
  RCS file: /cvs/public/parrot/languages/imcc/parser_util.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -w -r1.23 -r1.24
  --- parser_util.c     17 Aug 2003 11:15:16 -0000      1.23
  +++ parser_util.c     18 Aug 2003 12:26:30 -0000      1.24
  @@ -126,7 +126,8 @@
    *
    * compile a pasm or imcc string
    *
  - * FIXME compile to a new PackFile - we need separate constants
  + * FIXME as we have separate constants, the old constants in ghash must
  + *       be deleted.
    *
    */
   extern void* yy_scan_string(const char *);
  @@ -245,23 +246,13 @@
       STRING *pasm = string_from_cstring(interp, "PASM", 0);
       STRING *pir = string_from_cstring(interp, "PIR", 0);
       STRING *source = string_from_cstring(interp, "FILE", 0);
  -    STRING *sig =    string_from_cstring(interp, "pIt", 0);
  -    PMC * func;
       Parrot_csub_t pa = (Parrot_csub_t)imcc_compile_pasm;
       Parrot_csub_t pi = (Parrot_csub_t)imcc_compile_pir;
       Parrot_csub_t ps = (Parrot_csub_t)imcc_compile_file;
   
  -    func = pmc_new(interp, enum_class_Compiler);
  -    Parrot_compreg(interp, pasm, func);
  -    VTABLE_set_string_keyed(interp, func, (PMC*)F2DPTR(pa), sig);
  -
  -    func = pmc_new(interp, enum_class_Compiler);
  -    Parrot_compreg(interp, pir, func);
  -    VTABLE_set_string_keyed(interp, func, (PMC*)F2DPTR(pi), sig);
  -
  -    func = pmc_new(interp, enum_class_Compiler);
  -    Parrot_compreg(interp, source, func);
  -    VTABLE_set_string_keyed(interp, func, (PMC*)F2DPTR(ps), sig);
  +    Parrot_compreg(interp, pasm, (PMC*)F2DPTR(pa));
  +    Parrot_compreg(interp, pir, (PMC*)F2DPTR(pi));
  +    Parrot_compreg(interp, source, (PMC*)F2DPTR(ps) );
   }
   
   
  
  
  

Reply via email to