Using the VB. Interface DLLs to CLIPS.DLL

To use the CLIPS HLL (High Level Language), interface you need actually two components: the CLIPS.DLL, (32 bit) or CLIPSDLL.DLL, (16 bit) and the interface DLL - CLIPSHLL.DLL, (32 bit) or CLPVBDLL.DLL, (16 bit). The interface DLL simply provides a handy, way to access the common CLIPS functions. The CLIPS DLL is built with a C (__cdecl exports) interface and the interface DLL exports its functions as WINAPI (__stdcall), thus making it easier for some High Level languages to interface to the CLIPS engine. It additionally provides some encapsulation, allow for easier access to items such as routes within CLIPS. Does this provide as much functionality and flexibility as the CLIPS OCX (for example) or as writing your own custom interface to CLIPS? No, but this is quick, dirty and free (your satisfaction guaranteed or your money back, how about that :). If you need more functionality or flexibility, look at one of the other options. Both myself and Mike Giordano maintain the code for this on an 'as we get time to' basis.
 

Note!

You must have JavaScript enabled for these web pages to function properly.

EXPORTS:

Attribute VB_Name = "HLLDECL"
' these are the function declarations for the clips-HLL_
' interface DLL. Note that some are functions and others
' are sub-routines. All Parameters are by value
' ######################################################
'   when the parameter route is used, it refers to a CLIPS i/o route
'   valid values for route:
'       "wdisplay"
'       "stdout"
'       "werror"
'       "wwarning"
'       "wdialog"
'       "wagenda"
'       "wtrace"
'--------------------------------------------------------
' All of the Instance functions use the concept of a "current" instance
' internally the CLIPSHLL is maintaining a pointer to what it thinks is the
' current instance of a given object. Thus slot accessors will attempt to
' operate on this "current" instance, to change the current instance you would
' use the find instance function.
'--------------------------------------------------------
' ******************************************************
' Declare Function HLL_GETROUTESTRING Lib "CLIPSHLL.DLL" (ByVal route As String, 
'                                                         ByVal Routelength As Integer, 
'                                                         ByVal Buffer As String, 
'                                                         ByVal BufLength As Integer) As Integer
'   Parameters:
'       route       : captured CLIPS route to read
'       RouteLength : Length of the name of the router (i.e. For "stdout" this parameter is 6)
'       Buffer      : string to store result in
'       BufLength   : maximum length of return string
'   return values:
'       -5  route name is invalid
'       -4  route string is NULL or not set to valid length
'       -3  HLL_SETROUTE not yet called on this route name
'       -2  output Buffer is not valid for specified length
'       -1  End of route buffer was reached, resetting to beginning again
'       #   of bytes copied into the return parameter buffer
'   Comments:   retrieve the next availible string value from a captured route
'               buffer.
Declare Function HLL_GETROUTESTRING Lib "CLIPSHLL.DLL" (ByVal route As String, _
                                                        ByVal Routelength As Integer, _
                                                        ByVal Buffer As String, _
                                                        ByVal BufLength As Integer) As Integer _
' ******************************************************
' Declare Function HLL_GETNUMBEROFFACTS Lib "CLIPSHLL.DLL" () As Long
'   Parameters: None
'   return values:
'       -1  :call failed
'       #   :number of facts in CLIPS
'   Comments:   retrieve number of facts in the CLIPS environment
Declare Function HLL_GETNUMBEROFFACTS Lib "CLIPSHLL.DLL" () As Long
' ******************************************************
' Declare Function HLL_RUN Lib "CLIPSHLL.DLL" (ByVal Iterations As Long) As Long
'   Parameters:
'       Iterations  :number of iterations to run, -1 means run to completion
'   return values:
'       -1  :call failed
'       #   :number of iterations that CLIPS ran
'   Comments:   calls CLIPS Run() function - allows CLIPS rules to fire
Declare Function HLL_RUN Lib "CLIPSHLL.DLL" (ByVal Iterations As Long) As Long
' ******************************************************
' Declare Function HLL_NEXTFACTSTRING Lib "CLIPSHLL.DLL" (ByVal Buffer As String, 
'                                                       ByVal length As Integer) As Integer
'   Parameters:
'       Buffer  :string to hold return value
'       Length  :maximum length of return string
'   return values:
'       -2   :string buffer not valid to length specified
'       -1   :call to GetNextFact() failed, (no more facts?)
'        #   :Number of bytes written to dest buffer
'   Comments:   read the next fact from the CLIPS env. and place it into a string
'               buffer, (this will be the PPFact form of the fact).
Declare Function HLL_NEXTFACTSTRING Lib "CLIPSHLL.DLL" (ByVal Buffer As String, _
                                                        ByVal length As Integer) As Integer
