Back to index

wims  3.65+svn20090927
proc.inc
Go to the documentation of this file.
00001 %% This file is language-independent.
00002 
00003 \text{header=wims(nonempty lines wims(record 0 of \datafile))}
00004 \integer{n=wims(linecnt \header)}
00005 \text{commonq=}
00006 \for{k=1 to \n}{
00007  \text{l=\header[\k;]}
00008  \text{test=wims(char 1 to 3 of \l)}
00009  \text{l=wims(char 4 to -1 of \l)}
00010  \text{commonq=\test issametext .IQ?\commonq \l}
00011 }
00012 
00013 \integer{qcnt=items(\records)}
00014 \integer{givetrue=1}
00015 \integer{minfalse=0}
00016 \text{option=}
00017 \integer{tot=8}
00018 \text{anstype=checkbox iswordof \option?checkbox:radio}
00019 \text{chars=A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
00020 
00021 \text{ans=}
00022 \text{list=}
00023 \text{pick=}
00024 \text{hint=}
00025 \text{image=}
00026 \text{feedback=}
00027 \text{statement=}
00028 \text{empty=}
00029 \text{Tot=}
00030 
00031 \for{rec in \records}{
00032 
00033 \text{data=wims(trim wims(record \rec of \datafile))}
00034 \text{data=wims(embraced randitem \data)}
00035 \text{statement1=wims(line 1 of \data)}
00036 \text{statement1=wims(singlespace wims(rows2lines \statement1))}
00037 \integer{n=wims(linecnt \data)}
00038 \text{true1=}
00039 \text{false1=}
00040 \text{contents=statement}
00041 \text{fb1=}
00042 \for{k=2 to \n}{
00043  \text{l=wims(trim wims(line \k of \data))}
00044  \text{c=wims(char 1 of \l)}
00045  \text{l=wims(char 2 to -1 of \l)}
00046  \text{l=wims(replace internal , by , in \l)}
00047  \text{l=wims(singlespace wims(rows2lines \l))}
00048  \text{contents=\contents,\l}
00049  \if{\c issametext 0}{
00050    \text{false1=wims(append item \k to \false1)}
00051  }
00052  \if{\c issametext 1}{
00053    \text{true1=wims(append item \k to \true1)}
00054  }
00055  \if{\c isin Ff and \k > 2}{
00056   \text{fb1=\fb1\l}
00057  }
00058  \if{\c isin Hh}{
00059   \text{hint=\l}
00060  }
00061  \if{\c isin Ii}{
00062   \text{image=wims(trim \l)}
00063  }
00064  \text{fb1=\fb1,}
00065 }
00066 \integer{truecnt=items(\true1)}
00067 \integer{falsecnt=items(\false1)}
00068 \integer{givetrue1=\givetrue>\truecnt?\truecnt:\givetrue}
00069 \integer{tot1=\tot > \falsecnt+\givetrue?\falsecnt+\givetrue:\tot}
00070 \integer{givetrue1=\givetrue1>\tot1-1?\tot1-1}
00071 \integer{minfalse1=\minfalse>\tot1-\givetrue1?\tot1-\givetrue1:\minfalse}
00072 \text{tsh=shuffle(\truecnt)}
00073 \text{true=item(\tsh,\true1)}
00074 \if{\minfalse1>0}{
00075  \text{false1=item(1..\minfalse1,\false1);}
00076  \text{false2=item(\minfalse1+1..\falsecnt,\false1)}
00077 }{
00078  \integer{minfalse1=0}
00079  \text{false2=\false1}
00080  \text{false1=}
00081 }
00082 \text{fsh=shuffle(\falsecnt)}
00083 \text{false2=item(\fsh,\false2)}
00084 \text{pick1=item(1..\givetrue1,\true),\false1 item(1..\tot1-\givetrue1-\minfalse1,\false2)}
00085 \text{ind=wims(makelist 1 for x=1 to \givetrue1),wims(makelist 0 for x=1 to \tot1-\givetrue1)}
00086 \text{sh=shuffle(\tot1)}
00087 \text{ind=item(\sh,\ind)}
00088 \text{pick1=item(\sh,\pick1)}
00089 \text{ans1=positionof(1,\ind)}
00090 \text{list1=item(1..\tot1,\chars)}
00091 \text{Tot=\Tot\tot1,}
00092 \text{list=\list\list1;}
00093 \text{ans=\ans\ans1;}
00094 \text{feedback=\feedback\fb1[\pick1];}
00095 \text{pick1=\contents[\pick1]}
00096 \text{pick=\pick\pick1;}
00097 \text{statement=\statement\statement1;}
00098 
00099 }
00100 
00101 \text{repind=}
00102 \text{indcolor=}
00103 \text{reps=}
00104 \text{steps=wims(makelist r x for x=1 to \qcnt)}
00105 \text{steps=\steptype notsametext all?wims(items2lines \steps)}
00106 \steps{\steps}
00107 
00108 \statement{
00109 \if{\image notsametext }{
00110   <img align=right hspace=10 src=\imagedir/\image> <p>
00111 }
00112 \commonq
00113 \for{q=1 to \qcnt}{
00114  \if{\steptype issametext all or (\status issametext end and \q<=\step) or \q=\step}{
00115   \if{\qcnt>1}{<p> \q. }
00116   \statement[\q;]
00117   <p><table border=0 cellspacing=4>
00118   \for{i=1 to \Tot[\q]}{
00119    <tr><td nowrap>\embed{reply \q,\i}.</td>
00120    <td>\pick[\q;\i]</td></tr>
00121   }
00122   </table>
00123   \if{\status issametext end and \repind[\q]>0 and \feedback[\q;\repind[\q]] notsametext }{
00124    <p><font color=\indcolor[\q]><em>\feedback[\q;\repind[\q]]</em></font>
00125   }
00126   \if{\q<\qcnt and (\steptype issametext all or \q<\step)}{<p><hr>}
00127  }
00128 }
00129 \if{\image notsametext }{<br clear=right>}
00130 }
00131 
00132 \answer{\choicename 1}{\ans[1;];\list[1;]}{type=\anstype}{option=\option}
00133 \answer{\choicename 2}{\ans[2;];\list[2;]}{type=\anstype}{option=\option}
00134 \answer{\choicename 3}{\ans[3;];\list[3;]}{type=\anstype}{option=\option}
00135 \answer{\choicename 4}{\ans[4;];\list[4;]}{type=\anstype}{option=\option}
00136 \answer{\choicename 5}{\ans[5;];\list[5;]}{type=\anstype}{option=\option}
00137 \answer{\choicename 6}{\ans[6;];\list[6;]}{type=\anstype}{option=\option}
00138 \answer{\choicename 7}{\ans[7;];\list[7;]}{type=\anstype}{option=\option}
00139 \answer{\choicename 8}{\ans[8;];\list[8;]}{type=\anstype}{option=\option}
00140 \answer{\choicename 9}{\ans[9;];\list[9;]}{type=\anstype}{option=\option}
00141 \answer{\choicename 10}{\ans[10;];\list[10;]}{type=\anstype}{option=\option}
00142 \answer{\choicename 11}{\ans[11;];\list[11;]}{type=\anstype}{option=\option}
00143 \answer{\choicename 12}{\ans[12;];\list[12;]}{type=\anstype}{option=\option}
00144 \answer{\choicename 13}{\ans[13;];\list[13;]}{type=\anstype}{option=\option}
00145 \answer{\choicename 14}{\ans[14;];\list[14;]}{type=\anstype}{option=\option}
00146 \answer{\choicename 15}{\ans[15;];\list[15;]}{type=\anstype}{option=\option}
00147 \answer{\choicename 16}{\ans[16;];\list[16;]}{type=\anstype}{option=\option}
00148 \answer{\choicename 17}{\ans[17;];\list[17;]}{type=\anstype}{option=\option}
00149 \answer{\choicename 18}{\ans[18;];\list[18;]}{type=\anstype}{option=\option}
00150 \answer{\choicename 19}{\ans[19;];\list[19;]}{type=\anstype}{option=\option}
00151 \answer{\choicename 20}{\ans[20;];\list[20;]}{type=\anstype}{option=\option}
00152 
00153 \text{reps=\reply1,\reply2,\reply3,\reply4,\reply5,\reply6,\reply7,\preply8,\preply9,\reply10,
00154   \reply11,\reply12,\reply13,\reply14,\reply15,\reply16,\reply17,\preply8,\preply9,\reply20}
00155 \for{t=1 to \qcnt}{
00156   \text{ind=positionof(\reps[\t],\chars)}
00157   \text{repind=\repind\ind,}
00158   \text{indcolor=\ind isitemof \ans[\t;]?\indcolor[]green,:\indcolor[]red,}
00159 }
00160 
00161 \hint{\hint}
00162