added sample for slot predicate constraints.

khk.

git-svn-id: 9643e93313b82f5e4da82d8413267a0daa4b5472@1098 2cd91b7d-3b21-0410-a5f4-f42db4f24360

(deftemplate wurst (slot name) (slot spitzname) (slot farbe) )
(deftemplate salat (slot name) (slot farbe) )
(deftemplate getraenk (slot name) (slot farbe) )

(assert (wurst (name "bratwurst")(spitzname "bratwosch")(farbe "weiss") ))
(assert (wurst (name "weisswurst")(spitzname "weisswurst")(farbe "weiss") ))
(assert (wurst (name "wienerwurst")(spitzname "wiener")(farbe "rot") ))
(assert (wurst (name "gemuesewurst")(spitzname "gemuesewurst")(farbe "gruen") ))
(assert (wurst (name "kartoffelsalat")(farbe "pink") ))

(assert (salat (name "kartoffelsalat")(farbe "weiss") ))

(assert (getraenk (name "wasser") (farbe "schwarz") ))
(assert (getraenk (name "cola") (farbe "schwarz") ))
(assert (getraenk (name "kartoffelsalat") (farbe "schwarz") ))

(defrule ababab
	(salat (farbe ?farbe))
	?x <- (wurst (farbe ?farbe))
=>
	(printout t (get-fact-id ?x) crlf )
)
(fire)

(defrule megarule
	(wurst (name ?wurstname) (spitzname ?wurstname) (farbe ?farbe))
	(salat (farbe ?farbe)(name ?salatname) )
	=> (printout t "Die Wurst " ?wurstname " und der Salat " ?salatname " haben dieselbe Farbe, naemlich " ?farbe "! Ausserdem hat die Wurst denselben Spitznamen wie Name"  crlf)
)

(fire)

(defrule megarule
	(wurst (name ?wurstname) (spitzname ?wurstname) (farbe ?farbe))
	(salat (farbe ?farbe)(name ?salatname) )
	=> (printout t "Die Wurst " ?wurstname " und der Salat " ?salatname " haben dieselbe Farbe, naemlich " ?farbe "! Ausserdem hat die Wurst denselben Spitznamen wie Name"  crlf)
)

(fire)

(defrule tst2
	(wurst (name ?x) (spitzname ?y))
	=> (printout t ?x  crlf)
)

(defrule tst
	(wurst (name ~ ?salad))
	(salat (name ?salad))
	(getraenk (name ~ ?salad))
	=> (printout t ?salad crlf)
)

(defrule megarule1
	(salat (farbe ?farbe))
	(wurst (farbe ?farbe))
	=> (printout t "Es gibt sowohl einen Salat, als auch eine Wurst, die " ?farbe "ist."  crlf)
)

(defrule megarule
	(wurst (name ?wurstname) (spitzname ?wurstname) )
	(salat (farbe ?farbe))
	(wurst (farbe ?farbe))
	(salat (name ?salatname))
	=> (printout t "Die Wurst " ?wurstname " und der Salat " ?salatname " haben dieselbe Farbe, naemlich " ?farbe "! Ausserdem hat die Wurst denselben Spitznamen wie Name"  crlf)
)

(defrule zero
 => (printout t "boombam" crlf)
)

(defrule one
	(wurst (name ?x))
	=> (printout t "rule with one condition fired " ?x crlf)
)

(defrule two
	(wurst (name "bratwurst"))
	(wurst (farbe "weiss"))
	=> (printout t "rule with two conditions fired " crlf)
)

(defrule three
	(wurst (name "wienerwurst"))
	=> (printout t "rule with one condition fired - wienerwurst" crlf)
)

(defrule four
	?x <- (wurst (name "wienerwurst"))
	=>
	(printout t "rule with one binding fired - wienerwurst" crlf)
	(printout t "fact id of the wienerwurst fact" (get-fact-id  ?x) crlf)
)

