ProVRML - a Prolog interface for VRML
Author(s): Göran Smedbäck, Manuel Carro (some changes), The CLIP Group.ProVRML is Prolog library to handle VRML code. The library consists of modules to handle the tokenising, that is breaking the VRML code into smaller parts that can be analysed further. The further analysis will be the parsing. This is a complex part of the library and consists of several modules to handle errors and value check. When the parsing is done we have the Prolog terms of the VRML code. The terms are quite similar to the origin VRML code and can easily be read if you recognise that syntax.
This Prolog terms of the VRML code is then possible to use for analysis, reconstruction, reverse enginering, building blocks for automatic generation of VRML code. There are several possibilities and these are only some of them.
When you are done with the Prolog terms for the code, you would probably want to reverse the action and return to VRML code. This is done with the code generation modules. These are built up in more or less the same manner as the parser modules.
Usage and interface
- Library usage:
:- use_module(library(provrml)). - Exports:
- Imports:
- System library modules:
pillow/http, pillow/html, provrml/provrml_io, provrml/provrml_parser, provrml/generator. - Packages:
prelude, nonpure, assertions, isomodes, regtypes, pillow.
- System library modules:
Documentation on exports
Usage:vrml_web_to_terms(WEBAddress,Terms)
Given a address to a VRML-document on the Internet, the predicate will return the prolog-terms.
- Call and exit should be compatible with:
(basic_props:atm/1)WEBAddress is an atom.
(basic_props:string/1)Terms is a string (a list of character codes). - The following properties should hold at call time:
(term_typing:nonvar/1)WEBAddress is currently a term which is not a free variable.
(term_typing:var/1)Terms is a free variable.
Usage 1:vrml_file_to_terms(FileName,Term)
Given a filename containing a VRML-file the predicate returns the prolog terms corresponding.
- Call and exit should be compatible with:
(basic_props:atm/1)FileName is an atom.
(basic_props:atm/1)Term is an atom. - The following properties should hold at call time:
(term_typing:nonvar/1)FileName is currently a term which is not a free variable.
(term_typing:var/1)Term is a free variable.
Usage 2:vrml_file_to_terms(FileName,Terms)
Given a filename containing a VRML-file and a filename, the predicate write the prolog terms corresponding to the filename.
- Call and exit should be compatible with:
(basic_props:atm/1)FileName is an atom.
(basic_props:atm/1)Terms is an atom. - The following properties should hold at call time:
(term_typing:nonvar/1)FileName is currently a term which is not a free variable.
(term_typing:nonvar/1)Terms is currently a term which is not a free variable.
Usage:vrml_web_to_terms_file(WEBAddress,FileName)
Given a address to a VRML-document on the Internet and a filename, the predicate will write the prolog_terms to the file.
- Call and exit should be compatible with:
(basic_props:atm/1)WEBAddress is an atom.
(basic_props:atm/1)FileName is an atom. - The following properties should hold at call time:
(term_typing:nonvar/1)WEBAddress is currently a term which is not a free variable.
(term_typing:nonvar/1)FileName is currently a term which is not a free variable.
Usage:terms_file_to_vrml(FileName,List)
From a given filename with prologterms on the special format, the predicate returns the corresponding VRML-code.
- Call and exit should be compatible with:
(basic_props:atm/1)FileName is an atom.
(basic_props:string/1)List is a string (a list of character codes). - The following properties should hold at call time:
(term_typing:nonvar/1)FileName is currently a term which is not a free variable.
(term_typing:var/1)List is a free variable.
Usage:terms_file_to_vrml_file(Atom,Atom)
From a given filename with prologterms on the special format, the predicate writes the corresponding VRML-code to second filename.
- Call and exit should be compatible with:
(basic_props:atm/1)Atom is an atom.
(basic_props:atm/1)Atom is an atom. - The following properties should hold at call time:
(term_typing:nonvar/1)Atom is currently a term which is not a free variable.
(term_typing:nonvar/1)Atom is currently a term which is not a free variable.
Usage:terms_to_vrml_file(Term,FileName)
Given prolog-terms the predicate writes the corresponding VRML-code to the given file.
- Call and exit should be compatible with:
(basic_props:atm/1)Term is an atom.
(basic_props:atm/1)FileName is an atom. - The following properties should hold at call time:
(term_typing:nonvar/1)Term is currently a term which is not a free variable.
(term_typing:nonvar/1)FileName is currently a term which is not a free variable.
Usage:terms_to_vrml(Term,VRMLCode)
Given prolog-terms the predicate returns a list with the corresponding VRML-code.
- Call and exit should be compatible with:
(basic_props:atm/1)Term is an atom.
(basic_props:string/1)VRMLCode is a string (a list of character codes). - The following properties should hold at call time:
(term_typing:nonvar/1)Term is currently a term which is not a free variable.
(term_typing:var/1)VRMLCode is a free variable.
Usage:vrml_to_terms(VRMLCode,Terms)
Given a list with VRML-code the predicate will return the corresponding prolog-terms.
- Call and exit should be compatible with:
(basic_props:string/1)VRMLCode is a string (a list of character codes).
(basic_props:atm/1)Terms is an atom. - The following properties should hold at call time:
(term_typing:nonvar/1)VRMLCode is currently a term which is not a free variable.
(term_typing:var/1)Terms is a free variable.
Usage:vrml_in_out(FileName,FileName)
This is a controll-predicate that given a filename to a VRML-file and a filename, the predicate will read the VRML-code. Transform it to prolog-terms and then transform it back to VRRML-code and write it to the latter file.
- Call and exit should be compatible with:
(basic_props:atm/1)FileName is an atom.
(basic_props:atm/1)FileName is an atom. - The following properties should hold at call time:
(term_typing:nonvar/1)FileName is currently a term which is not a free variable.
(term_typing:nonvar/1)FileName is currently a term which is not a free variable.
Usage:vrml_http_access(ReadFilename,BaseFilename)
Given a web-address to a VRML-file the predicate will load the code, write it first to the second argument with extension '_first.wrl'. Then it transform the code to prolog terms and write it with the extension '.term'. Transform it back to VRML-code and write it to the filename with '.wrl. A good test-predicate.
- Call and exit should be compatible with:
(basic_props:atm/1)ReadFilename is an atom.
(basic_props:atm/1)BaseFilename is an atom. - The following properties should hold at call time:
(term_typing:nonvar/1)ReadFilename is currently a term which is not a free variable.
(term_typing:nonvar/1)BaseFilename is currently a term which is not a free variable.
Documentation on internals
Usage:read_page(WEBAddress,Data)
This routine reads a page on the web using pillow routines.
- Call and exit should be compatible with:
(basic_props:atm/1)WEBAddress is an atom.
(basic_props:string/1)Data is a string (a list of character codes). - The following properties should hold at call time:
(term_typing:nonvar/1)WEBAddress is currently a term which is not a free variable.
(term_typing:var/1)Data is a free variable.