File: patch.make

package info (click to toggle)
mercury 0.9-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 18,488 kB
  • ctags: 9,800
  • sloc: objc: 146,680; ansic: 51,418; sh: 6,436; lisp: 1,567; cpp: 1,040; perl: 854; makefile: 450; asm: 232; awk: 203; exp: 32; fortran: 3; csh: 1
file content (165 lines) | stat: -rw-r--r-- 6,314 bytes parent folder | download
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
%------------------------------------------------------------------------------%
% Copyright (C) 1999 INRIA/INSA.
--- /soft/eclipse/eclipse4.1/lib_pd/opium_light/make.op	Sat Feb 20 16:09:16 1999
+++ make.op	Thu Nov  4 09:01:40 1999
@@ -95,8 +95,9 @@
 	atom_string(ObjDir, ObjDirS),
 	make_scenario_Op(SName, Mod, OptionList, SrcDir, ObjDir).
 make_scenario_Op(S, Mod, OptionList) :-
-	get_opiumdir(ODS),
-	append_strings(ODS, "opiumfiles/", ObjDirS),
+	getenv('MERCURY_OPIUM_DIR', OpiumDir),
+	append_strings(OpiumDir, "/source/", ODS),
+	append_strings(ODS, "/opiumfiles/", ObjDirS),
 	atom_string(OD, ODS),
 	atom_string(ObjDir, ObjDirS),
 	make_scenario_Op(S, Mod, OptionList, OD, ObjDir).
@@ -202,9 +203,9 @@
 	opium_scenario_in_module((name:Scenario, _,_, options:[_,_,global], _,_), Mod1),
 	Mod \== Mod1,
 	!,
-	opium_printf(error, "scenario %w is already global in module %w\n", [Scenario, Mod1]).
+	printf(error, "scenario %w is already global in module %w\n", [Scenario, Mod1]).
 make_scenario_Op(Scenario, Mod, [A, T, GloLoc], SrcDir, ObjDir) :-	
-	opium_printf(output, "\nmaking scenario %w (%w)\n", [Scenario, GloLoc]),
+	printf(output, "\nmaking scenario %w (%w)\n", [Scenario, GloLoc]),
 	set_dbgcomp_flag(T),
 	file_suffixe_flag(SrcSuff, _, _),
 	concat_atom([SrcDir, Scenario, SrcSuff], BaseFile),
@@ -218,7 +219,7 @@
 make_scenario_Op(Scenario, Mod, OptionList, SrcDir, ObjDir) :-
 	reset_error_handler(95),
 	set_dbgcomp_flag(traceable),
-	opium_printf(error, "scenario %w could not be made\n", [Scenario]).
+	printf(error, "scenario %w could not be made\n", [Scenario]).
 
 /*
  *  first check whether scenario is declared in base file,
@@ -230,7 +231,7 @@
 		read(S, X),
 		(	X = end_of_file,
 			!,
-			opium_printf(error, "scenario %w should be declared in file %w\n", [Scenario, BaseFile]),
+			printf(error, "scenario %w should be declared in file %w\n", [Scenario, BaseFile]),
 			close(S),
 			fail
 		;
@@ -255,7 +256,8 @@
 	assert(current_options([A, T, GL])),
  	update(Scenario, Mod, [A, T, GL], FileList, Time, SrcDir, ObjDir),
 	retract_all(current_options(_)),
-	make_interface_list(Scenario, GL, Mod),	% for windowing user-interface
+% [R1] Not available for Opium-M.
+%	make_interface_list(Scenario, GL, Mod),	% for windowing user-interface
 	(opium_level(0) ->
 		/* we are booting Opium, so c parameters cannot be set */
 		initialize_parameters(single, Scenario, Mod),
@@ -314,7 +316,7 @@
 	/* scenario already globally present in another module */
 	!.
 make_needed_scenarios_i(NeededScenario, Mod) :-
