Skip to content

Commit 27c85cf

Browse files
committed
Merge branch 'master' of https://github.com/Synergex/CodeGen into cli_tool_add_feature
2 parents 508cdff + d4317b7 commit 27c85cf

171 files changed

Lines changed: 21853 additions & 24503 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CodeConverter/CodeConverter/Properties/AssemblyInfo.dbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ import System.Runtime.InteropServices
3030
; Revision
3131
;
3232
{assembly: AssemblyVersion("1.0.0.0")}
33-
{assembly: AssemblyFileVersion("5.9.8.0")}
33+
{assembly: AssemblyFileVersion("5.9.10.0")}

CodeConverter/CodeConverterInterface/Properties/AssemblyInfo.dbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ import System.Runtime.InteropServices
3030
; Revision
3131
;
3232
{assembly: AssemblyVersion("1.0.0.0")}
33-
{assembly: AssemblyFileVersion("5.9.8.0")}
33+
{assembly: AssemblyFileVersion("5.9.10.0")}

CodeGen/Properties/AssemblyInfo.dbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ import System.Runtime.InteropServices
3030
; Revision
3131
;
3232
{assembly: AssemblyVersion("1.0.0.0")}
33-
{assembly: AssemblyFileVersion("5.9.8.0")}
33+
{assembly: AssemblyFileVersion("5.9.10.0")}
3434

CodeGenEngine/CodeGenerator.dbl

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
;;
77
;; Description: In-process callable interface to CodeGen
88
;;
9-
;; Date:
9+
;; Date:
1010
;;
1111
;; Author: Steve Ives, Synergex Professional Services Group
1212
;; http://www.synergex.com
@@ -206,11 +206,11 @@ namespace CodeGen.Engine
206206
if (File.Exists(extensionsAssembly)) then
207207
begin
208208
;;Report the extensions assembly we're going to use
209-
context.Taskset.DevDebugLog(String.Format("Found Harmony Core extensions assembly {0}",extensionsAssembly))
209+
context.Taskset.DevDebugLog(String.Format("Found Harmony Core extensions assembly {0}",extensionsAssembly))
210210

211211
;;Open the assembly and load extensions
212212
if (!loadExtensionsFromAssembly(extensionsAssembly,context))
213-
context.Taskset.DevDebugLog("No extension classes were found in the extensions assembly!")
213+
context.Taskset.DevDebugLog("No extension classes were found in the extensions assembly!")
214214
end
215215
else
216216
begin
@@ -290,7 +290,7 @@ namespace CodeGen.Engine
290290
begin
291291
;;Open the assembly and load extensions
292292
if (!loadExtensionsFromAssembly(extensionsAssembly,context))
293-
errStatus = context.Taskset.ErrorLog("No extensions were found in the proforma extensions assembly!")
293+
errStatus = context.Taskset.ErrorLog("No extensions were found in the proforma extensions assembly!")
294294
end
295295

296296
mreturn !errStatus
@@ -446,7 +446,7 @@ namespace CodeGen.Engine
446446
end
447447

448448
;;--------------------------------------------------------------------------------------
449-
;;
449+
;;
450450

451451
if (!context.CurrentTask.MethodCatalogStructureMode)
452452
begin
@@ -459,7 +459,7 @@ namespace CodeGen.Engine
459459
begin
460460
mreturn context.CurrentTask.ErrorLog(String.Format("Interface {0} was not found in the method catalog!",context.CurrentTask.MethodCatalogInterface))
461461
end
462-
462+
463463
;;And remove all other interfaces
464464
context.MethodCatalog.Interfaces.RemoveAll(lambda(intf) {intf!=selectedInterface})
465465
context.MethodCatalogCustomized = true
@@ -480,7 +480,7 @@ namespace CodeGen.Engine
480480
mreturn context.CurrentTask.ErrorLog(String.Format("Interface {0} was not found in the method catalog!",context.CurrentTask.MethodCatalogInterface))
481481
end
482482
end
483-
483+
484484
if (context.MethodCatalog.Structures.Count == 0)
485485
begin
486486
mreturn context.CurrentTask.ErrorLog("Method catalog export file contains no structures!")
@@ -766,7 +766,7 @@ namespace CodeGen.Engine
766766
end
767767
end
768768
end
769-
769+
770770
endmethod
771771

772772
;;; <summary>
@@ -889,6 +889,7 @@ namespace CodeGen.Engine
889889
proc
890890