' ******************************************************
' Declare Function HLL_LOAD Lib "CLIPSHLL.DLL" (ByVal FileName As String,
'                                               ByVal FileNameLen as integer) As Integer
'   Parameters:
'       FileName    :string containing full filename/path of CLP file to load
'       FileNameLen :Length of the File Name. (i.e. For the file c:\rules.clp this paramter is 12)
'   return values:
'       -2  :bad filename
'       -1  :string buffer containing filename is no valid
'       0   :load failed
'       1   :Parse Failed
'       2   :Load OK
'       3   :Bad Load name
'       4   :Init not called (should never happen in HLL_)
'   Comments:   load a CLP file from disk into CLIPS
Declare Function HLL_LOAD Lib "CLIPSHLL.DLL" (ByVal FileName As String, _
                                              ByVal FileNameLen As Integer) As Integer
' ******************************************************
' Declare Function HLL_BLOAD Lib "CLIPSHLL.DLL" (ByVal FileName As String, 
'                                                ByVal FileNameLen As Integer) As Integer
'   Parameters:
'       FileName    :string containing full filename/path of CLP file to Bload
'       FileNameLen :Length of the File Name. (i.e. For the file c:\rules.bin this paramter is 12)
'   return values:
'       -2  :bad filename
'       -1  :string buffer containing filename is not valid
'       0   :load failed
'       1   :load OK
'   Comments:   Binary load of saved constructs, (requires a BSave first)
Declare Function HLL_BLOAD Lib "CLIPSHLL.DLL" (ByVal FileName As String, _ 
                                               ByVal FileNameLen As Integer) As Integer
' ******************************************************
' Declare Function HLL_BSAVE Lib "CLIPSHLL.DLL" (ByVal FileName As String, 
'                                                ByVal FileNameLen As Integer) As Integer
'   Parameters:
'       FileName    :string containing full filename/path of CLP file to BSave
'       FileNameLen :Length of the File Name. (i.e. For the file c:\rules.bin this paramter is 12)
'   return values:
'       -2  :bad filename
'       -1  :string buffer containing filename is not valid
'       0   :save failed
'       1   :save OK
'   Comments:   Binary save of CLIPS constructs
Declare Function HLL_BSAVE Lib "CLIPSHLL.DLL" (ByVal FileName As String, _
                                               ByVal FileNameLen As Integer) As Integer
' ******************************************************
' Declare Function HLL_RETRACTFACT Lib "CLIPSHLL.DLL" (ByVal Buffer As String, 
'                                                      ByVal Bufferlen As Integer) As Integer
'   Parameters:
'       Buffer      :string containing fact to be retracted
'       Bufferlen   :Length of the string to be retracted. (i.e. For (Monkey CuriousGeorge) this parameter is 22)
'   return values:
'       -2  :specified fact did not exist, (syntax must be *exact*)
'       -1  :Buffer parameter is NULL
'        0  :retraction failed
'        1  :fact successfully retracted
'   Comments:   retracts a fact from CLIPS
Declare Function HLL_RETRACTFACT Lib "CLIPSHLL.DLL" (ByVal Buffer As String, _
                                                     ByVal Bufferlen As Integer) As Integer
' ******************************************************
' Declare Function HLL_ASSERTFACT Lib "CLIPSHLL.DLL" (ByVal Buffer As String, 
'                                                     ByVal Bufferlen As Integer) As Integer
'   Parameters:
'       Buffer      :string containing fact to be asserted
'       Bufferlen   :Length of the string to be asserted. (i.e. For (Monkey CuriousGeorge) this parameter is 22)
'   return values:
'       -1  :Buffer parameter is NULL
'        0  :assertion failed
'        1  :assertion complete
'   Comments:   Asserts a fact to CLIPS
Declare Function HLL_ASSERTFACT Lib "CLIPSHLL.DLL" (ByVal Buffer As String, _
                                                    ByVal Bufferlen As Integer) As Integer
' ******************************************************
' Declare Function HLL_SAVEFACTS Lib "CLIPSHLL.DLL" (ByVal Buffer As String, 
'                                                    ByVal Bufferlen As Integer) As Integer
'   Parameters:
'       Buffer  :string containing full filename/path of save file
'   return values:
'       -2  :bad filename
'       -1  :string buffer containing filename is not valid
'       0   :save failed
'       1   :save OK
'   Comments:   Save current facts from CLIPS to disk
Declare Function HLL_SAVEFACTS Lib "CLIPSHLL.DLL" (ByVal Buffer As String, _
                                                   ByVal Bufferlen As Integer) As Integer
' ******************************************************
' Declare Function HLL_LOADFACTS Lib "CLIPSHLL.DLL" (ByVal Buffer As String, 
'                                                    ByVal Bufferlen As Integer) As Integer
'   Parameters:
'       Buffer      :string containing full filename/path of fact file to load
'       BufferLen   :Length of the File Name. (i.e. For the file c:\rules.fct this paramter is 12)
'   return values:
'       -2  :bad filename
'       -1  :string buffer containing filename is not valid
'       0   :load failed
'       1   :load OK
'   Comments:   Load a saved fact file into CLIPS
Declare Function HLL_LOADFACTS Lib "CLIPSHLL.DLL" (ByVal Buffer As String, _
                                                   ByVal Bufferlen As Integer) As Integer
