
In this file, you will find all the global variables used in Getleft.


As usual, this file is Copyright 1999-2000 Andrs Garca and its contents are
distributed under the terms of the GPL, which means, among other things, that it
comes with no warranty, if the contents of this file blow up your computer killing
some passersby, it will be your sole fault.

directories:
    Array with data about the local directories Getleft uses.
        - directories(local): directory of the file Getleft is processing.
        - directories(base): directory where you told Getleft to store the
          download.

dirGetleft:
    Array containing the different directories Getleft is in.
        - dirGetleft(main): directory where 'Getleft.tcl' is in.
        - dirGetleft(scripts): where the scripts like 'Ayuda.tcl' are in.
        - dirGetleft(doc): where the documentation is.
        - dirGetleft(images): for the images (GIFs & Co) of the program.
        - dirGetleft(languages): for the translations of Getleft.
        - dirGetleft(conf): where the logs and such are kept.
        - dirGetleft(lastDir): where the last downloaded site was saved.

done and done2:
    They are not real global variables, I use them in some dialogs so they can
    grab focus until the value of 'done' changes.

    I need 'done2' beacuse in the 'Choose Files' dialog you can access another
    dialog to choose which file extensions to filter, if both dialogs used the
    same variable, dismissing one would also dismiss the other.

errorCode:
    Global variable where Tcl puts error info.

getleftState:
    Array with information about Getleft present state:
        - encoding: charset enconding of the first page downloaded.
        - getleftState(filesChosen): '1' if the user has already chosen which
          links to download.
	    - getleftState(downloading): '1' if Getleft is downloading a site.
        - getleftState(errorFound):  '1' if there was any error during the
          download.

env:
    Global variable in which Tcl keeps the enviromental variables.

filesDone:
    Array where Getleft stores which files have already been processed for
    links. The key is the full name of the file, the value always '1', in
    fact Getleft only checks if the key exists, so that it won't process
    the same file twice. For example:
        set filesDone(/home/Andres/download/index.html) 1

indexMenus:
    Array, the key of each element is the label of a menu, the content is the
    index of the character of the label that should appear underwriten.

labelButtons
    Array with the labels for the buttons in the language chosen by the user.

labelDialogs:
    Array with the labels of the dialogs in the language chosen by the user.

labelMenus:
    Array with the label of the menus in the language chosen by the user.

labelMessages:
    Array with the messages in the language chosen by the user.

labelMonths:
    Array with the names of the months in the language chosen by the user.

labelTitles:
    Array with the titles of the windows in the language chosen by the user.

linksOk:
    Array that keeps which files have to be downloaded in the first page. So
    if, for example, linksOk(2)==1, the second link will be downloaded.

menus:
    Array with the path of the menus.

options:
    Array that keeps the user options, most are boolean variables.
        - options(cgi): Whether to follow link to cgi pages.
        - options(checkSize): '1' if Getleft should check the size of the downloaded files.
          In theory you always want to check, but some servers reportin wrong sizes.
        - options(dir): If '1' Getleft will download files that are above the first one
                        in the directory structure of the remote site.
        - options(dirProxy): Address and port of the proxy to use.
        - options(filter): The filter used to decide which files to download.
        - options(lang): Code of the language Getleft is using.
        - options(levels): number of levels Getleft will recursively download.
        - options(map): If '1' Getleft will do a map of the site.
        - options(onlyHtml): Whether we are only downloading html pages.
        - options(pauseFile): If '1' downloading will pause after the current file.
        - options(pausePage): If '1' downloading will stop after getting all links in
          the current page.
        - options(proxy): '1' if Getleft should use a proxy.
        - options(stopPage): If '1' downloading will stop after the current page.
        - options(stopFile): If '1' downloading will stop after the current file.
        - options(update): Whether the downloading is updating a former one.

optionsTmp:
    It is used in the 'Choose file' dialog to keep the 'dir' option, so
    that we can check if the user changes them.

relocated:
    In case Getleft finds a file that has been relocated, it will put all necessary
    info in this array.
        - relocated(ok): '1' if there has been a relocation.
        - relocated(url): The new file, including path, to download.

siteUrl:
    Array with information about the remote site of the url entered by the user.
        - SiteUrl(prot): Protocol of the site.
        - SiteUrl(www): Name of the site, e.g, www.scriptics.com
        - SiteUrl(dir): Directory that holds the file, e.g, /pub. The root directory
                        is represented by an empty string.
        - SiteUrl(base): Directory of the file you entered.

siteIndex:
    In case we ask Getleft to get the map of the site, when it's done, siteIndex
    is the number of links of the site plus one.

siteMap:
    Array with the map of the site, it has a row for every link, the columns:
        - '0': levels Getleft descended to find that link.
        - '1': link.
        - '2': description of the link.
        - siteMap(link) is set to '1' so that we only get every file once.

supportedLang:
    Array with the languages Getleft supports. It keeps the name of
    the language, the two-letter code to idenify it, and the encoding
    requiered for its font. For example, for English we have:
        - supportedLang(English) == en
        - supportedLang(en) == iso8859-1

tcl_platform
    Array in which Tcl keeps the platform it is running in.

urlIndex:
    The last Urls entered are keep in the list 'urlHistory', this variable
    keeps the index in which the next url will be entered.

urlHistory:
    List with the last urls entered.

