{
{ Create CTBETA out of CTABLE
{ CTBETA -- customer version
{ CTABLE -- internal version
{ original source is CTABLE
{ CTBETA is renamed to CTABLE for customers
{ CTABLE has compiler directives like this
{
{       {INTERNAL ONLY BEGIN}
{       {INTERNAL ONLY END}
{       {EXTERNAL VERSION
{
{ These directives (AND NO OTHERS) are interpreted by this program.
{ The compiler COULD produce CTBETA, but then the source would contain
{ stuff that a customer shouldn't see, so we use this program instead
{ to purify the source.
}

program xxx(input, output);

var
    inline: string[255];
    inname: string[255];
    outname: string[255];
    infile, outfile: text;
    passing: boolean;

begin
    write('name of CTABLE input file? ');
    readln(inname);
    reset(infile, inname);

    write('name of CTBETA output file? ');
    readln(outname);
    rewrite(outfile, outname);

    passing := true;

    while not eof(infile) do begin
	readln(infile, inline);
	inline := strrtrim(inline);
	if inline = '{INTERNAL ONLY BEGIN}' then
	    passing := false
	else
	if inline = '{INTERNAL ONLY END}' then
	    passing := true
	else
	if inline = '{EXTERNAL VERSION' then
	    passing := true
	else
	if passing then
	    writeln(outfile, inline);
    end;
    close(outfile, 'save');

end.

