当前位置: 首页>>代码示例>>C++>>正文


C++ RE函数代码示例

本文整理汇总了C++中RE函数的典型用法代码示例。如果您正苦于以下问题:C++ RE函数的具体用法?C++ RE怎么用?C++ RE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_exec

static void do_exec (const atf_tc_t * tc, const char *helper_name, atf_process_status_t * s)
{
    atf_fs_path_t process_helpers;

    const char *argv[3];

    get_process_helpers_path (tc, true, &process_helpers);

    argv[0] = atf_fs_path_cstring (&process_helpers);
    argv[1] = helper_name;
    argv[2] = NULL;
    printf ("Executing %s %s\n", argv[0], argv[1]);

    RE (atf_process_exec_array (s, &process_helpers, argv, NULL, NULL));
    atf_fs_path_fini (&process_helpers);
}
开发者ID:274914765,项目名称:C,代码行数:16,代码来源:process_test.c

示例2: caut_enc_get_byte_combination

static S caut_enc_get_byte_combination(SEI * ei, TD const * td, TEI * ti, bool * progress, uint8_t * byte) {
    struct iter_combination * const iter = &ti->prototype.c_combination;
    struct caut_combination const * const desc = &td->prototype.c_combination;

    uint64_t word = 0;
    memcpy(&word, ti->type, caut_tag_size(desc->tag));

    if (iter->tag_iter.tag_position < caut_tag_size(desc->tag)) {
        // still accumulating tag
        uint64_t const mask = mask_with_width(desc->field_count);
        if (word > mask) {
            return caut_status_err_invalid_combination;
        } else if (NULL == byte) {
            return caut_status_err_need_byte;
        } else {
            *progress = true;
            *byte = ((uint8_t *)&word)[iter->tag_iter.tag_position];
            iter->tag_iter.tag_position += 1;

            return caut_status_ok_busy;
        }
    } else {
        while (iter->field_position < desc->field_count) {
            uint64_t const field_flag = flag_set_at(iter->field_position);

            if (0 == (field_flag & word)) {
                iter->field_position += 1;
                continue;
            } else {
                struct caut_field const * const field = &desc->fields[iter->field_position];
                void const * base = (void *)(((uintptr_t)ti->type) + field->offset);

                iter->field_position += 1;

                if (field->data) {
                    RE(push_type_enc_iter(ei, field->ref_id, base));
                    return caut_status_ok_pushed;
                } else {
                    continue;
                }
            }
        }

        return caut_status_ok_pop;
    }
}
开发者ID:cauterize-tools,项目名称:caut-c11-stream,代码行数:46,代码来源:cauterize_encode.c

示例3: caut_enc_get_byte_synonym

static S caut_enc_get_byte_synonym(SEI * ei, TD const * td, TEI * ti, bool * progress, uint8_t * byte) {
    (void)byte;

    struct iter_synonym * const iter = &ti->prototype.c_synonym;
    struct caut_synonym const * const desc = &td->prototype.c_synonym;

    *progress = false;

    if (iter->done == false) {
        RE(push_type_enc_iter(ei, desc->ref_id, ti->type));
        iter->done = true;

        return caut_status_ok_pushed;
    } else {
        return caut_status_ok_pop;
    }
}
开发者ID:cauterize-tools,项目名称:caut-c11-stream,代码行数:17,代码来源:cauterize_encode.c

示例4: ATF_TC_BODY

ATF_TC_BODY(rfind_ch, tc)
{
    atf_dynstr_t str;

    RE(atf_dynstr_init_fmt(&str, "Foo1/Bar2/,.Baz"));

    ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, '\0'), atf_dynstr_npos);

    ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, '0'), atf_dynstr_npos);
    ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'b'), atf_dynstr_npos);

    ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'F'), 0);
    ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, '/'), 9);
    ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'a'), 13);
    ATF_REQUIRE_EQ(atf_dynstr_rfind_ch(&str, 'z'), 14);

    atf_dynstr_fini(&str);
}
开发者ID:0mp,项目名称:freebsd,代码行数:18,代码来源:dynstr_test.c

示例5: check_prepend