891891
data errStatus = false
892+
data structureWildcard = false
892893

893894
;;-------------------------------------------------------------------------
894895
;;Echo command line?
@@ -1372,7 +1373,7 @@ namespace CodeGen.Engine
13721373
else
13731374
begin
13741375
context.SelectionWindowScript = fileSpec
1375-
context.CurrentTask.DebugLog(String.Format("Selection window processing enabled from file {0}",fileSpec))
1376+
context.CurrentTask.DebugLog(String.Format("Selection window processing enabled from file {0}",fileSpec))
13761377
end
13771378
end
13781379
end
@@ -1394,6 +1395,7 @@ namespace CodeGen.Engine
13941395
if (context.CurrentTask.Structures[0]=="*") then
13951396
begin
13961397
;;Process all structures
1398+
structureWildcard = true
13971399
try
13981400
begin
13991401
context.Structures = new RpsStructureCollection(RpsLoadMode.Load,context.CurrentTask.UseAlternateFieldNames)
@@ -1410,7 +1412,7 @@ namespace CodeGen.Engine
14101412
begin
14111413
;;Process specified structures
14121414
data ix, int
1413-
for ix from 0 thru context.CurrentTask.Structures.Count-1
1415+
for ix from 0 thru context.CurrentTask.Structures.Count-1
14141416
begin
14151417
try
14161418
begin
@@ -1439,6 +1441,7 @@ namespace CodeGen.Engine
14391441
if (context.Taskset.Structures[0]=="*") then
14401442
begin
14411443
;;Process all structures
1444+
structureWildcard = true
14421445
try
14431446
begin
14441447
context.Structures = new RpsStructureCollection(RpsLoadMode.Load,context.CurrentTask.UseAlternateFieldNames)
@@ -1455,7 +1458,7 @@ namespace CodeGen.Engine
14551458
begin
14561459
;;Process specified structures
14571460
data ix, int
1458-
for ix from 0 thru context.Taskset.Structures.Count-1
1461+
for ix from 0 thru context.Taskset.Structures.Count-1
14591462
begin
14601463
try
14611464
begin
@@ -1494,7 +1497,7 @@ namespace CodeGen.Engine
14941497
;;Are we being asked to process a subset of the fields in a structure?
14951498

14961499
if (!errStatus && (!String.IsNullOrWhiteSpace(context.CurrentTask.Subset)))
1497-
context.CurrentTask.DevDebugLog("Subset processing was enabled for subset " + context.CurrentTask.Subset)
1500+
context.CurrentTask.DevDebugLog("Subset processing was enabled for subset " + context.CurrentTask.Subset)
14981501

14991502
;;-------------------------------------------------------------------------
15001503
;;Are we being asked to create a subset from a list of field names?
@@ -1539,7 +1542,7 @@ namespace CodeGen.Engine
15391542
;;Now parse the script file
15401543
if (!String.IsNullOrWhiteSpace(context.CurrentTask.WindowScript)) then
15411544
begin
1542-
context.CurrentTask.DevDebugLog("Parsing window script " + context.CurrentTask.WindowScript)
1545+
context.CurrentTask.DevDebugLog("Parsing window script " + context.CurrentTask.WindowScript)
15431546
errStatus = (boolean)ParseWindowScript(context)
15441547
end
15451548
else if (!String.IsNullOrWhiteSpace(context.CurrentTask.ProformaFile))
@@ -1552,7 +1555,7 @@ namespace CodeGen.Engine
15521555
errStatus = true
15531556
else
15541557
begin
1555-
context.CurrentTask.DevDebugLog("Parsing ProForma file " + context.CurrentTask.ProFormaFile)
1558+
context.CurrentTask.DevDebugLog("Parsing ProForma file " + context.CurrentTask.ProFormaFile)
15561559

15571560
if (address = %xaddr("ParseProForma",,1)) then
15581561
begin
@@ -1629,7 +1632,7 @@ namespace CodeGen.Engine
16291632

