|
12345678910111213141516171819202122232425262728293031323334353637 |
- from CPP import *
- from Function import *
-
- def process(FILE_IN):
- # Read file.
- lines_in = []
- with open(FILE_IN) as file:
- for line in file:
- lines_in.append(line.rstrip())
-
- f = Function()
- out = includes()
-
- # Parse.
- for ln in lines_in:
- ln = ln.rstrip()
-
- # Empty line.
- if ln == "":
- out += "\n"
- # Comment.
- elif (
- ln.startswith("#") and
- not f.isBody
- ):
- out += replaceComment(ln) + "\n"
- # Function.
- else:
- f.parseLine(ln)
-
- if f.isComplete:
- cpp = CPP(f)
- out += cpp.translate()
- # Create new function instance.
- f = Function()
-
- return out
|