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.20 2001/04/18 04:51:42 mast Exp $ + //! $Id: utils.pmod,v 1.21 2001/05/18 23:04:28 mast Exp $         final string format_short (mixed val)   {    if (stringp (val))    if (sizeof (val) <= 30)    return sprintf ("%O", val);    else    return sprintf ("%O/.../", val[..29]);    else {    val = sprintf ("%O", val);    if (sizeof (val) <= 30) -  return val; +  return replace (val, "\n", " ");    else -  return val[..29] + "/.../"; +  return String.trim_whites (replace (val[..29], "\n", " ")) + "/.../";    }   }      final array return_zero (mixed... ignored) {return 0;}   final array return_empty_array (mixed... ignored) {return ({});}      final int(1..1)|string|array free_text_error (object/*(RMXL.PXml)*/ p, string str)   {    sscanf (str, "%[ \t\n\r]", string ws);    if (str != ws)
Roxen.git/server/etc/modules/RXML.pmod/utils.pmod:69:    return ({str});   }         // PXml and PEnt callbacks.      final int(1..1)|string|array p_xml_comment_cb (object/*(RXML.PXml)*/ p, string str)   // FIXME: This is a kludge until quote tags are handled like other tags.   {    if (p->type->handle_literals) p->handle_literal(); +  else if (p->p_code) p->p_code_literal();    string name = p->parse_tag_name (str);    if (sizeof (name)) {    name = p->tag_name() + name;    if (string|array|function tdef = p->tags()[name]) {    if (stringp (tdef))    return ({tdef});    else if (arrayp (tdef))    return tdef[0] (p, p->parse_tag_args (str), @tdef[1..]);    else    return tdef (p, p->parse_tag_args (str));
Roxen.git/server/etc/modules/RXML.pmod/utils.pmod:112:    int char) == 2)    catch (str = (string) ({char}));    // Lax error handling: Just let it through if it can't be    // converted. Not really good, though.    }    }    else    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);    if (value != RXML.nil) {    if (type->free_text) return ({value});    p->add_value (value);    }    return ({});
Roxen.git/server/etc/modules/RXML.pmod/utils.pmod:138:   }      final int(1..1)|string|array p_xml_compat_entity_cb (object/*(RMXL.PXml)*/ p, string str)   {    RXML.Type type = p->type;    string entity = p->tag_name();    if (sizeof (entity) && entity[0] != '#')    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 : p->type); +  p->html_context() == "splice_arg" ? RXML.t_string : type);    if (value != RXML.nil) {    if (type->free_text) 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});   }