Skip to content

Commit 47da3f8

Browse files
committed
WIP, create the call graph
1 parent 3b21778 commit 47da3f8

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

BackendAst/DAstConstruction.fs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,6 +1000,41 @@ let private mapFile (r:Asn1AcnAst.AstRoot) (newTasMap : Map<TypeAssignmentInfo,
10001000
let private reMapFile (r:Asn1AcnAst.AstRoot) (icdStgFileName:string) (files0:Asn1File list) (deps:Asn1AcnAst.AcnInsertedFieldDependencies) (lm:LanguageMacros) (f:Asn1File) (us:State) =
10011001
let newModules, ns = f.Modules |> foldMap (fun cs m -> reMapModule r icdStgFileName files0 deps lm m cs) us
10021002
{f with Modules = newModules}, ns
1003+
(*
1004+
//the following functions determines which functions are used by PDU types.
1005+
//Only those functions are generated in the generated code.
1006+
let determinGeneratedFunctions (r:Asn1AcnAst.AstRoot) (files: Asn1File list) (us:State) =
1007+
let getFunctionCalls (tasId:ReferenceToType)=
1008+
seq {
1009+
for c in us.functionCalls do
1010+
if c.Key.typeId.AsString.StartsWith (tasId.AsString) then
1011+
yield (c.Key, c.Value)
1012+
} |> Seq.toList
1013+
1014+
let allTasses =
1015+
seq {
1016+
for f in files do
1017+
for m in f.Modules do
1018+
for tas in m.TypeAssignments do
1019+
match tas.Type.isValidFunction with
1020+
| None -> ()
1021+
| Some isValidFunction ->
1022+
match isValidFunction.funcName with
1023+
| None -> ()
1024+
| Some fncName ->
1025+
let fncCalls = getFunctionCalls tas.Type.id
1026+
yield {modName = m.Name.Value; tasName = tas.Name.Value; validationFunName = fncName; validationDependencies = fncCalls}
1027+
1028+
} |> List.ofSeq
1029+
let ret =
1030+
match r.args.icdPdus with
1031+
| None -> allTasses |> List.map(fun tas -> tas.modName, tas.tasName)
1032+
| Some pdus ->
1033+
let pduTas = pdus |> List.choose (fun pdu -> allTasses |> List.tryFind(fun tas -> tas.tasName = pdu))
1034+
0
1035+
0
1036+
1037+
*)
10031038

10041039
let DoWork (r:Asn1AcnAst.AstRoot) (icdStgFileName:string) (deps:Asn1AcnAst.AcnInsertedFieldDependencies) (lang:CommonTypes.ProgrammingLanguage) (lm:LanguageMacros) (encodings: CommonTypes.Asn1Encoding list) : AstRoot=
10051040
let l = lang

0 commit comments

Comments
 (0)