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