diff options
-rw-r--r-- | context/data/scite/scite-context-readme.pdf | bin | 212111 -> 212029 bytes | |||
-rw-r--r-- | context/data/scite/scite-context-readme.tex | 391 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 103 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 103 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 103 | ||||
-rw-r--r-- | tex/context/base/chem-str.lua | 80 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 4 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4131 -> 4128 bytes | |||
-rw-r--r-- | tex/context/base/context-version.png | bin | 40047 -> 40483 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/data-res.lua | 5 | ||||
-rw-r--r-- | tex/context/base/l-lua.lua | 13 | ||||
-rw-r--r-- | tex/context/base/math-ali.mkiv | 12 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24764 -> 24752 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 211760 -> 211622 bytes | |||
-rw-r--r-- | tex/context/base/tabl-xtb.lua | 12 | ||||
-rw-r--r-- | tex/context/base/util-lib.lua | 98 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 14 |
18 files changed, 579 insertions, 361 deletions
diff --git a/context/data/scite/scite-context-readme.pdf b/context/data/scite/scite-context-readme.pdf Binary files differindex 5e68aecc7..05473e597 100644 --- a/context/data/scite/scite-context-readme.pdf +++ b/context/data/scite/scite-context-readme.pdf diff --git a/context/data/scite/scite-context-readme.tex b/context/data/scite/scite-context-readme.tex index 0789401b8..3eb7d422a 100644 --- a/context/data/scite/scite-context-readme.tex +++ b/context/data/scite/scite-context-readme.tex @@ -113,56 +113,50 @@ {\em This manual is under (re)construction.} -For a long time at \PRAGMA\ we used \TEXEDIT, an editor we'd -written in \MODULA. It had some project management features and -recognized the project structure in \CONTEXT\ documents. Later we -rewrote this to a platform independent reimplementation called -\TEXWORK\ written in \PERLTK\ (not to be confused with the editor -with the plural name). - -In the beginning of the century I can into \SCITE, written by Neil -Hodgson. Although the mentioned editors provide some functionality -not present in \SCITE\ we decided to use that editor because it -frees us from maintaining our own. I ported our \TEX\ and -\METAPOST\ (line based) syntax highlighting to \SCITE\ and got a -lot of others for free. - -After a while I found out that there was an extension interface -written in \LUA. I played with it and wrote a few extensions too. -This pleasant experience later triggered the \LUATEX\ project. - -A decade into the century \SCITE\ got another new feature: you can -write dynamic external lexers in \LUA\ using \LPEG. As in the -meantime \CONTEXT\ has evolved in a \TEX/\LUA\ hybrid, it made -sense to look into this. The result is a couple of lexers that -suit \TEX, \METAPOST\ and \LUA\ usage in \CONTEXT\ \MKIV. As we -also use \XML\ as input and output format a lexer for \XML\ is also -provided. And because \PDF\ is one of the backend formats lexing of -\PDF\ is also implemented. \footnote {In the process some of the -general lexing framework was adapted to suit our demands for speed. -We ship these files as well.} - -In the \CONTEXT\ (standalone) distribution you will find the -relevant files under: +For a long time at \PRAGMA\ we used \TEXEDIT, an editor we'd written in \MODULA. +It had some project management features and recognized the project structure in +\CONTEXT\ documents. Later we rewrote this to a platform independent +reimplementation called \TEXWORK\ written in \PERLTK\ (not to be confused with +the editor with the plural name). + +In the beginning of the century I can into \SCITE, written by Neil Hodgson. +Although the mentioned editors provide some functionality not present in \SCITE\ +we decided to use that editor because it frees us from maintaining our own. I +ported our \TEX\ and \METAPOST\ (line based) syntax highlighting to \SCITE\ and +got a lot of others for free. + +After a while I found out that there was an extension interface written in \LUA. +I played with it and wrote a few extensions too. This pleasant experience later +triggered the \LUATEX\ project. + +A decade into the century \SCITE\ got another new feature: you can write dynamic +external lexers in \LUA\ using \LPEG. As in the meantime \CONTEXT\ has evolved in +a \TEX/\LUA\ hybrid, it made sense to look into this. The result is a couple of +lexers that suit \TEX, \METAPOST\ and \LUA\ usage in \CONTEXT\ \MKIV. As we also +use \XML\ as input and output format a lexer for \XML\ is also provided. And +because \PDF\ is one of the backend formats lexing of \PDF\ is also implemented. +\footnote {In the process some of the general lexing framework was adapted to +suit our demands for speed. We ship these files as well.} + +In the \CONTEXT\ (standalone) distribution you will find the relevant files +under: \starttyping <texroot>/tex/texmf-context/context/data/scite \stoptyping -Normally a user will not have to dive into the implementation -details but in principle you can tweak the properties files to -suit your purpose. +Normally a user will not have to dive into the implementation details but in +principle you can tweak the properties files to suit your purpose. \subject{The look and feel} -The color scheme that we use is consistent over the lexers but we -use more colors that in the traditional lexing. For instance, -\TEX\ primitives, low level \TEX\ commands, \TEX\ constants, basic -file structure related commands, and user commands all get a -different treatment. When spell checking is turned on, we indicate -unknown words, but also words that are known but might need -checking, for instance because they have an uppercase character. -In \in {figure} [fig:colors] we some of that in practice. +The color scheme that we use is consistent over the lexers but we use more colors +that in the traditional lexing. For instance, \TEX\ primitives, low level \TEX\ +commands, \TEX\ constants, basic file structure related commands, and user +commands all get a different treatment. When spell checking is turned on, we +indicate unknown words, but also words that are known but might need checking, +for instance because they have an uppercase character. In \in {figure} +[fig:colors] we some of that in practice. \placefigure [page] @@ -177,31 +171,29 @@ In \in {figure} [fig:colors] we some of that in practice. \subject{Installing \SCITE} -Installing \SCITE\ is straightforward. We are most familiar with -\MSWINDOWS\ but for other operating systems installation is not -much different. First you need to fetch the archive from: +Installing \SCITE\ is straightforward. We are most familiar with \MSWINDOWS\ but +for other operating systems installation is not much different. First you need to +fetch the archive from: \starttyping www.scintilla.org \stoptyping -The \MSWINDOWS\ binaries are zipped in \type {wscite.zip}, and you -can unzip this in any directory you want as long as you make sure -that the binary ends up in your path or as shortcut on your -desktop. So, say that you install \SCITE\ in: +The \MSWINDOWS\ binaries are zipped in \type {wscite.zip}, and you can unzip this +in any directory you want as long as you make sure that the binary ends up in +your path or as shortcut on your desktop. So, say that you install \SCITE\ in: \starttyping c:\data\system\scite\wscite \stoptyping -You need to add this path to your local path definition. -Installing \SCITE\ to some known place has the advantage that you -can move it around. There are no special dependencies on the -operating system. +You need to add this path to your local path definition. Installing \SCITE\ to +some known place has the advantage that you can move it around. There are no +special dependencies on the operating system. -Next you need to install the lpeg lexers. \footnote {Versions -later than 2.11 will not run on \MSWINDOWS\ 2K. In that case you need -to comment the external lexer import.} These can be fetched from: +Next you need to install the lpeg lexers. \footnote {Versions later than 2.11 +will not run on \MSWINDOWS\ 2K. In that case you need to comment the external +lexer import.} These can be fetched from: \starttyping http://foicica.com/scintillua/ @@ -214,15 +206,17 @@ copy them in the same path as where the regular properties files live. \footnote \SCITE\ that influence the lexers in which case you have to wait till we have update them to suit those changes.} -For \UNIX, one can take a precompiled version as well. Here we -need to split the set of files into: +For \UNIX, one can take a precompiled version as well. Here we might need to split +the set of files into: \starttyping /usr/bin /usr/share/scite \stoptyping -The second path is hard coded in the binary. +The second path is hard coded in the binary and moving all files there probably works +okay. Beware: if you're on a 64 bit system, you need to rename the 64 bit \type {so} +library. If you want to use \CONTEXT, you need to copy the relevant files from @@ -230,21 +224,19 @@ If you want to use \CONTEXT, you need to copy the relevant files from <texroot>/tex/texmf-context/context/data/scite \stoptyping -to the path were \SCITE\ keeps its property files (\type (*.properties). - -There is a file called \type {SciteGlobal.properties}. At the end -of that file (on \MSWINDOWS\ it is in the path where the Scite binary) -you then add a line to the end: +to the path were \SCITE\ keeps its property files (\type {*.properties}). There +is a file called \type {SciteGlobal.properties}. At the end of that file (on +\MSWINDOWS\ it is in the path where the Scite binary) you then add a line to the +end: \starttyping import scite-context-user \stoptyping -You need to restart \SCITE\ in order to see if things work out as -expected. +You need to restart \SCITE\ in order to see if things work out as expected. -Disabling the external lexer in a recent \SCITE\ is somewhat -tricky. In that case the end of that file looks like: +Disabling the external lexer in a recent \SCITE\ is somewhat tricky. In that case +the end of that file looks like: \starttyping imports.exclude=scite-context-external @@ -254,8 +246,8 @@ import scite-context-user In any case you need to make sure that the user file is loaded last. -After this, things should run as expected (given that \TEX\ runs -at the console as well). +After this, things should run as expected (given that \TEX\ runs at the console +as well). % In order to run the commands needed, we assume that the following programs % are installed: @@ -270,12 +262,11 @@ at the console as well). \subject{Fonts} -The configuration file defaults to the Dejavu fonts. These free -fonts are part of the \CONTEXT\ suite (also known as the -standalone distribution). Of course you can fetch them from \type -{http://dejavu-fonts.org} as well. You have to copy them to where -your operating system expects them. In the suite they are -available in +The configuration file defaults to the Dejavu fonts. These free fonts are part of +the \CONTEXT\ suite (also known as the standalone distribution). Of course you +can fetch them from \type {http://dejavu-fonts.org} as well. You have to copy +them to where your operating system expects them. In the suite they are available +in \starttyping <contextroot>/tex/texmf/fonts/truetype/public/dejavu @@ -283,9 +274,8 @@ available in \subject{An alternative approach} -If for some reason you prefer not to mess with property files in -the main \SCITE\ path, you can follow a different route and -selectively copy files to places. +If for some reason you prefer not to mess with property files in the main \SCITE\ +path, you can follow a different route and selectively copy files to places. The following files are needed for the lpeg based lexer: @@ -308,22 +298,21 @@ lexers/context/data/scite-context-data-metafun.lua lexers/themes/scite-context-theme.lua \stoptyping -The data files are needed because we cannot access property files -from within the lexer. If we could open a file we could use the -property files instead. +The data files are needed because we cannot access property files from within the +lexer. If we could open a file we could use the property files instead. -These files go to the \type {lexers} subpath in your \SCITE\ -installation. Normally this sits in the binary path. The -following files provide some extensions. On \MSWINDOWS\ you can copy -these files to the path where the \SCITE\ binary lives. +These files go to the \type {lexers} subpath in your \SCITE\ installation. +Normally this sits in the binary path. The following files provide some +extensions. On \MSWINDOWS\ you can copy these files to the path where the \SCITE\ +binary lives. \starttyping scite-ctx.lua \stoptyping -Because property files can only be loaded from the same path -where the (user) file loads them you need to copy the following -files to the same path where the loading is defined: +Because property files can only be loaded from the same path where the (user) +file loads them you need to copy the following files to the same path where the +loading is defined: \starttyping scite-context.properties @@ -367,41 +356,37 @@ to the file: SciTEUser.properties \stoptyping -Of course the pragma import is optional. You can comment either the -internal or external variant but there is no reason not to keep them both. +Of course the pragma import is optional. You can comment either the internal or +external variant but there is no reason not to keep them both. \subject{Extensions} -Just a quick not to some extensions. If you select a part of the -text (normally you do this with the shift key pressed) and you hit -\type {Shift-F11}, you get a menu with some options. More (robust) -ones will be provided at some point. +Just a quick not to some extensions. If you select a part of the text (normally +you do this with the shift key pressed) and you hit \type {Shift-F11}, you get a +menu with some options. More (robust) ones will be provided at some point. \subject{Spell checking} -If you want to have spell checking, you need have files with -correct words on each line. The first line of a file determines -the language: +If you want to have spell checking, you need have files with correct words on +each line. The first line of a file determines the language: \starttyping % language=uk \stoptyping -When you use the external lexers, you need to provide some files. -Given that you have a text file with valid words only, you can run -the following script: +When you use the external lexers, you need to provide some files. Given that you +have a text file with valid words only, you can run the following script: \starttyping mtxrun --script scite --words nl uk \stoptyping -This will convert files with names like \type {spell-nl.txt} into -\LUA\ files that you need to copy to the \type {lexers/data} path. -Spell checking happens realtime when you have the language -directive (just add a bogus character to disable it). Wrong words -are colored red, and words that might have a case problem are -colored orange. Recognized words are greyed and words with less -than three characters are ignored. +This will convert files with names like \type {spell-nl.txt} into \LUA\ files +that you need to copy to the \type {lexers/data} path. Spell checking happens +realtime when you have the language directive (just add a bogus character to +disable it). Wrong words are colored red, and words that might have a case +problem are colored orange. Recognized words are greyed and words with less than +three characters are ignored. In the case of internal lexers, the following file is needed: @@ -409,34 +394,32 @@ In the case of internal lexers, the following file is needed: spell-uk.txt \stoptyping -If you use the traditional lexer, this file is taken from the -path determined by the environment variable: +If you use the traditional lexer, this file is taken from the path determined by +the environment variable: \starttyping CTXSPELLPATH \stoptyping -As already mentioned, the lpeg lexer expects them in the data -path. This is because the \LUA\ instance that does the lexing is -rather minimalistic and lacks some libraries as well as cannot -access the main \SCITE\ state. +As already mentioned, the lpeg lexer expects them in the data path. This is +because the \LUA\ instance that does the lexing is rather minimalistic and lacks +some libraries as well as cannot access the main \SCITE\ state. -Spell checking in \type {txt} files is enabled by adding a first -line: +Spell checking in \type {txt} files is enabled by adding a first line: \starttyping [#!-%] language=uk \stoptyping -The first character on that line is one of the four mentioned -between square brackets. So, +The first character on that line is one of the four mentioned between square +brackets. So, \starttyping # language=uk \stoptyping -should work. For \XML\ files there are two methods. You can use the -following (at the start of the file): +should work. For \XML\ files there are two methods. You can use the following (at +the start of the file): \starttyping <?xml ... language="uk" ?> @@ -459,70 +442,63 @@ In a similar fashion you can drive the interface checking: \subject{Property files} -The internal lexers are controlled by the property files while the -external ones are steered with themes. Unfortunately there is -hardly any access to properties from the external lexer code nor -can we consult the file system and/or run programs like \type -{mtxrun}. This means that we cannot use configuration files in the -\CONTEXT\ distribution directly. Hopefully this changes with -future releases. +The internal lexers are controlled by the property files while the external ones +are steered with themes. Unfortunately there is hardly any access to properties +from the external lexer code nor can we consult the file system and/or run +programs like \type {mtxrun}. This means that we cannot use configuration files +in the \CONTEXT\ distribution directly. Hopefully this changes with future +releases. \subject{The external lexers} -These are the more advanced. They provide more detail and the \CONTEXT\ -lexer also supports nested \METAPOST\ and \LUA. Currently there is no -detailed configuration but this might change once they are stable. - -The external lexers operate on documents while the internal ones -operate on lines. This can make the external lexers slow on large -documents. We've optimized the code somewhat for speed and memory -consumption but there's only so much one can do. While lexing each -change in style needs a small table but allocating and garbage -collecting many small tables comes at a price. Of course in -practice this probably gets unnoticed. \footnote {I wrote the code -in 2011 on a more than 5 years old Dell M90 laptop, so I suppose -that speed is less an issue now.} - -In principle the external lexers can be used with \type -{textadept} which also uses \type {scintilla}. Actually, support -for lpeg lexing originates in \type {textadept}. Currently \type -{textadept} lacks a couple of features I like about \SCITE\ (for -instance it has no realtime logpane) and it's also still changing. -At some point the \CONTEXT\ distribution might ship with files -for \type {textadept} as well. - -The external lpeg lexers work okay with the \MSWINDOWS\ and -\LINUX\ versions of \SCITE, but unfortunately at the time of -writing this, the \LUA\ library that is needed is not available -for the \MACOSX\ version of \SCITE. Also, due to the fact that the -lexing framework is rather isolated, there are some issues that -cannot be addressed in the properly, at least not currently. - -In addition to \CONTEXT\ and \METAFUN\ lexing a \LUA\ lexer is -also provided so that we can handle \CONTEXT\ \LUA\ Document -(\CLD) files too. There is also an \XML\ lexer. This one also -provides spell checking. The \PDF\ lexer tries to do a good job on -\PDF\ files, but it has some limitations. There is also a simple -text file lexer that does spell checking. - -Don't worry if you see an orange rectangle in your \TEX\ or \XML\ -document. This indicates that there is a special space character -there, for instance \type {0xA0}, the nonbreakable space. Of course -we assume that you use \UTF8 as input encoding. +These are the more advanced. They provide more detail and the \CONTEXT\ lexer +also supports nested \METAPOST\ and \LUA. Currently there is no detailed +configuration but this might change once they are stable. + +The external lexers operate on documents while the internal ones operate on +lines. This can make the external lexers slow on large documents. We've optimized +the code somewhat for speed and memory consumption but there's only so much one +can do. While lexing each change in style needs a small table but allocating and +garbage collecting many small tables comes at a price. Of course in practice this +probably gets unnoticed. \footnote {I wrote the code in 2011 on a more than 5 +years old Dell M90 laptop, so I suppose that speed is less an issue now.} + +In principle the external lexers can be used with \type {textadept} which also +uses \type {scintilla}. Actually, support for lpeg lexing originates in \type +{textadept}. Currently \type {textadept} lacks a couple of features I like about +\SCITE\ (for instance it has no realtime logpane) and it's also still changing. +At some point the \CONTEXT\ distribution might ship with files for \type +{textadept} as well. + +The external lpeg lexers work okay with the \MSWINDOWS\ and \LINUX\ versions of +\SCITE, but unfortunately at the time of writing this, the \LUA\ library that is +needed is not available for the \MACOSX\ version of \SCITE. Also, due to the fact +that the lexing framework is rather isolated, there are some issues that cannot +be addressed in the properly, at least not currently. + +In addition to \CONTEXT\ and \METAFUN\ lexing a \LUA\ lexer is also provided so +that we can handle \CONTEXT\ \LUA\ Document (\CLD) files too. There is also an +\XML\ lexer. This one also provides spell checking. The \PDF\ lexer tries to do a +good job on \PDF\ files, but it has some limitations. There is also a simple text +file lexer that does spell checking. + +Don't worry if you see an orange rectangle in your \TEX\ or \XML\ document. This +indicates that there is a special space character there, for instance \type +{0xA0}, the nonbreakable space. Of course we assume that you use \UTF8 as input +encoding. \subject{The internal lexers} -\SCITE\ has quite some built in lexers. A lexer is responsible for -highlighting the syntax of your document. The way a \TEX\ file is -treated is configured in the file: +\SCITE\ has quite some built in lexers. A lexer is responsible for highlighting +the syntax of your document. The way a \TEX\ file is treated is configured in the +file: \starttyping tex.properties \stoptyping -You can edit this file to your needs using the menu entry under -\type {options} in the top bar. In this file, the following -settings apply to the \TEX\ lexer: +You can edit this file to your needs using the menu entry under \type {options} +in the top bar. In this file, the following settings apply to the \TEX\ lexer: \starttyping lexer.tex.interface.default=0 @@ -531,17 +507,16 @@ lexer.tex.comment.process=0 lexer.tex.auto.if=1 \stoptyping -The option \type {lexer.tex.interface.default} determines the way -keywords are highlighted. You can control the interface from your -document as well, which makes more sense that editing the -configuration file each time. +The option \type {lexer.tex.interface.default} determines the way keywords are +highlighted. You can control the interface from your document as well, which +makes more sense that editing the configuration file each time. \starttyping % interface=all|tex|nl|en|de|cz|it|ro|latex \stoptyping -The values in the properties file and the keywords in the preamble -line have the following meaning: +The values in the properties file and the keywords in the preamble line have the +following meaning: \starttabulate[|lT|lT|p|] \NC 0 \NC all \NC all commands (preceded by a backslash) \NC \NR @@ -555,19 +530,19 @@ line have the following meaning: \NC 8 \NC latex \NC \LATEX\ (apart from packages) \NC \NR \stoptabulate -The configuration file is set up in such a way that you can easily -add more keywords to the lists. The keywords for the second and -higher interfaces are defined in their own properties files. If -you're curious about the way this is configures, you can peek into -the property files that start with \type {scite-context}. When you -have \CONTEXT\ installed you can generate configuration files with +The configuration file is set up in such a way that you can easily add more +keywords to the lists. The keywords for the second and higher interfaces are +defined in their own properties files. If you're curious about the way this is +configures, you can peek into the property files that start with \type +{scite-context}. When you have \CONTEXT\ installed you can generate configuration +files with \starttyping mtxrun --script interface --scite \stoptyping -You need to make sure that you move the result to the right place so best -not mess around with this command and use the files from the distribution. +You need to make sure that you move the result to the right place so best not +mess around with this command and use the files from the distribution. Back to the properties in \type {tex.properties}. You can disable keyword coloring alltogether with: @@ -588,8 +563,8 @@ in a uniform color. But, when set to one, you will get as much colors as a \TEX\ source. It's a matter of taste what you choose. The lexer tries to cope with the \TEX\ syntax as good as possible and takes for -instance care of the funny \type {^^} notation. A special treatment is -applied to so called \type {\if}'s: +instance care of the funny \type {^^} notation. A special treatment is applied to +so called \type {\if}'s: \starttyping lexer.tex.auto.if=1 @@ -597,15 +572,15 @@ lexer.tex.auto.if=1 This is the default setting. When set to one, all \type {\ifwhatever}'s will be seen as a command. When set to zero, only the primitive \type {\if}'s will be -treated. In order not to confuse you, when this property is set to one, the -lexer will not color an \type {\ifwhatever} that follows an \type {\newif}. +treated. In order not to confuse you, when this property is set to one, the lexer +will not color an \type {\ifwhatever} that follows an \type {\newif}. \subject{The \METAPOST\ lexer} The \METAPOST\ lexer is set up slightly different from its \TEX\ counterpart, -first of all because \METAPOST\ is more a language that \TEX. As with the -\TEX\ lexer, we can control the interpretation of identifiers. The \METAPOST\ -specific configuration file is: +first of all because \METAPOST\ is more a language that \TEX. As with the \TEX\ +lexer, we can control the interpretation of identifiers. The \METAPOST\ specific +configuration file is: \starttyping metapost.properties @@ -674,13 +649,13 @@ find \type {mtxrun} in: or in a similar path that suits the operating system that you use. -When you hit \type{CTRL-12} your document will be processed. Take a look at -the \type {Tools} menu to see what more is provided. +When you hit \type{CTRL-12} your document will be processed. Take a look at the +\type {Tools} menu to see what more is provided. \subject{Extensions (using \LUA)} -When the \LUA\ extensions are loaded, you will see a message -in the log pane that looks like: +When the \LUA\ extensions are loaded, you will see a message in the log pane that +looks like: \starttyping - see scite-ctx.properties for configuring info @@ -710,9 +685,9 @@ This message tells you what extras are available. \subject{Templates} -There is an experimental template mechanism. One option is to define -templates in a properties file. The property file \type -{scite-ctx-context} contains definitions like: +There is an experimental template mechanism. One option is to define templates in +a properties file. The property file \type {scite-ctx-context} contains +definitions like: \starttyping command.25.$(file.patterns.context)=insert_template \ @@ -757,9 +732,9 @@ ctx.template.structure.itemize.example=\ </itemize>\n \stoptyping -For larger projects it makes sense to keep templates with the -project. In one of our projects we have a directory in the -path where the project files are kept which holds template files: +For larger projects it makes sense to keep templates with the project. In one of +our projects we have a directory in the path where the project files are kept +which holds template files: \starttyping ..../ctx-templates/achtergronden.xml @@ -777,13 +752,13 @@ ctx.template.mathadore.achtergronden.file=smt-achtergronden.xml ctx.template.mathadore.bewijs.file=smt-bewijs.xml \stoptyping -However, when no such menu is defined, we will automatically scan -the directory and build the menu without user intervention. +However, when no such menu is defined, we will automatically scan the directory +and build the menu without user intervention. \subject{Using \SCITE} -The following keybindings are available in \SCITE. Most of this -list is taken from the on|-|line help pages. +The following keybindings are available in \SCITE. Most of this list is taken +from the on|-|line help pages. \startbuffer[keybindings] \starttabulate[|l|p|] diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 00f63a579..d337ed75f 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 10048, stripped down to: 5684 +-- original size: 10352, stripped down to: 5955 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -247,7 +247,7 @@ local function loadedbypath(name,rawname,paths,islib,what) end local function notloaded(name) if helpers.trace then - helpers.report("? unable to locate library '%s'",name) + helpers.report("unable to locate library '%s'",name) end end helpers.loadedaslib=loadedaslib @@ -278,6 +278,16 @@ function helpers.loaded(name) end return notloaded(name) end +function helpers.unload(name) + if helpers.trace then + if package.loaded[name] then + helpers.report("unloading library '%s', %s",name,"done") + else + helpers.report("unloading library '%s', %s",name,"not loaded") + end + end + package.loaded[name]=nil +end end -- of closure @@ -12632,7 +12642,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 60821, stripped down to: 42503 +-- original size: 60857, stripped down to: 42496 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -12807,7 +12817,7 @@ local slash=P("/") local pathexpressionpattern=Cs ( Cc("^")*( Cc("%")*S(".-")+slash^2*P(-1)/"/.*" -+slash^2/"/[^/]*/*"+(1-slash)*P(-1)*Cc("/")+P(1) ++slash^2/"/"+(1-slash)*P(-1)*Cc("/")+P(1) )^1*Cc("$") ) local cache={} @@ -15403,7 +15413,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-lib"] = package.loaded["util-lib"] or true --- original size: 8911, stripped down to: 4216 +-- original size: 10762, stripped down to: 5269 if not modules then modules={} end modules ['util-lib']={ version=1.001, @@ -15418,6 +15428,7 @@ local findfile,findfiles=resolvers and resolvers.findfile,resolvers and resolver local loaded=package.loaded local report_swiglib=logs.reporter("swiglib") local trace_swiglib=false trackers.register("resolvers.swiglib",function(v) trace_swiglib=v end) +local done=false local function requireswiglib(required,version) local library=loaded[required] if library==nil then @@ -15426,32 +15437,48 @@ local function requireswiglib(required,version) local required_base=nameonly(required_full) local required_name=required_base.."."..os.libsuffix local version=type(version)=="string" and version~="" and version or false + local engine=environment.ownmain or false + if trace_swiglib and not done then + local list=resolvers.expandedpathlistfromvariable("lib") + for i=1,#list do + report_swiglib("tds path %i: %s",i,list[i]) + end + end + local function found(locate,asked_library,how,...) + if trace_swiglib then + report_swiglib("checking %s: %a",how,asked_library) + end + return locate(asked_library,...) + end local function check(locate,...) - local found_library=nil + local found=nil if version then local asked_library=joinfile(required_path,version,required_name) if trace_swiglib then report_swiglib("checking %s: %a","with version",asked_library) end - found_library=locate(asked_library,...) - if not found_library or found_library==""then - asked_library=joinfile(required_path,required_name) - if trace_swiglib then - report_swiglib("checking %s: %a","without version",asked_library) - end - found_library=locate(asked_library,...) - end - else + found=locate(asked_library,...) + end + if not found or found=="" then local asked_library=joinfile(required_path,required_name) if trace_swiglib then - report_swiglib("checking %s: %a","without version",asked_library) + report_swiglib("checking %s: %a","with version",asked_library) end - found_library=locate(asked_library,...) + found=locate(asked_library,...) end - return found_library and found_library~="" and found_library or false + return found and found~="" and found or false end - local found_library=findfile and check(findfile,"lib") - if findfiles and not found_library then + local function attempt(checkpattern) + if trace_swiglib then + report_swiglib("checking tds lib paths strictly") + end + local found=findfile and check(findfile,"lib") + if found and (not checkpattern or find(found,checkpattern)) then + return found + end + if trace_swiglib then + report_swiglib("checking tds lib paths with wildcard") + end local asked_library=joinfile(required_path,".*",required_name) if trace_swiglib then report_swiglib("checking %s: %a","latest version",asked_library) @@ -15459,18 +15486,38 @@ local function requireswiglib(required,version) local list=findfiles(asked_library,"lib",true) if list and #list>0 then table.sort(list) - found_library=list[#list] + local found=list[#list] + if found and (not checkpattern or find(found,checkpattern)) then + return found + end + end + if trace_swiglib then + report_swiglib("checking clib paths") end - end - if not found_library then package.extraclibpath(environment.ownpath) local paths=package.clibpaths() for i=1,#paths do - local found_library=check(lfs.isfile) - if found_library then - break + local found=check(lfs.isfile) + if found and (not checkpattern or find(found,checkpattern)) then + return found end end + return false + end + local found_library=nil + if engine then + if trace_swiglib then + report_swiglib("attemp 1, engine %a",engine) + end + found_library=attempt("/"..engine.."/") + if not found_library then + if trace_swiglib then + report_swiglib("attemp 2, no engine",asked_library) + end + found_library=attempt() + end + else + found_library=attempt() end if not found_library then if trace_swiglib then @@ -15773,8 +15820,8 @@ end -- of closure -- used libraries : l-lua.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 658276 --- stripped bytes : 241564 +-- original bytes : 660467 +-- stripped bytes : 242438 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 00f63a579..d337ed75f 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 10048, stripped down to: 5684 +-- original size: 10352, stripped down to: 5955 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -247,7 +247,7 @@ local function loadedbypath(name,rawname,paths,islib,what) end local function notloaded(name) if helpers.trace then - helpers.report("? unable to locate library '%s'",name) + helpers.report("unable to locate library '%s'",name) end end helpers.loadedaslib=loadedaslib @@ -278,6 +278,16 @@ function helpers.loaded(name) end return notloaded(name) end +function helpers.unload(name) + if helpers.trace then + if package.loaded[name] then + helpers.report("unloading library '%s', %s",name,"done") + else + helpers.report("unloading library '%s', %s",name,"not loaded") + end + end + package.loaded[name]=nil +end end -- of closure @@ -12632,7 +12642,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 60821, stripped down to: 42503 +-- original size: 60857, stripped down to: 42496 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -12807,7 +12817,7 @@ local slash=P("/") local pathexpressionpattern=Cs ( Cc("^")*( Cc("%")*S(".-")+slash^2*P(-1)/"/.*" -+slash^2/"/[^/]*/*"+(1-slash)*P(-1)*Cc("/")+P(1) ++slash^2/"/"+(1-slash)*P(-1)*Cc("/")+P(1) )^1*Cc("$") ) local cache={} @@ -15403,7 +15413,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-lib"] = package.loaded["util-lib"] or true --- original size: 8911, stripped down to: 4216 +-- original size: 10762, stripped down to: 5269 if not modules then modules={} end modules ['util-lib']={ version=1.001, @@ -15418,6 +15428,7 @@ local findfile,findfiles=resolvers and resolvers.findfile,resolvers and resolver local loaded=package.loaded local report_swiglib=logs.reporter("swiglib") local trace_swiglib=false trackers.register("resolvers.swiglib",function(v) trace_swiglib=v end) +local done=false local function requireswiglib(required,version) local library=loaded[required] if library==nil then @@ -15426,32 +15437,48 @@ local function requireswiglib(required,version) local required_base=nameonly(required_full) local required_name=required_base.."."..os.libsuffix local version=type(version)=="string" and version~="" and version or false + local engine=environment.ownmain or false + if trace_swiglib and not done then + local list=resolvers.expandedpathlistfromvariable("lib") + for i=1,#list do + report_swiglib("tds path %i: %s",i,list[i]) + end + end + local function found(locate,asked_library,how,...) + if trace_swiglib then + report_swiglib("checking %s: %a",how,asked_library) + end + return locate(asked_library,...) + end local function check(locate,...) - local found_library=nil + local found=nil if version then local asked_library=joinfile(required_path,version,required_name) if trace_swiglib then report_swiglib("checking %s: %a","with version",asked_library) end - found_library=locate(asked_library,...) - if not found_library or found_library==""then - asked_library=joinfile(required_path,required_name) - if trace_swiglib then - report_swiglib("checking %s: %a","without version",asked_library) - end - found_library=locate(asked_library,...) - end - else + found=locate(asked_library,...) + end + if not found or found=="" then local asked_library=joinfile(required_path,required_name) if trace_swiglib then - report_swiglib("checking %s: %a","without version",asked_library) + report_swiglib("checking %s: %a","with version",asked_library) end - found_library=locate(asked_library,...) + found=locate(asked_library,...) end - return found_library and found_library~="" and found_library or false + return found and found~="" and found or false end - local found_library=findfile and check(findfile,"lib") - if findfiles and not found_library then + local function attempt(checkpattern) + if trace_swiglib then + report_swiglib("checking tds lib paths strictly") + end + local found=findfile and check(findfile,"lib") + if found and (not checkpattern or find(found,checkpattern)) then + return found + end + if trace_swiglib then + report_swiglib("checking tds lib paths with wildcard") + end local asked_library=joinfile(required_path,".*",required_name) if trace_swiglib then report_swiglib("checking %s: %a","latest version",asked_library) @@ -15459,18 +15486,38 @@ local function requireswiglib(required,version) local list=findfiles(asked_library,"lib",true) if list and #list>0 then table.sort(list) - found_library=list[#list] + local found=list[#list] + if found and (not checkpattern or find(found,checkpattern)) then + return found + end + end + if trace_swiglib then + report_swiglib("checking clib paths") end - end - if not found_library then package.extraclibpath(environment.ownpath) local paths=package.clibpaths() for i=1,#paths do - local found_library=check(lfs.isfile) - if found_library then - break + local found=check(lfs.isfile) + if found and (not checkpattern or find(found,checkpattern)) then + return found end end + return false + end + local found_library=nil + if engine then + if trace_swiglib then + report_swiglib("attemp 1, engine %a",engine) + end + found_library=attempt("/"..engine.."/") + if not found_library then + if trace_swiglib then + report_swiglib("attemp 2, no engine",asked_library) + end + found_library=attempt() + end + else + found_library=attempt() end if not found_library then if trace_swiglib then @@ -15773,8 +15820,8 @@ end -- of closure -- used libraries : l-lua.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 658276 --- stripped bytes : 241564 +-- original bytes : 660467 +-- stripped bytes : 242438 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 00f63a579..d337ed75f 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -56,7 +56,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-lua"] = package.loaded["l-lua"] or true --- original size: 10048, stripped down to: 5684 +-- original size: 10352, stripped down to: 5955 if not modules then modules={} end modules ['l-lua']={ version=1.001, @@ -247,7 +247,7 @@ local function loadedbypath(name,rawname,paths,islib,what) end local function notloaded(name) if helpers.trace then - helpers.report("? unable to locate library '%s'",name) + helpers.report("unable to locate library '%s'",name) end end helpers.loadedaslib=loadedaslib @@ -278,6 +278,16 @@ function helpers.loaded(name) end return notloaded(name) end +function helpers.unload(name) + if helpers.trace then + if package.loaded[name] then + helpers.report("unloading library '%s', %s",name,"done") + else + helpers.report("unloading library '%s', %s",name,"not loaded") + end + end + package.loaded[name]=nil +end end -- of closure @@ -12632,7 +12642,7 @@ do -- create closure to overcome 200 locals limit package.loaded["data-res"] = package.loaded["data-res"] or true --- original size: 60821, stripped down to: 42503 +-- original size: 60857, stripped down to: 42496 if not modules then modules={} end modules ['data-res']={ version=1.001, @@ -12807,7 +12817,7 @@ local slash=P("/") local pathexpressionpattern=Cs ( Cc("^")*( Cc("%")*S(".-")+slash^2*P(-1)/"/.*" -+slash^2/"/[^/]*/*"+(1-slash)*P(-1)*Cc("/")+P(1) ++slash^2/"/"+(1-slash)*P(-1)*Cc("/")+P(1) )^1*Cc("$") ) local cache={} @@ -15403,7 +15413,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-lib"] = package.loaded["util-lib"] or true --- original size: 8911, stripped down to: 4216 +-- original size: 10762, stripped down to: 5269 if not modules then modules={} end modules ['util-lib']={ version=1.001, @@ -15418,6 +15428,7 @@ local findfile,findfiles=resolvers and resolvers.findfile,resolvers and resolver local loaded=package.loaded local report_swiglib=logs.reporter("swiglib") local trace_swiglib=false trackers.register("resolvers.swiglib",function(v) trace_swiglib=v end) +local done=false local function requireswiglib(required,version) local library=loaded[required] if library==nil then @@ -15426,32 +15437,48 @@ local function requireswiglib(required,version) local required_base=nameonly(required_full) local required_name=required_base.."."..os.libsuffix local version=type(version)=="string" and version~="" and version or false + local engine=environment.ownmain or false + if trace_swiglib and not done then + local list=resolvers.expandedpathlistfromvariable("lib") + for i=1,#list do + report_swiglib("tds path %i: %s",i,list[i]) + end + end + local function found(locate,asked_library,how,...) + if trace_swiglib then + report_swiglib("checking %s: %a",how,asked_library) + end + return locate(asked_library,...) + end local function check(locate,...) - local found_library=nil + local found=nil if version then local asked_library=joinfile(required_path,version,required_name) if trace_swiglib then report_swiglib("checking %s: %a","with version",asked_library) end - found_library=locate(asked_library,...) - if not found_library or found_library==""then - asked_library=joinfile(required_path,required_name) - if trace_swiglib then - report_swiglib("checking %s: %a","without version",asked_library) - end - found_library=locate(asked_library,...) - end - else + found=locate(asked_library,...) + end + if not found or found=="" then local asked_library=joinfile(required_path,required_name) if trace_swiglib then - report_swiglib("checking %s: %a","without version",asked_library) + report_swiglib("checking %s: %a","with version",asked_library) end - found_library=locate(asked_library,...) + found=locate(asked_library,...) end - return found_library and found_library~="" and found_library or false + return found and found~="" and found or false end - local found_library=findfile and check(findfile,"lib") - if findfiles and not found_library then + local function attempt(checkpattern) + if trace_swiglib then + report_swiglib("checking tds lib paths strictly") + end + local found=findfile and check(findfile,"lib") + if found and (not checkpattern or find(found,checkpattern)) then + return found + end + if trace_swiglib then + report_swiglib("checking tds lib paths with wildcard") + end local asked_library=joinfile(required_path,".*",required_name) if trace_swiglib then report_swiglib("checking %s: %a","latest version",asked_library) @@ -15459,18 +15486,38 @@ local function requireswiglib(required,version) local list=findfiles(asked_library,"lib",true) if list and #list>0 then table.sort(list) - found_library=list[#list] + local found=list[#list] + if found and (not checkpattern or find(found,checkpattern)) then + return found + end + end + if trace_swiglib then + report_swiglib("checking clib paths") end - end - if not found_library then package.extraclibpath(environment.ownpath) local paths=package.clibpaths() for i=1,#paths do - local found_library=check(lfs.isfile) - if found_library then - break + local found=check(lfs.isfile) + if found and (not checkpattern or find(found,checkpattern)) then + return found end end + return false + end + local found_library=nil + if engine then + if trace_swiglib then + report_swiglib("attemp 1, engine %a",engine) + end + found_library=attempt("/"..engine.."/") + if not found_library then + if trace_swiglib then + report_swiglib("attemp 2, no engine",asked_library) + end + found_library=attempt() + end + else + found_library=attempt() end if not found_library then if trace_swiglib then @@ -15773,8 +15820,8 @@ end -- of closure -- used libraries : l-lua.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 658276 --- stripped bytes : 241564 +-- original bytes : 660467 +-- stripped bytes : 242438 -- end library merge diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua index 311b70b2d..dfcf0a3e1 100644 --- a/tex/context/base/chem-str.lua +++ b/tex/context/base/chem-str.lua @@ -45,6 +45,7 @@ local P, R, S, C, Cs, Ct, Cc, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpe local variables = interfaces and interfaces.variables local context = context local formatters = string.formatters +local texcount = tex.count local v_default = variables.default local v_small = variables.small @@ -625,6 +626,7 @@ local function checked(d,factor,unit,scale) end local function calculated(height,bottom,top,factor,unit,scale) + local scaled = 0 if height == v_none then -- this always wins height = "0pt" @@ -654,22 +656,23 @@ local function calculated(height,bottom,top,factor,unit,scale) bottom = bottom * ratio top = top * ratio end + scaled = height top = topoints(top) bottom = topoints(bottom) height = topoints(height) end - return height, bottom, top + return height, bottom, top, scaled end function chemistry.start(settings) - chemistry.structures = chemistry.structures + 1 + -- + local width = settings.width or v_fit + local height = settings.height or v_fit local unit = settings.unit or 655360 local factor = settings.factor or 3 local rulethickness = settings.rulethickness or 65536 local rulecolor = settings.rulecolor or "" local axiscolor = settings.framecolor or "" - local width = settings.width or v_fit - local height = settings.height or v_fit local scale = settings.scale or "normal" local rotation = settings.rotation or 0 local offset = settings.offset or 0 @@ -678,8 +681,6 @@ function chemistry.start(settings) local top = settings.top or v_fit local bottom = settings.bottom or v_fit -- - metacode = { } - -- align = settings.symalign or "auto" if trace_structure then report_chemistry("unit %p, factor %s, symalign %s",unit,factor,align) @@ -709,11 +710,26 @@ function chemistry.start(settings) -- unit = scale * unit -- - width, left, right = calculated(width, left, right,factor,unit,scale) - height, bottom, top = calculated(height,bottom,top, factor,unit,scale) + local sp_width = 0 + local sp_height = 0 + -- + width, left, right, sp_width = calculated(width, left, right,factor,unit,scale) + height, bottom, top, sp_height = calculated(height,bottom,top, factor,unit,scale) + -- + if width ~= "true" and height ~= "true" and texcount["@@trialtypesetting"] ~= 0 then + if trace_structure then + report_chemistry("skipping trial run") + end + context.hrule(sp_width,sp_height,0) -- maybe depth + return + end + -- + chemistry.structures = chemistry.structures + 1 -- rotation = tonumber(rotation) or 0 -- + metacode = { } + -- if trace_structure then report_chemistry("%s scale %a, rotation %a, width %s, height %s, left %s, right %s, top %s, bottom %s","used",scale,rotation,width,height,left,right,top,bottom) end @@ -729,32 +745,36 @@ function chemistry.start(settings) end function chemistry.stop() - metacode[#metacode+1] = f_stop_structure - local mpcode = concat(metacode,"\n") - if trace_metapost then - report_chemistry("metapost code:\n%s", mpcode) - end - if metapost.instance(chemistry.instance) then - f_initialize = nil + if metacode then + metacode[#metacode+1] = f_stop_structure + local mpcode = concat(metacode,"\n") + if trace_metapost then + report_chemistry("metapost code:\n%s", mpcode) + end + if metapost.instance(chemistry.instance) then + f_initialize = nil + end + metapost.graphic { + instance = chemistry.instance, + format = chemistry.format, + data = mpcode, + definitions = f_initialize, + } + t_initialize = "" + metacode = nil end - metapost.graphic { - instance = chemistry.instance, - format = chemistry.format, - data = mpcode, - definitions = f_initialize, - } - t_initialize = "" - metacode = nil end function chemistry.component(spec,text,settings) - rulethickness, rulecolor, offset = settings.rulethickness, settings.rulecolor - local spec = settings_to_array_with_repeat(spec,true) -- no lower? - local text = settings_to_array_with_repeat(text,true) --- inspect(spec) - metacode[#metacode+1] = f_start_component - process(1,spec,text,1,rulethickness,rulecolor) -- offset? - metacode[#metacode+1] = f_stop_component + if metacode then + rulethickness, rulecolor, offset = settings.rulethickness, settings.rulecolor + local spec = settings_to_array_with_repeat(spec,true) -- no lower? + local text = settings_to_array_with_repeat(text,true) + -- inspect(spec) + metacode[#metacode+1] = f_start_component + process(1,spec,text,1,rulethickness,rulecolor) -- offset? + metacode[#metacode+1] = f_stop_component + end end statistics.register("chemical formulas", function() diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 530058fc9..85a3cf0a5 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,14 +11,14 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.04.07 14:05} +\newcontextversion{2013.04.08 17:52} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. \unprotect -\writestatus\m!system{beware: some patches loaded from cont-new.mkiv} +% \writestatus\m!system{beware: some patches loaded from cont-new.mkiv} % \attribute152\zerocount : marks ... lots of sweeps so best early in list diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 27388e1a0..916ff06be 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex a8a38184b..b32e53f50 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 224944aec..e11a57a4f 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.04.07 14:05} +\edef\contextversion{2013.04.08 17:52} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua index f7e238a11..32e19cf13 100644 --- a/tex/context/base/data-res.lua +++ b/tex/context/base/data-res.lua @@ -294,8 +294,9 @@ local pathexpressionpattern = Cs ( -- create lpeg instead (2013/2014) Cc("^") * ( Cc("%") * S(".-") + slash^2 * P(-1) / "/.*" --- + slash^2 / "/.-/" - + slash^2 / "/[^/]*/*" + -- + slash^2 / "/.-/" + -- + slash^2 / "/[^/]*/*" -- too general + + slash^2 / "/" + (1-slash) * P(-1) * Cc("/") + P(1) )^1 * Cc("$") -- yes or no $ diff --git a/tex/context/base/l-lua.lua b/tex/context/base/l-lua.lua index 538c65d7e..51816400e 100644 --- a/tex/context/base/l-lua.lua +++ b/tex/context/base/l-lua.lua @@ -356,7 +356,7 @@ end local function notloaded(name) if helpers.trace then - helpers.report("? unable to locate library '%s'",name) + helpers.report("unable to locate library '%s'",name) end end @@ -391,3 +391,14 @@ function helpers.loaded(name) end return notloaded(name) end + +function helpers.unload(name) + if helpers.trace then + if package.loaded[name] then + helpers.report("unloading library '%s', %s",name,"done") + else + helpers.report("unloading library '%s', %s",name,"not loaded") + end + end + package.loaded[name] = nil +end diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv index a172dc8ae..0d9d38e20 100644 --- a/tex/context/base/math-ali.mkiv +++ b/tex/context/base/math-ali.mkiv @@ -231,8 +231,16 @@ \let\align_text_normal_start\startalignment \let\align_text_normal_stop \stopalignment - \unexpanded\def\startalign{\ifmmode\expandafter\align_math_normal_start\else\expandafter\align_text_normal_start\fi} - \unexpanded\def\stopalign {\ifmmode\expandafter\align_math_normal_stop \else\expandafter\align_text_normal_stop \fi} + \unexpanded\def\startalign + {\ifmmode + \let\stopalign\align_math_normal_stop % cannot be an unexpanded def ... lookahead in align + \expandafter\align_math_normal_start + \else + \let\stopalign\align_text_normal_stop + \expandafter\align_text_normal_start + \fi} + + \let\stopalign\relax \let\startalignment\startalign \let\stopalignment \stopalign diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 23ddb60cc..f43bcdc4e 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 19f6e0668..f34d626b7 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua index cf9a4a0a6..59cfadbf2 100644 --- a/tex/context/base/tabl-xtb.lua +++ b/tex/context/base/tabl-xtb.lua @@ -59,6 +59,7 @@ local nodepool = nodes.pool local new_glue = nodepool.glue local new_kern = nodepool.kern local new_penalty = nodepool.penalty +local new_hlist = nodepool.hlist local v_stretch = variables.stretch local v_normal = variables.normal @@ -645,10 +646,13 @@ function xtables.construct() local list = drc.list if list then list.shift = list.height + list.depth - list = hpack_node_list(list) -- is somehow needed - list.width = 0 - list.height = 0 - list.depth = 0 +-- list = hpack_node_list(list) -- is somehow needed +-- list.width = 0 +-- list.height = 0 +-- list.depth = 0 +local h = new_hlist() +h.list = list +list = h if start then stop.next = list list.prev = stop diff --git a/tex/context/base/util-lib.lua b/tex/context/base/util-lib.lua index fde1f987e..601f2fb1d 100644 --- a/tex/context/base/util-lib.lua +++ b/tex/context/base/util-lib.lua @@ -65,6 +65,12 @@ or not using a wildcard lookup. This code is experimental and by providing a special abstract loader (called swiglib) we can start using the libraries. +A complication is that we might end up with a luajittex path matching before a +luatex path due to the path spec. One solution is to first check with the engine +prefixed. This could be prevented by a more strict lib pattern but that is not +always under our control. So, we first check for paths with engine in their name +and then without. + ]]-- -- seems to be clua in recent texlive @@ -81,6 +87,8 @@ local trace_swiglib = false trackers.register("resolvers.swiglib", function(v) -- We can check if there are more that one component, and if not, we can -- append 'core'. +local done = false + local function requireswiglib(required,version) local library = loaded[required] if library == nil then @@ -90,35 +98,55 @@ local function requireswiglib(required,version) local required_base = nameonly(required_full) local required_name = required_base .. "." .. os.libsuffix local version = type(version) == "string" and version ~= "" and version or false - -- helper + local engine = environment.ownmain or false + -- + if trace_swiglib and not done then + local list = resolvers.expandedpathlistfromvariable("lib") + for i=1,#list do + report_swiglib("tds path %i: %s",i,list[i]) + end + end + -- helpers + local function found(locate,asked_library,how,...) + if trace_swiglib then + report_swiglib("checking %s: %a",how,asked_library) + end + return locate(asked_library,...) + end local function check(locate,...) - local found_library = nil + local found = nil if version then local asked_library = joinfile(required_path,version,required_name) if trace_swiglib then report_swiglib("checking %s: %a","with version",asked_library) end - found_library = locate(asked_library,...) - if not found_library or found_library == ""then - asked_library = joinfile(required_path,required_name) - if trace_swiglib then - report_swiglib("checking %s: %a","without version",asked_library) - end - found_library = locate(asked_library,...) - end - else + found = locate(asked_library,...) + end + if not found or found == "" then local asked_library = joinfile(required_path,required_name) if trace_swiglib then - report_swiglib("checking %s: %a","without version",asked_library) + report_swiglib("checking %s: %a","with version",asked_library) end - found_library = locate(asked_library,...) + found = locate(asked_library,...) end - return found_library and found_library ~= "" and found_library or false + return found and found ~= "" and found or false end - -- check cnf spec using name and version - local found_library = findfile and check(findfile,"lib") - -- check cnf spec using wildcard - if findfiles and not found_library then + -- Alternatively we could first collect the locations and then do the two attempts + -- on this list but in practice this is not more efficient as we might have a fast + -- match anyway. + local function attempt(checkpattern) + -- check cnf spec using name and version + if trace_swiglib then + report_swiglib("checking tds lib paths strictly") + end + local found = findfile and check(findfile,"lib") + if found and (not checkpattern or find(found,checkpattern)) then + return found + end + -- check cnf spec using wildcard + if trace_swiglib then + report_swiglib("checking tds lib paths with wildcard") + end local asked_library = joinfile(required_path,".*",required_name) if trace_swiglib then report_swiglib("checking %s: %a","latest version",asked_library) @@ -126,19 +154,39 @@ local function requireswiglib(required,version) local list = findfiles(asked_library,"lib",true) if list and #list > 0 then table.sort(list) - found_library = list[#list] + local found = list[#list] + if found and (not checkpattern or find(found,checkpattern)) then + return found + end + end + -- Check clib paths using name and version. + if trace_swiglib then + report_swiglib("checking clib paths") end - end - -- check clib paths using name and version - if not found_library then package.extraclibpath(environment.ownpath) local paths = package.clibpaths() for i=1,#paths do - local found_library = check(lfs.isfile) - if found_library then - break + local found = check(lfs.isfile) + if found and (not checkpattern or find(found,checkpattern)) then + return found end end + return false + end + local found_library = nil + if engine then + if trace_swiglib then + report_swiglib("attemp 1, engine %a",engine) + end + found_library = attempt("/"..engine.."/") + if not found_library then + if trace_swiglib then + report_swiglib("attemp 2, no engine",asked_library) + end + found_library = attempt() + end + else + found_library = attempt() end -- load and initialize when found if not found_library then diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 2cb036df0..dff2d3975 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/07/13 14:05:24 +-- merge date : 04/08/13 17:52:17 do -- begin closure to overcome local limits and interference @@ -193,7 +193,7 @@ local function loadedbypath(name,rawname,paths,islib,what) end local function notloaded(name) if helpers.trace then - helpers.report("? unable to locate library '%s'",name) + helpers.report("unable to locate library '%s'",name) end end helpers.loadedaslib=loadedaslib @@ -224,6 +224,16 @@ function helpers.loaded(name) end return notloaded(name) end +function helpers.unload(name) + if helpers.trace then + if package.loaded[name] then + helpers.report("unloading library '%s', %s",name,"done") + else + helpers.report("unloading library '%s', %s",name,"not loaded") + end + end + package.loaded[name]=nil +end end -- closure |