pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:432:    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) +  /*! @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.    */ -  PIKEFUN string `()(array(string)|void arguments, object(CPP)|void context_obj) +  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 *parts = THIS->parts;    INT32 i; -  +  INT_TYPE flags = flags_sval?flags_sval->u.integer:0;       init_string_builder(&s, 0);    if(d->magic)    {    struct pike_string *a = NULL;    struct CPP_struct *this = get_storage(context_obj, CPP_program);       if (d->args > 0) {    a = ITEM(arguments)[0].u.string;    }
pike.git/src/cpp.cmod:522:    len--;    }    }    if (raw_arg & DEF_ARG_NOPOSTSPACE) {    while(len && wide_isspace(INDEX_PCHARP(a, len-1))) {    len--;    }    }    string_builder_append(&s, a, len);    } else { -  string_builder_shared_strcat(&s, str); +  /* NB: Evaluate the argument before insertion. */ +  int save_flags = d->flags; +  d->flags = CPP_MACRO_IN_USE; +  +  ref_push_string(str); +  push_int(flags & ~(CPP_EXPECT_ENDIF | CPP_EXPECT_ELSE)); +  safe_apply(context_obj, "cpp", 2); +  string_builder_shared_strcat(&s, Pike_sp[-1].u.string); +  pop_stack(); +  +  d->flags = save_flags; +     }    } -  +  if (!(raw_arg & DEF_ARG_NOPOSTSPACE)) { +  string_builder_putchar(&s, ' ');    } -  +  }    break;    default:    /* FIXME: Check that we have a callable. */    if (arguments) {    push_array_items(arguments);    apply_svalue(sval, arguments->size);    } else {    apply_svalue(sval, 0);    }    if (TYPEOF(Pike_sp[-1]) != T_STRING) {
pike.git/src/cpp.cmod:3395:    int i;    BEGIN_AGGREGATE_ARRAY(d->args) {    for (i = 0; i < d->args; i++) {    push_string(make_shared_binary_pcharp(arguments[i].arg,    arguments[i].len));    DO_AGGREGATE_ARRAY(120);    }    } END_AGGREGATE_ARRAY;    }    ref_push_object(Pike_fp->current_object); -  apply_lfun(d->self.u.object, LFUN_CALL, 2); +  push_int(flags); +  apply_lfun(d->self.u.object, LFUN_CALL, 3);       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 = flags;