(defrule five
	?x <- (wurst (name "wienerwurst") (gewicht ?y:&(> ?y 111))
	=>
	(printout t "rule with one predicate constraint fired - wienerwurst" crlf)
	(printout t "fact id of the wienerwurst fact" (get-fact-id  ?x) crlf)
)

(defrule six
	?x <- (wurst (gewicht ?y:&(> ?y ?z))
	(salat (name "kartoffelsalat") (gewicht ?z))
	=>
	(printout t "rule with one predicate constraint and an internal join fired" crlf)
	(printout t "fact id of the wienerwurst fact" (get-fact-id  ?x) crlf)
)

(fire)

(deftemplate wurst (slot name) (slot spitzname) (slot farbe) )
(deftemplate salat (slot name) (slot farbe) )
(deftemplate getraenk (slot name) (slot farbe) )

(assert (wurst (name "bratwurst")(spitzname "bratwosch")(farbe "weiss") ))
(assert (wurst (name "weisswurst")(spitzname "weisswurst")(farbe "weiss") ))
(assert (wurst (name "wienerwurst")(spitzname "wiener")(farbe "rot") ))
(assert (wurst (name "gemuesewurst")(spitzname "gemuesewurst")(farbe "gruen") ))
(assert (wurst (name "kartoffelsalat")(farbe "pink") ))

(assert (salat (name "kartoffelsalat")(farbe "weiss") ))

(assert (getraenk (name "wasser") (farbe "schwarz") ))
(assert (getraenk (name "cola") (farbe "schwarz") ))
(assert (getraenk (name "kartoffelsalat") (farbe "schwarz") ))

(defrule ababab
	(salat (farbe ?farbe))
	?x <- (wurst (farbe ?farbe))
=>
	(printout t (get-fact-id ?x) crlf )
)
(fire)

(defrule megarule
	(wurst (name ?wurstname) (spitzname ?wurstname) (farbe ?farbe))
	(salat (farbe ?farbe)(name ?salatname) )
	=> (printout t "Die Wurst " ?wurstname " und der Salat " ?salatname " haben dieselbe Farbe, naemlich " ?farbe "! Ausserdem hat die Wurst denselben Spitznamen wie Name"  crlf)
)

(fire)

(defrule megarule
	(wurst (name ?wurstname) (spitzname ?wurstname) (farbe ?farbe))
	(salat (farbe ?farbe)(name ?salatname) )
	=> (printout t "Die Wurst " ?wurstname " und der Salat " ?salatname " haben dieselbe Farbe, naemlich " ?farbe "! Ausserdem hat die Wurst denselben Spitznamen wie Name"  crlf)
)

(fire)

(defrule tst2
	(wurst (name ?x) (spitzname ?y))
	=> (printout t ?x  crlf)
)

(defrule tst
	(wurst (name ~ ?salad))
	(salat (name ?salad))
	(getraenk (name ~ ?salad))
	=> (printout t ?salad crlf)
)

(defrule megarule1
	(salat (farbe ?farbe))
	(wurst (farbe ?farbe))
	=> (printout t "Es gibt sowohl einen Salat, als auch eine Wurst, die " ?farbe "ist."  crlf)
)

(defrule megarule
	(wurst (name ?wurstname) (spitzname ?wurstname) )
	(salat (farbe ?farbe))
	(wurst (farbe ?farbe))
	(salat (name ?salatname))
	=> (printout t "Die Wurst " ?wurstname " und der Salat " ?salatname " haben dieselbe Farbe, naemlich " ?farbe "! Ausserdem hat die Wurst denselben Spitznamen wie Name"  crlf)
)

(defrule two
	(wurst (name "bratwurst"))
	(wurst (farbe "weiss"))
	=> (printout t "rule with two conditions fired " crlf)
)

(defrule zero
 => (printout t "boombam" crlf)
)

(defrule one
	(wurst (name ?x))
	=> (printout t "rule with one condition fired " ?x crlf)
)

(defrule three
	(wurst (name "wienerwurst"))
	=> (printout t "rule with one condition fired - wienerwurst" crlf)
)

;(defrule four
;	?x <- (wurst (name "wienerwurst"))
;	=>
;	(printout t "rule with one binding fired - wienerwurst" crlf)
;	(printout t "fact id of the wienerwurst fact" (get-fact-id  ?x) crlf)
;)

(fire)


Cleaned up painter.clp

Cleaned up painter.clp

(load* /lib/chicanery/pointer.clp)
(load* /lib/chicanery/input.clp)
(load* /lib/chicanery/menu.clp)
(load* /lib/chicanery/rectangle.clp)

(defglobal MAIN
           ?*system-initialized* = FALSE)

(deffacts query-operation
          (query input)
          (defmenu menu1 cut copy paste)
          (defmenu menu2 eat sleep drink))

(defrule initialize
         (declare (salience 10000))
         (initial-fact)
         =>
         (if (not ?*system-initialized*) then
           (eresized 0)
           (bind ?*system-initialized* TRUE)))

(defrule build-menus
         (declare (salience 9999))
         ?f <- (defmenu ?name $?entries)
         =>
         (retract ?f)
         (defmenu ?name ?entries))

(defrule on-resized
         (declare (salience 1000))
         ?f <- (event resized new ?value)
         =>
         (if (and ?value (< (getwindow) 0)) then
           (printout werror "ERROR: couldn't reattach to window" crlf)
           (exit)
           else
           (retract ?f)))

(defrule query-input
         ?f <- (query input)
         =>
         (retract ?f)
         (mouse/query)
         (assert (input mouse
                        buttons: (translate/mouse/buttons)
                        position: (mouse/position)
                        time-stamp: (mouse/timestamp))
                 (input keyboard
                        button: (translate/kbd/query))))

(defrule process-mouse-inputs
         (declare (salience -1))
         ?f <- (input mouse
                      buttons: $?
                      position: ? ?
                      time-stamp: ?)
         =>
         (retract ?f)
         (assert (query mouse)))

(defrule process-mouse-inputs:menu1
         ?f <- (input mouse
                      buttons: button3
                      position: ? ?
                      time-stamp: ?)
         =>
         (retract ?f)
         ; Display a menu
         (printout t (send [menu1] show-menu 3) crlf)
         (assert (query mouse)))

(defrule process-mouse-inputs:menu2
         ?f <- (input mouse
                      buttons: button2
                      position: ? ?
                      time-stamp: ?)
         =>
         (retract ?f)
         ; Display a menu
         (printout t (send [menu2] show-menu 2) crlf)
         (assert (query mouse)))

(defrule process-keyboard-inputs:quit
         (declare (salience 1))
         ?f <- (input keyboard
                      button: ESC)
         =>
         (retract ?f)
         (exit))

(defrule process-keyboard-inputs:nil
         (declare (salience 1))
         ?f <- (input keyboard
                      button: NIL)
         =>
         (retract ?f)
         (assert (query keyboard)))

(defrule process-keyboard-inputs
         ?f <- (input keyboard
                      button: ?b&~NIL)
         =>
         (retract ?f)
         (printout t "Pressed " ?b crlf)
         (assert (query keyboard)))

(defrule ready-to-query-input-again
         ?f <- (query keyboard)
         ?f2 <- (query mouse)
         =>
         (retract ?f ?f2)
         (assert (query input)))

(load* /lib/chicanery/input.clp)
(load* /lib/chicanery/menu.clp)

(defglobal MAIN
	   ?*system-initialized* = FALSE)

(deffacts query-operation
	  (query input)
	  (defmenu menu1 cut copy paste)
	  (defmenu menu2 eat sleep drink))

(defrule initialize
	 (declare (salience 10000))
	 (initial-fact)
	 =>
	 (if (not ?*system-initialized*) then
	   (eresized 0)
	   (bind ?*system-initialized* TRUE)))

(defrule build-menus
	 (declare (salience 9999))
	 ?f <- (defmenu ?a $?b)
	 =>
	 (retract ?f)
	 (defmenu ?a ?b))

(defrule on-resized
	 (declare (salience 1000))
	 ?f <- (event resized new ?value)
	 =>
	 (if (and ?value (< (getwindow) 0)) then
	   (printout werror "ERROR: couldn't reattach to window" crlf)
	   (exit)
	   else
	   (retract ?f)))

(defrule query-input
	 ?f <- (query input)
	 =>
	 (retract ?f)
	 (mouse/query)
	 (assert (input mouse
			buttons: (translate/mouse/buttons)
			position: (mouse/position)
			time-stamp: (mouse/timestamp))
		 (input keyboard
			button: (translate/kbd/query))))

(defrule process-mouse-inputs
	 (declare (salience -1))
	 ?f <- (input mouse
		      buttons: $?
		      position: ? ?
		      time-stamp: ?)
	 =>
	 (retract ?f)
	 (assert (query mouse)))

(defrule process-mouse-inputs:menu1
	 ?f <- (input mouse
		      buttons: button3
		      position: ? ?
		      time-stamp: ?)
	 =>
	 (retract ?f)
	 ; Display a menu
	 (printout t (send [menu1] show-menu 3) crlf)
	 (assert (query mouse)))

(defrule process-mouse-inputs:menu2
	 ?f <- (input mouse
		      buttons: button2
		      position: ? ?
		      time-stamp: ?)
	 =>
	 (retract ?f)
	 ; Display a menu
	 (printout t (send [menu2] show-menu 2) crlf)
	 (assert (query mouse)))

(defrule process-keyboard-inputs:quit
	 (declare (salience 1))
	 ?f <- (input keyboard
		      button: ESC)
	 =>
	 (retract ?f)
	 (exit))

(defrule process-keyboard-inputs:nil
	 (declare (salience 1))
	 ?f <- (input keyboard button: NIL)
	 =>
	 (retract ?f)
	 (assert (query keyboard)))

(defrule process-keyboard-inputs
	 ?f <- (input keyboard
		      button: ?b)
	 =>
	 (retract ?f)
	 (printout t "Pressed " ?b crlf)
	 (assert (query keyboard)))

(defrule ready-to-query-input-again
	 ?f <- (query keyboard)
	 ?f2 <- (query mouse)
	 =>
	 (retract ?f ?f2)
	 (assert (query input)))


Modified the ordering of how files were loaded to fix a bug in glapi conv

;------------------------------------------------------------------------------
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; Loader.clp - Loads the logic folder for glapi
;------------------------------------------------------------------------------
(logic-files "tools/conv/gl/glapi"
             "GLAPIArgumentConversion.clp"
             "GLAPIConversion.clp")

;------------------------------------------------------------------------------
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; Loader.clp - Loads the logic folder for glapi
;------------------------------------------------------------------------------
(logic-files "tools/conv/gl/glapi"
             "GLAPIConversion.clp"
             "GLAPIArgumentConversion.clp")


Add logic to fix tool changer bug.

Add logic to fix tool changer bug.

Signed-off-by: Matt Shaver <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@mattshaver.com>


advester

advester

(reset)

(defrule go-rule-1
    =>
    (printout t "What sort of environment is a trainee dealing with on the job? " crlf)
    (bind ?e (read))
    (assert (environment ?e))
    (printout t "What sort of job is the trainee do? " crlf)
    (bind ?e (read))
    (assert (job ?e))
    (printout t "Is the feedback required or not? (yes / no)" crlf)
    (bind ?e (read))
    (assert (feedback ?e))
    (run)
)

(defrule rule_1
    (environment papers | manuals | documents | textbooks)
     =>
    (assert (stimulus-situation verbal))
)

(defrule rule_2
    (environment pictures | illustrations | photographs | diagrams)
     =>
    (assert (stimulus-situation visual))
)

(defrule rule_3
    (environment machines | buildings | tools)
     =>
    (assert (stimulus-situation 'physical objects'))
)

(defrule rule_4
    (environment numbers | formulas | cumputer programs)
     =>
    (assert (stimulus-situation symbolic))
)

(defrule rule_5
    (job lecturing  | advising | counselling)
     =>
    (assert (stimulus-response oral))
)

(defrule rule_6
    (job building  | repairing | troubleshooting)
     =>
    (assert (stimulus-response 'hands on'))
)

(defrule rule_7
    (job typing  | writing | drawing)
     =>
    (assert (stimulus-response documented))
)

(defrule rule_8
    (job evlauating | reasoning | investigating)
     =>
    (assert (stimulus-response analytical))
)

(defrule rule_9
    (and (stimulus-situation 'physical objects')
         (stimulus-response 'hands on')
         (feedback yes)
    )
    =>
    (assert (medium workshop))
)

(defrule rule_10
    (and (stimulus-situation symbolic)
         (stimulus-response analytical)
         (feedback yes)
    )
    =>
    (assert (medium 'lecture-tutorial'))
)

(defrule rule_11
    (and (stimulus-situation visual)
         (stimulus-response oral)
         (feedback no)
    )
    =>
    (assert (medium 'lecture-tutorial'))
)

(defrule rule_12
    (and (stimulus-situation visual)
         (stimulus-response analytical)
         (feedback yes)
    )
    =>
    (assert (medium 'lecture-tutorial'))
)

(defrule rule_13
    (and (stimulus-situation visual)
         (stimulus-response oral)
         (feedback yes)
    )
    =>
    (assert (medium 'role-play exercises'))
)

(defrule rule_14
    (and (stimulus-situation verbal)
         (stimulus-response documented)
         (feedback yes)
    )
    =>
    (assert (medium videocassette))
)

error: pathspec 'adveser.clp' did not match any file(s) known to git


RunConstantConverter.clp: Updated the script to use the new layout

;------------------------------------------------------------------------------
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; RunConverter.clp - Runs the GLConstantConversion expert system
; Written by Joshua Scoggins
;------------------------------------------------------------------------------
(clear)
;relative to the root of the source directory
(batch* "LoadEngine.clp")
(load-application "tools/conv/gl/constant")
(reset)
(assert (parse constant file "/usr/include/GL/gl.h"))
(run)
(exit)

;------------------------------------------------------------------------------
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; RunConverter.clp - Runs the GLConstantConversion expert system
; Written by Joshua Scoggins
;------------------------------------------------------------------------------
(clear)
;relative to the root of the source directory
(batch* "lib/cortex/Library.clp")
(batch* "tools/conv/gl/constant/ConstantConversionEntry.clp")
(reset)
(assert (parse constant file "/usr/include/GL/gl.h"))
(run)
(exit)


Removed a return call from the is-root-panel handler

It isn't necessary and only serves to add a bit of overhead for no real benefit

;------------------------------------------------------------------------------
;The Adventure Engine
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; Panel.clp - Represents a container of widgets and tiles
;------------------------------------------------------------------------------
(defclass Runtime::Panel
  "A component that holds other widgets and tiles"
  (is-a Component)
  (role concrete)
  (pattern-match reactive)
  (multislot child-components
   (type INSTANCE))
  (message-handler is-root-panel primary))
;------------------------------------------------------------------------------
(defmessage-handler Runtime::Panel is-root-panel primary
 "Checks to see if the target panel is the root panel"
 ()
 (eq ?self:parent nil))
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
;The Adventure Engine
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; Panel.clp - Represents a container of widgets and tiles
;------------------------------------------------------------------------------
(defclass Runtime::Panel
  "A component that holds other widgets and tiles"
  (is-a Component)
  (role concrete)
  (pattern-match reactive)
  (multislot child-components
   (type INSTANCE))
  (message-handler is-root-panel primary))
;------------------------------------------------------------------------------
(defmessage-handler Runtime::Panel is-root-panel primary
 "Checks to see if the target panel is the root panel"
 ()
 (return (eq ?self:parent nil)))
;------------------------------------------------------------------------------


Simplified the facts asserted in ProducersPropagaion.clp

This should speed up the matching of rules in the network.

;Copyright (c) 2012, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
(defrule dependency-analysis-modification-propagation::PropagateBlockProducers
			(object (is-a BasicBlock) (parent ?r)
					  (Produces $?produces))
			=>
			(assert (Give ?r the following produced items $?produces)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-modification-propagation::PropagateRegionProducers-ParentExists
			?fct <- (Give ?r the following produced items $?produced)
			?region <- (object (is-a Region) (id ?r) (parent ?p))
			(exists (object (is-a Region) (id ?p)))
			=>
			(retract ?fct)
			(assert (Give ?p the following produced items $?produced))
			(slot-insert$ ?region Produces 1 ?produced))
;------------------------------------------------------------------------------
(defrule dependency-analysis-modification-propagation::PropagateRegionProducers-ParentDoesntExist
			?fct <- (Give ?r the following produced items $?produced)
			?region <- (object (is-a Region) (id ?r) (parent ?p))
			(not (exists (object (is-a Region) (id ?p))))
			=>
			(retract ?fct)
			(slot-insert$ ?region Produces 1 ?produced))
;------------------------------------------------------------------------------
(defrule dependency-analysis-modification-propagation::IdentifyNonLocalDependencies
			?i0 <- (object (is-a Instruction) (parent ?p) (Operands $? ?op $?))
			(object (is-a ParentedObject) (id ?op) (parent ~?p))
			;(test (not (member$ ?op (send ?i0 get-NonLocalDependencies))))
			=>
			;since we don't copy the set of producers at the start anymore we
			;need this operation as well
			(slot-insert$ ?i0 Producers 1 ?op)
			(slot-insert$ ?i0 NonLocalDependencies 1 ?op))
;------------------------------------------------------------------------------

;Copyright (c) 2012, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
(defrule dependency-analysis-modification-propagation::PropagateBlockProducers
			(object (is-a BasicBlock) (id ?b) (parent ?r)
					  (Produces $?produces))
			=>
			(assert (Give ?r from ?b the following produced items $?produces)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-modification-propagation::PropagateRegionProducers-ParentExists
			?fct <- (Give ?r from ? the following produced items $?produced)
			?region <- (object (is-a Region) (id ?r) (parent ?p))
			(exists (object (is-a Region) (id ?p)))
			=>
			(retract ?fct)
			(assert (Give ?p from ?r the following produced items $?produced))
			(slot-insert$ ?region Produces 1 ?produced))
;------------------------------------------------------------------------------
(defrule dependency-analysis-modification-propagation::PropagateRegionProducers-ParentDoesntExist
			?fct <- (Give ?r from ? the following produced items $?produced)
			?region <- (object (is-a Region) (id ?r) (parent ?p))
			(not (exists (object (is-a Region) (id ?p))))
			=>
			(retract ?fct)
			(slot-insert$ ?region Produces 1 ?produced))
;------------------------------------------------------------------------------
(defrule dependency-analysis-modification-propagation::IdentifyNonLocalDependencies
			?i0 <- (object (is-a Instruction) (parent ?p) (id ?t0)
								(Operands $? ?op $?))
			(object (is-a ParentedObject) (id ?op) (parent ~?p))
			;(test (not (member$ ?op (send ?i0 get-NonLocalDependencies))))
			=>
			;since we don't copy the set of producers at the start anymore we
			;need this operation as well
			(slot-insert$ ?i0 Producers 1 ?op)
			(slot-insert$ ?i0 NonLocalDependencies 1 ?op))
;------------------------------------------------------------------------------


Fix typo in encoding-0.clp

Fix typo in encoding-0.clp

% = MPPD DOMAIN: CLINGCON ENCODING =================================================================

% Move actions
#include "./action-MPP.clp".

% Order fulfillment (Goal condition)
#include "./goal-D-0.clp".

% Highway constraints
#include "../control/highways.clp".

% Output conversion
#include "./output-MPPD.lp".

% = MPPD DOMAIN: CLINGCON ENCODING =================================================================

% Move actions
#include "./action-MPP.clp".

% Order fulfillment (Goal condition)
#include "./goal-D-0.clp

% Highway constraints
#include "../control/highways.clp".

% Output conversion
#include "./output-MPPD.lp".


adding an example for testing the fact extension for temporal facts
peter

git-svn-id: 9643e93313b82f5e4da82d8413267a0daa4b5472@422 2cd91b7d-3b21-0410-a5f4-f42db4f24360

(deftemplate transaction
  (slot accountId (type STRING))
  (slot buyPrice (type DOUBLE))
  (slot countryCode (type STRING))
  (slot currentPrice (type DOUBLE))
  (slot cusip (type INTEGER))
  (slot exchange (type STRING))
  (slot industryGroupID (type INTEGER))
  (slot industryID (type INTEGER))
  (slot issuer (type STRING))
  (slot lastPrice (type DOUBLE))
  (slot purchaseDate (type STRING))
  (slot sectorID (type INTEGER))
  (slot shares (type DOUBLE))
  (slot subIndustryID (type INTEGER))
  (slot total (type DOUBLE))
)
(deftemplate account
  (slot accountId (type STRING))
  (slot cash (type DOUBLE))
  (slot fixedIncome (type DOUBLE))
  (slot stocks (type DOUBLE))
  (slot countryCode (type STRING))
)
(defrule joinrule1
 (transaction
    (accountId ?accid)
    (countryCode "US")
    (total ?tl&:(< ?tl 10000.00))
  )
  (account
    (accountId ?accid)
    (cash ?c&:(> ?c 1000000))
  )
=>
  (printout t "joinrule1 was fired" crlf)
)

(assert-temporal (transaction (accountId "acc1")(countryCode "US")(total 1298.00)(expiration-time 111111)(source "http://this.com/")(service-type "http")(validity 20) ) )

error: pathspec 'samples/temporal_test1.clp' did not match any file(s) known to git


changed the sequence of the asserts slightly to debug why the rules won't fire after the refactoring.
peter

git-svn-id: 9643e93313b82f5e4da82d8413267a0daa4b5472@519 2cd91b7d-3b21-0410-a5f4-f42db4f24360

(deftemplate transaction
  (slot accountId (type STRING))
  (slot buyPrice (type DOUBLE))
  (slot countryCode (type STRING))
  (slot currentPrice (type DOUBLE))
  (slot cusip (type INTEGER))
  (slot exchange (type STRING))
  (slot industryGroupID (type INTEGER))
  (slot industryID (type INTEGER))
  (slot issuer (type STRING))
  (slot lastPrice (type DOUBLE))
  (slot purchaseDate (type STRING))
  (slot sectorID (type INTEGER))
  (slot shares (type DOUBLE))
  (slot subIndustryID (type INTEGER))
  (slot total (type DOUBLE))
)
(deftemplate account
  (slot accountId (type STRING))
  (slot cash (type DOUBLE))
  (slot fixedIncome (type DOUBLE))
  (slot stocks (type DOUBLE))
  (slot countryCode (type STRING))
)
(deftemplate rating
  (slot cusip (type INTEGER))
  (slot issuer (type STRING))
)
(defrule joinrule2
 (transaction
    (accountId ?accid)
    (countryCode "US")
    (issuer ?iss)
  )
  (rating
    (issuer ?iss)
  )
  (account
    (accountId ?accid)
  )
=>
  (printout t "joinrule2 was fired" )
)
(assert (rating (cusip 10101025)(issuer "MSFT") ) )
(assert (rating (cusip 10101020)(issuer "IBM") ) )
(assert (transaction (accountId "acc1")(countryCode "US")(total 1298.00)(cusip 10101015)(issuer "MSFT") ) )
(assert (transaction (accountId "acc1")(countryCode "US")(total 1298.00)(cusip 10101010)(issuer "IBM") ) )
(assert (account (accountId "acc1")(cash 1200000) ) )

(deftemplate transaction
  (slot accountId (type STRING))
  (slot buyPrice (type DOUBLE))
  (slot countryCode (type STRING))
  (slot currentPrice (type DOUBLE))
  (slot cusip (type INTEGER))
  (slot exchange (type STRING))
  (slot industryGroupID (type INTEGER))
  (slot industryID (type INTEGER))
  (slot issuer (type STRING))
  (slot lastPrice (type DOUBLE))
  (slot purchaseDate (type STRING))
  (slot sectorID (type INTEGER))
  (slot shares (type DOUBLE))
  (slot subIndustryID (type INTEGER))
  (slot total (type DOUBLE))
)
(deftemplate account
  (slot accountId (type STRING))
  (slot cash (type DOUBLE))
  (slot fixedIncome (type DOUBLE))
  (slot stocks (type DOUBLE))
  (slot countryCode (type STRING))
)
(deftemplate rating
  (slot cusip (type INTEGER))
  (slot issuer (type STRING))
)
(defrule joinrule2
 (transaction
    (accountId ?accid)
    (countryCode "US")
    (issuer ?iss)
  )
  (rating
    (issuer ?iss)
  )
  (account
    (accountId ?accid)
  )
=>
  (printout t "joinrule2 was fired" )
)
(assert (transaction (accountId "acc1")(countryCode "US")(total 1298.00)(cusip 10101015)(issuer "MSFT") ) )
(assert (rating (cusip 10101025)(issuer "MSFT") ) )
(assert (transaction (accountId "acc1")(countryCode "US")(total 1298.00)(cusip 10101010)(issuer "IBM") ) )
(assert (rating (cusip 10101020)(issuer "IBM") ) )
(assert (account (accountId "acc1")(cash 1200000) ) )


- fixed a bug in the init.clp

- fixed a bug in the init.clp

git-svn-id: 9643e93313b82f5e4da82d8413267a0daa4b5472@872 2cd91b7d-3b21-0410-a5f4-f42db4f24360

(deftemplate agent-description
    (slot name (type STRING))
    (slot local (type BOOLEAN))
)

(deftemplate agent-ontology
    (slot name (type STRING))
    (slot definition (type STRING))
)

(deftemplate agent-performative
    (slot performative (type STRING))
    (slot handlerfunction (type STRING))
)

(deftemplate agent-message
	(slot sender (type STRING))
	(multislot receivers)
	(multislot reply-to)
	(slot performative (type STRING))
	(slot content (type STRING))
	(slot language (type STRING))
	(slot encoding (type STRING))
	(slot ontology (type STRING))
	(slot protocol (type STRING))
	(slot conversation-id (type STRING))
	(slot in-reply-to (type STRING))
	(slot reply-with (type STRING))
	(slot reply-by (type DATETIME))
	(multislot user-properties)
)

(defrule incoming-message
	(agent-description
		(name ?receiver)
		(local TRUE)
	)
	?message <- (agent-message
		(sender ?sender)
		(receivers ?receivers)
		(reply-to ?replyto)
		(performative ?performative)
		(content ?content)
		(language ?language)
		(encoding ?encoding)
		(ontology ?ontology)
		(protocol ?protocol)
		(conversation-id ?conversationid)
		(in-reply-to ?inreplyto)
		(reply-with ?replywith)
		(reply-by ?replyby)
		(user-properties ?userproperties)
	)
	(agent-performative
	    (performative ?performative)
	    (handlerfunction ?handler)
	)
	(test (member$ ?receiver ?receivers))
	=>
	(printout t ?receiver " received a message with performative " ?performative crlf)
	(assert (agent-description (name ?sender)(local FALSE)))
	(apply ?handler (member ?message getFactId))
)

(batch apps/jamochaagent/performatives/fipasl.clp)

(deftemplate agent-description
    (slot name (type STRING))
    (slot local (type BOOLEAN))
)

(deftemplate agent-ontology
    (slot name (type STRING))
    (slot definition (type STRING))
)

(deftemplate agent-performative
    (slot performative (type STRING))
    (slot handlerfunction (type STRING))
)

(deftemplate agent-message
	(slot sender)
	(multislot receivers)
	(multislot reply-to)
	(slot performative)
	(slot content)
	(slot language)
	(slot encoding)
	(slot ontology)
	(slot protocol)
	(slot conversation-id)
	(slot in-reply-to)
	(slot reply-with)
	(slot reply-by)
	(multislot user-properties)
)

(defrule incoming-message
	(agent-description
		(name ?receiver)
		(local TRUE)
	)
	?message <- (agent-message
		(sender ?sender)
		(receivers ?receivers)
		(reply-to ?replyto)
		(performative ?performative)
		(content ?content)
		(language ?language)
		(encoding ?encoding)
		(ontology ?ontology)
		(protocol ?protocol)
		(conversation-id ?conversationid)
		(in-reply-to ?inreplyto)
		(reply-with ?replywith)
		(reply-by ?replyby)
		(user-properties ?userproperties)
	)
	(agent-performative
	    (performative ?performative)
	    (handlerfunction ?handler)
	)
	(test (member$ ?receiver ?receivers))
	=>
	(printout t ?receiver " received a message with performative " ?performative crlf)
	(assert (agent-description (name ?sender)(local FALSE)))
	(apply ?handler (member ?message getFactId))
)

(batch ontologies/fipasl.clp)


Added RunGLAPIConverter.clp

Added RunGLAPIConverter.clp

This file automates the process of running the GLAPIConverter expert system on
a given file.

;------------------------------------------------------------------------------
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; RunGLAPIConversion.clp - Runs the GLAPIConversion expert system
; Written by Joshua Scoggins
;------------------------------------------------------------------------------
(clear)
(batch* GLAPIConversionEntry.clp)
(reset)
;Input format is the same as the constant conversion expert system
(assert (parse constant file "/usr/include/GL/gl.h"))
(run)
(exit)

error: pathspec 'src/tools/conv/gl/RunGLAPIConverter.clp' did not match any file(s) known to git


Added the hydra pass header.

Added the hydra pass header.

;------------------------------------------------------------------------------
;Copyright (c) 2012, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; PassHeader.clp - Header file/entry point into the hydra pass
;------------------------------------------------------------------------------

(defmodule hydra
           (import core ?ALL)
           (import llvm ?ALL)
           (import types ?ALL)
           (import indirect ?ALL)
           (import pipeline ?ALL)
           (import rampancy ?ALL)
           (import MAIN ?ALL))

error: pathspec 'lib/durandal/passes/hydra/PassHeader.clp' did not match any file(s) known to git


Fixed a typo in PassHandler's terminate-pass rule

I mis-spelled unmake-instance. This has been fixed.

;------------------------------------------------------------------------------
;Copyright (c) 2012, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; PassHandler.clp - Contains the logic necessary to handle pass execution
;------------------------------------------------------------------------------
(defrule pipeline::build-pass-descriptor
			?fct <- (message (to pipeline)
								  (action pass-description)
								  (arguments $?passes))
			=>
			(retract ?fct)
			(make-instance of PassDescriptor (passes $?passes)))
;------------------------------------------------------------------------------
(defrule pipeline::next-pass
			?obj <- (object (is-a PassDescriptor) (passes ?first $?rest))
			=>
			(assert (message (from pipeline) (to ?first) (action initial-fact)))
			(modify-instance ?obj (passes $?rest))
			;remove what is currently on the focus stack
			(pop-focus)
			(focus ?first pipeline))
;------------------------------------------------------------------------------
(defrule pipeline::terminate-pass
			?obj <- (object (is-a PassDescriptor) (passes))
			=>
			(unmake-instance ?obj)
			(pop-focus))
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
;Copyright (c) 2012, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; PassHandler.clp - Contains the logic necessary to handle pass execution
;------------------------------------------------------------------------------
(defrule pipeline::build-pass-descriptor
			?fct <- (message (to pipeline)
								  (action pass-description)
								  (arguments $?passes))
			=>
			(retract ?fct)
			(make-instance of PassDescriptor (passes $?passes)))
;------------------------------------------------------------------------------
(defrule pipeline::next-pass
			?obj <- (object (is-a PassDescriptor) (passes ?first $?rest))
			=>
			(assert (message (from pipeline) (to ?first) (action initial-fact)))
			(modify-instance ?obj (passes $?rest))
			;remove what is currently on the focus stack
			(pop-focus)
			(focus ?first pipeline))
;------------------------------------------------------------------------------
(defrule pipeline::terminate-pass
			?obj <- (object (is-a PassDescriptor) (passes))
			=>
			(unmake-instanec ?obj)
			(pop-focus))
;------------------------------------------------------------------------------


Reverted log-message function to previous version and documented some other functions.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;			GLOBALS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defglobal ?*outlog* = t)
(defglobal ?*logLevel* = ERROR) ; INFO | WARNING | ERROR | DEBUG (print always)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;			FUNCTIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deffunction log-message
	; Receives level and message chunks that would be concatenated.
	; Level is one of: INFO | WARNING | ERROR | DEBUG (print always)
	(?level ?msg1 $?msg2)

	(bind ?message ?msg1)
	(progn$ (?var $?msg2)
		(bind ?message (str-cat ?message ?var) )
	)
	(if (eq ?level DEBUG) then
		(printout ?*outlog* ?level ": " ?message crlf)
		(return)
	)
	(bind ?currentLogLevel 10)
	(bind ?lvl 10)
	(switch ?*logLevel*
		(case INFO then (bind ?currentLogLevel 0))
		(case ERROR then (bind ?currentLogLevel 20))
		(case WARNING then (bind ?currentLogLevel 10))
	)
	(switch ?level
		(case INFO then (bind ?lvl 0))
		(case ERROR then (bind ?lvl 20))
		(case WARNING then (bind ?lvl 10))
	)
	(if (>= ?lvl ?currentLogLevel) then
		(printout ?*outlog* ?level ": " ?message crlf)
	)
)

(deffunction setCmdTimer
	(?time ?cmd ?id)
	(python-call setCmdTimer ?time ?cmd ?id)
)

(deffunction setTimer
	; Receives time in miliseconds and a symbol to identify fact that indicates the timer ran off.
	(?time ?sym)
	(python-call setTimer ?time ?sym)
	(assert (timer_sent ?sym (time) (/ ?time 1000.0)))
)

(defrule clear_timers
	(declare (salience -1000))
	?t <-(BB_timer $?)
	=>
	(retract ?t)
)

(defrule delete_old_timers
	(declare (salience -1000))
	?t <-(timer_sent ? ?time ?duration)
	(test (> (time) (+ ?time ?duration) ) )
	=>
	(retract ?t)
)

(deffunction sleep
	; Receives time in miliseconds.
	; Prevents python from running during that time, even when messages are received.
	(?ms)
	(bind ?sym (gensym*))
	(python-call sleep ?ms ?sym)
	(halt)
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;			GLOBALS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defglobal ?*outlog* = t)
(defglobal ?*logLevel* = ERROR) ; INFO | WARNING | ERROR

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;			FUNCTIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deffunction log-message
	(?level ?msg1 $?msg2)

	(if (eq ?level DEBUG) then
		(printout ?*outlog* ?level ": " $?msg2 crlf)
		(return)
	)
	(bind ?currentLogLevel 10)
	(bind ?lvl 10)
	(switch ?*logLevel*
		(case INFO then (bind ?currentLogLevel 0))
		(case ERROR then (bind ?currentLogLevel 20))
		(case WARNING then (bind ?currentLogLevel 10))
	)
	(switch ?level
		(case INFO then (bind ?lvl 0))
		(case ERROR then (bind ?lvl 20))
		(case WARNING then (bind ?lvl 10))
	)
	(if (>= ?lvl ?currentLogLevel) then
		(printout ?*outlog* ?level ": " $?msg2 crlf)
	)
)

(deffunction setCmdTimer
	(?time ?cmd ?id)
	(python-call setCmdTimer ?time ?cmd ?id)
)

(deffunction setTimer
	(?time ?sym)
	(python-call setTimer ?time ?sym)
	(assert (timer_sent ?sym (time) (/ ?time 1000.0)))
)

(defrule clear_timers
	(declare (salience -1000))
	?t <-(BB_timer $?)
	=>
	(retract ?t)
)

(defrule delete_old_timers
	(declare (salience -1000))
	?t <-(timer_sent ? ?time ?duration)
	(test (> (time) (+ ?time ?duration) ) )
	=>
	(retract ?t)
)

(deffunction sleep
	(?ms)
	(bind ?sym (gensym*))
	(python-call sleep ?ms ?sym)
	(halt)
)


Added an include header to make it faster to load everything in the core

It must be batched!

;------------------------------------------------------------------------------
;electron-filesystem
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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 HOLDER 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.
;------------------------------------------------------------------------------
(load* (fs /lib/sys/core/message.clp))
(load* (fs /lib/sys/core/strings.clp))
(load* (fs /lib/sys/core/extensions.clp))

error: pathspec 'lib/sys/core/include.clp' did not match any file(s) known to git


Added the optimize message-handler to the LLVMModule class

This is a wrapper over the optimize command to make it easier to use.

;------------------------------------------------------------------------------
;Copyright (c) 2012, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; LLVMModule.clp - Module Type
;------------------------------------------------------------------------------
(defclass llvm::LLVMModule
  (is-a Object InteropObject ParentedObject)
  (slot inline-asm (type STRING))
  (slot triple (type STRING))
  (slot data-layout (type STRING))
  (slot module-identifier (type STRING))
  (slot endianness (type SYMBOL) (allowed-symbols any little big))
  (slot pointer-size (type SYMBOL) (allowed-symbols any pointer32 pointer64)))
;------------------------------------------------------------------------------
(defmessage-handler llvm::LLVMModule optimize (?optLevel $?passes)
 (optimize ?self:pointer ?optLevel ?passes))
;------------------------------------------------------------------------------


another jdbc mini sample added

another jdbc mini sample added

git-svn-id: 9643e93313b82f5e4da82d8413267a0daa4b5472@701 2cd91b7d-3b21-0410-a5f4-f42db4f24360

(deftemplate templ (slot a) (slot b) (slot c) )
(assert (jdbclink (JDBCdriver "com.mysql.jdbc.Driver") (ConnectionName "h") (TableName "test") (TemplateName "templ") (Username "jamocha") (Password "geheim") (JDBCurl "jdbc:mysql://134.130.113.67:65306/jamocha")))
(jdbclink 2 "import" "foo")

error: pathspec 'samples/jdbclink2.clp' did not match any file(s) known to git


Modified painter.clp to use the new chicanery lib

(load* /lib/chicanery.clp)

(defglobal MAIN
           ?*system-initialized* = FALSE)

(deffacts query-operation
          (query input)
          (defmenu menu1 cut copy paste)
          (defmenu menu2 eat sleep drink))

(defrule initialize
         (declare (salience 10000))
         (initial-fact)
         =>
         (if (not ?*system-initialized*) then
           (eresized 0)
           (bind ?*system-initialized* TRUE)))

(defrule build-menus
         (declare (salience 9999))
         ?f <- (defmenu ?name $?entries)
         =>
         (retract ?f)
         (defmenu ?name ?entries))

(defrule on-resized
         (declare (salience 1000))
         ?f <- (event resized new ?value)
         =>
         (if (and ?value (< (getwindow) 0)) then
           (printout werror "ERROR: couldn't reattach to window" crlf)
           (exit)
           else
           (retract ?f)))

(defrule query-input
         ?f <- (query input)
         =>
         (retract ?f)
         (mouse/query)
         (assert (input mouse
                        buttons: (translate/mouse/buttons)
                        position: (mouse/position)
                        time-stamp: (mouse/timestamp))
                 (input keyboard
                        button: (translate/kbd/query))))

(defrule process-mouse-inputs
         (declare (salience -1))
         ?f <- (input mouse
                      buttons: $?
                      position: ? ?
                      time-stamp: ?)
         =>
         (retract ?f)
         (assert (query mouse)))

(defrule process-mouse-inputs:menu1
         ?f <- (input mouse
                      buttons: button3
                      position: ? ?
                      time-stamp: ?)
         =>
         (retract ?f)
         ; Display a menu
         (printout t (send [menu1] show-menu 3) crlf)
         (assert (query mouse)))

(defrule process-mouse-inputs:menu2
         ?f <- (input mouse
                      buttons: button2
                      position: ? ?
                      time-stamp: ?)
         =>
         (retract ?f)
         ; Display a menu
         (printout t (send [menu2] show-menu 2) crlf)
         (assert (query mouse)))

(defrule process-keyboard-inputs:quit
         (declare (salience 1))
         ?f <- (input keyboard
                      button: ESC)
         =>
         (retract ?f)
         (exit))

(defrule process-keyboard-inputs:nil
         (declare (salience 1))
         ?f <- (input keyboard
                      button: NIL)
         =>
         (retract ?f)
         (assert (query keyboard)))

(defrule process-keyboard-inputs
         ?f <- (input keyboard
                      button: ?b&~NIL)
         =>
         (retract ?f)
         (printout t "Pressed " ?b crlf)
         (assert (query keyboard)))

(defrule ready-to-query-input-again
         ?f <- (query keyboard)
         ?f2 <- (query mouse)
         =>
         (retract ?f ?f2)
         (assert (query input)))

(load* /lib/chicanery/pointer.clp)
(load* /lib/chicanery/input.clp)
(load* /lib/chicanery/menu.clp)
(load* /lib/chicanery/rectangle.clp)
(load* /lib/chicanery/color.clp)

(defglobal MAIN
           ?*system-initialized* = FALSE)

(deffacts query-operation
          (query input)
          (defmenu menu1 cut copy paste)
          (defmenu menu2 eat sleep drink))

(defrule initialize
         (declare (salience 10000))
         (initial-fact)
         =>
         (if (not ?*system-initialized*) then
           (eresized 0)
           (bind ?*system-initialized* TRUE)))

(defrule build-menus
         (declare (salience 9999))
         ?f <- (defmenu ?name $?entries)
         =>
         (retract ?f)
         (defmenu ?name ?entries))

(defrule on-resized
         (declare (salience 1000))
         ?f <- (event resized new ?value)
         =>
         (if (and ?value (< (getwindow) 0)) then
           (printout werror "ERROR: couldn't reattach to window" crlf)
           (exit)
           else
           (retract ?f)))

(defrule query-input
         ?f <- (query input)
         =>
         (retract ?f)
         (mouse/query)
         (assert (input mouse
                        buttons: (translate/mouse/buttons)
                        position: (mouse/position)
                        time-stamp: (mouse/timestamp))
                 (input keyboard
                        button: (translate/kbd/query))))

(defrule process-mouse-inputs
         (declare (salience -1))
         ?f <- (input mouse
                      buttons: $?
                      position: ? ?
                      time-stamp: ?)
         =>
         (retract ?f)
         (assert (query mouse)))

(defrule process-mouse-inputs:menu1
         ?f <- (input mouse
                      buttons: button3
                      position: ? ?
                      time-stamp: ?)
         =>
         (retract ?f)
         ; Display a menu
         (printout t (send [menu1] show-menu 3) crlf)
         (assert (query mouse)))

(defrule process-mouse-inputs:menu2
         ?f <- (input mouse
                      buttons: button2
                      position: ? ?
                      time-stamp: ?)
         =>
         (retract ?f)
         ; Display a menu
         (printout t (send [menu2] show-menu 2) crlf)
         (assert (query mouse)))

(defrule process-keyboard-inputs:quit
         (declare (salience 1))
         ?f <- (input keyboard
                      button: ESC)
         =>
         (retract ?f)
         (exit))

(defrule process-keyboard-inputs:nil
         (declare (salience 1))
         ?f <- (input keyboard
                      button: NIL)
         =>
         (retract ?f)
         (assert (query keyboard)))

(defrule process-keyboard-inputs
         ?f <- (input keyboard
                      button: ?b&~NIL)
         =>
         (retract ?f)
         (printout t "Pressed " ?b crlf)
         (assert (query keyboard)))

(defrule ready-to-query-input-again
         ?f <- (query keyboard)
         ?f2 <- (query mouse)
         =>
         (retract ?f ?f2)
         (assert (query input)))


- merged the new multislot test to main branch

git-svn-id: 9643e93313b82f5e4da82d8413267a0daa4b5472@669 2cd91b7d-3b21-0410-a5f4-f42db4f24360

(deftemplate customer
  (slot first)
  (slot middle)
  (slot last)
  (slot title)
  (multislot addresses)
)
(defrule rule0
 (customer
    (first "john")
  )
=>
  (printout t "rule0 was fired" )
)
(assert (customer (first "john")(last "do")(addresses 1 4 5) ) )
(fire)
(bind ?var1 1)
(bind ?var2 4)
(assert (customer (first "john")(last "do")(addresses ?var1 ?var2) ) )

error: pathspec 'samples/multislot_test7.clp' did not match any file(s) known to git


Updated Init.clp of loop-region-merging to fix the module names

The modules were marked as loop-region-building-* instead of
loop-region-merging-*.

;------------------------------------------------------------------------------
;Copyright (c) 2012, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; Init.clp - Contains the defmodules that make up the process of
; loop-region-merging.
;------------------------------------------------------------------------------
(defmodule loop-region-merging-flatlist-build
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-flatlist-expand
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-flatlist-claim
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-flatlist-arbitrate
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-flatlist-resolve
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-determinant-construction
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-determinant-population
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-determinant-resolution
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-determinant-indirect-resolution
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-fixup
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-fixup-update
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-fixup-rename
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-merging-cleanup-merger
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defrule loop-region-merging::modify-pass-description
			"Modifies the target pass description to load the target subpasses"
			?fct <- (message (to loop-region-merging) (action initial-fact))
			?obj <- (object (is-a pass-description) (passes $?passes))
			=>
			(retract ?fct)
			(modify-instance ?obj
								  (passes
									 loop-region-merging-flatlist-build
									 loop-region-merging-flatlist-expand
									 loop-region-merging-flatlist-claim
									 loop-region-merging-flatlist-arbitrate
									 loop-region-merging-flatlist-resolve
									 loop-region-merging-determinant-construction
									 loop-region-merging-determinant-population
									 loop-region-merging-determinant-resolution
									 loop-region-merging-determinant-indirect-resolution
									 loop-region-merging-fixup
									 loop-region-merging-fixup-update
									 loop-region-merging-fixup-rename
									 loop-region-merging-cleanup-merger
									 $?passes)))
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
;Copyright (c) 2012, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of Joshua Scoggins nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
; Init.clp - Contains the defmodules that make up the process of
; loop-region-merging.
;------------------------------------------------------------------------------
(defmodule loop-region-building-flatlist-build
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-flatlist-expand
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-flatlist-claim
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-flatlist-arbitrate
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-flatlist-resolve
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-determinant-construction
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-determinant-population
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-determinant-resolution
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-determinant-indirect-resolution
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-fixup
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-fixup-update
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-fixup-rename
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defmodule loop-region-building-cleanup-merger
			  (import core ?ALL)
			  (import llvm ?ALL)
			  (import types ?ALL)
			  (import rampancy ?ALL)
			  (import indirect ?ALL)
			  (import pipeline ?ALL)
			  (import MAIN ?ALL))
;------------------------------------------------------------------------------
(defrule loop-region-merging::modify-pass-description
			"Modifies the target pass description to load the target subpasses"
			?fct <- (message (to loop-region-merging) (action initial-fact))
			?obj <- (object (is-a pass-description) (passes $?passes))
			=>
			(retract ?fct)
			(modify-instance ?obj
								  (passes
									 loop-region-building-flatlist-build
									 loop-region-building-flatlist-expand
									 loop-region-building-flatlist-claim
									 loop-region-building-flatlist-arbitrate
									 loop-region-building-flatlist-resolve
									 loop-region-building-determinant-construction
									 loop-region-building-determinant-population
									 loop-region-building-determinant-resolution
									 loop-region-building-determinant-indirect-resolution
									 loop-region-building-fixup
									 loop-region-building-fixup-update
									 loop-region-building-fixup-rename
									 loop-region-building-cleanup-merger
									 $?passes)))
;------------------------------------------------------------------------------


Added set_delete, changed salience and timer_sent.

-> Added set_delete function and rule to make facts be deleted after some time.
-> Modified salience to -9000 and 9000 for utils' rules.
-> Modified fact 'timer_sent' to have only a symbol.
-> Deleted rule which were supposed to delete timer_sent facts when timer was not created,
    as it wouldn't have work anyway, and shouldn't be activated anyway.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;			GLOBALS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defglobal ?*outlog* = t)
