home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug121.arc
/
FRENCH.ARK
/
FRENCH2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-08-07
|
2KB
|
99 lines
procedure givequiz(var quiz:quiztype;var order:integerarray;
numberquestions:integer; var quizitems: stringarray;
var wrong: booleanarray; var numberwrong: integer);
{ french version }
var
line,french,english,response :textline;
genderresponse,genderchar,c :character;
k :integer;
answerok,error,genderok :boolean;
procedure stripnl(var s:textline);
var
i :integer;
begin
i := index(NEWLINE,1,s);
if i<>0 then s[i] := EOS; {remove newline from line}
end;
procedure ncopy(var src:textline; si:integer;
var dest:textline; di:integer; count:integer);
{ copies at most "count" characters from src[si] to dest[di] }
begin
while (src[si] <> EOS) and (count>0) and (max(si,di)<=MAXSTR) do
begin
dest[di] := src[si];
si := si + 1;
di := di + 1;
count := count - 1;
end;
if di > MAXSTR then di := di - 1;
dest[di] := EOS;
end;
procedure decode(var line,french,english:textline; var genderchar
:character; var decodeerror:boolean);
var
k,v,v1,i,j :integer;
begin
stripnl(line);
v:= index(SLASH,1,line);
decodeerror := false;
if v >= 2 then
begin
ncopy(line,1,french,1,v-1);
v1 := index(SLASH,v+1,line);
if (v1 <> 0) then { have noun }
begin
if v1-v <> 2 then
decodeerror := true
else
begin
genderchar := line[v+1];
scopy(line,v1+1,english,1);
end;
end
else { have non-noun }
scopy(line,v+1,english,1);
end
else decodeerror := true;
end { decode };
function match(var response,target:textline):boolean;
{ returns 'true' if response matches one of the items in target }
var
matched,endofstring :boolean;
substring :textline;
v,start :integer;
begin
matched := false; endofstring := false;
start := 1;
if slength(response) > 0 then
while (not matched) and (not endofstring) do
begin
v := index(SEMICOLON,start,target);
if v=0 then
begin
scopy(target,start,substring,1);
endofstring := true;
end
else
begin
ncopy(target,start,substring,1,v-start);
start := v + 1;
end;
matched := equal(response,substring);
end;
match := matched;
end { match };