Added a doc string to InteropObject.clp

Added a doc string to InteropObject.clp

; An InteropObject stores a pointer to a type outside CLIPS

(defclass InteropObject
 "The class that allows CLIPS to interact with LLVM. Well that was what it was
 designed for. However this class can be used to allow objects outside CLIPS to
 be modified by request within CLIPS. It is up to the programmer to provide
 functions to act on these pointers though."
 (is-a USER)
 (slot Pointer (visibility public) (type NUMBER)))

; An InteropObject stores a pointer to a type outside CLIPS

(defclass InteropObject (is-a USER)
 (slot Pointer (visibility public) (type NUMBER)))


Rewrote the merge rules for producers and consumers to reduce activations

;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.
;------------------------------------------------------------------------------
; MergeRules.clp - Contains all of the merge rules used in the analysis stages
; Written by Joshua Scoggins (11/18/2012)
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-merge::generate-initial-consumer-list
         ?f0 <- (message (to dependency-analysis)
				             (action instruction-consumes)
								 (arguments ?a => ?id))
			(not (exists (message (to dependency-analysis)
							          (action instruction-consume-list)
										 (arguments ?id => $?))))
			=>
			(modify ?f0 (action instruction-consume-list)
			            (arguments ?id => ?a)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-merge::generate-initial-producer-list
         ?f0 <- (message (to dependency-analysis)
				             (action instruction-produces)
								 (arguments ?a => ?id))
			(not (exists (message (to dependency-analysis)
							          (action instruction-produce-list)
										 (arguments ?id => $?))))
			=>
			(modify ?f0 (action instruction-produce-list)
			            (arguments ?id => ?a)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-merge::add-to-consumer-list
 (declare (salience 1))
         ?f0 <- (message (to dependency-analysis)
				             (action instruction-consumes)
								 (arguments ?a => ?id))
			?f1 <- (message (to dependency-analysis)
				             (action instruction-consume-list)
								 (arguments ?id => $?elements))
			=>
			(retract ?f0)
			(modify ?f1 (arguments ?id => $?elements ?a)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-merge::add-to-producer-list
 (declare (salience 1))
         ?f0 <- (message (to dependency-analysis)
				             (action instruction-produces)
								 (arguments ?a => ?id))
			?f1 <- (message (to dependency-analysis)
				             (action instruction-produce-list)
								 (arguments ?id => $?elements))
			=>
			(retract ?f0)
			(modify ?f1 (arguments ?id => $?elements ?a)))
;------------------------------------------------------------------------------
;(defrule dependency-analysis-extended-memory-analysis-merge::MergeConsumers
;			?f0 <- (message (to dependency-analysis)
;								 (action instruction-consumes)
;								 (arguments ?a => ?id))
;			?f1 <- (message (to dependency-analysis)
;								 (action instruction-consumes)
;								 (arguments ?b&~?a => ?id))
;			=>
;			(retract ?f0)
;			(modify ?f1 (action instruction-consume-list)
;					  (arguments ?id => ?a ?b)))
;;------------------------------------------------------------------------------
;(defrule dependency-analysis-extended-memory-analysis-merge::MergeProducers
;			?f0 <- (message (to dependency-analysis)
;								 (action instruction-produces)
;								 (arguments ?a => ?id))
;			?f1 <- (message (to dependency-analysis)
;								 (action instruction-produces)
;								 (arguments ?b&~?a => ?id))
;			=>
;			(retract ?f0)
;			(modify ?f1 (action instruction-produce-list)
;					  (arguments ?id => ?a ?b)))
;;------------------------------------------------------------------------------
;(defrule dependency-analysis-extended-memory-analysis-merge::MergeConsumers-Multi
;			?f0 <- (message (to dependency-analysis)
;								 (action instruction-consume-list)
;								 (arguments ?id => $?a))
;			?f1 <- (message (to dependency-analysis)
;								 (action instruction-consume-list)
;								 (arguments ?id => $?b))
;			(test (neq ?f0 ?f1))
;			=>
;			(retract ?f0)
;			(modify ?f1 (arguments ?id => $?a $?b)))
;;------------------------------------------------------------------------------
;(defrule dependency-analysis-extended-memory-analysis-merge::MergeProducers-Multi
;			?f0 <- (message (to dependency-analysis)
;								 (action instruction-produce-list)
;								 (arguments ?id => $?a))
;			?f1 <- (message (to dependency-analysis)
;								 (action instruction-produce-list)
;								 (arguments ?id => $?b))
;			(test (neq ?f0 ?f1))
;			=>
;			(retract ?f0)
;			(modify ?f1 (arguments ?id => $?a $?b)))
;;------------------------------------------------------------------------------
;(defrule dependency-analysis-extended-memory-analysis-merge::MergeConsumers-Only
;			(declare (salience -2))
;			?f <- (message (to dependency-analysis)
;								(action instruction-consumes)
;								(arguments ?a => ?b))
;			=>
;			(modify ?f (action instruction-consume-list)
;					  (arguments ?b => ?a)))
;;------------------------------------------------------------------------------
;(defrule dependency-analysis-extended-memory-analysis-merge::MergeProducers-Only
;			(declare (salience -2))
;			?f <- (message (to dependency-analysis)
;								(action instruction-produces)
;								(arguments ?a => ?b))
;			=>
;			(modify ?f (action instruction-produce-list)
;					  (arguments ?b => ?a)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-inject::InjectConsumers-Producers-And-LocalDependencies
			"Performs the actions of InjectConsumers and
			InjectProducersAndLocalDependencies in a single rule fire."
			(declare (salience 1))
			?f0 <- (message (to dependency-analysis)
								 (action instruction-produce-list)
								 (arguments ?id => $?t0))
			?f1 <- (message (to dependency-analysis)
								 (action instruction-consume-list)
								 (arguments ?id => $?t1))
			?inst <- (object (is-a Instruction)
								  (id ?id)
								  (Consumers $?c)
								  (Producers $?p)
								  (LocalDependencies $?ld))
			=>
			(retract ?f0 ?f1)
			(bind ?cs $?c)
			(bind ?ps $?p)
			(bind ?lds $?ld)
			(object-pattern-match-delay
			  (progn$ (?target ?t1)
						 (if (not (member$ ?target ?cs)) then
							(bind ?cs (insert$ ?cs 1 ?target))))
			  (progn$ (?target ?t0)
						 (if (not (member$ ?target ?lds)) then
							(bind ?lds (insert$ ?lds 1 ?target)))
						 (if (not (member$ ?target ?ps)) then
							(bind ?ps (insert$ ?ps 1 ?target))))
			  (modify-instance ?inst (Consumers ?cs) (Producers ?ps)
									 (LocalDependencies ?lds))))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-inject::InjectConsumers
			"Adds a given consumer to the target instruction"
			?fct <- (message (to dependency-analysis)
								  (action instruction-consume-list)
								  (arguments ?id => $?targets))
			?inst <- (object (is-a Instruction)
								  (id ?id)
								  (Consumers $?cs))
			=>
			(retract ?fct)
			(bind ?cons $?cs)
			(object-pattern-match-delay
			  (progn$ (?target ?targets)
						 (if (not (member$ ?target ?cons)) then
							(bind ?cons (insert$ ?cons 1 ?target)))))
			  (modify-instance ?inst (Consumers ?cons)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-inject::InjectProducersAndLocalDependencies
			"Adds a given producer to the target instruction."
			?fct <- (message (to dependency-analysis)
								  (action instruction-produce-list)
								  (arguments ?id => $?targets))
			?inst <- (object (is-a Instruction)
								  (id ?id)
								  (Producers $?ps)
								  (LocalDependencies $?ld))
			=>
			(retract ?fct)
			(bind ?prods $?ps)
			(bind ?lds $?ld)
			(object-pattern-match-delay
			  (progn$ (?target ?targets)
						 (if (not (member$ ?target ?lds)) then
						   (bind ?lds (create$ ?lds ?target)))
						 (if (not (member$ ?target ?prods)) then
						  (bind ?prods (create$ ?prods ?target)))))
			  (modify-instance ?inst (Producers ?prods) (LocalDependencies ?lds)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-make-set::SetifyInstructionProducers
			?inst <- (object (is-a Instruction)
								  (Producers $?a ?b $?c ?b $?d))
			=>
			;if we find one duplicate instance then just convert the whole thing
			;into a list
			(bind ?mid (create$ ?b))
			(bind ?all (create$ ?a ?c ?d))
			(progn$ (?t ?all)
			        (if (not (member$ ?t ?mid)) then
						   (bind ?mid (insert$ ?mid (+ ?t-index 1) ?t))))
			(modify-instance ?inst (Producers ?mid)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-make-set::SetifyInstructionConsumers
			?inst <- (object (is-a Instruction)
								  (Consumers $?a ?b $?c ?b $?d))
			=>
			(bind ?mid (create$ ?b))
			(bind ?all (create$ ?a ?c ?d))
			(progn$ (?t ?all)
			        (if (not (member$ ?t ?mid)) then
						   (bind ?mid (insert$ ?mid (+ ?t-index 1) ?t))))
			(modify-instance ?inst (Consumers ?mid)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-make-set::SetifyLocalDependencies
			?inst <- (object (is-a Instruction)
								  (LocalDependencies $?a ?b $?c ?b $?d))
			=>
			(bind ?mid (create$ ?b))
			(bind ?all (create$ ?a ?c ?d))
			(progn$ (?t ?all)
			        (if (not (member$ ?t ?mid)) then
						   (bind ?mid (insert$ ?mid (+ ?t-index 1) ?t))))
			(modify-instance ?inst (LocalDependencies ?mid)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-make-set::SetifyNonLocalDependencies
			?inst <- (object (is-a Instruction)
								  (NonLocalDependencies $?a ?b $?c ?b $?d))
			=>
			(bind ?mid (create$ ?b))
			(bind ?all (create$ ?a ?c ?d))
			(progn$ (?t ?all)
			        (if (not (member$ ?t ?mid)) then
						   (bind ?mid (insert$ ?mid (+ ?t-index 1) ?t))))
			(modify-instance ?inst (NonLocalDependencies ?mid)))
;------------------------------------------------------------------------------

;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.
;------------------------------------------------------------------------------
; MergeRules.clp - Contains all of the merge rules used in the analysis stages
; Written by Joshua Scoggins (11/18/2012)
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-merge::MergeConsumers
			?f0 <- (message (to dependency-analysis)
								 (action instruction-consumes)
								 (arguments ?a => ?id))
			?f1 <- (message (to dependency-analysis)
								 (action instruction-consumes)
								 (arguments ?b&~?a => ?id))
			=>
			(retract ?f0)
			(modify ?f1 (action instruction-consume-list)
					  (arguments ?id => ?a ?b)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-merge::MergeProducers
			?f0 <- (message (to dependency-analysis)
								 (action instruction-produces)
								 (arguments ?a => ?id))
			?f1 <- (message (to dependency-analysis)
								 (action instruction-produces)
								 (arguments ?b&~?a => ?id))
			=>
			(retract ?f0)
			(modify ?f1 (action instruction-produce-list)
					  (arguments ?id => ?a ?b)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-merge::MergeConsumers-Multi
			?f0 <- (message (to dependency-analysis)
								 (action instruction-consume-list)
								 (arguments ?id => $?a))
			?f1 <- (message (to dependency-analysis)
								 (action instruction-consume-list)
								 (arguments ?id => $?b))
			(test (neq ?f0 ?f1))
			=>
			(retract ?f0)
			(modify ?f1 (arguments ?id => $?a $?b)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-merge::MergeProducers-Multi
			?f0 <- (message (to dependency-analysis)
								 (action instruction-produce-list)
								 (arguments ?id => $?a))
			?f1 <- (message (to dependency-analysis)
								 (action instruction-produce-list)
								 (arguments ?id => $?b))
			(test (neq ?f0 ?f1))
			=>
			(retract ?f0)
			(modify ?f1 (arguments ?id => $?a $?b)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-merge::MergeConsumers-Only
			(declare (salience -2))
			?f <- (message (to dependency-analysis)
								(action instruction-consumes)
								(arguments ?a => ?b))
			=>
			(modify ?f (action instruction-consume-list)
					  (arguments ?b => ?a)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-merge::MergeProducers-Only
			(declare (salience -2))
			?f <- (message (to dependency-analysis)
								(action instruction-produces)
								(arguments ?a => ?b))
			=>
			(modify ?f (action instruction-produce-list)
					  (arguments ?b => ?a)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-inject::InjectConsumers-Producers-And-LocalDependencies
			"Performs the actions of InjectConsumers and
			InjectProducersAndLocalDependencies in a single rule fire."
			(declare (salience 1))
			?f0 <- (message (to dependency-analysis)
								 (action instruction-produce-list)
								 (arguments ?id => $?t0))
			?f1 <- (message (to dependency-analysis)
								 (action instruction-consume-list)
								 (arguments ?id => $?t1))
			?inst <- (object (is-a Instruction)
								  (id ?id)
								  (Consumers $?c)
								  (Producers $?p)
								  (LocalDependencies $?ld))
			=>
			(retract ?f0 ?f1)
			(bind ?cs $?c)
			(bind ?ps $?p)
			(bind ?lds $?ld)
			(object-pattern-match-delay
			  (progn$ (?target ?t1)
						 (if (not (member$ ?target ?cs)) then
							(bind ?cs (insert$ ?cs 1 ?target))))
			  (progn$ (?target ?t0)
						 (if (not (member$ ?target ?lds)) then
							(bind ?lds (insert$ ?lds 1 ?target)))
						 (if (not (member$ ?target ?ps)) then
							(bind ?ps (insert$ ?ps 1 ?target))))
			  (modify-instance ?inst (Consumers ?cs) (Producers ?ps)
									 (LocalDependencies ?lds))))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-inject::InjectConsumers
			"Adds a given consumer to the target instruction"
			?fct <- (message (to dependency-analysis)
								  (action instruction-consume-list)
								  (arguments ?id => $?targets))
			?inst <- (object (is-a Instruction)
								  (id ?id)
								  (Consumers $?cs))
			=>
			(retract ?fct)
			(bind ?cons $?cs)
			(object-pattern-match-delay
			  (progn$ (?target ?targets)
						 (if (not (member$ ?target ?cons)) then
							(bind ?cons (insert$ ?cons 1 ?target)))))
			  (modify-instance ?inst (Consumers ?cons)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-inject::InjectProducersAndLocalDependencies
			"Adds a given producer to the target instruction."
			?fct <- (message (to dependency-analysis)
								  (action instruction-produce-list)
								  (arguments ?id => $?targets))
			?inst <- (object (is-a Instruction)
								  (id ?id)
								  (Producers $?ps)
								  (LocalDependencies $?ld))
			=>
			(retract ?fct)
			(bind ?prods $?ps)
			(bind ?lds $?ld)
			(object-pattern-match-delay
			  (progn$ (?target ?targets)
						 (if (not (member$ ?target ?lds)) then
						   (bind ?lds (create$ ?lds ?target)))
						 (if (not (member$ ?target ?prods)) then
						  (bind ?prods (create$ ?prods ?target)))))
			  (modify-instance ?inst (Producers ?prods) (LocalDependencies ?lds)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-make-set::SetifyInstructionProducers
			?inst <- (object (is-a Instruction)
								  (Producers $?a ?b $?c ?b $?d))
			=>
			;if we find one duplicate instance then just convert the whole thing
			;into a list
			(bind ?mid (create$ ?b))
			(bind ?all (create$ ?a ?c ?d))
			(progn$ (?t ?all)
			        (if (not (member$ ?t ?mid)) then
						   (bind ?mid (insert$ ?mid (+ ?t-index 1) ?t))))
			(modify-instance ?inst (Producers ?mid)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-make-set::SetifyInstructionConsumers
			?inst <- (object (is-a Instruction)
								  (Consumers $?a ?b $?c ?b $?d))
			=>
			(bind ?mid (create$ ?b))
			(bind ?all (create$ ?a ?c ?d))
			(progn$ (?t ?all)
			        (if (not (member$ ?t ?mid)) then
						   (bind ?mid (insert$ ?mid (+ ?t-index 1) ?t))))
			(modify-instance ?inst (Consumers ?mid)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-make-set::SetifyLocalDependencies
			?inst <- (object (is-a Instruction)
								  (LocalDependencies $?a ?b $?c ?b $?d))
			=>
			(bind ?mid (create$ ?b))
			(bind ?all (create$ ?a ?c ?d))
			(progn$ (?t ?all)
			        (if (not (member$ ?t ?mid)) then
						   (bind ?mid (insert$ ?mid (+ ?t-index 1) ?t))))
			(modify-instance ?inst (LocalDependencies ?mid)))
;------------------------------------------------------------------------------
(defrule dependency-analysis-extended-memory-analysis-make-set::SetifyNonLocalDependencies
			?inst <- (object (is-a Instruction)
								  (NonLocalDependencies $?a ?b $?c ?b $?d))
			=>
			(bind ?mid (create$ ?b))
			(bind ?all (create$ ?a ?c ?d))
			(progn$ (?t ?all)
			        (if (not (member$ ?t ?mid)) then
						   (bind ?mid (insert$ ?mid (+ ?t-index 1) ?t))))
			(modify-instance ?inst (NonLocalDependencies ?mid)))
;------------------------------------------------------------------------------


Fixed name issues in WavefrontAdvancement.clp

I fixed the calls to get-Contents and the Contents slot insert to be values
instead.

;------------------------------------------------------------------------------
;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 wavefront-scheduling-advance-init::MoveContentsToDeleteNodes
         "Moves blocks out of the contents into the closed list"
         (declare (salience 2701))
         ?wave <- (object (is-a Wavefront)
                          (id ?z)
                          (parent ?r)
                          (values $?c)
                          (Closed $?cl))
         (test (or (> (length$ ?c) 0)
                   (> (length$ ?cl) 0)))
         =>
         (slot-insert$ ?wave DeleteNodes 1 ?c ?cl))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-advance-identify::MarkShouldStayOnWavefront
         (declare (salience 343))
         ?wave <- (object (is-a Wavefront)
                          (id ?q)
                          (parent ?r)
                          (DeleteNodes $?a ?b $?c)
                          (Closed $?clos)
                          (values $?contents))

         ?bb <- (object (is-a Diplomat)
                        (id ?b)
                        (NextPathElements ?s))
         (object (is-a Diplomat)
                 (id ?s)
                 (PreviousPathElements $?ppe))
         (test (not (subsetp ?ppe (create$ ?a ?b ?c))))
         ?agObj <- (object (is-a PathAggregate)
                           (parent ?b))
         =>
         (object-pattern-match-delay
           (if (not (member$ ?b $?clos)) then
             (bind ?ind (member$ ?b $?contents))
             (slot-delete$ ?wave values ?ind ?ind)
             (modify-instance ?wave (Closed $?clos ?b)
                              (DeleteNodes $?a $?c))
             else
             (modify-instance ?wave (DeleteNodes $?a $?c)))))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-advance::DeleteElementFromWavefront
         (declare (salience 180))
         ?wave <- (object (is-a Wavefront)
                          (id ?id)
                          (parent ?r)
                          (DeleteNodes ?a $?rest))
         (object (is-a Diplomat)
                 (id ?a)
                 (NextPathElements $?npe))
         =>
         ;TODO: Continue to port here
         (object-pattern-match-delay
           (bind ?ind (member$ ?a (send ?wave get-values)))
           (bind ?ind2 (member$ ?a (send ?wave get-Closed)))
           (modify-instance ?wave (DeleteNodes $?rest))
           (if ?ind then (slot-delete$ ?wave values ?ind ?ind))
           (if ?ind2 then (slot-delete$ ?wave Closed ?ind2 ?ind2))
           (assert (message (to wavefront-scheduling)
                            (action add-blocks-into)
                            (arguments ?id => $?npe)))))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-advance-end::PutSuccessorsOntoWavefront-Match
         ?fct <- (message (to wavefront-scheduling)
                          (action add-blocks-into)
                          (arguments ?id => ?next $?rest))
         ?wave <- (object (is-a Wavefront)
                          (id ?id)
                          (values $?contents))
         =>
         (modify ?fct (arguments ?id => $?rest))
         (if (not (member$ ?next $?contents)) then
           (modify-instance ?wave (contents $?contents ?next))))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-advance-end::PutSuccessorsOntoWavefront-NoMoreElements
         ?fct <- (message (to wavefront-scheduling)
                          (action add-blocks-into)
                          (arguments ?id =>))
         =>
         (retract ?fct))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-update::PonderRestartOfWavefrontScheduling
         ?fct <- (message (to wavefront-scheduling-update)
                          (from pipeline)
                          (action initial-fact))
         ?obj <- (object (is-a pass-description)
                         (passes $?passes))
         =>
         (retract ?fct)
         (bind ?instances (find-all-instances ((?wave Wavefront))
                                              (> (length$ ?wave:values) 0)))
         (if (> (length$ ?instances) 0) then
           (modify-instance ?obj
                            (passes wavefront-scheduling-init
                                    wavefront-scheduling-identify
                                    wavefront-scheduling-phi-identify
                                    wavefront-scheduling-phi-node
                                    wavefront-scheduling-phi-node-update
                                    wavefront-scheduling-pathing
                                    wavefront-scheduling-strip
                                    wavefront-scheduling-inject
                                    wavefront-scheduling-acquire
                                    wavefront-scheduling-slice
                                    wavefront-scheduling-analyze-init
                                    wavefront-scheduling-pre-generate-analyze
                                    wavefront-scheduling-generate-analyze
                                    wavefront-scheduling-analyze
                                    wavefront-scheduling-slice-analyze
                                    wavefront-scheduling-merge-init
                                    wavefront-scheduling-merge
                                    wavefront-scheduling-merge-update
                                    wavefront-scheduling-reopen-blocks
                                    wavefront-scheduling-ponder
                                    wavefront-scheduling-post-ponder
                                    wavefront-scheduling-rename
                                    wavefront-scheduling-dependency-analysis
                                    wavefront-scheduling-advance-init
                                    wavefront-scheduling-advance-identify
                                    wavefront-scheduling-advance
                                    wavefront-scheduling-advance-end
                                    wavefront-scheduling-update
                                    $?passes))))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-final::RetractUnlinkedInstructions
         ?bb <- (object (is-a BasicBlock)
                        (id ?b)
                        (UnlinkedInstructions ?i $?rest))
         ?instruction <- (object (is-a Instruction)
                                 (id ?i)
                                 (parent ?b)
                                 (pointer ?ptr))
         (object (is-a PathAggregate)
                 (parent ?b)
                 (InstructionPropagation $? ?i ?new ?b ! $?))
         (object (is-a Instruction)
                 (id ?new)
                 (pointer ?nPtr))
         =>
         ;this is a little gross but it is a very easy way to ensure that
         ;things work correctly so that the LLVM ModuleVerifier doesn't come
         ;down like a hammer on what we're doing
         (object-pattern-match-delay
           (llvm-replace-all-uses ?ptr ?nPtr)
           (modify-instance ?bb (UnlinkedInstructions $?rest))
           (llvm-unlink-and-delete-instruction ?ptr)
           (unmake-instance ?instruction)))
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
;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 wavefront-scheduling-advance-init::MoveContentsToDeleteNodes
         "Moves blocks out of the contents into the closed list"
         (declare (salience 2701))
         ?wave <- (object (is-a Wavefront)
                          (id ?z)
                          (parent ?r)
                          (values $?c)
                          (Closed $?cl))
         (test (or (> (length$ ?c) 0)
                   (> (length$ ?cl) 0)))
         =>
         (slot-insert$ ?wave DeleteNodes 1 ?c ?cl))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-advance-identify::MarkShouldStayOnWavefront
         (declare (salience 343))
         ?wave <- (object (is-a Wavefront)
                          (id ?q)
                          (parent ?r)
                          (DeleteNodes $?a ?b $?c)
                          (Closed $?clos)
                          (values $?contents))

         ?bb <- (object (is-a Diplomat)
                        (id ?b)
                        (NextPathElements ?s))
         (object (is-a Diplomat)
                 (id ?s)
                 (PreviousPathElements $?ppe))
         (test (not (subsetp ?ppe (create$ ?a ?b ?c))))
         ?agObj <- (object (is-a PathAggregate)
                           (parent ?b))
         =>
         (object-pattern-match-delay
           (if (not (member$ ?b $?clos)) then
             (bind ?ind (member$ ?b $?contents))
             (slot-delete$ ?wave Contents ?ind ?ind)
             (modify-instance ?wave (Closed $?clos ?b)
                              (DeleteNodes $?a $?c))
             else
             (modify-instance ?wave (DeleteNodes $?a $?c)))))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-advance::DeleteElementFromWavefront
         (declare (salience 180))
         ?wave <- (object (is-a Wavefront)
                          (id ?id)
                          (parent ?r)
                          (DeleteNodes ?a $?rest))
         (object (is-a Diplomat)
                 (id ?a)
                 (NextPathElements $?npe))
         =>
         ;TODO: Continue to port here
         (object-pattern-match-delay
           (bind ?ind (member$ ?a (send ?wave get-Contents)))
           (bind ?ind2 (member$ ?a (send ?wave get-Closed)))
           (modify-instance ?wave (DeleteNodes $?rest))
           (if ?ind then (slot-delete$ ?wave Contents ?ind ?ind))
           (if ?ind2 then (slot-delete$ ?wave Closed ?ind2 ?ind2))
           (assert (message (to wavefront-scheduling)
                            (action add-blocks-into)
                            (arguments ?id => $?npe)))))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-advance-end::PutSuccessorsOntoWavefront-Match
         ?fct <- (message (to wavefront-scheduling)
                          (action add-blocks-into)
                          (arguments ?id => ?next $?rest))
         ?wave <- (object (is-a Wavefront)
                          (id ?id)
                          (values $?contents))
         =>
         (modify ?fct (arguments ?id => $?rest))
         (if (not (member$ ?next $?contents)) then
           (modify-instance ?wave (contents $?contents ?next))))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-advance-end::PutSuccessorsOntoWavefront-NoMoreElements
         ?fct <- (message (to wavefront-scheduling)
                          (action add-blocks-into)
                          (arguments ?id =>))
         =>
         (retract ?fct))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-update::PonderRestartOfWavefrontScheduling
         ?fct <- (message (to wavefront-scheduling-update)
                          (from pipeline)
                          (action initial-fact))
         ?obj <- (object (is-a pass-description)
                         (passes $?passes))
         =>
         (retract ?fct)
         (bind ?instances (find-all-instances ((?wave Wavefront))
                                              (> (length$ ?wave:values) 0)))
         (if (> (length$ ?instances) 0) then
           (modify-instance ?obj
                            (passes wavefront-scheduling-init
                                    wavefront-scheduling-identify
                                    wavefront-scheduling-phi-identify
                                    wavefront-scheduling-phi-node
                                    wavefront-scheduling-phi-node-update
                                    wavefront-scheduling-pathing
                                    wavefront-scheduling-strip
                                    wavefront-scheduling-inject
                                    wavefront-scheduling-acquire
                                    wavefront-scheduling-slice
                                    wavefront-scheduling-analyze-init
                                    wavefront-scheduling-pre-generate-analyze
                                    wavefront-scheduling-generate-analyze
                                    wavefront-scheduling-analyze
                                    wavefront-scheduling-slice-analyze
                                    wavefront-scheduling-merge-init
                                    wavefront-scheduling-merge
                                    wavefront-scheduling-merge-update
                                    wavefront-scheduling-reopen-blocks
                                    wavefront-scheduling-ponder
                                    wavefront-scheduling-post-ponder
                                    wavefront-scheduling-rename
                                    wavefront-scheduling-dependency-analysis
                                    wavefront-scheduling-advance-init
                                    wavefront-scheduling-advance-identify
                                    wavefront-scheduling-advance
                                    wavefront-scheduling-advance-end
                                    wavefront-scheduling-update
                                    $?passes))))
;------------------------------------------------------------------------------
(defrule wavefront-scheduling-final::RetractUnlinkedInstructions
         ?bb <- (object (is-a BasicBlock)
                        (id ?b)
                        (UnlinkedInstructions ?i $?rest))
         ?instruction <- (object (is-a Instruction)
                                 (id ?i)
                                 (parent ?b)
                                 (pointer ?ptr))
         (object (is-a PathAggregate)
                 (parent ?b)
                 (InstructionPropagation $? ?i ?new ?b ! $?))
         (object (is-a Instruction)
                 (id ?new)
                 (pointer ?nPtr))
         =>
         ;this is a little gross but it is a very easy way to ensure that
         ;things work correctly so that the LLVM ModuleVerifier doesn't come
         ;down like a hammer on what we're doing
         (object-pattern-match-delay
           (llvm-replace-all-uses ?ptr ?nPtr)
           (modify-instance ?bb (UnlinkedInstructions $?rest))
           (llvm-unlink-and-delete-instruction ?ptr)
           (unmake-instance ?instruction)))
;------------------------------------------------------------------------------


Added RunConverter.clp

Added RunConverter.clp

It is a file that runs the GLConstantConversion expert system on
/usr/include/GL/gl.h

;------------------------------------------------------------------------------
;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)
(batch* GLConstantConversion.clp)
(reset)
(assert (parse constant file "/usr/include/GL/gl.h"))
(run)
(exit)

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