/[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 2594 by schoenebeck, Thu Jun 5 00:16:25 2014 UTC revision 2619 by schoenebeck, Wed Jun 11 13:24:32 2014 UTC
# Line 10  Line 10 
10  #include "ScriptVM.h"  #include "ScriptVM.h"
11    
12  #include <string.h>  #include <string.h>
13    #include <assert.h>
14  #include "../common/global_private.h"  #include "../common/global_private.h"
15  #include "tree.h"  #include "tree.h"
16    
# Line 110  namespace LinuxSampler { Line 111  namespace LinuxSampler {
111          context->createScanner(is);          context->createScanner(is);
112    
113          InstrScript_parse(context);          InstrScript_parse(context);
114          std::cout << "Allocating " << context->globalIntVarCount * sizeof(int) << " bytes of global int VM memory.\n";          dmsg(2,("Allocating %d bytes of global int VM memory.\n", context->globalIntVarCount * sizeof(int)));
115          std::cout << "Allocating " << context->globalStrVarCount << " of global VM string variables.\n";          dmsg(2,("Allocating %d of global VM string variables.\n", context->globalStrVarCount));
116          if (!context->globalIntMemory)          if (!context->globalIntMemory)
117              context->globalIntMemory = new ArrayList<int>();              context->globalIntMemory = new ArrayList<int>();
118          if (!context->globalStrMemory)          if (!context->globalStrMemory)
# Line 152  namespace LinuxSampler { Line 153  namespace LinuxSampler {
153                  _requiredMaxStackSizeFor(&*parserCtx->handlers);                  _requiredMaxStackSizeFor(&*parserCtx->handlers);
154          }          }
155          execCtx->stack.resize(parserCtx->requiredMaxStackSize);          execCtx->stack.resize(parserCtx->requiredMaxStackSize);
156          std::cout << "Created VM exec context with "          dmsg(2,("Created VM exec context with %d bytes VM stack size.\n",
157                    << parserCtx->requiredMaxStackSize * sizeof(ExecContext::StackFrame)                  parserCtx->requiredMaxStackSize * sizeof(ExecContext::StackFrame)));
                   << " bytes VM stack size.\n";  
158          //printf("execCtx=0x%lx\n", (uint64_t)execCtx);          //printf("execCtx=0x%lx\n", (uint64_t)execCtx);
159          const int polySize = parserCtx->polyphonicIntVarCount;          const int polySize = parserCtx->polyphonicIntVarCount;
160          execCtx->polyphonicIntMemory.resize(polySize);          execCtx->polyphonicIntMemory.resize(polySize);
161          memset(&execCtx->polyphonicIntMemory[0], 0, polySize * sizeof(int));          memset(&execCtx->polyphonicIntMemory[0], 0, polySize * sizeof(int));
162    
163          std::cout << "Allocated " << polySize * sizeof(int)          dmsg(2,("Allocated %d bytes polyphonic memory.\n", polySize * sizeof(int)));
                   << " bytes polyphonic memory.\n";  
164          return execCtx;          return execCtx;
165      }      }
166    
# Line 169  namespace LinuxSampler { Line 168  namespace LinuxSampler {
168          if (name == "message") return &fnMessage;          if (name == "message") return &fnMessage;
169          else if (name == "exit") return &fnExit;          else if (name == "exit") return &fnExit;
170          else if (name == "wait") return &fnWait;          else if (name == "wait") return &fnWait;
171            else if (name == "abs") return &fnAbs;
172            else if (name == "random") return &fnRandom;
173            else if (name == "num_elements") return &fnNumElements;
174          return NULL;          return NULL;
175      }      }
176    
# Line 200  namespace LinuxSampler { Line 202  namespace LinuxSampler {
202              return VMExecStatus_t(VM_EXEC_NOT_RUNNING | VM_EXEC_ERROR);              return VMExecStatus_t(VM_EXEC_NOT_RUNNING | VM_EXEC_ERROR);
203          }          }
204    
205            // a ParserContext object is always tied to exactly one ScriptVM object
206            assert(m_parserContext->functionProvider == this);
207    
208          ExecContext* ctx = dynamic_cast<ExecContext*>(execContex);          ExecContext* ctx = dynamic_cast<ExecContext*>(execContex);
209          if (!ctx) {          if (!ctx) {
210              std::cerr << "Invalid VM exec context.\n";              std::cerr << "Invalid VM exec context.\n";

Legend:
Removed from v.2594  
changed lines
  Added in v.2619

  ViewVC Help
Powered by ViewVC