erste Fassung von awl2scl erzeugt
This commit is contained in:
+1142
File diff suppressed because it is too large
Load Diff
+11
-3
@@ -268,6 +268,7 @@ INDIRECT_CALL_TOKENS = {"UC", "CC"}
|
||||
POINTER_ARITH_TOKENS = {
|
||||
"LAR1_ACCU1", "LAR2_ACCU1", "TAR1_ACCU1", "TAR2_ACCU1", "ADDAR1", "ADDAR2",
|
||||
}
|
||||
OPEN_DB_TOKENS = {"OPEN_DB", "OPEN_DI"}
|
||||
|
||||
|
||||
def _pat(p):
|
||||
@@ -316,11 +317,12 @@ class Complexity:
|
||||
self.indirect_calls = 0
|
||||
self.register_indirect = 0
|
||||
self.pointer_arith = 0
|
||||
self.indirect_db_open = 0
|
||||
self.networks = 0
|
||||
|
||||
@property
|
||||
def has_pointer_signal(self):
|
||||
return self.register_indirect > 0 or self.pointer_arith > 0
|
||||
return self.register_indirect > 0 or self.pointer_arith > 0 or self.indirect_db_open > 0
|
||||
|
||||
@property
|
||||
def has_branch_signal(self):
|
||||
@@ -340,6 +342,10 @@ def analyze_complexity(blk):
|
||||
c.indirect_calls += 1
|
||||
if text in POINTER_ARITH_TOKENS:
|
||||
c.pointer_arith += 1
|
||||
if text in OPEN_DB_TOKENS:
|
||||
for acc in st.findall(f"{NS_SL}Access"):
|
||||
if acc.find(f"{NS_SL}Indirect") is not None:
|
||||
c.indirect_db_open += 1
|
||||
if st.find(f"{NS_SL}LabelDeclaration") is not None:
|
||||
c.labels += 1
|
||||
for ind in blk.iter(f"{NS_SL}Indirect"):
|
||||
@@ -352,7 +358,8 @@ def classify(xml_path, complexity):
|
||||
if complexity.networks == 0:
|
||||
return "A", "reine Datenablage ohne Programmcode (0 Netzwerke, z.B. GlobalDB)"
|
||||
if complexity.has_pointer_signal:
|
||||
return "C", f"registerindirekte Adressierung ({complexity.register_indirect}x Indirect, {complexity.pointer_arith}x AR-Arithmetik)"
|
||||
return "C", (f"registerindirekte Adressierung ({complexity.register_indirect}x Indirect, "
|
||||
f"{complexity.pointer_arith}x AR-Arithmetik, {complexity.indirect_db_open}x OPN DB[Variable])")
|
||||
name_cat = classify_by_name(xml_path)
|
||||
if name_cat == "C":
|
||||
return "C", "Namensmuster (Daten*/Fifo*/DBMOV/Logistik/SS_Host/Visualisierung)"
|
||||
@@ -412,7 +419,8 @@ def default_log_path():
|
||||
def _format_result_line(r):
|
||||
c = r.complexity
|
||||
stats = (f"Sprünge={c.jumps} Labels={c.labels} IndirekteAufrufe={c.indirect_calls} "
|
||||
f"RegisterIndirekt={c.register_indirect} AR-Arithmetik={c.pointer_arith} NW={c.networks}")
|
||||
f"RegisterIndirekt={c.register_indirect} AR-Arithmetik={c.pointer_arith} "
|
||||
f"OPN-Indirekt={c.indirect_db_open} NW={c.networks}")
|
||||
return (f"{r.btype:10s} {str(r.num or ''):>5s} {r.name or '':30s} [{stats}]\n"
|
||||
f" Grund: {r.reason}\n"
|
||||
f" Pfad : {r.xml_path}")
|
||||
|
||||
Reference in New Issue
Block a user