guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Extended -e syntax


From: Christopher Cramer
Subject: Re: Extended -e syntax
Date: Mon, 1 Mar 2004 14:20:23 -0600
User-agent: Mutt/1.2.5i

On Sun, Feb 29, 2004 at 10:32:45PM -0500, Clinton Ebadi wrote:
> I've been trying to get guile-pg to compile and it hasn't been working out
> too well...ttn uses his new build system stuff with guile-pg and they only
> work with Guile 1.4.x unless Guile has support for his extended -e syntax.

Here's a patch for the sourceforge guile-pg that gets it to compile
with Guile 1.6. No idea if it works with 1.7. I sent this to the (then)
guile-pg maintainer years ago but he never released another version.

I have been using this for a long time now with no problems, but I've
never used large objects so that part is not tested. You need to run
automake after applying this patch.

        * Makefile.am: change to work with Guile 1.6 snarfer

        * libpostgres.c, libpostgres_lo.c, scm/postgres.scm.in:
        update to use Guile 1.6 API

diff -ur guile-pg-0.07/Makefile.am guile-pg-0.07-new/Makefile.am
--- guile-pg-0.07/Makefile.am   Fri Jun  2 02:52:34 2000
+++ guile-pg-0.07-new/Makefile.am       Sat Jul 20 19:04:00 2002
@@ -43,7 +43,7 @@
 
 SUFFIXES = .x
 .c.x:
-       guile-snarf $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $< > $@
+       guile-snarf $< $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) > $@
 
 ## Add -MG to make the .x magic work with auto-dep code.
 MKDEP = gcc -M -MG $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
diff -ur guile-pg-0.07/libpostgres.c guile-pg-0.07-new/libpostgres.c
--- guile-pg-0.07/libpostgres.c Tue Jun 20 04:41:51 2000
+++ guile-pg-0.07-new/libpostgres.c     Sat Jul 20 22:02:05 2002
@@ -37,7 +37,6 @@
 #include <guile/gh.h>
 
 #include <libpq-fe.h>
-#include <postgres.h>
 #include <libpq/libpq-fs.h>
 
 #include <libpostgres.h>
@@ -1151,14 +1150,14 @@
 
 #include <libpostgres.x>
 
-    scm_sysintern("PGRES_TUPLES_OK", SCM_MAKINUM(PGRES_TUPLES_OK));
-    scm_sysintern("PGRES_COMMAND_OK", SCM_MAKINUM(PGRES_COMMAND_OK));
-    scm_sysintern("PGRES_EMPTY_QUERY", SCM_MAKINUM(PGRES_EMPTY_QUERY));
-    scm_sysintern("PGRES_COPY_OUT", SCM_MAKINUM(PGRES_COPY_OUT));
-    scm_sysintern("PGRES_COPY_IN", SCM_MAKINUM(PGRES_COPY_IN));
-    scm_sysintern("PGRES_BAD_RESPONSE", SCM_MAKINUM(PGRES_BAD_RESPONSE));
-    scm_sysintern("PGRES_NONFATAL_ERROR", SCM_MAKINUM(PGRES_NONFATAL_ERROR));
-    scm_sysintern("PGRES_FATAL_ERROR", SCM_MAKINUM(PGRES_FATAL_ERROR));
+    scm_c_define("PGRES_TUPLES_OK", SCM_MAKINUM(PGRES_TUPLES_OK));
+    scm_c_define("PGRES_COMMAND_OK", SCM_MAKINUM(PGRES_COMMAND_OK));
+    scm_c_define("PGRES_EMPTY_QUERY", SCM_MAKINUM(PGRES_EMPTY_QUERY));
+    scm_c_define("PGRES_COPY_OUT", SCM_MAKINUM(PGRES_COPY_OUT));
+    scm_c_define("PGRES_COPY_IN", SCM_MAKINUM(PGRES_COPY_IN));
+    scm_c_define("PGRES_BAD_RESPONSE", SCM_MAKINUM(PGRES_BAD_RESPONSE));
+    scm_c_define("PGRES_NONFATAL_ERROR", SCM_MAKINUM(PGRES_NONFATAL_ERROR));
+    scm_c_define("PGRES_FATAL_ERROR", SCM_MAKINUM(PGRES_FATAL_ERROR));
 
     init_libpostgres_lo();
 
diff -ur guile-pg-0.07/libpostgres_lo.c guile-pg-0.07-new/libpostgres_lo.c
--- guile-pg-0.07/libpostgres_lo.c      Fri Jun  2 05:14:55 2000
+++ guile-pg-0.07-new/libpostgres_lo.c  Sat Jul 20 20:05:16 2002
@@ -197,7 +197,7 @@
   SCM_SETSTREAM (port, (SCM) lobp);
 
   pt->rw_random = 1;
