diff options
Diffstat (limited to 'Master/texmf-dist/dvips/pstricks/pst-algparser.pro')
-rw-r--r-- | Master/texmf-dist/dvips/pstricks/pst-algparser.pro | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/Master/texmf-dist/dvips/pstricks/pst-algparser.pro b/Master/texmf-dist/dvips/pstricks/pst-algparser.pro index c9009a9f623..1d5fb04c661 100644 --- a/Master/texmf-dist/dvips/pstricks/pst-algparser.pro +++ b/Master/texmf-dist/dvips/pstricks/pst-algparser.pro @@ -1,7 +1,7 @@ -% $Id: pst-algparser.pro 532 2011-07-09 13:02:57Z herbert $ +% $Id: pst-algparser.pro 594 2011-10-31 18:13:18Z herbert $ %% %% PostScript prologue for PSTricks algorithm parser -%% Version 0.03, 2011/06/03 +%% Version 0.04, 2011/10/21 %% %% This program can be redistributed and/or modified under the terms %% of the LaTeX Project Public License Distributed from CTAN archives @@ -13,11 +13,14 @@ % /tx@CoreAnalyzerDict 100 dict def tx@CoreAnalyzerDict begin % -% PS ANALYZER FOR ALGEBRAIC EXPRESSION V1.12 +% PS ANALYZER FOR ALGEBRAIC EXPRESSION V1.13 +% +% 09/2011 DR factorial with ! added +% % E->T|E+T % T->FS|T*FS % FS -> F | +FS | -FS -% F->P|F^SF +% F->P|F^SF|P! % P->(E)|literal % literal->number|var|var[E]|func(params) % params->E|E,param @@ -82,12 +85,16 @@ ifelse AnalyzePostHook } def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% F->P|F^P +%% F->P|F^P|P! %% STR index /AnalyzeFactor { AnalyzePreHook AnalyzePower IsEndingFactor { dup 0 ne { 32 eq { NextNonBlankChar } if } { pop } ifelse } - { { RollOp 1 add NextNonBlankChar pop AnalyzePower PreEvalHook EvalPower IsEndingFactor { pop exit } if} loop } + { { dup 33 eq%% is there a ! DR 09/2011 + { pop 1 add NextNonBlankChar pop EvalFactorial } + { RollOp 1 add NextNonBlankChar pop AnalyzePower PreEvalHook EvalPower } + ifelse + IsEndingFactor { pop exit } if } loop } ifelse AnalyzePostHook } def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -227,6 +234,10 @@ end /ExpressionVector ExpressionVector aload length dup 5 add -1 roll pop /exp cvx exch 1 add array astore def } def +/EvalFactorial {% DR 09/2011 + /ExpressionVector ExpressionVector aload length + /fact cvx exch 1 add array astore def +} def /EvalLiteral {% ReadLiteral dup 40 eq%%% there is an open par -> function call @@ -492,6 +503,13 @@ end %tx@CoreAnalyzerDict mark 11 -5 roll cleartomark 2 index 6 index dup 4 index exch sub getinterval exch 6 2 roll } def %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% No derivative for factorial ! only cst => null derivative +/EvalFactorial {% DR 09/2011 + 4 index (0) eq + { (0) mark 8 -2 roll cleartomark 2 index 7 index dup 4 index exch sub getinterval exch 6 2 roll } + { DERIVATIVE_ENGINE_ERROR_no_variable_in_factorial } ifelse +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% str -> true/false /IsStrNumber {% true exch @@ -507,7 +525,7 @@ end %tx@CoreAnalyzerDict ReadLiteral dup 40 eq%%% there is an open par -> function call { pop (EvalFunc_ ) 9 4 index StrConcat 0 exch getinterval cvn cvx exec } { dup 91 eq%%% there is an open bracket -> vector element - { ERROR_vector_not_yet_implemented } + { DERIVATIVE_ENGINE_ERROR_vector_not_yet_implemented } { pop EvalVariable } ifelse } ifelse @@ -567,7 +585,7 @@ end %tx@CoreAnalyzerDict { dup 0 eq { (1) StrConcat } { 1 sub } ifelse (/\(2*sqrt\() StrConcat 5 index StrConcat (\)\)) StrConcat } if PostCommonFunc } def /EvalFunc_Fact {% - PreCommonFunc { ERROR_no_variable_expression_in_Fact } if + PreCommonFunc { DERIVATIVE_ENGINE_ERROR_no_variable_expression_in_Fact } if PostCommonFunc } def /EvalFunc_sh {% PreCommonFunc |