File: simplifier.pro

package info (click to toggle)
spark 2012.0.deb-9
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 29,260 kB
  • ctags: 3,098
  • sloc: ada: 186,243; cpp: 13,497; makefile: 685; yacc: 440; lex: 176; ansic: 119; sh: 16
file content (223 lines) | stat: -rw-r--r-- 8,102 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
% -----------------------------------------------------------------------------
%  (C) Altran Praxis Limited
% -----------------------------------------------------------------------------
% 
%  The SPARK toolset is free software; you can redistribute it and/or modify it
%  under terms of the GNU General Public License as published by the Free
%  Software Foundation; either version 3, or (at your option) any later
%  version. The SPARK toolset is distributed in the hope that it will be
%  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
%  Public License for more details. You should have received a copy of the GNU
%  General Public License distributed with the SPARK toolset; see file
%  COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy of
%  the license.
% 
% =============================================================================


%###############################################################################
% PURPOSE
%-------------------------------------------------------------------------------
% Top level file, to build the Simplifier.
%###############################################################################


%###############################################################################
% MODULE
%###############################################################################


%###############################################################################
% DEPENDENCIES
%###############################################################################

%###############################################################################
% TYPES
%###############################################################################


%###############################################################################
% DATA
%###############################################################################


%###############################################################################
% PREDICATES
%###############################################################################

%===============================================================================
% LOAD ENHANCED DEFECT REPORTING
%===============================================================================
:- use_module('defectreporting.pro').
%===============================================================================

%===============================================================================
% LOAD SICSTUS LIBRARIES BEFORE DYNAMIC CHANGES
%===============================================================================
:- use_module('librarypredicates.pro').

:- load_files(library(system), [when(compile_time), imports([environ/2])]).

%===============================================================================

%===============================================================================
% DYNAMIC FEATURES PRE-LOAD
%===============================================================================
:- use_module('settings.pro',
              [declare_settings/0]).
:- declare_settings.

:- use_module('opdeclar.pro',
              [declare_operators/0,
               hide_operators/0]).
:- declare_operators.

% Conditional compilation - only compile usage utilities is the user
% has installed TCLTK libraries and wants usage profiling.

:- if(environ('USAGE_PROFILING', 'ON')).

:- use_module('usage_utilities.pro',
              [save_usage_data/0,
               view_usage/0]).
:- endif.

%===============================================================================

%===============================================================================
% FIXED SYSTEM CONFIGURATION
%-------------------------------------------------------------------------------
% This information will be the same for every execution of the tool.
%===============================================================================
:- use_module('data__system.pro',
              [add_system_toolname/1]).

:- use_module('load__switches.pro').

%===============================================================================

%===============================================================================
% LOAD SYSTEM
%===============================================================================
:- include('main_simplifier.pro').
%===============================================================================

%===============================================================================
% runtime_entry(start).
%-------------------------------------------------------------------------------
% This is a special Sicstus predicate, which will be automatically invoked
% when restoring a saved state. It is the top level, or main, predicate.
%===============================================================================

runtime_entry(start):-
    simplifier_main,
    save_usage_profile,
    halt(0),
    !.

%===============================================================================
% save_usage_profile
%-------------------------------------------------------------------------------
% Predicate to save usage data if usage switch specifies a file.
% Usage is only possible when the Simplifier is compiled using the
% prolog flag profiledcode (refer to makefile) and when it is run in
% Sicstus interactive mode (limitation of Sicstus) - see usage_profile script.
%===============================================================================

:- if(environ('USAGE_PROFILING', 'ON')).

save_usage_profile:-
    \+ get_switch_usage(no_usage_file),
    save_usage_data,
    !.

:- endif.

save_usage_profile:-
    !.

%===============================================================================
% show_usage
%-------------------------------------------------------------------------------
% Show collected usage data.
%===============================================================================

:- if(environ('USAGE_PROFILING', 'ON')).

show_usage:-
    load_switches,
    view_usage,
    halt(0).

:- endif.

%===============================================================================

%===============================================================================
% DYNAMIC FEATURES POST-LOAD
%===============================================================================

% _After_ all dynamic predicates have been introduced, we need to disable
% "dynamic" as an operator in case a user has an fdl entity called
% "dynamic". Same goes for the other predefined prolog operators that might
% look like fdl identifiers. See the sicstus manual section "Standard
% Operators"
:- hide_operators.
%===============================================================================

%===============================================================================
% BUILD SAV AND HALT
%===============================================================================

buildsav_simplifier:-
    zero_defects_reported,
    save_program('spadesimp.sav'),
    halt(0).

buildsav_simplifier:-
    report_total_defects,
    halt(1).

buildsav_zombiescope:-
    zero_defects_reported,
    save_program('zombiescope.sav'),
    halt(0).

buildsav_zombiescope:-
    report_total_defects,
    halt(1).

buildsav_usage_profiled:-
    zero_defects_reported,
    save_program('spadesimp_usage_profiled.sav'),
    halt(0).

buildsav_usage_profiled:-
    report_total_defects,
    halt(1).

% The following are for building with SWI

swisav_simplifier:-
    zero_defects_reported,
    qsave_program('spadesimp', [autoload(true), goal(simplifier_main), stand_alone(false)]),
    halt(0).

swisav_simplifier:-
    report_total_defects,
    halt(1).

swisav_zombiescope:-
    zero_defects_reported,
    qsave_program('zombiescope', [autoload(true), goal(simplifier_main), stand_alone(false)]),
    halt(0).

swisav_zombiescope:-
    report_total_defects,
    halt(1).

%===============================================================================

%###############################################################################
% END-OF-FILE