-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor doc corrections and adding a luamcallbacks.get_priority function
- Loading branch information
Showing
1 changed file
with
35 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,12 +23,14 @@ | |
\input docstrip.tex | ||
\Msg{************************************************************************} | ||
\Msg{* Installation} | ||
\Msg{* Package: luamcallbacks 2009/02/26 v0.9 LuaTeX multiple callbacks package} | ||
\Msg{* Package: luamcallbacks 2009/03/10 v0.91 LuaTeX multiple callbacks package} | ||
\Msg{************************************************************************} | ||
|
||
\keepsilent | ||
\askforoverwritefalse | ||
|
||
\let\MetaPrefix\relax | ||
|
||
\preamble | ||
This is a generated file. | ||
|
||
|
@@ -43,6 +45,8 @@ and the derived files | |
|
||
\endpreamble | ||
|
||
\let\MetaPrefix\DoubleperCent | ||
|
||
\generate{% | ||
\file{luamcallbacks.drv}{\from{luamcallbacks.dtx}{driver}}% | ||
\usedir{doc/luatex/luamcallbacks}% | ||
|
@@ -53,21 +57,6 @@ and the derived files | |
|
||
\def\MetaPrefix{-- } | ||
|
||
% we have to redefine the preamble to get the good comments. | ||
|
||
\preamble | ||
This is a generated file. | ||
|
||
Copyright (C) 2009 by Elie Roux <[email protected]> | ||
|
||
This work is under the CC0 license. | ||
|
||
This work consists of the main source file luamcallbacks.dtx | ||
and the derived files | ||
luamcallbacks.lua luamcallbacks.drv, luamcallbacks-test.tex, | ||
luamcallbacks.pdf. | ||
\endpreamble | ||
|
||
\def\luapostamble{% | ||
\MetaPrefix^^J% | ||
\MetaPrefix\space End of File `\outFileName'.% | ||
|
@@ -98,7 +87,7 @@ and the derived files | |
%<driver> | ||
%<driver>\NeedsTeXFormat{LaTeX2e} | ||
%<driver>\ProvidesPackage{luamcallbacks.sty} | ||
%<driver> [2009/02/26 v0.9 LuaTeX multiple callbacks package] | ||
%<driver> [2009/03/10 v0.91 LuaTeX multiple callbacks package] | ||
%<driver> | ||
% \fi | ||
%<*driver> | ||
|
@@ -132,7 +121,7 @@ and the derived files | |
% \GetFileInfo{luamcallbacks.drv} | ||
% | ||
% \title{The \textsf{luamcallbacks} package} | ||
% \date{2009/02/26 v0.9} | ||
% \date{2009/03/10 v0.91} | ||
% \author{Elie Roux \\ \texttt{[email protected]}} | ||
% | ||
% \maketitle | ||
|
@@ -152,7 +141,7 @@ and the derived files | |
% | ||
%The functions are called in a certain order, and when a package registers a callback it can assign a priority to its function. Conflicts can still remain even with the priority mechanism, for example in the case where two packages want to have the highest priority. In these cases the packages have to solve the conflicts themselves. | ||
% | ||
% This package contains only a \texttt{.lua} file, that can be called by another lua script. For example, this script is called in \textsc{luatextra}. | ||
% This package contains only a \texttt{.lua} file, that can be called by another lua script. For example, this script is called in \textsf{luatextra}. | ||
% | ||
%\subsubsection{Limitations} | ||
% | ||
|
@@ -181,8 +170,8 @@ luamcallbacks = { } | |
|
||
luamcallbacks.module = { | ||
name = "luamcallbacks", | ||
version = 0.9, | ||
date = "2009/03/06", | ||
version = 0.91, | ||
date = "2009/03/10", | ||
description = "Module to register several functions in a callback.", | ||
author = "Hans Hagen & Elie Roux", | ||
copyright = "Hans Hagen & Elie Roux", | ||
|
@@ -322,7 +311,6 @@ function luamcallbacks.add (name,func,description,priority) | |
name)) | ||
return | ||
end | ||
|
||
if not description or description == "" then | ||
luamcallbacks.error( | ||
format("unable to add function to '%s', no proper description passed", | ||
|
@@ -365,6 +353,30 @@ function luamcallbacks.add (name,func,description,priority) | |
description,priority,name)) | ||
end | ||
|
||
% \end{macrocode} | ||
% | ||
% \end{macro} | ||
% | ||
% \begin{macro}{luamcallbacks.get priority} | ||
% | ||
% This function tells if a function has already been registered in a callback, and gives its current priority. The arguments are the name of the callback and the description of the function. If it has already been registered, it gives its priority, and if not it returns false. | ||
% | ||
% \begin{macrocode} | ||
|
||
function luamcallbacks.get_priority (name, description) | ||
if not name or name == "" or not callbacktypes[name] or not description then | ||
return false | ||
end | ||
local l = luamcallbacks.callbacklist[name] | ||
if not l then return false end | ||
for p, f in pairs(l) do | ||
if f.description == description then | ||
return p | ||
end | ||
end | ||
return false | ||
end | ||
|
||
% \end{macrocode} | ||
% | ||
% \end{macro} | ||
|
@@ -558,6 +570,7 @@ end | |
callback.add = luamcallbacks.add | ||
callback.remove = luamcallbacks.remove | ||
callback.reset = luamcallbacks.reset | ||
callback.get_priority = luamcallbacks.get_priority | ||
|
||
callback.register = function (...) | ||
luamcallbacks.error("function callback.register has been deleted by luamcallbacks, please use callback.add instead.") | ||
|