\n/g;
return $_;
}
sub tqlayout
{ my ($Name, $Head, $Code, $Doku, $Dflt, $Attr) = @_;
if ($html)
{
print "
$Name\n";
if ($Attr eq '')
{
print " | $Head\n";
}
else
{
print " | $Head\n";
print " | $Attr\n";
}
if ($Code ne '')
{
my @Part = split('\|',$Code);
my $Type = $Part[0];
my $Indi = $#Part > 0 ? $Part[1] : "";
my $Parm = $#Part > 1 ? $Part[2] : "";
$Code = $Parm if $Type eq 'PRN';
$Code = $Indi if $Type eq 'CTL';
$Code = "ESC $Indi" if $Type eq 'ESC';
$Code = "0x7f" if $Type eq 'DEL';
$Code = "ESC # $Indi" if $Type eq 'HSH';
$Code = "ESC $Parm" if $Type eq 'SCS';
$Code = "ESC Y $Parm" if $Type eq 'VT5';
$Code = "ESC [ $Parm $Indi" if $Type eq 'CSI';
$Code = "ESC [ ? $Parm $Indi" if $Type eq 'PRI';
print " |
$Head\n";
foreach $p (sort keys %$t)
{
my @Fld = split('\.', $p);
if ($#Fld == 1 && $Fld[1] eq 'head')
{
my $name = $Fld[0];
my $head = $t->{$p};
my $attr = exists $t->{"$name.sect"}?$t->{"$name.sect"}:"";
if ($attr =~ /$Include/)
{
tqlayout2( $name, $head, exists $t->{"$name.code"}?$t->{"$name.code"}:"");
}
}
}
}
sub sortTest
{
my ($t) = @_;
my $p;
my $s = {};
my $n = {};
my $curr = "";
foreach $p (keys %$t)
{
my @Fld = split('\.', $p);
if ($#Fld == 1 && $Fld[1] eq 'head')
{
my $name = $Fld[0];
if (exists $t->{"$name.code"})
{
$s->{$t->{"$name.code"}} = $name;
}
}
}
print "\n";
foreach $p (sort keys %$s)
{
my $name = $s->{$p};
my @Fld = split('\|', $p);
if ($Fld[0] ne $curr)
{
print "$Fld[0] codes\n";
}
$curr = $Fld[0];
tqlayout2($name,$t->{"$name.head"},$p);
}
print " | \n";
}
sub htmlsect
{
my ($h) = @_;
$_ = $all->{"$h.html"};
s/\n \.\n/\n \n/g;
print "$_\n";
}
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# MAIN ------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
my $t = parse();
my $p;
my $table = 0;
# -------------------------------
htmlsect("Introduction");
# -------------------------------
secthead("Control Sequences");
htmlsect("Sequences");
# -------------------------------
secthead("Host to Terminal (Instructions by Code)");
sortTest($t);
# -------------------------------
secthead("Host to Terminal (Instructions by Group)");
htmlsect("Operations");
print " \n";
tqlayoutTable("Commands (Character Display Operation)",$t,"Command\.Display");
tqlayoutTable("Commands (Rendition related status)",$t,"Command\.RenderMode");
tqlayoutTable("Commands (Cursor)",$t,"Command\.Cursor");
tqlayoutTable("Commands (Cursor related status)",$t,"Command\.CursMode");
tqlayoutTable("Commands (Edit)",$t,"Command\.Erase|Command\.Insert|Command.\Delete");
tqlayoutTable("Commands (Miscellaneous)",$t,"Command[^.]|Command\$");
tqlayoutTable("Commands (General mode setting)",$t,"Command\.SetMode");
tqlayoutTable("Commands (Miscellaneous status)",$t,"Command\.Mode");
tqlayoutTable("Commands (VT52)",$t,"Command\.VT52");
tqlayoutTable("Commands (Not implemented)",$t,"Command\.NoImp");
tqlayoutTable("Commands (Ignored)",$t,"Command\.Ignored");
tqlayoutTable("Commands (Requests)",$t,"Command\.Request");
print " \n";
# -------------------------------
secthead("Terminal to Host");
print "\n";
tqlayoutTable("Replies",$t,"Reply");
tqlayoutTable("Events",$t,"Event");
# -------------------------------
print " \n";
secthead("Modes");
print "\n";
tqlayoutTable("Modes",$t,"Mode");
#print "Other Codes\n";
print " \n";
# -------------------------------
secthead("Appendix A - Notion Details");
htmlsect("ConceptDB");
# -------------------------------
head();
foreach $p (sort keys %$t)
{
my @Fld = split('\.', $p);
if ($#Fld == 1 && $Fld[1] eq 'head')
{
# print "\n" if ($table);
my $name = $Fld[0];
my $head = $t->{$p};
tqlayout( $name, $head,
exists $t->{"$name.code"}?$t->{"$name.code"}:"",
exists $t->{"$name.text"}?$t->{"$name.text"}:"",
exists $t->{"$name.dflt"}?$t->{"$name.dflt"}:"",
exists $t->{"$name.emus"}?$t->{"$name.emus"}:"" );
$table = 0;
}
if ($html && $#Fld == 2 && $Fld[1] eq 'table')
{
my $lines = $t->{$p};
my $line;
my $field;
my @fldspan = ();
my $ln = 0;
print " |