rpms/clips/devel clips-init.el, NONE, 1.1 clips-mode.el, NONE, 1.1 clips.spec, NONE, 1.1 inf-clips.el, NONE, 1.1 xclips.png, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Rick L. Vinyard (rvinyard) fedora-extras-commits at redhat.com
Fri Jun 23 21:09:46 UTC 2006


Author: rvinyard

Update of /cvs/extras/rpms/clips/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv19486/devel

Modified Files:
	.cvsignore sources 
Added Files:
	clips-init.el clips-mode.el clips.spec inf-clips.el xclips.png 
Log Message:
auto-import clips-6.24-8 on branch devel from clips-6.24-8.src.rpm


--- NEW FILE clips-init.el ---
(autoload 'clips-mode "clips-mode" "Clips editing mode." t)
(autoload 'run-clips "inf-clips" "Run Clips." t)
(add-to-list 'auto-mode-alist '("\\.clp$" . clips-mode))


--- NEW FILE clips-mode.el ---
;;; clips-mode.el --- Clips editing mode.

;;;************************************************************************
;;; Basado en jess-mode.el de:

;; Copyright (C) 1999 by David E. Young.

;; Author: David E. Young <david.young at fnc.fujitsu.com>
;; Keywords: languages, clips

;; This is version 0.5 of 9 August 1999.

;; 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 2, 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, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;; 02111-1307  USA
;;;************************************************************************

;;; Code:

(require 'lisp-mode)

(defvar clips-mode-map nil)

(defvar clips-mode-hook nil
  "*Hooks for customising Clips mode.")

(defvar clips-mode-syntax-table nil
  "The value of which is the syntax table for Clips mode.")

(when (not clips-mode-map)
  (let ((map (make-sparse-keymap "Clips")))
;    (setq clips-mode-map
;      (nconc (make-sparse-keymap) shared-lisp-mode-map))
    (setq clips-mode-map (make-sparse-keymap))
    (define-key clips-mode-map [menu-bar] (make-sparse-keymap))
    (define-key clips-mode-map [menu-bar clips]
      (cons "Clips" map))
    (define-key map [inf-clips-load-file] 
      '("Load File" . inf-clips-load-file))
    (define-key map [run-clips] '("Run Inferior Clips" . run-clips))
    (define-key map [comment-region] '("Comment Region" . comment-region))
    (define-key map [indent-region] '("Indent Region" . indent-region))
    (define-key map [indent-line] '("Indent Line" . lisp-indent-line))))

(if (not clips-mode-syntax-table)
    (let ((i 0))
      (setq clips-mode-syntax-table (make-syntax-table))
      (while (< i ?0)
             (modify-syntax-entry i "_   " clips-mode-syntax-table)
             (setq i (1+ i)))
      (setq i (1+ ?9))
      (while (< i ?A)
             (modify-syntax-entry i "_   " clips-mode-syntax-table)
             (setq i (1+ i)))
      (setq i (1+ ?Z))
      (while (< i ?a)
             (modify-syntax-entry i "_   " clips-mode-syntax-table)
             (setq i (1+ i)))
      (setq i (1+ ?z))
      (while (< i 128)
             (modify-syntax-entry i "_   " clips-mode-syntax-table)
             (setq i (1+ i)))
      (modify-syntax-entry ?  "    " clips-mode-syntax-table)
      (modify-syntax-entry ?\t "    " clips-mode-syntax-table)
      (modify-syntax-entry ?\n ">   " clips-mode-syntax-table)
      (modify-syntax-entry ?\f ">   " clips-mode-syntax-table)
      (modify-syntax-entry ?\; "<   " clips-mode-syntax-table)
      (modify-syntax-entry ?` "'   " clips-mode-syntax-table)
      (modify-syntax-entry ?' "'   " clips-mode-syntax-table)
      (modify-syntax-entry ?, "'   " clips-mode-syntax-table)
      (modify-syntax-entry ?. "'   " clips-mode-syntax-table)
      (modify-syntax-entry ?# "'   " clips-mode-syntax-table)
      (modify-syntax-entry ?\" "\"    " clips-mode-syntax-table)
      (modify-syntax-entry ?\\ "\\   " clips-mode-syntax-table)
      (modify-syntax-entry ?\( "()  " clips-mode-syntax-table)
      (modify-syntax-entry ?\) ")(  " clips-mode-syntax-table)
      (modify-syntax-entry ?\[ "(]  " clips-mode-syntax-table)
      (modify-syntax-entry ?\] ")[  " clips-mode-syntax-table)
      (modify-syntax-entry ?*   "w   " clips-mode-syntax-table)
      ;; The next syntax entry doesn't work with these forms:
      ;;  `,.foo
      ;;  #.foo
      ;; but it works better with variables with .'s in them
      (modify-syntax-entry ?. "w   " clips-mode-syntax-table)
      (modify-syntax-entry ?\| "_   " clips-mode-syntax-table)
      (modify-syntax-entry ?\[ "_   " clips-mode-syntax-table)
      (modify-syntax-entry ?\] "_   " clips-mode-syntax-table)))

(defconst clips-font-lock-keywords-1
  (eval-when-compile
    (let ((clips-constructs
           (regexp-opt
            '("deffunction" "deftemplate" "defrule" "deffacts" "defgeneric"
              "defmodule" "defadvice" "defglobal" "defmethod"
              "definstance" "defclass")))
         (clips-identifier
          (let ((letter "a-zA-Z_$\-\300-\326\330-\366\370-\377")
                (digit "0-9"))
            (concat "\\<\\([" letter "][" letter digit "]*\\)\\>"))))
     (list
      (cons (concat "\\<" clips-constructs "\\>\\s *" clips-identifier)
            `(,(+ 1 (regexp-opt-depth clips-constructs)) font-lock-function-name-face))
      (cons (concat "\\<\\(" clips-constructs "\\)\\>") 'font-lock-keyword-face))))
  "Subdued expressions to highlight in Clips modes.")

(defconst clips-font-lock-keywords-2
  (append clips-font-lock-keywords-1
          (eval-when-compile
            (let ((clips-builtins
                   (regexp-opt
                    '("slot" "multislot" "type" "default" "default-dynamic"
                      "extends" "crlf""range" "nil" "if" "then" "else" "while"
                      "progn" "progn$" "not" "or" "switch" "case" "and" "reset"
                      "assert" "test" "declare" "salience" "return" "bind"
                      "retract" "explicit" "unique" "node-index-hash" "halt"
                      "=>")))
                  (clips-connective-constraints
                   (regexp-opt '("|" "&"))))
              (list
               (cons (concat "\\<\\(" clips-builtins "\\)\\>") 'font-lock-builtin-face)
               (cons (concat "\\<\\(" clips-connective-constraints "\\)\\>")
                     'font-lock-builtin-face)))))
  "Gaudy expressions to highlight in Clips modes.")

(defvar clips-font-lock-keywords clips-font-lock-keywords-2
  "Default expressions to highlight in Clips modes.")

(defun clips-initialize-mode ()
  (set-syntax-table clips-mode-syntax-table)
  (make-local-variable 'paragraph-start)
  (setq paragraph-start (concat page-delimiter "\\|$" ))
  (make-local-variable 'paragraph-separate)
  (setq paragraph-separate paragraph-start)
  (make-local-variable 'paragraph-ignore-fill-prefix)
  (setq paragraph-ignore-fill-prefix t)
  (make-local-variable 'fill-paragraph-function)
  (setq fill-paragraph-function 'lisp-fill-paragraph)
  ;; Adaptive fill mode gets in the way of auto-fill,
  ;; and should make no difference for explicit fill
  ;; because lisp-fill-paragraph should do the job.
  (make-local-variable 'adaptive-fill-mode)
  (setq adaptive-fill-mode nil)
  (make-local-variable 'indent-line-function)
  (setq indent-line-function 'lisp-indent-line)
  (make-local-variable 'indent-region-function)
  (setq indent-region-function 'lisp-indent-region)
  (make-local-variable 'parse-sexp-ignore-comments)
  (setq parse-sexp-ignore-comments t)
  (make-local-variable 'outline-regexp)
  (setq outline-regexp ";;; \\|(....")
  (make-local-variable 'comment-start)
  (setq comment-start ";")
  (make-local-variable 'comment-start-skip)
  ;; Look within the line for a ; following an even number of backslashes
  ;; after either a non-backslash or the line beginning.
  (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
  (make-local-variable 'comment-column)
  (setq comment-column 40)
  (make-local-variable 'comment-indent-function)
  (setq comment-indent-function 'lisp-comment-indent)
  (make-local-variable 'imenu-generic-expression)
  (setq imenu-generic-expression lisp-imenu-generic-expression)
  (make-local-variable 'font-lock-defaults)
  (setq font-lock-defaults '(clips-font-lock-keywords))
  (use-local-map clips-mode-map)
  (set-syntax-table clips-mode-syntax-table))

(put 'else 'clips-indent-function 0)

(defun clips-indent-function (ipoint state)
  (message "clips-indent-function")
  (lisp-indent-function ipoint state))

(defun clips-mode ()
  "Major mode for editing Clips code.
Editing commands are similar to those of other Lisp-like modes.

In addition, if an inferior Clips process is running, some additional
commands will be defined for evaluating expressions and controlling
the interpreter. The status of the process will also be displayed in
the modeline of all Clips buffers.

Commands:
\\{clips-mode-map}
Entry to this mode calls the value of `clips-mode-hook' if that value
is non-nil."
  (interactive)
  (kill-all-local-variables)
  (clips-initialize-mode)
  (setq major-mode 'clips-mode)
  (setq mode-name "Clips")
  (run-hooks 'clips-mode-hook))

(provide 'clips-mode)

;;; clips-mode.el ends here


--- NEW FILE clips.spec ---
Summary:	  CLIPS language for developing expert systems
Name:		  clips
Version:	  6.24
Release:	  8%{?dist}
Url:		  http://www.ghg.net/clips/download/source/
License:	  GPL
Group:		  Development/Tools
Source0:	  http://www.ghg.net/clips/download/source/clipssrc.tar.Z
Source1:	  http://www.ghg.net/clips/download/source/x-prjct.tar.Z
Source2:	  http://www.ghg.net/clips/download/executables/examples/AllExamples.tar.Z
Source3:	  http://www.ghg.net/clips/download/documentation/abstract.pdf
Source4:	  http://www.ghg.net/clips/download/documentation/apg.pdf
Source5:	  http://www.ghg.net/clips/download/documentation/arch5-1.pdf
Source6:	  http://www.ghg.net/clips/download/documentation/bpg.pdf
Source7:	  http://www.ghg.net/clips/download/documentation/ig.pdf
Source8:	  http://www.ghg.net/clips/download/documentation/usrguide.pdf
Source9:	  http://www.ghg.net/clips/download/documentation/3CCP.pdf
Source10:	  xclips.png
Source11:         clips-init.el
Source12:         clips-mode.el
Source13:         inf-clips.el
Patch0:	 	  clips-6.24-linux.patch.bz2
BuildRoot:        %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:	  libtermcap-devel libXt-devel libXext-devel libXmu-devel libXaw-devel xorg-x11-server-Xorg xorg-x11-proto-devel xorg-x11-xbitmaps desktop-file-utils

%description
CLIPS is a productive development and delivery expert system tool which 
provides a complete environment for the construction of rule and/or object 
based expert systems. Created in 1985 by NASA, CLIPS is now widely used 
throughout the government, industry, and academia.

This package provides the CLIPS command line environment and the clips
library.

%package          libs
Summary:          Run-time libraries for CLIPS applications
Group:            System Environment/Libraries

%description    libs
This package contains the run-time libraries needed for CLIPS applications.

%package          devel
Summary:          Headers for developing programs that will embed CLIPS
Group:            Development/Libraries
Requires:         clips-libs = %{version}-%{release}
Requires:         libtermcap-devel pkgconfig

%description    devel
This package contains the libraries and header files needed for
developing embedded CLIPS applications.

%package xclips
Summary:	  X interface to CLIPS
Group:		  Development/Tools

%description xclips
X interface to CLIPS.

%package doc
Summary:	  Documentation for CLIPS
Group:		  Documentation

%description doc
This package contains documentation for the CLIPS library as well as numerous 
examples.

The following are some of the documents in this package:
- Proceedings of the Third Conference on CLIPS, 1994 (3CCP.pdf)
- Application abstracts (abstract.pdf)
- CLIPS Reference Manual, Volume II, Advanced Programming Guide (apg.pdf)
- CLIPS Architecture Manual (arch5-1.pdf)
- CLIPS Reference Manual, Volume I, Basic Programming Guide (bpg.pdf)
- CLIPS Reference Manual, Volume III, Interfaces Guide (ig.pdf)
- CLIPS Users Guide (usrguide.pdf)


%prep
%setup -q -a 1 -a 2 -c
mv x-prjct/xinterface clipssrc/
mv x-prjct/color clipssrc/
mv clipssrc/clipssrc clipssrc/clips
%patch0 -p0 
chmod a-x clipssrc/*/*.h clipssrc/*/*.c
chmod a-x Examples/*.clp
chmod a-x Examples/Cholesterol/*
chmod u+x clipssrc/configure
for i in %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE8} %{SOURCE9}; do
 cp $i .
done

%build
cd clipssrc
%configure --enable-static=no
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf %{buildroot}
%{__install} -D %{SOURCE10} %{buildroot}%{_datadir}/pixmaps/xclips.png
%{__install} -m 644 -D %{SOURCE11} %{buildroot}%{_datadir}/emacs/site-lisp/site-start.d/clips-init.el
%{__install} -m 644 -D %{SOURCE12} %{buildroot}%{_datadir}/emacs/site-lisp/clips-mode.el
%{__install} -m 644 -D %{SOURCE13} %{buildroot}%{_datadir}/emacs/site-lisp/inf-clips.el
cd clipssrc
desktop-file-install --vendor fedora \
	--dir %{buildroot}%{_datadir}/applications \
	--add-category X-Fedora \
	xclips.desktop
%{__make} DESTDIR=%{buildroot} install
find %{buildroot} -type f -name "*.la" -exec rm -f {} ';'

%clean
%{__rm} -rf %{buildroot}

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_bindir}/clips
%{_datadir}/emacs/site-lisp/site-start.d/clips-init.el
%{_datadir}/emacs/site-lisp/clips-mode.el
%{_datadir}/emacs/site-lisp/inf-clips.el

%files libs
%defattr(-,root,root,-)
%{_libdir}/*.so.*
%{_datadir}/%{name}/
%doc clipssrc/readme.txt
%doc clipssrc/COPYING_LINUX_PATCH
%doc clipssrc/README_LINUX_PATCH

%files devel
%defattr(-,root,root,-)
%{_libdir}/*.so
%{_libdir}/pkgconfig/*
%{_includedir}/%{name}/

%files xclips
%defattr(-,root,root,-)
%{_bindir}/xclips
%{_bindir}/xclips-color
%{_datadir}/pixmaps/xclips.png
%{_datadir}/applications/*xclips.desktop

%files doc
%defattr(-,root,root,-)
%doc Examples/
%doc abstract.pdf arch5-1.pdf bpg.pdf usrguide.pdf 3CCP.pdf
%doc apg.pdf
%doc ig.pdf
 
%changelog
* Thu Jun 22 2006 Rick L Vinyard Jr <rvinyard at cs.nmsu.edu> 6.24-8
- Fixed pkgconfig .pc from -L libdir to -Llibdir

* Thu Jun 22 2006 Rick L Vinyard Jr <rvinyard at cs.nmsu.edu> 6.24-7
- Renamed docs subpackage to doc
- Changed pkgconfig .pc to use -L libdir -lclips in patch
- Added extern "C" and ifdef __cplusplus to clips.h in patch

* Wed Jun 21 2006 Rick L Vinyard Jr <rvinyard at cs.nmsu.edu> 6.24-6
- Created docs subpackage
- Moved all pdf docs and examples into docs subpackage
- Removed Requires clips from xclips
- Added emacs mode to clips package

* Sun Jun 18 2006 Rick L Vinyard Jr <rvinyard at cs.nmsu.edu> 6.24-5
- Created libs subpackage
- Renamed x11 subpackage to xclips
- Changed install location of clips.hlp in autotools patch
- Renamed clips.png to xclips.png
- Moved xclips.desktop and xclips.png to xclips subpackage
- Modified autotools patch to build xclips.desktop to keep version tag current
- Changed xclips Requires from %%{name} to clips to be more explicit

* Sat Jun 17 2006 Rick L Vinyard Jr <rvinyard at cs.nmsu.edu> 6.24-4
- Moved ig.pdf to x11 subpackage

* Sat Jun 17 2006 Rick L Vinyard Jr <rvinyard at cs.nmsu.edu> 6.24-3
- Autotools patch now treats clips.hlp as data rather than doc

* Sat Jun 17 2006 Rick L Vinyard Jr <rvinyard at cs.nmsu.edu> 6.24-2
- Fixed pkgconfig include directory to /usr/include/clips
- Fixed help define

* Fri Jun 16 2006 Rick L Vinyard Jr <rvinyard at cs.nmsu.edu> 6.24-1
- New release
- Changed desktop entry name from xclips to XCLIPS
- New autotools struture builds clips and xclips in separate directories
- Moved bpg.pdf to clips main package
- Added examples from AllExamples.tar.Z
- Moved clips.hlp to clips main package
- Remove xclips.desktop source and moved it into autotools patch
- Added build for xclips color utility as xclips-color

* Thu Jun 15 2006 Rick L Vinyard Jr <rvinyard at cs.nmsu.edu> 6.23-2
- Added libXt-devel, libXaw-devel, libXext-devel, libXmu-devel to BuildRequires

* Tue Jun 13 2006 Rick L Vinyard Jr <rvinyard at cs.nmsu.edu> 6.23-1
- Initial release
 


--- NEW FILE inf-clips.el ---
;;; inf-clips.el --- Inferior Clips mode.

;;;************************************************************************
;;; Basado en inf-jess.el de:

;; Copyright (C) 1999 by David E. Young.

;; Author: David E. Young <david.young at fnc.fujitsu.com>
;; Keywords: languages, clips

;; Version 0.5 of 9 August 1999.

;; 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 2, 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, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;; 02111-1307  USA
;;;************************************************************************

;;; Code:

(require 'comint)
(require 'clips-mode)

(defvar inferior-clips-mode-map nil)

(defvar inferior-clips-mode-hook nil
  "*Hooks for customising Clips mode.")

(defvar inferior-clips-load-hook nil
  "*Hooks run after this module is loaded.")

(defvar inferior-clips-buffer nil
  "The current inferior Clips process buffer.")

(defvar inferior-clips-program "clips"
  "*Defines a program name or function used to construct an inferior
Clips process.
If this variable evaluates to a string, it is interpreted as a
'self-contained' executable (eg. shell script) that requires no
arguments. If this variable's value is a function, it should evaluate
to a list of arguments which are handed to the Java virtual machine as
defined by `inferior-clips-vm'.")

(defvar inferior-clips-vm "java"
  "*Defines the virtual machine used to run an inferior Clips process.")

(defvar source-modes '(inferior-clips-mode)
  "*Used to determine whether or not a buffer contains Clips source code.")

(defvar previous-dir/file nil
  "Records the last directory and file used in loading. Holds a dotted
pair of the form `(DIRECTORY . FILE)' describing the last
`load-file' command.")

(when (not inferior-clips-mode-map)
  (setq inferior-clips-mode-map
    (copy-keymap comint-mode-map)))
(define-key clips-mode-map "\C-c\C-l" 'inf-clips-load-file)
(define-key inferior-clips-mode-map "\C-c\C-l" 'inf-clips-load-file)
(define-key inferior-clips-mode-map "\C-ci" 'inf-clips-reset-engine) ; initialize engine
(define-key inferior-clips-mode-map "\C-cl" 'inf-clips-load-file)
(define-key inferior-clips-mode-map "\C-cg" 'inf-clips-run-engine) ; "go"...
(define-key inferior-clips-mode-map "\C-cf" 'inf-clips-get-facts)
(define-key inferior-clips-mode-map "\C-cr" 'inf-clips-get-rules)

;; These keys augment 'clips-mode-map' with behavior specific to an
;; inferior Clips process...

(define-key clips-mode-map "\C-x\C-e" 'inf-clips-eval-last-sexp)  ; GNU convention
(define-key clips-mode-map "\M-\C-x" 'inf-clips-eval-deffunction) ; GNU convention
(define-key clips-mode-map "\C-ce" 'inf-clips-eval-region)
(define-key clips-mode-map "\C-ct" 'inf-clips-eval-deftemplate)

(defun inferior-clips-mode ()
  "Major mode for interacting with an inferior Clips process.
Runs a Clips interpreter as a subprocess of Emacs, with Clips I/O
through an Emacs buffer.  Variable `inferior-clips-program'
controls how the Clips interpreter is run.

For information on running multiple processes in multiple buffers, see
documentation for variable `inferior-clips-buffer'.

\\{inferior-clips-mode-map}

Customisation: Entry to this mode runs the hooks on `comint-mode-hook' and
`inferior-clips-mode-hook' (in that order).

You can send text to the inferior Clips process from other buffers containing
Clips source.
    switch-to-inferior-clips switches the current buffer to the Clips process buffer.
    clips-eval-region sends the current region to the Clips process.

    Prefixing the clips-eval-region command with a
    \\[universal-argument] causes a switch to the Clips process buffer
    after sending the text.

Commands:
Return after the end of the process' output sends the text from the
    end of process to point.
Return before the end of the process' output copies the sexp ending at point
    to the end of the process' output, and sends it.
Delete converts tabs to spaces as it moves back.
Tab indents for Clips; with argument, shifts rest
    of expression rigidly with the current line.
C-M-q does Tab on each line starting within following expression.
Paragraphs are separated only by blank lines.  Semicolons start comments.
If you accidentally suspend your process, use \\[comint-continue-subjob]
to continue it."
  (interactive)
  (kill-all-local-variables)
  (comint-mode)
  (setq major-mode 'inferior-clips-mode)
  (setq mode-name "Inferior Clips")
  (setq mode-line-process '(": %s"))
  (use-local-map inferior-clips-mode-map)
  (setq comint-input-sentinel 'ignore)
  (run-hooks 'inferior-clips-mode-hook))

(defun run-clips (&optional image)
  "Run an inferior Clips process, with input and output via buffer
`*clips*'. If there is a process already running in `*clips*', just
switch to that buffer.
With argument, allows you to edit the command line (default is value
of `inferior-clips-program').  Runs the hooks from
`inferior-clips-mode-hook' (after the `comint-mode-hook' is run).
\(Type \\[describe-mode] in the process buffer for a list of commands.)"
  (interactive (list
                (and current-prefix-arg
                     (read-string "Run Clips like this: "))))
  (when (not (comint-check-proc "*clips*"))
    (let* ((image
            (or image inferior-clips-program))
           (buffer
            (cond ((stringp image)
                   (make-comint "clips" image))
                  ((functionp image)
                   (apply 'make-comint
                          "clips" inferior-clips-vm nil
                          (funcall image)))
                  (t
                   (error "Variable `inferior-clips-program' must be either stringp or
functionp")))))
      (set-buffer buffer)
      (inferior-clips-mode)))
  (setq inferior-clips-buffer "*clips*")
  (switch-to-buffer inferior-clips-buffer))

(defun test-run-clips ()
  (interactive)
  (setq inferior-clips-program
        #'(lambda ()
            '("-classpath"
              "/files/devel/jem/classes/clips.jar"
              "clips.Main")))
  (run-clips))

(defun inf-clips-send-request(req)
  (let ((proc (inferior-clips-process)))
    (comint-send-string proc (concat req "\n"))))

(defun inf-clips-load-file (fname)
  "Load a Clips source file into the inferior Clips process."
  (interactive
   (comint-get-source "Load Clips file: "
                      previous-dir/file
                      source-modes t))
  (comint-check-source fname)
  (setq previous-dir/file
	(cons (file-name-directory fname)
	      (file-name-nondirectory fname)))
  (inf-clips-send-request (format "(load %s)" fname))
  (switch-to-inferior-clips t))

(defun inf-clips-get-facts ()
  "Retrieve the fact list from the inferior Clips process."
  (interactive)
  (inf-clips-send-request "(facts)"))

(defun inf-clips-get-rules ()
  "Retrieve the rule list from the inferior Clips process."
  (interactive)
  (inf-clips-send-request "(rules)"))

(defun inf-clips-reset-engine ()
  "Reset the inference engine running in the inferior Clips process."
  (interactive)
  (inf-clips-send-request "(reset)"))

(defun inf-clips-run-engine ()
  "Run the inference engine in the inferior Clips process."
  (interactive)
  (inf-clips-send-request "(run)"))

(defun inferior-clips-process ()
  (let ((proc (get-buffer-process
               (if (eq major-mode 'inferior-clips-mode)
                   (current-buffer)
                 inferior-clips-buffer))))
    (or proc
        (error "No Clips sub-process; see variable `inferior-clips-buffer'"))))

(defun switch-to-inferior-clips (eob-p)
  "Switch to the inferior Clips process buffer.
With argument, positions cursor at end of buffer."
  (interactive "P")
  (if (get-buffer-process inferior-clips-buffer)
      (let ((pop-up-frames
            ;; Be willing to use another frame
            ;; that already has the window in it.
             (or pop-up-frames
                 (get-buffer-window inferior-clips-buffer t))))
        (pop-to-buffer inferior-clips-buffer))
    (run-clips inferior-clips-program))
  (when eob-p
    (push-mark)
    (goto-char (point-max))))

(defun inf-clips-eval-region (start end &optional and-go)
  "Send the current region to the inferior Clips process.
Prefix argument forces switch to Clips buffer afterwards."
  (interactive "r\nP")
  (let ((proc (inferior-clips-process)))
    (comint-send-region proc start end)
    (comint-send-string proc "\n")
    (if and-go
        (switch-to-inferior-clips t))))

(defun inf-clips-eval-last-sexp (&optional and-go)
  "Send the previous sexp to the inferior Clips process.
Prefix argument means switch to the Clips buffer afterwards."
  (interactive "P")
  (inf-clips-eval-region
   (save-excursion
     (backward-sexp) (point))
   (point) and-go))

(defun inf-clips-eval-form (&optional and-go)
  "Send the current form to the inferior Clips process.
Prefix argument means switch to the Clips buffer afterwards."
  (interactive "P")
  (save-excursion
    (end-of-defun)
    (skip-chars-backward " \t\n\r\f") ;  Makes allegro happy
    (let ((end (point)))
      (beginning-of-defun)
      (inf-clips-eval-region (point) end)))
  (if and-go
      (switch-to-inferior-clips t)))

(defun inf-clips-eval-deffunction (&optional and-go)
  "Send the current deffunction to the inferior Clips process.
Prefix argument means switch to the Clips buffer afterwards."
  (interactive "P")
  (inf-clips-eval-form and-go))

(defun inf-clips-eval-defrule (&optional and-go)
  "Send the current defrule to the inferior Clips process.
Prefix argument means switch to the Clips buffer afterwards."
  (interactive "P")
  (inf-clips-eval-form and-go))

(defun inf-clips-eval-deftemplate (&optional and-go)
  "Send the current deftemplate to the inferior Clips process.
Prefix argument means switch to the Clips buffer afterwards."
  (interactive "P")
  (inf-clips-eval-form and-go))

(run-hooks 'inferior-clips-load-hook)

(provide 'inf-clips)

;;; inf-clips.el ends here


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/clips/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	23 Jun 2006 21:03:35 -0000	1.1
+++ .cvsignore	23 Jun 2006 21:09:46 -0000	1.2
@@ -0,0 +1,11 @@
+3CCP.pdf
+AllExamples.tar.Z
+abstract.pdf
+apg.pdf
+arch5-1.pdf
+bpg.pdf
+clips-6.24-linux.patch.bz2
+clipssrc.tar.Z
+ig.pdf
+usrguide.pdf
+x-prjct.tar.Z


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/clips/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	23 Jun 2006 21:03:35 -0000	1.1
+++ sources	23 Jun 2006 21:09:46 -0000	1.2
@@ -0,0 +1,11 @@
+a6a60733af08f9e9e6d0928272ad4dd9  3CCP.pdf
+f5c02b997199f3ede779b8502af2ba09  AllExamples.tar.Z
+cd3ecddc4e538b8af0e5cf08ab7fd89c  abstract.pdf
+fae2267d96fb95603345e91c9990caaa  apg.pdf
+9a13d2ed18fe6ab67902d5bce29957cb  arch5-1.pdf
+63891971aa782dc67c2de0579647247e  bpg.pdf
+1a1ef58d26fe2a1a3d136c093e3e44af  clips-6.24-linux.patch.bz2
+ccba9d912375e57a1b7d9eba12da4198  clipssrc.tar.Z
+89beca5caa08b30d8285cca7f1df1d26  ig.pdf
+44e54697a8acf3509bc4ca51d88b65bd  usrguide.pdf
+1bb0d0e684742188b8c14912c26f12cb  x-prjct.tar.Z




More information about the scm-commits mailing list