本文整理汇总了C++中alloc_small函数的典型用法代码示例。如果您正苦于以下问题:C++ alloc_small函数的具体用法?C++ alloc_small怎么用?C++ alloc_small使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了alloc_small函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ml_gtk_widget_get_pointer
CAMLprim value ml_gtk_widget_get_pointer (value w)
{
int x,y;
value ret;
gtk_widget_get_pointer (GtkWidget_val(w), &x, &y);
ret = alloc_small (2,0);
Field(ret,0) = Val_int(x);
Field(ret,1) = Val_int(y);
return ret;
}
开发者ID:CRogers,项目名称:obc,代码行数:10,代码来源:ml_gtk.c示例2: ml_gsl_stats_minmax_index
CAMLprim value ml_gsl_stats_minmax_index(value data)
{
size_t len = Double_array_length(data);
size_t mi, ma;
value r;
gsl_stats_minmax_index(&mi, &ma, Double_array_val(data), 1, len);
r = alloc_small(2, 0);
Field(r, 0) = Val_int(mi);
Field(r, 1) = Val_int(ma);
return r;
}
开发者ID:ptrf,项目名称:LCDE,代码行数:11,代码来源:mlgsl_stats.c示例3: val_of_result_pair
static value val_of_result_pair (gsl_sf_result *re, gsl_sf_result *im)
{
CAMLparam0 ();
CAMLlocal3 (v, v_re, v_im);
v_re = val_of_result (re);
v_im = val_of_result (im);
v = alloc_small (2, 0);
Field (v, 0) = v_re;
Field (v, 1) = v_im;
CAMLreturn (v);
}
开发者ID:ryanrhymes,项目名称:gsl-ocaml,代码行数:11,代码来源:mlgsl_sf.c示例4: ml_gdk_window_get_pointer_location
CAMLprim value ml_gdk_window_get_pointer_location (value window)
{
int x = 0;
int y = 0;
value ret;
gdk_window_get_pointer (GdkWindow_val(window), &x, &y, NULL);
ret = alloc_small (2, 0);
Field(ret, 0) = Val_int(x);
Field(ret, 1) = Val_int(y);
return ret;
}
开发者ID:CRogers,项目名称:obc,代码行数:11,代码来源:ml_gdk.c示例5: caml_gr_wait_allocate_result
static value caml_gr_wait_allocate_result(int mouse_x, int mouse_y, int button,
int keypressed, int key)
{
value res = alloc_small(5, 0);
Field(res, 0) = Val_int(mouse_x);
Field(res, 1) = Val_int(mouse_y == -1 ? -1 : Wcvt(mouse_y));
Field(res, 2) = Val_bool(button);
Field(res, 3) = Val_bool(keypressed);
Field(res, 4) = Val_int(key & 0xFF);
return res;
}
开发者ID:ArnaudParant,项目名称:install_script,代码行数:11,代码来源:events.c示例6: value_of_keyevent
static value value_of_keyevent(SDL_KeyboardEvent keyevt)
{
CAMLparam0();
CAMLlocal2(v, r);
Uint8 char_code = 0;
tag_t tag;
r = alloc_small(6, 0);
Field(r, 0) = Val_int(keyevt.which) ;
Field(r, 1) = keyevt.state == SDL_RELEASED ? Val_int(0) : Val_int(1);
Field(r, 2) = find_mlsdl_keysym(keyevt.keysym.sym) ;
Field(r, 3) = Val_int(keyevt.keysym.mod) ;
if (keyevt.keysym.unicode <= 0x7F)
char_code = keyevt.keysym.unicode;
Field(r, 4) = Val_int(char_code);
Field(r, 5) = Val_long(keyevt.keysym.unicode);
tag = keyevt.state == SDL_PRESSED ? 1 : 2 ;
v = alloc_small(1, tag);
Field(v, 0) = r;
CAMLreturn(v);
}
开发者ID:Ninju,项目名称:OCamlSDL,代码行数:20,代码来源:sdlevent_stub.c示例7: alloc_small_barray
METHODDEF JBLOCKARRAY
alloc_small_barray (long blocksperrow, long numrows)
/* Allocate a "small" (all-in-memory) 2-D coefficient-block array */
{
small_barray_ptr hdr;
JBLOCKARRAY result;
JBLOCKROW workspace;
long rowsperchunk, currow, i;
#ifdef MEM_STATS
total_num_barray++;
cur_num_barray++;
if (cur_num_barray > max_num_barray) max_num_barray = cur_num_barray;
#endif
/* Calculate max # of rows allowed in one allocation chunk */
rowsperchunk = MAX_ALLOC_CHUNK / (blocksperrow * SIZEOF(JBLOCK));
if (rowsperchunk <= 0)
ERREXIT(methods, "Image too wide for this implementation");
/* Get space for header and row pointers; this is always "near" on 80x86 */
hdr = (small_barray_ptr) alloc_small((size_t) (numrows * SIZEOF(JBLOCKROW)
+ SIZEOF(small_barray_hdr)));
result = (JBLOCKARRAY) (hdr+1); /* advance past header */
/* Insert into list now so free_all does right thing if I fail */
/* after allocating only some of the rows... */
hdr->next = small_barray_list;
hdr->numrows = 0;
hdr->rowsperchunk = rowsperchunk;
small_barray_list = hdr;
/* Get the rows themselves; on 80x86 these are "far" */
currow = 0;
while (currow < numrows) {
rowsperchunk = MIN(rowsperchunk, numrows - currow);
#ifdef MEM_STATS
total_bytes_barray += rowsperchunk * blocksperrow * SIZEOF(JBLOCK)
+ MALLOC_FAR_OVERHEAD;
#endif
workspace = (JBLOCKROW) jget_large((size_t) (rowsperchunk * blocksperrow
* SIZEOF(JBLOCK)));
if (workspace == NULL)
out_of_memory(4);
for (i = rowsperchunk; i > 0; i--) {
result[currow++] = workspace;
workspace += blocksperrow;
}
hdr->numrows = currow;
}
return result;
}
开发者ID:OS2World,项目名称:APP-GRAPHICS-X11-XLOADIMAGE,代码行数:54,代码来源:jmemmgr.c示例8: alloc_sockaddr
value alloc_sockaddr(union sock_addr_union * adr /*in*/,
socklen_param_type adr_len, int close_on_error)
{
value res;
switch(adr->s_gen.sa_family) {
#ifndef _WIN32
case AF_UNIX:
{ value n = copy_string(adr->s_unix.sun_path);
Begin_root (n);
res = alloc_small(1, 0);
Field(res,0) = n;
End_roots();
break;
}
#endif
case AF_INET:
{ value a = alloc_inet_addr(&adr->s_inet.sin_addr);
Begin_root (a);
res = alloc_small(2, 1);
Field(res,0) = a;
Field(res,1) = Val_int(ntohs(adr->s_inet.sin_port));
End_roots();
break;
}
#ifdef HAS_IPV6
case AF_INET6:
{ value a = alloc_inet6_addr(&adr->s_inet6.sin6_addr);
Begin_root (a);
res = alloc_small(2, 1);
Field(res,0) = a;
Field(res,1) = Val_int(ntohs(adr->s_inet6.sin6_port));
End_roots();
break;
}
#endif
default:
if (close_on_error != -1) close (close_on_error);
unix_error(EAFNOSUPPORT, "", Nothing);
}
return res;
}
开发者ID:ArnaudParant,项目名称:install_script,代码行数:41,代码来源:socketaddr.c示例9: kc_cursor_open
extern CAMLprim
value kc_cursor_open(value caml_db)
{
CAMLparam1(caml_db);
KCDB* db = get_db(caml_db);
KCCUR* cur = open_cursor(db);
value caml_cursor = alloc_small(1, Abstract_tag);
KCCUR_val(caml_cursor) = cur;
CAMLreturn(caml_cursor);
}
开发者ID:didier-wenzek,项目名称:ocaml-kyotocabinet,代码行数:12,代码来源:kyoto_ocaml_wrapper.c示例10: caml_gr_text_size
value caml_gr_text_size(value str)
{
int width;
value res;
caml_gr_check_open();
if (caml_gr_font == NULL) caml_gr_get_font(DEFAULT_FONT);
width = XTextWidth(caml_gr_font, String_val(str), string_length(str));
res = alloc_small(2, 0);
Field(res, 0) = Val_int(width);
Field(res, 1) = Val_int(caml_gr_font->ascent + caml_gr_font->descent);
return res;
}
开发者ID:Chris00,项目名称:ocaml,代码行数:12,代码来源:text.c示例11: val_of_result_e10
static inline value val_of_result_e10(gsl_sf_result_e10 *result)
{
CAMLparam0();
CAMLlocal3(r, v, e) ;
v = copy_double(result->val);
e = copy_double(result->err);
r = alloc_small(3, 0);
Field(r, 0) = v;
Field(r, 1) = e;
Field(r, 2) = Val_int(result->e10);
CAMLreturn(r);
}
开发者ID:ryanrhymes,项目名称:gsl-ocaml,代码行数:12,代码来源:mlgsl_sf.c示例12: ml_gdk_window_get_position
CAMLprim value ml_gdk_window_get_position (value window)
{
int x, y;
value ret;
gdk_window_get_position (GdkWindow_val(window), &x, &y);
ret = alloc_small (2,0);
Field(ret,0) = Val_int(x);
Field(ret,1) = Val_int(y);
return ret;
}
开发者ID:CRogers,项目名称:obc,代码行数:12,代码来源:ml_gdk.c示例13: ml_gdk_drawable_get_size
CAMLprim value ml_gdk_drawable_get_size (value drawable)
{
int x, y;
value ret;
gdk_drawable_get_size (GdkDrawable_val(drawable), &x, &y);
ret = alloc_small (2,0);
Field(ret,0) = Val_int(x);
Field(ret,1) = Val_int(y);
return ret;
}
开发者ID:CRogers,项目名称:obc,代码行数:12,代码来源:ml_gdk.c示例14: ml_gtk_calendar_get_date
CAMLprim value ml_gtk_calendar_get_date (value w)
{
guint year, month, day;
value ret;
gtk_calendar_get_date (GtkCalendar_val(w), &year, &month, &day);
ret = alloc_small (3, 0);
Field(ret,0) = Val_int(year);
Field(ret,1) = Val_int(month);
Field(ret,2) = Val_int(day);
return ret;
}
开发者ID:DMClambo,项目名称:pfff,代码行数:12,代码来源:ml_gtkmisc.c示例15: ml_gsl_poly_complex_solve_quadratic
CAMLprim value ml_gsl_poly_complex_solve_quadratic(value a, value b, value c)
{
gsl_complex z0, z1;
gsl_poly_complex_solve_quadratic(Double_val(a), Double_val(b),
Double_val(c), &z0, &z1);
{
CAMLparam0();
CAMLlocal3(r,rz0,rz1);
rz0 = alloc_small(2 * Double_wosize, Double_array_tag);
Store_double_field(rz0, 0, GSL_REAL(z0));
Store_double_field(rz0, 1, GSL_IMAG(z0));
rz1 = alloc_small(2 * Double_wosize, Double_array_tag);
Store_double_field(rz1, 0, GSL_REAL(z1));
Store_double_field(rz1, 1, GSL_IMAG(z1));
r = alloc_small(2, 0);
Field(r,0) = rz0 ;
Field(r,1) = rz1 ;
CAMLreturn(r);
}
}
开发者ID:akabe,项目名称:gsl-ocaml,代码行数:21,代码来源:mlgsl_poly.c本文标签属性:
示例:示例图
代码:代码大全可复制
alloc_small:alloc_small