16301633
if ((!errStatus) && (context.DebugLoggingEnabled) && (context.Structures.Count>0))
16311634
begin
1632-
context.CurrentTask.Log("Structure(s):",true,false)
1635+
context.CurrentTask.Log("Structure(s):",true,false)
16331636
data str, @RpsStructure
16341637
foreach str in context.Structures
16351638
context.CurrentTask.Log(" - " + str.Name)
@@ -1823,7 +1826,7 @@ namespace CodeGen.Engine
18231826
end
18241827
else if (context.DebugLoggingEnabled)
18251828
begin
1826-
context.CurrentTask.Log("Custom field filters in use", true, false)
1829+
context.CurrentTask.Log("Custom field filters in use", true, false)
18271830
if (context.CurrentTask.IncludeOverlayFields)
18281831
context.CurrentTask.Log(" - Overlays will be included")
18291832
if (context.CurrentTask.IgnoreExcludeLanguage)
@@ -1852,7 +1855,7 @@ namespace CodeGen.Engine
18521855
end
18531856
else if (context.DebugLoggingEnabled)
18541857
begin
1855-
context.CurrentTask.Log("Custom group processing rules are in use", true, false)
1858+
context.CurrentTask.Log("Custom group processing rules are in use", true, false)
18561859
if (context.CurrentTask.ExplicitGroupNoExpand)
18571860
context.CurrentTask.Log(" - Explicit groups will not be expanded to individual fields")
18581861
if (context.CurrentTask.GroupFieldNoGroupPrefix) ;;Do not prefix group fields with group name
@@ -1908,7 +1911,7 @@ namespace CodeGen.Engine
19081911
begin
19091912
data token, @UserToken
19101913
foreach token in context.CurrentTask.UserTokens
1911-
context.UserTokens.Add(token)
1914+
context.UserTokens.Add(token)
19121915
end
19131916
else
19141917
UserTokenCollection.AddTokens(context.CurrentTask.UserTokens,context.CurrentTask,context)
@@ -2060,7 +2063,7 @@ namespace CodeGen.Engine
20602063
if (context.MultiStructureMode) then
20612064
begin
20622065
;;Process the template once for all structures
2063-
2066+
20642067
;;Check each structure, flatten arrays and groups, etc.
20652068
context.CurrentTask.DebugLog("")
20662069
data ix, int
@@ -2088,8 +2091,14 @@ namespace CodeGen.Engine
20882091
for ix from 0 thru context.Structures.Count-1
20892092
begin
20902093
;;Check the structure, flatten arrays and groups, etc.
2091-
if (!RepositoryTools.CheckStructure(context,context.Structures[ix])) then
2092-
errStatus = true
2094+
data errContext ,ValidationContext
2095+
if (!RepositoryTools.CheckStructure(context,context.Structures[ix],errContext)) then
2096+
begin
2097+
if (structureWildcard && errContext == ValidationContext.Skipped) then
2098+
nop ;deliberatly skipping
2099+
else
2100+
errStatus = true
2101+
end
20932102
else
20942103
begin
20952104
;;Set structure context

CodeGenEngine/Properties/AssemblyInfo.dbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import System.Runtime.InteropServices
3030
; Revision
3131
;
3232
{assembly: AssemblyVersion("1.0.0.0")}
33-
{assembly: AssemblyFileVersion("5.9.8.0")}
33+
{assembly: AssemblyFileVersion("5.9.10.0")}
3434

3535

3636

CodeGenEngine/RepositoryTools.dbl

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,48 +46,74 @@ import CodeGen.RepositoryAPI
4646

4747
namespace CodeGen.Engine
4848

49+
public enum ValidationContext
50+
Ok ,0
51+
Skipped
52+
NoFieldsInStructure
53+
FieldSizeIssue
54+
endenum
55+
4956
public partial class RepositoryTools
5057

5158
public static method CheckStructure, boolean
5259
required in context, @CodeGenContext
5360
required in Struct , @RpsStructure
5461
endparams
5562

63+
stack record
64+
errContext, ValidationContext
65+
endrecord
66+
67+
proc
68+
mreturn RepositoryTools.CheckStructure(context,Struct,errContext)
69+
endmethod
70+
71+
public static method CheckStructure, boolean
72+
required in context, @CodeGenContext
73+
required in Struct , @RpsStructure
74+
required out ErrContext,ValidationContext
75+
endparams
76+
5677
stack record
5778
ErrStatus, boolean
5879
endrecord
5980

6081
proc
6182

6283
ErrStatus = false
84+
ErrContext = ValidationContext.Ok
6385

6486
;; ==========================================================================================
6587
;; STRUCTURE VALIDATION
6688

