Ejemplo n.º 1
0
static SCM
guile_sock_no_delay (SCM sock, SCM enable)
{
    svz_socket_t *xsock;
    int old = 0, set = 0;

    scm_assert_smob_type (guile_svz_socket_tag, sock);
    xsock = (svz_socket_t *) SCM_SMOB_DATA (sock);
    if (xsock->proto & PROTO_TCP)
    {
        if (!SCM_UNBNDP (enable))
        {
            SCM_ASSERT (scm_is_bool (enable) || scm_is_integer (enable), enable,
                        SCM_ARG2, FUNC_NAME);
            if ((scm_is_bool (enable) && scm_is_true (enable)) ||
                    (scm_is_integer (enable) && scm_to_int (enable) != 0))
                set = 1;
        }
        if (svz_tcp_nodelay (xsock->sock_desc, set, &old) < 0)
            old = 0;
        else if (SCM_UNBNDP (enable))
            svz_tcp_nodelay (xsock->sock_desc, old, NULL);
    }
    return SCM_BOOL (old);
}
Ejemplo n.º 2
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \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;
}
Ejemplo n.º 3
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \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;
}
Ejemplo n.º 4
0
SCM
gucu_slk_set (SCM labnum, SCM label, SCM fmt)
{
  SCM_ASSERT (scm_is_integer (labnum), labnum, SCM_ARG1, "slk-set");
  SCM_ASSERT (scm_is_string (label), label, SCM_ARG2, "slk-set");
  SCM_ASSERT (scm_is_integer (fmt), fmt, SCM_ARG3, "slk-set");

  int c_labnum = scm_to_int (labnum);
  char *c_label = scm_to_locale_string (label);
  int c_fmt = scm_to_int (fmt);

  int ret = slk_set (c_labnum, c_label, c_fmt);
  RETURNTF (ret);
}
Ejemplo n.º 5
0
Archivo: scheme.c Proyecto: nizmic/nwm
static SCM scm_draw_border(SCM client_smob, SCM color, SCM width)
{
    client_t *client = (client_t *)SCM_SMOB_DATA(client_smob);
    uint32_t color_uint;
    int width_int;
    if (scm_is_integer(color))
        color_uint = scm_to_uint32(color);
    else
        color_uint = 0x6CA0A3;
    if (scm_is_integer(width))
        width_int = scm_to_int(width);
    else
        width_int = 1;
    draw_border(client, color_uint, width_int);
    return SCM_UNSPECIFIED;
}
Ejemplo n.º 6
0
SCM guilePushChildElement(SCM childIndex)
{
  if(scm_is_integer(childIndex))
  {
    guihckStackPushChildElement(threadLocalContext.ctx, scm_to_int(childIndex));
    return SCM_BOOL_T;
  }
  return SCM_BOOL_F;
}
Ejemplo n.º 7
0
SCM
gucu_set_TABSIZE (SCM t)
{
  SCM_ASSERT (scm_is_integer (t), t, SCM_ARG1, "set-tabsize!");

  set_tabsize (scm_to_int (t));

  return SCM_UNSPECIFIED;
}
Ejemplo n.º 8
0
SCM
gucu_slk_init (SCM fmt)
{
  SCM_ASSERT (scm_is_integer (fmt), fmt, SCM_ARG1, "slk-init");

  int c_fmt = scm_to_int (fmt);

  int ret = slk_init (c_fmt);
  RETURNTF (ret);
}
Ejemplo n.º 9
0
SCM
gucu_slk_color_x (SCM color_pair_number)
{
  SCM_ASSERT (scm_is_integer (color_pair_number), color_pair_number, SCM_ARG1,
	      "slk-color!");

  short c_color_pair_number = scm_to_short (color_pair_number);

  int ret = slk_color (c_color_pair_number);
  RETURNTF (ret);
}
Ejemplo n.º 10
0
/* Convert mouse coordinates to screen coordinates */
SCM
gucu_wmouse_trafo (SCM win, SCM sy, SCM sx, SCM to_screen)
{
  SCM_ASSERT (_scm_is_window (win), win, SCM_ARG1, "mouse-trafo");
  SCM_ASSERT (scm_is_integer (sy), sy, SCM_ARG2, "mouse-trafo");
  SCM_ASSERT (scm_is_integer (sx), sx, SCM_ARG3, "mouse-trafo");
  SCM_ASSERT (scm_is_bool (to_screen), to_screen, SCM_ARG4, "mouse-trafo");

  int x, y, ret;
  x = scm_to_int (sx);
  y = scm_to_int (sy);

  ret = wmouse_trafo (_scm_to_window (win), &y, &x, scm_to_bool (to_screen));
  if (ret)
    {
      return scm_list_2 (scm_from_int (y), scm_from_int (x));
    }
  else
    return SCM_BOOL_F;
}
Ejemplo n.º 11
0
SCM
gucu_slk_label (SCM labnum)
{
  SCM_ASSERT (scm_is_integer (labnum), labnum, SCM_ARG1, "slk-label");

  int c_labnum = scm_to_int (labnum);

  char *ret = slk_label (c_labnum);
  SCM s_ret = scm_from_locale_string (ret);

  return s_ret;
}
Ejemplo n.º 12
0
SCM guilePushElement(SCM elementSymbol)
{
  if(scm_is_integer(elementSymbol))
  {
    guihckElementId id = scm_to_uint64(elementSymbol);
    guihckStackPushElement(threadLocalContext.ctx, id);
    return SCM_BOOL_T;
  }
  else
  {
    return SCM_BOOL_F;
  }
}
Ejemplo n.º 13
0
SCM
gucu_slk_attr_set_x (SCM attrs, SCM color_pair_number)
{
  SCM_ASSERT (_scm_is_attr (attrs), attrs, SCM_ARG1, "slk-attr-set!");
  SCM_ASSERT (scm_is_integer (color_pair_number), color_pair_number, SCM_ARG2,
	      "slk-attr-set!");

  const attr_t c_attrs = _scm_to_attr (attrs);
  short c_color_pair_number = scm_to_short (color_pair_number);

  int ret = slk_attr_set (c_attrs, c_color_pair_number, NULL);
  RETURNTF (ret);
}
Ejemplo n.º 14
0
static SCM
guile_sock_local_address (SCM sock, SCM address)
{
    svz_socket_t *xsock;
    uint16_t port;
    SCM pair;

    scm_assert_smob_type (guile_svz_socket_tag, sock);
    xsock = (svz_socket_t *) SCM_SMOB_DATA (sock);
    pair = scm_cons (scm_from_ulong (xsock->local_addr),
                     scm_from_int ((int) xsock->local_port));
    if (!SCM_UNBNDP (address))
    {
        SCM_ASSERT (scm_is_pair (address) && scm_is_integer (SCM_CAR (address))
                    && scm_is_integer (SCM_CDR (address)), address, SCM_ARG2,
                    FUNC_NAME);
        port = scm_to_uint16 (SCM_CDR (address));
        xsock->local_addr = scm_to_ulong (SCM_CAR (address));
        xsock->local_port = (unsigned short) port;
    }
    return pair;
}
Ejemplo n.º 15
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_output_vector_threshold(SCM numlines)
{
  int val;

  SCM_ASSERT (scm_is_integer (numlines), numlines,
              SCM_ARG1, "output-vector-threshold");
  
  val = scm_to_int (numlines);

  default_print_vector_threshold = val;

  return SCM_BOOL_T;
}
Ejemplo n.º 16
0
static SCM wrap_musicpd_play(SCM id) {
	bool b;
	int mpdid;

	b = SCM_BOOL_F;
	if(scm_is_integer(id)) {
		mpdid = scm_to_int(id);
		b = musicpd_play_id(mpdid);
	} else {
		b = musicpd_play();
	}
	
	return scm_from_bool(b);
}
Ejemplo n.º 17
0
static SCM
guile_sock_idle_counter (SCM sock, SCM counter)
{
    svz_socket_t *xsock;
    int ocounter;

    scm_assert_smob_type (guile_svz_socket_tag, sock);
    xsock = (svz_socket_t *) SCM_SMOB_DATA (sock);
    ocounter = xsock->idle_counter;
    if (!SCM_UNBNDP (counter))
    {
        SCM_ASSERT (scm_is_integer (counter), counter, SCM_ARG2, FUNC_NAME);
        xsock->idle_counter = scm_to_int (counter);
    }
    return scm_from_int (ocounter);
}
Ejemplo n.º 18
0
static SCM
guile_sock_send_buffer_size (SCM sock, SCM size)
{
    svz_socket_t *xsock;
    int len;

    scm_assert_smob_type (guile_svz_socket_tag, sock);
    xsock = (svz_socket_t *) SCM_SMOB_DATA (sock);
    if (!SCM_UNBNDP (size))
    {
        SCM_ASSERT (scm_is_integer (size), size, SCM_ARG2, FUNC_NAME);
        len = scm_to_int (size);
        svz_sock_resize_buffers (xsock, len, xsock->recv_buffer_size);
    }
    return scm_cons (scm_from_int (xsock->send_buffer_size),
                     scm_from_int (xsock->send_buffer_fill));
}
Ejemplo n.º 19
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_snap_size(SCM size)
{
    int val;

    SCM_ASSERT (scm_is_integer (size), size, SCM_ARG1, "snap-size");

    val = scm_to_int (size);
    if (val == 0) {
        fprintf(stderr, _("Invalid size [%d] passed to snap-size\n"),
                val);
        val = 100; /* absolute default */
    }

    default_snap_size = val;

    return SCM_BOOL_T;
}
Ejemplo n.º 20
0
int
xscm_val_to_int (SCM x)
{
    if (SCM_UNBNDP (x))
        return 0;
    else if (scm_is_bool (x))
    {
        if (scm_is_false(x))
            return 0;
        else
            return 1;
    }
    else if (scm_is_integer (x))
        return scm_to_int (x);

    return 0;
}
Ejemplo n.º 21
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \brief Scheme function for setting the step for keyboard pan.
 *
 * Default setting is 20.
 */