' ******************************************************
' Declare Function HLL_CLIPSBATCH Lib "CLIPSHLL.DLL" (ByVal Buffer As String, 
'                                                     ByVal Bufferlen As Integer) As Integer
'   Parameters:
'       Buffer      :string containing full filename/path of batch file to load
'       BufferLen   :Length of the File Name. (i.e. For the file c:\rules.fct this paramter is 12)
'   return values:
'       -1  :Buffer parameter is NULL
'        0  :batch run failed
'        1  :batch run OK
'   Comments:   load and execute a CLIPS batch file
Declare Function HLL_CLIPSBATCH Lib "CLIPSHLL.DLL" (ByVal Buffer As String, _
                                                    ByVal Bufferlen As Integer) As Integer
' ******************************************************
' Declare Function HLL_SETGLOBALINT Lib "CLIPSHLL.DLL" (ByVal defglobal As String, 
'                                                       ByVal defgloballen As Integer, 
'                                                       ByVal Value As Integer) As Integer
'   Parameters:
'       defglobal       :string containing defglobal name
'       defgloballen    :Length of the string containing the defglobal name
'       value           :integer value to assign
'   return values:
'       -1  :defglobal parameter is NULL
'        0  :call failed, (perhaps the format is incorrect)
'        1  :success
'   Comments:   set a defglobal integer value
Declare Function HLL_SETGLOBALINT Lib "CLIPSHLL.DLL" (ByVal defglobal As String, _
                                                      ByVal defgloballen As Integer, _
                                                      ByVal Value As Integer) As Integer
' ******************************************************
' Declare Function HLL_SETGLOBALFLOAT Lib "CLIPSHLL.DLL" (ByVal defglobal As String, 
'                                                         ByVal defgloballen As Integer, 
'                                                         ByVal Value As Single) As Integer
'   Parameters:
'       defglobal       :string containing defglobal name
'       defgloballen    :Length of the string containing the defglobal name
'       value           :floating point value to assign
'   return values:
'       -1  :defglobal parameter is NULL
'        0  :call failed, (perhaps the format is incorrect)
'        1  :success
'   Comments:   set a defglobal float value
Declare Function HLL_SETGLOBALFLOAT Lib "CLIPSHLL.DLL" (ByVal defglobal As String, _
                                                        ByVal defgloballen As Integer, _
                                                        ByVal Value As Single) As Integer
' ******************************************************
' Declare Function HLL_SETGLOBALLONG Lib "CLIPSHLL.DLL" (ByVal defglobal As String, 
'                                                        ByVal defgloballen As Integer, 
'                                                        ByVal Value As Long) As Integer
'   Parameters:
'       defglobal       :string containing defglobal name
'       defgloballen    :Length of the string containing the defglobal name
'       value           :long integer value to assign
'   return values:
'       -1  :defglobal parameter is NULL
'        0  :call failed, (perhaps the format is incorrect)
'        1  :success
'   Comments:   set a defglobal long integer value
Declare Function HLL_SETGLOBALLONG Lib "CLIPSHLL.DLL" (ByVal defglobal As String, _
                                                       ByVal defgloballen As Integer, _
                                                       ByVal Value As Long) As Integer
' ******************************************************
' Declare Function HLL_SETGLOBALSTRING Lib "CLIPSHLL.DLL" (ByVal defglobal As String, 
'                                                          ByVal defgloballen as integer, 
'                                                          ByVal Value As String, byval datalen as integer) As Integer
'   Parameters:
'       defglobal       :string containing defglobal name
'       defgloballen    :Length of the string containing the defglobal name
'       value           :string value to assign
'       datalen         :Length of the data string
'   return values:
'       -2  :value parameter is NULL
'       -1  :defglobal parameter is NULL
'        0  :call failed, (perhaps the format is incorrect)
'        1  :success
'   Comments:   set a defglobal string value
Declare Function HLL_SETGLOBALSTRING Lib "CLIPSHLL.DLL" (ByVal defglobal As String, 
                                                         ByVal defgloballen As Integer, 
                                                         ByVal Value As String, 
                                                         ByVal datalen As Integer) As Integer
' ******************************************************
' Declare Function HLL_GETGLOBALINT Lib "CLIPSHLL.DLL" (ByVal defglobal As String, 
'                                                       ByVal defgloballen As Integer) As Integer
'   Parameters:
'       defglobal       :string containing the name of the defglobal to query
'       defgloballen    :Length of the string containing the defglobal name
'   return values:
'       -9999   :error occured
'         #     :integer value of the defglobal
'   Comments:   get the value of a defglobal as an integer
Declare Function HLL_GETGLOBALINT Lib "CLIPSHLL.DLL" (ByVal defglobal As String, _
                                                      ByVal defgloballen As Integer) As Integer
