pike.git / src / modules / Parser / html.c

version» Context lines:

pike.git/src/modules/Parser/html.c:935:    *! @returns    *! Returns the object being called.    *!    *! @seealso    *! @[tags], @[containers], @[entities]    *!    */      static void html_add_tag(INT32 args)   { -  check_all_args("add_tag",args,BIT_STRING, +  check_all_args(NULL,args,BIT_STRING,    BIT_INT|BIT_STRING|BIT_ARRAY|BIT_FUNCTION|BIT_OBJECT|BIT_PROGRAM,0);    if (TYPEOF(sp[1-args]) == T_ARRAY) {    struct array *a = sp[1-args].u.array;    if (!a->size ||    (TYPEOF(a->item[0]) != T_FUNCTION && TYPEOF(a->item[0]) != T_OBJECT &&    TYPEOF(a->item[0]) != T_PROGRAM))    SIMPLE_ARG_TYPE_ERROR("add_tag", 1, "array with function as first element");    }    else if (TYPEOF(sp[1-args]) == T_INT && sp[1-args].u.integer)    SIMPLE_ARG_TYPE_ERROR("add_tag", 1, "zero, string, array or function");
pike.git/src/modules/Parser/html.c:970:    if (UNSAFE_IS_ZERO(sp-1))    map_delete(THIS->maptag,sp-2);    else    mapping_insert(THIS->maptag,sp-2,sp-1);    pop_n_elems(args);    ref_push_object(THISOBJ);   }      static void html_add_container(INT32 args)   { -  check_all_args("add_container",args,BIT_STRING, +  check_all_args(NULL,args,BIT_STRING,    BIT_INT|BIT_STRING|BIT_ARRAY|BIT_FUNCTION|BIT_OBJECT|BIT_PROGRAM,0);    if (TYPEOF(sp[1-args]) == T_ARRAY) {    struct array *a = sp[1-args].u.array;    if (!a->size ||    (TYPEOF(a->item[0]) != T_FUNCTION && TYPEOF(a->item[0]) != T_OBJECT &&    TYPEOF(a->item[0]) != T_PROGRAM))    SIMPLE_ARG_TYPE_ERROR("add_container", 1, "array with function as first element");    }    else if (TYPEOF(sp[1-args]) == T_INT && sp[1-args].u.integer)    SIMPLE_ARG_TYPE_ERROR("add_tag", 1, "zero, string, array or function");
pike.git/src/modules/Parser/html.c:1010:    if (UNSAFE_IS_ZERO(sp-1))    map_delete(THIS->mapcont,sp-2);    else    mapping_insert(THIS->mapcont,sp-2,sp-1);    pop_n_elems(args);    ref_push_object(THISOBJ);   }      static void html_add_entity(INT32 args)   { -  check_all_args("add_entity",args,BIT_STRING, +  check_all_args(NULL,args,BIT_STRING,    BIT_INT|BIT_STRING|BIT_ARRAY|BIT_FUNCTION|BIT_OBJECT|BIT_PROGRAM,0);    if (TYPEOF(sp[1-args]) == T_ARRAY) {    struct array *a = sp[1-args].u.array;    if (!a->size ||    (TYPEOF(a->item[0]) != T_FUNCTION && TYPEOF(a->item[0]) != T_OBJECT &&    TYPEOF(a->item[0]) != T_PROGRAM))    SIMPLE_ARG_TYPE_ERROR("add_entity", 1, "array with function as first element");    }    else if (TYPEOF(sp[1-args]) == T_INT && sp[1-args].u.integer)    SIMPLE_ARG_TYPE_ERROR("add_tag", 1, "zero, string, array or function");
pike.git/src/modules/Parser/html.c:1046:      static void html_add_quote_tag(INT32 args)   {    int remove;    struct mapping *map;    struct pike_string *name;    struct pike_string *prefix;    struct svalue *val;    ONERROR uwp;    -  check_all_args("add_quote_tag",args,BIT_STRING, +  check_all_args(NULL,args,BIT_STRING,    BIT_INT|BIT_STRING|BIT_ARRAY|BIT_FUNCTION|BIT_OBJECT|BIT_PROGRAM,    BIT_STRING|BIT_VOID,0);    if (TYPEOF(sp[1-args]) == T_ARRAY) {    struct array *a = sp[1-args].u.array;    if (!a->size ||    (TYPEOF(a->item[0]) != T_FUNCTION && TYPEOF(a->item[0]) != T_OBJECT &&    TYPEOF(a->item[0]) != T_PROGRAM))    SIMPLE_ARG_TYPE_ERROR("add_quote_tag", 1, "array with function as first element");    }    else if (TYPEOF(sp[1-args]) == T_INT && sp[1-args].u.integer)
pike.git/src/modules/Parser/html.c:1188:    UNSET_ONERROR (uwp);       ref_push_object(THISOBJ);   }      static void html_add_tags(INT32 args)   {    INT32 e;    struct keypair *k;    struct mapping_data *md; -  check_all_args("add_tags",args,BIT_MAPPING,0); +  check_all_args(NULL,args,BIT_MAPPING,0);       md = sp[-1].u.mapping->data;       NEW_MAPPING_LOOP(md)    {    push_svalue(&k->ind);    push_svalue(&k->val);    html_add_tag(2);    pop_stack();    }       pop_n_elems(args);    ref_push_object(THISOBJ);   }      static void html_add_containers(INT32 args)   {    INT32 e;    struct keypair *k;    struct mapping_data *md; -  check_all_args("add_containers",args,BIT_MAPPING,0); +  check_all_args(NULL,args,BIT_MAPPING,0);       md = sp[-1].u.mapping->data;       NEW_MAPPING_LOOP(md)    {    push_svalue(&k->ind);    push_svalue(&k->val);    html_add_container(2);    pop_stack();    }       pop_n_elems(args);    ref_push_object(THISOBJ);   }      static void html_add_entities(INT32 args)   {    INT32 e;    struct keypair *k;    struct mapping_data *md; -  check_all_args("add_entities",args,BIT_MAPPING,0); +  check_all_args(NULL,args,BIT_MAPPING,0);       md = sp[-1].u.mapping->data;       NEW_MAPPING_LOOP(md)    {    push_svalue(&k->ind);    push_svalue(&k->val);    html_add_entity(2);    pop_stack();    }
pike.git/src/modules/Parser/html.c:4469:    break;    }    default:    push_int(0);    }   }      static void html_tag_args(INT32 args)   {    struct svalue def; -  check_all_args("tag_args",args,BIT_MIXED|BIT_VOID,0); +  check_all_args(NULL,args,BIT_MIXED|BIT_VOID,0);    if (args) assign_svalue_no_free(&def,sp-args);    pop_n_elems(args);       if (!THIS->start) Pike_error ("Parser.HTML: There's no current range.\n");       switch (THIS->type) {    case TYPE_TAG:    case TYPE_CONT:    if (args)    {
pike.git/src/modules/Parser/html.c:4547:    push_int(0);    break;    }    default:    push_int(0);    }   }      static void html_tag(INT32 args)   { -  check_all_args("tag",args,BIT_MIXED|BIT_VOID,0); +  check_all_args(NULL,args,BIT_MIXED|BIT_VOID,0);       html_tag_args(args);    html_tag_name(0);    stack_swap();    html_tag_content(0);    f_aggregate(3);   }      /*! @decl string context()    *! Returns the current output context as a string.
pike.git/src/modules/Parser/html.c:4607:    *! Parses the tag name from a tag string without the surrounding    *! brackets, i.e. a string on the form @expr{"tagname some='tag'    *! args"@}.    *! @returns    *! Returns the tag name or an empty string if none.    */      static void html_parse_tag_name(INT32 args)   {    struct piece feed; -  check_all_args("parse_tag_name",args,BIT_STRING,0); +  check_all_args(NULL,args,BIT_STRING,0);    feed.s=sp[-args].u.string;    feed.next=NULL;    tag_name(THIS,&feed,0,0);    stack_pop_n_elems_keep_top(args);   }      /*! @decl mapping parse_tag_args(string tag)    *!    *! Parses the tag arguments from a tag string without the name and    *! surrounding brackets, i.e. a string on the form @expr{"some='tag'
pike.git/src/modules/Parser/html.c:4630:    *! @returns    *! Returns a mapping containing the tag arguments.    *!    *! @seealso    *! @[tag_args]    */      static void html_parse_tag_args(INT32 args)   {    struct piece feed; -  check_all_args("parse_tag_args",args,BIT_STRING,0); +  check_all_args(NULL,args,BIT_STRING,0);    feed.s=sp[-args].u.string;    feed.next=NULL;    tag_args(THIS,&feed,0,NULL,0,0);    stack_pop_n_elems_keep_top(args);   }      /** debug *******************************************/      /*! @decl mapping _inspect()    *!
pike.git/src/modules/Parser/html.c:4934:    *! becomes    *!    *! @pre{<foo arg1="val 1" arg2='val 2' arg3 arg4>@}    *!    *! if @expr{"splice"@} is set as the splice argument name.    */      static void html_splice_arg (INT32 args)   {    struct pike_string *old = THIS->splice_arg; -  check_all_args("splice_arg",args,BIT_VOID|BIT_STRING|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_STRING|BIT_INT,0);    if (args) {    if (TYPEOF(sp[-args]) == T_STRING)    add_ref (THIS->splice_arg = sp[-args].u.string);    else if (sp[-args].u.integer)    SIMPLE_ARG_TYPE_ERROR ("splice_arg", 1, "string or zero");    else    THIS->splice_arg = NULL;    }    pop_n_elems(args);    if (old) push_string (old);
pike.git/src/modules/Parser/html.c:5058:    *! If only a container callback exists, it gets the empty string    *! as content when there's none to be parsed. If only a    *! non-container callback exists, it will be called (without the    *! content argument) for both kinds of tags.    *! @endint    */      static void html_ignore_tags(INT32 args)   {    int o=!(THIS->flags & FLAG_PARSE_TAGS); -  check_all_args("ignore_tags",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags &= ~FLAG_PARSE_TAGS;    else THIS->flags |= FLAG_PARSE_TAGS;    THIS->top.parse_tags = THIS->flags & FLAG_PARSE_TAGS;    }    pop_n_elems(args);    push_int(o);   }      static void html_case_insensitive_tag(INT32 args)   {    int o=!!(THIS->flags & FLAG_CASE_INSENSITIVE_TAG); -  check_all_args("case_insensitive_tag",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags |= FLAG_CASE_INSENSITIVE_TAG;    else THIS->flags &= ~FLAG_CASE_INSENSITIVE_TAG;    }    pop_n_elems(args);       if (args && (THIS->flags & FLAG_CASE_INSENSITIVE_TAG) && !o) {    INT32 e;    struct keypair *k;    struct mapping_data *md;
pike.git/src/modules/Parser/html.c:5110:    free_mapping(THIS->mapcont);    THIS->mapcont=(--sp)->u.mapping;    }       push_int(o);   }      static void html_lazy_argument_end(INT32 args)   {    int o=!!(THIS->flags & FLAG_LAZY_END_ARG_QUOTE); -  check_all_args("lazy_argument_end",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags |= FLAG_LAZY_END_ARG_QUOTE;    else THIS->flags &= ~FLAG_LAZY_END_ARG_QUOTE;    recalculate_argq(THIS);    }    pop_n_elems(args);    push_int(o);   }      static void html_lazy_entity_end(INT32 args)   {    int o=!!(THIS->flags & FLAG_LAZY_ENTITY_END); -  check_all_args("lazy_entity_end",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags |= FLAG_LAZY_ENTITY_END;    else THIS->flags &= ~FLAG_LAZY_ENTITY_END;    }    pop_n_elems(args);    push_int(o);   }      /*! @decl int nestling_entity_end(void|int value)    *!    */      static void html_nestling_entity_end(INT32 args)   {    int o=!!(THIS->flags & FLAG_NESTLING_ENTITY_END); -  check_all_args("nestling_entity_end",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags |= FLAG_NESTLING_ENTITY_END;    else THIS->flags &= ~FLAG_NESTLING_ENTITY_END;    }    pop_n_elems(args);    push_int(o);   }      static void html_match_tag(INT32 args)   {    int o=!!(THIS->flags & FLAG_MATCH_TAG); -  check_all_args("match_tag",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags |= FLAG_MATCH_TAG;    else THIS->flags &= ~FLAG_MATCH_TAG;    }    pop_n_elems(args);    push_int(o);   }      static void html_mixed_mode(INT32 args)   {    int o=THIS->out_max_shift < 0; -  check_all_args("mixed_mode",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) {    if (!o) {    struct out_piece *f;    size_t c;    THIS->out_max_shift = -1;    /* Got to count the entries in the output queue. */    for (f = THIS->out, c = 0; f; f = f->next) c++;    THIS->out_length = c;    }
pike.git/src/modules/Parser/html.c:5199:    THIS->out_length = length;    }    }    pop_n_elems(args);    push_int(o);   }      static void html_reparse_strings(INT32 args)   {    int o=!!(THIS->flags & FLAG_REPARSE_STRINGS); -  check_all_args("reparse_strings",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags |= FLAG_REPARSE_STRINGS;    else THIS->flags &= ~FLAG_REPARSE_STRINGS;    }    pop_n_elems(args);    push_int(o);   }      static void html_ignore_unknown(INT32 args)   {    int o=!!(THIS->flags & FLAG_IGNORE_UNKNOWN); -  check_all_args("ignore_unknown",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags |= FLAG_IGNORE_UNKNOWN;    else THIS->flags &= ~FLAG_IGNORE_UNKNOWN;    }    pop_n_elems(args);    push_int(o);   }      static void html_xml_tag_syntax(INT32 args)   {    int o=THIS->flags; -  check_all_args("xml_tag_syntax",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    THIS->flags &= ~(FLAG_XML_TAGS|FLAG_STRICT_TAGS);    switch (sp[-args].u.integer) {    case 0: THIS->flags |= FLAG_STRICT_TAGS; break;    case 1: break;    case 2: THIS->flags |= FLAG_XML_TAGS; break;    case 3: THIS->flags |= FLAG_XML_TAGS|FLAG_STRICT_TAGS; break;    default:    SIMPLE_ARG_TYPE_ERROR ("xml_tag_syntax", 1, "integer 0..3");    }
pike.git/src/modules/Parser/html.c:5247:    if (o & FLAG_XML_TAGS)    o = o & FLAG_STRICT_TAGS ? 3 : 2;    else    o = o & FLAG_STRICT_TAGS ? 0 : 1;    push_int(o);   }      static void html_ws_before_tag_name(INT32 args)   {    int o=!!(THIS->flags & FLAG_WS_BEFORE_TAG_NAME); -  check_all_args("ws_before_tag_name",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags |= FLAG_WS_BEFORE_TAG_NAME;    else THIS->flags &= ~FLAG_WS_BEFORE_TAG_NAME;    }    pop_n_elems(args);    push_int(o);   }      static void html_max_stack_depth(INT32 args)   {    int o=THIS->max_stack_depth; -  check_all_args("max_stack_depth",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    THIS->max_stack_depth = sp[-args].u.integer;    }    pop_n_elems(args);    push_int(o);   }      #ifdef HTML_DEBUG   static void html_debug_mode(INT32 args)   {    int o=!!(THIS->flags & FLAG_DEBUG_MODE); -  check_all_args("debug_mode",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags |= FLAG_DEBUG_MODE;    else THIS->flags &= ~FLAG_DEBUG_MODE;    }    pop_n_elems(args);    push_int(o);   }   #endif      /*! @decl int ignore_comments(void|int value)    *!    */      static void html_ignore_comments(INT32 args)   {    int o=!!(THIS->flags & FLAG_IGNORE_COMMENTS); -  check_all_args("debug_mode",args,BIT_VOID|BIT_INT,0); +  check_all_args(NULL,args,BIT_VOID|BIT_INT,0);    if (args) {    if (sp[-args].u.integer) THIS->flags |= FLAG_IGNORE_COMMENTS;    else THIS->flags &= ~FLAG_IGNORE_COMMENTS;    recalculate_argq(THIS);    }    pop_n_elems(args);    push_int(o);   }      /*! @decl int quote_stapling(int|void enable)