cvsuser 02/05/24 10:26:35
Modified: . Makefile README mod_parrot.c
Log:
Got IO working much better. Now, mod_parrot creates a ParrotIO object and
passes it to the callee as P1.
Revision Changes Path
1.7 +1 -1 mod_parrot/Makefile
Index: Makefile
===================================================================
RCS file: /cvs/public/mod_parrot/Makefile,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -r1.6 -r1.7
--- Makefile 23 May 2002 03:05:46 -0000 1.6
+++ Makefile 24 May 2002 17:26:35 -0000 1.7
@@ -22,7 +22,7 @@
hsd:
- LD_LIBRARY_PATH=$(PARROT_LIB_DIR) $(APACHEDIR)/bin/httpd -X
+ LD_LIBRARY_PATH=$(PARROT_LIB_DIR):$(LD_LIBRARY_PATH) $(APACHEDIR)/bin/httpd -X
patch: mod_parrot.diff
perl -pi -ne 's#(.Config{ccflags})#"\1 -I$(.CURDIR) -I$(APACHEDIR)/include"#' $(PARROT_DIR)/Configure.pl
1.6 +16 -27 mod_parrot/README
Index: README
===================================================================
RCS file: /cvs/public/mod_parrot/README,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- README 23 May 2002 03:20:51 -0000 1.5
+++ README 24 May 2002 17:26:35 -0000 1.6
@@ -1,10 +1,11 @@
README for Apache mod_parrot module
===================================
-Until Parrot has an IO sub system it'll be ugly to get it to print to
-the browsers, so that doesn't work very well. So for now your best
-bet is to httpd with -X and watch the output on your
-terminal. Exciting, huh?
+It's sort of working now. You still can't set any headers. In fact, all
+headers are sent to the browser before the parrot code is executed. This is
+because parrot is given access to the raw file descriptor which we steal from
+the apache BUFF* object. Everything must be flushed from the file descriptor
+before parrot starts printing to it.
We don't have a real mailinglist, so subscribe to the mod_parrot CVS
list by sending mail to [email protected] and talk to
@@ -30,22 +31,10 @@
1. First build parrot.
- If you want IO then start by running
-
- make patchprint
-
- That munges the parrot source code to call a modparrot function
- which sends output to the appropriate place in parrot.
-
- Then run
-
- make patch
- # (which will make the appropriate patch and then build the library.)
- cd $PARROT_DIR
- perl ./Configure.pl with arguments to your tasting
- make
- cd -
-
+ a) cd $PARROT_DIR
+ b) perl ./Configure.pl with arguments to your tasting
+ c) make shared
+ d) copy blib/lib/libparrot.so to $APACHEDIR/libexec or something
2. Then run
@@ -75,17 +64,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.
+I (Tony) needed the following line, as well.
+ LoadFile libexec/libparrot.so
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 send data to the client, use the PIO object in pmc register 1:
+
+print P1, "Testing\n"
To use mod_parrot, use assemble.pl to compile to bytecode, and then
put that in your web directory.
1.8 +16 -3 mod_parrot/mod_parrot.c
Index: mod_parrot.c
===================================================================
RCS file: /cvs/public/mod_parrot/mod_parrot.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- mod_parrot.c 23 May 2002 03:05:46 -0000 1.7
+++ mod_parrot.c 24 May 2002 17:26:35 -0000 1.8
@@ -6,7 +6,8 @@
#include "http_protocol.h"
#include "util_script.h"
-#include "parrot/embed.h"
+#include "parrot/parrot.h"
+#include "parrot/register.h"
#include <stdio.h>
#include <unistd.h>
@@ -57,6 +58,8 @@
time_t ptime;
int fd;
+ fd = r->connection->client->fd;
+
sharedr = r;
if (r->filename == NULL) {
@@ -84,14 +87,24 @@
r->content_type = "text/plain";
ap_soft_timeout("send example call trace", r);
ap_send_http_header(r);
+ /* right nw, we have no way to send parrot prints through the BUFF *,
+ * so flush whatever's in the buffer. Then let parrot do raw IO on
+ * the fd
+ */
+ ap_rflush(r);
if (r->header_only) {
ap_kill_timeout(r);
return OK;
}
- // so here
+ /* so here */
Parrot_loadbc(interpreter, pf);
+ /* suggested change */
+ /*Parrot_set_pmc_register(interpreter, 1, new_io_pmc(interpreter, PIO_fdopen(interpreter,fd,"a")));*/
+ /* Create a ParrotIO object as P1*/
+ interpreter->pmc_reg.registers[1] = new_io_pmc(interpreter, PIO_fdopen(interpreter,fd,"a"));
+ /* actually run it*/
Parrot_runcode(interpreter, 0, NULL);
ap_kill_timeout(r);
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.