' ******************************************************
' Declare Function HLL_MAKEINSTANCE Lib "CLIPSHLL.DLL" (ByVal instance As String) As Integer
'   Parameters:
'       instance    :string containing instance creation command
'                    of the form "[classname] of class"
'   return values:
'       -1  :instance parameter is NULL
'        0  :call failed, (syntax correct?)
'        1  :success, current instance ptr is pointing to new instance
'   Comments:   create a new instance of a class
Declare Function HLL_MAKEINSTANCE Lib "CLIPSHLL.DLL" (ByVal instance As String) As Integer
' ******************************************************
' Declare Function HLL_FINDINSTANCE Lib "CLIPSHLL.DLL" (ByVal instance As String) As Integer
'   Parameters:
'       instance    :string containing name of instance to locate
'   return values:
'       -1  :instance parameter is NULL
'        0  :call failed, (syntax correct?)
'        1+ :success, current instance ptr is pointing to found instance
'   Comments: finds the named instance
Declare Function HLL_FINDINSTANCE Lib "CLIPSHLL.DLL" (ByVal instance As String) As Integer
' ******************************************************
' Declare Function HLL_GETSLOT Lib "CLIPSHLL.DLL" (ByVal Slot As String, 
'                                                  ByVal Slotlen As Integer, 
'                                                  ByVal Buffer As String, 
'                                                  ByVal length As Integer) As Integer
'   Parameters:
'       Slot    :string containing name of Slot
'       Slotlen :Length of the name of the slot
'       buffer  :string for return value
'       length  : max length of return buffer
'   return values:
'       -2  :Slot parameter is NULL
'       -1  :buffer parameter is not valid for specified length
'        0  : call failed, (be sure slot name is correct for class)
'        1+ :success
'   Comments: uses the current instance ptr, attempts to access slots by name
Declare Function HLL_GETSLOT Lib "CLIPSHLL.DLL" (ByVal Slot As String, _
                                                 ByVal Slotlen As Integer, _
                                                 ByVal Buffer As String, _
                                                 ByVal length As Integer) As Integer
' ******************************************************
' Declare Function HLL_PUTSLOTFLOAT Lib "CLIPSHLL.DLL" (ByVal Slot As String, 
'                                                       ByVal Slotlen, ByVal Value As Single) As Integer
'   Parameters:
'       Slot    :string containing name of slot
'       Slotlen :Length of the name of the slot
'       value   :floating point value to set
'   return values:
'       -1  :Slot paramter is NULL
'        0  :call failed
'        1+ :success
'   Comments:   place a floating point number value into the named slot for
'               current instance
Declare Function HLL_PUTSLOTFLOAT Lib "CLIPSHLL.DLL" (ByVal Slot As String, _
                                                      ByVal Slotlen, _
                                                      ByVal Value As Single) As Integer
' ******************************************************
' Declare Function HLL_PUTSLOTINT Lib "CLIPSHLL.DLL" (ByVal Slot As String, 
'                                                     ByVal Slotlen As Integer, 
'                                                     ByVal Value As Long) As Integer
'   Parameters:
'       Slot    :string containing name of slot
'       Slotlen :Length of the name of the slot
'       value   :integer value to set
'   return values:
'       -1  :Slot paramter is NULL
'        0  :call failed
'        1  :success
'   Comments:   place an integer value into named slot for current instance
Declare Function HLL_PUTSLOTINT Lib "CLIPSHLL.DLL" (ByVal Slot As String, 
                                                    ByVal Slotlen As Integer, 
                                                    ByVal Value As Long) As Integer
' ******************************************************
' Declare Function HLL_PUTSLOTSYMBOL Lib "CLIPSHLL.DLL" (ByVal Slot As String, 
'                                                        ByVal Slotlen As Integer, 
'                                                        ByVal Buffer As String) As Integer
'   Parameters:
'       Slot    :string containing name of slot
'       Slotlen :Length of the name of the slot
'       value   :integer value to set
'   return values:
'       -2  :buffer parameter is NULL
'       -1  :Slot paramter is NULL
'        0  :call failed
'        1  :success
'   Comments: attempts to set a SYMBOL into the slot for current instance
Declare Function HLL_PUTSLOTSYMBOL Lib "CLIPSHLL.DLL" (ByVal Slot As String, 
                                                       ByVal Slotlen As Integer, 
                                                       ByVal Buffer As String) As Integer
' ******************************************************
' Declare Function HLL_PUTSLOTSTRING Lib "CLIPSHLL.DLL" (ByVal Slot As String, 
'                                                        ByVal Slotlen As Integer, 
'                                                        ByVal Buffer As String, 
'                                                        ByVal datalen As Integer) As Integer
'   Parameters:
'       Slot    :string containing name of slot
'       Slotlen :Length of the name of the slot
'       Buffer  :String value to set
'       datalen :Length of the data buffer
'   return values:
'       -2  :buffer parameter is NULL
'       -1  :Slot paramter is NULL
'        0  :call failed
'        1  :success
'   Comments: attempts to set a string into the slot for current instance
Declare Function HLL_PUTSLOTSTRING Lib "CLIPSHLL.DLL" (ByVal Slot As String, _
                                                       ByVal Slotlen As Integer, _
                                                       ByVal Buffer As String, _
                                                       ByVal datalen As Integer) As Integer
' ******************************************************
' Declare Function HLL_GETGLOBALLONG Lib "CLIPSHLL.DLL" (ByVal defglobal As String, 
'                                                        ByVal defgloballen As Integer) As Long
'   Parameters:
'       defglobal       :string containing name of defglobal
'       defgloballen    :Length of the string containing the defglobal name
'   return values:
'       -999999 :error occured
'        #      :value of defglobal
'   Comments:   return value of a defglobal as a long integer
Declare Function HLL_GETGLOBALLONG Lib "CLIPSHLL.DLL" (ByVal defglobal As String, _
                                                       ByVal defgloballen As Integer) As Long
