cvs commit: mod_parrot Makefile README mod_parrot.c

[email protected]
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
cvsuser     01/12/01 21:32:40

  Modified:    .        Makefile README mod_parrot.c
  Log:
  Make IO work... sort of.
  
  Revision  Changes    Path
  1.3       +5 -1      mod_parrot/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /cvs/public/mod_parrot/Makefile,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- Makefile	2001/12/02 05:01:02	1.2
  +++ Makefile	2001/12/02 05:32:40	1.3
  @@ -3,11 +3,15 @@
   
   PARROT_DIR=../parrot
   
  -all: mod_parrot.so
  +all: patchparrot mod_parrot.so
   
   mod_parrot.so: mod_parrot.c
   	$(APACHEDIR)/bin/apxs -Wall -I $(PARROT_DIR)/include -c -n parrot mod_parrot.c -L$(PARROT_DIR) -lparrot 
   
  +patchparrot:
  +	make -C $(PARROT_DIR) core_ops.c
  +	perl -pi -e 's/printf/modparrot_printf/g' $(PARROT_DIR)/core_ops.c
  +	make -C $(PARROT_DIR) libparrot.so
   
   install: mod_parrot.so
   	$(APACHEDIR)/bin/apxs -i -a -n parrot mod_parrot.so
  
  
  
  1.3       +39 -6     mod_parrot/README
  
  Index: README
  ===================================================================
  RCS file: /cvs/public/mod_parrot/README,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- README	2001/09/16 02:38:05	1.2
  +++ README	2001/12/02 05:32:40	1.3
  @@ -5,12 +5,36 @@
   get around to that.  So for now you have to run httpd with -X and
   watch the output on your terminal. Exciting, huh?
   
  +UPDATE:  this now sort of works!  (But it's a little... well, a lot,
  +hackish)
   
  -To install, first build parrot and then fix the PREFIX and the
  -PARROT_DIR in the Makefile. Then run
   
  -  make all install
  +To install:
   
  +0. Fix the APACHEDIR and the PARROT_DIR in the Makefile.
  +
  +1. First build parrot.
  +
  +If you want IO, you need to run this command on your parrot source:
  +  perl -pi -e 's/modparrot_printf/printf/g' core_ops.c
  +That munges the parrot source code to call a modparrot function which
  +sends output to the appropriate place in parrot.
  +(You can also just do the following:
  +
  +    a) cd $PARROT_DIR
  +    b) perl ./Configure.pl with arguments to your tasting
  +    c) back in the mod_parrot dir
  +    d) make patchparrot 
  +	    (which will make the appropriate patch and then build the library.)
  +
  +2. Then run
  +
  +  make mod_parrot.so
  +
  +3. Install mod_parrot into your apache tree with
  +
  +  make install
  +
   which will first install and then enable the module in your
   configuration file.
   
  @@ -18,7 +42,7 @@
   can just unpack the Apache source and then run
     ./configure --enable-module=so --prefix=/home/me/somewhere/else/
   
  -To activate the parrot module in your apache configuration, do
  +4, To activate the parrot module in your apache configuration, do
   something like
   
       <Location /parrot/>
  @@ -31,8 +55,17 @@
   
   should do the trick too.
   
  -
   To start the server you can use
   
       make hsd
  +	to start in single process mode.
  +
  +Or, if you are using the patchparrot IO method, just start apache
  +normally.
  +
  +By default, mod_parrot hardcodes the output to MIME type text/plain.
  +You will need to edit this in mod_parrot.c if you want to change it.
  +(Eventually, of course, there will be custom parrot ops to do this.)
   
  +To use mod_parrot, use assemble.pl to compile to bytecode, and then
  +put that in your web directory.
  
  
  
  1.3       +18 -0     mod_parrot/mod_parrot.c
  
  Index: mod_parrot.c
  ===================================================================
  RCS file: /cvs/public/mod_parrot/mod_parrot.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- mod_parrot.c	2001/12/02 05:01:17	1.2
  +++ mod_parrot.c	2001/12/02 05:32:40	1.3
  @@ -19,13 +19,31 @@
   module MODULE_VAR_EXPORT mod_parrot_module;
   
   struct Parrot_Interp *interpreter;
  +request_rec *sharedr;
   
  +int modparrot_printf(const char *format, ...) {
  +  va_list ap;
  +  char buf[2048];
  +  int nbytes;
  +  
  +  va_start(ap, format); /* initialize the list of arguments */
  +  nbytes = vsprintf(buf,format, ap); /* actually do the printing */
  +  va_end(ap); /* end reading the arguments */
  +
  +  nbytes = ap_rputs(buf,sharedr);
  +
  +  return nbytes; /* return the same as printf */
  +}
  +
  +
   static int parrot_handler(request_rec *r)
   {
     struct PackFile * pf;
     void *program_code;
     struct stat file_stat;
     int fd;
  +
  +  sharedr = r;
     
       if (stat(r->filename, &file_stat)) {
         printf("can't stat %s, code %i\n", r->filename, errno);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.