static
void
check_prepend(atf_error_t (*prepend)(atf_dynstr_t *, const char *, ...))
{
    const size_t maxlen = 8192;
    char buf[maxlen + 1];
    size_t i;
    atf_dynstr_t str;

    printf("Prepending with plain string\n");
    buf[0] = '\0';
    RE(atf_dynstr_init(&str));
    for (i = 0; i < maxlen; i++) {
        if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
            fprintf(stderr, "Failed at iteration %zd\n", i);
            atf_tc_fail("Failed to prepend character at iteration %zd", i);
        }

        memmove(buf + 1, buf, i + 1);
        if (i % 2 == 0) {
            RE(prepend(&str, "%s", "a"));
            buf[0] = 'a';
        } else {
            RE(prepend(&str, "%s", "b"));
            buf[0] = 'b';
        }
    }
    atf_dynstr_fini(&str);

    printf("Prepending with formatted string\n");
    buf[0] = '\0';
    RE(atf_dynstr_init(&str));
    for (i = 0; i < maxlen; i++) {
        if (strcmp(atf_dynstr_cstring(&str), buf) != 0) {
            fprintf(stderr, "Failed at iteration %zd\n", i);
            atf_tc_fail("Failed to prepend character at iteration %zd", i);
        }

        memmove(buf + 1, buf, i + 1);
        if (i % 2 == 0) {
            RE(prepend(&str, "%s", "a"));
            buf[0] = 'a';
        } else {
            RE(prepend(&str, "%s", "b"));
            buf[0] = 'b';
        }
    }
    atf_dynstr_fini(&str);
}
开发者ID:0mp,项目名称:freebsd,代码行数:49,代码来源:dynstr_test.c

示例6: ATF_TC_BODY

ATF_TC_BODY (status_coredump, tc)
{
    struct rlimit rl;

    rl.rlim_cur = RLIM_INFINITY;
    rl.rlim_max = RLIM_INFINITY;
    if (setrlimit (RLIMIT_CORE, &rl) == -1)
        atf_tc_skip ("Cannot unlimit the core file size; check limits " "manually");

    const int rawstatus = fork_and_wait_child (child_sigquit);

    atf_process_status_t s;

    RE (atf_process_status_init (&s, rawstatus));
    ATF_CHECK (!atf_process_status_exited (&s));
    ATF_CHECK (atf_process_status_signaled (&s));
    ATF_CHECK_EQ (atf_process_status_termsig (&s), SIGQUIT);
    ATF_CHECK (atf_process_status_coredump (&s));
    atf_process_status_fini (&s);
}
开发者ID:274914765,项目名称:C,代码行数:20,代码来源:process_test.c

示例7: redirect_fd_stream_init

static void redirect_fd_stream_init (void *v)
{
    struct redirect_fd_stream *s = v;

    switch (s->m_base.m_type)
    {
        case stdout_type:
            s->m_fd = open ("stdout", O_WRONLY | O_CREAT | O_TRUNC, 0644);
            break;
        case stderr_type:
            s->m_fd = open ("stderr", O_WRONLY | O_CREAT | O_TRUNC, 0644);
            break;
        default:
            UNREACHABLE;
    }
    ATF_REQUIRE (s->m_fd != -1);

    s->m_base.m_sb_ptr = &s->m_base.m_sb;
    RE (atf_process_stream_init_redirect_fd (&s->m_base.m_sb, s->m_fd));
}
开发者ID:274914765,项目名称:C,代码行数:20,代码来源:process_test.c

示例8: ATF_TC_BODY

ATF_TC_BODY(rewrite__too_long_with_newlines, tc)
{
    char input[1000];
    fill_buffer("failed: ", "line\n", input, sizeof(input));

    // This is quite awful but is the price we have to pay for using fixed-size
    // buffers in the code for simplicity and speed...
    char exp_output[1024 + 8 /* strlen("failed: ") */ + 1];
    fill_buffer("failed: ", "line<<NEWLINE>>", exp_output, sizeof(exp_output));
    exp_output[sizeof(exp_output) - 2] = '\n';

    bool success;
    atf_utils_create_file("in.txt", "%s", input);
    RE(kyua_atf_result_rewrite("in.txt", "out.txt",
                               generate_wait_exitstatus(EXIT_FAILURE),
                               false, &success));
    atf_utils_cat_file("out.txt", "OUTPUT:   ");
    printf("EXPECTED: %s", exp_output);
    ATF_REQUIRE(atf_utils_compare_file("out.txt", exp_output));
    ATF_REQUIRE_EQ(false, success);
}
开发者ID:namore,项目名称:kyua,代码行数:21,代码来源:atf_result_test.c

示例9: caut_enc_get_byte_array