' ******************************************************
' Declare Function HLL_GETGLOBALFLOAT Lib "CLIPSHLL.DLL" (ByVal defglobal As String, 
'                                                         ByVal defgloballen As Integer, 
'                                                         Value As Single) As Integer
'   Parameters:
'       defglobal       :string containing the name of the defglobal
'       defgloballen    :Length of the string containing the defglobal name
'       Value           :return value
'   return values:
'        0  :error occured
'        1+ :Success
'   Comments:   return the value of a defglobal as a floating point number
Declare Function HLL_GETGLOBALFLOAT Lib "CLIPSHLL.DLL" (ByVal defglobal As String, _
                                                        ByVal defgloballen As Integer, _
                                                        Value As Single) As Integer
' ******************************************************
' Declare Function HLL_SETLOGFILE Lib "CLIPSHLL.DLL" (ByVal fname As String, 
'                                                     ByVal FileNameLen As Integer) As Integer
'   Parameters:
'       FileName    :string containing the path & filename of error route log file
'       FileNameLen :Length of the File Name. (i.e. For the file c:\rules.bin this paramter is 12)
'   return values:
'        0  :success
'        -1 :failed
'   Comments:   set the filename and location of the error log, by default it is
'               CLIPSDLL.ERR in the WINDOWS directory
Declare Function HLL_SETLOGFILE Lib "CLIPSHLL.DLL" (ByVal FileName As String, _ 
                                                    ByVal FileNameLen As Integer) As Integer
' ******************************************************
' Declare Sub HLL_GETGLOBALSTRING Lib "CLIPSHLL.DLL" (ByVal defglobal As String, 
'                                                     ByVal defgloballen As Integer, 
'                                                     ByVal Buffer As String, 
'                                                     ByVal length As Integer)
'   Parameters:
'       defglobal       :name of the defglobal variable in CLIPS
'       defgloballen    :Length of the string containing the defglobal name
'       buffer          :result buffer, (value of defglobal will be placed here)
'       length          :max length of result string
'   Comments:   get the value of a defglobal variable and retun the result as a string
Declare Sub HLL_GETGLOBALSTRING Lib "CLIPSHLL.DLL" (ByVal defglobal As String, _
                                                    ByVal defgloballen As Integer, _
                                                    ByVal Buffer As String, _
                                                    ByVal length As Integer)
' ******************************************************
' Declare Sub HLL_DELCURRENTINST Lib "CLIPSHLL.DLL" ()
'   Parameters:
'   Comments:   delete object pointed at by current instance pointer
Declare Sub HLL_DELCURRENTINST Lib "CLIPSHLL.DLL" ()
' ******************************************************
' Declare Sub HLL_CLEARROUTE Lib "CLIPSHLL.DLL" (ByVal route As String, 
'                                                ByVal routelen As Integer)
'   Parameters:
'       route       :captured CLIPS route to clear
'       routelen    :Length of the name of the router
'   Comments:   empty a captured route buffer of any data already there
Declare Sub HLL_CLEARROUTE Lib "CLIPSHLL.DLL" (ByVal route As String, _
                                               ByVal routelen As Integer)
' ******************************************************
' Declare Sub HLL_SETROUTE Lib "CLIPSHLL.DLL" (ByVal route As String, 
'                                              ByVal routelen As Integer)
'   Parameters:
'       route       :CLIPS route to capture
'       routelen    :Length of the name of the router
'   Comments:   captures a CLIPS i/o route to a buffer in memory
Declare Sub HLL_SETROUTE Lib "CLIPSHLL.DLL" (ByVal route As String, 
                                             ByVal routelen As Integer)
' ******************************************************
' Declare Sub HLL_UNSETROUTE Lib "CLIPSHLL.DLL" (ByVal route As String, 
'                                                ByVal routelen As Integer)
'   Parameters:
'       route       :captured CLIPS route to un-capture
'       routelen    :Length of the name of the router
'   Comments:   removes the "capture on a CLIPS i/o route
Declare Sub HLL_UNSETROUTE Lib "CLIPSHLL.DLL" (ByVal route As String, _
                                               ByVal routelen As Integer)
' ******************************************************
' Declare Sub HLL_SETROUTEFILE Lib "CLIPSHLL.DLL" (ByVal route As String, 
'                                                  ByVal routelen As Integer, 
'                                                  ByVal FileName As String, 
'                                                  ByVal FileNameLen As Integer)
'   Parameters:
'       route       :CLIPS route to capture to file
'       routelen    :Length of the name of the router
'       FileName    :string containing the path & filename of error route log file
'       FileNameLen :Length of the File Name.
'   Comments:   captures a CLIPS i/o route to a file, (note you can set
'               both a buffer and file capture at the same time).
Declare Sub HLL_SETROUTEFILE Lib "CLIPSHLL.DLL" (ByVal route As String, _
                                                 ByVal routelen As Integer, _
                                                 ByVal FileName As String, _
                                                 ByVal FileNameLen As Integer)
