Roxen.git / server / etc / modules / RXML.pmod / utils.pmod

version» Context lines:

Roxen.git/server/etc/modules/RXML.pmod/utils.pmod:1:   //! Things that belong elsewhere but can't lie there for various silly   //! reasons. Everything here is considered internal and not part of   //! the RXML.pmod API.   //!   //! E.g. one reason is to avoid circular references in the parser   //! objects when the callbacks are defined in them.   //!   //! Created 2000-01-21 by Martin Stjernholm   //! - //! $Id: utils.pmod,v 1.23 2001/06/09 00:33:25 mast Exp $ + //! $Id: utils.pmod,v 1.24 2001/06/18 15:19:44 mast Exp $      constant short_format_length = 40;      final string format_short (mixed val)   // This one belongs somewhere else..   {    string res = "";       void format_val (mixed val)    {    if (arrayp (val) || multisetp (val)) {    string end;    if (multisetp (val)) res += "(<", end = ">)", val = indices (val);    else res += "({", end = "})";    if (sizeof (res) >= short_format_length) throw (0);    for (int i = 0; i < sizeof (val);) { -  res += format_val (val[i]); -  if (++i < sizeof (val) - 1) res += ", "; +  format_val (val[i]); +  if (++i < sizeof (val)) res += ", ";    if (sizeof (res) >= short_format_length) throw (0);    }    res += end;    }    else if (mappingp (val)) {    res += "([";    if (sizeof (res) >= short_format_length) throw (0);    array ind = sort (indices (val));    for (int i = 0; i < sizeof (ind);) { -  res += format_val (ind[i]) + ": "; +  format_val (ind[i]) + ": ";    if (sizeof (res) >= short_format_length) throw (0); -  res += format_val (val[ind[i]]); -  if (++i < sizeof (ind) - 1) res += ", "; +  format_val (val[ind[i]]); +  if (++i < sizeof (ind)) res += ", ";    if (sizeof (res) >= short_format_length) throw (0);    }    res += "])";    }    else {    if (stringp (val) && sizeof (val) > short_format_length - sizeof (res)) {    sscanf (val, "%[ \t\n\r]", string lead);    if (sizeof (lead) > sizeof ("/.../") && sizeof (lead) < sizeof (val))    val = val[sizeof (lead)..], res += "/.../";    if (sizeof (val) > short_format_length - sizeof (res)) {
Roxen.git/server/etc/modules/RXML.pmod/utils.pmod:181:    if (entity[0] == ':') str = entity[1..];    else if (has_value (entity, ".")) {    if (type->handle_literals) p->handle_literal();    else if (p->p_code) p->p_code_literal();    mixed value = p->handle_var (    p,    entity,    // No quoting of splice args. FIXME: Add some sort of    // safeguard against splicing in things like "nice><evil    // stuff='...'"? -  p->html_context() == "splice_arg" ? RXML.t_string : type); +  p->html_context() == "splice_arg" ? RXML.t_any_text : type);    if (value != RXML.nil) {    if (type->free_text && !p->p_code) return ({value});    p->add_value (value);    }    return ({});    }    if (!type->free_text)    RXML.parse_error ("Unknown entity \"&%s;\" not allowed context of type %s.\n",    entity, type->name);    return ({str});
Roxen.git/server/etc/modules/RXML.pmod/utils.pmod:209:    if (entity[0] == ':') str = entity[1..];    else if (has_value (entity, ".")) {    if (type->handle_literals) p->handle_literal();    else if (p->p_code) p->p_code_literal();    mixed value = p->handle_var (    p,    entity,    // No quoting of splice args. FIXME: Add some sort of    // safeguard against splicing in things like "nice><evil    // stuff='...'"? -  p->html_context() == "splice_arg" ? RXML.t_string : type); +  p->html_context() == "splice_arg" ? RXML.t_any_text : type);    if (value != RXML.nil) {    if (type->free_text && !p->p_code) return ({value});    p->add_value (value);    }    return ({});    }    if (!type->free_text)    RXML.parse_error ("Unknown entity \"&%s;\" not allowed in context of type %s.\n",    entity, type->name);    return ({str});   }