6.1.1. Construct Global Frame

This frame is shared between all processes, and is initialised at module load time. It hooks crucial resources and identification information. The attributes of the global frame class are used as the globals() dictionary for executing user scripts.

[This is probably a bad idea, because it allows the user to change the attributes using the global declaration. On the other hand, it provides a method for sharing between processes.]

For some weird reason, the global frame is a python class, not a module, and not a class instance. It's not a plain module, because python termination is somewhat indeterminate, and it isn't an instance, because there's only ever one of them. Clients of the global frame keep a reference to it explicitly to prevent premature deletion by the python run time on program termination.

The global fram in turn keeps references to a set of important resources, so that they're not deleted prematurely either. I'm doing this because interscript __del__ methods are often used to do substantial work, and it's imperative that system resources are available until all dynamically created objects are destroyed.

Start python section to interscript/__init__.py[2 /3 ] Next Prev First Last
    19: #line 252 "iscr.pak"
    20: class global_frame:
    21: 
    22:   from interscript.drivers.sinks.bufdisk import named_file_sink
    23:   from interscript.drivers.sinks.disk import simple_named_file_sink
    24:   from interscript.drivers.sinks.null import null_sink
    25:   from interscript.drivers.sinks.cache import cache_sink
    26: 
    27:   from interscript.drivers.sources.base import eoi, eof
    28:   from interscript.drivers.sources.disk import named_file_source
    29:   from interscript.drivers.sources.url import url_source
    30:   from interscript.drivers.sources.ftp import ftp_file_source
    31:   from interscript.drivers.sources.http import http_file_source
    32:   from interscript.drivers.sources.cache import cache_source
    33: 
    34:   from interscript.drivers.storage.memory import memory
    35: 
    36:   from interscript.weavers.auto import auto_weaver
    37:   from interscript.weavers.filter import markup_filter
    38:   from interscript.weavers.multiplexor import multiplexor
    39: 
    40:   from interscript.parsers.html import sgml_wrapper, html_filter
    41: 
    42:   from interscript.tanglers.data import data_tangler
    43:   from interscript.tanglers.python import python_tangler
    44:   from interscript.tanglers.null import null_tangler
    45:   from interscript.tanglers.doc import doc_tangler
    46:   import sys
    47:   import os
    48:   import string
    49:   import re
    50:   import time
    51:   from interscript.utilities import commands
    52:   from interscript.core.sets import set
    53:   from interscript.core.stacks import stack
    54:   import interscript.core.protocols
    55:   protocol = interscript.core.protocols
    56:   import getoptions
    57: 
    58:   import __builtin__
    59:   __builtins__ = __builtin__
    60:   del __builtin__
    61: 
    62:   try:
    63:     import thread
    64:     #print 'thread available'
    65:   except:
    66:     #print 'thread NOT available'
    67:     pass
    68: 
End python section to interscript/__init__.py[2]