Changeset 619 for Deliverables/D2.2/8051/src/languages.ml
- Timestamp:
- Mar 2, 2011, 3:27:41 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Deliverables/D2.2/8051/src/languages.ml
r486 r619 199 199 (* FIXME *) 200 200 let instrument costs_mapping = function 201 | AstClight p -> 202 AstClight (ClightAnnotator.instrument p costs_mapping) 201 | AstClight p -> 202 let (p', cost_incr) = ClightAnnotator.instrument p costs_mapping in 203 (AstClight p', cost_incr) 203 204 | AstCminor p -> 204 AstCminor (CminorAnnotator.instrument p costs_mapping) 205 let (p', cost_incr) = CminorAnnotator.instrument p costs_mapping in 206 (AstCminor p', cost_incr) 205 207 | p -> 206 208 Error.warning "during instrumentation" … … 208 210 "Instrumentation is not implemented for source language `%s'." 209 211 (to_string (language_of_ast p))); 210 p212 (p, "") 211 213 212 214 let annotate input_ast final = … … 232 234 ASMPrinter.print_program p 233 235 234 let save filename ast = 235 let output_filename = 236 Misc.SysExt.alternative 237 (Filename.chop_extension filename 238 ^ "." ^ extension (language_of_ast ast)) 239 in 236 let save exact_output filename ast = 237 let ext_chopped_filename = 238 if exact_output then filename 239 else 240 try Filename.chop_extension filename 241 with Invalid_argument ("Filename.chop_extension") -> filename in 242 let ext_filename = 243 ext_chopped_filename ^ "." ^ extension (language_of_ast ast) in 244 let output_filename = 245 if exact_output then ext_filename 246 else Misc.SysExt.alternative ext_filename in 240 247 let cout = open_out output_filename in 241 248 output_string cout (string_output ast); … … 243 250 close_out cout 244 251 245 let interpret = function 252 let save_cost_incr filename cost_incr = 253 let cout = open_out (filename ^ ".cerco") in 254 output_string cout cost_incr; 255 flush cout; 256 close_out cout 257 258 let interpret print_result = function 246 259 | AstClight p -> 247 ClightInterpret.interpret falsep260 ClightInterpret.interpret print_result p 248 261 | AstCminor p -> 249 CminorInterpret.interpret falsep262 CminorInterpret.interpret print_result p 250 263 | AstRTLabs p -> 251 RTLabsInterpret.interpret p 264 RTLabsInterpret.interpret print_result p 252 265 | AstRTL p -> 253 RTLInterpret.interpret p 266 RTLInterpret.interpret print_result p 254 267 | AstERTL p -> 255 ERTLInterpret.interpret p 268 ERTLInterpret.interpret print_result p 256 269 | AstLTL p -> 257 LTLInterpret.interpret p 270 LTLInterpret.interpret print_result p 258 271 | AstLIN p -> 259 LINInterpret.interpret p 272 LINInterpret.interpret print_result p 260 273 | AstASM p -> 261 ASMInterpret.interpret p 274 ASMInterpret.interpret print_result p
Note: See TracChangeset
for help on using the changeset viewer.