Changeset 4213
- Timestamp:
- 04/21/08 09:25:05 (3 months ago)
- Location:
- trunk
- Files:
-
- 9 modified
-
compiler/logtalk.pl (modified) (7 diffs)
-
manuals/index.html (modified) (1 diff)
-
manuals/userman/errors.html (modified) (2 diffs)
-
manuals/userman/index.html (modified) (1 diff)
-
manuals/userman/predicates.html (modified) (2 diffs)
-
manuals/userman/programming.html (modified) (3 diffs)
-
manuals/userman/running.html (modified) (2 diffs)
-
manuals/userman/userman.header (modified) (1 diff)
-
RELEASE_NOTES.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/compiler/logtalk.pl
r4196 r4213 205 205 :- dynamic('$lgt_pp_calls_pred_'/4). % '$lgt_pp_calls_pred_'(Functor, Arity, TFunctor, TArity) 206 206 :- dynamic('$lgt_non_portable_call_'/2). % '$lgt_non_portable_call_'(Functor, Arity) 207 :- dynamic('$lgt_non_portable_function_'/2). % '$lgt_non_portable_function_'(Functor, Arity) 207 208 208 209 :- dynamic('$lgt_pp_defs_nt_'/2). % '$lgt_pp_defs_nt_'(Functor, Arity) … … 4752 4753 retractall('$lgt_pp_calls_pred_'(_, _, _, _)), 4753 4754 retractall('$lgt_non_portable_call_'(_, _)), 4755 retractall('$lgt_non_portable_function_'(_, _)), 4754 4756 retractall('$lgt_pp_defs_nt_'(_, _)), 4755 4757 retractall('$lgt_pp_calls_nt_'(_, _)), … … 7198 7200 7199 7201 7202 % arithmetic predicates (portability checks) 7203 7204 '$lgt_tr_body'(_ is Exp, _, _, _) :- 7205 '$lgt_check_non_portable_functions'(Exp), 7206 fail. 7207 '$lgt_tr_body'(Exp1 =:= Exp2, _, _, _) :- 7208 '$lgt_check_non_portable_functions'(Exp1), 7209 '$lgt_check_non_portable_functions'(Exp2), 7210 fail. 7211 '$lgt_tr_body'(Exp1 =\= Exp2, _, _, _) :- 7212 '$lgt_check_non_portable_functions'(Exp1), 7213 '$lgt_check_non_portable_functions'(Exp2), 7214 fail. 7215 '$lgt_tr_body'(Exp1 < Exp2, _, _, _) :- 7216 '$lgt_check_non_portable_functions'(Exp1), 7217 '$lgt_check_non_portable_functions'(Exp2), 7218 fail. 7219 '$lgt_tr_body'(Exp1 =< Exp2, _, _, _) :- 7220 '$lgt_check_non_portable_functions'(Exp1), 7221 '$lgt_check_non_portable_functions'(Exp2), 7222 fail. 7223 '$lgt_tr_body'(Exp1 > Exp2, _, _, _) :- 7224 '$lgt_check_non_portable_functions'(Exp1), 7225 '$lgt_check_non_portable_functions'(Exp2), 7226 fail. 7227 '$lgt_tr_body'(Exp1 >= Exp2, _, _, _) :- 7228 '$lgt_check_non_portable_functions'(Exp1), 7229 '$lgt_check_non_portable_functions'(Exp2), 7230 fail. 7231 7232 7200 7233 % Logtalk and Prolog built-in (meta-)predicates 7201 7234 … … 7553 7586 7554 7587 '$lgt_compiler_db_pred_ind_chk'(_). 7588 7589 7590 7591 % '$lgt_check_non_portable_functions'(@term) 7592 % 7593 % checks an arithmetic expression for calls to non-standard Prolog functions 7594 7595 7596 '$lgt_check_non_portable_functions'(Exp) :- 7597 var(Exp), 7598 !. 7599 7600 '$lgt_check_non_portable_functions'(Exp) :- 7601 number(Exp), 7602 !. 7603 7604 '$lgt_check_non_portable_functions'(Exp) :- 7605 '$lgt_iso_spec_function'(Exp), 7606 !, 7607 Exp =.. [_| Exps], 7608 '$lgt_check_non_portable_function_args'(Exps). 7609 7610 '$lgt_check_non_portable_functions'(Exp) :- 7611 functor(Exp, Functor, Arity), 7612 ( '$lgt_non_portable_function_'(Functor, Arity) -> 7613 true 7614 ; assertz('$lgt_non_portable_function_'(Functor, Arity)) 7615 ), 7616 Exp =.. [_| Exps], 7617 '$lgt_check_non_portable_function_args'(Exps). 7618 7619 7620 '$lgt_check_non_portable_function_args'([]). 7621 7622 '$lgt_check_non_portable_function_args'([Exp| Exps]) :- 7623 '$lgt_check_non_portable_functions'(Exp), 7624 '$lgt_check_non_portable_function_args'(Exps). 7555 7625 7556 7626 … … 8609 8679 '$lgt_report_misspelt_calls', 8610 8680 '$lgt_report_non_portable_calls', 8681 '$lgt_report_non_portable_functions', 8611 8682 '$lgt_report_unknown_entities' 8612 8683 ; true … … 10153 10224 functor(Pred, Functor, Arity), 10154 10225 \+ '$lgt_pp_redefined_built_in_'(Pred, _, _, _, _). 10226 10227 10228 10229 % report non-portable arithmetic function calls in the body of object and category predicates 10230 10231 '$lgt_report_non_portable_functions' :- 10232 '$lgt_compiler_flag'(portability, warning), 10233 setof(Functor/Arity, '$lgt_non_portable_function_'(Functor, Arity), Functions), 10234 '$lgt_inc_compile_warnings_counter', 10235 nl, 10236 ( Functions = [_] -> 10237 write(' WARNING! Call to non-standard Prolog built-in arithmetic function: ') 10238 ; write(' WARNING! Calls to non-standard Prolog built-in arithmetic functions: ') 10239 ), 10240 '$lgt_writeq_list'(Functions), 10241 !. 10242 10243 '$lgt_report_non_portable_functions'. 10155 10244 10156 10245 … … 12706 12795 '$lgt_iso_spec_pred'(halt). 12707 12796 '$lgt_iso_spec_pred'(halt(_)). 12797 12798 12799 12800 12801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12802 % 12803 % table of ISO specified arithmetic functions 12804 % 12805 % (used for portability checking) 12806 % 12807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 12808 12809 12810 12811 '$lgt_iso_spec_function'('-'(_)). 12812 '$lgt_iso_spec_function'('+'(_, _)). 12813 '$lgt_iso_spec_function'('-'(_, _)). 12814 '$lgt_iso_spec_function'('*'(_, _)). 12815 '$lgt_iso_spec_function'('/'(_, _)). 12816 '$lgt_iso_spec_function'('//'(_, _)). 12817 '$lgt_iso_spec_function'(rem(_, _)). 12818 '$lgt_iso_spec_function'(mod(_, _)). 12819 '$lgt_iso_spec_function'('/\\'(_, _)). 12820 '$lgt_iso_spec_function'('\\/'(_, _)). 12821 '$lgt_iso_spec_function'('\\'(_, _)). 12822 '$lgt_iso_spec_function'('<<'(_, _)). 12823 '$lgt_iso_spec_function'('>>'(_, _)). 12824 '$lgt_iso_spec_function'('**'(_, _)). 12825 12826 '$lgt_iso_spec_function'(abs(_)). 12827 '$lgt_iso_spec_function'(sign(_)). 12828 '$lgt_iso_spec_function'(sqrt(_)). 12829 '$lgt_iso_spec_function'(atan(_)). 12830 '$lgt_iso_spec_function'(cos(_)). 12831 '$lgt_iso_spec_function'(sin(_)). 12832 '$lgt_iso_spec_function'(exp(_)). 12833 '$lgt_iso_spec_function'(log(_)). 12834 '$lgt_iso_spec_function'(float(_)). 12835 '$lgt_iso_spec_function'(ceiling(_)). 12836 '$lgt_iso_spec_function'(floor(_)). 12837 '$lgt_iso_spec_function'(round(_)). 12838 '$lgt_iso_spec_function'(truncate(_)). 12839 '$lgt_iso_spec_function'(float_fractional_part(_)). 12840 '$lgt_iso_spec_function'(float_integer_part(_)). 12708 12841 12709 12842 -
trunk/manuals/index.html
r4212 r4213 32 32 <div class="copyright"> 33 33 <span>Copyright © <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> — <a href="http://logtalk.org">Logtalk.org</a></span><br/> 34 <span>Last updated on: April 19, 2008</span>34 <span>Last updated on: April 21, 2008</span> 35 35 </div> 36 36 <div class="navbottom"> -
trunk/manuals/userman/errors.html
r3650 r4213 90 90 91 91 <p> 92 A warning will be reported if a predicate clause contains a call to a non-ISO defined built-in predicate.92 A warning will be reported if a predicate clause contains a call to a non-ISO specified built-in predicate or to a non-ISO specified arithmetic function. 93 93 </p> 94 94 … … 126 126 <div class="copyright"> 127 127 <span>Copyright © <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> — <a href="http://logtalk.org">Logtalk.org</a></span><br/> 128 <span>Last updated on: April 14, 2007</span>128 <span>Last updated on: April 21, 2008</span> 129 129 </div> 130 130 <div class="navbottom"> -
trunk/manuals/userman/index.html
r4206 r4213 302 302 <div class="copyright"> 303 303 <span>Copyright © <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> — <a href="http://logtalk.org">Logtalk.org</a></span><br/> 304 <span>Last updated on: April 9, 2008</span>304 <span>Last updated on: April 21, 2008</span> 305 305 </div> 306 306 <div class="navbottom"> -
trunk/manuals/userman/predicates.html
r4194 r4213 660 660 </p> 661 661 <p> 662 When calling non-standard Prolog built-in predicates , you may run into portability problems while trying your applications with different back-end Prolog compilers (non-standard predicates are often specific to a Prolog compiler). You may use the Logtalk compiler flag <a title="Consult user manual" href="running.html#options"><code>portability/1</code></a> to help check for problematic calls in your code.662 When calling non-standard Prolog built-in predicates or using non-standard Prolog arithmetic functions, you may run into portability problems while trying your applications with different back-end Prolog compilers (non-standard predicates and non-standard arithmetic functions are often specific to a Prolog compiler). You may use the Logtalk compiler flag <a title="Consult user manual" href="running.html#options"><code>portability/1</code></a> to help check for problematic calls in your code. 663 663 </p> 664 664 … … 676 676 <div class="copyright"> 677 677 <span>Copyright © <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> — <a href="http://logtalk.org">Logtalk.org</a></span><br/> 678 <span>Last updated on: April 7, 2008</span>678 <span>Last updated on: April 21, 2008</span> 679 679 </div> 680 680 <div class="navbottom"> -
trunk/manuals/userman/programming.html
r4039 r4213 99 99 100 100 <p> 101 Logtalk is compatible with almost all modern Prolog compilers. However, this does not necessarily imply that your Logtalk programs will have the same level of portability. If possible, you should only use in your programs Logtalk built-in predicates and ISO Prolog defined built-in predicates. If you need to use built-in predicates that may not be available in other Prolog compilers, you should try to encapsulate the non-portable code in a small number of objects and provide a portable <strong>interface</strong> for that code through the use of Logtalk protocols. An example will be code that access operating-system specific features. The Logtalk compiler can warn you of the use of non-ISO defined built-in predicates by using the <code>portability/1</code> compiler flag.101 Logtalk is compatible with almost all modern Prolog compilers. However, this does not necessarily imply that your Logtalk programs will have the same level of portability. If possible, you should only use in your programs Logtalk built-in predicates and ISO Prolog specified built-in predicates and arithmetic functions. If you need to use built-in predicates (or built-in arithmetic functions) that may not be available in other Prolog compilers, you should try to encapsulate the non-portable code in a small number of objects and provide a portable <strong>interface</strong> for that code through the use of Logtalk protocols. An example will be code that access operating-system specific features. The Logtalk compiler can warn you of the use of non-ISO specified built-in predicates and arithmetic functions by using the <code>portability/1</code> compiler flag. 102 102 </p> 103 103 … … 123 123 </p> 124 124 125 <h3 id="programming_style">Coding style guid lines</h3>125 <h3 id="programming_style">Coding style guidelines</h3> 126 126 127 127 <p> … … 163 163 <div class="copyright"> 164 164 <span>Copyright © <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> — <a href="http://logtalk.org">Logtalk.org</a></span><br/> 165 <span>Last updated on: January21, 2008</span>165 <span>Last updated on: April 21, 2008</span> 166 166 </div> 167 167 <div class="navbottom"> -
trunk/manuals/userman/running.html
r4206 r4213 119 119 <dl> 120 120 <dt><code>portability(Option)</code></dt> 121 <dd>Controls the non-ISO specified built-in predicate calls warnings. Possible option values are <code>warning</code> and <code>silent</code> (the usual default).</dd>121 <dd>Controls the non-ISO specified built-in predicate and non-ISO specified built-in arithmetic function calls warnings. Possible option values are <code>warning</code> and <code>silent</code> (the usual default).</dd> 122 122 </dl> 123 123 <dl> … … 515 515 <div class="copyright"> 516 516 <span>Copyright © <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> — <a href="http://logtalk.org">Logtalk.org</a></span><br/> 517 <span>Last updated on: April 9, 2008</span>517 <span>Last updated on: April 21, 2008</span> 518 518 </div> 519 519 <div class="navbottom"> -
trunk/manuals/userman/userman.header
r4212 r4213 36 36 <span>http://logtalk.org/</span> 37 37 </p> 38 <p class="date">Last updated on April 19, 2008</p>38 <p class="date">Last updated on April 21, 2008</p> 39 39 </div> 40 40 -
trunk/RELEASE_NOTES.txt
r4210 r4213 12 12 13 13 2.31.5 - April ??, 2008 14 15 Added support for checking arithmetic expressions for calls to 16 non-portable function calls when using the "portability" compiler 17 flag. 14 18 15 19 Updated the implementation of the threaded/1 built-in predicate to