static S caut_enc_get_byte_array(SEI * ei, TD const * td, TEI * ti, bool * progress, uint8_t * byte) {
    struct iter_array * const iter = &ti->prototype.c_array;
    struct caut_array const * const desc = &td->prototype.c_array;

    *progress = false;
    (void) byte;

    if (iter->elem_position < desc->length) {
        void const * base =
            (void *)(
                ((uintptr_t)ti->type) +
                (desc->elem_span * iter->elem_position));

        RE(push_type_enc_iter(ei, desc->ref_id, base));
        iter->elem_position += 1;

        return caut_status_ok_pushed;
    } else {
        return caut_status_ok_pop;
    }
}
开发者ID:cauterize-tools,项目名称:caut-c11-stream,代码行数:21,代码来源:cauterize_encode.c

示例10: PA_HeldObjectMove

void PA_HeldObjectMove(Ts *ts, Obj *held, Obj *grid, GridCoord torow,
                       GridCoord tocol)
{
  ObjList	*objs, *p;
  /* (S8) -> (S2)+(S6): Held object which moves is no longer
   * inside anything. (Holding overrides inside.)
   * todo: Actor holds key in pocket while walking.
   */
  TE(ts, L(N("inside"), held, ObjWild, E));

  if (grid) { /* Optimization. */
    /* (S7): <held> is small container. */
    objs = RE(ts, L(N("inside"), ObjWild, held, E));
    for (p = objs; p; p = p->next) {
      PA_SmallContainedObjectMove(ts, I(p->obj, 1), grid, torow, tocol);
    }
    ObjListFree(objs);
  }

  PA_MoveObject(ts, held, grid, torow, tocol);
}
开发者ID:brunogal,项目名称:thoughttreasure,代码行数:21,代码来源:pagrasp.c

示例11: assert

// Populate __pointers section.
void RuntimeDyldMachO::populateIndirectSymbolPointersSection(
                                                    const MachOObjectFile &Obj,
                                                    const SectionRef &PTSection,
                                                    unsigned PTSectionID) {
  assert(!Obj.is64Bit() &&
         "Pointer table section not supported in 64-bit MachO.");

  MachO::dysymtab_command DySymTabCmd = Obj.getDysymtabLoadCommand();
  MachO::section Sec32 = Obj.getSection(PTSection.getRawDataRefImpl());
  uint32_t PTSectionSize = Sec32.size;
  unsigned FirstIndirectSymbol = Sec32.reserved1;
  const unsigned PTEntrySize = 4;
  unsigned NumPTEntries = PTSectionSize / PTEntrySize;
  unsigned PTEntryOffset = 0;

  assert((PTSectionSize % PTEntrySize) == 0 &&
         "Pointers section does not contain a whole number of stubs?");

  DEBUG(dbgs() << "Populating pointer table section "
               << Sections[PTSectionID].getName() << ", Section ID "
               << PTSectionID << ", " << NumPTEntries << " entries, "
               << PTEntrySize << " bytes each:\n");

  for (unsigned i = 0; i < NumPTEntries; ++i) {
    unsigned SymbolIndex =
      Obj.getIndirectSymbolTableEntry(DySymTabCmd, FirstIndirectSymbol + i);
    symbol_iterator SI = Obj.getSymbolByIndex(SymbolIndex);
    ErrorOr<StringRef> IndirectSymbolNameOrErr = SI->getName();
    if (std::error_code EC = IndirectSymbolNameOrErr.getError())
      report_fatal_error(EC.message());
    StringRef IndirectSymbolName = *IndirectSymbolNameOrErr;
    DEBUG(dbgs() << "  " << IndirectSymbolName << ": index " << SymbolIndex
          << ", PT offset: " << PTEntryOffset << "\n");
    RelocationEntry RE(PTSectionID, PTEntryOffset,
                       MachO::GENERIC_RELOC_VANILLA, 0, false, 2);
    addRelocationForSymbol(RE, IndirectSymbolName);
    PTEntryOffset += PTEntrySize;
  }
}
开发者ID:2asoft,项目名称:freebsd,代码行数:40,代码来源:RuntimeDyldMachO.cpp

示例12: passf2pos_sse

static void passf2pos_sse(const uint16_t l1, const complex_t *cc,
                          complex_t *ch, const complex_t *wa)
{
    uint16_t k, ah, ac;

    for (k = 0; k < l1; k++)
    {
        ah = 2*k;
        ac = 4*k;

        RE(ch[ah])    = RE(cc[ac]) + RE(cc[ac+1]);
        IM(ch[ah])    = IM(cc[ac]) + IM(cc[ac+1]);

        RE(ch[ah+l1]) = RE(cc[ac]) - RE(cc[ac+1]);
        IM(ch[ah+l1]) = IM(cc[ac]) - IM(cc[ac+1]);
    }
}
开发者ID:TravisKraatz,项目名称:cinelerra,代码行数:17,代码来源:cfft.c

