about summary refs log blame commit diff stats
path: root/025trace.cc
blob: 7bd3e579841efe70133eaa4f15e7a5102d8a5ec5 (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                                                                            
                 




                                      

                                             

                                        

                                                



                                                                


                          









                                                
//: Allow mu programs to log facts just like we've been doing in C++ so far.

:(scenario trace)
recipe main [
  trace [foo], [this is a trace in mu]
]
+foo: this is a trace in mu

:(before "End Primitive Recipe Declarations")
TRACE,
:(before "End Primitive Recipe Numbers")
Recipe_number["trace"] = TRACE;
:(before "End Primitive Recipe Implementations")
case TRACE: {
  assert(isa_literal(current_instruction().ingredients.at(0)));
  string label = current_instruction().ingredients.at(0).name;
  assert(isa_literal(current_instruction().ingredients.at(1)));
  string message = current_instruction().ingredients.at(1).name;
  trace(label) << message;
  break;
}

:(before "End Primitive Recipe Declarations")
HIDE_WARNINGS,
:(before "End Primitive Recipe Numbers")
Recipe_number["hide-warnings"] = HIDE_WARNINGS;
:(before "End Primitive Recipe Implementations")
case HIDE_WARNINGS: {
  Hide_warnings = true;
  break;
}