generator_util (library)
Author(s): Göran Smedbäck.Usage and interface
- Library usage:
:- use_module(library(generator_util)). - Exports:
- Imports:
- System library modules:
provrml/provrmlerror, provrml/provrml_io, provrml/field_value, provrml/field_value_check, provrml/lookup, provrml/parser_util. - Packages:
prelude, nonpure, dcg, assertions, nortchecks, isomodes.
- System library modules:
Documentation on exports
Usage 1:reading(DEF,Parse,L,T)
This predicate will check if we have the special key word.
- Call and exit should be compatible with:
(basic_props:atm/1)DEF is an atom.
(internal_types:parse/1)Parse is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)DEF is currently a term which is not a free variable.
(term_typing:nonvar/1)Parse is currently a term which is not a free variable.
Usage 2:reading(IS,NodeTypeId,ParseIn,ParseOut)
This predicate will refer to a formerly introduced interface. We do a checkup of the access type and output the values.
- Call and exit should be compatible with:
(basic_props:atm/1)IS is an atom.
(basic_props:atm/1)NodeTypeId is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure. - The following properties should hold at call time:
(term_typing:nonvar/1)IS is currently a term which is not a free variable.
(term_typing:nonvar/1)NodeTypeId is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 3:reading(Node,Parse,L,T)
This predicate will read a node so we will check the properties of that one and then continue the progress in the generation.
- Call and exit should be compatible with:
(basic_props:atm/1)Node is an atom.
(internal_types:parse/1)Parse is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)Node is currently a term which is not a free variable.
(term_typing:nonvar/1)Parse is currently a term which is not a free variable.
Usage 4:reading(Script,Parse,L,T)
This predicate read a script and will then continue the generation.
- Call and exit should be compatible with:
(basic_props:atm/1)Script is an atom.
(internal_types:parse/1)Parse is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)Script is currently a term which is not a free variable.
(term_typing:nonvar/1)Parse is currently a term which is not a free variable.
Usage 5:reading(NodeGut,NodeName,ParseIn,ParseOut)
This predicate will read a node gut and will check the field according to the name.
- Call and exit should be compatible with:
(basic_props:atm/1)NodeGut is an atom.
(basic_props:atm/1)NodeName is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure. - The following properties should hold at call time:
(term_typing:nonvar/1)NodeGut is currently a term which is not a free variable.
(term_typing:nonvar/1)NodeName is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 6:reading(PROTO,Parse,L,T)
This predicate will read a prototype, check that the term name is the one, 'PROTO'.
- Call and exit should be compatible with:
(basic_props:atm/1)PROTO is an atom.
(internal_types:parse/1)Parse is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)PROTO is currently a term which is not a free variable.
(term_typing:nonvar/1)Parse is currently a term which is not a free variable.
Usage 7:reading(EXTERNPROTO,Parse,L,T)
This predicate read a term with the name given as the first argument.
- Call and exit should be compatible with:
(basic_props:atm/1)EXTERNPROTO is an atom.
(internal_types:parse/1)Parse is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)EXTERNPROTO is currently a term which is not a free variable.
(term_typing:nonvar/1)Parse is currently a term which is not a free variable.
Usage 1:reading(Entrance,ParseIn,ParseOut,L,T)
This predicate is a general predicate in this help module. The first argument is a key word to direct the input to the right entrance. When I say output in the following predicates I am refering to the out predicate which actually will use the features of DCG and we will add the output terms in a list for later output. The list is hidden to the user but is in this case the fourth argument will be the list and the fifth will be the resulting list, hopefully empty after the generation. Then we should have read all the terms.
- Call and exit should be compatible with:
(basic_props:atm/1)Entrance is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)Entrance is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 2:reading(Empty,ParseIn,ParseOut,L,T)
This predicate check if we have ran out of input and is ready to terminate the reading.
- Call and exit should be compatible with:
(basic_props:atm/1)Empty is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)Empty is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 3:reading(Header,ParseIn,ParseOut,L,T)
This predicate read the header and after the header we can have more information, that is comments.
- Call and exit should be compatible with:
(basic_props:atm/1)Header is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)Header is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 4:reading(NULL,ParseIn,ParseOut,L,T)
This predicate accepts the special key word 'NULL' and will output that.
- Call and exit should be compatible with:
(basic_props:atm/1)NULL is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)NULL is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 5:reading(Comment,ParseIn,ParseOut,L,T)
This predicate will read a comment.
- Call and exit should be compatible with:
(basic_props:atm/1)Comment is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)Comment is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 6:reading(USE,ParseIn,ParseOut,L,T)
This predicate will read the 'USE' key word.
- Call and exit should be compatible with:
(basic_props:atm/1)USE is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)USE is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 7:reading(MfstringValue,ParseIn,ParseOut,L,T)
This predicate will read the term multi field string value. Then it will continue the generation in the field_value_check module. There it will read the string values and generate the code.
- Call and exit should be compatible with:
(basic_props:atm/1)MfstringValue is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)MfstringValue is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 8:reading(ExposedField,ParseIn,ParseOut,L,T)
This predicate will read an exposedField and do the checkup for the interface with all its components.
- Call and exit should be compatible with:
(basic_props:atm/1)ExposedField is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ExposedField is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 9:reading(RestrictedInterfaceDeclaration,ParseIn,ParseOut,L,T)
This predicate will read the declaration for a restricted field and do the checkup accordingly if necessary.
- Call and exit should be compatible with:
(basic_props:atm/1)RestrictedInterfaceDeclaration is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)RestrictedInterfaceDeclaration is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 10:reading(ExternInterfaceDeclaration,ParseIn,ParseOut,L,T)
For reading an external interface declaration we see that we have three arguments in the term and that we have special access key word. We then outputs the declaration.
- Call and exit should be compatible with:
(basic_props:atm/1)ExternInterfaceDeclaration is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ExternInterfaceDeclaration is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 11:reading(ROUTE,ParseIn,ParseOut,L,T)
Reading a ROUTE and we split the term into its parts. There might be comments in the different fields and therefore we have to strip_clean the fields to get them without a possible list containing comments, this for the checkup of the routing parameters. We then do an output of the values, then with the comments.
- Call and exit should be compatible with:
(basic_props:atm/1)ROUTE is an atom.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ROUTE is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage 12:reading(Error_X,ParseIn,ParseOut,L,T)
The predicate will call a proper error message after fetching some values like name.
- Call and exit should be compatible with:
(basic_props:struct/1)Error_X is a compound term.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)Error_X is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage:open_node(ParseIn,ParseOut,NodeGutsParseStruct,NodeNameId,L,T)
The predicate will open a node to extract its name and its guts. The guts will then be added to a new parse structure to be emptied in the above module, generator.
- Call and exit should be compatible with:
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(internal_types:parse/1)NodeGutsParseStruct is a parse structure.
(basic_props:atm/1)NodeNameId is an atom.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
(term_typing:var/1)NodeGutsParseStruct is a free variable.
(term_typing:var/1)NodeNameId is a free variable.
Usage:close_node(ParseNodeStruct,ParseIn,ParseOut,L,T)
The predicate will end the generation from the node and will do that by adding all the new posts in the dictionary, like new declarations and nodes, to the already used dictionary.
- Call and exit should be compatible with:
(internal_types:parse/1)ParseNodeStruct is a parse structure.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ParseNodeStruct is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage:close_nodeGut(ParseIn,ParseOut,L,T)
The predicate will perform all the actions needed terminate the reading of the node guts.
- Call and exit should be compatible with:
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage:open_PROTO(Parse,ProtoParse,L,T)
This predicate will construct a parse structure with the prototype information, the interface only. It can thereafter be used in further code generation. The scene will be opened afterwards.
- Call and exit should be compatible with:
(internal_types:parse/1)Parse is a parse structure.
(internal_types:parse/1)ProtoParse is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)Parse is currently a term which is not a free variable.
(term_typing:var/1)ProtoParse is a free variable.
Usage:close_PROTO(DeclParse,SceneParse,ParseIn,ParseOut,L,T)
The predicate will push the dictionaries with its new information when gone through the scenery. The output parse structure will contain all the new information.
- Call and exit should be compatible with:
(internal_types:parse/1)DeclParse is a parse structure.
(internal_types:parse/1)SceneParse is a parse structure.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)SceneParse is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage:open_EXTERNPROTO(Parse,DeclParse,StringParse,L,T)
This predicate will construct parse structures with the prototype information, the interface and the strings. It can thereafter be used in further code generation.
- Call and exit should be compatible with:
(internal_types:parse/1)Parse is a parse structure.
(internal_types:parse/1)DeclParse is a parse structure.
(internal_types:parse/1)StringParse is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)Parse is currently a term which is not a free variable.
(term_typing:var/1)DeclParse is a free variable.
(term_typing:var/1)StringParse is a free variable.
Usage:close_EXTERNPROTO(ParseDeclIn,ParseStringIn,ParseIn,ParseOut,L,T)
The predicate will end the generating of the external prototype and do checkup if there was correct.
- Call and exit should be compatible with:
(internal_types:parse/1)ParseDeclIn is a parse structure.
(internal_types:parse/1)ParseStringIn is a parse structure.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage:open_DEF(ParseIn,ParseOut,ParseNode,L,T)
The predicate will open and do the settings to generate the code for a definition of a node.
- Call and exit should be compatible with:
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(internal_types:parse/1)ParseNode is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
(term_typing:var/1)ParseNode is a free variable.
Usage:close_DEF(ParseNode,ParseIn,ParseOut,L,T)
The predicate will push the new dictionary information from the node definition to the output parse structure combining the information in the old parse structure with the newly received.
- Call and exit should be compatible with:
(internal_types:parse/1)ParseNode is a parse structure.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ParseNode is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage:open_Script(ParseIn,ParseOut,ScriptParse,L,T)
The predicate will create a parse structure with the script guts.
- Call and exit should be compatible with:
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(internal_types:parse/1)ScriptParse is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
(term_typing:var/1)ScriptParse is a free variable.
Usage:close_Script(ScriptParse,ParseIn,ParseOut,L,T)
This predicate will update the dictionaries after generating code for the script.
- Call and exit should be compatible with:
(internal_types:parse/1)ScriptParse is a parse structure.
(internal_types:parse/1)ParseIn is a parse structure.
(internal_types:parse/1)ParseOut is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)ScriptParse is currently a term which is not a free variable.
(term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
(term_typing:var/1)ParseOut is a free variable.
Usage:indentation_list(Parse,IndList)
This predcate will construct a list with indentations to be output before text. The information of the indentations is inside the parse structure.
- Call and exit should be compatible with:
(internal_types:parse/1)Parse is a parse structure.
(basic_props:list/2)IndList is a list of atms. - The following properties should hold at call time:
(term_typing:nonvar/1)Parse is currently a term which is not a free variable.
(term_typing:var/1)IndList is a free variable.
Usage:start_vrmlScene(Parse,ParseScene,L,T)
The predicate will construct a parse structure with the prototype scene and do the setups.
- Call and exit should be compatible with:
(internal_types:parse/1)Parse is a parse structure.
(internal_types:parse/1)ParseScene is a parse structure.
(basic_props:list/1)L is a list.
(basic_props:list/1)T is a list. - The following properties should hold at call time:
(term_typing:nonvar/1)Parse is currently a term which is not a free variable.
(term_typing:var/1)ParseScene is a free variable.
Usage:remove_comments(Value,CommentsBefore,ValueClean,CommentsAfter)
The predicate will remove comments and return the comments before and after the pure value.
- Call and exit should be compatible with:
(basic_props:list/2)Value is a list of atms.
(basic_props:list/2)CommentsBefore is a list of atms.
(basic_props:atm/1)ValueClean is an atom.
(basic_props:list/2)CommentsAfter is a list of atms. - The following properties should hold at call time:
(term_typing:nonvar/1)Value is currently a term which is not a free variable.
(term_typing:var/1)CommentsBefore is a free variable.
(term_typing:var/1)ValueClean is a free variable.
(term_typing:var/1)CommentsAfter is a free variable.
Known bugs and planned improvements
- Run-time checks have been reported not to work with this code. That means that either the assertions here, or the code that implements the run-time checks are erroneous.