Skip to content

Commit 623f97b

Browse files
Small changes to test code
1 parent 42cdadb commit 623f97b

9 files changed

Lines changed: 154 additions & 114 deletions

File tree

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,37 @@
11
// Core dialect
2-
PUBLIC STRUCTURE MyStruct
3-
EXPORT n AS INT
4-
EXPORT c AS STRING
5-
END STRUCTURE
62

73
FUNCTION Start() AS VOID
8-
? SizeOf(System.Drawing.Point) // OK
9-
? SizeOf(MyStruct) // error XS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('MyStruct')
104
RETURN
5+
6+
function XSGetProcessIdThread( nThreadId as dword ) as array
7+
local aWindows as array
8+
local oGCHandle as System.Runtime.InteropServices.GCHandle
9+
local oPtr as IntPtr
10+
local oDelegate as EnumWindowsProc_delegate
11+
// static local oEnumWindowsProcDelegate := EnumWindowsProc as EnumWindowsProc_Delegate
12+
13+
aWindows := {}
14+
oDelegate := EnumWindowsProcProc
15+
oPtr := System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate( oDelegate )
16+
oGcHandle := NULL // default( System.Runtime.InteropServices.GCHandle)
17+
EnumThreadWindows( nThreadId, oPtr, System.Runtime.InteropServices.GCHandle.ToIntPtr( oGCHandle ) )
18+
oGCHandle:Free()
19+
20+
return aWindows
21+
22+
function EnumWindowsProcProc(hwnd as ptr, lParam as IntPtr) as logic
23+
local aWindows as array
24+
local gch as System.Runtime.InteropServices.GCHandle
25+
local nProcId as dword
26+
local pProcId as dword Ptr
27+
28+
nProcId := 0
29+
pProcId := @nProcId
30+
gch := System.Runtime.InteropServices.GCHandle.FromIntPtr(LParam)
31+
aWindows := (array) gch:Target
32+
GetWindowThreadProcessID( hWnd, pProcId )
33+
AAdd( aWindows, { hwnd, nProcId } )
34+
35+
return true
36+
37+
delegate EnumWindowsProc_delegate( hWnd as ptr, LParam as IntPtr ) as logic

src/CompilerTests/xSharp Tests.viproj

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ RecentReference = Browse:E:\XSharp\Dev\src\CompilerTests\Runtime\XSharp.RT.dll
3434
RecentReference = Browse:E:\XSharp\Dev\src\CompilerTests\Runtime\XSharp.VFP.dll
3535
RecentReference = GAC:XSharp.Core,v4,2.6.0.0
3636
RecentReference = GAC:XSharp.RT,v4,2.6.0.0
37+
RecentReference = Browse:E:\XSharp\Dev30\Artifacts\Debug\VOWin32APILibrary.dll
3738

