本文整理汇总了C++中caml_copy_int64函数的典型用法代码示例。如果您正苦于以下问题:C++ caml_copy_int64函数的具体用法?C++ caml_copy_int64怎么用?C++ caml_copy_int64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了caml_copy_int64函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onlyWin32_getFileInformationByHandle_ml
value onlyWin32_getFileInformationByHandle_ml(value handle_v)
{
HANDLE handle = (HANDLE)handle_v;
BY_HANDLE_FILE_INFORMATION fileInfo;
CAMLparam0 ();
CAMLlocal1 (v);
ULARGE_INTEGER size, index;
if( !GetFileInformationByHandle(handle, &fileInfo) ){
DWORD err = GetLastError();
win32_maperr(err);
uerror("GetFileInformationByHandle", Nothing);
}
size.HighPart = fileInfo.nFileSizeHigh;
size.LowPart = fileInfo.nFileSizeLow;
index.HighPart = fileInfo.nFileIndexHigh;
index.LowPart = fileInfo.nFileIndexLow;
v = caml_alloc (8, 0);
Store_field(v,0, Val_int(fileInfo.dwFileAttributes));
Store_field(v, 1,
caml_copy_double(FileTime_to_POSIX(fileInfo.ftCreationTime)));
Store_field(v, 2,
caml_copy_double(FileTime_to_POSIX(fileInfo.ftLastAccessTime)));
Store_field(v, 3,
caml_copy_double(FileTime_to_POSIX(fileInfo.ftLastWriteTime)));
Store_field(v, 4, Val_int(fileInfo.dwVolumeSerialNumber));
Store_field(v, 5, caml_copy_int64(size.QuadPart));
Store_field(v, 6, Val_int(fileInfo.nNumberOfLinks));
Store_field(v, 7, caml_copy_int64(index.QuadPart));
CAMLreturn (v);
}
示例2: stub_xtl_ocaml_progress
static void stub_xtl_ocaml_progress(struct xentoollog_logger *logger,
const char *context,
const char *doing_what /* no \r,\n */,
int percent, unsigned long done, unsigned long total)
{
caml_leave_blocking_section();
CAMLparam0();
CAMLlocalN(args, 5);
struct caml_xtl *xtl = (struct caml_xtl*)logger;
value *func = caml_named_value(xtl->progress_cb) ;
if (func == NULL)
caml_raise_sys_error(caml_copy_string("Unable to find callback"));
/* progress : string option -> string -> int -> int64 -> int64 -> unit; */
args[0] = Val_context(context);
args[1] = caml_copy_string(doing_what);
args[2] = Val_int(percent);
args[3] = caml_copy_int64(done);
args[4] = caml_copy_int64(total);
caml_callbackN(*func, 5, args);
CAMLdone;
caml_enter_blocking_section();
}
示例3: Val_physinfo
static value Val_physinfo(libxl_physinfo *c_val)
{
CAMLparam0();
CAMLlocal2(v, hwcap);
int i;
hwcap = caml_alloc_tuple(8);
for (i = 0; i < 8; i++)
Store_field(hwcap, i, caml_copy_int32(c_val->hw_cap[i]));
v = caml_alloc_tuple(11);
Store_field(v, 0, Val_int(c_val->threads_per_core));
Store_field(v, 1, Val_int(c_val->cores_per_socket));
Store_field(v, 2, Val_int(c_val->max_cpu_id));
Store_field(v, 3, Val_int(c_val->nr_cpus));
Store_field(v, 4, Val_int(c_val->cpu_khz));
Store_field(v, 5, caml_copy_int64(c_val->total_pages));
Store_field(v, 6, caml_copy_int64(c_val->free_pages));
Store_field(v, 7, caml_copy_int64(c_val->scrub_pages));
Store_field(v, 8, Val_int(c_val->nr_nodes));
Store_field(v, 9, hwcap);
Store_field(v, 10, caml_copy_int32(c_val->phys_cap));
CAMLreturn(v);
}
示例4: get_section_data_internal
value get_section_data_internal( bhp _p )
{
CAMLparam0();
CAMLlocal4( data, v, str, tupl );
bh* p = (bh*) _p;
struct bfd* abfd = p->bfdp;
asection *sect;
bfd_size_type datasize = 0;
data = Val_emptylist;
if ( p->is_from_file ) {
for ( sect = abfd->sections; sect != NULL; sect = sect->next ) {
datasize = bfd_get_section_size( sect );
str = caml_alloc_string( datasize );
bfd_get_section_contents( abfd, sect,
(bfd_byte*)String_val(str),
0, datasize );
tupl = caml_alloc_tuple( 3 );
Store_field( tupl, 0, str );
Store_field( tupl, 1, caml_copy_int64( sect->vma ) );
Store_field( tupl, 2, caml_copy_int64( sect->vma + datasize ) );
v = caml_alloc_small( 2, 0 );
Field( v, 0 ) = tupl;
Field( v, 1 ) = data;
data = v;
}
}
CAMLreturn( data );
}
示例5: stub_get_blktap3_stats
CAMLprim value stub_get_blktap3_stats(value filename)
{
CAMLparam1(filename);
CAMLlocal1(stats);
FILE *c_fd;
struct stats c_stats;
c_fd = fopen(String_val(filename), "rb");
if (!c_fd) uerror("fopen", Nothing);
if (fread(&c_stats, sizeof(struct stats), 1, c_fd) < 1) uerror("fread", Nothing);
stats = caml_alloc_tuple(10);
Store_field(stats, 0, caml_copy_int64((int64_t) c_stats.read_reqs_submitted));
Store_field(stats, 1, caml_copy_int64((int64_t) c_stats.read_reqs_completed));
Store_field(stats, 2, caml_copy_int64((int64_t) c_stats.read_sectors));
Store_field(stats, 3, caml_copy_int64((int64_t) c_stats.read_total_ticks));
Store_field(stats, 4, caml_copy_int64((int64_t) c_stats.write_reqs_submitted));
Store_field(stats, 5, caml_copy_int64((int64_t) c_stats.write_reqs_completed));
Store_field(stats, 6, caml_copy_int64((int64_t) c_stats.write_sectors));
Store_field(stats, 7, caml_copy_int64((int64_t) c_stats.write_total_ticks));
Store_field(stats, 8, caml_copy_int64((int64_t) c_stats.io_errors));
if ((c_stats.flags) & BT3_LOW_MEMORY_MODE)
Store_field(stats, 9, Val_true);
else
Store_field(stats, 9, Val_false);
fclose(c_fd);
CAMLreturn(stats);
}
示例6: caml_int64_mod
CAMLprim value caml_int64_mod(value v1, value v2)
{
int64 dividend = Int64_val(v1);
int64 divisor = Int64_val(v2);
if (I64_is_zero(divisor)) caml_raise_zero_divide();
/* PR#4740: on some processors, division crashes on overflow.
Implement the same behavior as for type "int". */
if (I64_is_min_int(dividend) && I64_is_minus_one(divisor)) {
int64 zero = I64_literal(0,0);
return caml_copy_int64(zero);
}
return caml_copy_int64(I64_mod(Int64_val(v1), divisor));
}
示例7: caml_Val_file_offset
CAMLexport value caml_Val_file_offset(file_offset fofs)
{
int64 ofs;
ofs.l = fofs;
ofs.h = 0;
return caml_copy_int64(ofs);
}
示例8: brlapiml_waitKey
CAMLprim value brlapiml_waitKey(value handle, value unit)
{
CAMLparam2(handle, unit);
brlapi_keyCode_t keyCode;
brlapiCheckError(readKey, 1, &keyCode);
CAMLreturn(caml_copy_int64(keyCode));
}
示例9: caml_int64_of_string
CAMLprim value caml_int64_of_string(value s)
{
char * p;
uint64 max_uint64 = I64_literal(0xFFFFFFFF, 0xFFFFFFFF);
uint64 max_int64 = I64_literal(0x80000000, 0x00000000);
uint64 res, threshold;
int sign, base, d;
p = parse_sign_and_base(String_val(s), &base, &sign);
I64_udivmod(max_uint64, I64_of_int32(base), &threshold, &res);
d = parse_digit(*p);
if (d < 0 || d >= base) caml_failwith("int_of_string");
res = I64_of_int32(d);
for (p++; /*nothing*/; p++) {
char c = *p;
if (c == '_') continue;
d = parse_digit(c);
if (d < 0 || d >= base) break;
/* Detect overflow in multiplication base * res */
if (I64_ult(threshold, res)) caml_failwith("int_of_string");
res = I64_add(I64_mul(I64_of_int32(base), res), I64_of_int32(d));
/* Detect overflow in addition (base * res) + d */
if (I64_ult(res, I64_of_int32(d))) caml_failwith("int_of_string");
}
if (p != String_val(s) + caml_string_length(s)){
caml_failwith("int_of_string");
}
if (base == 10 && I64_ult(max_int64, res)) caml_failwith("int_of_string");
if (sign < 0) res = I64_neg(res);
return caml_copy_int64(res);
}
示例10: stub_sendfile64
CAMLprim value stub_sendfile64(value in_fd, value out_fd, value len){
CAMLparam3(in_fd, out_fd, len);
CAMLlocal1(result);
size_t c_len = Int64_val(len);
size_t bytes;
int c_in_fd = Int_val(in_fd);
int c_out_fd = Int_val(out_fd);
int rc = NOT_IMPLEMENTED;
enter_blocking_section();
#ifdef __linux__
rc = TRIED_AND_FAILED;
bytes = sendfile(c_out_fd, c_in_fd, NULL, c_len);
if (bytes != -1) rc = OK;
#endif
leave_blocking_section();
switch (rc) {
case NOT_IMPLEMENTED:
caml_failwith("This platform does not support sendfile()");
break;
case TRIED_AND_FAILED:
uerror("sendfile", Nothing);
break;
default: break;
}
result = caml_copy_int64(bytes);
CAMLreturn(result);
}
示例11: caml_query_performance_frequency
value caml_query_performance_frequency() {
LARGE_INTEGER freq;
if (!QueryPerformanceFrequency(&freq)) {
caml_failwith("QueryPerformanceFrequency");
return 0;
}
return caml_copy_int64(freq.QuadPart);
}
示例12: caml_query_performance_counter
value caml_query_performance_counter() {
LARGE_INTEGER count;
if (!QueryPerformanceCounter(&count)) {
caml_failwith("QueryPerformanceCounter");
return 0;
}
return caml_copy_int64(count.QuadPart);
}
示例13: stub_xenctrlext_get_runstate_info
CAMLprim value stub_xenctrlext_get_runstate_info(value xch, value domid)
{
CAMLparam2(xch, domid);
#if defined(XENCTRL_HAS_GET_RUNSTATE_INFO)
CAMLlocal1(result);
xc_runstate_info_t info;
int retval;
retval = xc_get_runstate_info(_H(xch), _D(domid), &info);
if (retval < 0)
failwith_xc(_H(xch));
/* Store
0 : state (int32)
1 : missed_changes (int32)
2 : state_entry_time (int64)
3-8 : times (int64s)
*/
result = caml_alloc_tuple(9);
Store_field(result, 0, caml_copy_int32(info.state));
Store_field(result, 1, caml_copy_int32(info.missed_changes));
Store_field(result, 2, caml_copy_int64(info.state_entry_time));
Store_field(result, 3, caml_copy_int64(info.time[0]));
Store_field(result, 4, caml_copy_int64(info.time[1]));
Store_field(result, 5, caml_copy_int64(info.time[2]));
Store_field(result, 6, caml_copy_int64(info.time[3]));
Store_field(result, 7, caml_copy_int64(info.time[4]));
Store_field(result, 8, caml_copy_int64(info.time[5]));
CAMLreturn(result);
#else
caml_failwith("XENCTRL_HAS_GET_RUNSTATE_INFO not defined");
#endif
}
示例14: caml_get_addr
CAMLprim value
caml_get_addr(value page)
{
CAMLparam1(page);
CAMLlocal1(int64);
void *data = Caml_ba_data_val(page);
int64 = caml_copy_int64((uint64_t) data);
CAMLreturn(int64);
}
示例15: mk_int64_paranode
paranode mk_int64_paranode(int64_t l, source_info_t *src_info) {
CAMLparam0();
CAMLlocal1(val);
val = caml_alloc(1, PARNUM_INT64);
Store_field(val, 0, caml_copy_int64(l));
CAMLreturnT(paranode, mk_num(val, src_info));
}