// testtex.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include "ltx2mathml.h"


int main()
{
    int index;
    char input[256];

    while (true)
    {
        printf("> ");

        if( !fgets(input, 255, stdin) ||  ('\n' == input[0]))
            break;
        else
        {
            if (convertFormula(input, -1, &index))// -1 indicates 'input' is null terminated
            {
                string result;

                if (getMathMLOutput(result, true))
                {
                    std::cout << result << std::endl;
                }
                else
                {
                    std::cout << "Input produced no output\n";
                }
            }
            else
            {
                std::cout << "[Index: " << index << "] " << getLastError() << std::endl;
            }
        }
    }
    return 0;
}
