#include <iostream>
#include <string>
#include <fstream>
#include "ccc_x11.h"

using namespace std;

void openfile(void);
Point do_vector(double, double);
Point do_move(double, double);
void do_range(ifstream &, double, double);

Point last;
ifstream plotin;

int ccc_win_main()
{
	string op;
	double x, y;

	openfile();
	while(plotin >> op >> x >> y) {
		if(op == "m") {
			last = do_move(x, y);
		}
		else if(op == "v") {
			last = do_vector(x, y);
		}
		else if(op == "ra") {
			do_range(plotin, x, y);
		}
	}
	
	plotin.close();
	return 0;
}

void
openfile(void)
{
	string filename;

	cout << "What file? ";
	cin >> filename;

	ifstream plotin(filename.c_str());
}

Point
do_vector(double a, double b)
{
	Point next(a, b);

	cwin << Line(last, next);
	return next;
}

Point
do_move(double x, double y)
{
	return Point(x, y);
}

void
do_range(ifstream &plotin, double x, double y)
{
	plotin >> x >> y;
}
