[Mumps2Py:] [99] cleaned up how I call on mumps2py. |
[ Thread Index |
Date Index
| More lists.mumps2py.org/discuss Archives
]
Revision: 99
Author: pgallot
Date: 2008-02-12 18:54:37 +0000 (Tue, 12 Feb 2008)
Log Message:
-----------
cleaned up how I call on mumps2py.
Modified Paths:
--------------
trunk/mumps2py_test.py
trunk/mumps2py_ui.pyw
Modified: trunk/mumps2py_test.py
===================================================================
--- trunk/mumps2py_test.py 2008-02-12 18:53:53 UTC (rev 98)
+++ trunk/mumps2py_test.py 2008-02-12 18:54:37 UTC (rev 99)
@@ -19,7 +19,7 @@
""" Provides a regression testing system for Mumps2Py """
import ConfigParser, os, tempfile
-import mumps2py.mumps_module, mumps2py.mumps2tok, mumps2py.tok2python
+import mumps2py
def compare_files(filename_1, filename_2):
@@ -38,11 +38,9 @@
def generate_outputoutput(test_file, out_file, out_dir):
"""given a test_file, generate out_file from the Python translation"""
- the_module = mumps2py.mumps_module.ModuleInfo(test_file, \
- out_dir, \
- "temp")
- mumps2py.mumps2tok.parseMumps(the_module)
- translation = mumps2py.tok2python.translate(the_module)
+ the_module = mumps2py.parse_for_routines(test_file, out_dir)[0]
+ mumps2py.parseMumps(the_module)
+ translation = mumps2py.translate(the_module)
pytrans_file = the_module.output_file
print "writing translation to", pytrans_file
py_outputfile = open(pytrans_file,"w+")
Modified: trunk/mumps2py_ui.pyw
===================================================================
--- trunk/mumps2py_ui.pyw 2008-02-12 18:53:53 UTC (rev 98)
+++ trunk/mumps2py_ui.pyw 2008-02-12 18:54:37 UTC (rev 99)
@@ -18,10 +18,7 @@
""" Implements a user interface for translating Mumps code to Python """
import os, re, fileinput, time
-from mumps2py.mumps_module import parse_for_routines
-from mumps2py.mumps2tok import parseMumps, ParseError
-from mumps2py.tok2python import translate
-from mumps2py.mumps2py_config import create_m2p_file
+import mumps2py
import mumps2py_test
from Tkinter import *
@@ -169,7 +166,7 @@
for a_module in self.modules:
if a_module.end < start_line:
continue
- parseMumps(a_module)
+ mumps2py.parseMumps(a_module)
def parsegivenmodule(self, popup):
"""parse the module specified by popup"""
@@ -181,10 +178,10 @@
self.__display_before(the_module.input_file, \
the_module.start, the_module.end)
try:
- parseMumps(the_module)
- translation = translate(the_module)
+ mumps2py.parseMumps(the_module)
+ translation = mumps2py.translate(the_module)
self.__display_after(the_module, translation)
- except ParseError, err:
+ except mumps2py.ParseError, err:
print err.error_msg()
self.__display_decomposed(the_module)
return
@@ -193,12 +190,12 @@
"""parse all the modules in a Mumps file"""
if self.modules:
for the_module in self.modules:
- parseMumps(the_module)
+ mumps2py.parseMumps(the_module)
if len(self.modules) == 1:
the_module = self.modules[0]
- parseMumps(the_module)
+ mumps2py.parseMumps(the_module)
self.__display_decomposed(the_module)
- translation = translate(the_module)
+ translation = mumps2py.translate(the_module)
self.__display_after(the_module, translation)
def parseuntilmodule(self, popup):
@@ -228,7 +225,7 @@
for modcnt, the_module in enumerate(modules_list):
print the_module.mod_name
if the_module.tokenlist_isempty():
- parseMumps(the_module, input_file)
+ mumps2py.parseMumps(the_module, input_file)
for token in the_module.TokenList:
token.count_subtokens(toks)
the_module.empty_tokenlist() # keep memory usage down
@@ -266,7 +263,7 @@
self.file_close()
tstart = time.time()
- self.modules = parse_for_routines(mumps_file, m2py_dir)
+ self.modules = mumps2py.parse_for_routines(mumps_file, m2py_dir)
print time.time() - tstart,"seconds to load %d routines" \
% len(self.modules)
if len(self.modules) == 1:
@@ -312,7 +309,7 @@
)
if m2p_fname:
if input_fname:
- create_m2p_file(m2p_fname, input_fname)
+ mumps2py.create_m2p_file(m2p_fname, input_fname)
self.message(m2p_fname + " created.")
def save_and_run(self):