File: FreeContact.xsp

package info (click to toggle)
libfreecontact-perl 0.08-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 280 kB
  • ctags: 6
  • sloc: perl: 87; makefile: 12
file content (147 lines) | stat: -rw-r--r-- 4,806 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*  Copyright (C) 2013 by Laszlo Kajan, Technical University of Munich, Germany

    This program is free software; you can redistribute it and/or modify
    it under the same terms as Perl itself, either Perl version 5.10.1 or,
    at your option, any later version of Perl 5 you may have available.
*/
%module{FreeContact};

%{
MODULE=FreeContact PACKAGE=FreeContact

void
get_ps_evfold()
    PPCODE:
        _XPUSHS_GET_PS(ps_evfold);

void
get_ps_psicov()
    PPCODE:
        _XPUSHS_GET_PS(ps_psicov);

void
get_ps_psicov_sd()
    PPCODE:
        _XPUSHS_GET_PS(ps_psicov_sd);
%}

// Example: /usr/share/doc/libextutils-xspp-perl/examples/Object-WithIntAndString/Object-WithIntAndString.xsp
%name{FreeContact::Predictor} class predictor
{
                    %name{_new} predictor(bool __dbg = false);
                    ~predictor();

/*    void            get_seq_weights(
                        freq_vec_t& __aliw, double& __wtot,
                        ali_t& __ali, double __clustpc,
                        bool __veczw = true, int __num_threads = 0
                    );*/

%{
void
predictor::_get_seq_weights( freq_vec_t* __aliw, double* __wtot, ali_t& __ali, double __clustpc, bool __veczw = true, int __num_threads = 0 )
  PREINIT:
    freq_vec_t aliw;
    double wtot = 0;
  CODE:
    __aliw = &aliw; __wtot = &wtot;
    try {
      THIS->get_seq_weights(*__aliw, *__wtot, __ali, __clustpc, __veczw, __num_threads);
    }
    catch (std::exception& e) {
      croak("Caught C++ exception of type or derived from 'std::exception': %s", e.what());
    }
    catch (...) {
      croak("Caught C++ exception of unknown type");
    }
  OUTPUT:
    __aliw
    __wtot
%}

// lkajan: I apparently can not use this to add an INIT: block to the XS
/*    cont_res_t      run( ali_t& __ali, double __cp,
                        double __density, double __gapth, U16 __mincontsep,
                        double __pseudocnt, double __pscnt_weight, bool __estimate_ivcov, double __shrink_lambda,
                        bool __cov20, bool __apply_gapth, double __rho,
                        bool __veczw = true, int __num_threads = 0, time_res_t *__timing = NULL
                    );*/
};

%{
cont_res_t
predictor::_run( __ali, __cp, __density, __gapth, __mincontsep, __pseudocnt, __pscnt_weight, __estimate_ivcov, __shrink_lambda, __cov20, __apply_gapth, __rho, __veczw = true, __num_threads = 0, __icme_timeout = 1800, __timing = NULL )
    ali_t& __ali
    double __cp
    double __density
    double __gapth
    U16 __mincontsep
    double __pseudocnt
    double __pscnt_weight
    bool __estimate_ivcov
    double __shrink_lambda
    bool __cov20
    bool __apply_gapth
    double __rho
    bool __veczw
    int __num_threads
    time_t __icme_timeout
    time_res_t* __timing
  PREINIT:
    time_res_t timing;
  CODE:
    try {
      if(items>=17) {
        if (SvROK(ST(16)) && SvTYPE(SvRV(ST(16))) == SVt_PVHV) __timing = &timing;
        else __timing = NULL;
      }
      RETVAL = THIS->run( __ali, __cp, __density, __gapth, __mincontsep, __pseudocnt, __pscnt_weight, __estimate_ivcov, __shrink_lambda, __cov20, __apply_gapth, __rho, __veczw, __num_threads, __icme_timeout, __timing );
    }
    catch (freecontact::icme_timeout_error& e)
    {
      croak("Caught FreeContact timeout exception: %s", e.what());
    }
    catch (std::exception& e) {
      croak("Caught C++ exception of type or derived from 'std::exception': %s", e.what());
    }
    catch (...) {
      croak("Caught C++ exception of unknown type");
    }
  OUTPUT:
    __timing
    RETVAL
%}

%{
cont_res_t
predictor::_run_with_seq_weights(ali_t& __ali, freq_vec_t &__aliw, double __wtot, double __density, double __gapth, U16 __mincontsep, double __pseudocnt, double __pscnt_weight, bool __estimate_ivcov, double __shrink_lambda, bool __cov20, bool __apply_gapth, double __rho, int __num_threads = 0, time_t __icme_timeout = 1800, time_res_t *__timing = NULL)
  PREINIT:
    time_res_t timing;
  CODE:
    try {
      if(items>=17) {
        if (SvROK(ST(16)) && SvTYPE(SvRV(ST(16))) == SVt_PVHV) __timing = &timing;
        else __timing = NULL;
      }
      RETVAL = THIS->run( __ali, __aliw, __wtot,
        __density, __gapth, __mincontsep,
        __pseudocnt, __pscnt_weight, __estimate_ivcov, __shrink_lambda,
        __cov20, __apply_gapth, __rho,
        __num_threads, __icme_timeout, __timing );
    }
    catch (freecontact::icme_timeout_error& e)
    {
      croak("Caught FreeContact timeout exception: %s", e.what());
    }
    catch (std::exception& e) {
      croak("Caught C++ exception of type or derived from 'std::exception': %s", e.what());
    }
    catch (...) {
      croak("Caught C++ exception of unknown type");
    }
  OUTPUT:
    __timing
    RETVAL
%}

// vim:et:ts=4:ai:syntax=cpp: