File:  [LON-CAPA] / loncom / homework / caparesponse / capa.i
Revision 1.3: download - view: text, annotated - select for diffs
Fri Mar 12 21:06:19 2004 UTC (20 years, 5 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- BUG# Lots, lets start with 186,32,220,870
- when checking unit,sigfig etctera, we want to tell the student what we think they enetered, need to get the error string out of the C code and into perl space.
- Still need to do something with the message but at lest we have it now
- <numericalhint> properl namespace it's vars now.

    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:   char *temp=SvPV(tempsv,len);
   17:   cvalue = &temp;
   18:   $target = cvalue;
   19: }
   20: 
   21: %typemap(perl5,argout) char ** reterror {
   22:   SV *tempsv;
   23:   tempsv = SvRV($arg);
   24:   if (($source!=NULL) && (*$source!=NULL)) {
   25:     sv_setpv(tempsv, *$source);
   26:     free(*$source);
   27:   }
   28: }
   29: extern int caparesponse_capa_check_answer(char *response,char *correct,
   30: 				   int type,int tol_type,double tolerance,
   31: 				   int sig_lbound,int sig_ubound, 
   32: 				   char *ans_fmt, char *unit_str,
   33: 				   int calc, char *id_list, char *pts_list,
   34: 				   char *rndseed, char** reterror);

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