Modified the Pass class to register and load the target pass on init

;------------------------------------------------------------------------------
;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.
;------------------------------------------------------------------------------
; Pass.clp - Pass types that interact with LibIndirect
;------------------------------------------------------------------------------
(defclass indirect::PassBase
  "The base class of all passes (native or indirect)"
  (is-a Object)
  (slot pass-name (type SYMBOL STRING) (visibility public))
  (slot pass-description (type STRING) (visibility public)))
;------------------------------------------------------------------------------
(defclass indirect::NativePass
  "A wrapper over a native LLVM pass"
  (is-a PassBase)
  (role concrete)
  (pattern-match reactive))
;------------------------------------------------------------------------------
(defclass indirect::Pass
  "Represents an indirect pass that uses LibIndirect to interact with LLVM"
  (is-a PassBase)
  (role concrete)
  (pattern-match reactive)
  (slot pass-type (type SYMBOL) (allowed-symbols Unknown Module Function Region
																 Loop BasicBlock CallGraphSCC MachineFunction))
  (slot is-analysis (type SYMBOL) (allowed-symbols FALSE TRUE))
  (slot is-cfg (type SYMBOL) (allowed-symbols FALSE TRUE))
  (slot need-loops (type SYMBOL) (allowed-symbols FALSE TRUE))
  (slot need-regions (type SYMBOL) (allowed-symbols FALSE TRUE))
  (slot preserves-all (type SYMBOL) (allowed-symbols FALSE TRUE))
  (slot preserves-cfg (type SYMBOL) (allowed-symbols FALSE TRUE))
  (multislot passes (type SYMBOL))
  (multislot required (type SYMBOL))
  (multislot required-transitive (type SYMBOL))
  (multislot preserved (type SYMBOL))
  ;begin CLIPS specific slots
  (slot entry-point (type STRING))
  (message-handler register)
  (message-handler unregister)
  (message-handler is-registered))
;------------------------------------------------------------------------------
(defmessage-handler indirect::Pass init around ()
						  (call-next-handler)
						  ;automatically load the code if there is an entry point
						  (if (and (< (str-length ?self:entry-point) 0)
									  (not (defmodule-exists ?self:pass-name))) then
							 (batch* ?self:entry-point))
						  (if (not (is-registered ?self:pass-name)) then
							 (register-pass ?self:pass-name
												 ?self:pass-description
												 ?self:pass-type
												 ?self:is-analysis
												 ?self:is-cfg
												 ?self:need-regions
												 ?self:need-loops
												 ?self:passes
												 ?self:required
												 ?self:required-transitive
												 ?self:preserved
												 ?self:preserves-all
												 ?self:preserves-cfg)))
;------------------------------------------------------------------------------
(defmessage-handler indirect::Pass register ()
						  (if (not (is-registered ?self:pass-name)) then
							 (register-pass ?self:pass-name
												 ?self:pass-description
												 ?self:pass-type
												 ?self:is-analysis
												 ?self:is-cfg
												 ?self:need-regions
												 ?self:need-loops
												 ?self:passes
												 ?self:required
												 ?self:required-transitive
												 ?self:preserved
												 ?self:preserves-all
												 ?self:preserves-cfg)
							 (return TRUE)
							 else
							 (printout werror "ERROR: pass already registered" crlf)
							 (return FALSE)))

;------------------------------------------------------------------------------
(defmessage-handler indirect::Pass unregister ()
						  (unregister-pass ?self:pass-name))
;------------------------------------------------------------------------------
(defmessage-handler indirect::Pass is-registered ()
						  (pass-registered ?self:pass-name))
;------------------------------------------------------------------------------

;------------------------------------------------------------------------------
;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.
;------------------------------------------------------------------------------
; Pass.clp - Pass types that interact with LibIndirect
;------------------------------------------------------------------------------
(defclass indirect::PassBase
  "The base class of all passes (native or indirect)"
  (is-a Object)
  (slot pass-name (type SYMBOL STRING) (visibility public))
  (slot pass-description (type STRING) (visibility public)))
;------------------------------------------------------------------------------
(defclass indirect::NativePass
  "A wrapper over a native LLVM pass"
  (is-a PassBase)
  (role concrete)
  (pattern-match reactive))
