100 print "J'ouvre le fichier questionnaire.html en sortie"
200 rem programme qui transforme un fichier reponses.html
300 rem en fichiers questionnaire.html
400 rem et en fichier correction.
500 rem ------
600 dim ligne$(15)
700 noligne = 0
800 noquestion = 0
900 nbquestions = 0
1000 cocher$ = "vrai/faux/ne sais pas"
1090 vraibis$ = "vrai !"
1100 vrai$ = "C'est vrai"
1200 vrai2$ = ""
1300 vraivaleur = 1
1400 faux$ = "C'est faux"
1401 fauxbis$ = "faux !"
1500 faux2$ = ""
1600 fauxvaleur = 0
1610 saispas$ = ""
1700 debut = 0
1800 fin = 0
1810 nouveautheme=0
1900 rem ------
2000 print "J'ouvre le fichier reponses.html en entre"
2100 rem SFGetFile pour appeler l'interface Macintosh de chargement de fichiers
2200 open "SFGetFile" for input as #1
2300 rem SFPutFile pour appeler l'interface Macintosh de dchargement de fichiers
2400 open "SFPutFile" for output as #2
2500 rem ---- copie de l'entete ----
2600 while eof(#1) = 0
2700 input #1,ligne$(1)
2800 if instr(ligne$(1),"
")
2801 input #1,ligne$(2),ligne$(3),ligne$(4),ligne$(5),ligne$(6),ligne$(7)
2805 if instr(ligne$(3),"
") and instr(ligne$(5),"
") then exit while
2809 endif
2810 print ligne$(1)
2820 print #2,ligne$(1)
2830 wend
2835 nouveautheme=1
2840 rem ----- dbut des questions -----
2850 rem ----- pour tous les thmes -----
2860 while eof(#1) = 0
2900 rem ----- criture du thme -----
2910 if nouveautheme=1
3100 print "------H3-----";ligne$(3);ligne$(5);"/";mid$(ligne$(7),1,instr(ligne$(7),"/H3")-2)
3200 print #2,"
";mid$(ligne$(7),1,instr(ligne$(7),"/H3")-2);"
"
3300 print #2,cocher$;
3304 nouveautheme=0
3305 endif
3310 rem ----- cherche la question ----
3350 debut=8
3400 for i = debut to 15
3500 input #1,ligne$(i)
3800 if instr(ligne$(i),vrai$) or instr(ligne$(i),faux$) or instr(ligne$(i),vraibis$) or instr(ligne$(i),fauxbis$)
3810 fin=i
3820 i=15
3830 endif
3840 next i
3850 rem ----- crit vracit -----
3855 print #2,"
"
3860 if instr(ligne$(fin),vrai$) or instr(ligne$(fin),vraibis$)
3870 print vrai2$;
3871 print #2, vrai2$;
3880 else
3881 if instr(ligne$(fin),faux$) or instr(ligne$(fin),fauxbis$)
3882 print faux2$;
3884 print #2, faux2$;
3885 else
3886 print #2,saispas$;
3887 endif
3888 endif
3900 rem ----- crit question -----
3910 debut=8
3920 for i=debut to fin
3930 if instr(ligne$(i),"NAME")
3932 ligne$(i)=mid$(ligne$(i),instr(ligne$(i),"")+4)
3940 endif
3950 if instr(ligne$(i),"")
3952 ligne$(i)=mid$(ligne$(i),0,instr(ligne$(i),"")-1)
3955 endif
if instr(ligne$(i),"")
ligne$(i)=""
endif
3956 ligne$(i)=ligne$(i)+" "
3980 if ligne$(i)="" or instr(ligne$(i),"")
4315 i=200
4320 endif
4400 rem ----- si H3 thme suivant
4450 if instr(ligne$(1),"")
4451 input #1,ligne$(2),ligne$(3),ligne$(4),ligne$(5),ligne$(6),ligne$(7)
4455 if instr(ligne$(3),"
") and instr(ligne$(5),"
")
4456 nouveautheme=1
4457 i=200
4458 endif
4459 endif
4500 next i
5550 rem ----- fin de la boucle gnrale
5600 wend
5700 rem --- ferme les fichiers
5800 close #2
5900 close #1
6000 print "c'est fini"