diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/expl3/test3.tex')
-rw-r--r-- | Master/texmf-dist/source/latex/expl3/test3.tex | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/test3.tex b/Master/texmf-dist/source/latex/expl3/test3.tex new file mode 100644 index 00000000000..3dd5f714d35 --- /dev/null +++ b/Master/texmf-dist/source/latex/expl3/test3.tex @@ -0,0 +1,135 @@ +% \iffalse +%% File: test2 Copyright (C) 1990-2006 LaTeX3 project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``expl3 bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +% \fi +\documentclass{article} + +\usepackage{l3precom} + +% let's dump what is known about the LaTeX internals so far. +% this will not be much as the very basic stuff doesn't get +% dumped and we haven't got anything else. +% +\dumpLaTeXstate{test1} + +\CodeStart + +% we need some variants of tlp_set which are not yet +% defined for use in the code below. +% +\exp_def_form:nnn{tlp_set}{Nn}{on} +\exp_def_form:nnn{tlp_gset}{Nn}{on} + +% okay, here we either load a dump file (testdump.cmp) +% and then jump tp \cs_dump: or we compile one for next time. +% don't forget that if you change code below it will only have any +% affect if a new dump file is written so you may have to remove +% the existing one. +% +\cs_load_dump:n{testdump} + +% two test definitions +% +\def_new:Npn\foo{some foo} +\def_new:Npn\baz{some baz} + +% we say that \foo should be dumped in the compiled style. +% this is pretty useless as it is certainly not faster than defining +% it in the first place. but this is only done for showing that it +% works. just assume that \foo is actually a pretty difficult +% definition which does need a lot of static compilation due to +% parsing, comparing values, etc., so that it is much faster load the +% final version rather than do the compilation each time again. +% +% btw note that \baz is not dumped and will not be available in the +% production run (ie the one using the cmp file) +% +\cs_record_name:N\foo + +% get our self a scratch register (again this will not be available in +% the production run) +% +\tlp_new:Nn\l_scratch_tlp{} + +% now we generate a unique cs name and assign it the string "foo". +% again pretty useless example. but with this mechansim you can build +% complex graph structures etc using these names as pointers, etc. and +% in such a case you need to dump the state of your graph at some +% point to be able to load it very fast in production. +% +\cs_gen_sym:N\l_scratch_tlp{} +\tlp_set:on \l_scratch_tlp {foo} + +% ditto for a global unique name +% +\cs_ggen_sym:N\l_scratch_tlp{} +\tlp_gset:on \l_scratch_tlp {bar} + +% and now we dump the whole rubbish. In the current implementation +% only csnames can be precompiled, perhaps registers should be handled +% similarly. +% +\cs_dump: + +% and some int register to show something in the second LaTeX state +% dump. +% +\int_new:N\l_my_int +\int_set:Nn\l_my_int{42} +% +% as the allocation routines are not distributed we have to do this +% manually. +% +\register_record_name:N\l_my_int + +\dumpLaTeXstate{test2} + +% and changing something ... what happens with the LaTeX state? +% +\int_set:Nn\l_my_int{0} +\def:Npn\file_not_found:nTF#1#2#3{} + +\dumpLaTeXstate{test3} + +\CodeStop + +\begin{document} + +\LaTeX\ still works! + +\end{document} + + + + |