(defglobal ?*logLevel* = ERROR) ; INFO | WARNING | ERROR | DEBUG (print always)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;			FUNCTIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deffunction log-message
	; Receives level and message chunks that would be concatenated.
	; Level is one of: INFO | WARNING | ERROR | DEBUG (print always)
	(?level ?msg1 $?msg2)

	(bind ?message ?msg1)
	(progn$ (?var $?msg2)
		(bind ?message (str-cat ?message ?var) )
	)
	(if (eq ?level DEBUG) then
		(printout ?*outlog* ?level ": " ?message crlf)
		(return)
	)
	(bind ?currentLogLevel 10)
	(bind ?lvl 10)
	(switch ?*logLevel*
		(case INFO then (bind ?currentLogLevel 0))
		(case ERROR then (bind ?currentLogLevel 20))
		(case WARNING then (bind ?currentLogLevel 10))
	)
	(switch ?level
		(case INFO then (bind ?lvl 0))
		(case ERROR then (bind ?lvl 20))
		(case WARNING then (bind ?lvl 10))
	)
	(if (>= ?lvl ?currentLogLevel) then
		(printout ?*outlog* ?level ": " ?message crlf)
	)
)

(deffunction setCmdTimer
	(?time ?cmd ?id)
	(python-call setCmdTimer ?time ?cmd ?id)
)

