1 | /* -*- mode: c; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
---|
2 | #ifdef HAVE_LIBZEPHYR |
---|
3 | #include <zephyr/zephyr.h> |
---|
4 | #endif |
---|
5 | #include <EXTERN.h> |
---|
6 | |
---|
7 | #define OWL_PERL |
---|
8 | #include "owl.h" |
---|
9 | |
---|
10 | #define SV_IS_CODEREF(sv) (SvROK((sv)) && SvTYPE(SvRV((sv))) == SVt_PVCV) |
---|
11 | |
---|
12 | typedef char utf8; |
---|
13 | |
---|
14 | /************************************************************* |
---|
15 | * NOTE |
---|
16 | ************************************************************* |
---|
17 | * These functions, when they are intended to be user-visible, |
---|
18 | * are documented in perl/lib/BarnOwl.pm. If you add functions |
---|
19 | * to this file, add the appropriate documentation there! |
---|
20 | * |
---|
21 | * If the function is simple enough, we simply define its |
---|
22 | * entire functionality here in XS. If, however, it needs |
---|
23 | * complex argument processing or something, we define a |
---|
24 | * simple version here that takes arguments in as flat a |
---|
25 | * manner as possible, to simplify the XS code, put it in |
---|
26 | * BarnOwl::Internal::, and write a perl wrapper in BarnOwl.pm |
---|
27 | * that munges the arguments as appropriate and calls the |
---|
28 | * internal version. |
---|
29 | */ |
---|
30 | |
---|
31 | MODULE = BarnOwl PACKAGE = BarnOwl |
---|
32 | |
---|
33 | const utf8 * |
---|
34 | command(cmd, ...) |
---|
35 | const char *cmd |
---|
36 | PREINIT: |
---|
37 | char *rv = NULL; |
---|
38 | const char **argv; |
---|
39 | int i; |
---|
40 | CODE: |
---|
41 | { |
---|
42 | if (items == 1) { |
---|
43 | rv = owl_function_command(cmd); |
---|
44 | } else { |
---|
45 | argv = owl_malloc((items + 1) * sizeof *argv); |
---|
46 | argv[0] = cmd; |
---|
47 | for(i = 1; i < items; i++) { |
---|
48 | argv[i] = SvPV_nolen(ST(i)); |
---|
49 | } |
---|
50 | rv = owl_function_command_argv(argv, items); |
---|
51 | owl_free(argv); |
---|
52 | } |
---|
53 | RETVAL = rv; |
---|
54 | } |
---|
55 | OUTPUT: |
---|
56 | RETVAL |
---|
57 | CLEANUP: |
---|
58 | if (rv) owl_free(rv); |
---|
59 | |
---|
60 | SV * |
---|
61 | getcurmsg() |
---|
62 | CODE: |
---|
63 | RETVAL = owl_perlconfig_curmessage2hashref(); |
---|
64 | OUTPUT: |
---|
65 | RETVAL |
---|
66 | |
---|
67 | int |
---|
68 | getnumcols() |
---|
69 | CODE: |
---|
70 | RETVAL = owl_global_get_cols(&g); |
---|
71 | OUTPUT: |
---|
72 | RETVAL |
---|
73 | |
---|
74 | time_t |
---|
75 | getidletime() |
---|
76 | CODE: |
---|
77 | RETVAL = owl_global_get_idletime(&g); |
---|
78 | OUTPUT: |
---|
79 | RETVAL |
---|
80 | |
---|
81 | const utf8 * |
---|
82 | zephyr_getrealm() |
---|
83 | CODE: |
---|
84 | RETVAL = owl_zephyr_get_realm(); |
---|
85 | OUTPUT: |
---|
86 | RETVAL |
---|
87 | |
---|
88 | const utf8 * |
---|
89 | zephyr_getsender() |
---|
90 | CODE: |
---|
91 | RETVAL = owl_zephyr_get_sender(); |
---|
92 | OUTPUT: |
---|
93 | RETVAL |
---|
94 | |
---|
95 | void |
---|
96 | zephyr_zwrite(cmd,msg) |
---|
97 | const char *cmd |
---|
98 | const char *msg |
---|
99 | PREINIT: |
---|
100 | int i; |
---|
101 | CODE: |
---|
102 | i = owl_zwrite_create_and_send_from_line(cmd, msg); |
---|
103 | |
---|
104 | const utf8 * |
---|
105 | ztext_stylestrip(ztext) |
---|
106 | const char *ztext |
---|
107 | PREINIT: |
---|
108 | char *rv = NULL; |
---|
109 | CODE: |
---|
110 | rv = owl_function_ztext_stylestrip(ztext); |
---|
111 | RETVAL = rv; |
---|
112 | OUTPUT: |
---|
113 | RETVAL |
---|
114 | CLEANUP: |
---|
115 | if (rv) owl_free(rv); |
---|
116 | |
---|
117 | const utf8 * |
---|
118 | zephyr_smartstrip_user(in) |
---|
119 | const char *in |
---|
120 | PREINIT: |
---|
121 | char *rv = NULL; |
---|
122 | CODE: |
---|
123 | { |
---|
124 | rv = owl_zephyr_smartstripped_user(in); |
---|
125 | RETVAL = rv; |
---|
126 | } |
---|
127 | OUTPUT: |
---|
128 | RETVAL |
---|
129 | CLEANUP: |
---|
130 | owl_free(rv); |
---|
131 | |
---|
132 | const utf8 * |
---|
133 | zephyr_getsubs() |
---|
134 | PREINIT: |
---|
135 | char *rv = NULL; |
---|
136 | CODE: |
---|
137 | rv = owl_zephyr_getsubs(); |
---|
138 | RETVAL = rv; |
---|
139 | OUTPUT: |
---|
140 | RETVAL |
---|
141 | CLEANUP: |
---|
142 | if (rv) owl_free(rv); |
---|
143 | |
---|
144 | void |
---|
145 | queue_message(msg) |
---|
146 | SV *msg |
---|
147 | PREINIT: |
---|
148 | owl_message *m; |
---|
149 | CODE: |
---|
150 | { |
---|
151 | if(!SvROK(msg) || SvTYPE(SvRV(msg)) != SVt_PVHV) { |
---|
152 | croak("Usage: BarnOwl::queue_message($message)"); |
---|
153 | } |
---|
154 | |
---|
155 | m = owl_perlconfig_hashref2message(msg); |
---|
156 | |
---|
157 | owl_global_messagequeue_addmsg(&g, m); |
---|
158 | } |
---|
159 | |
---|
160 | void |
---|
161 | admin_message(header, body) |
---|
162 | const char *header |
---|
163 | const char *body |
---|
164 | CODE: |
---|
165 | { |
---|
166 | owl_function_adminmsg(header, body); |
---|
167 | } |
---|
168 | |
---|
169 | void |
---|
170 | start_question(line, callback) |
---|
171 | const char *line |
---|
172 | SV *callback |
---|
173 | PREINIT: |
---|
174 | owl_editwin *e; |
---|
175 | CODE: |
---|
176 | { |
---|
177 | if(!SV_IS_CODEREF(callback)) |
---|
178 | croak("Callback must be a subref"); |
---|
179 | |
---|
180 | e = owl_function_start_question(line); |
---|
181 | |
---|
182 | owl_editwin_set_cbdata(e, |
---|
183 | newSVsv(callback), |
---|
184 | owl_perlconfig_dec_refcnt); |
---|
185 | owl_editwin_set_callback(e, owl_perlconfig_edit_callback); |
---|
186 | } |
---|
187 | |
---|
188 | void |
---|
189 | start_password(line, callback) |
---|
190 | const char *line |
---|
191 | SV *callback |
---|
192 | PREINIT: |
---|
193 | owl_editwin *e; |
---|
194 | CODE: |
---|
195 | { |
---|
196 | if(!SV_IS_CODEREF(callback)) |
---|
197 | croak("Callback must be a subref"); |
---|
198 | |
---|
199 | e = owl_function_start_password(line); |
---|
200 | |
---|
201 | owl_editwin_set_cbdata(e, |
---|
202 | newSVsv(callback), |
---|
203 | owl_perlconfig_dec_refcnt); |
---|
204 | owl_editwin_set_callback(e, owl_perlconfig_edit_callback); |
---|
205 | } |
---|
206 | |
---|
207 | void |
---|
208 | start_edit_win(line, callback) |
---|
209 | const char *line |
---|
210 | SV *callback |
---|
211 | CODE: |
---|
212 | { |
---|
213 | if(!SV_IS_CODEREF(callback)) |
---|
214 | croak("Callback must be a subref"); |
---|
215 | |
---|
216 | owl_function_start_edit_win(line, |
---|
217 | owl_perlconfig_edit_callback, |
---|
218 | newSVsv(callback), |
---|
219 | owl_perlconfig_dec_refcnt); |
---|
220 | } |
---|
221 | |
---|
222 | |
---|
223 | const char * |
---|
224 | get_data_dir () |
---|
225 | CODE: |
---|
226 | RETVAL = owl_get_datadir(); |
---|
227 | OUTPUT: |
---|
228 | RETVAL |
---|
229 | |
---|
230 | const char * |
---|
231 | get_config_dir () |
---|
232 | CODE: |
---|
233 | RETVAL = owl_global_get_confdir(&g); |
---|
234 | OUTPUT: |
---|
235 | RETVAL |
---|
236 | |
---|
237 | void |
---|
238 | popless_text(text) |
---|
239 | const char *text |
---|
240 | CODE: |
---|
241 | { |
---|
242 | owl_function_popless_text(text); |
---|
243 | } |
---|
244 | |
---|
245 | void |
---|
246 | popless_ztext(text) |
---|
247 | const char *text |
---|
248 | CODE: |
---|
249 | { |
---|
250 | owl_fmtext fm; |
---|
251 | owl_fmtext_init_null(&fm); |
---|
252 | owl_fmtext_append_ztext(&fm, text); |
---|
253 | owl_function_popless_fmtext(&fm); |
---|
254 | owl_fmtext_cleanup(&fm); |
---|
255 | } |
---|
256 | |
---|
257 | void |
---|
258 | error(text) |
---|
259 | const char *text |
---|
260 | CODE: |
---|
261 | { |
---|
262 | owl_function_error("%s", text); |
---|
263 | } |
---|
264 | |
---|
265 | void |
---|
266 | debug(text) |
---|
267 | const char *text |
---|
268 | CODE: |
---|
269 | { |
---|
270 | owl_function_debugmsg("%s", text); |
---|
271 | } |
---|
272 | |
---|
273 | void |
---|
274 | message(text) |
---|
275 | const char *text |
---|
276 | CODE: |
---|
277 | { |
---|
278 | owl_function_makemsg("%s", text); |
---|
279 | } |
---|
280 | |
---|
281 | void |
---|
282 | create_style(name, object) |
---|
283 | const char *name |
---|
284 | SV *object |
---|
285 | PREINIT: |
---|
286 | owl_style *s; |
---|
287 | CODE: |
---|
288 | { |
---|
289 | s = owl_malloc(sizeof(owl_style)); |
---|
290 | owl_style_create_perl(s, name, newSVsv(object)); |
---|
291 | owl_global_add_style(&g, s); |
---|
292 | } |
---|
293 | |
---|
294 | int |
---|
295 | getnumcolors() |
---|
296 | CODE: |
---|
297 | RETVAL = owl_function_get_color_count(); |
---|
298 | OUTPUT: |
---|
299 | RETVAL |
---|
300 | |
---|
301 | void |
---|
302 | _remove_filter(filterName) |
---|
303 | const char *filterName |
---|
304 | CODE: |
---|
305 | { |
---|
306 | /* Don't delete the current view, or the 'all' filter */ |
---|
307 | if (strcmp(filterName, owl_view_get_filtname(owl_global_get_current_view(&g))) |
---|
308 | && strcmp(filterName, "all")) { |
---|
309 | owl_global_remove_filter(&g,filterName); |
---|
310 | } |
---|
311 | } |
---|
312 | |
---|
313 | const utf8 * |
---|
314 | wordwrap(in, cols) |
---|
315 | const char *in |
---|
316 | int cols |
---|
317 | PREINIT: |
---|
318 | char *rv = NULL; |
---|
319 | CODE: |
---|
320 | rv = owl_text_wordwrap(in, cols); |
---|
321 | RETVAL = rv; |
---|
322 | OUTPUT: |
---|
323 | RETVAL |
---|
324 | CLEANUP: |
---|
325 | if (rv) |
---|
326 | owl_free(rv); |
---|
327 | |
---|
328 | void |
---|
329 | remove_io_dispatch(fd) |
---|
330 | int fd |
---|
331 | CODE: |
---|
332 | owl_select_remove_perl_io_dispatch(fd); |
---|
333 | |
---|
334 | AV* |
---|
335 | all_filters() |
---|
336 | PREINIT: |
---|
337 | owl_list fl; |
---|
338 | CODE: |
---|
339 | { |
---|
340 | owl_list_create(&fl); |
---|
341 | owl_dict_get_keys(&g.filters, &fl); |
---|
342 | RETVAL = owl_new_av(&fl, (SV*(*)(const void*))owl_new_sv); |
---|
343 | sv_2mortal((SV*)RETVAL); |
---|
344 | owl_list_cleanup(&fl, owl_free); |
---|
345 | } |
---|
346 | OUTPUT: |
---|
347 | RETVAL |
---|
348 | |
---|
349 | AV* |
---|
350 | all_styles() |
---|
351 | PREINIT: |
---|
352 | owl_list l; |
---|
353 | CODE: |
---|
354 | { |
---|
355 | owl_list_create(&l); |
---|
356 | owl_global_get_style_names(&g, &l); |
---|
357 | RETVAL = owl_new_av(&l, (SV*(*)(const void*))owl_new_sv); |
---|
358 | sv_2mortal((SV*)RETVAL); |
---|
359 | } |
---|
360 | OUTPUT: |
---|
361 | RETVAL |
---|
362 | CLEANUP: |
---|
363 | owl_list_cleanup(&l, owl_free); |
---|
364 | |
---|
365 | |
---|
366 | AV* |
---|
367 | all_variables() |
---|
368 | PREINIT: |
---|
369 | owl_list l; |
---|
370 | CODE: |
---|
371 | { |
---|
372 | owl_list_create(&l); |
---|
373 | owl_dict_get_keys(owl_global_get_vardict(&g), &l); |
---|
374 | RETVAL = owl_new_av(&l, (SV*(*)(const void*))owl_new_sv); |
---|
375 | sv_2mortal((SV*)RETVAL); |
---|
376 | } |
---|
377 | OUTPUT: |
---|
378 | RETVAL |
---|
379 | CLEANUP: |
---|
380 | owl_list_cleanup(&l, owl_free); |
---|
381 | |
---|
382 | |
---|
383 | AV* |
---|
384 | all_keymaps() |
---|
385 | PREINIT: |
---|
386 | owl_list l; |
---|
387 | const owl_keyhandler *kh; |
---|
388 | CODE: |
---|
389 | { |
---|
390 | owl_list_create(&l); |
---|
391 | kh = owl_global_get_keyhandler(&g); |
---|
392 | owl_keyhandler_get_keymap_names(kh, &l); |
---|
393 | RETVAL = owl_new_av(&l, (SV*(*)(const void*))owl_new_sv); |
---|
394 | sv_2mortal((SV*)RETVAL); |
---|
395 | } |
---|
396 | OUTPUT: |
---|
397 | RETVAL |
---|
398 | CLEANUP: |
---|
399 | owl_list_cleanup(&l, owl_free); |
---|
400 | |
---|
401 | void |
---|
402 | redisplay() |
---|
403 | CODE: |
---|
404 | { |
---|
405 | owl_messagelist_invalidate_formats(owl_global_get_msglist(&g)); |
---|
406 | owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS); |
---|
407 | owl_mainwin_redisplay(owl_global_get_mainwin(&g)); |
---|
408 | } |
---|
409 | |
---|
410 | const char * |
---|
411 | get_zephyr_variable(name) |
---|
412 | const char *name; |
---|
413 | CODE: |
---|
414 | RETVAL = owl_zephyr_get_variable(name); |
---|
415 | OUTPUT: |
---|
416 | RETVAL |
---|
417 | |
---|
418 | const utf8 * |
---|
419 | skiptokens(str, n) |
---|
420 | const char *str; |
---|
421 | int n; |
---|
422 | CODE: |
---|
423 | RETVAL = skiptokens(str, n); |
---|
424 | OUTPUT: |
---|
425 | RETVAL |
---|
426 | |
---|
427 | |
---|
428 | MODULE = BarnOwl PACKAGE = BarnOwl::Zephyr |
---|
429 | |
---|
430 | int |
---|
431 | have_zephyr() |
---|
432 | CODE: |
---|
433 | RETVAL = owl_global_is_havezephyr(&g); |
---|
434 | OUTPUT: |
---|
435 | RETVAL |
---|
436 | |
---|
437 | MODULE = BarnOwl PACKAGE = BarnOwl::Internal |
---|
438 | |
---|
439 | |
---|
440 | void |
---|
441 | new_command(name, func, summary, usage, description) |
---|
442 | char *name |
---|
443 | SV *func |
---|
444 | char *summary |
---|
445 | char *usage |
---|
446 | char *description |
---|
447 | PREINIT: |
---|
448 | owl_cmd cmd; |
---|
449 | CODE: |
---|
450 | { |
---|
451 | if(!SV_IS_CODEREF(func)) { |
---|
452 | croak("Command function must be a coderef!"); |
---|
453 | } |
---|
454 | cmd.name = name; |
---|
455 | cmd.cmd_perl = newSVsv(func); |
---|
456 | cmd.summary = summary; |
---|
457 | cmd.usage = usage; |
---|
458 | cmd.description = description; |
---|
459 | cmd.validctx = OWL_CTX_ANY; |
---|
460 | cmd.cmd_aliased_to = NULL; |
---|
461 | cmd.cmd_args_fn = NULL; |
---|
462 | cmd.cmd_v_fn = NULL; |
---|
463 | cmd.cmd_i_fn = NULL; |
---|
464 | cmd.cmd_ctxargs_fn = NULL; |
---|
465 | cmd.cmd_ctxv_fn = NULL; |
---|
466 | cmd.cmd_ctxi_fn = NULL; |
---|
467 | owl_cmddict_add_cmd(owl_global_get_cmddict(&g), &cmd); |
---|
468 | } |
---|
469 | |
---|
470 | void |
---|
471 | new_variable_string(name, ival, summ, desc) |
---|
472 | const char * name |
---|
473 | const char * ival |
---|
474 | const char * summ |
---|
475 | const char * desc |
---|
476 | CODE: |
---|
477 | owl_variable_dict_newvar_string(owl_global_get_vardict(&g), |
---|
478 | name, |
---|
479 | summ, |
---|
480 | desc, |
---|
481 | ival); |
---|
482 | |
---|
483 | void |
---|
484 | new_variable_int(name, ival, summ, desc) |
---|
485 | const char * name |
---|
486 | int ival |
---|
487 | const char * summ |
---|
488 | const char * desc |
---|
489 | CODE: |
---|
490 | owl_variable_dict_newvar_int(owl_global_get_vardict(&g), |
---|
491 | name, |
---|
492 | summ, |
---|
493 | desc, |
---|
494 | ival); |
---|
495 | |
---|
496 | void |
---|
497 | new_variable_bool(name, ival, summ, desc) |
---|
498 | const char * name |
---|
499 | int ival |
---|
500 | const char * summ |
---|
501 | const char * desc |
---|
502 | CODE: |
---|
503 | owl_variable_dict_newvar_bool(owl_global_get_vardict(&g), |
---|
504 | name, |
---|
505 | summ, |
---|
506 | desc, |
---|
507 | ival); |
---|
508 | |
---|
509 | void |
---|
510 | add_io_dispatch(fd, mode, cb) |
---|
511 | int fd |
---|
512 | int mode |
---|
513 | SV * cb |
---|
514 | CODE: |
---|
515 | owl_select_add_perl_io_dispatch(fd, mode, newSVsv(cb)); |
---|
516 | |
---|
517 | IV |
---|
518 | add_timer(after, interval, cb) |
---|
519 | int after |
---|
520 | int interval |
---|
521 | SV *cb |
---|
522 | PREINIT: |
---|
523 | SV *ref; |
---|
524 | owl_timer *t; |
---|
525 | CODE: |
---|
526 | ref = sv_rvweaken(newSVsv(cb)); |
---|
527 | t = owl_select_add_timer(after, |
---|
528 | interval, |
---|
529 | owl_perlconfig_perl_timer, |
---|
530 | owl_perlconfig_perl_timer_destroy, |
---|
531 | ref); |
---|
532 | owl_function_debugmsg("Created timer %p", t); |
---|
533 | RETVAL = (IV)t; |
---|
534 | OUTPUT: |
---|
535 | RETVAL |
---|
536 | |
---|
537 | void |
---|
538 | remove_timer(timer) |
---|
539 | IV timer |
---|
540 | PREINIT: |
---|
541 | owl_timer *t; |
---|
542 | CODE: |
---|
543 | t = (owl_timer*)timer; |
---|
544 | owl_function_debugmsg("Freeing timer %p", t); |
---|
545 | owl_select_remove_timer(t); |
---|
546 | |
---|
547 | MODULE = BarnOwl PACKAGE = BarnOwl::Editwin |
---|
548 | |
---|
549 | int |
---|
550 | replace(count, string) |
---|
551 | int count; |
---|
552 | const char *string; |
---|
553 | PREINIT: |
---|
554 | owl_editwin *e; |
---|
555 | CODE: |
---|
556 | e = owl_global_get_typwin(&g); |
---|
557 | if (e) { |
---|
558 | RETVAL = owl_editwin_replace(e, count, string); |
---|
559 | } else { |
---|
560 | RETVAL = 0; |
---|
561 | } |
---|
562 | OUTPUT: |
---|
563 | RETVAL |
---|
564 | |
---|
565 | int |
---|
566 | point_move(delta) |
---|
567 | int delta; |
---|
568 | PREINIT: |
---|
569 | owl_editwin *e; |
---|
570 | CODE: |
---|
571 | e = owl_global_get_typwin(&g); |
---|
572 | if (e) { |
---|
573 | RETVAL = owl_editwin_point_move(e, delta); |
---|
574 | } else { |
---|
575 | RETVAL = 0; |
---|
576 | } |
---|
577 | OUTPUT: |
---|
578 | RETVAL |
---|
579 | |
---|
580 | int |
---|
581 | replace_region(string) |
---|
582 | const char *string; |
---|
583 | PREINIT: |
---|
584 | owl_editwin *e; |
---|
585 | CODE: |
---|
586 | e = owl_global_get_typwin(&g); |
---|
587 | if (e) { |
---|
588 | RETVAL = owl_editwin_replace_region(e, string); |
---|
589 | } else { |
---|
590 | RETVAL = 0; |
---|
591 | } |
---|
592 | OUTPUT: |
---|
593 | RETVAL |
---|
594 | |
---|
595 | const utf8 * |
---|
596 | get_region() |
---|
597 | PREINIT: |
---|
598 | char *region; |
---|
599 | owl_editwin *e; |
---|
600 | CODE: |
---|
601 | e = owl_global_get_typwin(&g); |
---|
602 | if (e) { |
---|
603 | region = owl_editwin_get_region(owl_global_get_typwin(&g)); |
---|
604 | } else { |
---|
605 | region = NULL; |
---|
606 | } |
---|
607 | RETVAL = region; |
---|
608 | OUTPUT: |
---|
609 | RETVAL |
---|
610 | CLEANUP: |
---|
611 | owl_free(region); |
---|
612 | |
---|
613 | SV * |
---|
614 | save_excursion(sub) |
---|
615 | SV *sub; |
---|
616 | PROTOTYPE: & |
---|
617 | PREINIT: |
---|
618 | int count; |
---|
619 | owl_editwin *e; |
---|
620 | owl_editwin_excursion *x; |
---|
621 | CODE: |
---|
622 | { |
---|
623 | e = owl_global_get_typwin(&g); |
---|
624 | if(!e) |
---|
625 | croak("The edit window is not currently active!"); |
---|
626 | |
---|
627 | x = owl_editwin_begin_excursion(owl_global_get_typwin(&g)); |
---|
628 | PUSHMARK(SP); |
---|
629 | count = call_sv(sub, G_SCALAR|G_EVAL|G_NOARGS); |
---|
630 | SPAGAIN; |
---|
631 | owl_editwin_end_excursion(owl_global_get_typwin(&g), x); |
---|
632 | |
---|
633 | if(SvTRUE(ERRSV)) { |
---|
634 | croak(NULL); |
---|
635 | } |
---|
636 | |
---|
637 | if(count == 1) |
---|
638 | RETVAL = SvREFCNT_inc(POPs); |
---|
639 | else |
---|
640 | XSRETURN_UNDEF; |
---|
641 | |
---|
642 | } |
---|
643 | OUTPUT: |
---|
644 | RETVAL |
---|
645 | |
---|
646 | int |
---|
647 | current_column() |
---|
648 | PREINIT: |
---|
649 | owl_editwin *e; |
---|
650 | CODE: |
---|
651 | e = owl_global_get_typwin(&g); |
---|
652 | if (e) { |
---|
653 | RETVAL = owl_editwin_current_column(e); |
---|
654 | } else { |
---|
655 | RETVAL = 0; |
---|
656 | } |
---|
657 | OUTPUT: |
---|
658 | RETVAL |
---|
659 | |
---|
660 | int |
---|
661 | point() |
---|
662 | PREINIT: |
---|
663 | owl_editwin *e; |
---|
664 | CODE: |
---|
665 | e = owl_global_get_typwin(&g); |
---|
666 | if (e) { |
---|
667 | RETVAL = owl_editwin_get_point(e); |
---|
668 | } else { |
---|
669 | RETVAL = 0; |
---|
670 | } |
---|
671 | OUTPUT: |
---|
672 | RETVAL |
---|
673 | |
---|
674 | int |
---|
675 | mark() |
---|
676 | PREINIT: |
---|
677 | owl_editwin *e; |
---|
678 | CODE: |
---|
679 | e = owl_global_get_typwin(&g); |
---|
680 | if (e) { |
---|
681 | RETVAL = owl_editwin_get_mark(e); |
---|
682 | } else { |
---|
683 | RETVAL = 0; |
---|
684 | } |
---|
685 | OUTPUT: |
---|
686 | RETVAL |
---|