Ignore:
Timestamp:
Sep 20, 2010, 2:56:01 PM (14 years ago)
Author:
david
Message:

ajout support perl (attention encore en dev)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-kernel/service_internal_perl.c

    r17 r22  
    127127}
    128128       
    129 
     129int zoo_perl_support(maps** main_conf,map* request,service* s,maps **real_inputs,maps **real_outputs){
     130        maps* m=*main_conf;
     131        maps* inputs=*real_inputs;
     132        maps* outputs=*real_outputs;
     133        int res=SERVICE_FAILED;
     134        map * tmp=getMap(s->content,"serviceProvide");
     135
     136        char *my_argv[] = { "", tmp->value };
     137        if ((my_perl = perl_alloc()) == NULL){
     138                fprintf(stderr,"no memmory");
     139                exit(1);
     140        }
     141        perl_construct( my_perl );
     142        perl_parse(my_perl, xs_init, 2, my_argv, (char **)NULL);
     143        perl_run(my_perl);
     144       
     145
     146        HV* h_main_conf = (HV *)sv_2mortal((SV *)newHV());
     147        HV* h_real_inputs = (HV *)sv_2mortal((SV *)newHV());
     148        HV* h_real_outputs = (HV *)sv_2mortal((SV *)newHV());
     149        maps_to_hash(m,&h_main_conf);
     150        maps_to_hash(inputs,&h_real_inputs);
     151        maps_to_hash(outputs,&h_real_outputs);
     152        dSP;
     153        ENTER;
     154        SAVETMPS;
     155        PUSHMARK(SP);
     156        XPUSHs(sv_2mortal(newRV_inc((SV *)h_main_conf)));
     157        XPUSHs(sv_2mortal(newRV_inc((SV *)h_real_inputs)));
     158        XPUSHs(sv_2mortal(newRV_inc((SV *)h_real_outputs)));
     159        PUTBACK;
     160        call_pv(s->name, G_SCALAR);
     161        SPAGAIN;
     162        res = POPi;
     163        hash_to_maps(h_real_outputs,real_outputs);
     164        PUTBACK;
     165        FREETMPS;
     166        LEAVE;
     167        return res;
     168}
     169
     170       
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png