(deffunction setTimer
	; Receives time in miliseconds and a symbol to identify fact that indicates the timer ran off.
	(?time ?sym)
	(python-call setTimer ?time ?sym)
	(assert (timer_sent ?sym) )
)

(defrule clear_timers
	(declare (salience -9000))
	?t <-(BB_timer $?)
	=>
	(retract ?t)
)

(defrule delete_timer_sent
	(declare (salience 9000))
	(BB_timer ?sym)
	?t <-(timer_sent ?sym)
	=>
	(retract ?t)
)

(deffunction sleep
	; Receives time in miliseconds.
	; Prevents python from running during that time, even when messages are received.
	(?ms)
	(bind ?sym (gensym*))
	(python-call sleep ?ms ?sym)
	(halt)
)

(deffunction set_delete
	(?fact ?time_in_secs)
	(bind ?sym (gensym*))
	(setTimer (* ?time_in_secs 1000) ?sym)
	(assert
		(BB_set_delete ?fact ?sym)
	)
)

(defrule set_delete-delete_fact
	(BB_timer ?sym)
	?f <-(BB_set_delete ?fact ?sym)
	(test (fact-existp ?fact))
	=>
	(retract ?f ?fact)
)

(defrule set_delete-delete_delete_flag
	(BB_timer ?sym)
	?f <-(BB_set_delete ?fact ?sym)
	(not (test (fact-existp ?fact)))
	=>
	(retract ?f)
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;			GLOBALS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defglobal ?*outlog* = t)
(defglobal ?*logLevel* = ERROR) ; INFO | WARNING | ERROR | DEBUG (print always)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;			FUNCTIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deffunction log-message
	; Receives level and message chunks that would be concatenated.
	; Level is one of: INFO | WARNING | ERROR | DEBUG (print always)
	(?level ?msg1 $?msg2)

	(bind ?message ?msg1)
	(progn$ (?var $?msg2)
		(bind ?message (str-cat ?message ?var) )
	)
	(if (eq ?level DEBUG) then
		(printout ?*outlog* ?level ": " ?message crlf)
		(return)
	)
	(bind ?currentLogLevel 10)
	(bind ?lvl 10)
	(switch ?*logLevel*
		(case INFO then (bind ?currentLogLevel 0))
		(case ERROR then (bind ?currentLogLevel 20))
		(case WARNING then (bind ?currentLogLevel 10))
	)
	(switch ?level
		(case INFO then (bind ?lvl 0))
		(case ERROR then (bind ?lvl 20))
		(case WARNING then (bind ?lvl 10))
	)
	(if (>= ?lvl ?currentLogLevel) then
		(printout ?*outlog* ?level ": " ?message crlf)
	)
)

