• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Shared Jess Libraries

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In an effort to create shared libraries in Jess, I have created a simple pre-processor that takes a Jess source file and performs a simple search for #include <jessfile.jess> and replaces this text with the contents of the include file. While this works fine for sharing common templates and functions among different rule files, I want to replace this with something that works with your eclipse plugin. As a result, I have recently attempted to create a userfunction called "include" so that a call such as (include jessfile) would result in an execute of the contents of the jessfile.jess. Is there a better way of achieving this idea? Would this even work?
author and iconoclast
Posts: 24207
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Welcome to JavaRanch!

A clp file can use either "batch" or "require/require*" to include another file of Jess code. "batch" will always include the other file, which might lead to errors if the file is missing or has previously been included. "require" is like C's "include" with built-in include guards; it will only read a given file once (used properly). "require*" is like "require" except it fails silently if the included file is missing.

All of these work in Eclipse, so what you want already exists, and you don't need to write anything.

You can read about all of these functions in the "Jess Function Guide" chapter of the manual.
Nothing? Or something? Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic