Develop and Download Open Source Software

Browse CVS Repository

Annotation of /shiki/shiki/xyzzylisp.stub

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.10 - (hide annotations) (download)
Wed Nov 29 04:37:23 2006 UTC (17 years, 4 months ago) by aloha
Branch: MAIN
Changes since 1.9: +3 -0 lines
bug fix (C-x C-s) and add no-or-yes-p API

1 aloha 1.2 "#include \"shiki.h\""
2    
3 aloha 1.5 (define-type <buffer> "GtkTextBuffer*" "buffer"
4     "SHIKI_BUFFER_P" "SHIKI_BUFFER_UNBOX" "SHIKI_BUFFER_BOX")
5    
6 aloha 1.6 (define-cproc bufferp (buffer)
7     (call <boolean> "SHIKI_BUFFER_P"))
8    
9 aloha 1.5 (define-cproc selected-buffer ()
10     (body <buffer>
11     " g_object_ref(Shiki_CURRENT_TEXT_BUFFER);
12     SCM_RESULT = Shiki_CURRENT_TEXT_BUFFER;"))
13    
14 aloha 1.6 (define-cproc get-next-buffer (&optional buffer)
15     (body <buffer>
16 aloha 1.9 " SCM_RESULT = NULL;
17     if(buffer == SCM_UNBOUND)
18 aloha 1.6 SCM_RESULT = Shiki_get_next_buffer(Shiki_CURRENT_TEXT_BUFFER);
19     else if(SHIKI_BUFFER_P(buffer))
20     SCM_RESULT = Shiki_get_next_buffer(SHIKI_BUFFER_UNBOX(buffer));
21     else
22     Scm_Error(\"buffer required, but got %S\", buffer);
23     if(SCM_RESULT)
24     g_object_ref(SCM_RESULT);"))
25    
26 aloha 1.7 (define-cproc buffer-lines (&optional buffer)
27     (body <int>
28 aloha 1.9 " SCM_RESULT = -1;
29     if(buffer == SCM_UNBOUND)
30 aloha 1.7 SCM_RESULT = gtk_text_buffer_get_line_count(Shiki_CURRENT_TEXT_BUFFER);
31     else if(SHIKI_BUFFER_P(buffer))
32     SCM_RESULT = gtk_text_buffer_get_line_count(SHIKI_BUFFER_UNBOX(buffer));
33     else
34     Scm_Error(\"buffer required, but got %S\", buffer);"))
35    
36     (define-cproc buffer-size (&optional buffer)
37     (body <int>
38 aloha 1.9 " SCM_RESULT = -1;
39     if(buffer == SCM_UNBOUND)
40 aloha 1.7 SCM_RESULT = gtk_text_buffer_get_char_count(Shiki_CURRENT_TEXT_BUFFER);
41     else if(SHIKI_BUFFER_P(buffer))
42     SCM_RESULT = gtk_text_buffer_get_char_count(SHIKI_BUFFER_UNBOX(buffer));
43     else
44     Scm_Error(\"buffer required, but got %S\", buffer);"))
45    
46 aloha 1.8 (define-cproc erase-buffer (&optional buffer)
47     (body <void>
48     " if(buffer == SCM_UNBOUND)
49     Shiki_erase_buffer(Shiki_CURRENT_TEXT_BUFFER);
50     else if(SHIKI_BUFFER_P(buffer))
51     Shiki_erase_buffer(SHIKI_BUFFER_UNBOX(buffer));
52     else
53     Scm_Error(\"buffer required, but got %S\", buffer);"))
54    
55     (define-cproc delete-buffer (&optional buffer)
56     (body <void>
57     " if(buffer == SCM_UNBOUND)
58     Shiki_delete_buffer(Shiki_CURRENT_TEXT_BUFFER);
59     else if(SHIKI_BUFFER_P(buffer))
60     Shiki_delete_buffer(SHIKI_BUFFER_UNBOX(buffer));
61     else
62     Scm_Error(\"buffer required, but got %S\", buffer);"))
63    
64     (define-cproc find-buffer (buffer_name::<const-cstring>)
65     (call <buffer>? "Shiki_find_buffer"))
66    
67     (define-cproc new-buffer-create (buffer_name::<const-cstring>)
68     (expr <buffer> "Shiki_new_buffer_create(g_strdup(buffer_name))"))
69    
70     (define-cproc count-buffers ()
71     (expr <int> "g_list_length(Shiki_EDITOR_BUFFER_LIST)"))
72    
73 aloha 1.6 (define-cproc get-previous-buffer (&optional buffer)
74     (body <buffer>
75 aloha 1.9 " SCM_RESULT = NULL;
76     if(buffer == SCM_UNBOUND)
77 aloha 1.6 SCM_RESULT = Shiki_get_previous_buffer(Shiki_CURRENT_TEXT_BUFFER);
78     else if(SHIKI_BUFFER_P(buffer))
79     SCM_RESULT = Shiki_get_previous_buffer(SHIKI_BUFFER_UNBOX(buffer));
80     else
81     Scm_Error(\"buffer required, but got %S\", buffer);
82     if(SCM_RESULT)
83     g_object_ref(SCM_RESULT);")
84     )
85    
86     (define-cproc buffer-list ()
87     (call "Shiki_buffer_list"))
88    
89     (define-cproc next-buffer ()
90     (body <void> "gtk_notebook_next_page(Shiki_EDITOR_NOTEBOOK);"))
91 aloha 1.7
92 aloha 1.6 (define-cproc previous-buffer ()
93     (body <void> "gtk_notebook_prev_page(Shiki_EDITOR_NOTEBOOK);"))
94    
95     (define-cproc buffer-name (buffer::<buffer>)
96     (expr <const-cstring>? "Shiki_buffer_name(buffer)"))
97    
98 aloha 1.7 (define-cproc deleted-buffer-p (buffer::<buffer>)
99     (expr <boolean>? "Shiki_deleted_buffer_p(buffer)"))
100    
101 aloha 1.6 (define-cproc buffer-modified-p (&optional buffer)
102     (body <boolean>
103 aloha 1.9 " SCM_RESULT = FALSE;
104     if(buffer == SCM_UNBOUND)
105 aloha 1.6 SCM_RESULT = gtk_text_buffer_get_modified(Shiki_CURRENT_TEXT_BUFFER);
106     else if(SHIKI_BUFFER_P(buffer))
107     SCM_RESULT = gtk_text_buffer_get_modified(SHIKI_BUFFER_UNBOX(buffer));
108     else
109     Scm_Error(\"buffer required, but got %S\", buffer);"))
110    
111 aloha 1.1 (define-cproc buffer-substring (start::<int> end::<int>)
112 aloha 1.3 (body <string>?
113     " gchar *substr = Shiki_buffer_substring(start, end);
114     if(substr)
115     SCM_RESULT = SCM_STRING(SCM_MAKE_STR_COPYING(substr));
116     else
117     SCM_RESULT = SCM_STRING(SCM_FALSE);
118     g_free(substr);"))
119 aloha 1.5
120 aloha 1.4 (define-cproc delete-region (start::<int> end::<int>)(call <void> "Shiki_delete_region"))
121    
122 aloha 1.6 (define-cproc insert (char_or_string)
123 aloha 1.4 (body <void>
124     "if(SCM_CHARP(char_or_string)) {
125     gunichar u = SCM_CHAR_VALUE(char_or_string);
126     gchar *str = g_ucs4_to_utf8(&u, 1, NULL, NULL, NULL);
127     gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, str, -1);
128     g_free(str);
129     } else if(SCM_STRINGP(char_or_string))
130 aloha 1.6 gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, SCM_STRING_CONST_CSTRING(char_or_string), -1);
131     else
132     Scm_Error(\"character or string required, but got %S\", char_or_string);"))
133 aloha 1.4
134     (define-cproc point () (call <int> "Shiki_point"))
135     (define-cproc point-max () (call <int> "Shiki_point_max"))
136     (define-cproc point-min () (call <int> "Shiki_point_min"))
137     (define-cproc goto-char (offset::<int>) (call <void> "Shiki_goto_char"))
138     (define-cproc forward-char () (call <void> "Shiki_forward_char"))
139     (define-cproc backward-char () (call <void> "Shiki_backward_char"))
140     (define-cproc goto-line (line::<int>) (call <void> "Shiki_goto_line"))
141     (define-cproc goto-bol () (call <void> "Shiki_goto_bol"))
142     (define-cproc goto-eol () (call <void> "Shiki_goto_eol"))
143 aloha 1.8 (define-cproc forward-line (&optional (count::<int> 1))
144     (call <void> "Shiki_forward_line"))
145    
146    
147     (define-cproc file-name-dialog (&keyword (title::<const-cstring> "���������������������"))
148     (call <const-cstring>? "Shiki_file_name_dialog"))
149    
150     (define-cproc yes-or-no-p (msg::<const-cstring>)
151     (call <boolean> "Shiki_yes_or_no_p"))
152 aloha 1.9
153 aloha 1.10 (define-cproc no-or-yes-p (msg::<const-cstring>)
154     (call <boolean> "Shiki_no_or_yes_p"))
155    
156 aloha 1.9 (define-cproc need-buffer-save-p (buffer::<buffer>)
157     (call <boolean> "Shiki_need_buffer_save_p"))
158    
159     (define-cproc msgbox (format::<string> &rest args)
160     (body <symbol>
161     " ScmObj os = Scm_MakeOutputStringPort(TRUE);
162     GtkWidget *dialog;
163     Scm_Format(SCM_PORT(os), format, args, FALSE);
164     dialog = gtk_message_dialog_new(GTK_WINDOW(Shiki_EDITOR_WINDOW),
165     GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
166     Scm_GetString(SCM_STRING(Scm_GetOutputString(SCM_PORT(os)))));
167     gtk_dialog_run(GTK_DIALOG(dialog));
168     gtk_widget_destroy(dialog);
169     SCM_RESULT = SCM_SYMBOL(SCM_INTERN(\":ok\"));"))

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26