(deffunction setCmdTimer
	(?time ?cmd ?id)
	(python-call setCmdTimer ?time ?cmd ?id)
)

(deffunction setTimer
	; Receives time in miliseconds and a symbol to identify fact that indicates the timer ran off.
	(?time ?sym)
	(python-call setTimer ?time ?sym)
	(assert (timer_sent ?sym (time) (/ ?time 1000.0)))
)

(defrule clear_timers
	(declare (salience -1000))
	?t <-(BB_timer $?)
	=>
	(retract ?t)
)

(defrule delete_old_timers
	(declare (salience -1000))
	?t <-(timer_sent ? ?time ?duration)
	(test (>= (time) (+ ?time ?duration) ) )
	=>
	(retract ?t)
)

(defrule delete_old_timers
	(declare (salience -1000))
	?t <-(timer_sent ?sym ?time ?duration)
	(test (< (time) (+ ?time ?duration) ) )
	=>
	(retract ?t)
	(assert (timer_sent ?sym ?time ?duration))
)

(deffunction sleep
	; Receives time in miliseconds.
	; Prevents python from running during that time, even when messages are received.
	(?ms)
	(bind ?sym (gensym*))
	(python-call sleep ?ms ?sym)
	(halt)
)

(deffunction set_delete
	(?fact ?time_in_secs)
	(bind ?sym (gensym*))
	(setTimer (* ?time_in_secs 1000) ?sym)
	(assert
		(BB_set_delete ?fact ?sym)
	)
)

