1 //
2 // Copyright (c) 2010-2018 Antmicro
3 // Copyright (c) 2011-2015 Realtime Embedded
4 //
5 // This file is licensed under the MIT License.
6 // Full license text is available in 'licenses/MIT.txt'.
7 //
8 using System;
9 using Antmicro.Renode.Core;
10 
11 namespace Antmicro.Renode.Hooks
12 {
13     public static class UserStateHookExtensions
14     {
AddUserStateHook(this IMachine machine, string stateName, string pythonScript)15         public static void AddUserStateHook(this IMachine machine, string stateName, string pythonScript)
16         {
17             var engine = new UserStatePythonEngine(machine, pythonScript);
18             machine.AddUserStateHook(x => x == stateName, engine.Hook);
19         }
20     }
21 }
22 
23