WelcomeWhat's NewsInform GuideORLibraryDownloadsLinksWebMaster@OnyxRing.com

This site
pageviews since

Today's date:

Author: Jim Fisher
Title: Using the ORLibrary Entries Without the Framework

Creation Date: 8/6/2004 10:38:30 PM
Last Updated: 8/6/2004 10:38:30 PM

Using the ORLibrary Entries Without the Framework

The modules in the ORLibrary were written to take advantage of the ORLibrary framework, specifically the OR_Library_Include.h file. As a rule, it is substantially less trouble to simply utilize this framework, but for those who are adamant about using a module alone, it is possible, although sometimes problematic, to use a library entry without committing yourself to the framework.

Including the Extension

As with traditional extensions, ORLibrary modules are imported using the include directive. An ORLibrary module differs from the standard extension in that it must be included four times, in four different places:
  • Before inclusion of Parser
  • Before inclusion of VerbLib
  • Immediately after the inclusion of VerbLib
  • Immediately after the inclusion of Grammar
  • ORLibrary modules attempt to detect discrepancies in the order of inclusion and will throw a compile-time error if one is detected.

    Limitation by Dependencies

    An increasing number of ORLibrary modules depend upon other modules and attempt to meet these dependencies automatically by using framework techniques. Modules that have dependencies will detect if the framework is present and throw an error if it is not.

    By convention, a list of a module's dependencies can be found in the "AutoDep" section of its comment header. An example of such a module is ORKnowledgeTopic, which depends upon OROptionList, ORDynaString and ORPronoun.

    Manually Meeting Dependencies

    It is still possible to convince a module with dependencies to compile without the framework. Do this by defining the ORLibraryInclude constant at the start of your source file. This "fools" the module into believing the framework will be there to satisfy it's needs. Since it really isn't, the burden of meeting these requirements falls to the developer. Keep in mind that many dependencies have dependencies of their own. So: when including an extension manually, all requisite modules, including requisites of requisites, must also be included manually.

    The following code skeleton demonstrates leveraging the ORKnowledgeTopic extension without the library:

     Constant ORLibraryInclude; !--Convince modules we are using the framework 
     !... code that belongs before PARSER 
     #include "OROptionList";     !--dependency of ORKnowledgeTopic 
     #include "ORTextFormatting"; !--dependency of ORDynaString 
     #include "ORPronoun";        !--dependency of ORKnowledgeTopic
     #include "ORDynaString";     !--dependency of ORKnowledgeTopic 
     #include "ORKnowledgeTopic";  
     #include "parser";           !--standard library inclusion
     !... code that belongs between PARSER and VERBLIB
     #include "OROptionList";    
     #include "ORTextFormatting";
     #include "ORPronoun";        
     #include "ORDynaString";    
     #include "ORKnowledgeTopic";  
     #include "verblib";          !--standard library inclusion 
     #include "OROptionList";     
     #include "ORTextFormatting"; 
     #include "ORPronoun";        
     #include "ORDynaString";    
     #include "ORKnowledgeTopic";  
     !... code that belongs between VERBLIB and GRAMMAR
     #include "grammar";          !--standard library inclusion 
     #include "OROptionList";    
     #include "ORTextFormatting";
     #include "ORPronoun";        
     #include "ORDynaString";    
     #include "ORKnowledgeTopic";  
     !... code that belongs follows GRAMMAR

    Copyright 2004 - 2021 : Jim Fisher
    OnyxRing.com has been given the potentially non-exclusive right to display the content of this article. However the original author retains all rights. Permission to reproduce this article -- either in part or in whole -- is left strictly to the discretion of the original author.