# Path: AOR/Subroutine.py
# class Subroutine(ProgUnit):
#     # Constructor for a subroutine object. Parameter:
#     #
#     # sSubName -- Name of function
#     #
#     def __init__(self, subStatement=None):
#         ProgUnit.__init__(self, subStatement)
# 
# Path: AOR/Function.py
# class Function(ProgUnit):
#     # Constructor for a subroutine object. Parameter:
#     #
#     # sSubName -- Name of function
#     #
#     def __init__(self, FuncStatement):
#         ProgUnit.__init__(self, FuncStatement)
# 
# Path: AOR/Program.py
# class Program(ProgUnit):
#     # Constructor for a program object. Parameter:
#     #
#     # sProgName -- Name of function
#     #
#     def __init__(self, progStatement=None):
#         ProgUnit.__init__(self, progStatement)
# 
# Path: AOR/AttributeString.py
# class AttributeString(str):
#     def __init__(self, s):
#     def sCreateCopy(self, s):
#     def tSplitString(self, n):
#     def SetPrefixAttributes(self,  l) : self.lPrefix = l[:]
#     def SetPostfixAttributes(self, l) : self.lPostfix = l[:]
#     def AppendPrefix(self,  o):
#     def AppendPostfix(self, o):
#     def GetPrefixAttributes(self ): return self.lPrefix
#     def GetPostfixAttributes(self): return self.lPostfix
#     def GetString(self): return str.__str__(self)
#     def upper(self):
#     def lower(self):
#     def capitalize(self):
#     def ToList(self, stylesheet, l): return l.append(self)
#     def __repr__(self):
# 
# Path: Tools/Config.py
# class Config:
#     # Class attribut with all general (i.e. not format specific)
#     # attributes
#     dDefault = { 'stylesheet' : {'labelalignright'      : 1,
#                                  'indent'               : 3,
#                                  'keywordcase'          : 'upper',
#                                  'variablecase'         : 'lower',
#                                  'contlinemarker'       : '&',
#                                  'spacebetweencommalist': 1,
#                                  'format'               : 'fixed',
#                                  'maxcols'              : {'fixed' : 72, 'free' : 132},
#                                  'startcolumn'          : {'fixed' :  7, 'free' :   1},
#                                  },
#                  'files'      : {'amip1sst.F': {'linelength':132},
#                                  'landmask.F': {'linelength':132},
#                                  'sstmskgh.F': {'linelength':132},
#                                  'zevpmx.F'  : {'linelength':132}
#                                  },
#                  'project'    : {'paths'     : [".","whatever/directory"]
#                                  },
#                  }
# 
#     # Special character used to separate entries for dictionary in dict in ...
#     # e.g.: "project|paths" instead of ["project"]["path"]
#     sSeparatorChar = "|"
#     
#     # The actual configuration information (as a class variable)
#     dConfig        = {}
#     # --------------------------------------------------------------------------
#     # Init: save the config filename and read the config file
#     def __init__(self, sConfigFilename="stanrc"):
#         if not Config.dConfig:
#             Config.sConfigFilename=sConfigFilename
#             self.GetConfig()
# 
#     # -------------------------------------------------------------------------
#     def GetConfig(self):
#         # Try reading the config file. If it doesn't exist (or any other
#         # error occurs), get the default values
#         try:
#             f=open(Config.sConfigFilename,'r')
#             l=f.readlines()
#             f.close()
#             s="\n".join(l)
#             Config.dConfig=eval(s)
#         except IOError:
#             Config.dConfig = Config.dDefault.copy()
#             self.WriteConfigFile()
#             
#     # -------------------------------------------------------------------------
#     # Save the config dictionary
#     def WriteConfigFile(self):
#         try:
#             f=open(Config.sConfigFilename,'w')
#         except IOError:
#             print "Couldn't open",Config.sConfigFilename
#             return
#         f.write(`Config.dConfig`)
#         f.write("\n")
#         f.close()
#         
#     # -------------------------------------------------------------------------
#     # Access to the configuration data via a dictionary like interface.
#     # As a shortcut, one can use "|" (see sSeparatorChar) to divide several
#     # nested dictionaries, i.e. ["a|b|c"] instead of ["a"]["b"]["b"]
#     def __getitem__(self, sKey):
#         l = sKey.split(Config.sSeparatorChar)
#         d = Config.dConfig
#         for i in l:
#             d=d.get(i,None)
#             if not d:
#                 return None
#         return d
#     # -------------------------------------------------------------------------
#     # Set configuration data via a dictionary like interface.
#     # As a shortcut, one can use "|" (see sSeparatorChar) to divide several
#     # nested dictionaries, i.e. ["a|b|c"]=1 instead of ["a"]["b"]["b"]=1
#     def __setitem__(self, sKey, value):
#         l = sKey.split(Config.sSeparatorChar)
#         d = Config.dConfig
#         # Follow the tree:
#         for i in range(len(l)-1):
#             d1=d.get(l[i],None)         # goto next dictionary
#             # Create new entry for all remaining entries
#             if not d1:
#                 for j in range(i, len(l)-1):
#                     d[l[j]] = {}
#                     d       = d[l[j]]
#                 d[l[-1]] = value
#                 self.WriteConfigFile()  # save the modified config file
#                 return
#             d=d1
#         d[l[-1]] = value
# 
#         self.WriteConfigFile()          # save the modified config file


