File:  [Isaki's NoNo m68k/m88k emulator] / nono / vm / event.cpp
Revision 1.1.1.10 (vendor branch): download - view: text, annotated - select for diffs
Wed Apr 29 17:05:50 2026 UTC (2 months, 3 weeks ago) by root
Branches: MAIN, Isaki
CVS tags: v027, v026, v025, HEAD
nono 1.5.0

//
// nono
// Copyright (C) 2020 nono project
// Licensed under nono-license.txt
//

//
// イベント
//

#include "event.h"
#include "scheduler.h"

// コンストラクタ
Event::Event(Device *dev_, int code_,
	EventCallback_t func_, const std::string& name_)
{
	dev = dev_;
	code = code_;
	func = func_;
	name = name_;
}

// デストラクタ
Event::~Event()
{
}

// 名前をセットする
void
Event::SetName(const std::string& val)
{
	name = val;
	if (name.length() > 25) {
		dev->putmsgn("Event Name \"%s\" is too long(%u chars)",
			name.c_str(), (uint)name.length());
		name.resize(25);
	}
}


//
// イベントマネージャ
//

// コンストラクタ
EventManager::EventManager()
	: inherited(OBJ_EVENT_MANAGER)
{
}

// デストラクタ
EventManager::~EventManager()
{
}

// イベントを登録する。
// こっちは初期設定のほう。イベントを有効にする、ではない。
Event *
EventManager::Regist(Device *dev_, int code_,
	EventCallback_t func_, const std::string& name_)
{
	all.push_back(new Event(dev_, code_, func_, name_));
	return all.back();
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.