// MergePLAs.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

using namespace std;

#include "../../Kernel/kernelincludes.h"

int main(int argc, char* argv[])
{
    PLA source1, source2;

	cerr << "MargePLAs 1.0, (c) December 2008 by Petr Fiser" << endl << endl;
    if ( argc != 4 ) {
		cout << "Syntax: MargePLAs source1.pla source2.pla dest.pla" << endl;
		exit(1);
    }

	try {
        source1.LoadPLA(argv[1]);
		source2.LoadPLA(argv[2]);
    } catch (IOException e) {
            cerr << e.GetMsg() << endl;
            exit(1);
    }

	if ( source1.getType().f != source2.getType().f || source1.getType().d != source2.getType().d || source1.getType().r != source2.getType().r ) {
		cout << "PLAs must be of the same type" << endl;
		exit(1);
	}
	source1.AppendPLA(&source2);

	source1.SavePLA(argv[3]);

    return 0;
}

