Skip to content

Commit 65f8929

Browse files
committed
Now it builds, does it work?
1 parent e536d4c commit 65f8929

File tree

12 files changed

+132
-125
lines changed

12 files changed

+132
-125
lines changed

CodeGenEngine/CodeGenContext.dbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ namespace CodeGen.Engine
130130
public method ResetTaskContext, void
131131
proc
132132
;;Main repository context
133-
Structures = new RpsStructureCollection(RpsLoadMode.NoLoad)
133+
Structures = new RpsStructureCollection(Repository,RpsLoadMode.NoLoad)
134134
Repository = ^null
135135

136136
;;Other context

CodeGenEngine/CodeGenerator.dbl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ namespace CodeGen.Engine
12931293
context.CurrentTask.RepositoryFile = context.CurrentTask.RepositoryFile.ToUpper()
12941294
try
12951295
begin
1296-
context.FileDefinition = new RpsFile(context.CurrentTask.RepositoryFile,context.CurrentTask.UseAlternateFieldNames)
1296+
context.FileDefinition = new RpsFile(context.Repository,context.CurrentTask.RepositoryFile,context.CurrentTask.UseAlternateFieldNames)
12971297
end
12981298
catch (e, @RpsFileException)
12991299
begin
@@ -1398,7 +1398,7 @@ namespace CodeGen.Engine
13981398
structureWildcard = true
13991399
try
14001400
begin
1401-
context.Structures = new RpsStructureCollection(RpsLoadMode.Load,context.CurrentTask.UseAlternateFieldNames)
1401+
context.Structures = new RpsStructureCollection(context.Repository,RpsLoadMode.Load,context.CurrentTask.UseAlternateFieldNames)
14021402
if (context.Structures.Count == 0)
14031403
errStatus = context.CurrentTask.Errorlog("Your repository contains no structures!")
14041404
end
@@ -1416,7 +1416,7 @@ namespace CodeGen.Engine
14161416
begin
14171417
try
14181418
begin
1419-
data newStructure, @RpsStructure, new RpsStructure(context.CurrentTask.Structures[ix],context.CurrentTask.UseAlternateFieldNames)
1419+
data newStructure, @RpsStructure, new RpsStructure(context.Repository,context.CurrentTask.Structures[ix],context.CurrentTask.UseAlternateFieldNames)
14201420
if (!String.IsNullOrWhiteSpace(context.SelectionWindowScript))
14211421
begin
14221422
if (!ProcessSelectionWindows(context,newStructure))
@@ -1444,7 +1444,7 @@ namespace CodeGen.Engine
14441444
structureWildcard = true
14451445
try
14461446
begin
1447-
context.Structures = new RpsStructureCollection(RpsLoadMode.Load,context.CurrentTask.UseAlternateFieldNames)
1447+
context.Structures = new RpsStructureCollection(context.Repository,RpsLoadMode.Load,context.CurrentTask.UseAlternateFieldNames)
14481448
if (context.Structures.Count == 0)
14491449
errStatus = context.CurrentTask.Errorlog("Your repository contains no structures!")
14501450
end
@@ -1462,7 +1462,7 @@ namespace CodeGen.Engine
14621462
begin
14631463
try
14641464
begin
1465-
data newStructure, @RpsStructure, new RpsStructure(context.Taskset.Structures[ix],context.CurrentTask.UseAlternateFieldNames)
1465+
data newStructure, @RpsStructure, new RpsStructure(context.Repository,context.Taskset.Structures[ix],context.CurrentTask.UseAlternateFieldNames)
14661466
if (!String.IsNullOrWhiteSpace(context.SelectionWindowScript))
14671467
begin
14681468
if (!ProcessSelectionWindows(context,newStructure))
@@ -1561,7 +1561,7 @@ namespace CodeGen.Engine
15611561
begin
15621562
data pfStructure, @RpsStructure
15631563

1564-
context.CurrentTask.ProFormaStructures = new RpsStructureCollection(RpsLoadMode.NoLoad)
1564+
context.CurrentTask.ProFormaStructures = new RpsStructureCollection(context.Repository,RpsLoadMode.NoLoad)
15651565

15661566
try
15671567
begin

CodeGenEngine/LoopExpander.dbl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ namespace CodeGen.Engine
168168
data context = template.Context
169169
data task = context.CurrentTask
170170
data loop = ^as(loops.Last(), FieldLoopNode)
171-
data groupStructure = String.IsNullOrWhiteSpace(field.GroupStructure) ? new RpsStructure(field.GroupFields,field.Name) : new RpsStructure(field.GroupStructure)
171+
data groupStructure = String.IsNullOrWhiteSpace(field.GroupStructure) ? new RpsStructure(context.Repository,field.GroupFields,field.Name) : new RpsStructure(context.Repository,field.GroupStructure)
172172
data saveMaxIndex = loop.MaxIndex
173173
data saveCurrentIndex = loop.CurrentIndex
174174

