Recent Changes - Search:

WikiDoc

Categories

Alpha family startup sequence

Alpha7, Alpha8, [[Software/AlphaX | AlphaX]], Alphatk create certain commands, initialise certain variables and source a variety of .tcl files when the editor first starts up.

This page document hows that startup sequence functions, and how it needs to be structured and formalised to clean things up a bit (and deal with certain issues like encodings which can otherwise be problematic).


Startup

Alpha 8/X/tk currently have a three-stage startup sequence:

1. Internal variable setting, etc.

Sets alpha::defaultEncoding (macRoman or ISOmacRoman)

Sets alpha::platform (to 'tk' or 'alpha').

Sets HOME

Checks if AlphaTcl is in an archive (.zip or scripted doc) and mounts it (Alphatk only)

Create [alert] or [alertnote] command. (Alpha8 currently also creates the [buttonAlert] command for legacy reasons.)

Sources SystemCode/Init/initialize.tcl

Creates most Alpha Commands (*)

2. Calls [alpha::PreGuiStartup]

See Startup Pregui Stage

Makes the status bar, and any other permanent gui components.

3. Calls [alpha::Startup], which has two effective phases:

3.1 rebuild package and tcl indices if needed (where, in case no tclIndices exist, we manually source 7 files first).

See Package Rebuild Stage?

3.2 start loading packages etc (early packages first, then prefs, then rest of packages, menus etc)

(*) What we need to address is exactly which Alpha Commands are critical at this stage, and which commands could possibly be postponed until after alpha::PreGuiStartup is called. This should also help us to split part of AlphaTcl's core into a pre-gui directory (and anything in that directory can only call the critical commands).


Timing AlphaTcl Initialization

AlphaTcl 8.0 and higher Source contains support for timing arbitrary actions performed in AlphaTcl. This is enabled by the [alpha::recordTimingData] command, which takes a single "note" argument. Whenever this is called, the current time (as determined by [clock] and measured in milliseconds) is added to a "Timing Database". Whenever a file is sourced (via [source] or auto_loading mechanisms) this event is always recorded in the Timing Database.

The AlphaDev Menu > Alpha Testing submenu now includes three new items

  • Display Timing Data
  • Flush Timing Data
  • Time AlphaTcl Proc

which provide a UI to this internal Timing Database cache. By default, all of the major steps in the initialization are recorded, so the first time that the "Display Timing Data" menu item is selected all of this timing information is reformatted and presented in a new window. This should help developers optimize and re-organize the startup sequence by providing a "bird's eye view" of everything that is taking place, especially when particular SystemCode files are being sourced.


Which files should go where? Edit and add comments below as you see fit!


SystemCode/Init/initialize.tcl

PreGui:

SystemCode/PreGui/alphaVersionInfo.tcl -- put this in the toplevel? The first time it is needed is either when the splash screen is put up, or when the decision is made to rebuild package indices. Currently it is loaded a the PreGui stage.

SystemCode/PreGui/initAlphaTcl.tcl -- as the start of the PreGui stage, this should go here.

SystemCode/initTcl.tcl -- code to set up 'unknown', and various other 'tcl-index' related items. Also contains some Alpha 7 stuff (unbind, etc, which we ought to move elsewhere). This file must be manually sourced, since it contains 'unknown'. This means it should probably go in PreGui, since I think we want all subsequent phases to use the tclIndices.

SystemCode/PreGui/library.tcl -- contains basic package index rebuilding and newPref functionality, and 'alphaOpen' and 'source'. Pretty sure this is for PreGui.

SystemCode/PreGui/coreFixes.tcl -- loaded very early at present, and it would be very confusing if commands were only fixed half way through startup. So, this should be PreGui, unless, of course, many of the commands are not yet defined! So, this might need to be split into two pieces.

SystemCode/PreGui/prefsHandling.tcl -- since we load the early prefs PreGui, this has to be part of the PreGui phase.


Main startup:

SystemCode/AlphaBits.tcl -- could perhaps end of ignoring it completely in Alpha 8/X/tk?, since it was only ever needed for Alpha 7.

SystemCode/alphaDefinitions.tcl


Loaded as needed:

SystemCode/CorePackages/modeCreationAssistant.tcl

SystemCode/CorePackages/reportABug.tcl

SystemCode/CorePackages/setupWizard.tcl

