Logtalk 2.25.0 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1288 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
		| @@ -859,8 +859,8 @@ p_prompt (void) | ||||
| #include <readline/readline.h> | ||||
| #endif | ||||
|  | ||||
| extern void add_history (const char *); | ||||
|  | ||||
| /* extern void add_history (const char *); | ||||
| */ | ||||
| static char *ttyptr = NULL; | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -40,17 +40,19 @@ directory can be copied to any location that its accessible by all the users | ||||
| for some reason, not feasible or desired). | ||||
|  | ||||
| The "scripts" sub-directory contains shell scripts for easy installation of  | ||||
| Logtalk on Windows, Unix, and Unix-like operating systems (for details,  | ||||
| see the "scripts/NOTES" file). After running the appropriated script for your  | ||||
| operating-system, the second step will be to run the Prolog integration  | ||||
| scripts that you find on the "scripts" sub-directory, assuming that your  | ||||
| favorite Prolog compilers are supported (if that is not the case, don't | ||||
| worry: just follow the steps described in the "QUICK_START" file). The third  | ||||
| step is for each user to make a local copy of the Logtalk user-modifiable  | ||||
| files to its home directory. This allows each user to easily customize  | ||||
| Logtalk to its needs. These copies can be easily made by instructing end-users  | ||||
| to simply run the shell command "cplgtdirs" (the corresponding scripts are  | ||||
| described in the "scripts/NOTES" file). | ||||
| Logtalk on MacOS X, Windows, Linux, and Unix-like operating systems (see the  | ||||
| "scripts/NOTES" file for details). | ||||
|  | ||||
| After running the appropriated script for your operating-system, the second  | ||||
| step will be to run the Prolog integration scripts that you find on the  | ||||
| "scripts" sub-directory, assuming that your favorite Prolog compilers are  | ||||
| supported (if that is not the case, don't worry: just follow the steps  | ||||
| described in the "QUICK_START" file). The third step is for each user to  | ||||
| make a local copy of the Logtalk user-modifiable files to its home directory. | ||||
| This allows each user to easily customize Logtalk to its needs. These copies  | ||||
| can be easily made by instructing end-users to simply run the shell command  | ||||
| "cplgtdirs" (the corresponding scripts are described in the "scripts/NOTES"  | ||||
| file). | ||||
|  | ||||
| The "scripts/lgt_install.*" installation scripts make all files read-only in  | ||||
| order to avoid user tempering. This is a convenient setup for computer labs,  | ||||
| @@ -161,7 +163,7 @@ the file "$LOGTALKUSER/xml/NOTES". | ||||
| 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 "scripts" sub-directory contains several scripts | ||||
| 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.  | ||||
| and the Logtalk compiler. The "$LOGTALKHOME/scripts" sub-directory contains  | ||||
| several scripts 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.  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -81,7 +81,7 @@ with just the word "help" in the subject or in the message body. | ||||
| Installing Logtalk is just a matter of uncompressing/unpacking the | ||||
| distribution archive file for your operating system. You can install | ||||
| Logtalk in any directory that you find convenient. See the file INSTALL  | ||||
| for further instructions. | ||||
| for detailed instructions on how to customize your working environment. | ||||
|  | ||||
| See the user manual for a description of the source files organization  | ||||
| and for using instructions (to read the user manual open the file  | ||||
| @@ -98,7 +98,7 @@ to run Logtalk, provided that your favorite Prolog compiler is supported. | ||||
| 7. DOCUMENTATION | ||||
|  | ||||
| The reference and user manuals and the tutorial are provided in XHTML format  | ||||
| and are contained in the manuals directory. | ||||
| and can be found in the manuals directory. | ||||
|  | ||||
| PDF versions of all documentation are also available as a separated download  | ||||
| from the Logtalk web site. The PDF files include page numbers, an index, and  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -10,6 +10,37 @@ RELEASE NOTES | ||||
| ============= | ||||
|  | ||||
|  | ||||
| 2.25.0 - May 23, 2005 | ||||
|  | ||||
| 	Logtalk compiler is now source file-based instead of entity-based. Thus,  | ||||
| 	a source file may now contain any number of entities, without the need of  | ||||
| 	using source metafiles. Therefore, this version drops support for source  | ||||
| 	metafiles and the .mlgt file name extension. | ||||
|  | ||||
| 	The experimental encoding/1 directive, when used, must be the first term  | ||||
| 	on a source file.  Added an entry to the reference manual describing the  | ||||
| 	directive. Improved "encodings" example. | ||||
|  | ||||
| 	Added a new method, debugging/1, to the "debugger" pseudo-object for  | ||||
| 	querying the system about entities compiled in debug mode. | ||||
|  | ||||
| 	Improved source file and entity compilation and loading reporting. In  | ||||
| 	particular, when using library notation for source files, the Logtalk  | ||||
| 	compiler now prints the library path containing the source files being  | ||||
| 	compiled or loaded. | ||||
|  | ||||
| 	Added new shell scripts, makeall_lgt.*, which run all the make_*lgt.*  | ||||
| 	shell scripts in sequence. | ||||
|  | ||||
| 	Simplified compiler reporting of singleton variables in directives and  | ||||
| 	clauses. | ||||
|  | ||||
| 	Added an adaption of the "timetables" LPA Prolog++ example. | ||||
|  | ||||
| 	Updated B-Prolog config file for the new 6.7 #2 version. Dropped support  | ||||
| 	for older versions of B-Prolog. | ||||
|  | ||||
|  | ||||
| 2.24.0 - April 22, 2005 | ||||
|  | ||||
| 	Added experimental support for a encoding/1 directive for declaring the  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -105,4 +105,10 @@ release notes for details). If you are using custom config files, be sure to | ||||
| update them by coping the definition of the new predicates. | ||||
|  | ||||
| Logtalk version 2.23.0 features new, optimized implementations of the database | ||||
| built-in methods, implying recompilation of all objects, protocols, and categories. | ||||
| built-in methods, implying the recompilation of all objects, protocols, and  | ||||
| categories. | ||||
|  | ||||
| Logtalk version 2.25.0 drops support for source metafiles and .mlgt file name  | ||||
| extension as this version features a new, file-based compiler, supporting the  | ||||
| definition of any number of entities in a single file. Older code using source  | ||||
| metafiles will need to rename the file name extensions from .mlgt to .lgt. | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -23,7 +23,7 @@ Some examples may redefine objects already loaded from other examples. | ||||
| You may want to restart Logtalk after trying each example. | ||||
|  | ||||
| Some of the examples code have been adopted from public available Prolog  | ||||
| code and from known Prolog text books and are copyrighted by the respective  | ||||
| code or from known Prolog text books and are copyrighted by the respective  | ||||
| authors. | ||||
|  | ||||
| These are programming examples, meaning that you should study the source  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -10,4 +10,4 @@ To load this example and for sample queries, please see the SCRIPT | ||||
| file. | ||||
|  | ||||
| For a description of this example, please see the comments in the  | ||||
| aliases.mlgt metafile. | ||||
| aliases.lgt source file. | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -30,6 +30,23 @@ yes | ||||
| Side = 2  | ||||
| yes | ||||
|  | ||||
| | ?- square(2)::predicate_property(side(_), Property). | ||||
|  | ||||
| Property = public ; | ||||
| Property = static ; | ||||
| Property = declared_in(rectangle(_G264, _G265)) ; | ||||
| Property = defined_in(rectangle(_G297, _G298)) ; | ||||
| Property = alias(width(_G182)) | ||||
| yes | ||||
|  | ||||
| | ?- square(2)::predicate_property(width(_), Property). | ||||
|  | ||||
| Property = public ; | ||||
| Property = static ; | ||||
| Property = declared_in(rectangle(_G262, _G263)) ; | ||||
| Property = defined_in(rectangle(_G293, _G294)) | ||||
| yes | ||||
|  | ||||
|  | ||||
| % check the object circle(_) public protocol: | ||||
|  | ||||
|   | ||||
							
								
								
									
										70
									
								
								Logtalk/examples/aliases/aliases.lgt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								Logtalk/examples/aliases/aliases.lgt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| /* | ||||
| This example illustrates the use of the predicate directive alias/3 for  | ||||
| defining alternative names for inherited predicates. | ||||
| */ | ||||
|  | ||||
|  | ||||
| % first, we define a simple parametric object for representing rectangles: | ||||
|  | ||||
| :- object(rectangle(_Width, _Height)). | ||||
|  | ||||
| 	:- public(width/1). | ||||
| 	:- public(height/1). | ||||
| 	:- public(area/1). | ||||
|  | ||||
| 	width(Width) :- | ||||
| 		parameter(1, Width). | ||||
|  | ||||
| 	height(Height) :- | ||||
| 		parameter(2, Height). | ||||
|  | ||||
| 	area(Area) :- | ||||
| 		::width(Width), | ||||
| 		::height(Height), | ||||
| 		Area is Width*Height. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % next, we define a square object which adds an alias, side/1, for the  | ||||
| % inherited predicate width/1: | ||||
|  | ||||
| :- object(square(Side), | ||||
| 	extends(rectangle(Side, Side))). | ||||
|  | ||||
| 	:- alias(rectangle(_, _), width/1, side/1). | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % a similar example can be defined using ellipses and circles: | ||||
|  | ||||
| :- object(ellipse(_RX, _RY)). | ||||
|  | ||||
| 	:- public(rx/1). | ||||
| 	:- public(ry/1). | ||||
| 	:- public(area/1). | ||||
|  | ||||
| 	rx(Rx) :- | ||||
| 		parameter(1, Rx). | ||||
|  | ||||
| 	ry(Ry) :- | ||||
| 		parameter(2, Ry). | ||||
|  | ||||
| 	area(Area) :- | ||||
| 		::rx(Rx), | ||||
| 		::ry(Ry), | ||||
| 		Area is Rx*Ry*3.1415927. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % in this case, we define an alias named r/1 for the inherited  | ||||
| % predicate rx/1: | ||||
|  | ||||
| :- object(circle(Radius), | ||||
| 	extends(ellipse(Radius, Radius))). | ||||
|  | ||||
| 	:- alias(ellipse(_, _), rx/1, r/1). | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -34,7 +34,7 @@ | ||||
| 		write('Bird identification expert system'), nl, nl, | ||||
| 		forall( | ||||
|  			(order::leaf(Bird), check(Bird)), | ||||
| 			(nl, write('Possible identification : '), write(Bird), nl)), | ||||
| 			(nl, write('Possible identification: '), write(Bird), nl)), | ||||
| 		nl, write('No (more) candidates found.'). | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -12,7 +12,7 @@ Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ... | ||||
|  | ||||
|  | ||||
| % first variant of the "diamond problem", defined in the "diamond1" metafile: | ||||
| % first variant of the "diamond problem", defined in the "diamond1" source file: | ||||
|  | ||||
| | ?- d1::m. | ||||
|  | ||||
| @@ -20,7 +20,7 @@ Redefinition of method m/0 in object b1 | ||||
| yes | ||||
|  | ||||
|  | ||||
| % second variant of the "diamond problem", defined in the "diamond2" metafile: | ||||
| % second variant of the "diamond problem", defined in the "diamond2" source file: | ||||
|  | ||||
| | ?- d2::m. | ||||
|  | ||||
| @@ -28,7 +28,7 @@ Redefinition of method m/0 in object c2 | ||||
| yes | ||||
|  | ||||
|  | ||||
| % third variant of the "diamond problem", defined in the "diamond3" metafile: | ||||
| % third variant of the "diamond problem", defined in the "diamond3" source file: | ||||
|  | ||||
| | ?- d3::b3_m. | ||||
|  | ||||
|   | ||||
							
								
								
									
										57
									
								
								Logtalk/examples/diamonds/diamond1.lgt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								Logtalk/examples/diamonds/diamond1.lgt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| /* | ||||
| These objects illustrate a variant of the "diamond problem" using  | ||||
| a prototype hierarchy. | ||||
|  | ||||
| In this simple case, the inherited definition which will be used in the   | ||||
| bottom object is determined by the Logtalk predicate lookup algorithm.  | ||||
| */ | ||||
|  | ||||
|  | ||||
| % root object, declaring and defining a predicate m/0: | ||||
|  | ||||
| :- object(a1). | ||||
|  | ||||
| 	:- public(m/0). | ||||
|  | ||||
| 	m :- | ||||
| 		this(This), | ||||
| 		write('Default definition of method m/0 in object '), | ||||
| 		write(This), nl. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % an object descending from the root object, which redefines predicate m/0: | ||||
|  | ||||
| :- object(b1, | ||||
| 	extends(a1)). | ||||
|  | ||||
| 	m :- | ||||
| 		this(This), | ||||
| 		write('Redefinition of method m/0 in object '), | ||||
| 		write(This), nl. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % another object descending from the root object, which also redefines predicate m/0: | ||||
|  | ||||
| :- object(c1, | ||||
| 	extends(a1)). | ||||
|  | ||||
| 	m :- | ||||
| 		this(This), | ||||
| 		write('Redefinition of method m/0 in object '), | ||||
| 		write(This), nl. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % bottom object, descending from the two previous objects and, as such, inheriting | ||||
| % two definitions for the predicate m/0: | ||||
|  | ||||
| :- object(d1, | ||||
| 	extends(b1, c1)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
							
								
								
									
										64
									
								
								Logtalk/examples/diamonds/diamond2.lgt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								Logtalk/examples/diamonds/diamond2.lgt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,64 @@ | ||||
| /* | ||||
| These objects illustrate a variant of the "diamond problem" using  | ||||
| a prototype hierarchy. | ||||
|  | ||||
| In this simple case, a solution for making the overridden definition inherited  | ||||
| by the bottom object the visible one is implemented using the alias/3 predicate  | ||||
| directive.  | ||||
| */ | ||||
|  | ||||
|  | ||||
| % root object, declaring and defining a predicate m/0: | ||||
|  | ||||
| :- object(a2). | ||||
|  | ||||
| 	:- public(m/0). | ||||
|  | ||||
| 	m :- | ||||
| 		this(This), | ||||
| 		write('Default definition of method m/0 in object '), | ||||
| 		write(This), nl. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % an object descending from the root object, which redefines predicate m/0: | ||||
|  | ||||
| :- object(b2, | ||||
| 	extends(a2)). | ||||
|  | ||||
| 	m :- | ||||
| 		this(This), | ||||
| 		write('Redefinition of method m/0 in object '), | ||||
| 		write(This), nl. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % another object descending from the root object, which also redefines predicate m/0: | ||||
|  | ||||
| :- object(c2, | ||||
| 	extends(a2)). | ||||
|  | ||||
| 	m :- | ||||
| 		this(This), | ||||
| 		write('Redefinition of method m/0 in object '), | ||||
| 		write(This), nl. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % bottom object, descending from the two previous objects and, as such, inheriting | ||||
| % two definitions for the predicate m/0; the overridden definition inherited from  | ||||
| % object "c2" is renamed using the alias/3 directive and then we redefine the  | ||||
| % predicate m/0 to call the renamed definition: | ||||
|  | ||||
| :- object(d2, | ||||
| 	extends(b2, c2)). | ||||
|  | ||||
| 	:- alias(c2, m/0, c2_m/0). | ||||
| 	 | ||||
| 	m :- | ||||
| 		::c2_m. | ||||
|  | ||||
| :- end_object. | ||||
							
								
								
									
										61
									
								
								Logtalk/examples/diamonds/diamond3.lgt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								Logtalk/examples/diamonds/diamond3.lgt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| /* | ||||
| These objects illustrate a variant of the "diamond problem" using  | ||||
| a prototype hierarchy. | ||||
|  | ||||
| In this simple case, a solution is presented for making two conflicting  | ||||
| definitions inherited by the bottom object visible through the use of the  | ||||
| alias/3 predicate directive.  | ||||
| */ | ||||
|  | ||||
|  | ||||
| % root object, declaring and defining a predicate m/0: | ||||
|  | ||||
| :- object(a3). | ||||
|  | ||||
| 	:- public(m/0). | ||||
|  | ||||
| 	m :- | ||||
| 		this(This), | ||||
| 		write('Default definition of method m/0 in object '), | ||||
| 		write(This), nl. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % an object descending from the root object, which redefines predicate m/0: | ||||
|  | ||||
| :- object(b3, | ||||
| 	extends(a3)). | ||||
|  | ||||
| 	m :- | ||||
| 		this(This), | ||||
| 		write('Redefinition of method m/0 in object '), | ||||
| 		write(This), nl. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % another object descending from the root object, which also redefines predicate m/0: | ||||
|  | ||||
| :- object(c3, | ||||
| 	extends(a3)). | ||||
|  | ||||
| 	m :- | ||||
| 		this(This), | ||||
| 		write('Redefinition of method m/0 in object '), | ||||
| 		write(This), nl. | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| % bottom object, descending from the two previous objects and, as such, inheriting | ||||
| % two definitions for the predicate m/0; both inherited definitions are renamed  | ||||
| % using the alias/3 directive: | ||||
|  | ||||
| :- object(d3, | ||||
| 	extends(b3, c3)). | ||||
|  | ||||
| 	:- alias(b3, m/0, b3_m/0). | ||||
| 	:- alias(c3, m/0, c3_m/0). | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -13,8 +13,23 @@ directive, which is fully based on the directive with the same name found | ||||
| on recent development releases of SWI-Prolog. Currently, this example  | ||||
| requires Logtalk to be run with the SWI-Prolog compiler. | ||||
|  | ||||
| The "babel.lgt" source file uses UTF-8 encoding. When browsing its code,  | ||||
| be sure to use a text editor that supports this encoding. In addition,  | ||||
| you may need to configure your text editor to open the source file using  | ||||
| this encoding. If you are using the SWI-Prolog GUI application on Windows,  | ||||
| be sure to select a font which supports Unicode characters. | ||||
| The "babel.lgt" source file uses UTF-8 encoding. The "latin.lgt" source  | ||||
| file uses ISO-8859-1 (Latin 1) encoding. Be sure to use a text editor that  | ||||
| supports these encodings when opening these files. In addition, you may  | ||||
| need to configure your text editor to open the source file using the  | ||||
| declared encoding. If you are using the SWI-Prolog GUI application on  | ||||
| Windows, be sure to select a font which supports Unicode characters. | ||||
|  | ||||
| Currently, Logtalk accepts any atom is an argument for the encoding/1  | ||||
| directive. As, by default, Logtalk automatically generates a XML documenting  | ||||
| file for each compiled entity, the following table is used to set the  | ||||
| encoding of the XML file: | ||||
|  | ||||
| 	Logtalk source file		XML file | ||||
| 	ascii					us-ascii | ||||
| 	iso_latin_1				iso-8859-1 | ||||
| 	unicode_be				utf-16 | ||||
| 	unicode_le				utf-16 | ||||
| 	utf8					utf-8 | ||||
|  | ||||
| Note that the values on the left column are the ones recognized by SWI-Prolog. | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -44,3 +44,18 @@ Code = zh | ||||
| Text = '你好世界!' | ||||
|  | ||||
| Yes | ||||
|  | ||||
|  | ||||
| % query the table of names: | ||||
|  | ||||
| | ?- latin::name(Name). | ||||
|  | ||||
| Name = 'António Simões' ; | ||||
|  | ||||
| Name = 'Cátia Conceição' ; | ||||
|  | ||||
| Name = 'João Raínho' ; | ||||
|  | ||||
| Name = 'Luís Araújo' | ||||
|  | ||||
| Yes | ||||
|   | ||||
							
								
								
									
										24
									
								
								Logtalk/examples/encodings/latin.lgt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								Logtalk/examples/encodings/latin.lgt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
|  | ||||
| :- encoding(iso_latin_1). | ||||
|  | ||||
|  | ||||
| :- object(latin). | ||||
|  | ||||
| 	:- info([ | ||||
| 		version is 1.0, | ||||
| 		author is 'Paulo Moura', | ||||
| 		date is 2005/04/24, | ||||
| 		comment is 'Simple test of the encoding/1 directive.']). | ||||
|  | ||||
| 	:- public(name/1). | ||||
| 	:- mode(name(?atom), zero_or_more). | ||||
| 	:- info(name/1, [ | ||||
| 		comment is 'Table of person names.', | ||||
| 		argnames is ['Name']]). | ||||
|  | ||||
| 	name('Ant<6E>nio Sim<69>es'). | ||||
| 	name('C<>tia Concei<65><69>o'). | ||||
| 	name('Jo<4A>o Ra<52>nho'). | ||||
| 	name('Lu<4C>s Ara<72>jo'). | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,4 +1,5 @@ | ||||
|  | ||||
| :- initialization( | ||||
| 	logtalk_load([ | ||||
| 		babel])).  | ||||
| 		babel, | ||||
| 		latin])).  | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
| @@ -10,4 +10,4 @@ To load this example and for sample queries, please see the SCRIPT | ||||
| file. | ||||
|  | ||||
| For a description of this example, please see the comments in the  | ||||
| engines.mlgt metafile. | ||||
| engines.lgt source file. | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
							
								
								
									
										67
									
								
								Logtalk/examples/engines/engines.lgt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								Logtalk/examples/engines/engines.lgt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| /* | ||||
| This is a simple example of category composition, i.e. importation of  | ||||
| categories by other categories in order to provide modified components  | ||||
| for building objects, using car engines. | ||||
|  | ||||
| The example defines a car engine protocol (enginep), a standard engine  | ||||
| (classic), and an improved version of it (sport). Both engines are then  | ||||
| imported in two car models (sedan and coupe). | ||||
| */ | ||||
|  | ||||
|  | ||||
| % first we define a protocol for describing the characteristics of an engine: | ||||
|  | ||||
| :- protocol(enginep). | ||||
|  | ||||
| 	:- public(reference/1). | ||||
| 	:- public(capacity/1). | ||||
| 	:- public(cylinders/1). | ||||
| 	:- public(horsepower_rpm/2). | ||||
| 	:- public(bore_stroke/2). | ||||
| 	:- public(fuel/1). | ||||
|  | ||||
| :- end_protocol. | ||||
|  | ||||
|  | ||||
| % second, we can define a typical engine as a category, which will be used  | ||||
| % when "assembling" cars: | ||||
|  | ||||
| :- category(classic, | ||||
| 	implements(enginep)). | ||||
|  | ||||
| 	reference('M180.940'). | ||||
| 	capacity(2195). | ||||
| 	cylinders(6). | ||||
| 	horsepower_rpm(94, 4800). | ||||
| 	bore_stroke(80, 72.8). | ||||
| 	fuel(gasoline). | ||||
|  | ||||
| :- end_category. | ||||
|  | ||||
|  | ||||
| % next, we define a souped up version of the previous engine, which differs  | ||||
| % from the standard one only in its reference and in its horsepower: | ||||
|  | ||||
| :- category(sport, | ||||
| 	imports(classic)). | ||||
|  | ||||
| 	reference('M180.941'). | ||||
| 	horsepower_rpm(110, 5000). | ||||
|  | ||||
| :- end_category. | ||||
|  | ||||
|  | ||||
| % with engines (and other components), we may start "assembling" some cars: | ||||
|  | ||||
| :- object(sedan, | ||||
| 	imports(classic)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
|  | ||||
|  | ||||
| :- object(coupe, | ||||
| 	imports(sport)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
							
								
								
									
										16
									
								
								Logtalk/examples/errors/SCRIPT
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								Logtalk/examples/errors/SCRIPT
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|  | ||||
|  | ||||
| % The entities on this example are divided in two sets. To load each  | ||||
| % sets of entities, compile and load the corresponding loader files: | ||||
|  | ||||
| | ?- logtalk_load(errors(warnings_loader)). | ||||
| ... | ||||
|  | ||||
| | ?- logtalk_load(errors(errors_loader)). | ||||
| ... | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,17 +1,11 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|  | ||||
|  | ||||
| To load this example and for sample queries, please see the SCRIPT  | ||||
| file. | ||||
|  | ||||
| This example is an adaptation of a LPA Prolog++ example that is  | ||||
| described in the LPA Prolog++ Reference Manual. This manual can  | ||||
| be downloaded from the LPA web site <http://www.lpa.co.uk>. Please  | ||||
| consult this reference manual for further informations about this  | ||||
| example. | ||||
|  | ||||
| This directory contains examples adaptated from the LPA Prolog++  | ||||
| Reference Manual. This manual can be downloaded from the LPA web  | ||||
| site at <http://www.lpa.co.uk>. Please consult this reference  | ||||
| manual for further informations about each example. | ||||
|   | ||||
| @@ -1,34 +0,0 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|  | ||||
|  | ||||
| % start by loading the necessary library support files (if not  | ||||
| % already loaded): | ||||
|  | ||||
| | ?- logtalk_load(library(hierarchies_loader)). | ||||
| ... | ||||
|  | ||||
|  | ||||
| % now you are ready for loading the example: | ||||
|  | ||||
| | ?- logtalk_load(lpa(loader)). | ||||
| ... | ||||
|  | ||||
|  | ||||
| | ?- fault::findall. | ||||
|  | ||||
| Please answer all questions with yes or no. | ||||
|  | ||||
| The starter turns but the engine doesnt fire?   no. | ||||
| The engine has difficulty starting?     yes. | ||||
| The engine cuts out shortly after starting?     yes. | ||||
|  | ||||
| Location      : distributor | ||||
| Possible Fault: Worn distributor brushes | ||||
|  | ||||
| No (more) explanations found. | ||||
| yes. | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| :- object(cylinders, | ||||
| 	extends(engine)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,25 +0,0 @@ | ||||
|  | ||||
| :- object(distributor, | ||||
| 	extends(sparking)). | ||||
|  | ||||
|  | ||||
| 	fault(f1001, 'Condensation in the distributor cap'). | ||||
| 	fault(f1002, 'Faulty distributor arm'). | ||||
| 	fault(f1003, 'Worn distributor brushes'). | ||||
|  | ||||
| 	symptom(s1001, 'The starter turns but the engine doesnt fire'). | ||||
| 	symptom(s1002, 'The engine has difficulty starting'). | ||||
| 	symptom(s1003, 'The engine cuts out shortly after starting'). | ||||
| 	symptom(s1004, 'The engine cuts out at speed'). | ||||
|  | ||||
| 	effect(f1001, s1001). | ||||
| 	effect(f1002, s1001). | ||||
| 	effect(f1002, s1004). | ||||
| 	effect(f1003, s1002). | ||||
| 	effect(f1003, s1003). | ||||
|  | ||||
| 	contrary(s1002, s1001). | ||||
| 	contrary(s1003, s1001). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| :- object(electrical, | ||||
| 	extends(fault)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| :- object(engine, | ||||
| 	extends(mechanical)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,72 +0,0 @@ | ||||
|  | ||||
| :- object(fault, | ||||
| 	imports(proto_hierarchy)). | ||||
|  | ||||
|  | ||||
| 	:- info([ | ||||
| 		author is 'Paulo Moura', | ||||
| 		version is 1.0, | ||||
| 		date is 2000/4/22, | ||||
| 		comment is 'Expert system for automobile fault diagnosis.', | ||||
| 		source is 'Example adopted from the LPA Prolog++ documentation.']). | ||||
|  | ||||
|  | ||||
| 	:- public(findall/0). | ||||
| 	:- mode(findall, one). | ||||
|  | ||||
| 	:- private(told_by_user_/2). | ||||
| 	:- dynamic(told_by_user_/2). | ||||
| 	:- mode(told_by_user_(?nonvar, ?nonvar), zero_or_more). | ||||
|  | ||||
| 	:- public(find/1). | ||||
| 	:- mode(find(?nonvar), zero_or_more). | ||||
|  | ||||
| 	:- private(exhibited/1). | ||||
| 	:- mode(exhibited(+nonvar), zero_or_one). | ||||
|  | ||||
| 	:- public(contrary/2). | ||||
| 	:- mode(contrary(?nonvar, ?nonvar), zero_or_more). | ||||
|  | ||||
| 	:- public(fault/2). | ||||
| 	:- mode(fault(?nonvar, ?nonvar), zero_or_more). | ||||
|  | ||||
| 	:- public(effect/2). | ||||
| 	:- mode(effect(?nonvar, ?nonvar), zero_or_more). | ||||
|  | ||||
| 	:- public(symptom/2). | ||||
| 	:- mode(symptom(?nonvar, ?nonvar), zero_or_more). | ||||
|  | ||||
|  | ||||
| 	findall :- | ||||
| 		retractall(told_by_user_(_, _)), | ||||
| 		write('Please answer all questions with yes or no.'), nl, nl, | ||||
| 		forall( | ||||
|  			(::descendant(Where), Where::find(Description)), | ||||
| 			(nl, write('Location      : '), write(Where), nl, | ||||
| 			 write('Possible Fault: '), write(Description), nl)), | ||||
| 		nl, write('No (more) explanations found.'). | ||||
|  | ||||
|  | ||||
| 	find(Description) :- | ||||
| 		::fault(Fault, Description), | ||||
| 		forall(::effect(Fault, Symptom), exhibited(Symptom)). | ||||
|  | ||||
|  | ||||
| 	exhibited(Symptom) :- | ||||
| 		told_by_user_(Symptom, Reply), | ||||
| 		!, | ||||
| 		Reply = yes. | ||||
|  | ||||
| 	exhibited(Symptom) :- | ||||
| 		::symptom(Symptom, Description), | ||||
| 		write(Description), write('? '), | ||||
| 		read(Reply), | ||||
| 		asserta(told_by_user_(Symptom, Reply)), | ||||
| 		Reply = yes, | ||||
| 		forall( | ||||
| 			(::contrary(Symptom, Contrary); | ||||
| 			 ::contrary(Contrary, Symptom)), | ||||
| 			asserta(told_by_user_(Contrary, no))). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| :- object(fuel_system, | ||||
| 	extends(fault)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| :- object(lights, | ||||
| 	extends(electrical)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,15 +0,0 @@ | ||||
|  | ||||
| :- initialization( | ||||
| 	logtalk_load([ | ||||
| 		fault, | ||||
| 		mechanical, | ||||
| 		engine, | ||||
| 		cylinders, | ||||
| 		electrical, | ||||
| 		starting, | ||||
| 		sparking, | ||||
| 		plugs, | ||||
| 		distributor, | ||||
| 		fuel_system, | ||||
| 		lights, | ||||
| 		starter_motor])). | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| :- object(mechanical, | ||||
|         extends(fault)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| :- object(plugs, | ||||
| 	extends(sparking)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| :- object(sparking, | ||||
| 	extends(starting)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| :- object(starter_motor, | ||||
| 	extends(starting)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +0,0 @@ | ||||
|  | ||||
| :- object(starting, | ||||
| 	extends(electrical)). | ||||
|  | ||||
|  | ||||
| :- end_object. | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,12 +1,19 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|  | ||||
|  | ||||
| % start by loading the example: | ||||
| % start by loading the necessary library support files (if not  | ||||
| % already loaded): | ||||
|  | ||||
| | ?- logtalk_load(library(types_loader)). | ||||
| ... | ||||
|  | ||||
|  | ||||
| % now you are ready for loading the example: | ||||
|  | ||||
| | ?- logtalk_load(msglog(loader)). | ||||
| ... | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| ================================================================= | ||||
| Logtalk - Object oriented extension to Prolog | ||||
| Release 2.24.0 | ||||
| Release 2.25.0 | ||||
|  | ||||
| Copyright (c) 1998-2005 Paulo Moura.  All Rights Reserved. | ||||
| ================================================================= | ||||
|   | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user