[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog 2f5dd9f13c 024/166: FIXED: Use more robust Prol
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog 2f5dd9f13c 024/166: FIXED: Use more robust Prolog to C string conversion |
Date: |
Fri, 30 Sep 2022 04:59:22 -0400 (EDT) |
branch: elpa/sweeprolog
commit 2f5dd9f13c23e5789f67188c907696e6458cda5f
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
FIXED: Use more robust Prolog to C string conversion
---
sweep.c | 4 +++-
sweep.el | 10 ++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/sweep.c b/sweep.c
index ff148c71fb..bccb1ad40b 100644
--- a/sweep.c
+++ b/sweep.c
@@ -102,8 +102,10 @@ term_to_value_string(emacs_env *eenv, term_t t) {
char * string = NULL;
emacs_value v = NULL;
size_t l = -1;
- if (PL_get_string_chars(t, &string, &l)) {
+ if (PL_get_nchars(t, &l, &string, CVT_STRING|REP_UTF8)) {
v = eenv->make_string(eenv, string, l);
+ } else {
+ v = eenv->make_string(eenv, "sweep conversion error", 22);
}
return v;
}
diff --git a/sweep.el b/sweep.el
index 88dfe1b0a2..ed8c7af17a 100644
--- a/sweep.el
+++ b/sweep.el
@@ -15,6 +15,10 @@
;;; Code:
+(defgroup sweep nil
+ "SWI-Prolog Embedded in Emacs."
+ :group 'prolog)
+
(defvar sweep-install-buffer-name "*Install sweep*"
"Name of the buffer used for compiling sweep-module.")
@@ -88,6 +92,7 @@
nil))))))
(completing-read "Predicate: " col)))
+;;;###autoload
(defun sweep-find-predicate (mfn)
"Jump to the definiton of the Prolog predicate MFN.
MFN must be a string of the form \"M:F/N\" where M is a Prolog
@@ -125,12 +130,13 @@ module name, F is a functor name and N is its arity."
(let* ((val (cdr (assoc-string key col)))
(pat (car val))
(des (cdr val)))
- (concat (make-string (- 32 (length key)) ? )
+ (concat (make-string (max 0 (- 32 (length key))) ? )
(if des
- (concat pat (make-string (- 64 (length pat)) ?
) des)
+ (concat pat (make-string (max 0 (- 80 (length
pat))) ? ) des)
pat)))))))
(completing-read "Module: " col)))
+;;;###autoload
(defun sweep-find-module (mod)
"Jump to the source file of the Prolog module MOD."
(interactive (list (sweep-read-module-name)))
- [nongnu] elpa/sweeprolog 24a1e14ee9 151/166: MODIFIED: Breaking change: rename sweep.el to sweeprolog.el..., (continued)
- [nongnu] elpa/sweeprolog 24a1e14ee9 151/166: MODIFIED: Breaking change: rename sweep.el to sweeprolog.el..., ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 13c7551015 156/166: ENHANCED: only fontify visible sweeprolog-mode buffers on idle, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog cada0d3871 166/166: DOC: document quasi-quotation highlighting in the manual, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 85af4010e8 158/166: Use a public mailing list in the Maintainer package header, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 353ef846fb 035/166: ENHANCED: Pass keystrokes to the top-level directly when appropriate, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 72cc4d516b 014/166: PORT: detect linux vs macOS shared object extension in Makefile, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog e029eb3e3c 016/166: update .build.yml, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 0aa0a46631 017/166: PORT: don't use clang's -fdiagnostics-absolute-paths, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog d4a501e9af 020/166: PORT: use rpath linker option, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog b75179cc6e 022/166: Revert rpath tweaks, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 2f5dd9f13c 024/166: FIXED: Use more robust Prolog to C string conversion,
ELPA Syncer <=
- [nongnu] elpa/sweeprolog 5f0f223318 023/166: Use LD_PRELOAD for testing, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog ea04f467b9 027/166: ADDED: sweep-pack-install for interactively installing packs, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 25bda86c48 032/166: Use load-file-path instead of custom hack, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog c5b1504ca8 033/166: ADDED: sweep-top-level command and appropriate mode, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog a06906287f 036/166: ADDED: sweep_funcall/2, 3 for calling Elisp functions from Prolog, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 5b23e9819b 038/166: DOC: Add Prolog initialization section to the manual, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 4e4d8508cd 039/166: ENHANCED: Allow using swipl compiled with GMP, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 4b4b28f15a 007/166: Add module descriptions to sweep-find-module annotation function, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 0078ef8ff0 060/166: ENHANCED: syntax errors coloring, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog e38825d0e2 066/166: ENHANCED: use a distinct face for structured comments, ELPA Syncer, 2022/09/30