pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:186:    if (THIS->parts) {    free_array(THIS->parts);    }    add_ref(THIS->parts = parts);    }      #ifndef tObjImpl_CPP   #define tObjImpl_CPP tObj   #endif    -  /*! @decl string `()(array(string)|void arguments, CPP|void context, int|void flags) +  /*! @decl string `()(array(string)|void arguments, CPP|void context, @ +  *! int|void flags)    *!    *! @param arguments    *! Array of arguments to the macro. Zero if no parenthesis.    *!    *! @param context    *! CPP context we are evaluating in.    *!    *! @returns -  *! Returns the expansion of the macro. +  *! Returns the expansion of the macro on success, and @expr{0@} (zero) +  *! on failure (typically due to invalid @[arguments]).    */    PIKEFUN string `()(array(string)|void arguments, object(CPP)|void context_obj,    int|void flags_sval)    flags ID_PROTECTED;    {    struct define_struct *d = THIS;    struct string_builder s;    struct array *arguments2 = arguments;    struct array *parts = THIS->parts;    INT32 i;
pike.git/src/cpp.cmod:228:    } else {    if (context_obj) {    push_text("Expected %d arguments to macro %s, got none.");    push_int(d->args);    ref_push_string(d->name);    apply(context_obj, "cpp_error", 3);    } else {    my_yyerror("Expected %d argumnets to macro %S, got none.",    d->args, d->name);    } +  push_int(0); +  return;    }    }       if (d->args != arguments2->size) {    if (!(d->flags & CPP_MACRO_VARARGS) ||    (d->args > arguments2->size+1)) {    /* Allow varargs to be left out. */    if (context_obj) {    push_text("Bad number of arguments to macro %s, expected %d"    ", got %d.");    ref_push_string(d->name);    push_int(d->args);    push_int(arguments2->size);    apply(context_obj, "cpp_error", 4);    } else {    my_yyerror("Bad number of arguments to macro %S, expected %d"    ", got %d.",    d->name, d->args, arguments2->size);    } -  +  push_int(0); +  return;    }    if (d->args > arguments2->size) {    /* Grow arguments2 to at least d->args elements. */    ref_push_array(arguments2);    ref_push_string(empty_pike_string);    f_aggregate(1);    push_int(d->args - arguments2->size);    o_multiply();    f_add(2);    arguments2 = Pike_sp[-1].u.array;
pike.git/src/cpp.cmod:304:    struct pike_string *str;    if (!arguments2 || (arg >= arguments2->size)) {    if (context_obj) {    push_text("Too few arguments to macro %s.");    ref_push_string(d->name);    safe_apply(context_obj, "cpp_error", 2);    pop_stack();    } else {    my_yyerror("Too few arguments to macro %S.", d->name);    } -  break; +  free_string_builder(&s); +  push_int(0); +  return;    }    str = arguments2->item[arg].u.string;    if (raw_arg & DEF_ARG_NEED_COMMA) {    if (!(d->flags & CPP_MACRO_VARARGS) ||    (arg != d->args-1) ||    str->len) {    /* Don't add the comma if the varargs argument and empty. */    string_builder_putchar(&s, ',');    string_builder_putchar(&s, ' ');    }
pike.git/src/cpp.cmod:384:    if (TYPEOF(Pike_sp[-1]) != T_STRING) {    if (context_obj) {    push_text("Invalid return value from macro %s: %s (expected string).");    ref_push_string(d->name);    push_text(get_name_of_type(TYPEOF(Pike_sp[-3])));    safe_apply(context_obj, "cpp_error", 3);    } else {    my_yyerror("Invalid return value from macro %S: %s (expected string).",    d->name, get_name_of_type(TYPEOF(Pike_sp[-1])));    } -  pop_stack(); -  break; +  free_string_builder(&s); +  push_int(0); +  return;    }    string_builder_shared_strcat(&s, Pike_sp[-1].u.string);    pop_stack();    break;    }    }       done:    if (!(d->flags & CPP_MACRO_KEEP_NL)) {    /* Remove any newlines from the completed expression. */
pike.git/src/cpp.cmod:3375:    !(d->flags & CPP_MACRO_VARARGS)) {    // Allow a single argument to be left out.    pop_stack();    ref_push_string(empty_pike_string);    f_aggregate(1);    }    ref_push_object(Pike_fp->current_object);    push_int(flags);    apply_lfun(d->self.u.object, LFUN_CALL, 3);    +  if (TYPEOF(Pike_sp[-1]) == PIKE_T_STRING) {    save_flags = d->flags;    d->flags |= CPP_MACRO_DISABLED;       /* NB: We're executing in the CPP context object. */    low_cpp(this, MKPCHARP_STR(Pike_sp[-1].u.string), Pike_sp[-1].u.string->len,    flags & ~(CPP_EXPECT_ENDIF | CPP_EXPECT_ELSE),    charset);       d->flags = save_flags; -  +  } else { +  this->compile_errors++; +  }       /* NB: Pop the args array too... */    pop_n_elems(Pike_sp + 1 - save_sp);   }      /*    * Preprocessor template.    *    * NB: There are two basic cases where this function is called:    *