summaryrefslogtreecommitdiff
path: root/support/ltx2mathml/src/test.cpp
blob: 99b68a5d58f99dbfcbd06644b26f533f91f11829 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// 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;
}