File:  [LON-CAPA] / loncom / homework / caparesponse / capa.i
Revision 1.4: download - view: text, annotated - select for diffs
Sat Mar 13 00:23:27 2004 UTC (20 years, 5 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- I think I finally understand the type globs

    1: %module capa
    2: %{
    3: 
    4: %}
    5: 
    6: %typemap(perl5,in) char** reterror (char* cvalue) {
    7:   SV* tempsv;
    8:   if (!SvROK($source)) {
    9:     croak("expected a reference\n");
   10:   }
   11:   tempsv = SvRV($source);
   12:   if ((!SvPOK(tempsv))) {
   13:     croak("expected a double reference\n");
   14:   }
   15:   int len;
   16:   cvalue = SvPV(tempsv,len);
   17:   $target = &cvalue;
   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: }
   28: extern int caparesponse_capa_check_answer(char *response,char *correct,
   29: 				   int type,int tol_type,double tolerance,
   30: 				   int sig_lbound,int sig_ubound, 
   31: 				   char *ans_fmt, char *unit_str,
   32: 				   int calc, char *id_list, char *pts_list,
   33: 				   char *rndseed, char** reterror);

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>