PROGRAM untel;

USES
  SysUtils;

CONST
  Hex	 : String[16] = '0123456789ABCDEF';
  MaxETT = 8;
  Entete : ARRAY[1..MaxETT] OF String =
	('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">',
	 '<HTML>',
	 '<HEAD>',
	 '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">',
	 '<META NAME="author" CONTENT="Olivier Hammam">',
	 '<META NAME="generator"',
	 '        CONTENT="HtmlEdit v2.3 - site: http://www.htmledit.com - contact: info@htmledit.com">',
	 '<STYLE>BODY, TD, P { font-family: arial, sans-serif; font-size: 12; }</STYLE>');

PROCEDURE Main;

  VAR
    X,
    Y, Z : Word;
    S	 : String;
    F	 : Text;

  BEGIN
    Assign(F, 'SET'+ParamStr(1)+'00-'+ParamStr(1)+'FF.htm'); Rewrite(F);
    IF (IOResult = 0)
       THEN BEGIN
	 FOR X := 1 TO MaxETT DO
	     WriteLN(F, Entete[X]);
	 WriteLN(F, '<TITLE>UNICODE Charset ',
		    ParamStr(1), '00-', ParamStr(1), 'FF</TITLE>');
	 WriteLN(F, '</HEAD>'#13#10'<BODY BGCOLOR=#FFFFC0>');
	 WriteLN(F, '<H1 ALIGN=center><U>UNICODE Charset ',
		    ParamStr(1), '00-', ParamStr(1), 'FF</U></H1>');
	 WriteLN(F, '<TABLE ALIGN=center><TR><TD>');
	 FOR X := 1 TO 16 DO
	     Write(F, '<TD>'+ParamStr(1)+Hex[X]);
	 WriteLN(F, '');
	 FOR Y := 1 TO 16 DO BEGIN
	   Write(F, '<TR><TD>', Hex[Y]);
	   FOR X := 1 TO 16 DO BEGIN
	     Z := StrToInt('$'+ParamStr(1)+Hex[X]+Hex[Y]);
	     S := IntToStr(Z);
	     WriteLN(F, '<TD ALIGN=center><FONT SIZE=4><B>&#',
			S, ';</B></FONT><BR>U'+ParamStr(1)+Hex[X]+Hex[Y]);
	   END;
	 END;
       WriteLN(F, '</TABLE></FONT>'#13#10'</BODY>'#13#10'</HTML>'#13#10);
       Flush(F); Close(F);
     END
     ELSE WriteLN('Erreur en cr‚ation de fichier');
  END;

BEGIN
  IF (ParamStr(1) <> '') AND (Length(ParamStr(1)) = 2) AND
     (StrToIntDef(ParamStr(1), -1) IN [$0..$FF])
     THEN Main
     ELSE WriteLN('Une valeur hexa comprise entre 00 et FF est requise.');
END.

