| 183 |
/* エディタの初期化 */ |
/* エディタの初期化 */ |
| 184 |
static void shiki_editor_window_init(int argc, char **argv); |
static void shiki_editor_window_init(int argc, char **argv); |
| 185 |
|
|
| 186 |
|
/* xyzzy lisp buffer/builtin 互換関数 */ |
| 187 |
static ScmObj Shiki_buffer_substring(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_) |
#include "xyzzylisp.c" |
|
{ |
|
|
ScmObj start, end, result; |
|
|
GtkTextIter s, e; |
|
|
gchar *substring; |
|
|
SCM_ENTER_SUBR("buffer-substring"); |
|
|
start = SCM_ARGREF(0); |
|
|
end = SCM_ARGREF(1); |
|
|
if(Scm_NumCmp(start, end) >= 0) |
|
|
return SCM_FALSE; |
|
|
gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &s, SCM_INT_VALUE(start)); |
|
|
gtk_text_buffer_get_iter_at_offset(Shiki_CURRENT_TEXT_BUFFER, &e, SCM_INT_VALUE(end)); |
|
|
|
|
|
substring = gtk_text_buffer_get_text(Shiki_CURRENT_TEXT_BUFFER, &s, &e, FALSE); |
|
|
result = SCM_MAKE_STR_COPYING(substring); |
|
|
g_free(substring); |
|
|
SCM_RETURN(result); |
|
|
} |
|
|
|
|
|
static SCM_DEFINE_STRING_CONST(buffer_substring__NAME, "buffer-substring", 16, 16); |
|
|
static SCM_DEFINE_SUBR(buffer_substring__STUB, 2, 0, SCM_OBJ(&buffer_substring__NAME), Shiki_buffer_substring, NULL, NULL); |
|
| 188 |
|
|
| 189 |
/* バッファの内容を消去 */ |
/* バッファの内容を消去 */ |
| 190 |
static void clear_current_buffer() { |
static void clear_current_buffer() { |
| 194 |
gtk_text_buffer_delete(Shiki_CURRENT_TEXT_BUFFER, &start, &end); |
gtk_text_buffer_delete(Shiki_CURRENT_TEXT_BUFFER, &start, &end); |
| 195 |
} |
} |
| 196 |
|
|
|
static ScmObj Shiki_clear_current_buffer() |
|
|
{ |
|
|
clear_current_buffer(); |
|
|
return SCM_NIL; |
|
|
} |
|
|
|
|
|
static SCM_DEFINE_STRING_CONST(clear_current_buffer__NAME, "clear-current-buffer", 20, 20); |
|
|
static SCM_DEFINE_SUBR(clear_current_buffer__STUB, 0, 0, SCM_OBJ(&clear_current_buffer__NAME), Shiki_clear_current_buffer, NULL, NULL); |
|
|
|
|
| 197 |
static void destroy_handler(GtkWidget *button, GtkWidget *widget) {gtk_widget_destroy(widget);} |
static void destroy_handler(GtkWidget *button, GtkWidget *widget) {gtk_widget_destroy(widget);} |
| 198 |
|
|
| 199 |
static void toggled_handler(GtkToggleButton *togglebutton, gboolean *flag) { |
static void toggled_handler(GtkToggleButton *togglebutton, gboolean *flag) { |
| 554 |
tabinfo->tabpage_label = g_strndup(tabinfo->basename, 7); |
tabinfo->tabpage_label = g_strndup(tabinfo->basename, 7); |
| 555 |
tabinfo->env = Scm_MakeModule(NULL, FALSE); |
tabinfo->env = Scm_MakeModule(NULL, FALSE); |
| 556 |
|
|
| 557 |
SCM_DEFINE(tabinfo->env, "clear-current-buffer", SCM_OBJ(&clear_current_buffer__STUB)); |
/* xyzzy lisp 関数を登録 */ |
| 558 |
SCM_DEFINE(tabinfo->env, "buffer-substring", SCM_OBJ(&buffer_substring__STUB)); |
Scm_Init_xyzzylisp(SCM_MODULE(tabinfo->env)); |
| 559 |
|
|
| 560 |
g_return_if_fail(tabinfo->env != SCM_FALSE); |
g_return_if_fail(tabinfo->env != SCM_FALSE); |
| 561 |
|
|