/
ColdCore-3.0a9.02/
ColdCore-3.0a9.02/src/
new object $ctext_frob: $frob;

var $root created_on = 837584074;
var $root flags = ['variables, 'methods, 'code, 'core];
var $root inited = 1;
var $root managed = [$ctext_frob];
var $root manager = $ctext_frob;

public method ._ctext() {
    arg this;
    
    return this[1];
};

public method .append() {
    arg this, new, @br;
    var data, tmp, vars;
    
    data = this[1];
    vars = this[2];
    if (br) {
        switch (br[1]) {
            case "p":
                data += [(<$format, ["p", [], [], 'do_p]>)];
            case "br":
                data += [(<$format, ["br", [], [], 'do_br]>)];
            default:
                data += [$format.new_tag(br[1], [], [])];
        }
    }
    if (type(new) == 'list) {
        data += new;
    } else if ((type(new) == 'frob) && (class(new) == $ctext_frob)) {
        data += new._ctext();
        vars = (new.vars()).union(vars);
    } else {
        data += [new];
    }
    return (<this(), [data, vars]>);
};

public method .eval_ctext() {
    arg this;
    var data, vars;
    
    vars = this[2];
    vars = vars.add('time, 'pre);
    if (!(| vars['sender] |))
        vars = vars.add('sender, sender());
    if (!(| vars['evaluator] |))
        vars = vars.add('evaluator, $bs_eval);
    vars = vars.union((vars['evaluator]).init());
    return .new_with(@(vars['evaluator])._eval_ctext(this[1], vars));
};

public method .format() {
    arg this;
    var vars;
    
    vars = this[2];
    vars = vars.add('time, 'post);
    if (!(| vars['receiver] |))
        vars = vars.add('receiver, sender());
    if (!(| vars['evaluator] |))
        vars = vars.add('evaluator, $bs_eval);
    if (!(| vars['formatter] |))
        vars = vars.add('formatter, $plain_format);
    vars = vars.union((vars['formatter]).init());
    return (vars['formatter]).format(this[1], vars);
};

public method .get_var() {
    arg this, name;
    
    return (this[2])[name];
};

public method .new_with() {
    arg data, @vars;
    
    [(vars ?= #[])] = vars;
    return (<this(), [data, vars]>);
};

public method .set_var() {
    arg this, name, value;
    var vars;
    
    vars = this[2];
    vars = vars.add(name, value);
    return (<this(), [this[1], vars]>);
};

public method .set_vars() {
    arg this, new;
    var vars, key;
    
    return (<this(), [this[1], new.union(this[2])]>);
    vars = this[2];
    for key in (new.keys())
        vars = vars.add(key, new[key]);
    return (<this(), [this[1], vars]>);
};

public method .uncompile() {
    arg this;
    var vars;
    
    vars = this[2];
    if (!(| vars['uncompiler] |))
        vars = vars.add('uncompiler, $uncompiler);
    vars = vars.union((vars['uncompiler]).init());
    return ((vars['uncompiler])._eval_ctext(this[1], vars))[1];
};

public method .vars() {
    arg this;
    
    return this[2];
};