(defrule set_delete-delete_fact
	(BB_timer ?sym)
	?f <-(BB_set_delete ?fact ?sym)
	=>
	(retract ?f ?fact)
)


Added the cpuinfo expert system

Added the cpuinfo expert system

It parses and prints the contents of /proc/cpuinfo on linux as CLIPS
objects. Unfortunately, it only runs on Linux since its the machine I
wrote it on.

;------------------------------------------------------------------------------
;electron-filesystem
;Copyright (c) 2013, Joshua Scoggins
;All rights reserved.
;
;Redistribution and use in source and binary forms, with or without
;modification, are permitted provided that the following conditions are met:
;    * Redistributions of source code must retain the above copyright
;      notice, this list of conditions and the following disclaimer.
;    * 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.
;    * Neither the name of electron-filesystem nor the
;      names of its contributors may be used to endorse or promote products
;      derived from this software without specific prior written permission.
;
;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 Joshua Scoggins 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.
;------------------------------------------------------------------------------
(if (neq (operating-system) Linux) then
  (printout werror "ERROR: This only works on linux" crlf)
  (exit -1))

(load* (fs /sys/core/message.clp))
(load* (fs /sys/core/strings.clp))
(defclass processor
  (is-a USER)
  (slot processor)
  (slot vendor_id)
  (slot cpu-family)
  (slot model)
  (slot model-name)
  (slot stepping)
  (slot microcode)
  (slot cpu-MHz)
  (slot cache-size)
  (slot physical-id)
  (slot siblings)
  (slot core-id)
  (slot cpu-cores)
  (slot apicid)
  (slot initial-apicid)
  (slot fpu)
  (slot fpu_exception)
  (slot cpuid-level)
  (slot wp)
  (multislot flags)
  (slot bogomips)
  (slot clflush-size)
  (slot cache_alignment)
  (slot address-sizes)
  (slot power-management))