3839
[Application Groups]
3940
ApplicationGroup = BUGS,E440B545-3C18-4457-A54F-4F3256349ABE,723E53EA-0D2C-4FC9-B86E-F050D29A49D2
@@ -121419,11 +121420,12 @@ ReferenceGAC = CLR4,System.Core,1,0,4.0.0.0
121419121420
ReferenceBrowse = E:\XSharp\Dev\src\CompilerTests\Runtime\XSharp.RT.dll,1,1
121420121421
ReferenceBrowse = E:\XSharp\Dev\src\CompilerTests\Runtime\XSharp.Core.dll,1,1
121421121422
ReferenceBrowse = E:\XSharp\Dev\src\CompilerTests\Runtime\XSharp.VFP.dll,1,1
121423+
ReferenceBrowse = E:\XSharp\Dev30\Artifacts\Debug\VOWin32APILibrary.dll,1,1
121422121424
[Tester Resources]
121423121425
[Tester Native Resources]
121424121426
[Tester License files]
121425121427
[Tester General Options]
121426-
Switches=/ppo
121428+
Switches=
121427121429
ZeroArrays=0
121428121430
CaseSensitive=0
121429121431
ImplicitNamespace=0
@@ -121435,7 +121437,7 @@ VO5=0
121435121437
VO6=0
121436121438
VO7=0
121437121439
VO8=0
121438-
VO9=1
121440+
VO9=0
121439121441
VO10=0
121440121442
VO11=0
121441121443
VO12=0
@@ -121447,7 +121449,7 @@ VO17=0
121447121449
FOX1=0
121448121450
FOX2=0
121449121451
XPP1=0
121450-
LateBound=1
121452+
LateBound=0
121451121453
Unsafe=0
121452121454
Undeclared=0
121453121455
EnforceSelf=0
@@ -121460,8 +121462,8 @@ FOvf=0
121460121462
ModernSyntax=0
121461121463
NamedArgs=0
121462121464
InitLocals=0
121463-
AllowOldStyleAssignments=1
121464-
AllowDotOption=1
121465+
AllowOldStyleAssignments=0
121466+
AllowDotOption=0
121465121467
ResponseOnly=0
121466121468
[Tester Configurations]
121467121469
AppConfig = Debug,11111111-1111-1111-1111-111111111111
@@ -136639,8 +136641,8 @@ FileType = Code
136639136641
CopyToBin = 0
136640136642
[C934 - Problem calling error handler from BEGIN...END SEQUENCE References]
136641136643
ReferenceGAC = CLR4,System,1,0,4.0.0.0
136642-
ReferenceGAC = CLR4,XSharp.Core,1,0,2.6.0.0
136643-
ReferenceGAC = CLR4,XSharp.RT,1,0,2.6.0.0
136644+
ReferenceGAC = XSharp.Core,1,0,2.6.0.0
136645+
ReferenceGAC = XSharp.RT,1,0,2.6.0.0
136644136646
[C934 - Problem calling error handler from BEGIN...END SEQUENCE Resources]
136645136647
[C934 - Problem calling error handler from BEGIN...END SEQUENCE Native Resources]
136646136648
[C934 - Problem calling error handler from BEGIN...END SEQUENCE License files]
@@ -136887,8 +136889,8 @@ CopyToBin = 0
136887136889
[C936 - Exception with default parameters from type float References]
136888136890
ReferenceGAC = CLR4,System,1,0,4.0.0.0
136889136891
ReferenceGAC = CLR4,System.Core,1,0,4.0.0.0
136890-
ReferenceGAC = CLR4,XSharp.Core,1,0,2.6.0.0
136891-
ReferenceGAC = CLR4,XSharp.RT,1,0,2.6.0.0
136892+
ReferenceGAC = XSharp.Core,1,0,2.6.0.0
136893+
ReferenceGAC = XSharp.RT,1,0,2.6.0.0
136892136894
[C936 - Exception with default parameters from type float Resources]
136893136895
[C936 - Exception with default parameters from type float Native Resources]
136894136896
[C936 - Exception with default parameters from type float License files]
@@ -137008,8 +137010,8 @@ CopyToBin = 0
137008137010
[C937 - Late bound problem with enums References]
137009137011
ReferenceGAC = CLR4,System,1,0,4.0.0.0
137010137012
ReferenceGAC = CLR4,System.Core,1,0,4.0.0.0
137011-
ReferenceGAC = CLR4,XSharp.Core,1,0,2.6.0.0
137012-
ReferenceGAC = CLR4,XSharp.RT,1,0,2.6.0.0
137013+
ReferenceGAC = XSharp.Core,1,0,2.6.0.0
137014+
ReferenceGAC = XSharp.RT,1,0,2.6.0.0
137013137015
[C937 - Late bound problem with enums Resources]
137014137016
[C937 - Late bound problem with enums Native Resources]
137015137017
[C937 - Late bound problem with enums License files]
@@ -137129,8 +137131,8 @@ CopyToBin = 0
137129137131
[C938 - Latebound assign of iVars References]
137130137132
ReferenceGAC = CLR4,System,1,0,4.0.0.0
137131137133
ReferenceGAC = CLR4,System.Core,1,0,4.0.0.0
137132-
ReferenceGAC = CLR4,XSharp.Core,1,0,2.6.0.0
137133-
ReferenceGAC = CLR4,XSharp.RT,1,0,2.6.0.0
137134+
ReferenceGAC = XSharp.Core,1,0,2.6.0.0
137135+
ReferenceGAC = XSharp.RT,1,0,2.6.0.0
137134137136
[C938 - Latebound assign of iVars Resources]
137135137137
[C938 - Latebound assign of iVars Native Resources]
137136137138
[C938 - Latebound assign of iVars License files]

