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.6 - (hide annotations) (download)
Sun Nov 26 15:34:16 2006 UTC (17 years, 4 months ago) by aloha
Branch: MAIN
Changes since 1.5: +50 -2 lines
add 8 xyzzy lisp 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     " if(buffer == SCM_UNBOUND)
17     SCM_RESULT = Shiki_get_next_buffer(Shiki_CURRENT_TEXT_BUFFER);
18     else if(SHIKI_BUFFER_P(buffer))
19     SCM_RESULT = Shiki_get_next_buffer(SHIKI_BUFFER_UNBOX(buffer));
20     else
21     Scm_Error(\"buffer required, but got %S\", buffer);
22     if(SCM_RESULT)
23     g_object_ref(SCM_RESULT);"))
24    
25     (define-cproc get-previous-buffer (&optional buffer)
26     (body <buffer>
27     " if(buffer == SCM_UNBOUND)
28     SCM_RESULT = Shiki_get_previous_buffer(Shiki_CURRENT_TEXT_BUFFER);
29     else if(SHIKI_BUFFER_P(buffer))
30     SCM_RESULT = Shiki_get_previous_buffer(SHIKI_BUFFER_UNBOX(buffer));
31     else
32     Scm_Error(\"buffer required, but got %S\", buffer);
33     if(SCM_RESULT)
34     g_object_ref(SCM_RESULT);")
35     )
36    
37     (define-cproc buffer-list ()
38     (call "Shiki_buffer_list"))
39    
40     (define-cproc next-buffer ()
41     (body <void> "gtk_notebook_next_page(Shiki_EDITOR_NOTEBOOK);"))
42     (define-cproc previous-buffer ()
43     (body <void> "gtk_notebook_prev_page(Shiki_EDITOR_NOTEBOOK);"))
44    
45     (define-cproc buffer-name (buffer::<buffer>)
46     (expr <const-cstring>? "Shiki_buffer_name(buffer)"))
47    
48     (define-cproc buffer-modified-p (&optional buffer)
49     (body <boolean>
50     " if(buffer == SCM_UNBOUND)
51     SCM_RESULT = gtk_text_buffer_get_modified(Shiki_CURRENT_TEXT_BUFFER);
52     else if(SHIKI_BUFFER_P(buffer))
53     SCM_RESULT = gtk_text_buffer_get_modified(SHIKI_BUFFER_UNBOX(buffer));
54     else
55     Scm_Error(\"buffer required, but got %S\", buffer);"))
56    
57 aloha 1.1 (define-cproc buffer-substring (start::<int> end::<int>)
58 aloha 1.3 (body <string>?
59     " gchar *substr = Shiki_buffer_substring(start, end);
60     if(substr)
61     SCM_RESULT = SCM_STRING(SCM_MAKE_STR_COPYING(substr));
62     else
63     SCM_RESULT = SCM_STRING(SCM_FALSE);
64     g_free(substr);"))
65 aloha 1.5
66 aloha 1.4 (define-cproc delete-region (start::<int> end::<int>)(call <void> "Shiki_delete_region"))
67    
68 aloha 1.6 (define-cproc insert (char_or_string)
69 aloha 1.4 (body <void>
70     "if(SCM_CHARP(char_or_string)) {
71     gunichar u = SCM_CHAR_VALUE(char_or_string);
72     gchar *str = g_ucs4_to_utf8(&u, 1, NULL, NULL, NULL);
73     gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, str, -1);
74     g_free(str);
75     } else if(SCM_STRINGP(char_or_string))
76 aloha 1.6 gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, SCM_STRING_CONST_CSTRING(char_or_string), -1);
77     else
78     Scm_Error(\"character or string required, but got %S\", char_or_string);"))
79 aloha 1.4
80     (define-cproc point () (call <int> "Shiki_point"))
81     (define-cproc point-max () (call <int> "Shiki_point_max"))
82     (define-cproc point-min () (call <int> "Shiki_point_min"))
83     (define-cproc goto-char (offset::<int>) (call <void> "Shiki_goto_char"))
84     (define-cproc forward-char () (call <void> "Shiki_forward_char"))
85     (define-cproc backward-char () (call <void> "Shiki_backward_char"))
86     (define-cproc goto-line (line::<int>) (call <void> "Shiki_goto_line"))
87     (define-cproc goto-bol () (call <void> "Shiki_goto_bol"))
88     (define-cproc goto-eol () (call <void> "Shiki_goto_eol"))

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