SCM g_rc_keyboardpan_gain(SCM gain)
{
    int val;

    SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "keyboardpan-gain");

    val = scm_to_int (gain);

    if (val <= 0) {
        fprintf(stderr, _("Invalid gain [%d] passed to keyboardpan-gain\n"),
                val);
        val = 20; /* absolute default */
    }

    default_keyboardpan_gain = val;

    return SCM_BOOL_T;
}
Ejemplo n.º 22
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_select_slack_pixels(SCM pixels)
{
    int val;

    SCM_ASSERT (scm_is_integer (pixels), pixels, SCM_ARG1, "select-slack-pixels");

    val = scm_to_int (pixels);

    if (val <= 0) {
        fprintf(stderr, _("Invalid number of pixels [%d] passed to select-slack-pixels\n"),
                val);
        val = 4; /* absolute default */
    }

    default_select_slack_pixels = val;

    return SCM_BOOL_T;
}
Ejemplo n.º 23
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_auto_save_interval(SCM seconds)
{
    int val;

    SCM_ASSERT (scm_is_integer (seconds), seconds, SCM_ARG1, "auto-save-interval");

    val = scm_to_int (seconds);

    if (val < 0) {
        fprintf(stderr, _("Invalid number of seconds [%d] passed to auto-save-interval\n"),
                val);
        val = 120; /* absolute default */
    }

    default_auto_save_interval = val;

    return SCM_BOOL_T;
}
Ejemplo n.º 24
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_dots_grid_fixed_threshold (SCM spacing)
{
    int val;

    SCM_ASSERT (scm_is_integer (spacing), spacing, SCM_ARG1, "dots-grid-fixed-threshold");

    val = scm_to_int (spacing);

    if (val <= 0) {
        fprintf(stderr, _("Invalid pixel spacing [%d] passed to dots-grid-fixed-threshold\n"),
                val);
        val = 10; /* absolute default */
    }

    default_dots_grid_fixed_threshold = val;

    return SCM_BOOL_T;
}
Ejemplo n.º 25
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_dots_grid_dot_size (SCM dotsize)
{
    int val;

    SCM_ASSERT (scm_is_integer (dotsize), dotsize, SCM_ARG1, "dots-grid-dot-size");

    val = scm_to_int (dotsize);

    if (val <= 0) {
        fprintf(stderr, _("Invalid dot size [%d] passed to dots-grid-dot-size\n"),
                val);
        val = 1; /* absolute default */
    }

    default_dots_grid_dot_size = val;

    return SCM_BOOL_T;
}
Ejemplo n.º 26
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_undo_levels(SCM levels)
{
    int val;

    SCM_ASSERT (scm_is_integer (levels), levels, SCM_ARG1, "undo-levels");

    val = scm_to_int (levels);

    if (val == 0) {
        fprintf(stderr, _("Invalid num levels [%d] passed to undo-levels\n"),
                val);
        val = 10; /* absolute default */
    }

    default_undo_levels = val;

    return SCM_BOOL_T;
}
Ejemplo n.º 27
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_add_attribute_offset(SCM offset)
{
    int val;

    SCM_ASSERT (scm_is_integer (offset), offset,
                SCM_ARG1, "add-attribute-offset");

    val = scm_to_int (offset);

    if (val < 0) {
        fprintf(stderr, _("Invalid offset [%d] passed to add-attribute-offset\n"),
                val);
        val = 50; /* absolute default */
    }

    default_add_attribute_offset = val;

    return SCM_BOOL_T;
}
Ejemplo n.º 28
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_mesh_grid_display_threshold (SCM spacing)
{
    int val;

    SCM_ASSERT (scm_is_integer (spacing), spacing, SCM_ARG1,
                "mesh-grid-display-threshold");

    val = scm_to_int (spacing);

    if (val <= 0) {
        fprintf (stderr, _("Invalid pixel spacing [%d] passed to "
                           "mesh-grid-display-threshold\n"), val);
        val = 3; /* absolute default */
    }

    default_mesh_grid_display_threshold = val;

    return SCM_BOOL_T;
}
Ejemplo n.º 29
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_zoom_gain(SCM gain)
{
    int val;

    SCM_ASSERT (scm_is_integer (gain), gain, SCM_ARG1, "zoom-gain");

    val = scm_to_int (gain);

    /* Allow -ve numbers in case the user wishes to reverse zoom direction,
     * but don't allow zero gain as this would disable the zoom action */
    if (val == 0) {
        fprintf(stderr, _("Invalid gain [%d] passed to zoom-gain\n"), val);
        val = 20; /* absolute default */
    }

    default_zoom_gain = val;

    return SCM_BOOL_T;
}
Ejemplo n.º 30
0
Archivo: g_rc.c Proyecto: bert/geda-gaf
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
SCM g_rc_scrollpan_steps(SCM steps)
{
    int val;

    SCM_ASSERT (scm_is_integer (steps), steps, SCM_ARG1, "scrollpan-steps");

    val = scm_to_int (steps);

    /* Allow -ve numbers in case the user wishes to reverse scroll direction,
     * but don't allow zero steps as this would cause a division by zero error */
    if (val == 0) {
        fprintf(stderr, _("Invalid number of steps [%d] scrollpan-steps\n"), val);
        val = 8; /* absolute default */
    }

    default_scrollpan_steps = val;

    return SCM_BOOL_T;
}