//  main.c
//  Laser Tweezers host application, version 0.9.1 alpha
/*
 *  Shane Saxon has waived all copyright and related or neighboring rights to
 *  "miniTweezers GUI". Published from the United States as Public Domain.
 *  Creative Commons License CC0 1.0 Universal.
 *
 *  Created by Shane Saxon with contributions by Steven Smith, Evan Sperber,
 *  and Josep-Maria Huguet.  Code base started in 2004.
 *
 *  To view the full license with a list of additional authors and to download or
 *  contribute code goto http://tweezerslab.unipr.it/license.html
 *
 */

//#include "ltdata.h"					//in the prefix header for the lt project
//#include "ltcontrol.h"				//in the prefix header
#include "ltosx.h"						//OSX specific code, events, timers, NIB	
#include "ltposix.h"						//POSIX code for instrument USB serial IO
//#include "ltqt.h"
//#include "lthid.h"
#include "ltopengl.h"					//OpenGL windows, currently AGL


//////////////////////////////////////////////////
int main (int argc, char* argv[])
{	
	int err = 0;
	pData data = (pData) NewPtrClear (sizeof (Data));
	
	InitData (data);
	InitThreads (data);
	InitPosix (data);
	err = InitNib (data);
	require_noerr (err, CantInitNib);
	
	err = InitEvents (data);
	require_noerr (err, CantInitEvents);
	InitControl (data);	
	
	RunApplicationEventLoop();			//run main loop until program quits
	
//	CloseThreads (data);
	CloseEvents (data);
	CloseNib(data);   
	ClosePosix (data);
	
	CantInitNib:
	CantInitEvents:
	return err;
}