From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dick.r.chiang@gmail.com Newsgroups: gmane.emacs.bugs Subject: bug#52440: 28.0.50; [PATCH] Quis custodiet ipsos custodes (sqlite3) Date: Sat, 11 Dec 2021 16:32:01 -0500 Message-ID: <87wnkazv3i.fsf@dick> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1224"; mail-complaints-to="usenet@ciao.gmane.io" To: 52440@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 11 22:33:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mw9zR-00007T-VC for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Dec 2021 22:33:10 +0100 Original-Received: from localhost ([::1]:48260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mw9zQ-0000ZJ-FI for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Dec 2021 16:33:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mw9zK-0000Yi-Tb for bug-gnu-emacs@gnu.org; Sat, 11 Dec 2021 16:33:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mw9zK-0007pv-KL for bug-gnu-emacs@gnu.org; Sat, 11 Dec 2021 16:33:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mw9zK-0002Wd-H2 for bug-gnu-emacs@gnu.org; Sat, 11 Dec 2021 16:33:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: dick.r.chiang@gmail.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Dec 2021 21:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52440 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.16392583389651 (code B ref -1); Sat, 11 Dec 2021 21:33:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Dec 2021 21:32:18 +0000 Original-Received: from localhost ([127.0.0.1]:50163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mw9yX-0002VW-Al for submit@debbugs.gnu.org; Sat, 11 Dec 2021 16:32:17 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:49872) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mw9yT-0002VM-3V for submit@debbugs.gnu.org; Sat, 11 Dec 2021 16:32:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mw9yS-0000Sn-TH for bug-gnu-emacs@gnu.org; Sat, 11 Dec 2021 16:32:08 -0500 Original-Received: from [2607:f8b0:4864:20::f34] (port=42953 helo=mail-qv1-xf34.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mw9yO-0007ky-FL for bug-gnu-emacs@gnu.org; Sat, 11 Dec 2021 16:32:08 -0500 Original-Received: by mail-qv1-xf34.google.com with SMTP id p3so11104921qvj.9 for ; Sat, 11 Dec 2021 13:32:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=mJz9xtZCz3WNvom6pGSbdfGBlV3vjJtyMyWhy8uLizc=; b=ZRY7e/dOPR3mrlFWJHR6yq16R1QA0n3/RNM3FdwZ59AdtRr35bHAtslVXG/slVmM5z k6fEh9OYe8MZbhzY6RcAdMpkzElOwkWsfKDUe3Q/8z0OXexUVGtGGasBeqs9rkJ7MTTA XXq4FRYMXbhmpuQRBvaxV/uSL4RTHy6ri+jdia5U3BAohYA4st0yb7VP2QStYBVxG67a iSpzhFd6sUZ2VnI/iZITQxTqQu6D4hhvA4GqMfToRnlf+LE2M8ZW6ahgaPbcnAg/0nzZ QWpMaKzsSk2BYzTeVTk+fz5S1EXhpWkqhtJiE7JdSKqPcWb9N/kbOL0Jd58mFAcLo7nG p0yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=mJz9xtZCz3WNvom6pGSbdfGBlV3vjJtyMyWhy8uLizc=; b=wHT/EAlqYLRmQe40ywdRRsMXPiadRRzfpfm8Z0WIZ8qqa/wVF/v1nLZkUCxYd9FWbz iUy7cns7qhxOKMRRbDtE/LUDbJfAcx1+kQXsIdLz+//Yt9QyJQS5VsWU/rD/UHbI1+sw QncVwuaUgl7Uqj/cU+onZKlac+YAVnL8Vq81/oroP9Srab+5UdKDxijyD+lL427ABmmR VB0YJKMUtAEtWT7xpu53uYXK0hKISSHh1R6nXGhWXWSGGCw455kdC0rYOOj48CUo/FJp WmuqlUH8cU9KA/Qi2f7ZJrJlYn8fpfB8RzOzA133UFtEcj4y49yECiMShywBDOPEGbv4 fyfA== X-Gm-Message-State: AOAM5327fcoPAypprsGuv73d5JjiTVoYxjBUF+blpNCT0rcLqapQrO5Q Iv7BT7ocb/O3XKQjaAFyKktXYh+FJ/I= X-Google-Smtp-Source: ABdhPJxwlA19/PBwl5H+wjvj9V4p2ED3jMf17/LTSgfOzDsMOlw8+TAHcOaIQy5ZYa5t4qONGmQFew== X-Received: by 2002:ad4:5b8f:: with SMTP id 15mr33660008qvp.60.1639258322831; Sat, 11 Dec 2021 13:32:02 -0800 (PST) Original-Received: from localhost ([68.237.93.126]) by smtp.gmail.com with ESMTPSA id k8sm3520056qko.130.2021.12.11.13.32.02 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Dec 2021 13:32:02 -0800 (PST) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::f34 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::f34; envelope-from=dick.r.chiang@gmail.com; helo=mail-qv1-xf34.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222151 Archived-At: --=-=-= Content-Type: text/plain More cleanly separate the new module from standard builds, aka, slow thy roll. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-sqlite3-Quis-custodiet-ipsos-custodes.patch >From c7b20a867b795d0ebfa6d5572c31a72f3caa926a Mon Sep 17 00:00:00 2001 From: dickmao Date: Sat, 11 Dec 2021 16:21:30 -0500 Subject: [PATCH] [sqlite3] Quis custodiet ipsos custodes * configure.ac (WIDE_EMACS_INT): Default off `--with-sqlite3`. (HAVE_SQLITE3): Opt out of sqlite.o. (SQLITE3_LIBS): Hew to autotools sop. * lisp/sqlite-mode.el (sqlite-execute, sqlite-more-p, sqlite-next, sqlite-columns, sqlite-finalize, sqlite-select, sqlite-open): Forward declare. * src/Makefile.in (SQLITE3_CFLAGS): Hew to autotools sop. * src/alloc.c (union emacs_align_type): Give a hoot, don't pollute. (cleanup_vector): Give a hoot, don't pollute. * src/data.c (syms_of_data): Fence. * src/emacs.c (main): Give a hoot, don't pollute. * src/lisp.h (GCALIGNED_STRUCT): Give a hoot, don't pollute. * src/print.c (print_vectorlike): Fence. * src/sqlite.c (Fsqlitep): What is SQLITE without the P? (Fsqlite_available_p): Unfence. (syms_of_sqlite): Unfence. * test/src/sqlite-tests.el (sqlite-mode, sqlite-execute, sqlite-close, sqlitep, sqlite-available-p, sqlite-finalize, sqlite-next, sqlite-more-p, sqlite-select, sqlite-open): Forward declare. --- configure.ac | 21 ++++++++------ lisp/sqlite-mode.el | 8 ++++++ src/Makefile.in | 12 ++++++-- src/alloc.c | 11 +++++++- src/data.c | 1 + src/emacs.c | 8 +++++- src/lisp.h | 36 ------------------------ src/print.c | 7 ++++- src/sqlite.c | 18 ++---------- src/sqlite.h | 59 ++++++++++++++++++++++++++++++++++++++++ test/Makefile.in | 1 - test/src/sqlite-tests.el | 11 ++++++++ 12 files changed, 127 insertions(+), 66 deletions(-) create mode 100644 src/sqlite.h diff --git a/configure.ac b/configure.ac index 0debc852141..a602e45cefe 100644 --- a/configure.ac +++ b/configure.ac @@ -448,7 +448,7 @@ AC_DEFUN OPTION_DEFAULT_ON([png],[don't compile with PNG image support]) OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support]) OPTION_DEFAULT_ON([webp],[don't compile with WebP image support]) -OPTION_DEFAULT_ON([sqlite3],[don't compile with sqlite3 support]) +OPTION_DEFAULT_OFF([sqlite3],[don't compile with sqlite3 support]) OPTION_DEFAULT_ON([lcms2],[don't compile with Little CMS support]) OPTION_DEFAULT_ON([libsystemd],[don't compile with libsystemd support]) OPTION_DEFAULT_ON([cairo],[don't compile with Cairo drawing]) @@ -2682,27 +2682,32 @@ AC_DEFUN fi fi -### Use -lsqlite3 if available, unless '--with-sqlite3=no' HAVE_SQLITE3=no +SQLITE3_OBJ= +### Use -lsqlite3 if available, unless '--with-sqlite3=no' if test "${with_sqlite3}" != "no"; then AC_CHECK_LIB(sqlite3, sqlite3_open_v2, HAVE_SQLITE3=yes, HAVE_SQLITE3=no) if test "$HAVE_SQLITE3" = "yes"; then SQLITE3_LIBS=-lsqlite3 - AC_SUBST(SQLITE3_LIBS) - LIBS="$SQLITE3_LIBS $LIBS" + SQLITE3_OBJ=sqlite.o AC_DEFINE(HAVE_SQLITE3, 1, [Define to 1 if you have the libsqlite3 library (-lsqlite).]) - # Windows loads libsqlite dynamically - if test "${opsys}" = "mingw32"; then - SQLITE3_LIBS= - fi AC_CHECK_LIB(sqlite3, sqlite3_load_extension, HAVE_SQLITE3_LOAD_EXTENSION=yes, HAVE_SQLITE3_LOAD_EXTENSION=no) if test "$HAVE_SQLITE3_LOAD_EXTENSION" = "yes"; then AC_DEFINE(HAVE_SQLITE3_LOAD_EXTENSION, 1, [Define to 1 if sqlite3 supports loading extensions.]) fi + # Windows loads libsqlite dynamically + if test "${opsys}" = "mingw32"; then + SQLITE3_LIBS= + fi fi fi +AC_SUBST(HAVE_SQLITE3) +AC_SUBST(SQLITE3_LIBS) +AC_SUBST(SQLITE3_CFLAGS) +AC_SUBST(SQLITE3_OBJ) + HAVE_IMAGEMAGICK=no if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes" || \ test "${HAVE_BE_APP}" = "yes"; then diff --git a/lisp/sqlite-mode.el b/lisp/sqlite-mode.el index 9306bd85dcd..823dfeb07d6 100644 --- a/lisp/sqlite-mode.el +++ b/lisp/sqlite-mode.el @@ -25,6 +25,14 @@ (require 'cl-lib) +(declare-function sqlite-execute "sqlite.c") +(declare-function sqlite-more-p "sqlite.c") +(declare-function sqlite-next "sqlite.c") +(declare-function sqlite-columns "sqlite.c") +(declare-function sqlite-finalize "sqlite.c") +(declare-function sqlite-select "sqlite.c") +(declare-function sqlite-open "sqlite.c") + (defvar-keymap sqlite-mode-map "g" #'sqlite-mode-list-tables "c" #'sqlite-mode-list-columns diff --git a/src/Makefile.in b/src/Makefile.in index 3a8445db2d4..85c10103c4e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -238,6 +238,8 @@ IMAGEMAGICK_CFLAGS= LIBXML2_LIBS = @LIBXML2_LIBS@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ +SQLITE3_OBJ = @SQLITE3_OBJ@ SQLITE3_LIBS = @SQLITE3_LIBS@ GETADDRINFO_A_LIBS = @GETADDRINFO_A_LIBS@ @@ -330,6 +332,10 @@ JSON_LIBS = JSON_CFLAGS = @JSON_CFLAGS@ JSON_OBJ = @JSON_OBJ@ +SQLITE3_LIBS = @SQLITE3_LIBS@ +SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ +SQLITE3_OBJ = @SQLITE3_OBJ@ + INTERVALS_H = dispextern.h intervals.h composite.h GETLOADAVG_LIBS = @GETLOADAVG_LIBS@ @@ -395,7 +401,7 @@ EMACS_CFLAGS= $(HARFBUZZ_CFLAGS) $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ $(LIBSYSTEMD_CFLAGS) $(JSON_CFLAGS) \ $(LIBGNUTLS_CFLAGS) $(NOTIFY_CFLAGS) $(CAIRO_CFLAGS) \ - $(WERROR_CFLAGS) $(HAIKU_CFLAGS) + $(WERROR_CFLAGS) $(HAIKU_CFLAGS) $(SQLITE3_CFLAGS) ALL_CFLAGS = $(EMACS_CFLAGS) $(WARN_CFLAGS) $(CFLAGS) ALL_OBJC_CFLAGS = $(EMACS_CFLAGS) \ $(filter-out $(NON_OBJC_CFLAGS),$(WARN_CFLAGS)) $(CFLAGS) \ @@ -428,11 +434,11 @@ base_obj = doprnt.o intervals.o textprop.o composite.o xml.o lcms.o $(NOTIFY_OBJ) \ $(XWIDGETS_OBJ) \ profiler.o decompress.o \ - thread.o systhread.o sqlite.o \ + thread.o systhread.o \ $(if $(HYBRID_MALLOC),sheap.o) \ $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) $(JSON_OBJ) \ - $(HAIKU_OBJ) + $(HAIKU_OBJ) $(SQLITE3_OBJ) doc_obj = $(base_obj) $(NS_OBJC_OBJ) obj = $(doc_obj) $(HAIKU_CXX_OBJ) diff --git a/src/alloc.c b/src/alloc.c index 9f52a414d68..a9ba9885fd8 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -50,6 +50,10 @@ Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software #include TERM_HEADER #endif /* HAVE_WINDOW_SYSTEM */ +#ifdef HAVE_SQLITE3 +#include "sqlite.h" +#endif + #include #include #include /* For backtrace. */ @@ -125,7 +129,6 @@ Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software struct Lisp_Overlay Lisp_Overlay; struct Lisp_Sub_Char_Table Lisp_Sub_Char_Table; struct Lisp_Subr Lisp_Subr; - struct Lisp_Sqlite Lisp_Sqlite; struct Lisp_User_Ptr Lisp_User_Ptr; struct Lisp_Vector Lisp_Vector; struct terminal terminal; @@ -3181,6 +3184,12 @@ cleanup_vector (struct Lisp_Vector *vector) } } #endif +#ifdef HAVE_SQLITE3 + else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_SQLITE)) + { + /* clean s___ up. To be implemented. */ + } +#endif } /* Reclaim space used by unmarked vectors. */ diff --git a/src/data.c b/src/data.c index f07667b0003..81ae2f412ad 100644 --- a/src/data.c +++ b/src/data.c @@ -4069,6 +4069,7 @@ #define PUT_ERROR(sym, tail, msg) \ DEFSYM (Qterminal, "terminal"); DEFSYM (Qxwidget, "xwidget"); DEFSYM (Qxwidget_view, "xwidget-view"); + DEFSYM (Qsqlite, "sqlite"); DEFSYM (Qdefun, "defun"); diff --git a/src/emacs.c b/src/emacs.c index 3fc055aed92..05441b06825 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -81,6 +81,10 @@ #define MAIN_PROGRAM #include TERM_HEADER #endif /* HAVE_WINDOW_SYSTEM */ +#ifdef HAVE_SQLITE3 +#include "sqlite.h" +#endif /* HAVE_SQLITE3 */ + #include "bignum.h" #include "intervals.h" #include "character.h" @@ -2183,8 +2187,10 @@ main (int argc, char **argv) #endif syms_of_window (); syms_of_xdisp (); - syms_of_sqlite (); syms_of_font (); +#ifdef HAVE_SQLITE3 + syms_of_sqlite (); +#endif #ifdef HAVE_WINDOW_SYSTEM syms_of_fringe (); syms_of_image (); diff --git a/src/lisp.h b/src/lisp.h index 92ab05b4228..aa48b218d36 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2571,17 +2571,6 @@ xmint_pointer (Lisp_Object a) return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Misc_Ptr)->pointer; } -struct Lisp_Sqlite -{ - union vectorlike_header header; - void *db; - void *stmt; - char *name; - void (*finalizer) (void *); - bool eof; - bool is_statement; -} GCALIGNED_STRUCT; - struct Lisp_User_Ptr { union vectorlike_header header; @@ -2659,31 +2648,6 @@ XUSER_PTR (Lisp_Object a) return XUNTAG (a, Lisp_Vectorlike, struct Lisp_User_Ptr); } -INLINE bool -SQLITEP (Lisp_Object x) -{ - return PSEUDOVECTORP (x, PVEC_SQLITE); -} - -INLINE bool -SQLITE (Lisp_Object a) -{ - return PSEUDOVECTORP (a, PVEC_SQLITE); -} - -INLINE void -CHECK_SQLITE (Lisp_Object x) -{ - CHECK_TYPE (SQLITE (x), Qsqlitep, x); -} - -INLINE struct Lisp_Sqlite * -XSQLITE (Lisp_Object a) -{ - eassert (SQLITEP (a)); - return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Sqlite); -} - INLINE bool BIGNUMP (Lisp_Object x) { diff --git a/src/print.c b/src/print.c index 214f1d12c11..f06ceb308a6 100644 --- a/src/print.c +++ b/src/print.c @@ -40,6 +40,10 @@ Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2021 Free Software #include #include +#ifdef HAVE_SQLITE3 +#include +#endif + #if IEEE_FLOATING_POINT # include #endif @@ -1875,6 +1879,7 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, } break; #endif +#ifdef HAVE_SQLITE3 case PVEC_SQLITE: { print_c_string ("#', printcharfun); } break; - +#endif default: emacs_abort (); } diff --git a/src/sqlite.c b/src/sqlite.c index d92dcf723c9..f9b57c8d387 100644 --- a/src/sqlite.c +++ b/src/sqlite.c @@ -25,8 +25,7 @@ Copyright (C) 2021 Free Software Foundation, Inc. #include #include "lisp.h" #include "coding.h" - -#ifdef HAVE_SQLITE3 +#include "sqlite.h" #include @@ -644,24 +643,17 @@ DEFUN ("sqlite-finalize", Fsqlite_finalize, Ssqlite_finalize, 1, 1, 0, return Qt; } -#endif /* HAVE_SQLITE3 */ - DEFUN ("sqlitep", Fsqlitep, Ssqlitep, 1, 1, 0, doc: /* Say whether OBJECT is an SQlite object. */) (Lisp_Object object) { -#ifdef HAVE_SQLITE3 - return SQLITE (object)? Qt: Qnil; -#else - return Qnil; -#endif + return SQLITEP (object) ? Qt: Qnil; } DEFUN ("sqlite-available-p", Fsqlite_available_p, Ssqlite_available_p, 0, 0, 0, doc: /* Return t if sqlite3 support is available in this instance of Emacs.*/) (void) { -#ifdef HAVE_SQLITE3 # ifdef WINDOWSNT Lisp_Object found = Fassq (Qsqlite3, Vlibrary_cache); if (CONSP (found)) @@ -671,15 +663,11 @@ DEFUN ("sqlite-available-p", Fsqlite_available_p, Ssqlite_available_p, 0, 0, 0, # else return Qt; #endif -#else - return Qnil; -#endif } void syms_of_sqlite (void) { -#ifdef HAVE_SQLITE3 defsubr (&Ssqlite_open); defsubr (&Ssqlite_close); defsubr (&Ssqlite_execute); @@ -696,7 +684,7 @@ syms_of_sqlite (void) defsubr (&Ssqlite_finalize); DEFSYM (Qset, "set"); DEFSYM (Qfull, "full"); -#endif + defsubr (&Ssqlitep); DEFSYM (Qsqlitep, "sqlitep"); defsubr (&Ssqlite_available_p); diff --git a/src/sqlite.h b/src/sqlite.h new file mode 100644 index 00000000000..0d26f0b7b8f --- /dev/null +++ b/src/sqlite.h @@ -0,0 +1,59 @@ +/* Header file for the sqlite3 integration. + +Copyright (C) 2021 Free Software Foundation, Inc. + +This file is NOT part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + +#ifndef EMACS_SQLITE_H +#define EMACS_SQLITE_H + +#include "lisp.h" + +INLINE_HEADER_BEGIN + +struct Lisp_Sqlite +{ + union vectorlike_header header; + void *db; + void *stmt; + char *name; + void (*finalizer) (void *); + bool eof; + bool is_statement; +}; + +INLINE bool +SQLITEP (Lisp_Object x) +{ + return PSEUDOVECTORP (x, PVEC_SQLITE); +} + +INLINE struct Lisp_Sqlite * +XSQLITE (Lisp_Object a) +{ + eassert (SQLITEP (a)); + return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Sqlite); +} + +INLINE void +CHECK_SQLITE (Lisp_Object sql) +{ + CHECK_TYPE (SQLITEP (sql), Qsqlitep, sql); +} + +INLINE_HEADER_END + +#endif /* EMACS_SQLITE_H */ diff --git a/test/Makefile.in b/test/Makefile.in index f2c49584e7f..f3f7855b439 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -48,7 +48,6 @@ SO = SEPCHAR = @SEPCHAR@ HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@ - REPLACE_FREE = @REPLACE_FREE@ -include ${top_builddir}/src/verbose.mk diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el index 7ccea1c2a54..58949b2ebc6 100644 --- a/test/src/sqlite-tests.el +++ b/test/src/sqlite-tests.el @@ -25,6 +25,17 @@ (require 'ert) (require 'ert-x) +(require 'sqlite-mode) + +(declare-function sqlite-execute "sqlite.c") +(declare-function sqlite-close "sqlite.c") +(declare-function sqlitep "sqlite.c") +(declare-function sqlite-available-p "sqlite.c") +(declare-function sqlite-finalize "sqlite.c") +(declare-function sqlite-next "sqlite.c") +(declare-function sqlite-more-p "sqlite.c") +(declare-function sqlite-select "sqlite.c") +(declare-function sqlite-open "sqlite.c") (ert-deftest sqlite-select () (skip-unless (sqlite-available-p)) -- 2.26.2 --=-=-= Content-Type: text/plain In Commercial Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10) of 2021-12-11 built on dick Repository revision: 783c1910c3bdc9fc47fee3b305fa3e4c17d42b7b Repository branch: longlines Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 System Description: Ubuntu 18.04.4 LTS Configured using: 'configure --prefix=/home/dick/.local --enable-checking --with-tree-sitter --enable-dumping-overwrite CC=gcc-10 'CFLAGS=-g3 -Og -I/home/dick/.local/include/' LDFLAGS=-L/home/dick/.local/lib PKG_CONFIG_PATH=/home/dick/.local/lib/pkgconfig CXX=gcc-10' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON TREE-SITTER LCMS2 LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XPM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Magit Minor modes in effect: async-bytecomp-package-mode: t global-git-commit-mode: t shell-dirtrack-mode: t projectile-mode: t flx-ido-mode: t override-global-mode: t global-hl-line-mode: t winner-mode: t tooltip-mode: t show-paren-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /home/dick/gomacro-mode/gomacro-mode hides /home/dick/.emacs.d/elpa/gomacro-mode-20200326.1103/gomacro-mode /home/dick/.emacs.d/elpa/hydra-20170924.2259/lv hides /home/dick/.emacs.d/elpa/lv-20191106.1238/lv /home/dick/.emacs.d/elpa/magit-3.3.0/magit-section-pkg hides /home/dick/.emacs.d/elpa/magit-section-3.3.0/magit-section-pkg /home/dick/org-gcal.el/org-gcal hides /home/dick/.emacs.d/elpa/org-gcal-0.3/org-gcal /home/dick/.emacs.d/lisp/json hides /home/dick/emacs/lisp/json /home/dick/.emacs.d/elpa/transient-0.3.6/transient hides /home/dick/emacs/lisp/transient /home/dick/.emacs.d/elpa/hierarchy-20171221.1151/hierarchy hides /home/dick/emacs/lisp/emacs-lisp/hierarchy Features: (shadow sort footnote mail-extr gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr pixel-fill kinsoku svg dom gnus-group mm-url gnus-undo gnus-start gnus-dbus gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range gnus-win emacsbug sendmail benchmark pulse help-fns radix-tree find-func vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-cvs vc-rcs tramp-archive tramp-gvfs tramp-cache zeroconf dbus xml tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat parse-time iso8601 ls-lisp vc bug-reference cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs magit-extras sh-script executable rect face-remap magit-patch-changelog magit-patch magit-submodule magit-obsolete magit-popup async-bytecomp async magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode diff git-commit log-edit message yank-media rmc puny rfc822 mml mml-sec epa epg rfc6068 epg-config mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader pcvs-util add-log magit-core magit-margin magit-transient magit-process with-editor shell pcomplete server magit-mode transient format-spec make-mode ag vc-svn find-dired s dired-x dired dired-loaddefs misearch multi-isearch vc-git diff-mode vc-dispatcher autoconf autoconf-mode paredit-ext paredit subed subed-vtt subed-srt subed-common subed-mpv subed-debug subed-config inf-ruby ruby-mode smie company pcase haskell-interactive-mode haskell-presentation-mode haskell-process haskell-session haskell-compile haskell-mode haskell-cabal haskell-utils haskell-font-lock haskell-indentation haskell-string haskell-sort-imports haskell-lexeme haskell-align-imports haskell-complete-module haskell-ghc-support noutline outline flymake-proc flymake warnings etags fileloop generator xref project dabbrev haskell-customize hydra lv use-package-ensure solarized-theme solarized-definitions projectile lisp-mnt mail-parse rfc2231 ibuf-ext ibuffer ibuffer-loaddefs thingatpt magit-autorevert autorevert filenotify magit-git magit-section magit-utils crm dash rx grep compile comint ansi-color gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils text-property-search time-date flx-ido flx google-translate-default-ui google-translate-core-ui facemenu color ido google-translate-core google-translate-tk google-translate-backend use-package-bind-key bind-key auto-complete easy-mmode advice edmacro kmacro popup cus-edit pp cus-load wid-edit emms-player-mplayer emms-player-simple emms emms-compat cl-extra help-mode use-package-core derived hl-line winner ring finder-inf json-reformat-autoloads json-snatcher-autoloads sml-mode-autoloads tornado-template-mode-autoloads info package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars seq gv subr-x byte-opt bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tree-sitter tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 974965 153625) (symbols 48 35753 1) (strings 32 136426 20527) (string-bytes 1 4530479) (vectors 16 98269) (vector-slots 8 2745491 89364) (floats 8 464 1477) (intervals 56 71313 6420) (buffers 992 32)) --=-=-=--