-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💥**breakChange**:rename to **CScripting**
- Loading branch information
1 parent
4b0ffdd
commit 234d46d
Showing
52 changed files
with
1,061 additions
and
927 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#r "nuget: Python.System, *" | ||
#r "nuget: CScripting, *" | ||
|
||
|
||
addr = 0x12345678 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.5.33627.172 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CScripting", "CScripting\CScripting.csproj", "{9DF9921F-4A9E-4EE3-908D-2BCC79D24BE6}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CScriptingDemo", "CScriptingDemo\CScriptingDemo.csproj", "{FFC71AD4-85B0-4050-8ED0-BAD84413CFA6}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CScriptingTests", "CScriptingTests\CScriptingTests.csproj", "{656D583E-E1A1-4127-86F4-F0A8265B2B03}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{9DF9921F-4A9E-4EE3-908D-2BCC79D24BE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9DF9921F-4A9E-4EE3-908D-2BCC79D24BE6}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9DF9921F-4A9E-4EE3-908D-2BCC79D24BE6}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9DF9921F-4A9E-4EE3-908D-2BCC79D24BE6}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{FFC71AD4-85B0-4050-8ED0-BAD84413CFA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{FFC71AD4-85B0-4050-8ED0-BAD84413CFA6}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{FFC71AD4-85B0-4050-8ED0-BAD84413CFA6}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{FFC71AD4-85B0-4050-8ED0-BAD84413CFA6}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{656D583E-E1A1-4127-86F4-F0A8265B2B03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{656D583E-E1A1-4127-86F4-F0A8265B2B03}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{656D583E-E1A1-4127-86F4-F0A8265B2B03}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{656D583E-E1A1-4127-86F4-F0A8265B2B03}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {19598AB3-02E0-4316-A003-BDCAC338A7DA} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Numerics; | ||
using System.Text; | ||
|
||
#if WITH_NAME_SPACE | ||
namespace CScripting | ||
{ | ||
#endif | ||
#if !MATLAB_NOT_IN_TOP_NAMESPACE | ||
public partial class CScripting | ||
{ | ||
#endif | ||
public partial class matlab | ||
{ | ||
public static Complex fft(object arg1, object arg2, object arg3) | ||
{ | ||
|
||
throw new NotImplementedException(); | ||
} | ||
} | ||
#if !MATLAB_NOT_IN_TOP_NAMESPACE | ||
} | ||
#endif | ||
|
||
|
||
#if WITH_NAME_SPACE | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System; | ||
using System.Numerics; | ||
|
||
public partial class CScripting | ||
{ | ||
public partial class matlab | ||
{ | ||
public static int[] linespace(int start, int end, int step = 1) | ||
{ | ||
return new int[end - start]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using System; | ||
using System.Numerics; | ||
|
||
#if WITH_NAME_SPACE | ||
namespace CScripting | ||
{ | ||
#endif | ||
|
||
public partial class CScripting | ||
{ | ||
#region abs | ||
//public const double e = Math.E; | ||
public const double pi = Math.PI; | ||
|
||
/// <summary> | ||
/// 将复数转为绝对值 | ||
/// </summary> | ||
/// <param name="num"></param> | ||
/// <returns></returns> | ||
public static double Abs(Complex num) => Abs(num.Magnitude); | ||
|
||
/// <see cref=" Math.Abs"/> | ||
public static decimal Abs(decimal value) => Abs(value); | ||
|
||
/// <see cref=" Math.Abs"/> | ||
public static double Abs(double value) => Abs(value); | ||
|
||
/// <see cref=" Math.Abs"/> | ||
public static short Abs(short value) => Abs(value); | ||
|
||
/// <see cref=" Math.Abs"/> | ||
public static int Abs(int value) => Abs(value); | ||
|
||
/// <see cref=" Math.Abs"/> | ||
public static long Abs(long value) => Abs(value); | ||
|
||
/// <see cref=" Math.Abs"/> | ||
public static sbyte Abs(sbyte value) => Abs(value); | ||
|
||
/// <see cref=" Math.Abs"/> | ||
public static float Abs(float value) => Abs(value); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, use `Abs` instead.")] | ||
#endif | ||
public static double abs(Complex num) => Math.Abs(num.Magnitude); | ||
|
||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] | ||
#endif | ||
public static double abs(double num) => Math.Abs(num); | ||
|
||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] | ||
#endif | ||
public static decimal abs(decimal num) => Math.Abs(num); | ||
|
||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] | ||
#endif | ||
public static short abs(short num) => Math.Abs(num); | ||
|
||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] | ||
#endif | ||
public static int abs(int num) => Math.Abs(num); | ||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] | ||
#endif | ||
public static long abs(long num) => Math.Abs(num); | ||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] | ||
#endif | ||
public static sbyte abs(sbyte num) => Math.Abs(num); | ||
|
||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, `using static System.Math;` and use `Abs` instead.")] | ||
#endif | ||
public static float abs(float num) => Math.Abs(num); | ||
|
||
#endregion | ||
|
||
} | ||
#if WITH_NAME_SPACE | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Numerics; | ||
|
||
#if WITH_NAME_SPACE | ||
namespace CScripting | ||
{ | ||
#endif | ||
|
||
public partial class CScripting | ||
{ | ||
#region all | ||
/// <summary> | ||
/// <see cref="Enumerable"/> | ||
/// </summary> | ||
/// <typeparam name="TSource"></typeparam> | ||
/// <param name="iterable"></param> | ||
/// <param name="predicate"></param> | ||
/// <returns></returns> | ||
public static bool All<TSource>(IEnumerable<TSource> iterable, Func<TSource, bool> predicate = null) | ||
=> All(iterable, predicate); | ||
|
||
|
||
|
||
|
||
|
||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, use `{nameof(All)}` instead.")] | ||
#endif | ||
public static bool all<TSource>(IEnumerable<TSource> iterable, Func<TSource, bool> predicate = null) | ||
{ | ||
if (predicate == null) | ||
return iterable.All(a => Convert.ToBoolean(a)); | ||
else | ||
return iterable.All(predicate); | ||
} | ||
|
||
|
||
#endregion | ||
|
||
} | ||
#if WITH_NAME_SPACE | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Numerics; | ||
|
||
#if WITH_NAME_SPACE | ||
namespace CScripting | ||
{ | ||
#endif | ||
|
||
public partial class CScripting | ||
{ | ||
#region any | ||
/// <summary> | ||
/// <see cref="Enumerable"/> | ||
/// </summary> | ||
/// <typeparam name="TSource"></typeparam> | ||
/// <param name="iterable"></param> | ||
/// <param name="predicate"></param> | ||
/// <returns></returns> | ||
public static bool Any<TSource>(IEnumerable<TSource> iterable, Func<TSource, bool> predicate = null) | ||
=> Any(iterable, predicate); | ||
|
||
|
||
|
||
|
||
|
||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, use `{nameof(Any)}` instead.")] | ||
#endif | ||
public static bool any<TSource>(IEnumerable<TSource> iterable, Func<TSource, bool> predicate = null) | ||
{ | ||
if (predicate == null) | ||
return iterable.Any(); | ||
else | ||
return iterable.Any(predicate); | ||
} | ||
|
||
#endregion | ||
|
||
} | ||
#if WITH_NAME_SPACE | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
|
||
#if WITH_NAME_SPACE | ||
namespace CScripting | ||
{ | ||
#endif | ||
|
||
public partial class CScripting | ||
{ | ||
#region bin | ||
|
||
/// <summary> | ||
/// 将整形的数转为二进制 | ||
/// </summary> | ||
/// <param name="x">整数</param> | ||
/// <param name="width">位宽,<see langword="null"/> 则不关注,如果转换结果大于位宽,则取位宽</param> | ||
/// <returns>二进制字符串</returns> | ||
public static string Bin(long x, int? width = null) | ||
=> Bin(x, width); | ||
|
||
|
||
|
||
|
||
|
||
#if OBSOLETE | ||
[Obsolete("This method is deprecated, use `{nameof(bin)}` instead.")] | ||
#endif | ||
public static string bin(long x, int? width = null) | ||
{ | ||
if (width == null || width <= 0) | ||
{ | ||
return "0b" + Convert.ToString(x, 2); | ||
} | ||
else | ||
{ | ||
string format = Convert.ToString(x, 2); | ||
if (format.Length < width) | ||
{ | ||
string par = ""; | ||
for (int c = 0; c < width - format.Length; c++) | ||
{ | ||
par += "0"; | ||
} | ||
return "0b" + par + format; | ||
} | ||
return "0b" + format; | ||
} | ||
} | ||
|
||
#endregion | ||
} | ||
#if WITH_NAME_SPACE | ||
} | ||
#endif |
Oops, something went wrong.