Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: wordcode files
- X-seq: zsh-workers 9959
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: wordcode files
- Date: Wed, 1 Mar 2000 16:58:03 +0000
- In-reply-to: <200003011006.LAA24751@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <200003011006.LAA24751@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Mar 1, 11:06am, Sven Wischnowsky wrote:
} Subject: PATCH: wordcode files
}
} The zcompile builtin can be used to create wordcode files. [...] If
} neither -r nor -m are given zcompile decides if the file is to be read
} or mapped: if the resulting file (one version of the content, see
} below) is less than 4096 bytes long it is read. [...]
}
} The file created contains two versions: one for either endian-ness.
} The shell reading the file will decide which one it needs [...]
}
} Wordcode files can be used in two ways. One way is to put them into
} the directories in $fpath with the .zwc extension. [...] The other way
} is to put the name of the wordcode file into $fpath. In that case the
} .zwc extension isn't required [...]
This all sounds fine, although I lean towards requiring that the .zwc
extension appear in the $fpath listing. What happens, for example, if
I have both a ~/zshfun/ and ~/zshfun.zwc and I list ~/zshfun in $fpath?
} [...] Note also, that such digest files are really only searched when
} they appear as elements of $fpath. The shell does not look into every
} *.zwc file in every diretory in $fpath [...]
This is just fine.
} [...] I also find it tempting to turn most of my .z* files (including
} the completion dump file) into functions and putting them into a
} wordcode file, but I haven't implemented any support for that either.
} Maybe we could extend the mechanism with the *.zwc files to also apply
} to sourced files -- creating dump files for them is simple, and can be
} done already with zcompile, it's just that the function for sourcing a
} file does not check if there is a *.zwc file. Should we?
What would "source" do if it encountered a function digest file? Simply
define all the functions it contains?
Perhaps we'd need yet another option to zcompile, to tell it to produce
a source-able file instead of a function digest. Then "source" ignores
the digest files and autoloading ignores source-able files. Unless we
think it'd be useful to have autoloading simply execute the source-able
files, but I think that'd have to be limited to the file-in-a-directory
case and not the file-named-in-$fpath case.
} % zcompile foo ../Completion/*/_*~*~
} % fpath=(foo)
}
} And then do completion (without having it done before in the same
} shell)... the first completions (where normally the functions are
} loaded and parsed) should be a lot faster, especially when using the
} larger functions like _cvs, _rpm or _pbm.
So _cvs is still a function that defines a bunch of other functions
and then calls itself? When such a function is loaded from a mapped
digest file, the result of executing it is going to be a bunch of
functions that have been copied into allocated memory, right?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author