;------------------------------------------------------------------------------
(defclass indirect::Pass
  "Represents an indirect pass that uses LibIndirect to interact with LLVM"
  (is-a PassBase)
  (role concrete)
  (pattern-match reactive)
  (slot pass-type (type SYMBOL) (allowed-symbols Unknown Module Function Region
																 Loop BasicBlock CallGraphSCC MachineFunction))
  (slot is-analysis (type SYMBOL) (allowed-symbols FALSE TRUE))
  (slot is-cfg (type SYMBOL) (allowed-symbols FALSE TRUE))
  (slot need-loops (type SYMBOL) (allowed-symbols FALSE TRUE))
  (slot need-regions (type SYMBOL) (allowed-symbols FALSE TRUE))
  (slot preserves-all (type SYMBOL) (allowed-symbols FALSE TRUE))
  (slot preserves-cfg (type SYMBOL) (allowed-symbols FALSE TRUE))
  (multislot passes (type SYMBOL))
  (multislot required (type SYMBOL))
  (multislot required-transitive (type SYMBOL))
  (multislot preserved (type SYMBOL))
  ;begin CLIPS specific slots
  (slot entry-point (type STRING))
  (message-handler register)
  (message-handler unregister)
  (message-handler is-registered))
;------------------------------------------------------------------------------
(defmessage-handler indirect::Pass register ()
						  (register-pass ?self:pass-name
											  ?self:pass-description
											  ?self:pass-type
											  ?self:is-analysis
											  ?self:is-cfg
											  ?self:need-regions
											  ?self:need-loops
											  ?self:passes
											  ?self:required
											  ?self:required-transitive
											  ?self:preserved
											  ?self:preserves-all
											  ?self:preserves-cfg))
;------------------------------------------------------------------------------
(defmessage-handler indirect::Pass unregister ()
						  (unregister-pass ?self:pass-name))
;------------------------------------------------------------------------------
(defmessage-handler indirect::Pass is-registered ()
						  (pass-registered ?self:pass-name))
;------------------------------------------------------------------------------


Added the reset-run-exit chunk

Added the reset-run-exit chunk

;------------------------------------------------------------------------------
;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.
;------------------------------------------------------------------------------
; reset-run-exit.clp - Calls reset, run, and then exits. This is useful for
;                      expert systems that are meant to run and then exit
;
; Obviously, this prevent shell access.
;------------------------------------------------------------------------------
(reset)
(run)
(exit)

error: pathspec 'sys/chunks/reset-run-exit.clp' did not match any file(s) known to git


bugfix

bugfix

#include <csp>.

&dom{N..N}              = ordered(O,A,0) :- init(object(order,O),   value(line,(A,N))).
&dom{0..ordered(O,A,0)} = ordered(O,A,T) :- ordered(O,A), time(T).
&dom{N..N}              = shelved(S,A,0) :- init(object(product,A), value(on,  (S,N))).
&dom{0..shelved(S,A,0)} = shelved(S,A,T) :- shelved(S,A), time(T).

&dom{0..ordered(O,A,0)} = process(A,O,S,T) :- ordered(O,A), shelved(S,A), time(T).

{ process(A,O,S,T) : ordered(O,A), shelved(S,A) } 1 :- time(T). % process one article at a time at one processing station (via order)

:- process(_,O,_,T), target(O,P), not serves(_,P,T).
:- process(A,O,S,T), target(O,P),     serves(R,P,T), not carries(R,S,T).
:- process(A,O,S,T), &sum{ shelved(S,A,T-1); -process(A,O,S,T) } < 0.

:-     process(A,O,S,T), shelved(S,A),               &sum{ shelved(S,A,T-1); -shelved(S,A,T); -process(A,O,S,T) } != 0.
:-     process(A,O,S,T),               ordered(O,A), &sum{ ordered(O,A,T-1); -ordered(O,A,T); -process(A,O,S,T) } != 0.
:-     process(A,O,S,T),                             &sum{                                     process(A,O,S,T) }  = 0.

:- not process(A,_,S,T), shelved(S,A),               &sum{ shelved(S,A,T-1); -shelved(S,A,T)                    } != 0, time(T).
:- not process(A,O,_,T),               ordered(O,A), &sum{ ordered(O,A,T-1); -ordered(O,A,T)                    } != 0, time(T). % >>> REPORT MAX!!! <<<
:- not process(A,O,S,T), shelved(S,A), ordered(O,A), &sum{                                     process(A,O,S,T) } != 0, time(T).

%*
:-                    shelved(S,A),               &sum{ shelved(S,A,T-1); -shelved(S,A,T)                         }  < 0, time(T).
:-                                  ordered(O,A), &sum{ ordered(O,A,T-1); -ordered(O,A,T)                         }  < 0, time(T).
*%

#include <csp>.