示例13: caut_enc_get_byte_record

static S caut_enc_get_byte_record(SEI * ei, TD const * td, TEI * ti, bool * progress, uint8_t * byte) {
    struct iter_record * const iter = &ti->prototype.c_record;
    struct caut_record const * const desc = &td->prototype.c_record;

    (void) byte;
    *progress = false;

    if (iter->field_position < desc->field_count) {
        struct caut_field const * const field = &desc->fields[iter->field_position];
        void const * base = (void *)(((uintptr_t)ti->type) + field->offset);

        if (field->data == false) {
            return caut_status_err_invalid_record;
        } else {
            RE(push_type_enc_iter(ei, field->ref_id, base));
            iter->field_position += 1;
        }

        return caut_status_ok_pushed;
    } else {
        return caut_status_ok_pop;
    }
}
开发者ID:cauterize-tools,项目名称:caut-c11-stream,代码行数:23,代码来源:cauterize_encode.c

示例14: caut_enc_get_byte_vector

static S caut_enc_get_byte_vector(SEI * ei, TD const * td, TEI * ti, bool * progress, uint8_t * byte) {
    struct iter_vector * const iter = &ti->prototype.c_vector;
    struct caut_vector const * const desc = &td->prototype.c_vector;

    uint64_t word = 0;
    memcpy(&word, ti->type, caut_tag_size(desc->tag));

    if (iter->tag_iter.tag_position < caut_tag_size(desc->tag)) {
        // still accumulating tag
        if (word > desc->max_length) {
            return caut_status_err_invalid_vector;
        } else if (NULL == byte) {
            return caut_status_err_need_byte;
        } else {
            *progress = true;
            *byte = ((uint8_t *)&word)[iter->tag_iter.tag_position];
            iter->tag_iter.tag_position += 1;

            return caut_status_ok_busy;
        }
    } else if (iter->elem_position < word) {
        // accumulating elements
        void const * base =
            (void *)(
                ((uintptr_t)ti->type) +
                desc->elem_offset +
                (desc->elem_span * iter->elem_position));

        RE(push_type_enc_iter(ei, desc->ref_id, base));
        iter->elem_position += 1;

        return caut_status_ok_pushed;
    } else {
        return caut_status_ok_pop;
    }
}
开发者ID:cauterize-tools,项目名称:caut-c11-stream,代码行数:36,代码来源:cauterize_encode.c

示例15: PA_MoveTo

/* SUBGOAL move-to na ?grasper ?object */
void PA_MoveTo(Context *cx, Subgoal *sg, Ts *ts, Obj *a, Obj *o)
{
  Obj	*p;
  Dur	d;
  Dbg(DBGPLAN, DBGOK, "PA_MoveTo", E);
  switch (sg->state) {
    case STBEGIN:
      if (!(p = DbRetrieveWhole(ts, NULL, N("human"), I(o, 2)))) goto failure;
      if (p != a) {
        Dbg(DBGPLAN, DBGDETAIL, "failure: grasper not part of actor", E);
        goto failure;
      }
      SG(cx, sg, 1, STFAILURE, L(N("near-reachable"), p, I(o,3), E));
      return;
    case 1:
      if ((p = R1E(ts, L(N("inside"), I(o,3), ObjWild, E))) &&
          YES(RE(ts, L(N("closed"), I(p, 2), E)))) {
        SG(cx, sg, 2, STFAILURE, L(N("open"), I(p, 2), E));
      } else {
        TOSTATE(cx, sg, 2);
      }
      return;
    case 2:
      PA_GrasperMove(ts, I(o, 2), NULL, 0, 0);

      d = DurationOf(I(o, 0));
      AA(ts, d, o);
      TsIncrement(ts, d);
      AS(ts, 0, L(N("near-graspable"), I(o,2), I(o,3), E));
      TOSTATE(cx, sg, STSUCCESS);
      return;
    default: Dbg(DBGPLAN, DBGBAD, "PA_MoveTo: undefined state %d", sg->state);
  }
failure:
  TOSTATE(cx, sg, STFAILURE);
}
开发者ID:brunogal,项目名称:thoughttreasure,代码行数:37,代码来源:pagrasp.c


注:本文中的RE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。