[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sqlite3 a2d5e39133 43/62: Removed unused codes from consts
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sqlite3 a2d5e39133 43/62: Removed unused codes from consts.c |
Date: |
Tue, 14 Mar 2023 11:01:47 -0400 (EDT) |
branch: elpa/sqlite3
commit a2d5e391338b386d077ea0977866cee06a0d92b3
Author: Uphill Battler <code@uphill.me>
Commit: Uphill Battler <code@uphill.me>
Removed unused codes from consts.c
---
Makefile | 13 +------------
README.org | 12 ++++++++++--
consts.c | 27 +++++++++++++++++----------
tools/Makefile | 4 ++++
tools/gen-consts.py | 18 +++++++++++++++---
tools/gen-consts.sh | 25 +++++++++++++++++++++----
6 files changed, 68 insertions(+), 31 deletions(-)
diff --git a/Makefile b/Makefile
index 6dd70593f8..d866ada7ac 100644
--- a/Makefile
+++ b/Makefile
@@ -37,23 +37,12 @@ module: $(MODULE).so
install: module
emacsclient -e '(package-install-file "$(MODULE_TAR)")'
-doc: README.md
-
-# create constants based on sqlite3.h
-consts:
- tools/gen-consts.sh > consts.c
-
-# Create README.md
-# md-toc.py inserts a TOC into the markdown file
-README.md: README-in.md
- tools/md-toc.py $< > $@
-
%.so: %.o
$(CC) -shared -o $@ $< $(LIB)
%.o: %.c
$(CC) $(CFLAGS) -fPIC -c $<
-# Emacs 25.3
+# Regression test
test:
$(EMACS) -batch -Q -L . -l tests/regression.el
diff --git a/README.org b/README.org
index 7922fed615..89dd710617 100644
--- a/README.org
+++ b/README.org
@@ -27,7 +27,7 @@ direct access to the core SQLite3 C API from Emacs Lisp.
While this module provides only 14 functions (vs
[[https://sqlite.org/c3ref/funclist.html][200+ in the C API]]), it should
satisfy most
users' needs.
-The current version is v0.13.
+The current version is v0.14.
This is an alpha release so it might crash your Emacs. Save your work before
you try it out!
@@ -36,6 +36,8 @@ This is an alpha release so it might crash your Emacs. Save
your work before you
:TOC: :include all :depth 4 :ignore (this)
:END:
+# M-x org-make-toc to update the TOC
+# Requires https://github.com/alphapapa/org-make-toc
:CONTENTS:
- [[#sqlite3-api-for-emacs-25][SQLite3 API for Emacs 25+]]
- [[#requirements][Requirements]]
@@ -63,6 +65,7 @@ This is an alpha release so it might crash your Emacs. Save
your work before you
- [[#a-note-on-garbage-collection][A Note on Garbage Collection]]
- [[#known-problems][Known Problems]]
- [[#license][License]]
+ - [[#contributors][Contributors]]
- [[#changelog][Changelog]]
- [[#useful-links-for-writing-dynamic-modules][Useful Links for Writing
Dynamic Modules]]
:END:
@@ -90,7 +93,7 @@ $ make module
#+END_SRC
A tar archive called ~sqlite3-api-X.Y.tar~ will be created. Do a ~M-x
package-install-file~ in Emacs to install that tar archive and
-you'll all set.
+you're all set.
For Mac users:
#+BEGIN_SRC sh :eval no :exports code
@@ -352,7 +355,12 @@ For integers > 61 bits you can retrieve them as text as a
workaround.
** License
The code is licensed under the
[[https://www.gnu.org/licenses/gpl-3.0.html][GNU GPL v3]].
+** Contributors
+- [[https://github.com/tarsius][Jonas Bernoulli]] - Melpa package
** Changelog
+*v0.14 - 2020-07-08*
+- Added sqlite3.el (melpa)
+
*v0.13 - 2020-04-20*
- Rewrote README in .org format
diff --git a/consts.c b/consts.c
index aa468e79bb..6a2360622f 100644
--- a/consts.c
+++ b/consts.c
@@ -1,6 +1,21 @@
/*
- Auto-generated 2020-04-14 20:31:47
- Based on
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sqlite3.h
+ This program 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.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ Auto-generated 2020-07-08 18:50:03
+ Based on https://sqlite.org/c3ref/constlist.html
*/
defconst(env, "sqlite-version", env->make_string(env, SQLITE_VERSION,
strlen(SQLITE_VERSION)));
@@ -124,11 +139,6 @@ defconst(env, "sqlite-open-fullmutex",
env->make_integer(env, SQLITE_OPEN_FULLMU
defconst(env, "sqlite-open-sharedcache", env->make_integer(env,
SQLITE_OPEN_SHAREDCACHE));
defconst(env, "sqlite-open-privatecache", env->make_integer(env,
SQLITE_OPEN_PRIVATECACHE));
defconst(env, "sqlite-open-wal", env->make_integer(env, SQLITE_OPEN_WAL));
-defconst(env, "sqlite-open-fileprotection-complete", env->make_integer(env,
SQLITE_OPEN_FILEPROTECTION_COMPLETE));
-defconst(env, "sqlite-open-fileprotection-completeunlessopen",
env->make_integer(env, SQLITE_OPEN_FILEPROTECTION_COMPLETEUNLESSOPEN));
-defconst(env,
"sqlite-open-fileprotection-completeuntilfirstuserauthentication",
env->make_integer(env,
SQLITE_OPEN_FILEPROTECTION_COMPLETEUNTILFIRSTUSERAUTHENTICATION));
-defconst(env, "sqlite-open-fileprotection-none", env->make_integer(env,
SQLITE_OPEN_FILEPROTECTION_NONE));
-defconst(env, "sqlite-open-fileprotection-mask", env->make_integer(env,
SQLITE_OPEN_FILEPROTECTION_MASK));
defconst(env, "sqlite-iocap-atomic", env->make_integer(env,
SQLITE_IOCAP_ATOMIC));
defconst(env, "sqlite-iocap-atomic512", env->make_integer(env,
SQLITE_IOCAP_ATOMIC512));
defconst(env, "sqlite-iocap-atomic1k", env->make_integer(env,
SQLITE_IOCAP_ATOMIC1K));
@@ -187,9 +197,6 @@ defconst(env, "sqlite-fcntl-rollback-atomic-write",
env->make_integer(env, SQLIT
defconst(env, "sqlite-fcntl-lock-timeout", env->make_integer(env,
SQLITE_FCNTL_LOCK_TIMEOUT));
defconst(env, "sqlite-fcntl-data-version", env->make_integer(env,
SQLITE_FCNTL_DATA_VERSION));
defconst(env, "sqlite-fcntl-size-limit", env->make_integer(env,
SQLITE_FCNTL_SIZE_LIMIT));
-defconst(env, "sqlite-get-lockproxyfile", env->make_integer(env,
SQLITE_GET_LOCKPROXYFILE));
-defconst(env, "sqlite-set-lockproxyfile", env->make_integer(env,
SQLITE_SET_LOCKPROXYFILE));
-defconst(env, "sqlite-last-errno", env->make_integer(env, SQLITE_LAST_ERRNO));
defconst(env, "sqlite-access-exists", env->make_integer(env,
SQLITE_ACCESS_EXISTS));
defconst(env, "sqlite-access-readwrite", env->make_integer(env,
SQLITE_ACCESS_READWRITE));
defconst(env, "sqlite-access-read", env->make_integer(env,
SQLITE_ACCESS_READ));
diff --git a/tools/Makefile b/tools/Makefile
new file mode 100644
index 0000000000..c558ceb20e
--- /dev/null
+++ b/tools/Makefile
@@ -0,0 +1,4 @@
+# Grab SQLITE_* from sqlite.h
+# Requires pandoc and python3
+consts:
+ ./gen-consts.sh > ../consts.c
diff --git a/tools/gen-consts.py b/tools/gen-consts.py
index 863b0a6e9d..2ced0c91be 100755
--- a/tools/gen-consts.py
+++ b/tools/gen-consts.py
@@ -1,13 +1,25 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
import os
import re
+useful_codes = []
+with open(sys.argv[1]) as f:
+ for l in f.readlines():
+ useful_codes.append(l.rstrip())
+
+# Read from sqlite3.h (from stdin)
+# only codes that exist in useful_codes are included in consts.c
for line in sys.stdin.readlines():
- line.rstrip()
# fields = [ "#define", "SQLITE_XXXX" "YYYY" ];
- fields = re.split("\s+", line, 3)
+ fields = re.split("\s+", line.rstrip(), 3)
+
+ #print("{0}".format(fields[1]))
+ if not fields[1] in useful_codes:
+ #print("{0} excluded".format(fields[1]))
+ continue
+
sym = re.sub("_", "-", fields[1].lower())
if len(fields) > 2 and fields[2] != "":
if fields[2].startswith('"'):
diff --git a/tools/gen-consts.sh b/tools/gen-consts.sh
index 2fac34da16..5ba9421b6b 100755
--- a/tools/gen-consts.sh
+++ b/tools/gen-consts.sh
@@ -1,15 +1,32 @@
#!/bin/bash
-# locate the path of sqlite3.h
-# Take -I... as the only argument
DIR=$(dirname $0)
NOW=$(date '+%Y-%m-%d %H:%M:%S')
+URL=https://sqlite.org/c3ref/constlist.html
SQLITE3_H=$(echo '#include <sqlite3.h>' | gcc $* -x c -H -fsyntax-only - 2>&1
| grep '^\. ' | cut -f2 -d' ')
cat<<EOF
+/*
+ This program 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.
+
+ This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
/*
Auto-generated $NOW
- Based on $SQLITE3_H
+ Based on $URL
*/
EOF
-grep '^#define SQLITE_' $SQLITE3_H | grep -v 'SQLITE_TRANSIENT' | grep -v
SQLITE_STATIC | $DIR/gen-consts.py
+
+curl -s $URL | pandoc -t html -t plain | grep "^SQLITE_" | grep -v SCANSTAT |
grep -v SQLITE_STATIC > $DIR/useful.txt
+grep '^#define SQLITE_' $SQLITE3_H | grep -v 'SQLITE_TRANSIENT' | grep -v
SQLITE_STATIC | $DIR/gen-consts.py $DIR/useful.txt
+rm -f $DIR/useful.txt
- [nongnu] elpa/sqlite3 48c913559f 03/62: -std=c99 to Makefile, (continued)
- [nongnu] elpa/sqlite3 48c913559f 03/62: -std=c99 to Makefile, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 94f0c69538 06/62: improved doc, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 ce41ac18bc 02/62: first commit, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 8ad45baacf 05/62: fixed memory leak; used sqlite3_close_v2, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 ed7ea9c919 18/62: removed sqlite3-api-constants.el from repo, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 0bae137c63 26/62: LIB and INC added to Makefile, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 9e6dbe5d37 15/62: fixed typo, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 0131cc617d 19/62: python3 -> python, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 7abb3c6f70 28/62: fixed callback example; added Homebrew linkage, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 71d35506ec 07/62: minor adjustment to Makefile, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 a2d5e39133 43/62: Removed unused codes from consts.c,
ELPA Syncer <=
- [nongnu] elpa/sqlite3 b72c2c40d9 44/62: Better handling of SQLite codes in consts.c, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 a51467b031 04/62: added test for Emacs 25.1, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 1f1f7ab2db 09/62: added package creation section, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 1b7b1fc03f 10/62: fixed module installation bug, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 a69ff5a456 11/62: github installation function added, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 47391311a9 12/62: edited sqlite3-api.el to adhere to melpa guidelines, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 723787e6d9 21/62: added 'make install', ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 77e719fb88 24/62: better comments, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 0dfe8e07df 30/62: 26.1 test added, ELPA Syncer, 2023/03/14
- [nongnu] elpa/sqlite3 b8fc4e2fae 35/62: TOC, ELPA Syncer, 2023/03/14