# Path: k_os/OIL/Error.py
# class OILError(object):
#     inst=None
# 
#     def __new__(cls):
#         if cls.inst is None:
#             # Make it a Singleton.
#             cls.inst=super(OILError,cls).__new__(cls)
#             cls.fatalErrorCounter=0
#             cls.errorCounter=0
#             cls.warningCounter=0
#             cls.informationCounter=0
# 
#             cls.loggerMessageonly=createLogger(logging.NOTSET,"kos.oil.logger.messageonly",
#                 "[%(levelname)s] - %(message)s"
#             )
#             cls.loggerFilename=createLogger(logging.NOTSET,"kos.oil.logger.filename",
#                 "[%(levelname)s]:%(fname)s - %(message)s"
#             )
#             cls.loggerFull=createLogger(logging.NOTSET,"kos.oil.logger.full",
#                  "[%(levelname)s]:%(fname)s:%(lno)s - %(message)s"
#             )
#         return cls.inst
# 
#     def logMessage(self,level,message,lineno=None,filename=None,code=None):
#         if lineno and filename:
#             self.loggerFull.log(level,message,extra={'lno': lineno,'fname': filename})
#         elif filename:
#             self.loggerFilename.log(level,message,extra={'fname': filename})
#         else:
#             self.loggerMessageonly.log(level,message)
# 
# 
#     def fatalError(self,message,lineno=None,filename=None,code=''):
#         self.logMessage(logging.CRITICAL,message,lineno,filename,"F-"+code)
#         self.fatalErrorCounter+=1
#         sys.exit(1)
# 
#     def error(self,message,lineno=None,filename=None,code=''):
#         self.logMessage(logging.ERROR,message,lineno,filename,"E-"+code)
#         self.errorCounter+=1
# 
#     def warning(self,message,lineno=None,filename=None,code=''):
#         self.logMessage(logging.WARNING,message,lineno,filename,"W-"+code)
#         self.warningCounter+=1
# 
#     def information(self,message,lineno=None,filename=None,code=''):
#         self.logMessage(logging.INFO,message,lineno,filename,"I-"+code)
#         self.informationCounter+=1


from collections import namedtuple
from optparse import OptionParser, OptionGroup
from k_os.OIL.Error import OILError
import logging
import os
import sys
import k_os.OIL.GenCfg
import k_os.OIL.Parser
import k_os.OIL.Preproc
        metavar = 'dir',
        help = """Add directory to the list of directories to be searched for include files.
        Environment-Variable 'KOS_INCLUDE' is also used to locate Include-Files."""
        )
    op.add_option_group(input_group)

    group = OptionGroup(op, 'Output')
    group.add_option('-o', '--orti', help = 'generate orti-FILE', dest = 'orti', action = 'store_true', default = False)
    group.add_option('-r', '--resource-usage', help = 'generate resource statistics', dest = 'res_usage',
        action = 'store_true', default = False)
    group.add_option('-t', '--test', help = "verify only, don't generate anything", dest = 'test',
        action = 'store_true', default = False)
    group.add_option('-V', '--verbose', help = 'print Information messages', dest = 'verbose',
        action = 'store_true', default = False)
    group.add_option('-S', '--silent', help = "don't print any messages.", dest = 'silent', action = 'store_true',
        default = False)

## keep immediate file.
    op.add_option_group(group)

    (options, args) = op.parse_args()

    SetIncludePaths(options.inc_path)

    if len(args) == 0:
        op.error('no input file')

    if len(args) != 1:
        op.error('incorrect number of arguments')


# Path: k_os/OIL/Error.py
# class OILError(object):
#     inst=None
# 
#     def __new__(cls):
#         if cls.inst is None:
#             # Make it a Singleton.
#             cls.inst=super(OILError,cls).__new__(cls)
#             cls.fatalErrorCounter=0
#             cls.errorCounter=0
#             cls.warningCounter=0
#             cls.informationCounter=0
# 
#             cls.loggerMessageonly=createLogger(logging.NOTSET,"kos.oil.logger.messageonly",
#                 "[%(levelname)s] - %(message)s"
#             )
#             cls.loggerFilename=createLogger(logging.NOTSET,"kos.oil.logger.filename",
#                 "[%(levelname)s]:%(fname)s - %(message)s"
#             )
#             cls.loggerFull=createLogger(logging.NOTSET,"kos.oil.logger.full",
#                  "[%(levelname)s]:%(fname)s:%(lno)s - %(message)s"
#             )
#         return cls.inst
# 
#     def logMessage(self,level,message,lineno=None,filename=None,code=None):
#         if lineno and filename:
#             self.loggerFull.log(level,message,extra={'lno': lineno,'fname': filename})
#         elif filename:
#             self.loggerFilename.log(level,message,extra={'fname': filename})
#         else:
#             self.loggerMessageonly.log(level,message)
# 
# 
#     def fatalError(self,message,lineno=None,filename=None,code=''):
#         self.logMessage(logging.CRITICAL,message,lineno,filename,"F-"+code)
#         self.fatalErrorCounter+=1
#         sys.exit(1)
# 
#     def error(self,message,lineno=None,filename=None,code=''):
#         self.logMessage(logging.ERROR,message,lineno,filename,"E-"+code)
#         self.errorCounter+=1
# 
#     def warning(self,message,lineno=None,filename=None,code=''):
#         self.logMessage(logging.WARNING,message,lineno,filename,"W-"+code)
#         self.warningCounter+=1
# 
#     def information(self,message,lineno=None,filename=None,code=''):
#         self.logMessage(logging.INFO,message,lineno,filename,"I-"+code)
#         self.informationCounter+=1


# Path: k_os/OIL/kosgen.py
from collections import namedtuple
from optparse import OptionParser, OptionGroup
from k_os.OIL.Error import OILError
import logging
import os
import sys
import k_os.OIL.GenCfg
import k_os.OIL.Parser
import k_os.OIL.Preproc

        metavar = 'dir',
        help = """Add directory to the list of directories to be searched for include files.
        Environment-Variable 'KOS_INCLUDE' is also used to locate Include-Files."""
        )
    op.add_option_group(input_group)

    group = OptionGroup(op, 'Output')
    group.add_option('-o', '--orti', help = 'generate orti-FILE', dest = 'orti', action = 'store_true', default = False)
    group.add_option('-r', '--resource-usage', help = 'generate resource statistics', dest = 'res_usage',
        action = 'store_true', default = False)
    group.add_option('-t', '--test', help = "verify only, don't generate anything", dest = 'test',
        action = 'store_true', default = False)
    group.add_option('-V', '--verbose', help = 'print Information messages', dest = 'verbose',
        action = 'store_true', default = False)
    group.add_option('-S', '--silent', help = "don't print any messages.", dest = 'silent', action = 'store_true',
        default = False)

## keep immediate file.
    op.add_option_group(group)

    (options, args) = op.parse_args()

    SetIncludePaths(options.inc_path)

    if len(args) == 0:
        op.error('no input file')

    if len(args) != 1:
        op.error('incorrect number of arguments')


    error = OILError()