view pyink/extensions.py @ 1415:f34d2fcbcd0d

Revert changeset #88c8c874f4b8. #88c8c874f4b8 try to fix crashing, but it blame to wrong code. If you look into runtime stack of xnjsmb_coord_remove(), you will find self argument is already wrong. It is in an invalid address.
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 06 Apr 2011 15:13:09 +0800
parents 2d56ed5b0995
children
line wrap: on
line source

import pybExtension
import html5css3, mbbbox

_all_extensions = [html5css3.extension, mbbbox.extension]

_DEBUG_FLAG_NAME = 'PYINK_EXT_DBG_ENABLE'

def _reg_extensions():
    import os

    if os.environ.has_key(_DEBUG_FLAG_NAME):
        debug_level = int(os.environ[_DEBUG_FLAG_NAME])
    else:
        debug_level = 0
        pass
    
    if debug_level > 0:
        print 'Loading extensions'
        pass
    
    for ext_imp, ext_id, ext_name, ioe_name, ioe_items in _all_extensions:
        if debug_level > 0:
            print '    register %s -- %s' % (ext_id, ext_name)
            pass
        
        #
        # ioe_items is description items for input, output, and effect.
        #
        if ioe_name not in ('input', 'output', 'effect'):
            raise ValueError, 'invalid extension type (%s)' % (ioe_name)
        
        kws = {ioe_name: ioe_items}
        pybExtension.register_extension(ext_imp, ext_id, ext_name, **kws)
        pass
    pass

def initial():
    _reg_extensions()
    pass