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


C++ scm_to_int函数代码示例

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


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

示例1: ffmpeg_crop_audio_frame_size

SCM ffmpeg_crop_audio_frame_size(SCM scm_self, SCM scm_size)
{
  struct ffmpeg_t *self = get_self(scm_self);
  self->audio_target_frame->nb_samples = scm_to_int(scm_size);
  self->audio_packed_frame->nb_samples = scm_to_int(scm_size);
  return SCM_UNSPECIFIED;
}
开发者ID:wedesoft,项目名称:aiscm,代码行数:7,代码来源:ffmpeg.c

示例2: make_image

static SCM
make_image (SCM name, SCM s_width, SCM s_height)
{
  SCM smob;
  struct image *image;
  int width = scm_to_int (s_width);
  int height = scm_to_int (s_height);

  /* Step 1: Allocate the memory block.
   */
  image = (struct image *) scm_gc_malloc (sizeof (struct image), "image");

  /* Step 2: Initialize it with straight code.
   */
  image->width = width;
  image->height = height;
  image->pixels = NULL;
  image->name = SCM_BOOL_F;
  image->update_func = SCM_BOOL_F;

  /* Step 3: Create the smob.
   */
  SCM_NEWSMOB (smob, image_tag, image);

  /* Step 4: Finish the initialization.
   */
  image->name = name;
  image->pixels = scm_gc_malloc_pointerless (width * height, "image pixels");

  return smob;
}
开发者ID:AtomicKity,项目名称:guile,代码行数:31,代码来源:image-type.c

示例3: make_board

static SCM make_board (SCM s_width, SCM s_height) {
	int i;
	int j;

	SCM smob;
	struct board *board;
	int width = scm_to_int(s_width);
	int height = scm_to_int(s_height);

	board = (struct board *) scm_gc_malloc(sizeof(struct board), "board");

	board->width = width;
	board->height = height;
	board->update_func = SCM_BOOL_F;
	board->cell_list = SCM_EOL;

	for (i = height - 1; i >= 0; i--) {
		SCM row = SCM_EOL;
		for (j = width - 1; j >= 0; j--) {
			SCM y_offset = scm_from_int(i);
			SCM x_offset = scm_from_int(j);
			row = scm_cons(make_cell(x_offset, y_offset, scm_from_int(0)), row);
		}
		board->cell_list = scm_cons(row, board->cell_list);
	}

	SCM_NEWSMOB(smob, board_tag, board);

	return smob;
}
开发者ID:bradfordbarr,项目名称:Flatland,代码行数:30,代码来源:board.c

示例4: g_action_get_position

/*! \brief Get the action position.
 * \par Function Description
 * Retrieves the current action position and stores it in \a x and \a
 * y, optionally snapping it to the grid if \a snap is true.  This
 * should be interpreted as the position that the user was pointing
 * with the mouse pointer when the current action was invoked.  If
 * there is no valid world position for the current action, returns
 * FALSE without modifying the output variables.
 *
 * This should be used by actions implemented in C to figure out where
 * on the schematic the user wants them to apply the action.
 *
 * See also the (gschem action) Scheme module.
 *
 * \param w_current    Current gschem toplevel structure.
 * \param x            Location to store x coordinate.
 * \param y            Location to store y coordinate.
 *
 * \return TRUE if current action position is set, FALSE otherwise.
 */
gboolean
g_action_get_position (gboolean snap, int *x, int *y)
{
  SCM s_action_position_proc;
  SCM s_point;
  GschemToplevel *w_current = g_current_window ();

  g_assert (w_current);

  /* Get the action-position procedure */
  s_action_position_proc =
    scm_variable_ref (scm_c_module_lookup (scm_c_resolve_module ("gschem action"),
                                           "action-position"));

  /* Retrieve the action position */
  s_point = scm_call_0 (s_action_position_proc);

  if (scm_is_false (s_point)) return FALSE;

  if (x) {
    *x = scm_to_int (scm_car (s_point));
    if (snap) {
      *x = snap_grid (w_current, *x);
    }
  }
  if (y) {
    *y = scm_to_int (scm_cdr (s_point));
    if (snap) {
      *y = snap_grid (w_current, *y);
    }
  }

  return TRUE;
}
开发者ID:SayCV,项目名称:geda-gaf,代码行数:54,代码来源:g_action.c

示例5: CheckArgType

