Skip to content

Commit 76c7fb7

Browse files
authored
Merge pull request #1549 from EvilBeaver/latest
Выпуск версии 1.9.3
2 parents dc3f21f + eca9c84 commit 76c7fb7

File tree

17 files changed

+150
-44
lines changed

17 files changed

+150
-44
lines changed

Jenkinsfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pipeline {
44
agent none
55

66
environment {
7-
ReleaseNumber = '1.9.2'
7+
ReleaseNumber = '1.9.3'
88
outputEnc = '65001'
99
}
1010

@@ -218,10 +218,10 @@ pipeline {
218218
}
219219
}
220220

221-
stage ('Publishing revision') {
221+
stage ('Publishing dev-revision') {
222222
when { anyOf {
223223
// TODO сделать автовычисление маркера lts или latest и согласовать его с путём к папке на стр. 250 (TARGET=..._)
224-
branch 'release/latest'
224+
branch 'latest'
225225
}
226226
}
227227

@@ -247,7 +247,7 @@ pipeline {
247247
mv $WIN/OneScript*-x86*.zip ./
248248
mv $RPM/*.rpm x64/
249249
mv $DEB/*.deb x64/
250-
TARGET="/var/www/oscript.io/download/versions/latest/"
250+
TARGET="/var/www/oscript.io/download/versions/latest-dev/"
251251
sudo rsync -rv --delete --exclude mddoc*.zip --exclude *.src.rpm . $TARGET
252252
'''.stripIndent()
253253
}

src/1Script.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
2323
ProjectSection(SolutionItems) = preProject
2424
..\Build.csproj = ..\Build.csproj
2525
oscommon.targets = oscommon.targets
26+
..\Jenkinsfile = ..\Jenkinsfile
2627
EndProjectSection
2728
EndProject
2829
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Installer", "Installer\Installer.wixproj", "{BBE794A6-B159-422F-B655-B7F03F25F223}"

src/ScriptEngine.HostedScript/Library/Binary/BinaryDataContext.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,11 @@ public override string AsString()
203203
return "";
204204

205205
buffer = new byte[length];
206+
207+
var keepPos = _backingFile.Position;
206208
_backingFile.Seek(0, SeekOrigin.Begin);
207209
_backingFile.Read(buffer, 0, length);
210+
_backingFile.Seek(keepPos, SeekOrigin.Begin);
208211
}
209212

210213
StringBuilder hex = new StringBuilder(length*3);

src/ScriptEngine.HostedScript/Library/NativeApi/NativeApiKernel.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public static IntPtr LoadLibrary(string filename)
3030

3131
public static IntPtr GetProcAddress(IntPtr module, string procName)
3232
{
33-
return IsLinux ? LinuxProc(module, procName) : WindowsProc(module, procName);
33+
var pointer = IsLinux ? LinuxProc(module, procName) : WindowsProc(module, procName);
34+
return pointer != IntPtr.Zero
35+
? pointer
36+
: throw new ApplicationException($"Function pointer for {procName} not obtained.");
3437
}
3538

3639
public static bool FreeLibrary(IntPtr module)

src/ScriptEngine.HostedScript/Library/NativeApi/NativeApiLibrary.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public NativeApiLibrary(String filepath, String identifier)
3737
_tempfile = Path.GetTempFileName();
3838
NativeApiPackage.Extract(stream, _tempfile);
3939
Module = NativeApiKernel.LoadLibrary(_tempfile);
40+
if (Module == IntPtr.Zero)
41+
{
42+
File.Delete(_tempfile);
43+
}
4044
}
4145
else
4246
Module = NativeApiKernel.LoadLibrary(filepath);

src/ScriptEngine.HostedScript/Library/NativeApi/NativeApiPackage.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public static bool IsZip(Stream stream)
2626
const int ZIP_LEAD_BYTES = 0x04034b50;
2727
return (BitConverter.ToInt32(bytes, 0) == ZIP_LEAD_BYTES);
2828
}
29+
30+
private static bool Is64BitProcess()
31+
{
32+
return IntPtr.Size == 8;
33+
}
2934

3035
public static void Extract(Stream stream, String tempfile)
3136
{
@@ -50,7 +55,7 @@ private static String GetEntryName(ZipFile zip)
5055
using (var reader = XmlReader.Create(stream))
5156
{
5257
var thisOs = NativeApiProxy.IsLinux ? "Linux" : "Windows";
53-
var thisArch = System.Environment.Is64BitOperatingSystem ? "x86_64" : "i386";
58+
var thisArch = Is64BitProcess() ? "x86_64" : "i386";
5459
while (reader.ReadToFollowing("component"))
5560
{
5661
var attrOs = reader.GetAttribute("os");

src/ScriptEngine.NativeApi/NativeApiProxy.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ DllExport int32_t GetNParams(ProxyComponent* proxy, int32_t lMethodNum)
326326
return (int32_t)proxy->Component().GetNParams(lMethodNum);
327327
}
328328

329-
DllExport bool ADDIN_API HasParamDefValue(ProxyComponent* proxy, int32_t lMethodNum, int32_t lParamNum)
329+
DllExport bool HasParamDefValue(ProxyComponent* proxy, int32_t lMethodNum, int32_t lParamNum)
330330
{
331331
CHECK_PROXY(false);
332332
tVariant variant = { 0 };
@@ -335,7 +335,7 @@ DllExport bool ADDIN_API HasParamDefValue(ProxyComponent* proxy, int32_t lMethod
335335
return result;
336336
}
337337

338-
DllExport bool ADDIN_API GetParamDefValue(ProxyComponent* proxy, int32_t lMethodNum, int32_t lParamNum, VariantFuncRespond respond)
338+
DllExport bool GetParamDefValue(ProxyComponent* proxy, int32_t lMethodNum, int32_t lParamNum, VariantFuncRespond respond)
339339
{
340340
CHECK_PROXY(false);
341341
tVariant variant = { 0 };
@@ -351,15 +351,15 @@ DllExport bool HasRetVal(ProxyComponent* proxy, int32_t lMethodNum)
351351
return proxy->Component().HasRetVal(lMethodNum);
352352
}
353353

354-
DllExport bool ADDIN_API CallAsProc(ProxyComponent* proxy, int32_t lMethodNum, tVariant* paParams)
354+
DllExport bool CallAsProc(ProxyComponent* proxy, int32_t lMethodNum, tVariant* paParams)
355355
{
356356
CHECK_PROXY(false);
357357
auto lSizeArray = GetNParams(proxy, lMethodNum);
358358
bool ok = proxy->Component().CallAsProc(lMethodNum, paParams, lSizeArray);
359359
return ok;
360360
}
361361

362-
DllExport bool ADDIN_API CallAsFunc(ProxyComponent* proxy, int32_t lMethodNum, tVariant* paParams, VariantFuncRespond respond)
362+
DllExport bool CallAsFunc(ProxyComponent* proxy, int32_t lMethodNum, tVariant* paParams, VariantFuncRespond respond)
363363
{
364364
CHECK_PROXY(false);
365365
tVariant variant = { 0 };

src/ScriptEngine/Compiler/Compiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ private void BuildTryExceptStatement()
11111111
BuildCodeBatch(Token.EndTry);
11121112

11131113
var endIndex = AddLineNumber(_lastExtractedLexem.LineNumber, CodeGenerationFlags.CodeStatistics | CodeGenerationFlags.DebugCode);
1114-
AddCommand(OperationCode.EndTry);
1114+
AddCommand(OperationCode.EndTry, beginHandler);
11151115
CorrectCommandArgument(jmpIndex, endIndex);
11161116

11171117
NextToken();

src/ScriptEngine/Machine/Contexts/ContextDiscoverer.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ namespace ScriptEngine.Machine.Contexts
1515
static class ContextDiscoverer
1616
{
1717
private const string INSTANCE_RETRIEVER_NAME = "CreateInstance";
18+
19+
public static void DiscoverClasses(Assembly assembly)
20+
{
21+
DiscoverClasses(assembly, t => true);
22+
}
1823

19-
public static void DiscoverClasses(System.Reflection.Assembly assembly)
24+
public static void DiscoverClasses(Assembly assembly, Func<Type, bool> filter)
2025
{
2126
IEnumerable<Type> types;
2227
try
@@ -37,29 +42,34 @@ public static void DiscoverClasses(System.Reflection.Assembly assembly)
3742

3843
var collection = GetMarkedTypes(types, typeof(ContextClassAttribute));
3944

40-
foreach (var type in collection)
45+
foreach (var type in collection.Where(filter))
4146
{
4247
RegisterSystemType(type);
4348
}
4449
}
4550

46-
public static void DiscoverGlobalContexts(RuntimeEnvironment environment, System.Reflection.Assembly assembly)
51+
public static void DiscoverGlobalContexts(RuntimeEnvironment environment, Assembly assembly)
52+
{
53+
DiscoverGlobalContexts(environment, assembly, t => true);
54+
}
55+
56+
public static void DiscoverGlobalContexts(RuntimeEnvironment environment, Assembly assembly, Func<Type, bool> filter)
4757
{
4858
var allTypes = assembly.GetTypes();
4959
var enums = GetMarkedTypes(allTypes.AsParallel(), typeof(SystemEnumAttribute));
50-
foreach (var item in enums)
60+
foreach (var item in enums.Where(filter))
5161
{
5262
RegisterSystemEnum(item, environment);
5363
}
5464

5565
var simpleEnums = GetMarkedTypes(allTypes.AsParallel(), typeof(EnumerationTypeAttribute));
56-
foreach (var item in simpleEnums)
66+
foreach (var item in simpleEnums.Where(filter))
5767
{
5868
RegisterSimpleEnum(item, environment);
5969
}
6070

6171
var contexts = GetMarkedTypes(allTypes.AsParallel(), typeof(GlobalContextAttribute));
62-
foreach (var item in contexts)
72+
foreach (var item in contexts.Where(filter))
6373
{
6474
RegisterGlobalContext(item, environment);
6575
}

src/ScriptEngine/Machine/Contexts/ScriptDrivenObject.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This Source Code Form is subject to the terms of the
77
using System;
88
using System.Collections.Generic;
99
using System.Linq;
10+
using System.Threading;
1011

1112
namespace ScriptEngine.Machine.Contexts
1213
{

0 commit comments

Comments
 (0)