Exemple #1
0
        public void RaiseException()
        {
            IntPtr error = IntPtr.Zero;

            VlScriptHeader.VlsGetLastHostError(this.host, out error);
            throw new InvalidOperationException(Marshal.PtrToStringUni(error));
        }
Exemple #2
0
 public void InstallAssembly(VlsAssembly assembly)
 {
     if (VlScriptHeader.VlsLoadAssembly(this.host, assembly.assembly) == VlScriptHeader.VLS_ERR)
     {
         RaiseException();
     }
 }
Exemple #3
0
 public void InstallCoreNativePlugin()
 {
     if (VlScriptHeader.VlsLoadPlugin_CoreNative(this.host) == VlScriptHeader.VLS_ERR)
     {
         RaiseException();
     }
 }
Exemple #4
0
 public void PrepareToCall(VlsBasicFunction function, IntPtr resultAddress)
 {
     if (VlScriptHeader.VlsSetFunction(this.state, function.Assembly.assembly, function.Entry, resultAddress) == VlScriptHeader.VLS_ERR)
     {
         this.host.RaiseException();
     }
 }
Exemple #5
0
 public void Call()
 {
     if (VlScriptHeader.VlsExecute(this.state) == VlScriptHeader.VLS_ERR)
     {
         this.host.RaiseException();
     }
 }
Exemple #6
0
 public void PushParameter(IntPtr data, int size)
 {
     if (VlScriptHeader.VlsPush(this.state, data, size) == VlScriptHeader.VLS_ERR)
     {
         this.host.RaiseException();
     }
 }
Exemple #7
0
 public void InitializeInstalledAssembly(VlsAssembly assembly)
 {
     if (VlScriptHeader.VlsInitAssembly(this.state, assembly.assembly) == VlScriptHeader.VLS_ERR)
     {
         this.host.RaiseException();
     }
 }
Exemple #8
0
 public void InstallUnitTestNativePlugin(UnitTestPrinter printer)
 {
     if (VlScriptHeader.VlsLoadPlugin_UnitTestNative(this.host,
                                                     new VlScriptHeader.VlsUnitTestPrinter(printer)
                                                     ) == VlScriptHeader.VLS_ERR)
     {
         RaiseException();
     }
 }
Exemple #9
0
 public void InstallConsoleNativePlugin(ConsoleReader reader, ConsoleWriter writer)
 {
     if (VlScriptHeader.VlsLoadPlugin_ConsoleNative(this.host,
                                                    new VlScriptHeader.VlsConsoleReader(reader),
                                                    new VlScriptHeader.VlsConsoleWriter(writer)
                                                    ) == VlScriptHeader.VLS_ERR)
     {
         RaiseException();
     }
 }
Exemple #10
0
 public VlsState(VlsHost host)
 {
     if (VlScriptHeader.VlsCreateState(host.host, out this.state) == VlScriptHeader.VLS_ERR)
     {
         host.RaiseException();
     }
     else
     {
         this.host = host;
     }
 }
Exemple #11
0
 public VlsHost(int stackSize)
 {
     if (MinStackSize > stackSize || stackSize > MaxStackSize)
     {
         throw new InvalidOperationException("Stack size out of range.");
     }
     else if (VlScriptHeader.VlsCreateHost(out this.host, stackSize) == VlScriptHeader.VLS_ERR)
     {
         throw new InvalidOperationException("Fail to create host.");
     }
 }
Exemple #12
0
 public VlsAssembly(VlsHost host, string fileName)
 {
     if (VlScriptHeader.VlsCreateAssemblyFromFile(host.host, fileName, out this.assembly) == VlScriptHeader.VLS_ERR)
     {
         host.RaiseException();
     }
     else
     {
         this.host           = host;
         this.BasicFunctions = new VlsBasicFunctionList(this);
     }
 }
Exemple #13
0
 public void RegisterForeignFunction(string category, string name, ForeignFunction function, IntPtr userData)
 {
     VlScriptHeader.VlsForeignFunction foreignFunction = new VlScriptHeader.VlsForeignFunction(function);
     if (VlScriptHeader.VlsRegisterForeignFunction(host, category, name,
                                                   foreignFunction,
                                                   userData) == VlScriptHeader.VLS_ERR)
     {
         RaiseException();
     }
     else
     {
         this.registeredForeignFunctions.Add(foreignFunction);
     }
 }
 public VlsBasicFunction this[int index]
 {
     get
     {
         IntPtr name  = IntPtr.Zero;
         int    entry = 0;
         if (VlScriptHeader.VlsGetBasicFunctionName(this.assembly.assembly, index, out name) == VlScriptHeader.VLS_ERR)
         {
             this.assembly.host.RaiseException();
         }
         if (VlScriptHeader.VlsGetBasicFunctionEntry(this.assembly.assembly, index, out entry) == VlScriptHeader.VLS_ERR)
         {
             this.assembly.host.RaiseException();
         }
         return(new VlsBasicFunction()
         {
             Name = Marshal.PtrToStringUni(name),
             Entry = entry,
             Assembly = this.assembly
         });
     }
 }
Exemple #15
0
 public void Dispose()
 {
     VlScriptHeader.VlsDisposeState(this.state);
 }
Exemple #16
0
 public void Dispose()
 {
     VlScriptHeader.VlsDisposeAssembly(this.assembly);
 }
Exemple #17
0
 public void Dispose()
 {
     VlScriptHeader.VlsDisposeHost(this.host);
 }