Method code for $parse_lib.filter_ctext()

[Turn off line numbering]
  1: arg what, @defaults;
  2: var dic, output, prop, eff, ctext;
  3: 
  4: dic = #[['receiver, sender()], ['time, 'post], ['formatter, $plain_format]];
  5: if (defaults && type(defaults[1]) == 'dictionary)
  6:     dic = dict_union(dic, defaults[1]);
  7: switch (class(what)) {
  8:     case $ctext_frob:
  9:         output = what.set_vars(dic).format();
 10:     case $message_frob:
 11:         output = what.format(dic);
 12:     case $filtered_frob:
 13:         if ((prop = (| sender().default_propagator() |)))
 14:             what = what.propagate(prop);
 15:         if (!what) {
 16:             output = `[];
 17:         } else {
 18:             ctext = what.message().to_ctext(dic);
 19:             for eff in (what.effects()) {
 20:                 if (type(eff) == 'string)
 21:                     ctext = $ctext_frob.new_with([eff + " "], ctext.vars()).append(ctext);
 22:                 else
 23:                     ctext = $propagator_effects.(eff[1])(ctext, dic, eff.subrange(2));
 24:             }
 25:             ctext = ctext.set_vars(what.sensory());
 26:             output = ctext.format();
 27:         }
 28:     default:
 29:         output = what;
 30: }
 31: return output;

// Created 27-Mar-1995 as a part of ColdCore, see: @help Credit

Tlon