' ******************************************************
' Declare Sub HLL_REMOVEALLFACTS Lib "CLIPSHLL.DLL" ()
'   Comments:   clear all facts from CLIPS
Declare Sub HLL_REMOVEALLFACTS Lib "CLIPSHLL.DLL" ()
' ******************************************************
' Declare Sub HLL_RESET Lib "CLIPSHLL.DLL" ()
'   Comments:   performs a CLIPS Reset()
Declare Sub HLL_RESET Lib "CLIPSHLL.DLL" ()
' ******************************************************
' Declare Sub HLL_INIT Lib "CLIPSHLL.DLL" ()
'   Comments:   performs an InitializeCLIPS(), not really needed - the interface
'               DLL will do this when it initializes, by default
Declare Sub HLL_INIT Lib "CLIPSHLL.DLL" ()
' ******************************************************
' Declare Sub HLL_CLEAR Lib "CLIPSHLL.DLL" ()
'   Comments:   performs a CLIPS Clear()
Declare Sub HLL_CLEAR Lib "CLIPSHLL.DLL" ()
' ******************************************************
' Declare Function HLL_ROUTECOMMAND Lib "CLIPSHLL.DLL" (ByVal theCommand As String, 
'                                                       ByVal theCommandLength As Integer, 
'                                                       ByVal theRouter As String, 
'                                                       ByVal theRouterLength As Integer) As Integer
'   Parameters:
'       theCommand       : The command to be issued to CLIPS
'       theCommandLength : Length of the command
'       theRouter        : The name of the router where the output of the command should appear
'       theRouterLength  : Length of the name of the router
'   return values:
'       -2  Router name is NULL or not set to a valid value
'       -1  Command string is NULL or not set to a valid value
'        0  Error from CLIPS (probable malformed command)
'        1  Success
'   Comments:   Issues a formatted command to the CLIPS Engine
Declare Function HLL_ROUTECOMMAND Lib "CLIPSHLL.DLL" (ByVal theCommand As String, _
                                                      ByVal theCommandLength As Integer, _
                                                      ByVal theRouter As String, _
                                                      ByVal theRouterLength As Integer) As Integer
' ******************************************************
' Declare Sub HLL_EXIT Lib "CLIPSHLL.DLL" (ByVal theReturnCode As Integer)
'   Parameters:
'       theReturnCode : The exit value to pass to CLIPS
'   return values:
'       None
'   Comments:   Shuts down the current CLIPS Engine
Declare Sub HLL_EXIT Lib "CLIPSHLL.DLL" (ByVal theReturnCode As Integer)
' ******************************************************
' Declare Function HLL_WATCH Lib "CLIPSHLL.DLL" (ByVal theItem As String, 
'                                                ByVal theItemLength As Integer) As Integer
'   Parameters:
'       theItem       : The Item to be 'Watch'ed by CLIPS
'       theItemLength : Length of the Item
'   return values:
'       -1  The Item is NULL or not set to a valid value
'        0  CLIPS Error
'        1  Success
'   Comments:   Issues a (watch ...) command to the CLIPS Engine
Declare Function HLL_WATCH Lib "CLIPSHLL.DLL" (ByVal theItem As String, _
                                               ByVal theItemLength As Integer) As Integer
' ******************************************************
' Declare Function HLL_UNWATCH Lib "CLIPSHLL.DLL" (ByVal theItem As String, 
'                                                  ByVal theItemLength As Integer) As Integer
'   Parameters:
'       theItem       : The Item to be 'UnWatch'ed by CLIPS
'       theItemLength : Length of the Item
'   return values:
'       -1  The Item is NULL or not set to a valid value
'        0  CLIPS Error
'        1  Success
'   Comments:   Issues a (unwatch ...) command to the CLIPS Engine
Declare Function HLL_UNWATCH Lib "CLIPSHLL.DLL" (ByVal theItem As String, 
                                                 ByVal theItemLength As Integer) As Integer
' ******************************************************
' Declare Function HLL_SETFACTDUP Lib "CLIPSHLL.DLL" (ByVal iValue As String) As Integer
'   Parameters:
'       iValue : The Value to pass to SetFactDuplication
'   return values:
'       -1  on error
'       Old fact duplication Value
'   Comments:   Passes iValue to the set-fact-duplication function
Declare Function HLL_SETFACTDUP Lib "CLIPSHLL.DLL" (ByVal iValue As String) As Integer
' ******************************************************
' Declare Function HLL_GETFACTDUP Lib "CLIPSHLL.DLL" () As Integer
'   Parameters:
'       None
'   return values:
'       -1  on error
'       Old fact duplication Value
'   Comments:   Returns the value of FactDuplication
Declare Function HLL_GETFACTDUP Lib "CLIPSHLL.DLL" () As Integer
' ******************************************************
' Declare Function HLL_DRIBBLE Lib "CLIPSHLL.DLL" (ByVal theFile As String, 
'                                                  ByVal theFilelen As Integer, 
'                                                  ByVal iOnOff As Integer) As Integer
'   Parameters:
'       theFile    : The name of the where the Dribble output will go
'       theFilelen : The length of the name of the Dribble file
'       iOnOff     : 1 to Start the dribble process, 0 to End the dribble process
'   return values:
'       -1  The FileName is NULL or not set to a valid value
'        0  CLIPS Error
'        1  Success
'   Comments:   High Level version of the dribble command
Declare Function HLL_DRIBBLE Lib "CLIPSHLL.DLL" (ByVal theFile As String, _
                                                 ByVal theFilelen As Integer, _
                                                 ByVal iOnOff As Integer) As Integer
