Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…guy94/PRFork/contribution/7684, Text rendering issues
  • Loading branch information
jmp75 committed Nov 12, 2014
2 parents 17a3c41 + d9dbf8d commit 0be83b4
Show file tree
Hide file tree
Showing 44 changed files with 609 additions and 337 deletions.
4 changes: 3 additions & 1 deletion .nuget/NuGet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>

<!-- Setting Restore Packages to false on 2014-11, as this causes a nuisance batch build failure on Linux. This is a workaround only-->
<RestorePackages>false</RestorePackages>
<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>

Expand Down Expand Up @@ -130,4 +132,4 @@
</Code>
</Task>
</UsingTask>
</Project>
</Project>
9 changes: 5 additions & 4 deletions R.NET/ComplexMatrix.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RDotNet.Internals;
using RDotNet.Utilities;
using System;
using System.Numerics;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -95,8 +96,8 @@ protected internal ComplexMatrix(REngine engine, IntPtr coerced)
/// <param name="matrix"></param>
protected override void InitMatrixFastDirect(Complex[,] matrix)
{
var vectorCplx = Utility.ArrayConvertOneDim(matrix);
var data = Utility.SerializeComplexToDouble(vectorCplx);
var vectorCplx = ArrayConverter.ArrayConvertOneDim(matrix);
var data = RTypesUtil.SerializeComplexToDouble(vectorCplx);
Marshal.Copy(data, 0, DataPointer, data.Length);
}

Expand All @@ -109,8 +110,8 @@ protected override void InitMatrixFastDirect(Complex[,] matrix)
int n = this.ItemCount;
var data = new double[2 * n];
Marshal.Copy(DataPointer, data, 0, 2 * n);
var oneDim = Utility.DeserializeComplexFromDouble(data);
return Utility.ArrayConvertAllTwoDim(oneDim, this.RowCount, this.ColumnCount);
var oneDim = RTypesUtil.DeserializeComplexFromDouble(data);
return ArrayConverter.ArrayConvertAllTwoDim(oneDim, this.RowCount, this.ColumnCount);
}

/// <summary>
Expand Down
5 changes: 3 additions & 2 deletions R.NET/ComplexVector.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RDotNet.Internals;
using RDotNet.Utilities;
using System;
using System.Collections.Generic;
using System.Numerics;
Expand Down Expand Up @@ -89,15 +90,15 @@ protected override Complex[] GetArrayFast()
int n = this.Length;
var data = new double[2*n];
Marshal.Copy(DataPointer, data, 0, 2 * n);
return Utility.DeserializeComplexFromDouble(data);
return RTypesUtil.DeserializeComplexFromDouble(data);
}

/// <summary>
/// Efficient initialisation of R vector values from an array representation in the CLR
/// </summary>
protected override void SetVectorDirect(Complex[] values)
{
double[] data = Utility.SerializeComplexToDouble(values);
double[] data = RTypesUtil.SerializeComplexToDouble(values);
IntPtr pointer = IntPtr.Add(DataPointer, 0);
Marshal.Copy(data, 0, pointer, data.Length);
}
Expand Down
11 changes: 7 additions & 4 deletions R.NET/Devices/CharacterDeviceAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,12 @@ private void SetupWindowsDevice(StartupParameter parameter)
{
if (parameter.RHome == null)
{
//string rhome = Marshal.PtrToStringAnsi(Engine.GetFunction<getValue>("get_R_HOME")());
string rhome = NativeUtility.GetRHomeEnvironmentVariable();
parameter.start.rhome = Marshal.StringToHGlobalAnsi(ConvertSeparatorToUnixStylePath(rhome));
parameter.start.rhome = ToNativeUnixPath(NativeUtility.GetRHomeEnvironmentVariable());
}
if (parameter.Home == null)
{
string home = Marshal.PtrToStringAnsi(Engine.GetFunction<getValue>("getRUser")());
parameter.start.home = Marshal.StringToHGlobalAnsi(ConvertSeparatorToUnixStylePath(home));
parameter.start.home = ToNativeUnixPath(home);
}
parameter.start.ReadConsole = ReadConsole;
parameter.start.WriteConsole = WriteConsole;
Expand All @@ -92,6 +90,11 @@ private void SetupWindowsDevice(StartupParameter parameter)
parameter.start.Busy = Busy;
}

private static IntPtr ToNativeUnixPath(string path)
{
return Marshal.StringToHGlobalAnsi(ConvertSeparatorToUnixStylePath(path));
}

private void SetupUnixDevice()
{
IntPtr suicidePointer = this.engine.DangerousGetHandle("ptr_R_Suicide");
Expand Down
3 changes: 2 additions & 1 deletion R.NET/Environment.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RDotNet.Internals;
using RDotNet.Utilities;
using System;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -36,7 +37,7 @@ public REnvironment Parent
{
SEXPREC sexp = GetInternalStructure();
IntPtr parent = sexp.envsxp.enclos;
return Engine.CheckNil(parent) ? null : new REnvironment(Engine, parent);
return Engine.EqualsRNilValue(parent) ? null : new REnvironment(Engine, parent);
}
}

Expand Down
5 changes: 3 additions & 2 deletions R.NET/IntegerMatrix.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RDotNet.Internals;
using RDotNet.Utilities;
using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
Expand Down Expand Up @@ -92,7 +93,7 @@ protected internal IntegerMatrix(REngine engine, IntPtr coerced)
/// <param name="matrix"></param>
protected override void InitMatrixFastDirect(int[,] matrix)
{
var values = Utility.ArrayConvertOneDim(matrix);
var values = ArrayConverter.ArrayConvertOneDim(matrix);
Marshal.Copy(values, 0, DataPointer, values.Length);
}

