about summary refs log blame commit diff stats
path: root/cpp/025trace
blob: ae06cb8b8cb683a7ae2303503cef3890ccd8dd7f (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[0]));
  string label = current_instruction().ingredients[0].name;
  assert(isa_literal(current_instruction().ingredients[1]));
  string message = current_instruction().ingredients[1].name;
  trace(label) << message;
  break;
}