emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/sweeprolog 588cfb0f63 130/166: BUILD: Inline sweep.h in sw


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog 588cfb0f63 130/166: BUILD: Inline sweep.h in sweep.c
Date: Fri, 30 Sep 2022 04:59:31 -0400 (EDT)

branch: elpa/sweeprolog
commit 588cfb0f636b1bf873b83aee1cd6de75f5973de4
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    BUILD: Inline sweep.h in sweep.c
---
 sweep.c | 32 +++++++++++++++++++-------------
 sweep.h | 47 -----------------------------------------------
 2 files changed, 19 insertions(+), 60 deletions(-)

diff --git a/sweep.c b/sweep.c
index e55496e15b..847d9817ac 100644
--- a/sweep.c
+++ b/sweep.c
@@ -30,16 +30,30 @@
     POSSIBILITY OF SUCH DAMAGE.
 */
 
-#include "sweep.h"
+#include "emacs-module.h"
+#include <SWI-Prolog.h>
+#include <SWI-Stream.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
 int plugin_is_GPL_compatible;
 
-term_t o = 0;
+term_t      output_term = 0;
 emacs_env * current_env = NULL;
 
+static int         value_to_term(emacs_env*, emacs_value, term_t);
+static emacs_value term_to_value(emacs_env*, term_t);
+
+void
+ethrow(emacs_env *env, const char * message) {
+  ptrdiff_t  len = strlen(message);
+
+  emacs_value str = env->make_string(env, message, len);
+  emacs_value arg = env->funcall (env, env->intern (env, "list"), 1, &str);
+  env->non_local_exit_signal(env, env->intern(env, "error"), arg);
+}
+
 char*
 estring_to_cstring(emacs_env *eenv, emacs_value estring, ptrdiff_t *len_p) {
   char * buf = NULL;
@@ -93,14 +107,6 @@ ecdr(emacs_env *env, emacs_value cons) {
   return env->funcall (env, env->intern (env, "cdr"), 1, &cons);
 }
 
-void
-ethrow(emacs_env *env, const char * message) {
-  ptrdiff_t  len = strlen(message);
-
-  emacs_value str = env->make_string(env, message, len);
-  emacs_value arg = env->funcall (env, env->intern (env, "list"), 1, &str);
-  env->non_local_exit_signal(env, env->intern(env, "error"), arg);
-}
 
 emacs_value
 enil(emacs_env *env) { return env->intern(env, "nil"); }
@@ -373,9 +379,9 @@ sweep_next_solution(emacs_env *env, ptrdiff_t nargs, 
emacs_value *args, void *da
   case PL_S_FALSE:
     return enil(env);
   case PL_S_TRUE:
-    return econs(env, et(env), term_to_value(env, o));
+    return econs(env, et(env), term_to_value(env, output_term));
   case PL_S_LAST:
-    return econs(env, env->intern(env, "!"), term_to_value(env, o));
+    return econs(env, env->intern(env, "!"), term_to_value(env, output_term));
   default:
     return NULL;
   }
@@ -429,7 +435,7 @@ sweep_open_query(emacs_env *env, ptrdiff_t nargs, 
emacs_value *args, void *data)
 
   PL_open_query(n, PL_Q_NODEBUG | PL_Q_EXT_STATUS | PL_Q_CATCH_EXCEPTION, p, 
a);
 
-  o = a+(env->is_not_nil(env, s) ? 0 : 1);
+  output_term = a+(env->is_not_nil(env, s) ? 0 : 1);
 
   r = et(env);
 
diff --git a/sweep.h b/sweep.h
deleted file mode 100644
index bc0d950774..0000000000
--- a/sweep.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-    Author:        Eshel Yaron
-    E-mail:        eshel@swi-prolog.org
-    Copyright (c)  2022, SWI-Prolog Solutions b.v.
-    All rights reserved.
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions
-    are met:
-
-    1. Redistributions of source code must retain the above copyright
-       notice, this list of conditions and the following disclaimer.
-
-    2. Redistributions in binary form must reproduce the above copyright
-       notice, this list of conditions and the following disclaimer in
-       the documentation and/or other materials provided with the
-       distribution.
-
-    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-    FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-    POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef _SWEEP_H
-#define _SWEEP_H
-
-#include "emacs-module.h"
-#include <SWI-Prolog.h>
-#include <SWI-Stream.h>
-
-static int         value_to_term(emacs_env*, emacs_value, term_t);
-static emacs_value term_to_value(emacs_env*, term_t);
-static char *      estring_to_cstring(emacs_env*, emacs_value, ptrdiff_t*);
-static void        ethrow(emacs_env*, const char*);
-/* static int         estring_to_atom(emacs_env*, emacs_value, term_t); */
-/* static IOSTREAM *  estring_to_stream(emacs_env*, emacs_value); */
-
-#endif /*_SWEEP_H*/



reply via email to

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