Expand All @@ -104,7 +105,7 @@ protected override void InitMatrixFastDirect(int[,] matrix)
{
var values = new int[this.ItemCount];
Marshal.Copy(DataPointer, values, 0, values.Length);
return Utility.ArrayConvertAllTwoDim(values, this.RowCount, this.ColumnCount);
return ArrayConverter.ArrayConvertAllTwoDim(values, this.RowCount, this.ColumnCount);
}

/// <summary>
Expand Down
21 changes: 12 additions & 9 deletions R.NET/Internals/Delegates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ namespace RDotNet.Internals
/// <param name="argv">arguments passed to the embedded engine</param>
/// <remarks>
/// <code>
/// int Rf_initEmbeddedR(int argc, char **argv)
///{
/// int Rf_initEmbeddedR(int argc, char **argv)
///{
/// Rf_initialize_R(argc, argv);
/// // R_Interactive is set to true in unix Rembedded.c, not gnuwin
/// R_Interactive = TRUE; /* Rf_initialize_R set this based on isatty */
/// setup_Rmainloop();
/// return(1);
/// // R_Interactive is set to true in unix Rembedded.c, not gnuwin
/// R_Interactive = TRUE; /* Rf_initialize_R set this based on isatty */
/// setup_Rmainloop();
/// return(1);
///}
/// </code>
/// </code>
/// </remarks>
/// <returns></returns>
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
Expand Down Expand Up @@ -140,6 +140,9 @@ namespace RDotNet.Internals
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate IntPtr R_tryEval(IntPtr statement, IntPtr environment, out bool errorOccurred);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void Rf_PrintValue(IntPtr value);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate IntPtr R_ParseVector(IntPtr statement, int statementCount, out ParseStatus status, IntPtr _);

Expand Down Expand Up @@ -193,8 +196,8 @@ namespace RDotNet.Internals
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate bool Rf_isOrdered(IntPtr sexp);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate IntPtr R_lsInternal(IntPtr environment, bool all);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate IntPtr R_lsInternal(IntPtr environment, bool all);

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate IntPtr Rf_applyClosure(IntPtr call, IntPtr value, IntPtr arguments, IntPtr environment, IntPtr suppliedEnvironment);
Expand Down
5 changes: 3 additions & 2 deletions R.NET/LogicalMatrix.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RDotNet.Internals;
using RDotNet.Utilities;
using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
Expand Down Expand Up @@ -91,7 +92,7 @@ protected internal LogicalMatrix(REngine engine, IntPtr coerced)
/// <param name="matrix"></param>
protected override void InitMatrixFastDirect(bool[,] matrix)
{
var intValues = Utility.ArrayConvertAllOneDim(matrix, Convert.ToInt32);
var intValues = ArrayConverter.ArrayConvertAllOneDim(matrix, Convert.ToInt32);
Marshal.Copy(intValues, 0, DataPointer, intValues.Length);
}

Expand All @@ -103,7 +104,7 @@ protected override void InitMatrixFastDirect(bool[,] matrix)
{
int[] intValues = new int[this.ItemCount];
Marshal.Copy(DataPointer, intValues, 0, intValues.Length);
return Utility.ArrayConvertAllTwoDim(intValues, Convert.ToBoolean, this.RowCount, this.ColumnCount);
return ArrayConverter.ArrayConvertAllTwoDim(intValues, Convert.ToBoolean, this.RowCount, this.ColumnCount);
}

/// <summary>
Expand Down
5 changes: 3 additions & 2 deletions R.NET/NumericMatrix.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using RDotNet.Internals;
using RDotNet.Utilities;
using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
Expand Down Expand Up @@ -100,7 +101,7 @@ protected internal NumericMatrix(REngine engine, IntPtr coerced)
/// <param name="matrix"></param>
protected override void InitMatrixFastDirect(double[,] matrix)
{
var values = Utility.ArrayConvertOneDim(matrix);
var values = ArrayConverter.ArrayConvertOneDim(matrix);
Marshal.Copy(values, 0, DataPointer, values.Length);
}

Expand All @@ -112,7 +113,7 @@ protected override void InitMatrixFastDirect(double[,] matrix)
{
var values = new double[this.ItemCount];
Marshal.Copy(DataPointer, values, 0, values.Length);
return Utility.ArrayConvertAllTwoDim(values, this.RowCount, this.ColumnCount);
return ArrayConverter.ArrayConvertAllTwoDim(values, this.RowCount, this.ColumnCount);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions R.NET/Properties/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.16.*")]
[assembly: AssemblyInformationalVersion("1.5.16")]
[assembly: AssemblyVersion("1.5.17.*")]
[assembly: AssemblyInformationalVersion("1.5.17")]
4 changes: 3 additions & 1 deletion R.NET/RDotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="REngine.cs" />
<Compile Include="SymbolicExpressionExtension.cs" />
<Compile Include="Utility.cs" />
<Compile Include="Utilities\ArrayConverter.cs" />
<Compile Include="Utilities\REngineExtensionsAdvanced.cs" />
<Compile Include="Utilities\RTypesUtil.cs" />
<Compile Include="Vector.cs" />
<Compile Include="LogicalVector.cs" />
<Compile Include="CharacterVector.cs" />
Expand Down
Loading

0 comments on commit 0be83b4

Please sign in to comment.