-  if (SCM_INPORTP (port)) {
+  if (SCM_INPUT_PORT_P (port)) {
       pt->read_buf = malloc (LOB_BUFLEN);
       if (pt->read_buf == NULL)
         scm_memory_error (s_lob_mklobport);
@@ -207,7 +207,7 @@
       pt->read_buf = ((unsigned char *) pt->read_pos) = pt->read_end = 
&pt->shortbuf;
       pt->read_buf_size = 1;
   }
-  if (SCM_OUTPORTP (port)) {
+  if (SCM_OUTPUT_PORT_P (port)) {
       pt->write_buf = malloc (LOB_BUFLEN);
       if (pt->write_buf == NULL)
         scm_memory_error (s_lob_mklobport);
@@ -219,7 +219,7 @@
   }
   pt->write_end = pt->write_buf + pt->write_buf_size;
 
-  SCM_SETCAR (port, SCM_CAR (port) & ~SCM_BUF0);
+  SCM_SET_CELL_WORD_0 (port, SCM_CELL_WORD_0 (port) & ~SCM_BUF0);
 
   SCM_ALLOW_INTS;
 
@@ -315,7 +315,7 @@
               }
               pt->write_pos = pt->write_buf + remaining;
           }
-          if (!terminating)
+          if (1 /*!terminating*/)
              scm_syserror ("lob_flush");
           else {
               const char *msg = "Error: could not flush large object file 
descriptor ";
@@ -445,7 +445,7 @@
              lob_flush (port);
       }
       /* handle line buffering.  */
-      if ((SCM_CAR (port) & SCM_BUFLINE) && memchr (data, '\n', size))
+      if ((SCM_CELL_WORD_0 (port) & SCM_BUFLINE) && memchr (data, '\n', size))
           lob_flush (port);
    }
 }
diff -ur guile-pg-0.07/scm/postgres.scm.in guile-pg-0.07-new/scm/postgres.scm.in
--- guile-pg-0.07/scm/postgres.scm.in   Wed May 31 04:59:07 2000
+++ guile-pg-0.07-new/scm/postgres.scm.in       Sat Jul 20 21:11:43 2002
@@ -20,10 +20,56 @@
 
 ;; Load the C interface functions
 
-(if (not (defined? 'pg-guile-pg-loaded)) ;; Unless already loaded (static) ...
-  (dynamic-call "init_postgres" (dynamic-link "libpostgres.so")))
+(define-module (database postgres)
+  :export (
+       PGRES_TUPLES_OK
+       PGRES_COMMAND_OK
+       PGRES_EMPTY_QUERY
+       PGRES_COPY_OUT
+       PGRES_COPY_IN
+       PGRES_BAD_RESPONSE
+       PGRES_NONFATAL_ERROR
+       PGRES_FATAL_ERROR
+       pg-connectdb
+       pg-reset
+       pg-get-client-data
+       pg-set-client-data!
+       pg-exec
+       pg-error-message
+       pg-get-db
+       pg-set-db
+       pg-get-user
+       pg-get-pass
+       pg-get-host
+       pg-get-port
+       pg-get-tty
+       pg-get-options
+       pg-get-connection
+       pg-backend-pid
+       pg-result-status
+       pg-ntuples
+       pg-nfields
+       pg-cmdtuples
+       pg-oid-status
+       pg-oid-value
+       pg-fname
+       pg-fnumber
+       pg-ftype
+       pg-fsize
+       pg-getvalue
+       pg-getlength
+       pg-getisnull
+       pg-binary-tuples?
+       pg-fmod
+       pg-guile-pg-version
+       pg-getline
+       pg-putline
+       pg-endcopy
+       pg-trace
+       pg-untrace))
 
-(define-module (database postgres))
+(if (not (defined? 'pg-guile-pg-loaded)) ;; Unless already loaded (static) ...
+  (load-extension "libpostgres" "init_postgres"))
 
 (define-public (pg-guile-pg-module-config-stamp) "@GUILE_PG_STAMP@")
 (define-public (pg-guile-pg-module-version) "@VERSION@")

-- 
Christopher Cramer <address@hidden> <http://www.pyro.net/~crayc/>
In politics you have to understand not where the voters are when a poll
is taken, but where they are likely to end up on Election Day.
-- Rep. Tom Davis, former NRCC Chairman




reply via email to

[Prev in Thread] Current Thread [Next in Thread]