/[svn]/linuxsampler/trunk/src/scriptvm/ScriptVM.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/ScriptVM.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2885 by schoenebeck, Fri Apr 22 15:37:45 2016 UTC revision 2965 by schoenebeck, Mon Jul 18 09:42:28 2016 UTC
# Line 14  Line 14 
14  #include "../common/global_private.h"  #include "../common/global_private.h"
15  #include "tree.h"  #include "tree.h"
16  #include "CoreVMFunctions.h"  #include "CoreVMFunctions.h"
17    #include "CoreVMDynVars.h"
18  #include "editor/NkspScanner.h"  #include "editor/NkspScanner.h"
19    
20  #define DEBUG_SCRIPTVM_CORE 0  #define DEBUG_SCRIPTVM_CORE 0
# Line 98  namespace LinuxSampler { Line 99  namespace LinuxSampler {
99          m_fnAbs = new CoreVMFunction_abs;          m_fnAbs = new CoreVMFunction_abs;
100          m_fnRandom = new CoreVMFunction_random;          m_fnRandom = new CoreVMFunction_random;
101          m_fnNumElements = new CoreVMFunction_num_elements;          m_fnNumElements = new CoreVMFunction_num_elements;
102            m_fnInc = new CoreVMFunction_inc;
103            m_fnDec = new CoreVMFunction_dec;
104            m_varRealTimer = new CoreVMDynVar_NKSP_REAL_TIMER;
105            m_varPerfTimer = new CoreVMDynVar_NKSP_PERF_TIMER;
106            m_fnShLeft = new CoreVMFunction_sh_left;
107            m_fnShRight = new CoreVMFunction_sh_right;
108      }      }
109    
110      ScriptVM::~ScriptVM() {      ScriptVM::~ScriptVM() {
# Line 107  namespace LinuxSampler { Line 114  namespace LinuxSampler {
114          delete m_fnAbs;          delete m_fnAbs;
115          delete m_fnRandom;          delete m_fnRandom;
116          delete m_fnNumElements;          delete m_fnNumElements;
117            delete m_fnInc;
118            delete m_fnDec;
119            delete m_fnShLeft;
120            delete m_fnShRight;
121            delete m_varRealTimer;
122            delete m_varPerfTimer;
123      }      }
124    
125      VMParserContext* ScriptVM::loadScript(const String& s) {      VMParserContext* ScriptVM::loadScript(const String& s) {
# Line 121  namespace LinuxSampler { Line 134  namespace LinuxSampler {
134          context->registerBuiltInConstIntVariables( builtInConstIntVariables() );          context->registerBuiltInConstIntVariables( builtInConstIntVariables() );
135          context->registerBuiltInIntVariables( builtInIntVariables() );          context->registerBuiltInIntVariables( builtInIntVariables() );
136          context->registerBuiltInIntArrayVariables( builtInIntArrayVariables() );          context->registerBuiltInIntArrayVariables( builtInIntArrayVariables() );
137            context->registerBuiltInDynVariables( builtInDynamicVariables() );
138    
139          context->createScanner(is);          context->createScanner(is);
140    
# Line 203  namespace LinuxSampler { Line 217  namespace LinuxSampler {
217          else if (name == "abs") return m_fnAbs;          else if (name == "abs") return m_fnAbs;
218          else if (name == "random") return m_fnRandom;          else if (name == "random") return m_fnRandom;
219          else if (name == "num_elements") return m_fnNumElements;          else if (name == "num_elements") return m_fnNumElements;
220            else if (name == "inc") return m_fnInc;
221            else if (name == "dec") return m_fnDec;
222            else if (name == "sh_left") return m_fnShLeft;
223            else if (name == "sh_right") return m_fnShRight;
224          return NULL;          return NULL;
225      }      }
226    
# Line 214  namespace LinuxSampler { Line 232  namespace LinuxSampler {
232          return std::map<String,VMInt8Array*>();          return std::map<String,VMInt8Array*>();
233      }      }
234    
235        std::map<String,VMDynVar*> ScriptVM::builtInDynamicVariables() {
236            std::map<String,VMDynVar*> m;
237    
238            m["$NKSP_PERF_TIMER"] = m_varPerfTimer;
239            m["$NKSP_REAL_TIMER"] = m_varRealTimer;
240            m["$KSP_TIMER"] = m_varRealTimer;
241    
242            return m;
243        }
244    
245      std::map<String,int> ScriptVM::builtInConstIntVariables() {      std::map<String,int> ScriptVM::builtInConstIntVariables() {
246          return std::map<String,int>();          std::map<String,int> m;
247    
248            m["$NI_CB_TYPE_INIT"] = VM_EVENT_HANDLER_INIT;
249            m["$NI_CB_TYPE_NOTE"] = VM_EVENT_HANDLER_NOTE;
250            m["$NI_CB_TYPE_RELEASE"] = VM_EVENT_HANDLER_RELEASE;
251            m["$NI_CB_TYPE_CONTROLLER"] = VM_EVENT_HANDLER_CONTROLLER;
252    
253            return m;
254      }      }
255    
256      VMEventHandler* ScriptVM::currentVMEventHandler() {      VMEventHandler* ScriptVM::currentVMEventHandler() {

Legend:
Removed from v.2885  
changed lines
  Added in v.2965

  ViewVC Help
Powered by ViewVC