@@ -869,7 +869,7 @@ namespace CodeGen.Engine
869869
end
870870

871871
;;Build a collection of enums that are referred to by the current structure
872-
data enumsToProcess = new RpsEnumCollection(currentStructure.Name)
872+
data enumsToProcess = new RpsEnumCollection(context.Repository,currentStructure.Name)
873873

874874
loop.MaxIndex = enumsToProcess.Count - 1
875875
context.CurrentTask.DebugLog(String.Format(" - {0,-30} -> {1} enums", string.Format("<{0}>", loop.OpenToken.Value), loop.MaxIndex + 1))
@@ -939,7 +939,7 @@ namespace CodeGen.Engine
939939
begin
940940
;;If the to structure was not found then it's not currently being processed
941941
;;so we'll load it directly from the repository
942-
loop.ToStructure = new RpsStructure(loop.CurrentRelation.ToStructure,context.CurrentTask.UseAlternateFieldNames)
942+
loop.ToStructure = new RpsStructure(context.Repository,loop.CurrentRelation.ToStructure,context.CurrentTask.UseAlternateFieldNames)
943943
end
944944
end
945945

@@ -1574,7 +1574,7 @@ namespace CodeGen.Engine
15741574

15751575
try
15761576
begin
1577-
loop.CurrentEnum = new RpsEnum(enumName)
1577+
loop.CurrentEnum = new RpsEnum(context.Repository,enumName)
15781578
end
15791579
catch (ex, @Exception)
15801580
begin
@@ -1602,7 +1602,7 @@ namespace CodeGen.Engine
16021602

16031603
try
16041604
begin
1605-
loop.CurrentStructure = new RpsStructure(structureName,context.CurrentTask.UseAlternateFieldNames)
1605+
loop.CurrentStructure = new RpsStructure(context.Repository,structureName,context.CurrentTask.UseAlternateFieldNames)
16061606
context.SetCurrentStructure(loop.CurrentStructure)
16071607
end
16081608
catch (ex, @Exception)

CodeGenEngine/ParseWindowScript.dbl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ namespace CodeGen.Engine
428428
begin
429429
data fsix, int
430430

431-
context.Structures = new RpsStructureCollection(RpsLoadMode.NoLoad)
431+
context.Structures = new RpsStructureCollection(context.Repository,RpsLoadMode.NoLoad)
432432

433433
for fsix from 1 thru FieldSets.Count-1
434434
begin
@@ -452,7 +452,7 @@ namespace CodeGen.Engine
452452
;;Create an collection of repository fields containing only the
453453
;;fields from the input window
454454

