From 75b2645e3faae6d5a2d5c8bbc321718fb5ecbea3 Mon Sep 17 00:00:00 2001 From: pmoura Date: Sun, 26 Mar 2006 17:31:34 +0000 Subject: [PATCH] Logtalk 2.27.1 files. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1580 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- Logtalk/INSTALL | 58 +- Logtalk/QUICK_START | 2 +- Logtalk/README | 2 +- Logtalk/RELEASE_NOTES | 41 +- Logtalk/UPGRADING | 8 +- Logtalk/contributions/NOTES | 2 +- Logtalk/examples/NOTES | 5 +- Logtalk/examples/aliases/NOTES | 2 +- Logtalk/examples/aliases/SCRIPT | 2 +- Logtalk/examples/assignvars/NOTES | 2 +- Logtalk/examples/assignvars/SCRIPT | 2 +- Logtalk/examples/benchmarks/NOTES | 2 +- Logtalk/examples/benchmarks/SCRIPT | 2 +- Logtalk/examples/birds/NOTES | 2 +- Logtalk/examples/birds/SCRIPT | 2 +- Logtalk/examples/bricks/NOTES | 2 +- Logtalk/examples/bricks/SCRIPT | 2 +- Logtalk/examples/classvars/NOTES | 2 +- Logtalk/examples/classvars/SCRIPT | 2 +- Logtalk/examples/dcgs/NOTES | 2 +- Logtalk/examples/dcgs/SCRIPT | 11 +- Logtalk/examples/dcgs/loader.lgt | 2 + Logtalk/examples/dcgs/tokenizer.lgt | 114 + Logtalk/examples/diamonds/NOTES | 2 +- Logtalk/examples/diamonds/SCRIPT | 2 +- Logtalk/examples/dynpred/NOTES | 2 +- Logtalk/examples/dynpred/SCRIPT | 2 +- Logtalk/examples/encodings/NOTES | 2 +- Logtalk/examples/encodings/SCRIPT | 2 +- Logtalk/examples/engines/NOTES | 2 +- Logtalk/examples/engines/SCRIPT | 2 +- Logtalk/examples/errors/NOTES | 2 +- Logtalk/examples/errors/SCRIPT | 2 +- Logtalk/examples/expansion/NOTES | 2 +- Logtalk/examples/expansion/SCRIPT | 2 +- Logtalk/examples/hello_world/NOTES | 2 +- Logtalk/examples/hello_world/SCRIPT | 2 +- Logtalk/examples/hooks/NOTES | 2 +- Logtalk/examples/hooks/SCRIPT | 2 +- Logtalk/examples/inheritance/NOTES | 2 +- Logtalk/examples/inheritance/SCRIPT | 2 +- Logtalk/examples/instmethods/NOTES | 2 +- Logtalk/examples/instmethods/SCRIPT | 2 +- Logtalk/examples/lo/NOTES | 2 +- Logtalk/examples/lo/planner/NOTES | 2 +- Logtalk/examples/lo/planner/SCRIPT | 2 +- Logtalk/examples/lo/travellers/NOTES | 2 +- Logtalk/examples/lo/travellers/SCRIPT | 2 +- Logtalk/examples/logic/NOTES | 2 +- Logtalk/examples/logic/SCRIPT | 2 +- Logtalk/examples/lpa/NOTES | 2 +- Logtalk/examples/lpa/faults/NOTES | 2 +- Logtalk/examples/lpa/faults/SCRIPT | 2 +- Logtalk/examples/lpa/timetables/NOTES | 2 +- Logtalk/examples/lpa/timetables/SCRIPT | 2 +- Logtalk/examples/metainterpreters/NOTES | 2 +- Logtalk/examples/metainterpreters/SCRIPT | 2 +- Logtalk/examples/metapredicates/NOTES | 2 +- Logtalk/examples/metapredicates/SCRIPT | 2 +- Logtalk/examples/mi/NOTES | 2 +- Logtalk/examples/mi/SCRIPT | 2 +- Logtalk/examples/miscellaneous/NOTES | 2 +- Logtalk/examples/miscellaneous/SCRIPT | 2 +- Logtalk/examples/modules/NOTES | 2 +- Logtalk/examples/modules/SCRIPT | 2 +- Logtalk/examples/msglog/NOTES | 2 +- Logtalk/examples/msglog/SCRIPT | 2 +- Logtalk/examples/operators/NOTES | 2 +- Logtalk/examples/operators/SCRIPT | 2 +- Logtalk/examples/parametric/NOTES | 2 +- Logtalk/examples/parametric/SCRIPT | 2 +- Logtalk/examples/points/NOTES | 2 +- Logtalk/examples/points/SCRIPT | 2 +- Logtalk/examples/polygons/NOTES | 2 +- Logtalk/examples/polygons/SCRIPT | 2 +- Logtalk/examples/profiling/NOTES | 2 +- Logtalk/examples/profiling/SCRIPT | 2 +- Logtalk/examples/proxies/NOTES | 33 + Logtalk/examples/proxies/SCRIPT | 24 + Logtalk/examples/proxies/loader.lgt | 13 + Logtalk/examples/proxies/proxies.lgt | 39 + Logtalk/examples/puzzles/NOTES | 2 +- Logtalk/examples/puzzles/SCRIPT | 2 +- Logtalk/examples/reflection/NOTES | 2 +- Logtalk/examples/reflection/SCRIPT | 2 +- Logtalk/examples/relations/NOTES | 2 +- Logtalk/examples/relations/SCRIPT | 2 +- Logtalk/examples/roots/NOTES | 2 +- Logtalk/examples/roots/SCRIPT | 2 +- Logtalk/examples/searching/NOTES | 2 +- Logtalk/examples/searching/SCRIPT | 2 +- Logtalk/examples/shapes/NOTES | 2 +- Logtalk/examples/shapes/ch/NOTES | 2 +- Logtalk/examples/shapes/ch/SCRIPT | 2 +- Logtalk/examples/shapes/ph/NOTES | 2 +- Logtalk/examples/shapes/ph/SCRIPT | 2 +- Logtalk/examples/sicstus/NOTES | 2 +- Logtalk/examples/sicstus/SCRIPT | 2 +- Logtalk/examples/symdiff/NOTES | 2 +- Logtalk/examples/symdiff/SCRIPT | 2 +- Logtalk/examples/viewpoints/NOTES | 2 +- Logtalk/examples/viewpoints/SCRIPT | 2 +- Logtalk/libpaths/NOTES | 2 +- Logtalk/libpaths/libpaths.pl | 3 +- Logtalk/library/NOTES | 2 +- Logtalk/library/SCRIPT | 2 +- Logtalk/library/all.notes | 2 +- Logtalk/library/class_hierarchy.lgt | 34 +- Logtalk/library/date.lgt | 13 +- Logtalk/library/dates.notes | 2 +- Logtalk/library/debugging.notes | 2 +- Logtalk/library/dependents.notes | 2 +- Logtalk/library/events.notes | 2 +- Logtalk/library/experimental/NOTES | 2 +- Logtalk/library/hierarchies.notes | 2 +- Logtalk/library/metapredicates.notes | 2 +- Logtalk/library/proto_hierarchy.lgt | 24 +- Logtalk/library/proto_hierarchyp.lgt | 22 +- Logtalk/library/random.notes | 2 +- Logtalk/library/types.notes | 2 +- Logtalk/manuals/NOTES | 10 +- Logtalk/manuals/glossary.html | 7 +- Logtalk/manuals/index.html | 8 +- Logtalk/manuals/print.css | 9 +- Logtalk/manuals/refman/index.html | 2 +- .../manuals/refman/methods/parameter2.html | 4 +- Logtalk/manuals/userman/index.html | 3 +- Logtalk/manuals/userman/objects.html | 3 + Logtalk/manuals/userman/predicates.html | 16 +- Logtalk/manuals/userman/programming.html | 9 +- Logtalk/scripts/NOTES | 2 +- Logtalk/scripts/cleandist.sh | 2 +- Logtalk/scripts/cplgtdirs.js | 7 +- Logtalk/scripts/cplgtdirs.sh | 3 +- Logtalk/scripts/debian/control | 2 +- Logtalk/scripts/lgt_install.js | 2 +- Logtalk/scripts/lgt_install.sh | 18 +- Logtalk/scripts/logtalk.spec | 58 +- Logtalk/scripts/make_ciaolgt.js | 2 +- Logtalk/scripts/make_ciaolgt.sh | 2 +- Logtalk/scripts/make_eclipselgt.js | 2 +- Logtalk/scripts/make_eclipselgt.sh | 2 +- Logtalk/scripts/make_gplgt.js | 2 +- Logtalk/scripts/make_gplgt.sh | 2 +- Logtalk/scripts/make_plclgt.js | 2 +- Logtalk/scripts/make_plclgt.sh | 2 +- Logtalk/scripts/make_qplgt.sh | 2 +- Logtalk/scripts/make_sicstuslgt.js | 2 +- Logtalk/scripts/make_sicstuslgt.sh | 2 +- Logtalk/scripts/make_swilgt.js | 2 +- Logtalk/scripts/make_swilgt.sh | 2 +- Logtalk/scripts/make_xsbcvslgt.js | 2 +- Logtalk/scripts/make_xsbcvslgt.sh | 2 +- Logtalk/scripts/make_xsblgt.sh | 2 +- Logtalk/scripts/make_yaplgt.js | 2 +- Logtalk/scripts/make_yaplgt.sh | 2 +- Logtalk/scripts/makeall_lgt.js | 2 +- Logtalk/scripts/makeall_lgt.sh | 2 +- Logtalk/wenv/NOTES | 2 +- Logtalk/wenv/bbedit/NOTES | 12 +- Logtalk/wenv/crimson/NOTES | 2 +- Logtalk/wenv/emacs/NOTES | 2 +- Logtalk/wenv/emacs/logtalk.el | 6 +- Logtalk/wenv/jedit/NOTES | 2 +- Logtalk/wenv/jedit/logtalk.xml | 1 + Logtalk/wenv/kate/NOTES | 4 +- Logtalk/wenv/kate/logtalk.xml | 8 +- Logtalk/wenv/nedit/NOTES | 2 +- Logtalk/wenv/nedit/logtalk.pats | 2 +- Logtalk/wenv/source-highlight/NOTES | 2 +- Logtalk/wenv/source-highlight/logtalk.lang | 2 +- Logtalk/wenv/subethaedit/NOTES | 2 +- Logtalk/wenv/subethaedit/logtalk.plist | 1 + .../Logtalk.mode/Contents/Info.plist | 2 +- .../Resources/AutocompleteAdditions.txt | 3 + .../Contents/Resources/SyntaxDefinition.xml | 4 +- Logtalk/wenv/subethaedit2/NOTES | 2 +- Logtalk/wenv/tests/NOTES | 2 +- .../Preferences/Completions.plist | 148 + .../Preferences/Entity list.plist | 19 + .../Logtalk.tmbundle/Syntaxes/Logtalk.plist | 482 ++- Logtalk/wenv/textmate/NOTES | 10 +- Logtalk/wenv/textpad/NOTES | 2 +- Logtalk/wenv/textpad/logtalk.syn | 3 +- Logtalk/wenv/vim/NOTES | 2 +- Logtalk/wenv/vim/logtalk.vim | 3 +- Logtalk/wenv/xcode/NOTES | 2 +- Logtalk/xml/NOTES | 2 +- Logtalk/xml/ie50.xsl | 2 +- Logtalk/xml/lgt2html.js | 2 +- Logtalk/xml/lgt2html.sh | 2 +- Logtalk/xml/lgt2pdf.js | 2 +- Logtalk/xml/lgt2pdf.sh | 2 +- Logtalk/xml/lgt2xml.js | 2 +- Logtalk/xml/lgt2xml.sh | 2 +- Logtalk/xml/lgthtml.xsl | 2 +- Logtalk/xml/lgtpdf.xsl | 2 +- Logtalk/xml/lgtpdfa4.xsl | 2 +- Logtalk/xml/lgtpdfus.xsl | 2 +- Logtalk/xml/lgtxhtml.xsl | 2 +- Logtalk/xml/lgtxml.xsl | 2 +- Logtalk/xml/logtalk.dtd | 2 +- Logtalk/xml/logtalk.xsd | 2 +- library/logtalk/logtalk.pl | 3428 +++++++++-------- library/logtalk/yap.config | 16 +- 205 files changed, 2896 insertions(+), 2171 deletions(-) create mode 100644 Logtalk/examples/dcgs/tokenizer.lgt create mode 100644 Logtalk/examples/proxies/NOTES create mode 100644 Logtalk/examples/proxies/SCRIPT create mode 100644 Logtalk/examples/proxies/loader.lgt create mode 100644 Logtalk/examples/proxies/proxies.lgt create mode 100644 Logtalk/wenv/textmate/Logtalk.tmbundle/Preferences/Completions.plist create mode 100644 Logtalk/wenv/textmate/Logtalk.tmbundle/Preferences/Entity list.plist diff --git a/Logtalk/INSTALL b/Logtalk/INSTALL index c5870da52..e2f296117 100644 --- a/Logtalk/INSTALL +++ b/Logtalk/INSTALL @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= @@ -108,34 +108,7 @@ variable for all users and also sets the LOGTALKUSER environment variable for the administrator user running the script. -3. CREATING NEW PROLOG TOP-LEVELS FOR AUTOMATIC LOADING OF LOGTALK - -Most Prolog compilers allows the user to define an initialization file that -is automatically consulted at startup. This initialization file may contain -directives for loading other files, such as the Logtalk configuration file -and the Logtalk compiler. The "$LOGTALKHOME/scripts" sub-directory contains -several scripts (named "make_*lgt.*") for automating the creation of these -initialization files for some Prolog compilers. In addition, be sure to read -the "configs/NOTES" file notes on the Prolog compilers that you intend to use. -There are also "makeall_lgt.*" scripts that try to run all the individual -"make_*lgt.*" scripts: - ->> POSIX systems: - - % cd $LOGTALKHOME/scripts - % sudo ./makeall_lgt.sh - ->> Windows: - - C:\> cd %LOGTALKHOME%\scripts - C:\> cscript makeall_lgt.js - -This assumes that your favorite Prolog compilers are supported by the -"make_*lgt.*" scripts. If that is not the case, don't worry: just follow -the steps described in the "QUICK_START" file. - - -4. COPYING THE LOGTALK USER-MODIFIABLE FILES TO USERS HOME DIRECTORIES +3. COPYING THE LOGTALK USER-MODIFIABLE FILES TO USERS HOME DIRECTORIES If you installed Logtalk on your home directory, then skip this step if you have set both Logtalk environment variables (LOGTALKHOME and LOGTALKUSER) to @@ -162,6 +135,33 @@ directory, this setup as the advantage of allowing each end-user to independently customize default compilation options and library paths. +4. CREATING NEW PROLOG TOP-LEVELS FOR AUTOMATIC LOADING OF LOGTALK + +Most Prolog compilers allows the user to define an initialization file that +is automatically consulted at startup. This initialization file may contain +directives for loading other files, such as the Logtalk configuration file +and the Logtalk compiler. The "$LOGTALKHOME/scripts" sub-directory contains +several scripts (named "make_*lgt.*") for automating the creation of these +initialization files for some Prolog compilers. In addition, be sure to read +the "configs/NOTES" file notes on the Prolog compilers that you intend to use. +There are also "makeall_lgt.*" scripts that try to run all the individual +"make_*lgt.*" scripts: + +>> POSIX systems: + + % cd $LOGTALKHOME/scripts + % sudo ./makeall_lgt.sh + +>> Windows: + + C:\> cd %LOGTALKHOME%\scripts + C:\> cscript makeall_lgt.js + +This assumes that your favorite Prolog compilers are supported by the +"make_*lgt.*" scripts. If that is not the case, don't worry: just follow +the steps described in the "QUICK_START" file. + + 5. SETTING LIBRARY PATHS In Logtalk, a library is simply a directory containing source files. Library diff --git a/Logtalk/QUICK_START b/Logtalk/QUICK_START index fd13584a5..248521183 100644 --- a/Logtalk/QUICK_START +++ b/Logtalk/QUICK_START @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/README b/Logtalk/README index b17019fd2..8da567fdf 100644 --- a/Logtalk/README +++ b/Logtalk/README @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/RELEASE_NOTES b/Logtalk/RELEASE_NOTES index 8b2acbb88..99ffbd1d9 100644 --- a/Logtalk/RELEASE_NOTES +++ b/Logtalk/RELEASE_NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= @@ -10,6 +10,45 @@ RELEASE NOTES ============= +2.27.1 - March 27, 2006 + + Allow calls to the built-in method parameter/2 with the first argument + not instantiated at compile time. Detect and report as a compilation + error parameter/2 indexes that are out of range. + + Optimized generation of predicate definition and declaration linking + clauses, resulting in small lookup performance improvements and in space + savings for the Prolog code generated when compiling Logtalk entities. + + Many minor code and documentation improvements to the Logtalk compiler. + + Added an object version of the tokenizer described in the Michael + Covington's paper "Tokenization using DCG Rules" to the "dcgs" example. + + Improved integration code for Qu-Prolog and Logtalk ("configs/qphook.ql"). + + Improved library hierarchy methods that return lists of objects in order + to avoid duplicated elements (library objects "proto_hierarchy.lgt" and + "class_hierarchy.lgt"). Added new methods extension/1 and extensions/1 to + the library object "proto_hierarchy.lgt". + + Documented the concept of "parametric object proxy". Added a new example, + "proxies", illustrating the use of parametric object proxies. + + Added support for code completion and for listing entity names on the + symbol pop-up menu to the MacOS X TextMate text editor. + + Updated the "cplgtdirs.*" scripts to also create an alias/shortcut to the + "wenv" directory. + + Renamed the alternative compilation and documentation directory names on + all config files to be compatible across operating-systems. Removed unused + predicate '$lgt_reverse'/2 from all config files. + + Updated HTML manuals "print.css" CSS file for compatibility with the + latest version of CSSToXSLFO. + + 2.27.0 - February 9, 2006 Improved performance for local calls to the built-in methods phrase/2-3. diff --git a/Logtalk/UPGRADING b/Logtalk/UPGRADING index 05d276d4d..b426ad657 100644 --- a/Logtalk/UPGRADING +++ b/Logtalk/UPGRADING @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= @@ -122,3 +122,9 @@ generated by previous Logtalk versions. Logtalk version 2.27.0 changes representation of declared predicates in order to support the new predicate property non_terminal/1, implying recompilation of all objects, protocols, and categories. + +Logtalk version 2.27.1 optimizes the generation of predicate definition and +declaration linking clauses, resulting in small performance improvements and +in space savings for the Prolog code generated when compiling Logtalk entities. +Recompilation of all objects, protocols, and categories is necessary in order +to take advantage of this optimizations. diff --git a/Logtalk/contributions/NOTES b/Logtalk/contributions/NOTES index 527273d3c..80a00772c 100644 --- a/Logtalk/contributions/NOTES +++ b/Logtalk/contributions/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/NOTES b/Logtalk/examples/NOTES index 9446d4f1d..facc560bf 100644 --- a/Logtalk/examples/NOTES +++ b/Logtalk/examples/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= @@ -145,6 +145,9 @@ polygons profiling examples of using of events and monitors to implement profilers +proxies + example of using parametric object proxies + puzzles several examples of logical puzzles diff --git a/Logtalk/examples/aliases/NOTES b/Logtalk/examples/aliases/NOTES index 21fc7dd37..22ee92578 100644 --- a/Logtalk/examples/aliases/NOTES +++ b/Logtalk/examples/aliases/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/aliases/SCRIPT b/Logtalk/examples/aliases/SCRIPT index 06bbec98b..83b9b4ab1 100644 --- a/Logtalk/examples/aliases/SCRIPT +++ b/Logtalk/examples/aliases/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/assignvars/NOTES b/Logtalk/examples/assignvars/NOTES index 0d26f4e3b..8bd1ecfef 100644 --- a/Logtalk/examples/assignvars/NOTES +++ b/Logtalk/examples/assignvars/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/assignvars/SCRIPT b/Logtalk/examples/assignvars/SCRIPT index 75a5bb155..3608d96fd 100644 --- a/Logtalk/examples/assignvars/SCRIPT +++ b/Logtalk/examples/assignvars/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/benchmarks/NOTES b/Logtalk/examples/benchmarks/NOTES index c07da4431..d10d402cc 100644 --- a/Logtalk/examples/benchmarks/NOTES +++ b/Logtalk/examples/benchmarks/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/benchmarks/SCRIPT b/Logtalk/examples/benchmarks/SCRIPT index 91c8b6784..2d6496009 100644 --- a/Logtalk/examples/benchmarks/SCRIPT +++ b/Logtalk/examples/benchmarks/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/birds/NOTES b/Logtalk/examples/birds/NOTES index 3811567e6..17c0a0fa4 100644 --- a/Logtalk/examples/birds/NOTES +++ b/Logtalk/examples/birds/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/birds/SCRIPT b/Logtalk/examples/birds/SCRIPT index 3f607fa22..f1b091f05 100644 --- a/Logtalk/examples/birds/SCRIPT +++ b/Logtalk/examples/birds/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/bricks/NOTES b/Logtalk/examples/bricks/NOTES index c5fe083ce..e3944c4f5 100644 --- a/Logtalk/examples/bricks/NOTES +++ b/Logtalk/examples/bricks/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/bricks/SCRIPT b/Logtalk/examples/bricks/SCRIPT index 21ef71989..15ebe6e33 100644 --- a/Logtalk/examples/bricks/SCRIPT +++ b/Logtalk/examples/bricks/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/classvars/NOTES b/Logtalk/examples/classvars/NOTES index 16d70c49b..a8ca05385 100644 --- a/Logtalk/examples/classvars/NOTES +++ b/Logtalk/examples/classvars/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/classvars/SCRIPT b/Logtalk/examples/classvars/SCRIPT index 7b44d0ceb..be4e2e1e7 100644 --- a/Logtalk/examples/classvars/SCRIPT +++ b/Logtalk/examples/classvars/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/dcgs/NOTES b/Logtalk/examples/dcgs/NOTES index fe5b66573..dbd722424 100644 --- a/Logtalk/examples/dcgs/NOTES +++ b/Logtalk/examples/dcgs/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/dcgs/SCRIPT b/Logtalk/examples/dcgs/SCRIPT index c959e26ba..52aea5797 100644 --- a/Logtalk/examples/dcgs/SCRIPT +++ b/Logtalk/examples/dcgs/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= @@ -71,6 +71,15 @@ L = [pwd,'cd ..','ls -a'] ? yes +% convert a string to a list of tokens (words, numbers, ponctuation): + +| ?- tokenizer::tokens(" We owe $1,048,576.24 to Agent 007 for Version 3.14159! ", Tokens). + +Tokens = [we,owe,$,1048576.24,to,agent,7,for,version,3.14159,!] ? + +yes + + % walker movements: | ?- walker::walk([n(5), e(4), s(2), nw(8), s(5), se(1), n(4)], Ending). diff --git a/Logtalk/examples/dcgs/loader.lgt b/Logtalk/examples/dcgs/loader.lgt index b49060260..949a00d5e 100644 --- a/Logtalk/examples/dcgs/loader.lgt +++ b/Logtalk/examples/dcgs/loader.lgt @@ -6,6 +6,7 @@ enigma, parsetree, sentences, + tokenizer, url, xml, shell, @@ -26,6 +27,7 @@ files, comment the directive above and uncomment the directive below enigma, parsetree, sentences, + tokenizer, url, xml, shell, diff --git a/Logtalk/examples/dcgs/tokenizer.lgt b/Logtalk/examples/dcgs/tokenizer.lgt new file mode 100644 index 000000000..e6ea518c4 --- /dev/null +++ b/Logtalk/examples/dcgs/tokenizer.lgt @@ -0,0 +1,114 @@ + +% Natural Language Processing in Prolog using Definite Clause Grammar rules +% +% This example is a straightforward adaptation of the original plain Prolog +% code described in the paper: +% +% Tokenization using DCG Rules +% Michael A. Covington +% Artificial Intelligence Center +% The University of Georgia +% Athens, Georgia 30602-7415 U.S.A. +% 2000 April 21 +% +% A copy of the paper is available at: +% +% http://www.ai.uga.edu/~mc/projpaper.ps +% +% Usage example: +% +% | ?- tokenizer::tokens(" We owe $1,048,576.24 to Agent 007 for Version 3.14159! ", Tokens). + +:- object(tokenizer). + + :- info([ + version is 1.0, + date is 2006/2/11, + author is 'Michael A. Covington', + comment is 'Natural language tokenizer example using DCG rules.']). + + :- public(tokens/2). + :- mode(tokens(+string, -list), zero_or_more). + :- info(tokens/2, [ + comment is 'Parses a string into a list of tokens.', + argnames is ['String', 'Tokens']]). + + tokens(String, Tokens) :- + phrase(token_list(Tokens), String). + + % A token list is a series of zero or more tokens. + % Its argument consists of the list of tokens, as atoms and numbers. + % The cut ensures that the maximum number of characters is gathered into each token. + + token_list([T| Rest]) --> blank0, token(T), !, token_list(Rest). + token_list([]) --> blank0. + + % blank0 is a series of zero or more blanks. + + blank0 --> [C], {char_type(C, blank)}, !, blank0. + blank0 --> []. + + % Several kinds of tokens. + % This is where lists of characters get converted into atoms or numbers. + + token(T) --> special(L), {atom_codes(T, L)}. + token(T) --> word(W), {atom_codes(T, W)}. + token(T) --> numeral(N), {number_codes(T, N)}. + + % A word is a series of one or more letters. + % The rules are ordered so that we first try to gather as many + % characters into one digit_string as possible. + + word([L| Rest]) --> letter(L), word(Rest). + word([L]) --> letter(L). + + % A numeral is a list of characters that constitute a number. + % The argument of numeral(...) is the list of character codes. + + numeral([C1, C2, C3| N]) --> ",", digit(C1), digit(C2), digit(C3), numeral(N). + numeral([C1, C2, C3]) --> ",", digit(C1), digit(C2), digit(C3). + numeral([C| N]) --> digit(C), numeral(N). % multiple digits + numeral([C]) --> digit(C). % single digit + numeral(N) --> decimal_part(N). % decimal point and more digits + + decimal_part([46| Rest]) --> ".", digit_string(Rest). + + digit_string([D| N]) --> digit(D), digit_string(N). + digit_string([D]) --> digit(D). + + % Various kinds of characters... + + digit(C) --> [C], {char_type(C, numeric)}. + + special([C]) --> [C], {char_type(C, special)}. + + letter(C) --> [C], {char_type(C, lowercase)}. + letter(C) --> [U], {char_type(U, uppercase), C is U + 32}. % Conversion to lowercase + + % char_type(+Code, ?Type) + % Classifies a character (ASCII code) as blank, numeric, uppercase, lowercase, or special. + % Adapted from Covington 1994. + + char_type(Code, Type) :- % blanks, other ctrl codes + Code =< 32, + !, + Type = blank. + + char_type(Code, Type) :- % digits + 48 =< Code, Code =< 57, + !, + Type = numeric. + + char_type(Code, Type) :- % lowercase letters + 97 =< Code, Code =< 122, + !, + Type = lowercase. + + char_type(Code, Type) :- % uppercase letters + 65 =< Code, Code =< 90, + !, + Type = uppercase. + + char_type(_, special). % all others + +:- end_object. diff --git a/Logtalk/examples/diamonds/NOTES b/Logtalk/examples/diamonds/NOTES index b484e7c4b..ec63dfd44 100644 --- a/Logtalk/examples/diamonds/NOTES +++ b/Logtalk/examples/diamonds/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/diamonds/SCRIPT b/Logtalk/examples/diamonds/SCRIPT index 1b75cf9aa..775b63ec8 100644 --- a/Logtalk/examples/diamonds/SCRIPT +++ b/Logtalk/examples/diamonds/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/dynpred/NOTES b/Logtalk/examples/dynpred/NOTES index 1d807d963..ca0dd88ff 100644 --- a/Logtalk/examples/dynpred/NOTES +++ b/Logtalk/examples/dynpred/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/dynpred/SCRIPT b/Logtalk/examples/dynpred/SCRIPT index b650de6b7..caf949dc8 100644 --- a/Logtalk/examples/dynpred/SCRIPT +++ b/Logtalk/examples/dynpred/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/encodings/NOTES b/Logtalk/examples/encodings/NOTES index acf22c848..68e3879c0 100644 --- a/Logtalk/examples/encodings/NOTES +++ b/Logtalk/examples/encodings/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/encodings/SCRIPT b/Logtalk/examples/encodings/SCRIPT index d300d9932..6fd702e14 100644 --- a/Logtalk/examples/encodings/SCRIPT +++ b/Logtalk/examples/encodings/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/engines/NOTES b/Logtalk/examples/engines/NOTES index 4dc0bbdce..06a0c8b96 100644 --- a/Logtalk/examples/engines/NOTES +++ b/Logtalk/examples/engines/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/engines/SCRIPT b/Logtalk/examples/engines/SCRIPT index 7cafd5459..4e9669e60 100644 --- a/Logtalk/examples/engines/SCRIPT +++ b/Logtalk/examples/engines/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/errors/NOTES b/Logtalk/examples/errors/NOTES index 0c807512a..cd701d3a8 100644 --- a/Logtalk/examples/errors/NOTES +++ b/Logtalk/examples/errors/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/errors/SCRIPT b/Logtalk/examples/errors/SCRIPT index b9294d84d..360ade39b 100644 --- a/Logtalk/examples/errors/SCRIPT +++ b/Logtalk/examples/errors/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/expansion/NOTES b/Logtalk/examples/expansion/NOTES index 4dc0bbdce..06a0c8b96 100644 --- a/Logtalk/examples/expansion/NOTES +++ b/Logtalk/examples/expansion/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/expansion/SCRIPT b/Logtalk/examples/expansion/SCRIPT index fb4d23e01..dfd157b47 100644 --- a/Logtalk/examples/expansion/SCRIPT +++ b/Logtalk/examples/expansion/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/hello_world/NOTES b/Logtalk/examples/hello_world/NOTES index da67f3cde..68d7e1de7 100644 --- a/Logtalk/examples/hello_world/NOTES +++ b/Logtalk/examples/hello_world/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/hello_world/SCRIPT b/Logtalk/examples/hello_world/SCRIPT index 1d60132db..7d204f873 100644 --- a/Logtalk/examples/hello_world/SCRIPT +++ b/Logtalk/examples/hello_world/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/hooks/NOTES b/Logtalk/examples/hooks/NOTES index 6dc9fe7a7..64ed96c2e 100644 --- a/Logtalk/examples/hooks/NOTES +++ b/Logtalk/examples/hooks/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/hooks/SCRIPT b/Logtalk/examples/hooks/SCRIPT index c1a915608..dfc3655bf 100644 --- a/Logtalk/examples/hooks/SCRIPT +++ b/Logtalk/examples/hooks/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/inheritance/NOTES b/Logtalk/examples/inheritance/NOTES index 1efe03d0e..f0433925e 100644 --- a/Logtalk/examples/inheritance/NOTES +++ b/Logtalk/examples/inheritance/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/inheritance/SCRIPT b/Logtalk/examples/inheritance/SCRIPT index ac61dd856..baccc5351 100644 --- a/Logtalk/examples/inheritance/SCRIPT +++ b/Logtalk/examples/inheritance/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/instmethods/NOTES b/Logtalk/examples/instmethods/NOTES index 6c9590c1a..dc9243bda 100644 --- a/Logtalk/examples/instmethods/NOTES +++ b/Logtalk/examples/instmethods/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/instmethods/SCRIPT b/Logtalk/examples/instmethods/SCRIPT index e04fd9a85..561b21324 100644 --- a/Logtalk/examples/instmethods/SCRIPT +++ b/Logtalk/examples/instmethods/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/lo/NOTES b/Logtalk/examples/lo/NOTES index 03cdc13a2..af8855d22 100644 --- a/Logtalk/examples/lo/NOTES +++ b/Logtalk/examples/lo/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/lo/planner/NOTES b/Logtalk/examples/lo/planner/NOTES index b9361fbd7..bf74aa703 100644 --- a/Logtalk/examples/lo/planner/NOTES +++ b/Logtalk/examples/lo/planner/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/lo/planner/SCRIPT b/Logtalk/examples/lo/planner/SCRIPT index 4c6e90ad6..9199f4630 100644 --- a/Logtalk/examples/lo/planner/SCRIPT +++ b/Logtalk/examples/lo/planner/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/lo/travellers/NOTES b/Logtalk/examples/lo/travellers/NOTES index b9361fbd7..bf74aa703 100644 --- a/Logtalk/examples/lo/travellers/NOTES +++ b/Logtalk/examples/lo/travellers/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/lo/travellers/SCRIPT b/Logtalk/examples/lo/travellers/SCRIPT index c4ed14609..84e73688e 100644 --- a/Logtalk/examples/lo/travellers/SCRIPT +++ b/Logtalk/examples/lo/travellers/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/logic/NOTES b/Logtalk/examples/logic/NOTES index ff5487c00..c4e044e39 100644 --- a/Logtalk/examples/logic/NOTES +++ b/Logtalk/examples/logic/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/logic/SCRIPT b/Logtalk/examples/logic/SCRIPT index e89dfe403..708df7a39 100644 --- a/Logtalk/examples/logic/SCRIPT +++ b/Logtalk/examples/logic/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/lpa/NOTES b/Logtalk/examples/lpa/NOTES index ee9cdef85..3de6dde4b 100644 --- a/Logtalk/examples/lpa/NOTES +++ b/Logtalk/examples/lpa/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/lpa/faults/NOTES b/Logtalk/examples/lpa/faults/NOTES index 00bac0689..94c38400e 100644 --- a/Logtalk/examples/lpa/faults/NOTES +++ b/Logtalk/examples/lpa/faults/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/lpa/faults/SCRIPT b/Logtalk/examples/lpa/faults/SCRIPT index 144a71fab..d0ade91e5 100644 --- a/Logtalk/examples/lpa/faults/SCRIPT +++ b/Logtalk/examples/lpa/faults/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/lpa/timetables/NOTES b/Logtalk/examples/lpa/timetables/NOTES index 35d90a536..4992e58b8 100644 --- a/Logtalk/examples/lpa/timetables/NOTES +++ b/Logtalk/examples/lpa/timetables/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/lpa/timetables/SCRIPT b/Logtalk/examples/lpa/timetables/SCRIPT index 276ddcd5b..5e0382fb0 100644 --- a/Logtalk/examples/lpa/timetables/SCRIPT +++ b/Logtalk/examples/lpa/timetables/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/metainterpreters/NOTES b/Logtalk/examples/metainterpreters/NOTES index 4b7fbb46b..afd509747 100644 --- a/Logtalk/examples/metainterpreters/NOTES +++ b/Logtalk/examples/metainterpreters/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/metainterpreters/SCRIPT b/Logtalk/examples/metainterpreters/SCRIPT index c90e5dd70..4d42c8430 100644 --- a/Logtalk/examples/metainterpreters/SCRIPT +++ b/Logtalk/examples/metainterpreters/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/metapredicates/NOTES b/Logtalk/examples/metapredicates/NOTES index e583e7738..b4f6d1b31 100644 --- a/Logtalk/examples/metapredicates/NOTES +++ b/Logtalk/examples/metapredicates/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/metapredicates/SCRIPT b/Logtalk/examples/metapredicates/SCRIPT index 1066a7855..2c60bb365 100644 --- a/Logtalk/examples/metapredicates/SCRIPT +++ b/Logtalk/examples/metapredicates/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/mi/NOTES b/Logtalk/examples/mi/NOTES index 3344fa4a1..ce6005da5 100644 --- a/Logtalk/examples/mi/NOTES +++ b/Logtalk/examples/mi/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/mi/SCRIPT b/Logtalk/examples/mi/SCRIPT index a5dc48dc9..ae54d4f56 100644 --- a/Logtalk/examples/mi/SCRIPT +++ b/Logtalk/examples/mi/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/miscellaneous/NOTES b/Logtalk/examples/miscellaneous/NOTES index c12f7759b..16c4506a3 100644 --- a/Logtalk/examples/miscellaneous/NOTES +++ b/Logtalk/examples/miscellaneous/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/miscellaneous/SCRIPT b/Logtalk/examples/miscellaneous/SCRIPT index 9344c88e5..2e62e7b27 100644 --- a/Logtalk/examples/miscellaneous/SCRIPT +++ b/Logtalk/examples/miscellaneous/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/modules/NOTES b/Logtalk/examples/modules/NOTES index b7e43c86c..d9d1ba6f3 100644 --- a/Logtalk/examples/modules/NOTES +++ b/Logtalk/examples/modules/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/modules/SCRIPT b/Logtalk/examples/modules/SCRIPT index 66c6bae04..362041f5e 100644 --- a/Logtalk/examples/modules/SCRIPT +++ b/Logtalk/examples/modules/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/msglog/NOTES b/Logtalk/examples/msglog/NOTES index 299a4b53d..96889b127 100644 --- a/Logtalk/examples/msglog/NOTES +++ b/Logtalk/examples/msglog/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/msglog/SCRIPT b/Logtalk/examples/msglog/SCRIPT index cdba02623..27b5082b7 100644 --- a/Logtalk/examples/msglog/SCRIPT +++ b/Logtalk/examples/msglog/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/operators/NOTES b/Logtalk/examples/operators/NOTES index 524458621..3e641b08f 100644 --- a/Logtalk/examples/operators/NOTES +++ b/Logtalk/examples/operators/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/operators/SCRIPT b/Logtalk/examples/operators/SCRIPT index 7d0e51d03..c122fbc5f 100644 --- a/Logtalk/examples/operators/SCRIPT +++ b/Logtalk/examples/operators/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/parametric/NOTES b/Logtalk/examples/parametric/NOTES index 955397a7c..e6c06ccdc 100644 --- a/Logtalk/examples/parametric/NOTES +++ b/Logtalk/examples/parametric/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/parametric/SCRIPT b/Logtalk/examples/parametric/SCRIPT index 507a1d1ee..7a8c008c8 100644 --- a/Logtalk/examples/parametric/SCRIPT +++ b/Logtalk/examples/parametric/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/points/NOTES b/Logtalk/examples/points/NOTES index 2a3961ac0..79c9a88a5 100644 --- a/Logtalk/examples/points/NOTES +++ b/Logtalk/examples/points/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/points/SCRIPT b/Logtalk/examples/points/SCRIPT index 305f8dbe3..422b24d52 100644 --- a/Logtalk/examples/points/SCRIPT +++ b/Logtalk/examples/points/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/polygons/NOTES b/Logtalk/examples/polygons/NOTES index 0634e20a3..e0994276c 100644 --- a/Logtalk/examples/polygons/NOTES +++ b/Logtalk/examples/polygons/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/polygons/SCRIPT b/Logtalk/examples/polygons/SCRIPT index 1727616e2..9496a3eaa 100644 --- a/Logtalk/examples/polygons/SCRIPT +++ b/Logtalk/examples/polygons/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/profiling/NOTES b/Logtalk/examples/profiling/NOTES index 41d10420c..40b5fa421 100644 --- a/Logtalk/examples/profiling/NOTES +++ b/Logtalk/examples/profiling/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/profiling/SCRIPT b/Logtalk/examples/profiling/SCRIPT index 7498095cc..2ec3f8278 100644 --- a/Logtalk/examples/profiling/SCRIPT +++ b/Logtalk/examples/profiling/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/proxies/NOTES b/Logtalk/examples/proxies/NOTES new file mode 100644 index 000000000..ed92cec93 --- /dev/null +++ b/Logtalk/examples/proxies/NOTES @@ -0,0 +1,33 @@ +================================================================= +Logtalk - Object oriented extension to Prolog +Release 2.27.1 + +Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. +================================================================= + + +To load this example and for sample queries, please see the SCRIPT file. + +A parametric object may be used to represent objects whose "state" is static +and set when the object is defined. However, there can be only one parametric +object with a given functor and arity. For example, if we define the following +parametric object: + + :- object(circle(_Radius, _Color)). + ... + :- end_object. + +then the following terms may be interpreted as references to the object above: + + circle(1, blue) + circle(2, yellow) + +In the context of parametric objects, the above terms are know as "parametric +object proxies". Proxies represent different instantiations of a parametric +object parameters. They may be stored on the database as Prolog facts. This +results in a very compact representation, which can be an advantage when +dealing with a large number of objects. However, this is also a fragile +solution as changes on the parametric object ancestors may imply changes to +the number and meaning of the parametric object parameters which, in turn, +may imply changes to all the Prolog facts used to represent the individual +objects. diff --git a/Logtalk/examples/proxies/SCRIPT b/Logtalk/examples/proxies/SCRIPT new file mode 100644 index 000000000..a8889de6a --- /dev/null +++ b/Logtalk/examples/proxies/SCRIPT @@ -0,0 +1,24 @@ +================================================================= +Logtalk - Object oriented extension to Prolog +Release 2.27.1 + +Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. +================================================================= + + +% start by loading the example: + +| ?- logtalk_load(proxies(loader)). +... + + +% print the area and the perimeter for all circle proxies: + +| ?- forall(circle(Id, R, C), (write(Id), write(' '), circle(R, C)::print)). + +#1 area: 4.75291, perimeter: 7.72831, color: blue +#2 area: 43.2412, perimeter: 23.3106, color: yellow +#3 area: 0.477836, perimeter: 2.45044, color: green +#4 area: 103.508, perimeter: 36.0655, color: black +#5 area: 217.468, perimeter: 52.2761, color: cyan +yes diff --git a/Logtalk/examples/proxies/loader.lgt b/Logtalk/examples/proxies/loader.lgt new file mode 100644 index 000000000..d5285528f --- /dev/null +++ b/Logtalk/examples/proxies/loader.lgt @@ -0,0 +1,13 @@ + +:- initialization( + logtalk_load( + [proxies])). + +/* +If you intend to use the FOP XSL:FO processor for generating PDF documenting +files, comment the directive above and uncomment the directive below + +:- initialization( + logtalk_load( + [proxies], [xmlsref(standalone)])). +*/ diff --git a/Logtalk/examples/proxies/proxies.lgt b/Logtalk/examples/proxies/proxies.lgt new file mode 100644 index 000000000..72f3e53dd --- /dev/null +++ b/Logtalk/examples/proxies/proxies.lgt @@ -0,0 +1,39 @@ + +:- object(circle(_Radius, _Color)). + + :- public([ + radius/1, + color/1, + area/1, + perimeter/1, + print/0]). + + radius(Radius) :- + parameter(1, Radius). + + color(Color) :- + parameter(2, Color). + + area(Area) :- + ::radius(Radius), + Area is 3.1415927*Radius*Radius. + + perimeter(Perimeter) :- + ::radius(Radius), + Perimeter is 2*3.1415927*Radius. + + print :- + area(Area), write('area: '), write(Area), + perimeter(Perimeter), write(', perimeter: '), write(Perimeter), + color(Color), write(', color: '), write(Color), nl. + +:- end_object. + + +% parametric object proxies (with an extra argument to represent identity): + +circle('#1', 1.23, blue). +circle('#2', 3.71, yellow). +circle('#3', 0.39, green). +circle('#4', 5.74, black). +circle('#5', 8.32, cyan). diff --git a/Logtalk/examples/puzzles/NOTES b/Logtalk/examples/puzzles/NOTES index 111832d7f..5677b1f65 100644 --- a/Logtalk/examples/puzzles/NOTES +++ b/Logtalk/examples/puzzles/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/puzzles/SCRIPT b/Logtalk/examples/puzzles/SCRIPT index 8dd6a0a66..5c7654a1b 100644 --- a/Logtalk/examples/puzzles/SCRIPT +++ b/Logtalk/examples/puzzles/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/reflection/NOTES b/Logtalk/examples/reflection/NOTES index 953a05732..10d8df450 100644 --- a/Logtalk/examples/reflection/NOTES +++ b/Logtalk/examples/reflection/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/reflection/SCRIPT b/Logtalk/examples/reflection/SCRIPT index 9111f7991..7e7e9aea1 100644 --- a/Logtalk/examples/reflection/SCRIPT +++ b/Logtalk/examples/reflection/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/relations/NOTES b/Logtalk/examples/relations/NOTES index 73b4b4231..3253c467f 100644 --- a/Logtalk/examples/relations/NOTES +++ b/Logtalk/examples/relations/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/relations/SCRIPT b/Logtalk/examples/relations/SCRIPT index 0c92df779..0c7c90251 100644 --- a/Logtalk/examples/relations/SCRIPT +++ b/Logtalk/examples/relations/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/roots/NOTES b/Logtalk/examples/roots/NOTES index 76a08558e..10311b6d7 100644 --- a/Logtalk/examples/roots/NOTES +++ b/Logtalk/examples/roots/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/roots/SCRIPT b/Logtalk/examples/roots/SCRIPT index eafdda3c5..2c5bdb1e9 100644 --- a/Logtalk/examples/roots/SCRIPT +++ b/Logtalk/examples/roots/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/searching/NOTES b/Logtalk/examples/searching/NOTES index b92cd30d6..3c4954e85 100644 --- a/Logtalk/examples/searching/NOTES +++ b/Logtalk/examples/searching/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/searching/SCRIPT b/Logtalk/examples/searching/SCRIPT index 5e1cdeb9f..35ee805d9 100644 --- a/Logtalk/examples/searching/SCRIPT +++ b/Logtalk/examples/searching/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/shapes/NOTES b/Logtalk/examples/shapes/NOTES index 6673d8f62..5d9de9b6a 100644 --- a/Logtalk/examples/shapes/NOTES +++ b/Logtalk/examples/shapes/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/shapes/ch/NOTES b/Logtalk/examples/shapes/ch/NOTES index 497fd24cb..da66a21b4 100644 --- a/Logtalk/examples/shapes/ch/NOTES +++ b/Logtalk/examples/shapes/ch/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/shapes/ch/SCRIPT b/Logtalk/examples/shapes/ch/SCRIPT index 2027ff09c..40112e935 100644 --- a/Logtalk/examples/shapes/ch/SCRIPT +++ b/Logtalk/examples/shapes/ch/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/shapes/ph/NOTES b/Logtalk/examples/shapes/ph/NOTES index b9361fbd7..bf74aa703 100644 --- a/Logtalk/examples/shapes/ph/NOTES +++ b/Logtalk/examples/shapes/ph/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/shapes/ph/SCRIPT b/Logtalk/examples/shapes/ph/SCRIPT index 8d78d9828..07bd6daaa 100644 --- a/Logtalk/examples/shapes/ph/SCRIPT +++ b/Logtalk/examples/shapes/ph/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/sicstus/NOTES b/Logtalk/examples/sicstus/NOTES index fe7b60fea..4402bd7bc 100644 --- a/Logtalk/examples/sicstus/NOTES +++ b/Logtalk/examples/sicstus/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/sicstus/SCRIPT b/Logtalk/examples/sicstus/SCRIPT index 49622001a..d3324c3f3 100644 --- a/Logtalk/examples/sicstus/SCRIPT +++ b/Logtalk/examples/sicstus/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/symdiff/NOTES b/Logtalk/examples/symdiff/NOTES index 092b42282..94e15ab66 100644 --- a/Logtalk/examples/symdiff/NOTES +++ b/Logtalk/examples/symdiff/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/symdiff/SCRIPT b/Logtalk/examples/symdiff/SCRIPT index 136f768df..5768a7d07 100644 --- a/Logtalk/examples/symdiff/SCRIPT +++ b/Logtalk/examples/symdiff/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/viewpoints/NOTES b/Logtalk/examples/viewpoints/NOTES index 3a217092a..691b58d63 100644 --- a/Logtalk/examples/viewpoints/NOTES +++ b/Logtalk/examples/viewpoints/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/examples/viewpoints/SCRIPT b/Logtalk/examples/viewpoints/SCRIPT index 9c7829791..0ef626eb7 100644 --- a/Logtalk/examples/viewpoints/SCRIPT +++ b/Logtalk/examples/viewpoints/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/libpaths/NOTES b/Logtalk/libpaths/NOTES index 255a3a99e..38a838d16 100644 --- a/Logtalk/libpaths/NOTES +++ b/Logtalk/libpaths/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/libpaths/libpaths.pl b/Logtalk/libpaths/libpaths.pl index ef225b48c..83bba5452 100644 --- a/Logtalk/libpaths/libpaths.pl +++ b/Logtalk/libpaths/libpaths.pl @@ -2,7 +2,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Logtalk - Object oriented extension to Prolog -% Release 2.27.0 +% Release 2.27.1 % % Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. % @@ -47,6 +47,7 @@ assertz(logtalk_library_path(points, examples('points/'))), assertz(logtalk_library_path(polygons, examples('polygons/'))), assertz(logtalk_library_path(profiling, examples('profiling/'))), + assertz(logtalk_library_path(proxies, examples('proxies/'))), assertz(logtalk_library_path(puzzles, examples('puzzles/'))), assertz(logtalk_library_path(reflection, examples('reflection/'))), assertz(logtalk_library_path(relations, examples('relations/'))), diff --git a/Logtalk/library/NOTES b/Logtalk/library/NOTES index 900f8387d..2fdf22ea7 100644 --- a/Logtalk/library/NOTES +++ b/Logtalk/library/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/SCRIPT b/Logtalk/library/SCRIPT index 69fb08907..551319843 100644 --- a/Logtalk/library/SCRIPT +++ b/Logtalk/library/SCRIPT @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/all.notes b/Logtalk/library/all.notes index 905c479fd..0f98c22c1 100644 --- a/Logtalk/library/all.notes +++ b/Logtalk/library/all.notes @@ -1,7 +1,7 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/class_hierarchy.lgt b/Logtalk/library/class_hierarchy.lgt index 78cf48cf2..af6757ee6 100644 --- a/Logtalk/library/class_hierarchy.lgt +++ b/Logtalk/library/class_hierarchy.lgt @@ -4,9 +4,9 @@ :- info([ - version is 1.0, + version is 1.1, author is 'Paulo Moura', - date is 2000/7/24, + date is 2006/2/20, comment is 'Class hierarchy predicates.']). @@ -96,7 +96,10 @@ leaves(Leaves) :- self(Self), - findall(Leaf, leaf(Self, Leaf), Leaves). + ( setof(Leaf, leaf(Self, Leaf), Leaves) -> + true + ; Leaves = [] + ). leaf_instance(Leaf) :- @@ -115,7 +118,10 @@ leaf_instances(Leaves) :- self(Self), - findall(Leaf, leaf_instance(Self, Leaf), Leaves). + ( setof(Leaf, leaf_instance(Self, Leaf), Leaves) -> + true + ; Leaves = [] + ). leaf_class(Leaf) :- @@ -132,7 +138,10 @@ leaf_classes(Leaves) :- self(Self), - findall(Leaf, leaf_class(Self, Leaf), Leaves). + ( setof(Leaf, leaf_class(Self, Leaf), Leaves) -> + true + ; Leaves = [] + ). descendant(Descendant) :- @@ -154,7 +163,10 @@ descendants(Descendants) :- self(Self), - findall(Descendant, descendant(Self, Descendant), Descendants). + ( setof(Descendant, descendant(Self, Descendant), Descendants) -> + true + ; Descendants = [] + ). descendant_class(Descendant) :- @@ -172,7 +184,10 @@ descendant_classes(Descendants) :- self(Self), - findall(Descendant, descendant_class(Self, Descendant), Descendants). + ( setof(Descendant, descendant_class(Self, Descendant), Descendants) -> + true + ; Descendants = [] + ). descendant_instance(Descendant) :- @@ -190,7 +205,10 @@ descendant_instances(Descendants) :- self(Self), - findall(Descendant, descendant_instance(Self, Descendant), Descendants). + ( setof(Descendant, descendant_instance(Self, Descendant), Descendants) -> + true + ; Descendants = [] + ). :- end_category. diff --git a/Logtalk/library/date.lgt b/Logtalk/library/date.lgt index 76ee5fd3a..a762b2af9 100644 --- a/Logtalk/library/date.lgt +++ b/Logtalk/library/date.lgt @@ -4,9 +4,9 @@ :- info([ - version is 1.0, + version is 1.1, author is 'Paulo Moura', - date is 2000/7/24, + date is 2006/3/7, comment is 'Date predicates.']). @@ -15,11 +15,10 @@ leap_year(Year) :- - (0 is mod(Year, 4), - \+ 0 is mod(Year, 100) - ; - 0 is mod(Year, 400)), - !. + ( 0 =:= mod(Year, 4), 0 =\= mod(Year, 100) -> + true + ; 0 =:= mod(Year, 400) + ). name_of_day(1, 'Sunday', 'Sun'). diff --git a/Logtalk/library/dates.notes b/Logtalk/library/dates.notes index 5653c5944..a6d35ba13 100644 --- a/Logtalk/library/dates.notes +++ b/Logtalk/library/dates.notes @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/debugging.notes b/Logtalk/library/debugging.notes index 2f0ad671a..ead778ddd 100644 --- a/Logtalk/library/debugging.notes +++ b/Logtalk/library/debugging.notes @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/dependents.notes b/Logtalk/library/dependents.notes index 7c71c17cb..1b8353abe 100644 --- a/Logtalk/library/dependents.notes +++ b/Logtalk/library/dependents.notes @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/events.notes b/Logtalk/library/events.notes index b5e15395c..a2947d166 100644 --- a/Logtalk/library/events.notes +++ b/Logtalk/library/events.notes @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/experimental/NOTES b/Logtalk/library/experimental/NOTES index 5cb1e0db7..49ee276fb 100644 --- a/Logtalk/library/experimental/NOTES +++ b/Logtalk/library/experimental/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/hierarchies.notes b/Logtalk/library/hierarchies.notes index 7268a7a1b..027e1fdf4 100644 --- a/Logtalk/library/hierarchies.notes +++ b/Logtalk/library/hierarchies.notes @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/metapredicates.notes b/Logtalk/library/metapredicates.notes index 308f2ca17..a14b1acc3 100644 --- a/Logtalk/library/metapredicates.notes +++ b/Logtalk/library/metapredicates.notes @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/proto_hierarchy.lgt b/Logtalk/library/proto_hierarchy.lgt index 253a77204..016417048 100644 --- a/Logtalk/library/proto_hierarchy.lgt +++ b/Logtalk/library/proto_hierarchy.lgt @@ -4,9 +4,9 @@ :- info([ - version is 1.0, + version is 1.1, author is 'Paulo Moura', - date is 2000/7/24, + date is 2006/2/20, comment is 'Prototype hierarchy predicates.']). @@ -38,6 +38,16 @@ findall(Ancestor, ancestor(Self, Ancestor), Ancestors). + extension(Prototype) :- + self(Self), + extends_object(Prototype, Self). + + + extensions(Prototypes) :- + self(Self), + findall(Prototype, extends_object(Prototype, Self), Prototypes). + + leaf(Leaf) :- self(Self), leaf(Self, Leaf). @@ -54,7 +64,10 @@ leaves(Leaves) :- self(Self), - findall(Leaf, leaf(Self, Leaf), Leaves). + ( setof(Leaf, leaf(Self, Leaf), Leaves) -> + true + ; Leaves = [] + ). descendant(Descendant) :- @@ -76,7 +89,10 @@ descendants(Descendants) :- self(Self), - findall(Descendant, descendant(Self, Descendant), Descendants). + ( setof(Descendant, descendant(Self, Descendant), Descendants) -> + true + ; Descendants = [] + ). :- end_category. diff --git a/Logtalk/library/proto_hierarchyp.lgt b/Logtalk/library/proto_hierarchyp.lgt index 2c279746c..13bd27089 100644 --- a/Logtalk/library/proto_hierarchyp.lgt +++ b/Logtalk/library/proto_hierarchyp.lgt @@ -2,30 +2,34 @@ :- protocol(proto_hierarchyp, extends(hierarchyp)). - :- info([ - version is 1.0, + version is 1.1, author is 'Paulo Moura', - date is 2000/7/24, + date is 2006/2/20, comment is 'Prototype hierarchy protocol.']). - :- public(parent/1). - :- mode(parent(?object), zero_or_more). - :- info(parent/1, [ comment is 'Returns, by backtracking, all object parents.', argnames is ['Parent']]). - :- public(parents/1). - :- mode(parents(-list), one). - :- info(parents/1, [ comment is 'List of all object parents.', argnames is ['Parents']]). + :- public(extension/1). + :- mode(extension(?object), zero_or_more). + :- info(extension/1, [ + comment is 'Returns, by backtracking, all object direct descendants.', + argnames is ['Extension']]). + + :- public(extensions/1). + :- mode(extensions(-list), one). + :- info(extensions/1, [ + comment is 'List of all object direct descendants.', + argnames is ['Extensions']]). :- end_protocol. diff --git a/Logtalk/library/random.notes b/Logtalk/library/random.notes index 94ce687a3..bd6ec5d47 100644 --- a/Logtalk/library/random.notes +++ b/Logtalk/library/random.notes @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/library/types.notes b/Logtalk/library/types.notes index dffb2df33..70b0e8db5 100644 --- a/Logtalk/library/types.notes +++ b/Logtalk/library/types.notes @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/manuals/NOTES b/Logtalk/manuals/NOTES index fd88794ba..051558dda 100644 --- a/Logtalk/manuals/NOTES +++ b/Logtalk/manuals/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= @@ -13,17 +13,17 @@ the appearance of the pages by changing the included "screen.css" CSS file. Needless to say, the manual pages look better in recent web browser releases that support both the XHTML 1.1 and CSS web standards. -The "print.css" CSS file can be used with CSSToXSLFO (version 1.2 or +The "print.css" CSS file can be used with CSSToXSLFO (version 1.3.1 or later) to generate PDF files with page numbers suitable for printing. For informations on how to use CSSToXSLFO, please see the following URL: http://www.re.be/css2xslfo/ -An usage example would be: +An usage example (with version 1.3.1) would be: - % java -jar css2xslfo1_2.jar .html -fo .fo + % java -jar css2xslfo1_3_1.jar .html -fo .fo % xep -fo .fo -pdf .pdf RenderX's XEP is strongly recommended. Some of the others XSL-FO -processors do not support some of the used XSL-FO 1.0 constructs. \ No newline at end of file +processors do not support some of the used XSL-FO 1.0 constructs. diff --git a/Logtalk/manuals/glossary.html b/Logtalk/manuals/glossary.html index 02a360a9b..61073e7e7 100644 --- a/Logtalk/manuals/glossary.html +++ b/Logtalk/manuals/glossary.html @@ -134,6 +134,9 @@
parametric object
An object whose name is a compound term containing free variables that can be used to parameterize the object predicates.
+
parametric object proxy
+
A compond term with the same functor and usually the same number of arguments as the identifier of a parametric object.
+ @@ -171,7 +174,7 @@
protocol
A set of predicates directives that can be implemented by an object or a category (or extended by another protocol).
-
prototype
+
prototype
A self-describing object that may extend or be extended by other objects.
self
@@ -193,7 +196,7 @@
XHTML + CSS - Last updated on: November 16, 2005 + Last updated on: March 18, 2006
diff --git a/Logtalk/manuals/index.html b/Logtalk/manuals/index.html index eb112f9d3..d26b1b504 100644 --- a/Logtalk/manuals/index.html +++ b/Logtalk/manuals/index.html @@ -6,7 +6,7 @@ - Logtalk 2.27.0 Documentation + Logtalk 2.27.1 Documentation @@ -14,10 +14,10 @@ -

Logtalk 2.27.0 Documentation

+

Logtalk 2.27.1 Documentation

  • User Manual

  • @@ -33,7 +33,7 @@
    XHTML + CSS - Last updated on: January 29, 2006 + Last updated on: March 18, 2006
    diff --git a/Logtalk/manuals/print.css b/Logtalk/manuals/print.css index db749fc01..835c6107e 100644 --- a/Logtalk/manuals/print.css +++ b/Logtalk/manuals/print.css @@ -17,18 +17,13 @@ margin-bottom: 2cm; } -@page body { - counter-reset: page; -} - body { color: black; font-size: 10pt; font-family: Times, serif; - padding: 18pt 0pt 18pt 0pt; - margin: 0pt; + padding-top: 18pt; + padding-bottom: 18pt; background: white; - page: body; region: body; hyphenate: true; } diff --git a/Logtalk/manuals/refman/index.html b/Logtalk/manuals/refman/index.html index 95bb06374..7304df903 100644 --- a/Logtalk/manuals/refman/index.html +++ b/Logtalk/manuals/refman/index.html @@ -265,7 +265,7 @@
    XHTML + CSS - Last updated on: January 29, 2006 + Last updated on: February 11, 2006
    diff --git a/Logtalk/manuals/refman/methods/parameter2.html b/Logtalk/manuals/refman/methods/parameter2.html index db83c523d..49ccc9861 100644 --- a/Logtalk/manuals/refman/methods/parameter2.html +++ b/Logtalk/manuals/refman/methods/parameter2.html @@ -26,7 +26,7 @@
    parameter(Number, Term)

    -Normally used only in parametric objects, this method returns parameter values by using the parameter position in the object identifier. Note that this predicate implies an instantiation between its second argument and the corresponding implicit context argument in the predicate containing the call. This instantiation occurs at the clause head, not at the clause body. See also this/1. +Normally used only in parametric objects, this method returns parameter values by using the parameter position in the object identifier. Note that this predicate implies an unification between its second argument and the corresponding implicit context argument in the predicate containing the call. This unification occurs at the clause head, not at the clause body. See also this/1.

    Template and modes

    @@ -66,7 +66,7 @@ Normally used only in Copyright © Paulo MouraLogtalk.org
    XHTML + CSS - Last updated on: November 16, 2005 + Last updated on: February 11, 2006
    diff --git a/Logtalk/manuals/userman/index.html b/Logtalk/manuals/userman/index.html index 8607b0463..8246a1d07 100644 --- a/Logtalk/manuals/userman/index.html +++ b/Logtalk/manuals/userman/index.html @@ -257,6 +257,7 @@
    Libraries of source files
    Portable programs
    Avoiding common errors
    +
    Coding style guidlines
    Logtalk scope
    @@ -265,7 +266,7 @@
    XHTML + CSS - Last updated on: January 29, 2006 + Last updated on: March 18, 2006
    diff --git a/Logtalk/manuals/userman/objects.html b/Logtalk/manuals/userman/objects.html index ca7802086..02d1819d6 100644 --- a/Logtalk/manuals/userman/objects.html +++ b/Logtalk/manuals/userman/objects.html @@ -170,6 +170,9 @@ Both solutions are equally efficient because the runtime cost of the methods When storing a parametric object in its own source file, the convention is to name the file after the object, with the object arity appended. For instance, when defining an object named sort(Type), we may save it in a sort_1.lgt text file. This way it is easy to avoid file name clashes when saving Logtalk entities that have the same functor but different arity.

    +

    +Compound terms with the same functor and (usually) the same number of arguments as a parametric object identifier may act as proxies to a parametric object. Proxies may be stored on the database as Prolog facts and be used to represent different instantiations of a parametric object parameters. +

    Finding defined objects

    diff --git a/Logtalk/manuals/userman/predicates.html b/Logtalk/manuals/userman/predicates.html index 4b3892820..b7adb0f1d 100644 --- a/Logtalk/manuals/userman/predicates.html +++ b/Logtalk/manuals/userman/predicates.html @@ -493,7 +493,7 @@ Logtalk defines a set of built-in object predicates or methods to access message

    Execution context methods

    -Logtalk defines four built-in methods to access an object execution context. These methods are compiled in-line and can be freely used without worrying about performance penalties. When called from inside a category, these methods refer to the execution context of the object importing the category. +Logtalk defines four built-in methods to access an object execution context. These methods (with the possible exception of parameter/2) are translated to a single unification performed at compile time with a clause head context argument. Therefore, they can be freely used without worrying about performance penalties. When called from inside a category, these methods refer to the execution context of the object importing the category.

    To find the object that received the message under execution we may use the self/1 method. We may also retrieve the object that has sent the message under execution using the sender/1 method. @@ -533,6 +533,16 @@ to answer a message received by descendant that was sent by user yes

    +Note that the goals self(Self), sender(Sender), and this(This), being translated to unifications with the clause head context arguments at compile time, are effectively removed from the clause body. This implies that a clause such as: +

    +
    predicate(Arg) :-
    +    self(Self),
    +    atom(Arg),
    +    ... .
    +

    +is compiled with the goal atom(Arg) as the first condition on the clause body. As such, the use of these context execution methods do not interfere with the optimizations that some Prolog compilers perform when the first clause body condition is a call to a built-in type-test predicate or a comparison operator. +

    +

    For parametric objects, the method parameter/2 enables us to retrieve current parameter values (see the session on parametric objects for a detailed description). For example:

    :- object(block(_Color)).
    @@ -552,7 +562,7 @@ After compiling and loading these two objects, we can try the following goal:
     Color parameter value is blue
     yes

    -The method parameter/2 is only compiled in-line when used inside objects; its use inside categories implies a call to the built-in Prolog predicate arg/3. Nevertheless, note that calls to parameter/2 from inside categories are inherently problematic: a category may be implemented by several objects, both parametric (with different number of parameters) and non-parametric. Care must be taken to ensure that a parametric object importing such a category match the interpretation of its parameters used in the category. +The method parameter/2 is only translated to a compile time unification when used inside objects with its first argument instantiated at compile time. When the first argument is not known at compile time, or when the method is used inside categories, its call implies a call to the built-in Prolog predicate arg/3. Nevertheless, note that calls to parameter/2 from inside categories are inherently problematic: a category may be implemented by several objects, both parametric (with different number of parameters) and non-parametric. Care must be taken to ensure that a parametric object importing such a category match the interpretation of its parameters used in the category.

    Database methods

    @@ -672,7 +682,7 @@ Currently, there is no clean workaround for calling non-standard, Prolog built-i
    XHTML + CSS - Last updated on: January 21, 2006 + Last updated on: February 11, 2006
    diff --git a/Logtalk/manuals/userman/programming.html b/Logtalk/manuals/userman/programming.html index 03e85d6b0..deccae725 100644 --- a/Logtalk/manuals/userman/programming.html +++ b/Logtalk/manuals/userman/programming.html @@ -119,6 +119,13 @@ In general, Logtalk does not verify if a user predicate call/return arguments co Logtalk error handling strongly depends on the ISO compliance of the chosen Prolog compiler. For instance, the error terms that are generated by some Logtalk built-in predicates assume that the Prolog built-ins behave as defined in the ISO standard regarding error conditions. In particular, if your Prolog compiler does not support a read_term/3 built-in predicate compliant with the ISO Prolog Standard definition, then the current version of the Logtalk preprocessor will not be able to detect misspell variables in your source code.

    +

    Coding style guidlines

    + +

    +It is suggested that all code between an entity opening and closing directives be indented by one tab stop. When defining entity code, both directives and predicates, Prolog coding style guidelines may be applied. All Logtalk source files, examples, and standard library entities use four-space tabs for laying out code. Closed related entities should be defined in the same source file. Entities that might be useful in different contexts (such as library entities) are best defined in their own source files. +

    + +

    Logtalk scope

    @@ -154,7 +161,7 @@ Logtalk, as an object-oriented extension to Prolog, shares with it the same pref

    XHTML + CSS - Last updated on: November 16, 2005 + Last updated on: March 18, 2006
    diff --git a/Logtalk/scripts/NOTES b/Logtalk/scripts/NOTES index 64cef95bf..bb85a1acc 100644 --- a/Logtalk/scripts/NOTES +++ b/Logtalk/scripts/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/scripts/cleandist.sh b/Logtalk/scripts/cleandist.sh index 4aa65d2a2..8b6beffb0 100755 --- a/Logtalk/scripts/cleandist.sh +++ b/Logtalk/scripts/cleandist.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/cplgtdirs.js b/Logtalk/scripts/cplgtdirs.js index d96a26418..56ee5a241 100644 --- a/Logtalk/scripts/cplgtdirs.js +++ b/Logtalk/scripts/cplgtdirs.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= @@ -79,6 +79,11 @@ link.Description = "Shortcut to Logtalk documentation"; link.TargetPath = logtalk_home + "\\manuals"; link.Save(); +link = WshShell.CreateShortcut(logtalk_user + "\\wenv.lnk"); +link.Description = "Shortcut to Logtalk text editing support"; +link.TargetPath = logtalk_home + "\\wenv"; +link.Save(); + link = WshShell.CreateShortcut(logtalk_user + "\\xml\\lgt2html.js.lnk"); link.Description = "Shortcut to lgt2html script"; link.TargetPath = logtalk_home + "\\xml\\lgt2html.js"; diff --git a/Logtalk/scripts/cplgtdirs.sh b/Logtalk/scripts/cplgtdirs.sh index fffaefb7b..ab9f6ba01 100755 --- a/Logtalk/scripts/cplgtdirs.sh +++ b/Logtalk/scripts/cplgtdirs.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= @@ -73,6 +73,7 @@ ln -sf "$LOGTALKHOME"/README "$LOGTALKUSER"/README ln -sf "$LOGTALKHOME"/RELEASE_NOTES "$LOGTALKUSER"/RELEASE_NOTES ln -sf "$LOGTALKHOME"/UPGRADING "$LOGTALKUSER"/UPGRADING ln -sf "$LOGTALKHOME"/manuals "$LOGTALKUSER"/manuals +ln -sf "$LOGTALKHOME"/wenv "$LOGTALKUSER"/wenv ln -sf "$LOGTALKHOME"/xml/lgt2html.sh "$LOGTALKUSER"/xml/lgt2html ln -sf "$LOGTALKHOME"/xml/lgt2pdf.sh "$LOGTALKUSER"/xml/lgt2pdf ln -sf "$LOGTALKHOME"/xml/lgt2xml.sh "$LOGTALKUSER"/xml/lgt2xml diff --git a/Logtalk/scripts/debian/control b/Logtalk/scripts/debian/control index ddca43990..3307b5a33 100644 --- a/Logtalk/scripts/debian/control +++ b/Logtalk/scripts/debian/control @@ -1,5 +1,5 @@ Package: logtalk -Version: 2.26.2 +Version: 2.27.1 Section: languages Priority: optional Architecture: all diff --git a/Logtalk/scripts/lgt_install.js b/Logtalk/scripts/lgt_install.js index 39a736846..ee7633ef2 100644 --- a/Logtalk/scripts/lgt_install.js +++ b/Logtalk/scripts/lgt_install.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= diff --git a/Logtalk/scripts/lgt_install.sh b/Logtalk/scripts/lgt_install.sh index 88beeb99a..ab9266155 100755 --- a/Logtalk/scripts/lgt_install.sh +++ b/Logtalk/scripts/lgt_install.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= @@ -23,20 +23,20 @@ echo echo "Installing Logtalk on $prefix ..." echo -rm -rf $prefix/lgt2270 +rm -rf $prefix/lgt2271 rm -f $prefix/logtalk -mkdir $prefix/lgt2270 +mkdir $prefix/lgt2271 cd .. -cp -R * $prefix/lgt2270 +cp -R * $prefix/lgt2271 cd $prefix -chmod -R go-w,a+r lgt2270 -chmod a+x lgt2270 -chmod a+x lgt2270/scripts/*.sh -chmod a+x lgt2270/xml/*.sh -ln -sf lgt2270 logtalk +chmod -R go-w,a+r lgt2271 +chmod a+x lgt2271 +chmod a+x lgt2271/scripts/*.sh +chmod a+x lgt2271/xml/*.sh +ln -sf lgt2271 logtalk mkdir -p bin cd bin diff --git a/Logtalk/scripts/logtalk.spec b/Logtalk/scripts/logtalk.spec index 4db6e2518..fd9a51174 100644 --- a/Logtalk/scripts/logtalk.spec +++ b/Logtalk/scripts/logtalk.spec @@ -1,11 +1,11 @@ Name: logtalk Summary: Logtalk - Open source object-oriented extension to Prolog -Version: 2.27.0 +Version: 2.27.1 Release: 1 License: Artistic License 2.0 Group: Development/Languages Packager: Paulo Moura -Source: http://www.logtalk.org/files/lgt2270.tgz +Source: http://www.logtalk.org/files/lgt2271.tgz BuildArchitectures: noarch URL: http://www.logtalk.org/ Prefix: /usr/local @@ -13,19 +13,19 @@ AutoReqProv: no %description Logtalk is an open source object-oriented extension to the Prolog programming language. Integrating logic programming with object-oriented and event-driven programming, it is compatible with most Prolog compilers. It supports both prototypes and classes. In addition, it supports component-based programming through category-based composition. %prep -%setup -n lgt2270 +%setup -n lgt2271 %build %install -rm -rf /usr/local/lgt2270 +rm -rf /usr/local/lgt2271 rm -f /usr/local/logtalk -mkdir /usr/local/lgt2270 -cp -R * /usr/local/lgt2270 +mkdir /usr/local/lgt2271 +cp -R * /usr/local/lgt2271 cd /usr/local -chmod -R go-w,a+r lgt2270 -chmod a+x lgt2270 -chmod a+x lgt2270/scripts/*.sh -chmod a+x lgt2270/xml/*.sh -ln -sf lgt2270 logtalk +chmod -R go-w,a+r lgt2271 +chmod a+x lgt2271 +chmod a+x lgt2271/scripts/*.sh +chmod a+x lgt2271/xml/*.sh +ln -sf lgt2271 logtalk cd bin ln -sf ../logtalk/scripts/cplgtdirs.sh cplgtdirs ln -sf ../logtalk/xml/lgt2pdf.sh lgt2pdf @@ -34,24 +34,24 @@ ln -sf ../logtalk/xml/lgt2xml.sh lgt2xml %clean %files %defattr(-,root,users) -%doc /usr/local/lgt2270/BIBLIOGRAPHY -%doc /usr/local/lgt2270/INSTALL -%doc /usr/local/lgt2270/LICENSE -%doc /usr/local/lgt2270/QUICK_START -%doc /usr/local/lgt2270/README -%doc /usr/local/lgt2270/RELEASE_NOTES -%doc /usr/local/lgt2270/UPGRADING -/usr/local/lgt2270/compiler -/usr/local/lgt2270/configs -/usr/local/lgt2270/contributions -/usr/local/lgt2270/examples -/usr/local/lgt2270/libpaths -/usr/local/lgt2270/library -%docdir /usr/local/lgt2270/manuals -/usr/local/lgt2270/manuals -/usr/local/lgt2270/scripts -/usr/local/lgt2270/wenv -/usr/local/lgt2270/xml +%doc /usr/local/lgt2271/BIBLIOGRAPHY +%doc /usr/local/lgt2271/INSTALL +%doc /usr/local/lgt2271/LICENSE +%doc /usr/local/lgt2271/QUICK_START +%doc /usr/local/lgt2271/README +%doc /usr/local/lgt2271/RELEASE_NOTES +%doc /usr/local/lgt2271/UPGRADING +/usr/local/lgt2271/compiler +/usr/local/lgt2271/configs +/usr/local/lgt2271/contributions +/usr/local/lgt2271/examples +/usr/local/lgt2271/libpaths +/usr/local/lgt2271/library +%docdir /usr/local/lgt2271/manuals +/usr/local/lgt2271/manuals +/usr/local/lgt2271/scripts +/usr/local/lgt2271/wenv +/usr/local/lgt2271/xml /usr/local/logtalk /usr/local/bin/cplgtdirs /usr/local/bin/lgt2pdf diff --git a/Logtalk/scripts/make_ciaolgt.js b/Logtalk/scripts/make_ciaolgt.js index 95646de4c..682b95f55 100644 --- a/Logtalk/scripts/make_ciaolgt.js +++ b/Logtalk/scripts/make_ciaolgt.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= diff --git a/Logtalk/scripts/make_ciaolgt.sh b/Logtalk/scripts/make_ciaolgt.sh index b53c67db5..5b97b685e 100755 --- a/Logtalk/scripts/make_ciaolgt.sh +++ b/Logtalk/scripts/make_ciaolgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/make_eclipselgt.js b/Logtalk/scripts/make_eclipselgt.js index 1b121435f..5a21e22da 100644 --- a/Logtalk/scripts/make_eclipselgt.js +++ b/Logtalk/scripts/make_eclipselgt.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= diff --git a/Logtalk/scripts/make_eclipselgt.sh b/Logtalk/scripts/make_eclipselgt.sh index 68925c815..d64bc1d8a 100755 --- a/Logtalk/scripts/make_eclipselgt.sh +++ b/Logtalk/scripts/make_eclipselgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/make_gplgt.js b/Logtalk/scripts/make_gplgt.js index 971f20f98..237df28be 100644 --- a/Logtalk/scripts/make_gplgt.js +++ b/Logtalk/scripts/make_gplgt.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= diff --git a/Logtalk/scripts/make_gplgt.sh b/Logtalk/scripts/make_gplgt.sh index 19daf0caf..f4cbc64e9 100755 --- a/Logtalk/scripts/make_gplgt.sh +++ b/Logtalk/scripts/make_gplgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/make_plclgt.js b/Logtalk/scripts/make_plclgt.js index 54e601f9f..d1a7ea993 100644 --- a/Logtalk/scripts/make_plclgt.js +++ b/Logtalk/scripts/make_plclgt.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= diff --git a/Logtalk/scripts/make_plclgt.sh b/Logtalk/scripts/make_plclgt.sh index 287c0d85e..9ee1f4e71 100755 --- a/Logtalk/scripts/make_plclgt.sh +++ b/Logtalk/scripts/make_plclgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/make_qplgt.sh b/Logtalk/scripts/make_qplgt.sh index 8764edc9a..c45c8a581 100755 --- a/Logtalk/scripts/make_qplgt.sh +++ b/Logtalk/scripts/make_qplgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/make_sicstuslgt.js b/Logtalk/scripts/make_sicstuslgt.js index 242ecd70e..9144c2075 100644 --- a/Logtalk/scripts/make_sicstuslgt.js +++ b/Logtalk/scripts/make_sicstuslgt.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= diff --git a/Logtalk/scripts/make_sicstuslgt.sh b/Logtalk/scripts/make_sicstuslgt.sh index dbce38164..7339f0f15 100755 --- a/Logtalk/scripts/make_sicstuslgt.sh +++ b/Logtalk/scripts/make_sicstuslgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/make_swilgt.js b/Logtalk/scripts/make_swilgt.js index cfb70508b..8f7fee148 100644 --- a/Logtalk/scripts/make_swilgt.js +++ b/Logtalk/scripts/make_swilgt.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= diff --git a/Logtalk/scripts/make_swilgt.sh b/Logtalk/scripts/make_swilgt.sh index 25df62d76..dbe94c9d9 100755 --- a/Logtalk/scripts/make_swilgt.sh +++ b/Logtalk/scripts/make_swilgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/make_xsbcvslgt.js b/Logtalk/scripts/make_xsbcvslgt.js index 7385586a9..b3ed86c7a 100644 --- a/Logtalk/scripts/make_xsbcvslgt.js +++ b/Logtalk/scripts/make_xsbcvslgt.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= diff --git a/Logtalk/scripts/make_xsbcvslgt.sh b/Logtalk/scripts/make_xsbcvslgt.sh index a09935619..5702f9316 100755 --- a/Logtalk/scripts/make_xsbcvslgt.sh +++ b/Logtalk/scripts/make_xsbcvslgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/make_xsblgt.sh b/Logtalk/scripts/make_xsblgt.sh index 9e5092df1..83db28343 100755 --- a/Logtalk/scripts/make_xsblgt.sh +++ b/Logtalk/scripts/make_xsblgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/make_yaplgt.js b/Logtalk/scripts/make_yaplgt.js index 85328e177..2a76afb7e 100644 --- a/Logtalk/scripts/make_yaplgt.js +++ b/Logtalk/scripts/make_yaplgt.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= diff --git a/Logtalk/scripts/make_yaplgt.sh b/Logtalk/scripts/make_yaplgt.sh index 4f95c55d5..d64c781e5 100755 --- a/Logtalk/scripts/make_yaplgt.sh +++ b/Logtalk/scripts/make_yaplgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/scripts/makeall_lgt.js b/Logtalk/scripts/makeall_lgt.js index 65adb7f35..a9f6ac973 100644 --- a/Logtalk/scripts/makeall_lgt.js +++ b/Logtalk/scripts/makeall_lgt.js @@ -1,6 +1,6 @@ // ================================================================= // Logtalk - Object oriented extension to Prolog -// Release 2.27.0 +// Release 2.27.1 // // Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. // ================================================================= diff --git a/Logtalk/scripts/makeall_lgt.sh b/Logtalk/scripts/makeall_lgt.sh index 7177c2d92..06bf540a8 100755 --- a/Logtalk/scripts/makeall_lgt.sh +++ b/Logtalk/scripts/makeall_lgt.sh @@ -2,7 +2,7 @@ ## ================================================================= ## Logtalk - Object oriented extension to Prolog -## Release 2.27.0 +## Release 2.27.1 ## ## Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ## ================================================================= diff --git a/Logtalk/wenv/NOTES b/Logtalk/wenv/NOTES index 5621ace79..10306da7b 100644 --- a/Logtalk/wenv/NOTES +++ b/Logtalk/wenv/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/wenv/bbedit/NOTES b/Logtalk/wenv/bbedit/NOTES index 33ab43948..c3be3faa7 100644 --- a/Logtalk/wenv/bbedit/NOTES +++ b/Logtalk/wenv/bbedit/NOTES @@ -1,22 +1,24 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= This directory contains files that provide basic syntax highlighting -for editing Logtalk source files with the BBEdit 8.x text editor -(http://www.barebones.com/products/bbedit/index.shtml). +for editing Logtalk source files with the Bare Bones BBEdit 8.x or +TextWrangler 2.x text editors (http://www.barebones.com/). -To install copy the file "logtalk.plist" either to the folder: +To install copy the file "logtalk.plist" either to the folders: ~/Library/Application Support/BBEdit/Language Modules/ + ~/Library/Application Support/TextWrangler/Language Modules/ -or to the folder: +or to the folders: /Library/Application Support/BBEdit/Language Modules/ + /Library/Application Support/TextWrangler/Language Modules/ (create the folder if it does not exist). diff --git a/Logtalk/wenv/crimson/NOTES b/Logtalk/wenv/crimson/NOTES index 945914598..a84a5f431 100644 --- a/Logtalk/wenv/crimson/NOTES +++ b/Logtalk/wenv/crimson/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/wenv/emacs/NOTES b/Logtalk/wenv/emacs/NOTES index 0f2577e28..d4663e8b9 100644 --- a/Logtalk/wenv/emacs/NOTES +++ b/Logtalk/wenv/emacs/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/wenv/emacs/logtalk.el b/Logtalk/wenv/emacs/logtalk.el index 2a73ebda4..850b6ce8c 100644 --- a/Logtalk/wenv/emacs/logtalk.el +++ b/Logtalk/wenv/emacs/logtalk.el @@ -4,8 +4,8 @@ ;; Author: Paulo Moura ;; Creation date: November 15, 2003 -;; Last modification date: October 10, 2005 -;; Version: 0.7 +;; Last modification date: February 24, 2006 +;; Version: 0.71 ;; Installation: ;; @@ -112,7 +112,7 @@ ("\\(a\\(?:bolish\\|ssert[az]\\)\\|clause\\|retract\\(?:all\\)?\\)\\([(]\\)" 1 'logtalk-built-in-method-face) ("\\(bagof\\|f\\(?:\\(?:ind\\|or\\)all\\)\\|setof\\)\\([(]\\)" 1 'logtalk-built-in-method-face) ("\\(after\\|before\\)\\([(]\\)" 1 'logtalk-built-in-method-face) - ("\\(phrase\\|expand_term\\)\\([(]\\)" 1 'logtalk-built-in-method-face) + ("\\(phrase\\|expand_term\\|term_expansion\\)\\([(]\\)" 1 'logtalk-built-in-method-face) )) diff --git a/Logtalk/wenv/jedit/NOTES b/Logtalk/wenv/jedit/NOTES index cd92dfb5c..fe044b662 100644 --- a/Logtalk/wenv/jedit/NOTES +++ b/Logtalk/wenv/jedit/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/wenv/jedit/logtalk.xml b/Logtalk/wenv/jedit/logtalk.xml index 87e1fb042..5a0e7deca 100644 --- a/Logtalk/wenv/jedit/logtalk.xml +++ b/Logtalk/wenv/jedit/logtalk.xml @@ -246,6 +246,7 @@ after expand_term + term_expansion phrase diff --git a/Logtalk/wenv/kate/NOTES b/Logtalk/wenv/kate/NOTES index 8dc97780a..6b9e0817a 100644 --- a/Logtalk/wenv/kate/NOTES +++ b/Logtalk/wenv/kate/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= @@ -13,7 +13,7 @@ KDE Kate and KWrite text editors (http://kate.kde.org/). To install copy the file "logtalk.xml" to the directory: - $(KDEDIR)/share/apps/katepart/syntax/ + $KDEDIR/share/apps/katepart/syntax/ or: diff --git a/Logtalk/wenv/kate/logtalk.xml b/Logtalk/wenv/kate/logtalk.xml index b022d9270..17e130c8f 100644 --- a/Logtalk/wenv/kate/logtalk.xml +++ b/Logtalk/wenv/kate/logtalk.xml @@ -1,7 +1,7 @@ - + @@ -17,11 +17,11 @@ - + - + @@ -48,7 +48,7 @@ - + diff --git a/Logtalk/wenv/nedit/NOTES b/Logtalk/wenv/nedit/NOTES index ce090f669..62edc47fe 100644 --- a/Logtalk/wenv/nedit/NOTES +++ b/Logtalk/wenv/nedit/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/wenv/nedit/logtalk.pats b/Logtalk/wenv/nedit/logtalk.pats index a942db82e..a22a7d12c 100644 --- a/Logtalk/wenv/nedit/logtalk.pats +++ b/Logtalk/wenv/nedit/logtalk.pats @@ -40,7 +40,7 @@ nedit.highlightPatterns: Logtalk:1:0{\n\ Number:"[0-9]+(\.[0-9]+)?([eE][-+][0-9]+)?":::Numeric Const::\n\ String:"""":""""::String::\n\ String:"'":"'"::String::\n\ - Built-in methods:"<(parameter|self|sender|this|current_predicate|predicate_property|abolish|asserta|assertz|retractall|retract|bagof|findall|forall|setof|before|after|expand_term|phrase)(?=[(])":::Subroutine::\n\ + Built-in methods:"<(parameter|self|sender|this|current_predicate|predicate_property|abolish|asserta|assertz|retractall|retract|bagof|findall|forall|setof|before|after|expand_term|term_expansion|phrase)(?=[(])":::Subroutine::\n\ Arithmetic operators:"|\\+|\\*|\\-|/|=:=|=\\\\=|=\\<|\\>=|\\<|\\>":::Subroutine::\n\ Built-in predicates:"<(current_object|current_protocol|current_category|create_object|create_protocol|create_category|object_property|protocol_property|category_property|abolish_object|abolish_protocol|abolish_vategory|extends_object|extends_protocol|omplements_protocol|instantiates_class|specializes_class|imports_category|abolish_events|current_events|define_events|current_logtalk_flag|set_logtalk_flag|logtalk_compile|logtalk_load|logtalk_library_path|forall|retractall)(?=[(])":::Subroutine::\n\ Term unification:"=|\\\\=":::Subroutine::\n\ diff --git a/Logtalk/wenv/source-highlight/NOTES b/Logtalk/wenv/source-highlight/NOTES index 60ebbd527..a5115c09b 100644 --- a/Logtalk/wenv/source-highlight/NOTES +++ b/Logtalk/wenv/source-highlight/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/wenv/source-highlight/logtalk.lang b/Logtalk/wenv/source-highlight/logtalk.lang index 746d3851c..d9b5405a1 100644 --- a/Logtalk/wenv/source-highlight/logtalk.lang +++ b/Logtalk/wenv/source-highlight/logtalk.lang @@ -17,7 +17,7 @@ keyword = '\<(abolish|c(urrent|reate))_(object|protocol|category)(?=\()', keyword = '\<(after|before)(?=\()', '\<(parameter|this|se(lf|nder))(?=\()', '\<(current_predicate|predicate_property)(?=\()', - '\<(expand_term|phrase)(?=\()', + '\<(expand_term|term_expansion|phrase)(?=\()', '\<(clause|retract(all)?)(?=\()', '\[^A-Za-z0-9_](before)\( [^A-Za-z0-9_](after)\( [^A-Za-z0-9_](expand_term)\( + [^A-Za-z0-9_](term_expansion)\( [^A-Za-z0-9_](phrase)\( diff --git a/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Info.plist b/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Info.plist index b0fbea620..a5c399bc5 100644 --- a/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Info.plist +++ b/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Info.plist @@ -18,8 +18,8 @@ 6.0 TCMModeExtensions - config lgt + config diff --git a/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Resources/AutocompleteAdditions.txt b/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Resources/AutocompleteAdditions.txt index 5eabcd464..8d0744730 100644 --- a/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Resources/AutocompleteAdditions.txt +++ b/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Resources/AutocompleteAdditions.txt @@ -67,8 +67,11 @@ predicate_property(, ) before(, , ) after(, , ) + phrase(, ) phrase(, , ) +term_expansion(, ) +expand_term(, ) unify_with_occurs_check(, ) diff --git a/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Resources/SyntaxDefinition.xml b/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Resources/SyntaxDefinition.xml index aa5bd689c..bcd7db0eb 100644 --- a/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Resources/SyntaxDefinition.xml +++ b/Logtalk/wenv/subethaedit2/Logtalk.mode/Contents/Resources/SyntaxDefinition.xml @@ -40,10 +40,9 @@ - \b(instantiates)\( \b(specializes)\( \b(extends)\( - \b(imp(orts|lements))\( + \b(i(mp(orts|lements)|nstantiates))\( @@ -82,6 +81,7 @@ \b(before)\( \b(after)\( \b(expand_term)\( + \b(term_expansion)\( \b(phrase)\( diff --git a/Logtalk/wenv/subethaedit2/NOTES b/Logtalk/wenv/subethaedit2/NOTES index d47a67fac..f30bb367c 100644 --- a/Logtalk/wenv/subethaedit2/NOTES +++ b/Logtalk/wenv/subethaedit2/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/wenv/tests/NOTES b/Logtalk/wenv/tests/NOTES index 253bd3d22..80997dc10 100644 --- a/Logtalk/wenv/tests/NOTES +++ b/Logtalk/wenv/tests/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/wenv/textmate/Logtalk.tmbundle/Preferences/Completions.plist b/Logtalk/wenv/textmate/Logtalk.tmbundle/Preferences/Completions.plist new file mode 100644 index 000000000..7a4f3c0c1 --- /dev/null +++ b/Logtalk/wenv/textmate/Logtalk.tmbundle/Preferences/Completions.plist @@ -0,0 +1,148 @@ + + + + + name + Completions + scope + + settings + + completions + + encoding + calls + category + dynamic + end_category + end_object + end_protocol + info + initialization + object + protocol + uses + alias + discontiguous + metapredicate + mode + op + private + protected + public + current_object + current_protocol + current_category + object_property + protocol_property + category_property + create_object + create_protocol + create_category + abolish_object + abolish_protocol + abolish_category + extends_object + extends_protocol + implements_protocol + imports_category + instantiates_class + specializes_class + abolish_events + current_event + define_events + logtalk_load + logtalk_compile + logtalk_library_path + current_logtalk_flag + set_logtalk_flag + self + this + sender + parameter + before + after + phrase + expand_term + term_expansion + true + fail + call + catch + throw + unify_with_occurs_check + var + atom + integer + float + atomic + compound + nonvar + number + arg + copy_term + functor + current_predicate + predicate_property + abolish + assertz + asserta + clause + retract + retractall + bagof + findall + forall + setof + current_input + current_output + set_input + set_output + open + close + flush_output + stream_property + at_end_of_stream + set_stream_position + get_char + get_code + peek_char + peek_code + put_char + put_code + nl + get_byte + peek_byte + put_byte + read + read_term + write + writeq + write_canonical + atom_chars + atom_codes + atom_concat + number_chars + number_codes + current_op + char_conversion + current_char_conversion + once + repeat + atom_length + atom_concat + sub_atom + atom_chars + atom_codes + char_code + number_chars + number_codes + set_prolog_flag + current_prolog_flag + halt + + + uuid + 73BD67B7-8673-4022-BF87-06C69F013847 + + diff --git a/Logtalk/wenv/textmate/Logtalk.tmbundle/Preferences/Entity list.plist b/Logtalk/wenv/textmate/Logtalk.tmbundle/Preferences/Entity list.plist new file mode 100644 index 000000000..d9a85a8b4 --- /dev/null +++ b/Logtalk/wenv/textmate/Logtalk.tmbundle/Preferences/Entity list.plist @@ -0,0 +1,19 @@ + + + + + name + Symbol list: entities + scope + entity.name + settings + + showInSymbolList + 1 + symbolTransformation + + + uuid + F7EA22E4-A54C-4BAB-8E65-F411A8B1107A + + diff --git a/Logtalk/wenv/textmate/Logtalk.tmbundle/Syntaxes/Logtalk.plist b/Logtalk/wenv/textmate/Logtalk.tmbundle/Syntaxes/Logtalk.plist index 45a44ff19..bea918b5e 100644 --- a/Logtalk/wenv/textmate/Logtalk.tmbundle/Syntaxes/Logtalk.plist +++ b/Logtalk/wenv/textmate/Logtalk.tmbundle/Syntaxes/Logtalk.plist @@ -1,159 +1,323 @@ -/** - ** Logtalk syntax dictionary for TextMate. - ** - ** Paulo Moura - **/ - -{ - name = "Logtalk"; - scopeName = "source.logtalk"; - - fileTypes = (lgt, config); - - foldingStartMarker = "(/\\*|:-\\s+(object|protocol|category)(?=[(]))"; - foldingStopMarker = "(\\*/|:-\\s+end_(object|protocol|category)(?=[.]))"; - - patterns = ( - { name = "comment.block.logtalk"; - begin = "/\\*"; end = "\\*/"; - }, - { name = "comment.line.percentage.logtalk"; - match = "%.*$"; - }, - { name = "storage.type.opening.logtalk"; - match = ":-\\s+(object|protocol|category|module)(?=[(])"; - }, - { - name = "storage.type.closing.logtalk"; - match = ":-\\s+(end_(object|protocol|category))(?=[.])"; - }, - { name = "storage.type.relations.logtalk"; - match = "\\b(extends|i(nstantiates|mp(orts|lements))|specializes)(?=[(])"; - }, - { name = "storage.modifier.others.logtalk"; - match = ":-\\s+(calls|e(ncoding|xport)|in(itialization|fo)|uses)(?=[(])"; - }, - { name = "storage.modifier.others.logtalk"; - match = ":-\\s+(alias|info|d(ynamic|iscontiguous)|m(etapredicate|ode|ultifile)|p(ublic|r(otected|ivate))|op|use(s|_module))(?=[(])"; - }, - { name = "keyword.operator.message-sending.logtalk"; - match = "(::|\\^\\^)"; - }, - { name = "keyword.operator.mode.logtalk"; - match = "(\\?|@)"; - }, - { name = "keyword.operator.term-comparison.logtalk"; - match = "(@=<|@<|@>|@>=|==|\\\\==)"; - }, - { name = "keyword.operator.arithmetic-comparison.logtalk"; - match = "(=<|<|>|>=|=:=|=\\\\=)"; - }, - { name = "keyword.operator.bitwise.logtalk"; - match = "(<<|>>|/\\\\|\\\\/|\\\\)"; - }, - { name = "keyword.operator.evaluable.logtalk"; - match = "\\b(mod|rem)\\b"; - }, - { name = "keyword.operator.evaluable.logtalk"; - match = "(\\*\\*|\\+|-|\\*|/|//)"; - }, - { name = "keyword.operator.misc.logtalk"; - match = "(:-|!|\\\\+|,|;|-->|->|=|\\=|\\.|=\\.\\.|\\bis\\b)"; - }, - { name = "support.function.control.logtalk"; - match = "\\b(true|fail|repeat)\\b"; - }, - { name = "support.function.control.logtalk"; - match = "\\b(ca(ll|tch)|throw|once)(?=[(])"; - }, - { name = "support.function.chars-and-bytes-io.logtalk"; - match = "\\b((get|peek|put)_(char|code|byte)|nl)(?=[(])"; - }, - { name = "support.function.chars-and-bytes-io.logtalk"; - match = "\\bnl\\b"; - }, - { name = "support.function.atom-term-processing.logtalk"; - match = "\\b(atom_(length|c(hars|o(ncat|des)))|sub_atom|char_code|number_c(hars|odes))(?=[(])"; - }, - { name = "support.function.term-testing.logtalk"; - match = "\\b(var|atom|integer|float|atomic|compound|n(onvar|umber))(?=[(])"; - }, - { name = "support.function.term-io.logtalk"; - match = "\\b(read_term|read|write|write(q|_(canonical|term))|op|current_op|char_conversion|current_char_conversion)(?=[(])"; - }, - { name = "support.function.term-creation-and-decomposition.logtalk"; - match = "\\b(arg|copy_term|functor)(?=[(])"; - }, - { name = "support.function.term-unification.logtalk"; - match = "\\b(unify_with_occurs_check)(?=[(])"; - }, - { name = "support.function.stream-selection-and-control.logtalk"; - match = "\\b((set|current)_(in|out)put|open|close|flush_output|stream_property|at_end_of_stream|set_stream_position)(?=[(])"; - }, - { name = "support.function.stream-selection-and-control.logtalk"; - match = "\\b(flush_output|at_end_of_stream)\\b"; - }, - { name = "support.function.prolog-flags.logtalk"; - match = "\\b((set|current)_prolog_flag)(?=[(])"; - }, - { name = "support.function.compiling-and-loading.logtalk"; - match = "\\b(logtalk_(compile|l(ibrary_path|oad)))(?=[(])"; - }, - { name = "support.function.event-handling.logtalk"; - match = "\\b((abolish|define)_events|current_event)(?=[(])"; - }, - { name = "support.function.implementation-defined-hooks.logtalk"; - match = "\\b((current|set)_logtalk_flag|halt)(?=[(])"; - }, - { name = "support.function.implementation-defined-hooks.logtalk"; - match = "\\b(halt)\\b"; - }, - { name = "support.function.entity-creation-and-abolishing.logtalk"; - match = "\\b((c(reate|urrent)|abolish)_(object|protocol|category))(?=[(])"; - }, - { name = "keyword.other.predicate.reflection.logtalk"; - match = "\\b((object|protocol|category)_property|extends_(object|protocol)|imp(orts_category|lements_protocol)|(instantiates|specializes)_class)(?=[(])"; - }, - { name = "support.function.logtalk"; - match = "\\b((for|retract)all)(?=[(])"; - }, - { name = "support.function.execution-context.logtalk"; - match = "\\b(parameter|se(lf|nder)|this)(?=[(])"; - }, - { name = "support.function.database.logtalk"; - match = "\\b(a(bolish|ssert(a|z))|clause|retract|retractall)(?=[(])"; - }, - { name = "support.function.all-solutions.logtalk"; - match = "\\b((bag|set)of|f(ind|or)all)(?=[(])"; - }, - { name = "support.function.reflection.logtalk"; - match = "\\b(current_predicate|predicate_property)(?=[(])"; - }, - { name = "support.function.event-handler.logtalk"; - match = "\\b(before|after)(?=[(])"; - }, - { name = "support.function.grammar-rule.logtalk"; - match = "\\b(expand_term|phrase)(?=[(])"; - }, - { name = "string.quoted.single.logtalk"; - begin = "'"; end = "'"; swallow = "\\\\."; - }, - { name = "string.quoted.double.logtalk"; - begin = "\""; end = "\""; swallow = "\\\\."; - }, - { name = "constant.numeric.logtalk"; - match = "\\b(0b[0-1]+|0o[0-7]+|0x\\h+)\\b"; - }, - { name = "constant.numeric.logtalk"; - match = "\\b(0'.|0''|0'\")"; - }, - { name = "constant.numeric.logtalk"; - match = "\\b(\\d+\\.?\\d*((e|E)(\\+|-)?\\d+)?)\\b"; - }, - { name = "variable.other.logtalk"; - match = "\\b([A-Z_][A-Za-z0-9_]*)\\b"; - } - ); - - uuid = "C11FA1F2-6EDB-11D9-8798-000A95DAA580"; -} + + + + + fileTypes + + lgt + config + + foldingStartMarker + (/\*|:-\s+(object|protocol|category)(?=[(])) + foldingStopMarker + (\*/|:-\s+end_(object|protocol|category)(?=[.])) + name + Logtalk + patterns + + + begin + /\* + end + \*/ + name + comment.block.logtalk + + + match + %.*$ + name + comment.line.percentage.logtalk + + + captures + + 1 + + name + storage.type.opening.logtalk + + 3 + + name + entity.name + + + match + (:-\s+(object|protocol|category|module))(?:\()([^(,)]+) + name + + + + match + :-\s+(end_(object|protocol|category))(?=[.]) + name + storage.type.closing.logtalk + + + match + \b(extends|i(nstantiates|mp(orts|lements))|specializes)(?=[(]) + name + storage.type.relations.logtalk + + + match + :-\s+(calls|e(ncoding|xport)|in(itialization|fo)|uses)(?=[(]) + name + storage.modifier.others.logtalk + + + match + :-\s+(alias|info|d(ynamic|iscontiguous)|m(etapredicate|ode|ultifile)|p(ublic|r(otected|ivate))|op|use(s|_module))(?=[(]) + name + storage.modifier.others.logtalk + + + match + (::|\^\^) + name + keyword.operator.message-sending.logtalk + + + match + (\?|@) + name + keyword.operator.mode.logtalk + + + match + (@=<|@<|@>|@>=|==|\\==) + name + keyword.operator.term-comparison.logtalk + + + match + (=<|<|>|>=|=:=|=\\=) + name + keyword.operator.arithmetic-comparison.logtalk + + + match + (<<|>>|/\\|\\/|\\) + name + keyword.operator.bitwise.logtalk + + + match + \b(mod|rem)\b + name + keyword.operator.evaluable.logtalk + + + match + (\*\*|\+|-|\*|/|//) + name + keyword.operator.evaluable.logtalk + + + match + (:-|!|\\+|,|;|-->|->|=|\=|\.|=\.\.|\bis\b) + name + keyword.operator.misc.logtalk + + + match + \b(true|fail|repeat)\b(?![()]) + name + support.function.control.logtalk + + + match + \b(ca(ll|tch)|throw|once)(?=[(]) + name + support.function.control.logtalk + + + match + \b((get|peek|put)_(char|code|byte)|nl)(?=[(]) + name + support.function.chars-and-bytes-io.logtalk + + + match + \bnl\b + name + support.function.chars-and-bytes-io.logtalk + + + match + \b(atom_(length|c(hars|o(ncat|des)))|sub_atom|char_code|number_c(hars|odes))(?=[(]) + name + support.function.atom-term-processing.logtalk + + + match + \b(var|atom|integer|float|atomic|compound|n(onvar|umber))(?=[(]) + name + support.function.term-testing.logtalk + + + match + \b(read_term|read|write|write(q|_(canonical|term))|op|current_op|char_conversion|current_char_conversion)(?=[(]) + name + support.function.term-io.logtalk + + + match + \b(arg|copy_term|functor)(?=[(]) + name + support.function.term-creation-and-decomposition.logtalk + + + match + \b(unify_with_occurs_check)(?=[(]) + name + support.function.term-unification.logtalk + + + match + \b((set|current)_(in|out)put|open|close|flush_output|stream_property|at_end_of_stream|set_stream_position)(?=[(]) + name + support.function.stream-selection-and-control.logtalk + + + match + \b(flush_output|at_end_of_stream)\b(?![()]) + name + support.function.stream-selection-and-control.logtalk + + + match + \b((set|current)_prolog_flag)(?=[(]) + name + support.function.prolog-flags.logtalk + + + match + \b(logtalk_(compile|l(ibrary_path|oad)))(?=[(]) + name + support.function.compiling-and-loading.logtalk + + + match + \b((abolish|define)_events|current_event)(?=[(]) + name + support.function.event-handling.logtalk + + + match + \b((current|set)_logtalk_flag|halt)(?=[(]) + name + support.function.implementation-defined-hooks.logtalk + + + match + \b(halt)\b + name + support.function.implementation-defined-hooks.logtalk + + + match + \b((c(reate|urrent)|abolish)_(object|protocol|category))(?=[(]) + name + support.function.entity-creation-and-abolishing.logtalk + + + match + \b((object|protocol|category)_property|extends_(object|protocol)|imp(orts_category|lements_protocol)|(instantiates|specializes)_class)(?=[(]) + name + support.function.reflection.logtalk + + + match + \b((for|retract)all)(?=[(]) + name + support.function.logtalk + + + match + \b(parameter|se(lf|nder)|this)(?=[(]) + name + support.function.execution-context.logtalk + + + match + \b(a(bolish|ssert(a|z))|clause|retract|retractall)(?=[(]) + name + support.function.database.logtalk + + + match + \b((bag|set)of|f(ind|or)all)(?=[(]) + name + support.function.all-solutions.logtalk + + + match + \b(current_predicate|predicate_property)(?=[(]) + name + support.function.reflection.logtalk + + + match + \b(before|after)(?=[(]) + name + support.function.event-handler.logtalk + + + match + \b(expand_term|term_expansion|phrase)(?=[(]) + name + support.function.grammar-rule.logtalk + + + begin + ' + end + ' + name + string.quoted.single.logtalk + swallow + \\. + + + begin + " + end + " + name + string.quoted.double.logtalk + swallow + \\. + + + match + \b(0b[0-1]+|0o[0-7]+|0x\h+)\b + name + constant.numeric.logtalk + + + match + \b(0'.|0''|0'") + name + constant.numeric.logtalk + + + match + \b(\d+\.?\d*((e|E)(\+|-)?\d+)?)\b + name + constant.numeric.logtalk + + + match + \b([A-Z_][A-Za-z0-9_]*)\b + name + variable.other.logtalk + + + scopeName + source.logtalk + uuid + C11FA1F2-6EDB-11D9-8798-000A95DAA580 + + diff --git a/Logtalk/wenv/textmate/NOTES b/Logtalk/wenv/textmate/NOTES index aefddef02..0817896dd 100644 --- a/Logtalk/wenv/textmate/NOTES +++ b/Logtalk/wenv/textmate/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= @@ -18,11 +18,3 @@ folders: /Library/Application Support/TextMate/Bundles/ (create the chosen folder if it does not exist). - -Copy the file "Logtalk Theme.tmScopeSettings" to one of the following -folders: - - ~/Library/Application Support/TextMate/Settings/ - /Library/Application Support/TextMate/Settings/ - -(create the chosen folder if it does not exist). diff --git a/Logtalk/wenv/textpad/NOTES b/Logtalk/wenv/textpad/NOTES index 5ffd1a448..b8b761559 100644 --- a/Logtalk/wenv/textpad/NOTES +++ b/Logtalk/wenv/textpad/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/wenv/textpad/logtalk.syn b/Logtalk/wenv/textpad/logtalk.syn index 146a56cfc..4208a0f1d 100644 --- a/Logtalk/wenv/textpad/logtalk.syn +++ b/Logtalk/wenv/textpad/logtalk.syn @@ -1,7 +1,7 @@ ; TextPad syntax definitions for Logtalk (http://www.logtalk.org/) ; ; Author: Paulo Moura -; Last changed in: October 9, 2005 +; Last changed in: February 24, 2006 ; ; Tags used and sugested colors: ; Keywords 1 message sending operators blue @@ -161,6 +161,7 @@ setof before after expand_term +term_expansion phrase ; Mode operators diff --git a/Logtalk/wenv/vim/NOTES b/Logtalk/wenv/vim/NOTES index 61431c689..22f1ce7f2 100644 --- a/Logtalk/wenv/vim/NOTES +++ b/Logtalk/wenv/vim/NOTES @@ -1,6 +1,6 @@ ================================================================= Logtalk - Object oriented extension to Prolog -Release 2.27.0 +Release 2.27.1 Copyright (c) 1998-2006 Paulo Moura. All Rights Reserved. ================================================================= diff --git a/Logtalk/wenv/vim/logtalk.vim b/Logtalk/wenv/vim/logtalk.vim index f4779226a..6faf5960e 100644 --- a/Logtalk/wenv/vim/logtalk.vim +++ b/Logtalk/wenv/vim/logtalk.vim @@ -2,7 +2,7 @@ " " Language: Logtalk " Maintainer: Paulo Moura -" Last Change: October 9, 2005 +" Last Change: February 24, 2006 " Quit when a syntax file was already loaded: @@ -137,6 +137,7 @@ syn match logtalkBuiltInMethod "\ % check if we're debugging the target object + '$lgt_tr_msg'(Pred, Obj, Call, user), % compile the message + ( '$lgt_dbg_debugging_', '$lgt_debugging_'(Obj) -> % check if we're debugging the target object '$lgt_ctx_ctx'(Ctx, user, user, Obj, '$lgt_po_user0_', []), catch('$lgt_dbg_goal'(Obj::Pred, Call, Ctx), Error, '$lgt_runtime_error_handler'(Error)) - ; - catch(Call, Error, '$lgt_runtime_error_handler'(Error))). + ; catch(Call, Error, '$lgt_runtime_error_handler'(Error)) + ). @@ -508,8 +508,8 @@ abolish_object(Obj) :- throw(error(type_error(object_identifier, Obj), abolish_object(Obj))). abolish_object(Obj) :- - '$lgt_current_object_'(Obj, Prefix, _, _, _, Type) -> - (Type = (dynamic) -> + ( '$lgt_current_object_'(Obj, Prefix, _, _, _, Type) -> + ( Type == (dynamic) -> '$lgt_call'(Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, Rnm), '$lgt_abolish_entity_predicates'(Def), '$lgt_abolish_entity_predicates'(DDef), @@ -532,10 +532,10 @@ abolish_object(Obj) :- retractall('$lgt_imports_category_'(Obj, _, _)), retractall('$lgt_debugging_'(Obj)), '$lgt_clean_lookup_caches' - ; - throw(error(permission_error(modify, static_object, Obj), abolish_object(Obj)))) - ; - throw(error(existence_error(object, Obj), abolish_object(Obj))). + ; throw(error(permission_error(modify, static_object, Obj), abolish_object(Obj))) + ) + ; throw(error(existence_error(object, Obj), abolish_object(Obj))) + ). @@ -550,8 +550,8 @@ abolish_category(Ctg) :- throw(error(type_error(category_identifier, Ctg), abolish_category(Ctg))). abolish_category(Ctg) :- - '$lgt_current_category_'(Ctg, Prefix, Type) -> - (Type = (dynamic) -> + ( '$lgt_current_category_'(Ctg, Prefix, Type) -> + ( Type == (dynamic) -> '$lgt_call'(Prefix, Dcl, Def, Rnm), '$lgt_abolish_entity_predicates'(Def), abolish(Dcl/4), @@ -563,10 +563,10 @@ abolish_category(Ctg) :- retractall('$lgt_imports_category_'(Ctg, _, _)), retractall('$lgt_implements_protocol_'(Ctg, _, _)), '$lgt_clean_lookup_caches' - ; - throw(error(permission_error(modify, static_category, Ctg), abolish_category(Ctg)))) - ; - throw(error(existence_error(category, Ctg), abolish_category(Ctg))). + ; throw(error(permission_error(modify, static_category, Ctg), abolish_category(Ctg))) + ) + ; throw(error(existence_error(category, Ctg), abolish_category(Ctg))) + ). @@ -581,8 +581,8 @@ abolish_protocol(Ptc) :- throw(error(type_error(protocol_identifier, Ptc), abolish_protocol(Ptc))). abolish_protocol(Ptc) :- - '$lgt_current_protocol_'(Ptc, Prefix, Type) -> - (Type = (dynamic) -> + ( '$lgt_current_protocol_'(Ptc, Prefix, Type) -> + ( Type == (dynamic) -> '$lgt_call'(Prefix, Dcl, Rnm), abolish(Dcl/4), abolish(Dcl/5), @@ -591,10 +591,10 @@ abolish_protocol(Ptc) :- retractall('$lgt_current_protocol_'(Ptc, _, _)), retractall('$lgt_extends_protocol_'(Ptc, _, _)), '$lgt_clean_lookup_caches' - ; - throw(error(permission_error(modify, static_protocol, Ptc), abolish_protocol(Ptc)))) - ; - throw(error(existence_error(protocol, Ptc), abolish_protocol(Ptc))). + ; throw(error(permission_error(modify, static_protocol, Ptc), abolish_protocol(Ptc))) + ) + ; throw(error(existence_error(protocol, Ptc), abolish_protocol(Ptc))) + ). @@ -602,8 +602,8 @@ abolish_protocol(Ptc) :- '$lgt_abolish_entity_predicates'(Def) :- '$lgt_call'(Def, _, _, _, _, Pred), - functor(Pred, Functor, Arity), - abolish(Functor/Arity), + functor(Pred, Functor, Arity), + abolish(Functor/Arity), fail. '$lgt_abolish_entity_predicates'(_). @@ -636,7 +636,9 @@ implements_protocol(ObjOrCtg, Ptc, Scope) :- implements_protocol(ObjOrCtg, Ptc, Scope) :- nonvar(Scope), - \+ '$lgt_member'(Scope, [(public), protected, private]), + Scope \== (public), + Scope \== protected, + Scope \== private, throw(error(type_error(scope, Scope), implements_protocol(ObjOrCtg, Ptc, Scope))). implements_protocol(ObjOrCtg, Ptc, Scope) :- @@ -670,7 +672,9 @@ imports_category(ObjOrCtg, Ctg, Scope) :- imports_category(ObjOrCtg, Ctg, Scope) :- nonvar(Scope), - \+ '$lgt_member'(Scope, [(public), protected, private]), + Scope \== (public), + Scope \== protected, + Scope \== private, throw(error(type_error(scope, Scope), imports_category(ObjOrCtg, Ctg, Scope))). imports_category(ObjOrCtg, Ctg, Scope) :- @@ -702,7 +706,9 @@ instantiates_class(Obj, Class, Scope) :- instantiates_class(Obj, Class, Scope) :- nonvar(Scope), - \+ '$lgt_member'(Scope, [(public), protected, private]), + Scope \== (public), + Scope \== protected, + Scope \== private, throw(error(type_error(scope, Scope), instantiates_class(Obj, Class, Scope))). instantiates_class(Obj, Class, Scope) :- @@ -734,7 +740,9 @@ specializes_class(Class, Superclass, Scope) :- specializes_class(Class, Superclass, Scope) :- nonvar(Scope), - \+ '$lgt_member'(Scope, [(public), protected, private]), + Scope \== (public), + Scope \== protected, + Scope \== private, throw(error(type_error(scope, Scope), specializes_class(Class, Superclass, Scope))). specializes_class(Class, Superclass, Scope) :- @@ -766,7 +774,9 @@ extends_protocol(Ptc1, Ptc2, Scope) :- extends_protocol(Ptc1, Ptc2, Scope) :- nonvar(Scope), - \+ '$lgt_member'(Scope, [(public), protected, private]), + Scope \== (public), + Scope \== protected, + Scope \== private, throw(error(type_error(scope, Scope), extends_protocol(Ptc1, Ptc2, Scope))). extends_protocol(Ptc1, Ptc2, Scope) :- @@ -798,7 +808,9 @@ extends_object(Prototype, Parent, Scope) :- extends_object(Prototype, Parent, Scope) :- nonvar(Scope), - \+ '$lgt_member'(Scope, [(public), protected, private]), + Scope \== (public), + Scope \== protected, + Scope \== private, throw(error(type_error(scope, Scope), extends_object(Prototype, Parent, Scope))). extends_object(Prototype, Parent, Scope) :- @@ -810,8 +822,8 @@ extends_object(Prototype, Parent, Scope) :- current_event(Event, Obj, Msg, Sender, Monitor) :- nonvar(Event), - Event \= before, - Event \= after, + Event \== before, + Event \== after, throw(error(type_error(event, Event), current_event(Event, Obj, Msg, Sender, Monitor))). current_event(Event, Obj, Msg, Sender, Monitor) :- @@ -846,8 +858,8 @@ current_event(after, Obj, Msg, Sender, Monitor) :- define_events(Event, Obj, Msg, Sender, Monitor) :- nonvar(Event), - Event \= before, - Event \= after, + Event \== before, + Event \== after, throw(error(type_error(event, Event), define_events(Event, Obj, Msg, Sender, Monitor))). define_events(Event, Obj, Msg, Sender, Monitor) :- @@ -903,8 +915,8 @@ define_events(after, Obj, Msg, Sender, Monitor) :- abolish_events(Event, Obj, Msg, Sender, Monitor) :- nonvar(Event), - Event \= before, - Event \= after, + Event \== before, + Event \== after, throw(error(type_error(event, Event), abolish_events(Event, Obj, Msg, Sender, Monitor))). abolish_events(Event, Obj, Msg, Sender, Monitor) :- @@ -948,18 +960,13 @@ abolish_events(after, Obj, Msg, Sender, Monitor) :- % % gets/checks the current value of a compiler flag -'$lgt_compiler_flag'(Option, Value) :- % flag value as defined in the options - '$lgt_pp_compiler_flag_'(Option, Value2), % argument of the compiling and loading - !, % predicates - Value = Value2. - -'$lgt_compiler_flag'(Option, Value) :- % default value for the current Logtalk - '$lgt_current_flag_'(Option, Value2), % session, set by calls to the - !, % set_logtalk_flag/2 predicate - Value = Value2. - -'$lgt_compiler_flag'(Option, Value) :- % default value, defined on the - '$lgt_default_flag'(Option, Value). % Prolog config files +'$lgt_compiler_flag'(Option, Value) :- + ( '$lgt_pp_compiler_flag_'(Option, Value2) -> % flag value as defined in the options argument + Value = Value2 % of the compiling and loading predicates + ; '$lgt_current_flag_'(Option, Value2) -> % default value for the current Logtalk session, + Value = Value2 % set by calls to the set_logtalk_flag/2 predicate + ; '$lgt_default_flag'(Option, Value) % default value, defined on the Prolog config files + ). @@ -981,20 +988,6 @@ logtalk_compile(Files) :- % % compiles to disk a source file or a list of source files using a list of flag options -logtalk_compile(File, Flags) :- - (atom(File), File \= []; compound(File), File \= [_| _]), - !, - catch( - ('$lgt_init_warnings_counter'(logtalk_compile(File, Flags)), - '$lgt_check_source_file'(File), - '$lgt_check_compiler_flags'(Flags), - '$lgt_set_compiler_flags'(Flags), - '$lgt_compile_file'(File), - '$lgt_report_warning_numbers'(logtalk_compile(File, Flags))), - Error, - ('$lgt_reset_warnings_counter', - throw(error(Error, logtalk_compile(File, Flags))))). - logtalk_compile(Files, Flags) :- catch( ('$lgt_init_warnings_counter'(logtalk_compile(Files, Flags)), @@ -1011,14 +1004,6 @@ logtalk_compile(Files, Flags) :- % predicates for compilation warning counting and reporting -'$lgt_reset_entity_warnings_flag' :- - retractall('$lgt_pp_entity_warnings_flag_'). - - -'$lgt_entity_warnings_flag' :- - '$lgt_pp_entity_warnings_flag_'. - - '$lgt_reset_warnings_counter' :- retractall('$lgt_pp_warnings_top_argument_'(_)), retractall('$lgt_pp_comp_warnings_counter_'(_)), @@ -1027,25 +1012,25 @@ logtalk_compile(Files, Flags) :- '$lgt_init_warnings_counter'(Term) :- - '$lgt_pp_warnings_top_argument_'(_) -> + ( '$lgt_pp_warnings_top_argument_'(_) -> true - ; - asserta('$lgt_pp_warnings_top_argument_'(Term)), - retractall('$lgt_pp_comp_warnings_counter_'(_)), + ; asserta('$lgt_pp_warnings_top_argument_'(Term)), % remember top compilation/loading goal + retractall('$lgt_pp_comp_warnings_counter_'(_)), % initialize compilation warnings counter asserta('$lgt_pp_comp_warnings_counter_'(0)), - retractall('$lgt_pp_load_warnings_counter_'(_)), + retractall('$lgt_pp_load_warnings_counter_'(_)), % initialize loading warnings counter asserta('$lgt_pp_load_warnings_counter_'(0)), - retractall('$lgt_pp_entity_warnings_flag_'). + retractall('$lgt_pp_entity_warnings_flag_') + ). '$lgt_inc_compile_warnings_counter' :- retract('$lgt_pp_comp_warnings_counter_'(Old)), New is Old + 1, asserta('$lgt_pp_comp_warnings_counter_'(New)), - ('$lgt_pp_entity_warnings_flag_' -> + ( '$lgt_pp_entity_warnings_flag_' -> true - ; - assertz('$lgt_pp_entity_warnings_flag_')). + ; assertz('$lgt_pp_entity_warnings_flag_') + ). '$lgt_inc_load_warnings_counter' :- @@ -1055,68 +1040,57 @@ logtalk_compile(Files, Flags) :- '$lgt_report_warning_numbers'(Term) :- - retract('$lgt_pp_warnings_top_argument_'(Term)), - retract('$lgt_pp_comp_warnings_counter_'(CCounter)), - retract('$lgt_pp_load_warnings_counter_'(LCounter)), - '$lgt_compiler_flag'(report, on), - Counter is CCounter + LCounter, - '$lgt_write_warning_numbers'(Counter, CCounter, LCounter), - !. - -'$lgt_report_warning_numbers'(_). - - -'$lgt_write_warning_numbers'(0, _, _) :- - !, - write('(0 warnings)'), nl. - -'$lgt_write_warning_numbers'(_, 0, LCounter) :- - !, - write('('), write(LCounter), write(' loading '), - '$lgt_write_warnings_word'(LCounter), write(')'), nl. - -'$lgt_write_warning_numbers'(_, CCounter, 0) :- - !, - write('('), write(CCounter), write(' compilation '), - '$lgt_write_warnings_word'(CCounter), write(')'), nl. - -'$lgt_write_warning_numbers'(_, CCounter, LCounter) :- - write('('), write(CCounter), write(' compilation '), - '$lgt_write_warnings_word'(CCounter), write(' and '), - write(LCounter), write(' loading '), - '$lgt_write_warnings_word'(LCounter), write(')'), nl. + ( retract('$lgt_pp_warnings_top_argument_'(Term)) -> % if top compilation/loading goal then + retract('$lgt_pp_comp_warnings_counter_'(CCounter)), % report compilation and loading warnings + retract('$lgt_pp_load_warnings_counter_'(LCounter)), + ( '$lgt_compiler_flag'(report, on) -> + ( CCounter + LCounter =:= 0 -> % no warnings + write('(0 warnings)'), nl + ; CCounter =:= 0 -> % no compilation warnings + write('('), write(LCounter), write(' loading '), + '$lgt_write_warnings_word'(LCounter), write(')'), nl + ; LCounter =:= 0 -> % no loading warnings + write('('), write(CCounter), write(' compilation '), + '$lgt_write_warnings_word'(CCounter), write(')'), nl + ; write('('), write(CCounter), write(' compilation '), % both compilation and loading warnings + '$lgt_write_warnings_word'(CCounter), write(' and '), + write(LCounter), write(' loading '), + '$lgt_write_warnings_word'(LCounter), write(')'), nl + ) + ; % report flag is off + true + ) + ; % not top compilation/loading goal + true + ). '$lgt_write_warnings_word'(Number) :- - Number =:= 1 -> + ( Number =:= 1 -> write(warning) - ; - write(warnings). + ; write(warnings) + ). -% '$lgt_check_source_files'(@list) +% '$lgt_check_source_files'(@term) % -% check if the source file names are valid and if they exist in the current working directory +% check if the source file names are valid and correspond to existing files '$lgt_check_source_files'(Files) :- var(Files), throw(instantiation_error). -'$lgt_check_source_files'(Files) :- - \+ '$lgt_is_proper_list'(Files), - throw(type_error(source_file_names, Files)). +'$lgt_check_source_files'([]) :- + !. -'$lgt_check_source_files'(Files) :- - '$lgt_check_source_files_list'(Files). - - -'$lgt_check_source_files_list'([]). - -'$lgt_check_source_files_list'([File| Files]) :- +'$lgt_check_source_files'([File| Files]) :- + !, '$lgt_check_source_file'(File), - '$lgt_check_source_files_list'(Files). + '$lgt_check_source_files'(Files). +'$lgt_check_source_files'(File) :- + '$lgt_check_source_file'(File). '$lgt_check_source_file'(File) :- @@ -1140,13 +1114,12 @@ logtalk_compile(Files, Flags) :- '$lgt_check_source_file'(_). -'$lgt_check_library_source_file'(Term) :- - \+ Term =.. [_, _], - throw(type_error(source_file_name, Term)). '$lgt_check_library_source_file'(Term) :- - Term =.. [Library, File], - '$lgt_check_library_source_file'(Library, File). + ( Term =.. [Library, File] -> + '$lgt_check_library_source_file'(Library, File) + ; throw(type_error(source_file_name, Term)) + ). '$lgt_check_library_source_file'(Library, File) :- @@ -1174,18 +1147,18 @@ logtalk_compile(Files, Flags) :- '$lgt_expand_library_path'(Library, Path, N) :- - logtalk_library_path(Library, Location) -> - (atom(Location) -> + ( logtalk_library_path(Library, Location) -> + ( atom(Location) -> Path = Location - ; - Location =.. [Library2, Location2], + ; Location =.. [Library2, Location2], N > 0, N2 is N - 1, '$lgt_expand_library_path'(Library2, Path2, N2), - atom_concat(Path2, Location2, Path)) - ; - (atom(Library), - Path = Library). + atom_concat(Path2, Location2, Path) + ) + ; atom(Library), + Path = Library + ). @@ -1208,17 +1181,17 @@ logtalk_compile(Files, Flags) :- '$lgt_check_compiler_flag_list'([]). '$lgt_check_compiler_flag_list'([Flag| Flags]) :- - '$lgt_valid_compiler_flag'(Flag) -> + ( '$lgt_valid_compiler_flag'(Flag) -> '$lgt_check_compiler_flag_list'(Flags) - ; - throw(type_error(compiler_flag, Flag)). + ; throw(type_error(compiler_flag, Flag)) + ). '$lgt_valid_compiler_flag'(Flag) :- compound(Flag), Flag =.. [Name, Value], nonvar(Value), - once('$lgt_valid_flag_value'(Name, Value)). + '$lgt_valid_flag_value'(Name, Value). @@ -1227,15 +1200,15 @@ logtalk_compile(Files, Flags) :- % sets the compiler flag options '$lgt_set_compiler_flags'(Flags) :- - retractall('$lgt_pp_compiler_flag_'(_, _)), - retractall('$lgt_pp_hook_goal_'(_, _)), + retractall('$lgt_pp_compiler_flag_'(_, _)), % retract old flag values + retractall('$lgt_pp_hook_goal_'(_, _)), % and any old hook goal '$lgt_assert_compiler_flags'(Flags), - ( '$lgt_pp_compiler_flag_'(debug, on) -> - retractall('$lgt_pp_compiler_flag_'(smart_compilation, _)), - asserta('$lgt_pp_compiler_flag_'(smart_compilation, off)) + ( '$lgt_pp_compiler_flag_'(debug, on) -> % debug flag on implies that + retractall('$lgt_pp_compiler_flag_'(smart_compilation, _)), % the smart_compilation flag + asserta('$lgt_pp_compiler_flag_'(smart_compilation, off)) % must be off ; true), - ( '$lgt_pp_compiler_flag_'(hook, Obj::Functor) -> - Call =.. [Functor, Term, Terms], + ( '$lgt_pp_compiler_flag_'(hook, Obj::Functor) -> % pre-compile hook in order + Call =.. [Functor, Term, Terms], % to speed up entity compilation ( Obj == user -> Goal = Call ; '$lgt_tr_msg'(Call, Obj, Goal, user) @@ -1274,20 +1247,6 @@ logtalk_load(Files) :- % compiles to disk and then loads to memory a source file % or a list of source files using a list of compiler options -logtalk_load(File, Flags) :- - (atom(File), File \= []; compound(File), File \= [_| _]), - !, - catch( - ('$lgt_init_warnings_counter'(logtalk_load(File, Flags)), - '$lgt_check_source_file'(File), - '$lgt_check_compiler_flags'(Flags), - '$lgt_set_compiler_flags'(Flags), - '$lgt_load_file'(File), - '$lgt_report_warning_numbers'(logtalk_load(File, Flags))), - Error, - ('$lgt_reset_warnings_counter', - throw(error(Error, logtalk_load(File, Flags))))). - logtalk_load(Files, Flags) :- catch( ('$lgt_init_warnings_counter'(logtalk_load(Files, Flags)), @@ -1332,27 +1291,16 @@ set_logtalk_flag(Flag, Value) :- \+ '$lgt_valid_flag_value'(Flag, Value), throw(error(domain_error(valid_flag_value, Value), set_logtalk_flag(Flag, Value))). -set_logtalk_flag(debug, on) :- - !, - retractall('$lgt_current_flag_'(debug, _)), - assertz('$lgt_current_flag_'(debug, on)), - retractall('$lgt_current_flag_'(smart_compilation, _)), - assertz('$lgt_current_flag_'(smart_compilation, off)). - -set_logtalk_flag(hook, Obj::Functor) :- - !, - retractall('$lgt_current_flag_'(hook, _)), - assertz('$lgt_current_flag_'(hook, Obj::Functor)), - Call =.. [Functor, Term, Terms], - ( Obj == user -> - Goal = Call - ; '$lgt_tr_msg'(Call, Obj, Goal, user)), - retractall('$lgt_hook_goal_'(_, _)), - assertz(('$lgt_hook_goal_'(Term, Terms) :- catch(Goal, _, fail))). - set_logtalk_flag(Flag, Value) :- retractall('$lgt_current_flag_'(Flag, _)), - assertz('$lgt_current_flag_'(Flag, Value)). + assertz('$lgt_current_flag_'(Flag, Value)), + ( Flag == debug -> + retractall('$lgt_current_flag_'(smart_compilation, _)), + assertz('$lgt_current_flag_'(smart_compilation, off)) + ; Flag == hook -> + '$lgt_compile_hook'(Value) + ; true + ). @@ -1377,7 +1325,7 @@ current_logtalk_flag(Flag, Value) :- '$lgt_default_flag'(Flag, Value), \+ '$lgt_current_flag_'(Flag, _). -current_logtalk_flag(version, version(2, 27, 0)). +current_logtalk_flag(version, version(2, 27, 1)). @@ -1393,10 +1341,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % checks if an object exists at runtime '$lgt_obj_exists'(Obj, Pred, Sender) :- - \+ '$lgt_current_object_'(Obj, _, _, _, _, _) -> - throw(error(existence_error(object, Obj), Obj::Pred, Sender)) - ; - true. + ( '$lgt_current_object_'(Obj, _, _, _, _, _) -> + true + ; throw(error(existence_error(object, Obj), Obj::Pred, Sender)) + ). @@ -1426,7 +1374,8 @@ current_logtalk_flag(version, version(2, 27, 0)). nonvar(Arity), !, functor(Pred, Functor, Arity), - once('$lgt_visible_predicate'(Obj, Pred, Sender, Scope)). + '$lgt_visible_predicate'(Obj, Pred, Sender, Scope), + !. '$lgt_current_predicate'(Obj, Functor/Arity, Sender, Scope) :- setof( @@ -1437,6 +1386,8 @@ current_logtalk_flag(version, version(2, 27, 0)). % '$lgt_visible_predicate'(@object_identifier, ?callable, @object_identifier, @term) +% +% checks/returns object predicates visible/within the scope of the sender '$lgt_visible_predicate'(Obj, Pred, Sender, Scope) :- '$lgt_current_object_'(Obj, _, Dcl, _, _, _), @@ -1474,9 +1425,9 @@ current_logtalk_flag(version, version(2, 27, 0)). ; Prop = declared_in(TCtn) ; '$lgt_once'(Def, Pred, _, _, _, _, DCtn), Prop = defined_in(DCtn) - ; Meta \= no, + ; Meta \== no, Prop = metapredicate(Meta) - ; NonTerminal \= no, + ; NonTerminal \== no, functor(Pred, Functor, Arity2), Arity is Arity2 - 2, Prop = non_terminal(Functor//Arity) @@ -1502,7 +1453,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_built_in'(Pred), ( Prop = (public) ; Prop = built_in - ; ('$lgt_predicate_property'(Pred, (dynamic)) -> Prop = (dynamic); Prop = static) + ; ( '$lgt_predicate_property'(Pred, (dynamic)) -> + Prop = (dynamic) + ; Prop = static + ) ; functor(Pred, Functor, Arity), functor(Meta, Functor, Arity), ('$lgt_metapredicate'(Meta) -> Prop = metapredicate(Meta)) @@ -1600,35 +1554,40 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_abolish_chk'(Obj, Functor/Arity, Sender, Scope) :- '$lgt_current_object_'(Obj, Prefix, Dcl, _, _, _), !, - ((functor(Pred, Functor, Arity), '$lgt_call'(Dcl, Pred, PScope, Compilation, _, _, SCtn, _)) -> - ((\+ \+ PScope = Scope; Sender = SCtn) -> - (Compilation = (dynamic) -> + ( functor(Pred, Functor, Arity), + '$lgt_call'(Dcl, Pred, PScope, Compilation, _, _, SCtn, _) -> + ( (\+ \+ PScope = Scope; Sender = SCtn) -> + ( Compilation == (dynamic) -> '$lgt_call'(Prefix, _, _, _, _, _, DDcl, DDef, _), - ('$lgt_call'(DDcl, Pred, _) -> + ( '$lgt_call'(DDcl, Pred, _) -> Clause =.. [DDcl, Pred, _], retractall(Clause), - ('$lgt_call'(DDef, Pred, _, _, _, Call) -> + ( '$lgt_call'(DDef, Pred, _, _, _, Call) -> functor(Call, CFunctor, CArity), abolish(CFunctor/CArity), Clause2 =.. [DDef, Pred, _, _, _, Call], retractall(Clause2), '$lgt_clean_lookup_caches'(Pred) - ; - true) - ; - ('$lgt_call'(Dcl, Pred, _, _, _, _) -> + ; true + ) + ; % no dynamic predicate declaration: + ( '$lgt_call'(Dcl, Pred, _, _, _, _) -> throw(error(permission_error(modify, predicate_declaration, Pred), Obj::abolish(Functor/Arity), Sender)) - ; - throw(error(existence_error(predicate_declaration, Pred), Obj::abolish(Functor/Arity), Sender)))) - ; - throw(error(permission_error(modify, static_predicate, Pred), Obj::abolish(Functor/Arity), Sender))) - ; - (PScope = p -> + ; throw(error(existence_error(predicate_declaration, Pred), Obj::abolish(Functor/Arity), Sender)) + ) + ) + ; % predicate is static: + throw(error(permission_error(modify, static_predicate, Pred), Obj::abolish(Functor/Arity), Sender)) + ) + ; % predicate is not within the scope of the sender: + ( PScope == p -> throw(error(permission_error(modify, private_predicate, Pred), Obj::abolish(Functor/Arity), Sender)) - ; - throw(error(permission_error(modify, protected_predicate, Pred), Obj::abolish(Functor/Arity), Sender)))) - ; - throw(error(existence_error(predicate_declaration, Pred), Obj::abolish(Functor/Arity), Sender))). + ; throw(error(permission_error(modify, protected_predicate, Pred), Obj::abolish(Functor/Arity), Sender)) + ) + ) + ; % no predicate declaration: + throw(error(existence_error(predicate_declaration, Pred), Obj::abolish(Functor/Arity), Sender)) + ). '$lgt_abolish_chk'(Obj, Functor/Arity, Sender, _) :- throw(error(existence_error(object, Obj), Obj::abolish(Functor/Arity), Sender)). @@ -1664,10 +1623,10 @@ current_logtalk_flag(version, version(2, 27, 0)). throw(error(type_error(callable, Body), Obj::asserta((Head:-Body)), Sender)). '$lgt_asserta'(Obj, Clause, Sender, TestScope, DclScope) :- - Clause = (_ :- _) -> + ( Clause = (_ :- _) -> '$lgt_asserta_rule_chk'(Obj, Clause, Sender, TestScope, DclScope) - ; - '$lgt_asserta_fact_chk'(Obj, Clause, Sender, TestScope, DclScope). + ; '$lgt_asserta_fact_chk'(Obj, Clause, Sender, TestScope, DclScope) + ). '$lgt_asserta_rule_chk'(Obj, (Head:-Body), Sender, TestScope, DclScope) :- @@ -1675,23 +1634,25 @@ current_logtalk_flag(version, version(2, 27, 0)). !, '$lgt_call'(Prefix, Dcl, Def, _, _, _, DDcl, DDef, _), '$lgt_assert_pred_dcl'(Dcl, DDcl, Head, Scope, Type, Meta, SCtn, DclScope), - (Type = (dynamic) -> - ((\+ \+ Scope = TestScope; Sender = SCtn) -> - '$lgt_assert_pred_call'(Def, DDef, Prefix, Head, Sender2, This, Self, Call, _), + ( Type == (dynamic) -> + ( (\+ \+ Scope = TestScope; Sender = SCtn) -> + '$lgt_assert_pred_call'(Obj, Def, DDef, Prefix, Head, Sender2, This, Self, Call, _), '$lgt_pred_meta_vars'(Head, Meta, Metavars), '$lgt_ctx_ctx'(Ctx, Sender2, This, Self, Prefix, Metavars), '$lgt_tr_body'(Body, TBody, DBody, Ctx), - ('$lgt_debugging_'(Obj) -> + ( '$lgt_debugging_'(Obj) -> asserta((Call :- ('$lgt_nop'(Body), '$lgt_dbg_head'(Head, Ctx), DBody))) - ; - asserta((Call :- ('$lgt_nop'(Body), TBody)))) - ; - (Scope = p -> + ; asserta((Call :- ('$lgt_nop'(Body), TBody))) + ) + ; % predicate is not within the scope of the sender: + ( Scope == p -> throw(error(permission_error(modify, private_predicate, Head), Obj::asserta((Head:-Body)), Sender)) - ; - throw(error(permission_error(modify, protected_predicate, Head), Obj::asserta((Head:-Body)), Sender)))) - ; - throw(error(permission_error(modify, static_predicate, Head), Obj::asserta((Head:-Body)), Sender))). + ; throw(error(permission_error(modify, protected_predicate, Head), Obj::asserta((Head:-Body)), Sender)) + ) + ) + ; % predicate is static: + throw(error(permission_error(modify, static_predicate, Head), Obj::asserta((Head:-Body)), Sender)) + ). '$lgt_asserta_rule_chk'(Obj, (Head:-Body), Sender, _, _) :- throw(error(existence_error(object, Obj), Obj::asserta((Head:-Body)), Sender)). @@ -1707,27 +1668,30 @@ current_logtalk_flag(version, version(2, 27, 0)). !, '$lgt_call'(Prefix, Dcl, Def, _, _, _, DDcl, DDef, _), '$lgt_assert_pred_dcl'(Dcl, DDcl, Head, Scope, Type, _, SCtn, DclScope), - (Type = (dynamic) -> - ((\+ \+ Scope = TestScope; Sender = SCtn) -> - ('$lgt_debugging_'(Obj) -> - '$lgt_assert_pred_call'(Def, DDef, Prefix, Head, Sender2, This, Self, Call, _), + ( Type == (dynamic) -> + ( (\+ \+ Scope = TestScope; Sender = SCtn) -> + ( '$lgt_debugging_'(Obj) -> + '$lgt_assert_pred_call'(Obj, Def, DDef, Prefix, Head, Sender2, This, Self, Call, _), '$lgt_ctx_ctx'(Ctx, Sender2, This, Self, Prefix, []), asserta((Call :- '$lgt_dbg_fact'(Head, Ctx))) - ; + ; % not debugging, generate predicate template for caching: functor(Head, HFunctor, HArity), functor(GHead, HFunctor, HArity), functor(Obj, OFunctor, OArity), functor(GObj, OFunctor, OArity), functor(Sender, SFunctor, SArity), functor(GSender, SFunctor, SArity), - '$lgt_assert_pred_call'(Def, DDef, Prefix, GHead, Sender2, This, Self, GCall, Update), + '$lgt_assert_pred_call'(Obj, Def, DDef, Prefix, GHead, Sender2, This, Self, GCall, Update), asserta('$lgt_db_lookup_cache_'(GObj, GHead, GSender, Scope, GCall, Update)), - GObj = Obj, GHead = Head, GSender = Sender, - asserta(GCall)) - ; - (Scope = p -> + (GObj, GHead, GSender) = (Obj, Head, Sender), + asserta(GCall) + ) + ; % predicate is not within the scope of the sender: + ( Scope == p -> throw(error(permission_error(modify, private_predicate, Head), Obj::asserta(Head), Sender)) - ; - throw(error(permission_error(modify, protected_predicate, Head), Obj::asserta(Head), Sender)))) - ; - throw(error(permission_error(modify, static_predicate, Head), Obj::asserta(Head), Sender))). + ; throw(error(permission_error(modify, protected_predicate, Head), Obj::asserta(Head), Sender)) + ) + ) + ; % predicate is static: + throw(error(permission_error(modify, static_predicate, Head), Obj::asserta(Head), Sender)) + ). '$lgt_asserta_fact_chk'(Obj, Head, Sender, _, _) :- throw(error(existence_error(object, Obj), Obj::asserta(Head), Sender)). @@ -1758,10 +1722,10 @@ current_logtalk_flag(version, version(2, 27, 0)). throw(error(type_error(callable, Clause), Obj::asserta(Clause), Sender)). '$lgt_assertz'(Obj, Clause, Sender, TestScope, DclScope) :- - Clause = (_ :- _) -> + ( Clause = (_ :- _) -> '$lgt_assertz_rule_chk'(Obj, Clause, Sender, TestScope, DclScope) - ; - '$lgt_assertz_fact_chk'(Obj, Clause, Sender, TestScope, DclScope). + ; '$lgt_assertz_fact_chk'(Obj, Clause, Sender, TestScope, DclScope) + ). '$lgt_assertz_rule_chk'(Obj, (Head:-Body), Sender, TestScope, DclScope) :- @@ -1769,23 +1733,25 @@ current_logtalk_flag(version, version(2, 27, 0)). !, '$lgt_call'(Prefix, Dcl, Def, _, _, _, DDcl, DDef, _), '$lgt_assert_pred_dcl'(Dcl, DDcl, Head, Scope, Type, Meta, SCtn, DclScope), - (Type = (dynamic) -> - ((\+ \+ Scope = TestScope; Sender = SCtn) -> - '$lgt_assert_pred_call'(Def, DDef, Prefix, Head, Sender2, This, Self, Call, _), + ( Type == (dynamic) -> + ( (\+ \+ Scope = TestScope; Sender = SCtn) -> + '$lgt_assert_pred_call'(Obj, Def, DDef, Prefix, Head, Sender2, This, Self, Call, _), '$lgt_pred_meta_vars'(Head, Meta, Metavars), '$lgt_ctx_ctx'(Ctx, Sender2, This, Self, Prefix, Metavars), '$lgt_tr_body'(Body, TBody, DBody, Ctx), - ('$lgt_debugging_'(Obj) -> + ( '$lgt_debugging_'(Obj) -> assertz((Call :- ('$lgt_nop'(Body), '$lgt_dbg_head'(Head, Ctx), DBody))) - ; - assertz((Call :- ('$lgt_nop'(Body), TBody)))) - ; - (Scope = p -> + ; assertz((Call :- ('$lgt_nop'(Body), TBody))) + ) + ; % predicate is not within the scope of the sender: + ( Scope == p -> throw(error(permission_error(modify, private_predicate, Head), Obj::assertz((Head:-Body)), Sender)) - ; - throw(error(permission_error(modify, protected_predicate, Head), Obj::assertz((Head:-Body)), Sender)))) - ; - throw(error(permission_error(modify, static_predicate, Head), Obj::assertz((Head:-Body)), Sender))). + ; throw(error(permission_error(modify, protected_predicate, Head), Obj::assertz((Head:-Body)), Sender)) + ) + ) + ; % predicate is static: + throw(error(permission_error(modify, static_predicate, Head), Obj::assertz((Head:-Body)), Sender)) + ). '$lgt_assertz_rule_chk'(Obj, (Head:-Body), Sender, _, _) :- throw(error(existence_error(object, Obj), Obj::assertz((Head:-Body)), Sender)). @@ -1801,27 +1767,30 @@ current_logtalk_flag(version, version(2, 27, 0)). !, '$lgt_call'(Prefix, Dcl, Def, _, _, _, DDcl, DDef, _), '$lgt_assert_pred_dcl'(Dcl, DDcl, Head, Scope, Type, _, SCtn, DclScope), - (Type = (dynamic) -> - ((\+ \+ Scope = TestScope; Sender = SCtn) -> - ('$lgt_debugging_'(Obj) -> - '$lgt_assert_pred_call'(Def, DDef, Prefix, Head, Sender2, This, Self, Call, _), + ( Type == (dynamic) -> + ( (\+ \+ Scope = TestScope; Sender = SCtn) -> + ( '$lgt_debugging_'(Obj) -> + '$lgt_assert_pred_call'(Obj, Def, DDef, Prefix, Head, Sender2, This, Self, Call, _), '$lgt_ctx_ctx'(Ctx, Sender2, This, Self, Prefix, []), assertz((Call :- '$lgt_dbg_fact'(Head, Ctx))) - ; + ; % not debugging, generate predicate template for caching: functor(Head, HFunctor, HArity), functor(GHead, HFunctor, HArity), functor(Obj, OFunctor, OArity), functor(GObj, OFunctor, OArity), functor(Sender, SFunctor, SArity), functor(GSender, SFunctor, SArity), - '$lgt_assert_pred_call'(Def, DDef, Prefix, GHead, Sender2, This, Self, GCall, Update), + '$lgt_assert_pred_call'(Obj, Def, DDef, Prefix, GHead, Sender2, This, Self, GCall, Update), asserta('$lgt_db_lookup_cache_'(GObj, GHead, GSender, Scope, GCall, Update)), - GObj = Obj, GHead = Head, GSender = Sender, - assertz(GCall)) - ; - (Scope = p -> + (GObj, GHead, GSender) = (Obj, Head, Sender), + assertz(GCall) + ) + ; % predicate is not within the scope of the sender: + ( Scope == p -> throw(error(permission_error(modify, private_predicate, Head), Obj::asserta(Head), Sender)) - ; - throw(error(permission_error(modify, protected_predicate, Head), Obj::asserta(Head), Sender)))) - ; - throw(error(permission_error(modify, static_predicate, Head), Obj::asserta(Head), Sender))). + ; throw(error(permission_error(modify, protected_predicate, Head), Obj::asserta(Head), Sender)) + ) + ) + ; % predicate is static: + throw(error(permission_error(modify, static_predicate, Head), Obj::asserta(Head), Sender)) + ). '$lgt_assertz_fact_chk'(Obj, Head, Sender, _, _) :- throw(error(existence_error(object, Obj), Obj::assertz(Head), Sender)). @@ -1831,28 +1800,37 @@ current_logtalk_flag(version, version(2, 27, 0)). % get or set (if doesn't exist) the declaration for an asserted predicate '$lgt_assert_pred_dcl'(Dcl, DDcl, Pred, Scope, Type, Meta, SCtn, DclScope) :- - '$lgt_call'(Dcl, Pred, Scope, Type, Meta, _, SCtn, _) -> + ( '$lgt_call'(Dcl, Pred, Scope, Type, Meta, _, SCtn, _) -> true - ; + ; % no previous predicate declaration: '$lgt_assert_ddcl_clause'(DDcl, Pred, DclScope), - (Scope, Type, Meta) = (DclScope, (dynamic), no). + (Scope, Type, Meta) = (DclScope, (dynamic), no) + ). % get or set (if doesn't exist) the compiled call for an asserted predicate -'$lgt_assert_pred_call'(Def, _, _, Pred, Sender, This, Self, Call, true) :- - '$lgt_call'(Def, Pred, Sender, This, Self, Call), - !. - -'$lgt_assert_pred_call'(_, DDef, _, Pred, Sender, This, Self, Call, '$lgt_update_ddef_table'(DDef, Pred, Call)) :- - '$lgt_call'(DDef, Pred, Sender, This, Self, Call), - !. - -'$lgt_assert_pred_call'(_, DDef, Prefix, Pred, Sender, This, Self, Call, '$lgt_update_ddef_table'(DDef, Pred, Call)) :- - functor(Pred, Functor, Arity), - '$lgt_assert_ddef_clause'(Functor, Arity, Prefix, DDef, _), - '$lgt_once'(DDef, Pred, Sender, This, Self, Call). +'$lgt_assert_pred_call'(Obj, Def, DDef, Prefix, Pred, Sender, This, Self, Call, Update) :- + ( % if a definition lookup entry alread exists on the object... + '$lgt_call'(Def, Pred, Sender, This, Self, Call, Obj) -> + ( % then check if it's a dynamic one that implies an update goal... + '$lgt_call'(DDef, Pred, Sender, This, Self, Call) -> + Update = '$lgt_update_ddef_table'(DDef, Pred, Call) + ; % or a static one... + Update = true + ) + ; % else no definition lookup entry exists; construct and assert a dynamic one... + functor(Pred, Functor, Arity), + '$lgt_construct_predicate_functor'(Prefix, Functor, Arity, PredPrefix), + Pred =.. [_| Args], + '$lgt_append'(Args, [Sender, This, Self], TArgs), + Call =.. [PredPrefix| TArgs], + Clause =.. [DDef, Pred, Sender, This, Self, Call], + assertz(Clause), + '$lgt_clean_lookup_caches'(Pred), + Update = '$lgt_update_ddef_table'(DDef, Pred, Call) + ). @@ -1879,40 +1857,43 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_db_lookup_cache_'(Obj, Head, Sender, Scope, Call, _), !, clause(Call, TBody), - (TBody = ('$lgt_nop'(Body), _) -> + ( TBody = ('$lgt_nop'(Body), _) -> true - ; - Body = TBody). + ; Body = TBody + ). '$lgt_clause_chk'(Obj, Head, Body, Sender, Scope) :- '$lgt_current_object_'(Obj, Prefix, _, _, _, _), !, '$lgt_call'(Prefix, Dcl, Def, _, _, _, _, DDef, _), - ('$lgt_call'(Dcl, Head, PScope, Type, _, _, SCtn, _) -> - (Type = (dynamic) -> - ((\+ \+ PScope = Scope; Sender = SCtn) -> + ( '$lgt_call'(Dcl, Head, PScope, Type, _, _, SCtn, _) -> + ( Type == (dynamic) -> + ( (\+ \+ PScope = Scope; Sender = SCtn) -> once(('$lgt_call'(Def, Head, _, _, _, Call); '$lgt_call'(DDef, Head, _, _, _, Call))), clause(Call, TBody), - (TBody = ('$lgt_nop'(Body), _) -> + ( TBody = ('$lgt_nop'(Body), _) -> true - ; - Body = TBody) - ; - (PScope = p -> + ; Body = TBody + ) + ; % predicate is not within the scope of the sender: + ( PScope == p -> throw(error(permission_error(access, private_predicate, Head), Obj::clause(Head, Body), Sender)) - ; - throw(error(permission_error(access, protected_predicate, Head), Obj::clause(Head, Body), Sender)))) - ; - throw(error(permission_error(access, static_predicate, Head), Obj::clause(Head, Body), Sender))) - ; - ((Obj = Sender, '$lgt_call'(DDef, Head, _, _, _, Call)) -> % local dynamic predicate with no scope declaration + ; throw(error(permission_error(access, protected_predicate, Head), Obj::clause(Head, Body), Sender)) + ) + ) + ; % predicate is static: + throw(error(permission_error(access, static_predicate, Head), Obj::clause(Head, Body), Sender)) + ) + ; % local dynamic predicate with no scope declaration: + ( (Obj = Sender, '$lgt_call'(DDef, Head, _, _, _, Call)) -> clause(Call, TBody), - (TBody = ('$lgt_nop'(Body), _) -> + ( TBody = ('$lgt_nop'(Body), _) -> true - ; - Body = TBody) - ; - throw(error(existence_error(predicate_declaration, Head), Obj::clause(Head, Body), Sender)))). + ; Body = TBody + ) + ; throw(error(existence_error(predicate_declaration, Head), Obj::clause(Head, Body), Sender)) + ) + ). '$lgt_clause_chk'(Obj, Head, Body, Sender, _) :- throw(error(existence_error(object, Obj), Obj::clause(Head, Body), Sender)). @@ -1934,39 +1915,43 @@ current_logtalk_flag(version, version(2, 27, 0)). throw(error(type_error(callable, Head), Obj::retract((Head:-Body)), Sender)). '$lgt_retract'(Obj, Clause, Sender, Scope) :- - Clause = (_ :- _) -> + ( Clause = (_ :- _) -> '$lgt_retract_rule_chk'(Obj, Clause, Sender, Scope) - ; - '$lgt_retract_fact_chk'(Obj, Clause, Sender, Scope). + ; '$lgt_retract_fact_chk'(Obj, Clause, Sender, Scope) + ). '$lgt_retract_rule_chk'(Obj, (Head:-Body), Sender, Scope) :- '$lgt_current_object_'(Obj, Prefix, _, _, _, _), !, '$lgt_call'(Prefix, Dcl, Def, _, _, _, _, DDef, _), - ('$lgt_call'(Dcl, Head, PScope, Type, _, _, SCtn, _) -> - (Type = (dynamic) -> - ((\+ \+ PScope = Scope; Sender = SCtn) -> - ('$lgt_call'(Def, Head, _, _, _, Call) -> + ( '$lgt_call'(Dcl, Head, PScope, Type, _, _, SCtn, _) -> + ( Type == (dynamic) -> + ( (\+ \+ PScope = Scope; Sender = SCtn) -> + ( '$lgt_call'(Def, Head, _, _, _, Call) -> retract((Call :- ('$lgt_nop'(Body), _))) - ; - ('$lgt_call'(DDef, Head, _, _, _, Call) -> + ; ( '$lgt_call'(DDef, Head, _, _, _, Call) -> retract((Call :- ('$lgt_nop'(Body), _))), '$lgt_update_ddef_table'(DDef, Head, Call) - ; - fail)) - ; - (PScope = p -> + ; fail + ) + ) + ; % predicate is not within the scope of the sender: + ( PScope == p -> throw(error(permission_error(modify, private_predicate, Head), Obj::retract((Head:-Body)), Sender)) - ; - throw(error(permission_error(modify, protected_predicate, Head), Obj::retract((Head:-Body)), Sender)))) - ; - throw(error(permission_error(modify, static_predicate, Head), Obj::retract((Head:-Body)), Sender))) - ; - ((Obj = Sender, '$lgt_call'(DDef, Head, _, _, _, Call)) -> % local dynamic predicate with no scope declaration + ; throw(error(permission_error(modify, protected_predicate, Head), Obj::retract((Head:-Body)), Sender)) + ) + ) + ; % predicate is static: + throw(error(permission_error(modify, static_predicate, Head), Obj::retract((Head:-Body)), Sender)) + ) + ; % local dynamic predicate with no scope declaration: + ( Obj = Sender, + '$lgt_call'(DDef, Head, _, _, _, Call) -> retract((Call :- ('$lgt_nop'(Body), _))) - ; - throw(error(existence_error(predicate_declaration, Head), Obj::retract((Head:-Body)), Sender)))). + ; throw(error(existence_error(predicate_declaration, Head), Obj::retract((Head:-Body)), Sender)) + ) + ). '$lgt_retract_rule_chk'(Obj, (Head:-Body), Sender, _) :- throw(error(existence_error(object, Obj), Obj::retract((Head:-Body)), Sender)). @@ -1985,47 +1970,50 @@ current_logtalk_flag(version, version(2, 27, 0)). functor(Head, HFunctor, HArity), functor(GHead, HFunctor, HArity), functor(Obj, OFunctor, OArity), functor(GObj, OFunctor, OArity), functor(Sender, SFunctor, SArity), functor(GSender, SFunctor, SArity), - ('$lgt_call'(Dcl, Head, PScope, Type, _, _, SCtn, _) -> - (Type = (dynamic) -> - ((\+ \+ PScope = Scope; Sender = SCtn) -> - ('$lgt_call'(Def, GHead, _, _, _, GCall) -> - ('$lgt_debugging_'(Obj) -> - GObj = Obj, GHead = Head, GSender = Sender, + ( '$lgt_call'(Dcl, Head, PScope, Type, _, _, SCtn, _) -> + ( Type == (dynamic) -> + ( (\+ \+ PScope = Scope; Sender = SCtn) -> + ( '$lgt_call'(Def, GHead, _, _, _, GCall) -> + ( '$lgt_debugging_'(Obj) -> + (GObj, GHead, GSender) = (Obj, Head, Sender), retract((GCall :- '$lgt_dbg_fact'(_, _))) - ; - asserta('$lgt_db_lookup_cache_'(GObj, GHead, GSender, Scope, GCall, true)), - GObj = Obj, GHead = Head, GSender = Sender, - retract(GCall)) - ; - ('$lgt_call'(DDef, GHead, _, _, _, GCall) -> - ('$lgt_debugging_'(Obj) -> - GObj = Obj, GHead = Head, GSender = Sender, + ; asserta('$lgt_db_lookup_cache_'(GObj, GHead, GSender, Scope, GCall, true)), + (GObj, GHead, GSender) = (Obj, Head, Sender), + retract(GCall) + ) + ; ( '$lgt_call'(DDef, GHead, _, _, _, GCall) -> + ( '$lgt_debugging_'(Obj) -> + (GObj, GHead, GSender) = (Obj, Head, Sender), retract((GCall :- '$lgt_dbg_fact'(_, _))) - ; - asserta('$lgt_db_lookup_cache_'(GObj, GHead, GSender, Scope, GCall, '$lgt_update_ddef_table'(DDef, GHead, GCall))), - GObj = Obj, GHead = Head, GSender = Sender, - retract(GCall)), + ; asserta('$lgt_db_lookup_cache_'(GObj, GHead, GSender, Scope, GCall, '$lgt_update_ddef_table'(DDef, GHead, GCall))), + (GObj, GHead, GSender) = (Obj, Head, Sender), + retract(GCall) + ), '$lgt_update_ddef_table'(DDef, GHead, GCall) - ; - fail)) - ; - (PScope = p -> + ; fail + ) + ) + ; % predicate is not within the scope of the sender: + ( PScope == p -> throw(error(permission_error(modify, private_predicate, Head), Obj::retract(Head), Sender)) - ; - throw(error(permission_error(modify, protected_predicate, Head), Obj::retract(Head), Sender)))) - ; - throw(error(permission_error(modify, static_predicate, Head), Obj::retract(Head), Sender))) - ; - ((GObj = GSender, '$lgt_call'(DDef, GHead, _, _, _, GCall)) -> % local dynamic predicate with no scope declaration - ('$lgt_debugging_'(Obj) -> - GObj = Obj, GHead = Head, GSender = Sender, + ; throw(error(permission_error(modify, protected_predicate, Head), Obj::retract(Head), Sender)) + ) + ) + ; % predicate is static: + throw(error(permission_error(modify, static_predicate, Head), Obj::retract(Head), Sender)) + ) + ; % local dynamic predicate with no scope declaration: + ( GObj = GSender, '$lgt_call'(DDef, GHead, _, _, _, GCall) -> + ( '$lgt_debugging_'(Obj) -> + (GObj, GHead, GSender) = (Obj, Head, Sender), retract((GCall :- '$lgt_dbg_fact'(_, _))) - ; - asserta('$lgt_db_lookup_cache_'(GObj, GHead, GSender, Scope, GCall, true)), - GObj = Obj, GHead = Head, GSender = Sender, - retract(GCall)) - ; - throw(error(existence_error(predicate_declaration, Head), Obj::retract(Head), Sender)))). + ; asserta('$lgt_db_lookup_cache_'(GObj, GHead, GSender, Scope, GCall, true)), + (GObj, GHead, GSender) = (Obj, Head, Sender), + retract(GCall) + ) + ; throw(error(existence_error(predicate_declaration, Head), Obj::retract(Head), Sender)) + ) + ). '$lgt_retract_fact_chk'(Obj, Head, Sender, _) :- throw(error(existence_error(object, Obj), Obj::retract(Head), Sender)). @@ -2059,34 +2047,38 @@ current_logtalk_flag(version, version(2, 27, 0)). functor(Head, HFunctor, HArity), functor(GHead, HFunctor, HArity), functor(Obj, OFunctor, OArity), functor(GObj, OFunctor, OArity), functor(Sender, SFunctor, SArity), functor(GSender, SFunctor, SArity), - ('$lgt_call'(Dcl, GHead, PScope, Type, _, _, SCtn, _) -> - (Type = (dynamic) -> - ((\+ \+ PScope = Scope; Sender = SCtn) -> - ('$lgt_call'(Def, GHead, _, _, _, GCall) -> + ( '$lgt_call'(Dcl, GHead, PScope, Type, _, _, SCtn, _) -> + ( Type == (dynamic) -> + ( (\+ \+ PScope = Scope; Sender = SCtn) -> + ( '$lgt_call'(Def, GHead, _, _, _, GCall) -> asserta('$lgt_db_lookup_cache_'(GObj, GHead, GSender, Scope, GCall, true)), - GObj = Obj, GHead = Head, GSender = Sender, + (GObj, GHead, GSender) = (Obj, Head, Sender), retractall(GCall) - ; - ('$lgt_call'(DDef, GHead, _, _, _, GCall) -> - GObj = Obj, GHead = Head, GSender = Sender, + ; ( '$lgt_call'(DDef, GHead, _, _, _, GCall) -> + (GObj, GHead, GSender) = (Obj, Head, Sender), retractall(GCall), '$lgt_update_ddef_table'(DDef, GHead, GCall) - ; - true)) - ; - (PScope = p -> + ; true + ) + ) + ; % predicate is not within the scope of the sender: + ( PScope == p -> throw(error(permission_error(modify, private_predicate, Head), Obj::retractall(Head), Sender)) - ; - throw(error(permission_error(modify, protected_predicate, Head), Obj::retractall(Head), Sender)))) - ; - throw(error(permission_error(modify, static_predicate, Head), Obj::retractall(Head), Sender))) - ; - ((GObj = GSender, '$lgt_call'(DDef, GHead, _, _, _, GCall)) -> % local dynamic predicate with no scope declaration + ; throw(error(permission_error(modify, protected_predicate, Head), Obj::retractall(Head), Sender)) + ) + ) + ; % predicate is static: + throw(error(permission_error(modify, static_predicate, Head), Obj::retractall(Head), Sender)) + ) + ; % local dynamic predicate with no scope declaration: + ( GObj = GSender, + '$lgt_call'(DDef, GHead, _, _, _, GCall) -> asserta('$lgt_db_lookup_cache_'(GObj, GHead, GSender, Scope, GCall, true)), - GObj = Obj, GHead = Head, GSender = Sender, + (GObj, GHead, GSender) = (Obj, Head, Sender), retractall(GCall) - ; - throw(error(existence_error(predicate_declaration, Head), Obj::retractall(Head), Sender)))). + ; throw(error(existence_error(predicate_declaration, Head), Obj::retractall(Head), Sender)) + ) + ). '$lgt_retractall_chk'(Obj, Head, Sender, _) :- throw(error(existence_error(object, Obj), Obj::retractall(Head), Sender)). @@ -2166,32 +2158,34 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_append'([Head| Tail], Rest, Input). '$lgt_phrase'(Obj, NonTerminal, Input, Rest, Sender, Scope) :- - '$lgt_current_object_'(Obj, Prefix, Dcl, Def, _, _) -> + ( '$lgt_current_object_'(Obj, Prefix, Dcl, Def, _, _) -> NonTerminal =.. [Functor| Args], '$lgt_append'(Args, [Input, Rest], Args2), Pred =.. [Functor| Args2], - ('$lgt_call'(Dcl, Pred, PScope, _, _, _, SCtn, _) -> - ((\+ \+ PScope = Scope; Sender = SCtn) -> + ( '$lgt_call'(Dcl, Pred, PScope, _, _, _, SCtn, _) -> + ( (\+ \+ PScope = Scope; Sender = SCtn) -> '$lgt_once'(Def, Pred, Sender, Obj, Obj, Call, _), call(Call) - ; - (PScope = p -> + ; % non-terminal is not within the scope of the sender: + ( PScope == p -> throw(error(permission_error(access, private_non_terminal, NonTerminal), Obj::phrase(NonTerminal, Input, Rest), Sender)) - ; - throw(error(permission_error(access, protected_non_terminal, NonTerminal), Obj::phrase(NonTerminal, Input, Rest), Sender)))) - ; - ((Obj = Sender, - ('$lgt_call'(Def, Pred, Obj, Obj, Obj, Call) - ; - '$lgt_call'(Prefix, _, _, _, _, _, _, DDef, _), '$lgt_call'(DDef, Pred, Obj, Obj, Obj, Call))) -> + ; throw(error(permission_error(access, protected_non_terminal, NonTerminal), Obj::phrase(NonTerminal, Input, Rest), Sender)) + ) + ) + ; % no declaration found for non-terninal: + Obj = Sender, + ( '$lgt_call'(Def, Pred, Obj, Obj, Obj, Call) + ; '$lgt_call'(Prefix, _, _, _, _, _, _, DDef, _), '$lgt_call'(DDef, Pred, Obj, Obj, Obj, Call) + ) -> call(Call) - ; - throw(error(existence_error(non_terminal_declaration, NonTerminal), Obj::phrase(NonTerminal, Input, Rest), Sender)))) - ; - (catch(current_module(Obj), _, fail) -> + ; throw(error(existence_error(non_terminal_declaration, NonTerminal), Obj::phrase(NonTerminal, Input, Rest), Sender)) + ) + ; % not a current object: + ( catch(current_module(Obj), _, fail) -> ':'(Obj, Pred) - ; - throw(error(existence_error(object, Obj), Obj::phrase(NonTerminal, Input, Rest), Sender))). + ; throw(error(existence_error(object, Obj), Obj::phrase(NonTerminal, Input, Rest), Sender)) + ) + ). @@ -2215,14 +2209,13 @@ current_logtalk_flag(version, version(2, 27, 0)). % % calls the term_expansion/2 user-defined predicate % -% if there is a scope directive, then the call fails if the sender in not within scope; +% if there is a scope directive, then the call fails if the sender is not within scope; % when there is no scope directive, then we call any local definition when the sender % and the target object are the same '$lgt_term_expansion'(Obj, Term, Expansion, Sender, Scope) :- '$lgt_current_object_'(Obj, Prefix, Dcl, Def, _, _), - ( ('$lgt_once'(Dcl, term_expansion(_, _), PScope, _, _, _, SCtn, _), - (\+ \+ PScope = Scope; Sender = SCtn)) -> + ( ('$lgt_once'(Dcl, term_expansion(_, _), PScope, _, _, _, SCtn, _), (\+ \+ PScope = Scope; Sender = SCtn)) -> '$lgt_once'(Def, term_expansion(Term, Expansion), Sender, Obj, Obj, Call, _) ; Obj = Sender, ( '$lgt_once'(Def, term_expansion(Term, Expansion), Obj, Obj, Obj, Call) -> @@ -2264,8 +2257,8 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_send_to_self_nv'(Obj, Pred, Sender) :- '$lgt_current_object_'(Obj, _, Dcl, Def, _, _), - ('$lgt_call'(Dcl, Pred, Scope, _, _, _, SCtn, _) -> - ((Scope = p(_); Sender = SCtn) -> + ( '$lgt_call'(Dcl, Pred, Scope, _, _, _, SCtn, _) -> % lookup declaration + ( (Scope = p(_); Sender = SCtn) -> % check scope functor(Pred, PFunctor, PArity), functor(GPred, PFunctor, PArity), % construct predicate template functor(Obj, OFunctor, OArity), functor(GObj, OFunctor, OArity), % construct object template functor(Sender, SFunctor, SArity), functor(GSender, SFunctor, SArity), % construct "sender" template @@ -2273,13 +2266,15 @@ current_logtalk_flag(version, version(2, 27, 0)). asserta('$lgt_self_lookup_cache_'(GObj, GPred, GSender, GCall)), % cache lookup result (GObj, GPred, GSender) = (Obj, Pred, Sender), call(GCall) - ; - throw(error(permission_error(access, private_predicate, Pred), Obj::Pred, Sender))) - ; - ('$lgt_built_in'(Pred) -> + ; % message is not within the scope of the sender: + throw(error(permission_error(access, private_predicate, Pred), Obj::Pred, Sender)) + ) + ; % no predicate declaration, check if it's a built-in predicate: + ( '$lgt_built_in'(Pred) -> call(Pred) - ; - throw(error(existence_error(predicate_declaration, Pred), Obj::Pred, Sender)))). + ; throw(error(existence_error(predicate_declaration, Pred), Obj::Pred, Sender)) + ) + ). % '$lgt_send_to_object'(@object, ?term, +object) @@ -2309,26 +2304,28 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_send_to_object_nv'(Obj, Pred, Sender) :- '$lgt_current_object_'(Obj, _, Dcl, Def, _, _), !, - ('$lgt_call'(Dcl, Pred, Scope, _, _, _, _, _) -> - (Scope = p(p(_)) -> + ( '$lgt_call'(Dcl, Pred, Scope, _, _, _, _, _) -> % lookup declaration + ( Scope = p(p(_)) -> % check scope functor(Pred, PFunctor, PArity), functor(GPred, PFunctor, PArity), % construct predicate template functor(Obj, OFunctor, OArity), functor(GObj, OFunctor, OArity), % construct object template - '$lgt_once'(Def, GPred, GSender, GObj, GObj, GCall, _), + '$lgt_once'(Def, GPred, GSender, GObj, GObj, GCall, _), % lookup definition asserta('$lgt_obj_lookup_cache_'(GObj, GPred, GSender, GCall)), % cache lookup result (GObj, GPred, GSender) = (Obj, Pred, Sender), - \+ ('$lgt_before_'(Obj, Pred, Sender, _, BCall), \+ call(BCall)), - call(GCall), - \+ ('$lgt_after_'(Obj, Pred, Sender, _, ACall), \+ call(ACall)) - ; - (Scope = p -> + \+ ('$lgt_before_'(Obj, Pred, Sender, _, BCall), \+ call(BCall)), % call before event handlers + call(GCall), % call method + \+ ('$lgt_after_'(Obj, Pred, Sender, _, ACall), \+ call(ACall)) % call after event handlers + ; % message is not within the scope of the sender: + ( Scope == p -> throw(error(permission_error(access, private_predicate, Pred), Obj::Pred, Sender)) - ; - throw(error(permission_error(access, protected_predicate, Pred), Obj::Pred, Sender)))) - ; - ('$lgt_built_in'(Pred) -> + ; throw(error(permission_error(access, protected_predicate, Pred), Obj::Pred, Sender)) + ) + ) + ; % no predicate declaration, check if it's a built-in predicate: + ( '$lgt_built_in'(Pred) -> call(Pred) - ; - throw(error(existence_error(predicate_declaration, Pred), Obj::Pred, Sender)))). + ; throw(error(existence_error(predicate_declaration, Pred), Obj::Pred, Sender)) + ) + ). '$lgt_send_to_object_nv'(Obj, Pred, _) :- catch(current_module(Obj), _, fail), @@ -2365,24 +2362,25 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_send_to_object_ne_nv'(Obj, Pred, Sender) :- '$lgt_current_object_'(Obj, _, Dcl, Def, _, _), !, - ('$lgt_call'(Dcl, Pred, Scope, _, _, _, _, _) -> - (Scope = p(p(_)) -> + ( '$lgt_call'(Dcl, Pred, Scope, _, _, _, _, _) -> % lookup declaration + ( Scope = p(p(_)) -> % check scope functor(Pred, PFunctor, PArity), functor(GPred, PFunctor, PArity), % construct predicate template functor(Obj, OFunctor, OArity), functor(GObj, OFunctor, OArity), % construct object template - '$lgt_once'(Def, GPred, GSender, GObj, GObj, GCall, _), + '$lgt_once'(Def, GPred, GSender, GObj, GObj, GCall, _), % lookup definition asserta('$lgt_obj_lookup_cache_'(GObj, GPred, GSender, GCall)), % cache lookup result (GObj, GPred, GSender) = (Obj, Pred, Sender), - call(GCall) - ; - (Scope = p -> + call(GCall) % call method + ; % message is not within the scope of the sender: + ( Scope == p -> throw(error(permission_error(access, private_predicate, Pred), Obj::Pred, Sender)) - ; - throw(error(permission_error(access, protected_predicate, Pred), Obj::Pred, Sender)))) - ; - ('$lgt_built_in'(Pred) -> + ; throw(error(permission_error(access, protected_predicate, Pred), Obj::Pred, Sender)) + ) + ) + ; % no predicate declaration, check if it's a built-in predicate: + ( '$lgt_built_in'(Pred) -> call(Pred) - ; - throw(error(existence_error(predicate_declaration, Pred), Obj::Pred, Sender)))). + ; throw(error(existence_error(predicate_declaration, Pred), Obj::Pred, Sender))) + ). '$lgt_send_to_object_ne_nv'(Obj, Pred, _) :- catch(current_module(Obj), _, fail), @@ -2416,26 +2414,27 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_current_object_'(Self, _, Dcl, _, _, _), '$lgt_call'(Dcl, Pred, Scope, _, _, _, SCtn, _), !, - ((Scope = p(_); This = SCtn) -> + ( (Scope = p(_); This = SCtn) -> % check scope '$lgt_current_object_'(This, _, _, _, Super, _), functor(Pred, PFunctor, PArity), functor(GPred, PFunctor, PArity), % construct predicate template functor(This, TFunctor, TArity), functor(GThis, TFunctor, TArity), % construct "this" template functor(Self, SFunctor, SArity), functor(GSelf, SFunctor, SArity), % construct "self" template - '$lgt_once'(Super, GPred, GSender, GThis, GSelf, GCall, Ctn), - (Ctn \= GThis -> + '$lgt_once'(Super, GPred, GSender, GThis, GSelf, GCall, Ctn), % lookup definition + ( Ctn \= GThis -> asserta('$lgt_super_lookup_cache_'(GSelf, GPred, GThis, GSender, GCall)), % cache lookup result (GSelf, GPred, GThis, GSender) = (Self, Pred, This, Sender), - call(GCall) - ; - throw(error(endless_loop(Pred), ^^Pred, This))) - ; - throw(error(permission_error(access, private_predicate, Pred), ^^Pred, This))). + call(GCall) % call inherited definition + ; throw(error(endless_loop(Pred), ^^Pred, This)) + ) + ; % message is not within the scope of the sender: + throw(error(permission_error(access, private_predicate, Pred), ^^Pred, This)) + ). '$lgt_send_to_super_nv'(_, Pred, This, _) :- - '$lgt_built_in'(Pred) -> + ( '$lgt_built_in'(Pred) -> call(Pred) - ; - throw(error(existence_error(predicate_declaration, Pred), ^^Pred, This)). + ; throw(error(existence_error(predicate_declaration, Pred), ^^Pred, This)) + ). @@ -2455,10 +2454,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_current_object_'(Obj, Prefix, _, _, _, _), '$lgt_ctx_ctx'(Ctx, Sender, Obj, Obj, Prefix, _), '$lgt_tr_body'(Pred, Call, DCall, Ctx), - (('$lgt_dbg_debugging_', '$lgt_debugging_'(Obj)) -> + ( '$lgt_dbg_debugging_', '$lgt_debugging_'(Obj) -> call(DCall) - ; - call(Call)). + ; call(Call) + ). @@ -2469,10 +2468,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_call_built_in'(Pred, Ctx) :- '$lgt_ctx_ctx'(Ctx, Sender, This, Self, _, _), '$lgt_current_object_'(This, _, _, Def, _, _), - ('$lgt_call'(Def, Pred, Sender, This, Self, Call) -> + ( '$lgt_call'(Def, Pred, Sender, This, Self, Call) -> call(Call) - ; - call(Pred)). + ; call(Pred) + ). @@ -2508,19 +2507,19 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_po_user0_'('$lgt_po_user0__dcl', '$lgt_po_user0__def', _, _, _, _, _). '$lgt_po_user0__dcl'(Pred, p(p(p)), Type, no, no) :- - (nonvar(Pred) -> + ( nonvar(Pred) -> \+ '$lgt_built_in'(Pred), functor(Pred, Functor, Arity), current_predicate(Functor/Arity) - ; - current_predicate(Functor/Arity), + ; current_predicate(Functor/Arity), \+ '$lgt_hidden_functor'(Functor), functor(Pred, Functor, Arity), - \+ '$lgt_built_in'(Pred)), - ('$lgt_predicate_property'(Pred, (dynamic)) -> + \+ '$lgt_built_in'(Pred) + ), + ( '$lgt_predicate_property'(Pred, (dynamic)) -> Type = (dynamic) - ; - Type = static). + ; Type = static + ). '$lgt_po_user0__dcl'(Pred, p(p(p)), Type, Meta, NonTerminal, user, user) :- '$lgt_po_user0__dcl'(Pred, p(p(p)), Type, Meta, NonTerminal). @@ -2626,72 +2625,70 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dbg_debug' :- - '$lgt_dbg_debugging_' -> + ( '$lgt_dbg_debugging_' -> write('Debugger is on: showing spy points for all objects compiled in debug mode.'), nl - ; - assertz('$lgt_dbg_debugging_'), + ; assertz('$lgt_dbg_debugging_'), retractall('$lgt_dbg_tracing_'), - write('Debugger switched on: showing spy points for all objects compiled in debug mode.'), nl. + write('Debugger switched on: showing spy points for all objects compiled in debug mode.'), nl + ). '$lgt_dbg_nodebug' :- - '$lgt_dbg_debugging_' -> + ( '$lgt_dbg_debugging_' -> retractall('$lgt_dbg_debugging_'), retractall('$lgt_dbg_tracing_'), write('Debugger switched off.'), nl - ; - write('Debugger is off.'), nl. + ; write('Debugger is off.'), nl + ). '$lgt_dbg_trace' :- - '$lgt_dbg_tracing_' -> + ( '$lgt_dbg_tracing_' -> write('Debugger is on: tracing everything for all objects compiled in debug mode.'), nl - ; - assertz('$lgt_dbg_tracing_'), + ; assertz('$lgt_dbg_tracing_'), retractall('$lgt_dbg_debugging_'), assertz('$lgt_dbg_debugging_'), - write('Debugger switched on: tracing everything for all objects compiled in debug mode.'), nl. + write('Debugger switched on: tracing everything for all objects compiled in debug mode.'), nl + ). '$lgt_dbg_notrace' :- - '$lgt_dbg_tracing_' -> + ( '$lgt_dbg_tracing_' -> retractall('$lgt_dbg_tracing_'), retractall('$lgt_dbg_debugging_'), write('Debugger switched off.'), nl - ; - write('Debugger is off.'), nl. + ; write('Debugger is off.'), nl + ). '$lgt_dbg_debugging' :- - ('$lgt_dbg_debugging_' -> + ( '$lgt_dbg_debugging_' -> write('Debugger is on: '), - ('$lgt_dbg_tracing_' -> + ( '$lgt_dbg_tracing_' -> write('tracing everything.'), nl - ; - write('showing spy points.'), nl) - ; - write('Debugger is off.'), nl), nl, - ('$lgt_dbg_spying_'(_, _) -> + ; write('showing spy points.'), nl + ) + ; write('Debugger is off.'), nl + ), nl, + ( '$lgt_dbg_spying_'(_, _) -> write('Defined predicate spy points (Functor/Arity):'), nl, forall( '$lgt_dbg_spying_'(Functor, Arity), (write(' '), writeq(Functor), write('/'), write(Arity), nl)) - ; - write('No predicate spy points are defined.'), nl), nl, - ('$lgt_dbg_spying_'(_, _, _, _) -> + ; write('No predicate spy points are defined.'), nl + ), nl, + ( '$lgt_dbg_spying_'(_, _, _, _) -> write('Defined context spy points (Sender, This, Self, Goal):'), nl, forall( '$lgt_dbg_spying_'(Sender, This, Self, Goal), (write(' '), '$lgt_dbg_pretty_print_spypoint'(Sender, This, Self, Goal), nl)) - ; - write('No context spy points are defined.'), nl), nl, + ; write('No context spy points are defined.'), nl + ), nl, write('Leashed ports:'), nl, write(' '), - ('$lgt_dbg_leashing_'(_) -> - forall( - '$lgt_dbg_leashing_'(Port), - (write(Port), write(' '))) - ; - write('(none)')), + ( '$lgt_dbg_leashing_'(_) -> + forall('$lgt_dbg_leashing_'(Port), (write(Port), write(' '))) + ; write('(none)') + ), nl. @@ -2701,20 +2698,28 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dbg_pretty_print_spypoint'(Sender, This, Self, Goal) :- current_output(Output), - (var(Sender) -> write('_, '); '$lgt_pretty_print_vars_quoted'(Output, Sender), write(', ')), - (var(This) -> write('_, '); '$lgt_pretty_print_vars_quoted'(Output, This), write(', ')), - (var(Self) -> write('_, '); '$lgt_pretty_print_vars_quoted'(Output, Self), write(', ')), - (var(Goal) -> write('_'); '$lgt_pretty_print_vars_quoted'(Output, Goal)). + ( var(Sender) -> write('_, ') + ; '$lgt_pretty_print_vars_quoted'(Output, Sender), write(', ') + ), + ( var(This) -> write('_, ') + ; '$lgt_pretty_print_vars_quoted'(Output, This), write(', ') + ), + ( var(Self) -> write('_, ') + ; '$lgt_pretty_print_vars_quoted'(Output, Self), write(', ') + ), + ( var(Goal) -> write('_') + ; '$lgt_pretty_print_vars_quoted'(Output, Goal) + ). '$lgt_dbg_spy'(Preds) :- nonvar(Preds), '$lgt_dbg_spy_aux'(Preds), write('Predicate spy points set.'), nl, - ('$lgt_dbg_debugging_' -> + ( '$lgt_dbg_debugging_' -> true - ; - '$lgt_dbg_debug'). + ; '$lgt_dbg_debug' + ). '$lgt_dbg_spy_aux'([]). @@ -2722,19 +2727,19 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dbg_spy_aux'([Functor/Arity| Preds]) :- nonvar(Functor), nonvar(Arity), - ('$lgt_dbg_spying_'(Functor, Arity) -> + ( '$lgt_dbg_spying_'(Functor, Arity) -> true - ; - assertz('$lgt_dbg_spying_'(Functor, Arity))), + ; assertz('$lgt_dbg_spying_'(Functor, Arity)) + ), '$lgt_dbg_spy_aux'(Preds). '$lgt_dbg_spy_aux'(Functor/Arity) :- nonvar(Functor), nonvar(Arity), - ('$lgt_dbg_spying_'(Functor, Arity) -> + ( '$lgt_dbg_spying_'(Functor, Arity) -> true - ; - assertz('$lgt_dbg_spying_'(Functor, Arity))). + ; assertz('$lgt_dbg_spying_'(Functor, Arity)) + ). '$lgt_dbg_nospy'(Preds) :- @@ -2743,10 +2748,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dbg_nospy_aux'(Preds) :- - var(Preds) -> + ( var(Preds) -> retractall('$lgt_dbg_spying_'(_, _)) - ; - '$lgt_dbg_nospy_aux2'(Preds). + ; '$lgt_dbg_nospy_aux2'(Preds) + ). '$lgt_dbg_nospy_aux2'([]). @@ -2762,10 +2767,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dbg_spy'(Sender, This, Self, Goal) :- asserta('$lgt_dbg_spying_'(Sender, This, Self, Goal)), write('Context spy point set.'), nl, - ('$lgt_dbg_debugging_' -> + ( '$lgt_dbg_debugging_' -> true - ; - '$lgt_dbg_debug'). + ; '$lgt_dbg_debug' + ). '$lgt_dbg_nospy'(Sender, This, Self, Goal) :- @@ -2805,7 +2810,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dbg_valid_leash_value'(Shorthand, Ports) :- atom(Shorthand), - Shorthand \= [], + Shorthand \== [], !, '$lgt_dbg_leash_shortand_ports'(Shorthand, Ports). @@ -2841,10 +2846,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dbg_leashing'(Port, Goal, Ctx, Code) :- '$lgt_dbg_leashing_'(Port), - ('$lgt_dbg_tracing_' -> + ( '$lgt_dbg_tracing_' -> Code = ' ' - ; - '$lgt_dbg_spying'(Port, Goal, Ctx, Code)). + ; '$lgt_dbg_spying'(Port, Goal, Ctx, Code) + ). '$lgt_dbg_spying'(_, Goal, _, '+') :- @@ -2882,12 +2887,12 @@ current_logtalk_flag(version, version(2, 27, 0)). \+ '$lgt_dbg_skipping_', !, ( '$lgt_dbg_port'(call, Goal, _, Ctx, CAction), - (CAction = skip -> + ( CAction = skip -> retractall('$lgt_dbg_skipping_'), assertz('$lgt_dbg_skipping_'), CAction2 = true - ; - CAction2 = CAction), + ; CAction2 = CAction + ), call(CAction2), catch( call(TGoal), @@ -2896,11 +2901,10 @@ current_logtalk_flag(version, version(2, 27, 0)). (TAction = fail -> fail; throw(Error)))), ( '$lgt_dbg_port'(exit, Goal, _, Ctx, EAction), call(EAction) - ; - '$lgt_dbg_port'(redo, Goal, _, Ctx, RAction), + ; '$lgt_dbg_port'(redo, Goal, _, Ctx, RAction), (RAction = skip -> - retractall('$lgt_dbg_skipping_'), - assertz('$lgt_dbg_skipping_')), + retractall('$lgt_dbg_skipping_'), + assertz('$lgt_dbg_skipping_')), fail ) ; @@ -2919,20 +2923,19 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dbg_port'(Port, Goal, Error, Ctx, Action) :- '$lgt_dbg_debugging_', !, - ('$lgt_dbg_leashing'(Port, Goal, Ctx, Code) -> + ( '$lgt_dbg_leashing'(Port, Goal, Ctx, Code) -> repeat, write(Code), '$lgt_dbg_write_port_name'(Port), writeq(Goal), write(' ? '), catch('$lgt_read_single_char'(Option), _, fail), '$lgt_dbg_valid_port_option'(Option, Port, Code), + !, '$lgt_dbg_do_port_option'(Option, Goal, Error, Ctx, Action) - ; - ('$lgt_dbg_tracing_' -> + ; ( '$lgt_dbg_tracing_' -> write(' '), '$lgt_dbg_write_port_name'(Port), writeq(Goal), nl - ; - true), + ; true + ), Action = true - ), - !. + ). '$lgt_dbg_port'(_, _, _, _, true). @@ -2991,18 +2994,18 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dbg_debugging'. '$lgt_dbg_do_port_option'(+, Goal, _, _, _) :- - (Goal = (_ :: Pred) -> + ( Goal = (_ :: Pred) -> functor(Pred, Functor, Arity) - ; - functor(Goal, Functor, Arity)), + ; functor(Goal, Functor, Arity) + ), '$lgt_dbg_spy'(Functor/Arity), fail. '$lgt_dbg_do_port_option'(-, Goal, _, _, true) :- - (Goal = (_ :: Pred) -> + ( Goal = (_ :: Pred) -> functor(Pred, Functor, Arity) - ; - functor(Goal, Functor, Arity)), + ; functor(Goal, Functor, Arity) + ), '$lgt_dbg_nospy'(Functor/Arity). '$lgt_dbg_do_port_option'(*, Goal, _, _, true) :- @@ -3016,14 +3019,14 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dbg_do_port_option'(@, _, _, _, _) :- write(' ?- '), read(Goal), - once((Goal; true)), + Goal -> fail. '$lgt_dbg_do_port_option'(b, _, _, _, _) :- - ('$lgt_compiler_flag'(supports_break_predicate, true) -> + ( '$lgt_compiler_flag'(supports_break_predicate, true) -> break - ; - write(' break no supportd on this Prolog compiler.'), nl), + ; write(' break no supportd on this Prolog compiler.'), nl + ), fail. '$lgt_dbg_do_port_option'(a, _, _, _, _) :- @@ -3078,16 +3081,22 @@ current_logtalk_flag(version, version(2, 27, 0)). +% '$lgt_load_files'(@source_file_name) % '$lgt_load_files'(@source_file_name_list) % -% compiles to disk and then loads to memory a list of source files +% compiles to disk and then loads to memory a source file or a list of source files -'$lgt_load_files'([]). +'$lgt_load_files'([]) :- + !. '$lgt_load_files'([File| Files]) :- + !, '$lgt_load_file'(File), '$lgt_load_files'(Files). +'$lgt_load_files'(File) :- + '$lgt_load_file'(File). + % '$lgt_load_file'(@source_file_name) @@ -3139,9 +3148,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_current_object_'(Entity, Prefix, _, _, _, _), '$lgt_call'(Prefix, _, _, _, _, _, DDcl, DDef, _), DDefClause =.. [DDef, _, _, _, _, DDefHead], - forall( - retract(DDefClause), - retractall(DDefHead)), + forall(retract(DDefClause), retractall(DDefHead)), DDclClause =.. [DDcl, _, _], retractall(DDclClause). @@ -3156,12 +3163,12 @@ current_logtalk_flag(version, version(2, 27, 0)). % prints a warning for redefined entities '$lgt_report_redefined_entity'(Type, Entity) :- - '$lgt_compiler_flag'(report, on) -> + ( '$lgt_compiler_flag'(report, on) -> '$lgt_inc_load_warnings_counter', write(' WARNING! redefining '), write(Type), write(' '), current_output(Output), '$lgt_pretty_print_vars_quoted'(Output, Entity), nl - ; - true. + ; true + ). @@ -3170,16 +3177,16 @@ current_logtalk_flag(version, version(2, 27, 0)). % prints a message that an entity is being compiled '$lgt_report_compiling_entity'(Type, Entity) :- - '$lgt_reset_entity_warnings_flag', - ('$lgt_compiler_flag'(report, on) -> + retractall('$lgt_pp_entity_warnings_flag_'), + ( '$lgt_compiler_flag'(report, on) -> write('compiling '), write(Type), write(' '), current_output(Output), '$lgt_pretty_print_vars_quoted'(Output, Entity), - ('$lgt_compiler_flag'(debug, on) -> + ( '$lgt_compiler_flag'(debug, on) -> write(' in debug mode... ') - ; - write('... ')) - ; - true). + ; write('... ') + ) + ; true + ). @@ -3188,11 +3195,14 @@ current_logtalk_flag(version, version(2, 27, 0)). % prints a message that an entity is finished compiling '$lgt_report_compiled_entity'(_, _) :- - '$lgt_compiler_flag'(report, on) -> - ('$lgt_entity_warnings_flag' -> nl; true), + ( '$lgt_compiler_flag'(report, on) -> + ( '$lgt_pp_entity_warnings_flag_' -> + nl + ; true + ), write('compiled'), nl - ; - true. + ; true + ). @@ -3201,10 +3211,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % prints a message that an entity finished loading '$lgt_report_loaded_entity'(Entity) :- - '$lgt_compiler_flag'(report, on) -> + ( '$lgt_compiler_flag'(report, on) -> write('< '), writeq(Entity), write(' loaded'), nl - ; - true. + ; true + ). @@ -3213,10 +3223,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % prints the working directory being used for compiling/loading source files '$lgt_report_working_directory'(Directory) :- - '$lgt_compiler_flag'(report, on) -> + ( '$lgt_compiler_flag'(report, on) -> nl, write('+++ working on directory '), write(Directory), nl - ; - true. + ; true + ). @@ -3225,15 +3235,15 @@ current_logtalk_flag(version, version(2, 27, 0)). % prints a message that an entity is being compiled '$lgt_report_compiling_file'(File) :- - '$lgt_compiler_flag'(report, on) -> + ( '$lgt_compiler_flag'(report, on) -> write('>>> compiling source file '), writeq(File), - ('$lgt_compiler_flag'(debug, on) -> + ( '$lgt_compiler_flag'(debug, on) -> write(' in debug mode...') - ; - write('...')), + ; write('...') + ), nl - ; - true. + ; true + ). @@ -3242,10 +3252,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % prints a message that an entity is up-to-date '$lgt_report_up_to_date_file'(File) :- - '$lgt_compiler_flag'(report, on) -> + ( '$lgt_compiler_flag'(report, on) -> write('>>> compiling source file '), writeq(File), write('... up-to-date'), nl - ; - true. + ; true + ). @@ -3254,10 +3264,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % prints a message that a source file is finished compiling '$lgt_report_compiled_file'(File) :- - '$lgt_compiler_flag'(report, on) -> + ( '$lgt_compiler_flag'(report, on) -> write('>>> '), writeq(File), write(' source file compiled'), nl - ; - true. + ; true + ). @@ -3266,10 +3276,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % prints a message that an entity is being compiled '$lgt_report_loading_file'(File) :- - '$lgt_compiler_flag'(report, on) -> + ( '$lgt_compiler_flag'(report, on) -> write('<<< loading source file '), writeq(File), write('... '), nl - ; - true. + ; true + ). @@ -3278,23 +3288,29 @@ current_logtalk_flag(version, version(2, 27, 0)). % prints a message that a source file finished loading '$lgt_report_loaded_file'(File) :- - '$lgt_compiler_flag'(report, on) -> + ( '$lgt_compiler_flag'(report, on) -> write('<<< '), writeq(File), write(' source file loaded'), nl - ; - true. + ; true + ). +% '$lgt_compile_files'(@source_file_name) % '$lgt_compile_files'(@source_file_name_list) % -% compiles to disk a list of source files +% compiles to disk a source file or a list of source files -'$lgt_compile_files'([]). +'$lgt_compile_files'([]) :- + !. '$lgt_compile_files'([File| Files]) :- + !, '$lgt_compile_file'(File), '$lgt_compile_files'(Files). +'$lgt_compile_files'(File) :- + '$lgt_compile_file'(File). + % '$lgt_compile_file'(@source_file_name) @@ -3337,10 +3353,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_needs_recompilation'(File) :- '$lgt_file_name'(logtalk, File, Source), '$lgt_file_name'(prolog, File, Object), - ('$lgt_compare_file_mtimes'(Result, Source, Object) -> - Result = (>) - ; - true). + ( '$lgt_compare_file_mtimes'(Result, Source, Object) -> + Result == (>) + ; true + ). @@ -3349,10 +3365,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % writes to disk the entity compiled code '$lgt_write_tr_entity'(Stream) :- - catch(( - '$lgt_write_directives'(Stream), - '$lgt_write_prolog_clauses'(Stream), - '$lgt_write_logtalk_clauses'(Stream)), + catch( + ('$lgt_write_directives'(Stream), + '$lgt_write_prolog_clauses'(Stream), + '$lgt_write_logtalk_clauses'(Stream)), Error, '$lgt_compiler_error_handler'(Stream, Error)). @@ -3363,19 +3379,19 @@ current_logtalk_flag(version, version(2, 27, 0)). % writes to disk the entity documentation in XML format '$lgt_write_entity_doc'(Entity) :- - '$lgt_compiler_flag'(xmldocs, on) -> + ( '$lgt_compiler_flag'(xmldocs, on) -> '$lgt_entity_doc_file_name'(Entity, File), - catch(( - ('$lgt_pp_directive_'(encoding(Encoding)) -> + catch( + (( '$lgt_pp_directive_'(encoding(Encoding)) -> open(File, write, Stream, [encoding(Encoding)]) - ; - open(File, write, Stream)), + ; open(File, write, Stream) + ), '$lgt_write_xml_file'(Stream), close(Stream)), Error, '$lgt_compiler_error_handler'(Stream, Error)) - ; - true. + ; true + ). @@ -3400,13 +3416,12 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_file_name'(Type, Basename, File) :- '$lgt_file_extension'(Type, Extension), % defined on the Prolog config files - (('$lgt_compiler_flag'(altdirs, on), '$lgt_alt_directory'(Type, Directory)) -> + ( '$lgt_compiler_flag'(altdirs, on), '$lgt_alt_directory'(Type, Directory) -> '$lgt_make_directory'(Directory), % succeeds when the directory already exists atom_concat(Basename, Extension, Aux), atom_concat(Directory, Aux, File) % file on an alternative compilation directory - ; - atom_concat(Basename, Extension, File)). % file local to current working directory - + ; atom_concat(Basename, Extension, File) % file local to current working directory + ). % '$lgt_tr_file'(+atom) @@ -3451,10 +3466,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_check_for_encoding_directive'((:- encoding(Encoding)), Input, [encoding(Encoding)]) :- !, - ('$lgt_compiler_flag'(supports_encoding_dir, true) -> + ( '$lgt_compiler_flag'(supports_encoding_dir, true) -> '$lgt_set_stream_encoding'(Input, Encoding) - ; - throw(error(domain_error(directive, encoding/1), directive(encoding(Encoding))))). + ; throw(error(domain_error(directive, encoding/1), directive(encoding(Encoding)))) + ). '$lgt_check_for_encoding_directive'(_, _, []). % assume no encoding/1 directive present on the source file @@ -3506,18 +3521,25 @@ current_logtalk_flag(version, version(2, 27, 0)). !. % cut needed to prevent problems with compilers with broken read_term/3 '$lgt_report_singletons_aux'([Name| Names], Term) :- - ('$lgt_compiler_flag'(singletons, warning), '$lgt_compiler_flag'(report, on)) -> + ( '$lgt_compiler_flag'(singletons, warning), + '$lgt_compiler_flag'(report, on) -> '$lgt_inc_compile_warnings_counter', - ('$lgt_pp_entity'(_, _, _, _, _) -> nl; true), - (Names = [] -> + ( '$lgt_pp_entity'(_, _, _, _, _) -> + nl + ; true + ), + ( Names == [] -> write(' WARNING! singleton variable (') - ; - write(' WARNING! singleton variables (')), + ; write(' WARNING! singleton variables (') + ), '$lgt_write_list'([Name| Names]), 'lgt_report_singletons_term'(Term), - ('$lgt_pp_entity'(_, _, _, _, _) -> true; nl) - ; - true. + ( '$lgt_pp_entity'(_, _, _, _, _) -> + true + ; nl + ) + ; true + ). 'lgt_report_singletons_term'((:- Term)) :- @@ -3568,20 +3590,20 @@ current_logtalk_flag(version, version(2, 27, 0)). % the corresponding compiler flag sets their interpretation to don't care variables '$lgt_filter_dont_care_vars'(List, Result) :- - '$lgt_compiler_flag'(underscore_vars, dont_care) -> + ( '$lgt_compiler_flag'(underscore_vars, dont_care) -> '$lgt_filter_dont_care_vars'(List, [], Result) - ; - List = Result. + ; List = Result + ). '$lgt_filter_dont_care_vars'([], Result, Result) :- !. % cut needed to prevent problems with compilers with broken read_term/3 '$lgt_filter_dont_care_vars'([Atom = Var| List], Sofar, Result) :- - atom_concat('_', _, Atom) -> + ( atom_concat('_', _, Atom) -> '$lgt_filter_dont_care_vars'(List, Sofar, Result) - ; - '$lgt_filter_dont_care_vars'(List, [Atom = Var| Sofar], Result). + ; '$lgt_filter_dont_care_vars'(List, [Atom = Var| Sofar], Result) + ). @@ -3661,6 +3683,7 @@ current_logtalk_flag(version, version(2, 27, 0)). % clean up all dynamic predicates used during source file compilation +% (except any user-defined compiler options specified on the compiling and loading predicates) '$lgt_clean_pp_clauses' :- '$lgt_clean_pp_entity_clauses', @@ -3880,18 +3903,15 @@ current_logtalk_flag(version, version(2, 27, 0)). % translates a source file term (clauses, directives, and grammar rules) '$lgt_tr_term'(Term, Stream) :- - '$lgt_hook_goal'(Term, Terms) -> + ( % source-file specific compiler hook: + '$lgt_pp_hook_goal_'(Term, Terms) -> '$lgt_tr_expanded_terms'(Terms, Stream) - ; - '$lgt_tr_expanded_term'(Term, Stream). - - - -'$lgt_hook_goal'(Term, Terms) :- - '$lgt_pp_compiler_flag_'(hook, _) -> - '$lgt_pp_hook_goal_'(Term, Terms) - ; - '$lgt_hook_goal_'(Term, Terms). + ; % default compiler hook: + '$lgt_hook_goal_'(Term, Terms) -> + '$lgt_tr_expanded_terms'(Terms, Stream) + ; % no compiler hook defined: + '$lgt_tr_expanded_term'(Term, Stream) + ). @@ -3975,27 +3995,27 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_directive'(Dir, _) :- '$lgt_ignore_pl_directive'(Dir), % defined in the Prolog config files !, - ('$lgt_compiler_flag'(portability, warning) -> + ( '$lgt_compiler_flag'(portability, warning) -> nl, write(' WARNING! ignoring Prolog directive: '), writeq(Dir) - ; - true). + ; true + ). '$lgt_tr_directive'(Dir, _) :- '$lgt_copy_pl_directive'(Dir), % defined in the Prolog config files assertz('$lgt_pp_directive_'(Dir)), !, - ('$lgt_compiler_flag'(portability, warning) -> + ( '$lgt_compiler_flag'(portability, warning) -> nl, write(' WARNING! copying Prolog directive as-is: '), writeq(Dir) - ; - true). + ; true + ). '$lgt_tr_directive'(Dir, Stream) :- '$lgt_rewrite_pl_directive'(Dir, RWDir), % defined in the Prolog config files !, - ('$lgt_compiler_flag'(portability, warning) -> + ( '$lgt_compiler_flag'(portability, warning) -> nl, write(' WARNING! rewriting Prolog directive: '), writeq(Dir) - ; - true), + ; true + ), '$lgt_tr_directive'(RWDir, Stream). % try to translate the rewritten directive '$lgt_tr_directive'(Dir, _) :- @@ -4008,25 +4028,25 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_file_directive'(op(Pr, Spec, Ops)) :- % op/3 directives must be used during entity compilation !, - ('$lgt_valid_op_priority'(Pr) -> - ('$lgt_valid_op_specifier'(Spec) -> - ('$lgt_valid_op_names'(Ops) -> + ( '$lgt_valid_op_priority'(Pr) -> + ( '$lgt_valid_op_specifier'(Spec) -> + ( '$lgt_valid_op_names'(Ops) -> assertz('$lgt_pp_directive_'(op(Pr, Spec, Ops))), assertz('$lgt_pp_file_op_'(op(Pr, Spec, Ops))), op(Pr, Spec, Ops) - ; - throw(type_error(operator_name, Ops))) - ; - throw(type_error(operator_specifier, Spec))) - ; - throw(type_error(operator_priority, Pr))). + ; throw(type_error(operator_name, Ops)) + ) + ; throw(type_error(operator_specifier, Spec)) + ) + ; throw(type_error(operator_priority, Pr)) + ). '$lgt_tr_file_directive'(initialization(Goal)) :- !, - (callable(Goal) -> + ( callable(Goal) -> assertz('$lgt_pp_file_init_'(Goal)) - ; - throw(type_error(callable, Goal))). + ; throw(type_error(callable, Goal)) + ). '$lgt_tr_file_directive'(Dir) :- assertz('$lgt_pp_directive_'(Dir)). % directive will be copied to the generated Prolog file @@ -4047,16 +4067,16 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_directive'(object, [Obj| Rels], _) :- '$lgt_report_compiling_entity'(object, Obj), - '$lgt_tr_object_id'(Obj, static), % assume static category + '$lgt_tr_object_id'(Obj, static), % assume static category '$lgt_tr_object_relations'(Rels, Obj), '$lgt_save_file_op_table'. '$lgt_tr_directive'(end_object, [], Stream) :- - '$lgt_pp_object_'(Obj, _, _, _, _, _, _, _, _, _, _) -> + ( '$lgt_pp_object_'(Obj, _, _, _, _, _, _, _, _, _, _) -> '$lgt_tr_entity'(object, Obj, Stream), '$lgt_report_compiled_entity'(object, Obj) - ; - throw(closing_directive_mismatch). + ; throw(closing_directive_mismatch) + ). '$lgt_tr_directive'(protocol, [Ptc| _], _) :- var(Ptc), @@ -4068,7 +4088,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_directive'(protocol, [Ptc| Rels], _) :- '$lgt_report_compiling_entity'(protocol, Ptc), - '$lgt_tr_protocol_id'(Ptc, static), % assume static category + '$lgt_tr_protocol_id'(Ptc, static), % assume static category '$lgt_tr_protocol_relations'(Rels, Ptc), '$lgt_save_file_op_table'. @@ -4090,23 +4110,23 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_directive'(category, [Ctg| Rels], _) :- '$lgt_report_compiling_entity'(category, Ctg), - '$lgt_tr_category_id'(Ctg, static), % assume static category + '$lgt_tr_category_id'(Ctg, static), % assume static category '$lgt_tr_category_relations'(Rels, Ctg), '$lgt_save_file_op_table'. '$lgt_tr_directive'(end_category, [], Stream) :- - '$lgt_pp_category_'(Ctg, _, _, _, _, _) -> + ( '$lgt_pp_category_'(Ctg, _, _, _, _, _) -> '$lgt_tr_entity'(category, Ctg, Stream), '$lgt_report_compiled_entity'(category, Ctg) - ; - throw(closing_directive_mismatch). + ; throw(closing_directive_mismatch) + ). % compile modules as objects '$lgt_tr_directive'(module, [Module], Stream) :- !, - '$lgt_tr_directive'(module, [Module, []], Stream). % empty export list + '$lgt_tr_directive'(module, [Module, []], Stream). % empty export list '$lgt_tr_directive'(module, [Module, ExportList], _) :- (var(Module); var(ExportList)), @@ -4200,7 +4220,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_directive'(use_module, [Module, Preds], Stream) :- % module directive - (atom(Module) -> Name = Module; arg(1, Module, Name)), + ( atom(Module) -> + Name = Module + ; arg(1, Module, Name) + ), '$lgt_tr_directive'(uses, [Name, Preds], Stream). @@ -4211,21 +4234,21 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_directive'(info, [List], _) :- !, - ('$lgt_tr_entity_info_list'(List) -> + ( '$lgt_valid_entity_info_list'(List) -> assertz('$lgt_pp_info_'(List)) - ; - throw(type_error(entity_info_list, List))). + ; throw(type_error(entity_info_list, List)) + ). '$lgt_tr_directive'(info, [Pred, List], _) :- - nonvar(Pred) -> - ('$lgt_valid_pred_or_gr_ind'(Pred, Functor, Arity) -> + ( nonvar(Pred) -> + ( '$lgt_valid_pred_or_gr_ind'(Pred, Functor, Arity) -> '$lgt_tr_pred_info_list'(List, Functor, Arity), assertz('$lgt_pp_info_'(Pred, List)) - ; - throw(type_error(predicate_indicator, Pred))) - ; - throw(instantiation_error). + ; throw(type_error(predicate_indicator, Pred)) + ) + ; throw(instantiation_error) + ). '$lgt_tr_directive'((public), Preds, _) :- @@ -4318,12 +4341,13 @@ current_logtalk_flag(version, version(2, 27, 0)). throw(domain_error(indicator_mismatch, Functor1//Arity1, Functor2/Arity2)). '$lgt_tr_directive'(alias, [Entity, PI1, PI2], _) :- - ('$lgt_pp_extended_protocol_'(Entity, _, _, _); - '$lgt_pp_implemented_protocol_'(Entity, _, _, _); - '$lgt_pp_imported_category_'(Entity, _, _, _, _); - '$lgt_pp_extended_object_'(Entity, _, _, _, _, _, _, _, _, _); - '$lgt_pp_instantiated_class_'(Entity, _, _, _, _, _, _, _, _, _); - '$lgt_pp_specialized_class_'(Entity, _, _, _, _, _, _, _, _, _)), + ( '$lgt_pp_extended_protocol_'(Entity, _, _, _) + ; '$lgt_pp_implemented_protocol_'(Entity, _, _, _) + ; '$lgt_pp_imported_category_'(Entity, _, _, _, _) + ; '$lgt_pp_extended_object_'(Entity, _, _, _, _, _, _, _, _, _) + ; '$lgt_pp_instantiated_class_'(Entity, _, _, _, _, _, _, _, _, _) + ; '$lgt_pp_specialized_class_'(Entity, _, _, _, _, _, _, _, _, _) + ), !, '$lgt_tr_alias_directive'(Entity, PI1, PI2). @@ -4502,36 +4526,36 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_uses_preds'([], _). '$lgt_tr_uses_preds'([Pred| Preds], Obj) :- - (nonvar(Pred) -> + ( nonvar(Pred) -> true - ; - throw(instantiation_error)), - (Pred = (Original::Alias) -> + ; throw(instantiation_error) + ), + ( Pred = (Original::Alias) -> true - ; - (Original, Alias) = (Pred, Pred)), - ((nonvar(Original), nonvar(Alias)) -> + ; (Original, Alias) = (Pred, Pred) + ), + ( (nonvar(Original), nonvar(Alias)) -> true - ; - throw(instantiation_error)), - ('$lgt_valid_pred_ind'(Original, OFunctor, OArity) -> + ; throw(instantiation_error) + ), + ( '$lgt_valid_pred_ind'(Original, OFunctor, OArity) -> functor(TOriginal, OFunctor, OArity) - ; - throw(type_error(predicate_indicator, Original))), - ('$lgt_valid_pred_ind'(Alias, AFunctor, AArity) -> + ; throw(type_error(predicate_indicator, Original)) + ), + ( '$lgt_valid_pred_ind'(Alias, AFunctor, AArity) -> functor(TAlias, AFunctor, AArity) - ; - throw(type_error(predicate_indicator, Alias))), - (OArity =:= AArity -> + ; throw(type_error(predicate_indicator, Alias)) + ), + ( OArity =:= AArity -> true - ; - throw(domain_error(arity_mismatch(Original, Alias)))), - (\+ '$lgt_pp_uses_'(_, _, TAlias) -> + ; throw(domain_error(arity_mismatch(Original, Alias))) + ), + ( \+ '$lgt_pp_uses_'(_, _, TAlias) -> TOriginal =.. [_| Args], TAlias =.. [_| Args], % unify args of TOriginal and TAlias assertz('$lgt_pp_uses_'(Obj, TOriginal, TAlias)) - ; - functor(TAlias, Functor, Arity), - throw(permission_error(modify, uses_object_predicate, Functor/Arity))), + ; functor(TAlias, Functor, Arity), + throw(permission_error(modify, uses_object_predicate, Functor/Arity)) + ), '$lgt_tr_uses_preds'(Preds, Obj). @@ -4542,10 +4566,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_convert_module_meta_predicate_args'([], []). '$lgt_convert_module_meta_predicate_args'([Pred| Preds], [Pred2| Preds2]) :- - (nonvar(Pred) -> + ( nonvar(Pred) -> true - ; - throw(instantiation_error)), + ; throw(instantiation_error) + ), Pred =.. [Functor| Args], '$lgt_convert_meta_predicate_mode_spec'(Args, Args2), Pred2 =.. [Functor| Args2], @@ -4555,7 +4579,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_convert_meta_predicate_mode_spec'([], []). '$lgt_convert_meta_predicate_mode_spec'([Arg| Args], [Arg2| Args2]) :- - (Arg == (:) -> Arg2 = (::); Arg2 = (*)), + ( Arg == (:) -> Arg2 = (::) + ; Arg == (::) -> Arg2 = (::) % just to be safe... + ; Arg2 = (*) + ), '$lgt_convert_meta_predicate_mode_spec'(Args, Args2). @@ -4566,19 +4593,16 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_object_relations'([], _). -'$lgt_tr_object_relations'([Clause| _], _) :- - var(Clause), - throw(instantiation_error). - -'$lgt_tr_object_relations'([Clause| Clauses], Obj) :- - Clause =.. [Functor| Args], - '$lgt_tr_object_relation'(Functor, Args, Obj), - !, - '$lgt_tr_object_relations'(Clauses, Obj). - -'$lgt_tr_object_relations'([Clause| _], _) :- - functor(Clause, Functor, Arity), - throw(domain_error(object_relation, Functor/Arity)). +'$lgt_tr_object_relations'([Relation| Relations], Obj) :- + ( var(Relation) -> + throw(instantiation_error) + ; Relation =.. [Functor| Args], + '$lgt_tr_object_relation'(Functor, Args, Obj) -> + true + ; functor(Relation, Functor, Arity), + throw(domain_error(object_relation, Functor/Arity)) + ), + '$lgt_tr_object_relations'(Relations, Obj). @@ -4614,19 +4638,16 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_protocol_relations'([], _). -'$lgt_tr_protocol_relations'([Clause| _], _) :- - var(Clause), - throw(instantiation_error). - -'$lgt_tr_protocol_relations'([Clause| Clauses], Obj) :- - Clause =.. [Functor| Args], - '$lgt_tr_protocol_relation'(Functor, Args, Obj), - !, - '$lgt_tr_protocol_relations'(Clauses, Obj). - -'$lgt_tr_protocol_relations'([Clause| _], _) :- - functor(Clause, Functor, Arity), - throw(domain_error(protocol_relation, Functor/Arity)). +'$lgt_tr_protocol_relations'([Relation| Relations], Ptc) :- + ( var(Relation) -> + throw(instantiation_error) + ; Relation =.. [Functor| Args], + '$lgt_tr_protocol_relation'(Functor, Args, Ptc) -> + true + ; functor(Relation, Functor, Arity), + throw(domain_error(protocol_relation, Functor/Arity)) + ), + '$lgt_tr_protocol_relations'(Relations, Ptc). @@ -4646,19 +4667,16 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_category_relations'([], _). -'$lgt_tr_category_relations'([Clause| _], _) :- - var(Clause), - throw(instantiation_error). - -'$lgt_tr_category_relations'([Clause| Clauses], Obj) :- - Clause =.. [Functor| Args], - '$lgt_tr_category_relation'(Functor, Args, Obj), - !, - '$lgt_tr_category_relations'(Clauses, Obj). - -'$lgt_tr_category_relations'([Clause| _], _) :- - functor(Clause, Functor, Arity), - throw(domain_error(category_relation, Functor/Arity)). +'$lgt_tr_category_relations'([Relation| Relations], Ptc) :- + ( var(Relation) -> + throw(instantiation_error) + ; Relation =.. [Functor| Args], + '$lgt_tr_category_relation'(Functor, Args, Ptc) -> + true + ; functor(Relation, Functor, Arity), + throw(domain_error(category_relation, Functor/Arity)) + ), + '$lgt_tr_category_relations'(Relations, Ptc). @@ -4676,112 +4694,110 @@ current_logtalk_flag(version, version(2, 27, 0)). -% '$lgt_tr_entity_info_list'(@list) +% '$lgt_valid_entity_info_list'(@list) % % true if the argument is a list of valid key-value pairs -'$lgt_tr_entity_info_list'(List) :- +'$lgt_valid_entity_info_list'(List) :- var(List), throw(instantiation_error). -'$lgt_tr_entity_info_list'(List) :- +'$lgt_valid_entity_info_list'(List) :- \+ '$lgt_is_proper_list'(List), throw(type_error(list, List)). -'$lgt_tr_entity_info_list'([]). +'$lgt_valid_entity_info_list'([]). -'$lgt_tr_entity_info_list'([Head| _]) :- +'$lgt_valid_entity_info_list'([Head| _]) :- var(Head), throw(instantiation_error). -'$lgt_tr_entity_info_list'([Head| _]) :- +'$lgt_valid_entity_info_list'([Head| _]) :- Head \= (_ is _), throw(type_error(key_value_info_pair, Head)). -'$lgt_tr_entity_info_list'([Key is Value| _]) :- +'$lgt_valid_entity_info_list'([Key is Value| _]) :- (var(Key); var(Value)), throw(instantiation_error). -'$lgt_tr_entity_info_list'([Key is _| _]) :- +'$lgt_valid_entity_info_list'([Key is _| _]) :- \+ atom(Key), throw(type_error(atom, Key)). -'$lgt_tr_entity_info_list'([Key is Value| Tail]) :- - '$lgt_tr_entity_info_key_value'(Key, Value), - '$lgt_tr_entity_info_list'(Tail). +'$lgt_valid_entity_info_list'([Key is Value| Tail]) :- + '$lgt_valid_entity_info_key_value'(Key, Value), + '$lgt_valid_entity_info_list'(Tail). -% '$lgt_tr_entity_info_key_value'(+atom, @nonvar) +% '$lgt_valid_entity_info_key_value'(+atom, @nonvar) % % true if the argument is a valid key-value pair -'$lgt_tr_entity_info_key_value'(author, Author) :- +'$lgt_valid_entity_info_key_value'(author, Author) :- !, - (atom(Author) -> + ( atom(Author) -> true - ; - throw(type_error(atom, Author))). + ; throw(type_error(atom, Author)) + ). -'$lgt_tr_entity_info_key_value'(comment, Comment) :- +'$lgt_valid_entity_info_key_value'(comment, Comment) :- !, - (atom(Comment) -> + ( atom(Comment) -> true - ; - throw(type_error(atom, Comment))). + ; throw(type_error(atom, Comment)) + ). -'$lgt_tr_entity_info_key_value'(date, Date) :- +'$lgt_valid_entity_info_key_value'(date, Date) :- !, - (Date = Year/Month/Day -> - (integer(Year) -> - (integer(Month) -> - (integer(Day) -> + ( Date = Year/Month/Day -> + ( integer(Year) -> + ( integer(Month) -> + ( integer(Day) -> true - ; - throw(type_error(integer, Day))) - ; - throw(type_error(integer, Month))) - ; - throw(type_error(integer, Year))) - ; - throw(type_error(date, Date))). + ; throw(type_error(integer, Day)) + ) + ; throw(type_error(integer, Month)) + ) + ; throw(type_error(integer, Year)) + ) + ; throw(type_error(date, Date)) + ). -'$lgt_tr_entity_info_key_value'(parameters, Parameters) :- +'$lgt_valid_entity_info_key_value'(parameters, Parameters) :- !, - ('$lgt_is_proper_list'(Parameters) -> - (('$lgt_member'(Parameter, Parameters), \+ '$lgt_valid_entity_parameter'(Parameter)) -> + ( '$lgt_is_proper_list'(Parameters) -> + ( '$lgt_member'(Parameter, Parameters), \+ '$lgt_valid_entity_parameter'(Parameter) -> throw(type_error(parameter, Parameter)) - ; - (('$lgt_pp_object_'(Obj, _, _, _, _, _, _, _, _, _, _), - \+ \+ Obj =.. [_| Parameters]) -> + ; ( ('$lgt_pp_object_'(Obj, _, _, _, _, _, _, _, _, _, _), \+ \+ Obj =.. [_| Parameters]) -> true - ; - throw(length_error(parameters_list, Parameters)))) - ; - throw(type_error(list, Parameters))). + ; throw(length_error(parameters_list, Parameters)) + ) + ) + ; throw(type_error(list, Parameters)) + ). -'$lgt_tr_entity_info_key_value'(parnames, Parnames) :- +'$lgt_valid_entity_info_key_value'(parnames, Parnames) :- !, - ('$lgt_is_proper_list'(Parnames) -> - (('$lgt_member'(Name, Parnames), \+ atom(Name)) -> + ( '$lgt_is_proper_list'(Parnames) -> + ( '$lgt_member'(Name, Parnames), \+ atom(Name) -> throw(type_error(atom, Name)) - ; - (('$lgt_pp_object_'(Obj, _, _, _, _, _, _, _, _, _, _), - \+ \+ Obj =.. [_| Parnames]) -> + ; ( '$lgt_pp_object_'(Obj, _, _, _, _, _, _, _, _, _, _), \+ \+ Obj =.. [_| Parnames] -> true - ; - throw(length_error(parnames_list, Parnames)))) - ; - throw(type_error(list, Parnames))). + ; throw(length_error(parnames_list, Parnames)) + ) + ) + ; throw(type_error(list, Parnames)) + ). -'$lgt_tr_entity_info_key_value'(version, Version) :- +'$lgt_valid_entity_info_key_value'(version, Version) :- !, - (atomic(Version) -> + ( atomic(Version) -> true - ; - throw(type_error(atomic, Version))). + ; throw(type_error(atomic, Version)) + ). -'$lgt_tr_entity_info_key_value'(_, _). +'$lgt_valid_entity_info_key_value'(_, _). @@ -4827,76 +4843,76 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_pred_info_key_value'(allocation, Allocation, _, _) :- !, - (atom(Allocation) -> - ('$lgt_member'(Allocation, [container, descendants, instances, classes, subclasses, any]) -> + ( atom(Allocation) -> + ( '$lgt_valid_pred_allocation'(Allocation) -> true - ; - throw(domain_error(allocation, Allocation))) - ; - throw(type_error(atom, Allocation))). + ; throw(domain_error(allocation, Allocation)) + ) + ; throw(type_error(atom, Allocation)) + ). '$lgt_tr_pred_info_key_value'(arguments, Arguments, Functor, Arity) :- !, - ('$lgt_is_proper_list'(Arguments) -> - (('$lgt_member'(Argument, Arguments), \+ '$lgt_valid_pred_argument'(Argument)) -> + ( '$lgt_is_proper_list'(Arguments) -> + ( '$lgt_member'(Argument, Arguments), \+ '$lgt_valid_pred_argument'(Argument) -> throw(type_error(argument, Argument)) - ; - ((functor(Pred, Functor, Arity), Pred =.. [_| Arguments]) -> + ; ( functor(Pred, Functor, Arity), Pred =.. [_| Arguments] -> true - ; - throw(length_error(arguments_list, Arguments)))) - ; - throw(type_error(list, Arguments))). + ; throw(length_error(arguments_list, Arguments)) + ) + ) + ; throw(type_error(list, Arguments)) + ). '$lgt_tr_pred_info_key_value'(argnames, Argnames, Functor, Arity) :- !, - ('$lgt_is_proper_list'(Argnames) -> - (('$lgt_member'(Name, Argnames), \+ atom(Name)) -> + ( '$lgt_is_proper_list'(Argnames) -> + ( '$lgt_member'(Name, Argnames), \+ atom(Name) -> throw(type_error(atom, Name)) - ; - ((functor(Pred, Functor, Arity), Pred =.. [_| Argnames]) -> + ; ( functor(Pred, Functor, Arity), Pred =.. [_| Argnames] -> true - ; - throw(length_error(argnames_list, Argnames)))) - ; - throw(type_error(list, Argnames))). + ; throw(length_error(argnames_list, Argnames)) + ) + ) + ; throw(type_error(list, Argnames)) + ). '$lgt_tr_pred_info_key_value'(comment, Comment, _, _) :- !, - (atom(Comment) -> + ( atom(Comment) -> true - ; - throw(type_error(atom, Comment))). + ; throw(type_error(atom, Comment)) + ). '$lgt_tr_pred_info_key_value'(exceptions, Exceptions, _, _) :- !, - ('$lgt_is_proper_list'(Exceptions) -> - (('$lgt_member'(Exception, Exceptions), \+ '$lgt_valid_pred_exception'(Exception)) -> + ( '$lgt_is_proper_list'(Exceptions) -> + ( '$lgt_member'(Exception, Exceptions), \+ '$lgt_valid_pred_exception'(Exception) -> throw(type_error(exception, Exception)) - ; - true) - ; - throw(type_error(list, Exceptions))). + ; true + ) + ; throw(type_error(list, Exceptions)) + ). '$lgt_tr_pred_info_key_value'(examples, Examples, Functor, Arity) :- !, - ('$lgt_is_proper_list'(Examples) -> - (('$lgt_member'(Example, Examples), \+ '$lgt_valid_pred_call_example'(Example, Functor, Arity)) -> + ( '$lgt_is_proper_list'(Examples) -> + ( '$lgt_member'(Example, Examples), \+ '$lgt_valid_pred_call_example'(Example, Functor, Arity) -> throw(type_error(example, Example)) - ; - true) - ; - throw(type_error(list, Examples))). + ; true + ) + ; throw(type_error(list, Examples)) + ). '$lgt_tr_pred_info_key_value'(redefinition, Redefinition, _, _) :- !, - (atom(Redefinition) -> - ('$lgt_member'(Redefinition, [never, free, specialize, call_super_first, call_super_last]) -> + ( atom(Redefinition) -> + ( '$lgt_valid_pred_redefinition'(Redefinition) -> true - ; - throw(domain_error(redefinition, Redefinition))) - ; - throw(type_error(atom, Redefinition))). + ; throw(domain_error(redefinition, Redefinition)) + ) + ; throw(type_error(atom, Redefinition)) + ). '$lgt_tr_pred_info_key_value'(_, _, _, _). @@ -4915,25 +4931,25 @@ current_logtalk_flag(version, version(2, 27, 0)). % '$lgt_tr_clause'(+clause) '$lgt_tr_clause'(Clause) :- - \+ '$lgt_pp_entity'(_, _, _, _, _), % clause occurs before opening entity directive + \+ '$lgt_pp_entity'(_, _, _, _, _), % clause occurs before opening entity directive !, - assertz('$lgt_pp_ppclause_'(Clause)). % clause will copied unchanged to the generated Prolog file + assertz('$lgt_pp_ppclause_'(Clause)). % clause will copied unchanged to the generated Prolog file '$lgt_tr_clause'(Clause) :- '$lgt_pp_entity'(Type, Entity, Prefix, _, _), - ((Type = object, compound(Entity)) -> % if the entity is a parametric object we need - '$lgt_ctx_this'(Ctx, Entity) % "this" for inline compilation of parameter/2 - ; - true), + ( Type == object, compound(Entity) -> % if the entity is a parametric object we need + '$lgt_ctx_this'(Ctx, Entity) % "this" for inline compilation of parameter/2 + ; true + ), '$lgt_ctx_prefix'(Ctx, Prefix), catch( '$lgt_tr_clause'(Clause, TClause, DClause, Ctx), Error, throw(error(Error, clause(Clause)))), - ('$lgt_compiler_flag'(debug, on) -> + ( '$lgt_compiler_flag'(debug, on) -> assertz('$lgt_pp_eclause_'(DClause)) - ; - assertz('$lgt_pp_eclause_'(TClause))), + ; assertz('$lgt_pp_eclause_'(TClause)) + ), !. '$lgt_tr_clause'(Clause) :- @@ -4977,10 +4993,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_head'(Head, THead, Ctx), '$lgt_tr_body'(Body, TBody, DBody, Ctx), '$lgt_simplify_body'(TBody, SBody), - (SBody == true -> + ( SBody == true -> TClause = THead - ; - TClause = (THead:-SBody)). + ; TClause = (THead:-SBody) + ). '$lgt_tr_clause'(Fact, _, _, _) :- \+ callable(Fact), @@ -5071,13 +5087,13 @@ current_logtalk_flag(version, version(2, 27, 0)). Head =.. [_| Args], '$lgt_ctx_prefix'(Ctx, EPrefix), '$lgt_construct_predicate_functor'(EPrefix, Functor, Arity, PPrefix), - (('$lgt_pp_dynamic_'(Functor, Arity), - \+ '$lgt_pp_public_'(Functor, Arity), - \+ '$lgt_pp_protected_'(Functor, Arity), - \+ '$lgt_pp_private_'(Functor, Arity)) -> + ( '$lgt_pp_dynamic_'(Functor, Arity), + \+ '$lgt_pp_public_'(Functor, Arity), + \+ '$lgt_pp_protected_'(Functor, Arity), + \+ '$lgt_pp_private_'(Functor, Arity) -> '$lgt_add_ddef_clause'(Functor, Arity, PPrefix, Ctx) - ; - '$lgt_add_def_clause'(Functor, Arity, PPrefix, Ctx)), + ; '$lgt_add_def_clause'(Functor, Arity, PPrefix, Ctx) + ), '$lgt_ctx_ctx'(Ctx, Sender, This, Self, _, _), '$lgt_append'(Args, [Sender, This, Self], Args2), THead =.. [PPrefix| Args2]. @@ -5097,10 +5113,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_ctx_meta_vars'(Ctx, Metavars), '$lgt_ctx_sender'(Ctx, Sender), '$lgt_ctx_this'(Ctx, This), - ('$lgt_member_var'(Pred, Metavars) -> + ( '$lgt_member_var'(Pred, Metavars) -> TPred = '$lgt_metacall_in_object'(Sender, Pred, This) - ; - TPred = '$lgt_metacall_in_object'(This, Pred, This)). + ; TPred = '$lgt_metacall_in_object'(This, Pred, This) + ). % pre-processor bypass (call of external code) @@ -5228,85 +5244,85 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_body'(abolish(Pred), TCond, DCond, Ctx) :- !, '$lgt_ctx_this'(Ctx, This), - ('$lgt_runtime_db_pred_ind_chk'(Pred) -> + ( '$lgt_runtime_db_pred_ind_chk'(Pred) -> TCond = '$lgt_abolish'(This, Pred, This, p(_)) - ; - '$lgt_compiler_db_pred_ind_chk'(Pred), - TCond = '$lgt_abolish_chk'(This, Pred, This, p(_))), + ; '$lgt_compiler_db_pred_ind_chk'(Pred), + TCond = '$lgt_abolish_chk'(This, Pred, This, p(_)) + ), DCond = '$lgt_dbg_goal'(abolish(Pred), TCond, Ctx). '$lgt_tr_body'(asserta(Pred), TCond, DCond, Ctx) :- !, - ('$lgt_optimizable_local_db_call'(Pred, Ctx, TPred) -> + ( '$lgt_optimizable_local_db_call'(Pred, Ctx, TPred) -> TCond = asserta(TPred) - ; - '$lgt_ctx_this'(Ctx, This), - ('$lgt_runtime_db_clause_chk'(Pred) -> + ; '$lgt_ctx_this'(Ctx, This), + ( '$lgt_runtime_db_clause_chk'(Pred) -> TCond = '$lgt_asserta'(This, Pred, This, p(_), p) - ; - '$lgt_compiler_db_clause_chk'(Pred), - (Pred = (_ :- _) -> + ; '$lgt_compiler_db_clause_chk'(Pred), + ( Pred = (_ :- _) -> TCond = '$lgt_asserta_rule_chk'(This, Pred, This, p(_), p) - ; - TCond = '$lgt_asserta_fact_chk'(This, Pred, This, p(_), p)))), + ; TCond = '$lgt_asserta_fact_chk'(This, Pred, This, p(_), p) + ) + ) + ), DCond = '$lgt_dbg_goal'(asserta(Pred), TCond, Ctx). '$lgt_tr_body'(assertz(Pred), TCond, DCond, Ctx) :- !, - ('$lgt_optimizable_local_db_call'(Pred, Ctx, TPred) -> + ( '$lgt_optimizable_local_db_call'(Pred, Ctx, TPred) -> TCond = assertz(TPred) - ; - '$lgt_ctx_this'(Ctx, This), - ('$lgt_runtime_db_clause_chk'(Pred) -> + ; '$lgt_ctx_this'(Ctx, This), + ( '$lgt_runtime_db_clause_chk'(Pred) -> TCond = '$lgt_assertz'(This, Pred, This, p(_), p) - ; - '$lgt_compiler_db_clause_chk'(Pred), - (Pred = (_ :- _) -> + ; '$lgt_compiler_db_clause_chk'(Pred), + ( Pred = (_ :- _) -> TCond = '$lgt_assertz_rule_chk'(This, Pred, This, p(_), p) - ; - TCond = '$lgt_assertz_fact_chk'(This, Pred, This, p(_), p)))), + ; TCond = '$lgt_assertz_fact_chk'(This, Pred, This, p(_), p) + ) + ) + ), DCond = '$lgt_dbg_goal'(assertz(Pred), TCond, Ctx). '$lgt_tr_body'(clause(Head, Body), TCond, DCond, Ctx) :- !, - ('$lgt_optimizable_local_db_call'(Head, Ctx, THead) -> + ( '$lgt_optimizable_local_db_call'(Head, Ctx, THead) -> TCond = (clause(THead, TBody), (TBody = ('$lgt_nop'(Body), _) -> true; Body = TBody)) - ; - '$lgt_ctx_this'(Ctx, This), - ('$lgt_runtime_db_clause_chk'((Head :- Body)) -> + ; '$lgt_ctx_this'(Ctx, This), + ( '$lgt_runtime_db_clause_chk'((Head :- Body)) -> TCond = '$lgt_clause'(This, Head, Body, This, p(_)) - ; - '$lgt_compiler_db_clause_chk'((Head :- Body)), - TCond = '$lgt_clause_chk'(This, Head, Body, This, p(_)))), + ; '$lgt_compiler_db_clause_chk'((Head :- Body)), + TCond = '$lgt_clause_chk'(This, Head, Body, This, p(_)) + ) + ), DCond = '$lgt_dbg_goal'(clause(Head, Body), TCond, Ctx). '$lgt_tr_body'(retract(Pred), TCond, DCond, Ctx) :- !, - ('$lgt_optimizable_local_db_call'(Pred, Ctx, TPred) -> + ( '$lgt_optimizable_local_db_call'(Pred, Ctx, TPred) -> TCond = retract(TPred) - ; - '$lgt_ctx_this'(Ctx, This), - ('$lgt_runtime_db_clause_chk'(Pred) -> + ; '$lgt_ctx_this'(Ctx, This), + ( '$lgt_runtime_db_clause_chk'(Pred) -> TCond = '$lgt_retract'(This, Pred, This, p(_)) - ; - '$lgt_compiler_db_clause_chk'(Pred), - (Pred = (_ :- _) -> + ; '$lgt_compiler_db_clause_chk'(Pred), + ( Pred = (_ :- _) -> TCond = '$lgt_retract_rule_chk'(This, Pred, This, p(_)) - ; - TCond = '$lgt_retract_fact_chk'(This, Pred, This, p(_))))), + ; TCond = '$lgt_retract_fact_chk'(This, Pred, This, p(_)) + ) + ) + ), DCond = '$lgt_dbg_goal'(retract(Pred), TCond, Ctx). '$lgt_tr_body'(retractall(Pred), TCond, DCond, Ctx) :- !, - ('$lgt_optimizable_local_db_call'(Pred, Ctx, TPred) -> + ( '$lgt_optimizable_local_db_call'(Pred, Ctx, TPred) -> TCond = retractall(TPred) - ; - '$lgt_ctx_this'(Ctx, This), - ('$lgt_runtime_db_clause_chk'(Pred) -> + ; '$lgt_ctx_this'(Ctx, This), + ( '$lgt_runtime_db_clause_chk'(Pred) -> TCond = '$lgt_retractall'(This, Pred, This, p(_)) - ; - '$lgt_compiler_db_clause_chk'(Pred), - TCond = '$lgt_retractall_chk'(This, Pred, This, p(_)))), + ; '$lgt_compiler_db_clause_chk'(Pred), + TCond = '$lgt_retractall_chk'(This, Pred, This, p(_)) + ) + ), DCond = '$lgt_dbg_goal'(retractall(Pred), TCond, Ctx). @@ -5356,13 +5372,17 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_body'(parameter(Arg, Value), TPred, '$lgt_dbg_goal'(parameter(Arg, Temp), DPred, Ctx), Ctx) :- !, '$lgt_ctx_this'(Ctx, This), - (var(This) -> - TPred = arg(Arg, This, Value), % when using parameter/2 in categories - DPred = (TPred, Temp=Value) - ; - arg(Arg, This, Value), - TPred = true, - DPred = (Temp=Value)). + ( (var(This); var(Arg)) -> % when using parameter/2 in categories + TPred = arg(Arg, This, Value), % or when the first argument will only + DPred = (TPred, Temp=Value) % be instantiated at runtime + ; functor(This, _, Arity), + ( 1 =< Arg, Arg =< Arity -> + arg(Arg, This, Value), + TPred = true, + DPred = (Temp=Value) + ; throw(domain_error(out_of_range, Arg)) + ) + ). % term input predicates that need to be operator aware @@ -5494,12 +5514,12 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_optimizable_local_db_call'(Pred, Ctx, TPred) :- callable(Pred), functor(Pred, Functor, Arity), - Functor \= (:-), % only facts allowed + Functor \== (:-), % only facts allowed '$lgt_pp_dynamic_'(Functor, Arity), - once(( % a scope directive must be present - '$lgt_pp_public_'(Functor, Arity); - '$lgt_pp_protected_'(Functor, Arity); - '$lgt_pp_private_'(Functor, Arity))), + ( '$lgt_pp_public_'(Functor, Arity) % a scope directive must be present + ; '$lgt_pp_protected_'(Functor, Arity) + ; '$lgt_pp_private_'(Functor, Arity) + ), !, Pred =.. [Functor| Args], '$lgt_ctx_ctx'(Ctx, _, _, _, EPrefix, _), '$lgt_construct_predicate_functor'(EPrefix, Functor, Arity, PPrefix), @@ -5595,16 +5615,16 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_msg'(Pred, Obj, TPred, This) :- nonvar(Obj), - ((Obj = (_, _); Obj = (_; _)) -> + ( (Obj = (_, _); Obj = (_; _)) -> !, '$lgt_tr_msg_broadcasting'(Obj, Pred, TPred, This) % message broadcasting - ; - (\+ callable(Obj) -> + ; ( \+ callable(Obj) -> throw(type_error(object_identifier, Obj)) % invalid object identifier - ; - This \= user, % not runtime message translation + ; This \== user, % not runtime message translation assertz('$lgt_pp_referenced_object_'(Obj)), % remember object receiving message - fail)). + fail + ) + ). % translation performed at runtime @@ -5612,10 +5632,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_msg'(Pred, Obj, TPred, This) :- var(Pred), !, - ('$lgt_compiler_flag'(events, on) -> + ( '$lgt_compiler_flag'(events, on) -> TPred = '$lgt_send_to_object'(Obj, Pred, This) - ; - TPred = '$lgt_send_to_object_ne'(Obj, Pred, This)). + ; TPred = '$lgt_send_to_object_ne'(Obj, Pred, This) + ). % invalid message @@ -5708,60 +5728,60 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_msg'(abolish(Pred), Obj, TPred, This) :- !, - ('$lgt_runtime_db_pred_ind_chk'(Pred) -> + ( '$lgt_runtime_db_pred_ind_chk'(Pred) -> TPred = '$lgt_abolish'(Obj, Pred, This, p(p(p))) - ; - '$lgt_compiler_db_pred_ind_chk'(Pred), - TPred = '$lgt_abolish_chk'(Obj, Pred, This, p(p(p)))). + ; '$lgt_compiler_db_pred_ind_chk'(Pred), + TPred = '$lgt_abolish_chk'(Obj, Pred, This, p(p(p))) + ). '$lgt_tr_msg'(asserta(Pred), Obj, TPred, This) :- !, - ('$lgt_runtime_db_clause_chk'(Pred) -> - TPred = '$lgt_asserta'(Obj, Pred, This, p(p(_)), p(p(p))) - ; - '$lgt_compiler_db_clause_chk'(Pred), - (Pred = (_ :- _) -> - TPred = '$lgt_asserta_rule_chk'(Obj, Pred, This, p(p(_)), p(p(p))) - ; - TPred = '$lgt_asserta_fact_chk'(Obj, Pred, This, p(p(_)), p(p(p))))). + ( '$lgt_runtime_db_clause_chk'(Pred) -> + TPred = '$lgt_asserta'(Obj, Pred, This, p(p(_)), p(p(p))) + ; '$lgt_compiler_db_clause_chk'(Pred), + ( Pred = (_ :- _) -> + TPred = '$lgt_asserta_rule_chk'(Obj, Pred, This, p(p(_)), p(p(p))) + ; TPred = '$lgt_asserta_fact_chk'(Obj, Pred, This, p(p(_)), p(p(p))) + ) + ). '$lgt_tr_msg'(assertz(Pred), Obj, TPred, This) :- !, - ('$lgt_runtime_db_clause_chk'(Pred) -> - TPred = '$lgt_assertz'(Obj, Pred, This, p(p(_)), p(p(p))) - ; - '$lgt_compiler_db_clause_chk'(Pred), - (Pred = (_ :- _) -> - TPred = '$lgt_assertz_rule_chk'(Obj, Pred, This, p(p(_)), p(p(p))) - ; - TPred = '$lgt_assertz_fact_chk'(Obj, Pred, This, p(p(_)), p(p(p))))). + ( '$lgt_runtime_db_clause_chk'(Pred) -> + TPred = '$lgt_assertz'(Obj, Pred, This, p(p(_)), p(p(p))) + ; '$lgt_compiler_db_clause_chk'(Pred), + ( Pred = (_ :- _) -> + TPred = '$lgt_assertz_rule_chk'(Obj, Pred, This, p(p(_)), p(p(p))) + ; TPred = '$lgt_assertz_fact_chk'(Obj, Pred, This, p(p(_)), p(p(p))) + ) + ). '$lgt_tr_msg'(clause(Head, Body), Obj, TPred, This) :- !, - ('$lgt_runtime_db_clause_chk'((Head :- Body)) -> + ( '$lgt_runtime_db_clause_chk'((Head :- Body)) -> TPred = '$lgt_clause'(Obj, Head, Body, This, p(p(p))) - ; - '$lgt_compiler_db_clause_chk'((Head :- Body)), - TPred = '$lgt_clause_chk'(Obj, Head, Body, This, p(p(p)))). + ; '$lgt_compiler_db_clause_chk'((Head :- Body)), + TPred = '$lgt_clause_chk'(Obj, Head, Body, This, p(p(p))) + ). '$lgt_tr_msg'(retract(Pred), Obj, TPred, This) :- !, - ('$lgt_runtime_db_clause_chk'(Pred) -> - TPred = '$lgt_retract'(Obj, Pred, This, p(p(p))) - ; - '$lgt_compiler_db_clause_chk'(Pred), - (Pred = (_ :- _) -> - TPred = '$lgt_retract_rule_chk'(Obj, Pred, This, p(p(p))) - ; - TPred = '$lgt_retract_fact_chk'(Obj, Pred, This, p(p(p))))). + ( '$lgt_runtime_db_clause_chk'(Pred) -> + TPred = '$lgt_retract'(Obj, Pred, This, p(p(p))) + ; '$lgt_compiler_db_clause_chk'(Pred), + ( Pred = (_ :- _) -> + TPred = '$lgt_retract_rule_chk'(Obj, Pred, This, p(p(p))) + ; TPred = '$lgt_retract_fact_chk'(Obj, Pred, This, p(p(p))) + ) + ). '$lgt_tr_msg'(retractall(Pred), Obj, TPred, This) :- !, - ('$lgt_runtime_db_clause_chk'(Pred) -> + ( '$lgt_runtime_db_clause_chk'(Pred) -> TPred = '$lgt_retractall'(Obj, Pred, This, p(p(p))) - ; - '$lgt_compiler_db_clause_chk'(Pred), - TPred = '$lgt_retractall_chk'(Obj, Pred, This, p(p(p)))). + ; '$lgt_compiler_db_clause_chk'(Pred), + TPred = '$lgt_retractall_chk'(Obj, Pred, This, p(p(p))) + ). % DCG predicates @@ -5780,16 +5800,16 @@ current_logtalk_flag(version, version(2, 27, 0)). % (meta-)predicate: translation performed at runtime '$lgt_tr_msg'(Pred, Obj, TPred, This) :- - var(Obj) -> - ('$lgt_compiler_flag'(events, on) -> + ( var(Obj) -> + ( '$lgt_compiler_flag'(events, on) -> TPred = '$lgt_send_to_object'(Obj, Pred, This) - ; - TPred = '$lgt_send_to_object_ne'(Obj, Pred, This)) - ; - ('$lgt_compiler_flag'(events, on) -> + ; TPred = '$lgt_send_to_object_ne'(Obj, Pred, This) + ) + ; ( '$lgt_compiler_flag'(events, on) -> TPred = '$lgt_send_to_object_nv'(Obj, Pred, This) - ; - TPred = '$lgt_send_to_object_ne_nv'(Obj, Pred, This)). + ; TPred = '$lgt_send_to_object_ne_nv'(Obj, Pred, This) + ) + ). @@ -5895,60 +5915,60 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_self_msg'(abolish(Pred), TPred, This, Self) :- !, - ('$lgt_runtime_db_pred_ind_chk'(Pred) -> + ( '$lgt_runtime_db_pred_ind_chk'(Pred) -> TPred = '$lgt_abolish'(Self, Pred, This, p(_)) - ; - '$lgt_compiler_db_pred_ind_chk'(Pred), - TPred = '$lgt_abolish_chk'(Self, Pred, This, p(_))). + ; '$lgt_compiler_db_pred_ind_chk'(Pred), + TPred = '$lgt_abolish_chk'(Self, Pred, This, p(_)) + ). '$lgt_tr_self_msg'(asserta(Pred), TPred, This, Self) :- !, - ('$lgt_runtime_db_clause_chk'(Pred) -> + ( '$lgt_runtime_db_clause_chk'(Pred) -> TPred = '$lgt_asserta'(Self, Pred, This, p(_), p(p)) - ; - '$lgt_compiler_db_clause_chk'(Pred), - (Pred = (_ :- _) -> + ; '$lgt_compiler_db_clause_chk'(Pred), + ( Pred = (_ :- _) -> TPred = '$lgt_asserta_rule_chk'(Self, Pred, This, p(_), p(p)) - ; - TPred = '$lgt_asserta_fact_chk'(Self, Pred, This, p(_), p(p)))). + ; TPred = '$lgt_asserta_fact_chk'(Self, Pred, This, p(_), p(p)) + ) + ). '$lgt_tr_self_msg'(assertz(Pred), TPred, This, Self) :- !, - ('$lgt_runtime_db_clause_chk'(Pred) -> + ( '$lgt_runtime_db_clause_chk'(Pred) -> TPred = '$lgt_assertz'(Self, Pred, This, p(_), p(p)) - ; - '$lgt_compiler_db_clause_chk'(Pred), - (Pred = (_ :- _) -> + ; '$lgt_compiler_db_clause_chk'(Pred), + ( Pred = (_ :- _) -> TPred = '$lgt_assertz_rule_chk'(Self, Pred, This, p(_), p(p)) - ; - TPred = '$lgt_assertz_fact_chk'(Self, Pred, This, p(_), p(p)))). + ; TPred = '$lgt_assertz_fact_chk'(Self, Pred, This, p(_), p(p)) + ) + ). '$lgt_tr_self_msg'(clause(Head, Body), TPred, This, Self) :- !, - ('$lgt_runtime_db_clause_chk'((Head :- Body)) -> + ( '$lgt_runtime_db_clause_chk'((Head :- Body)) -> TPred = '$lgt_clause'(Self, Head, Body, This, p(_)) - ; - '$lgt_compiler_db_clause_chk'((Head :- Body)), - TPred = '$lgt_clause_chk'(Self, Head, Body, This, p(_))). + ; '$lgt_compiler_db_clause_chk'((Head :- Body)), + TPred = '$lgt_clause_chk'(Self, Head, Body, This, p(_)) + ). '$lgt_tr_self_msg'(retract(Pred), TPred, This, Self) :- !, - ('$lgt_runtime_db_clause_chk'(Pred) -> + ( '$lgt_runtime_db_clause_chk'(Pred) -> TPred = '$lgt_retract'(Self, Pred, This, p(_)) - ; - '$lgt_compiler_db_clause_chk'(Pred), - (Pred = (_ :- _) -> + ; '$lgt_compiler_db_clause_chk'(Pred), + ( Pred = (_ :- _) -> TPred = '$lgt_retract_rule_chk'(Self, Pred, This, p(_)) - ; - TPred = '$lgt_retract_fact_chk'(Self, Pred, This, p(_)))). + ; TPred = '$lgt_retract_fact_chk'(Self, Pred, This, p(_)) + ) + ). '$lgt_tr_self_msg'(retractall(Pred), TPred, This, Self) :- !, - ('$lgt_runtime_db_clause_chk'(Pred) -> + ( '$lgt_runtime_db_clause_chk'(Pred) -> TPred = '$lgt_retractall'(Self, Pred, This, p(_)) - ; - '$lgt_compiler_db_clause_chk'(Pred), - TPred = '$lgt_retractall_chk'(Self, Pred, This, p(_))). + ; '$lgt_compiler_db_clause_chk'(Pred), + TPred = '$lgt_retractall_chk'(Self, Pred, This, p(_)) + ). @@ -6003,10 +6023,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_tr_super_sending'(Pred, TPred, Ctx) :- '$lgt_ctx_ctx'(Ctx, Sender, This, Self, _, _), - (var(Pred) -> + ( var(Pred) -> TPred = '$lgt_send_to_super'(Self, Pred, This, Sender) - ; - TPred = '$lgt_send_to_super_nv'(Self, Pred, This, Sender)). + ; TPred = '$lgt_send_to_super_nv'(Self, Pred, This, Sender) + ). % '$lgt_pred_meta_vars'(+callable, -list) @@ -6017,12 +6037,12 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pred_meta_vars'(Pred, Metavars) :- functor(Pred, Functor, Arity), functor(Meta, Functor, Arity), - ('$lgt_pp_metapredicate_'(Meta) -> + ( '$lgt_pp_metapredicate_'(Meta) -> Pred =.. [_| Args], Meta =.. [_| MArgs], '$lgt_extract_meta_vars'(Args, MArgs, Metavars) - ; - Metavars = []). + ; Metavars = [] + ). @@ -6032,12 +6052,12 @@ current_logtalk_flag(version, version(2, 27, 0)). % in a position corresponding to a meta-argument '$lgt_pred_meta_vars'(Pred, Meta, Metavars) :- - Meta = no -> + ( Meta == no -> Metavars = [] - ; - Pred =.. [_| Args], + ; Pred =.. [_| Args], Meta =.. [_| MArgs], - '$lgt_extract_meta_vars'(Args, MArgs, Metavars). + '$lgt_extract_meta_vars'(Args, MArgs, Metavars) + ). @@ -6047,7 +6067,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_extract_meta_vars'([Var| Args], [MArg| MArgs], [Var| Metavars]) :- var(Var), - MArg = (::), + MArg == (::), !, '$lgt_extract_meta_vars'(Args, MArgs, Metavars). @@ -6224,10 +6244,11 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_save_operators'([], []). '$lgt_save_operators'([op(_, Spec, Op)| Ops], Saved) :- - ((current_op(Pr, SCSpec, Op), '$lgt_same_op_class'(Spec, SCSpec)) -> + ( current_op(Pr, SCSpec, Op), + '$lgt_same_op_class'(Spec, SCSpec) -> Saved = [op(Pr, SCSpec, Op)| Saved2] - ; - Saved = Saved2), + ; Saved = Saved2 + ), '$lgt_save_operators'(Ops, Saved2). @@ -6376,17 +6397,17 @@ current_logtalk_flag(version, version(2, 27, 0)). throw(instantiation_error). '$lgt_tr_implements_protocol'([Ref| Refs], ObjOrCtg) :- - '$lgt_valid_ref_scope'(Ref, Scope) -> - ('$lgt_valid_protocol_ref'(Ref, Ptc) -> + ( '$lgt_valid_ref_scope'(Ref, Scope) -> + ( '$lgt_valid_protocol_ref'(Ref, Ptc) -> assertz('$lgt_pp_referenced_protocol_'(Ptc)), assertz('$lgt_pp_rclause_'('$lgt_implements_protocol_'(ObjOrCtg, Ptc, Scope))), '$lgt_construct_protocol_functors'(Ptc, Prefix, Dcl, _), assertz('$lgt_pp_implemented_protocol_'(Ptc, Prefix, Dcl, Scope)), '$lgt_tr_implements_protocol'(Refs, ObjOrCtg) - ; - throw(type_error(protocol_identifier, Ptc))) - ; - throw(type_error(scope, Ref)). + ; throw(type_error(protocol_identifier, Ptc)) + ) + ; throw(type_error(scope, Ref)) + ). @@ -6407,17 +6428,17 @@ current_logtalk_flag(version, version(2, 27, 0)). throw(instantiation_error). '$lgt_tr_imports_category'([Ref| Refs], ObjOrCtg) :- - '$lgt_valid_ref_scope'(Ref, Scope) -> - ('$lgt_valid_category_ref'(Ref, Ctg) -> + ( '$lgt_valid_ref_scope'(Ref, Scope) -> + ( '$lgt_valid_category_ref'(Ref, Ctg) -> assertz('$lgt_pp_referenced_category_'(Ctg)), assertz('$lgt_pp_rclause_'('$lgt_imports_category_'(ObjOrCtg, Ctg, Scope))), '$lgt_construct_category_functors'(Ctg, Prefix, Dcl, Def, _), assertz('$lgt_pp_imported_category_'(Ctg, Prefix, Dcl, Def, Scope)), '$lgt_tr_imports_category'(Refs, ObjOrCtg) - ; - throw(type_error(category_identifier, Ctg))) - ; - throw(type_error(scope, Ref)). + ; throw(type_error(category_identifier, Ctg)) + ) + ; throw(type_error(scope, Ref)) + ). @@ -6437,17 +6458,17 @@ current_logtalk_flag(version, version(2, 27, 0)). throw(instantiation_error). '$lgt_tr_instantiates_class'([Ref| Refs], Obj) :- - '$lgt_valid_ref_scope'(Ref, Scope) -> - ('$lgt_valid_object_ref'(Ref, Class) -> + ( '$lgt_valid_ref_scope'(Ref, Scope) -> + ( '$lgt_valid_object_ref'(Ref, Class) -> assertz('$lgt_pp_referenced_object_'(Class)), assertz('$lgt_pp_rclause_'('$lgt_instantiates_class_'(Obj, Class, Scope))), '$lgt_construct_object_functors'(Class, Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, _), assertz('$lgt_pp_instantiated_class_'(Class, Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, Scope)), '$lgt_tr_instantiates_class'(Refs, Obj) - ; - throw(type_error(object_identifier, Class))) - ; - throw(type_error(scope, Ref)). + ; throw(type_error(object_identifier, Class)) + ) + ; throw(type_error(scope, Ref)) + ). @@ -6467,17 +6488,17 @@ current_logtalk_flag(version, version(2, 27, 0)). throw(instantiation_error). '$lgt_tr_specializes_class'([Ref| Refs], Class) :- - '$lgt_valid_ref_scope'(Ref, Scope) -> - ('$lgt_valid_object_ref'(Ref, Superclass) -> + ( '$lgt_valid_ref_scope'(Ref, Scope) -> + ( '$lgt_valid_object_ref'(Ref, Superclass) -> assertz('$lgt_pp_referenced_object_'(Superclass)), assertz('$lgt_pp_rclause_'('$lgt_specializes_class_'(Class, Superclass, Scope))), '$lgt_construct_object_functors'(Superclass, Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, _), assertz('$lgt_pp_specialized_class_'(Superclass, Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, Scope)), '$lgt_tr_specializes_class'(Refs, Class) - ; - throw(type_error(object_identifier, Superclass))) - ; - throw(type_error(scope, Ref)). + ; throw(type_error(object_identifier, Superclass)) + ) + ; throw(type_error(scope, Ref)) + ). @@ -6497,17 +6518,17 @@ current_logtalk_flag(version, version(2, 27, 0)). throw(instantiation_error). '$lgt_tr_extends_object'([Ref| Refs], Obj) :- - '$lgt_valid_ref_scope'(Ref, Scope) -> - ('$lgt_valid_object_ref'(Ref, Parent) -> + ( '$lgt_valid_ref_scope'(Ref, Scope) -> + ( '$lgt_valid_object_ref'(Ref, Parent) -> assertz('$lgt_pp_referenced_object_'(Parent)), assertz('$lgt_pp_rclause_'('$lgt_extends_object_'(Obj, Parent, Scope))), '$lgt_construct_object_functors'(Parent, Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, _), assertz('$lgt_pp_extended_object_'(Parent, Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, Scope)), '$lgt_tr_extends_object'(Refs, Obj) - ; - throw(type_error(object_identifier, Parent))) - ; - throw(type_error(scope, Ref)). + ; throw(type_error(object_identifier, Parent)) + ) + ; throw(type_error(scope, Ref)) + ). @@ -6527,17 +6548,17 @@ current_logtalk_flag(version, version(2, 27, 0)). throw(instantiation_error). '$lgt_tr_extends_protocol'([Ref| Refs], Ptc1) :- - '$lgt_valid_ref_scope'(Ref, Scope) -> - ('$lgt_valid_protocol_ref'(Ref, Ptc2) -> + ( '$lgt_valid_ref_scope'(Ref, Scope) -> + ( '$lgt_valid_protocol_ref'(Ref, Ptc2) -> assertz('$lgt_pp_referenced_protocol_'(Ptc2)), assertz('$lgt_pp_rclause_'('$lgt_extends_protocol_'(Ptc1, Ptc2, Scope))), '$lgt_construct_protocol_functors'(Ptc2, Prefix, Dcl, _), assertz('$lgt_pp_extended_protocol_'(Ptc2, Prefix, Dcl, Scope)), '$lgt_tr_extends_protocol'(Refs, Ptc1) - ; - throw(type_error(protocol_identifier, Ptc2))) - ; - throw(type_error(scope, Ref)). + ; throw(type_error(protocol_identifier, Ptc2)) + ) + ; throw(type_error(scope, Ref)) + ). @@ -6546,18 +6567,18 @@ current_logtalk_flag(version, version(2, 27, 0)). % reports any potential problem found while compiling an entity '$lgt_report_problems'(protocol) :- - '$lgt_compiler_flag'(report, on) -> + ( '$lgt_compiler_flag'(report, on) -> '$lgt_report_unknown_entities' - ; - true. + ; true + ). '$lgt_report_problems'(object) :- - '$lgt_compiler_flag'(report, on) -> + ( '$lgt_compiler_flag'(report, on) -> '$lgt_report_misspelt_calls', '$lgt_report_non_portable_calls', '$lgt_report_unknown_entities' - ; - true. + ; true + ). '$lgt_report_problems'(category) :- '$lgt_report_problems'(object). @@ -6569,12 +6590,12 @@ current_logtalk_flag(version, version(2, 27, 0)). % reports any unknown referenced entities found while compiling an entity '$lgt_report_unknown_entities' :- - '$lgt_compiler_flag'(unknown, warning) -> + ( '$lgt_compiler_flag'(unknown, warning) -> '$lgt_report_unknown_objects', '$lgt_report_unknown_protocols', '$lgt_report_unknown_categories' - ; - true. + ; true + ). @@ -6583,16 +6604,16 @@ current_logtalk_flag(version, version(2, 27, 0)). % report any unknown referenced objects found while compiling an entity '$lgt_report_unknown_objects' :- - setof(Obj, '$lgt_unknown_object'(Obj), Objs) -> + ( setof(Obj, '$lgt_unknown_object'(Obj), Objs) -> '$lgt_inc_compile_warnings_counter', nl, - (Objs = [_] -> + ( Objs = [_] -> write(' WARNING! reference to unknown object: ') - ; - write(' WARNING! references to unknown objects: ')), + ; write(' WARNING! references to unknown objects: ') + ), '$lgt_writeq_list'(Objs) - ; - true. + ; true + ). '$lgt_unknown_object'(Obj) :- @@ -6609,16 +6630,16 @@ current_logtalk_flag(version, version(2, 27, 0)). % report any unknown referenced protocols found while compiling an entity '$lgt_report_unknown_protocols' :- - setof(Ptc, '$lgt_unknown_protocol'(Ptc), Ptcs) -> + ( setof(Ptc, '$lgt_unknown_protocol'(Ptc), Ptcs) -> '$lgt_inc_compile_warnings_counter', nl, - (Ptcs = [_] -> + ( Ptcs = [_] -> write(' WARNING! reference to unknown protocol: ') - ; - write(' WARNING! references to unknown protocols: ')), + ; write(' WARNING! references to unknown protocols: ') + ), '$lgt_writeq_list'(Ptcs) - ; - true. + ; true + ). '$lgt_unknown_protocol'(Ptc) :- @@ -6634,16 +6655,16 @@ current_logtalk_flag(version, version(2, 27, 0)). % report any unknown referenced categories found while compiling an entity '$lgt_report_unknown_categories' :- - setof(Ctg, '$lgt_unknown_category'(Ctg), Ctgs) -> + ( setof(Ctg, '$lgt_unknown_category'(Ctg), Ctgs) -> '$lgt_inc_compile_warnings_counter', nl, - (Ctgs = [_] -> + ( Ctgs = [_] -> write(' WARNING! reference to unknown category: ') - ; - write(' WARNING! references to unknown categories: ')), + ; write(' WARNING! references to unknown categories: ') + ), '$lgt_writeq_list'(Ctgs) - ; - true. + ; true + ). '$lgt_unknown_category'(Ctg) :- @@ -6690,22 +6711,23 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_ctx_ctx'(Ctx, Sender, This, Self, _, _), '$lgt_append'(Args, [Sender, This, Self], TArgs), THead =.. [Prefix|TArgs], - once( - ('$lgt_pp_object_'(_, _, _, Def, _, _, _, _, _, _, _); - '$lgt_pp_category_'(_, _, _, Def, _, _))), + ( '$lgt_pp_object_'(_, _, _, Def, _, _, _, _, _, _, _) -> + true + ; '$lgt_pp_category_'(_, _, _, Def, _, _) + ), Clause =.. [Def, Head, Sender, This, Self, THead], - ('$lgt_pp_def_'(Clause) -> + ( '$lgt_pp_def_'(Clause) -> true - ; - assertz('$lgt_pp_def_'(Clause))), - ('$lgt_built_in'(Head) -> + ; assertz('$lgt_pp_def_'(Clause)) + ), + ( '$lgt_built_in'(Head) -> assertz('$lgt_pp_redefined_built_in_'(Head, Ctx, THead)) - ; - true), - ('$lgt_pp_defs_pred_'(Functor, Arity) -> + ; true + ), + ( '$lgt_pp_defs_pred_'(Functor, Arity) -> true - ; - assertz('$lgt_pp_defs_pred_'(Functor, Arity))). + ; assertz('$lgt_pp_defs_pred_'(Functor, Arity)) + ). @@ -6721,34 +6743,18 @@ current_logtalk_flag(version, version(2, 27, 0)). THead =.. [Prefix|TArgs], '$lgt_pp_object_'(_, _, _, _, _, _, _, _, DDef, _, _), Clause =.. [DDef, Head, Sender, This, Self, THead], - ('$lgt_pp_ddef_'(Clause) -> + ( '$lgt_pp_ddef_'(Clause) -> true - ; - assertz('$lgt_pp_ddef_'(Clause))), - ('$lgt_built_in'(Head) -> + ; assertz('$lgt_pp_ddef_'(Clause)) + ), + ( '$lgt_built_in'(Head) -> assertz('$lgt_pp_redefined_built_in_'(Head, Ctx, THead)) - ; - true), - ('$lgt_pp_defs_pred_'(Functor, Arity) -> + ; true + ), + ( '$lgt_pp_defs_pred_'(Functor, Arity) -> true - ; - assertz('$lgt_pp_defs_pred_'(Functor, Arity))). - - - -% '$lgt_assert_ddef_clause'(+atom, +integer, +atom, +atom, -callable) -% -% asserts a dynamic "ddef clause" (used to translate a predicate call) - -'$lgt_assert_ddef_clause'(Functor, Arity, OPrefix, DDef, Call) :- - '$lgt_construct_predicate_functor'(OPrefix, Functor, Arity, PPrefix), - functor(Pred, Functor, Arity), - Pred =.. [_| Args], - '$lgt_append'(Args, [Sender, This, Self], TArgs), - Call =.. [PPrefix| TArgs], - Clause =.. [DDef, Pred, Sender, This, Self, Call], - assertz(Clause), - '$lgt_clean_lookup_caches'(Pred). + ; assertz('$lgt_pp_defs_pred_'(Functor, Arity)) + ). @@ -6762,14 +6768,14 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_update_ddef_table'(DDef, Head, Call) :- functor(Call, CFunctor, CArity), functor(GCall, CFunctor, CArity), - (clause(GCall, _) -> + ( clause(GCall, _) -> true - ; - functor(Head, HFunctor, HArity), + ; functor(Head, HFunctor, HArity), functor(GHead, HFunctor, HArity), Clause =.. [DDef, GHead, _, _, _, _], retractall(Clause), - '$lgt_clean_lookup_caches'(GHead)). + '$lgt_clean_lookup_caches'(GHead) + ). @@ -6822,21 +6828,21 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_protocol_directives' :- - '$lgt_pp_protocol_'(_, Prefix, Dcl, Rnm, (dynamic)) -> + ( '$lgt_pp_protocol_'(_, Prefix, Dcl, Rnm, (dynamic)) -> assertz('$lgt_pp_directive_'(dynamic(Prefix/1))), assertz('$lgt_pp_directive_'(dynamic(Dcl/4))), assertz('$lgt_pp_directive_'(dynamic(Dcl/5))), assertz('$lgt_pp_directive_'(dynamic(Rnm/3))) - ; - true. + ; true + ). '$lgt_gen_object_dynamic_directives' :- - '$lgt_pp_object_'(_, _, _, _, _, _, _, _, _, _, (dynamic)) -> + ( '$lgt_pp_object_'(_, _, _, _, _, _, _, _, _, _, (dynamic)) -> '$lgt_gen_dynamic_object_dynamic_directives' - ; - '$lgt_gen_static_object_dynamic_directives'. + ; '$lgt_gen_static_object_dynamic_directives' + ). @@ -6873,9 +6879,9 @@ current_logtalk_flag(version, version(2, 27, 0)). assertz('$lgt_pp_directive_'(dynamic(DDcl/2))), assertz('$lgt_pp_directive_'(dynamic(DDef/5))), '$lgt_pp_dynamic_'(Functor, Arity), - '$lgt_construct_predicate_functor'(Prefix, Functor, Arity, TFunctor), - TArity is Arity + 3, - assertz('$lgt_pp_directive_'(dynamic(TFunctor/TArity))), + '$lgt_construct_predicate_functor'(Prefix, Functor, Arity, TFunctor), + TArity is Arity + 3, + assertz('$lgt_pp_directive_'(dynamic(TFunctor/TArity))), fail. '$lgt_gen_static_object_dynamic_directives'. @@ -6885,9 +6891,9 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_object_discontiguous_directives' :- '$lgt_pp_object_'(_, Prefix, _, _, _, _, _, _, _, _, _), '$lgt_pp_discontiguous_'(Functor, Arity), - '$lgt_construct_predicate_functor'(Prefix, Functor, Arity, TFunctor), - TArity is Arity + 3, - assertz('$lgt_pp_directive_'(discontiguous(TFunctor/TArity))), + '$lgt_construct_predicate_functor'(Prefix, Functor, Arity, TFunctor), + TArity is Arity + 3, + assertz('$lgt_pp_directive_'(discontiguous(TFunctor/TArity))), fail. '$lgt_gen_object_discontiguous_directives'. @@ -6895,24 +6901,24 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_category_dynamic_directives' :- - '$lgt_pp_category_'(_, Prefix, Dcl, Def, Rnm, (dynamic)) -> + ( '$lgt_pp_category_'(_, Prefix, Dcl, Def, Rnm, (dynamic)) -> assertz('$lgt_pp_directive_'(dynamic(Prefix/2))), assertz('$lgt_pp_directive_'(dynamic(Dcl/4))), assertz('$lgt_pp_directive_'(dynamic(Dcl/5))), assertz('$lgt_pp_directive_'(dynamic(Def/5))), assertz('$lgt_pp_directive_'(dynamic(Rnm/3))), '$lgt_gen_dynamic_entity_dynamic_predicate_directives' - ; - true. + ; true + ). '$lgt_gen_category_discontiguous_directives' :- '$lgt_pp_category_'(_, Prefix, _, _, _, _), '$lgt_pp_discontiguous_'(Functor, Arity), - '$lgt_construct_predicate_functor'(Prefix, Functor, Arity, TFunctor), - TArity is Arity + 3, - assertz('$lgt_pp_directive_'(discontiguous(TFunctor/TArity))), + '$lgt_construct_predicate_functor'(Prefix, Functor, Arity, TFunctor), + TArity is Arity + 3, + assertz('$lgt_pp_directive_'(discontiguous(TFunctor/TArity))), fail. '$lgt_gen_category_discontiguous_directives'. @@ -6920,96 +6926,88 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_object_clauses' :- - ('$lgt_pp_instantiated_class_'(_, _, _, _, _, _, _, _, _, _); - '$lgt_pp_specialized_class_'(_, _, _, _, _, _, _, _, _, _)) -> - '$lgt_gen_ic_clauses' - ; - '$lgt_gen_prototype_clauses'. + ( \+ '$lgt_pp_instantiated_class_'(_, _, _, _, _, _, _, _, _, _), + \+ '$lgt_pp_specialized_class_'(_, _, _, _, _, _, _, _, _, _) -> + '$lgt_gen_prototype_clauses' + ; '$lgt_gen_ic_clauses' + ). -% '$lgt_gen_local_dcl_clauses' +% '$lgt_gen_local_dcl_clauses'(-callable) % -% a (local) predicate declaration is only generated -% if there is a scope declaration for the predicate +% a (local) predicate declaration is only generated if there is a scope +% declaration for the predicate; the single argument returns the atom +% "true" if there are local declaration clauses and the atom "fail" otherwise -'$lgt_gen_local_dcl_clauses' :- +'$lgt_gen_local_dcl_clauses'(_) :- '$lgt_pp_entity'(_, _, _, Dcl, _), - (('$lgt_pp_public_'(Functor, Arity), Scope = p(p(p))); - ('$lgt_pp_protected_'(Functor, Arity), Scope = p(p)); - ('$lgt_pp_private_'(Functor, Arity), Scope = p)), + ( '$lgt_pp_public_'(Functor, Arity), Scope = p(p(p)) + ; '$lgt_pp_protected_'(Functor, Arity), Scope = p(p) + ; '$lgt_pp_private_'(Functor, Arity), Scope = p + ), functor(Pred, Functor, Arity), - ('$lgt_pp_dynamic_'(Functor, Arity)-> + ( '$lgt_pp_dynamic_'(Functor, Arity)-> Compilation = (dynamic) - ; - Compilation = static), + ; Compilation = static + ), functor(Meta, Functor, Arity), - ('$lgt_pp_metapredicate_'(Meta) -> + ( '$lgt_pp_metapredicate_'(Meta) -> Meta2 = Meta - ; - Meta2 = no), - ('$lgt_pp_non_terminal_'(Functor, _, Arity) -> + ; Meta2 = no + ), + ( '$lgt_pp_non_terminal_'(Functor, _, Arity) -> NonTerminal = yes - ; - NonTerminal = no), + ; NonTerminal = no + ), Fact =.. [Dcl, Pred, Scope, Compilation, Meta2, NonTerminal], assertz('$lgt_pp_dcl_'(Fact)), fail. -'$lgt_gen_local_dcl_clauses' :- % generate a catchall clause if needed for - \+ '$lgt_pp_dcl_'(_) -> % entities that do not contain declarations - '$lgt_pp_entity'(_, _, _, Dcl, _), - Head =.. [Dcl, _, _, _, _, _], - assertz('$lgt_pp_dcl_'((Head:-fail))) - ; - true. +'$lgt_gen_local_dcl_clauses'(Local) :- + '$lgt_pp_dcl_'(_) -> Local = true; Local = fail. -% '$lgt_gen_local_def_clauses' +% '$lgt_gen_local_def_clauses'(-callable) % % generates local def clauses for undefined but declared (via scope or -% dynamic directives) predicates +% dynamic directives) predicates; the single argument returns the atom +% "true" if there are local definition clauses and the atom "fail" otherwise -'$lgt_gen_local_def_clauses' :- +'$lgt_gen_local_def_clauses'(_) :- '$lgt_pp_entity'(_, _, EPrefix, _, _), '$lgt_pp_dynamic_'(Functor, Arity), \+ '$lgt_pp_defs_pred_'(Functor, Arity), '$lgt_construct_predicate_functor'(EPrefix, Functor, Arity, PPrefix), '$lgt_ctx_ctx'(Ctx), - ((\+ '$lgt_pp_public_'(Functor, Arity), - \+ '$lgt_pp_protected_'(Functor, Arity), - \+ '$lgt_pp_private_'(Functor, Arity)) -> + ( \+ '$lgt_pp_public_'(Functor, Arity), + \+ '$lgt_pp_protected_'(Functor, Arity), + \+ '$lgt_pp_private_'(Functor, Arity) -> '$lgt_add_ddef_clause'(Functor, Arity, PPrefix, Ctx) - ; - '$lgt_add_def_clause'(Functor, Arity, PPrefix, Ctx)), + ; '$lgt_add_def_clause'(Functor, Arity, PPrefix, Ctx) + ), fail. -'$lgt_gen_local_def_clauses'. - - - -'$lgt_gen_obj_catchall_def_clause' :- - \+ '$lgt_pp_def_'(_) -> - '$lgt_pp_object_'(_, _, _, Def, _, _, _, _, _, _, _), - Head =.. [Def, _, _, _, _, _], - assertz('$lgt_pp_def_'((Head:-fail))) - ; - true. +'$lgt_gen_local_def_clauses'(Local) :- + '$lgt_pp_def_'(_) -> Local = true; Local = fail. '$lgt_gen_protocol_clauses' :- - '$lgt_gen_local_dcl_clauses', - '$lgt_gen_protocol_linking_clauses', + '$lgt_gen_local_dcl_clauses'(Local), + '$lgt_gen_protocol_linking_clauses'(Local), '$lgt_gen_protocol_extend_clauses'. -'$lgt_gen_protocol_linking_clauses' :- +'$lgt_gen_protocol_linking_clauses'(Local) :- '$lgt_pp_protocol_'(Ptc, _, PDcl, _, _), Head =.. [PDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ptc], - Body =.. [PDcl, Pred, Scope, Compilation, Meta, NonTerminal], + ( call(Local) -> + Body =.. [PDcl, Pred, Scope, Compilation, Meta, NonTerminal] + ; Body = fail + ), assertz('$lgt_pp_dcl_'((Head:-Body))). @@ -7017,22 +7015,22 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_protocol_extend_clauses' :- '$lgt_pp_protocol_'(_, _, PDcl1, PRnm, _), '$lgt_pp_extended_protocol_'(Ptc2, _, PDcl2, EScope), - (EScope = (public) -> + ( EScope == (public) -> Lookup =.. [PDcl2, Pred, Scope, Compilation, Meta, NonTerminal, Ctn] - ; - (EScope = protected -> + ; ( EScope == protected -> Call =.. [PDcl2, Pred, Scope2, Compilation, Meta, NonTerminal, Ctn], Lookup = (Call, (Scope2 == p -> Scope = p; Scope = p(p))) - ; - Scope = p, - Lookup =.. [PDcl2, Pred, _, Compilation, Meta, NonTerminal, Ctn])), - ('$lgt_pp_alias_'(Ptc2, _, _) -> + ; Scope = p, + Lookup =.. [PDcl2, Pred, _, Compilation, Meta, NonTerminal, Ctn] + ) + ), + ( '$lgt_pp_alias_'(Ptc2, _, _) -> Head =.. [PDcl1, Alias, Scope, Compilation, Meta, NonTerminal, Ctn], Rename =.. [PRnm, Ptc2, Pred, Alias], assertz('$lgt_pp_dcl_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [PDcl1, Pred, Scope, Compilation, Meta, NonTerminal, Ctn], - assertz('$lgt_pp_dcl_'((Head:-Lookup)))), + ; Head =.. [PDcl1, Pred, Scope, Compilation, Meta, NonTerminal, Ctn], + assertz('$lgt_pp_dcl_'((Head:-Lookup))) + ), fail. '$lgt_gen_protocol_extend_clauses'. @@ -7051,17 +7049,20 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_category_dcl_clauses' :- - '$lgt_gen_local_dcl_clauses', - '$lgt_gen_category_linking_dcl_clauses', + '$lgt_gen_local_dcl_clauses'(Local), + '$lgt_gen_category_linking_dcl_clauses'(Local), '$lgt_gen_category_implements_dcl_clauses', '$lgt_gen_category_imports_dcl_clauses'. -'$lgt_gen_category_linking_dcl_clauses' :- +'$lgt_gen_category_linking_dcl_clauses'(Local) :- '$lgt_pp_category_'(Ctg, _, CDcl, _, _, _), Head =.. [CDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctg], - Body =.. [CDcl, Pred, Scope, Compilation, Meta, NonTerminal], + ( call(Local) -> + Body =.. [CDcl, Pred, Scope, Compilation, Meta, NonTerminal] + ; Body = fail + ), assertz('$lgt_pp_dcl_'((Head:-Body))). @@ -7069,22 +7070,22 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_category_implements_dcl_clauses' :- '$lgt_pp_category_'(_, _, CDcl, _, PRnm, _), '$lgt_pp_implemented_protocol_'(Ptc, _, PDcl, EScope), - (EScope = (public) -> + ( EScope == (public) -> Lookup =.. [PDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctn] - ; - (EScope = protected -> + ; ( EScope == protected -> Call =.. [PDcl, Pred, Scope2, Compilation, Meta, NonTerminal, Ctn], Lookup = (Call, (Scope2 == p -> Scope = p; Scope = p(p))) - ; - Scope = p, - Lookup =.. [PDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn])), - ('$lgt_pp_alias_'(Ptc, _, _) -> + ; Scope = p, + Lookup =.. [PDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn] + ) + ), + ( '$lgt_pp_alias_'(Ptc, _, _) -> Head =.. [CDcl, Alias, Scope, Compilation, Meta, NonTerminal, Ctn], Rename =.. [PRnm, Ptc, Pred, Alias], assertz('$lgt_pp_dcl_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [CDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctn], - assertz('$lgt_pp_dcl_'((Head:-Lookup)))), + ; Head =.. [CDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctn], + assertz('$lgt_pp_dcl_'((Head:-Lookup))) + ), fail. '$lgt_gen_category_implements_dcl_clauses'. @@ -7094,22 +7095,22 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_category_imports_dcl_clauses' :- '$lgt_pp_category_'(_, _, CDcl, _, PRnm, _), '$lgt_pp_imported_category_'(Ctg, _, ECDcl, _, EScope), - (EScope = (public) -> + ( EScope == (public) -> Lookup =.. [ECDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctn] - ; - (EScope = protected -> + ; ( EScope == protected -> Call =.. [ECDcl, Pred, Scope2, Compilation, Meta, NonTerminal, Ctn], Lookup = (Call, (Scope2 == p -> Scope = p; Scope = p(p))) - ; - Scope = p, - Lookup =.. [ECDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn])), - ('$lgt_pp_alias_'(Ctg, _, _) -> + ; Scope = p, + Lookup =.. [ECDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn] + ) + ), + ( '$lgt_pp_alias_'(Ctg, _, _) -> Head =.. [CDcl, Alias, Scope, Compilation, Meta, NonTerminal, Ctn], Rename =.. [PRnm, Ctg, Pred, Alias], assertz('$lgt_pp_dcl_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [CDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctn], - assertz('$lgt_pp_dcl_'((Head:-Lookup)))), + ; Head =.. [CDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctn], + assertz('$lgt_pp_dcl_'((Head:-Lookup))) + ), fail. '$lgt_gen_category_imports_dcl_clauses'. @@ -7117,26 +7118,18 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_category_def_clauses' :- - '$lgt_gen_category_catchall_def_clause', '$lgt_gen_category_linking_def_clauses', '$lgt_gen_category_imports_def_clauses'. -'$lgt_gen_category_catchall_def_clause' :- - \+ '$lgt_pp_def_'(_) -> - '$lgt_pp_category_'(_, _, _, Def, _, _), - Head =.. [Def, _, _, _, _, _], - assertz('$lgt_pp_def_'((Head:-fail))) - ; - true. - - - '$lgt_gen_category_linking_def_clauses' :- '$lgt_pp_category_'(Ctg, _, _, Def, _, _), Head =.. [Def, Pred, Sender, This, Self, Call, Ctg], - Body =.. [Def, Pred, Sender, This, Self, Call], + ( '$lgt_pp_def_'(_) -> + Body =.. [Def, Pred, Sender, This, Self, Call] + ; Body = fail + ), assertz('$lgt_pp_def_'((Head:-Body))). @@ -7146,13 +7139,13 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_rclause_'('$lgt_imports_category_'(Ctg, Ctg2, _)), % needed for parameter passing '$lgt_pp_imported_category_'(Ctg2, _, _, Def2, _), Lookup =.. [Def2, Pred, Sender, This, Self, Call, Ctn], - ('$lgt_pp_alias_'(Ctg2, _, _) -> + ( '$lgt_pp_alias_'(Ctg2, _, _) -> Head =.. [Def, Alias, Sender, This, Self, Call, Ctn], Rename =.. [PRnm, Ctg2, Pred, Alias], assertz('$lgt_pp_def_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [Def, Pred, Sender, This, Self, Call, Ctn], - assertz('$lgt_pp_def_'((Head:-Lookup)))), + ; Head =.. [Def, Pred, Sender, This, Self, Call, Ctn], + assertz('$lgt_pp_def_'((Head:-Lookup))) + ), fail. '$lgt_gen_category_imports_def_clauses'. @@ -7167,19 +7160,22 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_prototype_dcl_clauses' :- - '$lgt_gen_local_dcl_clauses', - '$lgt_gen_prototype_linking_dcl_clauses', + '$lgt_gen_local_dcl_clauses'(Local), + '$lgt_gen_prototype_linking_dcl_clauses'(Local), '$lgt_gen_prototype_implements_dcl_clauses', '$lgt_gen_prototype_imports_dcl_clauses', '$lgt_gen_prototype_extends_dcl_clauses'. -'$lgt_gen_prototype_linking_dcl_clauses' :- +'$lgt_gen_prototype_linking_dcl_clauses'(Local) :- '$lgt_pp_object_'(Obj, _, Dcl, _, _, _, _, DDcl, _, _, _), - Head =.. [Dcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Obj], - Body =.. [Dcl, Pred, Scope, Compilation, Meta, NonTerminal], - assertz('$lgt_pp_dcl_'((Head:-Body))), + ( call(Local) -> + Head =.. [Dcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Obj], + Body =.. [Dcl, Pred, Scope, Compilation, Meta, NonTerminal], + assertz('$lgt_pp_dcl_'((Head:-Body))) + ; true + ), Head2 =.. [Dcl, Pred, Scope, (dynamic), no, no, Obj, Obj], Body2 =.. [DDcl, Pred, Scope], assertz('$lgt_pp_dcl_'((Head2:-Body2))). @@ -7189,22 +7185,23 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_prototype_implements_dcl_clauses' :- '$lgt_pp_object_'(Obj, _, ODcl, _, _, _, _, _, _, PRnm, _), '$lgt_pp_implemented_protocol_'(Ptc, _, PDcl, EScope), - (EScope = (public) -> + ( EScope == (public) -> Lookup =.. [PDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctn] - ; - (EScope = protected -> + ; ( EScope == protected -> Call =.. [PDcl, Pred, Scope2, Compilation, Meta, NonTerminal, Ctn], Lookup = (Call, (Scope2 == p -> Scope = p; Scope = p(p))) - ; + ; Scope = p, - Lookup =.. [PDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn])), - ('$lgt_pp_alias_'(Ptc, _, _) -> + Lookup =.. [PDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn] + ) + ), + ( '$lgt_pp_alias_'(Ptc, _, _) -> Head =.. [ODcl, Alias, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], Rename =.. [PRnm, Ptc, Pred, Alias], assertz('$lgt_pp_dcl_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [ODcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], - assertz('$lgt_pp_dcl_'((Head:-Lookup)))), + ; Head =.. [ODcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], + assertz('$lgt_pp_dcl_'((Head:-Lookup))) + ), fail. '$lgt_gen_prototype_implements_dcl_clauses'. @@ -7214,22 +7211,22 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_prototype_imports_dcl_clauses' :- '$lgt_pp_object_'(Obj, _, ODcl, _, _, _, _, _, _, PRnm, _), '$lgt_pp_imported_category_'(Ctg, _, CDcl, _, EScope), - (EScope = (public) -> + ( EScope == (public) -> Lookup =.. [CDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctn] - ; - (EScope = protected -> + ; ( EScope == protected -> Call =.. [CDcl, Pred, Scope2, Compilation, Meta, NonTerminal, Ctn], Lookup = (Call, (Scope2 == p -> Scope = p; Scope = p(p))) - ; - Scope = p, - Lookup =.. [CDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn])), - ('$lgt_pp_alias_'(Ctg, _, _) -> + ; Scope = p, + Lookup =.. [CDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn] + ) + ), + ( '$lgt_pp_alias_'(Ctg, _, _) -> Head =.. [ODcl, Alias, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], Rename =.. [PRnm, Ctg, Pred, Alias], assertz('$lgt_pp_dcl_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [ODcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], - assertz('$lgt_pp_dcl_'((Head:-Lookup)))), + ; Head =.. [ODcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], + assertz('$lgt_pp_dcl_'((Head:-Lookup))) + ), fail. '$lgt_gen_prototype_imports_dcl_clauses'. @@ -7239,23 +7236,23 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_prototype_extends_dcl_clauses' :- '$lgt_pp_object_'(Obj, _, ODcl, _, _, _, _, _, _, PRnm, _), '$lgt_pp_extended_object_'(Parent, _, PDcl, _, _, _, _, _, _, EScope), - (EScope = (public) -> + ( EScope == (public) -> Lookup =.. [PDcl, Pred, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn] - ; - (EScope = protected -> + ; ( EScope == protected -> Call =.. [PDcl, Pred, Scope2, Compilation, Meta, NonTerminal, SCtn, TCtn], Lookup = (Call, (Scope2 == p -> Scope = p; Scope = p(p))) - ; - Scope = p, + ; Scope = p, Call =.. [PDcl, Pred, Scope2, Compilation, Meta, NonTerminal, SCtn2, TCtn], - Lookup = (Call, (Scope2 == p -> SCtn = SCtn2; SCtn = Obj)))), - ('$lgt_pp_alias_'(Parent, _, _) -> + Lookup = (Call, (Scope2 == p -> SCtn = SCtn2; SCtn = Obj)) + ) + ), + ( '$lgt_pp_alias_'(Parent, _, _) -> Head =.. [ODcl, Alias, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn], Rename =.. [PRnm, Parent, Pred, Alias], assertz('$lgt_pp_dcl_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [ODcl, Pred, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn], - assertz('$lgt_pp_dcl_'((Head:-Lookup)))), + ; Head =.. [ODcl, Pred, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn], + assertz('$lgt_pp_dcl_'((Head:-Lookup))) + ), fail. '$lgt_gen_prototype_extends_dcl_clauses'. @@ -7263,19 +7260,21 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_prototype_def_clauses' :- - '$lgt_gen_local_def_clauses', - '$lgt_gen_obj_catchall_def_clause', - '$lgt_gen_prototype_linking_def_clauses', + '$lgt_gen_local_def_clauses'(Local), + '$lgt_gen_prototype_linking_def_clauses'(Local), '$lgt_gen_prototype_imports_def_clauses', '$lgt_gen_prototype_extends_def_clauses'. -'$lgt_gen_prototype_linking_def_clauses' :- +'$lgt_gen_prototype_linking_def_clauses'(Local) :- '$lgt_pp_object_'(Obj, _, _, Def, _, _, _, _, DDef, _, _), Head =.. [Def, Pred, Sender, This, Self, Call, Obj], - Body =.. [Def, Pred, Sender, This, Self, Call], - assertz('$lgt_pp_def_'((Head:-Body))), + ( call(Local) -> + Body =.. [Def, Pred, Sender, This, Self, Call], + assertz('$lgt_pp_def_'((Head:-Body))) + ; true + ), Body2 =.. [DDef, Pred, Sender, This, Self, Call], assertz('$lgt_pp_def_'((Head:-Body2))). @@ -7286,13 +7285,13 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_rclause_'('$lgt_imports_category_'(Obj, Ctg, _)), % needed for parameter passing '$lgt_pp_imported_category_'(Ctg, _, _, CDef, _), Lookup =.. [CDef, Pred, Sender, Obj, Self, Call, Ctn], - ('$lgt_pp_alias_'(Ctg, _, _) -> + ( '$lgt_pp_alias_'(Ctg, _, _) -> Head =.. [ODef, Alias, Sender, Obj, Self, Call, Ctn], Rename =.. [PRnm, Ctg, Pred, Alias], assertz('$lgt_pp_def_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [ODef, Pred, Sender, Obj, Self, Call, Ctn], - assertz('$lgt_pp_def_'((Head:-Lookup)))), + ; Head =.. [ODef, Pred, Sender, Obj, Self, Call, Ctn], + assertz('$lgt_pp_def_'((Head:-Lookup))) + ), fail. '$lgt_gen_prototype_imports_def_clauses'. @@ -7304,13 +7303,13 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_rclause_'('$lgt_extends_object_'(Obj, Parent, _)), % needed for parameter passing '$lgt_pp_extended_object_'(Parent, _, _, PDef, _, _, _, _, _, _), Lookup =.. [PDef, Pred, Sender, Parent, Self, Call, Ctn], - ('$lgt_pp_alias_'(Parent, _, _) -> + ( '$lgt_pp_alias_'(Parent, _, _) -> Head =.. [ODef, Alias, Sender, Obj, Self, Call, Ctn], Rename =.. [PRnm, Parent, Pred, Alias], assertz('$lgt_pp_def_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [ODef, Pred, Sender, Obj, Self, Call, Ctn], - assertz('$lgt_pp_def_'((Head:-Lookup)))), + ; Head =.. [ODef, Pred, Sender, Obj, Self, Call, Ctn], + assertz('$lgt_pp_def_'((Head:-Lookup))) + ), fail. '$lgt_gen_prototype_extends_def_clauses'. @@ -7333,13 +7332,13 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_rclause_'('$lgt_extends_object_'(Obj, Parent, _)), % needed for parameter passing '$lgt_pp_extended_object_'(Parent, _, _, PDef, _, _, _, _, _, _), Lookup =.. [PDef, Pred, Sender, Parent, Self, Call, Ctn], - ('$lgt_pp_alias_'(Parent, _, _) -> + ( '$lgt_pp_alias_'(Parent, _, _) -> Head =.. [OSuper, Alias, Sender, Obj, Self, Call, Ctn], Rename =.. [PRnm, Parent, Pred, Alias], assertz('$lgt_pp_def_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [OSuper, Pred, Sender, Obj, Self, Call, Ctn], - assertz('$lgt_pp_def_'((Head:-Lookup)))), + ; Head =.. [OSuper, Pred, Sender, Obj, Self, Call, Ctn], + assertz('$lgt_pp_def_'((Head:-Lookup))) + ), fail. '$lgt_gen_prototype_super_clauses'. @@ -7348,15 +7347,14 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_ic_clauses' :- '$lgt_gen_ic_dcl_clauses', - '$lgt_gen_ic_idcl_clauses', '$lgt_gen_ic_def_clauses', - '$lgt_gen_ic_idef_clauses', '$lgt_gen_ic_super_clauses'. '$lgt_gen_ic_dcl_clauses' :- - '$lgt_gen_local_dcl_clauses', + '$lgt_gen_local_dcl_clauses'(Local), + '$lgt_gen_ic_idcl_clauses'(Local), '$lgt_gen_ic_hierarchy_dcl_clauses'. @@ -7371,23 +7369,23 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_ic_hierarchy_dcl_clauses' :- '$lgt_pp_object_'(Obj, _, ODcl, _, _, _, _, _, _, PRnm, _), '$lgt_pp_instantiated_class_'(Class, _, _, _, _, CIDcl, _, _, _, EScope), - (EScope = (public) -> + ( EScope == (public) -> Lookup =.. [CIDcl, Pred, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn] - ; - (EScope = protected -> + ; ( EScope == protected -> Call =.. [CIDcl, Pred, Scope2, Compilation, Meta, NonTerminal, SCtn, TCtn], Lookup = (Call, (Scope2 == p -> Scope = p; Scope = p(p))) - ; - Scope = p, + ; Scope = p, Call =.. [CIDcl, Pred, Scope2, Compilation, Meta, NonTerminal, SCtn2, TCtn], - Lookup = (Call, (Scope2 == p -> SCtn = SCtn2; SCtn = Obj)))), - ('$lgt_pp_alias_'(Class, _, _) -> + Lookup = (Call, (Scope2 == p -> SCtn = SCtn2; SCtn = Obj)) + ) + ), + ( '$lgt_pp_alias_'(Class, _, _) -> Head =.. [ODcl, Alias, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn], Rename =.. [PRnm, Class, Pred, Alias], assertz('$lgt_pp_dcl_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [ODcl, Pred, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn], - assertz('$lgt_pp_dcl_'((Head:-Lookup)))), + ; Head =.. [ODcl, Pred, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn], + assertz('$lgt_pp_dcl_'((Head:-Lookup))) + ), fail. '$lgt_gen_ic_hierarchy_dcl_clauses'. @@ -7396,19 +7394,22 @@ current_logtalk_flag(version, version(2, 27, 0)). % generates instance/class inherited declaration clauses -'$lgt_gen_ic_idcl_clauses' :- - '$lgt_gen_ic_linking_idcl_clauses', +'$lgt_gen_ic_idcl_clauses'(Local) :- + '$lgt_gen_ic_linking_idcl_clauses'(Local), '$lgt_gen_ic_protocol_idcl_clauses', '$lgt_gen_ic_category_idcl_clauses', '$lgt_gen_ic_hierarchy_idcl_clauses'. -'$lgt_gen_ic_linking_idcl_clauses' :- +'$lgt_gen_ic_linking_idcl_clauses'(Local) :- '$lgt_pp_object_'(Obj, _, Dcl, _, _, IDcl, _, DDcl, _, _, _), - Head =.. [IDcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Obj], - Body =.. [Dcl, Pred, Scope, Compilation, Meta, NonTerminal], - assertz('$lgt_pp_dcl_'((Head:-Body))), + ( call(Local) -> + Head =.. [IDcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Obj], + Body =.. [Dcl, Pred, Scope, Compilation, Meta, NonTerminal], + assertz('$lgt_pp_dcl_'((Head:-Body))) + ; true + ), Head2 =.. [IDcl, Pred, Scope, (dynamic), no, no, Obj, Obj], Body2 =.. [DDcl, Pred, Scope], assertz('$lgt_pp_dcl_'((Head2:-Body2))). @@ -7418,22 +7419,22 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_ic_protocol_idcl_clauses' :- '$lgt_pp_object_'(Obj, _, _, _, _, OIDcl, _, _, _, PRnm, _), '$lgt_pp_implemented_protocol_'(Ptc, _, PDcl, EScope), - (EScope = (public) -> + ( EScope == (public) -> Lookup =.. [PDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctn] - ; - (EScope = protected -> + ; ( EScope == protected -> Call =.. [PDcl, Pred, Scope2, Compilation, Meta, NonTerminal, Ctn], Lookup = (Call, (Scope2 == p -> Scope = p; Scope = p(p))) - ; - Scope = p, - Lookup =.. [PDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn])), - ('$lgt_pp_alias_'(Ptc, _, _) -> + ; Scope = p, + Lookup =.. [PDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn] + ) + ), + ( '$lgt_pp_alias_'(Ptc, _, _) -> Head =.. [OIDcl, Alias, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], Rename =.. [PRnm, Ptc, Pred, Alias], assertz('$lgt_pp_dcl_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [OIDcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], - assertz('$lgt_pp_dcl_'((Head:-Lookup)))), + ; Head =.. [OIDcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], + assertz('$lgt_pp_dcl_'((Head:-Lookup))) + ), fail. '$lgt_gen_ic_protocol_idcl_clauses'. @@ -7443,22 +7444,22 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_ic_category_idcl_clauses' :- '$lgt_pp_object_'(Obj, _, _, _, _, OIDcl, _, _, _, PRnm, _), '$lgt_pp_imported_category_'(Ctg, _, CDcl, _, EScope), - (EScope = (public) -> + ( EScope == (public) -> Lookup =.. [CDcl, Pred, Scope, Compilation, Meta, NonTerminal, Ctn] - ; - (EScope = protected -> + ; ( EScope == protected -> Call =.. [CDcl, Pred, Scope2, Compilation, Meta, NonTerminal, Ctn], Lookup = (Call, (Scope2 == p -> Scope = p; Scope = p(p))) - ; - Scope = p, - Lookup =.. [CDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn])), - ('$lgt_pp_alias_'(Ctg, _, _) -> + ; Scope = p, + Lookup =.. [CDcl, Pred, _, Compilation, Meta, NonTerminal, Ctn] + ) + ), + ( '$lgt_pp_alias_'(Ctg, _, _) -> Head =.. [OIDcl, Alias, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], Rename =.. [PRnm, Ctg, Pred, Alias], assertz('$lgt_pp_dcl_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [OIDcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], - assertz('$lgt_pp_dcl_'((Head:-Lookup)))), + ; Head =.. [OIDcl, Pred, Scope, Compilation, Meta, NonTerminal, Obj, Ctn], + assertz('$lgt_pp_dcl_'((Head:-Lookup))) + ), fail. '$lgt_gen_ic_category_idcl_clauses'. @@ -7468,23 +7469,23 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_ic_hierarchy_idcl_clauses' :- '$lgt_pp_object_'(Obj, _, _, _, _, CIDcl, _, _, _, PRnm, _), '$lgt_pp_specialized_class_'(Super, _, _, _, _, SIDcl, _, _, _, EScope), - (EScope = (public) -> + ( EScope == (public) -> Lookup =.. [SIDcl, Pred, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn] - ; - (EScope = protected -> + ; ( EScope == protected -> Call =.. [SIDcl, Pred, Scope2, Compilation, Meta, NonTerminal, SCtn, TCtn], Lookup = (Call, (Scope2 == p -> Scope = p; Scope = p(p))) - ; - Scope = p, + ; Scope = p, Call =.. [SIDcl, Pred, Scope2, Compilation, Meta, NonTerminal, SCtn2, TCtn], - Lookup = (Call, (Scope2 == p -> SCtn = SCtn2; SCtn = Obj)))), - ('$lgt_pp_alias_'(Super, _, _) -> + Lookup = (Call, (Scope2 == p -> SCtn = SCtn2; SCtn = Obj)) + ) + ), + ( '$lgt_pp_alias_'(Super, _, _) -> Head =.. [CIDcl, Alias, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn], Rename =.. [PRnm, Super, Pred, Alias], assertz('$lgt_pp_dcl_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [CIDcl, Pred, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn], - assertz('$lgt_pp_dcl_'((Head:-Lookup)))), + ; Head =.. [CIDcl, Pred, Scope, Compilation, Meta, NonTerminal, SCtn, TCtn], + assertz('$lgt_pp_dcl_'((Head:-Lookup))) + ), fail. '$lgt_gen_ic_hierarchy_idcl_clauses'. @@ -7492,19 +7493,22 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_gen_ic_def_clauses' :- - '$lgt_gen_local_def_clauses', - '$lgt_gen_obj_catchall_def_clause', - '$lgt_gen_ic_linking_def_clauses', + '$lgt_gen_local_def_clauses'(Local), + '$lgt_gen_ic_linking_def_clauses'(Local), '$lgt_gen_ic_imports_def_clauses', - '$lgt_gen_ic_hierarchy_def_clauses'. + '$lgt_gen_ic_hierarchy_def_clauses', + '$lgt_gen_ic_idef_clauses'(Local). -'$lgt_gen_ic_linking_def_clauses' :- +'$lgt_gen_ic_linking_def_clauses'(Local) :- '$lgt_pp_object_'(Obj, _, _, Def, _, _, _, _, DDef, _, _), Head =.. [Def, Pred, Sender, This, Self, Call, Obj], - Body =.. [Def, Pred, Sender, This, Self, Call], - assertz('$lgt_pp_def_'((Head:-Body))), + ( call(Local) -> + Body =.. [Def, Pred, Sender, This, Self, Call], + assertz('$lgt_pp_def_'((Head:-Body))) + ; true + ), Body2 =.. [DDef, Pred, Sender, This, Self, Call], assertz('$lgt_pp_def_'((Head:-Body2))). @@ -7515,13 +7519,13 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_rclause_'('$lgt_imports_category_'(Obj, Ctg, _)), % needed for parameter passing '$lgt_pp_imported_category_'(Ctg, _, _, CDef, _), Lookup =.. [CDef, Pred, Sender, Obj, Self, Call, Ctn], - ('$lgt_pp_alias_'(Ctg, _, _) -> + ( '$lgt_pp_alias_'(Ctg, _, _) -> Head =.. [ODef, Alias, Sender, Obj, Self, Call, Ctn], Rename =.. [PRnm, Ctg, Pred, Alias], assertz('$lgt_pp_def_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [ODef, Pred, Sender, Obj, Self, Call, Ctn], - assertz('$lgt_pp_def_'((Head:-Lookup)))), + ; Head =.. [ODef, Pred, Sender, Obj, Self, Call, Ctn], + assertz('$lgt_pp_def_'((Head:-Lookup))) + ), fail. '$lgt_gen_ic_imports_def_clauses'. @@ -7533,32 +7537,34 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_rclause_'('$lgt_instantiates_class_'(Obj, Class, _)), % needed for parameter passing '$lgt_pp_instantiated_class_'(Class, _, _, _, _, _, CIDef, _, _, _), Lookup =.. [CIDef, Pred, Sender, Class, Self, Call, Ctn], - ('$lgt_pp_alias_'(Class, _, _) -> + ( '$lgt_pp_alias_'(Class, _, _) -> Head =.. [ODef, Alias, Sender, Obj, Self, Call, Ctn], Rename =.. [PRnm, Class, Pred, Alias], assertz('$lgt_pp_def_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [ODef, Pred, Sender, Obj, Self, Call, Ctn], - assertz('$lgt_pp_def_'((Head:-Lookup)))), + ; Head =.. [ODef, Pred, Sender, Obj, Self, Call, Ctn], + assertz('$lgt_pp_def_'((Head:-Lookup))) + ), fail. '$lgt_gen_ic_hierarchy_def_clauses'. - -'$lgt_gen_ic_idef_clauses' :- - '$lgt_gen_ic_linking_idef_clauses', +'$lgt_gen_ic_idef_clauses'(Local) :- + '$lgt_gen_ic_linking_idef_clauses'(Local), '$lgt_gen_ic_category_idef_clauses', '$lgt_gen_ic_hierarchy_idef_clauses'. -'$lgt_gen_ic_linking_idef_clauses' :- +'$lgt_gen_ic_linking_idef_clauses'(Local) :- '$lgt_pp_object_'(Obj, _, _, Def, _, _, IDef, _, DDef, _, _), Head =.. [IDef, Pred, Sender, This, Self, Call, Obj], - Body =.. [Def, Pred, Sender, This, Self, Call], - assertz('$lgt_pp_def_'((Head:-Body))), + ( call(Local) -> + Body =.. [Def, Pred, Sender, This, Self, Call], + assertz('$lgt_pp_def_'((Head:-Body))) + ; true + ), Body2 =.. [DDef, Pred, Sender, This, Self, Call], assertz('$lgt_pp_def_'((Head:-Body2))). @@ -7569,13 +7575,13 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_rclause_'('$lgt_imports_category_'(Obj, Ctg, _)), % needed for parameter passing '$lgt_pp_imported_category_'(Ctg, _, _, CDef, _), Lookup =.. [CDef, Pred, Sender, Obj, Self, Call], - ('$lgt_pp_alias_'(Ctg, _, _) -> + ( '$lgt_pp_alias_'(Ctg, _, _) -> Head =.. [OIDef, Alias, Sender, Obj, Self, Call, Ctg], Rename =.. [PRnm, Ctg, Pred, Alias], assertz('$lgt_pp_def_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [OIDef, Pred, Sender, Obj, Self, Call, Ctg], - assertz('$lgt_pp_def_'((Head:-Lookup)))), + ; Head =.. [OIDef, Pred, Sender, Obj, Self, Call, Ctg], + assertz('$lgt_pp_def_'((Head:-Lookup))) + ), fail. '$lgt_gen_ic_category_idef_clauses'. @@ -7587,13 +7593,13 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_rclause_'('$lgt_specializes_class_'(Class, Super, _)), % needed for parameter passing '$lgt_pp_specialized_class_'(Super, _, _, _, _, _, SIDef, _, _, _), Lookup =.. [SIDef, Pred, Sender, Super, Self, Call, Ctn], - ('$lgt_pp_alias_'(Super, _, _) -> + ( '$lgt_pp_alias_'(Super, _, _) -> Head =.. [CIDef, Alias, Sender, Class, Self, Call, Ctn], Rename =.. [PRnm, Super, Pred, Alias], assertz('$lgt_pp_def_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [CIDef, Pred, Sender, Class, Self, Call, Ctn], - assertz('$lgt_pp_def_'((Head:-Lookup)))), + ; Head =.. [CIDef, Pred, Sender, Class, Self, Call, Ctn], + assertz('$lgt_pp_def_'((Head:-Lookup))) + ), fail. '$lgt_gen_ic_hierarchy_idef_clauses'. @@ -7617,13 +7623,13 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_rclause_'('$lgt_instantiates_class_'(Obj, Class, _)), % needed for parameter passing '$lgt_pp_instantiated_class_'(Class, _, _, _, _, _, CIDef, _, _, _), Lookup =.. [CIDef, Pred, Sender, Class, Obj, Call, Ctn], - ('$lgt_pp_alias_'(Class, _, _) -> + ( '$lgt_pp_alias_'(Class, _, _) -> Head =.. [OSuper, Alias, Sender, Obj, Obj, Call, Ctn], Rename =.. [PRnm, Class, Pred, Alias], assertz('$lgt_pp_def_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [OSuper, Pred, Sender, Obj, Obj, Call, Ctn], - assertz('$lgt_pp_def_'((Head:-Lookup)))), + ; Head =.. [OSuper, Pred, Sender, Obj, Obj, Call, Ctn], + assertz('$lgt_pp_def_'((Head:-Lookup))) + ), fail. % ... or/and in subclasses... @@ -7633,13 +7639,13 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_rclause_'('$lgt_specializes_class_'(Class, Super, _)), % needed for parameter passing '$lgt_pp_specialized_class_'(Super, _, _, _, _, _, SIDef, _, _, _), Lookup =.. [SIDef, Pred, Sender, Super, Self, Call, Ctn], - ('$lgt_pp_alias_'(Super, _, _) -> + ( '$lgt_pp_alias_'(Super, _, _) -> Head =.. [CSuper, Alias, Sender, Class, Self, Call, Ctn], Rename =.. [PRnm, Super, Pred, Alias], assertz('$lgt_pp_def_'((Head :- var(Alias) -> Lookup, Rename; Rename, Lookup))) - ; - Head =.. [CSuper, Pred, Sender, Class, Self, Call, Ctn], - assertz('$lgt_pp_def_'((Head:-Lookup)))), + ; Head =.. [CSuper, Pred, Sender, Class, Self, Call, Ctn], + assertz('$lgt_pp_def_'((Head:-Lookup))) + ), fail. '$lgt_gen_ic_super_clauses'. @@ -7653,11 +7659,11 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_fix_redef_built_ins' :- retract('$lgt_pp_eclause_'(Clause)), - (Clause = (Head:-Body) -> + ( Clause = (Head:-Body) -> '$lgt_fix_redef_built_ins'(Body, FBody), assertz('$lgt_pp_feclause_'((Head:-FBody))) - ; - assertz('$lgt_pp_feclause_'(Clause))), + ; assertz('$lgt_pp_feclause_'(Clause)) + ), fail. '$lgt_fix_redef_built_ins' :- @@ -7744,10 +7750,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_fix_redef_built_ins'('$lgt_call_built_in'(Pred, Ctx), TPred) :- !, - ('$lgt_pp_redefined_built_in_'(Pred, Ctx, TPred) -> + ( '$lgt_pp_redefined_built_in_'(Pred, Ctx, TPred) -> true - ; - '$lgt_fix_redef_built_ins'(Pred, TPred)). + ; '$lgt_fix_redef_built_ins'(Pred, TPred) + ). '$lgt_fix_redef_built_ins'(Pred, Pred). @@ -7779,10 +7785,10 @@ current_logtalk_flag(version, version(2, 27, 0)). setof(Pred, '$lgt_misspelt_call'(Pred), Preds), '$lgt_inc_compile_warnings_counter', nl, - (Preds = [_] -> + ( Preds = [_] -> write(' WARNING! this static predicate is called but never defined: ') - ; - write(' WARNING! these static predicates are called but never defined: ')), + ; write(' WARNING! these static predicates are called but never defined: ') + ), '$lgt_writeq_list'(Preds), !. @@ -7811,10 +7817,10 @@ current_logtalk_flag(version, version(2, 27, 0)). setof(Pred, '$lgt_non_portable_call'(Pred), Preds), '$lgt_inc_compile_warnings_counter', nl, - (Preds = [_] -> + ( Preds = [_] -> write(' WARNING! call to non-standard Prolog built-in predicate: ') - ; - write(' WARNING! calls to non-standard Prolog built-in predicates: ')), + ; write(' WARNING! calls to non-standard Prolog built-in predicates: ') + ), '$lgt_writeq_list'(Preds), !. @@ -7834,18 +7840,13 @@ current_logtalk_flag(version, version(2, 27, 0)). % constructs the entity functors clause '$lgt_pp_entity_functors'(Clause) :- - '$lgt_pp_object_'(_, Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, Rnm, _), - Clause =.. [Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, Rnm], - !. - -'$lgt_pp_entity_functors'(Clause) :- - '$lgt_pp_category_'(_, Prefix, Dcl, Def, Rnm, _), - Clause =.. [Prefix, Dcl, Def, Rnm], - !. - -'$lgt_pp_entity_functors'(Clause) :- - '$lgt_pp_protocol_'(_, Prefix, Dcl, Rnm, _), - Clause =.. [Prefix, Dcl, Rnm]. + ( '$lgt_pp_object_'(_, Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, Rnm, _) -> + Clause =.. [Prefix, Dcl, Def, Super, IDcl, IDef, DDcl, DDef, Rnm] + ; '$lgt_pp_category_'(_, Prefix, Dcl, Def, Rnm, _) -> + Clause =.. [Prefix, Dcl, Def, Rnm] + ; '$lgt_pp_protocol_'(_, Prefix, Dcl, Rnm, _) -> + Clause =.. [Prefix, Dcl, Rnm] + ). @@ -7855,9 +7856,9 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_directives'(Stream) :- '$lgt_pp_directive_'(Dir), - write_canonical(Stream, (:- Dir)), - write(Stream, '.'), - nl(Stream), + write_canonical(Stream, (:- Dir)), + write(Stream, '.'), + nl(Stream), fail. '$lgt_write_directives'(_). @@ -7870,9 +7871,9 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_prolog_clauses'(Stream) :- '$lgt_pp_ppclause_'(Clause), - write_canonical(Stream, Clause), - write(Stream, '.'), - nl(Stream), + write_canonical(Stream, Clause), + write(Stream, '.'), + nl(Stream), fail. '$lgt_write_prolog_clauses'(_). @@ -7904,8 +7905,8 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_def_clauses'(Stream) :- '$lgt_pp_def_'(Clause), - write_canonical(Stream, Clause), - write(Stream, '.'), nl(Stream), + write_canonical(Stream, Clause), + write(Stream, '.'), nl(Stream), fail. '$lgt_write_def_clauses'(_). @@ -7914,8 +7915,8 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_ddef_clauses'(Stream) :- '$lgt_pp_ddef_'(Clause), - write_canonical(Stream, Clause), - write(Stream, '.'), nl(Stream), + write_canonical(Stream, Clause), + write(Stream, '.'), nl(Stream), fail. '$lgt_write_ddef_clauses'(_). @@ -7924,9 +7925,9 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_dcl_clauses'(Stream) :- '$lgt_pp_dcl_'(Clause), - write_canonical(Stream, Clause), - write(Stream, '.'), - nl(Stream), + write_canonical(Stream, Clause), + write(Stream, '.'), + nl(Stream), fail. '$lgt_write_dcl_clauses'(_). @@ -7935,9 +7936,9 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_super_clauses'(Stream) :- '$lgt_pp_super_'(Clause), - write_canonical(Stream, Clause), - write(Stream, '.'), - nl(Stream), + write_canonical(Stream, Clause), + write(Stream, '.'), + nl(Stream), fail. '$lgt_write_super_clauses'(_). @@ -7945,19 +7946,19 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_alias_clauses'(Stream) :- - once(( - '$lgt_pp_object_'(_, _, _, _, _, _, _, _, _, Rnm, _); - '$lgt_pp_category_'(_, _, _, _, Rnm, _); - '$lgt_pp_protocol_'(_, _, _, Rnm, _))), + ( '$lgt_pp_object_'(_, _, _, _, _, _, _, _, _, Rnm, _) + ; '$lgt_pp_category_'(_, _, _, _, Rnm, _) + ; '$lgt_pp_protocol_'(_, _, _, Rnm, _) + ), !, '$lgt_write_alias_clauses'(Stream, Rnm). '$lgt_write_alias_clauses'(Stream, Rnm) :- '$lgt_pp_alias_'(Entity, Pred, Alias), - Clause =.. [Rnm, Entity, Pred, Alias], - write_canonical(Stream, Clause), - write(Stream, '.'), - nl(Stream), + Clause =.. [Rnm, Entity, Pred, Alias], + write_canonical(Stream, Clause), + write(Stream, '.'), + nl(Stream), fail. '$lgt_write_alias_clauses'(Stream, Rnm) :- @@ -7970,9 +7971,9 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_pred_clauses'(Stream) :- '$lgt_pp_feclause_'(Clause), - write_canonical(Stream, Clause), - write(Stream, '.'), - nl(Stream), + write_canonical(Stream, Clause), + write(Stream, '.'), + nl(Stream), fail. '$lgt_write_pred_clauses'(_). @@ -7987,11 +7988,11 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_init_call'(Stream) :- '$lgt_init_goal'(Goal), - (Goal = true -> + ( Goal == true -> true - ; - write_canonical(Stream, (:- initialization(Goal))), - write(Stream, '.'), nl(Stream)). + ; write_canonical(Stream, (:- initialization(Goal))), + write(Stream, '.'), nl(Stream) + ). @@ -8002,23 +8003,22 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_init_goal'(Goal) :- findall(EGoal, '$lgt_pp_entity_init_'(_, EGoal), EGoals), - ('$lgt_pp_file_init_'(FGoal) -> - (EGoals \= [] -> + ( '$lgt_pp_file_init_'(FGoal) -> + ( EGoals \== [] -> '$lgt_list_to_conjunction'(EGoals, EGoals2), Goal = (EGoals2, FGoal) - ; - Goal = FGoal) - ; - (EGoals \= [] -> + ; Goal = FGoal + ) + ; ( EGoals \== [] -> '$lgt_list_to_conjunction'(EGoals, Goal) - ; - Goal = true)). + ; Goal = true + ) + ). % converts a list of goals into a conjunction of goals -'$lgt_list_to_conjunction'([G], G) :- - !. +'$lgt_list_to_conjunction'([G], G) :- !. '$lgt_list_to_conjunction'([G1, G2| Gs], (G1, R)) :- '$lgt_list_to_conjunction'([G2| Gs], R). @@ -8031,10 +8031,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pp_entity'(_, Entity, _, _, _), findall(Clause, '$lgt_pp_rclause'(Clause), Clauses), Goal1 = '$lgt_assert_runtime_clauses'(Clauses), - ('$lgt_pp_fentity_init_'(Goal2) -> + ( '$lgt_pp_fentity_init_'(Goal2) -> Goal = (Goal1, Goal2) - ; - Goal = Goal1), + ; Goal = Goal1 + ), assertz('$lgt_pp_entity_init_'(Entity, Goal)). @@ -8058,14 +8058,14 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_assert_directives' :- '$lgt_pp_directive_'(dynamic(Functor/Arity)), - functor(Pred, Functor, Arity), - asserta(Pred), - retract(Pred), + functor(Pred, Functor, Arity), + asserta(Pred), + retract(Pred), fail. '$lgt_assert_directives' :- '$lgt_pp_directive_'(op(Pr, Spec, Ops)), - op(Pr, Spec, Ops), + op(Pr, Spec, Ops), fail. '$lgt_assert_directives'. @@ -8080,7 +8080,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_assert_dcl_clauses' :- '$lgt_pp_dcl_'(Clause), - assertz(Clause), + assertz(Clause), fail. '$lgt_assert_dcl_clauses'. @@ -8089,7 +8089,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_assert_def_clauses' :- '$lgt_pp_def_'(Clause), - assertz(Clause), + assertz(Clause), fail. '$lgt_assert_def_clauses'. @@ -8098,7 +8098,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_assert_ddef_clauses' :- '$lgt_pp_ddef_'(Clause), - assertz(Clause), + assertz(Clause), fail. '$lgt_assert_ddef_clauses'. @@ -8107,7 +8107,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_assert_super_clauses' :- '$lgt_pp_super_'(Clause), - assertz(Clause), + assertz(Clause), fail. '$lgt_assert_super_clauses'. @@ -8116,7 +8116,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_assert_pred_clauses' :- '$lgt_pp_feclause_'(Clause), - assertz(Clause), + assertz(Clause), fail. '$lgt_assert_pred_clauses'. @@ -8125,7 +8125,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_assert_runtime_clauses' :- '$lgt_pp_rclause'(Clause), - assertz(Clause), + assertz(Clause), fail. '$lgt_assert_runtime_clauses'. @@ -8137,10 +8137,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % call any defined initialization goal for a dynamically created entity '$lgt_assert_init' :- - '$lgt_pp_fentity_init_'(Goal) -> + ( '$lgt_pp_fentity_init_'(Goal) -> once(Goal) - ; - true. + ; true + ). @@ -8151,15 +8151,18 @@ current_logtalk_flag(version, version(2, 27, 0)). % % we may be reloading the entity so we must first retract any old % runtime clauses before asserting the new ones +% +% this is mostly a workaround for the lack of support of multifile +% predicates in some Prolog compilers '$lgt_assert_runtime_clauses'([Clause| Clauses]) :- arg(1, Clause, Entity), - ('$lgt_redefined_entity'(Entity, Type) -> + ( '$lgt_redefined_entity'(Entity, Type) -> '$lgt_clean_lookup_caches', '$lgt_clean_redefined_entity'(Type, Entity), '$lgt_report_redefined_entity'(Type, Entity) - ; - true), + ; true + ), '$lgt_retract_old_runtime_clauses'(Entity), '$lgt_assert_new_runtime_clauses'([Clause| Clauses]). @@ -8266,25 +8269,41 @@ current_logtalk_flag(version, version(2, 27, 0)). number_codes(Arity, Codes), atom_codes(Atom, Codes), atom_concat(Prefix, FunctorPlusArity, TFunctor), % generate and test - ('$lgt_current_object_'(Entity, Prefix, _, _, _, _), Type = object - ; - '$lgt_current_category_'(Entity, Prefix, _), Type = category), + ( '$lgt_current_object_'(Entity, Prefix, _, _, _, _), + Type = object + ; '$lgt_current_category_'(Entity, Prefix, _), + Type = category + ), atom_concat(Functor, Aux, FunctorPlusArity), atom_concat('_', Atom, Aux), !. +% '$lgt_compile_hook'(+callable) +% +% compiles the user-defined compiler hook + +'$lgt_compile_hook'(Obj::Functor) :- + Call =.. [Functor, Term, Terms], + ( Obj == user -> + Goal = Call + ; '$lgt_tr_msg'(Call, Obj, Goal, user) + ), + retractall('$lgt_hook_goal_'(_, _)), + assertz(('$lgt_hook_goal_'(Term, Terms) :- catch(Goal, _, fail))). + + + % '$lgt_built_in'(+callable) % % checks if the argument is either a Prolog or Logtalk built-in predicate '$lgt_built_in'(Pred) :- - '$lgt_pl_built_in'(Pred), - !. - -'$lgt_built_in'(Pred) :- - '$lgt_lgt_built_in'(Pred). + ( '$lgt_pl_built_in'(Pred) -> + true + ; '$lgt_lgt_built_in'(Pred) + ). @@ -8373,7 +8392,6 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_lgt_closing_directive'(end_protocol, 0). - '$lgt_lgt_entity_directive'(encoding, 1). '$lgt_lgt_entity_directive'(calls, N) :- @@ -8391,7 +8409,6 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_lgt_entity_directive'(info, 1). - '$lgt_lgt_predicate_directive'((dynamic), N) :- N >= 1. @@ -8515,8 +8532,12 @@ current_logtalk_flag(version, version(2, 27, 0)). % % valid predicate indicator or grammar rule indicator -'$lgt_valid_pred_or_gr_ind'(Term, Functor, Arity) :- - once((Term = Functor/Arity; Term = Functor//Arity)), +'$lgt_valid_pred_or_gr_ind'(Functor/Arity, Functor, Arity) :- + atom(Functor), + integer(Arity), + Arity >= 0. + +'$lgt_valid_pred_or_gr_ind'(Functor//Arity, Functor, Arity) :- atom(Functor), integer(Arity), Arity >= 0. @@ -8526,20 +8547,20 @@ current_logtalk_flag(version, version(2, 27, 0)). % '$lgt_valid_ref_scope'(@nonvar, -atom) '$lgt_valid_ref_scope'(Ref, Scope) :- - Ref = (Scope::_) -> + ( Ref = (Scope::_) -> '$lgt_scope'(Scope, _) - ; - Scope = (public). + ; Scope = (public) + ). % '$lgt_valid_protocol_ref'(@nonvar, -atom) '$lgt_valid_protocol_ref'(Ref, Ptc) :- - (Ref = (_::Ptc) -> + ( Ref = (_::Ptc) -> true - ; - Ptc = Ref), + ; Ptc = Ref + ), atom(Ptc). @@ -8547,10 +8568,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % '$lgt_valid_object_ref'(@nonvar, -atom) '$lgt_valid_object_ref'(Ref, Obj) :- - (Ref = (_::Obj) -> + ( Ref = (_::Obj) -> true - ; - Obj = Ref), + ; Obj = Ref + ), callable(Obj). @@ -8558,10 +8579,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % '$lgt_valid_category_ref'(@nonvar, -atom) '$lgt_valid_category_ref'(Ref, Ctg) :- - (Ref = (_::Ctg) -> + ( Ref = (_::Ctg) -> true - ; - Ctg = Ref), + ; Ctg = Ref + ), atom(Ctg). @@ -8570,20 +8591,19 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_valid_op_priority'(Pr) :- integer(Pr), - Pr >= 0, - Pr =< 1200. + 0 =< Pr, Pr =< 1200. % '$lgt_valid_op_specifier'(@term) '$lgt_valid_op_specifier'(Spec) :- - nonvar(Spec), + atom(Spec), '$lgt_op_specifier'(Spec). -% '$lgt_op_specifier'(@nonvar) +% '$lgt_op_specifier'(+atom) '$lgt_op_specifier'(fx). '$lgt_op_specifier'(fy). @@ -8653,8 +8673,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_valid_metapred_term_args'([]). '$lgt_valid_metapred_term_args'([Arg| Args]) :- - nonvar(Arg), - once((Arg = (::); Arg = (*))), + once((Arg == (::); Arg == (*))), '$lgt_valid_metapred_term_args'(Args). @@ -8689,12 +8708,12 @@ current_logtalk_flag(version, version(2, 27, 0)). % '$lgt_valid_number_of_solutions'(@term) '$lgt_valid_number_of_solutions'(Solutions) :- - nonvar(Solutions), + atom(Solutions), '$lgt_pred_number_of_solutions'(Solutions). -% '$lgt_pred_number_of_solutions'(@nonvar) +% '$lgt_pred_number_of_solutions'(+atom) '$lgt_pred_number_of_solutions'(zero). '$lgt_pred_number_of_solutions'(one). @@ -8771,62 +8790,62 @@ current_logtalk_flag(version, version(2, 27, 0)). % '$lgt_valid_flag_value'(@atom, @nonvar) -'$lgt_valid_flag_value'(xmldocs, on). -'$lgt_valid_flag_value'(xmldocs, off). +'$lgt_valid_flag_value'(xmldocs, on) :- !. +'$lgt_valid_flag_value'(xmldocs, off) :- !. '$lgt_valid_flag_value'(xslfile, File) :- atom(File). -'$lgt_valid_flag_value'(xmlsref, standalone). -'$lgt_valid_flag_value'(xmlsref, (local)). -'$lgt_valid_flag_value'(xmlsref, web). +'$lgt_valid_flag_value'(xmlsref, standalone) :- !. +'$lgt_valid_flag_value'(xmlsref, (local)) :- !. +'$lgt_valid_flag_value'(xmlsref, web) :- !. -'$lgt_valid_flag_value'(xmlspec, dtd). -'$lgt_valid_flag_value'(xmlspec, xsd). +'$lgt_valid_flag_value'(xmlspec, dtd) :- !. +'$lgt_valid_flag_value'(xmlspec, xsd) :- !. -'$lgt_valid_flag_value'(unknown, silent). -'$lgt_valid_flag_value'(unknown, warning). +'$lgt_valid_flag_value'(unknown, silent) :- !. +'$lgt_valid_flag_value'(unknown, warning) :- !. -'$lgt_valid_flag_value'(singletons, silent). -'$lgt_valid_flag_value'(singletons, warning). +'$lgt_valid_flag_value'(singletons, silent) :- !. +'$lgt_valid_flag_value'(singletons, warning) :- !. -'$lgt_valid_flag_value'(misspelt, silent). -'$lgt_valid_flag_value'(misspelt, warning). +'$lgt_valid_flag_value'(misspelt, silent) :- !. +'$lgt_valid_flag_value'(misspelt, warning) :- !. -'$lgt_valid_flag_value'(lgtredef, silent). -'$lgt_valid_flag_value'(lgtredef, warning). +'$lgt_valid_flag_value'(lgtredef, silent) :- !. +'$lgt_valid_flag_value'(lgtredef, warning) :- !. -'$lgt_valid_flag_value'(plredef, silent). -'$lgt_valid_flag_value'(plredef, warning). +'$lgt_valid_flag_value'(plredef, silent) :- !. +'$lgt_valid_flag_value'(plredef, warning) :- !. -'$lgt_valid_flag_value'(portability, silent). -'$lgt_valid_flag_value'(portability, warning). +'$lgt_valid_flag_value'(portability, silent) :- !. +'$lgt_valid_flag_value'(portability, warning) :- !. -'$lgt_valid_flag_value'(report, on). -'$lgt_valid_flag_value'(report, off). +'$lgt_valid_flag_value'(report, on) :- !. +'$lgt_valid_flag_value'(report, off) :- !. -'$lgt_valid_flag_value'(smart_compilation, on). -'$lgt_valid_flag_value'(smart_compilation, off). +'$lgt_valid_flag_value'(smart_compilation, on) :- !. +'$lgt_valid_flag_value'(smart_compilation, off) :- !. -'$lgt_valid_flag_value'(underscore_vars, dont_care). -'$lgt_valid_flag_value'(underscore_vars, singletons). +'$lgt_valid_flag_value'(underscore_vars, dont_care) :- !. +'$lgt_valid_flag_value'(underscore_vars, singletons) :- !. '$lgt_valid_flag_value'(code_prefix, Prefix) :- atom(Prefix). -'$lgt_valid_flag_value'(debug, on). -'$lgt_valid_flag_value'(debug, off). +'$lgt_valid_flag_value'(debug, on) :- !. +'$lgt_valid_flag_value'(debug, off) :- !. -'$lgt_valid_flag_value'(events, on). -'$lgt_valid_flag_value'(events, off). +'$lgt_valid_flag_value'(events, on) :- !. +'$lgt_valid_flag_value'(events, off) :- !. '$lgt_valid_flag_value'(hook, Obj::Functor) :- atom(Functor), - once((atom(Obj); compound(Obj))). + callable(Obj). -% '$'$lgt_valid_pred_argument'(@term) +% '$lgt_valid_entity_parameter'(@term) % % valid predicate argument documentation on info/2 directive @@ -8836,7 +8855,7 @@ current_logtalk_flag(version, version(2, 27, 0)). -% '$'$lgt_valid_pred_argument'(@term) +% '$lgt_valid_pred_argument'(@term) % % valid predicate argument documentation on info/2 directive @@ -8845,6 +8864,30 @@ current_logtalk_flag(version, version(2, 27, 0)). atom(Description). +% '$lgt_valid_pred_allocation'(@nonvar) +% +% valid predicate allocation on info/2 directive + +'$lgt_valid_pred_allocation'(container). +'$lgt_valid_pred_allocation'(descendants). +'$lgt_valid_pred_allocation'(instances). +'$lgt_valid_pred_allocation'(classes). +'$lgt_valid_pred_allocation'(subclasses). +'$lgt_valid_pred_allocation'(any). + + + +% '$lgt_valid_pred_redefinition'(@nonvar) +% +% valid predicate redefinition on info/2 directive + +'$lgt_valid_pred_redefinition'(never). +'$lgt_valid_pred_redefinition'(free). +'$lgt_valid_pred_redefinition'(specialize). +'$lgt_valid_pred_redefinition'(call_super_first). +'$lgt_valid_pred_redefinition'(call_super_last). + + % '$lgt_valid_pred_exception'(@term) % @@ -8864,10 +8907,10 @@ current_logtalk_flag(version, version(2, 27, 0)). atom(Description), callable(Call), nonvar(Bindings), - (atom(Bindings) -> - once((Bindings == no; Bindings == yes)) - ; - '$lgt_valid_example_var_bindings'(Bindings)). + ( Bindings == no -> true + ; Bindings == yes -> true + ; '$lgt_valid_example_var_bindings'(Bindings) + ). @@ -8881,10 +8924,10 @@ current_logtalk_flag(version, version(2, 27, 0)). functor(Pred, Functor, Arity), Call = Pred, nonvar(Bindings), - (atom(Bindings) -> - once((Bindings == no; Bindings == yes)) - ; - '$lgt_valid_example_var_bindings'(Bindings)). + ( Bindings == no -> true + ; Bindings == yes -> true + ; '$lgt_valid_example_var_bindings'(Bindings) + ). @@ -8906,7 +8949,8 @@ current_logtalk_flag(version, version(2, 27, 0)). % '$lgt_xml_encoding'(-atom) % -% returns the text encoding that should be used on the XML documenting file +% returns the text encoding that should be used on the XML documenting file; +% default encoding is UTF-8 '$lgt_xml_encoding'(XMLEncoding) :- '$lgt_pp_directive_'(encoding(Encoding)) -> @@ -9202,7 +9246,8 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_dcg_body'(NonTerminal, S0, S, Goal) :- '$lgt_dcg_non_terminal'(NonTerminal, S0, S, Goal), functor(NonTerminal, Functor, Arity), - ( '$lgt_pp_calls_nt_'(Functor, Arity) -> true + ( '$lgt_pp_calls_nt_'(Functor, Arity) -> + true ; assertz('$lgt_pp_calls_nt_'(Functor, Arity)) ). @@ -9363,39 +9408,39 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_xml_encoding'(Encoding), '$lgt_xml_header_text'('1.0', Encoding, no, Text), '$lgt_write_xml_open_tag'(Stream, Text, []), - (XMLSpec = dtd -> + ( XMLSpec == dtd -> write(Stream, ''), nl(Stream) - ; - true), + ; true + ), '$lgt_compiler_flag'(xslfile, XSL), write(Stream, ''), nl(Stream), - (XMLSpec = dtd -> + ( XMLSpec == dtd -> '$lgt_write_xml_open_tag'(Stream, logtalk, []) - ; - '$lgt_write_xml_open_tag'(Stream, logtalk, + ; '$lgt_write_xml_open_tag'(Stream, logtalk, ['xmlns:xsi'-'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:noNamespaceSchemaLocation'-'logtalk.xsd'])). + 'xsi:noNamespaceSchemaLocation'-'logtalk.xsd']) + ). '$lgt_write_xml_header'(web, XMLSpec, Stream) :- '$lgt_xml_encoding'(Encoding), '$lgt_xml_header_text'('1.0', Encoding, no, Text), '$lgt_write_xml_open_tag'(Stream, Text, []), - (XMLSpec = dtd -> + ( XMLSpec == dtd -> write(Stream, ''), nl(Stream) - ; - true), + ; true + ), '$lgt_compiler_flag'(xslfile, XSL), write(Stream, ''), nl(Stream), - (XMLSpec = dtd -> + ( XMLSpec == dtd -> '$lgt_write_xml_open_tag'(Stream, logtalk, []) - ; - '$lgt_write_xml_open_tag'(Stream, logtalk, + ; '$lgt_write_xml_open_tag'(Stream, logtalk, ['xmlns:xsi'-'http://www.w3.org/2001/XMLSchema-instance', - 'xsi:noNamespaceSchemaLocation'-'http://www.logtalk.org/xml/1.3/logtalk.xsd'])). + 'xsi:noNamespaceSchemaLocation'-'http://www.logtalk.org/xml/1.3/logtalk.xsd']) + ). '$lgt_write_xml_header'(standalone, _, Stream) :- '$lgt_xml_encoding'(Encoding), @@ -9430,46 +9475,50 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_cdata_element'(Stream, name, [], Entity), '$lgt_write_xml_element'(Stream, (type), [], Type), '$lgt_write_xml_element'(Stream, compilation, [], Compilation), - ('$lgt_pp_info_'(Info) -> - ('$lgt_member'(comment is Comment, Info) -> - '$lgt_write_xml_cdata_element'(Stream, comment, [], Comment) - ; - true), - ('$lgt_member'(parameters is Parameters, Info) -> - '$lgt_write_xml_open_tag'(Stream, parameters, []), - forall( - '$lgt_member'(Parname-Description, Parameters), - ('$lgt_write_xml_open_tag'(Stream, parameter, []), - '$lgt_write_xml_cdata_element'(Stream, name, [], Parname), - '$lgt_write_xml_cdata_element'(Stream, description, [], Description), - '$lgt_write_xml_close_tag'(Stream, parameter))), - '$lgt_write_xml_close_tag'(Stream, parameters) - ; - true), - ('$lgt_member'(author is Author, Info) -> - '$lgt_write_xml_cdata_element'(Stream, author, [], Author) - ; - true), - ('$lgt_member'(version is Version, Info) -> - '$lgt_write_xml_element'(Stream, version, [], Version) - ; - true), - ('$lgt_member'(date is Date, Info) -> - '$lgt_write_xml_element'(Stream, date, [], Date) - ; - true), - forall( - ('$lgt_member'(Key is Value, Info), - \+ '$lgt_member'(Key, [comment, author, version, date, parameters, parnames, remarks])), - ('$lgt_write_xml_open_tag'(Stream, info, []), - '$lgt_write_xml_element'(Stream, key, [], Key), - '$lgt_write_xml_cdata_element'(Stream, value, [], Value), - '$lgt_write_xml_close_tag'(Stream, info))) - ; - true), + ( '$lgt_pp_info_'(Info) -> + '$lgt_write_xml_entity_info'(Stream, Info) + ; true + ), '$lgt_write_xml_close_tag'(Stream, entity). +'$lgt_write_xml_entity_info'(Stream, Info) :- + ( '$lgt_member'(comment is Comment, Info) -> + '$lgt_write_xml_cdata_element'(Stream, comment, [], Comment) + ; true + ), + ( '$lgt_member'(parameters is Parameters, Info) -> + '$lgt_write_xml_open_tag'(Stream, parameters, []), + forall( + '$lgt_member'(Parname-Description, Parameters), + ('$lgt_write_xml_open_tag'(Stream, parameter, []), + '$lgt_write_xml_cdata_element'(Stream, name, [], Parname), + '$lgt_write_xml_cdata_element'(Stream, description, [], Description), + '$lgt_write_xml_close_tag'(Stream, parameter))), + '$lgt_write_xml_close_tag'(Stream, parameters) + ; true + ), + ( '$lgt_member'(author is Author, Info) -> + '$lgt_write_xml_cdata_element'(Stream, author, [], Author) + ; true + ), + ( '$lgt_member'(version is Version, Info) -> + '$lgt_write_xml_element'(Stream, version, [], Version) + ; true + ), + ( '$lgt_member'(date is Date, Info) -> + '$lgt_write_xml_element'(Stream, date, [], Date) + ; true + ), + forall( + ('$lgt_member'(Key is Value, Info), + \+ '$lgt_member'(Key, [comment, author, version, date, parameters, parnames, remarks])), + ('$lgt_write_xml_open_tag'(Stream, info, []), + '$lgt_write_xml_element'(Stream, key, [], Key), + '$lgt_write_xml_cdata_element'(Stream, value, [], Value), + '$lgt_write_xml_close_tag'(Stream, info))). + + % '$lgt_entity_to_xml_term'(+entity) % @@ -9478,11 +9527,11 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_entity_to_xml_term'(Entity) :- '$lgt_pp_info_'(List), - ('$lgt_member'(parnames is Names, List) -> + ( '$lgt_member'(parnames is Names, List) -> true - ; - '$lgt_member'(parameters is Parameters, List), - findall(Name, '$lgt_member'(Name - _, Parameters), Names)), + ; '$lgt_member'(parameters is Parameters, List), + findall(Name, '$lgt_member'(Name - _, Parameters), Names) + ), !, Entity =.. [_| Args], '$lgt_vars_to_atoms'(Args, Args, Names). @@ -9516,15 +9565,15 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_pred_qcall_to_xml_term'(Functor, Arity, Call, Bindings) :- - once(( - '$lgt_pp_info_'(Functor/Arity, List) - ; - '$lgt_pp_info_'(Functor//Arity, List))), - ('$lgt_member'(argnames is Names, List) -> + ( '$lgt_pp_info_'(Functor/Arity, List) -> true - ; - '$lgt_member'(arguments is Arguments, List), - findall(Name, '$lgt_member'(Name - _, Arguments), Names)), + ; '$lgt_pp_info_'(Functor//Arity, List) + ), + ( '$lgt_member'(argnames is Names, List) -> + true + ; '$lgt_member'(arguments is Arguments, List), + findall(Name, '$lgt_member'(Name - _, Arguments), Names) + ), !, Call =.. [Functor| Args], '$lgt_binding_vars'(Bindings, Vars), @@ -9570,11 +9619,11 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_double_quote_atoms'(Atom, QAtom) :- atom(Atom), !, - ('$lgt_atom_needs_quotes'(Atom) -> + ( '$lgt_atom_needs_quotes'(Atom) -> atom_concat('''', Atom, Aux), atom_concat(Aux, '''', QAtom) - ; - Atom = QAtom). + ; Atom = QAtom + ). '$lgt_double_quote_atoms'(Number, Number) :- number(Number), @@ -9582,21 +9631,31 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_double_quote_atoms'(Term, QTerm) :- Term =.. [Functor| Args], - ('$lgt_built_in'(Term) -> + ( '$lgt_built_in'(Term) -> QFunctor = Functor - ; - '$lgt_double_quote_atoms'(Functor, QFunctor)), + ; '$lgt_double_quote_atoms'(Functor, QFunctor) + ), '$lgt_double_quote_atoms'(Args, QArgs), QTerm =.. [QFunctor| QArgs]. '$lgt_atom_needs_quotes'(Atom) :- atom_chars(Atom, [First| Rest]), - once(( - First @< a; - First @> z; - '$lgt_member'(Char, Rest), - \+ (Char == '_'; Char @>= a, Char @=< z; Char @>= 'A', Char @=< 'Z'; Char @>= '0', Char @=< '9'))). + ( First @< a + ; First @> z + ; '$lgt_member'(Char, Rest), + \+ '$lgt_alpha_numeric_char'(Char) + ), + !. + + +'$lgt_alpha_numeric_char'('_'). +'$lgt_alpha_numeric_char'(Char) :- + Char @>= a, Char @=< z. +'$lgt_alpha_numeric_char'(Char) :- + Char @>= 'A', Char @=< 'Z'. +'$lgt_alpha_numeric_char'(Char) :- + Char @>= '0', Char @=< '9'. @@ -9605,10 +9664,10 @@ current_logtalk_flag(version, version(2, 27, 0)). % returns a list of all binding variables '$lgt_binding_vars'(Bindings, Vars) :- - atom(Bindings) -> % no bindings, just "no", "yes", or equivalent answers + ( atom(Bindings) -> % no bindings, just "no", "yes", or equivalent answers Vars = [] - ; - '$lgt_binding_vars_list'(Bindings, Vars). + ; '$lgt_binding_vars_list'(Bindings, Vars) + ). '$lgt_binding_vars_list'((Var = _), [Var]). @@ -9625,13 +9684,13 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_vars_to_atoms'([], _, []). '$lgt_vars_to_atoms'([Arg| Args], Vars, [Name| Names]) :- - (var(Arg) -> - ('$lgt_member_var'(Arg, Vars) -> + ( var(Arg) -> + ( '$lgt_member_var'(Arg, Vars) -> Arg = Name - ; - Arg = '_') - ; - true), + ; Arg = '_' + ) + ; true + ), '$lgt_vars_to_atoms'(Args, Vars, Names). @@ -9643,7 +9702,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_vars_to_underscore'([]). '$lgt_vars_to_underscore'([Arg| Args]) :- - (var(Arg) -> Arg = '_'; true), + ( var(Arg) -> + Arg = '_' + ; true + ), '$lgt_vars_to_underscore'(Args). @@ -9681,10 +9743,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_public_predicates'(Stream) :- '$lgt_write_xml_open_tag'(Stream, (public), []), '$lgt_pp_public_'(Functor, Arity), - ('$lgt_pp_non_terminal_'(Functor, Args, Arity) -> + ( '$lgt_pp_non_terminal_'(Functor, Args, Arity) -> '$lgt_write_xml_non_terminal'(Stream, Functor, Args, Arity, (public)) - ; - '$lgt_write_xml_predicate'(Stream, Functor, Arity, (public))), + ; '$lgt_write_xml_predicate'(Stream, Functor, Arity, (public)) + ), fail. '$lgt_write_xml_public_predicates'(Stream) :- @@ -9699,10 +9761,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_protected_predicates'(Stream) :- '$lgt_write_xml_open_tag'(Stream, protected, []), '$lgt_pp_protected_'(Functor, Arity), - ('$lgt_pp_non_terminal_'(Functor, Args, Arity) -> + ( '$lgt_pp_non_terminal_'(Functor, Args, Arity) -> '$lgt_write_xml_non_terminal'(Stream, Functor, Args, Arity, protected) - ; - '$lgt_write_xml_predicate'(Stream, Functor, Arity, protected)), + ; '$lgt_write_xml_predicate'(Stream, Functor, Arity, protected) + ), fail. '$lgt_write_xml_protected_predicates'(Stream) :- @@ -9717,10 +9779,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_private_predicates'(Stream) :- '$lgt_write_xml_open_tag'(Stream, private, []), '$lgt_pp_private_'(Functor, Arity), - ('$lgt_pp_non_terminal_'(Functor, Args, Arity) -> + ( '$lgt_pp_non_terminal_'(Functor, Args, Arity) -> '$lgt_write_xml_non_terminal'(Stream, Functor, Args, Arity, private) - ; - '$lgt_write_xml_predicate'(Stream, Functor, Arity, private)), + ; '$lgt_write_xml_predicate'(Stream, Functor, Arity, private) + ), fail. '$lgt_write_xml_private_predicates'(Stream) :- @@ -9737,29 +9799,29 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_predicate_data'(Stream, Functor, Arity, Functor/Arity, Scope), '$lgt_write_xml_predicate_meta'(Stream, Functor, Arity), '$lgt_write_xml_predicate_mode'(Stream, Functor, Arity), - ('$lgt_pp_info_'(Functor/Arity, Info) -> + ( '$lgt_pp_info_'(Functor/Arity, Info) -> '$lgt_write_xml_predicate_info'(Stream, Functor, Arity, Info) - ; - true), + ; true + ), '$lgt_write_xml_close_tag'(Stream, predicate). '$lgt_write_xml_predicate_data'(Stream, Functor, Arity, Name, Scope) :- '$lgt_write_xml_cdata_element'(Stream, name, [], Name), '$lgt_write_xml_element'(Stream, scope, [], Scope), - (('$lgt_pp_entity'(_, _, _, _, (dynamic)); '$lgt_pp_dynamic_'(Functor, Arity)) -> + ( ('$lgt_pp_entity'(_, _, _, _, (dynamic)); '$lgt_pp_dynamic_'(Functor, Arity)) -> Compilation = (dynamic) - ; - Compilation = static), + ; Compilation = static + ), '$lgt_write_xml_element'(Stream, compilation, [], Compilation). '$lgt_write_xml_predicate_meta'(Stream, Functor, Arity) :- functor(Meta, Functor, Arity), - ('$lgt_pp_metapredicate_'(Meta) -> + ( '$lgt_pp_metapredicate_'(Meta) -> '$lgt_write_xml_cdata_element'(Stream, meta, [], Meta) - ; - true). + ; true + ). '$lgt_write_xml_predicate_mode'(Stream, Functor, Arity) :- @@ -9773,11 +9835,11 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_predicate_info'(Stream, Functor, Arity, Info) :- - ('$lgt_member'(comment is Comment, Info) -> + ( '$lgt_member'(comment is Comment, Info) -> '$lgt_write_xml_cdata_element'(Stream, comment, [], Comment) - ; - true), - ('$lgt_member'(arguments is Arguments, Info) -> + ; true + ), + ( '$lgt_member'(arguments is Arguments, Info) -> findall(Name, '$lgt_member'(Name - _, Arguments), Names), Template =.. [Functor| Names], '$lgt_write_xml_cdata_element'(Stream, template, [], Template), @@ -9789,14 +9851,14 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_cdata_element'(Stream, description, [], Description), '$lgt_write_xml_close_tag'(Stream, argument))), '$lgt_write_xml_close_tag'(Stream, arguments) - ; - true), - ('$lgt_member'(argnames is Names, Info) -> + ; true + ), + ( '$lgt_member'(argnames is Names, Info) -> Template =.. [Functor| Names], '$lgt_write_xml_cdata_element'(Stream, template, [], Template) - ; - true), - ('$lgt_member'(exceptions is Exceptions, Info) -> + ; true + ), + ( '$lgt_member'(exceptions is Exceptions, Info) -> '$lgt_write_xml_open_tag'(Stream, exceptions, []), forall( '$lgt_member'(Cond-Term, Exceptions), @@ -9805,8 +9867,8 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_cdata_element'(Stream, term, [], Term), '$lgt_write_xml_close_tag'(Stream, exception))), '$lgt_write_xml_close_tag'(Stream, exceptions) - ; - true), + ; true + ), forall( ('$lgt_member'(Key is Value, Info), \+ '$lgt_member'(Key, [comment, arguments, argnames, exceptions, examples])), @@ -9814,7 +9876,7 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_element'(Stream, key, [], Key), '$lgt_write_xml_cdata_element'(Stream, value, [], Value), '$lgt_write_xml_close_tag'(Stream, info))), - ('$lgt_member'(examples is Examples, Info) -> + ( '$lgt_member'(examples is Examples, Info) -> '$lgt_write_xml_open_tag'(Stream, examples, []), forall( '$lgt_member'((Description - Call - {Bindings}), Examples), @@ -9825,8 +9887,8 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_cdata_element'(Stream, bindings, [], QBindings), '$lgt_write_xml_close_tag'(Stream, example))), '$lgt_write_xml_close_tag'(Stream, examples) - ; - true). + ; true + ). @@ -9838,10 +9900,10 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_open_tag'(Stream, predicate, []), '$lgt_write_xml_predicate_data'(Stream, Functor, Arity, Functor//Args, Scope), '$lgt_write_xml_predicate_mode'(Stream, Functor, Args), - ('$lgt_pp_info_'(Functor//Args, Info) -> + ( '$lgt_pp_info_'(Functor//Args, Info) -> '$lgt_write_xml_predicate_info'(Stream, Functor, Args, Info) - ; - true), + ; true + ), '$lgt_write_xml_close_tag'(Stream, predicate). @@ -9882,14 +9944,14 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_relations'(Stream) :- '$lgt_pp_entity'(_, Entity, _, _, _), - '$lgt_pp_uses_'(Obj), - '$lgt_write_xml_relation'(Stream, Entity, Obj, uses), + '$lgt_pp_uses_'(Obj), + '$lgt_write_xml_relation'(Stream, Entity, Obj, uses), fail. '$lgt_write_xml_relations'(Stream) :- '$lgt_pp_entity'(_, Entity, _, _, _), - '$lgt_pp_calls_'(Ptc), - '$lgt_write_xml_relation'(Stream, Entity, Ptc, calls), + '$lgt_pp_calls_'(Ptc), + '$lgt_write_xml_relation'(Stream, Entity, Ptc, calls), fail. '$lgt_write_xml_relations'(Stream) :- @@ -9919,15 +9981,15 @@ current_logtalk_flag(version, version(2, 27, 0)). '$lgt_write_xml_remarks'(Stream) :- '$lgt_write_xml_open_tag'(Stream, remarks, []), - (('$lgt_pp_info_'(Info), '$lgt_member'(remarks is Remarks, Info)) -> + ( '$lgt_pp_info_'(Info), '$lgt_member'(remarks is Remarks, Info) -> forall( '$lgt_member'((Topic - Text), Remarks), ('$lgt_write_xml_open_tag'(Stream, remark, []), '$lgt_write_xml_cdata_element'(Stream, topic, [], Topic), '$lgt_write_xml_cdata_element'(Stream, text, [], Text), '$lgt_write_xml_close_tag'(Stream, remark))) - ; - true), + ; true + ), '$lgt_write_xml_close_tag'(Stream, remarks). @@ -10275,25 +10337,19 @@ current_logtalk_flag(version, version(2, 27, 0)). -% '$lgt_assert_hook_goal' +% '$lgt_assert_default_hook_goal' % -% asserts the compiler hook goal +% asserts the compiler hook goal specified on the config file -'$lgt_assert_hook_goal' :- - '$lgt_default_flag'(hook, Obj::Functor), - Call =.. [Functor, Term, Terms], - ( Obj == user -> - Goal = Call - ; '$lgt_tr_msg'(Call, Obj, Goal, user)), - retractall('$lgt_hook_goal_'(_, _)), - assertz(('$lgt_hook_goal_'(Term, Terms) :- catch(Goal, _, fail))), - !. - -'$lgt_assert_hook_goal'. +'$lgt_assert_default_hook_goal' :- + ( '$lgt_default_flag'(hook, Hook) -> + '$lgt_compile_hook'(Hook) + ; true + ). -:- initialization(('$lgt_startup_message', '$lgt_assert_hook_goal')). +:- initialization(('$lgt_startup_message', '$lgt_assert_default_hook_goal')). diff --git a/library/logtalk/yap.config b/library/logtalk/yap.config index 8caaf988a..9fd844ad6 100644 --- a/library/logtalk/yap.config +++ b/library/logtalk/yap.config @@ -1,11 +1,11 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Logtalk - Object oriented extension to Prolog -% Release 2.27.0 +% Release 2.27.1 % % configuration file for YAP Prolog 4.3.23 and later versions % -% last updated: January 12, 2006 +% last updated: March 24, 2006 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -247,8 +247,8 @@ forall(Generate, Test) :- % '$lgt_alt_directory'(?atom, ?atom) -'$lgt_alt_directory'(prolog, '.logtalk/'). -'$lgt_alt_directory'(xml, 'xmldocs/'). +'$lgt_alt_directory'(prolog, 'lgt_temp/'). +'$lgt_alt_directory'(xml, 'xml_docs/'). @@ -332,14 +332,6 @@ forall(Generate, Test) :- '$lgt_is_proper_list'(Tail). -'$lgt_reverse'(List, Reversed) :- - '$lgt_reverse'(List, [], Reversed, Reversed). - -'$lgt_reverse'([], Reversed, Reversed, []). -'$lgt_reverse'([Head| Tail], List, Reversed, [_| Bound]) :- - '$lgt_reverse'(Tail, [Head| List], Reversed, Bound). - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%