Daily update on 20250312-074647 by Nitload Youmu. Additional Message : Change: Temp not want to compile RULE and PROCEDURE
Add: Add factory method to generate more kind of binary operator node Add: more SIMD intrinsic C function Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
@@ -84,6 +84,10 @@ void load_intrinsic_sse(ssc_intrinsic *context)
|
|||||||
context->dot_43 = dot_43_sse;
|
context->dot_43 = dot_43_sse;
|
||||||
context->city_hash_simplify = city_hash_simplify_sse;
|
context->city_hash_simplify = city_hash_simplify_sse;
|
||||||
context->index_pair = index_pair_sse;
|
context->index_pair = index_pair_sse;
|
||||||
|
context->sub_m2 = submatrix2_sse;
|
||||||
|
context->sub_m3 = submatrix3_sse;
|
||||||
|
context->sub_m4 = submatrix4_sse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_intrinsic_avx(ssc_intrinsic *context)
|
void load_intrinsic_avx(ssc_intrinsic *context)
|
||||||
|
|||||||
@@ -40,3 +40,18 @@ INTERNAL void __cdecl addmatrix2_avx(__2_columnset *left, __2_columnset *right,
|
|||||||
__m256 temp = _mm256_add_ps(ALIGN256(left->column[0]), ALIGN256(right->column[0]));
|
__m256 temp = _mm256_add_ps(ALIGN256(left->column[0]), ALIGN256(right->column[0]));
|
||||||
_mm256_storeu_ps(&ans->m[0][0], temp);
|
_mm256_storeu_ps(&ans->m[0][0], temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INTERNAL void __cdecl submatrix2_sse(__2_columnset *left, __2_columnset *right, __2_columnset *ans)
|
||||||
|
{
|
||||||
|
__m128 temp0 = _mm_sub_ps(ALIGN(left->column[0]), ALIGN(right->column[0]));
|
||||||
|
__m128 temp1 = _mm_sub_ps(ALIGN(left->column[1]), ALIGN(right->column[1]));
|
||||||
|
|
||||||
|
_mm_storeu_ps(&ans->m[0][0], temp0);
|
||||||
|
_mm_storeu_ps(&ans->m[0][1], temp1);
|
||||||
|
}
|
||||||
|
|
||||||
|
INTERNAL void __cdecl submatrix2_avx(__2_columnset *left, __2_columnset *right, __2_columnset *ans)
|
||||||
|
{
|
||||||
|
__m256 temp = _mm256_sub_ps(ALIGN256(left->column[0]), ALIGN256(right->column[0]));
|
||||||
|
_mm256_storeu_ps(&ans->m[0][0], temp);
|
||||||
|
}
|
||||||
|
|||||||
@@ -101,4 +101,30 @@ INTERNAL void __cdecl addmatrix3_512(__3_columnset *left, __3_columnset *right,
|
|||||||
_mm512_mask_store_ps(ans, 0x0fff, temp);
|
_mm512_mask_store_ps(ans, 0x0fff, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INTERNAL void __cdecl submatrix3_sse(__3_columnset *left, __3_columnset *right, __3_columnset *ans)
|
||||||
|
{
|
||||||
|
__m128 temp0 = _mm_sub_ps(ALIGN(left->column[0]), ALIGN(right->column[0]));
|
||||||
|
__m128 temp1 = _mm_sub_ps(ALIGN(left->column[1]), ALIGN(right->column[1]));
|
||||||
|
__m128 temp2 = _mm_sub_ps(ALIGN(left->column[2]), ALIGN(right->column[2]));
|
||||||
|
|
||||||
|
_mm_storeu_ps(&ans->m[0][0], temp0);
|
||||||
|
_mm_storeu_ps(&ans->m[0][1], temp1);
|
||||||
|
_mm_storeu_ps(&ans->m[0][2], temp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
INTERNAL void __cdecl submatrix3_avx(__3_columnset *left, __3_columnset *right, __3_columnset *ans)
|
||||||
|
{
|
||||||
|
__m256 temp0 = _mm256_sub_ps(ALIGN256(left->part), ALIGN256(right->part));
|
||||||
|
__m128 temp1 = _mm_sub_ps(ALIGN(left->column[2]), ALIGN(right->column[2]));
|
||||||
|
|
||||||
|
_mm256_storeu_ps(&ans->m[0][0], temp0);
|
||||||
|
_mm_storeu_ps(&ans->m[0][2], temp1);
|
||||||
|
}
|
||||||
|
|
||||||
|
INTERNAL void __cdecl submatrix3_512(__3_columnset *left, __3_columnset *right, __3_columnset *ans)
|
||||||
|
{
|
||||||
|
__m512 temp = _mm512_sub_ps(_mm512_loadu_ps(left), _mm512_loadu_ps(right));
|
||||||
|
_mm512_mask_store_ps(ans, 0x0fff, temp);
|
||||||
|
}
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|||||||
@@ -82,3 +82,22 @@ INTERNAL void SSCDECL addmatrix4_512(__4_columnset *left, __4_columnset *right,
|
|||||||
{
|
{
|
||||||
ans->stream = _mm512_add_ps(ALIGN512(left->stream), ALIGN512(right->stream));
|
ans->stream = _mm512_add_ps(ALIGN512(left->stream), ALIGN512(right->stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INTERNAL void SSCDECL submatrix4_sse(__4_columnset *left, __4_columnset *right, __4_columnset *ans)
|
||||||
|
{
|
||||||
|
ans->column[0] = _mm_sub_ps(ALIGN(left->column[0]), ALIGN(right->column[0]));
|
||||||
|
ans->column[1] = _mm_sub_ps(ALIGN(left->column[1]), ALIGN(right->column[1]));
|
||||||
|
ans->column[2] = _mm_sub_ps(ALIGN(left->column[2]), ALIGN(right->column[2]));
|
||||||
|
ans->column[3] = _mm_sub_ps(ALIGN(left->column[3]), ALIGN(right->column[3]));
|
||||||
|
}
|
||||||
|
|
||||||
|
INTERNAL void SSCDECL submatrix4_avx(__4_columnset *left, __4_columnset *right, __4_columnset *ans)
|
||||||
|
{
|
||||||
|
ans->half[0] = _mm256_sub_ps(ALIGN256(left->half[0]), ALIGN256(right->half[0]));
|
||||||
|
ans->half[1] = _mm256_sub_ps(ALIGN256(left->half[1]), ALIGN256(right->half[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
INTERNAL void SSCDECL submatrix4_512(__4_columnset *left, __4_columnset *right, __4_columnset *ans)
|
||||||
|
{
|
||||||
|
ans->stream = _mm512_sub_ps(ALIGN512(left->stream), ALIGN512(right->stream));
|
||||||
|
}
|
||||||
|
|||||||
@@ -64,12 +64,17 @@ INTERNAL void normalize(__m128 *source, __m128 *target);
|
|||||||
|
|
||||||
INTERNAL void SSCDECL addmatrix2_sse(__2_columnset *left, __2_columnset *right, __2_columnset *ans);
|
INTERNAL void SSCDECL addmatrix2_sse(__2_columnset *left, __2_columnset *right, __2_columnset *ans);
|
||||||
INTERNAL void SSCDECL addmatrix2_avx(__2_columnset *left, __2_columnset *right, __2_columnset *ans);
|
INTERNAL void SSCDECL addmatrix2_avx(__2_columnset *left, __2_columnset *right, __2_columnset *ans);
|
||||||
|
INTERNAL void SSCDECL submatrix2_sse(__2_columnset *left, __2_columnset *right, __2_columnset *ans);
|
||||||
|
INTERNAL void SSCDECL addmatrix2_avx(__2_columnset *left, __2_columnset *right, __2_columnset *ans);
|
||||||
INTERNAL void SSCDECL transpose23(__2_columnset const *source, __3_columnset *target);
|
INTERNAL void SSCDECL transpose23(__2_columnset const *source, __3_columnset *target);
|
||||||
INTERNAL void SSCDECL transpose24(__2_columnset const *source, __4_columnset *target);
|
INTERNAL void SSCDECL transpose24(__2_columnset const *source, __4_columnset *target);
|
||||||
|
|
||||||
INTERNAL void SSCDECL addmatrix3_sse(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
INTERNAL void SSCDECL addmatrix3_sse(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
||||||
INTERNAL void SSCDECL addmatrix3_avx(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
INTERNAL void SSCDECL addmatrix3_avx(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
||||||
INTERNAL void SSCDECL addmatrix3_512(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
INTERNAL void SSCDECL addmatrix3_512(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
||||||
|
INTERNAL void SSCDECL submatrix3_sse(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
||||||
|
INTERNAL void SSCDECL submatrix3_avx(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
||||||
|
INTERNAL void SSCDECL submatrix3_512(__3_columnset *left, __3_columnset *right, __3_columnset *ans);
|
||||||
INTERNAL void SSCDECL transpose32(__3_columnset const *source, __2_columnset *target);
|
INTERNAL void SSCDECL transpose32(__3_columnset const *source, __2_columnset *target);
|
||||||
INTERNAL void SSCDECL transpose33(__3_columnset const *source, __3_columnset *target);
|
INTERNAL void SSCDECL transpose33(__3_columnset const *source, __3_columnset *target);
|
||||||
INTERNAL void SSCDECL transpose34(__3_columnset const *source, __4_columnset *target);
|
INTERNAL void SSCDECL transpose34(__3_columnset const *source, __4_columnset *target);
|
||||||
@@ -78,6 +83,9 @@ INTERNAL float SSCDECL det_mat3(__3_columnset *matrix, __3_columnset *tranpose);
|
|||||||
INTERNAL void SSCDECL addmatrix4_sse(__4_columnset *left, __4_columnset *right, __4_columnset *ans);
|
INTERNAL void SSCDECL addmatrix4_sse(__4_columnset *left, __4_columnset *right, __4_columnset *ans);
|
||||||
INTERNAL void SSCDECL addmatrix4_avx(__4_columnset *left, __4_columnset *right, __4_columnset *ans);
|
INTERNAL void SSCDECL addmatrix4_avx(__4_columnset *left, __4_columnset *right, __4_columnset *ans);
|
||||||
INTERNAL void SSCDECL addmatrix4_512(__4_columnset *left, __4_columnset *right, __4_columnset *ans);
|
INTERNAL void SSCDECL addmatrix4_512(__4_columnset *left, __4_columnset *right, __4_columnset *ans);
|
||||||
|
INTERNAL void SSCDECL submatrix4_sse(__4_columnset *left, __4_columnset *right, __4_columnset *ans);
|
||||||
|
INTERNAL void SSCDECL submatrix4_avx(__4_columnset *left, __4_columnset *right, __4_columnset *ans);
|
||||||
|
INTERNAL void SSCDECL submatrix4_512(__4_columnset *left, __4_columnset *right, __4_columnset *ans);
|
||||||
INTERNAL void SSCDECL transpose42(__4_columnset const *source, __2_columnset *target);
|
INTERNAL void SSCDECL transpose42(__4_columnset const *source, __2_columnset *target);
|
||||||
INTERNAL void SSCDECL transpose43(__4_columnset const *source, __3_columnset *target);
|
INTERNAL void SSCDECL transpose43(__4_columnset const *source, __3_columnset *target);
|
||||||
INTERNAL void SSCDECL transpose44(__4_columnset const *source, __4_columnset *target);
|
INTERNAL void SSCDECL transpose44(__4_columnset const *source, __4_columnset *target);
|
||||||
@@ -99,7 +107,7 @@ INTERNAL void SSCDECL dot_42_avx(__4_columnset *transpose, __m128 *vector, __m12
|
|||||||
|
|
||||||
INTERNAL void SSCDECL dot_43_sse(__4_columnset *transpose, __m128 *vector, __m128 *ans);
|
INTERNAL void SSCDECL dot_43_sse(__4_columnset *transpose, __m128 *vector, __m128 *ans);
|
||||||
INTERNAL void SSCDECL dot_43_avx(__4_columnset *transpose, __m128 *vector, __m128 *ans);
|
INTERNAL void SSCDECL dot_43_avx(__4_columnset *transpose, __m128 *vector, __m128 *ans);
|
||||||
INTERNAL void SSCDECL dot_43_512(__4_columnset *transpose, __m128 *vector, __m128 *ans);
|
//INTERNAL void SSCDECL dot_43_512(__4_columnset *transpose, __m128 *vector, __m128 *ans);
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
@@ -124,6 +132,9 @@ typedef struct ssc_intrinsic {
|
|||||||
DOTPROC dot_43;
|
DOTPROC dot_43;
|
||||||
int (*index_pair)(short const *str, uint32_t target, int length);
|
int (*index_pair)(short const *str, uint32_t target, int length);
|
||||||
VECTORNORMALIZEPROC normalize_3;
|
VECTORNORMALIZEPROC normalize_3;
|
||||||
|
MATARITHMETIC sub_m2;
|
||||||
|
MATARITHMETIC sub_m3;
|
||||||
|
MATARITHMETIC sub_m4;
|
||||||
MATRIXTRANSPOSEPROC transpose_23;
|
MATRIXTRANSPOSEPROC transpose_23;
|
||||||
MATRIXTRANSPOSEPROC transpose_24;
|
MATRIXTRANSPOSEPROC transpose_24;
|
||||||
MATRIXTRANSPOSEPROC transpose_32;
|
MATRIXTRANSPOSEPROC transpose_32;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace StgSharp.Internal
|
|||||||
public unsafe byte[] GetBytes()
|
public unsafe byte[] GetBytes()
|
||||||
{
|
{
|
||||||
byte[] ret = new byte[16];
|
byte[] ret = new byte[16];
|
||||||
fixed( Vector4* vptr = &data.Vec ) {
|
fixed( M128* vptr = &data ) {
|
||||||
byte* bptr = ( byte* )vptr;
|
byte* bptr = ( byte* )vptr;
|
||||||
for( int i = 0; i < 15; i++ ) {
|
for( int i = 0; i < 15; i++ ) {
|
||||||
ret[ i ] = *bptr;
|
ret[ i ] = *bptr;
|
||||||
|
|||||||
@@ -48,11 +48,11 @@ namespace StgSharp.HighPerformance
|
|||||||
{
|
{
|
||||||
|
|
||||||
[FieldOffset( 0 )] internal fixed byte Buffer[ 16 ];
|
[FieldOffset( 0 )] internal fixed byte Buffer[ 16 ];
|
||||||
[FieldOffset( 0 )] internal Vector4 Vec;
|
[FieldOffset( 0 )] internal Vector128<byte> Vec;
|
||||||
|
|
||||||
internal M128( Vector4 v )
|
internal M128( Vector4 v )
|
||||||
{
|
{
|
||||||
Vec = v;
|
Vec = v.AsVector128().AsByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ref T AsRef<T>() where T: struct, INumber<T>
|
public ref T AsRef<T>() where T: struct, INumber<T>
|
||||||
@@ -77,7 +77,7 @@ namespace StgSharp.HighPerformance
|
|||||||
public T Read<T>( int index ) where T: struct, INumber<T>
|
public T Read<T>( int index ) where T: struct, INumber<T>
|
||||||
|
|
||||||
{
|
{
|
||||||
fixed( Vector4* p = &Vec ) {
|
fixed( byte* p = Buffer ) {
|
||||||
#pragma warning disable CS8500
|
#pragma warning disable CS8500
|
||||||
return *( ( T* )p + index );
|
return *( ( T* )p + index );
|
||||||
#pragma warning restore CS8500
|
#pragma warning restore CS8500
|
||||||
@@ -123,61 +123,61 @@ namespace StgSharp.HighPerformance
|
|||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static explicit operator Vector128<byte>( M128 m )
|
public static explicit operator Vector128<byte>( M128 m )
|
||||||
{
|
{
|
||||||
return m.Vec.AsVector128().As<float, byte>();
|
return m.Vec.As<byte, byte>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static explicit operator Vector128<double>( M128 m )
|
public static explicit operator Vector128<double>( M128 m )
|
||||||
{
|
{
|
||||||
return m.Vec.AsVector128().As<float, double>();
|
return m.Vec.As<byte, double>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static explicit operator Vector128<float>( M128 m )
|
public static explicit operator Vector128<float>( M128 m )
|
||||||
{
|
{
|
||||||
return m.Vec.AsVector128().As<float, float>();
|
return m.Vec.As<byte, float>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static explicit operator Vector128<int>( M128 m )
|
public static explicit operator Vector128<int>( M128 m )
|
||||||
{
|
{
|
||||||
return m.Vec.AsVector128().As<float, int>();
|
return m.Vec.As<byte, int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static explicit operator Vector128<long>( M128 m )
|
public static explicit operator Vector128<long>( M128 m )
|
||||||
{
|
{
|
||||||
return m.Vec.AsVector128().As<float, long>();
|
return m.Vec.As<byte, long>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static explicit operator Vector128<sbyte>( M128 m )
|
public static explicit operator Vector128<sbyte>( M128 m )
|
||||||
{
|
{
|
||||||
return m.Vec.AsVector128().As<float, sbyte>();
|
return m.Vec.As<byte, sbyte>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static explicit operator Vector128<short>( M128 m )
|
public static explicit operator Vector128<short>( M128 m )
|
||||||
{
|
{
|
||||||
return m.Vec.AsVector128().As<float, short>();
|
return m.Vec.As<byte, short>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static explicit operator Vector128<uint>( M128 m )
|
public static explicit operator Vector128<uint>( M128 m )
|
||||||
{
|
{
|
||||||
return m.Vec.AsVector128().As<float, uint>();
|
return m.Vec.As<byte, uint>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static explicit operator Vector128<ulong>( M128 m )
|
public static explicit operator Vector128<ulong>( M128 m )
|
||||||
{
|
{
|
||||||
return m.Vec.AsVector128().As<float, ulong>();
|
return m.Vec.As<byte, ulong>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static explicit operator Vector128<ushort>( M128 m )
|
public static explicit operator Vector128<ushort>( M128 m )
|
||||||
{
|
{
|
||||||
return m.Vec.AsVector128().As<float, ushort>();
|
return m.Vec.As<byte, ushort>();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
using StgSharp.Graphics;
|
using StgSharp.Graphics;
|
||||||
using StgSharp.Graphics.OpenGL;
|
using StgSharp.Graphics.OpenGL;
|
||||||
using StgSharp.Internal.OpenGL;
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ namespace StgSharp.Internal.Intrinsic
|
|||||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, Vector4*, Vector4*, void> dot_43;
|
public delegate* unmanaged[Cdecl]<ColumnSet4*, Vector4*, Vector4*, void> dot_43;
|
||||||
public delegate* unmanaged[Cdecl]<char*, int, int, int> index_pair;
|
public delegate* unmanaged[Cdecl]<char*, int, int, int> index_pair;
|
||||||
public delegate* unmanaged[Cdecl]<Vector4*, Vector4*, void> normalize_v3;
|
public delegate* unmanaged[Cdecl]<Vector4*, Vector4*, void> normalize_v3;
|
||||||
|
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet2*, ColumnSet2*, void> sub_mat_2;
|
||||||
|
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, ColumnSet3*, void> sub_mat_3;
|
||||||
|
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, ColumnSet4*, void> sub_mat_4;
|
||||||
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet3*, void> transpose23;
|
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet3*, void> transpose23;
|
||||||
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet4*, void> transpose24;
|
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet4*, void> transpose24;
|
||||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet2*, void> transpose32;
|
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet2*, void> transpose32;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ namespace StgSharp.Math
|
|||||||
Pack = 16 )]
|
Pack = 16 )]
|
||||||
public struct Matrix22 : IMat
|
public struct Matrix22 : IMat
|
||||||
{
|
{
|
||||||
|
|
||||||
[FieldOffset( 2 * 2 * 4 * sizeof( float ) )]
|
[FieldOffset( 2 * 2 * 4 * sizeof( float ) )]
|
||||||
internal bool isTransposed = false;
|
internal bool isTransposed = false;
|
||||||
|
|
||||||
@@ -50,12 +51,6 @@ namespace StgSharp.Math
|
|||||||
[FieldOffset( 2 * 4 * sizeof( float ) )]
|
[FieldOffset( 2 * 4 * sizeof( float ) )]
|
||||||
internal ColumnSet2 _transpose;
|
internal ColumnSet2 _transpose;
|
||||||
|
|
||||||
public Matrix22()
|
|
||||||
{
|
|
||||||
Unsafe.SkipInit( out this );
|
|
||||||
isTransposed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Matrix22( ColumnSet2 mat )
|
internal Matrix22( ColumnSet2 mat )
|
||||||
{
|
{
|
||||||
this._mat = mat;
|
this._mat = mat;
|
||||||
@@ -69,6 +64,12 @@ namespace StgSharp.Math
|
|||||||
_mat.colum1 = c1;
|
_mat.colum1 = c1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Matrix22()
|
||||||
|
{
|
||||||
|
Unsafe.SkipInit( out this );
|
||||||
|
isTransposed = false;
|
||||||
|
}
|
||||||
|
|
||||||
public Matrix22( float a00, float a01, float a10, float a11 )
|
public Matrix22( float a00, float a01, float a10, float a11 )
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit( out this );
|
Unsafe.SkipInit( out this );
|
||||||
@@ -106,21 +107,16 @@ namespace StgSharp.Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static unsafe Matrix22 operator +(Matrix22 left, Matrix22 right)
|
public static unsafe Matrix22 operator -(
|
||||||
|
Matrix22 left,
|
||||||
|
Matrix22 right )
|
||||||
{
|
{
|
||||||
Matrix22 ret = new Matrix22();
|
Matrix22 ret = new Matrix22();
|
||||||
InternalIO.Intrinsic.add_mat_2( &left._mat, &right._mat, &ret._mat );
|
InternalIO.Intrinsic.sub_mat_2( &left._mat, &right._mat,
|
||||||
|
&ret._mat );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
|
||||||
public static Matrix22 operator -( Matrix22 left, Matrix22 right )
|
|
||||||
{
|
|
||||||
return new Matrix22(
|
|
||||||
left._mat.colum0 + right._mat.colum0,
|
|
||||||
left._mat.colum1 + right._mat.colum1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Matrix22 operator *( Matrix22 mat, float value )
|
public static Matrix22 operator *( Matrix22 mat, float value )
|
||||||
{
|
{
|
||||||
@@ -177,5 +173,16 @@ namespace StgSharp.Math
|
|||||||
mat._mat.colum0 / value, mat._mat.colum1 / value );
|
mat._mat.colum0 / value, mat._mat.colum1 / value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
|
public static unsafe Matrix22 operator +(
|
||||||
|
Matrix22 left,
|
||||||
|
Matrix22 right )
|
||||||
|
{
|
||||||
|
Matrix22 ret = new Matrix22();
|
||||||
|
InternalIO.Intrinsic.add_mat_2( &left._mat, &right._mat,
|
||||||
|
&ret._mat );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,12 +48,6 @@ namespace StgSharp.Math
|
|||||||
[FieldOffset( 3 * 4 * sizeof( float ) )] internal ColumnSet2 _transpose;
|
[FieldOffset( 3 * 4 * sizeof( float ) )] internal ColumnSet2 _transpose;
|
||||||
[FieldOffset( 0 )] internal ColumnSet3 _mat;
|
[FieldOffset( 0 )] internal ColumnSet3 _mat;
|
||||||
|
|
||||||
public Matrix23()
|
|
||||||
{
|
|
||||||
Unsafe.SkipInit( out _mat);
|
|
||||||
Unsafe.SkipInit(out _transpose);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Matrix23( Vector4 c0, Vector4 c1, Vector4 c2 )
|
internal Matrix23( Vector4 c0, Vector4 c1, Vector4 c2 )
|
||||||
{
|
{
|
||||||
_mat.colum0 = c0;
|
_mat.colum0 = c0;
|
||||||
@@ -61,6 +55,12 @@ namespace StgSharp.Math
|
|||||||
_mat.colum2 = c2;
|
_mat.colum2 = c2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Matrix23()
|
||||||
|
{
|
||||||
|
Unsafe.SkipInit( out _mat );
|
||||||
|
Unsafe.SkipInit( out _transpose );
|
||||||
|
}
|
||||||
|
|
||||||
public Matrix23(
|
public Matrix23(
|
||||||
float a00,
|
float a00,
|
||||||
float a01,
|
float a01,
|
||||||
@@ -122,12 +122,14 @@ namespace StgSharp.Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Matrix23 operator -( Matrix23 left, Matrix23 right )
|
public static unsafe Matrix23 operator -(
|
||||||
|
Matrix23 left,
|
||||||
|
Matrix23 right )
|
||||||
{
|
{
|
||||||
return new Matrix23(
|
Matrix23 ret = new Matrix23();
|
||||||
left._mat.colum0 - right._mat.colum0,
|
InternalIO.Intrinsic.sub_mat_3( &left._mat, &right._mat,
|
||||||
left._mat.colum1 - right._mat.colum1,
|
&ret._mat );
|
||||||
left._mat.colum2 - right._mat.colum2 );
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
@@ -189,10 +191,13 @@ namespace StgSharp.Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static unsafe Matrix23 operator +( Matrix23 left, Matrix23 right )
|
public static unsafe Matrix23 operator +(
|
||||||
|
Matrix23 left,
|
||||||
|
Matrix23 right )
|
||||||
{
|
{
|
||||||
Matrix23 ret = new Matrix23();
|
Matrix23 ret = new Matrix23();
|
||||||
InternalIO.Intrinsic.add_mat_3(&left._mat, &right._mat, &ret._mat);
|
InternalIO.Intrinsic.add_mat_3( &left._mat, &right._mat,
|
||||||
|
&ret._mat );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ namespace StgSharp.Math
|
|||||||
Pack = 16 )]
|
Pack = 16 )]
|
||||||
public struct Matrix24 : IMat
|
public struct Matrix24 : IMat
|
||||||
{
|
{
|
||||||
|
|
||||||
[FieldOffset( 6 * 4 * sizeof( float ) )] internal bool isTransposed;
|
[FieldOffset( 6 * 4 * sizeof( float ) )] internal bool isTransposed;
|
||||||
[FieldOffset( 4 * 4 * sizeof( float ) )] internal ColumnSet2 transpose;
|
[FieldOffset( 4 * 4 * sizeof( float ) )] internal ColumnSet2 transpose;
|
||||||
|
|
||||||
@@ -53,12 +54,6 @@ namespace StgSharp.Math
|
|||||||
[FieldOffset( 32 )] public Vec2 Colum2;
|
[FieldOffset( 32 )] public Vec2 Colum2;
|
||||||
[FieldOffset( 48 )] public Vec2 Colum3;
|
[FieldOffset( 48 )] public Vec2 Colum3;
|
||||||
|
|
||||||
public Matrix24()
|
|
||||||
{
|
|
||||||
Unsafe.SkipInit(out this);
|
|
||||||
isTransposed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Matrix24( Vector4 c0, Vector4 c1, Vector4 c2, Vector4 c3 )
|
internal Matrix24( Vector4 c0, Vector4 c1, Vector4 c2, Vector4 c3 )
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit( out this );
|
Unsafe.SkipInit( out this );
|
||||||
@@ -69,6 +64,12 @@ namespace StgSharp.Math
|
|||||||
mat.colum3 = c3;
|
mat.colum3 = c3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Matrix24()
|
||||||
|
{
|
||||||
|
Unsafe.SkipInit( out this );
|
||||||
|
isTransposed = false;
|
||||||
|
}
|
||||||
|
|
||||||
public Matrix24(
|
public Matrix24(
|
||||||
float a00,
|
float a00,
|
||||||
float a01,
|
float a01,
|
||||||
@@ -141,13 +142,13 @@ namespace StgSharp.Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Matrix24 operator -( Matrix24 left, Matrix24 right )
|
public static unsafe Matrix24 operator -(
|
||||||
|
Matrix24 left,
|
||||||
|
Matrix24 right )
|
||||||
{
|
{
|
||||||
return new Matrix24(
|
Matrix24 ret = new Matrix24();
|
||||||
left.mat.colum0 - right.mat.colum0,
|
InternalIO.Intrinsic.sub_mat_4( &left.mat, &right.mat, &ret.mat );
|
||||||
left.mat.colum1 - right.mat.colum1,
|
return ret;
|
||||||
left.mat.colum2 - right.mat.colum2,
|
|
||||||
left.mat.colum3 - right.mat.colum3 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
@@ -209,7 +210,9 @@ namespace StgSharp.Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static unsafe Matrix24 operator +( Matrix24 left, Matrix24 right )
|
public static unsafe Matrix24 operator +(
|
||||||
|
Matrix24 left,
|
||||||
|
Matrix24 right )
|
||||||
{
|
{
|
||||||
Matrix24 ret = new Matrix24();
|
Matrix24 ret = new Matrix24();
|
||||||
InternalIO.Intrinsic.add_mat_4( &left.mat, &right.mat, &ret.mat );
|
InternalIO.Intrinsic.add_mat_4( &left.mat, &right.mat, &ret.mat );
|
||||||
|
|||||||
@@ -52,12 +52,6 @@ namespace StgSharp.Math
|
|||||||
[FieldOffset( 0 )] internal Vec3 colum0;
|
[FieldOffset( 0 )] internal Vec3 colum0;
|
||||||
[FieldOffset( 4 * 4 )] internal Vec3 colum1;
|
[FieldOffset( 4 * 4 )] internal Vec3 colum1;
|
||||||
|
|
||||||
public Matrix32()
|
|
||||||
{
|
|
||||||
Unsafe.SkipInit(out this);
|
|
||||||
isTransposed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Matrix32( Vector4 c0, Vector4 c1 )
|
internal Matrix32( Vector4 c0, Vector4 c1 )
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit( out this );
|
Unsafe.SkipInit( out this );
|
||||||
@@ -66,6 +60,12 @@ namespace StgSharp.Math
|
|||||||
mat.colum1 = c1;
|
mat.colum1 = c1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Matrix32()
|
||||||
|
{
|
||||||
|
Unsafe.SkipInit( out this );
|
||||||
|
isTransposed = false;
|
||||||
|
}
|
||||||
|
|
||||||
public unsafe Matrix32(
|
public unsafe Matrix32(
|
||||||
float a00,
|
float a00,
|
||||||
float a01,
|
float a01,
|
||||||
@@ -209,7 +209,9 @@ namespace StgSharp.Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static unsafe Matrix32 operator +( Matrix32 left, Matrix32 right )
|
public static unsafe Matrix32 operator +(
|
||||||
|
Matrix32 left,
|
||||||
|
Matrix32 right )
|
||||||
{
|
{
|
||||||
Matrix32 ret = new Matrix32();
|
Matrix32 ret = new Matrix32();
|
||||||
InternalIO.Intrinsic.add_mat_2( &left.mat, &right.mat, &ret.mat );
|
InternalIO.Intrinsic.add_mat_2( &left.mat, &right.mat, &ret.mat );
|
||||||
|
|||||||
@@ -52,12 +52,6 @@ namespace StgSharp.Math
|
|||||||
[FieldOffset( 1 * 4 * sizeof( float ) )] public Vec3 Colum1;
|
[FieldOffset( 1 * 4 * sizeof( float ) )] public Vec3 Colum1;
|
||||||
[FieldOffset( 2 * 4 * sizeof( float ) )] public Vec3 Colum2;
|
[FieldOffset( 2 * 4 * sizeof( float ) )] public Vec3 Colum2;
|
||||||
|
|
||||||
public Matrix33()
|
|
||||||
{
|
|
||||||
Unsafe.SkipInit(out this);
|
|
||||||
isTransposed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Matrix33( Vector4 c0, Vector4 c1, Vector4 c2 )
|
internal Matrix33( Vector4 c0, Vector4 c1, Vector4 c2 )
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit( out this );
|
Unsafe.SkipInit( out this );
|
||||||
@@ -67,6 +61,12 @@ namespace StgSharp.Math
|
|||||||
mat.colum2 = c2;
|
mat.colum2 = c2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Matrix33()
|
||||||
|
{
|
||||||
|
Unsafe.SkipInit( out this );
|
||||||
|
isTransposed = false;
|
||||||
|
}
|
||||||
|
|
||||||
public Matrix33(
|
public Matrix33(
|
||||||
float a00,
|
float a00,
|
||||||
float a01,
|
float a01,
|
||||||
@@ -140,12 +140,13 @@ namespace StgSharp.Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Matrix33 operator -( Matrix33 left, Matrix33 right )
|
public static unsafe Matrix33 operator -(
|
||||||
|
Matrix33 left,
|
||||||
|
Matrix33 right )
|
||||||
{
|
{
|
||||||
return new Matrix33(
|
Matrix33 ret = new Matrix33();
|
||||||
left.mat.colum0 - right.mat.colum0,
|
InternalIO.Intrinsic.sub_mat_3( &left.mat, &right.mat, &ret.mat );
|
||||||
left.mat.colum1 - right.mat.colum1,
|
return ret;
|
||||||
left.mat.colum2 + right.mat.colum2 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
@@ -229,7 +230,9 @@ namespace StgSharp.Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static unsafe Matrix33 operator +( Matrix33 left, Matrix33 right )
|
public static unsafe Matrix33 operator +(
|
||||||
|
Matrix33 left,
|
||||||
|
Matrix33 right )
|
||||||
{
|
{
|
||||||
Matrix33 ret = new Matrix33();
|
Matrix33 ret = new Matrix33();
|
||||||
InternalIO.Intrinsic.add_mat_3( &left.mat, &right.mat, &ret.mat );
|
InternalIO.Intrinsic.add_mat_3( &left.mat, &right.mat, &ret.mat );
|
||||||
|
|||||||
@@ -55,12 +55,6 @@ namespace StgSharp.Math
|
|||||||
[FieldOffset( 2 * 4 * sizeof( float ) )] public Vec3 Colum2;
|
[FieldOffset( 2 * 4 * sizeof( float ) )] public Vec3 Colum2;
|
||||||
[FieldOffset( 3 * 4 * sizeof( float ) )] public Vec3 Colum3;
|
[FieldOffset( 3 * 4 * sizeof( float ) )] public Vec3 Colum3;
|
||||||
|
|
||||||
public Matrix34()
|
|
||||||
{
|
|
||||||
Unsafe.SkipInit(out this);
|
|
||||||
isTransposed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Matrix34( ColumnSet4 mat )
|
internal Matrix34( ColumnSet4 mat )
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit( out this );
|
Unsafe.SkipInit( out this );
|
||||||
@@ -78,6 +72,12 @@ namespace StgSharp.Math
|
|||||||
mat.colum3 = c3;
|
mat.colum3 = c3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Matrix34()
|
||||||
|
{
|
||||||
|
Unsafe.SkipInit( out this );
|
||||||
|
isTransposed = false;
|
||||||
|
}
|
||||||
|
|
||||||
public Matrix34(
|
public Matrix34(
|
||||||
float a00,
|
float a00,
|
||||||
float a01,
|
float a01,
|
||||||
@@ -147,13 +147,13 @@ namespace StgSharp.Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static Matrix34 operator -( Matrix34 left, Matrix34 right )
|
public static unsafe Matrix34 operator -(
|
||||||
|
Matrix34 left,
|
||||||
|
Matrix34 right )
|
||||||
{
|
{
|
||||||
return new Matrix34(
|
Matrix34 ret = new Matrix34();
|
||||||
left.mat.colum0 - right.mat.colum0,
|
InternalIO.Intrinsic.sub_mat_4( &left.mat, &right.mat, &ret.mat );
|
||||||
left.mat.colum1 - right.mat.colum1,
|
return ret;
|
||||||
left.mat.colum2 - right.mat.colum2,
|
|
||||||
left.mat.colum3 - right.mat.colum3 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
@@ -227,12 +227,13 @@ namespace StgSharp.Math
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
public static unsafe Matrix34 operator +( Matrix34 left, Matrix34 right )
|
public static unsafe Matrix34 operator +(
|
||||||
|
Matrix34 left,
|
||||||
|
Matrix34 right )
|
||||||
{
|
{
|
||||||
Matrix34 ret = new Matrix34();
|
Matrix34 ret = new Matrix34();
|
||||||
InternalIO.Intrinsic.add_mat_4( &left.mat, &right.mat, &ret.mat );
|
InternalIO.Intrinsic.add_mat_4( &left.mat, &right.mat, &ret.mat );
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,12 +49,6 @@ namespace StgSharp.Math
|
|||||||
[FieldOffset( 0 )] internal ColumnSet2 mat;
|
[FieldOffset( 0 )] internal ColumnSet2 mat;
|
||||||
[FieldOffset( 8 * sizeof( float ) )] internal ColumnSet4 transpose;
|
[FieldOffset( 8 * sizeof( float ) )] internal ColumnSet4 transpose;
|
||||||
|
|
||||||
public Matrix42()
|
|
||||||
{
|
|
||||||
Unsafe.SkipInit(out this);
|
|
||||||
isTransposed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Matrix42( ColumnSet2 mat )
|
internal Matrix42( ColumnSet2 mat )
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit( out this );
|
Unsafe.SkipInit( out this );
|
||||||
@@ -70,6 +64,12 @@ namespace StgSharp.Math
|
|||||||
mat.colum1 = c1;
|
mat.colum1 = c1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Matrix42()
|
||||||
|
{
|
||||||
|
Unsafe.SkipInit( out this );
|
||||||
|
isTransposed = false;
|
||||||
|
}
|
||||||
|
|
||||||
public Matrix42(
|
public Matrix42(
|
||||||
float a00,
|
float a00,
|
||||||
float a01,
|
float a01,
|
||||||
@@ -144,9 +144,9 @@ namespace StgSharp.Math
|
|||||||
Matrix42 left,
|
Matrix42 left,
|
||||||
Matrix42 right )
|
Matrix42 right )
|
||||||
{
|
{
|
||||||
return new Matrix42(
|
Matrix42 ret = new Matrix42();
|
||||||
left.mat.colum0 - right.mat.colum0,
|
InternalIO.Intrinsic.sub_mat_2( &left.mat, &right.mat, &ret.mat );
|
||||||
left.mat.colum0 - right.mat.colum0 );
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
@@ -234,9 +234,9 @@ namespace StgSharp.Math
|
|||||||
Matrix42 left,
|
Matrix42 left,
|
||||||
Matrix42 right )
|
Matrix42 right )
|
||||||
{
|
{
|
||||||
return new Matrix42(
|
Matrix42 ret = new Matrix42();
|
||||||
left.mat.colum0 + right.mat.colum0,
|
InternalIO.Intrinsic.add_mat_2( &left.mat, &right.mat, &ret.mat );
|
||||||
left.mat.colum0 + right.mat.colum0 );
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -60,6 +61,12 @@ namespace StgSharp.Script
|
|||||||
|
|
||||||
public static Token Empty => EmptyToken;
|
public static Token Empty => EmptyToken;
|
||||||
|
|
||||||
|
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||||
|
public Token ReLocate( int line, int column )
|
||||||
|
{
|
||||||
|
return new Token( Value, line, column, Flag );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TokenFlag : int
|
public enum TokenFlag : int
|
||||||
|
|||||||
@@ -51,5 +51,11 @@ namespace StgSharp.Script.Express
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ExpTypeSource ExpBool
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,11 @@ namespace StgSharp.Script.Express
|
|||||||
PoolString( KeyWord.Real ),
|
PoolString( KeyWord.Real ),
|
||||||
out ExpTypeSource? _expReal );
|
out ExpTypeSource? _expReal );
|
||||||
ExpReal = _expReal;
|
ExpReal = _expReal;
|
||||||
|
ExpSchema_Nitload.Only
|
||||||
|
.TryGetType(
|
||||||
|
PoolString( KeyWord.Bool ),
|
||||||
|
out ExpTypeSource? _expBool );
|
||||||
|
ExpBool = _expBool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool LetterIsOperator( string str )
|
public static bool LetterIsOperator( string str )
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ namespace StgSharp.Script.Express
|
|||||||
MUL = "*",
|
MUL = "*",
|
||||||
DIV = "/",
|
DIV = "/",
|
||||||
NOT = "NOT",
|
NOT = "NOT",
|
||||||
|
NotEqual = "<>",
|
||||||
Assignment = ":=",
|
Assignment = ":=",
|
||||||
Equal = "=",
|
Equal = "=",
|
||||||
Mod = "MOD",
|
Mod = "MOD",
|
||||||
|
|||||||
@@ -112,6 +112,41 @@ namespace StgSharp.Script.Express
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ExpBinaryOperatorNode EqualTo(
|
||||||
|
Token source,
|
||||||
|
ExpNode left,
|
||||||
|
ExpNode right )
|
||||||
|
{
|
||||||
|
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
|
||||||
|
throw new ExpInvalidTypeException(
|
||||||
|
left.EqualityTypeConvert.Name,
|
||||||
|
right.EqualityTypeConvert.Name );
|
||||||
|
}
|
||||||
|
return new ExpBinaryOperatorNode( source )
|
||||||
|
{
|
||||||
|
_returnType = ExpCompile.ExpBool,
|
||||||
|
_nodeFlag = ExpNodeFlag.BuiltinType_Boolean | ExpNodeFlag.Operator_Binary,
|
||||||
|
CodeConvertTemplate = "{0} == {1}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ExpBinaryOperatorNode GreaterThan(
|
||||||
|
Token source,
|
||||||
|
ExpNode left,
|
||||||
|
ExpNode right )
|
||||||
|
{
|
||||||
|
if( !left.IsNumber && !right.IsNumber ) {
|
||||||
|
throw new ExpInvalidTypeException(
|
||||||
|
"Number", left.EqualityTypeConvert.Name );
|
||||||
|
}
|
||||||
|
return new ExpBinaryOperatorNode( source )
|
||||||
|
{
|
||||||
|
_returnType = ExpCompile.ExpBool,
|
||||||
|
_nodeFlag = ExpNodeFlag.BuiltinType_Boolean | ExpNodeFlag.Operator_Binary,
|
||||||
|
CodeConvertTemplate = "{0} > {1}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static ExpBinaryOperatorNode Mul(
|
public static ExpBinaryOperatorNode Mul(
|
||||||
Token source,
|
Token source,
|
||||||
ExpNode left,
|
ExpNode left,
|
||||||
@@ -132,6 +167,41 @@ namespace StgSharp.Script.Express
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ExpBinaryOperatorNode NotEqualTo(
|
||||||
|
Token source,
|
||||||
|
ExpNode left,
|
||||||
|
ExpNode right )
|
||||||
|
{
|
||||||
|
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
|
||||||
|
throw new ExpInvalidTypeException(
|
||||||
|
left.EqualityTypeConvert.Name,
|
||||||
|
right.EqualityTypeConvert.Name );
|
||||||
|
}
|
||||||
|
return new ExpBinaryOperatorNode( source )
|
||||||
|
{
|
||||||
|
_returnType = ExpCompile.ExpBool,
|
||||||
|
_nodeFlag = ExpNodeFlag.BuiltinType_Boolean | ExpNodeFlag.Operator_Binary,
|
||||||
|
CodeConvertTemplate = "{0} != {1}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ExpBinaryOperatorNode SmallerThan(
|
||||||
|
Token source,
|
||||||
|
ExpNode left,
|
||||||
|
ExpNode right )
|
||||||
|
{
|
||||||
|
if( !left.IsNumber && !right.IsNumber ) {
|
||||||
|
throw new ExpInvalidTypeException(
|
||||||
|
"Number", left.EqualityTypeConvert.Name );
|
||||||
|
}
|
||||||
|
return new ExpBinaryOperatorNode( source )
|
||||||
|
{
|
||||||
|
_returnType = ExpCompile.ExpBool,
|
||||||
|
_nodeFlag = ExpNodeFlag.BuiltinType_Boolean | ExpNodeFlag.Operator_Binary,
|
||||||
|
CodeConvertTemplate = "{0} < {1}",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static ExpBinaryOperatorNode Sub(
|
public static ExpBinaryOperatorNode Sub(
|
||||||
Token source,
|
Token source,
|
||||||
ExpNode left,
|
ExpNode left,
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="ExpLiteralGenericNode.cs"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload Space
|
||||||
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person
|
||||||
|
// obtaining a copy of this software and associated documentation
|
||||||
|
// files (the “Software”), to deal in the Software without restriction,
|
||||||
|
// including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||||
|
// and to permit persons to whom the Software is furnished to do so,
|
||||||
|
// subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and
|
||||||
|
// this permission notice shall be included in all copies
|
||||||
|
// or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||||
|
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||||
|
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
using StgSharp.Data;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace StgSharp.Script.Express
|
||||||
|
{
|
||||||
|
public class ExpIntNode : ExpElementInstanceBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private int _value;
|
||||||
|
|
||||||
|
public ExpIntNode( Token source, int value )
|
||||||
|
: base( source )
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
_nodeFlag = ExpNodeFlag.BuiltinType_Int | ExpNodeFlag.Element_Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IExpElementSource EqualityTypeConvert => ExpSchema.BuiltinSchema
|
||||||
|
.TryGetType(
|
||||||
|
ExpCompile.KeyWord.Int, out ExpTypeSource? type ) ?
|
||||||
|
type : throw new ExpCompileNotInitializedException();
|
||||||
|
|
||||||
|
public int Value => _value;
|
||||||
|
|
||||||
|
public override string TypeName => ExpCompile.KeyWord.Int;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ExpStringNode : ExpElementInstanceBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly string _value;
|
||||||
|
|
||||||
|
public ExpStringNode( Token source, string value )
|
||||||
|
: base( source )
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
_nodeFlag = ExpNodeFlag.BuiltinType_String | ExpNodeFlag.Element_Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IExpElementSource EqualityTypeConvert => ExpSchema.BuiltinSchema
|
||||||
|
.TryGetType(
|
||||||
|
ExpCompile.KeyWord.String,
|
||||||
|
out ExpTypeSource? type ) ?
|
||||||
|
type : throw new ExpCompileNotInitializedException();
|
||||||
|
|
||||||
|
public override string TypeName => EqualityTypeConvert.Name;
|
||||||
|
|
||||||
|
public string Value => _value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ExpBoolNode : ExpElementInstanceBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly bool _value;
|
||||||
|
|
||||||
|
public ExpBoolNode( Token source, bool value )
|
||||||
|
: base( source )
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
_nodeFlag = ExpNodeFlag.BuiltinType_Boolean | ExpNodeFlag.Element_Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Value => _value;
|
||||||
|
|
||||||
|
public override IExpElementSource EqualityTypeConvert => ExpSchema.BuiltinSchema
|
||||||
|
.TryGetType(
|
||||||
|
ExpCompile.KeyWord.Bool, out ExpTypeSource? type ) ?
|
||||||
|
type : throw new ExpCompileNotInitializedException();
|
||||||
|
|
||||||
|
public override string TypeName => EqualityTypeConvert.Name;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ExpRealNumberNode : ExpElementInstanceBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly float _value;
|
||||||
|
|
||||||
|
public ExpRealNumberNode( Token source, float value )
|
||||||
|
: base( source )
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
_nodeFlag = ExpNodeFlag.BuiltinType_Real | ExpNodeFlag.Element_Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Value => _value;
|
||||||
|
|
||||||
|
public override IExpElementSource EqualityTypeConvert => ExpSchema.BuiltinSchema
|
||||||
|
.TryGetType(
|
||||||
|
ExpCompile.KeyWord.String,
|
||||||
|
out ExpTypeSource? type ) ?
|
||||||
|
type : throw new ExpCompileNotInitializedException();
|
||||||
|
|
||||||
|
public override string TypeName => EqualityTypeConvert.Name;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ExpLogicValueNode : ExpElementInstanceBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private readonly ExpLogic _value;
|
||||||
|
|
||||||
|
public ExpLogicValueNode( Token source, ExpLogic value )
|
||||||
|
: base( source )
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
_nodeFlag = ExpNodeFlag.BuiltinType_Logic | ExpNodeFlag.Element_Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpLogic Value => _value;
|
||||||
|
|
||||||
|
public override IExpElementSource EqualityTypeConvert => ExpSchema.BuiltinSchema
|
||||||
|
.TryGetType(
|
||||||
|
ExpCompile.KeyWord.Logic,
|
||||||
|
out ExpTypeSource? type ) ?
|
||||||
|
type : throw new ExpCompileNotInitializedException();
|
||||||
|
|
||||||
|
public override string TypeName => EqualityTypeConvert.Name;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,14 +62,14 @@ namespace StgSharp.Script.Express
|
|||||||
if( increment == null ) {
|
if( increment == null ) {
|
||||||
switch( ( ExpNodeFlag )variable.NodeFlag | ExpNodeFlag.BuiltinType_Any ) {
|
switch( ( ExpNodeFlag )variable.NodeFlag | ExpNodeFlag.BuiltinType_Any ) {
|
||||||
case ExpNodeFlag.BuiltinType_Real:
|
case ExpNodeFlag.BuiltinType_Real:
|
||||||
increment = new ExpLiteralGenericNode<float>(
|
increment = new ExpRealNumberNode(
|
||||||
new Token(
|
new Token(
|
||||||
ExpCompile.PoolString( "1.0f" ), source.Line,
|
ExpCompile.PoolString( "1.0f" ), source.Line,
|
||||||
-1, TokenFlag.Number ),
|
-1, TokenFlag.Number ),
|
||||||
1.0f );
|
1.0f );
|
||||||
break;
|
break;
|
||||||
case ExpNodeFlag.BuiltinType_Int:
|
case ExpNodeFlag.BuiltinType_Int:
|
||||||
increment = new ExpLiteralGenericNode<int>(
|
increment = new ExpIntNode(
|
||||||
new Token(
|
new Token(
|
||||||
ExpCompile.PoolString( "1" ), source.Line, -1,
|
ExpCompile.PoolString( "1" ), source.Line, -1,
|
||||||
TokenFlag.Number ),
|
TokenFlag.Number ),
|
||||||
|
|||||||
@@ -65,6 +65,13 @@ namespace StgSharp.Script.Express
|
|||||||
case ExpCompile.KeyWord.DIV:
|
case ExpCompile.KeyWord.DIV:
|
||||||
node = ExpBinaryOperatorNode.Div( t, left, right );
|
node = ExpBinaryOperatorNode.Div( t, left, right );
|
||||||
return true;
|
return true;
|
||||||
|
case ExpCompile.KeyWord.Equal:
|
||||||
|
node = ExpBinaryOperatorNode.EqualTo( t, left, right );
|
||||||
|
return true;
|
||||||
|
case ExpCompile.KeyWord.NotEqual:
|
||||||
|
node = ExpBinaryOperatorNode.NotEqualTo( t, left, right );
|
||||||
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
node = ExpNode.Empty;
|
node = ExpNode.Empty;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -76,17 +76,25 @@ namespace StgSharp.Script.Express
|
|||||||
}
|
}
|
||||||
_cache.PushOperand( expToken );
|
_cache.PushOperand( expToken );
|
||||||
break;
|
break;
|
||||||
case TokenFlag.Number or TokenFlag.String or TokenFlag.Member:
|
case TokenFlag.Number or TokenFlag.String:
|
||||||
_cache.PushOperand( expToken );
|
_cache.PushOperand( expToken );
|
||||||
break;
|
break;
|
||||||
|
case TokenFlag.Member:
|
||||||
|
if( _context.TryGetFunction( expToken.Value, out _ ) ) {
|
||||||
|
_cache.PushOperator( expToken );
|
||||||
|
} else { }
|
||||||
|
break;
|
||||||
case TokenFlag.Separator_Single: //a , ; found
|
case TokenFlag.Separator_Single: //a , ; found
|
||||||
// if operator stack is not empty, convert all operators to node until meet a same separator
|
// if operator stack is not empty, convert all operators to node until meet a same separator
|
||||||
// or OperandAheadOfSeparator property is less than certain value
|
// or OperandAheadOfSeparator property is less than certain value
|
||||||
break;
|
break;
|
||||||
case TokenFlag.Separator_Left: //a ( [ { found
|
case TokenFlag.Separator_Left: //a ( [ { found
|
||||||
|
// check if the last token is a function name, loop block or branch
|
||||||
|
// then increase depth
|
||||||
_cache.PushOperator( expToken );
|
_cache.PushOperator( expToken );
|
||||||
break;
|
break;
|
||||||
case TokenFlag.Separator_Right: //a } ] ) found
|
case TokenFlag.Separator_Right: //a } ] ) found
|
||||||
|
//Close current depth and cache call node in this depth as a partial AST
|
||||||
break;
|
break;
|
||||||
case TokenFlag.Index_Left: // a [ found
|
case TokenFlag.Index_Left: // a [ found
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// file="ExpSchemaSource.Compile.cs"
|
||||||
|
// Project: StgSharp
|
||||||
|
// AuthorGroup: Nitload Space
|
||||||
|
// Copyright (c) Nitload Space. All rights reserved.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person
|
||||||
|
// obtaining a copy of this software and associated documentation
|
||||||
|
// files (the “Software”), to deal in the Software without restriction,
|
||||||
|
// including without limitation the rights to use, copy, modify, merge,
|
||||||
|
// publish, distribute, sublicense, and/or sell copies of the Software,
|
||||||
|
// and to permit persons to whom the Software is furnished to do so,
|
||||||
|
// subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and
|
||||||
|
// this permission notice shall be included in all copies
|
||||||
|
// or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED “AS IS”,
|
||||||
|
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
|
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||||
|
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace StgSharp.Script.Express
|
||||||
|
{
|
||||||
|
public enum ExpressCompileOption
|
||||||
|
{
|
||||||
|
|
||||||
|
Default = 0,
|
||||||
|
Translate = 1,
|
||||||
|
Compile = 2,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class ExpSchemaSource
|
||||||
|
{
|
||||||
|
|
||||||
|
public ExpSchema Compile( ExpressCompileOption option )
|
||||||
|
{
|
||||||
|
switch( option ) {
|
||||||
|
case ExpressCompileOption.Default:
|
||||||
|
return Compile_Translate( option );
|
||||||
|
case ExpressCompileOption.Translate:
|
||||||
|
return Compile_Translate( option );
|
||||||
|
case ExpressCompileOption.Compile:
|
||||||
|
throw new NotImplementedException();
|
||||||
|
default:
|
||||||
|
throw new ArgumentException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal GeneratedExpSchema Compile_Translate(
|
||||||
|
ExpressCompileOption option )
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Script")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6f494f25eff44526a1e002d5ebeab8cf7b86a51d")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+16b813646d8a2326551f05c69f727a292a719222")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Script")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Script")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/6f494f25eff44526a1e002d5ebeab8cf7b86a51d/*"}}
|
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/16b813646d8a2326551f05c69f727a292a719222/*"}}
|
||||||
@@ -59,45 +59,15 @@ namespace StgSharp
|
|||||||
try {
|
try {
|
||||||
StgSharp.Init();
|
StgSharp.Init();
|
||||||
|
|
||||||
/*
|
/**/
|
||||||
ExpCompile.InitCompile();
|
ExpCompile.InitCompile();
|
||||||
ExpFileSource reader = new ExpFileSource( testExpPath );
|
ExpFileSource reader = new ExpFileSource( testExpPath );
|
||||||
ExpSchemaSource schemaSource = new ExpSchemaSource();
|
ExpSchemaSource schemaSource = new ExpSchemaSource();
|
||||||
schemaSource.ReadSchema( reader );
|
schemaSource.ReadSchema( reader );
|
||||||
|
|
||||||
ScriptSourceTransmitter st = new ScriptSourceTransmitter(
|
|
||||||
"end", 0 );
|
|
||||||
for( int i = 0; i < 10; i++ ) {
|
|
||||||
string str = $"rawCode () (\"\") {i}";
|
|
||||||
Console.WriteLine( str );
|
|
||||||
st.WriteLine( str );
|
|
||||||
}
|
|
||||||
for( int i = 0; i < 10; i++ ) {
|
|
||||||
string str = $"Code{i} {new string(' ', i + 1)}-- Comment{i}";
|
|
||||||
Console.WriteLine( str );
|
|
||||||
st.WriteLine( str );
|
|
||||||
}
|
|
||||||
st.WriteLine( "CodeBef (* comment" );
|
|
||||||
st.WriteLine( $"comment *) codeAft" );
|
|
||||||
Console.WriteLine( "CodeBef (* comment_" );
|
|
||||||
Console.WriteLine( $"_comment *) codeAft" );
|
|
||||||
for( int i = 0; i < 10; i++ ) {
|
|
||||||
string str = $" Code{i} (* (* Comment{i} *) *) Code{i}";
|
|
||||||
Console.WriteLine( str );
|
|
||||||
st.WriteLine( str );
|
|
||||||
}
|
|
||||||
st.WriteLine( "end" );
|
|
||||||
ExpSourceReader sr = new ExpSourceReader( st );
|
|
||||||
int count = 0;
|
|
||||||
while( !sr.IsEmpty ) {
|
|
||||||
count++;
|
|
||||||
Token str = sr.ReadToken();
|
|
||||||
Console.WriteLine(
|
|
||||||
$"{count}\t{str.Flag}\t\t{str.Value.ToString()}" );
|
|
||||||
}
|
|
||||||
IScriptSourceProvider slice = st.Slice( 5, 2 );
|
|
||||||
/**/
|
|
||||||
/**/
|
/**/
|
||||||
|
/*
|
||||||
|
|
||||||
StgSharp.InitGL( 4, 6 );
|
StgSharp.InitGL( 4, 6 );
|
||||||
StgSharp.GlobalSetting.VSyncActivated = false;
|
StgSharp.GlobalSetting.VSyncActivated = false;
|
||||||
@@ -126,8 +96,8 @@ namespace StgSharp
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch( Exception ) {
|
catch( Exception ex ) {
|
||||||
throw;
|
Console.WriteLine( ex.Message );
|
||||||
/*
|
/*
|
||||||
StgSharp.WriteLog($"{ex}", LogType.Error);
|
StgSharp.WriteLog($"{ex}", LogType.Error);
|
||||||
if( true ) { }
|
if( true ) { }
|
||||||
|
|||||||
Reference in New Issue
Block a user