455-
Fields = new RpsFieldCollection()
455+
Fields = new RpsFieldCollection(context.Repository)
456456
foreach WscField in CurrentFieldSet.GetEnumerator()
457457
begin
458458
data Field, @RpsField
@@ -468,7 +468,7 @@ namespace CodeGen.Engine
468468
begin
469469
data Bracket2Pos, int
470470
data TmpArrayDim, [#]int
471-
Field = new RpsField(WscField.Structure,WscField.Name(1,Bracket1Pos-1))
471+
Field = new RpsField(context.Repository,WscField.Structure,WscField.Name(1,Bracket1Pos-1))
472472
;;Suffix the field name with the old array element #
473473
Bracket2Pos = %instr(Bracket1Pos,WscField.Name,"]")
474474
Field.SqlName = Field.Name + WscField.Name(Bracket1Pos+1,Bracket2Pos-1)
@@ -483,7 +483,7 @@ namespace CodeGen.Engine
483483
Field.ArrayDimension = TmpArrayDim
484484
end
485485
else
486-
Field = new RpsField(WscField.Structure,WscField.Name)
486+
Field = new RpsField(context.Repository,WscField.Structure,WscField.Name)
487487
end
488488
catch (ex)
489489
begin
@@ -511,7 +511,7 @@ namespace CodeGen.Engine
511511

512512
;;Now create a structure containing the fields from the input window
513513
try
514-
Struct = new RpsStructure(CurrentFieldSet.StructureName,Fields)
514+
Struct = new RpsStructure(context.Repository,CurrentFieldSet.StructureName,Fields)
515515
catch (ex)
516516
begin
517517
ErrStatus = context.CurrentTask.ErrorLog("Structure "+CurrentFieldSet.StructureName+" not found!" )

CodeGenEngine/RepositoryTools.dbl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ namespace CodeGen.Engine
279279
arrayIndex4 = "[" + %string(al1,mask(1:%trim(%string(Field.ArrayDimension[1])))) + "," + %string(al2,mask(1:%trim(%string(Field.ArrayDimension[2])))) + "," + %string(al3,mask(1:%trim(%string(Field.ArrayDimension[3])))) + "," + %string(al4,mask(1:%trim(%string(Field.ArrayDimension[4])))) + "]"
280280

281281
;; Start with a copy of the current field
282-
newField4 = new RpsField(Field)
282+
newField4 = new RpsField(context.Repository,Field)
283283

284284
;; Change the necessary properties
285285
newField4.Name = Field.Name + arrayIndex4
@@ -341,7 +341,7 @@ namespace CodeGen.Engine
341341
arrayIndex3 = "[" + %string(al1,mask(1:%trim(%string(Field.ArrayDimension[1])))) + "," + %string(al2,mask(1:%trim(%string(Field.ArrayDimension[2])))) + "," + %string(al3,mask(1:%trim(%string(Field.ArrayDimension[3])))) + "]"
342342

343343
;; Start with a copy of the current field
344-
newField3 = new RpsField(Field)
344+
newField3 = new RpsField(context.Repository,Field)
345345

346346
;; Change the necessary properties
347347
newField3.Name = Field.Name + arrayIndex3
@@ -402,7 +402,7 @@ namespace CodeGen.Engine
402402
arrayIndex2 = "[" + %string(al1,mask(1:%trim(%string(Field.ArrayDimension[1])))) + "," + %string(al2,mask(1:%trim(%string(Field.ArrayDimension[2])))) + "]"
403403

404404
;; Start with a copy of the current field
405-
newField2 = new RpsField(Field)
405+
newField2 = new RpsField(context.Repository,Field)
406406

407407
;; Change the necessary properties
408408
newField2.Name = Field.Name + arrayIndex2
@@ -461,7 +461,7 @@ namespace CodeGen.Engine
461461
arrayIndex1 = "[" + %string(al1) + "]"
462462

463463
;; Start with a copy of the current field
464-
newField1 = new RpsField(Field)
464+
newField1 = new RpsField(context.Repository,Field)
465465

466466
;; Change the necessary properties
467467
newField1.Name = Field.Name + arrayIndex1
@@ -665,7 +665,7 @@ namespace CodeGen.Engine
665665

666666
Child.GroupType = RpsFieldGroup.No
667667
Child.GroupStructure = String.Empty
668-
Child.GroupFields = new RpsFieldCollection()
668+
Child.GroupFields = new RpsFieldCollection(context.Repository)
669669
Child.GroupMemberPrefix = String.Empty
670670

671671
;TODO: IF OVERLAYS ARE INCLUDED THEN NEED TO UPDATE OVERLAY OFFSET. NOT SURE IF THIS IS EVEN FEASIBLE???

CodeGenEngine/TokenExpanders/TokenExpanderParameterLoop.dbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ namespace CodeGen.Engine
10501050
end
10511051
(ParameterType.Structure),
10521052
begin
1053-
data str = new RpsStructure(param.StructureName)
1053+
data str = new RpsStructure(template.Context.Repository,param.StructureName)
10541054
data sb = new StringBuilder("{")
10551055
data fld, @RpsField
10561056
data sampleData, string

HarmonyCoreCodeGen.Core/Model/Solution.dbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ namespace HarmonyCoreGenerator.Model
13541354
if(AlternateFieldNames.HasValue)
13551355
altFieldNames = AlternateFieldNames.Value
13561356

1357-
context.Structures = new RpsStructureCollection(RpsLoadMode.Load, altFieldNames)
1357+
context.Structures = new RpsStructureCollection(context.Repository,RpsLoadMode.Load,altFieldNames)
13581358
context.Properties.TryAdd(^typeof(HarmonyCoreExtensions.Helpers.RelationLookup), new HarmonyCoreExtensions.Helpers.RelationLookup(context.Structures, loadedRelations))
13591359
;;create code generator
13601360
data codegenInstance = new CodeGenerator(taskSet, context)

IsamView/Controls/FileView.dbl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace IsamView.Controls
1414

1515
public partial class FileView extends UserControl
1616

17+
private mRepository ,@Repository ;;Repository
1718
private mFile ,@RpsFile ;;Repository file
1819
private mStructure ,@RpsStructure ;;Files first (or only) structure
1920
private mClassFactory ,@DynamicClassFactory ;;Class factory for data
@@ -31,11 +32,13 @@ namespace IsamView.Controls
3132
this.InitializeComponent()
3233
this.Dock = DockStyle.Fill
3334

35+
mRepository = new Repository()
36+
3437
;;Save the file data
3538
mFile = aFile
3639

3740
;;Load the first structure and remove overlay fields
38-
mStructure = new RpsStructure(mFile.FirstStructure)
41+
mStructure = new RpsStructure(mRepository,mFile.FirstStructure)
3942
mStructure.Fields.RemoveOverlays()
4043

4144
;;Create a dynamic class factory

IsamView/Forms/MainForm.dbl

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ namespace IsamView.Forms
1212

1313
public partial class MainForm extends Form
1414

15-
private mRps ,@Repository
16-
private mProfileManager ,@ProfileManager
15+
private mRepository, @Repository
16+
private mProfileManager, @ProfileManager
1717

1818
public method MainForm
19-
endparams
2019
proc
2120
this.InitializeComponent()
2221

@@ -40,7 +39,6 @@ namespace IsamView.Forms
4039
private method MainForm_Load, void
4140
byval sender, @System.Object
4241
byval e, @System.EventArgs
43-
endparams
4442
proc
4543

4644
;;Initialize the profile manager and load existing profiles
@@ -128,9 +126,9 @@ namespace IsamView.Forms
128126
byval e, @System.Windows.Forms.FormClosedEventArgs
129127
endparams
130128
proc
131-
if (mRps!=^null)
132-
mRps.Dispose()
133-
clear mRps
129+
if (mRepository!=^null)
130+
mRepository.Dispose()
131+
clear mRepository
134132
clear mProfileManager
135133
endmethod
136134

@@ -171,7 +169,7 @@ namespace IsamView.Forms
171169
if (file.FirstStructure!=" ") then
172170
begin
173171
data str, @RpsStructure
174-
str = new RpsStructure(file.FirstStructure)
172+
str = new RpsStructure(mRepository,file.FirstStructure)
175173
lblFields.Text = str.Fields.Count.ToString()
176174
end
177175
else
@@ -297,22 +295,22 @@ namespace IsamView.Forms
297295
closedFileName ,@String
298296
ix ,int
299297
endrecord
300-
proc
301-
if (mainTabControl.SelectedTab.Tag != ^null)
302-
begin
303-
closedFileName = ((RpsFile)mainTabControl.SelectedTab.Tag).Name
304-
;;Go looking for the corresponding item in the View menu
305-
for ix from 5 thru mnuView.DropDownItems.Count - 1
306-
begin
307-
if (mnuView.DropDownItems[ix].Tag.ToString() == closedFileName )
308-
begin
309-
;;Yep, that's the one, remove it
310-
mnuView.DropDownItems.Remove(mnuView.DropDownItems[ix])
311-
exitloop
312-
end
313-
end
314-
mainTabControl.TabPages.Remove(mainTabControl.SelectedTab)
315-
end
298+
proc
299+
if (mainTabControl.SelectedTab.Tag != ^null)
300+
begin
301+
closedFileName = ((RpsFile)mainTabControl.SelectedTab.Tag).Name
302+
;;Go looking for the corresponding item in the View menu
303+
for ix from 5 thru mnuView.DropDownItems.Count - 1
304+
begin
305+
if (mnuView.DropDownItems[ix].Tag.ToString() == closedFileName )
306+
begin
307+
;;Yep, that's the one, remove it
308+
mnuView.DropDownItems.Remove(mnuView.DropDownItems[ix])
309+
exitloop
310+
end
311+
end
312+
mainTabControl.TabPages.Remove(mainTabControl.SelectedTab)
313+
end
316314
endmethod
317315

318316
private method mnuHelpAbout_Click, void
@@ -373,10 +371,10 @@ namespace IsamView.Forms
373371
;;If we came back from the profile manager with no profiles then close anything that we were working with before
374372
if (mProfileManager.Profiles.Count==0)
375373
begin
376-
if (mRps!=^null)
374+
if (mRepository!=^null)
377375
begin
378-
mRps.Dispose()
379-
clear mRps
376+
mRepository.Dispose()
377+
clear mRepository
380378
end
381379
filesGrid.DataSource = ^null
382380
end
@@ -409,10 +407,10 @@ namespace IsamView.Forms
409407
end
410408

411409
;;Close the repository
412-
if (mRps!=^null)
410+
if (mRepository!=^null)
413411
begin
414-
mRps.Dispose()
415-
clear mRps
412+
mRepository.Dispose()
413+
clear mRepository
416414
filesGrid.DataSource = ^null
417415
end
418416

@@ -425,8 +423,8 @@ namespace IsamView.Forms
425423
end
426424

427425
;;Open the repository and load the file definitions
428-
mRps = new Repository()
429-
filesGrid.DataSource = mRps.Files
426+
mRepository = new Repository()
427+
filesGrid.DataSource = mRepository.Files
430428
end
431429
else
432430
begin

0 commit comments

Comments
 (0)