Skip to content

Commit 4402256

Browse files
RobertvanderHulstcpyrgasfforay
authored
Dev (#1962)
* [Vsintegration] Fix Race condition at startup with the help of GitHub Copilot * [Codemodel] Added table for AssembliesPerProject. Added retry mechanism when Assembly could not be loaded * [Vsintegration] Prevent exception when command does not exist * [RDD} Fix problem with VarChar fields for FoxPro tables. Fixes #1796 * [Compiler tests] Added C968 for #1960 and #1961 * Add commands and functions to enhance the support of DBC / VFP in VFP Dialect (#1955) * [XSharp.VFP] Add CLOSE DATABASES, CLOSE TABLE commands * [XSharp.Core / XSharp.VFP] Add commands CLOSE DATABASES, CLOSE TABLES * [XSharp.Core] Fix visibility to give access to the ActiveDataBase for CLOSE DATABASES * [UDC] Merged CLOSE DATABASES and CLOSE TABLES variants into single UDC * [XSharp.Core / XSharp.VFP] Add support for ADD TABLE, REMOVE TABLE, RENAME TABLE in DBCs * [XSharp.Core/Data/VFP] CREATE TABLE: long field name support via DBC * [UDC] Fix an error in CLOSE DATABASE syntax * [DBC Support] Add several Tests in FoxTest project. Fix some related functions * [VFP] Fix SUM and AVERAGE UDCs clause must appear before TO * [VFP] Add support for COPY MEMO command * [VFP] Add support of REPLACE ... ADDITIVE command --------- Co-authored-by: Robert van der Hulst <robert@xsharp.eu> * [Runtime Tests] Added test for #1796, trimmed VARCHAR fields in DBFVFP * [VFP] Changed REF to OUT --------- Co-authored-by: cpyrgas <chris@xsharp.eu> Co-authored-by: Fabrice Foray <fforay@users.noreply.github.com>
1 parent 00c6671 commit 4402256

33 files changed

Lines changed: 2325 additions & 84 deletions

File tree

src/Common/FoxProCmd.xh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,32 @@
562562
#command CREATE DATABASE <(db)> => XSharp.RDD.Dbc.Create( <(db)>)
563563
#command DELETE DATABASE <(db)> [<del:DELETETABLES>] [<rec:RECYCLE>] => XSharp.RDD.Dbc.Delete( <(db)>, <.del.>, <.rec.>)
564564

565+
// CLOSE DATABASES [ALL] and CLOSE TABLES [ALL]
566+
// Implemented in XSharp.VFP\Database\DatabaseCommands.prg
567+
568+
#command CLOSE DATABASES [<all:ALL>] => __VFPCloseDatabases( <.all.> )
569+
#command CLOSE TABLES [<all:ALL>] => __VFPCloseTables( <.all.> )
570+
571+
// ADD TABLE TableName [NAME LongTableName]
572+
// Links an existing free .DBF to the currently active database.
573+
// Implemented in XSharp.VFP\Database\DatabaseCommands.prg
574+
// The NAME variant is defined last (tried first) to correctly consume the NAME clause.
575+
#command ADD TABLE <(file)> => __VFPAddTable( <(file)>, "")
576+
#command ADD TABLE <(file)> NAME <(name)> => __VFPAddTable( <(file)>, <(name)>)
577+
578+
// REMOVE TABLE TableName [DELETE] [RECYCLE]
579+
// Unlinks a table from the active database; optionally deletes the .DBF file.
580+
// Implemented in XSharp.VFP\Database\DatabaseCommands.prg
581+
// Precedence: most-specific forms defined last = tried first.
582+
#command REMOVE TABLE <(name)> => __VFPRemoveTable( <(name)>, .F., .F.)
583+
#command REMOVE TABLE <(name)> DELETE => __VFPRemoveTable( <(name)>, .T., .F.)
584+
#command REMOVE TABLE <(name)> RECYCLE => __VFPRemoveTable( <(name)>, .F., .T.)
585+
586+
// RENAME TABLE OldName TO NewName
587+
// Changes the logical name in the DBC; does not rename the physical .DBF.
588+
// Implemented in XSharp.VFP\Database\DatabaseCommands.prg
589+
#command RENAME TABLE <(old)> TO <(new)> => __VFPRenameTable( <(old)>, <(new)>)
590+
565591
// connection commands
566592
#command CREATE CONNECTION <(conn)> ;
567593
[DATASOURCE <(Dsn)>] ;

src/Common/dbcmd.xh

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -432,29 +432,31 @@
432432
<{lfor}>, <{lwhile}>, <nnext>, <rec>, <.rest.>, <.noopt.>;
433433
)
434434

