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.3 by aloha, Sat Nov 25 09:10:43 2006 UTC revision 1.4 by aloha, Sat Nov 25 14:28:17 2006 UTC
# Line 36  SCM_RETURN(SCM_MAKE_MAYBE(SCM_OBJ_SAFE, Line 36  SCM_RETURN(SCM_MAKE_MAYBE(SCM_OBJ_SAFE,
36  static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_substring__NAME, "buffer-substring", 16, 16);  static SCM_DEFINE_STRING_CONST(xyzzylisp_buffer_substring__NAME, "buffer-substring", 16, 16);
37  static SCM_DEFINE_SUBR(xyzzylisp_buffer_substring__STUB, 2, 0, SCM_OBJ(&xyzzylisp_buffer_substring__NAME), xyzzylisp_buffer_substring, NULL, NULL);  static SCM_DEFINE_SUBR(xyzzylisp_buffer_substring__STUB, 2, 0, SCM_OBJ(&xyzzylisp_buffer_substring__NAME), xyzzylisp_buffer_substring, NULL, NULL);
38    
39    static ScmObj xyzzylisp_delete_region(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
40    {
41      ScmObj start_scm;
42      int start;
43      ScmObj end_scm;
44      int end;
45      SCM_ENTER_SUBR("delete-region");
46      start_scm = SCM_ARGREF(0);
47      if (!SCM_EXACTP(start_scm)) Scm_Error("C integer required, but got %S", start_scm);
48      start = Scm_GetInteger(start_scm);
49      end_scm = SCM_ARGREF(1);
50      if (!SCM_EXACTP(end_scm)) Scm_Error("C integer required, but got %S", end_scm);
51      end = Scm_GetInteger(end_scm);
52      {
53    Shiki_delete_region(start, end);
54    SCM_RETURN(SCM_UNDEFINED);
55      }
56    }
57    
58    static SCM_DEFINE_STRING_CONST(xyzzylisp_delete_region__NAME, "delete-region", 13, 13);
59    static SCM_DEFINE_SUBR(xyzzylisp_delete_region__STUB, 2, 0, SCM_OBJ(&xyzzylisp_delete_region__NAME), xyzzylisp_delete_region, NULL, NULL);
60    
61    static ScmObj xyzzylisp_insert(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
62    {
63      ScmObj char_or_string_scm;
64      ScmObj char_or_string;
65      SCM_ENTER_SUBR("insert");
66      char_or_string_scm = SCM_ARGREF(0);
67      char_or_string = (char_or_string_scm);
68      {
69    if(SCM_CHARP(char_or_string)) {
70        gunichar u = SCM_CHAR_VALUE(char_or_string);
71        gchar *str  = g_ucs4_to_utf8(&u, 1, NULL, NULL, NULL);
72        gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, str, -1);
73        g_free(str);
74      } else if(SCM_STRINGP(char_or_string))
75        gtk_text_buffer_insert_at_cursor(Shiki_CURRENT_TEXT_BUFFER, SCM_STRING_CONST_CSTRING(char_or_string), -1);
76    SCM_RETURN(SCM_UNDEFINED);
77      }
78    }
79    
80    static SCM_DEFINE_STRING_CONST(xyzzylisp_insert__NAME, "insert", 6, 6);
81    static SCM_DEFINE_SUBR(xyzzylisp_insert__STUB, 1, 0, SCM_OBJ(&xyzzylisp_insert__NAME), xyzzylisp_insert, NULL, NULL);
82    
83    static ScmObj xyzzylisp_point(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
84    {
85      SCM_ENTER_SUBR("point");
86      {
87    {
88    int SCM_RESULT;
89    SCM_RESULT = Shiki_point();
90    SCM_RETURN(Scm_MakeInteger(SCM_RESULT));
91    }
92      }
93    }
94    
95    static SCM_DEFINE_STRING_CONST(xyzzylisp_point__NAME, "point", 5, 5);
96    static SCM_DEFINE_SUBR(xyzzylisp_point__STUB, 0, 0, SCM_OBJ(&xyzzylisp_point__NAME), xyzzylisp_point, NULL, NULL);
97    
98    static ScmObj xyzzylisp_point_max(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
99    {
100      SCM_ENTER_SUBR("point-max");
101      {
102    {
103    int SCM_RESULT;
104    SCM_RESULT = Shiki_point_max();
105    SCM_RETURN(Scm_MakeInteger(SCM_RESULT));
106    }
107      }
108    }
109    
110    static SCM_DEFINE_STRING_CONST(xyzzylisp_point_max__NAME, "point-max", 9, 9);
111    static SCM_DEFINE_SUBR(xyzzylisp_point_max__STUB, 0, 0, SCM_OBJ(&xyzzylisp_point_max__NAME), xyzzylisp_point_max, NULL, NULL);
112    
113    static ScmObj xyzzylisp_point_min(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
114    {
115      SCM_ENTER_SUBR("point-min");
116      {
117    {
118    int SCM_RESULT;
119    SCM_RESULT = Shiki_point_min();
120    SCM_RETURN(Scm_MakeInteger(SCM_RESULT));
121    }
122      }
123    }
124    
125    static SCM_DEFINE_STRING_CONST(xyzzylisp_point_min__NAME, "point-min", 9, 9);
126    static SCM_DEFINE_SUBR(xyzzylisp_point_min__STUB, 0, 0, SCM_OBJ(&xyzzylisp_point_min__NAME), xyzzylisp_point_min, NULL, NULL);
127    
128    static ScmObj xyzzylisp_goto_char(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
129    {
130      ScmObj offset_scm;
131      int offset;
132      SCM_ENTER_SUBR("goto-char");
133      offset_scm = SCM_ARGREF(0);
134      if (!SCM_EXACTP(offset_scm)) Scm_Error("C integer required, but got %S", offset_scm);
135      offset = Scm_GetInteger(offset_scm);
136      {
137    Shiki_goto_char(offset);
138    SCM_RETURN(SCM_UNDEFINED);
139      }
140    }
141    
142    static SCM_DEFINE_STRING_CONST(xyzzylisp_goto_char__NAME, "goto-char", 9, 9);
143    static SCM_DEFINE_SUBR(xyzzylisp_goto_char__STUB, 1, 0, SCM_OBJ(&xyzzylisp_goto_char__NAME), xyzzylisp_goto_char, NULL, NULL);
144    
145    static ScmObj xyzzylisp_forward_char(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
146    {
147      SCM_ENTER_SUBR("forward-char");
148      {
149    Shiki_forward_char();
150    SCM_RETURN(SCM_UNDEFINED);
151      }
152    }
153    
154    static SCM_DEFINE_STRING_CONST(xyzzylisp_forward_char__NAME, "forward-char", 12, 12);
155    static SCM_DEFINE_SUBR(xyzzylisp_forward_char__STUB, 0, 0, SCM_OBJ(&xyzzylisp_forward_char__NAME), xyzzylisp_forward_char, NULL, NULL);
156    
157    static ScmObj xyzzylisp_backward_char(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
158    {
159      SCM_ENTER_SUBR("backward-char");
160      {
161    Shiki_backward_char();
162    SCM_RETURN(SCM_UNDEFINED);
163      }
164    }
165    
166    static SCM_DEFINE_STRING_CONST(xyzzylisp_backward_char__NAME, "backward-char", 13, 13);
167    static SCM_DEFINE_SUBR(xyzzylisp_backward_char__STUB, 0, 0, SCM_OBJ(&xyzzylisp_backward_char__NAME), xyzzylisp_backward_char, NULL, NULL);
168    
169    static ScmObj xyzzylisp_goto_line(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
170    {
171      ScmObj line_scm;
172      int line;
173      SCM_ENTER_SUBR("goto-line");
174      line_scm = SCM_ARGREF(0);
175      if (!SCM_EXACTP(line_scm)) Scm_Error("C integer required, but got %S", line_scm);
176      line = Scm_GetInteger(line_scm);
177      {
178    Shiki_goto_line(line);
179    SCM_RETURN(SCM_UNDEFINED);
180      }
181    }
182    
183    static SCM_DEFINE_STRING_CONST(xyzzylisp_goto_line__NAME, "goto-line", 9, 9);
184    static SCM_DEFINE_SUBR(xyzzylisp_goto_line__STUB, 1, 0, SCM_OBJ(&xyzzylisp_goto_line__NAME), xyzzylisp_goto_line, NULL, NULL);
185    
186    static ScmObj xyzzylisp_goto_bol(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
187    {
188      SCM_ENTER_SUBR("goto-bol");
189      {
190    Shiki_goto_bol();
191    SCM_RETURN(SCM_UNDEFINED);
192      }
193    }
194    
195    static SCM_DEFINE_STRING_CONST(xyzzylisp_goto_bol__NAME, "goto-bol", 8, 8);
196    static SCM_DEFINE_SUBR(xyzzylisp_goto_bol__STUB, 0, 0, SCM_OBJ(&xyzzylisp_goto_bol__NAME), xyzzylisp_goto_bol, NULL, NULL);
197    
198    static ScmObj xyzzylisp_goto_eol(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
199    {
200      SCM_ENTER_SUBR("goto-eol");
201      {
202    Shiki_goto_eol();
203    SCM_RETURN(SCM_UNDEFINED);
204      }
205    }
206    
207    static SCM_DEFINE_STRING_CONST(xyzzylisp_goto_eol__NAME, "goto-eol", 8, 8);
208    static SCM_DEFINE_SUBR(xyzzylisp_goto_eol__STUB, 0, 0, SCM_OBJ(&xyzzylisp_goto_eol__NAME), xyzzylisp_goto_eol, NULL, NULL);
209    
210  void Scm_Init_xyzzylisp(ScmModule *module)  void Scm_Init_xyzzylisp(ScmModule *module)
211  {  {
212    
213    SCM_DEFINE(module, "buffer-substring", SCM_OBJ(&xyzzylisp_buffer_substring__STUB));    SCM_DEFINE(module, "buffer-substring", SCM_OBJ(&xyzzylisp_buffer_substring__STUB));
214      SCM_DEFINE(module, "delete-region", SCM_OBJ(&xyzzylisp_delete_region__STUB));
215      SCM_DEFINE(module, "insert", SCM_OBJ(&xyzzylisp_insert__STUB));
216      SCM_DEFINE(module, "point", SCM_OBJ(&xyzzylisp_point__STUB));
217      SCM_DEFINE(module, "point-max", SCM_OBJ(&xyzzylisp_point_max__STUB));
218      SCM_DEFINE(module, "point-min", SCM_OBJ(&xyzzylisp_point_min__STUB));
219      SCM_DEFINE(module, "goto-char", SCM_OBJ(&xyzzylisp_goto_char__STUB));
220      SCM_DEFINE(module, "forward-char", SCM_OBJ(&xyzzylisp_forward_char__STUB));
221      SCM_DEFINE(module, "backward-char", SCM_OBJ(&xyzzylisp_backward_char__STUB));
222      SCM_DEFINE(module, "goto-line", SCM_OBJ(&xyzzylisp_goto_line__STUB));
223      SCM_DEFINE(module, "goto-bol", SCM_OBJ(&xyzzylisp_goto_bol__STUB));
224      SCM_DEFINE(module, "goto-eol", SCM_OBJ(&xyzzylisp_goto_eol__STUB));
225  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

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