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


C++ Val_long函数代码示例

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


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

示例1: unix_lseek

CAMLprim value unix_lseek(value fd, value ofs, value cmd)
{
  file_offset ret;
  caml_enter_blocking_section();
  ret = lseek(Int_val(fd), Long_val(ofs),
                       seek_command_table[Int_val(cmd)]);
  caml_leave_blocking_section();
  if (ret == -1) uerror("lseek", Nothing);
  if (ret > Max_long) unix_error(EOVERFLOW, "lseek", Nothing);
  return Val_long(ret);
}
开发者ID:mzp,项目名称:coq-for-ipad,代码行数:11,代码来源:lseek.c

示例2: caml_ml_input_char

CAMLprim value caml_ml_input_char(value vchannel)
{
  CAMLparam1 (vchannel);
  struct channel * channel = Channel(vchannel);
  unsigned char c;

  Lock(channel);
  c = getch(channel);
  Unlock(channel);
  CAMLreturn (Val_long(c));
}
开发者ID:OCamlPro,项目名称:OCamlPro-OCaml-Branch,代码行数:11,代码来源:io.c

示例3: bigstring_pwrite_assume_fd_is_nonblocking_stub

CAMLprim value bigstring_pwrite_assume_fd_is_nonblocking_stub(
  value v_fd, value v_offset, value v_pos, value v_len, value v_bstr)
{
  char *bstr = get_bstr(v_bstr, v_pos);
  size_t len = Long_val(v_len);
  ssize_t written;

  written = pwrite(Int_val(v_fd), bstr, len, Long_val(v_offset));
  if (written == -1) uerror("bigstring_pwrite_assume_fd_is_nonblocking_stub", Nothing);
  return Val_long(written);
}
开发者ID:commonlisp,项目名称:core,代码行数:11,代码来源:bigstring_stubs.c

示例4: hh_hash_used_slots

CAMLprim value hh_hash_used_slots(void) {
  CAMLparam0();
  uint64_t count = 0;
  uintptr_t i = 0;
  for (i = 0; i < hashtbl_size; ++i) {
    if (hashtbl[i].addr != NULL) {
      count++;
    }
  }
  CAMLreturn(Val_long(count));
}
开发者ID:adelgado,项目名称:flow,代码行数:11,代码来源:hh_shared.c

示例5: caml_sys_get_config

CAMLprim value caml_sys_get_config(value unit)
{
  CAMLparam0 ();   /* unit is unused */
  CAMLlocal2 (result, ostype);

  ostype = caml_copy_string(OCAML_OS_TYPE);
  result = caml_alloc_small (2, 0);
  Field(result, 0) = ostype;
  Field(result, 1) = Val_long (8 * sizeof(value));
  CAMLreturn (result);
}
开发者ID:joechenq,项目名称:multi-script,代码行数:11,代码来源:sys.c

示例6: caml_ml_input_scan_line

CAMLprim value caml_ml_input_scan_line(value vchannel)
{
  CAMLparam1 (vchannel);
  struct channel * channel = Channel(vchannel);
  intnat res;

  Lock(channel);
  res = caml_input_scan_line(channel);
  Unlock(channel);
  CAMLreturn (Val_long(res));
}
开发者ID:OCamlPro,项目名称:OCamlPro-OCaml-Branch,代码行数:11,代码来源:io.c

示例7: svec_getvecword

value svec_getvecword (value vec)
{
  value res;

  res = Val_long(*(unsigned int*) String_val(vec));

  if (jit_ffi_debug)
    fprintf(stderr,"svec_getvecword returning 0x%8.8x [0x%8.8x].\n",
            (unsigned int) Long_val(res), * ((unsigned int*) (String_val(vec))));
  return res;
}
开发者ID:IanANGrant,项目名称:red-october,代码行数:11,代码来源:svec.c

示例8: CAMLlocal2

static void invoke_completion_callback
(long id, long len, long errCode, long action) {
  CAMLlocal2 (err, name);
  value args[4];
  err = Val_long(0);
  if (errCode != NO_ERROR) {
    len = -1;
    win32_maperr (errCode);
    err = unix_error_of_code(errno);
  }
  name = copy_string (action_name[action]);
  D(printf("Action %s completed: id %ld -> len %ld / err %d (errCode %ld)\n",
           action_name[action], id, len, errno, errCode));
  args[0] = Val_long(id);
  args[1] = Val_long(len);
  args[2] = err;
  args[3] = name;
  caml_callbackN(completionCallback, 4, args);
  D(printf("Callback performed\n"));
}
开发者ID:Phylliade,项目名称:Unison,代码行数:20,代码来源:lwt_unix_stubs.c

