Check-in [91eaf123c4]

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More formatting fixes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 91eaf123c45aab17be3eb43a3231df1e6a2556b7b366ca074b9e5ea293902c93
User & Date: dkf 2019-02-19 10:40:39
Context
2019-02-20
13:29
CFV for 527 by KBK check-in: b1a11fd5c7 user: dkf tags: trunk
2019-02-19
10:40
More formatting fixes check-in: 91eaf123c4 user: dkf tags: trunk
10:21
Formatting fix check-in: acc664dc37 user: dkf tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tip/430.md.

    51     51   # Specification
    52     52   
    53     53   There shall be new ensemble **zipfs** added to tcl. That ensemble will
    54     54   contain several commands including:
    55     55   
    56     56    * **zipfs canonical** _filename_
    57     57   
    58         -      > Returns the a string representing where _filename_ would be located
    59         -      > within zipfs.
           58  +    Returns the a string representing where _filename_ would be located
           59  +    within zipfs.
    60     60   
    61     61    * **zipfs exists** _filename_
    62     62   
    63         -      > Returns true if a file exists in zipfs. Unlike _file exists_
    64         -      > this command is safe to run in a safe interp, because it confers
    65         -      > no access to the local file system.
           63  +    Returns true if a file exists in zipfs. Unlike _file exists_
           64  +    this command is safe to run in a safe interp, because it confers
           65  +    no access to the local file system.
    66     66   
    67     67    * **zipfs mount** ?_archive_? ?_mountpoint_?
    68     68   
    69         -     > Mounts the ZIP file _archive_ at the location given by _mountpoint_,
    70         -     > which will default to **zipfs:/_archive_** if absent. With no arguments
    71         -     > this command describes all current mounts, returning a list of pairs.
           69  +    Mounts the ZIP file _archive_ at the location given by _mountpoint_,
           70  +    which will default to **zipfs:/_archive_** if absent. With no arguments
           71  +    this command describes all current mounts, returning a list of pairs.
    72     72   
    73     73    * **zipfs root**
    74     74   
    75         -     > Return the root mount point for Zipfs file systems. On windows this returns **zipfs:/**.
    76         -     > On all other platforms this returns **//zipfs:/**
    77         -
           75  +    Return the root mount point for Zipfs file systems. On windows this returns **zipfs:/**.
           76  +    On all other platforms this returns **//zipfs:/**
    78     77   
    79     78    * **zipfs tcl_library**
    80     79   
    81         -     > Search the current executable, the tcl dynamic library, and the local file system
    82         -     > for a zipfs file system containing Tcl's init.tcl file. Returns null if none was found.
           80  +    Search the current executable, the tcl dynamic library, and the local file system
           81  +    for a zipfs file system containing Tcl's init.tcl file. Returns null if none was found.
    83     82   
    84     83    * **zipfs unmount** _archive_
    85     84   
    86         -     > Unmounts the ZIP file _archive_, which must have been previously mounted.
           85  +    Unmounts the ZIP file _archive_, which must have been previously mounted.
    87     86   
    88     87   Outside of a save interpreter, the following additional commands will be available:
    89     88   
    90     89    * **zipfs lmkimg** _outfile_ _inlist_ ?strip? ?_password_? ?infile?
    91     90   
    92         -     > Generate a zip archive (_outfile_) from a list of files (_inlist_),
    93         -     > as a self extracting executable appended to a bare executable (_infile_).
    94         -     >
    95         -     > If _strip_ is given, that string will be removed from the front of all files
    96         -     > before generating their names within the archive.
    97         -     >
    98         -     > If _password_ is given, the file will be encrypted with that passphrase
           91  +    Generate a zip archive (_outfile_) from a list of files (_inlist_),
           92  +    as a self extracting executable appended to a bare executable (_infile_).
           93  +
           94  +    If _strip_ is given, that string will be removed from the front of all files
           95  +    before generating their names within the archive.
           96  +
           97  +    If _password_ is given, the file will be encrypted with that passphrase
    99     98   
   100     99    * **zipfs lmkzip** _outfile_ _inlist_ ?strip? ?_password_?
   101    100   
   102         -     > Generate a zip archive (_outfile_) from a list of files (_inlist_).
          101  +    Generate a zip archive (_outfile_) from a list of files (_inlist_).
   103    102   
   104    103    * **zipfs mkzip** _outfile_ _indir_ ?strip? ?_password_?
   105    104   
   106         -     > Generate a zip archive (_outfile_) from the contents of a directory (_indir_)
          105  +    Generate a zip archive (_outfile_) from the contents of a directory (_indir_)
   107    106   
   108    107    * **zipfs mkimg** _outfile_ _indir_ ?strip? ?_password_? ?infile?
   109    108   
   110         -     > Generate a zip archive (_outfile_) from the contents of a directory (_indir_),
   111         -     > as a self extracting executable appended to a bare executable (_infile_).
   112         -
          109  +    Generate a zip archive (_outfile_) from the contents of a directory (_indir_),
          110  +    as a self extracting executable appended to a bare executable (_infile_).
   113    111   
   114    112   ## VFS Mount Point
   115    113   
   116    114   On virtually all platforms tcl supports (Unix, Windows) ZipFs will mount all archives
   117    115   under *//zipfs:/*. Some operating systems (past or future) may have a special meaning
   118    116   for this style path. To that end, it may be changed to address the needs of the
   119    117   specific environment. Which root is being used for
................................................................................
   137    135   ## Generating Task Executables Tclsh/Wish
   138    136   
   139    137   If tclsh/wish detect that the executable has a zip archive attached, the executable will be
   140    138   mounted as **ZIPFS\_ROOT**_/app_. If **ZIPFS\_ROOT**_/app/main.tcl_ exists, that file is marked
   141    139   set the shell's startup script. If **ZIPFS\_ROOT**_/app/tcl\_library/_ exists, it will be
   142    140   searched for init.tcl.
   143    141   
   144         -The way to produce an executable will be as follows (Assuming the source for the application
   145         -is at ~/myapp/src:
          142  +The way to produce an executable will be as follows (assuming the source for the application
          143  +is at `~/myapp/src`):
   146    144   
   147    145   From Tcl:
   148    146   
   149         -    > zipfs mkimg ~/bin/myapp.exe ~/myapp/src ~/myapp/src ~/bin/tclsh87.exe
          147  +    zipfs mkimg ~/bin/myapp.exe ~/myapp/src ~/myapp/src ~/bin/tclsh87.exe
   150    148   
   151    149   From Unix:
   152    150   
   153         -    > cd ~/myapp/src
   154         -    > zip -r ~/myapp.zip .
   155         -    > cd ..
   156         -    > cp ~/bin/tclsh87.exe myapp.exe
   157         -    > cat myapp.zip >> myapp.exe
          151  +    cd ~/myapp/src
          152  +    zip -r ~/myapp.zip .
          153  +    cd ..
          154  +    cp ~/bin/tclsh87.exe myapp.exe
          155  +    cat myapp.zip >> myapp.exe
   158    156   
   159    157   ## First argument handling for Tclsh/Wish
   160    158   
   161    159   If the first argument to Tclsh or Wish is detected to be a zipfile, that file will be
   162         -mounted as **ZIPFS\_ROOT*_/app_. If **ZIPFS\_ROOT**_/app/main.tcl_ exists, that file is marked
          160  +mounted as **ZIPFS\_ROOT**_/app_. If **ZIPFS\_ROOT**_/app/main.tcl_ exists, that file is marked
   163    161   set the shell's startup script. If **ZIPFS\_ROOT**_/app/tcl\_library_ exists, it will be
   164         -searched for init.tcl.
          162  +searched for _init.tcl_.
   165    163   
   166    164   ## New Tclsh features for TEA
   167    165   
   168    166   To assist in packaging extensions, **tclsh** will take on a new command _install_. If
   169    167   _install_ is the first argument, set subsequent arguments are passed to a new file
   170    168   in library **install.tcl**.
   171    169   
   172    170   **tclsh install** with no arguments is designed to return immediately with a normal return code,
   173         -thus making it easy to test if a tclsh is tip430 Savvy but running in autoconf:
          171  +thus making it easy to test if a tclsh is tip430 savvy but running in autoconf:
   174    172   
   175         -    > AS_IF([$TCLSH_PROG install],[
   176         -    >  ZIP_PROG=${TCLSH_PROG}
   177         -    >  ZIP_PROG_OPTIONS="install mkzip"
   178         -    >  ZIP_PROG_VFSSEARCH="."
   179         -    >  AC_MSG_RESULT([Can use Native Tclsh for Zip encoding])
   180         -    > ])
          173  +    AS_IF([$TCLSH_PROG install],[
          174  +        ZIP_PROG=${TCLSH_PROG}
          175  +        ZIP_PROG_OPTIONS="install mkzip"
          176  +        ZIP_PROG_VFSSEARCH="."
          177  +        AC_MSG_RESULT([Can use Native Tclsh for Zip encoding])
          178  +    ])
   181    179   
   182    180   This tip only defines 2 function for install:
   183    181   
   184         - * **tclsh install mkzip**.
          182  + * **tclsh install mkzip** ...
   185    183   
   186         -    > This command is a passthrough to the **zipfs mkzip** command, and allows
   187         -    > tclsh to operate as zip encoder from make.
          184  +    This command is a passthrough to the **zipfs mkzip** command, and allows
          185  +    tclsh to operate as zip encoder from make.
   188    186   
   189         - * **tclsh install mkimg**.
          187  + * **tclsh install mkimg** ....
   190    188   
   191         -    > This command is a passthrough to the **zipfs mkimg** command, and allows
   192         -    > tclsh to operate as zip encoder from make.
          189  +    This command is a passthrough to the **zipfs mkimg** command, and allows
          190  +    tclsh to operate as zip encoder from make.
   193    191   
   194         - * **tclsh install copyDir** _source_ _destination_
          192  + * **tclsh install copyDir** _source destination_
   195    193   
   196         -    > This command will recursively copy the file structure of _source_
   197         -    > to _destination_
          194  +    This command will recursively copy the file structure of _source_
          195  +    to _destination_
   198    196   
   199         - * **tclsh install installDir** _source_ _destination_
          197  + * **tclsh install installDir** _source destination_
   200    198   
   201         -    > This command will recursively copy the file structure of _source_
   202         -    > to _destination_, deleting _destination_ if it already exists, and
          199  +    This command will recursively copy the file structure of _source_
          200  +    to _destination_, deleting _destination_ if it already exists, and
   203    201       > marking all files copies as read-only.
   204    202   
   205    203    * **tclsh install pkgindex_path** _path_ ?_path_...?
   206    204   
   207         -    > Index all of the paths specified and generate a script that can
   208         -    > be sourced to feed all of the __package ifneeded__ statements
   209         -    > to an interpreter in one shot. Useful for indexing VFS file systems
   210         -    >
   211         -    > example:
          205  +    Index all of the paths specified and generate a script that can
          206  +    be sourced to feed all of the __package ifneeded__ statements
          207  +    to an interpreter in one shot. Useful for indexing VFS file systems
          208  +
          209  +    example:
   212    210   
   213    211           tclsh install copyDir ~/myapp/src myapp.vfs
   214    212           tclsh install pkgindex_path myapp.vfs > myapp.vfs/pkgIndex.tcl
   215    213   
   216    214   ## Package loading
   217    215   
   218    216   Calls to **tcl_findLibrary** will now search through loaded packages to see if
................................................................................
   223    221   # Implementation
   224    222   
   225    223   This work is largely adapted Richard Hipp's work on Tcl As One Big Executable \(TOBE\).
   226    224   The concept has been modernized, somewhat, as well as heavily influenced by improvements
   227    225   made to it through the FreeWrap and Androwish projects. That implementation consists of one C file
   228    226   \(_tclZipvfs.c_\).  I have also prepared a set of kit-like behaviors for the
   229    227   core to express when tclAppInit.c is not compiled with a **TCL\_LOCAL\_MAIN\_HOOK**
   230         -defined. Those behaviors reside in the *TclZipfs_AppHook\(\)* function.
          228  +defined. Those behaviors reside in the **TclZipfs_AppHook**\(\) function.
   231    229   
   232    230   This work is checked in as the "_core\_zip\_vfs_" branch on both Tcl and Tk.
   233    231   
   234    232   
   235    233   ## Modifications to auto.tcl
   236    234   
   237    235   *auto.tcl* now has rules for scanning DLLs for zip file systems.
................................................................................
   309    307   ## Modifications to Tk
   310    308   
   311    309   Tk will scan tclConfig.sh, and if it detects a non-blank value for **TCL_ZIP_FILE**, it
   312    310   will make a call to *TclZipfs_AppHook\(\)* if no **TK\_LOCAL\_MAIN\_HOOK** was defined.
   313    311   
   314    312   # C API
   315    313   
   316         -* **int TclZipfs_AppHook\(int \*argc, char \*\*\*argv\);**
          314  +int **TclZipfs\_AppHook**\(int _\*argc,_ char _\*\*\*argv_\);
   317    315   
   318    316   1. If the current executable has an attached zip file system, mount that to **ZIPFS\_ROOT**/app.
   319    317   2. If the file **ZIPFS\_ROOT**_/app/main.tcl_ exists, register that file as the process startup script.
   320    318   3. If the file **ZIPFS\_ROOT**_/app/tcl\_library/init.tcl_ exists, register **ZIPFS\_ROOT**_/app/tcl\_library/init.tcl_ as **tcl\_library**
   321    319   4. If the file **ZIPFS\_ROOT**_/app/tk\_library/init.tcl_ exists, register **ZIPFS\_ROOT**_/app/tk\_library/init.tcl* as **tk\_library**
   322         -5. If **tcl\_library** was not set, the function will then scan the local environment for a
   323         -zipfs file system attached to either the tcl dynamic library or an archive named
   324         -*libtcl\_MAJOR\_MINOR\_PATCHLEVEL.zip*. That file can either be in the present working directory
   325         -or in the standard system install location for Tcl.
          320  +5. If **tcl\_library** was not set, the function will then scan the local environment for a zipfs file system attached to either the tcl dynamic library or an archive named `libtcl\_MAJOR\_MINOR\_PATCHLEVEL.zip` (where `MAJOR`, `MINOR` and `PATCHLEVEL` depend on the exact version of Tcl). That file can either be in the present working directory or in the standard system install location for Tcl.
          321  +
          322  +int **TclZipfs\_Mount**\(Tcl\_Interp _\*interp,_ const char _\*zipname,_ const char _\*mntpt,_ const char _\*passwd_\);
          323  +
          324  + > Mounts a zip file _zipname_ to the mount point _mntpt_. If _passwd_ is
          325  + > non-null, that string is used as the password to decrypt the contents.
          326  + > _mntpnt_ will always be relative to **zipfs:**
   326    327   
   327         -* **int TclZipfs_Mount\(Tcl\_Interp \*interp, const char \*zipname, const char \*mntpt, const char \*passwd\);**
          328  +int **TclZipfs\_Unmount**\(Tcl\_Interp _\*interp,_ const char _\*zipname_\);
   328    329   
   329         -    > Mounts a zip file _zipname_ to the mount point _mntpt_. If _passwd_ is
   330         -    > non-null, that string is used as the password to decrypt the contents.
   331         -    > _mntpnt_ will always be relative to **zipfs:**
   332         -
   333         -* **int TclZipfs_Unmount\(Tcl\_Interp \*interp, const char \*zipname\);**
   334         -
   335         -    > Unmount the file system created by a prior call to **TclZipfs_Mount\(\)**
          330  + > Unmount the file system created (from _zipname_) by a prior call to
          331  + > **TclZipfs_Mount**\(\).
   336    332   
   337    333   # Creating a wrapped executable
   338    334   
   339         -With this tip, producing a wrapped executable is now a matter of:
          335  +With this TIP, producing a wrapped executable is now a matter of:
   340    336   
   341    337       mkdir myvfs.vfs
   342    338       cd myvfs.vfs
   343    339       echo "puts {hello world}" > main.tcl
   344    340       zip -r ../hello.zip .
   345    341       cd ..
   346    342       cp tclsh8.7 hello
................................................................................
   347    343       cat hello.zip >> hello
   348    344       ./hello
   349    345       > hello world
   350    346   
   351    347   # Copyright
   352    348   
   353    349   This document has been placed in the public domain.
   354         -