/*
 * [TestBatChars.java]
 *
 * Summary: Generate sample Btm files to figure out how to generate various glyphs.
 *
 * Copyright: (c) 2016-2017 Roedy Green, Canadian Mind Products, http://mindprod.com
 *
 * Licence: This software may be copied and used freely for any purpose but military.
 *          http://mindprod.com/contact/nonmil.html
 *
 * Requires: JDK 1.8+
 *
 * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/
 *
 * Version History:
 *  1.0 2016-08-24 initial version
 */
package com.mindprod.example;

import com.mindprod.common18.ST;
import com.mindprod.fastcat.FastCat;
import com.mindprod.hunkio.HunkIO;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;

/**
 * Generate sample Btm files to figure out how to generate various glyphs.
 *
 * @author Roedy Green, Canadian Mind Products
 * @version 1.0 2016-08-24 initial version
 * @since 2016-08-24
 */
public final class TestBatChars
    {
    private static void genBat( final String encoding ) throws IOException
        {
        final FastCat sb = new FastCat( ( 256 - 33 ) * 7 + 3 );
        sb.append( "@echo off\n" );
        sb.append( "@echo ", encoding, ".btm generated with encoding ", encoding, "\n" );
        for ( int i = 33; i < 256; i++ )
            {
            if ( i != 96 /* grave */ )
                {
                sb.append( "@echo \\u", ST.toLZHexString( i, 4 ), " ", i, " \"", ( char ) i, "\"\n" );
                }
            }
        sb.append( "rem -30-\n" );
        HunkIO.writeEntireFile( new File( "C:\\temp\\" + encoding + ".btm" ),
                sb.toString(),
                Charset.forName( encoding ) );
        }

    /**
     * Generate some test files in C:\temp
     *
     * @param args not used
     */
    public static void main( String[] args ) throws IOException
        {
        genBat( "IBM850" );
        genBat( "IBM437" );
        genBat( "windows-1252" );
        }
    }