From now on you will find the variables used in namespaces

In case you are wondering:
    - Ayuda == Help
    - Ccombinado == Cuadro combinado == combobox
    - Dialogos == Dialogs
    - Herramientas == Tools
    - Ventana == Window
    - Rizo == Curl

Namespace Ayuda

None yet

Namespace Herramientas

This variables where defined as global in the namespace scope so I could use them
in 'bind' events

-ip:
    Every element of this array contains the path to one of the entries in which
    you put the network address and port of the proxy.

-n:
    In the events of the proxy configuration dialog, 'n' represents the next entry.

Namespace Ventana

-afterId
    Keeps the handle of the event which updates the progress bar.

-file
    File name and path in the local computer of the link being downloaded.

-labelWidth:
    Array with the approximate length of the fields to put the site, directory and
    filename in the downloading window. This is a kludge I have been meaning to
    fix for some time.

-link:
    Link being downloaded.

-mother
    Referer page of the link.

-window
    Array with the paths of the elements of the downloading window:
        - window(top): The toplevel path.
        - window(url): Label with the site domain name.
        - window(dir): Label with the directory of the file in the remote site.
        - window(file): Label with the name file.
        - window(left): Label where the time left of downloding.
        - window(bar1): The first canvas of the progress bar, the one with white background.
        - window(bar2): And the one with the blue background.

-uno,dos:
    Path of the text in the progress bar, 'uno' in black and 'dos' in white.

Namespace Rizo

-curlError
    In case 'curl' returns an error, this variable will have the error code.

-curlReport:
    Array that keeps some information about the download being done by curl:
        -curlReport(end): curl has finished downloading the link.
        -curlReport(gotBytes): the number of bytes curl has already downloaded from the
         current link.
        -curlReport(long): curl has to ways of giving information to the user, the
         'long' one and the 'short' one, this variable is '1' if the long one is
         being used for the current download.
        -curlReport(left): In the long reports, curl estimates how much time of downloading
         is left, this time is kept in this variable.
        -curlReport(nextFile): The contents of this variable are incremented, when
         Getleft can start downloading a new link. It is used in a 'tkwait' statement.
        -curlReport(pause): '1' while the user asks for the downloading to be paused.
        -curlReport(percentage): Percentage of the file downloaded.
        -curlReport(speed): The speed of the downloading.
        -curlReport(stop): '1' if the user wants to stop the downloading.

-leftIndex and speedIndex
    On version 6.4 curl changed the format of its report, this variables hold the place
    in that report of the time left and the current speed.

-meta:
    Array with the headers of the requested link:
        -meta(code): Error code return by the server.
        -meta(content): MIME type of the link, for example "text/html"
        -meta(error): Error message returned by the server.
        -meta(lastModified): Date of the last time the linked file was modified. Unfortunately,
         some servers don't return this info with the headers.
        -meta(relocate): '1' if the headers say that the link has been relocated.
        -meta(totalBytes): Size of the link
        -meta(versionServer): version of http used by the server.

-pipe:
    Handle of the pipe used to write the file.

-workaround
    Some servers return the body of a link when serving a 'HEAD' request, this variable is used
    to close the pipe used by 'curl', so that we don't have to wait till the full link has arrived.

    The lastest versions of 'curl' make this obsolete but, as I don't know which version you are
    using, I will keep it around for some time.


Namespace Dialogos

This namespace takes care of the dialog used to choose a directory. It is adapted from a example
found in 'Practical Programming in Tcl/Tk' by Brent Welch (http://www.beedub.com), I made most
of the changes to it a few years ago, when I knew even less about Tcl than I know now, so please,
don't blame Mr Welch for whatever you find there.

- fileselect
    Array with information about the elements of the dialog window.
        -fileselect(dir): Current directory.
        -fileselect(dirEnt): Path of the entry widget in which the current directory is shown.
        -fileselect(done): This is used as a marker in a tkwait statement, if it equals '1'
         the user has entered something, if it equals '0' the user has canceled the action.
        -fileselect(path): Path entered by the user.
        -fileselect(pathEnt): Path of the entry where the user can write the chosen directory.

Namespace Ccombinado

The combobox widget is defined here.

- cbArgs
    Array with the parameters passed to the widget:
        -cbArgs(-default): Whatever will appear in the entry when the combobox is mapped
        -cbArgs(-erasable): '1' if the user can delete items from the list, '0' if he can't.
        -cbArgs(-width): Width of the entry in characters.
        -cbArgs(items): List with the items, the one you should check if you allow the user to
         delete things. it seems that Tcl/Tk 8.3 will have a variable for this in the ListBox
         widget but, for the time being, we will have to keep it.

Namespace HtmlParser

- entities: array with the mapping of the Html character entities, for example:
        'entities(lt)==>'

- pageEncoding:
    if the page includes the encoding used in a meta tag, this variable will have it,
    otherwise, if will have an empty string.

- linkDescription:
    Array that contains the description of the links in the last processed page.
    Indexes begin at '1'.

- linkFile:
    Array that contains the links in the last page processed. Indexes begin
    at '1'.

- nFilterLinks:
    Number of links plus one after they have been filtered.

- nLinks:
    Number of links plus one found in the last page processed.


    So if you want to use it, you need something like:

    for {set i 1} {$i<$nLinks} {incr i} {}