SystemCode/CorePackages/superSearch.tcl


Uncategorized as yet:

SystemCode/alphaCommands.tcl

SystemCode/alphaHooks.tcl

SystemCode/alphaMenus.tcl

SystemCode/appleEvents.tcl

SystemCode/BackCompatibility.tcl

SystemCode/clickUtils.tcl

SystemCode/dialogs.tcl

SystemCode/dialogsNew.tcl

SystemCode/dialogsUtils.tcl

SystemCode/indentation.tcl

SystemCode/marks.tcl

SystemCode/menus.tcl

SystemCode/menusAndKeys.tcl

SystemCode/modes.tcl

SystemCode/package.tcl

SystemCode/rebuildAlphaTcl.tcl

SystemCode/runAlphaTcl.tcl

SystemCode/search.tcl

SystemCode/stringsLists.tcl

SystemCode/templates.tcl

SystemCode/textFill.tcl

SystemCode/textManip.tcl

SystemCode/vcsCore.tcl

SystemCode/win.tcl

SystemCode/CorePackages/aeom.tcl

SystemCode/CorePackages/appPaths.tcl

SystemCode/CorePackages/cache.tcl -- this is an example of a core package which is needed very early in startup, and is quite different to, say, setupWizard.tcl which AlphaTcl could function nicely without.

SystemCode/CorePackages/comments.tcl

SystemCode/CorePackages/completions.tcl

SystemCode/CorePackages/contextualMenu.tcl

SystemCode/CorePackages/error.tcl

SystemCode/CorePackages/fileManipulation.tcl

SystemCode/CorePackages/filesets.tcl

SystemCode/CorePackages/filesetsCoreTypes.tcl

SystemCode/CorePackages/filesetsUtils.tcl

SystemCode/CorePackages/functions.tcl

SystemCode/CorePackages/help.tcl

SystemCode/CorePackages/hook.tcl

SystemCode/CorePackages/htmlUtilities.tcl

SystemCode/CorePackages/install.tcl

SystemCode/CorePackages/interactiveSearch.tcl

SystemCode/CorePackages/internationalMenus.tcl

SystemCode/CorePackages/isIn.tcl

SystemCode/CorePackages/ISOTime.tcl

SystemCode/CorePackages/markStack.tcl

SystemCode/CorePackages/oldClock.tcl

SystemCode/CorePackages/openWindowsMenu.tcl

SystemCode/CorePackages/oserrors.tcl

SystemCode/CorePackages/paragraphs.tcl

SystemCode/CorePackages/positions.tcl

SystemCode/CorePackages/procUtils.tcl

SystemCode/CorePackages/prompts.tcl

SystemCode/CorePackages/quotingStrings.tcl

SystemCode/CorePackages/tags.tcl

SystemCode/CorePackages/temp.tcl

SystemCode/CorePackages/unix.tcl

SystemCode/CorePackages/windows.tcl

SystemCode/CorePackages/windowsMenuFixes.tcl

SystemCode/CorePackages/www.tcl


Miscellaneous comments:

(cbu 23Jan04) It seems like the existence of alpha::packageRequirementsFailed is checked a few different times in the SystemCode. Couldn't we just include

 
    if {![info exists alpha::packageRequirementsFailed]} {
        set alpha::packageRequirementsFailed list
    }

somewhere early in the startup sequence? It is saved in earlydefs.tcl, and the saved value should then over-write this empty list when necessary. This would just help simplify some of the code later.

(cbu 23Jan04) The proc [alpha::findAllPlugins] and some of its friends are in the modes.tcl file. Since these are called in runAlphaTcl.tcl, shouldn't they be placed in a more obvious init file?


Alpha7 Historical Notes

Alpha7's startup sequence cannot be modified appreciably, since the application itself is considered basically unchangeable. Alpha 7's startup sequence is simply to create all "Alpha Commands", set the HOME and PREFS variables and source SystemCode/AlphaBits.tcl. Any unhandled error encountered during sourcing AlphaBits will give the user a message and exit the application. Also if the results of sourcing do not create the 'file' menu, Alpha7 will also quit (i.e. Alpha7 defines an successful startup as one which doesn't throw an error and manages to create the file menu).


Category.Development

Page last modified on August 08, 2006, at 05:22 PM
Hosted on SourceForge.net Logo