From ec2e1c21b0958c8311fa3f4e52f5c1351837eed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Sun, 25 May 2014 20:52:45 +0100 Subject: [PATCH] fix docs --- docs/doxygen.rc | 21 +++++----- docs/yap.tex | 13 ++++++- pl/absf.yap | 97 ++++++++++++++++++++++++++++++++--------------- pl/attributes.yap | 3 ++ pl/consult.yap | 4 +- pl/errors.yap | 3 ++ 6 files changed, 98 insertions(+), 43 deletions(-) diff --git a/docs/doxygen.rc b/docs/doxygen.rc index 198860f4f..e7338c491 100644 --- a/docs/doxygen.rc +++ b/docs/doxygen.rc @@ -38,7 +38,7 @@ PROJECT_NAME = yap-6 # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = 6.3.4 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a @@ -330,7 +330,7 @@ AUTOLINK_SUPPORT = YES # diagrams that involve STL classes more complete and accurate. # The default value is: NO. -BUILTIN_STL_SUPPORT = NO +BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. @@ -670,7 +670,7 @@ SHOW_FILES = YES # Folder Tree View (if specified). # The default value is: YES. -SHOW_NAMESPACES = YES +SHOW_NAMESPACES = NO # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from @@ -783,7 +783,8 @@ INPUT = docs/yap.md \ os \ packages \ library \ - CXX + CXX \ + OPTYap # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -862,7 +863,7 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = +EXCLUDE = *pltotex.pl # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -963,7 +964,7 @@ FILTER_SOURCE_PATTERNS = # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = NO +USE_MDFILE_AS_MAINPAGE = docs/yap.md #--------------------------------------------------------------------------- # Configuration options related to source browsing @@ -989,19 +990,19 @@ INLINE_SOURCES = YES # Fortran comments will always remain visible. # The default value is: YES. -STRIP_CODE_COMMENTS = YES +STRIP_CODE_COMMENTS = NO # If the REFERENCED_BY_RELATION tag is set to YES then for each documented # function all documented functions referencing it will be listed. # The default value is: NO. -REFERENCED_BY_RELATION = NO +REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. # The default value is: NO. -REFERENCES_RELATION = NO +REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set # to YES, then the hyperlinks from functions in REFERENCES_RELATION and @@ -2100,7 +2101,7 @@ PERL_PATH = /usr/bin/perl # powerful graphs. # The default value is: YES. -CLASS_DIAGRAMS = NO +CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see: diff --git a/docs/yap.tex b/docs/yap.tex index 6ad193332..4c83e714c 100644 --- a/docs/yap.tex +++ b/docs/yap.tex @@ -9761,6 +9761,15 @@ this is possible, @var{Goal} will become invalid after executing YAP_RecoverSlots(1); if (out == 0) return FALSE; @end example + +@ifplaintext + +@copydoc real + +@end ifplaintext + +@texinfo + Slots are safe houses in the stack, the garbage collector and the stack shifter know about them and make sure they have correct values. In this case, we use a slot to preserve @var{t} during the execution of @@ -9807,6 +9816,8 @@ Set the first @var{HowMany} arguments to the @var{HowMany} slots starting at @var{slot}. @end table +@end texinfo + The following functions complement @var{YAP_RunGoal}: @table @code @item @code{int} YAP_RestartGoal(@code{void}) @@ -9815,7 +9826,7 @@ Look for the next solution to the current query by forcing YAP to backtrack to the latest goal. Notice that slots allocated since the last @code{YAP_RunGoal} will become invalid. -@item @code{int} YAP_Reset(@code{void}) +@Item @code{int} YAP_Reset(@code{void}) @findex YAP_Reset (C-Interface function) Reset execution environment (similar to the @code{abort/0} built-in). This is useful when you want to start a new query before diff --git a/pl/absf.yap b/pl/absf.yap index 5970711b1..fe6e1ed9a 100755 --- a/pl/absf.yap +++ b/pl/absf.yap @@ -8,7 +8,7 @@ * * *************************************************************************/ -/** +/** @file absf.yap @defgroup abs_file_name File Name Resolution @@ -20,7 +20,7 @@ variables and registry information to search for files. @{ - + */ @@ -53,7 +53,7 @@ specified both with dot, as `.ext`, or without, as plain `ext`. - relative_to(+ _FileOrDir_ ) - + Resolve the path relative to the given directory or directory the holding the given file. Without this option, paths are resolved relative to the working directory (see working_directory/2) or, @@ -64,7 +64,7 @@ Imposes the condition access_file( _File_ , _Mode_ ). _Mode_ is one of `read`, `write`, `append`, `exist` or `none` (default). - + See also access_file/2. - file_type(+ _Type_ ) @@ -72,15 +72,15 @@ Defines suffixes matching one of several pre-specified type of files. Default mapping is as follows: 1. `txt` implies `[ '' ]`, - + 2. `prolog` implies `['.yap', '.pl', '.prolog', '']`, - + 3. `executable` implies `['.so', ',dylib', '.dll']` depending on the Operating system, - + 4. `qlf` implies `['.qlf', '']`, - + 5. `directory` implies `['']`, - + 6. The file-type `source` is an alias for `prolog` designed to support compatibility with SICStus Prolog. See also prolog_file_type/2. Notice that this predicate only @@ -147,7 +147,7 @@ absolute_file_name(File0,File) :- '$find_in_path'(File,opts(Extensions,RelTo,Type,Access,FErrors,Expand,Debug),TrueFileName,G), nb:nb_queue_enqueue(Ref, TrueFileName), fail - ; + ; nb:nb_queue_close(Ref, FileNames, []) ), '$absolute_file_names'(Solutions, FileNames, FErrors, TrueFileName, File, G). @@ -157,7 +157,7 @@ absolute_file_name(File0,File) :- '$absolute_file_names'(Solutions, FileNames, _, TrueFileName, _, _) :- lists:member(TrueFileName, FileNames), (Solutions == first -> ! ; true). - + '$process_fn_opts'(V,_,_,_,_,_,_,_,_,G) :- var(V), !, '$do_error'(instantiation_error, G). @@ -187,7 +187,7 @@ absolute_file_name(File0,File) :- '$process_fn_opt'(verbose_file_search(Debug),Extensions,RelTo,Type,Access,FErrors,Solutions,Expand,Debug,Extensions,RelTo,Type,Access,FErrors,Solutions,Expand,_,G) :- !, '$check_true_false'(Debug,G). '$process_fn_opt'(Opt,Extensions,RelTo,Type,Access,FErrors,Solutions,Expand,Debug,Extensions,RelTo,Type,Access,FErrors,Solutions,Expand,Debug,G) :- !, - '$do_error'(domain_error(file_name_option,Opt),G). + '$do_error'(domain_error(file_name_option,Opt),G). '$check_fn_extensions'(V,G) :- var(V), !, '$do_error'(instantiation_error, G). @@ -203,7 +203,7 @@ absolute_file_name(File0,File) :- '$check_atom'(A,_G) :- atom(A), !. '$check_atom'(T,G) :- !, '$do_error'(type_error(atom,T),G). - + '$check_fn_type'(V,G) :- var(V), !, '$do_error'(instantiation_error, G). '$check_fn_type'(txt,_) :- !. @@ -216,7 +216,7 @@ absolute_file_name(File0,File) :- '$do_error'(domain_error(file_type,T),G). '$check_fn_type'(T,G) :- !, '$do_error'(type_error(atom,T),G). - + '$check_fn_errors'(V,G) :- var(V), !, '$do_error'(instantiation_error, G). '$check_fn_errors'(fail,_) :- !. @@ -234,7 +234,7 @@ absolute_file_name(File0,File) :- '$do_error'(domain_error(solutions,T),G). '$check_fn_solutions'(T,G) :- !, '$do_error'(type_error(atom,T),G). - + '$check_true_false'(V,G) :- var(V), !, '$do_error'(instantiation_error, G). '$check_true_false'(true,_) :- !. @@ -243,7 +243,7 @@ absolute_file_name(File0,File) :- '$do_error'(domain_error(boolean,T),G). '$check_true_false'(T,G) :- !, '$do_error'(type_error(atom,T),G). - + % This sequence must be followed: % user and user_input are special; % library(F) must check library_directories @@ -287,7 +287,7 @@ absolute_file_name(File0,File) :- '$swi_set_prolog_flag'(file_name_variables, Expand), ( '$absolute_file_name'(File,ExpFile) - -> + -> '$swi_set_prolog_flag'(file_name_variables, OldF) ; '$swi_set_prolog_flag'(file_name_variables, OldF), @@ -306,7 +306,7 @@ absolute_file_name(File0,File) :- ; AbsFile = ExpFile ). - + '$search_in_path'(File,opts(Extensions,_,Type,Access,_,_,_),F) :- '$add_extensions'(Extensions, File, F0), @@ -364,7 +364,7 @@ absolute_file_name(File0,File) :- % windows has stuff installed in the registry '$system_library_directories'(Library, Dir) :- '$swi_current_prolog_flag'(windows, true), - ( ( + ( ( '$swi_current_prolog_flag'(address_bits, 64) -> ( HKEY='HKEY_LOCAL_MACHINE/Software/YAP/Prolog64'; HKEY='HKEY_CURRENT_USER/Software/YAP/Prolog64' ) @@ -440,7 +440,7 @@ absolute_file_name(File0,File) :- is_absolute_file_name(File), !. '$extend_path_directory'(Name, D, File, Opts, NewFile, Call) :- user:file_search_path(Name, IDirs), - ( atom(IDirs) -> + ( atom(IDirs) -> '$split_by_sep'(0, 0, IDirs, Dir) ; Dir = IDirs @@ -464,8 +464,9 @@ absolute_file_name(File0,File) :- /** path(-Directories:list) is det,deprecated - YAP specific procedure that returns a list of user-defined directories - in the library search-path. + YAP specific procedure that returns a list of user-defined directories + in the library search-path.We suggest using user:file_search_path/2 for + compatibility with other Prologs. */ path(Path) :- findall(X,'$in_path'(X),Path). @@ -478,13 +479,17 @@ path(Path) :- findall(X,'$in_path'(X),Path). add_to_path(+Directory:atom) is det,deprecated YAP-specific predicate to include directory in library search path. + We suggest using user:file_search_path/2 for + compatibility with other Prologs. */ add_to_path(New) :- add_to_path(New,last). /** add_to_path(+Directory:atom, +Position:atom) is det,deprecated - YAP-specific predicate to include directory in front or back of library search path. + YAP-specific predicate to include directory in front or back of + library search path. We suggest using user:file_search_path/2 for + compatibility with other Prologs and more extensive functionality. */ add_to_path(New,Pos) :- atom(New), !, @@ -496,7 +501,7 @@ add_to_path(New,Pos) :- '$add_to_path'(New,last) :- !, recordz('$path',New,_). '$add_to_path'(New,first) :- recorda('$path',New,_). -/** remove_from_path(+Directory:atom) is det,deprecated +/** remove_from_path(+Directory:atom) is det,deprecated */ remove_from_path(New) :- '$check_path'(New,Path), @@ -515,7 +520,7 @@ remove_from_path(New) :- '$check_path'(New,Path), current library directory name. Asserted in the user module. Library directories are the places where files specified in the form - `library( _File_)` are searched by the predicates consult/1, + `library( _File_ )` are searched by the predicates consult/1, reconsult/1, use_module/1, ensure_loaded/1, and load_files/2. */ @@ -536,6 +541,24 @@ remove_from_path(New) :- '$check_path'(New,Path), /** user:prolog_file_type(?Suffix:atom, ?Handler:atom) is nondet, dynamic + This multifile/dynamic predicate relates a file extension _Suffix_ + to a language or file type _Handler_. By + default, it supports the extensions yap, pl, and prolog for prolog files and + uses one of dll, so, or dylib for shared objects. Initial definition is: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~prolog + prolog_file_type(yap, prolog). + prolog_file_type(pl, prolog). + prolog_file_type(prolog, prolog). + prolog_file_type(A, prolog) :- + current_prolog_flag(associate, A), + A \== prolog, + A \==pl, + A \== yap. + prolog_file_type(A, executable) :- + current_prolog_flag(shared_object_extension, A). +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ :- multifile user:prolog_file_type/2. @@ -563,10 +586,25 @@ user:prolog_file_type(A, executable) :- solutions. The predicate is originally defined as follows: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~prolog -file_search_path(library,A) :- - library_directory(A). -file_search_path(system,A) :- - prolog_flag(host_type,A). +file_search_path(library, Dir) :- + library_directory(Dir). +file_search_path(commons, Dir) :- + commons_directory(Dir). +file_search_path(swi, Home) :- + current_prolog_flag(home, Home). +file_search_path(yap, Home) :- + current_prolog_flag(home, Home). +file_search_path(system, Dir) :- + prolog_flag(host_type, Dir). +file_search_path(foreign, yap('lib/Yap')). +file_search_path(path, C) :- + ( getenv('PATH', A), + ( current_prolog_flag(windows, true) + -> atomic_list_concat(B, ;, A) + ; atomic_list_concat(B, :, A) + ), + lists:member(C, B) + ). ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Thus, `compile(library(A))` will search for a file using @@ -600,4 +638,3 @@ user:file_search_path(path, C) :- ), lists:member(C, B) ). - diff --git a/pl/attributes.yap b/pl/attributes.yap index b505ab133..cfc687290 100644 --- a/pl/attributes.yap +++ b/pl/attributes.yap @@ -84,6 +84,7 @@ cvt_to_swi_atts(att(Mod,Attribute,Atts), ModAttribute) :- % '$write'(4,vsc_woke:G+[Module1|Continuation]:' %'), fail. prolog:'$wake_up_goal'([Module1|Continuation], LG) :- + writeln( [Module1|Continuation]:LG), execute_woken_system_goals(LG), do_continuation(Continuation, Module1). @@ -97,6 +98,8 @@ prolog:'$wake_up_goal'([Module1|Continuation], LG) :- do_continuation('$cut_by'(X), _) :- !, '$$cut_by'(X). do_continuation('$restore_regs'(X), _) :- !, +% yap_flag(gc_trace,verbose), +% garbage_collect, '$restore_regs'(X). do_continuation('$restore_regs'(X,Y), _) :- !, % yap_flag(gc_trace,verbose), diff --git a/pl/consult.yap b/pl/consult.yap index d4acb685f..81bb7953e 100755 --- a/pl/consult.yap +++ b/pl/consult.yap @@ -105,7 +105,7 @@ load_files(Files,Opts) :- '$lf_option'('$location', 19, _). '$lf_option'(dialect, 20, yap). '$lf_option'(format, 21, source). -'$lf_option'(redefine_module, 22, ask). +'$lf_option'(redefine_module, 22, false). '$lf_option'(reexport, 23, false). '$lf_option'(sandboxed, 24, false). '$lf_option'(scope_settings, 25, false). @@ -1018,7 +1018,7 @@ source_file_property( File0, Prop) :- '$source_file_property'( File, Prop). '$source_file_property'( OldF, includes(F, Age)) :- - recorded('$lf_loaded','$lf_loaded'( F, _M,, _ include, _File, OldF, _Line, _), _), + recorded('$lf_loaded','$lf_loaded'( F, _M, _ include, _File, OldF, _Line, _), _), recorded('$lf_loaded','$lf_loaded'( F, Age, _), _). '$source_file_property'( F, included_in(OldF, Line)) :- recorded('$lf_loaded','$lf_loaded'( F, _M, include, _File, OldF, Line, _), _). diff --git a/pl/errors.yap b/pl/errors.yap index d149a1176..25cce826a 100644 --- a/pl/errors.yap +++ b/pl/errors.yap @@ -232,6 +232,9 @@ '$process_error'(error(thread_cancel(Id), G),top) :- !. '$process_error'(error(thread_cancel(Id), G), _) :- !, throw(error(thread_cancel(Id), G)). +'$process_error'(error(permission_error(module,redefined,A),B), Level) :- + Level \= top, !, + throw(error(permission_error(module,redefined,A),B)). '$process_error'(error(Msg, Where), _) :- !, '$set_fpu_exceptions', print_message(error,error(Msg, Where)).