Code-source_du_jours.13.01.2008 (c) db

type

		pindex_pchar = ^tindex_pchar;
		tindex_pchar = object(tindex)
			apc:pc255;
			constructor init(apos:Integer; pc:pchar);
			end;

		constructor tindex_pchar.init(apos:Integer; pc:pchar);
			var p:pchar;
			begin
			inherited init(apos);
			p:=strpos(pc,'-');
			if p<>nil then
				begin
				p^:=#0;
				if wutil.Is_Pchar_numerique(pc) then
					begin
					self.pos:=wutil.PChartolongint(apc);
					end;
				strcopy(self.apc,pc);
				end;
			end;

procedure tdiskwindow.import_rc_status_traduction;
	var Counter,Counter_deux:integer;
		fin,Fin_trad:text; {input traduction}
		out_buffer:tbufstream;
		s,sintrad:string;
		p,pt:pchar;
		apc,bpc,cpc,dpc:pc255;
		id,id_parcours:longint;
		une_Barre_Tempo:Wmenuk.Barre_Tempo;
		LoopMsg: TMsg;
		col_traduction:Pcollection; {of tindex_pchar}

	procedure for_indice_id(a:pindex_pchar); far;
		begin
		{une_Barre_Tempo.Augmente;}
		end;

	begin
	box(hwindow,'import_rc_status_traduction begin');

	out_buffer.init('c:\_php\status_gb.rc',stcreate,2000);


	{//Compter le nombre de mots}
	Counter:=0;
	Assign(Fin, 'c:\_php\status.rc');
	FileMode := 0;
	Reset(Fin);
	While not(eof(fIn)) do
		begin
		inc(counter);
		readln(fin,s);
		end;
	Close(Fin);

	inttopchar(counter,apc); strcat(apc,'c:\_php\status.rc'); box(0,apc);

	col_traduction:=new(Pcollection,init(Counter,100));

	assign(Fin_trad,'c:\_php\anglais.txt');
	FileMode := 0;
	Reset(Fin_Trad);
	Counter_deux:=0;
	while not eof(fin_trad) do
		begin
		readln(fin_trad,s);
		inc(counter_deux);
		end;

	inttopchar(counter_deux,apc); strcat(apc,'c:\_php\anglais.txt'); box(0,apc);

	assign(Fin_trad,'c:\_php\anglais.txt');
	FileMode := 0;
	Reset(Fin_Trad);
	Counter:=0;
	une_Barre_Tempo._init(counter_deux,wmenuk.KBT_exportation,nil);
	while not eof(fin_trad) do
		begin
		readln(fin_trad,s);
		strpcopy(apc,s);
		col_traduction^.insert(new(pindex_pchar,init(counter,apc)));

		if PeekMessage(LoopMsg, 0, 0, 0, pm_Remove) then
			begin
			TranslateMessage(LoopMsg);
			DispatchMessage(LoopMsg);
			end;
		une_Barre_Tempo.augmente;
		end;
	close(Fin_trad);
	une_Barre_Tempo.done;

	inttopchar(col_traduction^.count,apc); box(0,apc);

	une_Barre_Tempo._init(counter,wmenuk.KBT_exportation,nil);

	Assign(Fin, 'c:\_php\status.rc');
	FileMode := 0;
	Reset(Fin);
	While not(eof(fIn)) do
		begin
		if PeekMessage(LoopMsg, 0, 0, 0, pm_Remove) then
			begin
			TranslateMessage(LoopMsg);
			DispatchMessage(LoopMsg);
			end;
		une_Barre_Tempo.Augmente;
		readln(fin,s);
		{convertir en string}
		strpcopy(apc,s);
		{trouver un guillemet}
		p:=strpos(apc,'"');
		if p=nil then
			begin {écrire une chaine identique}
			strcat(apc,CRLF);
			out_buffer.write(apc,strlen(apc));
			{writeln(s);}
			end  {écrire une chaine identique}
		else
			begin {Paix trouver, Ecrire la correspondance}
			p^:=#0;
			{extraire son identifiant}
			if wutil.Is_Pchar_numerique(apc) then
				begin
				id:=wutil.PChartolongint(apc);
				col_traduction^.foreach(@for_indice_id); {temps de parcours si la liste est lue en entier.}


				end;
			end;  {Paix trouver, Ecrire la correspondance}
		end;
	Close(Fin);
	out_buffer.done;
	une_Barre_Tempo.Done;
	box(hwindow,'import_rc_status_traduction end');
	dispose(col_traduction,done);
	end;
{$endif denis}