Changeset a88f35a for perlglue.xs


Ignore:
Timestamp:
Jul 11, 2009, 1:14:36 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
cf26b72
Parents:
0190c4d
git-author:
Nelson Elhage <nelhage@mit.edu> (06/20/09 23:45:56)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:36)
Message:
Give perl code more rope with respect to the editwin.

In particular, implement save_excursion and replace_region.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perlglue.xs

    r0190c4d ra88f35a  
    474474        OUTPUT:
    475475                RETVAL
     476
     477int
     478replace_region(string)
     479        char *string;
     480        CODE:
     481                RETVAL = owl_editwin_replace_region(owl_global_get_typwin(&g), string);
     482        OUTPUT:
     483                RETVAL
     484
     485SV *
     486save_excursion(sub)
     487        SV *sub;
     488        PROTOTYPE: &
     489        PREINIT:
     490                int count;
     491                owl_editwin_excursion *x;
     492        CODE:
     493        {
     494                x = owl_editwin_begin_excursion(owl_global_get_typwin(&g));
     495                count = call_sv(sub, G_SCALAR|G_EVAL|G_NOARGS);
     496                owl_editwin_end_excursion(owl_global_get_typwin(&g), x);
     497
     498                if(SvTRUE(ERRSV)) {
     499                        croak(NULL);
     500                }
     501
     502                SPAGAIN;
     503                if(count == 1)
     504                        RETVAL = SvREFCNT_inc(POPs);
     505                else
     506                        XSRETURN_UNDEF;
     507
     508        }
     509        OUTPUT:
     510                RETVAL
Note: See TracChangeset for help on using the changeset viewer.