From 025dd6214f6e1c80b415eaefc4462562705f4995 Mon Sep 17 00:00:00 2001 From: pmoura Date: Tue, 6 Nov 2007 01:58:56 +0000 Subject: [PATCH] Logtalk 2.30.7 files. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1974 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- Logtalk/examples/testing/NOTES.txt | 14 + Logtalk/examples/testing/SCRIPT.txt | 15 + Logtalk/examples/testing/loader.lgt | 4 + Logtalk/examples/testing/testing.lgt | 134 +++++++ Logtalk/examples/threads/barriers/NOTES.txt | 11 + Logtalk/examples/threads/barriers/SCRIPT.txt | 22 ++ Logtalk/examples/threads/barriers/beatles.lgt | 36 ++ Logtalk/examples/threads/barriers/loader.lgt | 4 + Logtalk/examples/threads/tak/NOTES.txt | 13 + Logtalk/examples/threads/tak/SCRIPT.txt | 54 +++ Logtalk/examples/threads/tak/loader.lgt | 3 + Logtalk/examples/threads/tak/tak.lgt | 52 +++ Logtalk/integration/logtalk_comp_xsbmt.pl | 71 ++++ Logtalk/integration/logtalk_qp.pl | 19 + Logtalk/integration/logtalk_xsbmt.pl | 16 + Logtalk/integration/qplgt.sh | 60 ++++ Logtalk/integration/xsbmtlgt.sh | 60 ++++ Logtalk/library/lgtunit.lgt | 140 ++++++++ Logtalk/library/lgtunit.notes | 15 + .../refman/builtins/threaded_call1_2.html | 75 ++++ .../refman/builtins/threaded_exit1_2.html | 80 +++++ .../refman/builtins/threaded_once1_2.html | 75 ++++ .../refman/builtins/threaded_peek1_2.html | 78 ++++ Logtalk/scripts/macosx/Portfile | 73 ++++ Logtalk/wenv/gtksourceview2/NOTES.txt | 26 ++ Logtalk/wenv/gtksourceview2/logtalk.lang | 335 ++++++++++++++++++ 26 files changed, 1485 insertions(+) create mode 100644 Logtalk/examples/testing/NOTES.txt create mode 100644 Logtalk/examples/testing/SCRIPT.txt create mode 100644 Logtalk/examples/testing/loader.lgt create mode 100644 Logtalk/examples/testing/testing.lgt create mode 100644 Logtalk/examples/threads/barriers/NOTES.txt create mode 100644 Logtalk/examples/threads/barriers/SCRIPT.txt create mode 100644 Logtalk/examples/threads/barriers/beatles.lgt create mode 100644 Logtalk/examples/threads/barriers/loader.lgt create mode 100644 Logtalk/examples/threads/tak/NOTES.txt create mode 100644 Logtalk/examples/threads/tak/SCRIPT.txt create mode 100644 Logtalk/examples/threads/tak/loader.lgt create mode 100644 Logtalk/examples/threads/tak/tak.lgt create mode 100644 Logtalk/integration/logtalk_comp_xsbmt.pl create mode 100644 Logtalk/integration/logtalk_qp.pl create mode 100644 Logtalk/integration/logtalk_xsbmt.pl create mode 100755 Logtalk/integration/qplgt.sh create mode 100755 Logtalk/integration/xsbmtlgt.sh create mode 100644 Logtalk/library/lgtunit.lgt create mode 100644 Logtalk/library/lgtunit.notes create mode 100644 Logtalk/manuals/refman/builtins/threaded_call1_2.html create mode 100644 Logtalk/manuals/refman/builtins/threaded_exit1_2.html create mode 100644 Logtalk/manuals/refman/builtins/threaded_once1_2.html create mode 100644 Logtalk/manuals/refman/builtins/threaded_peek1_2.html create mode 100644 Logtalk/scripts/macosx/Portfile create mode 100644 Logtalk/wenv/gtksourceview2/NOTES.txt create mode 100644 Logtalk/wenv/gtksourceview2/logtalk.lang diff --git a/Logtalk/examples/testing/NOTES.txt b/Logtalk/examples/testing/NOTES.txt new file mode 100644 index 000000000..a18c2d371 --- /dev/null +++ b/Logtalk/examples/testing/NOTES.txt @@ -0,0 +1,14 @@ +================================================================ +Logtalk - Open source object-oriented logic programming language +Release 2.30.7 + +Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved. +================================================================ + + +This folder contains a preliminary framework for defining and running +unit tests in Logtalk. + +The unit tests framework is inspired on the works of Joachim Schimpf +(ECLiPSe library "test_util") and Jan Wielemaker (SWI-Prolog "plunit" +package). diff --git a/Logtalk/examples/testing/SCRIPT.txt b/Logtalk/examples/testing/SCRIPT.txt new file mode 100644 index 000000000..393e09a8f --- /dev/null +++ b/Logtalk/examples/testing/SCRIPT.txt @@ -0,0 +1,15 @@ +================================================================ +Logtalk - Open source object-oriented logic programming language +Release 2.30.7 + +Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved. +================================================================ + + +% start by loading the example: + +| ?- logtalk_load(testing(loader)). +... + + +% take a look at the "results.txt" file in the example directory \ No newline at end of file diff --git a/Logtalk/examples/testing/loader.lgt b/Logtalk/examples/testing/loader.lgt new file mode 100644 index 000000000..093b3d154 --- /dev/null +++ b/Logtalk/examples/testing/loader.lgt @@ -0,0 +1,4 @@ + +:- initialization(( + logtalk_load(library(lgtunit), [reload(skip)]), % allow for static binding + logtalk_load(testing))). diff --git a/Logtalk/examples/testing/testing.lgt b/Logtalk/examples/testing/testing.lgt new file mode 100644 index 000000000..261f5cdcf --- /dev/null +++ b/Logtalk/examples/testing/testing.lgt @@ -0,0 +1,134 @@ + +:- object(ctx_call_tests, + extends(lgtunit)). + + :- info([ + version is 1.0, + author is 'Paulo Moura', + date is 2007/04/17, + comment is 'Tests < Y, + X1 is X - 1, + tak_st(X1, Y, Z, A1), + Y1 is Y - 1, + tak_st(Y1, Z, X, A2), + Z1 is Z - 1, + tak_st(Z1, X, Y, A3), + tak_st(A1, A2, A3, A). + + tak_mt(X, Y, Z, A):- + X =< Y, + Z = A. + tak_mt(X, Y, Z, A):- + X > Y, + X1 is X - 1, + Y1 is Y - 1, + Z1 is Z - 1, + threaded(( + tak_st(X1, Y, Z, A1), + tak_st(Y1, Z, X, A2), + tak_st(Z1, X, Y, A3) + )), + tak_mt(A1, A2, A3, A). + +:- end_object. diff --git a/Logtalk/integration/logtalk_comp_xsbmt.pl b/Logtalk/integration/logtalk_comp_xsbmt.pl new file mode 100644 index 000000000..2fee6b917 --- /dev/null +++ b/Logtalk/integration/logtalk_comp_xsbmt.pl @@ -0,0 +1,71 @@ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Logtalk - Open source object-oriented logic programming language +% Release 2.30.7 +% +% Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +:- import stat_set_flag/2 from machine. % workaround for compiling/loading source files +:- stat_set_flag(79, 1). % when more than one thread is active + +:- compiler_options([xpp_on]). + +#include ../compiler/logtalk.pl + +% tables of defined events and monitors +:- thread_shared('$lgt_before_'(_, _, _, _, _)). +:- thread_shared('$lgt_after_'(_, _, _, _, _)). + +% tables of loaded entities and respective relationships +:- thread_shared('$lgt_current_protocol_'(_, _, _)). +:- thread_shared('$lgt_current_category_'(_, _, _, _)). +:- thread_shared('$lgt_current_object_'(_, _, _, _, _, _, _, _)). + +:- thread_shared('$lgt_implements_protocol_'(_, _, _)). +:- thread_shared('$lgt_imports_category_'(_, _, _)). +:- thread_shared('$lgt_instantiates_class_'(_, _, _)). +:- thread_shared('$lgt_specializes_class_'(_, _, _)). +:- thread_shared('$lgt_extends_protocol_'(_, _, _)). +:- thread_shared('$lgt_extends_object_'(_, _, _)). + +% table of loaded files +:- thread_shared('$lgt_loaded_file_'(_, _)). + +% debugger status and tables +:- thread_shared('$lgt_debugging_'(_)). + +:- thread_shared('$lgt_dbg_debugging_'). +:- thread_shared('$lgt_dbg_tracing_'). +:- thread_shared('$lgt_dbg_skipping_'). +:- thread_shared('$lgt_dbg_spying_'(_, _)). +:- thread_shared('$lgt_dbg_spying_'(_, _, _, _)). +:- thread_shared('$lgt_dbg_leashing_'(_)). + +% runtime flags +:- thread_shared('$lgt_current_flag_'(_, _)). + +% static binding caches +:- thread_shared('$lgt_static_binding_entity_'(_)). +:- thread_shared('$lgt_obj_static_binding_cache_'(_, _, _, _)). +:- thread_shared('$lgt_ctg_static_binding_cache_'(_, _, _, _, _, _)). + +% lookup caches for messages to an object, messages to self, and super calls +:- thread_shared('$lgt_obj_lookup_cache_'(_, _, _, _)). +:- thread_shared('$lgt_self_lookup_cache_'(_, _, _, _)). +:- thread_shared('$lgt_super_lookup_cache_'(_, _, _, _, _)). + +% lookup cache for asserting and retracting dynamic facts +:- thread_shared('$lgt_db_lookup_cache_'(_, _, _, _, _)). + +% table of library paths +:- thread_shared(logtalk_library_path(_, _)). + +% compiler hook goal: +:- thread_shared('$lgt_hook_goal_'(_, _)). + +% multi-threading tags +:- thread_shared('$lgt_threaded_tag_counter'(_)). diff --git a/Logtalk/integration/logtalk_qp.pl b/Logtalk/integration/logtalk_qp.pl new file mode 100644 index 000000000..f89f388a0 --- /dev/null +++ b/Logtalk/integration/logtalk_qp.pl @@ -0,0 +1,19 @@ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Logtalk - Open source object-oriented logic programming language +% Release 2.30.7 +% +% Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +:- os(system('ln -sf $LOGTALKUSER/configs/qu.config $LOGTALKUSER/configs/qu.pl')), + fcompile('$LOGTALKUSER/configs/qu.pl', [assemble_only(true)]), + load('$LOGTALKUSER/configs/qu.qo'), + os(system('ln -sf $LOGTALKHOME/compiler/logtalk.pl $LOGTALKUSER/.logtalk.pl')), + fcompile('$LOGTALKUSER/.logtalk.pl', [assemble_only(true), object_file('$LOGTALKUSER/.logtalk.qo'), string_table(256)]), + load('$LOGTALKUSER/.logtalk.qo'), + fcompile('$LOGTALKUSER/libpaths/libpaths.pl', [assemble_only(true)]), + load('$LOGTALKUSER/libpaths/libpaths.qo'). diff --git a/Logtalk/integration/logtalk_xsbmt.pl b/Logtalk/integration/logtalk_xsbmt.pl new file mode 100644 index 000000000..9a13359d7 --- /dev/null +++ b/Logtalk/integration/logtalk_xsbmt.pl @@ -0,0 +1,16 @@ + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Logtalk - Open source object-oriented logic programming language +% Release 2.30.7 +% +% Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +:- import expand_atom/2 from standard. + +:- expand_atom('$LOGTALKUSER/configs/xsb.config', Config), reconsult(Config). +:- expand_atom('$LOGTALKHOME/integration/logtalk_comp_xsbmt.pl', Compiler), reconsult(Compiler). +:- expand_atom('$LOGTALKUSER/libpaths/libpaths.pl', Libpaths), reconsult(Libpaths). diff --git a/Logtalk/integration/qplgt.sh b/Logtalk/integration/qplgt.sh new file mode 100755 index 000000000..06054a84e --- /dev/null +++ b/Logtalk/integration/qplgt.sh @@ -0,0 +1,60 @@ +#/bin/sh + +## ================================================================ +## Logtalk - Open source object-oriented logic programming language +## Release 2.30.7 +## +## Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved. +## ================================================================ + +if ! [ "$LOGTALKHOME" ]; then + echo "The environment variable LOGTALKHOME should be defined first, pointing" + echo "to your Logtalk installation directory!" + echo "Trying the default locations for the Logtalk installation..." + if [ -d "/usr/local/share/logtalk" ]; then + LOGTALKHOME=/usr/local/share/logtalk + echo "... using Logtalk installation found at /usr/local/share/logtalk" + elif [ -d "/usr/share/logtalk" ]; then + LOGTALKHOME=/usr/share/logtalk + echo "... using Logtalk installation found at /usr/share/logtalk" + elif [ -d "/opt/local/share/logtalk" ]; then + LOGTALKHOME=/opt/local/share/logtalk + echo "... using Logtalk installation found at /opt/local/share/logtalk" + elif [ -d "/opt/share/logtalk" ]; then + LOGTALKHOME=/opt/share/logtalk + echo "... using Logtalk installation found at /opt/share/logtalk" + else + echo "... unable to locate Logtalk installation directory!" + echo + exit 1 + fi + echo +elif ! [ -d "$LOGTALKHOME" ]; then + echo "The environment variable LOGTALKHOME points to a non-existing directory!" + echo "Its current value is: $LOGTALKHOME" + echo "The variable must be set to your Logtalk installation directory!" + echo + exit 1 +fi +export LOGTALKHOME + +if ! [ "$LOGTALKUSER" ]; then + echo "The environment variable LOGTALKUSER should be defined first, pointing" + echo "to your Logtalk user directory!" + echo "Trying the default location for the Logtalk user directory..." + export LOGTALKUSER=$HOME/logtalk + if [ -d "$LOGTALKUSER" ]; then + echo "... using Logtalk user directory found at $LOGTALKUSER" + else + echo "... Logtalk user directory not found at default location. Creating a" + echo "new Logtalk user directory by running the \"cplgtdirs\" shell script:" + cplgtdirs + fi +elif ! [ -d "$LOGTALKUSER" ]; then + echo "Cannot find \$LOGTALKUSER directory! Creating a new Logtalk user directory" + echo "by running the \"cplgtdirs\" shell script:" + cplgtdirs +fi +echo + +exec qp -s 3072 -d 1024 -h 2048 -g "['$LOGTALKHOME/integration/logtalk_qp.pl']." "$@" diff --git a/Logtalk/integration/xsbmtlgt.sh b/Logtalk/integration/xsbmtlgt.sh new file mode 100755 index 000000000..41cbefb02 --- /dev/null +++ b/Logtalk/integration/xsbmtlgt.sh @@ -0,0 +1,60 @@ +#/bin/sh + +## ================================================================ +## Logtalk - Open source object-oriented logic programming language +## Release 2.30.7 +## +## Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved. +## ================================================================ + +if ! [ "$LOGTALKHOME" ]; then + echo "The environment variable LOGTALKHOME should be defined first, pointing" + echo "to your Logtalk installation directory!" + echo "Trying the default locations for the Logtalk installation..." + if [ -d "/usr/local/share/logtalk" ]; then + LOGTALKHOME=/usr/local/share/logtalk + echo "... using Logtalk installation found at /usr/local/share/logtalk" + elif [ -d "/usr/share/logtalk" ]; then + LOGTALKHOME=/usr/share/logtalk + echo "... using Logtalk installation found at /usr/share/logtalk" + elif [ -d "/opt/local/share/logtalk" ]; then + LOGTALKHOME=/opt/local/share/logtalk + echo "... using Logtalk installation found at /opt/local/share/logtalk" + elif [ -d "/opt/share/logtalk" ]; then + LOGTALKHOME=/opt/share/logtalk + echo "... using Logtalk installation found at /opt/share/logtalk" + else + echo "... unable to locate Logtalk installation directory!" + echo + exit 1 + fi + echo +elif ! [ -d "$LOGTALKHOME" ]; then + echo "The environment variable LOGTALKHOME points to a non-existing directory!" + echo "Its current value is: $LOGTALKHOME" + echo "The variable must be set to your Logtalk installation directory!" + echo + exit 1 +fi +export LOGTALKHOME + +if ! [ "$LOGTALKUSER" ]; then + echo "The environment variable LOGTALKUSER should be defined first, pointing" + echo "to your Logtalk user directory!" + echo "Trying the default location for the Logtalk user directory..." + export LOGTALKUSER=$HOME/logtalk + if [ -d "$LOGTALKUSER" ]; then + echo "... using Logtalk user directory found at $LOGTALKUSER" + else + echo "... Logtalk user directory not found at default location. Creating a" + echo "new Logtalk user directory by running the \"cplgtdirs\" shell script:" + cplgtdirs + fi +elif ! [ -d "$LOGTALKUSER" ]; then + echo "Cannot find \$LOGTALKUSER directory! Creating a new Logtalk user directory" + echo "by running the \"cplgtdirs\" shell script:" + cplgtdirs +fi +echo + +exec xsb-mt --shared_predicates -l -e "['$LOGTALKHOME/integration/logtalk_xsbmt.pl']." "$@" diff --git a/Logtalk/library/lgtunit.lgt b/Logtalk/library/lgtunit.lgt new file mode 100644 index 000000000..e0fbfebc7 --- /dev/null +++ b/Logtalk/library/lgtunit.lgt @@ -0,0 +1,140 @@ + +:- object(lgtunit). + + :- info([ + version is 0.2, + author is 'Paulo Moura', + date is 2007/08/27, + comment is 'Logtalk unit test framework.']). + + :- public(succeeds/2). + :- mode(succeeds(+atom, @callable), zero_or_more). + :- info(succeeds/2, [ + comment is 'Defines a test goal which is expected to succeed.', + argnames is ['Test', 'Goal']]). + + :- public(fails/2). + :- mode(fails(+atom, @callable), zero_or_more). + :- info(fails/2, [ + comment is 'Defines a test goal which is expected to fail.', + argnames is ['Test', 'Goal']]). + + :- public(throws/3). + :- mode(throws(+atom, @callable, @nonvar), zero_or_more). + :- info(throws/3, [ + comment is 'Defines a test goal which is expected to throw an error.', + argnames is ['Test', 'Goal', 'Error']]). + + :- public(run/2). + :- mode(run(+atom, +atom), zero_or_one). + :- info(run/2, [ + comment is 'Runs the unit tests, writing the results to the specified file. Mode can be either "write" (to create a new file) or "append" (to add results to an existing file).', + argnames is ['File', 'Mode']]). + + :- public(run/0). + :- mode(run, zero_or_one). + :- info(run/0, [ + comment is 'Runs the unit tests, writing the results to the current output stream.']). + + :- protected(setup/0). + :- mode(setup, zero_or_one). + :- info(setup/0, [ + comment is 'Setup environment before running the test. Defaults to the goal true.']). + + :- protected(test/0). + :- mode(test, zero_or_one). + :- info(test/0, [ + comment is 'Executes the tests. By default, starts with the "succeeds" tests, followed by the "fails" tests, and than the "throws" tests.']). + + :- protected(cleanup/0). + :- mode(cleanup, zero_or_one). + :- info(cleanup/0, [ + comment is 'Cleanup environment after running the test. Defaults to the goal true.']). + + % by default, no test setup is needed: + setup. + + % by default, run all "succeeds", "fails", and "throws" tests: + test :- + test_succeeds, + test_fails, + test_throws. + + test_succeeds :- + forall(::succeeds(Test, Goal), test_succeeds(Test, Goal)). + + test_succeeds(Test, Goal) :- + ( catch({Goal}, _, fail) -> + passed_test(Test, Goal) + ; failed_test(Test, Goal) + ). + + test_fails :- + forall(::fails(Test, Goal), test_fail(Test, Goal)). + + test_fail(Test, Goal) :- + ( catch(\+ {Goal}, _, fail) -> + passed_test(Test, Goal) + ; failed_test(Test, Goal) + ). + + test_throws :- + forall(::throws(Test, Goal, Error), test_throws(Test, Goal, Error)). + + test_throws(Test, Goal, Error) :- + ( catch({Goal}, Ball, ((Ball = Error -> passed_test(Test, Goal); failed_test(Test, Goal)), Flag = error)) -> + ( var(Flag) -> + failed_test(Test, Goal) + ; true + ) + ; failed_test(Test, Goal) + ). + + passed_test(Test, _Goal) :- + self(Self), + write('= passed test '), writeq(Test), write(' in object '), writeq(Self), nl. + + failed_test(Test, _Goal) :- + self(Self), + write('= failed test '), writeq(Test), write(' in object '), writeq(Self), nl. + + % by default, no test cleanup is needed: + cleanup. + + run(File, Mode) :- + open(File, Mode, Stream), + current_output(Output), + set_output(Stream), + ::run, + set_output(Output), + close(Stream). + + run :- + self(Self), + write('% running tests from object '), writeq(Self), nl, + ( catch(::setup, Error, (broken(setup, Error), fail)) -> + ( catch(::test, Error, (broken(test, Error), Flag = error)) -> + do_cleanup, + ( var(Flag) -> + write('% completed tests from object '), writeq(Self), nl + ; write('% test run failed'), nl + ) + ; do_cleanup, + write('! test run failed for object '), writeq(Self), nl, + write('% test run failed'), nl + ) + ; write('! test setup failed for object '), writeq(Self), nl + ). + + do_cleanup :- + self(Self), + ( catch(::cleanup, Error, (broken(cleanup, Error), fail)) -> + true + ; write('! test cleanup failed for object '), writeq(Self), nl + ). + + broken(Step, Error) :- + self(Self), + write('! broken '), write(Step), write(' for object '), writeq(Self), write(': '), write(Error), nl. + +:- end_object. diff --git a/Logtalk/library/lgtunit.notes b/Logtalk/library/lgtunit.notes new file mode 100644 index 000000000..d214528c3 --- /dev/null +++ b/Logtalk/library/lgtunit.notes @@ -0,0 +1,15 @@ + +================================================================ +Logtalk - Open source object-oriented logic programming language +Release 2.30.7 + +Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved. +================================================================ + + +The "lgtunit.lgt" file contains a preliminary framework for defining +and running unit tests in Logtalk. + +The unit tests framework is inspired on the works of Joachim Schimpf +(ECLiPSe library "test_util") and Jan Wielemaker (SWI-Prolog "plunit" +package). diff --git a/Logtalk/manuals/refman/builtins/threaded_call1_2.html b/Logtalk/manuals/refman/builtins/threaded_call1_2.html new file mode 100644 index 000000000..a8cf11b28 --- /dev/null +++ b/Logtalk/manuals/refman/builtins/threaded_call1_2.html @@ -0,0 +1,75 @@ + + + + + + + + Logtalk built-in predicate: threaded_call/1-2 + + + + + + +
Logtalk reference manual
+
Built-in predicate: threaded_call/1-2
+
+
+ + +

threaded_call/1-2

+ +

Description

+ +
threaded_call(Goal)
+threaded_call(Goal, Tag)
+

+Proves Goal asynchronously using a new thread. The argument can be a message sending goal. Calls to this predicate always succeeds and return immediately. The results (success, failure, or exception) are sent back to the message queue of the object containing the call (this); they can be retrieved by calling the threaded_exit/1 predicate. +

+

+The variant threaded_call/2 returns a threaded call identifier tag that can be used with the threaded_exit/2 predicate. Tags shall be considered as an opaque term; users shall not rely on its type. +

+ +

Template and modes

+ +
threaded_call(@callable)
+threaded_call(@callable, -nonvar)
+ +

Errors

+ +
+
Goal is a variable:
+
instantiation_error
+
Goal is neither a variable nor a callable term:
+
type_error(callable, Goal)
+
Tag is not a variable:
+
type_error(variable, Goal)
+
+ +

Examples

+ +
+
Prove Goal asynchronously in a new thread:
+
threaded_call(Goal)
+
Prove ::Message asynchronously in a new thread:
+
threaded_call(::Message)
+
Prove Object::Message asynchronously in a new thread:
+
threaded_call(Object::Message)
+
+ + + + + + diff --git a/Logtalk/manuals/refman/builtins/threaded_exit1_2.html b/Logtalk/manuals/refman/builtins/threaded_exit1_2.html new file mode 100644 index 000000000..192a77c5c --- /dev/null +++ b/Logtalk/manuals/refman/builtins/threaded_exit1_2.html @@ -0,0 +1,80 @@ + + + + + + + + Logtalk built-in predicate: threaded_exit/1-2 + + + + + + +
Logtalk reference manual
+
Built-in predicate: threaded_exit/1-2
+
+
+ + +

threaded_exit/1-2

+ +

Description

+ +
threaded_exit(Goal)
+threaded_exit(Goal, Tag)
+

+Retrieves the result of proving Goal in a new thread. This predicate blocks execution until the reply is sent to the this message queue by the thread executing the goal. When there is no thread proving the goal, the predicate generates an exception. This predicate is non-deterministic, providing access to any alternative solutions of its argument. +

+

+The argument of this predicate should be a variant of the argument of the corresponding threaded_call/1 call. When the predicate argument is subsumed by the threaded_call/1 call argument, the threaded_exit/1 call will succeed iff its argument is a solution of the (more general) goal. +

+

+The variant threaded_exit/2 accepts a threaded call identifier tag generated by the calls to the threaded_call/2 and threaded_once/2 predicates. Tags shall be considered as an opaque term; users shall not rely on its type. +

+ +

Template and modes

+ +
threaded_exit(+callable)
+threaded_exit(+callable, +nonvar)
+ +

Errors

+ +
+
Goal is a variable:
+
instantiation_error
+
Goal is neither a variable nor a callable term:
+
type_error(callable, Goal)
+
no thread is running for proving Goal:
+
existence_error(goal_thread, Goal)
+
Tag is a variable:
+
instantiation_error
+
+ +

Examples

+ +
+
To retrieve an asynchronous goal proof result:
+
threaded_exit(Goal)
+
To retrieve an asynchronous message to self result:
+
threaded_exit(::Goal)
+
To retrieve an asynchronous message result:
+
threaded_exit(Object::Goal)
+
+ + + + + + diff --git a/Logtalk/manuals/refman/builtins/threaded_once1_2.html b/Logtalk/manuals/refman/builtins/threaded_once1_2.html new file mode 100644 index 000000000..19415e5e1 --- /dev/null +++ b/Logtalk/manuals/refman/builtins/threaded_once1_2.html @@ -0,0 +1,75 @@ + + + + + + + + Logtalk built-in predicate: threaded_once/1-2 + + + + + + +
Logtalk reference manual
+
Built-in predicate: threaded_once/1-2
+
+
+ + +

threaded_once/1-2

+ +

Description

+ +
threaded_once(Goal)
+threaded_once(Goal, Tag)
+

+Proves Goal asynchronously using a new thread. Only the first goal solution is found. The argument can be a message sending goal. This call always succeeds. The result (success, failure, or exception) is sent back to the message queue of the object containing the call (this). +

+

+The variant threaded_once/2 returns a threaded call identifier tag that can be used with the threaded_exit/2 predicate. Tags shall be considered as an opaque term; users shall not rely on its type. +

+ +

Template and modes

+ +
threaded_once(@callable)
+threaded_once(@callable, -nonvar)
+ +

Errors

+ +
+
Goal is a variable:
+
instantiation_error
+
Goal is neither a variable nor a callable term:
+
type_error(callable, Goal)
+
Tag is not a variable:
+
type_error(variable, Goal)
+
+ +

Examples

+ +
+
Prove Goal asynchronously in a new thread:
+
threaded_once(Goal)
+
Prove ::Message asynchronously in a new thread:
+
threaded_once(::Message)
+
Prove Object::Message asynchronously in a new thread:
+
threaded_once(Object::Message)
+
+ + + + + + diff --git a/Logtalk/manuals/refman/builtins/threaded_peek1_2.html b/Logtalk/manuals/refman/builtins/threaded_peek1_2.html new file mode 100644 index 000000000..986159278 --- /dev/null +++ b/Logtalk/manuals/refman/builtins/threaded_peek1_2.html @@ -0,0 +1,78 @@ + + + + + + + + Logtalk built-in predicate: threaded_peek/1-2 + + + + + + +
Logtalk reference manual
+
Built-in predicate: threaded_peek/1-2
+
+
+ + +

threaded_peek/1-2

+ +

Description

+ +
threaded_peek(Goal)
+threaded_peek(Goal, Tag)
+

+Checks if the result of proving Goal in a new thread is already available. This call succeeds or fails without blocking execution waiting for a reply to be available. +

+

+The argument of this predicate should be a variant of the argument of the corresponding threaded_call/1 call. When the predicate argument is subsumed by the threaded_call/1 call argument, the threaded_peek/1 call will succeed iff its argument unifies with an already available solution of the (more general) goal. +

+

+The variant threaded_peek/2 accepts a threaded call identifier tag generated by the calls to the threaded_call/2 and threaded_once/2 predicates. Tags shall be considered as an opaque term; users shall not rely on its type. +

+ +

Template and modes

+ +
threaded_peek(+callable)
+threaded_peek(+callable, +nonvar)
+ +

Errors

+ +
+
Goal is a variable:
+
instantiation_error
+
Goal is neither a variable nor a callable term:
+
type_error(callable, Goal)
+
Tag is a variable:
+
instantiation_error
+
+ +

Examples

+ +
+
To check for an asynchronous goal proof result:
+
threaded_peek(Goal)
+
To check for an asynchronous message to self result:
+
threaded_peek(::Goal)
+
To check for an asynchronous message result:
+
threaded_peek(Object::Goal)
+
+ + + + + + diff --git a/Logtalk/scripts/macosx/Portfile b/Logtalk/scripts/macosx/Portfile new file mode 100644 index 000000000..24af05b56 --- /dev/null +++ b/Logtalk/scripts/macosx/Portfile @@ -0,0 +1,73 @@ +# $Id: Portfile 26918 2007-07-11 15:28:15Z gwright@macports.org $ + +PortSystem 1.0 +name logtalk +version 2.30.7 + +categories lang +maintainers pmoura@logtalk.org +platforms darwin freebsd linux +description Logtalk - Open source object-oriented logic programming language + +long_description \ + Logtalk is an open source object-oriented logic programming language \ + that can use most Prolog implementations as a back-end compiler. \ + As a multi-paradigm language, Logtalk includes support for both \ + prototypes and classes, protocols, component-based programming \ + through category-based composition, event-driven programming, and \ + multi-threading programming. + +homepage http://logtalk.org/ +master_sites ${homepage}/files/ + +checksums md5 0653f6e2e10219111deed4b2096e6394 + +distname lgt2307 +extract.suffix .tar.bz2 + +use_bzip2 yes + +configure {} + +build {} + +destroot { + cd ${workpath}/${worksrcdir}/scripts + system "./install.sh ${destroot}/${prefix}" +} + +post-pkg { + set resources ${workpath}/${name}-${version}.pkg/Contents/Resources/ + file copy -force -- ${workpath}/${worksrcdir}/scripts/macosx/License.html ${resources} + file copy -force -- ${workpath}/${worksrcdir}/scripts/macosx/ReadMe.html ${resources} + file copy -force -- ${workpath}/${worksrcdir}/scripts/macosx/Welcome.html ${resources} + file copy -force -- ${workpath}/${worksrcdir}/scripts/macosx/postflight ${resources} +} + +post-activate { + ui_msg "****************************************************************************" + ui_msg "* Integration scripts have been created for running Logtalk with selected" + ui_msg "* back-end Prolog compilers (which must be properly installed for running" + ui_msg "* the scripts!):" + ui_msg "*" + ui_msg "* B-Prolog: bplgt (first run must use sudo)" + ui_msg "* CIAO: ciaolgt (first run must use sudo)" + ui_msg "* CxProlog: cxlgt" + ui_msg "* ECLiPSe: eclipselgt" + ui_msg "* GNU Prolog: gplgt" + ui_msg "* K-Prolog: plclgt" + ui_msg "* Qu-Prolog: qplgt" + ui_msg "* SICStus Prolog: sicstuslgt" + ui_msg "* SWI-Prolog: swilgt" + ui_msg "* XSB: xsblgt (first run must use sudo)" + ui_msg "* XSB (MT): xsbmtlgt (first run must use sudo)" + ui_msg "* YAP: yaplgt" + ui_msg "*" + ui_msg "* Remember to set the environment variable LOGTALKHOME to the path to" + ui_msg "* the Logtalk distribution: ${prefix}/share/logtalk" + ui_msg "* and the environment variable LOGTALKUSER to your local configuration" + ui_msg "* directory (usually ~/logtalk), which you can create by running the" + ui_msg "* command cplgtdirs. See the file \$LOGTALKHOME/CUSTOMIZE.txt for details" + ui_msg "* on how to customize your working environment." + ui_msg "****************************************************************************" +} diff --git a/Logtalk/wenv/gtksourceview2/NOTES.txt b/Logtalk/wenv/gtksourceview2/NOTES.txt new file mode 100644 index 000000000..f5ecc6454 --- /dev/null +++ b/Logtalk/wenv/gtksourceview2/NOTES.txt @@ -0,0 +1,26 @@ +================================================================ +Logtalk - Open source object-oriented logic programming language +Release 2.30.7 + +Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved. +================================================================ + + +This directory contains files that provide syntax highlighting for +GtkSourceView 2.x, which is a text widget used in text editors and +IDEs such as recent versions of Gnome's Gedit and MonoDevelop: + + http://gtksourceview.sourceforge.net/ + +To install, copy the file "logtalk.lang" to the following system-wide +directory: + + ${prefix}/share/gtksourceview-2.0/language-specs/ + +The ${prefix} can be e.g. "/usr", "/usr/local", or "/opt", depending +on your system configuration. + +Alternatively, you can copy the "logtalk.lang" file to the following +location on your home directory: + + ~./gnome2/gtksourceview-2.0/language-specs/ diff --git a/Logtalk/wenv/gtksourceview2/logtalk.lang b/Logtalk/wenv/gtksourceview2/logtalk.lang new file mode 100644 index 000000000..1c0a352ea --- /dev/null +++ b/Logtalk/wenv/gtksourceview2/logtalk.lang @@ -0,0 +1,335 @@ + + + + + + text/x-logtalk + *.lgt + % + /* + */ + + + +