-	opium_printf(output, "scenario %w needed but not present\n", [NeededScenario]),
+	printf(output, "scenario %w needed but not present\n", [NeededScenario]),
 	make(NeededScenario, Mod).
 
 /*
@@ -341,11 +343,18 @@
 	load_file_if_needed(Scenario, Mod, OptionList, SrcF, LoadF, AutoLoadF, TranslateTime).
 update_i(Scenario, Mod, OptionList, UpdateTime, SrcF, LoadF, AutoLoadF, SrcDir) :-
 	modify_time(LoadF, TranslateTime),
-	TranslateTime >= UpdateTime,
+	% R1 XXX Bug here: UpdateTime in not instanciated. 
+	% To turn around that bug, I have simply commented it out, which is ok
+	% since removing that test can only cause files to be loaded
+	% whereas it was not neccessary. It would certainly be necessary
+	% to look at it more carefully to fix that bug in a proper way.
+	% The best way to fix that kind of bugs is certainly to rewrite 
+	% everything in Mercury ;-)
+%	 TranslateTime >= UpdateTime,
 	!,
 	load_file_if_needed(Scenario, Mod, OptionList, SrcF, LoadF, AutoLoadF, TranslateTime).
 update_i(Scenario, Mod, OptionList, UpdateTime, SrcF, LoadF, AutoLoadF, ScrDir) :-
-	opium_printf(output, "%w is up-to-date\n", [SrcF]).
+	printf(output, "%w is up-to-date\n", [SrcF]).
 	
 /*
  *  load_file_if_needed/7
@@ -359,12 +368,12 @@
 load_file_if_needed(Scenario, Mod, [active, Traceable, GloLoc], SrcF, LoadF, AutoLoadF, TranslateTime) :-
 	file_to_be_loaded(Scenario, Mod, SrcF, LoadF, Traceable, GloLoc, TranslateTime),
 	!,
-	call(current_options(O), opium_kernel),
-	opium_printf(output, "loading %w\n", [SrcF]),
+	call(current_options(O), 'Opium-M'),
+	printf(output, "loading %w\n", [SrcF]),
 	compile(SrcF, Mod),
 	compile(LoadF, Mod),
 	update_file_name(Scenario, Mod, SrcF),
-	opium_printf(output, "%w is loaded\n", [SrcF]).
+	printf(output, "%w is loaded\n", [SrcF]).
 load_file_if_needed(Scenario, Mod, OptionL, SrcF, LoadF, AutoLoadF, TranslateTime).
 
 /*
@@ -377,9 +386,13 @@
 	S \== Scenario,
 	O = options : [active, Traceable, GloLoc],
 	member(SrcFile, Files),
-	UpdateTime > TTime,
+	% XXX make/5 crashes because this is uninstanciated.
+	% Removing it seems to make things work. It is ok to do 
+	% that since the only problem it can cause is that the message 
+	% "%w is up-to-date\n" migth be printed when it is not the case...
+%	 UpdateTime > TTime,
 	!,
-	opium_printf(output, "%w is up-to-date\n", [SrcFile]),
+	printf(output, "%w is up-to-date\n", [SrcFile]),
 	fail.
 file_to_be_loaded(Scenario, Mod, SrcFile, LoadF, Traceable, GloLoc, TTime) :-
 	opium_scenario_in_module((name:S, files:Files, N, O, updated:UpdateTime, M), Mod1),
@@ -449,7 +462,7 @@
 	!.
 provide_dir(Dir) :-
 	concat_atom([mkdir, '  ', Dir], SystemCmd),
-	system(SystemCmd).
+	sh(SystemCmd).
 
 
 /*
@@ -524,7 +537,7 @@
 load_decl_body(Clause, Module).
 
 add_gloloc_directive(Clause, Module) :-
-	call(current_options([_,_,GloLoc]), opium_kernel),
+	call(current_options([_,_,GloLoc]), 'Opium-M'),
 	add_gloloc_directive(Clause, Module, GloLoc).
 
 add_gloloc_directive(_, _, global) :-
@@ -755,16 +768,18 @@
 provide_opium_module(Mod) :-
 	is_opium_module(Mod),
 	!.
-provide_opium_module(Mod) :-
-	update_opium_module_menu(Mod),		% for wui interface
-	opium_printf(output, "creating opium module %w\n", [Mod]),
-	(current_module(Mod) ->
-		true
-	;
-		create_module(Mod)
-	),
-	get_opium_file("opium_module", File),
-	compile(File, Mod).
+
+% [R1] Removed because update_opium_module_menu is not available in Opium-M
+% provide_opium_module(Mod) :-
+% 	update_opium_module_menu(Mod),		% for wui interface
+% 	printf(output, "creating opium module %w\n", [Mod]),
+% 	(current_module(Mod) ->
+% 		true
+% 	;
+% 		create_module(Mod)
+% 	),
+% 	get_opium_file("opium_module", File),
+% 	compile(File, Mod).
 
 /*
  *  initialize_parameters(Type, Scenario, Mod)