├── tests
├── start.cmd
├── start-all.cmd
├── example-test.os
├── readme.md
├── socket.os
├── values-test.os
├── reflector.os
├── text-write.os
├── http.os
├── sysinfo.os
├── binarydata.os
├── random.os
├── file-object.os
├── xmlwrite.os
└── engine-behaviors.os
├── install
├── setlocals.cmd
├── vcredist_x86.exe
├── dotNetFx40_Full_setup.exe
└── build.cmd
├── src
├── TestApp
│ ├── script_badge.ico
│ ├── Resources
│ │ └── module_icons.png
│ ├── packages.config
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── Settings.Designer.cs
│ │ ├── AssemblyInfo.cs
│ │ └── Resources.Designer.cs
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── MainWindow.xaml
│ └── Controls
│ │ └── ProcedureListWnd.xaml
├── ScriptEngine.Snegopat
│ ├── app.ico
│ ├── app.rc
│ ├── Snegopat.idl
│ ├── resource.h
│ ├── snegopat.cpp
│ ├── IAddinImpl.cpp
│ ├── IAddinLoaderImpl.cpp
│ ├── SnegAPIDefinitions.h
│ ├── LibraryAttachedContext.cpp
│ ├── SnegopatAttachedContext.cpp
│ ├── MarshalingHelpers.h
│ ├── Stdafx.h
│ ├── Stdafx.cpp
│ ├── RefCountable.h
│ ├── DispatchHelpers.h
│ ├── clrfactory.cpp
│ ├── MarshalingHelpers.cpp
│ ├── CriticalResourceLoader.h
│ ├── RefCountable.cpp
│ ├── EventCallableSDO.h
│ ├── ScriptDrivenAddin.h
│ ├── AssemblyInfo.cpp
│ ├── ScriptDrivenAddin.cpp
│ ├── IAddinImpl.h
│ ├── CriticalResourceLoader.cpp
│ ├── ReadMe.txt
│ ├── LibraryAttachedContext.h
│ ├── EventCallableSDO.cpp
│ ├── IAddinLoaderImpl.h
│ └── SnegopatAttachedContext.h
├── packages
│ ├── DotNetZip.1.9.3
│ │ ├── DotNetZip.1.9.3.nupkg
│ │ └── lib
│ │ │ └── net20
│ │ │ └── Ionic.Zip.dll
│ ├── AvalonEdit.4.4.2.9744
│ │ ├── AvalonEdit.4.4.2.9744.nupkg
│ │ ├── lib
│ │ │ ├── Net35
│ │ │ │ └── ICSharpCode.AvalonEdit.dll
│ │ │ └── Net40
│ │ │ │ └── ICSharpCode.AvalonEdit.dll
│ │ └── AvalonEdit.4.4.2.9744.nuspec
│ └── repositories.config
├── ScriptEngine.HostedScript
│ ├── packages.config
│ ├── IHostApplication.cs
│ ├── Library
│ │ ├── ValueTable
│ │ │ ├── ValueTableIndex.cs
│ │ │ ├── CollectionIndexes.cs
│ │ │ └── ValueTableColumn.cs
│ │ ├── Http
│ │ │ ├── HttpRequestBody.cs
│ │ │ ├── HttpRequestBodyUnknown.cs
│ │ │ ├── HttpRequestBodyBinary.cs
│ │ │ ├── HttpRequestBodyFile.cs
│ │ │ └── HttpRequestBodyString.cs
│ │ ├── CLREnumValueWrapper.cs
│ │ ├── MiscGlobalFunctions.cs
│ │ ├── KeyAndValueImpl.cs
│ │ ├── StdTextWriteStream.cs
│ │ ├── Net
│ │ │ └── TCPServer.cs
│ │ ├── StdTextReadStream.cs
│ │ ├── Zip
│ │ │ ├── ZipCompressionMethodEnum.cs
│ │ │ ├── ZIPSubDirProcessingModeEnum.cs
│ │ │ ├── ZipRestoreFilePathsModeEnum.cs
│ │ │ ├── ZipStorePathModeEnum.cs
│ │ │ ├── ZipCompressionLevelEnum.cs
│ │ │ ├── ZipFileEntriesCollection.cs
│ │ │ └── ZipEncryptionMethodEnum.cs
│ │ ├── BinaryDataContext.cs
│ │ ├── Reflector.cs
│ │ ├── SymbolsEnum.cs
│ │ ├── RandomNumberGenerator.cs
│ │ ├── GuidWrapper.cs
│ │ ├── TextReadImpl.cs
│ │ ├── Xml
│ │ │ └── XmlGlobalFunctions.cs
│ │ └── MapImpl.cs
│ ├── Process.cs
│ └── Properties
│ │ └── AssemblyInfo.cs
├── ScriptEngine
│ ├── Machine
│ │ ├── Contexts
│ │ │ ├── IObjectWrapper.cs
│ │ │ ├── ICollectionContext.cs
│ │ │ ├── SelfAwareEnumValue.cs
│ │ │ ├── GlobalContextAttribute.cs
│ │ │ ├── EnumValueAttribute.cs
│ │ │ ├── ContextClassAttribute.cs
│ │ │ ├── SystemEnumAttribute.cs
│ │ │ ├── LibraryContextBase.cs
│ │ │ ├── ReflectedParamInfo.cs
│ │ │ ├── ScriptInformationContext.cs
│ │ │ ├── EnumContextHelper.cs
│ │ │ ├── PropertyNameIndexAccessor.cs
│ │ │ ├── DynamicPropertiesHolder.cs
│ │ │ ├── SafeArrayWrapper.cs
│ │ │ ├── EnumerationContext.cs
│ │ │ ├── EnumerationValue.cs
│ │ │ ├── DynamicPropertiesAccessor.cs
│ │ │ ├── ExceptionInfoContext.cs
│ │ │ ├── CollectionEnumerator.cs
│ │ │ └── UserScriptContextInstance.cs
│ │ ├── IReflectableContext.cs
│ │ ├── Scope.cs
│ │ ├── IAttachableContext.cs
│ │ ├── ExecutionFrame.cs
│ │ ├── IValue.cs
│ │ ├── GenericIValueComparer.cs
│ │ ├── IRuntimeContextInstance.cs
│ │ ├── GlobalInstancesManager.cs
│ │ ├── NullValueImpl.cs
│ │ ├── LoadedModule.cs
│ │ ├── TypeTypeValue.cs
│ │ └── PropertyBag.cs
│ ├── Compiler
│ │ ├── ParserException.cs
│ │ ├── ICompilerContext.cs
│ │ ├── SourceCodeIndexer.cs
│ │ └── ModulePersistor.cs
│ ├── Environment
│ │ ├── ICodeSourceFactory.cs
│ │ ├── ScriptModuleHandle.cs
│ │ ├── ICodeSource.cs
│ │ ├── ModuleInformation.cs
│ │ ├── ScriptSourceFactory.cs
│ │ ├── CodeSources.cs
│ │ └── FileOpener.cs
│ ├── CodePositionInfo.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ModuleImage.cs
│ ├── Utils.cs
│ ├── ScriptException.cs
│ └── RuntimeEnvironment.cs
├── oscript
│ ├── AppBehavior.cs
│ ├── MeasureBehavior.cs
│ ├── ShowCompiledBehavior.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── ShowUsageBehavior.cs
│ ├── MakeAppBehavior.cs
│ ├── BehaviorSelector.cs
│ └── ExecuteScriptBehavior.cs
├── StandaloneRunner
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Program.cs
└── GlobalAssemblyInfo.cs
├── dist.cmd
├── README.md
└── .gitignore
/tests/start.cmd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/tests/start.cmd
--------------------------------------------------------------------------------
/tests/start-all.cmd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/tests/start-all.cmd
--------------------------------------------------------------------------------
/install/setlocals.cmd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/install/setlocals.cmd
--------------------------------------------------------------------------------
/install/vcredist_x86.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/install/vcredist_x86.exe
--------------------------------------------------------------------------------
/src/TestApp/script_badge.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/TestApp/script_badge.ico
--------------------------------------------------------------------------------
/install/dotNetFx40_Full_setup.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/install/dotNetFx40_Full_setup.exe
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/ScriptEngine.Snegopat/app.ico
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/app.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/ScriptEngine.Snegopat/app.rc
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/Snegopat.idl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/ScriptEngine.Snegopat/Snegopat.idl
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/ScriptEngine.Snegopat/resource.h
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/snegopat.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/ScriptEngine.Snegopat/snegopat.cpp
--------------------------------------------------------------------------------
/src/TestApp/Resources/module_icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/TestApp/Resources/module_icons.png
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/IAddinImpl.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/ScriptEngine.Snegopat/IAddinImpl.cpp
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/IAddinLoaderImpl.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/ScriptEngine.Snegopat/IAddinLoaderImpl.cpp
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/SnegAPIDefinitions.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/ScriptEngine.Snegopat/SnegAPIDefinitions.h
--------------------------------------------------------------------------------
/src/packages/DotNetZip.1.9.3/DotNetZip.1.9.3.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/packages/DotNetZip.1.9.3/DotNetZip.1.9.3.nupkg
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/LibraryAttachedContext.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/ScriptEngine.Snegopat/LibraryAttachedContext.cpp
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/SnegopatAttachedContext.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/ScriptEngine.Snegopat/SnegopatAttachedContext.cpp
--------------------------------------------------------------------------------
/src/packages/DotNetZip.1.9.3/lib/net20/Ionic.Zip.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/packages/DotNetZip.1.9.3/lib/net20/Ionic.Zip.dll
--------------------------------------------------------------------------------
/src/TestApp/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/ScriptEngine.HostedScript/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/MarshalingHelpers.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | WCHAR* stringBuf(System::String^ str);
6 |
7 | BSTR stringToBSTR(System::String^ str);
8 |
--------------------------------------------------------------------------------
/src/packages/AvalonEdit.4.4.2.9744/AvalonEdit.4.4.2.9744.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/packages/AvalonEdit.4.4.2.9744/AvalonEdit.4.4.2.9744.nupkg
--------------------------------------------------------------------------------
/src/packages/AvalonEdit.4.4.2.9744/lib/Net35/ICSharpCode.AvalonEdit.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/packages/AvalonEdit.4.4.2.9744/lib/Net35/ICSharpCode.AvalonEdit.dll
--------------------------------------------------------------------------------
/src/packages/AvalonEdit.4.4.2.9744/lib/Net40/ICSharpCode.AvalonEdit.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xDrivenDevelopment/1script/HEAD/src/packages/AvalonEdit.4.4.2.9744/lib/Net40/ICSharpCode.AvalonEdit.dll
--------------------------------------------------------------------------------
/dist.cmd:
--------------------------------------------------------------------------------
1 | @echo Full distr and tests
2 | @echo add MSBuild 12 to your path
3 |
4 | MSBuild.exe ./BuildAll.csproj
5 | MSBuild.exe ./BuildAll.csproj /t:CreateZipForUpdateDll
6 | MSBuild.exe ./BuildAll.csproj /t:xUnitTest
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/Contexts/IObjectWrapper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | namespace ScriptEngine.Machine.Contexts
3 | {
4 | public interface IObjectWrapper
5 | {
6 | object UnderlyingObject { get; }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/Stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently,
3 | // but are changed infrequently
4 |
5 | #pragma once
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/packages/repositories.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/TestApp/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/Stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // ScriptEngine.Snegopat.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
--------------------------------------------------------------------------------
/src/oscript/AppBehavior.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace oscript
7 | {
8 | abstract class AppBehavior
9 | {
10 | public abstract int Execute();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Compiler/ParserException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ScriptEngine.Compiler
4 | {
5 | public class ParserException : ScriptException
6 | {
7 | internal ParserException(CodePositionInfo posInfo, string message)
8 | :base(posInfo, message)
9 | {
10 | }
11 |
12 | }
13 | }
--------------------------------------------------------------------------------
/src/TestApp/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Environment/ICodeSourceFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Environment
7 | {
8 | public interface ICodeSourceFactory
9 | {
10 | ICodeSource FromFile(string path);
11 | ICodeSource FromString(string code);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Environment/ScriptModuleHandle.cs:
--------------------------------------------------------------------------------
1 | using ScriptEngine.Machine;
2 |
3 | namespace ScriptEngine.Environment
4 | {
5 | public struct ScriptModuleHandle
6 | {
7 | internal ModuleImage Module { get; set; }
8 | }
9 |
10 | public struct LoadedModuleHandle
11 | {
12 | internal LoadedModule Module { get; set; }
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/Contexts/ICollectionContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Machine.Contexts
7 | {
8 | public interface ICollectionContext : IEnumerable
9 | {
10 | int Count();
11 | CollectionEnumerator GetManagedIterator();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/TestApp/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace TestApp
9 | {
10 | ///
11 | /// Interaction logic for App.xaml
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/ScriptEngine/CodePositionInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine
7 | {
8 | class CodePositionInfo
9 | {
10 | public string ModuleName { get; set; }
11 | public int LineNumber { get; set; }
12 | public string Code { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/IReflectableContext.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using ScriptEngine.Compiler;
3 | using ScriptEngine.Machine;
4 |
5 | namespace ScriptEngine.Machine
6 | {
7 | public interface IReflectableContext
8 | {
9 | IEnumerable GetProperties();
10 | IEnumerable GetMethods();
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/Scope.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Machine
7 | {
8 | struct Scope
9 | {
10 | public IVariable[] Variables;
11 | public MethodInfo[] Methods;
12 | public IRuntimeContextInstance Instance;
13 | public bool Detachable;
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/Contexts/SelfAwareEnumValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Machine.Contexts
7 | {
8 | public class SelfAwareEnumValue : EnumerationValue where TOwner : EnumerationContext
9 | {
10 | public SelfAwareEnumValue(TOwner owner) : base(owner)
11 | {
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/RefCountable.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Snegopat_h.h"
3 |
4 | class RefCountable
5 | {
6 | private:
7 | ULONG m_refCount;
8 |
9 | protected:
10 |
11 | virtual void OnZeroCount();
12 |
13 | public:
14 |
15 | RefCountable(void);
16 | virtual ~RefCountable(void);
17 |
18 | virtual ULONG __stdcall AddRef();
19 | virtual ULONG __stdcall Release();
20 |
21 | };
22 |
23 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Environment/ICodeSource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using ScriptEngine.Machine;
6 | using ScriptEngine.Machine.Contexts;
7 |
8 | namespace ScriptEngine.Environment
9 | {
10 | public interface ICodeSource
11 | {
12 | string Code { get; }
13 | string SourceDescription { get; }
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/DispatchHelpers.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | HRESULT invoke(LPDISPATCH pdisp,
6 | WORD wFlags,
7 | LPVARIANT pvRet,
8 | ::EXCEPINFO FAR* pexcepinfo,
9 | UINT FAR* pnArgErr,
10 | LPOLESTR pszName,
11 | LPCTSTR pszFmt,
12 | ...);
13 |
14 | LPCTSTR getNextVarType(LPCTSTR pszFmt, VARTYPE FAR* pvt);
15 |
16 | HRESULT countArgsInFormat(LPCTSTR pszFmt, UINT FAR *pn);
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/Contexts/GlobalContextAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Machine.Contexts
7 | {
8 | [AttributeUsage(AttributeTargets.Class)]
9 | public class GlobalContextAttribute : Attribute
10 | {
11 | public string Category { get; set; }
12 | public bool ManualRegistration { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Environment/ModuleInformation.cs:
--------------------------------------------------------------------------------
1 | using ScriptEngine.Compiler;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace ScriptEngine.Environment
8 | {
9 | class ModuleInformation
10 | {
11 | public string ModuleName { get; set; }
12 | public SourceCodeIndexer CodeIndexer { get; set; }
13 | public string Origin { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/ScriptEngine.HostedScript/IHostApplication.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.HostedScript
7 | {
8 | public interface IHostApplication
9 | {
10 | void Echo(string str);
11 | void ShowExceptionInfo(Exception exc);
12 | bool InputString(out string result, int maxLen);
13 | string[] GetCommandLineArguments();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/ScriptEngine.HostedScript/Library/ValueTable/ValueTableIndex.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using ScriptEngine.Machine.Contexts;
6 | using ScriptEngine.Machine;
7 |
8 | namespace ScriptEngine.HostedScript.Library.ValueTable
9 | {
10 | [ContextClass("ИндексКоллекции", "CollectionIndex")]
11 | class CollectionIndex : AutoContext
12 | {
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/IAttachableContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Machine
7 | {
8 | public interface IAttachableContext : IReflectableContext
9 | {
10 | void OnAttach(MachineInstance machine,
11 | out IVariable[] variables,
12 | out MethodInfo[] methods,
13 | out IRuntimeContextInstance instance);
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/ScriptEngine.HostedScript/Library/Http/HttpRequestBody.cs:
--------------------------------------------------------------------------------
1 | using ScriptEngine.Machine;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 |
8 | namespace ScriptEngine.HostedScript.Library.Http
9 | {
10 | interface IHttpRequestBody : IDisposable
11 | {
12 | IValue GetAsString();
13 | IValue GetAsBinary();
14 | IValue GetAsFilename();
15 |
16 | Stream GetDataStream();
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/clrfactory.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include
3 | #include
4 |
5 | #include "CriticalResourceLoader.h"
6 |
7 | gcroot g_ResLoader;
8 |
9 | void InitLibrary(HMODULE module)
10 | {
11 | g_ResLoader = gcnew CriticalResourceLoader(module);
12 | }
13 |
14 | IUnknown* GetLoader(IDispatch* pDesigner)
15 | {
16 | return g_ResLoader->GetLoader(pDesigner);
17 | }
18 |
19 | bool PrepareTypeInfo()
20 | {
21 | return g_ResLoader->PrepareTypeInfo();
22 | }
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/MarshalingHelpers.cpp:
--------------------------------------------------------------------------------
1 | #include "Stdafx.h"
2 | #include "MarshalingHelpers.h"
3 |
4 | WCHAR* stringBuf(System::String^ str)
5 | {
6 | int len = str->Length;
7 | WCHAR* buf = new WCHAR[len+1];
8 | memset(buf, 0, (len+1) * sizeof(WCHAR));
9 | for(int i = 0; i < len; i++)
10 | {
11 | buf[i] = str[i];
12 | }
13 |
14 | return buf;
15 | }
16 |
17 | BSTR stringToBSTR(System::String^ str)
18 | {
19 | WCHAR* buf = stringBuf(str);
20 | BSTR ret = SysAllocString(buf);
21 | delete[] buf;
22 |
23 | return ret;
24 | }
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/ExecutionFrame.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Machine
7 | {
8 | class ExecutionFrame
9 | {
10 | public IVariable[] Locals;
11 | public int InstructionPointer;
12 | public int LineNumber;
13 | public bool DiscardReturnValue;
14 | public string MethodName;
15 | public RuntimeException LastException;
16 |
17 | public Stack LocalFrameStack = new Stack();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/Contexts/EnumValueAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Machine.Contexts
7 | {
8 | [AttributeUsage(AttributeTargets.Property)]
9 | public class EnumValueAttribute : Attribute
10 | {
11 | string _name;
12 |
13 | public EnumValueAttribute(string name)
14 | {
15 | _name = name;
16 | }
17 |
18 | public string GetName()
19 | {
20 | return _name;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/IValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Machine
7 | {
8 | public interface IValue : IComparable, IEquatable
9 | {
10 | DataType DataType { get; }
11 | TypeDescriptor SystemType { get; }
12 |
13 | decimal AsNumber();
14 | DateTime AsDate();
15 | bool AsBoolean();
16 | string AsString();
17 | IRuntimeContextInstance AsObject();
18 | IValue GetRawValue();
19 |
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/CriticalResourceLoader.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "StdAfx.h"
3 | #include
4 | #include "IAddinImpl.h"
5 | #include "IAddinLoaderImpl.h"
6 |
7 | using namespace System;
8 |
9 | ref class CriticalResourceLoader
10 | {
11 | private:
12 | HMODULE m_module;
13 | WCHAR* m_modulePath;
14 |
15 | Reflection::Assembly^ DependencyHandler(Object^ sender, ResolveEventArgs^ args);
16 |
17 | public:
18 | CriticalResourceLoader(HMODULE);
19 | bool PrepareTypeInfo();
20 | IUnknown* GetLoader(IDispatch* pDesigner);
21 | ~CriticalResourceLoader(void);
22 | };
23 |
24 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Environment/ScriptSourceFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using ScriptEngine.Compiler;
6 |
7 | namespace ScriptEngine.Environment
8 | {
9 | class ScriptSourceFactory : ICodeSourceFactory
10 | {
11 | public ICodeSource FromString(string source)
12 | {
13 | return new StringBasedSource(source);
14 | }
15 |
16 | public ICodeSource FromFile(string path)
17 | {
18 | return new FileBasedSource(path);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/GenericIValueComparer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using ScriptEngine.Machine.Contexts;
6 |
7 | namespace ScriptEngine.Machine
8 | {
9 | public class GenericIValueComparer : IEqualityComparer
10 | {
11 |
12 | public bool Equals(IValue x, IValue y)
13 | {
14 | return x.Equals(y);
15 | }
16 |
17 | public int GetHashCode(IValue obj)
18 | {
19 | var CLR_obj = ContextValuesMarshaller.ConvertToCLRObject(obj);
20 | return CLR_obj.GetHashCode();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/example-test.os:
--------------------------------------------------------------------------------
1 | Перем юТест;
2 |
3 | Функция Версия() Экспорт
4 | Возврат "0.1";
5 | КонецФункции
6 |
7 | Функция ПолучитьСписокТестов(ЮнитТестирование) Экспорт
8 |
9 | юТест = ЮнитТестирование;
10 |
11 | ВсеТесты = Новый Массив;
12 |
13 | ВсеТесты.Добавить("ТестДолжен_ПроверитьВерсию");
14 | //ВсеТесты.Добавить("НесуществующийМетод");
15 | // ВсеТесты.Добавить("МетодОшибка");
16 |
17 | Возврат ВсеТесты;
18 | КонецФункции
19 |
20 | Процедура ТестДолжен_ПроверитьВерсию() Экспорт
21 | юТест.ПроверитьРавенство("0.1", Версия());
22 | КонецПроцедуры
23 |
24 | // Процедура МетодОшибка() Экспорт
25 | // юТест.ПроверитьРавенство(1,2);
26 | // КонецПроцедуры
27 |
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/RefCountable.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "RefCountable.h"
3 |
4 | RefCountable::RefCountable(void)
5 | {
6 | m_refCount = 0;
7 | }
8 |
9 | ULONG __stdcall RefCountable::AddRef()
10 | {
11 | return InterlockedIncrement(&m_refCount) ;
12 | }
13 |
14 | ULONG __stdcall RefCountable::Release()
15 | {
16 | long nRefCount = 0;
17 | nRefCount = InterlockedDecrement(&m_refCount) ;
18 | if (nRefCount == 0)
19 | {
20 | OnZeroCount();
21 | delete this;
22 | }
23 |
24 | return nRefCount;
25 | }
26 |
27 | void RefCountable::OnZeroCount()
28 | {
29 | }
30 |
31 | RefCountable::~RefCountable(void)
32 | {
33 | }
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # README #
2 |
3 | ### Зачем нужен этот репозиторий? ###
4 |
5 | * Данное приложение является исполняющей средой для скриптов на языке 1С:Предприятие.
6 | * Позволяет писать скрипты WSH на языке 1С без наличия самой платформы.
7 | * Подробнее см. [WIKI проекта](/EvilBeaver/1script/wiki/Home/)
8 |
9 | ### Как установить и собрать? ###
10 |
11 | * Установите Visual Studio 2010-2013
12 | * Откройте файл 1Script.sln
13 | * Выполните сборку проекта
14 |
15 | ### Как поучаствовать в проекте? ###
16 |
17 | * Клонируйте репозиторий
18 | * Меняйте что хотите
19 | * Присылайте pull-request
20 |
21 | ### С кем я говорю? ###
22 |
23 | * http://habrahabr.ru/users/evilbeaver/
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/Contexts/ContextClassAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ScriptEngine.Machine.Contexts
4 | {
5 | [AttributeUsage(AttributeTargets.Class)]
6 | public class ContextClassAttribute : Attribute
7 | {
8 | string _name;
9 | string _alias;
10 |
11 | public ContextClassAttribute(string typeName, string typeAlias = "")
12 | {
13 | _name = typeName;
14 | _alias = typeAlias;
15 | }
16 |
17 | public string GetName()
18 | {
19 | return _name;
20 | }
21 |
22 | public string GetAlias()
23 | {
24 | return _alias;
25 | }
26 |
27 | }
28 | }
--------------------------------------------------------------------------------
/src/ScriptEngine/Compiler/ICompilerContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ScriptEngine.Machine;
3 |
4 | namespace ScriptEngine.Compiler
5 | {
6 | interface ICompilerContext
7 | {
8 | SymbolBinding DefineMethod(ScriptEngine.Machine.MethodInfo method);
9 | SymbolBinding DefineProperty(string name);
10 | SymbolBinding DefineVariable(string name);
11 | SymbolBinding GetMethod(string name);
12 | SymbolScope GetScope(int scopeIndex);
13 | VariableBinding GetVariable(string name);
14 | SymbolScope Peek();
15 | SymbolScope PopScope();
16 | void PushScope(SymbolScope scope);
17 | int ScopeIndex(SymbolScope scope);
18 | int TopIndex();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/Contexts/SystemEnumAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Machine.Contexts
7 | {
8 | [AttributeUsage(AttributeTargets.Class)]
9 | public class SystemEnumAttribute : Attribute
10 | {
11 | private string _name;
12 | private string _alias;
13 |
14 | public SystemEnumAttribute(string name, string alias = "")
15 | {
16 | _name = name;
17 | _alias = alias;
18 | }
19 |
20 | public string GetName()
21 | {
22 | return _name;
23 | }
24 |
25 | public string GetAlias()
26 | {
27 | return _alias;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/ScriptEngine/Machine/Contexts/LibraryContextBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace ScriptEngine.Machine.Contexts
7 | {
8 | // костыльный класс для реализации ЗаполнитьЗначенияСвойств.
9 | // в версии 2.0 используется другой подход к иерархии контекстов.
10 |
11 | public class LibraryContextBase : PropertyNameIndexAccessor, IReflectableContext
12 | {
13 |
14 | public virtual IEnumerable GetProperties()
15 | {
16 | throw new NotImplementedException();
17 | }
18 |
19 | public virtual IEnumerable GetMethods()
20 | {
21 | throw new NotImplementedException();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/ScriptEngine.HostedScript/Library/Http/HttpRequestBodyUnknown.cs:
--------------------------------------------------------------------------------
1 | using ScriptEngine.Machine;
2 |
3 | namespace ScriptEngine.HostedScript.Library.Http
4 | {
5 | class HttpRequestBodyUnknown : IHttpRequestBody
6 | {
7 |
8 | public IValue GetAsString()
9 | {
10 | return ValueFactory.Create();
11 | }
12 |
13 | public IValue GetAsBinary()
14 | {
15 | return ValueFactory.Create();
16 | }
17 |
18 | public IValue GetAsFilename()
19 | {
20 | return ValueFactory.Create();
21 | }
22 |
23 | public void Dispose()
24 | {
25 | ;
26 | }
27 |
28 | public System.IO.Stream GetDataStream()
29 | {
30 | return null;
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/tests/readme.md:
--------------------------------------------------------------------------------
1 | ## Запуск тестов OneScript из командной строки
2 |
3 | [Страница Организация тестирования](https://bitbucket.org/EvilBeaver/1script/wiki/%D0%A2%D0%B5%D1%81%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5)
4 |
5 | Формат тестов совместим с форматом тестов проекта https://github.com/xDrivenDevelopment/xUnitFor1C/wiki
6 |
7 | Пример файла теста:
8 | ```
9 | Перем юТест;
10 |
11 | Функция ПолучитьСписокТестов(ЮнитТестирование) Экспорт
12 |
13 | юТест = ЮнитТестирование;
14 |
15 | ВсеТесты = Новый Массив;
16 |
17 | ВсеТесты.Добавить("ТестДолжен_ПроверитьВерсию");
18 |
19 | Возврат ВсеТесты;
20 | КонецФункции
21 |
22 | Процедура ТестДолжен_ПроверитьВерсию() Экспорт
23 | юТест.ПроверитьРавенство("0.1", Версия(), "Версия()");
24 | КонецПроцедуры
25 |
26 | Функция Версия() Экспорт
27 | Возврат "0.1";
28 | КонецФункции
29 | ```
--------------------------------------------------------------------------------
/src/ScriptEngine.Snegopat/EventCallableSDO.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "MarshalingHelpers.h"
5 | #include "SnegAPIDefinitions.h"
6 |
7 | using namespace System;
8 | using namespace System::Reflection;
9 | using namespace ScriptEngine;
10 | using namespace ScriptEngine::Environment;
11 | using namespace ScriptEngine::Machine;
12 | using namespace ScriptEngine::Machine::Contexts;
13 |
14 | public ref class EventCallableSDO : public ReflectableSDO
15 | {
16 | public:
17 | EventCallableSDO(ScriptDrivenObject^ instance, LoadedModuleHandle module);
18 |
19 | protected:
20 |
21 | virtual Object^ InvokeInternal(String^ name,
22 | System::Reflection::BindingFlags invokeAttr,
23 | Binder^ binder,
24 | Object^ target,
25 | array