' ******************************************************
' Declare Function HLL_SAVEINSTANCES Lib "CLIPSHLL.DLL" (ByVal theFile As String, 
'                                                        ByVal theFilelen, 
'                                                        ByVal iVisable) As Integer
'   Parameters:
'       theFile    : The name of the where the saved instances will go
'       theFilelen : The length of the name of the file
'       iOnOff     : 1 All visable instances, 0 save only LOCAL instances
'   return values:
'       -2  The FileName is NULL or not set to a valid value
'       -1  CLIPS Error
'        #  of instances saved
'   Comments:   High Level version of the save-instances command
Declare Function HLL_SAVEINSTANCES Lib "CLIPSHLL.DLL" (ByVal theFile As String, _
                                                       ByVal theFilelen, _
                                                       ByVal iVisable) As Integer
' ******************************************************
' Declare Function HLL_LOADINSTANCES Lib "CLIPSHLL.DLL" (ByVal theFile As String, 
'                                                        ByVal theFilelen) As Integer
'   Parameters:
'       theFile    : The name of the where the saved instances will go
'       theFilelen : The length of the name of the file
'   return values:
'       -2  The FileName is NULL or not set to a valid value
'       -1  CLIPS Error
'        #  of instances saved
'   Comments:   High Level version of the load-instances command
Declare Function HLL_LOADINSTANCES Lib "CLIPSHLL.DLL" (ByVal theFile As String, _
                                                       ByVal theFilelen) As Integer
' ******************************************************
' Declare Function HLL_SETSTRATEGY Lib "CLIPSHLL.DLL" (ByVal iOption As Integer) As Integer
'   Parameters:
'       iOption : Desired Strategy
'                   DEPTH_STRATEGY      0
'                   BREADTH_STRATEGY    1
'                   LEX_STRATEGY        2
'                   MEA_STRATEGY        3
'                   COMPLEXITY_STRATEGY 4
'                   SIMPLICITY_STRATEGY 5
'                   RANDOM_STRATEGY     6
'   return values:
'       The old strategy value
'   Comments:   High Level version of the set-strategy command
Declare Function HLL_SETSTRATEGY Lib "CLIPSHLL.DLL" (ByVal iOption As Integer) As Integer
' ******************************************************
' Declare Function HLL_GETSTRATEGY Lib "CLIPSHLL.DLL" () As Integer
'   Parameters:
'       None
'   return values:
'       DEPTH_STRATEGY      0
'       BREADTH_STRATEGY    1
'       LEX_STRATEGY        2
'       MEA_STRATEGY        3
'       COMPLEXITY_STRATEGY 4
'       SIMPLICITY_STRATEGY 5
'       RANDOM_STRATEGY     6
'   Comments:   High Level version of the get-strategy command
Declare Function HLL_GETSTRATEGY Lib "CLIPSHLL.DLL" () As Integer
' ******************************************************
' Declare Function HLL_MEMUSED Lib "CLIPSHLL.DLL" () As Long
'   Parameters:
'       None
'   return values:
'       # of bytes used
'   Comments:   High Level version of the mem-used command
Declare Function HLL_MEMUSED Lib "CLIPSHLL.DLL" () As Long
' ******************************************************
' Declare Function HLL_MEMREQUESTS Lib "CLIPSHLL.DLL" () As Long
'   Parameters:
'       None
'   return values:
'       # of memory requests made
'   Comments:   High Level version of the mem-requests command
Declare Function HLL_MEMREQUESTS Lib "CLIPSHLL.DLL" () As Long
' ******************************************************
' Declare Function HLL_FREEMEM Lib "CLIPSHLL.DLL" () As Long
'   Parameters:
'       None
'   return values:
'       None
'   Comments:   Attempts to free all of clips memory
Declare Function HLL_FREEMEM Lib "CLIPSHLL.DLL" () As Long
' ******************************************************
' Declare Function HLL_BUILD Lib "CLIPSHLL.DLL" (ByVal theConstruct As String, 
'                                                ByVal theConstructlen As Integer) As Integer
'   Parameters:
'       theConstruct    : Construct to be built by CLIPS. For example (deftemplate Person (slot name) (slot weight))
'       theConstructlen : Length of the construct
'   return values:
'       -1  Construct string is NULL or not set to a valid value
'        0  Error from CLIPS (probable malformed construct)
'        1  Success
'   Comments:   High Level version of the build command
Declare Function HLL_BUILD Lib "CLIPSHLL.DLL" (ByVal theConstruct As String, _
                                               ByVal theConstructlen As Integer) As Integer