src/CompilerTests/xSharp Tests.xicfg

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,7 +2034,7 @@ LASTTOUCHED = 20230824123424
20342034
APPLICATION = 20EFCF0E-6B10-43CF-918A-74C0DDE17AC8
20352035
LASTTOUCHED = 20230824123424
20362036
APPLICATION = 00517D44-7F90-491B-9AC1-3C6885BEA33F
2037-
LASTTOUCHED = 20241119154613
2037+
LASTTOUCHED = 20250418091532
20382038
APPLICATION = C41734F5-C73D-469B-989C-328098E245DD
20392039
LASTTOUCHED = 20230824123424
20402040
APPLICATION = 92954064-33D6-486F-ACBF-FE857B16DEC2
@@ -2283,6 +2283,18 @@ APPLICATION = D48A0E62-DE1B-4E0D-AF91-E4FE5C842868
22832283
LASTTOUCHED = 20241115085159
22842284
APPLICATION = BF9F859C-EB6C-45CC-9F2D-9CBF03913353
22852285
LASTTOUCHED = 20241223163803
2286+
APPLICATION = 2319ADE3-1DCB-49C1-AACA-220627B2F577
2287+
LASTTOUCHED = 20250415124430
2288+
APPLICATION = 8380689D-5C5F-48FB-A1C9-C5B04AB745ED
2289+
LASTTOUCHED = 20250415124430
2290+
APPLICATION = 57989867-0C28-4438-8260-A34FF275EB05
2291+
LASTTOUCHED = 20250415124430
2292+
APPLICATION = 5AD925B3-58EF-4746-9342-07BD850A0116
2293+
LASTTOUCHED = 20250415124430
2294+
APPLICATION = A7B268C3-0E99-49BA-8191-30620231ACD2
2295+
LASTTOUCHED = 20250415124430
2296+
APPLICATION = A46C8D0A-D5BA-4DF7-B629-76697F5DF2E6
2297+
LASTTOUCHED = 20250417114323
22862298

22872299
[File Settings]
22882300
FILE = 018196BD-ED9B-4D28-B739-2F6F63EF85DB
@@ -2345,23 +2357,4 @@ FILE = E9DF3356-7242-433B-9896-D95855934DB3
23452357
BREAKPOINT = 1,10
23462358