示例9: int_of_string

value int_of_string(value s)          /* ML */
{
    long res;
    int sign;
    int base;
    char * p;
    int c, d;

    p = String_val(s);
    if (*p == 0) failwith("int_of_string");
    sign = 1;
    if (*p == '-') {
        sign = -1;
        p++;
    }
    base = 10;
    if (*p == '0') {
        switch (p[1]) {
        case 'x':
        case 'X':
            base = 16;
            p += 2;
            break;
        case 'o':
        case 'O':
            base = 8;
            p += 2;
            break;
        case 'b':
        case 'B':
            base = 2;
            p += 2;
            break;
        }
    }
    res = 0;
    while (1) {
        c = *p;
        if (c >= '0' && c <= '9')
            d = c - '0';
        else if (c >= 'A' && c <= 'F')
            d = c - 'A' + 10;
        else if (c >= 'a' && c <= 'f')
            d = c - 'a' + 10;
        else
            break;
        if (d >= base) break;
        res = base * res + d;
        p++;
    }
    if (*p != 0)
        failwith("int_of_string");
    return Val_long(sign < 0 ? -res : res);
}
开发者ID:useada,项目名称:mosml,代码行数:54,代码来源:ints.c

示例10: bigstring_pread_assume_fd_is_nonblocking_stub

CAMLprim value bigstring_pread_assume_fd_is_nonblocking_stub(
    value v_fd, value v_offset, value v_pos, value v_len, value v_bstr)
{
  char *bstr = get_bstr(v_bstr, v_pos);
  size_t len = Long_val(v_len);
  ssize_t n_read;

  n_read = pread(Int_val(v_fd), bstr, len, Long_val(v_offset));
  if (n_read == -1) uerror("bigstring_pread_assume_fd_is_nonblocking_stub", Nothing);
  return Val_long(n_read);
}
开发者ID:commonlisp,项目名称:core,代码行数:11,代码来源:bigstring_stubs.c

示例11: hh_dep_used_slots

value hh_dep_used_slots() {
  CAMLparam0();
  uint64_t count = 0;
  uintptr_t slot = 0;
  for (slot = 0; slot < DEP_SIZE; ++slot) {
    if (deptbl[slot]) {
      count++;
    }
  }
  CAMLreturn(Val_long(count));
}
开发者ID:JeckoHeroOrg,项目名称:flow,代码行数:11,代码来源:hh_shared.c

示例12: hh_hash_used_slots

value hh_hash_used_slots() {
  CAMLparam0();
  uint64_t count = 0;
  uintptr_t i = 0;
  for (i = 0; i < HASHTBL_SIZE; ++i) {
    if (hashtbl[i].addr != NULL) {
      count++;
    }
  }
  CAMLreturn(Val_long(count));
}
开发者ID:JeckoHeroOrg,项目名称:flow,代码行数:11,代码来源:hh_shared.c

示例13: caml_gc_major_slice

CAMLprim value caml_gc_major_slice (value v)
{
  intnat res;
  CAMLassert (Is_long (v));
  caml_ev_pause(EV_PAUSE_GC);
  caml_empty_minor_heap ();
  res = caml_major_collection_slice(Long_val(v), 0);
  caml_ev_resume();
  caml_handle_gc_interrupt();
  return Val_long (res);
}
开发者ID:ocamllabs,项目名称:ocaml-multicore,代码行数:11,代码来源:gc_ctrl.c

示例14: unix_lseek

CAMLprim value unix_lseek(value fd, value ofs, value cmd)
{
  __int64 ret;

  ret = caml_set_file_pointer(Handle_val(fd), Long_val(ofs),
                              seek_command_table[Int_val(cmd)]);
  if (ret > Max_long) {
    win32_maperr(ERROR_ARITHMETIC_OVERFLOW);
    uerror("lseek", Nothing);
  }
  return Val_long(ret);
}
开发者ID:OCamlPro,项目名称:OCamlPro-OCaml-Branch,代码行数:12,代码来源:lseek.c

示例15: netsys_s_read_int4_64

CAMLprim value netsys_s_read_int4_64(value sv, value pv) 
{
    char *s;
    intnat p;

    s = String_val(sv);
    p = Long_val(pv);
    /* careful: the result of ntohl is unsigned. We first have to
       convert it to signed, then extend it to intnat.
    */
    return Val_long((int) (ntohl (*((unsigned int *) (s+p)))));
}
开发者ID:DMClambo,项目名称:pfff,代码行数:12,代码来源:netsys_c_xdr.c


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