Subversion Repositories wimsdev

Rev

Rev 7657 | Rev 8185 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*    Copyright (C) 1998-2003 XIAO, Gang of Universite de Nice - Sophia Antipolis
  2.  *
  3.  *  This program is free software; you can redistribute it and/or modify
  4.  *  it under the terms of the GNU General Public License as published by
  5.  *  the Free Software Foundation; either version 2 of the License, or
  6.  *  (at your option) any later version.
  7.  *
  8.  *  This program is distributed in the hope that it will be useful,
  9.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.  *  GNU General Public License for more details.
  12.  *
  13.  *  You should have received a copy of the GNU General Public License
  14.  *  along with this program; if not, write to the Free Software
  15.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16.  */
  17.  
  18.      /* Routines treating user scores. */
  19.  
  20. double oldfactor=0.85;     /* quality factor, should remain stable. */
  21.  
  22. enum {sr_require, sr_weight, sr_score, sr_mean, sr_remain, sr_last, sr_try, sr_best, sr_level};
  23. char scorebuf[MAX_CLASSEXOS*sizeof(scoreresult)+32];
  24. struct scoreresult *rscore;
  25. int scorecnt;
  26. double scoresum[MAX_SHEETS];
  27. int sheetstart[MAX_SHEETS], shexocnt[MAX_SHEETS];
  28. int examstart, examcnt;
  29. char rscore_class[MAX_CLASSLEN+1];
  30. char rscore_user[MAX_NAMELEN+1];
  31.  
  32. int totsheets=0;
  33. int score_ispublic=0;
  34. int score_status=-1;          /* save of score status */
  35. int score_statussheet=-1;
  36. int score_statusisexam=-1;
  37. double scorerecfactor=0.9;
  38.  
  39. /* gather user score, core routine. */
  40. int getscoreuser(char *classe, char *user)
  41. {
  42.   int i, j, osh, sh;
  43.   double s;
  44.   char *nowuser, *nowsheet, *nowexo, *nowscore;
  45.   char *pp;
  46.   if(*user==0) {
  47.     user=getvar("wims_user");
  48.     if(user==NULL || *user==0) return -1;
  49.   }
  50.   if(strcmp(classe,rscore_class)==0 && strcmp(user,rscore_user)==0) return 0;
  51.   nowsheet=nowexo=nowscore="";
  52.   nowuser=getvar("wims_user"); if(nowuser!=NULL && strcmp(user,nowuser)==0) {
  53.     nowscore=getvar("module_score"); if(nowscore!=NULL && *nowscore!=0) {
  54.       nowsheet=getvar("wims_sheet"); if(nowsheet==NULL) nowsheet="";
  55.       nowexo=getvar("wims_exo"); if(nowexo==NULL) nowexo="";
  56.     }
  57.     else nowscore="";
  58.   }
  59.   snprintf(scorebuf+sizeof(int),sizeof(scorebuf)-sizeof(int),
  60.        "-c%s -u%s getscore %s %s %s",
  61.        classe,user,nowsheet,nowexo,nowscore);
  62.   i=kerneld(scorebuf,sizeof(scorebuf));
  63.   if(i<0)  internal_error("getscoreuser(): daemon failure.");
  64.   if(memcmp(scorebuf+sizeof(int),"OK",2)!=0) {
  65.     if(memcmp(scorebuf+sizeof(int),"ERROR",5)==0) {
  66.       module_error(find_word_start(scorebuf+sizeof(int)+8));
  67.     }
  68.     else internal_error("getscoreuser(): communication error with wimslogd.");
  69.   }
  70.   pp=scorebuf+sizeof(int)+3; rscore=(struct scoreresult *) pp;
  71.   scorecnt=(i-sizeof(int)-3)/sizeof(scoreresult);
  72.   if(scorecnt>MAX_CLASSEXOS) module_error("too_many_exercises");
  73.   s=0; for(i=osh=0;i<scorecnt;i++) {
  74.     sh=(rscore[i].num>>8)+1;
  75.     if(sh<1 || sh>MAX_SHEETS) break;
  76.     if(osh>0 && osh<sh) {scoresum[osh-1]=s; s=0;}
  77.     for(;osh<sh && osh<MAX_SHEETS;osh++) sheetstart[osh]=i;
  78.     s+=rscore[i].require*rscore[i].weight;
  79.   }
  80.   if(osh>0) scoresum[osh-1]=s; totsheets=osh;
  81.   for(j=0;j<totsheets-1;j++) shexocnt[j]=sheetstart[j+1]-sheetstart[j];
  82.   shexocnt[totsheets-1]=i-sheetstart[totsheets-1];
  83.   examstart=i; examcnt=scorecnt-examstart;
  84.   mystrncpy(rscore_class,classe,sizeof(rscore_class));
  85.   mystrncpy(rscore_user,user,sizeof(rscore_user));
  86.   return 0;
  87. }
  88. /* work : exo */
  89. char *scorepname[]={
  90.      "class","user","sheet","work","exam"
  91. };
  92. #define scorepname_no (sizeof(scorepname)/sizeof(scorepname[0]))
  93. char score_class[MAX_CLASSLEN+1];
  94. int score_sheet,score_exo,score_isexam;
  95. char score_user[256];
  96.  
  97. /* Uniformed treatment of score command parameters
  98.  * format: class=? user=? sheet=? work=?
  99.  * all are optional. */
  100. void _scoreparm(char *p)
  101. {
  102.     int i;
  103.     char *pn, *pe, *pd, *pf;
  104.     char sav;
  105.  
  106.     score_sheet=score_exo=score_isexam=score_ispublic=0; *score_class=0;
  107.     score_user[0]=0;
  108.     for(i=0;i<scorepname_no;i++) {
  109.      pf=p;
  110.      ahead:
  111.      pn=strstr(pf,scorepname[i]); pf=pn+1;
  112.      if(pn==NULL) continue;
  113.      if(pn>p && !isspace(*(pn-1))) goto ahead;
  114.      pe=find_word_start(pn+strlen(scorepname[i]));
  115.      if(*pe!='=') goto ahead;
  116.      pd=find_word_start(pe+1);
  117.      pf=find_word_end(pd);
  118.      if(pf<=pd) continue;
  119.      sav=*pf; *pf=0;
  120.      switch(i) {
  121.          case 0: /* class */
  122.            mystrncpy(score_class,pd,sizeof(score_class)); break;
  123.          case 1: /* user */
  124.            mystrncpy(score_user,pd,sizeof(score_user)); break;
  125.          case 2: { /* sheet */
  126.           if(*pd=='P') {pd++; score_ispublic=1;}
  127.           score_sheet=atoi(pd);
  128.           break;
  129.          }
  130.          case 3: /* work=exo */
  131.            score_exo=atoi(pd); break;
  132.          case 4: /* exam */
  133.            score_isexam=1; break;
  134.      }
  135.      *pf=sav; ovlstrcpy(pn, pf);
  136.     }
  137.     *p=0;
  138.     if((*score_class!=0 || score_user[0]!=0) && !trusted_module()) {
  139.      module_error("not_trusted"); return;
  140.     }
  141.     if(*score_class==0) {
  142.      char *classe;
  143.      classe=getvar("wims_class");
  144.      if(classe==NULL || *classe==0) return;
  145.      else mystrncpy(score_class,classe,sizeof(score_class));
  146.     }
  147.     if(score_user[0]==0) {
  148.      char *user;
  149.      user=getvar("wims_user");
  150.      if(user!=NULL) mystrncpy(score_user,user,sizeof(score_user));
  151.     }
  152. }
  153.  
  154. /* gather score: relatif to some of the
  155.  *  user class work sheet exam
  156.  *    dtype can be require weight score mean remain best last level try
  157.  */
  158.  
  159. void _getscore(char *p,int dtype)
  160. {
  161.     int i,sh,ex,osh;
  162.     float d;
  163.     char *p1;
  164.  
  165.     _scoreparm(p);
  166.     if(*score_class==0 || *score_user==0) return;
  167.     if(getscoreuser(score_class,score_user)<0) return;
  168. /*  2^8 no_sheet + no_exo_in_the_sheet so limit no_exo to 2^8
  169. */
  170.     for(i=osh=0,p1=p;i<scorecnt && p1-p<MAX_LINELEN-32;i++) {
  171.      sh=(rscore[i].num>>8)+1; if(sh<1 || sh>MAX_SHEETS) break;
  172.      if(score_sheet!=0) {
  173.          if(sh<score_sheet) continue;
  174.          if(sh>score_sheet || sh>MAX_SHEETS) break;
  175.      }
  176.      ex=((rscore[i].num)&255)+1;
  177.      if(score_exo!=0 && ex!=score_exo) continue;
  178.      if(osh!=0 && sh!=osh) *p1++='\n';
  179.      switch(dtype) {
  180.          case sr_require: {d=rscore[i].require; break;}
  181.          case sr_weight: {d=rscore[i].weight; break;}
  182.          case sr_score: {d=rscore[i].score; break;}
  183.          case sr_mean: {d=rscore[i].mean; break;}
  184.          case sr_remain: {d=rscore[i].require-rscore[i].score; break;}
  185.          case sr_last: {d=rscore[i].last; break;}
  186.          case sr_try: {d=rscore[i].try; break;}
  187.          case sr_best: {d=rscore[i].best; break;}
  188.          case sr_level: {d=rscore[i].level ;break;}
  189.          default: {d=0; break;}
  190.      }
  191.      p1=moneyprint(p1,d); *p1++=' ';
  192.      osh=sh;
  193.     }
  194.     *p1++='\n'; *p1=0;
  195. }
  196.  
  197. /* gather user score. */
  198. void calc_getscore(char *p)
  199. {
  200.   _getscore(p,sr_score);
  201. }
  202.  
  203. /* gather user score average. */
  204. void calc_getscoremean(char *p)
  205. {
  206.   _getscore(p,sr_mean);
  207. }
  208.  
  209. /* gather remaining of score to get for user. */
  210. void calc_getscoreremain(char *p)
  211. {
  212.   _getscore(p,sr_remain);
  213. }
  214.  
  215. /* Require score table. */
  216. void calc_getscorerequire(char *p)
  217. {
  218.   _getscore(p,sr_require);
  219. }
  220.  
  221. /* Score weight table. */
  222. void calc_getscoreweight(char *p)
  223. {
  224.   _getscore(p,sr_weight);
  225. }
  226. /* user last score*/
  227. void calc_getscorelast(char *p)
  228. {
  229.   _getscore(p,sr_last);
  230. }
  231.  
  232. /* gather user score try numbers. */
  233. void calc_getscoretry(char *p)
  234. {
  235.   _getscore(p,sr_try);
  236. }
  237.  
  238. /* if the required points are 10* N, gather N user best scores */
  239. void calc_getscorebest(char *p)
  240. {
  241.   _getscore(p,sr_best);
  242. }
  243.  
  244. /* gather user score average. */
  245. void calc_getscorelevel(char *p)
  246. {
  247.   _getscore(p,sr_level);
  248. }
  249.  
  250. /* percentage of work done for each sheet:
  251.  * score mean best level
  252.  * as follows
  253.  * score=100*cumulative_points/required_points) (< 100)
  254.  * mean=quality (<10)
  255.  * best=10*(required/10 best_scores)/required_points (< 100)
  256.  * level=minimum of the required/10 best_scores (< 10)
  257.  */
  258.  
  259.  void calc_getscorepercent(char *p)
  260. {
  261.   int i,j,jend;
  262.   double tot, mean, totb, totl, totw, d;
  263.   char *p1;
  264.  
  265.   _scoreparm(p);
  266.   if(*score_class==0 || *score_user==0) return;
  267.   if(getscoreuser(score_class,score_user)<0) return;
  268.   for(p1=p,i=0;i<totsheets && p1-p<MAX_LINELEN-32;i++) {
  269.     if(scoresum[i]==0) {
  270.       ovlstrcpy(p1,"0 0 0 0\n"); p1+=strlen(p1); continue;
  271.     }
  272.     if(score_sheet!=0 && i!=score_sheet-1) continue;
  273.     if(scoresum[i]<=0) *p1++='\n';
  274.     tot=mean=totb=totl=totw=0; jend=sheetstart[i]+shexocnt[i];
  275.     for(j=sheetstart[i];j<jend;j++) {
  276. /* if mean<1 then ignore score.
  277.  * if mean<2 then half score. */
  278.       if(rscore[j].mean>=1) {
  279.         double dt=rscore[j].score;
  280.         float db=rscore[j].best;
  281.         float dl=rscore[j].level;
  282.         if(rscore[j].mean<2) {dt=dt/2; db=db/2; dl=dl/2;}
  283.         d=dt*rscore[j].weight;
  284. /* quality */
  285.         mean+=rscore[j].mean*d;
  286. /* cumulative score */
  287.         tot+=d;
  288. /* best */
  289.         totb+=db*rscore[j].weight;
  290. /* level */
  291.         totl+=dl*rscore[j].weight;
  292.         totw+=rscore[j].weight;
  293.       }
  294.     }
  295.     if(tot>0) {d=mean/tot;} else d=0;
  296. /* cumulative score */
  297.     p1=moneyprint(p1,rint(100*tot/scoresum[i])); *p1++=' ';
  298. /* quality */
  299.     p1=moneyprint(p1,d); *p1++=' ';
  300. /* best */
  301.     p1=moneyprint(p1,rint(100*totb/scoresum[i])); *p1++=' ';
  302. /* level */
  303.     p1=moneyprint(p1,rint(10*totl/totw));
  304.  
  305.    *p1++='\n';
  306.   }
  307.   *p1=0;
  308. }
  309.  
  310. /* Returns the status of a sheet, or -1 if error */
  311. int getsheetstatus(char *classe, int sheet)
  312. {
  313.   char *p, *st, buf[MAX_LINELEN+1], namebuf[MAX_FNAME+1];
  314.   int i;
  315.  
  316.   if(isexam || score_isexam) st="exam"; else st="sheet";
  317.   mkfname(namebuf,"%s/%s/%ss/.%ss",class_base,classe,st,st);
  318.   direct_datafile=1;datafile_fnd_record(namebuf,sheet,buf);direct_datafile=0;
  319.   p=find_word_start(buf); if(*p==0) return -1;
  320.   i=*p-'0'; if(i>5 || i<0) i=-1;
  321.   if((isexam || score_isexam) && i==0) {
  322.     p=getvar("wims_user"); if(p!=NULL && strcmp(p,"supervisor")==0) i=1;
  323.   }
  324.   return i;
  325. }
  326.  
  327. /* return 1 if a word of bf2 is a substring of host.
  328.  * Content of bf2 is destroyed. */
  329. int _subword(char bf2[])
  330. {
  331.   char *p1, *p2;
  332.   for(p1=strchr(bf2,'\\'); p1!=NULL; p1=strchr(p1+1,'\\')) {
  333.     char buf[MAX_LINELEN+1], buf2[MAX_LINELEN+1], fbuf[MAX_FNAME+1];
  334.     char *classp, *classp2, *userp, *scp;
  335.     classp=getvar("wims_class"); userp=getvar("wims_user");
  336.     if(classp==NULL || userp==NULL || *classp==0 || *userp==0) break;
  337.     scp=getvar("wims_superclass");
  338.     if(scp!=NULL && *scp!=0) classp2=scp; else classp2=classp;
  339.     if(p1>bf2 && !isspace(*(p1-1))) continue;
  340.     if(!isalnum(*(p1+1))) continue;
  341.     p2=find_word_end(p1); if(p2>=p1+MAX_NAMELEN) continue;
  342.     memmove(buf2, p1+1, p2-p1-1); buf2[p2-p1-1]=0;
  343.     snprintf(buf,sizeof(buf),"user__%s",buf2);
  344.     if(strcmp(userp,"supervisor")==0)
  345.       mkfname(fbuf,"%s/%s/supervisor",class_base,classp);
  346.     else
  347.       mkfname(fbuf,"%s/%s/.users/%s",class_base,classp2,userp);
  348.     getdef(fbuf,buf,buf2); if(buf2[0]==0) ovlstrcpy(buf2,"none");
  349.     string_modify(bf2,p1,p2,buf2);
  350.     p1+=strlen(buf2);
  351.   }
  352.   if((isexam || score_isexam) && bf2[0]=='#') return 1;
  353.   if(wordchr(bf2,"none")!=NULL) return 0;
  354.   if(wordchr(bf2,"all")!=NULL) return 1;
  355.   p1=find_word_start(bf2); if(*p1==0) return 1;
  356.   return checkhostt(p1);
  357. }
  358.  
  359. /* Returns 1 if score registration is open, 0 otherwise. */
  360. int _getscorestatus(char *classe, int sheet)
  361. {
  362.   char nbuf[MAX_LINELEN+1], gbuf[MAX_LINELEN+1];
  363.   char *es;
  364.  
  365.   if(classe==NULL || *classe==0 || sheet<=0) return 1;
  366.   if(getsheetstatus(classe,sheet)!=1) return 0;
  367.   if(*remote_addr==0) return 0;
  368.   if(isexam || score_isexam) {     /* exam simulation */
  369.     accessfile(nbuf,"r","%s/%s/.E%d",class_base,classe,sheet);
  370.     if(nbuf[0]=='#') return 1;
  371.   }
  372.   /* Global restriction data */
  373.   accessfile(nbuf,"r","%s/%s/.security",class_base,classe);
  374.   if(nbuf[0]) {
  375.     _getdef(nbuf,"allow",gbuf);
  376.     if(*find_word_start(gbuf)!=0 && _subword(gbuf)==0)
  377.       return 0;
  378.     _getdef(nbuf,"except",gbuf);
  379.     if(*find_word_start(gbuf)!=0 && _subword(gbuf)==1)
  380.       return 0;
  381.   }
  382.  
  383.   /* Sheet restriction data */
  384.   if(isexam || score_isexam) es="E"; else es="";
  385.   accessfile(nbuf,"r","%s/%s/.%s%d",class_base,classe,es,sheet);
  386.   if(*find_word_start(nbuf)==0) return 1;
  387.   return _subword(nbuf);
  388. }
  389.  
  390. /* Returns 1 if score registration is open, 0 otherwise. */
  391. int getscorestatus(char *classe, int sheet)
  392. {
  393.   if(score_status<0 || score_statussheet!=sheet
  394.      || score_statusisexam!=isexam) {
  395.     score_statussheet=sheet; score_statusisexam=isexam;
  396.     score_status=_getscorestatus(classe,sheet); score_isexam=0;
  397.     if(score_status==1 && (cmd_type==cmd_new || cmd_type==cmd_renew
  398.                || isexam)) {
  399.       char *p;
  400.       p=getvar("wims_scorereg");
  401.       if(p==NULL || strcmp(p,"suspend")!=0)
  402.          setvar("wims_scoring","pending");
  403.       else setvar("wims_scoring","");
  404.     }
  405.   }
  406.   if(isexam && score_status==0) {
  407.     char *p;
  408.     p=getvar("wims_user"); if(p==NULL || strcmp(p,"supervisor")!=0)
  409.                  user_error("exam_closed");
  410.   }
  411.   return score_status;
  412. }
  413.  
  414. /* Whether score registering is open */
  415. void calc_getscorestatus(char *p)
  416. {
  417.   _scoreparm(p);
  418.   if(*score_class==0 || score_sheet==0 || *score_user==0) {
  419.     *p=0; return;
  420.   }
  421.   if(getscorestatus(score_class, score_sheet))
  422.     ovlstrcpy(p,"yes");
  423.   else ovlstrcpy(p,"no");
  424. }
  425.  
  426. double exam_scoredata[MAX_EXOS];
  427.  
  428. /* get current exam score */
  429. void exam_currscore(int esh)
  430. {
  431.   char *p, *bf, pb[MAX_FNAME+1];
  432.   char *s, *p1, *p2, *e1, *e2;
  433.   int i;
  434.  
  435.   for(i=0;i<MAX_EXOS;i++) exam_scoredata[i]=-1000;
  436.   /* session_prefix is not yet defined here */
  437.   s=getvar("wims_session"); if(s==NULL || *s==0) return;
  438.   mystrncpy(pb,s,sizeof(pb));
  439.   p=strchr(pb,'_'); if(p!=NULL) *p=0;
  440.   bf=readfile(mkfname(NULL,"%s/%s/examscore.%d",session_dir,pb,esh),NULL,WORKFILE_LIMIT);
  441.   if(bf==NULL) return;
  442.   for(p1=bf;*p1;p1=p2) {
  443.     p2=strchr(p1,'\n'); if(*p2) *p2++=0;
  444.     else p2=p1+strlen(p1);
  445.     p1=find_word_start(find_word_end(find_word_start(p1)));
  446.     e1=find_word_end(p1); if(*e1) *e1++=0;
  447.     e1=find_word_start(e1); e2=find_word_start(find_word_end(e1));
  448.     *find_word_end(e1)=0;
  449.     i=atoi(p1);
  450.     if(i>=1 && i<=MAX_EXOS &&
  451.        exam_scoredata[i-1]==-1000 && strcmp(e1,"score")==0) {
  452.       *find_word_end(e2)=0;
  453.       exam_scoredata[i-1]=atof(e2);
  454.     }
  455.   }
  456.   free(bf);
  457. }
  458.  
  459. /* Gather exam score. */
  460. void calc_examscore(char *p)
  461. {
  462.   char *p1;
  463.   int i;
  464.  
  465.   _scoreparm(p); *p=0;
  466.   if(*score_class==0 || *score_user==0) return;
  467.   if(getscoreuser(score_class,score_user)<0) return;
  468.   p1=p;
  469.   for(i=0; i<examcnt && p1-p<MAX_LINELEN-32; i++) {
  470.     p1=moneyprint(p1,rscore[examstart+i].score); *p1++=' ';
  471.   }
  472.   *p1++='\n';
  473.   for(i=0; i<examcnt && p1-p<MAX_LINELEN-32; i++) {
  474.     p1=moneyprint(p1,rscore[examstart+i].require); *p1++=' ';
  475.     p1=moneyprint(p1,floor(rscore[examstart+i].mean/2)); *p1++=' ';
  476.     p1=moneyprint(p1,(int) rscore[examstart+i].mean%2); *p1++='\n';
  477.   }
  478.   *p1=0;
  479. }
  480.  
  481. /* check score dependency.
  482.  * returns 1 if requirements are met. */
  483. int _depcheck(char *ds, struct scoreresult *rs, int ecnt)
  484. {
  485.   char *p1, *p2, *p3, *p4, *pp;
  486.   int perc, t, sum;
  487.   double tgot, ttot, tmean;
  488.  
  489.   for(p1=ds; *p1; p1=p3) {
  490.     p2=strchr(p1,':'); if(p2==NULL) break;
  491.     *p2++=0; p2=find_word_start(p2);
  492.     for(p3=p2; myisdigit(*p3); p3++);
  493.     if(p3<=p2) break;
  494.     *p3++=0; perc=atoi(p2);
  495.     if(perc<=0 || perc>100) break;
  496.     for(pp=p1; *pp; pp++) if(!myisdigit(*pp)) *pp=' ';
  497.     tgot=ttot=tmean=0; sum=0;
  498.     for(pp=find_word_start(p1); *pp; pp=find_word_start(p4)) {
  499.       p4=find_word_end(pp); if(*p4) *p4++=0;
  500.       t=atoi(pp); if(t<=0 || t>ecnt) goto lend;
  501.       t--;
  502.       ttot+=rs[t].require; tgot+=rs[t].score; tmean+=rs[t].mean;
  503.       sum++;
  504.     }
  505.     if(ttot<10) continue;
  506.     if(tgot/ttot*sqrt(tmean/(sum*10))*100<perc) {
  507.       for(pp=p1;pp<p2-1;pp++) if(!*pp) *pp=',';
  508.       *pp=0; setvar("dep_list",p1);
  509.       return 0;
  510.     }
  511.   lend: ;
  512.   }
  513.   return 1;
  514. }
  515.  
  516. int depcheck(char *sh, int exo, char *deps)
  517. {
  518.   char buf[MAX_LINELEN+1];
  519.   char *s, sbuf[64];
  520.   int i, is;
  521.  
  522.   s=getvar("wims_session");
  523.   if(s==NULL || *s==0 || strstr(s,"robot")!=NULL) return 0;
  524.   mystrncpy(sbuf,s,sizeof(sbuf));
  525.   s=strchr(sbuf,'_'); if(s) *s=0;
  526.   accessfile(buf,"r","../sessions/%s/exodep.%s",sbuf,sh);
  527.   if(buf[0]==0) {     /* no dep file found */
  528.     is=atoi(sh); if(is<=0 || is>totsheets) return 0;
  529.     s=getvar("wims_class"); if(s==NULL || *s==0) return 0;
  530.     getscoreuser(s,"");
  531.     return _depcheck(deps,rscore+sheetstart[is-1],shexocnt[is-1]);
  532.   }
  533.   for(i=1,s=strchr(buf,':'); s && i<exo; i++, s=strchr(s+1,':'));
  534.   if(s==NULL) return 0;     /* bad file or exo number */
  535.   if(myisdigit(*++s)) return 0; else return 1;
  536. }
  537.  
  538. int exam_depcheck(char *deps, int exam)
  539. {
  540.   struct scoreresult esc[MAX_EXOS];
  541.   int i;
  542.   exam_currscore(exam);
  543.   for(i=0;i<MAX_EXOS;i++) {
  544.     esc[i].require=esc[i].mean=10;
  545.     if(exam_scoredata[i]==-1000) esc[i].score=0;
  546.     else esc[i].score=exam_scoredata[i];
  547.   }
  548.   return _depcheck(deps,esc,MAX_EXOS);
  549. }
  550.