//==========================================================================//
// File:	RPL4MODE.CPP                                                       //
// Project: MUNGA           Brick: Controls Manager                         //
// Contents: Interface specification for BT LBE4 Controls                   //
//--------------------------------------------------------------------------//
//   Date    Who  Modification                                              //
// --------  ---  ----------------------------------------------------------//
// 03/08/96  CPB  Built from BTL4MODE.CPP                                   //
//--------------------------------------------------------------------------//
// Copyright (C) 1994-1996, Virtual World Entertainment, Inc.               //
// All Rights reserved worldwide                                            //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL              //
//==========================================================================//

#include <rpl4.hpp>
#pragma hdrstop

#if !defined(RPL4MODE_HPP)
#	include <rpl4mode.hpp>
#endif

#if defined(DEBUG)
#	define Test_Tell(n) DEBUG_STREAM << n
#else
#	define Test_Tell(n)
#endif

struct ModeLookup
{
	const char *name;
	ModeMask modeMask;
};

static ModeLookup
	mode_lookup[] =
	{
		{"ModeNonConfig",   RPL4ModeManager::ModeNonConfig},
		{"ModeConfigReady", RPL4ModeManager::ModeConfigReady},
		{"ModeConfigOn",    RPL4ModeManager::ModeConfigOn},
		{"ModePreset1",     RPL4ModeManager::ModePreset1},
		{"ModePreset2",     RPL4ModeManager::ModePreset2},
		{"ModePreset3",     RPL4ModeManager::ModePreset3},
		{"ModePreset4",     RPL4ModeManager::ModePreset4},
		{"ModePreset5",     RPL4ModeManager::ModePreset5},
		{"ModePreset6",     RPL4ModeManager::ModePreset6},
		{"ModeBasic",       RPL4ModeManager::ModeBasic},
		{"ModeStandard",    RPL4ModeManager::ModeStandard},
		{"ModeIntercom",    RPL4ModeManager::ModeIntercom},
		{"ModeConfiguring", RPL4ModeManager::ModeConfiguring},
		{ NULL, (ModeMask)0}
	};

Logical
	RPL4ModeManager::ModeStringLookup(
		const char *name,
		ModeMask *returned_value
	)
{
	Check(this);
	Check_Pointer(name); 
	Check_Pointer(returned_value); 
	//----------------------------------------
	// Search table for match
	//----------------------------------------
	ModeLookup
		*lookup;

	for(lookup=mode_lookup; lookup->name!=NULL; ++lookup)
	{
		if (stricmp(name, lookup->name) == 0)
		{
			*returned_value = lookup->modeMask;
			Check_Fpu();
			return True;
		}
	}
	//----------------------------------------
	// Not found here, check next level down.
	//----------------------------------------
	Check_Fpu();
	return ModeManager::ModeStringLookup(name, returned_value);
}


