Annotation of loncom/homework/caparesponse/capa.i, revision 1.6
1.1 albertel 1: %module capa
2: %{
3:
4: %}
1.3 albertel 5:
1.4 albertel 6: %typemap(perl5,in) char** reterror (char* cvalue) {
1.3 albertel 7: SV* tempsv;
1.5 albertel 8: int len;
1.3 albertel 9: if (!SvROK($source)) {
10: croak("expected a reference\n");
11: }
12: tempsv = SvRV($source);
13: if ((!SvPOK(tempsv))) {
14: croak("expected a double reference\n");
15: }
1.4 albertel 16: cvalue = SvPV(tempsv,len);
17: $target = &cvalue;
1.3 albertel 18: }
19:
20: %typemap(perl5,argout) char ** reterror {
21: SV *tempsv;
22: tempsv = SvRV($arg);
23: if (($source!=NULL) && (*$source!=NULL)) {
24: sv_setpv(tempsv, *$source);
25: free(*$source);
26: }
27: }
1.6 ! albertel 28:
! 29: %typemap(perl5,in) double* scaled {
! 30: double *temp;
! 31: if (!SvROK($source)) {
! 32: croak("expected a reference\n");
! 33: }
! 34: SV* tempsv;
! 35: tempsv = SvRV($source);
! 36: if (!SvPOK(tempsv) && !SvIOK(tempsv) && !SvNOK(tempsv)) {
! 37: croak("expected a single reference to a scalar\n");
! 38: }
! 39: temp = malloc(sizeof(double));
! 40: *temp = SvNV(tempsv);
! 41: $target = temp;
! 42: }
! 43:
! 44: %typemap(perl5,argout) double* scaled {
! 45: SV *tempsv;
! 46: tempsv = SvRV($arg);
! 47: sv_setnv(tempsv, *$source);
! 48: free($source);
! 49: }
! 50:
! 51:
1.1 albertel 52: extern int caparesponse_capa_check_answer(char *response,char *correct,
53: int type,int tol_type,double tolerance,
54: int sig_lbound,int sig_ubound,
55: char *ans_fmt, char *unit_str,
1.2 albertel 56: int calc, char *id_list, char *pts_list,
1.3 albertel 57: char *rndseed, char** reterror);
1.6 ! albertel 58:
! 59: extern int caparesponse_get_real_response(char* unit_str, char* answer,
! 60: double* scaled);
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>