&dom{N..N}              = ordered(O,A,0) :- init(object(order,O),   value(line,(A,N))).
&dom{0..ordered(O,A,0)} = ordered(O,A,T) :- time(T).
&dom{N..N}              = shelved(S,A,0) :- init(object(product,A), value(on,  (S,N))).
&dom{0..shelved(S,A,0)} = shelved(S,A,T) :- time(T).

&dom{0..N}              =  process(A,O,S,T) :- ordered(O,A,number(N)), shelved(S,A), time(T).

{ process(A,O,S,T) : ordered(O,A), shelved(S,A) } 1 :- time(T). % process one article at a time at one processing station (via order)

:- process(_,O,_,T), target(O,P), not serves(_,P,T).
:- process(A,O,S,T), target(O,P),     serves(R,P,T), not carries(R,S,T).
:- process(A,O,S,T), &sum{ shelved(S,A,T-1); -process(A,O,S,T) } < 0.

:-     process(A,O,S,T), shelved(S,A),               &sum{ shelved(S,A,T-1); -shelved(S,A,T); -process(A,O,S,T) } != 0.
:-     process(A,O,S,T),               ordered(O,A), &sum{ ordered(O,A,T-1); -ordered(O,A,T); -process(A,O,S,T) } != 0.
:-     process(A,O,S,T),                             &sum{                                     process(A,O,S,T) }  = 0.

:- not process(A,_,S,T), shelved(S,A),               &sum{ shelved(S,A,T-1); -shelved(S,A,T)                    } != 0, time(T).
:- not process(A,O,_,T),               ordered(O,A), &sum{ ordered(O,A,T-1); -ordered(O,A,T)                    } != 0, time(T). % >>> REPORT MAX!!! <<<
:- not process(A,O,S,T), shelved(S,A), ordered(O,A), &sum{                                     process(A,O,S,T) } != 0, time(T).

%*
:-                    shelved(S,A),               &sum{ shelved(S,A,T-1); -shelved(S,A,T)                         }  < 0, time(T).
:-                                  ordered(O,A), &sum{ ordered(O,A,T-1); -ordered(O,A,T)                         }  < 0, time(T).
*%