import string
    import sys
    import getopt
        import profile
from   UserList            import UserList
from   AOR.Subroutine      import Subroutine
from   AOR.Function        import Function
from   AOR.Program         import Program
from   AOR.AttributeString import Comment
from   Tools.Config        import Config
    from Grammar.Parser import Parser
    from AOR.AttributeString import Comment
                from Analyser.Interface import GenerateInterface
#! /usr/bin/env python


# This is the base class for all output functions
class Output(Config):
    # Constructor. Parameter:
    #
    # f -- file object to output
    def __init__(self, f, nMaxCols=72, sFormat='fixed'):
        dClass2Func = { Comment   : self.CommentLine,

# Path: AOR/Subroutine.py
# class Subroutine(ProgUnit):
#     # Constructor for a subroutine object. Parameter:
#     #
#     # sSubName -- Name of function
#     #
#     def __init__(self, subStatement=None):
#         ProgUnit.__init__(self, subStatement)
# 
# Path: AOR/Function.py
# class Function(ProgUnit):
#     # Constructor for a subroutine object. Parameter:
#     #
#     # sSubName -- Name of function
#     #
#     def __init__(self, FuncStatement):
#         ProgUnit.__init__(self, FuncStatement)
# 
# Path: AOR/Program.py
# class Program(ProgUnit):
#     # Constructor for a program object. Parameter:
#     #
#     # sProgName -- Name of function
#     #
#     def __init__(self, progStatement=None):
#         ProgUnit.__init__(self, progStatement)
# 
# Path: AOR/AttributeString.py
# class AttributeString(str):
#     def __init__(self, s):
#     def sCreateCopy(self, s):
#     def tSplitString(self, n):
#     def SetPrefixAttributes(self,  l) : self.lPrefix = l[:]
#     def SetPostfixAttributes(self, l) : self.lPostfix = l[:]
#     def AppendPrefix(self,  o):
#     def AppendPostfix(self, o):
#     def GetPrefixAttributes(self ): return self.lPrefix
#     def GetPostfixAttributes(self): return self.lPostfix
#     def GetString(self): return str.__str__(self)
#     def upper(self):
#     def lower(self):
#     def capitalize(self):
#     def ToList(self, stylesheet, l): return l.append(self)
#     def __repr__(self):
# 
# Path: Tools/Config.py
# class Config:
#     # Class attribut with all general (i.e. not format specific)
#     # attributes
#     dDefault = { 'stylesheet' : {'labelalignright'      : 1,
#                                  'indent'               : 3,
#                                  'keywordcase'          : 'upper',
#                                  'variablecase'         : 'lower',
#                                  'contlinemarker'       : '&',
#                                  'spacebetweencommalist': 1,
#                                  'format'               : 'fixed',
#                                  'maxcols'              : {'fixed' : 72, 'free' : 132},
#                                  'startcolumn'          : {'fixed' :  7, 'free' :   1},
#                                  },
#                  'files'      : {'amip1sst.F': {'linelength':132},
#                                  'landmask.F': {'linelength':132},
#                                  'sstmskgh.F': {'linelength':132},
#                                  'zevpmx.F'  : {'linelength':132}
#                                  },
#                  'project'    : {'paths'     : [".","whatever/directory"]
#                                  },
#                  }
# 
#     # Special character used to separate entries for dictionary in dict in ...
#     # e.g.: "project|paths" instead of ["project"]["path"]
#     sSeparatorChar = "|"
#     
#     # The actual configuration information (as a class variable)
#     dConfig        = {}
#     # --------------------------------------------------------------------------
#     # Init: save the config filename and read the config file
#     def __init__(self, sConfigFilename="stanrc"):
#         if not Config.dConfig:
#             Config.sConfigFilename=sConfigFilename
#             self.GetConfig()
# 
#     # -------------------------------------------------------------------------
#     def GetConfig(self):
#         # Try reading the config file. If it doesn't exist (or any other
#         # error occurs), get the default values
#         try:
#             f=open(Config.sConfigFilename,'r')
#             l=f.readlines()
#             f.close()
#             s="\n".join(l)
#             Config.dConfig=eval(s)
#         except IOError:
#             Config.dConfig = Config.dDefault.copy()
#             self.WriteConfigFile()
#             
#     # -------------------------------------------------------------------------
#     # Save the config dictionary
#     def WriteConfigFile(self):
#         try:
#             f=open(Config.sConfigFilename,'w')
#         except IOError:
#             print "Couldn't open",Config.sConfigFilename
#             return
#         f.write(`Config.dConfig`)
#         f.write("\n")
#         f.close()
#         
#     # -------------------------------------------------------------------------
#     # Access to the configuration data via a dictionary like interface.
#     # As a shortcut, one can use "|" (see sSeparatorChar) to divide several
#     # nested dictionaries, i.e. ["a|b|c"] instead of ["a"]["b"]["b"]
#     def __getitem__(self, sKey):
#         l = sKey.split(Config.sSeparatorChar)
#         d = Config.dConfig
#         for i in l:
#             d=d.get(i,None)
#             if not d:
#                 return None
#         return d
#     # -------------------------------------------------------------------------
#     # Set configuration data via a dictionary like interface.
#     # As a shortcut, one can use "|" (see sSeparatorChar) to divide several
#     # nested dictionaries, i.e. ["a|b|c"]=1 instead of ["a"]["b"]["b"]=1
#     def __setitem__(self, sKey, value):
#         l = sKey.split(Config.sSeparatorChar)
#         d = Config.dConfig
#         # Follow the tree:
#         for i in range(len(l)-1):
#             d1=d.get(l[i],None)         # goto next dictionary
#             # Create new entry for all remaining entries
#             if not d1:
#                 for j in range(i, len(l)-1):
#                     d[l[j]] = {}
#                     d       = d[l[j]]
#                 d[l[-1]] = value
#                 self.WriteConfigFile()  # save the modified config file
#                 return
#             d=d1
#         d[l[-1]] = value
# 
#         self.WriteConfigFile()          # save the modified config file


# Path: Analyser/Output.py
import string
    import sys
    import getopt
        import profile
from   UserList            import UserList
from   AOR.Subroutine      import Subroutine
from   AOR.Function        import Function
from   AOR.Program         import Program
from   AOR.AttributeString import Comment
from   Tools.Config        import Config
    from Grammar.Parser import Parser
    from AOR.AttributeString import Comment
                from Analyser.Interface import GenerateInterface

#! /usr/bin/env python


# This is the base class for all output functions
class Output(Config):
    # Constructor. Parameter:
    #
    # f -- file object to output
    def __init__(self, f, nMaxCols=72, sFormat='fixed'):
        dClass2Func = { Comment   : self.CommentLine,

                        Subroutine: self.Subroutine,