SCM TTY::New(SCM fd, SCM readable){
  CheckArgType(fd, scm_integer_p, "tty-new", 1);
  CheckArgType(readable, scm_integer_p, "tty-new", 2);
  TTY * t = new TTY(scm_to_int(fd), scm_to_int(readable));
  assert(t!=NULL);
  return t->smob;
}
开发者ID:wehu,项目名称:mo,代码行数:7,代码来源:mo_tty.cpp

示例6: guile_comm_send

//
// Send as a procedure, receive as a function that returns
// arbitrary types unrelated to input is an ugly abstraction:
//
SCM
guile_comm_send (SCM world, SCM dst, SCM tag, SCM obj)
{
    size_t len;
    char *buf;

    // extract MPI_Comm, verifies the type:
    MPI_Comm comm = scm_to_comm (world);

    int idst = scm_to_int (dst);
    int itag = scm_to_int (tag);

    // searialize the object, dont forget to free() later:
    buf = scm_to_byte_string (obj, &len);
    assert (len < MAX_BUF_LENGTH);

    // printf ("SEND:%s\n", buf);

    // send just enough elements:
    int ierr = MPI_Send (buf, len, MPI_CHAR, idst, itag, comm);
    assert (MPI_SUCCESS==ierr);

    free (buf);

    return scm_from_int (ierr);
}
开发者ID:alexei-matveev,项目名称:guile-comm,代码行数:30,代码来源:libguile-comm.c

示例7: guile_comm_recv

SCM
guile_comm_recv (SCM world, SCM src, SCM tag)
{
    char buf[MAX_BUF_LENGTH];

    // extract MPI_Comm, verifies the type:
    MPI_Comm comm = scm_to_comm (world);

    int isrc = scm_to_int (src);
    int itag = scm_to_int (tag);

    MPI_Status stat;

    int ierr = MPI_Recv (buf, MAX_BUF_LENGTH, MPI_CHAR, isrc, itag, comm, &stat);
    assert (MPI_SUCCESS==ierr);

    // printf ("RECV:%s\n", buf);

    // get the size of the received data:
    int ilen;
    ierr = MPI_Get_count (&stat, MPI_CHAR, &ilen);
    assert (MPI_SUCCESS==ierr);

    return scm_from_byte_string (buf, ilen);
}
开发者ID:alexei-matveev,项目名称:guile-comm,代码行数:25,代码来源:libguile-comm.c

示例8: thit_new_model

static SCM
thit_new_model(SCM s_max_rows, SCM s_bds_disc, SCM s_n_cont, SCM s_dp_weight,
               SCM s_init_crosstab, SCM s_lambda_a, SCM s_lambda_b) 
{
    int max_rows = scm_to_int(s_max_rows);
    int n_cont = scm_to_int(s_n_cont);
    double dp_weight = scm_to_double(s_dp_weight);
    double init_crosstab = scm_to_double(s_init_crosstab);
    double lambda_a = scm_to_double(s_lambda_a);
    double lambda_b = scm_to_double(s_lambda_b);

    int n_disc = scm_to_int(scm_length(s_bds_disc));
    gsl_vector_int *bds_disc =  gsl_vector_int_alloc(n_disc);

    int i, b;
    for (i = 0; i < n_disc; i++) {
        b = scm_to_int(scm_list_ref(s_bds_disc, scm_from_int(i)));
        gsl_vector_int_set(bds_disc, i, b);
    }

    banmi_model_t *model = new_banmi_model(max_rows, bds_disc, n_cont, dp_weight,
                                           init_crosstab, lambda_a, lambda_b);

    SCM smob;
    SCM_NEWSMOB(smob, thit_model_tag, model);

    return smob;
}
开发者ID:jotok,项目名称:banmi,代码行数:28,代码来源:thit.c

示例9: scm_make_select_event_set

