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 Last
     3: #line 268 "iscr.pak"
     4: class global_frame:
     5: 
     6:   from interscript.drivers.sinks.bufdisk import named_file_sink
     7:   from interscript.drivers.sinks.disk import simple_named_file_sink
     8:   from interscript.drivers.sinks.null import null_sink
     9:   from interscript.drivers.sinks.cache import cache_sink
    10: 
    11:   from interscript.drivers.sources.base import eoi, eof
    12:   from interscript.drivers.sources.disk import named_file_source
    13:   from interscript.drivers.sources.url import url_source
    14:   from interscript.drivers.sources.ftp import ftp_file_source
    15:   from interscript.drivers.sources.http import http_file_source
    16:   from interscript.drivers.sources.cache import cache_source
    17: 
    18:   from interscript.drivers.storage.memory import memory
    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:   from interscript.tanglers.c import c_tangler
    32:   from interscript.tanglers.cpp import cpp_tangler
    33:   from interscript.tanglers.java import java_tangler
    34:   from interscript.tanglers.perl import perl_tangler
    35:   from interscript.tanglers.data import data_tangler
    36:   from interscript.tanglers.python import python_tangler
    37:   from interscript.tanglers.null import null_tangler
    38:   from interscript.tanglers.doc import doc_tangler
    39:   from interscript.tanglers.tcl import tcl_tangler
    40: 
    41:   import sys
    42:   import os
    43:   import string
    44:   import re
    45:   import time
    46:   from interscript.utilities import commands
    47:   from interscript.core.sets import set
    48:   from interscript.core.stacks import stack
    49:   import interscript.core.protocols
    50:   protocol = interscript.core.protocols
    51:   import getoptions
    52: 
    53:   import __builtin__
    54:   __builtins__ = __builtin__
    55:   del __builtin__
    56: 
    57:   try:
    58:     import thread
    59:     #print 'thread available'
    60:   except:
    61:     #print 'thread NOT available'
    62:     pass
    63: 
End python section to interscript/__init__.py[2]