diff options
Diffstat (limited to 'tex/context/base')
-rw-r--r-- | tex/context/base/attr-lay.lua | 1 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 119 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4381 -> 4388 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/math-frc.lua | 8 | ||||
-rw-r--r-- | tex/context/base/math-frc.mkiv | 94 | ||||
-rw-r--r-- | tex/context/base/math-ini.mkiv | 14 | ||||
-rw-r--r-- | tex/context/base/math-rad.mkvi | 2 | ||||
-rw-r--r-- | tex/context/base/mult-def.mkiv | 3 | ||||
-rw-r--r-- | tex/context/base/node-fin.lua | 40 | ||||
-rw-r--r-- | tex/context/base/page-sid.mkiv | 36 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24741 -> 24694 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 333450 -> 333462 bytes | |||
-rw-r--r-- | tex/context/base/util-sta.lua | 22 |
14 files changed, 278 insertions, 63 deletions
diff --git a/tex/context/base/attr-lay.lua b/tex/context/base/attr-lay.lua index 176af1a2c..e7d532237 100644 --- a/tex/context/base/attr-lay.lua +++ b/tex/context/base/attr-lay.lua @@ -80,6 +80,7 @@ local layerstacker = utilities.stacker.new("layers") -- experiment layerstacker.mode = "stack" layerstacker.unset = attributes.unsetvalue +viewerlayers.resolve_reset = layerstacker.resolve_reset viewerlayers.resolve_begin = layerstacker.resolve_begin viewerlayers.resolve_step = layerstacker.resolve_step viewerlayers.resolve_end = layerstacker.resolve_end diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 7700bfe92..c58ec05bd 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.10.06 14:31} +\newcontextversion{2014.10.07 11:14} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. @@ -32,6 +32,123 @@ % \inheritmaintextcolor % \to \everymargindatacontent +% This is experimental; if this changes we need to adapt the mb-mp +% style too. It's not in the core yet. + +% \def\ActionY{\blank\analyzenofparlines{\inleftmargin{\analyzednofparlines}}} +% \def\ActionN{\analyzenofparlines{\inleftmargin{\analyzednofparlines}}} +% +% \saveparnumber\ifnum\nofparlines<2 \ActionY\else\ActionN\fi 1.1 nop \crlf +% 1.2 nop \par +% \saveparnumber\ifnum\nofparlines<2 \ActionY\else\ActionN\fi 2.1 nop \par +% \saveparnumber\ifnum\nofparlines<2 \ActionY\else\ActionN\fi 3.1 yes \crlf +% 3.2 nop \crlf +% 3.3 nop \par +% \saveparnumber\ifnum\nofparlines<2 \ActionY\else\ActionN\fi 4.1 nop \crlf +% 4.2 nop \par +% \saveparnumber\ifnum\nofparlines<2 \ActionY\else\ActionN\fi 5.1 nop \par +% \saveparnumber\ifnum\nofparlines<2 \ActionY\else\ActionN\fi 6.1 yes \par +% +% \saveparnumber\doifelselessparlines {2}\ActionY\ActionN 1.1 nop \crlf +% 1.2 nop \par +% \saveparnumber\doifelselessparlines {2}\ActionY\ActionN 2.1 nop \par +% \saveparnumber\doifelselessparlines {2}\ActionY\ActionN 3.1 yes \crlf +% 3.2 nop \crlf +% 3.3 nop \par +% \saveparnumber\doifelselessparlines {2}\ActionY\ActionN 4.1 nop \crlf +% 4.2 nop \par +% \saveparnumber\doifelselessparlines {2}\ActionY\ActionN 5.1 nop \par +% \saveparnumber\doifelselessparlines {2}\ActionY\ActionN 6.1 yes \par + +\newcount \c_typo_par_current +\newcount \c_typo_par_saved +\newconstant\c_typo_par_state +\newconstant\c_typo_par_lines +\newconstant\c_typo_par_criterium + +\appendtoks + \advance\c_typo_par_current\plusone % local +\to \everypar + +\unexpanded\def\saveparnumber + {\c_typo_par_saved\tagparcounter} % local + +\def\savedparnumber {\number\c_typo_par_saved} +\def\currentparnumber{\number\c_typo_par_current} + +\unexpanded\def\nofparlines + {\numexpr + \ifhmode + \maxdimen + \else\ifnum\c_typo_par_current=\c_typo_par_current + % we have not yet started a new one + \prevgraf + \else\ifnum\c_typo_par_current>\c_typo_par_current + % we are somewhere in the future + \maxdimen + \else + \zerocount + \fi\fi\fi + \relax} + +\unexpanded\def\setnofparlinesstate + {\c_typo_par_state\numexpr + \ifhmode + \zerocount + \else\ifnum\c_typo_par_current=\c_typo_par_current + % we have not yet started a new one + \plusone + \else\ifnum\c_typo_par_current>\c_typo_par_current + % we are somewhere in the future + \plustwo + \else + \plusthree + \fi\fi\fi + \relax} + +\unexpanded\def\shownofparlines + {\dontleavehmode\hbox\bgroup + \infofont + [% + \number\c_typo_par_current:\number\c_typo_par_current:\space + \ifcase\c_typo_par_state + unknown% + \or + \ifnum\c_typo_par_lines<\c_typo_par_criterium + \darkred + \number\c_typo_par_lines<\number\c_typo_par_criterium + \else + \darkgreen + \number\c_typo_par_lines>=\number\c_typo_par_criterium + \fi + \or + ahead% + \else + behind% + \fi + ]% + \egroup} + +\unexpanded\def\doifelselessparlines#1% + {\c_typo_par_criterium#1\relax + \c_typo_par_lines\prevgraf + \setnofparlinesstate + \ifnum\nofparlines<#1\relax + \expandafter\firstoftwoarguments + \else + \expandafter\secondoftwoarguments + \fi} + +\unexpanded\def\doiflessparlines#1% + {\c_typo_par_criterium#1\relax + \c_typo_par_lines\prevgraf + \setnofparlinesstate + \ifnum\nofparlines<#1\relax + \expandafter\firstofoneargument + \else + \expandafter\gobbleoneargument + \fi} + %D Maybe: \unexpanded\def\tightvbox{\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox} diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 8a8d11cdd..68d39a739 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index cc0df1ac5..08aaa01c0 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.10.06 14:31} +\edef\contextversion{2014.10.07 11:14} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/math-frc.lua b/tex/context/base/math-frc.lua index 4f531a530..a663fb3ec 100644 --- a/tex/context/base/math-frc.lua +++ b/tex/context/base/math-frc.lua @@ -25,13 +25,13 @@ table.setmetatableindex(resolved, function(t,k) return v end) -local normalatop = context.normalatop -local normalover = context.normalover +local ctx_normalatop = context.normalatop +local ctx_normalover = context.normalover function commands.math_frac(how,left,right,width) if how == v_no then if left == 0x002E and right == 0x002E then - normalatop() + ctx_normalatop() else context("\\atopwithdelims%s%s",resolved[left],resolved[right]) end @@ -43,7 +43,7 @@ function commands.math_frac(how,left,right,width) end else -- v_auto if left == 0x002E and right == 0x002E then - normalover() + ctx_normalover() else context("\\overwithdelims%s%s",resolved[left],resolved[right]) end diff --git a/tex/context/base/math-frc.mkiv b/tex/context/base/math-frc.mkiv index 7032c665b..4e5a35b29 100644 --- a/tex/context/base/math-frc.mkiv +++ b/tex/context/base/math-frc.mkiv @@ -201,24 +201,6 @@ \expandafter\math_fraction_inner_margin \fi} -\def\math_fraction_inner_normal#1#2% - {\Ustack{% - {\usemathstyleparameter\mathfractionparameter{#1}}% we should store this one - \math_frac_command - {\usemathstyleparameter\mathfractionparameter{#2}}% and reuse it here - }\endgroup} - -\def\math_fraction_inner_margin#1#2% - {\Ustack{% - {\kern\d_math_fraction_margin - \usemathstyleparameter\mathfractionparameter{#1}% we should store this one - \kern\d_math_fraction_margin}% - \math_frac_command - {\kern\d_math_fraction_margin - \usemathstyleparameter\mathfractionparameter{#2}% and reuse it here - \kern\d_math_fraction_margin}% - }\endgroup} - \setvalue{\??mathfractionalternative\v!outer}% {\ifcase\d_math_fraction_margin \expandafter\math_fraction_outer_normal @@ -226,21 +208,62 @@ \expandafter\math_fraction_outer_margin \fi} +\setvalue{\??mathfractionalternative\v!both}% + {\ifcase\d_math_fraction_margin + \expandafter\math_fraction_both_normal + \else + \expandafter\math_fraction_both_margin + \fi} + +% todo: store first state and reuse second time + +\def\math_fraction_inner_normal#1#2% + {\Ustack{% + {\usemathstyleparameter\mathfractionparameter{#1}}\math_frac_command{\usemathstyleparameter\mathfractionparameter{#2}}% + }\endgroup} + \def\math_fraction_outer_normal#1#2% {\Ustack{% \usemathstyleparameter\mathfractionparameter - {{#1}\math_frac_command{#2}}% + {% + {#1}\math_frac_command{#2}% + }% + }\endgroup} + +\def\math_fraction_both_normal#1#2% + {\Ustack{% + \usemathstyleparameter\mathfractionparameter + {% + \usemathstyleparameter\mathfractionparameter{#1}\math_frac_command{\usemathstyleparameter\mathfractionparameter#2}% + }% + }\endgroup} + +\def\math_fraction_inner_margin#1#2% + {\Ustack{% + {\kern\d_math_fraction_margin\usemathstyleparameter\mathfractionparameter{#1}\kern\d_math_fraction_margin}% + \math_frac_command + {\kern\d_math_fraction_margin\usemathstyleparameter\mathfractionparameter{#2}\kern\d_math_fraction_margin}% }\endgroup} \def\math_fraction_outer_margin#1#2% {\Ustack{% \usemathstyleparameter\mathfractionparameter - {{\kern\d_math_fraction_margin#1\kern\d_math_fraction_margin}% + {% + {\kern\d_math_fraction_margin#1\kern\d_math_fraction_margin}% \math_frac_command - {\kern\d_math_fraction_margin#2\kern\d_math_fraction_margin}}% + {\kern\d_math_fraction_margin#2\kern\d_math_fraction_margin}% + }% }\endgroup} -\definemathfraction[frac][\c!mathstyle=] +\def\math_fraction_both_margin#1#2% + {\Ustack{% + \usemathstyleparameter\mathfractionparameter + {% + {\kern\d_math_fraction_margin\usemathstyleparameter\mathfractionparameter#1\kern\d_math_fraction_margin}% + \math_frac_command + {\kern\d_math_fraction_margin\usemathstyleparameter\mathfractionparameter#2\kern\d_math_fraction_margin}% + }% + }\endgroup} \unexpanded\def\xfrac {\begingroup\let\xfrac\xxfrac\math_frac_alternative\scriptstyle} \unexpanded\def\xxfrac{\begingroup \math_frac_alternative\scriptscriptstyle} @@ -277,9 +300,30 @@ % \unexpanded\def\dfrac #1#2{{\displaystyle {{#1}\normalover {#2}}}} % \unexpanded\def\tfrac #1#2{{\textstyle {{#1}\normalover {#2}}}} -\definemathfraction[dfrac][\c!alternative=\v!outer,\c!mathstyle=\s!display] -\definemathfraction[tfrac][\c!alternative=\v!outer,\c!mathstyle=\s!text] -\definemathfraction[sfrac][\c!alternative=\v!outer,\c!mathstyle=\s!script] +% \definemathfraction[frac] [\c!mathstyle=] +% \definemathfraction[dfrac][\c!alternative=\v!outer,\c!mathstyle=\s!display] +% \definemathfraction[tfrac][\c!alternative=\v!outer,\c!mathstyle=\s!text] +% \definemathfraction[sfrac][\c!alternative=\v!outer,\c!mathstyle=\s!script] + +% \definemathfraction[frac] [\c!alternative=\v!inner, \c!mathstyle=\inlineordisplaymath\s!script {\s!cramped,\s!text}] +% \definemathfraction[tfrac][\c!alternative=\inlineordisplaymath\v!inner\v!both,\c!mathstyle=\inlineordisplaymath\s!script {\s!cramped,\s!script}] +% \definemathfraction[sfrac][\c!alternative=\inlineordisplaymath\v!inner\v!both,\c!mathstyle=\inlineordisplaymath\s!scriptscript{\s!cramped,\s!scriptscript}] +% \definemathfraction[dfrac][\c!alternative=\v!inner, \c!mathstyle=\s!display] + +\definemathfraction[i:frac] [\c!alternative=\v!inner,\c!mathstyle=\s!script] +\definemathfraction[i:tfrac][\c!alternative=\v!inner,\c!mathstyle=\s!script] +\definemathfraction[i:sfrac][\c!alternative=\v!inner,\c!mathstyle=\s!scriptscript] +\definemathfraction[i:dfrac][\c!alternative=\v!inner,\c!mathstyle=\s!display] + +\definemathfraction[d:frac] [\c!alternative=\v!inner,\c!mathstyle={\s!cramped,\s!text}] +\definemathfraction[d:tfrac][\c!alternative=\v!both ,\c!mathstyle={\s!cramped,\s!script}] +\definemathfraction[d:sfrac][\c!alternative=\v!both ,\c!mathstyle={\s!cramped,\s!scriptscript}] +\definemathfraction[d:dfrac][\c!alternative=\v!inner,\c!mathstyle=\s!display] + +\unexpanded\def\frac {\csname\inlineordisplaymath id:frac\endcsname} +\unexpanded\def\tfrac{\csname\inlineordisplaymath id:tfrac\endcsname} +\unexpanded\def\sfrac{\csname\inlineordisplaymath id:sfrac\endcsname} +\unexpanded\def\dfrac{\csname\inlineordisplaymath id:dfrac\endcsname} % \definemathfraction[ddfrac][\c!mathstyle=\s!display] % \definemathfraction[ttfrac][\c!mathstyle=\s!text] diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index fd170d29f..070b8d246 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -91,6 +91,20 @@ \unexpanded\def\resetmathattributes{\ctxcommand{resetmathattributes()}} +% handy + +\newconditional\indisplaymath + +\appendtoks + \setfalse\indisplaymath +\to \everymath + +\appendtoks + \settrue\indisplaymath +\to \everydisplay + +\def\inlineordisplaymath{\ifconditional\indisplaymath\expandafter\secondoftwoarguments\else\expandafter\firstoftwoarguments\fi} + % \unexpanded\def\rawmathcharacter#1% slow but only for tracing % {\begingroup % \ifmmode diff --git a/tex/context/base/math-rad.mkvi b/tex/context/base/math-rad.mkvi index f22d62374..2115ab9a4 100644 --- a/tex/context/base/math-rad.mkvi +++ b/tex/context/base/math-rad.mkvi @@ -30,7 +30,7 @@ \unexpanded\def\sqrt{\doifnextoptionalcselse\rootwithdegree\rootwithoutdegree} -\def\styledrootradical#1#2% so that \text works ok ... \rootradical behaves somewhat weird +\unexpanded\def\styledrootradical#1#2% so that \text works ok ... \rootradical behaves somewhat weird {\normalexpanded{\rootradical{\normalunexpanded{#1}}{\noexpand\triggermathstyle{\normalmathstyle}\normalunexpanded{#2}}}} \unexpanded\def\rootwithdegree[#1]{\rootradical{#1}} diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv index 30a21d377..055f72dc9 100644 --- a/tex/context/base/mult-def.mkiv +++ b/tex/context/base/mult-def.mkiv @@ -45,6 +45,9 @@ \def\c!keeptogether {keeptogether} \def\c!viewerprefix {viewerprefix} +\def\v!display {display} +\def\v!inline {inline} + \def\c!dataset {dataset} \def\c!sectionblock {sectionblock} \def\c!language {language} diff --git a/tex/context/base/node-fin.lua b/tex/context/base/node-fin.lua index bb3800615..1566e099f 100644 --- a/tex/context/base/node-fin.lua +++ b/tex/context/base/node-fin.lua @@ -128,7 +128,7 @@ end local nsdata, nsnone, nslistwise, nsforced, nsselector, nstrigger local current, current_selector, done = 0, 0, false -- nb, stack has a local current ! -local nsbegin, nsend +local nsbegin, nsend, nsreset function states.initialize(namespace,attribute,head) nsdata = namespace.data @@ -142,6 +142,7 @@ function states.initialize(namespace,attribute,head) done = false -- todo: done cleanup nsstep = namespace.resolve_step if nsstep then + nsreset = namespace.resolve_reset nsbegin = namespace.resolve_begin nsend = namespace.resolve_end nspush = namespace.push @@ -483,14 +484,17 @@ end -- experimental local function stacker(namespace,attribute,head,default) -- no triggering, no inheritance, but list-wise - nsbegin() + +-- nsbegin() + local stacked = false + local current = head local previous = head local done = false - local okay = false local attrib = default or unsetvalue local check = false local leader = false + while current do local id = getid(current) if id == glyph_code then @@ -507,6 +511,10 @@ local function stacker(namespace,attribute,head,default) -- no triggering, no in elseif nslistwise then local a = getattr(current,attribute) if a and attrib ~= a and nslistwise[a] then -- viewerlayer +-- if not stacked then +-- stacked = true +-- nsbegin() +-- end head = insert_node_before(head,current,copied(nsdata[a])) local list = stacker(namespace,attribute,content,a) setfield(current,"list",list) @@ -529,13 +537,15 @@ local function stacker(namespace,attribute,head,default) -- no triggering, no in if check then local a = getattr(current,attribute) or unsetvalue if a ~= attrib then +if not stacked then + stacked = true + nsbegin() +end local n = nsstep(a) if n then - -- !!!! TEST CODE !!!! - -- head = insert_node_before(head,current,copied(nsdata[tonumber(n)])) -- a head = insert_node_before(head,current,tonut(n)) -- a end - attrib, done, okay = a, true, true + attrib, done = a, true if leader then -- tricky as a leader has to be a list so we cannot inject before local list, ok = stacker(namespace,attribute,leader,attrib) @@ -549,19 +559,23 @@ local function stacker(namespace,attribute,head,default) -- no triggering, no in previous = current current = getnext(current) end - if okay then - local n = nsend() - if n then - -- !!!! TEST CODE !!!! - -- head = insert_node_after(head,previous,copied(nsdata[tostring(n)])) - head = insert_node_after(head,previous,tonut(n)) - end + +if stacked then + + local n = nsend() + while n do + head = insert_node_after(head,previous,tonut(n)) + n = nsend() end + +end + return head, done end states.stacker = function(namespace,attribute,head,default) local head, done = stacker(namespace,attribute,tonut(head),default) + nsreset() return tonode(head), done end diff --git a/tex/context/base/page-sid.mkiv b/tex/context/base/page-sid.mkiv index c85565703..4760ca2f6 100644 --- a/tex/context/base/page-sid.mkiv +++ b/tex/context/base/page-sid.mkiv @@ -15,21 +15,18 @@ \unprotect -% These macro deal with side floats. We started with Daniel -% Comenetz macros as published in TUGBoat Volume 14 (1993), -% No.\ 1: Anchored Figures at Either Margin. I extended and -% patched the macros to suite our needs which results in a -% messy module. Therefore, this module badly needs an update -% because it's now a mixture of old and new macros. +% These macro deal with side floats. We started with Daniel Comenetz macros as published +% in TUGBoat Volume 14 (1993), No.\ 1: Anchored Figures at Either Margin. I extended and +% patched the macros to suite our needs which results in a messy module. Therefore, this +% module badly needs an update because it's now a mixture of old and new macros. % Interesting cases where it goes wrong: % % \placefigure[left]{}{} \dorecurse{3}{\input ward } {\par} \input ward % -% Here we get an unwanted carried over hangindent and parindent. A -% solution is to associate it with the local par node instead. This -% is something to discuss with Taco as it could be a new luatex -% feature: explicitly set par properties. +% Here we get an unwanted carried over hangindent and parindent. A solution is to associate +% it with the local par node instead. This is something to discuss with Taco as it could be +% a new luatex/mkiv feature: explicitly set par properties. % Maybe I should just rewrite the lot. @@ -223,11 +220,26 @@ \endgroup \ifdim\parskip>\zeropoint % why this test ? \ifdim\d_page_sides_bottomskip>\parskip - \nowhitespace - \vskip\d_page_sides_bottomskip + % \nowhitespace + % \vskip\d_page_sides_bottomskip + \blank[\v!nowhite,\the\dimexpr\d_page_sides_bottomskip] \fi + \else + \blank[\the\d_page_sides_bottomskip]% new, so needs checking \fi} +% alternative method (unsnapped) +% +% \def\page_sides_flush_floats_indeed +% {\scratchdimen\dimexpr\d_page_sides_vsize-\d_page_sides_bottomskip-\pagetotal\relax +% \ifdim\parskip>\zeropoint % why this test ? +% \ifdim\scratchdimen>\parskip +% \blank[\v!nowhite,\the\scratchdimen] % better in stages +% \fi +% \else +% \blank[\the\scratchdimen] +% \fi} + \def\page_sides_check_floats_after_par {\page_sides_check_floats_indeed \ifdim\oldpagetotal=\pagetotal \else diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex b2dd4be34..f4d86b843 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 30c0a9f46..9ee869ef6 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/util-sta.lua b/tex/context/base/util-sta.lua index 1a61ec4e6..27ab5a624 100644 --- a/tex/context/base/util-sta.lua +++ b/tex/context/base/util-sta.lua @@ -81,6 +81,8 @@ end function stacker.new(name) + local report = logs.reporter("stacker",name or nil) + local s local stack = { } @@ -126,8 +128,18 @@ function stacker.new(name) end end - local tops = { } - local top, switch + local tops = { } + local top = nil + local switch = nil + + local function resolve_reset(mode) + if #tops > 0 then + report("resetting %s left-over states of %a",#tops,name) + end + tops = { } + top = nil + switch = nil + end local function resolve_begin(mode) if mode then @@ -206,8 +218,7 @@ function stacker.new(name) local function resolve_end() -- resolve_step(s.unset) - local noftop = #top - if noftop > 0 then + if #tops > 0 then -- was #top brrr local result = s.stop(s,top,1,#top) remove(tops) top = tops[#tops] @@ -224,8 +235,6 @@ function stacker.new(name) resolve_end() end - local report = logs.reporter("stacker",name or nil) - s = { name = name or "unknown", unset = -1, @@ -240,6 +249,7 @@ function stacker.new(name) resolve_begin = resolve_begin, resolve_step = resolve_step, resolve_end = resolve_end, + resolve_reset = resolve_reset, } return s -- we can overload functions |