1 % (c) 2009-2024 Lehrstuhl fuer Softwaretechnik und Programmiersprachen,
2 % Heinrich Heine Universitaet Duesseldorf
3 % This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html)
4
5 :- module(compile_time_flags,
6 [compile_time_flag/1,
7 compile_time_flags/1,
8 relevant_prolog_flags/1
9 ]).
10
11 % compile time flags can be set from the command line for SICStus Prolog
12 % e.g., -Dprob_safe_mode=true when starting ProB from source or when generating the .sav file in the Makefile
13
14 :- use_module(module_information,[module_info/2]).
15
16 :- module_info(group,infrastructure).
17 :- module_info(description,'This module describes the possible compile-time flags of ProB.').
18
19 compile_time_flags(list(Flags)) :- % list wrapper for Tcl
20 findall(Flag, compile_time_flag(Flag), Flags).
21
22
23 :- load_files(library(system), [when(compile_time), imports([environ/2])]).
24 :- if(environ(prob_release,true)).
25 compile_time_flag(prob_release).
26 % set when building an official build of probcli or ProB Tcl/Tk
27 % excludes Tcl benchmarks, unit tests
28 :- endif.
29 :- if(environ(prob_safe_mode,true)).
30 compile_time_flag(prob_safe_mode).
31 % perform additional checks
32 % check_ast: check AST ground, check used_id infos for quantifiers...)
33 % check typing in equal_object, variable clashes in comprehension_set, call_residue check in my_findall,...
34 :- endif.
35 :- if(environ(prob_core_only,true)).
36 compile_time_flag(prob_core_only).
37 % probcli only contains core modules, many extensions are not included
38 :- endif.
39 :- if(environ(plspec_patch_libraries,true)).
40 compile_time_flag(plspec_patch_libraries).
41 % use plspec to check calls to ordsets, avl and lists libraries
42 :- endif.
43 :- if(environ(prob_data_validation_mode,true)).
44 compile_time_flag(prob_data_validation_mode).
45 % prevent certain instantiations of sets on the assumption that we do not need powerful constraint solving
46 :- endif.
47 :- if(environ(no_wd_checking,true)).
48 compile_time_flag(no_wd_checking).
49 % disable Well-Definedness checking for function applications
50 :- endif.
51 :- if(environ(prob_profile,true)).
52 compile_time_flag(prob_profile).
53 % store profile information for operations and invariant checking; is now controlled by prob_profiling_on preference
54 % but can be completely turned off by setting prob_profile to false
55 :- endif.
56 :- if(environ(prob_logging_mode,true)).
57 compile_time_flag(prob_logging_mode).
58 % automatically log probcli (add -ll command-line switch)
59 :- endif.
60 :- if(environ(no_terminal_colors,true)).
61 compile_time_flag(no_terminal_colors).
62 % disable terminal colors, can also be influence by setting NO_COLOR environment variable
63 :- endif.
64 :- if(environ(partially_evaluate,true)).
65 compile_time_flag(partially_evaluate).
66 :- endif.
67 :- if(environ(partially_evaluate_compile,true)).
68 compile_time_flag(partially_evaluate_compile).
69 :- endif.
70 :- if(environ(no_interrupts,true)).
71 compile_time_flag(no_interrupts).
72 % do not treat CTRL-C user_interrupts
73 :- endif.
74 :- if(environ(prob_noopt_mode,true)).
75 compile_time_flag(prob_noopt_mode).
76 % now While Loop optimisation
77 :- endif.
78 :- if(environ(prob_debug_flag,true)).
79 compile_time_flag(prob_debug_flag).
80 % additional debugging performed/enabled and checking of performance issues at the B Level
81 :- endif.
82 :- if(environ(prob_debug_watch_flag,true)).
83 compile_time_flag(prob_debug_watch_flag).
84 % watch certain predicate/expression computations precisely and report if they take too long
85 % performs monitoring at a lower level closer to Prolog than prob_debug_flag
86 :- endif.
87 :- if(environ(prob_enter_debugger_upon_error,true)).
88 compile_time_flag(prob_enter_debugger_upon_error).
89 % enter SICStus debugger when exception/error occurs
90 :- endif.
91 :- if(environ(prob_use_timer,true)).
92 compile_time_flag(prob_use_timer).
93 % use microsecond timer
94 :- endif.
95 :- if(environ(prob_src_profile,true)).
96 compile_time_flag(prob_src_profile).
97 % perform profiling at B source level in source_profiler.pl,
98 % now controlled by preference prob_source_profiling_on, but -Dprob_src_profile=false can disable it
99 :- endif.
100 :- if(environ(prob_myheap,false)).
101 compile_time_flag(prob_myheap_false).
102 % do not use C++ priority queue
103 :- endif.
104 :- if(environ(prob_c_counter,false)).
105 compile_time_flag(prob_c_counter_false).
106 % do not use C++ counter
107 :- endif.
108 :- if(environ(disable_chr,true)).
109 compile_time_flag(disable_chr). % do not include CHR library at all
110 :- endif.
111 :- if(environ(enable_time_out_for_constraints,true)).
112 compile_time_flag(enable_time_out_for_constraints). % use time_out for posting constraints
113 :- endif.
114 :- if(environ('SP_JIT',disabled)).
115 compile_time_flag('SP_JIT=disabled').
116 :- endif.
117 :- if(environ('SP_JIT',yes)).
118 compile_time_flag('SP_JIT=yes'). % this is the default
119 :- endif.
120 :- if(environ('SP_JIT',no)).
121 compile_time_flag('SP_JIT=no').
122 :- endif.
123 :- if(environ('SP_JIT_COUNTER_LIMIT',_)).
124 compile_time_flag('SP_JIT_COUNTER_LIMIT_SET'). % default is 0
125 :- endif.
126 :- if(environ('SP_JIT_CLAUSE_LIMIT',_)).
127 compile_time_flag('SP_JIT_CLAUSE_LIMIT_SET'). % default is 1024
128 :- endif.
129 :- if(environ('SP_SPTI_PATH',verbose)).
130 compile_time_flag('SP_SPTI_PATH=verbose'). % can be set to verbose
131 :- endif.
132 :- if(environ('SP_TIMEOUT_IMPLEMENTATON',legacy)).
133 % Needed with SICStus 4.4.0 to work around an issue with nested timeouts.
134 % Should have no effect on any other SICStus version.
135 % This is not actually a compile-time flag - it only takes effect when set at runtime.
136 compile_time_flag('SP_TIMEOUT_IMPLEMENTATON=legacy').
137 :- endif.
138
139 compile_time_flag(_) :- fail.
140
141
142 relevant_prolog_flags(Flags) :-
143 findall(Flag/Val, (relevant_flag(Flag),current_prolog_flag(Flag,Val)), Flags).
144
145 relevant_flag(dialect).
146 relevant_flag(version_data).
147 relevant_flag(platform_data).
148 relevant_flag(profiling).
149 relevant_flag(system_type).
150 relevant_flag(host_type).
151