src/lib/cortex/core/Loader.clp: Added a batch* operation for Message.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 all files in the core folder
;------------------------------------------------------------------------------
(batch* "src/lib/cortex/core/Object.clp")
(batch* "src/lib/cortex/core/Message.clp")
(batch* "src/lib/cortex/core/ObjectConversionFunctions.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 all files in the core folder
;------------------------------------------------------------------------------
(batch* "core/Object.clp")
(batch* "core/ObjectConversionFunctions.clp")


Added LLVMType.clp

Added LLVMType.clp

It contains all of the LLVMType classes.

;------------------------------------------------------------------------------
;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.
;------------------------------------------------------------------------------
(defclass llvm::LLVMType (is-a llvm::LLVMObject)
  (slot IsVoidType (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsHalfType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsFloatType (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsDoubleType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsX86FP80Type  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsFP128Type  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsPPCFP128Type  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsFloatingPointType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsX86MMXType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsFPOrFPVectorType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsLabelType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsMetadataType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsIntegerType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsIntOrIntVectorType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsFunctionType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsStructType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsArrayType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsPointerType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsVectorType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsEmptyType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsPrimitiveType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsDerivedType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsFirstClassType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsSingleValueType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsAggregateType  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot IsSized  (type SYMBOL) (allowed-values FALSE TRUE))
  (slot PrimitiveSizeInBits (type NUMBER) (range 0 ?VARIABLE))
  (slot ScalarSizeInBits (type NUMBER) (range 0 ?VARIABLE))
  (slot FPMantissaWidth (type NUMBER) (range 0 ?VARIABLE))
  (slot ScalarType (allowed-classes LLVMType))
  (multislot Subtypes)
  (multislot TypeMakeup (type SYMBOL))
  (slot IsFunctionVarArg (type SYMBOL) (allowed-values FALSE TRUE))
  (slot QuickType (type SYMBOL)))
;------------------------------------------------------------------------------
(defclass llvm::IntegerType (is-a llvm::LLVMType)
 (slot BitWidth (type NUMBER) (range 0 ?VARIABLE))
 (slot BitMask (type NUMBER))
 (slot SignBit (type NUMBER))
 (slot IsPowerOf2ByteWidth (type SYMBOL) (allowed-values FALSE TRUE)))
;------------------------------------------------------------------------------
(defclass llvm::FunctionType (is-a llvm::LLVMType)
 (slot IsVarArg (type SYMBOL) (allowed-values FALSE TRUE))
 (slot ReturnType (allowed-classes LLVMType))
 (multislot Parameters))
;------------------------------------------------------------------------------
(defmessage-handler llvm::FunctionType get-num-params primary
 ()
 (length$ ?self:Parameters))
;------------------------------------------------------------------------------
(defmessage-handler llvm::FunctionType get-param-type primary
 (?index)
 (nth$ ?index ?self:Parameters))
;------------------------------------------------------------------------------
(defclass llvm::CompositeType (is-a llvm::LLVMType)
 (multislot Indicies))
;------------------------------------------------------------------------------
(defclass llvm::StructType (is-a llvm::CompositeType)
 (slot Name (type SYMBOL))
 (slot IsPacked (type SYMBOL) (allowed-values FALSE TRUE))
 (slot IsLiteral (type SYMBOL) (allowed-values FALSE TRUE))
 (slot IsOpaque (type SYMBOL) (allowed-values FALSE TRUE))
 (slot IsSized (type SYMBOL) (allowed-values FALSE TRUE))
 (slot HasName (type SYMBOL) (allowed-values FALSE TRUE))
 (multislot Body))
;------------------------------------------------------------------------------
(defmessage-handler llvm::StructType set-body primary
 (?element ?isPacked)
 (bind ?self:IsPacked ?isPacked)
 (bind ?self:Body ?element))
;------------------------------------------------------------------------------
(defmessage-handler llvm::StructType get-num-elements
 ()
 (length$ ?self:Body))
;------------------------------------------------------------------------------
(defmessage-handler llvm::StructType get-element-type
 (?n)
 (nth$ ?n ?self:Body))
;------------------------------------------------------------------------------
(defclass llvm::SequentialType (is-a llvm::CompositeType)
 (slot ElementType (allowed-classes LLVMType)))
;------------------------------------------------------------------------------
(defclass llvm::VectorType (is-a llvm::SequentialType)
 (slot BitWidth (type NUMBER) (range 0 ?VARIABLE))
 (slot NumElements (type NUMBER) (range 0 ?VARIABLE)))
;------------------------------------------------------------------------------
(defclass llvm::PointerType (is-a llvm::SequentialType)
 (slot AddressSpace (type NUMBER) (range 0 ?VARIABLE)))
;------------------------------------------------------------------------------
(defclass llvm::ArrayType (is-a llvm::SequentialType)
 (slot NumElements (type NUMBER) (range 0 ?VARIABLE)))
;------------------------------------------------------------------------------

error: pathspec 'modules/llvm/LLVMType.clp' did not match any file(s) known to git


Added the possibility to cancel timers.

Added the possibility to cancel timers.

-> When a BB_timer fact is received and the use deleted the timer_sent fact, then the BB_timer is deleted as well
    in a rule with salience of 10000, never reaching the planning rules.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;			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 str-replace
	(?str ?old ?new)
	(bind ?len (str-length ?old))
	(bind ?pos (str-index ?old ?str))
	(while (neq ?pos FALSE) do
		(bind ?str_len (str-length ?str))
		(bind ?str
			(str-cat
				(sub-string 1 (- ?pos 1) ?str)
				?new
				(sub-string (+ ?pos ?len) ?str_len ?str)
			)
		)
		(bind ?pos (str-index ?old ?str))
	)
	(return ?str)
)

(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 -9501))
	?t <-(BB_timer $?)
	=>
	(retract ?t)
)

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

(defrule delete_timer
	(declare (salience 10000))
	?t <-(BB_timer ?sym)
	(not (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 stop
	()
	(log-message WARNING "Stop function called. EXECUTION HALTED.")
	(python-call stop)
	(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 str-replace
	(?str ?old ?new)
	(bind ?len (str-length ?old))
	(bind ?pos (str-index ?old ?str))
	(while (neq ?pos FALSE) do
		(bind ?str_len (str-length ?str))
		(bind ?str
			(str-cat
				(sub-string 1 (- ?pos 1) ?str)
				?new
				(sub-string (+ ?pos ?len) ?str_len ?str)
			)
		)
		(bind ?pos (str-index ?old ?str))
	)
	(return ?str)
)

(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 -9501))
	?t <-(BB_timer $?)
	=>
	(retract ?t)
)

(defrule delete_timer_sent
	(declare (salience 10000))
	(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 stop
	()
	(log-message WARNING "Stop function called. EXECUTION HALTED.")
	(python-call stop)
	(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)
)