435-
#command SUM <x1> [, <xn>] TO <v1> [, <vn>] ;
435+
#command SUM <x1> [, <xn>] ;
436436
[FOR <lfor>] ;
437437
[WHILE <lwhile>] ;
438438
[NEXT <nnext>] ;
439439
[RECORD <rec>] ;
440-
[<rest:REST>] ;
440+
[<REST:REST>] ;
441441
[<noopt: NOOPTIMIZE>] ;
442-
[ALL] ;
442+
[all] ;
443+
TO <v1> [, <vN>] ;
443444
;
444-
=> <v1> := [ <vn> := ] 0 ;
445+
=> <v1> := [ <vN> := ] 0 ;
445446
; DbEval( ;
446-
{|| <v1> += <x1> [, <vn> += <xn> ]}, ;
447+
{|| <v1> += <x1> [, <vN> += <xn> ]}, ;
447448
<{lfor}>, <{lwhile}>, <nnext>, <rec>, <.rest.>, <.noopt.>;
448449
)
449450

450-
#command AVERAGE [<x1> [, <xn>] TO <v1> [, <vn>]] ;
451+
#command AVERAGE [<x1> [, <xn>] ;
451452
[FOR <lfor>] ;
452453
[WHILE <lwhile>] ;
453454
[NEXT <nnext>] ;
454455
[RECORD <rec>] ;
455456
[<rest:REST>] ;
456457
[<noopt: NOOPTIMIZE>] ;
457-
[ALL] ;
458+
[all] ;
459+
TO <v1> [, <vN>]] ;
458460
;
459461
=> M->__Avg := <v1> := [ <vn> := ] 0 ;
460462
;
@@ -487,6 +489,34 @@
487489
#command SET MEMOBLOCKSIZE TO => RDDInfo(_SET_MEMOBLOCKSIZE, 512)
488490
#command SET OPTIMIZE <x:ON,OFF,&> => RDDInfo(_SET_OPTIMIZE, <(x)>)
489491

492+
#command COPY MEMO <field> TO <(file)> <add:ADDITIVE> [AS <nCP>] ;
493+
=> DbCopyMemo( <"field">, <(file)>, <ADD>[, <nCP>] )
494+
495+
// REPLACE ... [ADDITIVE] � without IN clause
496+
#command REPLACE <(f1)> WITH <x1> [<add1:ADDITIVE>] ;
497+
[, <(fn)> WITH <xn> [<addn:ADDITIVE>]] ;
498+
[FOR <lfor>] [WHILE <lwhile>] [NEXT <nnext>] [RECORD <rec>] ;
499+
[<REST:REST>] [<noopt:NOOPTIMIZE>] [all] ;
500+
=> DbEval( ;
501+
{|| DbAutoLock(), ;
502+
__FieldSetAdd(<(f1)>, <x1>, <.add1.>) ;
503+
[, __FieldSetAdd(<(fn)>, <xn>, <.addn.>)], ;
504+
DbAutoUnLock() }, ;
505+
<{lfor}>, <{lwhile}>, <nnext>, <rec>, <.rest.>, <.noopt.> ;
506+
)
507+
508+
// REPLACE ... [ADDITIVE] IN workarea � defined LAST, tried FIRST
509+
#command REPLACE <(f1)> WITH <x1> [<add1:ADDITIVE>] ;
510+
[, <(fn)> WITH <xn> [<addn:ADDITIVE>]] ;
511+
[FOR <lfor>] [WHILE <lwhile>] [NEXT <nnext>] [RECORD <rec>] ;
512+
[<REST:REST>] IN <(wa)> [<noopt:NOOPTIMIZE>] [all] ;
513+
=> __VfpReplaceIn( <(wa)>, ;
514+
{|| DbAutoLock(), ;
515+
__FieldSetAdd(<(f1)>, <x1>, <.add1.>) ;
516+
[, __FieldSetAdd(<(fn)>, <xn>, <.addn.>)], ;
517+
DbAutoUnLock() }, ;
518+
<{lfor}>, <{lwhile}>, <nnext>, <rec>, <.rest.>, <.noopt.> ;
519+
)
490520

491521
#endif // DBCMD_XH
492522

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// 968. Problems with XBase++ code [#1960, #1960]
2+
// https://github.com/X-Sharp/XSharpPublic/issues/1960
3+
// https://github.com/X-Sharp/XSharpPublic/issues/1961
4+
5+
// XBase++ dialect
6+
PROCEDURE Main
7+
LOCAL bErr,oErr
8+
9+
bErr := ErrorBlock( {|o| BREAK(o) } )
10+
11+
BEGIN SEQUENCE
12+
13+
ErrorBlock( bErr )
14+
15+
RECOVER USING oErr
16+
ErrorBlock( bErr )
17+
ENDSEQUENCE // compiler endless recursive state
18+
19+
// compiler endless recursive state
20+
#xcommand WAIT [<*any*>] => WAIT
21+
WAIT