(defrule open-file
         (initial-fact)
         =>
         (if (open /proc/cpuinfo /proc/cpuinfo "r") then
           (assert (message (action /proc/cpuinfo)
                            (contents (readline /proc/cpuinfo))))
           else
           (printout werror "ERROR: Couldn't open /proc/cpuinfo!" crlf)
           (exit -1)))

(defrule build-up:/proc/cpuinfo
         ?f <- (message (action /proc/cpuinfo)
                        (contents $?lines))
         =>
         (bind ?v (readline /proc/cpuinfo))
         (if (eq ?v EOF) then
           (close /proc/cpuinfo)
           (modify ?f (action build-entries))
           else
           (modify ?f (contents $?lines ?v))))

(defrule build-processor-entry
         ?f <- (message (action build-entries)
                        (contents $?contents "" $?rest))
         (test (not (member$ "" $?contents)))
         =>
         (modify ?f (contents $?rest))
         (duplicate ?f
                    (action processor-entry)
                    (from (instance-name (make-instance of processor)))
                    (contents $?contents)))

(defrule finish-building-entries
         ?f <- (message (action build-entries)
                        (contents))
         =>
         (retract ?f))

(defrule create-processor-entries
         ?f <- (message (action processor-entry)
                        (from ?uid)
                        (contents ?line $?rest))
         =>
         (modify ?f (contents $?rest))
         (duplicate ?f (action remove-colon)
                    (contents ?line)))

