示例#1
0
文件: doste.cpp 项目: knicos/Cadence
void cadence::doste::initialise(const OID &base, int n) {
        names = NEW Names;

	cadence::doste::OID rbase(base.a(),base.b(),0,0);
	cadence::doste::OID::local(rbase);

	Event::initialise();
	Processor::init(n);
	
	new cadence::doste::Processor();

	new VStore();
	new Number();
	root = OID::create(); //Make the root object.

	Event *evt = NEW Event(Event::ADD_REF, root);
	evt->send(Event::FLAG_FREE);

	//Now register the file objects
	//Object::registerType<File>();
	//Object::registerType<LocalFile>();

	#ifdef LINUX
	//pthread_attr_init(&pattr);
	//pthread_attr_setscope(&pattr, PTHREAD_SCOPE_SYSTEM);
	//pthread_attr_setdetachstate(&pattr, PTHREAD_CREATE_DETACHED);
	//One for each secondary processor that the system has.
	//for (int i=1; i<n; i++) {
	//	std::cout << "Making a processor\n";
	//	pthread_create(&thread[i-1], &pattr, thread_func, 0);
	//	usleep(10);
	//}
	//usleep(1000);
	//pthread_create(&thread2, &pattr, thread_func, 0);
	#endif
	
	//Now make the math functions
	root["math"] = OID::create();
	root["math"]["tan"] = OID(0,50,0,1);
	root["math"]["atan"] = OID(0,50,0,2);
	root["math"]["atan2"] = OID(0,50,0,3);
	root["math"]["sqrt"] = OID(0,50,0,4);
	root["math"]["sin"] = OID(0,50,0,5);
	root["math"]["cos"] = OID(0,50,0,6);
	root["math"]["_random"] = OID(0,50,0,7);
	//((OID)(root["math"])).function("random", OID(0,50,0,7)(Void));
	
	//Now create the builtin notations
	//doste::Object::registerType<DASMAgent>();
	//OID notations = OID::create();
	//root["notations"] = notations;
	//OID dasm = OID::create();
	//notations["dasm"] = dasm;
	//DASMAgent *dagent = NEW DASMAgent(dasm);
}