Subversion Repositories wimsdev

Rev

Rev 8185 | Rev 8849 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8185 Rev 8342
Line 115... Line 115...
115
    cd=classdata+i; cd->access=1;
115
    cd=classdata+i; cd->access=1;
116
    classcache[classcaches++].ptr=cd;
116
    classcache[classcaches++].ptr=cd;
117
    snprintf(cd->name,sizeof(cd->name),"%s",cl);
117
    snprintf(cd->name,sizeof(cd->name),"%s",cl);
118
    cd->start=time(NULL); cd->exocnt=0;
118
    cd->start=time(NULL); cd->exocnt=0;
119
/* Now get the exo data */
119
/* Now get the exo data */
120
    accessfile(buf,"r","sheets/.require");
120
    wlogdaccessfile(buf,"r","sheets/.require");
121
    for(i=k=0,p1=buf; *p1; i++,p1=p2) {
121
    for(i=k=0,p1=buf; *p1; i++,p1=p2) {
122
        p2=strchr(p1,'\n'); if(p2) *p2++=0; else p2=p1+strlen(p1);
122
        p2=strchr(p1,'\n'); if(p2) *p2++=0; else p2=p1+strlen(p1);
123
        for(j=0,q1=find_word_start(p1); *q1 && k<MAX_CLASSEXOS; j++,q1=find_word_start(q2)) {
123
        for(j=0,q1=find_word_start(p1); *q1 && k<MAX_CLASSEXOS; j++,q1=find_word_start(q2)) {
124
            q2=find_word_end(q1); if(*q2) *q2++=0;
124
            q2=find_word_end(q1); if(*q2) *q2++=0;
125
            cd->exos[k].num=(i<<8)+j;cd->exos[k].require=atof(q1);
125
            cd->exos[k].num=(i<<8)+j;cd->exos[k].require=atof(q1);
Line 128... Line 128...
128
        }
128
        }
129
 
129
 
130
    }
130
    }
131
    if(k>=MAX_CLASSEXOS) return NULL;
131
    if(k>=MAX_CLASSEXOS) return NULL;
132
    cd->exocnt=k; cd->examstart=k; cd->modif=0;
132
    cd->exocnt=k; cd->examstart=k; cd->modif=0;
133
    accessfile(buf,"r","sheets/.weight");
133
    wlogdaccessfile(buf,"r","sheets/.weight");
134
    for(i=k=0,p1=buf; *p1; i++,p1=p2) {
134
    for(i=k=0,p1=buf; *p1; i++,p1=p2) {
135
        p2=strchr(p1,'\n'); if(p2) *p2++=0; else p2=p1+strlen(p1);
135
        p2=strchr(p1,'\n'); if(p2) *p2++=0; else p2=p1+strlen(p1);
136
        for(j=0,q1=find_word_start(p1); *q1 && k<MAX_CLASSEXOS; j++,q1=find_word_start(q2)) {
136
        for(j=0,q1=find_word_start(p1); *q1 && k<MAX_CLASSEXOS; j++,q1=find_word_start(q2)) {
137
            q2=find_word_end(q1); if(*q2) *q2++=0;
137
            q2=find_word_end(q1); if(*q2) *q2++=0;
138
            if(cd->exos[k].num==(i<<8)+j) {
138
            if(cd->exos[k].num==(i<<8)+j) {
Line 141... Line 141...
141
            }
141
            }
142
            else while(k<cd->exocnt && cd->exos[k].num<(i<<8)+j) k++;
142
            else while(k<cd->exocnt && cd->exos[k].num<(i<<8)+j) k++;
143
        }
143
        }
144
    }
144
    }
145
    if(stat("exams/.exams",&st)==0) cd->modif=st.st_mtime; else return cd;
145
    if(stat("exams/.exams",&st)==0) cd->modif=st.st_mtime; else return cd;
146
    accessfile(buf,"r","exams/.exams");
146
    wlogdaccessfile(buf,"r","exams/.exams");
147
    if(buf[0]==0) return cd;
147
    if(buf[0]==0) return cd;
148
    if(buf[0]==':') p1=buf-1; else p1=strstr(buf,"\n:");
148
    if(buf[0]==':') p1=buf-1; else p1=strstr(buf,"\n:");
149
    for(n=m=0,k=cd->exocnt; p1 && k<MAX_CLASSEXOS && m<MAX_EXOS; p1=p2,m++) {
149
    for(n=m=0,k=cd->exocnt; p1 && k<MAX_CLASSEXOS && m<MAX_EXOS; p1=p2,m++) {
150
        p1+=2;
150
        p1+=2;
151
        p2=strstr(p1,"\n:"); if(p2) *p2=0;
151
        p2=strstr(p1,"\n:"); if(p2) *p2=0;