SCM scm_make_select_event_set(SCM nfds ,SCM size ,SCM type)
#define FUNC_NAME "make-event-set"
{
  int t;
  unsigned int n = 0;
  int fd;
  
  SCM_VALIDATE_NUMBER(1 ,nfds);
  SCM_VALIDATE_NUMBER(2 ,size);
  SCM_VALIDATE_NUMBER(3 ,type);
  
  t = scm_to_int(type);
  n = scm_to_uint(size);
  fd = scm_to_int(nfds);
  
  scm_rag_fd_set *rfd = (scm_rag_fd_set*)scm_gc_malloc(sizeof(scm_rag_fd_set));
  
  scm_rag_select_event_set *ses =
    (scm_rag_select_event_set*)scm_gc_malloc(sizeof(scm_rag_select_event_set),
					     "select-event-set");

  ses->type = t;
  ses->count = 0;
  ses->size = n;
  ses->nfds = fd;
  ses->set = rfd;
  
  return scm_rag_select_event_set2scm(ses);
}
开发者ID:NalaGinrut,项目名称:ragnarok,代码行数:29,代码来源:rag_select.c

示例10: __api_build_projectile_prototype

SCM __api_build_projectile_prototype(SCM name, SCM speed, SCM w, SCM h, SCM longevity, SCM dmg)
{
	char *s = scm_to_locale_string(name);
	projectile *p = build_projectile_prototype(s, scm_to_double(speed), scm_to_int(w), scm_to_int(h), scm_to_int(longevity), scm_to_int(dmg));
	free(s);
	SCM ret = scm_new_smob(__api_projectile_tag, (unsigned long) p);
	scm_gc_protect_object(ret);
	return ret;
}
开发者ID:chameco,项目名称:maildaemon,代码行数:9,代码来源:projectile.c

示例11: g_rc_window_size

/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_window_size(SCM width, SCM height)
{
    SCM_ASSERT (scm_is_integer (width),  width,  SCM_ARG1, "window-size");
    SCM_ASSERT (scm_is_integer (height), height, SCM_ARG2, "window-size");

    default_width  = scm_to_int (width);
    default_height = scm_to_int (height);

    return SCM_BOOL_T;
}
开发者ID:bert,项目名称:geda-gaf,代码行数:15,代码来源:g_rc.c

示例12: __api_make_fx

SCM __api_make_fx(SCM type, SCM col, SCM x, SCM y, SCM dim, SCM radius, SCM speed)
{
	color c = *((color *) SCM_SMOB_DATA(col));
	SCM ret = scm_new_smob(__api_effect_tag,
			(unsigned long) make_fx(scm_to_int(type), c,
				scm_to_double(x), scm_to_double(y), scm_to_int(dim),
				scm_to_int(radius), scm_to_double(speed)));
	scm_gc_protect_object(ret);
	return ret;
}
开发者ID:chameco,项目名称:maildaemon,代码行数:10,代码来源:fx.c

示例13: SCM_SMOB_DATA

SCM Display::scm_draw_image(SCM image, SCM pos) {
#ifdef WITH_SDL
	struct image *img = (struct image *) SCM_SMOB_DATA(image);
	SDL_Rect p;
	p.x = scm_to_int(scm_car(pos));
	p.y = scm_to_int(scm_cadr(pos));
	printf("%d, %d", img->surface, NULL);
	SDL_BlitSurface(img->surface, NULL, get()->m_pScreen, &p); 
#endif
}
开发者ID:acieroid,项目名称:gge,代码行数:10,代码来源:Display.cpp

示例14: function_type

static LLVMTypeRef function_type(SCM scm_return_type, SCM scm_argument_types)
{
  int n_arguments = scm_ilength(scm_argument_types);
  LLVMTypeRef *parameters = scm_gc_malloc_pointerless(n_arguments * sizeof(LLVMTypeRef), "make-llvm-function");
  for (int i=0; i<n_arguments; i++) {
    parameters[i] = llvm_type(scm_to_int(scm_car(scm_argument_types)));
    scm_argument_types = scm_cdr(scm_argument_types);
  };
  return LLVMFunctionType(llvm_type(scm_to_int(scm_return_type)), parameters, n_arguments, 0);
}
开发者ID:wedesoft,项目名称:aiscm,代码行数:10,代码来源:core.c

示例15: g_rc_image_size

/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_image_size(SCM width, SCM height)
{
    SCM_ASSERT (scm_is_integer (width),  width,  SCM_ARG1, "image-size");
    SCM_ASSERT (scm_is_integer (height), height, SCM_ARG2, "image-size");

    /* yes this is legit, we are casting the resulting double to an int */
    default_image_width  = scm_to_int (width);
    default_image_height = scm_to_int (height);

    return SCM_BOOL_T;
}
开发者ID:bert,项目名称:geda-gaf,代码行数:16,代码来源:g_rc.c


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