/* Generated by genstub.  Do not edit. */
#include <gauche.h>
#if defined(__CYGWIN__) || defined(__MINGW32__)
#define SCM_CGEN_CONST /*empty*/
#else
#define SCM_CGEN_CONST const
#endif
#include "shiki.h"
static ScmObj xyzzylisp_bufferp(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_scm;
  ScmObj buffer;
  SCM_ENTER_SUBR("bufferp");
  buffer_scm = SCM_ARGREF(0);
  buffer = (buffer_scm);
  {
{
int SCM_RESULT;
SCM_RESULT = SHIKI_BUFFER_P(buffer);
SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_bufferp__NAME, "bufferp", 7, 7);
static SCM_DEFINE_SUBR(xyzzylisp_bufferp__STUB, 1, 0, SCM_OBJ(&xyzzylisp_bufferp__NAME), xyzzylisp_bufferp, NULL, NULL);

static ScmObj xyzzylisp_selected_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("selected-buffer");
  {
{
GtkTextBuffer* SCM_RESULT;
  g_object_ref(Shiki_CURRENT_TEXT_BUFFER);
  SCM_RESULT = Shiki_CURRENT_TEXT_BUFFER;
SCM_RETURN(SHIKI_BUFFER_BOX(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_selected_buffer__NAME, "selected-buffer", 15, 15);
static SCM_DEFINE_SUBR(xyzzylisp_selected_buffer__STUB, 0, 0, SCM_OBJ(&xyzzylisp_selected_buffer__NAME), xyzzylisp_selected_buffer, NULL, NULL);

static ScmObj xyzzylisp_get_next_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_scm;
  ScmObj buffer;
  ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  SCM_ENTER_SUBR("get-next-buffer");
  if (Scm_Length(SCM_OPTARGS) > 1)
    Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
  if (SCM_NULLP(SCM_OPTARGS)) buffer_scm = SCM_UNBOUND;
  else {
    buffer_scm = SCM_CAR(SCM_OPTARGS);
    SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
  }
  buffer = (buffer_scm);
  {
{
GtkTextBuffer* SCM_RESULT;
  if(buffer == SCM_UNBOUND)
    SCM_RESULT = Shiki_get_next_buffer(Shiki_CURRENT_TEXT_BUFFER);
  else if(SHIKI_BUFFER_P(buffer))
    SCM_RESULT = Shiki_get_next_buffer(SHIKI_BUFFER_UNBOX(buffer));
  else
    Scm_Error("buffer required, but got %S", buffer);    
  if(SCM_RESULT)
    g_object_ref(SCM_RESULT);
SCM_RETURN(SHIKI_BUFFER_BOX(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_get_next_buffer__NAME, "get-next-buffer", 15, 15);
static SCM_DEFINE_SUBR(xyzzylisp_get_next_buffer__STUB, 0, 1, SCM_OBJ(&xyzzylisp_get_next_buffer__NAME), xyzzylisp_get_next_buffer, NULL, NULL);

static ScmObj xyzzylisp_buffer_lines(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_scm;
  ScmObj buffer;
  ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  SCM_ENTER_SUBR("buffer-lines");
  if (Scm_Length(SCM_OPTARGS) > 1)
    Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
  if (SCM_NULLP(SCM_OPTARGS)) buffer_scm = SCM_UNBOUND;
  else {
    buffer_scm = SCM_CAR(SCM_OPTARGS);
    SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
  }
  buffer = (buffer_scm);
  {
{
int SCM_RESULT;
  if(buffer == SCM_UNBOUND)
    SCM_RESULT = gtk_text_buffer_get_line_count(Shiki_CURRENT_TEXT_BUFFER);
  else if(SHIKI_BUFFER_P(buffer))
    SCM_RESULT = gtk_text_buffer_get_line_count(SHIKI_BUFFER_UNBOX(buffer));
  else
    Scm_Error("buffer required, but got %S", buffer);
SCM_RETURN(Scm_MakeInteger(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_lines__NAME, "buffer-lines", 12, 12);
static SCM_DEFINE_SUBR(xyzzylisp_buffer_lines__STUB, 0, 1, SCM_OBJ(&xyzzylisp_buffer_lines__NAME), xyzzylisp_buffer_lines, NULL, NULL);

static ScmObj xyzzylisp_buffer_size(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_scm;
  ScmObj buffer;
  ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  SCM_ENTER_SUBR("buffer-size");
  if (Scm_Length(SCM_OPTARGS) > 1)
    Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
  if (SCM_NULLP(SCM_OPTARGS)) buffer_scm = SCM_UNBOUND;
  else {
    buffer_scm = SCM_CAR(SCM_OPTARGS);
    SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
  }
  buffer = (buffer_scm);
  {
{
int SCM_RESULT;
  if(buffer == SCM_UNBOUND)
    SCM_RESULT = gtk_text_buffer_get_char_count(Shiki_CURRENT_TEXT_BUFFER);
  else if(SHIKI_BUFFER_P(buffer))
    SCM_RESULT = gtk_text_buffer_get_char_count(SHIKI_BUFFER_UNBOX(buffer));
  else
    Scm_Error("buffer required, but got %S", buffer);
SCM_RETURN(Scm_MakeInteger(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_size__NAME, "buffer-size", 11, 11);
static SCM_DEFINE_SUBR(xyzzylisp_buffer_size__STUB, 0, 1, SCM_OBJ(&xyzzylisp_buffer_size__NAME), xyzzylisp_buffer_size, NULL, NULL);

static ScmObj xyzzylisp_erase_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_scm;
  ScmObj buffer;
  ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  SCM_ENTER_SUBR("erase-buffer");
  if (Scm_Length(SCM_OPTARGS) > 1)
    Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
  if (SCM_NULLP(SCM_OPTARGS)) buffer_scm = SCM_UNBOUND;
  else {
    buffer_scm = SCM_CAR(SCM_OPTARGS);
    SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
  }
  buffer = (buffer_scm);
  {
  if(buffer == SCM_UNBOUND)
    Shiki_erase_buffer(Shiki_CURRENT_TEXT_BUFFER);
  else if(SHIKI_BUFFER_P(buffer))
    Shiki_erase_buffer(SHIKI_BUFFER_UNBOX(buffer));
  else
    Scm_Error("buffer required, but got %S", buffer);
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_erase_buffer__NAME, "erase-buffer", 12, 12);
static SCM_DEFINE_SUBR(xyzzylisp_erase_buffer__STUB, 0, 1, SCM_OBJ(&xyzzylisp_erase_buffer__NAME), xyzzylisp_erase_buffer, NULL, NULL);

static ScmObj xyzzylisp_delete_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_scm;
  ScmObj buffer;
  ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  SCM_ENTER_SUBR("delete-buffer");
  if (Scm_Length(SCM_OPTARGS) > 1)
    Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
  if (SCM_NULLP(SCM_OPTARGS)) buffer_scm = SCM_UNBOUND;
  else {
    buffer_scm = SCM_CAR(SCM_OPTARGS);
    SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
  }
  buffer = (buffer_scm);
  {
  if(buffer == SCM_UNBOUND)
    Shiki_delete_buffer(Shiki_CURRENT_TEXT_BUFFER);
  else if(SHIKI_BUFFER_P(buffer))
    Shiki_delete_buffer(SHIKI_BUFFER_UNBOX(buffer));
  else
    Scm_Error("buffer required, but got %S", buffer);
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_delete_buffer__NAME, "delete-buffer", 13, 13);
static SCM_DEFINE_SUBR(xyzzylisp_delete_buffer__STUB, 0, 1, SCM_OBJ(&xyzzylisp_delete_buffer__NAME), xyzzylisp_delete_buffer, NULL, NULL);

static ScmObj xyzzylisp_find_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_name_scm;
  const char * buffer_name;
  SCM_ENTER_SUBR("find-buffer");
  buffer_name_scm = SCM_ARGREF(0);
  if (!SCM_STRINGP(buffer_name_scm)) Scm_Error("const C string required, but got %S", buffer_name_scm);
  buffer_name = SCM_STRING_CONST_CSTRING(buffer_name_scm);
  {
{
GtkTextBuffer* SCM_RESULT;
SCM_RESULT = Shiki_find_buffer(buffer_name);
SCM_RETURN(SCM_MAKE_MAYBE(SHIKI_BUFFER_BOX, SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_find_buffer__NAME, "find-buffer", 11, 11);
static SCM_DEFINE_SUBR(xyzzylisp_find_buffer__STUB, 1, 0, SCM_OBJ(&xyzzylisp_find_buffer__NAME), xyzzylisp_find_buffer, NULL, NULL);

static ScmObj xyzzylisp_new_buffer_create(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_name_scm;
  const char * buffer_name;
  SCM_ENTER_SUBR("new-buffer-create");
  buffer_name_scm = SCM_ARGREF(0);
  if (!SCM_STRINGP(buffer_name_scm)) Scm_Error("const C string required, but got %S", buffer_name_scm);
  buffer_name = SCM_STRING_CONST_CSTRING(buffer_name_scm);
  {
{
GtkTextBuffer* SCM_RESULT;
 SCM_RESULT = (Shiki_new_buffer_create(g_strdup(buffer_name)));
SCM_RETURN(SHIKI_BUFFER_BOX(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_new_buffer_create__NAME, "new-buffer-create", 17, 17);
static SCM_DEFINE_SUBR(xyzzylisp_new_buffer_create__STUB, 1, 0, SCM_OBJ(&xyzzylisp_new_buffer_create__NAME), xyzzylisp_new_buffer_create, NULL, NULL);

static ScmObj xyzzylisp_count_buffers(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("count-buffers");
  {
{
int SCM_RESULT;
 SCM_RESULT = (g_list_length(Shiki_EDITOR_BUFFER_LIST));
SCM_RETURN(Scm_MakeInteger(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_count_buffers__NAME, "count-buffers", 13, 13);
static SCM_DEFINE_SUBR(xyzzylisp_count_buffers__STUB, 0, 0, SCM_OBJ(&xyzzylisp_count_buffers__NAME), xyzzylisp_count_buffers, NULL, NULL);

static ScmObj xyzzylisp_get_previous_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_scm;
  ScmObj buffer;
  ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  SCM_ENTER_SUBR("get-previous-buffer");
  if (Scm_Length(SCM_OPTARGS) > 1)
    Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
  if (SCM_NULLP(SCM_OPTARGS)) buffer_scm = SCM_UNBOUND;
  else {
    buffer_scm = SCM_CAR(SCM_OPTARGS);
    SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
  }
  buffer = (buffer_scm);
  {
{
GtkTextBuffer* SCM_RESULT;
  if(buffer == SCM_UNBOUND)
    SCM_RESULT = Shiki_get_previous_buffer(Shiki_CURRENT_TEXT_BUFFER);
  else if(SHIKI_BUFFER_P(buffer))
    SCM_RESULT = Shiki_get_previous_buffer(SHIKI_BUFFER_UNBOX(buffer));
  else
    Scm_Error("buffer required, but got %S", buffer);    
  if(SCM_RESULT)
    g_object_ref(SCM_RESULT);
SCM_RETURN(SHIKI_BUFFER_BOX(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_get_previous_buffer__NAME, "get-previous-buffer", 19, 19);
static SCM_DEFINE_SUBR(xyzzylisp_get_previous_buffer__STUB, 0, 1, SCM_OBJ(&xyzzylisp_get_previous_buffer__NAME), xyzzylisp_get_previous_buffer, NULL, NULL);

static ScmObj xyzzylisp_buffer_list(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("buffer-list");
  {
{
ScmObj SCM_RESULT;
SCM_RESULT = Shiki_buffer_list();
SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_list__NAME, "buffer-list", 11, 11);
static SCM_DEFINE_SUBR(xyzzylisp_buffer_list__STUB, 0, 0, SCM_OBJ(&xyzzylisp_buffer_list__NAME), xyzzylisp_buffer_list, NULL, NULL);

static ScmObj xyzzylisp_next_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("next-buffer");
  {
gtk_notebook_next_page(Shiki_EDITOR_NOTEBOOK);
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_next_buffer__NAME, "next-buffer", 11, 11);
static SCM_DEFINE_SUBR(xyzzylisp_next_buffer__STUB, 0, 0, SCM_OBJ(&xyzzylisp_next_buffer__NAME), xyzzylisp_next_buffer, NULL, NULL);

static ScmObj xyzzylisp_previous_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("previous-buffer");
  {
gtk_notebook_prev_page(Shiki_EDITOR_NOTEBOOK);
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_previous_buffer__NAME, "previous-buffer", 15, 15);
static SCM_DEFINE_SUBR(xyzzylisp_previous_buffer__STUB, 0, 0, SCM_OBJ(&xyzzylisp_previous_buffer__NAME), xyzzylisp_previous_buffer, NULL, NULL);

static ScmObj xyzzylisp_buffer_name(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_scm;
  GtkTextBuffer* buffer;
  SCM_ENTER_SUBR("buffer-name");
  buffer_scm = SCM_ARGREF(0);
  if (!SHIKI_BUFFER_P(buffer_scm)) Scm_Error("buffer required, but got %S", buffer_scm);
  buffer = SHIKI_BUFFER_UNBOX(buffer_scm);
  {
{
const char * SCM_RESULT;
 SCM_RESULT = (Shiki_buffer_name(buffer));
SCM_RETURN(SCM_MAKE_MAYBE(SCM_MAKE_STR_COPYING, SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_name__NAME, "buffer-name", 11, 11);
static SCM_DEFINE_SUBR(xyzzylisp_buffer_name__STUB, 1, 0, SCM_OBJ(&xyzzylisp_buffer_name__NAME), xyzzylisp_buffer_name, NULL, NULL);

static ScmObj xyzzylisp_deleted_buffer_p(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_scm;
  GtkTextBuffer* buffer;
  SCM_ENTER_SUBR("deleted-buffer-p");
  buffer_scm = SCM_ARGREF(0);
  if (!SHIKI_BUFFER_P(buffer_scm)) Scm_Error("buffer required, but got %S", buffer_scm);
  buffer = SHIKI_BUFFER_UNBOX(buffer_scm);
  {
{
int SCM_RESULT;
 SCM_RESULT = (Shiki_deleted_buffer_p(buffer));
SCM_RETURN(SCM_MAKE_MAYBE(SCM_MAKE_BOOL, SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_deleted_buffer_p__NAME, "deleted-buffer-p", 16, 16);
static SCM_DEFINE_SUBR(xyzzylisp_deleted_buffer_p__STUB, 1, 0, SCM_OBJ(&xyzzylisp_deleted_buffer_p__NAME), xyzzylisp_deleted_buffer_p, NULL, NULL);

static ScmObj xyzzylisp_buffer_modified_p(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj buffer_scm;
  ScmObj buffer;
  ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  SCM_ENTER_SUBR("buffer-modified-p");
  if (Scm_Length(SCM_OPTARGS) > 1)
    Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
  if (SCM_NULLP(SCM_OPTARGS)) buffer_scm = SCM_UNBOUND;
  else {
    buffer_scm = SCM_CAR(SCM_OPTARGS);
    SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
  }
  buffer = (buffer_scm);
  {
{
int SCM_RESULT;
  if(buffer == SCM_UNBOUND)
    SCM_RESULT = gtk_text_buffer_get_modified(Shiki_CURRENT_TEXT_BUFFER);
  else if(SHIKI_BUFFER_P(buffer))
    SCM_RESULT = gtk_text_buffer_get_modified(SHIKI_BUFFER_UNBOX(buffer));
  else
    Scm_Error("buffer required, but got %S", buffer);
SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_modified_p__NAME, "buffer-modified-p", 17, 17);
static SCM_DEFINE_SUBR(xyzzylisp_buffer_modified_p__STUB, 0, 1, SCM_OBJ(&xyzzylisp_buffer_modified_p__NAME), xyzzylisp_buffer_modified_p, NULL, NULL);

static ScmObj xyzzylisp_buffer_substring(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj start_scm;
  int start;
  ScmObj end_scm;
  int end;
  SCM_ENTER_SUBR("buffer-substring");
  start_scm = SCM_ARGREF(0);
  if (!SCM_EXACTP(start_scm)) Scm_Error("C integer required, but got %S", start_scm);
  start = Scm_GetInteger(start_scm);
  end_scm = SCM_ARGREF(1);
  if (!SCM_EXACTP(end_scm)) Scm_Error("C integer required, but got %S", end_scm);
  end = Scm_GetInteger(end_scm);
  {
{
ScmString* SCM_RESULT;
  gchar *substr = Shiki_buffer_substring(start, end);
  if(substr)
    SCM_RESULT = SCM_STRING(SCM_MAKE_STR_COPYING(substr));
  else
    SCM_RESULT = SCM_STRING(SCM_FALSE);
  g_free(substr);
SCM_RETURN(SCM_MAKE_MAYBE(SCM_OBJ_SAFE, SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_substring__NAME, "buffer-substring", 16, 16);
static SCM_DEFINE_SUBR(xyzzylisp_buffer_substring__STUB, 2, 0, SCM_OBJ(&xyzzylisp_buffer_substring__NAME), xyzzylisp_buffer_substring, NULL, NULL);

static ScmObj xyzzylisp_delete_region(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj start_scm;
  int start;
  ScmObj end_scm;
  int end;
  SCM_ENTER_SUBR("delete-region");
  start_scm = SCM_ARGREF(0);
  if (!SCM_EXACTP(start_scm)) Scm_Error("C integer required, but got %S", start_scm);
  start = Scm_GetInteger(start_scm);
  end_scm = SCM_ARGREF(1);
  if (!SCM_EXACTP(end_scm)) Scm_Error("C integer required, but got %S", end_scm);
  end = Scm_GetInteger(end_scm);
  {
Shiki_delete_region(start, end);
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_delete_region__NAME, "delete-region", 13, 13);
static SCM_DEFINE_SUBR(xyzzylisp_delete_region__STUB, 2, 0, SCM_OBJ(&xyzzylisp_delete_region__NAME), xyzzylisp_delete_region, NULL, NULL);

static ScmObj xyzzylisp_insert(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj char_or_string_scm;
  ScmObj char_or_string;
  SCM_ENTER_SUBR("insert");
  char_or_string_scm = SCM_ARGREF(0);
  char_or_string = (char_or_string_scm);
  {
if(SCM_CHARP(char_or_string)) {
    gunichar u = SCM_CHAR_VALUE(char_or_string);
    gchar *str  = g_ucs4_to_utf8(&u, 1, NULL, NULL, NULL);
    gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, str, -1);
    g_free(str);
  } else if(SCM_STRINGP(char_or_string))
    gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, SCM_STRING_CONST_CSTRING(char_or_string), -1);
    else
    Scm_Error("character or string required, but got %S", char_or_string);
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_insert__NAME, "insert", 6, 6);
static SCM_DEFINE_SUBR(xyzzylisp_insert__STUB, 1, 0, SCM_OBJ(&xyzzylisp_insert__NAME), xyzzylisp_insert, NULL, NULL);

static ScmObj xyzzylisp_point(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("point");
  {
{
int SCM_RESULT;
SCM_RESULT = Shiki_point();
SCM_RETURN(Scm_MakeInteger(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_point__NAME, "point", 5, 5);
static SCM_DEFINE_SUBR(xyzzylisp_point__STUB, 0, 0, SCM_OBJ(&xyzzylisp_point__NAME), xyzzylisp_point, NULL, NULL);

static ScmObj xyzzylisp_point_max(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("point-max");
  {
{
int SCM_RESULT;
SCM_RESULT = Shiki_point_max();
SCM_RETURN(Scm_MakeInteger(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_point_max__NAME, "point-max", 9, 9);
static SCM_DEFINE_SUBR(xyzzylisp_point_max__STUB, 0, 0, SCM_OBJ(&xyzzylisp_point_max__NAME), xyzzylisp_point_max, NULL, NULL);

static ScmObj xyzzylisp_point_min(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("point-min");
  {
{
int SCM_RESULT;
SCM_RESULT = Shiki_point_min();
SCM_RETURN(Scm_MakeInteger(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_point_min__NAME, "point-min", 9, 9);
static SCM_DEFINE_SUBR(xyzzylisp_point_min__STUB, 0, 0, SCM_OBJ(&xyzzylisp_point_min__NAME), xyzzylisp_point_min, NULL, NULL);

static ScmObj xyzzylisp_goto_char(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj offset_scm;
  int offset;
  SCM_ENTER_SUBR("goto-char");
  offset_scm = SCM_ARGREF(0);
  if (!SCM_EXACTP(offset_scm)) Scm_Error("C integer required, but got %S", offset_scm);
  offset = Scm_GetInteger(offset_scm);
  {
Shiki_goto_char(offset);
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_goto_char__NAME, "goto-char", 9, 9);
static SCM_DEFINE_SUBR(xyzzylisp_goto_char__STUB, 1, 0, SCM_OBJ(&xyzzylisp_goto_char__NAME), xyzzylisp_goto_char, NULL, NULL);

static ScmObj xyzzylisp_forward_char(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("forward-char");
  {
Shiki_forward_char();
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_forward_char__NAME, "forward-char", 12, 12);
static SCM_DEFINE_SUBR(xyzzylisp_forward_char__STUB, 0, 0, SCM_OBJ(&xyzzylisp_forward_char__NAME), xyzzylisp_forward_char, NULL, NULL);

static ScmObj xyzzylisp_backward_char(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("backward-char");
  {
Shiki_backward_char();
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_backward_char__NAME, "backward-char", 13, 13);
static SCM_DEFINE_SUBR(xyzzylisp_backward_char__STUB, 0, 0, SCM_OBJ(&xyzzylisp_backward_char__NAME), xyzzylisp_backward_char, NULL, NULL);

static ScmObj xyzzylisp_goto_line(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj line_scm;
  int line;
  SCM_ENTER_SUBR("goto-line");
  line_scm = SCM_ARGREF(0);
  if (!SCM_EXACTP(line_scm)) Scm_Error("C integer required, but got %S", line_scm);
  line = Scm_GetInteger(line_scm);
  {
Shiki_goto_line(line);
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_goto_line__NAME, "goto-line", 9, 9);
static SCM_DEFINE_SUBR(xyzzylisp_goto_line__STUB, 1, 0, SCM_OBJ(&xyzzylisp_goto_line__NAME), xyzzylisp_goto_line, NULL, NULL);

static ScmObj xyzzylisp_goto_bol(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("goto-bol");
  {
Shiki_goto_bol();
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_goto_bol__NAME, "goto-bol", 8, 8);
static SCM_DEFINE_SUBR(xyzzylisp_goto_bol__STUB, 0, 0, SCM_OBJ(&xyzzylisp_goto_bol__NAME), xyzzylisp_goto_bol, NULL, NULL);

static ScmObj xyzzylisp_goto_eol(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  SCM_ENTER_SUBR("goto-eol");
  {
Shiki_goto_eol();
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_goto_eol__NAME, "goto-eol", 8, 8);
static SCM_DEFINE_SUBR(xyzzylisp_goto_eol__STUB, 0, 0, SCM_OBJ(&xyzzylisp_goto_eol__NAME), xyzzylisp_goto_eol, NULL, NULL);

static ScmObj xyzzylisp_forward_line(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj count_scm;
  int count;
  ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  SCM_ENTER_SUBR("forward-line");
  if (Scm_Length(SCM_OPTARGS) > 1)
    Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
  if (SCM_NULLP(SCM_OPTARGS)) count_scm = Scm_MakeInteger(1);
  else {
    count_scm = SCM_CAR(SCM_OPTARGS);
    SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
  }
  if (!SCM_EXACTP(count_scm)) Scm_Error("C integer required, but got %S", count_scm);
  count = Scm_GetInteger(count_scm);
  {
Shiki_forward_line(count);
SCM_RETURN(SCM_UNDEFINED);
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_forward_line__NAME, "forward-line", 12, 12);
static SCM_DEFINE_SUBR(xyzzylisp_forward_line__STUB, 0, 1, SCM_OBJ(&xyzzylisp_forward_line__NAME), xyzzylisp_forward_line, NULL, NULL);

static SCM_DEFINE_STRING_CONST(KEYARG_title__NAME, "title", 5, 5);
static ScmObj KEYARG_title = SCM_UNBOUND;
static ScmObj xyzzylisp_file_name_dialog(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj title_scm;
  const char * title;
  ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  SCM_ENTER_SUBR("file-name-dialog");
  title_scm = Scm_GetKeyword(SCM_OBJ(KEYARG_title), SCM_OPTARGS, SCM_MAKE_STR("ファイルを開く"));
  if (!SCM_STRINGP(title_scm)) Scm_Error("const C string required, but got %S", title_scm);
  title = SCM_STRING_CONST_CSTRING(title_scm);
  {
{
const char * SCM_RESULT;
SCM_RESULT = Shiki_file_name_dialog(title);
SCM_RETURN(SCM_MAKE_MAYBE(SCM_MAKE_STR_COPYING, SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_file_name_dialog__NAME, "file-name-dialog", 16, 16);
static SCM_DEFINE_SUBR(xyzzylisp_file_name_dialog__STUB, 0, 1, SCM_OBJ(&xyzzylisp_file_name_dialog__NAME), xyzzylisp_file_name_dialog, NULL, NULL);

static ScmObj xyzzylisp_yes_or_no_p(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
{
  ScmObj msg_scm;
  const char * msg;
  SCM_ENTER_SUBR("yes-or-no-p");
  msg_scm = SCM_ARGREF(0);
  if (!SCM_STRINGP(msg_scm)) Scm_Error("const C string required, but got %S", msg_scm);
  msg = SCM_STRING_CONST_CSTRING(msg_scm);
  {
{
int SCM_RESULT;
SCM_RESULT = Shiki_yes_or_no_p(msg);
SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
}
  }
}

static SCM_DEFINE_STRING_CONST(xyzzylisp_yes_or_no_p__NAME, "yes-or-no-p", 11, 11);
static SCM_DEFINE_SUBR(xyzzylisp_yes_or_no_p__STUB, 1, 0, SCM_OBJ(&xyzzylisp_yes_or_no_p__NAME), xyzzylisp_yes_or_no_p, NULL, NULL);

void Scm_Init_xyzzylisp(ScmModule *module)
{

  SCM_DEFINE(module, "bufferp", SCM_OBJ(&xyzzylisp_bufferp__STUB));
  SCM_DEFINE(module, "selected-buffer", SCM_OBJ(&xyzzylisp_selected_buffer__STUB));
  SCM_DEFINE(module, "get-next-buffer", SCM_OBJ(&xyzzylisp_get_next_buffer__STUB));
  SCM_DEFINE(module, "buffer-lines", SCM_OBJ(&xyzzylisp_buffer_lines__STUB));
  SCM_DEFINE(module, "buffer-size", SCM_OBJ(&xyzzylisp_buffer_size__STUB));
  SCM_DEFINE(module, "erase-buffer", SCM_OBJ(&xyzzylisp_erase_buffer__STUB));
  SCM_DEFINE(module, "delete-buffer", SCM_OBJ(&xyzzylisp_delete_buffer__STUB));
  SCM_DEFINE(module, "find-buffer", SCM_OBJ(&xyzzylisp_find_buffer__STUB));
  SCM_DEFINE(module, "new-buffer-create", SCM_OBJ(&xyzzylisp_new_buffer_create__STUB));
  SCM_DEFINE(module, "count-buffers", SCM_OBJ(&xyzzylisp_count_buffers__STUB));
  SCM_DEFINE(module, "get-previous-buffer", SCM_OBJ(&xyzzylisp_get_previous_buffer__STUB));
  SCM_DEFINE(module, "buffer-list", SCM_OBJ(&xyzzylisp_buffer_list__STUB));
  SCM_DEFINE(module, "next-buffer", SCM_OBJ(&xyzzylisp_next_buffer__STUB));
  SCM_DEFINE(module, "previous-buffer", SCM_OBJ(&xyzzylisp_previous_buffer__STUB));
  SCM_DEFINE(module, "buffer-name", SCM_OBJ(&xyzzylisp_buffer_name__STUB));
  SCM_DEFINE(module, "deleted-buffer-p", SCM_OBJ(&xyzzylisp_deleted_buffer_p__STUB));
  SCM_DEFINE(module, "buffer-modified-p", SCM_OBJ(&xyzzylisp_buffer_modified_p__STUB));
  SCM_DEFINE(module, "buffer-substring", SCM_OBJ(&xyzzylisp_buffer_substring__STUB));
  SCM_DEFINE(module, "delete-region", SCM_OBJ(&xyzzylisp_delete_region__STUB));
  SCM_DEFINE(module, "insert", SCM_OBJ(&xyzzylisp_insert__STUB));
  SCM_DEFINE(module, "point", SCM_OBJ(&xyzzylisp_point__STUB));
  SCM_DEFINE(module, "point-max", SCM_OBJ(&xyzzylisp_point_max__STUB));
  SCM_DEFINE(module, "point-min", SCM_OBJ(&xyzzylisp_point_min__STUB));
  SCM_DEFINE(module, "goto-char", SCM_OBJ(&xyzzylisp_goto_char__STUB));
  SCM_DEFINE(module, "forward-char", SCM_OBJ(&xyzzylisp_forward_char__STUB));
  SCM_DEFINE(module, "backward-char", SCM_OBJ(&xyzzylisp_backward_char__STUB));
  SCM_DEFINE(module, "goto-line", SCM_OBJ(&xyzzylisp_goto_line__STUB));
  SCM_DEFINE(module, "goto-bol", SCM_OBJ(&xyzzylisp_goto_bol__STUB));
  SCM_DEFINE(module, "goto-eol", SCM_OBJ(&xyzzylisp_goto_eol__STUB));
  SCM_DEFINE(module, "forward-line", SCM_OBJ(&xyzzylisp_forward_line__STUB));
  SCM_DEFINE(module, "file-name-dialog", SCM_OBJ(&xyzzylisp_file_name_dialog__STUB));
  KEYARG_title = Scm_MakeKeyword(&KEYARG_title__NAME);
  SCM_DEFINE(module, "yes-or-no-p", SCM_OBJ(&xyzzylisp_yes_or_no_p__STUB));
}