' ******************************************************
' Declare Function HLL_ADDUSERROUTER Lib "CLIPSHLL.DLL" (ByVal theRouter As String, 
'                                                        ByVal theRouterLen As Integer) As Integer
'   Parameters:
'       theRouter    : Name of the User Defined Router
'       theRouterlen : Length of the name of the User Defined Router
'   return values:
'       -3  CLIPS Error (probable Router already defined)
'       -2  All available User Defined routers are allocated
'       -1  Router Name is NULL or not set to a valid value
'        0  Success
'   Comments:   Allocates a User defined router.
Declare Function HLL_ADDUSERROUTER Lib "CLIPSHLL.DLL" (ByVal theRouter As String, _
                                                       ByVal theRouterlen As Integer) As Integer
' ******************************************************
' Declare Function HLL_DELETEUSERROUTER Lib "CLIPSHLL.DLL" (ByVal theRouter As String, 
'                                                           ByVal theRouterLen As Integer) As Integer
'   Parameters:
'       theRouter    : Name of the User Defined Router
'       theRouterlen : Length of the name of the User Defined Router
'   return values:
'       -3  CLIPS Error
'       -2  Router not found
'       -1  Router Name is NULL or not set to a valid value
'        0  Success
'   Comments:   Removes a User defined router.
Declare Function HLL_DELETEUSERROUTER Lib "CLIPSHLL.DLL" (ByVal theRouter As String, _
'                                                         ByVal theRouterlen As Integer) As Integer
' ******************************************************
' Declare Function HLL_GETUSERROUTERSTRING Lib "CLIPSHLL.DLL" (ByVal theRouter As String, 
'                                                              ByVal theRouterlen As Integer, 
'                                                              ByVal theOutput As String, 
'                                                              ByVal theOutputlen As Integer) As Integer
'   Parameters:
'       theRouter    : Name of the User Defined Router
'       theRouterlen : Length of the name of the User Defined Router
'       theOutput    : Buffer when the router output will be placed
'       theOutputlen : Maximum length of output buffer
'   return values:
'       -4  Router Name is NULL or not set to a valid value
'       -3  Router not Found
'       -2  Output Buffer is not valid for specified length
'       -1  End of route buffer was reached, resetting to beginning again
'       #   of bytes copied into the return parameter buffer
Declare Function HLL_GETUSERROUTERSTRING Lib "CLIPSHLL.DLL" (ByVal theRouter As String, _
'                                                            ByVal theRouterlen As Integer, _
'                                                            ByVal theOutput As String, _
'                                                            ByVal theOutputlen As Integer) As Integer
' ******************************************************
' Declare Function HLL_ODBCQUERY Lib "CLIPSHLL.DLL" (ByVal theQuery As String, 
'                                                    ByVal theQuerylen As Integer, 
'                                                    ByVal ConnectInfo As String, 
'                                                    ByVal ConnectInfolen As Integer, 
'                                                    ByVal theTemplate As String, 
'                                                    ByVal theTemplatelen As Integer, 
'                                                    ByVal ImplodeData As String, 
'                                                    ByVal ImplodeDatalen As Integer, 
'                                                    ByVal ErrorMsg As String, 
'                                                    ByVal ErrorMsglen As Integer) As Integer
'   Parameters:
'       theQuery        : Standard SQL query used to determine which row(s) (tuples) will be used.
'       theQuerylen     : Length of the Query
'       ConnectInfo     : ODBC DSN and UserID/Password information
'       ConnectInfoLen  : Length of the Connect Information
'       theTemplate     : CLIPS deftemplate used to assert the fact(s)
'       theTemplateLen  : Length of the deftemplate
'       ImplodeData     : If data to be asserted is associated with slot type data (as opposed to multislot) then
'                         set this parameter to "yes"
'       ImplodeDatalen  : Length of Implode data parameter
'       ErrorMsg        : This parameter is set to "OK", if the function call is successful, else it contains an
'                         explanation of why the function call failed
'       ErrorMsglen     : Length of the ErrorMsg
'   return values:
'       -5  ErrorMsg Buffer is not valid for specified length
'       -4  ImplodeData is NULL or not set to a valid value
'       -3  theTemplate is NULL or not set to a valid value
'       -2  ConnectInfo is NULL or not set to a valid value
'       -1  theQuery is NULL or not set to a valid value
'       0  Check contents of ErrorMsg
'       1  Success
'   Comments Function that will process an ODBC query and ASSERT the resulting rows as FACTS in CLIPS.
Declare Function HLL_ODBCQUERY Lib "CLIPSHLL.DLL" (ByVal theQuery As String, _
                                                   ByVal theQuerylen As Integer, _
                                                   ByVal ConnectInfo As String, _
                                                   ByVal ConnectInfolen As Integer, _
                                                   ByVal theTemplate As String, _
                                                   ByVal theTemplatelen As Integer, _
                                                   ByVal ImplodeData As String, _
                                                   ByVal ImplodeDatalen As Integer, _
                                                   ByVal ErrorMsg As String, _
                                                   ByVal ErrorMsglen As Integer) As Integer