6.1.1. Construct Global Frame

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]
     7: #line 259 "interscript/src/iscr.pak"
     8: class global_frame:
     9: 
    10:   from interscript.drivers.sinks.bufdisk import named_file_sink
    11:   from interscript.drivers.sinks.disk import simple_named_file_sink
    12:   from interscript.drivers.sinks.null import null_sink
    13: 
    14:   from interscript.drivers.sources.base import eoi, eof
    15:   from interscript.drivers.sources.disk import named_file_source
    16:   from interscript.drivers.sources.url import url_source
    17:   from interscript.drivers.sources.ftp import ftp_file_source
    18:   from interscript.drivers.sources.http import http_file_source
    19: 
    20:   from interscript.weavers.text import plain_text_weaver
    21:   from interscript.weavers.latex import latex_weaver
    22:   from interscript.weavers.html import html_weaver
    23:   from interscript.weavers.raw import raw_weaver
    24:   from interscript.weavers.web import stacking_weaver
    25:   from interscript.weavers.auto import auto_weaver
    26:   from interscript.weavers.filter import markup_filter
    27:   from interscript.weavers.multiplexor import multiplexor
    28: 
    29:   from interscript.parsers.html import sgml_wrapper, html_filter
    30: 
    31:   import sys
    32:   import os
    33:   import string
    34:   import re
    35:   import time
    36:   import commands
    37:   from interscript.core.sets import set
    38:   from interscript.core.stacks import stack
    39:   import interscript.core.protocols
    40:   protocol = interscript.core.protocols
    41:   import getoptions
    42: 
    43:   import __builtin__
    44:   __builtins__ = __builtin__
    45:   del __builtin__
    46: 
    47:   try:
    48:     import thread
    49:     print 'thread available'
    50:   except:
    51:     print 'thread NOT available'
    52: 
    53: 
End python section to interscript/__init__.py[2]