本文整理汇总了C++中scm_from_int函数的典型用法代码示例。如果您正苦于以下问题:C++ scm_from_int函数的具体用法?C++ scm_from_int怎么用?C++ scm_from_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scm_from_int函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: status_list
SCM status_list (SCM board_smob) {
struct board *board;
struct cell *cell;
int i;
int j;
SCM cell_smob;
SCM list;
SCM row;
scm_assert_smob_type(board_tag, board_smob);
board = (struct board *) SCM_SMOB_DATA(board_smob);
list = SCM_EOL;
for (i = board->height - 1; i >= 0; i--) {
row = SCM_EOL;
for (j = board->width - 1; j >= 0; j--) {
cell_smob = scm_list_ref(scm_list_ref(board->cell_list, scm_from_int(j)), scm_from_int(i));
cell = (struct cell *) SCM_SMOB_DATA(cell_smob);
row = scm_cons(get_status(cell_smob), row);
}
list = scm_cons(row, list);
}
return list;
}
开发者ID:bradfordbarr,项目名称:Flatland,代码行数:25,代码来源:board.c
示例2: g_rc_component_dialog_attributes
/*! \brief read the configuration string list for the component dialog
* \par Function Description
* This function reads the string list from the component-dialog-attributes
* configuration parameter and converts the list into a GList.
* The GList is stored in the global default_component_select_attrlist variable.
*/
SCM g_rc_component_dialog_attributes(SCM stringlist)
{
int length, i;
GList *list=NULL;
gchar *attr;
SCM_ASSERT(scm_list_p(stringlist), stringlist, SCM_ARG1, "scm_is_list failed");
length = scm_ilength(stringlist);
/* If the command is called multiple times, remove the old list before
recreating it */
g_list_foreach(default_component_select_attrlist, (GFunc)g_free, NULL);
g_list_free(default_component_select_attrlist);
/* convert the scm list into a GList */
for (i=0; i < length; i++) {
SCM_ASSERT(scm_is_string(scm_list_ref(stringlist, scm_from_int(i))),
scm_list_ref(stringlist, scm_from_int(i)), SCM_ARG1,
"list element is not a string");
attr = g_strdup(SCM_STRING_CHARS(scm_list_ref(stringlist, scm_from_int(i))));
list = g_list_prepend(list, attr);
}
default_component_select_attrlist = g_list_reverse(list);
return SCM_BOOL_T;
}
开发者ID:jgriessen,项目名称:geda-gaf,代码行数:33,代码来源:g_rc.c
示例3: gdbscm_memory_port_end_input
static void
gdbscm_memory_port_end_input (SCM port, int offset)
{
scm_t_port *pt = SCM_PTAB_ENTRY (port);
ioscm_memory_port *iomem = (ioscm_memory_port *) SCM_STREAM (port);
size_t remaining = pt->read_end - pt->read_pos;
/* Note: Use of "int offset" is specified by Guile ports API. */
if ((offset < 0 && remaining + offset > remaining)
|| (offset > 0 && remaining + offset < remaining))
{
gdbscm_out_of_range_error (FUNC_NAME, 0, scm_from_int (offset),
_("overflow in offset calculation"));
}
offset += remaining;
if (offset > 0)
{
pt->read_pos = pt->read_end;
/* Throw error if unread-char used at beginning of file
then attempting to write. Seems correct. */
if (!ioscm_lseek_address (iomem, -offset, SEEK_CUR))
{
gdbscm_out_of_range_error (FUNC_NAME, 0, scm_from_int (offset),
_("bad offset"));
}
}
pt->rw_active = SCM_PORT_NEITHER;
}
开发者ID:freebsd-riscv,项目名称:riscv-binutils-gdb,代码行数:30,代码来源:scm-ports.c
示例4: weechat_guile_alist_to_hashtable
struct t_hashtable *
weechat_guile_alist_to_hashtable (SCM alist, int hashtable_size)
{
struct t_hashtable *hashtable;
int length, i;
SCM pair;
hashtable = weechat_hashtable_new (hashtable_size,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
if (!hashtable)
return NULL;
length = scm_to_int (scm_length (alist));
for (i = 0; i < length; i++)
{
pair = scm_list_ref (alist, scm_from_int (i));
weechat_hashtable_set (hashtable,
scm_i_string_chars (scm_list_ref (pair,
scm_from_int (0))),
scm_i_string_chars (scm_list_ref (pair,
scm_from_int (1))));
}
return hashtable;
}
开发者ID:munkee,项目名称:weechat,代码行数:28,代码来源:weechat-guile.c
示例5: is
/*
* Returns a list with coords of the ends of the given pin <B>object</B>.
The list is ( (x0 y0) (x1 y1) ), where the beginning is at (x0,y0) and the end at (x1,y1).
The active connection end of the pin is the beginning, so this function cares about the whichend property of the pin object. If whichend is 1, then it has to reverse the ends.
*/
SCM g_get_pin_ends(SCM object)
{
TOPLEVEL *toplevel;
OBJECT *o_current;
SCM coord1 = SCM_EOL;
SCM coord2 = SCM_EOL;
SCM coords = SCM_EOL;
/* Get toplevel and o_current */
SCM_ASSERT (g_get_data_from_object_smob (object, &toplevel, &o_current),
object, SCM_ARG1, "get-pin-ends");
/* Check that it is a pin object */
SCM_ASSERT (o_current != NULL,
object, SCM_ARG1, "get-pin-ends");
SCM_ASSERT (o_current->type == OBJ_PIN,
object, SCM_ARG1, "get-pin-ends");
SCM_ASSERT (o_current->line != NULL,
object, SCM_ARG1, "get-pin-ends");
coord1 = scm_cons(scm_from_int(o_current->line->x[0]),
scm_from_int(o_current->line->y[0]));
coord2 = scm_cons(scm_from_int(o_current->line->x[1]),
scm_from_int(o_current->line->y[1]));
if (o_current->whichend == 0) {
coords = scm_cons(coord1, scm_list(coord2));
} else {
coords = scm_cons(coord2, scm_list(coord1));
}
return coords;
}
开发者ID:jgriessen,项目名称:geda-gaf,代码行数:37,代码来源:g_hook.c
示例6: test_can_convert_to_slist__list_of_integers
int test_can_convert_to_slist__list_of_integers (void)
{
SCM str_list = scm_list_2(scm_from_int(1), scm_from_int(2));
int ret = _scm_can_convert_to_slist (str_list);
printf("test that _scm_can_convert_to_slist returns 0 when passed a list of integers: %d\n", ret == 0);
return ret == 0;
}
开发者ID:spk121,项目名称:guile-curl,代码行数:7,代码来源:check_type.c
示例7: test_scm_convert_to_slist__list_of_integers
int test_scm_convert_to_slist__list_of_integers (void)
{
SCM str_list = scm_list_2(scm_from_int(1), scm_from_int(2));
struct curl_slist *ret = _scm_convert_to_slist (str_list);
printf("test that _scm_convert_to_slist returns NULL when passed a list of integers: %d\n", ret == NULL);
return ret == NULL;
}
开发者ID:spk121,项目名称:guile-curl,代码行数:7,代码来源:check_type.c
示例8: game_process_event
static void
game_process_event (Game *game)
{
static ALLEGRO_EVENT event;
al_wait_for_event(game->event_queue, &event);
if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
{
game->running = false;
}
else if (event.type == ALLEGRO_EVENT_TIMER)
{
game_update (game);
}
else if (event.type == ALLEGRO_EVENT_KEY_UP)
{
if (scm_is_true (game->on_key_released))
{
scm_call_1 (game->on_key_released, scm_from_int (event.keyboard.keycode));
}
}
else if (event.type == ALLEGRO_EVENT_KEY_DOWN)
{
if (scm_is_true (game->on_key_pressed))
{
scm_call_1 (game->on_key_pressed, scm_from_int (event.keyboard.keycode));
}
}
}
开发者ID:davidgomes,项目名称:gnumaku,代码行数:30,代码来源:game.c
示例9: get_neighbors
SCM get_neighbors (SCM board_smob, SCM cell_smob) {
struct board *board;
struct cell *cell;
SCM list;
SCM neighbor;
int i;
int j;
int x;
int y;
scm_assert_smob_type(board_tag, board_smob);
scm_assert_smob_type(cell_tag, cell_smob);
board = (struct board *) SCM_SMOB_DATA(board_smob);
cell = (struct cell *) SCM_SMOB_DATA(cell_smob);
list = SCM_EOL;
for (i = -1; i < 2; i++) {
for (j = -1; j < 2; j++) {
if (i == 0 && j == 0) {
continue;
}
x = cell->x + i;
y = cell->y + j;
if (x >= 0 && x < board->width && y >= 0 && y < board->height) {
neighbor = scm_list_ref(scm_list_ref(board->cell_list, scm_from_int(y)), scm_from_int(x));
list = scm_cons(neighbor, list);
}
}
}
return list;
}
开发者ID:bradfordbarr,项目名称:Flatland,代码行数:34,代码来源:board.c
示例10: 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
示例11: scm_ragnarok_epoll_wait
SCM scm_ragnarok_epoll_wait(SCM event_set ,SCM second ,SCM msecond)
#define FUNC_NAME "ragnarok-epoll-wait"
{
scm_rag_epoll_event_set *es = NULL;
int fd;
int op;
int count;
long s = 0L;
long ms = 0L;
SCM cons;
int nfds;
SCM ret = SCM_EOL;
SCM_ASSERT_EPOLL_EVENT_SET(event_set);
es = (scm_rag_epoll_event_set*)SCM_SMOB_DATA(event_set);
if(!SCM_UNBNDP(second))
{
SCM_VALIDATE_NUMBER(3 ,second);
s = (long)scm_to_long(second);
if(!SCM_UNBNDP(msecond))
{
SCM_VALIDATE_NUMBER(4 ,msecond);
ms = (long)scm_to_long(msecond);
}
ms += s*1000; // convert to mseconds since epoll_wait only accept msecond;
}
ms = ms ? ms : -1;
count = es->count;
if(!count)
goto end;
nfds = epoll_wait(es->epfd ,es->ee_set ,count ,ms);
if(nfds < 0)
{
RAG_ERROR1("epoll_wait" ,"epoll_wait error! errno shows %a~%",
RAG_ERR2STR(errno));
}
while(nfds > 0)
{
nfds--;
fd = es->ee_set[nfds].data.fd;
op = es->ee_set[nfds].events;
cons = scm_cons(scm_from_int(fd) ,scm_from_int(op));
ret = scm_cons(cons ,ret);
}
return ret;
end:
return SCM_EOL;
}
开发者ID:NalaGinrut,项目名称:ragnarok,代码行数:58,代码来源:rag_epoll.c
示例12: gucu_getyx
SCM
gucu_getyx (SCM win)
{
int y, x;
getyx (_scm_to_window (win), y, x);
return (scm_list_2 (scm_from_int (y), scm_from_int (x)));
}
开发者ID:guildhall,项目名称:guile-ncurses,代码行数:9,代码来源:curs_spec.c
示例13: gucu_getsyx
/* Get the location of the virtual screen cursor */
SCM
gucu_getsyx ()
{
int y = 0, x = 0;
getsyx (y, x);
return (scm_list_2 (scm_from_int (y), scm_from_int (x)));
}
开发者ID:guildhall,项目名称:guile-ncurses,代码行数:10,代码来源:curs_spec.c
示例14: gucu_getscrreg
/* Return the range of the lines in the scroll region */
SCM
gucu_getscrreg (SCM win)
{
int top, bottom;
wgetscrreg (_scm_to_window (win), &top, &bottom);
return (scm_list_2 (scm_from_int (top), scm_from_int (bottom)));
}
开发者ID:guildhall,项目名称:guile-ncurses,代码行数:10,代码来源:curs_spec.c
示例15: call_guile_buttonpress
bool call_guile_buttonpress(unsigned int button, bool ctrl, int x, int y) {
return scm_to_bool (scm_eval (scm_list_n (scm_from_locale_symbol ("on-button-press"),
scm_from_int(button),
scm_from_bool(ctrl),
scm_from_int(x),
scm_from_int(y),
SCM_UNDEFINED
), scm_interaction_environment()));
}
开发者ID:pimp-my-code,项目名称:sxiv,代码行数:9,代码来源:scripting.c
示例16: scm_rexp_interval
VISIBLE SCM
scm_rexp_interval (SCM match, SCM subexpression)
{
rexp_interval_t interv = rexp_interval (scm_to_rexp_match_t (match),
scm_to_size_t (subexpression));
return ((interv.i_start == -1) ?
SCM_BOOL_F : scm_list_2 (scm_from_int (interv.i_start),
scm_from_int (interv.i_end)));
}
开发者ID:khaledhosny,项目名称:sortsmill,代码行数:9,代码来源:guile_strings_rexp.c
示例17: assert_object_type
SCM TTY::GetWinSize(SCM id){
assert_object_type(id);
TTY * t = (TTY *)get_object(id);
assert(t!=NULL);
int width = 0;
int height = 0;
int r = uv_tty_get_winsize(GetHandle(t), &width, &height);
if(r) Logger::Err("uv_tty_get_winsize failed! : %d", r);
return scm_list_2(scm_from_int(width), scm_from_int(height));
}
开发者ID:wehu,项目名称:mo,代码行数:10,代码来源:mo_tty.cpp
示例18: scm_gsl_error_handler_for_raising_a_gsl_error
VISIBLE void
scm_gsl_error_handler_for_raising_a_gsl_error (const char *reason,
const char *file,
int line, int gsl_errno)
{
scm_raise_gsl_error (scm_list_4 (scm_from_locale_string (reason),
scm_from_locale_string (file),
scm_from_int (line),
scm_from_int (gsl_errno)));
}
开发者ID:khaledhosny,项目名称:sortsmill,代码行数:10,代码来源:guile_math_gsl_error.c
示例19: scm_srcprops_to_alist
static SCM
scm_srcprops_to_alist (SCM obj)
{
SCM alist = SRCPROPALIST (obj);
if (!SCM_UNBNDP (SRCPROPCOPY (obj)))
alist = scm_acons (scm_sym_copy, SRCPROPCOPY (obj), alist);
alist = scm_acons (scm_sym_column, scm_from_int (SRCPROPCOL (obj)), alist);
alist = scm_acons (scm_sym_line, scm_from_int (SRCPROPLINE (obj)), alist);
return alist;
}
开发者ID:KarlHegbloom,项目名称:guile,代码行数:10,代码来源:srcprop.c
示例20: thit_scm_from_vector_int
SCM
thit_scm_from_vector_int(gsl_vector_int *v) {
SCM s_vector = scm_c_make_vector(v->size, SCM_BOOL_F);
int i;
for (i = 0; i < v->size; i++)
scm_vector_set_x(s_vector, scm_from_int(i),
scm_from_int(gsl_vector_int_get(v, i)));
return s_vector;
}
开发者ID:jotok,项目名称:banmi,代码行数:11,代码来源:thit.c
注:本文中的scm_from_int函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论