Daily update on 20250430-073804 by Nitload Youmu. Additional Message : full function of syntax analyze to STEP file

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-04-30 07:38:04 +08:00
parent a6411e2f25
commit 74c01effe4
52 changed files with 693 additions and 442 deletions
+2 -1
View File
@@ -19,7 +19,8 @@ INTERNAL int SSCDECL city_hash_simplify_sse(byte const *str, int const length)
hash = _mm_crc32_u16(hash, *ptr); hash = _mm_crc32_u16(hash, *ptr);
} }
} else { } else {
byte *last_128 = end - 16, *last_32 = end - 4; byte *last_128 = end - 16;
byte *last_32 = end - 4;
uint64_t hash64 = size; uint64_t hash64 = size;
for (; ptr < last_128; ptr += 16) { for (; ptr < last_128; ptr += 16) {
__m128i vec = _mm_loadu_si32((int *)ptr); __m128i vec = _mm_loadu_si32((int *)ptr);
Binary file not shown.
Binary file not shown.
Binary file not shown.
+5 -60
View File
@@ -1,62 +1,7 @@
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(517,5): warning MSB8004: Output 目录未以斜杠结尾。 此生成实例将添加斜杠,因为必须有这个斜杠才能正确计算 Output 目录。 C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(517,5): warning MSB8004: Output 目录未以斜杠结尾。 此生成实例将添加斜杠,因为必须有这个斜杠才能正确计算 Output 目录。
mat4.c hash.c
string.c D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\hash.c(30,43): warning C4244: “函数”: 从“uint64_t”转换到“unsigned char”,可能丢失数据
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\string.c(21,54): warning C4267: “return”: 从“size_t”转换到“int”,可能丢失数据 D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\hash.c(31,50): warning C4244: “函数”: 从“uint64_t”转换到“unsigned char”,可能丢失数据
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(9,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容 D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\hash.c(7,15): warning C4090: “初始化”: 不同的“const”限定符
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\string.c(36,54): warning C4267: “return”: 从“size_t”转换到“int”,可能丢失数据 D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\hash.c(7,34): warning C4090: “初始化”: 不同的“const”限定符
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(9,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(11,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(11,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(20,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(20,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(22,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(22,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(24,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(24,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(26,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(26,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(36,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(36,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(38,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(38,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(40,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(40,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(42,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(42,62): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(51,54): warning C4028: 形参 1 与声明不同
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(51,84): warning C4028: 形参 2 与声明不同
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(53,22): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(54,22): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(55,22): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(56,22): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(59,28): warning C4013: “det_mat3_internal”未定义;假设外部返回 int
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(59,28): warning C4244: “函数”: 从“int”转换到“float”,可能丢失数据
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(59,62): warning C4244: “函数”: 从“int”转换到“float”,可能丢失数据
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(60,28): warning C4244: “函数”: 从“int”转换到“float”,可能丢失数据
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(60,62): warning C4244: “函数”: 从“int”转换到“float”,可能丢失数据
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(61,36): warning C4133: “函数”: 从“const __m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(69,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(69,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(70,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(70,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(71,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(71,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(72,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(72,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(77,38): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(77,63): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(78,38): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(78,63): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(88,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(88,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(89,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(89,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(90,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(90,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(91,37): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(91,61): warning C4133: “函数”: 从“__m128 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(96,38): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(96,63): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(97,38): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.C\mat4.c(97,63): warning C4133: “函数”: 从“__m256 *”到“const float *”的类型不兼容
StgSharpC.vcxproj -> D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\build\StgSharp.C.dll StgSharpC.vcxproj -> D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\build\StgSharp.C.dll
+26 -23
View File
@@ -332,24 +332,27 @@ $LN9@city_hash_:
00101 e9 21 01 00 00 jmp $LN23@city_hash_ 00101 e9 21 01 00 00 jmp $LN23@city_hash_
$LN22@city_hash_: $LN22@city_hash_:
; 22 : byte *last_128 = end - 16, *last_32 = end - 4; ; 22 : byte *last_128 = end - 16;
00106 48 8b 45 48 mov rax, QWORD PTR end$[rbp] 00106 48 8b 45 48 mov rax, QWORD PTR end$[rbp]
0010a 48 83 e8 10 sub rax, 16 0010a 48 83 e8 10 sub rax, 16
0010e 48 89 85 a8 00 0010e 48 89 85 a8 00
00 00 mov QWORD PTR last_128$2[rbp], rax 00 00 mov QWORD PTR last_128$2[rbp], rax
; 23 : byte *last_32 = end - 4;
00115 48 8b 45 48 mov rax, QWORD PTR end$[rbp] 00115 48 8b 45 48 mov rax, QWORD PTR end$[rbp]
00119 48 83 e8 04 sub rax, 4 00119 48 83 e8 04 sub rax, 4
0011d 48 89 85 c8 00 0011d 48 89 85 c8 00
00 00 mov QWORD PTR last_32$3[rbp], rax 00 00 mov QWORD PTR last_32$3[rbp], rax
; 23 : uint64_t hash64 = size; ; 24 : uint64_t hash64 = size;
00124 8b 45 24 mov eax, DWORD PTR size$[rbp] 00124 8b 45 24 mov eax, DWORD PTR size$[rbp]
00127 48 89 85 e8 00 00127 48 89 85 e8 00
00 00 mov QWORD PTR hash64$4[rbp], rax 00 00 mov QWORD PTR hash64$4[rbp], rax
; 24 : for (; ptr < last_128; ptr += 16) { ; 25 : for (; ptr < last_128; ptr += 16) {
0012e eb 0c jmp SHORT $LN13@city_hash_ 0012e eb 0c jmp SHORT $LN13@city_hash_
$LN11@city_hash_: $LN11@city_hash_:
@@ -362,14 +365,14 @@ $LN13@city_hash_:
00143 48 39 45 68 cmp QWORD PTR ptr$[rbp], rax 00143 48 39 45 68 cmp QWORD PTR ptr$[rbp], rax
00147 73 5e jae SHORT $LN12@city_hash_ 00147 73 5e jae SHORT $LN12@city_hash_
; 25 : __m128i vec = _mm_loadu_si32((int *)ptr); ; 26 : __m128i vec = _mm_loadu_si32((int *)ptr);
00149 48 8b 45 68 mov rax, QWORD PTR ptr$[rbp] 00149 48 8b 45 68 mov rax, QWORD PTR ptr$[rbp]
0014d 66 0f 6e 00 movd xmm0, DWORD PTR [rax] 0014d 66 0f 6e 00 movd xmm0, DWORD PTR [rax]
00151 66 0f 7f 85 10 00151 66 0f 7f 85 10
01 00 00 movdqa XMMWORD PTR vec$5[rbp], xmm0 01 00 00 movdqa XMMWORD PTR vec$5[rbp], xmm0
; 26 : hash64 = _mm_crc32_u64(hash64, _mm_extract_epi64(vec, 0)); ; 27 : hash64 = _mm_crc32_u64(hash64, _mm_extract_epi64(vec, 0));
00159 66 0f 6f 85 10 00159 66 0f 6f 85 10
01 00 00 movdqa xmm0, XMMWORD PTR vec$5[rbp] 01 00 00 movdqa xmm0, XMMWORD PTR vec$5[rbp]
@@ -383,7 +386,7 @@ $LN13@city_hash_:
00178 48 89 85 e8 00 00178 48 89 85 e8 00
00 00 mov QWORD PTR hash64$4[rbp], rax 00 00 mov QWORD PTR hash64$4[rbp], rax
; 27 : hash64 = _mm_crc32_u64(hash64, _mm_extract_epi64(vec, 1)); ; 28 : hash64 = _mm_crc32_u64(hash64, _mm_extract_epi64(vec, 1));
0017f 66 0f 6f 85 10 0017f 66 0f 6f 85 10
01 00 00 movdqa xmm0, XMMWORD PTR vec$5[rbp] 01 00 00 movdqa xmm0, XMMWORD PTR vec$5[rbp]
@@ -397,19 +400,19 @@ $LN13@city_hash_:
0019e 48 89 85 e8 00 0019e 48 89 85 e8 00
00 00 mov QWORD PTR hash64$4[rbp], rax 00 00 mov QWORD PTR hash64$4[rbp], rax
; 28 : } ; 29 : }
001a5 eb 89 jmp SHORT $LN11@city_hash_ 001a5 eb 89 jmp SHORT $LN11@city_hash_
$LN12@city_hash_: $LN12@city_hash_:
; 29 : hash = _mm_crc32_u8(hash, hash64); ; 30 : hash = _mm_crc32_u8(hash, hash64);
001a7 8b 45 04 mov eax, DWORD PTR hash$[rbp] 001a7 8b 45 04 mov eax, DWORD PTR hash$[rbp]
001aa f2 0f 38 f0 85 001aa f2 0f 38 f0 85
e8 00 00 00 crc32 eax, BYTE PTR hash64$4[rbp] e8 00 00 00 crc32 eax, BYTE PTR hash64$4[rbp]
001b3 89 45 04 mov DWORD PTR hash$[rbp], eax 001b3 89 45 04 mov DWORD PTR hash$[rbp], eax
; 30 : hash = _mm_crc32_u8(hash, hash64 >> 32); ; 31 : hash = _mm_crc32_u8(hash, hash64 >> 32);
001b6 48 8b 85 e8 00 001b6 48 8b 85 e8 00
00 00 mov rax, QWORD PTR hash64$4[rbp] 00 00 mov rax, QWORD PTR hash64$4[rbp]
@@ -419,7 +422,7 @@ $LN12@city_hash_:
001c9 8b c1 mov eax, ecx 001c9 8b c1 mov eax, ecx
001cb 89 45 04 mov DWORD PTR hash$[rbp], eax 001cb 89 45 04 mov DWORD PTR hash$[rbp], eax
; 31 : for (; ptr < last_32; ptr += 4) { ; 32 : for (; ptr < last_32; ptr += 4) {
001ce eb 0c jmp SHORT $LN16@city_hash_ 001ce eb 0c jmp SHORT $LN16@city_hash_
$LN14@city_hash_: $LN14@city_hash_:
@@ -432,7 +435,7 @@ $LN16@city_hash_:
001e3 48 39 45 68 cmp QWORD PTR ptr$[rbp], rax 001e3 48 39 45 68 cmp QWORD PTR ptr$[rbp], rax
001e7 73 13 jae SHORT $LN15@city_hash_ 001e7 73 13 jae SHORT $LN15@city_hash_
; 32 : hash = _mm_crc32_u32(hash,*(uint32_t *)ptr); ; 33 : hash = _mm_crc32_u32(hash,*(uint32_t *)ptr);
001e9 48 8b 45 68 mov rax, QWORD PTR ptr$[rbp] 001e9 48 8b 45 68 mov rax, QWORD PTR ptr$[rbp]
001ed 8b 4d 04 mov ecx, DWORD PTR hash$[rbp] 001ed 8b 4d 04 mov ecx, DWORD PTR hash$[rbp]
@@ -440,12 +443,12 @@ $LN16@city_hash_:
001f5 8b c1 mov eax, ecx 001f5 8b c1 mov eax, ecx
001f7 89 45 04 mov DWORD PTR hash$[rbp], eax 001f7 89 45 04 mov DWORD PTR hash$[rbp], eax
; 33 : } ; 34 : }
001fa eb d4 jmp SHORT $LN14@city_hash_ 001fa eb d4 jmp SHORT $LN14@city_hash_
$LN15@city_hash_: $LN15@city_hash_:
; 34 : for (; ptr < end; ptr += 2) { ; 35 : for (; ptr < end; ptr += 2) {
001fc eb 0c jmp SHORT $LN19@city_hash_ 001fc eb 0c jmp SHORT $LN19@city_hash_
$LN17@city_hash_: $LN17@city_hash_:
@@ -457,7 +460,7 @@ $LN19@city_hash_:
0020e 48 39 45 68 cmp QWORD PTR ptr$[rbp], rax 0020e 48 39 45 68 cmp QWORD PTR ptr$[rbp], rax
00212 73 13 jae SHORT $LN18@city_hash_ 00212 73 13 jae SHORT $LN18@city_hash_
; 35 : hash = _mm_crc32_u8(hash,*ptr); ; 36 : hash = _mm_crc32_u8(hash,*ptr);
00214 48 8b 45 68 mov rax, QWORD PTR ptr$[rbp] 00214 48 8b 45 68 mov rax, QWORD PTR ptr$[rbp]
00218 8b 4d 04 mov ecx, DWORD PTR hash$[rbp] 00218 8b 4d 04 mov ecx, DWORD PTR hash$[rbp]
@@ -465,15 +468,15 @@ $LN19@city_hash_:
00220 8b c1 mov eax, ecx 00220 8b c1 mov eax, ecx
00222 89 45 04 mov DWORD PTR hash$[rbp], eax 00222 89 45 04 mov DWORD PTR hash$[rbp], eax
; 36 : } ; 37 : }
00225 eb d7 jmp SHORT $LN17@city_hash_ 00225 eb d7 jmp SHORT $LN17@city_hash_
$LN18@city_hash_: $LN18@city_hash_:
$LN23@city_hash_: $LN23@city_hash_:
$LN21@city_hash_: $LN21@city_hash_:
; 37 : } ; 38 : }
; 38 : hash ^= hash >> 16; ; 39 : hash ^= hash >> 16;
00227 8b 45 04 mov eax, DWORD PTR hash$[rbp] 00227 8b 45 04 mov eax, DWORD PTR hash$[rbp]
0022a c1 e8 10 shr eax, 16 0022a c1 e8 10 shr eax, 16
@@ -482,13 +485,13 @@ $LN21@city_hash_:
00232 8b c1 mov eax, ecx 00232 8b c1 mov eax, ecx
00234 89 45 04 mov DWORD PTR hash$[rbp], eax 00234 89 45 04 mov DWORD PTR hash$[rbp], eax
; 39 : hash *= 0x85ebca6b; ; 40 : hash *= 0x85ebca6b;
00237 69 45 04 6b ca 00237 69 45 04 6b ca
eb 85 imul eax, DWORD PTR hash$[rbp], -2048144789 ; 85ebca6bH eb 85 imul eax, DWORD PTR hash$[rbp], -2048144789 ; 85ebca6bH
0023e 89 45 04 mov DWORD PTR hash$[rbp], eax 0023e 89 45 04 mov DWORD PTR hash$[rbp], eax
; 40 : hash ^= hash >> 13; ; 41 : hash ^= hash >> 13;
00241 8b 45 04 mov eax, DWORD PTR hash$[rbp] 00241 8b 45 04 mov eax, DWORD PTR hash$[rbp]
00244 c1 e8 0d shr eax, 13 00244 c1 e8 0d shr eax, 13
@@ -497,13 +500,13 @@ $LN21@city_hash_:
0024c 8b c1 mov eax, ecx 0024c 8b c1 mov eax, ecx
0024e 89 45 04 mov DWORD PTR hash$[rbp], eax 0024e 89 45 04 mov DWORD PTR hash$[rbp], eax
; 41 : hash *= 0xc2b2ae35; ; 42 : hash *= 0xc2b2ae35;
00251 69 45 04 35 ae 00251 69 45 04 35 ae
b2 c2 imul eax, DWORD PTR hash$[rbp], -1028477387 ; c2b2ae35H b2 c2 imul eax, DWORD PTR hash$[rbp], -1028477387 ; c2b2ae35H
00258 89 45 04 mov DWORD PTR hash$[rbp], eax 00258 89 45 04 mov DWORD PTR hash$[rbp], eax
; 42 : hash ^= hash >> 16; ; 43 : hash ^= hash >> 16;
0025b 8b 45 04 mov eax, DWORD PTR hash$[rbp] 0025b 8b 45 04 mov eax, DWORD PTR hash$[rbp]
0025e c1 e8 10 shr eax, 16 0025e c1 e8 10 shr eax, 16
@@ -512,11 +515,11 @@ $LN21@city_hash_:
00266 8b c1 mov eax, ecx 00266 8b c1 mov eax, ecx
00268 89 45 04 mov DWORD PTR hash$[rbp], eax 00268 89 45 04 mov DWORD PTR hash$[rbp], eax
; 43 : return hash; ; 44 : return hash;
0026b 8b 45 04 mov eax, DWORD PTR hash$[rbp] 0026b 8b 45 04 mov eax, DWORD PTR hash$[rbp]
; 44 : } ; 45 : }
0026e 48 8d a5 f8 01 0026e 48 8d a5 f8 01
00 00 lea rsp, QWORD PTR [rbp+504] 00 00 lea rsp, QWORD PTR [rbp+504]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+7 -10
View File
@@ -42,20 +42,17 @@ namespace StgSharp
internal readonly T _defualtIncreament; internal readonly T _defualtIncreament;
public Counter( public Counter( T defaultValue, T defaultIncrement, T defaultDecrement )
T defualtValue,
T defualtIncreament,
T defualtDecreament )
{ {
_value = defualtValue; _value = defaultValue;
_defaultValue = defualtValue; _defaultValue = defaultValue;
_defualtIncreament = defualtIncreament; _defualtIncreament = defaultIncrement;
_defualtDecreament = defualtDecreament; _defualtDecreament = defaultDecrement;
} }
public T DecreamentSoan => _defualtDecreament; public T DecrementSpan => _defualtDecreament;
public T IncreamentSpan => _defualtIncreament; public T IncrementSpan => _defualtIncreament;
public T CurrentSpan => _value - _defaultValue; public T CurrentSpan => _value - _defaultValue;
@@ -45,9 +45,11 @@ namespace StgSharp.Graphics.OpenGL
{ {
/// <summary> /// <summary>
/// Create an instance of <see cref="Shader" /> program /// Create an instance of <see cref="Shader" /> program
/// </summary> /// </summary>
/// <returns> New instance of <see cref="Shader" /> instance. </returns> /// <returns>
/// New instance of <see cref="Shader" /> instance.
/// </returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
protected override sealed ShaderProgram CreateShaderProgram() protected override sealed ShaderProgram CreateShaderProgram()
{ {
@@ -55,9 +57,7 @@ namespace StgSharp.Graphics.OpenGL
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
protected override sealed Shader CreateShaderSegment( protected override sealed Shader CreateShaderSegment( ShaderType type, int count )
ShaderType type,
int count )
{ {
return new Shader( GL.CreateShaderSet( count, type ), type, this ); return new Shader( GL.CreateShaderSet( count, type ), type, this );
} }
@@ -71,10 +71,7 @@ namespace StgSharp.Graphics.OpenGL
internal readonly GlHandle[] handle; internal readonly GlHandle[] handle;
public readonly ShaderType type; public readonly ShaderType type;
internal unsafe Shader( internal unsafe Shader( GlHandle[] handle, ShaderType usage, glRender stream )
GlHandle[] handle,
ShaderType usage,
glRender stream )
{ {
this.handle = handle; this.handle = handle;
GL = stream.GL; GL = stream.GL;
@@ -84,10 +81,14 @@ namespace StgSharp.Graphics.OpenGL
public SerializableTypeCode SSDTypeCode => SerializableTypeCode.Shader; public SerializableTypeCode SSDTypeCode => SerializableTypeCode.Shader;
/// <summary> /// <summary>
/// Attach one shader code to a shader program. /// Attach one shader code to a shader program.
/// </summary> /// </summary>
/// <param _name="target"> Shader program to attach </param> /// <param _name="target">
/// <param _name="index"> Index of shader code in current shader code set. </param> /// Shader program to attach
/// </param>
/// <param _name="index">
/// Index of shader code in current shader code set.
/// </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public void AttachTo( int index, ShaderProgram target ) public void AttachTo( int index, ShaderProgram target )
{ {
@@ -98,16 +99,22 @@ namespace StgSharp.Graphics.OpenGL
{ {
string log = GL.GetShaderStatus( this, index, ( int )status ); string log = GL.GetShaderStatus( this, index, ( int )status );
if( !string.IsNullOrEmpty( log ) ) { if( !string.IsNullOrEmpty( log ) ) {
throw new Exception( $"{$"Shader Error \t{status}\n"}{log}" ); throw new InvalidOperationException( $"{$"Shader Error \t{status}\n"}{log}" );
} }
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void Compile( int index, ReadOnlySpan<byte> codeU8Stream )
{
GL.LoadShaderSource( handle[ index ], codeU8Stream );
GL.CompileShader( handle[ index ] );
CheckStatus( index, ShaderStatus.CompileStatus );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void Compile( int index, byte[] codeStream ) public unsafe void Compile( int index, byte[] codeStream )
{ {
if( codeStream == null ) { ArgumentNullException.ThrowIfNull( codeStream );
throw new ArgumentNullException( nameof( codeStream ) );
}
GL.LoadShaderSource( handle[ index ], codeStream ); GL.LoadShaderSource( handle[ index ], codeStream );
GL.CompileShader( handle[ index ] ); GL.CompileShader( handle[ index ] );
CheckStatus( index, ShaderStatus.CompileStatus ); CheckStatus( index, ShaderStatus.CompileStatus );
@@ -119,8 +126,7 @@ namespace StgSharp.Graphics.OpenGL
if( codeStream == null ) { if( codeStream == null ) {
throw new ArgumentNullException( nameof( codeStream ) ); throw new ArgumentNullException( nameof( codeStream ) );
} }
GL.LoadShaderSource( GL.LoadShaderSource( handle[ index ], codeStream.AsSpan() );
handle[ index ], codeStream.AsSpan() );
GL.CompileShader( handle[ index ] ); GL.CompileShader( handle[ index ] );
CheckStatus( index, ShaderStatus.CompileStatus ); CheckStatus( index, ShaderStatus.CompileStatus );
} }
@@ -134,8 +140,7 @@ namespace StgSharp.Graphics.OpenGL
{ {
string str = File.ReadAllText( fileRoute ); string str = File.ReadAllText( fileRoute );
if( string.IsNullOrEmpty( str ) ) { if( string.IsNullOrEmpty( str ) ) {
throw new InvalidOperationException( throw new InvalidOperationException( $"Cannot load and GLSL code from {fileRoute}" );
$"Cannot load and GLSL code from {fileRoute}" );
} }
return Encoding.UTF8.GetBytes( str ); return Encoding.UTF8.GetBytes( str );
} }
@@ -171,7 +176,7 @@ namespace StgSharp.Graphics.OpenGL
internal readonly GlHandle handle; internal readonly GlHandle handle;
/// <summary> /// <summary>
/// CustomizeInit a program with no shader attached. /// CustomizeInit a program with no shader attached.
/// </summary> /// </summary>
internal unsafe ShaderProgram( glRender binding ) internal unsafe ShaderProgram( glRender binding )
{ {
@@ -180,10 +185,14 @@ namespace StgSharp.Graphics.OpenGL
} }
/// <summary> /// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided. /// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary> /// </summary>
/// <param _name="name"> ContextName of the Uniform in shader code </param> /// <param _name="name">
/// <returns></returns> /// ContextName of the Uniform in shader code
/// </param>
/// <returns>
///
/// </returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe Uniform<T> GetUniform<T>( string name ) where T: struct public unsafe Uniform<T> GetUniform<T>( string name ) where T: struct
{ {
@@ -191,70 +200,79 @@ namespace StgSharp.Graphics.OpenGL
} }
/// <summary> /// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided. /// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary> /// </summary>
/// <param _name="name"> ContextName of the Uniform in shader code </param> /// <param _name="name">
/// <returns></returns> /// ContextName of the Uniform in shader code
public unsafe Uniform<T, U> GetUniform<T, U>( string name ) /// </param>
where T: struct /// <returns>
where U: struct ///
/// </returns>
public unsafe Uniform<T, U> GetUniform<T, U>( string name ) where T: struct where U: struct
{ {
return new Uniform<T, U>( return new Uniform<T, U>( GL.GetUniformLocation( this.handle, name ) );
GL.GetUniformLocation( this.handle, name ) );
} }
/// <summary> /// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided. /// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary> /// </summary>
/// <param _name="name"> ContextName of the Uniform in shader code </param> /// <param _name="name">
/// <returns></returns> /// ContextName of the Uniform in shader code
public unsafe Uniform<T, U, V> GetUniform<T, U, V>( string name ) /// </param>
where T: struct /// <returns>
///
/// </returns>
public unsafe Uniform<T, U, V> GetUniform<T, U, V>( string name ) where T: struct
where U: struct where U: struct
where V: struct where V: struct
{ {
return new Uniform<T, U, V>( return new Uniform<T, U, V>( GL.GetUniformLocation( this.handle, name ) );
GL.GetUniformLocation( this.handle, name ) );
} }
/// <summary> /// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided. /// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary> /// </summary>
/// <param _name="name"> ContextName of the Uniform in shader code </param> /// <param _name="name">
/// <returns></returns> /// ContextName of the Uniform in shader code
public unsafe Uniform<T, U, V, W> GetUniform<T, U, V, W>( string name ) /// </param>
where T: struct /// <returns>
///
/// </returns>
public unsafe Uniform<T, U, V, W> GetUniform<T, U, V, W>( string name ) where T: struct
where U: struct where U: struct
where V: struct where V: struct
where W: struct where W: struct
{ {
return new Uniform<T, U, V, W>( return new Uniform<T, U, V, W>( GL.GetUniformLocation( this.handle, name ) );
GL.GetUniformLocation( this.handle, name ) );
} }
/// <summary> /// <summary>
/// Link the shader to current viewPortDisplay. /// Link the shader to current viewPortDisplay.
/// </summary> /// </summary>
public unsafe void Link() public unsafe void Link()
{ {
if( InternalIO.InternalLinkShaderProgram( if( InternalIO.InternalLinkShaderProgram(
( OpenglContext* )this.GL.ContextHandle, handle.Value ) == 0 ) { ( OpenglContext* )this.GL.ContextHandle, handle.Value ) ==
0 )
{
IntPtr logPtr = InternalIO.InternalReadSSCLog(); IntPtr logPtr = InternalIO.InternalReadSSCLog();
try { try
{
byte[] logByte = new byte[512]; byte[] logByte = new byte[512];
Marshal.Copy( logPtr, logByte, 0, 512 ); Marshal.Copy( logPtr, logByte, 0, 512 );
string log = Encoding.UTF8.GetString( logByte ); string log = Encoding.UTF8.GetString( logByte );
log = log.Replace( "\0", string.Empty ); log = log.Replace( "\0", string.Empty );
InternalIO.InternalWriteLog( log, LogType.Error ); InternalIO.InternalWriteLog( log, LogType.Error );
} }
catch( Exception ex ) { catch( Exception ex )
{
InternalIO.InternalWriteLog( ex.Message, LogType.Error ); InternalIO.InternalWriteLog( ex.Message, LogType.Error );
} }
} }
} }
/// <summary> /// <summary>
/// Let the current viewPortDisplay use this shader. /// Let the current viewPortDisplay use this shader.
/// </summary> /// </summary>
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void Use() public unsafe void Use()
+176 -177
View File
@@ -50,8 +50,7 @@ namespace StgSharp.Graphics.OpenGL
private static Dictionary<IntPtr, OpenGLFunction> contextToGLMap = new Dictionary<IntPtr, OpenGLFunction>( private static Dictionary<IntPtr, OpenGLFunction> contextToGLMap = new Dictionary<IntPtr, OpenGLFunction>(
); );
private static ThreadLocal<OpenGLFunction> _currentGL = new ThreadLocal<OpenGLFunction>( private static ThreadLocal<OpenGLFunction> _currentGL = new ThreadLocal<OpenGLFunction>();
);
private OpenglContext* _context; private OpenglContext* _context;
private Lazy<int> _attachmentColorRange; private Lazy<int> _attachmentColorRange;
@@ -64,8 +63,7 @@ namespace StgSharp.Graphics.OpenGL
InitializeUnusedTextureImageUint ); InitializeUnusedTextureImageUint );
_attachmentColorRange = new Lazy<int>( _attachmentColorRange = new Lazy<int>(
() => { () => {
return GetMaskInteger( return GetMaskInteger( ( uint )glConst.MAX_COLOR_ATTACHMENTS );
( uint )glConst.MAX_COLOR_ATTACHMENTS );
} ); } );
} }
@@ -87,7 +85,8 @@ namespace StgSharp.Graphics.OpenGL
get get
{ {
#if DEBUG #if DEBUG
if( ( IntPtr )_context == IntPtr.Zero ) { if( ( IntPtr )_context == IntPtr.Zero )
{
throw new NullReferenceException(); throw new NullReferenceException();
} }
#endif #endif
@@ -126,11 +125,15 @@ namespace StgSharp.Graphics.OpenGL
} }
/// <summary> /// <summary>
/// Bind a frame Buffer to a frame Buffer target Same function as <see /// Bind a frame Buffer to a frame Buffer target Same function as <see
/// href="https://docs._gl/gl3/glBindFramebuffer">glBindFramebuffer</see>. /// href="https://docs._gl/gl3/glBindFramebuffer"> glBindFramebuffer </see>.
/// </summary> /// </summary>
/// <param _name="target"> The frame Buffer target of the binding operation. </param> /// <param _name="target">
/// <param _name="handle"> The handle of the frame Buffer object to bind. </param> /// The frame Buffer target of the binding operation.
/// </param>
/// <param _name="handle">
/// The handle of the frame Buffer object to bind.
/// </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public void BindFrameBuffer( FrameBufferTarget target, GlHandle handle ) public void BindFrameBuffer( FrameBufferTarget target, GlHandle handle )
{ {
@@ -156,11 +159,9 @@ namespace StgSharp.Graphics.OpenGL
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public FrameBufferStatus CheckFrameBufferStatus( public FrameBufferStatus CheckFrameBufferStatus( FrameBufferTarget target )
FrameBufferTarget target )
{ {
return ( FrameBufferStatus )Context.glCheckFramebufferStatus( return ( FrameBufferStatus )Context.glCheckFramebufferStatus( ( uint )target );
( uint )target );
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
@@ -179,7 +180,8 @@ namespace StgSharp.Graphics.OpenGL
public void ClearError() public void ClearError()
{ {
uint code = 0; uint code = 0;
for( int i = 0; i < 1024; i++ ) { for( int i = 0; i < 1024; i++ )
{
code = Context.glGetError(); code = Context.glGetError();
if( code == 0 ) { if( code == 0 ) {
return; return;
@@ -201,12 +203,11 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public void CombineFrameBufferRenderBuffer( public void CombineFrameBufferRenderBuffer(
FrameBufferAttachment attachment, FrameBufferAttachment attachment,
GlHandle rboHandle ) GlHandle rboHandle )
{ {
Context.glFramebufferRenderbuffer( Context.glFramebufferRenderbuffer(
glConst.FRAMEBUFFER, ( uint )attachment, glConst.RENDERBUFFER, glConst.FRAMEBUFFER, ( uint )attachment, glConst.RENDERBUFFER, rboHandle.Value );
rboHandle.Value );
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
@@ -242,12 +243,13 @@ namespace StgSharp.Graphics.OpenGL
{ {
GlHandle[] ret = new GlHandle[count]; GlHandle[] ret = new GlHandle[count];
uint t = ( uint )type; uint t = ( uint )type;
for( int i = 0; i < count; i++ ) { for( int i = 0; i < count; i++ )
{
uint id = Context.glCreateShader( t ); uint id = Context.glCreateShader( t );
if( id == 0 ) { if( id == 0 )
{
uint error = Context.glGetError(); uint error = Context.glGetError();
throw new InvalidOperationException( throw new InvalidOperationException( $"Failed in creating shader: {error}" );
$"Failed in creating shader: {error}" );
} }
ret[ i ] = GlHandle.Alloc( id ); ret[ i ] = GlHandle.Alloc( id );
} }
@@ -266,7 +268,8 @@ namespace StgSharp.Graphics.OpenGL
if( ( handle == null ) || ( handle.Length == 0 ) ) { if( ( handle == null ) || ( handle.Length == 0 ) ) {
throw new ArgumentNullException( nameof( handle ) ); throw new ArgumentNullException( nameof( handle ) );
} }
fixed( GlHandle* hptr = handle ) { fixed( GlHandle* hptr = handle )
{
uint* iptr = ( uint* )hptr; uint* iptr = ( uint* )hptr;
for( int i = 0; i < handle.Length; i++ ) { for( int i = 0; i < handle.Length; i++ ) {
Context.glDeleteBuffers( 1, iptr + i ); Context.glDeleteBuffers( 1, iptr + i );
@@ -275,11 +278,14 @@ namespace StgSharp.Graphics.OpenGL
} }
/// <summary> /// <summary>
/// Delete a render Buffer object Very simlilar function as <see /// Delete a render Buffer object Very simlilar function as <see
/// href="https://docs.gl/gl3/glDeleteRenderbuffers">glDeleteRenderbuffers</see>. The only /// href="https://docs.gl/gl3/glDeleteRenderbuffers"> glDeleteRenderbuffers </see>. The
/// deifference is that this mehtod can only delete one renderbuffer at the same time. /// only deifference is that this mehtod can only delete one renderbuffer at the same
/// time.
/// </summary> /// </summary>
/// <param _name="bufferHandle"> Handle to Buffer to delete. </param> /// <param _name="bufferHandle">
/// Handle to Buffer to delete.
/// </param>
public unsafe void DeleteRenderBuffer( GlHandle bufferHandle ) public unsafe void DeleteRenderBuffer( GlHandle bufferHandle )
{ {
Context.glDeleteRenderbuffers( 1, &bufferHandle.Value ); Context.glDeleteRenderbuffers( 1, &bufferHandle.Value );
@@ -288,7 +294,8 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void DeleteVertexArrays( GlHandle[] arrays ) public unsafe void DeleteVertexArrays( GlHandle[] arrays )
{ {
fixed( GlHandle* hptr = arrays ) { fixed( GlHandle* hptr = arrays )
{
uint* iptr = ( uint* )hptr; uint* iptr = ( uint* )hptr;
for( int i = 0; i < arrays.Length; i++ ) { for( int i = 0; i < arrays.Length; i++ ) {
Context.glDeleteVertexArrays( 1, iptr + i ); Context.glDeleteVertexArrays( 1, iptr + i );
@@ -297,11 +304,7 @@ namespace StgSharp.Graphics.OpenGL
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void DrawElements( public unsafe void DrawElements( GeometryType mode, uint count, TypeCode type, IntPtr ptr )
GeometryType mode,
uint count,
TypeCode type,
IntPtr ptr )
{ {
uint a; uint a;
a = type switch a = type switch
@@ -317,14 +320,15 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public void DrawElementsInstanced( public void DrawElementsInstanced(
GeometryType mode, GeometryType mode,
uint count, uint count,
TypeCode type, TypeCode type,
IntPtr ptr, IntPtr ptr,
uint amount ) uint amount )
{ {
uint a; uint a;
switch( type ) { switch( type )
{
case TypeCode.UInt32: case TypeCode.UInt32:
a = glConst.UNSIGNED_INT; a = glConst.UNSIGNED_INT;
break; break;
@@ -343,8 +347,7 @@ namespace StgSharp.Graphics.OpenGL
LogType.Error ); LogType.Error );
return; return;
} }
Context.glDrawElementsInstanced( Context.glDrawElementsInstanced( ( uint )mode, count, a, ( void* )ptr, amount );
( uint )mode, count, a, ( void* )ptr, amount );
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
@@ -355,22 +358,22 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public void FrameBufferTexture2d( public void FrameBufferTexture2d(
FrameBufferTarget target, FrameBufferTarget target,
uint attachment, uint attachment,
Texture2DTarget texTarget, Texture2DTarget texTarget,
GlHandle textureHandle, GlHandle textureHandle,
int level ) int level )
{ {
Context.glFramebufferTexture2D( Context.glFramebufferTexture2D(
( uint )target, attachment, ( uint )texTarget, ( uint )target, attachment, ( uint )texTarget, textureHandle.Value, level );
textureHandle.Value, level );
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe GlHandle[] GenBuffers( int count ) public unsafe GlHandle[] GenBuffers( int count )
{ {
GlHandle[] h = new GlHandle[count]; GlHandle[] h = new GlHandle[count];
fixed( GlHandle* hptr = h ) { fixed( GlHandle* hptr = h )
{
for( int i = 0; i < count; i++ ) { for( int i = 0; i < count; i++ ) {
Context.glGenBuffers( count, ( ( uint* )hptr ) + i ); Context.glGenBuffers( count, ( ( uint* )hptr ) + i );
} }
@@ -448,51 +451,48 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void GetTextureImage<T>( public unsafe void GetTextureImage<T>(
Texture2DTarget target, Texture2DTarget target,
int level, int level,
ImageChannel channel, ImageChannel channel,
PixelChannelLayout channelLayout, PixelChannelLayout channelLayout,
T[] dataStream ) T[] dataStream )
where T: struct,INumber<T> where T: struct,INumber<T>
{ {
#pragma warning disable CS8500 #pragma warning disable CS8500
fixed( T* tptr = dataStream ) { fixed( T* tptr = dataStream )
{
Context.glGetTexImage( Context.glGetTexImage(
( uint )target, level, ( uint )channel, ( uint )target, level, ( uint )channel, ( uint )channelLayout, tptr );
( uint )channelLayout, tptr );
} }
#pragma warning restore CS8500 #pragma warning restore CS8500
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public void GetTextureLevelProperty( public void GetTextureLevelProperty(
uint textureTypeMask, uint textureTypeMask,
int level, int level,
uint propertyMask, uint propertyMask,
out int propertyValue ) out int propertyValue )
{ {
fixed( int* iptr = &propertyValue ) { fixed( int* iptr = &propertyValue ) {
Context.glGetTexLevelParameteriv( Context.glGetTexLevelParameteriv( textureTypeMask, level, propertyMask, iptr );
textureTypeMask, level, propertyMask, iptr );
} }
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe GlHandle GetUniformLocation( public unsafe GlHandle GetUniformLocation( GlHandle program, string name )
GlHandle program,
string name )
{ {
byte[] code = Encoding.UTF8.GetBytes( name ); byte[] code = Encoding.UTF8.GetBytes( name );
fixed( byte* ptr = code ) { fixed( byte* ptr = code )
{
int ret = Context.glGetUniformLocation( program.Value, ptr ); int ret = Context.glGetUniformLocation( program.Value, ptr );
#if DEBUG #if DEBUG
if( ( ret == glConst.INVALID_OPERATION ) || ( ret == if( ( ret == glConst.INVALID_OPERATION ) || ( ret == glConst.INVALID_VALUE ) )
glConst.INVALID_VALUE ) ) { {
throw new InvalidOperationException(); throw new InvalidOperationException();
} }
if( ret == -1 ) { if( ret == -1 ) {
throw new UniformEmptyReferenceException( throw new UniformEmptyReferenceException( nameof( program ), name );
nameof( program ), name );
} }
#endif #endif
return GlHandle.SignedAlloc( ret ); return GlHandle.SignedAlloc( ret );
@@ -500,47 +500,51 @@ namespace StgSharp.Graphics.OpenGL
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void LoadShaderSource( public unsafe void LoadShaderSource( GlHandle shaderHandle, byte[] codeStream )
GlHandle shaderHandle,
byte[] codeStream )
{ {
fixed( byte* streamPtr = codeStream ) { fixed( byte* streamPtr = codeStream ) {
Context.glShaderSource( Context.glShaderSource( shaderHandle.Value, 1, &streamPtr, ( void* )0 );
shaderHandle.Value, 1, &streamPtr, ( void* )0 );
} }
} }
public unsafe void LoadShaderSource( public unsafe void LoadShaderSource( GlHandle shaderHandle, ReadOnlySpan<char> codeStream )
GlHandle shaderHandle,
ReadOnlySpan<char> codeStream )
{ {
fixed( char* streamPtr = codeStream ) { fixed( char* streamPtr = codeStream )
{
byte* bptr = ( byte* )streamPtr; byte* bptr = ( byte* )streamPtr;
Context.glShaderSource( Context.glShaderSource( shaderHandle.Value, 1, &bptr, ( void* )0 );
shaderHandle.Value, 1, &bptr, ( void* )0 ); }
}
public unsafe void LoadShaderSource( GlHandle shaderHandle, ReadOnlySpan<byte> codeStream )
{
fixed( byte* streamPtr = codeStream )
{
byte* bptr = streamPtr;
Context.glShaderSource( shaderHandle.Value, 1, &bptr, ( void* )0 );
} }
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public void ReadPixels( public void ReadPixels(
(int X, int Y) beginPosition, (int X, int Y) beginPosition,
(int width, int height) size, (int width, int height) size,
FrameBufferChannel format, FrameBufferChannel format,
PixelChannelLayout dataType, PixelChannelLayout dataType,
ref byte[] stream ) ref byte[] stream )
{ {
fixed( byte* bptr = stream ) { fixed( byte* bptr = stream ) {
Context.glReadPixels( Context.glReadPixels(
beginPosition.X, beginPosition.Y, size.width, size.height, beginPosition.X, beginPosition.Y, size.width, size.height, ( uint )format,
( uint )format, ( uint )dataType, bptr ); ( uint )dataType, bptr );
} }
} }
public void RereadImage( public void RereadImage(
in Image i, in Image i,
(int X, int Y) beginPosition, (int X, int Y) beginPosition,
FrameBufferChannel format, FrameBufferChannel format,
PixelChannelLayout dataType ) PixelChannelLayout dataType )
{ {
byte[] pixels = i.PixelBuffer; byte[] pixels = i.PixelBuffer;
if( !pixels.CheckArrayFormat( dataType ) ) { if( !pixels.CheckArrayFormat( dataType ) ) {
@@ -548,33 +552,31 @@ namespace StgSharp.Graphics.OpenGL
} }
fixed( byte* bptr = pixels ) { fixed( byte* bptr = pixels ) {
Context.glReadPixels( Context.glReadPixels(
beginPosition.X, beginPosition.Y, i.Width, i.Height, beginPosition.X, beginPosition.Y, i.Width, i.Height, ( uint )format,
( uint )format, ( uint )dataType, bptr ); ( uint )dataType, bptr );
} }
i.PixelUpdateCount++; i.PixelUpdateCount++;
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void SetBufferData<T>( public unsafe void SetBufferData<T>(
BufferType bufferType, BufferType bufferType,
T bufferData, T bufferData,
BufferUsage usage ) BufferUsage usage )
where T: struct where T: struct
{ {
int size = Marshal.SizeOf<T>(); int size = Marshal.SizeOf<T>();
#pragma warning disable CS8500 #pragma warning disable CS8500
T* p = &bufferData; T* p = &bufferData;
#pragma warning restore CS8500 #pragma warning restore CS8500
Context.glBufferData( Context.glBufferData( ( uint )bufferType, ( IntPtr )size, ( IntPtr )p, ( uint )usage );
( uint )bufferType, ( IntPtr )size, ( IntPtr )p,
( uint )usage );
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void SetBufferData<T>( public unsafe void SetBufferData<T>(
BufferType bufferType, BufferType bufferType,
T[] bufferArray, T[] bufferArray,
BufferUsage usage ) BufferUsage usage )
where T: struct,INumber<T> where T: struct,INumber<T>
{ {
int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) ); int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) );
@@ -583,19 +585,18 @@ namespace StgSharp.Graphics.OpenGL
} }
#pragma warning disable CS8500 #pragma warning disable CS8500
fixed( void* bufferPtr = bufferArray ) fixed( void* bufferPtr = bufferArray )
#pragma warning restore CS8500 #pragma warning restore CS8500
{ {
Context.glBufferData( Context.glBufferData(
( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr, ( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr, ( uint )usage );
( uint )usage );
} }
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void SetBufferData<T>( public unsafe void SetBufferData<T>(
BufferType bufferType, BufferType bufferType,
ReadOnlySpan<T> bufferArray, ReadOnlySpan<T> bufferArray,
BufferUsage usage ) BufferUsage usage )
where T: struct,INumber<T> where T: struct,INumber<T>
{ {
int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) ); int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) );
@@ -604,19 +605,18 @@ namespace StgSharp.Graphics.OpenGL
} }
#pragma warning disable CS8500 #pragma warning disable CS8500
fixed( void* bufferPtr = bufferArray ) fixed( void* bufferPtr = bufferArray )
#pragma warning restore CS8500 #pragma warning restore CS8500
{ {
Context.glBufferData( Context.glBufferData(
( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr, ( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr, ( uint )usage );
( uint )usage );
} }
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void SetBufferData<T>( public unsafe void SetBufferData<T>(
BufferType bufferType, BufferType bufferType,
Span<T> bufferArray, Span<T> bufferArray,
BufferUsage usage ) BufferUsage usage )
where T: struct, INumber<T> where T: struct, INumber<T>
{ {
int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) ); int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) );
@@ -626,19 +626,18 @@ namespace StgSharp.Graphics.OpenGL
#pragma warning disable CS8500 #pragma warning disable CS8500
fixed( void* bufferPtr = &bufferArray.GetPinnableReference() ) fixed( void* bufferPtr = &bufferArray.GetPinnableReference() )
#pragma warning restore CS8500 #pragma warning restore CS8500
{ {
Context.glBufferData( Context.glBufferData(
( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr, ( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr, ( uint )usage );
( uint )usage );
} }
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void SetBufferVectorData<T>( public unsafe void SetBufferVectorData<T>(
BufferType bufferType, BufferType bufferType,
ReadOnlySpan<T> bufferArray, ReadOnlySpan<T> bufferArray,
BufferUsage usage ) BufferUsage usage )
where T: struct, IVector<T> where T: struct, IVector<T>
{ {
int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) ); int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) );
@@ -647,19 +646,18 @@ namespace StgSharp.Graphics.OpenGL
} }
#pragma warning disable CS8500 #pragma warning disable CS8500
fixed( void* bufferPtr = &bufferArray.GetPinnableReference() ) fixed( void* bufferPtr = &bufferArray.GetPinnableReference() )
#pragma warning restore CS8500 #pragma warning restore CS8500
{ {
Context.glBufferData( Context.glBufferData(
( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr, ( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr, ( uint )usage );
( uint )usage );
} }
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void SetBufferVectorData<T>( public unsafe void SetBufferVectorData<T>(
BufferType bufferType, BufferType bufferType,
T[] bufferArray, T[] bufferArray,
BufferUsage usage ) BufferUsage usage )
where T: struct, IVector<T> where T: struct, IVector<T>
{ {
int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) ); int size = bufferArray.Length * Marshal.SizeOf( typeof( T ) );
@@ -668,28 +666,26 @@ namespace StgSharp.Graphics.OpenGL
} }
#pragma warning disable CS8500 #pragma warning disable CS8500
fixed( void* bufferPtr = bufferArray ) fixed( void* bufferPtr = bufferArray )
#pragma warning restore CS8500 #pragma warning restore CS8500
{ {
Context.glBufferData( Context.glBufferData(
( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr, ( uint )bufferType, ( IntPtr )size, ( IntPtr )bufferPtr, ( uint )usage );
( uint )usage );
} }
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void SetRenderBufferStorage( public unsafe void SetRenderBufferStorage(
RenderBufferInternalFormat internalFormat, RenderBufferInternalFormat internalFormat,
(int width, int height) size ) (int width, int height) size )
{ {
Context.glRenderbufferStorage( Context.glRenderbufferStorage(
glConst.RENDERBUFFER, ( uint )internalFormat, size.width, glConst.RENDERBUFFER, ( uint )internalFormat, size.width, size.height );
size.height );
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void SetRenderBufferStorage( public unsafe void SetRenderBufferStorage(
RenderBufferInternalFormat internalFormat, RenderBufferInternalFormat internalFormat,
(uint width, uint height) size ) (uint width, uint height) size )
{ {
Context.glRenderbufferStorage( Context.glRenderbufferStorage(
glConst.RENDERBUFFER, ( uint )internalFormat, ( int )size.width, glConst.RENDERBUFFER, ( uint )internalFormat, ( int )size.width,
@@ -698,60 +694,60 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetVertexAttribute( public void SetVertexAttribute(
uint index, uint index,
int size, int size,
TypeCode t, TypeCode t,
bool normalized, bool normalized,
uint stride, uint stride,
int pointer ) int pointer )
{ {
uint type = InternalIO.GLtype[ t ]; uint type = InternalIO.GLtype[ t ];
Context.glVertexAttribPointer( Context.glVertexAttribPointer(
index, size, type, normalized ? 1 : 0, stride, index, size, type, normalized ? 1 : 0, stride, ( void* )pointer );
( void* )pointer );
Context.glEnableVertexAttribArray( index ); Context.glEnableVertexAttribArray( index );
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public void TextureImage2d<T>( public void TextureImage2d<T>(
Texture2DTarget target, Texture2DTarget target,
int level, int level,
ImageChannel sourceChannel, ImageChannel sourceChannel,
uint width, uint width,
uint height, uint height,
ImageChannel targetChannel, ImageChannel targetChannel,
PixelChannelLayout type, PixelChannelLayout type,
T[] pixels ) T[] pixels )
where T: struct, INumber<T> where T: struct, INumber<T>
{ {
#pragma warning disable CS8500 #pragma warning disable CS8500
fixed( T* tptr = pixels ) { fixed( T* tptr = pixels )
T* ptr = ( ( pixels == null ) || ( pixels.Length == 0 ) ) ? {
( T* )IntPtr.Zero : tptr; T* ptr = ( ( pixels == null ) || ( pixels.Length == 0 ) ) ? ( T* )IntPtr.Zero : tptr;
Context.glTexImage2D( Context.glTexImage2D(
( uint )target, level, ( uint )sourceChannel, width, height, ( uint )target, level, ( uint )sourceChannel, width, height, 0,
0, ( uint )targetChannel, ( uint )type, tptr ); ( uint )targetChannel, ( uint )type, tptr );
} }
#pragma warning restore CS8500 #pragma warning restore CS8500
} }
[MethodImpl( MethodImplOptions.AggressiveInlining )] [MethodImpl( MethodImplOptions.AggressiveInlining )]
public void TextureImage2d<T>( public void TextureImage2d<T>(
Texture2DTarget target, Texture2DTarget target,
int level, int level,
ImageChannel sourceChannel, ImageChannel sourceChannel,
uint width, uint width,
uint height, uint height,
ImageChannel targetChannel, ImageChannel targetChannel,
PixelChannelLayout type, PixelChannelLayout type,
Span<T> pixelSpan ) Span<T> pixelSpan )
where T: struct, INumber<T> where T: struct, INumber<T>
{ {
#pragma warning disable CS8500 #pragma warning disable CS8500
fixed( T* tptr = pixelSpan ) { fixed( T* tptr = pixelSpan )
{
Context.glTexImage2D( Context.glTexImage2D(
( uint )target, level, ( uint )sourceChannel, width, height, ( uint )target, level, ( uint )sourceChannel, width, height, 0,
0, ( uint )targetChannel, ( uint )type, tptr ); ( uint )targetChannel, ( uint )type, tptr );
} }
#pragma warning restore CS8500 #pragma warning restore CS8500
} }
@@ -763,8 +759,8 @@ namespace StgSharp.Graphics.OpenGL
} }
public static bool TryGetFunctionPackage( public static bool TryGetFunctionPackage(
IntPtr handle, IntPtr handle,
out OpenGLFunction functionPackage ) out OpenGLFunction functionPackage )
{ {
return contextToGLMap.TryGetValue( handle, out functionPackage ); return contextToGLMap.TryGetValue( handle, out functionPackage );
} }
@@ -798,7 +794,10 @@ namespace StgSharp.Graphics.OpenGL
if( contextToGLMap.TryGetValue( handle, out pack ) ) { if( contextToGLMap.TryGetValue( handle, out pack ) ) {
return pack; return pack;
} }
pack = new OpenGLFunction { _context = ( OpenglContext* )handle }; pack = new OpenGLFunction
{
_context = ( OpenglContext* )handle
};
contextToGLMap.Add( handle, pack ); contextToGLMap.Add( handle, pack );
return pack; return pack;
} }
+12 -5
View File
@@ -49,7 +49,9 @@ namespace StgSharp.Internal
#region CollisionTexture #region CollisionTexture
internal const string CollisionTextureVertexShader = """ internal static ReadOnlySpan<byte> CollisionTextureVertexShader
{
get => """
#version 430 core #version 430 core
layout(location = 0) in vec2 localCollisionCoord; layout(location = 0) in vec2 localCollisionCoord;
layout(location = 1) in vec2 spaceCoord; layout(location = 1) in vec2 spaceCoord;
@@ -75,8 +77,12 @@ namespace StgSharp.Internal
float angle = atan(realCoord.y, realCoord.x); float angle = atan(realCoord.y, realCoord.x);
gl_Position = vec4(angle, realCoord.y, dist, 1); gl_Position = vec4(angle, realCoord.y, dist, 1);
} }
"""; """u8;
internal const string CollisionTextureFragmentShader = """ }
internal static ReadOnlySpan<byte> CollisionTextureFragmentShader
{
get => """
#version 430 core #version 430 core
out vec4 Color; out vec4 Color;
@@ -92,8 +98,9 @@ namespace StgSharp.Internal
gl_FragDepth = min(dist, gl_FragDepth); gl_FragDepth = min(dist, gl_FragDepth);
Color = vec4(dist,0,0,1); Color = vec4(dist,0,0,1);
} }
"""; """u8;
}
#endregion #endregion
} }
} }
+3 -5
View File
@@ -7,7 +7,7 @@
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
// files (the ¡°Software¡±), to deal in the Software without restriction, // files (the ��Software��), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge, // including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, // publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so, // and to permit persons to whom the Software is furnished to do so,
@@ -17,7 +17,7 @@
// this permission notice shall be included in all copies // this permission notice shall be included in all copies
// or substantial portions of the Software. // or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED ¡°AS IS¡±, // THE SOFTWARE IS PROVIDED ��AS IS��,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -46,9 +46,7 @@ namespace StgSharp.Gaming
float angle, float angle,
float scale ) float scale )
{ {
if( buffer == null ) { ArgumentNullException.ThrowIfNull(buffer);
throw new ArgumentNullException( nameof( buffer ) );
}
GlobalBuffer = buffer; GlobalBuffer = buffer;
BufferId = buffer.CreateInstanceID(); BufferId = buffer.CreateInstanceID();
( ( IInstancing )this ).Scale = scale; ( ( IInstancing )this ).Scale = scale;
@@ -1,9 +1,10 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // 对此文件的更改可能会导致不正确的行为,并且如果
// the code is regenerated. // 重新生成代码,这些更改将会丢失。
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -13,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Common")] [assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Common")]
[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+ccef0de6f686f94da655b0e7d854d0acaf907d04")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Common")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Common")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Common")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Common")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -0,0 +1 @@
"restore":{"projectUniqueName":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj","projectName":"StgSharp.Common","projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj","outputPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"C:\\Program Files\\dotnet\\library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Microsoft.CSharp":{"target":"Package","version":"[4.7.0, )"},"System.Runtime.CompilerServices.Unsafe":{"target":"Package","version":"[6.1.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json"}}
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Common")] [assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Common")]
[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+b618fdf7b5295b190dcc6b7168e038d1d5a11455")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Common")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Common")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Common")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Common")]
[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/b618fdf7b5295b190dcc6b7168e038d1d5a11455/*"}} {"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/a6411e2f25010961d278c5bcb4a929e21b176bba/*"}}
@@ -1,9 +1,10 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // 对此文件的更改可能会导致不正确的行为,并且如果
// the code is regenerated. // 重新生成代码,这些更改将会丢失。
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -13,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Generator")] [assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Generator")]
[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+ccef0de6f686f94da655b0e7d854d0acaf907d04")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Generator")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Generator")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Generator")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Generator")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -0,0 +1 @@
"restore":{"projectUniqueName":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\StgSharp.Generator.csproj","projectName":"StgSharp.Generator","projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\StgSharp.Generator.csproj","outputPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Generator\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"C:\\Program Files\\dotnet\\library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Microsoft.CodeAnalysis.CSharp":{"suppressParent":"All","target":"Package","version":"[4.13.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json"}}
@@ -0,0 +1,61 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="StepDependencyDetector.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.Model.Step;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Model.Step
{
internal class StepDependencyDetector
{
public StepDependencyDetector() { }
public List<int> Dependencies { get; private set; } = new();
public void AddDependency( StepEntityInstanceNode node )
{
Dependencies.Add( node.Id );
}
public IEnumerable<int> ExportAllDependencies()
{
List<int> ret = Dependencies;
Dependencies = new List<int>();
return ret;
}
}
}
@@ -0,0 +1,54 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="StepEntityDefineSequence.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.Script.Express;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Model.Step
{
public record class StepEntityDefineSequence
{
public StepEntityDefineSequence( ExpSyntaxNode node, IEnumerable<int> dep )
{
Expression = node;
Dependencies = dep;
}
public ExpSyntaxNode Expression { get; init; }
public IEnumerable<int> Dependencies { get; init; }
}
}
@@ -0,0 +1,101 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="StepHeaderLineConstructor.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.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StgSharp.Model.Step
{
public class StepHeaderLineConstructor
{
private static Regex regex = new Regex(
@"(?<param1>.+?(\)|'\s?\)|'))\s?(?<sepcomma>,)\s?(?<other>(.|\(|\(\s?').+)",
RegexOptions.Compiled );
private readonly int _id;
private readonly List<string> _paramList;
private string _caller;
public StepHeaderLineConstructor( int id, string caller, string parameters )
{
_caller = caller;
_paramList = new List<string>();
SplitParameter( parameters );
}
public string this[ int paramIndex ]
{
get => _paramList[ paramIndex ];
}
public ReadOnlyCollection<string> ParamList
{
get => _paramList.AsReadOnly();
}
public static string TempCallerName
{
get => "TEMPCALLER";
}
public string Caller
{
get => _caller;
internal set => _caller = value;
}
public static StepHeaderLineConstructor CreateTempExpression( int id )
{
return new StepHeaderLineConstructor( id, "TEMPCALLER", string.Empty );
}
private void SplitParameter( string parameters )
{
if( string.IsNullOrEmpty( parameters ) || string.IsNullOrWhiteSpace( parameters ) ) {
return;
}
Match match = regex.Match( parameters );
while( match.Success )
{
_paramList.Add( match.Groups[ "param1" ].Value );
parameters = match.Groups[ "other" ].Value;
match = regex.Match( parameters );
}
_paramList.Add( parameters );
}
}
}
@@ -1,9 +1,10 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // 对此文件的更改可能会导致不正确的行为,并且如果
// the code is regenerated. // 重新生成代码,这些更改将会丢失。
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -13,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Model")] [assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Model")]
[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+ccef0de6f686f94da655b0e7d854d0acaf907d04")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Model")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Model")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Model")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Model")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -0,0 +1 @@
"restore":{"projectUniqueName":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj","projectName":"StgSharp.Model","projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj","outputPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"C:\\Program Files\\dotnet\\library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj":{"projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj"},"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj":{"projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj"}}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json"}}
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Model")] [assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Model")]
[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+a0f7476291d65b51de2055f8b2d69fa44348d04b")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Model")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Model")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Model")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Model")]
[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/b618fdf7b5295b190dcc6b7168e038d1d5a11455/*"}} {"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/a6411e2f25010961d278c5bcb4a929e21b176bba/*"}}
+9 -3
View File
@@ -89,6 +89,8 @@ namespace StgSharp.Script
get => _statementCache.Peek(); get => _statementCache.Peek();
} }
public Stack<CompileDepthMark> DepthStack => _depthStack;
public void DecreaseDepth() public void DecreaseDepth()
{ {
CompileDepthMark mark = _depthStack.Pop(); CompileDepthMark mark = _depthStack.Pop();
@@ -110,9 +112,13 @@ namespace StgSharp.Script
if( StatementsInDepth.Count == 0 ) { if( StatementsInDepth.Count == 0 ) {
return TNode.Empty; return TNode.Empty;
} }
TNode first = StatementsInDepth.Peek(); TNode end = StatementsInDepth.Peek();
while( StatementsInDepth.Count > 0 ) { TNode first = end;
first.PrependNode( StatementsInDepth.Pop() ); while( StatementsInDepth.Count > 0 )
{
first = StatementsInDepth.Pop();
end.PrependNode( first );
end = first;
} }
return first; return first;
} }
@@ -69,7 +69,7 @@ namespace StgSharp.Script.Express
Dot, Comma, Semicolon, Colon, Percent, Apostrophe, Dot, Comma, Semicolon, Colon, Percent, Apostrophe,
Backslash, IndexOf, RightBracket, LeftBrace, Backslash, IndexOf, RightBracket, LeftBrace,
RightBrace, Pipe, LeftParen, RightParen, LeftAsterisk, RightBrace, Pipe, LeftParen, RightParen, LeftAsterisk,
Assignment, DoublePipe, ExpSymbole, CommentSingleLine, Assignment, DoublePipe, ExpSymbol, CommentSingleLine,
CommentStart, CommentEnd, InstanceEqual, InstanceNotEqual CommentStart, CommentEnd, InstanceEqual, InstanceNotEqual
]; ];
@@ -342,7 +342,7 @@ namespace StgSharp.Script.Express
public const string LeftAsterisk = "<*"; public const string LeftAsterisk = "<*";
public const string Assignment = ":="; public const string Assignment = ":=";
public const string DoublePipe = "||"; public const string DoublePipe = "||";
public const string ExpSymbole = "**"; public const string ExpSymbol = "**";
public const string CommentSingleLine = "--"; public const string CommentSingleLine = "--";
public const string CommentStart = "(*"; public const string CommentStart = "(*";
public const string CommentEnd = "*)"; public const string CommentEnd = "*)";
@@ -54,7 +54,7 @@ namespace StgSharp.Script.Express
public override ExpElementType ElementType => ExpElementType.Function; public override ExpElementType ElementType => ExpElementType.Function;
public IExpElementSource ReturningType { get; protected set; } public ExpInstantiableElement ReturningType { get; protected set; }
public override IScriptSourceProvider SourceProvider => _transmitter; public override IScriptSourceProvider SourceProvider => _transmitter;
@@ -69,7 +69,8 @@ namespace StgSharp.Script.Express
ExpSyntaxNode right ) ExpSyntaxNode right )
{ {
if( !left.IsNumber && !right.IsNumber ) { if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name ); throw new ExpInvalidTypeException( source, "Number",
left.EqualityTypeConvert.Name );
} }
bool isFloat = bool isFloat =
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == ( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
@@ -89,7 +90,7 @@ namespace StgSharp.Script.Express
{ {
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) { if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
throw new ExpInvalidTypeException( throw new ExpInvalidTypeException(
left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name ); source, left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name );
} }
return new ExpBinaryOperatorNode( source, left, right ) return new ExpBinaryOperatorNode( source, left, right )
{ {
@@ -133,7 +134,7 @@ namespace StgSharp.Script.Express
{ {
if( right is not ExpMetaRefNode metaRef ) { if( right is not ExpMetaRefNode metaRef ) {
throw new ExpInvalidTypeException( throw new ExpInvalidTypeException(
"<source of element>", right.EqualityTypeConvert.Name ); source, "<source of element>", right.EqualityTypeConvert.Name );
} }
return new ExpBinaryOperatorNode( source, left, right ) return new ExpBinaryOperatorNode( source, left, right )
{ {
@@ -153,7 +154,8 @@ namespace StgSharp.Script.Express
ExpSyntaxNode right ) ExpSyntaxNode right )
{ {
if( !left.IsNumber && !right.IsNumber ) { if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name ); throw new ExpInvalidTypeException( source, "Number",
left.EqualityTypeConvert.Name );
} }
bool isFloat = bool isFloat =
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == ( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
@@ -173,7 +175,7 @@ namespace StgSharp.Script.Express
{ {
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) { if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
throw new ExpInvalidTypeException( throw new ExpInvalidTypeException(
left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name ); source, left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name );
} }
return new ExpBinaryOperatorNode( source, left, right ) return new ExpBinaryOperatorNode( source, left, right )
{ {
@@ -189,7 +191,8 @@ namespace StgSharp.Script.Express
ExpSyntaxNode right ) ExpSyntaxNode right )
{ {
if( !left.IsNumber && !right.IsNumber ) { if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name ); throw new ExpInvalidTypeException( source, "Number",
left.EqualityTypeConvert.Name );
} }
return new ExpBinaryOperatorNode( source, left, right ) return new ExpBinaryOperatorNode( source, left, right )
{ {
@@ -205,7 +208,8 @@ namespace StgSharp.Script.Express
ExpSyntaxNode right ) ExpSyntaxNode right )
{ {
if( !left.IsNumber && !right.IsNumber ) { if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name ); throw new ExpInvalidTypeException( source, "Number",
left.EqualityTypeConvert.Name );
} }
return new ExpBinaryOperatorNode( source, left, right ) return new ExpBinaryOperatorNode( source, left, right )
{ {
@@ -221,7 +225,8 @@ namespace StgSharp.Script.Express
ExpSyntaxNode right ) ExpSyntaxNode right )
{ {
if( !left.IsNumber && !right.IsNumber ) { if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name ); throw new ExpInvalidTypeException( source, "Number",
left.EqualityTypeConvert.Name );
} }
bool isFloat = bool isFloat =
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == ( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
@@ -241,7 +246,7 @@ namespace StgSharp.Script.Express
{ {
if( left.EqualityTypeConvert != right.EqualityTypeConvert ) { if( left.EqualityTypeConvert != right.EqualityTypeConvert ) {
throw new ExpInvalidTypeException( throw new ExpInvalidTypeException(
left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name ); source, left.EqualityTypeConvert.Name, right.EqualityTypeConvert.Name );
} }
return new ExpBinaryOperatorNode( source, left, right ) return new ExpBinaryOperatorNode( source, left, right )
{ {
@@ -257,7 +262,8 @@ namespace StgSharp.Script.Express
ExpSyntaxNode right ) ExpSyntaxNode right )
{ {
if( !left.IsNumber && !right.IsNumber ) { if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name ); throw new ExpInvalidTypeException( source, "Number",
left.EqualityTypeConvert.Name );
} }
return new ExpBinaryOperatorNode( source, left, right ) return new ExpBinaryOperatorNode( source, left, right )
{ {
@@ -273,7 +279,8 @@ namespace StgSharp.Script.Express
ExpSyntaxNode right ) ExpSyntaxNode right )
{ {
if( !left.IsNumber && !right.IsNumber ) { if( !left.IsNumber && !right.IsNumber ) {
throw new ExpInvalidTypeException( "Number", left.EqualityTypeConvert.Name ); throw new ExpInvalidTypeException( source, "Number",
left.EqualityTypeConvert.Name );
} }
bool isFloat = bool isFloat =
( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == ( left._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0 || ( right._nodeFlag | ExpNodeFlag.BuiltinType_Real ) ==
@@ -67,7 +67,7 @@ namespace StgSharp.Script.Express
{ {
if( !indexExpression.IsNumber ) { if( !indexExpression.IsNumber ) {
throw new ExpInvalidTypeException( throw new ExpInvalidTypeException(
"Number", indexExpression.EqualityTypeConvert.Name ); source, "Number", indexExpression.EqualityTypeConvert.Name );
} }
return new ExpCollectionIndexNode( source, instance, indexExpression ); return new ExpCollectionIndexNode( source, instance, indexExpression );
} }
@@ -58,7 +58,7 @@ namespace StgSharp.Script.Express
public ExpFunctionSource FunctionCaller => _function; public ExpFunctionSource FunctionCaller => _function;
public override ExpInstantiableElement EqualityTypeConvert => _function.; public override ExpInstantiableElement EqualityTypeConvert => _function.ReturningType;
public override ExpSyntaxNode Left => Empty; public override ExpSyntaxNode Left => Empty;
@@ -78,7 +78,7 @@ namespace StgSharp.Script.Express
1, isLiteral: true ); 1, isLiteral: true );
break; break;
default: default:
throw new ExpInvalidTypeException( "Int or Real", "otherwise" ); throw new ExpInvalidTypeException( variable, "Int or Real", "otherwise" );
} }
} }
_variable = variable; _variable = variable;
@@ -58,7 +58,8 @@ namespace StgSharp.Script.Express
public static ExpUnaryOperatorNode UnaryMinus( Token source, ExpSyntaxNode operand ) public static ExpUnaryOperatorNode UnaryMinus( Token source, ExpSyntaxNode operand )
{ {
if( !operand.IsNumber ) { if( !operand.IsNumber ) {
throw new ExpInvalidTypeException( "Number", operand.EqualityTypeConvert.Name ); throw new ExpInvalidTypeException(
source, "Number", operand.EqualityTypeConvert.Name );
} }
bool isFloat = bool isFloat =
( operand._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0; ( operand._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
@@ -74,7 +75,7 @@ namespace StgSharp.Script.Express
if( ( operand._nodeFlag | ( ExpNodeFlag.BuiltinType_Logic | ExpNodeFlag.BuiltinType_Logic ) ) == if( ( operand._nodeFlag | ( ExpNodeFlag.BuiltinType_Logic | ExpNodeFlag.BuiltinType_Logic ) ) ==
0 ) { 0 ) {
throw new ExpInvalidTypeException( throw new ExpInvalidTypeException(
"Bool or Logic", operand.EqualityTypeConvert.Name ); source, "Bool or Logic", operand.EqualityTypeConvert.Name );
} }
return new ExpUnaryOperatorNode( source ) return new ExpUnaryOperatorNode( source )
{ {
@@ -86,7 +87,8 @@ namespace StgSharp.Script.Express
public static ExpUnaryOperatorNode UnaryPlus( Token source, ExpSyntaxNode operand ) public static ExpUnaryOperatorNode UnaryPlus( Token source, ExpSyntaxNode operand )
{ {
if( !operand.IsNumber ) { if( !operand.IsNumber ) {
throw new ExpInvalidTypeException( "Number", operand.EqualityTypeConvert.Name ); throw new ExpInvalidTypeException(
source, "Number", operand.EqualityTypeConvert.Name );
} }
bool isFloat = bool isFloat =
( operand._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0; ( operand._nodeFlag | ExpNodeFlag.BuiltinType_Real ) == 0;
+23 -2
View File
@@ -42,8 +42,23 @@ namespace StgSharp.Script.Express
public class ExpException : Exception public class ExpException : Exception
{ {
private Token _pos;
public ExpException( string message ) : base( message ) { } public ExpException( string message ) : base( message ) { }
public ExpException( Token position, string message )
: base( $"Express compile error at {position.Line}-{position.Column}:\n{message}" )
{
_pos = position;
}
public ExpException( ExpSyntaxNode node, string message )
: base(
$"Express compile error at {node.Source.Line}-{node.Source.Column}:\n{message}" )
{
_pos = node._source;
}
} }
public class ExpInvalidCharException : ExpException public class ExpInvalidCharException : ExpException
@@ -100,11 +115,17 @@ namespace StgSharp.Script.Express
} }
public class ExpInvalidTypeException : InvalidCastException public class ExpInvalidTypeException : ExpException
{ {
public ExpInvalidTypeException( string required, string provided ) public ExpInvalidTypeException( ExpSyntaxNode node, string required, string provided )
: base( : base(
node,
$"Type {required} is required at position, but a {provided} instance is provided." ) { }
public ExpInvalidTypeException( Token t, string required, string provided )
: base(
t,
$"Type {required} is required at position, but a {provided} instance is provided." ) { } $"Type {required} is required at position, but a {provided} instance is provided." ) { }
} }
@@ -54,7 +54,7 @@ namespace StgSharp.Script.Express
_cache.StatementsInDepth.Push( statement ); _cache.StatementsInDepth.Push( statement );
} else } else
{ {
ExpInvalidSyntaxException.ThrowNoOperator( rightSeparator ); _cache.StatementsInDepth.Push( ExpSyntaxNode.Empty );
} }
} else } else
{ {
+8 -17
View File
@@ -114,7 +114,7 @@ namespace StgSharp.Script.Express
do do
{ {
_lineCache = _provider.ReadLine( out _lineNum ); _lineCache = _provider.ReadLine( out _lineNum );
} while (string.IsNullOrEmpty( _lineCache )); } while (string.IsNullOrEmpty( _lineCache ) && !_provider.IsEmpty);
_current = 0; _current = 0;
} }
if( _isReadingMultiLineComment ) if( _isReadingMultiLineComment )
@@ -182,7 +182,7 @@ namespace StgSharp.Script.Express
rest = match.Groups[ "rest" ].Index; rest = match.Groups[ "rest" ].Index;
_current = rest; _current = rest;
_last = new( _last = new(
ExpressCompile.PoolString( source[ 1..( end - begin ) ] ), _lineNum, ExpressCompile.PoolString( source[ 0..( end - begin ) ] ), _lineNum,
begin, TokenFlag.Member ); begin, TokenFlag.Member );
return _last; return _last;
} else } else
@@ -236,21 +236,12 @@ namespace StgSharp.Script.Express
throw new ExpInvalidCharException( '\"' ); throw new ExpInvalidCharException( '\"' );
} }
case '(': case '(':
cNext = source[ 1 ]; begin = _current;
if( cNext == '*' ) _current++;
{ _last = new(
_isReadingMultiLineComment = true; ExpressCompile.PoolString( source[ ..1 ] ), _lineNum, begin,
_current += 2; TokenFlag.Separator_Left );
goto readLine; return _last;
} else
{
begin = _current;
_current++;
_last = new(
ExpressCompile.PoolString( source[ ..1 ] ), _lineNum, begin,
TokenFlag.Separator_Left );
return _last;
}
case ')' or '}': case ')' or '}':
begin = _current; begin = _current;
_current++; _current++;
@@ -1,9 +1,10 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // 对此文件的更改可能会导致不正确的行为,并且如果
// the code is regenerated. // 重新生成代码,这些更改将会丢失。
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -13,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+ccef0de6f686f94da655b0e7d854d0acaf907d04")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
[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")]
@@ -0,0 +1 @@
"restore":{"projectUniqueName":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj","projectName":"StgSharp.Script","projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj","outputPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"C:\\Program Files\\dotnet\\library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj":{"projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj"}}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"CommunityToolkit.HighPerformance":{"target":"Package","version":"[8.4.0, )"},"Microsoft.CodeAnalysis.CSharp":{"target":"Package","version":"[4.13.0, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json"}}
@@ -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+b618fdf7b5295b190dcc6b7168e038d1d5a11455")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
[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/b618fdf7b5295b190dcc6b7168e038d1d5a11455/*"}} {"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/a6411e2f25010961d278c5bcb4a929e21b176bba/*"}}
@@ -1,36 +1,4 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file=".NETCoreApp,Version=v8.0.AssemblyAttributes.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.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// <autogenerated /> // <autogenerated />
using System; using System;
using System.Reflection; using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute( [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
".NETCoreApp,Version=v8.0",
FrameworkDisplayName = ".NET 8.0" )]
@@ -1,9 +1,10 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // 此代码由工具生成。
// 运行时版本:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // 对此文件的更改可能会导致不正确的行为,并且如果
// the code is regenerated. // 重新生成代码,这些更改将会丢失。
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -13,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.TerminalDialogue")] [assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.TerminalDialogue")]
[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+ccef0de6f686f94da655b0e7d854d0acaf907d04")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.TerminalDialogue")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharp.TerminalDialogue")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.TerminalDialogue")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.TerminalDialogue")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -0,0 +1 @@
"restore":{"projectUniqueName":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\StgSharp.TerminalDialogue.csproj","projectName":"StgSharp.TerminalDialogue","projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\StgSharp.TerminalDialogue.csproj","outputPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"C:\\Program Files\\dotnet\\library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","dependencies":{"Terminal.Gui":{"target":"Package","version":"[2.0.0-v2-develop.2329, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json"}}
+6 -6
View File
@@ -56,12 +56,12 @@ namespace StgSharp
internal static unsafe void Main( string[] args ) internal static unsafe void Main( string[] args )
{ {
try StgSharp.Init();
{ TestStepRead();
StgSharp.Init(); StgSharp.Terminate( 0 );
ExpLinearExpressionTest(); return;
return;
} try { }
catch( Exception ex ) catch( Exception ex )
{ {
Console.WriteLine( ex ); Console.WriteLine( ex );
+61
View File
@@ -0,0 +1,61 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="StepReadingTest.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.Model.Step;
using StgSharp.Script.Express;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp
{
internal static partial class Program
{
private static string[] stepFile = [
@"D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\StepModel\_NPart#8299.stp",
@"D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\StepModel\几何毛坯.STEP",
];
private static void TestStepRead()
{
ExpressCompile.InitCompile();
if( StepReader.FromFile( stepFile[ 0 ], out StepReader reader ) )
{
StepModel model = reader.ReadToModelSingleThread();
reader.Dispose();
}
}
}
}
@@ -0,0 +1 @@
"restore":{"projectUniqueName":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharpDebug\\StgSharpDebug.csproj","projectName":"StgSharpDebug","projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharpDebug\\StgSharpDebug.csproj","outputPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharpDebug\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net8.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"C:\\Program Files\\dotnet\\library-packs":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net8.0":{"targetAlias":"net8.0","projectReferences":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj":{"projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj"},"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj":{"projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj"},"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj":{"projectPath":"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj"}}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"}}"frameworks":{"net8.0":{"targetAlias":"net8.0","imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json"}}
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpDebug")] [assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpDebug")]
[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+c29993fd8497704d2ddeab3e1a3f8bfa5caa8d90")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharpDebug")] [assembly: System.Reflection.AssemblyProductAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpDebug")] [assembly: System.Reflection.AssemblyTitleAttribute("StgSharpDebug")]
[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/2692495dc8460e1f60a2d073f162c5f526e1ba1b/*"}} {"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/a6411e2f25010961d278c5bcb4a929e21b176bba/*"}}