6789
context.CurrentTask.DebugLog(" - Checking structure " + Struct.Name)
6890

69-
;; Make sure the structure has fields
70-
if (!Struct.Fields.Count)
71-
ErrStatus = context.CurrentTask.Errorlog("Structure " + Struct.Name + " has no fields")
72-
73-
;; Do we have any tags?
74-
if (!ErrStatus&&Struct.Tags.Count)
75-
begin
76-
;; Make sure it's a field=value tag
77-
if (Struct.TagType!=RpsTagType.FieldAndValue)
78-
context.CurrentTask.Log("WARNING: Structure "+Struct.Name+" has an unsupported record length tag. Tag loop tokens may not work!")
79-
end
80-
8191
;; Make sure the structure has not been excluded with @NOCODEGEN
8292
if (!ErrStatus)
8393
begin
8494
if ((Struct.UserText.ToUpper().Contains("@NOCODEGEN"))||(Struct.LongDescription.ToUpper().Contains("@NOCODEGEN")))
8595
begin
8696
context.CurrentTask.DebugLog(" - Structure " + Struct.Name + " is excluded from processing by @NOCODEGEN")
8797
ErrStatus = true
98+
ErrContext = ValidationContext.Skipped
8899
end
89100
end
90101

102+
;; Make sure the structure has fields
103+
if (!ErrStatus && !Struct.Fields.Count)
104+
begin
105+
ErrStatus = context.CurrentTask.Errorlog("Structure " + Struct.Name + " has no fields")
106+
ErrContext = ValidationContext.NoFieldsInStructure
107+
end
108+
109+
;; Do we have any tags?
110+
if (!ErrStatus && Struct.Tags.Count)
111+
begin
112+
;; Make sure it's a field=value tag
113+
if (Struct.TagType!=RpsTagType.FieldAndValue)
114+
context.CurrentTask.Log("WARNING: Structure "+Struct.Name+" has an unsupported record length tag. Tag loop tokens may not work!")
115+
end
116+
91117
;; ==========================================================================================
92118
;; FIELD FILTERS AND VALIDATION
93119
;; The structure seems OK, now lets look at the fields
@@ -106,6 +132,7 @@ namespace CodeGen.Engine
106132
if (Field.DataType == RpsFieldDataType.Decimal && Field.Precision==0 && Field.Size > 28)
107133
begin
108134
;;ErrStatus = context.CurrentTask.ErrorLog(String.Format("Decimal field {0}.{1} exceeds the maximum size of D28!", Struct.Name, Field.Name))
135+
;;ErrContext = ValidationContext.FieldSizeIssue
109136
;;exitloop
110137
end
111138

@@ -116,6 +143,7 @@ namespace CodeGen.Engine
116143
if ((Field.Size-Field.Precision) > 28 || Field.Precision > 28)
117144
begin
118145
;;ErrStatus = context.CurrentTask.ErrorLog(String.Format("Implied decimal field {0}.{1} exceeds the maximum size of D56.28!", Struct.Name, Field.Name))
146+
;;ErrContext = ValidationContext.FieldSizeIssue
119147
;;exitloop
120148
end
121149
end
@@ -450,7 +478,7 @@ namespace CodeGen.Engine
450478
begin
451479
newField1.SqlName = StringTools.SqlName(newField1.Name)
452480
end
453-
481+
454482
;; Note: BaseName doesn't change because of array expansion
455483

456484
if (Field.MappedField)
@@ -508,7 +536,7 @@ namespace CodeGen.Engine
508536
;; 2. Implicit GROUP (fields defined by another structure)
509537
;;
510538
;; And if the "include overlays" command line option (-f o) was used:
511-
;;
539+
;;
512540
;; 3. Explicit GROUP OVERLAY
513541
;; 4. Implicit GROUP OVERLAY
514542

@@ -673,9 +701,12 @@ namespace CodeGen.Engine
673701
data ix, int
674702
for ix from 0 thru Struct.Fields.Count-1
675703
Struct.Fields[ix].LogicalFieldNumber = ix+1
676-
end
704+
end
677705
else
706+
begin
678707
ErrStatus = context.CurrentTask.Errorlog("After applying CodeGen rules structure " + Struct.Name + " has no remaining fields!")
708+
ErrContext = ValidationContext.NoFieldsInStructure
709+
end
679710
end
680711

681712
if (!ErrStatus)

0 commit comments

Comments
 (0)