forked from ram1123/FNAL-Beam-Test-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HeaderExtracter.py
69 lines (60 loc) · 1.53 KB
/
HeaderExtracter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
############################################################
# To Do List
#
# 1.
#
#
#
############################################################
# Basic Info about this Macro
#
#
#
#
############################################################
import sys
try:
fp = open("ClassReadTree.h")
except IOError:
sys.exit('\n=> ERROR:: File not found : ClassReadTree.h\n')
else:
print('File ClassReadTree.h opened')
sys.stdout = open('ClassReadTree.cc', 'w')
start1 = 0
start2 = 0
start3 = 0
for i, line in enumerate(fp):
if "class ClassReadTree {" in line:
#print('Found line containing "class ClassReadTree {"')
#print "line number is = ",i
start1 = 1
#else:
#sys.exit('Error 1: Could not find line containing "class ClassReadTree {"')
if start1 == 1:
print line
if "}" in line:
start1 = 0
#else:
# sys.exit('Could not find closing braces }')
if "ClassReadTree::Init(" in line:
#print "line number is = ",i
start2 = 1
#else:
#sys.exit('Could not find line containing "ClassReadTree::Init("')
if start2 == 1:
print line
if "}" in line:
start2 = 0
#else:
# sys.exit('Could not find closing braces }')
if "ClassReadTree::~ClassReadTree()" in line:
start3 = 1
#else:
#sys.exit('Could not find line containing "ClassReadTree::~ClassReadTree()"')
if start3 == 1:
print line
if "}" in line:
start3 = 0
#else:
#sys.exit('Could not find closing braces }')
fp.close()