Index: /src/mpy.py
===================================================================
--- /src/mpy.py	(revision 4)
+++ /src/mpy.py	(revision 5)
@@ -25,8 +25,7 @@
 # TODO add unitary tests
 # TODO add [ and { despecialization
-# TODO save the directory exploration to do it only once per session
-# -------------------------------------------------------------------------------------------------
-_date = '2009-12-30 16:00'
-_version = '1.07'
+# -------------------------------------------------------------------------------------------------
+_date = '2011-01-05 14:30'
+_version = '1.08'
 _authors = 'Franck Wajsburt'
 _organization = '(UPMC/LIP6/SOC)'
@@ -40,5 +39,5 @@
 ==========================================================================='''
 
-import os, sys, pdb
+import os, sys, pdb, math, re
 from optparse import OptionParser
 from datetime import datetime
@@ -287,31 +286,33 @@
                         # test if buf is a file name, if yes includes file
                         # therefore pushes the current file and opens the new
-                        incname = _mpyfindfile(buf,mpyidir)
-                        if incname != '':
-                           if mpydebug == True:
-                              _mpylog("\nInclude  to %s from %s" % (mpyout, incname))
-
-                           # push known parameters of the current opened file
-                           opened_mpyin.append((mpyin, mpybuf, mpyfname,
+
+                        if re.match("\w*(\.\w*)+",buf):
+                           incname = _mpyfindfile(buf,mpyidir)
+                           if incname != '':
+                              if mpydebug == True:
+                                 _mpylog("\nInclude  to %s from %s" % (mpyout, incname))
+
+                              # push known parameters of the current opened file
+                              opened_mpyin.append((mpyin, mpybuf, mpyfname,
                                                 mpylineno, mpycharno, mpylength))
 
-                           # old values required for test of recursivity just below
-                           oldmpyfname = mpyfname
-                           oldmpylineno = mpylineno
-
-                           # open the include file
-                           mpyin, mpyfname = _mpyopen(realfname = incname)
-                           mpybuf = mpyin.read(-1)
-                           mpylineno = 1
-                           mpycharno = 0
-                           mpylength = len(mpybuf)
-                           level = 0
-                           buf = mode = ''
-
-                           # test recursive include
-                           for f in opened_mpyin[:-1]:
-                              if mpyfname in f:
-                                 _exit ("%s[%d]: forbidden recursive inclusion on %s"
-                                        % (oldmpyfname, oldmpylineno, mpyfname))
+                              # old values required for test of recursivity just below
+                              oldmpyfname = mpyfname
+                              oldmpylineno = mpylineno
+
+                              # open the include file
+                              mpyin, mpyfname = _mpyopen(realfname = incname)
+                              mpybuf = mpyin.read(-1)
+                              mpylineno = 1
+                              mpycharno = 0
+                              mpylength = len(mpybuf)
+                              level = 0
+                              buf = mode = ''
+
+                              # test recursive include
+                              for f in opened_mpyin[:-1]:
+                                 if mpyfname in f:
+                                    _exit ("%s[%d]: forbidden recursive inclusion on %s"
+                                           % (oldmpyfname, oldmpylineno, mpyfname))
 
                         # just evaluate buf
@@ -431,4 +432,9 @@
 
 # -------------------------------------------------------------------------------------------------
+
+def log2(x):
+    return int(math.ceil(math.log(x,2)))
+
+# -------------------------------------------------------------------------------------------------
 # define globals dictionnary
 # -------------------------------------------------------------------------------------------------
