cvsuser     03/07/29 16:02:07

  Modified:    .        embed.c exec.c
               include/parrot embed.h
               languages/imcc main.c
  Log:
  Make imcc accept a .o file as an argument to -o and make it visible to the parrot 
core thru the string_reg pointers.
  
  Revision  Changes    Path
  1.77      +12 -1     parrot/embed.c
  
  Index: embed.c
  ===================================================================
  RCS file: /cvs/public/parrot/embed.c,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -w -r1.76 -r1.77
  --- embed.c   29 Jul 2003 20:54:03 -0000      1.76
  +++ embed.c   29 Jul 2003 23:02:04 -0000      1.77
  @@ -1,7 +1,7 @@
   /* embed.c
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: embed.c,v 1.76 2003/07/29 20:54:03 scog Exp $
  + *     $Id: embed.c,v 1.77 2003/07/29 23:02:04 grunblatt Exp $
    *  Overview:
    *     The Parrot embedding interface.
    *  Data Structure and Algorithms:
  @@ -291,6 +291,17 @@
   
           VTABLE_push_string(interpreter, userargv, arg);
       }
  +}
  +
  +/* XXX This allows a command line option to be visible from inside the
  + * Parrot core, this is done using the pointers in the interpreter structure,
  + * and the subsystems using this arguments must clear them before running.
  + */
  +
  +void
  +Parrot_setup_opt(struct Parrot_Interp *interpreter, int n, char *argv)
  +{
  +    interpreter->string_reg.registers[n] = (STRING *)argv;
   }
   
   static int
  
  
  
  1.11      +5 -2      parrot/exec.c
  
  Index: exec.c
  ===================================================================
  RCS file: /cvs/public/parrot/exec.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -w -r1.10 -r1.11
  --- exec.c    29 Jul 2003 20:04:03 -0000      1.10
  +++ exec.c    29 Jul 2003 23:02:04 -0000      1.11
  @@ -2,7 +2,7 @@
    * exec.c
    *
    * CVS Info
  - *    $Id: exec.c,v 1.10 2003/07/29 20:04:03 grunblatt Exp $
  + *    $Id: exec.c,v 1.11 2003/07/29 23:02:04 grunblatt Exp $
    * Overview:
    *    Generate an object file.
    * History:
  @@ -48,6 +48,7 @@
   {
       int i, j, *k;
       char *cp, *nptr;
  +    const char *output;
       long bhs;
       Parrot_exec_objfile_t *obj;
       Parrot_jit_info_t *jit_info;
  @@ -92,7 +93,9 @@
       obj->text.size += (4 - obj->text.size % 4);
       obj->data.size += (4 - obj->data.size % 4);
       offset_fixup(obj);
  -    Parrot_exec_save(obj, "exec_output.o");
  +    output = (interpreter->string_reg.registers[0]) ?
  +        (const char *)interpreter->string_reg.registers[0] : "exec_output.o";
  +    Parrot_exec_save(obj, output);
   }
   
   /*  add_data_member
  
  
  
  1.18      +3 -1      parrot/include/parrot/embed.h
  
  Index: embed.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/embed.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -w -r1.17 -r1.18
  --- embed.h   21 Jul 2003 18:00:42 -0000      1.17
  +++ embed.h   29 Jul 2003 23:02:06 -0000      1.18
  @@ -1,7 +1,7 @@
   /* embed.h
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: embed.h,v 1.17 2003/07/21 18:00:42 chromatic Exp $
  + *     $Id: embed.h,v 1.18 2003/07/29 23:02:06 grunblatt Exp $
    *  Overview:
    *     This is the Parrot embedding system--the only part of Parrot that
    *     the outside world should see.
  @@ -35,6 +35,8 @@
   void Parrot_loadbc(Parrot_Interp, Parrot_PackFile);
   
   void Parrot_setup_argv(Parrot_Interp, int argc, char ** argv);
  +
  +void Parrot_setup_opt(Parrot_Interp, int n, char *argv);
   
   void Parrot_runcode(Parrot_Interp, int argc, char *argv[]);
   
  
  
  
  1.35      +8 -0      parrot/languages/imcc/main.c
  
  Index: main.c
  ===================================================================
  RCS file: /cvs/public/parrot/languages/imcc/main.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -w -r1.34 -r1.35
  --- main.c    29 Jul 2003 13:35:21 -0000      1.34
  +++ main.c    29 Jul 2003 23:02:07 -0000      1.35
  @@ -400,6 +400,14 @@
           if (ext && strcmp (ext, ".pbc") == 0) {
               write_pbc = 1;
           }
  +#if EXEC_CAPABLE
  +        else if (ext && strcmp (ext, ".o") == 0) {
  +            run_pbc = 2;
  +            write_pbc = 0;
  +            Parrot_setup_opt(interpreter, 0, output);
  +            Parrot_setflag(interpreter, PARROT_EXEC_FLAG, ext);
  +        }
  +#endif
           if (!strcmp(sourcefile, output))
               fatal(1, "main", "outputfile is sourcefile\n");
       }
  
  
  

Reply via email to