Develop and Download Open Source Software

Browse CVS Repository

Diff of /shiki/shiki/xyzzylisp.c

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

revision 1.5 by aloha, Sun Nov 26 00:41:57 2006 UTC revision 1.6 by aloha, Sun Nov 26 15:34:16 2006 UTC
# Line 6  Line 6 
6  #define SCM_CGEN_CONST const  #define SCM_CGEN_CONST const
7  #endif  #endif
8  #include "shiki.h"  #include "shiki.h"
9    static ScmObj xyzzylisp_bufferp(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
10    {
11      ScmObj buffer_scm;
12      ScmObj buffer;
13      SCM_ENTER_SUBR("bufferp");
14      buffer_scm = SCM_ARGREF(0);
15      buffer = (buffer_scm);
16      {
17    {
18    int SCM_RESULT;
19    SCM_RESULT = SHIKI_BUFFER_P(buffer);
20    SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
21    }
22      }
23    }
24    
25    static SCM_DEFINE_STRING_CONST(xyzzylisp_bufferp__NAME, "bufferp", 7, 7);
26    static SCM_DEFINE_SUBR(xyzzylisp_bufferp__STUB, 1, 0, SCM_OBJ(&xyzzylisp_bufferp__NAME), xyzzylisp_bufferp, NULL, NULL);
27    
28  static ScmObj xyzzylisp_selected_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)  static ScmObj xyzzylisp_selected_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
29  {  {
30    SCM_ENTER_SUBR("selected-buffer");    SCM_ENTER_SUBR("selected-buffer");
# Line 22  SCM_RETURN(SHIKI_BUFFER_BOX(SCM_RESULT)) Line 41  SCM_RETURN(SHIKI_BUFFER_BOX(SCM_RESULT))
41  static SCM_DEFINE_STRING_CONST(xyzzylisp_selected_buffer__NAME, "selected-buffer", 15, 15);  static SCM_DEFINE_STRING_CONST(xyzzylisp_selected_buffer__NAME, "selected-buffer", 15, 15);
42  static SCM_DEFINE_SUBR(xyzzylisp_selected_buffer__STUB, 0, 0, SCM_OBJ(&xyzzylisp_selected_buffer__NAME), xyzzylisp_selected_buffer, NULL, NULL);  static SCM_DEFINE_SUBR(xyzzylisp_selected_buffer__STUB, 0, 0, SCM_OBJ(&xyzzylisp_selected_buffer__NAME), xyzzylisp_selected_buffer, NULL, NULL);
43    
44    static ScmObj xyzzylisp_get_next_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
45    {
46      ScmObj buffer_scm;
47      ScmObj buffer;
48      ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
49      SCM_ENTER_SUBR("get-next-buffer");
50      if (Scm_Length(SCM_OPTARGS) > 1)
51        Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
52      if (SCM_NULLP(SCM_OPTARGS)) buffer_scm = SCM_UNBOUND;
53      else {
54        buffer_scm = SCM_CAR(SCM_OPTARGS);
55        SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
56      }
57      buffer = (buffer_scm);
58      {
59    {
60    GtkTextBuffer* SCM_RESULT;
61      if(buffer == SCM_UNBOUND)
62        SCM_RESULT = Shiki_get_next_buffer(Shiki_CURRENT_TEXT_BUFFER);
63      else if(SHIKI_BUFFER_P(buffer))
64        SCM_RESULT = Shiki_get_next_buffer(SHIKI_BUFFER_UNBOX(buffer));
65      else
66        Scm_Error("buffer required, but got %S", buffer);    
67      if(SCM_RESULT)
68        g_object_ref(SCM_RESULT);
69    SCM_RETURN(SHIKI_BUFFER_BOX(SCM_RESULT));
70    }
71      }
72    }
73    
74    static SCM_DEFINE_STRING_CONST(xyzzylisp_get_next_buffer__NAME, "get-next-buffer", 15, 15);
75    static SCM_DEFINE_SUBR(xyzzylisp_get_next_buffer__STUB, 0, 1, SCM_OBJ(&xyzzylisp_get_next_buffer__NAME), xyzzylisp_get_next_buffer, NULL, NULL);
76    
77    static ScmObj xyzzylisp_get_previous_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
78    {
79      ScmObj buffer_scm;
80      ScmObj buffer;
81      ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
82      SCM_ENTER_SUBR("get-previous-buffer");
83      if (Scm_Length(SCM_OPTARGS) > 1)
84        Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
85      if (SCM_NULLP(SCM_OPTARGS)) buffer_scm = SCM_UNBOUND;
86      else {
87        buffer_scm = SCM_CAR(SCM_OPTARGS);
88        SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
89      }
90      buffer = (buffer_scm);
91      {
92    {
93    GtkTextBuffer* SCM_RESULT;
94      if(buffer == SCM_UNBOUND)
95        SCM_RESULT = Shiki_get_previous_buffer(Shiki_CURRENT_TEXT_BUFFER);
96      else if(SHIKI_BUFFER_P(buffer))
97        SCM_RESULT = Shiki_get_previous_buffer(SHIKI_BUFFER_UNBOX(buffer));
98      else
99        Scm_Error("buffer required, but got %S", buffer);    
100      if(SCM_RESULT)
101        g_object_ref(SCM_RESULT);
102    SCM_RETURN(SHIKI_BUFFER_BOX(SCM_RESULT));
103    }
104      }
105    }
106    
107    static SCM_DEFINE_STRING_CONST(xyzzylisp_get_previous_buffer__NAME, "get-previous-buffer", 19, 19);
108    static SCM_DEFINE_SUBR(xyzzylisp_get_previous_buffer__STUB, 0, 1, SCM_OBJ(&xyzzylisp_get_previous_buffer__NAME), xyzzylisp_get_previous_buffer, NULL, NULL);
109    
110    static ScmObj xyzzylisp_buffer_list(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
111    {
112      SCM_ENTER_SUBR("buffer-list");
113      {
114    {
115    ScmObj SCM_RESULT;
116    SCM_RESULT = Shiki_buffer_list();
117    SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
118    }
119      }
120    }
121    
122    static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_list__NAME, "buffer-list", 11, 11);
123    static SCM_DEFINE_SUBR(xyzzylisp_buffer_list__STUB, 0, 0, SCM_OBJ(&xyzzylisp_buffer_list__NAME), xyzzylisp_buffer_list, NULL, NULL);
124    
125    static ScmObj xyzzylisp_next_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
126    {
127      SCM_ENTER_SUBR("next-buffer");
128      {
129    gtk_notebook_next_page(Shiki_EDITOR_NOTEBOOK);
130    SCM_RETURN(SCM_UNDEFINED);
131      }
132    }
133    
134    static SCM_DEFINE_STRING_CONST(xyzzylisp_next_buffer__NAME, "next-buffer", 11, 11);
135    static SCM_DEFINE_SUBR(xyzzylisp_next_buffer__STUB, 0, 0, SCM_OBJ(&xyzzylisp_next_buffer__NAME), xyzzylisp_next_buffer, NULL, NULL);
136    
137    static ScmObj xyzzylisp_previous_buffer(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
138    {
139      SCM_ENTER_SUBR("previous-buffer");
140      {
141    gtk_notebook_prev_page(Shiki_EDITOR_NOTEBOOK);
142    SCM_RETURN(SCM_UNDEFINED);
143      }
144    }
145    
146    static SCM_DEFINE_STRING_CONST(xyzzylisp_previous_buffer__NAME, "previous-buffer", 15, 15);
147    static SCM_DEFINE_SUBR(xyzzylisp_previous_buffer__STUB, 0, 0, SCM_OBJ(&xyzzylisp_previous_buffer__NAME), xyzzylisp_previous_buffer, NULL, NULL);
148    
149    static ScmObj xyzzylisp_buffer_name(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
150    {
151      ScmObj buffer_scm;
152      GtkTextBuffer* buffer;
153      SCM_ENTER_SUBR("buffer-name");
154      buffer_scm = SCM_ARGREF(0);
155      if (!SHIKI_BUFFER_P(buffer_scm)) Scm_Error("buffer required, but got %S", buffer_scm);
156      buffer = SHIKI_BUFFER_UNBOX(buffer_scm);
157      {
158    {
159    const char * SCM_RESULT;
160     SCM_RESULT = (Shiki_buffer_name(buffer));
161    SCM_RETURN(SCM_MAKE_MAYBE(SCM_MAKE_STR_COPYING, SCM_RESULT));
162    }
163      }
164    }
165    
166    static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_name__NAME, "buffer-name", 11, 11);
167    static SCM_DEFINE_SUBR(xyzzylisp_buffer_name__STUB, 1, 0, SCM_OBJ(&xyzzylisp_buffer_name__NAME), xyzzylisp_buffer_name, NULL, NULL);
168    
169    static ScmObj xyzzylisp_buffer_modified_p(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
170    {
171      ScmObj buffer_scm;
172      ScmObj buffer;
173      ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
174      SCM_ENTER_SUBR("buffer-modified-p");
175      if (Scm_Length(SCM_OPTARGS) > 1)
176        Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
177      if (SCM_NULLP(SCM_OPTARGS)) buffer_scm = SCM_UNBOUND;
178      else {
179        buffer_scm = SCM_CAR(SCM_OPTARGS);
180        SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
181      }
182      buffer = (buffer_scm);
183      {
184    {
185    int SCM_RESULT;
186      if(buffer == SCM_UNBOUND)
187        SCM_RESULT = gtk_text_buffer_get_modified(Shiki_CURRENT_TEXT_BUFFER);
188      else if(SHIKI_BUFFER_P(buffer))
189        SCM_RESULT = gtk_text_buffer_get_modified(SHIKI_BUFFER_UNBOX(buffer));
190      else
191        Scm_Error("buffer required, but got %S", buffer);
192    SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
193    }
194      }
195    }
196    
197    static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_modified_p__NAME, "buffer-modified-p", 17, 17);
198    static SCM_DEFINE_SUBR(xyzzylisp_buffer_modified_p__STUB, 0, 1, SCM_OBJ(&xyzzylisp_buffer_modified_p__NAME), xyzzylisp_buffer_modified_p, NULL, NULL);
199    
200  static ScmObj xyzzylisp_buffer_substring(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)  static ScmObj xyzzylisp_buffer_substring(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
201  {  {
202    ScmObj start_scm;    ScmObj start_scm;
# Line 89  if(SCM_CHARP(char_or_string)) { Line 264  if(SCM_CHARP(char_or_string)) {
264      g_free(str);      g_free(str);
265    } else if(SCM_STRINGP(char_or_string))    } else if(SCM_STRINGP(char_or_string))
266      gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, SCM_STRING_CONST_CSTRING(char_or_string), -1);      gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, SCM_STRING_CONST_CSTRING(char_or_string), -1);
267        else
268        Scm_Error("character or string required, but got %S", char_or_string);
269  SCM_RETURN(SCM_UNDEFINED);  SCM_RETURN(SCM_UNDEFINED);
270    }    }
271  }  }
# Line 226  static SCM_DEFINE_SUBR(xyzzylisp_goto_eo Line 403  static SCM_DEFINE_SUBR(xyzzylisp_goto_eo
403  void Scm_Init_xyzzylisp(ScmModule *module)  void Scm_Init_xyzzylisp(ScmModule *module)
404  {  {
405    
406      SCM_DEFINE(module, "bufferp", SCM_OBJ(&xyzzylisp_bufferp__STUB));
407    SCM_DEFINE(module, "selected-buffer", SCM_OBJ(&xyzzylisp_selected_buffer__STUB));    SCM_DEFINE(module, "selected-buffer", SCM_OBJ(&xyzzylisp_selected_buffer__STUB));
408      SCM_DEFINE(module, "get-next-buffer", SCM_OBJ(&xyzzylisp_get_next_buffer__STUB));
409      SCM_DEFINE(module, "get-previous-buffer", SCM_OBJ(&xyzzylisp_get_previous_buffer__STUB));
410      SCM_DEFINE(module, "buffer-list", SCM_OBJ(&xyzzylisp_buffer_list__STUB));
411      SCM_DEFINE(module, "next-buffer", SCM_OBJ(&xyzzylisp_next_buffer__STUB));
412      SCM_DEFINE(module, "previous-buffer", SCM_OBJ(&xyzzylisp_previous_buffer__STUB));
413      SCM_DEFINE(module, "buffer-name", SCM_OBJ(&xyzzylisp_buffer_name__STUB));
414      SCM_DEFINE(module, "buffer-modified-p", SCM_OBJ(&xyzzylisp_buffer_modified_p__STUB));
415    SCM_DEFINE(module, "buffer-substring", SCM_OBJ(&xyzzylisp_buffer_substring__STUB));    SCM_DEFINE(module, "buffer-substring", SCM_OBJ(&xyzzylisp_buffer_substring__STUB));
416    SCM_DEFINE(module, "delete-region", SCM_OBJ(&xyzzylisp_delete_region__STUB));    SCM_DEFINE(module, "delete-region", SCM_OBJ(&xyzzylisp_delete_region__STUB));
417    SCM_DEFINE(module, "insert", SCM_OBJ(&xyzzylisp_insert__STUB));    SCM_DEFINE(module, "insert", SCM_OBJ(&xyzzylisp_insert__STUB));

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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