(defrule finish-processor-decomposition
         ?f <- (message (action processor-entry)
                        (contents))
         =>
         (retract ?f))

(defrule remove-colon
         ?f <- (message (action remove-colon)
                        (contents ?line))
         (test (contains ":" ?line))
         =>
         (bind ?ind (str-index ":" ?line))
         (modify ?f (action mangle-name)
                 (contents (sub-string 1 (- ?ind 1) ?line)
                           (sub-string (+ ?ind 1) (str-length ?line) ?line))))

(defrule mangle-name
         ?f <- (message (action mangle-name)
                        (contents ?name ?contents))
         =>
         (bind ?ename (explode$ ?name))
         (if (multifieldp ?ename) then
           (bind ?bname (nth$ 1 ?ename))
           (progn$ (?z (rest$ ?ename))
                   (bind ?bname (format nil "%s-%s" ?bname ?z)))
           (modify ?f (action parse-entry)
                   (contents (sym-cat ?bname) ?contents))
           else
           (modify ?f (action parse-entry)
                   (contents (sym-cat ?ename) ?contents))))

(defrule parse-entry
         ?f <- (message (action parse-entry)
                        (contents ?name $?contents))
         =>
         (modify ?f (action ?name)
                 (to populate)
                 (contents $?contents)))

(defrule populate-object:flags
         (declare (salience 1))
         ?f <- (message (to populate)
                        (from ?name)
                        (action flags)
                        (contents ?line))
         ?proc <- (object (is-a processor)
                          (name ?name))
         =>
         (retract ?f)
         (send ?proc put-flags (explode$ ?line)))

(defrule populate-object:model-name
         (declare (salience 1))
         ?f <- (message (to populate)
                        (from ?name)
                        (action model-name)
                        (contents ?line))
         ?proc <- (object (is-a processor)
                          (name ?name))
         =>
         (retract ?f)
         (send ?proc put-model-name (sub-string 2 (str-length ?line) ?line)))

(defrule populate-object:generic
         ?f <- (message (to populate)
                        (from ?name)
                        (action ?field)
                        (contents ?value&~""))
         ?proc <- (object (is-a processor)
                          (name ?name))
         =>
         (retract ?f)
         (send ?proc (sym-cat put- ?field) (string-to-field ?value)))

(defrule populate-object:empty
         ?f <- (message (to populate)
                        (from ?name)
                        (action ?field)
                        (contents ""))
         ?proc <- (object (is-a processor)
                          (name ?name))
         =>
         (retract ?f)
         (send ?proc (sym-cat put- ?field) nil))

(defrule print-processor
         (declare (salience -1))
         ?f <- (object (is-a processor))
         =>
         (printout t "(")
         (send ?f print)
         (printout t ")" crlf))

error: pathspec 'logic/proc/cpuinfo.clp' did not match any file(s) known to git


mux now passes messages

mux now passes messages

(deftemplate message
             (slot from)
             (slot to)
             (slot action)
             (multislot values))
(defrule parse-mouse-input
         ?f <- (mouse ?buttons&:(!= ?buttons 4) ?x ?y ?msec)
         =>
         (retract ?f)
         (format t "mouse: %d %d %d %d%n" ?buttons ?x ?y ?msec))

(defrule parse-mouse-input:quit
         ?f <- (mouse ?buttons&:(= ?buttons 4) ?x ?y ?msec)
         =>
         (retract ?f)
         (format t "exiting%n")
         (exit))

(defrule send-message-on
         ?f <- (message (from ?from)
                        (to ?to&~mux)
                        (action ?action)
                        (values $?values))
         =>
         (retract ?f)
         (format ?to "(message (from %s) (to %s) (action %s) (values %s))"
                 ?from ?to ?action (implode$ ?values)))