23472359
[OpenFiles]
2348-
OPENFILE=F95CB848-7ED0-4590-B1C5-9A82058838B1,10,1
2349-
OPENFILE=49F7B41E-2312-4C94-9A33-AB4C5F9BDE59,15,1
2350-
OPENFILE=9E9E419C-2022-42BF-B545-FD4CDA1E126C,9,1
2351-
OPENFILE=0A8C9546-D392-4E21-8F5D-451D00BBA06C,59,1
2352-
OPENFILE=D0D0E096-1E2C-4475-8CC4-AD710381EE5D,14,1
2353-
OPENFILE=378CB737-F264-4408-BEDC-687A0BDFFAAE,17,1
2354-
OPENFILE=E31E5E07-7F51-4638-932A-DE7DD97F6473,229,1
2355-
OPENFILE=66F443D8-3EC4-428C-93EC-88B9AA1F72F3,14,1
2356-
OPENFILE=CD486AC9-7A7D-4594-B613-4D422AFD088E,16,1
2357-
ACTIVEFILE=7B4DD920-5928-4A7C-B3B6-F0E0C9FF09F3,10,1
2358-
OPENFILE=F7F45F5E-DFD6-4920-BFCB-231BF8947475,12,1
2359-
OPENFILE=8DAC8163-CABE-4EEE-A472-A23A5BAC5D50,9,1
2360-
OPENFILE=0E4E5762-377F-4D03-ABC5-3652AE49474C,14,1
2361-
OPENFILE=C43E4070-CEB2-428E-BFE4-501B3B260A6A,1,1
2362-
OPENFILE=0F9DB692-2825-4656-8FEA-3EE83AE24174,6,1
2363-
OPENFILE=D60F10B5-FC0B-4A69-BBFA-B24568A9D692,11,1
2364-
OPENFILE=7FD26807-C53A-42D7-89CC-52CDF49ADEC2,1,1
2365-
OPENFILE=D1C2C977-8843-4D11-9A4D-BED48EDB5685,1,1
2366-
OPENFILE=F11D952F-B053-4DD3-A4FA-61F69CDE744B,1,1
2367-
OPENFILE=79AF7256-3EC8-4149-88EA-FB9C2516D7BA,1,1
2360+
ACTIVEFILE=7B4DD920-5928-4A7C-B3B6-F0E0C9FF09F3,16,1

src/Tests/DbcTest/Program.prg

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,26 @@ Using System.Linq
44
Using System.Text
55

66
Function Start() As Void Strict
7-
System.Console.OutputEncoding = System.Text.Encoding.GetEncoding(936)
8-
Use c:\temp\testchar
9-
DoWork()
10-
Use c:\temp\testmemo
11-
DoWork()
12-
Use c:\temp\testvarchar
13-
DoWork()
7+
LOCAL u AS USUAL
8+
PRIVATE p
9+
try
10+
u := Today()
11+
p := Today()
12+
13+
? GoMonth(u,1) // error XS0121
14+
? GoMonth(p,1) // error XS0121
15+
? Quarter(u, 1)
16+
? Week(u,1)
17+
? Week(u,2)
18+
? Week(u,3)
19+
? Dmy(u)
20+
? Mdy(u)
21+
u := "abc"
22+
//? Mdy(u)
23+
//? Week(u,3)
24+
//? GoMonth(u,1) // error XS0121
25+
? Quarter(u, 1)
26+
catch e as exception
27+
? e:ToString()
28+
end try
1429
wait
15-
Return
16-
End Function
17-
FUNCTION DoWork()
18-
FIELD a, b
19-
Append Blank
20-
Replace a With "005", b With "中国"
21-
? a
22-
? b
23-
RETURN TRUE

src/Tests/General/Program.prg

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
FUNCTION Start() AS VOID
2-
LOCAL cFileName AS STRING
3-
cFileName := "C:\temp\exception"
4-
DbUseArea(,"DBFCDX",cFileName,,TRUE)
5-
DO WHILE .not. eof()
6-
? RecNo(), FieldGet(1)
7-
DbSkip()
8-
END DO
9-
DBCloseArea()
1+
CLASS TestClass
2+
METHOD Seek(a AS INT) AS INT
3+
? "a"
4+
RETURN a
5+
METHOD Seek(a AS INT, b AS INT) AS INT
6+
? "b"
7+
RETURN a+b
8+
METHOD Seek(a AS INT, b AS INT, c AS INT) AS INT
9+
? "c"
10+
RETURN a+b+c
11+
END CLASS
12+
13+
FUNCTION Start() AS VOID
14+
LOCAL u := TestClass{} AS USUAL
15+
? u:Seek(1)
16+
? u:Seek(1,2)
17+
? u:Seek(1,2,3)
1018
wait
11-
RETURN

0 commit comments

Comments
 (0)