| 1 | % (c) 2009-2019 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_data_validation_mode,true)). | |
| 36 | compile_time_flag(prob_data_validation_mode). | |
| 37 | % prevent certain instantiations of sets on the assumption that we do not need powerful constraint solving | |
| 38 | :- endif. | |
| 39 | :- if(environ(no_wd_checking,true)). | |
| 40 | compile_time_flag(no_wd_checking). | |
| 41 | % disable Well-Definedness checking for function applications | |
| 42 | :- endif. | |
| 43 | :- if(environ(prob_profile,true)). | |
| 44 | compile_time_flag(prob_profile). | |
| 45 | % store profile information for operations and invariant checking | |
| 46 | :- endif. | |
| 47 | :- if(environ(prob_logging_mode,true)). | |
| 48 | compile_time_flag(prob_logging_mode). | |
| 49 | % automatically log probcli (add -ll command-line switch) | |
| 50 | :- endif. | |
| 51 | :- if(environ(prob_observe_runtime,true)). | |
| 52 | compile_time_flag(prob_observe_runtime). | |
| 53 | % observe runtime of closure expansions and print message when this takes long | |
| 54 | :- endif. | |
| 55 | :- if(environ(no_terminal_colors,true)). | |
| 56 | compile_time_flag(no_terminal_colors). | |
| 57 | % disable terminal colors, can also be influence by setting NOCOLOR environment variable | |
| 58 | :- endif. | |
| 59 | :- if(environ(partially_evaluate,true)). | |
| 60 | compile_time_flag(partially_evaluate). | |
| 61 | :- endif. | |
| 62 | :- if(environ(partially_evaluate_compile,true)). | |
| 63 | compile_time_flag(partially_evaluate_compile). | |
| 64 | :- endif. | |
| 65 | :- if(environ(use_pe_cache,true)). | |
| 66 | compile_time_flag(use_pe_cache). | |
| 67 | :- endif. | |
| 68 | :- if(environ(no_interrupts,true)). | |
| 69 | compile_time_flag(no_interrupts). | |
| 70 | % do not treat CTRL-C user_interrupts | |
| 71 | :- endif. | |
| 72 | :- if(environ('SP_JIT',disabled)). | |
| 73 | compile_time_flag('SP_JIT=disabled'). | |
| 74 | :- endif. | |
| 75 | :- if(environ('SP_JIT',yes)). | |
| 76 | compile_time_flag('SP_JIT=yes'). % this is the default | |
| 77 | :- endif. | |
| 78 | :- if(environ('SP_JIT',no)). | |
| 79 | compile_time_flag('SP_JIT=no'). | |
| 80 | :- endif. | |
| 81 | :- if(environ('SP_JIT_COUNTER_LIMIT',_)). | |
| 82 | compile_time_flag('SP_JIT_COUNTER_LIMIT_SET'). % default is 0 | |
| 83 | :- endif. | |
| 84 | :- if(environ('SP_JIT_CLAUSE_LIMIT',_)). | |
| 85 | compile_time_flag('SP_JIT_CLAUSE_LIMIT_SET'). % default is 1024 | |
| 86 | :- endif. | |
| 87 | :- if(environ('SP_SPTI_PATH',verbose)). | |
| 88 | compile_time_flag('SP_SPTI_PATH=verbose'). % can be set to verbose | |
| 89 | :- endif. | |
| 90 | :- if(environ('SP_TIMEOUT_IMPLEMENTATON',legacy)). | |
| 91 | compile_time_flag('SP_TIMEOUT_IMPLEMENTATON=legacy'). % can be set to verbose | |
| 92 | :- endif. | |
| 93 | ||
| 94 | compile_time_flag(_) :- fail. | |
| 95 | ||
| 96 | ||
| 97 | relevant_prolog_flags(Flags) :- | |
| 98 | findall(Flag/Val, (relevant_flag(Flag),current_prolog_flag(Flag,Val)), Flags). | |
| 99 | ||
| 100 | relevant_flag(dialect). | |
| 101 | relevant_flag(version_data). | |
| 102 | relevant_flag(profiling). |