blob: e895719186fe8b6c2284f5aff7ad34620ada3fe1 [file] [log] [blame] [edit]
#!/usr/bin/env python3
import os
import re
import common
re_subckt = re.compile('^\s*(?:inline)?\s*\.?(?:subckt|model)\s+([^\s]*)\s*')
broken = []
for pn in common.files('spice'):
print("spice file", pn)
found = False
with open(pn) as f:
f = iter(f)
try:
while True:
l = next(f)
l = l.strip().lower()
if l.startswith('*'):
continue
if l.startswith('//'):
continue
if 'subckt' not in l and '.model' not in l:
continue
nl = next(f)
nl = nl.strip().lower()
if 'ends' in nl:
common.add_file_for_module(mod, pn, include=True)
continue
m = re_subckt.search(l)
if not m:
print(" Error:", l)
continue
mod = m.group(1)
common.add_file_for_module(mod, pn)
found = True
except StopIteration:
pass
# Hack for empty file
if 's8rf_pshort_W1p65_L0p15_M4_b' in pn:
found = True
if not found:
broken.append(pn)
print(" !!!! No subckt found in", pn)
common.write_mod_json('spice', common.modules, broken)