summaryrefslogtreecommitdiffstats
path: root/sse-feed
diff options
context:
space:
mode:
Diffstat (limited to 'sse-feed')
-rwxr-xr-xsse-feed34
1 files changed, 26 insertions, 8 deletions
diff --git a/sse-feed b/sse-feed
index d16dfef..8290f48 100755
--- a/sse-feed
+++ b/sse-feed
@@ -1,14 +1,34 @@
#!/usr/bin/python
-import sys, os
+import sys, os, MYSQLdb
+from popen2 import Popen3
-def handle_file(path, dirpath, filename):
- global ms
+LEXER_PATH="."
+
+db = MySQLdb.connect(host = "localhost", user = "sse_web", passwd = "ece6Yoli", db = "sse")
+
+def process_file(root, path):
+ print "Processing %s" % path
+
+
+
+ p = Popen3("%s/lex-c %s" % (LEXER_PATH, os.path.join(root, path)))
+
+ for identifier in p.fromchild:
+ print "ID:", identifier.strip()
+
+ if p.wait() != 0:
+ print "WARNING: Subprocess failed!"
+
+ del p
+
+def handle_file(root, path, filename):
extension = filename.split(".")[-1]
if extension in ("c", "h"):
- print "C source %s %s %s" % (path, dirpath, filename)
+ process_file(root, os.path.join(path, filename))
+
def handle_tree(path):
@@ -16,11 +36,9 @@ def handle_tree(path):
for dirpath, dirs, files in os.walk(path):
for f in files:
- assert path, dirpath[:len(path)]
+ assert path + "/" == (dirpath + "/") [:len(path)+1]
- dirpath = dirpath[len(path):]
-
- handle_file(path, dirpath, f)
+ handle_file(path, dirpath[len(path)+1:], f)
for a in sys.argv[1:]:
handle_tree(a)