src/CompilerTests/xSharp Tests30.viproj

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145891,6 +145891,132 @@ AppConfig = Release,22222222-2222-2222-2222-222222222222
145891145891
ForceX86=0
145892145892
Optimize=0
145893145893
ENDApplication = C967 - No compiler error when using NIL and CLIPPER calling convention in the Core dialect #1907
145894+
145895+
ApplicationGroup = B9CFE839-D401-428D-94E9-E9D21E9F772D
145896+
; ************** APPLICATION C968 - Problems with XBase++ code [#1960, #1960] *************
145897+
Application = C968 - Problems with XBase++ code [#1960, #1960]
145898+
IDEVersion = 1.06
145899+
GalleryName =
145900+
GalleryPage =
145901+
GalleryDefaultName =
145902+
Target = 0
145903+
Platform = AnyCPU
145904+
Language = XSharp
145905+
Runtime = CLR4
145906+
NetVersion =
145907+
Dialect = XBasePP
145908+
Folder = %ProjectPath%\Applications\C968\
145909+
PrgSubFolder = \Prg
145910+
ResourcesSubFolder =
145911+
Description =
145912+
NameSpace =
145913+
Assembly = C968
145914+
Extension =
145915+
ApplicationIcon =
145916+
OutputFolder =
145917+
Frameworks = 1
145918+
GUID = 5FB25712-578E-4B57-A69D-1422AEE0F776
145919+
IncludeInProjectBuild = 1
145920+
IncludeInProjectSearch = 1
145921+
IncludeInProjectExport = 1
145922+
EmitAssemblyProperties = 0
145923+
EmitNetVersion = 0
145924+
IncludePath =
145925+
StdDefsFile =
145926+
AppToRun =
145927+
SignAssembly = 0
145928+
KeyFile =
145929+
145930+
[ExportOptions]
145931+
ExportResources = 0
145932+
ExportImages = 0
145933+
[C968 - Problems with XBase++ code [#1960, #1960] FileGroups]
145934+
[C968 - Problems with XBase++ code [#1960, #1960] Files]
145935+
File = %AppPath%\Prg\C968.prg
145936+
FileGUID = 0E7D62BD-CA25-4027-84D0-DC0FEAA8CA5C
145937+
FileType = Code
145938+
CopyToBin = 0
145939+
[C968 - Problems with XBase++ code [#1960, #1960] References]
145940+
ReferenceGAC = CLR4,System,1,0,4.0.0.0
145941+
ReferenceGAC = CLR4,System.Core,1,0,4.0.0.0
145942+
ReferenceGAC = CLR4,XSharp.Core,1,0,3.0.0.0
145943+
ReferenceGAC = CLR4,XSharp.RT,1,0,3.0.0.0
145944+
ReferenceGAC = CLR4,XSharp.XPP,1,0,3.0.0.0
145945+
[C968 - Problems with XBase++ code [#1960, #1960] Resources]
145946+
[C968 - Problems with XBase++ code [#1960, #1960] Native Resources]
145947+
[C968 - Problems with XBase++ code [#1960, #1960] License files]
145948+
[C968 - Problems with XBase++ code [#1960, #1960] General Options]
145949+
Switches=
145950+
IgnoreWarnings=
145951+
ZeroArrays=0
145952+
CaseSensitive=0
145953+
ImplicitNamespace=0
145954+
VO1=0
145955+
VO2=0
145956+
VO3=0
145957+
VO4=0
145958+
VO5=0
145959+
VO6=0
145960+
VO7=0
145961+
VO8=0
145962+
VO9=0
145963+
VO10=0
145964+
VO11=0
145965+
VO12=0
145966+
VO13=0
145967+
VO14=0
145968+
VO15=1
145969+
VO16=0
145970+
VO17=0
145971+
FOX1=0
145972+
FOX2=0
145973+
XPP1=0
145974+
LateBound=0
145975+
Unsafe=0
145976+
Undeclared=0
145977+
EnforceSelf=0
145978+
EnforceOverride=0
145979+
UseNativeVersion=0
145980+
MemVar=0
145981+
IgnoreStdDefs=0
145982+
Ovf=0
145983+
FOvf=0
145984+
ModernSyntax=0
145985+
NamedArgs=0
145986+
InitLocals=0
145987+
AllowOldStyleAssignments=0
145988+
AllowDotOption=0
145989+
ResponseOnly=0
145990+
[C968 - Problems with XBase++ code [#1960, #1960] Configurations]
145991+
AppConfig = Debug,11111111-1111-1111-1111-111111111111
145992+
Switches=
145993+
SwitchesCF=
145994+
CommandLine=
145995+
CommandLineCF=
145996+
Debug=1
145997+
DebugInit=1
145998+
DefineDebug=1
145999+
DefineTrace=0
146000+
SyntaxOnly=0
146001+
WarningsErrors=0
146002+
ForceConsole=0
146003+
ForceX86=0
146004+
Optimize=0
146005+
AppConfig = Release,22222222-2222-2222-2222-222222222222
146006+
Switches=
146007+
SwitchesCF=
146008+
CommandLine=
146009+
CommandLineCF=
146010+
Debug=0
146011+
DebugInit=0
146012+
DefineDebug=0
146013+
DefineTrace=0
146014+
SyntaxOnly=0
146015+
WarningsErrors=0
146016+
ForceConsole=0
146017+
ForceX86=0
146018+
Optimize=0
146019+
ENDApplication = C968 - Problems with XBase++ code [#1960, #1960]
145894146020
[EndApplications]
145895146021

145896146022
[Configurations]

0 commit comments

Comments
 (0)