diff options
author | Karl Berry <karl@freefriends.org> | 2008-01-25 00:33:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-01-25 00:33:24 +0000 |
commit | 7b47a6fc77ad486993f61d5ecdcd884a64f331da (patch) | |
tree | 0c29e5a6adc88fe23713e5e1dfd2fcbe7be0f3e5 /Master/texmf-dist/dvips | |
parent | fb100c8d5700c5ed13acd4bcf77f59447de8a8f3 (diff) |
pstricks 0.36 (23jan08)
git-svn-id: svn://tug.org/texlive/trunk@6393 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/dvips')
-rw-r--r-- | Master/texmf-dist/dvips/pstricks/Changes | 29 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pstricks/pst-algparser.pro | 739 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pstricks/pst-dots.pro | 5 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pstricks/pst-node.pro | 92 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pstricks/pstricks.pro | 260 |
5 files changed, 1027 insertions, 98 deletions
diff --git a/Master/texmf-dist/dvips/pstricks/Changes b/Master/texmf-dist/dvips/pstricks/Changes index 2974ffd99ce..d57551e998c 100644 --- a/Master/texmf-dist/dvips/pstricks/Changes +++ b/Master/texmf-dist/dvips/pstricks/Changes @@ -1,16 +1,29 @@ ---- pstricks.pro +1.02 2008-01-01 - added the arrowtype D>, sides as curves (ArrowD) + - added the whole algebraic parser stuff + - added function tan := sin cos div + - added function Tan := sin cos Div + - added Pyth2 for 2 points given by xA yA xB yB + - change variable names from x,y to xOrig, yOrig for + EllipticArcArrow + - move font setting for \psgrid into pstricks.tex 1.01 2006-01-11 (vg) fix a bug with ArcAdjust when both angles ares negative - (hv) add Sqrt sunction -1.00 2005-09-19 (hv) move the code for arcs of an ellipse from + add Sqrt sunction +1.00 2005-09-19 move the code for arcs of an ellipse from the main pstricks.tex into this pro -97, patch 7 2005-09-11 (hv) added new fillstyles -97, patch 6 2005-05-17 (hv) added some helper stuff - RadtoDeg, DegtoRad, Pi, TwoPi, ATAN -97, patch 5 2005-03-08 (hv) bugfix for DashLine +97, patch 7 2005-09-11 added new fillstyles +97, patch 6 2005-05-17 added some helper stuff + RadtoDeg, DegtoRad, Pi, TwoPi, ATAN +97, patch 5 2005-03-08 bugfix for DashLine ----- pst-text.pro -1.00 2005-11-29 (hv) add a patch for japanese text +---- pst-node.pro +1.00 2008-01-01 code formatting (hv) + ---- pst-dots.pro 2.00 2006-12-19 add more dot symbols from Etienne Riga (hv) + + +---- pst-alpparser.pro +0.01 2008-01-01 initial version (hv) diff --git a/Master/texmf-dist/dvips/pstricks/pst-algparser.pro b/Master/texmf-dist/dvips/pstricks/pst-algparser.pro new file mode 100644 index 00000000000..398a0ecedd7 --- /dev/null +++ b/Master/texmf-dist/dvips/pstricks/pst-algparser.pro @@ -0,0 +1,739 @@ +% $Id: pst-algparser.pro 7 2007-12-29 22:21:13Z herbert $ +% +% PostScript prologue for PSTricks algorithm parser +% Version 0.01, 2008/01/01 +% For distribution and copyright, see pstricks.tex. hv@pstricks.de +% +%-----------------------------------------------------------------------------% +/AlgParser { tx@AlgToPs begin AlgToPs end } def % Dominique Rodriguez +% +/tx@CoreAnalyzerDict 100 dict def tx@CoreAnalyzerDict begin +% +% PS ANALYZER FOR ALGEBRAIC EXPRESSION V1.12 +% E->T|E+T +% T->FS|T*FS +% FS -> F | +FS | -FS +% F->P|F^SF +% P->(E)|literal +% literal->number|var|var[E]|func(params) +% params->E|E,param +% number->TOBEFINISHED +% +%% E expression, T term, SF signed factor, F factor, P power +% +%% parser +% +%% str +% +%% C->E<condition_operators>E +%% STR index -> STR index+lenExpr +/AnalyzeCond { AnalyzeExpr ReadCondOp AnalyzeExpr EvalCondOp } def +% +%% analyze Expression List (separator , or | ) +%% STR index -> STR index+lenExpr +%% /AnalyzeListOfE { +%% { NextNonBlankChar pop AnalyzeExpr%%dup Strlen eq { exit } if NextNonBlankChar +%% NextNonBlankChar dup 0 eq { pop exit } if +%% dup 44 ne 1 index 124 ne and { dup 41 ne { PROBLEMCONTACTBILLOU } { pop exit } ifelse } if +%% pop NextNonBlankChar dup 0 eq { exit } if 124 ne { PROBLEMCONTACTBILLOU } if 1 add NextNonBlankChar 0 eq {toto} if } loop +%% AnalyzeListOfEPostHook +%% } def +/AnalyzeListOfE { + /NotFirst false def + { NextNonBlankChar pop AnalyzeExpr + NotFirst { EvalListOfExpr } { /NotFirst true def } ifelse + dup Strlen eq { exit } if NextNonBlankChar + dup 44 ne 1 index 124 ne and + { dup 41 ne { PROBLEMCONTACTBILLOU } { pop exit } ifelse } + if pop 1 add } loop + AnalyzeListOfEPostHook +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% E->T|E+T +%% STR index -> STR index+lenExpr +/AnalyzeExpr { + AnalyzePreHook AnalyzeTerm IsEndingExpr + { dup 0 ne { 32 eq { NextNonBlankChar } if } { pop } ifelse } + { { RollOp 1 add NextNonBlankChar pop AnalyzeTerm PreEvalHook EvalAddSub IsEndingExpr { pop exit } if } loop } + ifelse + AnalyzePostHook +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% T->FS|T*FS +%% STR index +/AnalyzeTerm { + AnalyzePreHook AnalyzeSignedFactor IsEndingTerm + { dup 0 ne { 32 eq { NextNonBlankChar } if } { pop } ifelse } + { { RollOp 1 add NextNonBlankChar pop AnalyzeSignedFactor PreEvalHook EvalMulDiv IsEndingTerm { pop exit } if} loop } + ifelse + AnalyzePostHook +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% FS -> F | +FS | -FS +%% STR index +/AnalyzeSignedFactor { + AnalyzePreHook 2 copy get dup IsUnaryOp + { RollOp 1 add NextNonBlankChar pop AnalyzeSignedFactor EvalUnaryOp } + { pop AnalyzeFactor } + ifelse AnalyzePostHook +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% F->P|F^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 } + ifelse AnalyzePostHook +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% P->(E)|literal +%% STR index +/AnalyzePower { + %% depending of first char either a number, or a literal + 2 copy get dup 40 eq%%an open par + { pop 1 add NextNonBlankChar pop AnalyzeExpr 1 add NextNonBlankChar pop } + { AnalyzeLiteral } + ifelse +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% STR index STR[index] -> STR index +%/AnalyzeLiteral { IsNumber { EvalNumber } { EvalLiteral } ifelse } def +/AnalyzeLiteral { dup IsUnaryOp exch IsNumber or { EvalNumber } { EvalLiteral } ifelse } def%%dr 09102006 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% recognize + or - +%% chr -> T/F +/IsUnaryOp { dup 43 eq exch 45 eq or } bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% a number can contain only : 0123456789. +%% chr -> T/F +/IsNumber { dup 48 ge exch dup 57 le 3 -1 roll and exch 46 eq or } bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% STR index -> STR index number +%% a number can be of the form [0-9]*.[0-9]*\([eE][+-]?[0-9]+\)? +%% STR index -> STR index' number +/ReadNumber { + exch dup 3 -1 roll dup 3 1 roll + %%read mantissa + { 1 add 2 copy dup Strlen eq { pop pop 0 exit } if get dup IsNumber not { exit } if pop } loop + dup 101 eq exch 69 eq or + %%% there is a "e" or "E" -> read exponant + { 1 add 2 copy get dup IsUnaryOp + { pop 1 add 2 copy get } if + { IsNumber not { exit } if 1 add 2 copy get } loop } + if + dup 4 1 roll + 3 -1 roll exch 1 index sub getinterval +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% a number can contain only : 0123456789. +%% chr -> T/F +/IsCondOp { dup 30 eq exch dup 60 ge exch 62 le and or } bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% STR index -> STR index number +%% a number can be of the form [0-9]*.[0-9]*\([eE][+-]?[0-9]+\)? +%% STR index -> STR index' number +/ReadCondOp { + NextNonBlankChar 1 index 4 1 roll + { IsCondOp not { exit } if 1 add 2 copy get } loop + 2 copy 5 -1 roll + exch 1 index sub getinterval 3 1 roll +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% a literal can contain only : 0123456789. +%% chr -> T/F +/IsLiteral {% + dup 48 ge exch dup 57 le 3 -1 roll and exch + dup 65 ge exch dup 90 le 3 -1 roll and 3 -1 roll or exch + dup 97 ge exch 122 le and or } bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% a literal can be of the form [a-zA-Z][a-zA-Z0-9]*\(\((Expression)\)|\(\[Expression\]\)\)? +%% STR index -> literal STR index' nextchr +/ReadLiteral { + exch dup 3 -1 roll dup 3 1 roll + %%read literal core + { 2 copy dup Strlen eq { pop pop 0 exit } if get dup IsLiteral not { exit } if pop 1 add } loop + 4 1 roll dup 5 1 roll 3 -1 roll exch 1 index sub getinterval 4 1 roll +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% expr is ended by end of str or a clpar +%% STR index -> STR index STR[index] T/F +/IsEndingExpr {% + 2 copy dup Strlen eq + %% if end of str is reached -> end ! + { pop pop 0 true } + %% ending chr -> clpar, comma, |, <, >, =, !, + {get dup dup 41 eq + exch dup 124 eq + exch dup 93 eq + exch dup 44 eq + exch dup 30 eq + exch dup 60 ge exch 62 le and or or or or or} + ifelse } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% expr is ended by end of str or a +- +%% STR index -> STR index STR[index] T/F +/IsEndingTerm { IsEndingExpr { true } { dup dup 43 eq exch 45 eq or } ifelse } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% expr is ended by end of str or */ +%% STR index -> STR index STR[index] T/F +/IsEndingFactor { IsEndingTerm { true } { dup dup 42 eq exch 47 eq or } ifelse } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% expr is ended by end of str or ^ +%% STR index -> STR index STR[index] T/F +/IsEndingPower { IsEndingFactor { true } { dup 94 eq } ifelse } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% STR index -> STR index STR[index] +/NextNonBlankChar { { dup Strlen eq { 0 exit } if 2 copy get dup neBlkChar { exit } if pop 1 add } loop } bind def +/neBlkChar { dup 32 ne exch dup 10 ne exch 9 ne and and } bind def +%%%%%%%%%%%%%%%%%%%%%%%% +%% DEBUG +/BRK {false} def +/BRKtrue {/BRK true def} def +/BRKStop {BRK {BRKtoto} if } def +/BRKEvalStop {BRK exch if } def +/BRKBRK2true {BRK {BRK2true} if } def +/BRK2 {false} def +/BRK2true {/BRK2 true def} def +/BRK2Stop {BRK2 {BRK2toto} if } def/BRK {false} def +end +% +%-------------------------------------------------------------------------------% +% +/tx@AlgToPs 12 dict def tx@AlgToPs begin +% +%% algExpr -> PSVector +/AlgToPs { tx@CoreAnalyzerDict begin InitParser AnalyzeListOfE pop pop EndingSequence end } def +/EndingSequence { ExpressionVector aload length /end cvx exch 1 add array astore } def +/InitParser { /ExpressionVector [ /tx@AddMathFunc cvx /begin cvx ] def dup length /Strlen exch def 0 } def +/Strlen 0 def +/EvalListOfExpr {} def% +/EvalNumber {% + ReadNumber cvr /ExpressionVector ExpressionVector aload length dup 3 add -1 roll cvx + exch 1 add array astore def NextNonBlankChar pop } def +/EvalAddSub {% + /ExpressionVector ExpressionVector aload length dup 5 add -1 roll + 43 eq { /add } { /sub } ifelse cvx exch 1 add array astore def +} def +/EvalMulDiv {% + /ExpressionVector ExpressionVector aload length dup 5 add -1 roll + 42 eq { /mul } { /div } ifelse cvx exch 1 add array astore def +} def +/EvalPower {% + /ExpressionVector ExpressionVector aload length dup 5 add -1 roll + pop /exp cvx exch 1 add array astore def +} def +/EvalLiteral {% + ReadLiteral + dup 40 eq%%% there is an open par -> function call + { pop 2 index + dup (Sum) eq { EvalSum } + { dup (IfTE) eq { EvalCond } + { dup (Derive) eq { pop EvalDerive } + { pop 1 add NextNonBlankChar pop AnalyzeListOfE 2 index TrigoFunc + /ExpressionVector ExpressionVector aload length dup 5 add -1 roll cvn cvx + exch 1 add array astore def 1 add NextNonBlankChar pop } ifelse } ifelse} ifelse } + { /ExpressionVector ExpressionVector aload length dup 6 add -1 roll cvn cvx exch 1 add array astore def + dup 91 eq%%% there is an open bracket -> vector element + { pop 1 add NextNonBlankChar pop AnalyzeExpr + /ExpressionVector ExpressionVector aload length /cvi cvx exch /get cvx exch 2 add array astore def 1 add } + { pop NextNonBlankChar pop } + ifelse} + ifelse +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% the derive function : Derive(n,f(x)) +%% firstparindex lastparindex -> +/EvalDerive { + %% manage the function descripiton + 1 add ReadNumber 3 1 roll NextNonBlankChar + 44 ne { ANALYZER_ERROR_missing_second_comma_in_Sum } if + 1 add NextNonBlankChar pop + 3 -1 roll cvi + dup 0 eq + { pop AnalyzeExpr 3 -1 roll pop 1 add } + { 1 sub 3 1 roll (x) exch tx@Derive begin DeriveIndexed end 4 -1 roll + { (x) tx@Derive begin Derive end } repeat + ExpressionVector exch /ExpressionVector [] def + AlgToPs aload length + /ExpressionVector 1 index 3 add -1 roll aload length dup 3 add -1 roll /l2 exch def /l1 exch def + l1 l2 add 1 add l2 neg roll l1 l2 add array astore def 3 -1 roll pop 1 add + 1 index length /Strlen exch def } ifelse +} def +/EvalSum {% + pop 1 add NextNonBlankChar pop + %% read the variable name + ReadLiteral pop NextNonBlankChar + 44 ne { ANALYZER_ERROR_missing_first_comma_in_Sum } if + %% read the initial value + 1 add NextNonBlankChar pop ReadNumber cvi 3 1 roll + 2 copy get 44 ne { ANALYZER_ERROR_missing_second_comma_in_Sum } if + %% read the increment value + 1 add NextNonBlankChar pop ReadNumber cvi 3 1 roll + 2 copy get 44 ne { ANALYZER_ERROR_missing_second_comma_in_Sum } if + %% read the limit value + 1 add NextNonBlankChar pop ReadNumber cvi 3 1 roll + 2 copy get 44 ne { ANALYZER_ERROR_missing_second_comma_in_Sum } if + /ExpressionVector ExpressionVector aload length dup 7 add -3 roll 0 4 1 roll + 5 -1 roll 4 add array astore def + %% keep ExpressionVector for later and create a new one for internal Sum computation + ExpressionVector 3 1 roll /ExpressionVector [ 6 -1 roll cvn /exch cvx /def cvx ] def + 1 add NextNonBlankChar pop AnalyzeExpr + %% add each term + /ExpressionVector ExpressionVector aload length 1 add /add cvx exch array astore def + /ExpressionVector 4 -1 roll aload length ExpressionVector cvx /for cvx 3 -1 roll 2 add + array astore def 3 -1 roll pop 1 add +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Convert to radians if trigo function call +%% (name) -> +/TrigoFunc { + dup (cos) eq 1 index (sin) eq or exch (tan) eq or + { /ExpressionVector ExpressionVector aload length Pi /div cvx 180 /mul cvx 5 -1 roll 4 add + array astore def + } if +} def +/EvalCond {% + pop 1 add AnalyzeCond NextNonBlankChar + 44 ne { ANALYZER_ERROR_missing_first_comma_in_IfTE } if + ExpressionVector 3 1 roll /ExpressionVector [] def + 1 add AnalyzeExpr ExpressionVector 3 1 roll /ExpressionVector [] def + NextNonBlankChar 44 ne { ANALYZER_ERROR_missing_second_comma_in_IfTE } if + 1 add AnalyzeExpr + NextNonBlankChar 41 ne { ANALYZER_ERROR_missing_ending parenthesis_in_IfTE } if + ExpressionVector + /ExpressionVector 6 -1 roll aload length dup + 6 add -1 roll cvx exch dup 4 add -1 roll cvx /ifelse cvx 3 -1 roll 3 add array astore def + 1 add 3 -1 roll pop +} def +%% CondOp STR index +/EvalCondOp {% + 3 -1 roll + dup (=) eq { /eq } {% + dup (<) eq { /lt } {% + dup (>) eq { /gt } {% + dup (>=) eq { /ge } {% + dup (<=) eq { /ge } {% + dup (!=) eq { /ne } { ERROR_non_valid_conditional_operator } + ifelse } ifelse } ifelse } ifelse } ifelse } ifelse + cvx exch pop + /ExpressionVector ExpressionVector aload length dup 3 add -1 roll exch 1 add array astore def } def +/EvalUnaryOp { + 3 -1 roll 45 eq { /ExpressionVector ExpressionVector aload length /neg cvx exch 1 add array astore def } if +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% H O O K S +/AnalyzePreHook {} bind def +/PreEvalHook {} bind def +/AnalyzeListOfEPostHook {} bind def +/AnalyzePostHook {} def +/RollOp { 3 1 roll } bind def +end %tx@CoreAnalyzerDict +% +%--------------------------------------------------------------------% +% +/tx@Derive 41 dict def tx@Derive begin +%%increase ^^ for each function added +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% algExpr variable -> PSVector +/Derive {% + 10240 string 3 1 roll 0 3 1 roll + /Variable exch def + tx@CoreAnalyzerDict begin InitParser AnalyzeListOfE end +} def +/Strlen 0 def +/InitParser { dup length /Strlen exch def 0 } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% algExpr variable index -> PSVector +/DeriveIndexed {% + 3 1 roll 10240 string 3 1 roll 0 3 1 roll + /Variable exch def + tx@CoreAnalyzerDict begin InitParser pop 4 -1 roll AnalyzeExpr 4 -2 roll pop pop 4 -2 roll exch pop end +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% (u,v)'=-(u',v') +/EvalListOfExpr {% + 4 2 roll 2 copy 9 -1 roll dup length 4 1 roll putinterval add AddPipe + 2 copy 7 -1 roll dup length 4 1 roll putinterval add + 6 -2 roll pop pop + 2 copy pop 0 6 2 roll GetIntervalNewStr 5 1 roll 2 copy 0 exch getinterval 6 1 roll } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% (-u)'=-(u') +/EvalUnaryOp { + 4 -2 roll 4 index (0) eq + { (0) StrConcat 7 -1 roll pop } + { 7 -1 roll 45 eq + { AddSub AddOpPar true } { false } ifelse + 3 1 roll 5 index StrConcat 3 -1 roll { AddClPar } if } ifelse + 2 copy pop 0 6 2 roll GetIntervalNewStr + 7 -2 roll pop pop 2 index 6 index dup 4 index exch sub getinterval exch 6 2 roll +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% (number)'=0 +/EvalNumber { ReadNumber (0) 6 2 roll } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% (u+v)'=u'+v' +/EvalAddSub {% + 7 index dup (0) eq + { pop true }%% du=0 nothing added + { dup length exch 5 index 5 index 3 -1 roll putinterval 4 -1 roll add 3 1 roll false } + ifelse + 5 index dup (0) eq + { pop { (0) } { 4 -2 roll 2 copy pop 0 6 2 roll GetIntervalNewStr } ifelse }%%dv=0 + { exch + { 5 -2 roll 7 index 45 eq { AddSub } if false } %%nothing yet added + { 5 -2 roll 7 index 43 eq%%something yet added + { AddAdd false } { AddSub AddOpPar true } ifelse } + ifelse 11 1 roll + 3 -1 roll StrConcat 10 -1 roll { AddClPar } if + 2 copy pop 0 6 2 roll GetIntervalNewStr } + ifelse + mark 11 -5 roll cleartomark 2 index 6 index dup 4 index exch sub getinterval exch 6 2 roll +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% (u*v)' or (u/v)' +/EvalMulDiv { 6 index 42 eq {EvalMul} {EvalDiv} ifelse } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% (u*v)'=u'*v+u*v' +/EvalMul {% + 4 -2 roll 7 index dup (0) eq + { pop false }%%du=0 + { (1) eq%%du=1 + { false } + { AddOpPar 7 index StrConcat AddClPar AddMul AddOpPar true } ifelse + 3 1 roll 6 index StrConcat 3 -1 roll { AddClPar } if + true }%%du!=0 + ifelse + 5 1 roll 5 index (0) eq + { 5 -1 roll not { (0) StrConcat } if }%%dv=0 + { 5 -1 roll { AddAdd } if + 4 index (1) eq + { 8 index StrConcat } + { AddOpPar 8 index StrConcat AddClPar AddMul AddOpPar 4 index StrConcat AddClPar } + ifelse + }%%dv!=0 + ifelse + 2 copy pop 0 6 2 roll GetIntervalNewStr + mark 11 -5 roll cleartomark 2 index 6 index dup 4 index exch sub getinterval exch 6 2 roll +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% (u/v)'=(u'*v-u*v')/v^2 +/EvalDiv {% + 4 -2 roll + 4 index (0) eq%%dv=0 -> u'/v + { 7 index (0) eq { (0) StrConcat } { AddOpPar 7 index StrConcat AddClPar AddDiv 5 index StrConcat } ifelse } + { 7 index dup (0) eq + { pop }%%du=0 + { (1) eq%%du=1 + { false } + { AddOpPar 7 index StrConcat AddClPar AddMul AddOpPar true } ifelse + 3 1 roll 6 index StrConcat 3 -1 roll { AddClPar } if}%%du!=0 + ifelse + AddSub + 4 index (1) eq + { 8 index StrConcat } + { AddOpPar 8 index StrConcat AddClPar AddMul AddOpPar 4 index StrConcat AddClPar } + ifelse + %}%%dv!=0 + 2 copy GetIntervalNewStr 3 1 roll pop 0 AddOpPar 3 -1 roll StrConcat AddClPar + AddDiv AddOpPar 5 index StrConcat AddClPar 2 copy (^2) putinterval 2 add } + ifelse + 2 copy pop 0 6 2 roll GetIntervalNewStr + mark 11 -5 roll cleartomark 2 index 6 index dup 4 index exch sub getinterval exch 6 2 roll +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% str1 index str2 -> str1 index +/StrConcat { dup length 4 2 roll 2 copy 6 -1 roll putinterval 3 -1 roll add } bind def +/GetIntervalNewStr { 0 exch getinterval dup length string copy } bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% (u^v)'=(u^v)'=u'vu^(v-1)+v'u^(v)ln(u) +/EvalPower {% + 4 -2 roll 7 index (0) eq + {%%if du=0 then (u^v)'=v'ln(u)u^v + 4 index (0) eq + { (0) StrConcat }%%if dv=0 then (u^v)'=0 + { 4 index (1) ne { AddOpPar 4 index StrConcat (\)*) StrConcat } if + 8 index (e) ne { (ln\() StrConcat 8 index StrConcat (\)*) StrConcat } if + AddOpPar 8 index StrConcat (\)^\() StrConcat 5 index StrConcat AddClPar } ifelse + } + {%%du!=0 + 4 index (0) eq + {%%if dv=0 then (u^v)'=vu'u^(v-1) + 5 index dup IsStrNumber + { dup (0) eq + { StrConcat } + { dup dup (1) eq exch (1.0) eq or + { StrConcat } + { StrConcat + 7 index dup (1) ne exch (1.0) ne and%%%dr 09102006 insert du if <> 1 + { (*\() StrConcat 7 index StrConcat (\)) StrConcat } if%%%dr 09102006 + (*\() StrConcat 8 index StrConcat (\)) StrConcat + 5 index dup dup (2) eq exch (2.0) eq or + { pop } { cvr 1 sub 20 string cvs 3 1 roll (^) StrConcat 3 -1 roll StrConcat } ifelse } ifelse } ifelse } + { pop AddOpPar 5 index StrConcat (\)*\() StrConcat 8 index StrConcat (\)^\() StrConcat + 5 index StrConcat (-1\)) StrConcat } ifelse + } + {%%if dv!=0 and du!=0 then (u^v)'=u'vu^(v-1)+v'u^(v)ln(u) + 7 index (1) ne { AddOpPar 7 index StrConcat (\)*) StrConcat } if + AddOpPar 5 index StrConcat (\)*\() StrConcat + 8 index StrConcat (\)^\() StrConcat + 5 index StrConcat (-1\)+\() StrConcat + 4 index (1) ne { 4 index StrConcat (\)*\() StrConcat } if + 8 index StrConcat (\)^\() StrConcat + 5 index StrConcat (\)*ln\() StrConcat + 8 index StrConcat AddClPar + } ifelse + } ifelse + 2 copy pop 0 6 2 roll GetIntervalNewStr + mark 11 -5 roll cleartomark 2 index 6 index dup 4 index exch sub getinterval exch 6 2 roll +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% str -> true/false +/IsStrNumber {% + true exch + { dup 48 lt exch dup 57 gt 3 -1 roll or + exch dup 46 ne%%. + exch dup 43 ne%%+ + exch 45 ne%%- + and and and { pop false } if } forall +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% literal switch -> func call, vector, variables +/EvalLiteral {% + 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 } + { pop EvalVariable } + ifelse } + ifelse +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% first last parpos Expr[first:parpos-1] -> +/EvalVariable { 2 index Variable eq { (1) } { (0) } ifelse 4 -1 roll exch 6 2 roll } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% (f(u))'=u'f'(u) +/EvalFunc { + 4 2 roll 4 index (1) ne + { AddOpPar 4 index StrConcat (\)*) StrConcat } if + (Eval ) 4 8 index StrConcat 0 exch getinterval cvn cvx exec + 2 copy pop 0 6 2 roll GetIntervalNewStr + mark 9 -3 roll cleartomark 2 index 6 index dup 4 index exch sub getinterval exch 6 2 roll +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Func derivative -> Eval<func> +/EvalFunc_sin {% + PreCommonFunc + { (cos\() StrConcat 5 index StrConcat AddClPar } if + PostCommonFunc } def +/EvalFunc_cos {% + PreCommonFunc + { (\(-sin\() StrConcat 5 index StrConcat (\)\)) StrConcat } if + PostCommonFunc } def +/EvalFunc_tan {% + PreCommonFunc + { dup 0 eq { (1) StrConcat } { 1 sub } ifelse (/cos\() StrConcat 5 index StrConcat (\)^2) StrConcat } if + PostCommonFunc } def +/EvalFunc_asin {% + PreCommonFunc + { (1/sqrt\(1-\() StrConcat 5 index StrConcat (\)^2\)\)) StrConcat } if + PostCommonFunc } def +/EvalFunc_acos {% + PreCommonFunc + { (-1/sqrt\(1-\() StrConcat 5 index StrConcat (\)^2\)\)) StrConcat } if + PostCommonFunc } def +/EvalFunc_atg {% + PreCommonFunc + { (1/\(1+\() StrConcat 5 index StrConcat (\)^2\)\)) StrConcat } if + PostCommonFunc } def +/EvalFunc_ln {% + PreCommonFunc + { dup 0 eq { (1) StrConcat } { 1 sub } ifelse (/\() StrConcat 5 index StrConcat AddClPar } if + PostCommonFunc } def +/EvalFunc_exp {% + PreCommonFunc + { (exp\() StrConcat 5 index StrConcat AddClPar } if + PostCommonFunc } def +/EvalFunc_sqrt {% + PreCommonFunc + { 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 + PostCommonFunc } def +/EvalFunc_sh {% + PreCommonFunc + { (ch\() StrConcat 5 index StrConcat AddClPar } if + PostCommonFunc } def +/EvalFunc_ch {% + PreCommonFunc + { (sh\() StrConcat 5 index StrConcat AddClPar } if + PostCommonFunc } def +/EvalFunc_th {% + PreCommonFunc + { dup 0 eq { (1) StrConcat } { 1 sub } ifelse (/ch\() StrConcat 5 index StrConcat (\)^2) StrConcat } if + PostCommonFunc } def +/EvalFunc_Argsh {% + PreCommonFunc + { (1/sqrt\(1+\() StrConcat 5 index StrConcat (\)^2\)\)) StrConcat } if + PostCommonFunc } def +/EvalFunc_Argch {% + PreCommonFunc + { (1/sqrt\(\() StrConcat 5 index StrConcat (\)^2-1\)\)) StrConcat } if + PostCommonFunc } def +/EvalFunc_Argth {% + PreCommonFunc + { (1/\(1-\() StrConcat 5 index StrConcat (\)^2\)\)) StrConcat } if + PostCommonFunc } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/PreCommonFunc { + 1 add NextNonBlankChar pop 3 -1 roll 5 1 roll AnalyzeExpr 1 add NextNonBlankChar pop + 4 2 roll 4 index (0) eq + { (0) StrConcat false } + { 4 index (1) ne { AddOpPar 4 index StrConcat (\)*) StrConcat } if true } ifelse +} def +/PostCommonFunc { + 2 copy pop 0 6 2 roll GetIntervalNewStr + mark 9 -3 roll cleartomark 2 index 6 index dup 4 index exch sub getinterval exch 6 2 roll +} def +/EvalFunc_Derive {% + 1 add ReadNumber cvi 1 add dup cvr log 1 add cvi string cvs + 4 -1 roll pop 5 1 roll 1 add NextNonBlankChar pop AnalyzeExpr 1 add + 4 -2 roll (Derive\() StrConcat 7 -1 roll StrConcat (,) StrConcat 6 -1 roll StrConcat AddClPar + 2 copy pop 0 6 2 roll GetIntervalNewStr 6 -1 roll pop 2 index 6 index dup 4 index exch sub getinterval + exch 6 2 roll } def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% literal switch -> func call, vector, variables +/EvalFunc_Sum {% + 1 add NextNonBlankChar pop + %% read the variable name + ReadLiteral pop 3 -1 roll pop NextNonBlankChar + 44 ne { ANALYZER_ERROR_missing_first_comma_in_Sum } if + %% read the initial value + 1 add NextNonBlankChar pop ReadNumber pop + 2 copy get 44 ne { ANALYZER_ERROR_missing_second_comma_in_Sum } if + %% read the increment value + 1 add NextNonBlankChar pop ReadNumber pop + 2 copy get 44 ne { ANALYZER_ERROR_missing_third_comma_in_Sum } if + %% read the limit value + 1 add NextNonBlankChar pop ReadNumber pop + 2 copy get 44 ne { ANALYZER_ERROR_missing_fourth_comma_in_Sum } if + 1 add NextNonBlankChar pop dup 6 1 roll 3 -1 roll pop AnalyzeExpr 1 add NextNonBlankChar pop + 4 -2 roll 3 index 8 index dup 9 index exch sub getinterval StrConcat + 4 index StrConcat AddClPar + 2 copy pop 0 6 2 roll GetIntervalNewStr + mark 9 -3 roll cleartomark 2 index 6 index dup 4 index exch sub getinterval exch 6 2 roll +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% literal switch -> func call, vector, variables +/EvalFunc_IfTE {% + 3 -1 roll pop 1 add NextNonBlankChar pop SkipCond + NextNonBlankChar + 44 ne { ANALYZER_ERROR_missing_first_comma_in_IfTE } if + 1 add NextNonBlankChar pop dup 5 1 roll + AnalyzeExpr NextNonBlankChar + 44 ne { ANALYZER_ERROR_missing_second_comma_in_IfTE } if + 1 add NextNonBlankChar pop + AnalyzeExpr 1 add NextNonBlankChar pop + 4 -2 roll 3 index 10 index dup 11 index exch sub getinterval StrConcat + 6 index StrConcat (,) StrConcat 4 index StrConcat AddClPar + 2 copy pop 0 6 2 roll GetIntervalNewStr + mark 11 -5 roll cleartomark 2 index 6 index dup 4 index exch sub getinterval exch 6 2 roll +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% advance in str until a comma is found (no error detection!) +%% str index -> str index' +/SkipCond { { 1 add 2 copy get 44 eq {exit } if } loop } bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Convert to radians if trigo function call +%% (name) -> +/TrigoFunc { + dup (cos) eq 1 index (sin) eq or exch (tan) eq or + { /ExpressionVector ExpressionVector aload length Pi /div cvx 180 /mul cvx 5 -1 roll 4 add + array astore def + } if +} def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% No derivative for condition.... +/EvalCondOp { 3 -1 roll pop } bind def +/PutIntervalOneAdd {putinterval 1 add} bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Add open parenthesis in string at the given index +%% str index -> str index+1 +/AddOpPar {2 copy (\() PutIntervalOneAdd} bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Add close parenthesis in string at the given index +%% str index -> str index+1 +/AddClPar {2 copy (\)) PutIntervalOneAdd} bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Add 0 in string at the given index +%% str index -> str index+1 +/AddZero {2 copy (0) PutIntervalOneAdd} bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Add open parenthesis in string at the given index +%% str index -> str index+1 +/AddMul {2 copy (*) PutIntervalOneAdd} bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Add open parenthesis in string at the given index +%% str index -> str index+1 +/AddDiv {2 copy (/) PutIntervalOneAdd} bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Add a plus sign in string at the given index +%% str index -> str index+1 +/AddAdd {2 copy (+) PutIntervalOneAdd} bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Add a minus sign in string at the given index +%% str index -> str index+1 +/AddSub {2 copy (-) PutIntervalOneAdd} bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Add a pipe sign in string at the given index +%% str index -> str index+1 +/AddPipe {2 copy (|) PutIntervalOneAdd} bind def +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% H O O K S +/AnalyzePreHook { dup 5 1 roll } bind def +/PreEvalHook {} def +/AnalyzePostHook { 7 -1 roll pop } bind def +/AnalyzeListOfEPostHook { 6 -1 roll mark 6 1 roll cleartomark } bind def +/RollOp { 5 1 roll } bind def +end%%%tx@CoreAnalyzerDict +/tx@AddMathFunc 12 dict def tx@AddMathFunc begin +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% NEW FUNC +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% function arcsine in radians asin(x)=atan(x/sqrt(1-x^2)) +%% x -> theta +/asin {% + dup abs 1 gt { EQDFasinrangeerror } if + dup dup dup mul 1 exch sub sqrt atan exch 0 lt { 360 sub } if DegtoRad +} def +%% function arccosine in radians acos(x)=atan(sqrt(1-x^2)/x) +%% x -> theta +/acos {% + dup abs 1 gt { EQDFacosrangeerror } if + dup dup mul 1 exch sub sqrt exch atan DegtoRad +} def +%% function arctangent in radians +%% x -> theta +/atg { 1 atan dup 90 gt { 360 sub } if DegtoRad } bind def +%% HYPERBOLIC FUNCTIONS +/sh { dup Ex exch neg Ex sub 2 div } def +/ch { dup Ex exch neg Ex add 2 div } def +/th { dup sh exch ch div } def +/Argsh { dup dup mul 1 add sqrt add ln } def +/Argch { dup dup mul 1 sub sqrt add ln } def +/Argth { dup 1 add exch 1 exch sub div ln 2 div } def +%% modified exponential funtion for 0 +%% x n -> x^n +/Exp { dup 0 eq { pop pop 1 } { exp } ifelse } bind def +%% modified exponential funtion for 0 +%% x -> e^x +/Ex { Euler exch exp } bind def +%% +%% factorial function +%% n -> n! +/Fact { 1 exch 2 exch 1 exch { mul } for } bind def +/fact { Fact } bind def +end + +% END pstricks.pro diff --git a/Master/texmf-dist/dvips/pstricks/pst-dots.pro b/Master/texmf-dist/dvips/pstricks/pst-dots.pro index e8297d814e0..2f98b1777e2 100644 --- a/Master/texmf-dist/dvips/pstricks/pst-dots.pro +++ b/Master/texmf-dist/dvips/pstricks/pst-dots.pro @@ -1,6 +1,7 @@ -%! +% $Id: pst-dots.pro 7 2007-12-29 22:21:13Z herbert $ +% %% PostScript prologue for pstricks.tex. -%% Version 2.00, Suggestion of 2006/12/19 +%% Version 2.00, 2006/12/19 %% For distribution, see pstricks.tex. %% %% Timothy Van Zandt <tvz@Princeton.EDU> diff --git a/Master/texmf-dist/dvips/pstricks/pst-node.pro b/Master/texmf-dist/dvips/pstricks/pst-node.pro index 5502ecbd202..85c44dde388 100644 --- a/Master/texmf-dist/dvips/pstricks/pst-node.pro +++ b/Master/texmf-dist/dvips/pstricks/pst-node.pro @@ -1,17 +1,39 @@ -%! +% $Id: pst-node.pro 7 2007-12-29 22:21:13Z herbert $ +% % PostScript prologue for pst-node.tex. -% Version 97 patch 1, 97/05/09. +% Version 1.00, 2008/01/01. % For distribution, see pstricks.tex. % /tx@NodeDict 400 dict def tx@NodeDict begin -tx@Dict begin /T /translate load def end -/NewNode { gsave /next ED dict dup 3 1 roll def exch { dup 3 1 roll def } -if begin tx@Dict begin STV CP T exec end /NodeMtrx CM def next end -grestore } def -/InitPnode { /Y ED /X ED /NodePos { NodeSep Cos mul NodeSep Sin mul } def +tx@Dict begin + /T /translate load def +end +/NewNode { % on stack: { x y } boolean N@name type InitXnode + gsave + /next ED % { x y } boolean N@name type + dict dup % { x y } boolean N@name dict dict + 3 1 roll def % { x y } boolean dict N@name dict def + exch { dup 3 1 roll def } if % { x y } dict boolean + begin % { x y } dict begin + tx@Dict begin + STV CP T exec % set scaling + end + /NodeMtrx CM def % save CM + next % InitXNode + end + grestore +} def +% +/InitPnode { + /Y ED /X ED + /NodePos { NodeSep Cos mul NodeSep Sin mul } def +} def +% +/InitCnode { + /r ED /Y ED /X ED + /NodePos { NodeSep r add dup Cos mul exch Sin mul } def } def -/InitCnode { /r ED /Y ED /X ED /NodePos { NodeSep r add dup Cos mul exch -Sin mul } def } def +% /GetRnodePos { Cos 0 gt { /dx r NodeSep add def } { /dx l NodeSep sub def } ifelse Sin 0 gt { /dy u NodeSep add def } { /dy d NodeSep sub def } ifelse dx Sin mul abs dy Cos mul abs gt { dy Cos mul Sin div dy } { dx @@ -30,13 +52,16 @@ sin def /NodePos { TriNodePos } def } def /OvalNodePos { /ww w NodeSep add def /hh h NodeSep add def Sin ww mul Cos hh mul Atan dup cos ww mul exch sin hh mul } def /GetCenter { begin X Y NodeMtrx transform CM itransform end } def +% /XYPos { dup sin exch cos Do /Cos ED /Sin ED /Dist ED Cos 0 gt { Dist -Dist Sin mul Cos div } { Cos 0 lt { Dist neg Dist Sin mul Cos div neg } -{ 0 Dist Sin mul } ifelse } ifelse Do } def + Dist Sin mul Cos div } { Cos 0 lt { Dist neg Dist Sin mul Cos div neg } + { 0 Dist Sin mul } ifelse } ifelse Do +} def /GetEdge { dup 0 eq { pop begin 1 0 NodeMtrx dtransform CM idtransform -exch atan sub dup sin /Sin ED cos /Cos ED /NodeSep ED NodePos NodeMtrx -dtransform CM idtransform end } { 1 eq {{exch}} {{}} ifelse /Do ED pop -XYPos } ifelse } def + exch atan sub dup sin /Sin ED cos /Cos ED /NodeSep ED NodePos NodeMtrx + dtransform CM idtransform end } { 1 eq {{exch}} {{}} ifelse /Do ED pop + XYPos } ifelse +} def /AddOffset { 1 index 0 eq { pop pop } { 2 copy 5 2 roll cos mul add 4 1 roll sin mul sub exch } ifelse } def /GetEdgeA { NodeSepA AngleA NodeA NodeSepTypeA GetEdge OffsetA AngleA @@ -51,10 +76,18 @@ ArmA AngleA XYPos OffsetA AngleA AddOffset yA add /yA2 ED xA add /xA2 ED AngleB sin mul yB1 add def } { ArmTypeB 1 eq {{exch}} {{}} ifelse /Do ED ArmB AngleB XYPos OffsetB AngleB AddOffset yB add /yB2 ED xB add /xB2 ED } ifelse } def -/InitNC { /b ED /a ED /NodeSepTypeB ED /NodeSepTypeA ED /NodeSepB ED -/NodeSepA ED /OffsetB ED /OffsetA ED tx@NodeDict a known tx@NodeDict b -known and dup { /NodeA a load def /NodeB b load def NodeA GetCenter /yA -ED /xA ED NodeB GetCenter /yB ED /xB ED } if } def +/InitNC { + /b ED /a ED % second and first node + /NodeSepTypeB ED /NodeSepTypeA ED + /NodeSepB ED /NodeSepA ED + /OffsetB ED /OffsetA ED + tx@NodeDict a known tx@NodeDict b known and dup { + /NodeA a load def + /NodeB b load def + NodeA GetCenter /yA ED /xA ED + NodeB GetCenter /yB ED /xB ED } if +} def +% /LPutLine { 4 copy 3 -1 roll sub neg 3 1 roll sub Atan /NAngle ED 1 t sub mul 3 1 roll 1 t sub mul 4 1 roll t mul add /Y ED t mul add /X ED } def /LPutLines { mark LPutVar counttomark 2 div 1 sub /n ED t floor dup n gt @@ -107,12 +140,21 @@ begin ArrowB end curveto /LPutVar [ xA1 yA1 xA2 yA2 xB2 yB2 xB1 yB1 ] cvx def /LPutPos { t LPutVar BezierMidpoint } def /HPutPos { { HPutLines } HPutCurve } def /VPutPos { { VPutLines } HPutCurve } def } def % -/NCAngles { GetEdgeA GetEdgeB GetArmA GetArmB /mtrx AngleA matrix rotate -def xA2 yA2 mtrx transform pop xB2 yB2 mtrx transform exch pop mtrx -itransform /y0 ED /x0 ED mark ArmB 0 ne { xB1 yB1 } if xB2 yB2 x0 y0 xA2 -yA2 ArmA 0 ne { xA1 yA1 } if tx@Dict begin false Line end /LPutVar [ xB1 -yB1 xB2 yB2 x0 y0 xA2 yA2 xA1 yA1 ] cvx def /LPutPos { LPutLines } def -/HPutPos { HPutLines } def /VPutPos { VPutLines } def } def +/NCAngles { + GetEdgeA GetEdgeB GetArmA GetArmB + /mtrx AngleA matrix rotate def + xA2 yA2 mtrx transform pop + xB2 yB2 mtrx transform exch pop + mtrx itransform + /y0 ED /x0 ED + mark ArmB 0 ne { xB1 yB1 } if + xB2 yB2 x0 y0 xA2 yA2 + ArmA 0 ne { xA1 yA1 } if + tx@Dict begin false Line end + /LPutVar [ xB1 yB1 xB2 yB2 x0 y0 xA2 yA2 xA1 yA1 ] cvx def + /LPutPos { LPutLines } def + /HPutPos { HPutLines } def + /VPutPos { VPutLines } def } def % /NCAngle { GetEdgeA GetEdgeB GetArmB /mtrx AngleA matrix rotate def xB2 yB2 mtrx itransform pop xA1 yA1 mtrx itransform exch pop mtrx transform @@ -196,8 +238,10 @@ w sub yB } { xB yB w sub xB yB w add } ifelse xA1 yA1 ] cvx def /LPutPos { pop pop pop pop 4 2 roll } ifelse } def /VPutPos { VPutPos@ VPutLine } def /HPutPos { VPutPos@ HPutLine } def mark LPutVar tx@Dict begin /ArrowA { moveto } def /ArrowB { } def false Line closepath end } def + /LPutCoor { NAngle tx@Dict begin /NAngle ED end gsave CM STV CP Y sub neg exch X sub neg exch moveto setmatrix CP grestore } def + /LPut { tx@NodeDict /LPutPos known { LPutPos } { CP /Y ED /X ED /NAngle 0 def } ifelse LPutCoor } def /HPutAdjust { Sin Cos mul 0 eq { 0 } { d Cos mul Sin div flag not { neg } diff --git a/Master/texmf-dist/dvips/pstricks/pstricks.pro b/Master/texmf-dist/dvips/pstricks/pstricks.pro index 9a527fb6cff..12b81d67af3 100644 --- a/Master/texmf-dist/dvips/pstricks/pstricks.pro +++ b/Master/texmf-dist/dvips/pstricks/pstricks.pro @@ -1,7 +1,13 @@ -%! +% $Id: pstricks.pro 10 2008-01-18 13:31:24Z herbert $ +% % PostScript prologue for pstricks.tex. -% Version 1.01, 2006/01/11 -% For distribution, see pstricks.tex. +% Version 1.03, 2008/01/01 +% For distribution and copyright, see pstricks.tex. +% +% +systemdict /.setopacityalpha known not {/.setopacityalpha { pop } def } if +systemdict /.setblendmode known not {/.setblendmode { pop } def } if +systemdict /.setshapealpha known not {/.setshapealpha { pop } def } if % /tx@Dict 200 dict def tx@Dict begin /ADict 25 dict def @@ -18,13 +24,28 @@ /Atan { /atan load stopped { pop pop 0 } if } def % return 0 if atan not known /ATAN1 {neg -1 atan 180 sub } def % atan(x) (only one parameter) /Div { dup 0 eq { pop } { div } ifelse } def % control the division +/tan { dup cos abs 1.e-10 lt + { pop 1.e10 } % return 1.e10 as infinit + { dup sin exch cos div } ifelse % default sin/cos +} def +/Tan { dup sin exch cos Div } def % sin(x)/cos(x) x in degrees +/Acos {dup dup mul neg 1 add dup 0 lt { % arc cos, returns 0 when negative root + pop pop 0 }{ sqrt exch atan} ifelse } def /NET { neg exch neg exch T } def % change coordinate system to the negative one -/Pyth { dup mul exch dup mul add sqrt } def % Pythagoras, epects 2 parameter +/Pyth { dup mul exch dup mul add sqrt } def % Pythagoras, expects 2 parameter +/Pyth2 { % Pythagoras, xA yA xB yB + 3 -1 roll % xA xB yB yA + sub % xA xB yB-yA + 3 1 roll % yB-yA xA xB + sub % yB-yA xA-xB + Pyth } def /PtoC { 2 copy cos mul 3 1 roll sin mul } def % Polar to Cartesian %----------------- hv added 20050516 --------------- +/PiDiv2 1.57079632680 def /Pi 3.14159265359 def /TwoPi 6.28318530718 def /Euler 2.71828182846 def +%/e Euler bind def /RadtoDeg { 180 mul Pi div } bind def % convert from radian to degrees /DegtoRad { Pi mul 180 div } bind def % viceversa %----------------- hv end--------------------------- @@ -122,22 +143,75 @@ %pop pop } def %% DG/SR modification end % -/BeginArrow { ADict begin /@mtrx CM def gsave 2 copy T 2 index sub neg -exch 3 index sub exch Atan rotate newpath } def +/BeginArrow { ADict begin + /@mtrx CM def + gsave + 2 copy T + 2 index sub neg exch + 3 index sub exch Atan + rotate newpath +} def +% /EndArrow { @mtrx setmatrix CP grestore end } def -/Arrow { CLW mul add dup 2 div /w ED mul dup /h ED mul /a ED { 0 h T 1 -1 -scale } if w neg h moveto 0 0 L w h L w neg a neg rlineto gsave fill -grestore } def -/Tbar { CLW mul add /z ED z -2 div CLW 2 div moveto z 0 rlineto stroke 0 -CLW moveto } def -/Bracket { CLW mul add dup CLW sub 2 div /x ED mul CLW add /y ED /z CLW 2 -div def x neg y moveto x neg CLW 2 div L x CLW 2 div L x y L stroke 0 -CLW moveto } def -/RoundBracket { CLW mul add dup 2 div /x ED mul /y ED /mtrx CM def 0 CLW -2 div T x y mul 0 ne { x y scale } if 1 1 moveto .85 .5 .35 0 0 0 -curveto -.35 0 -.85 .5 -1 1 curveto mtrx setmatrix stroke 0 CLW moveto } -def +% +/Arrow { + CLW mul add dup + 2 div /w ED + mul dup /h ED + mul /a ED + { 0 h T 1 -1 scale } if + w neg h moveto + 0 0 L w h L w neg a neg rlineto + gsave fill grestore +} def +% +/ArrowD { % the sides are drawn as curves (hv 20071211) + CLW mul add dup + 2 div /w ED + mul dup /h ED + mul /Inset ED + { 0 h T 1 -1 scale } if % changes the direction +% we use y=w/h^2 * x^2 as equation for the control points +% for the coordinates the arrow is seen from top to bottom +% the bottom (tip) is (0;0) + w neg h moveto % lower left of > + w 9 div 4 mul neg h 3 div 2 mul + w 9 div neg h 3 div + 0 0 curveto % tip of > + w 9 div h 3 div + w 9 div 4 mul h 3 div 2 mul + w h curveto % upper left of > + w neg Inset neg rlineto % move to x=0 and inset + gsave fill grestore +} def +% +/Tbar { + CLW mul add /z ED + z -2 div CLW 2 div moveto + z 0 rlineto stroke + 0 CLW moveto +} def +% +/Bracket { + CLW mul add dup CLW sub 2 div + /x ED mul CLW add /y ED /z CLW 2 div def + x neg y moveto + x neg CLW 2 div L x CLW 2 div L x y L stroke + 0 CLW moveto +} def +% +/RoundBracket { + CLW mul add dup 2 div + /x ED mul /y ED /mtrx CM def + 0 CLW 2 div T x y mul 0 ne { x y scale } if + 1 1 moveto + .85 .5 .35 0 0 0 curveto + -.35 0 -.85 .5 -1 1 curveto + mtrx setmatrix stroke 0 CLW moveto +} def +% /SD { 0 360 arc fill } def +% /EndDot { % DS is the dot size { /z DS def } { /z 0 def } ifelse /b ED 0 z DS SD b { 0 z DS CLW sub SD } if @@ -147,13 +221,16 @@ def /closepath load } /pathforall load stopped { pop pop pop pop CP /moveto load } if ] cvx newpath 3 1 roll T exec } def % -/NArray { aload length 2 div dup dup cvi eq not { exch pop } if /n exch -cvi def } def +%/NArray { +% aload length 2 div dup dup cvi eq not { exch pop } if /n exch +% cvi def +%} def +% /NArray { % holds the coordinates and on top of stack the showpoints boolean - /f ED + /showpoints ED counttomark 2 div dup cvi /n ED n eq not { exch pop } if - f { ] aload /Points ED } { n 2 mul 1 add -1 roll pop } ifelse + showpoints { ] aload /Points ED } { n 2 mul 1 add -1 roll pop } ifelse } def /Line { NArray n 0 eq not @@ -262,38 +339,86 @@ def sub 3 div def /dy y0 y1 sub 3 div def x0 dx sub y0 dy add x1 y1 ArrowA x0 dx add y0 dy add x0 2 mul x1 sub y1 ArrowB curveto /Points [ x1 y1 x0 y0 x0 2 mul x1 sub y1 ] def } def -/Grid { newpath /a 4 string def /b ED /c ED /n ED cvi dup 1 lt { pop 1 } -if /s ED s div dup 0 eq { pop 1 } if /dy ED s div dup 0 eq { pop 1 } if -/dx ED dy div round dy mul /y0 ED dx div round dx mul /x0 ED dy div -round cvi /y2 ED dx div round cvi /x2 ED dy div round cvi /y1 ED dx div -round cvi /x1 ED /h y2 y1 sub 0 gt { 1 } { -1 } ifelse def /w x2 x1 sub -0 gt { 1 } { -1 } ifelse def b 0 gt { /z1 b 4 div CLW 2 div add def -/Helvetica findfont b scalefont setfont /b b .95 mul CLW 2 div add def } -if systemdict /setstrokeadjust known { true setstrokeadjust /t { } def } -{ /t { transform 0.25 sub round 0.25 add exch 0.25 sub round 0.25 add -exch itransform } bind def } ifelse gsave n 0 gt { 1 setlinecap [ 0 dy n -div ] dy n div 2 div setdash } { 2 setlinecap } ifelse /i x1 def /f y1 -dy mul n 0 gt { dy n div 2 div h mul sub } if def /g y2 dy mul n 0 gt { -dy n div 2 div h mul add } if def x2 x1 sub w mul 1 add dup 1000 gt { -pop 1000 } if { i dx mul dup y0 moveto b 0 gt { gsave c i a cvs dup -stringwidth pop /z2 ED w 0 gt {z1} {z1 z2 add neg} ifelse h 0 gt {b neg} -{z1} ifelse rmoveto show grestore } if dup t f moveto g t L stroke /i i -w add def } repeat grestore gsave n 0 gt -% DG/SR modification begin - Nov. 7, 1997 - Patch 1 -%{ 1 setlinecap [ 0 dx n div ] dy n div 2 div setdash } -{ 1 setlinecap [ 0 dx n div ] dx n div 2 div setdash } -% DG/SR modification end -{ 2 setlinecap } ifelse /i y1 def /f x1 dx mul -n 0 gt { dx n div 2 div w mul sub } if def /g x2 dx mul n 0 gt { dx n -div 2 div w mul add } if def y2 y1 sub h mul 1 add dup 1000 gt { pop -1000 } if { newpath i dy mul dup x0 exch moveto b 0 gt { gsave c i a cvs -dup stringwidth pop /z2 ED w 0 gt {z1 z2 add neg} {z1} ifelse h 0 gt -{z1} {b neg} ifelse rmoveto show grestore } if dup f exch t moveto g -exch t L stroke /i i h add def } repeat grestore } def -/ArcArrow { /d ED /b ED /a ED gsave newpath 0 -1000 moveto clip newpath 0 -1 0 0 b grestore c mul /e ED pop pop pop r a e d PtoC y add exch x add -exch r a PtoC y add exch x add exch b pop pop pop pop a e d CLW 8 div c -mul neg d } def +% +/Grid { + newpath + /a 4 string def + /b ED /c ED /n ED + cvi dup 1 lt { pop 1 } if + /s ED + s div dup 0 eq { pop 1 } if + /dy ED s div dup 0 eq { pop 1 } if + /dx ED dy div round dy mul + /y0 ED dx div round dx mul + /x0 ED dy div round cvi + /y2 ED dx div round cvi + /x2 ED dy div round cvi + /y1 ED dx div round cvi + /x1 ED + /h y2 y1 sub 0 gt { 1 } { -1 } ifelse def + /w x2 x1 sub 0 gt { 1 } { -1 } ifelse def + b 0 gt { + /z1 b 4 div CLW 2 div add def +% /Helvetica findfont b scalefont setfont + /b b .95 mul CLW 2 div add def } if + systemdict /setstrokeadjust known + { true setstrokeadjust /t { } def } + { /t { transform 0.25 sub round 0.25 add exch 0.25 sub round 0.25 add + exch itransform } bind def } ifelse + gsave n 0 gt { 1 setlinecap [ 0 dy n div ] dy n div 2 div setdash } { 2 setlinecap } ifelse + /i x1 def + /f y1 dy mul n 0 gt { dy n div 2 div h mul sub } if def + /g y2 dy mul n 0 gt { dy n div 2 div h mul add } if def + x2 x1 sub w mul 1 add dup 1000 gt { pop 1000 } if + { i dx mul dup y0 moveto + b 0 gt + { gsave c i a cvs dup stringwidth pop + /z2 ED w 0 gt {z1} {z1 z2 add neg} ifelse + h 0 gt {b neg}{z1} ifelse + rmoveto show grestore } if + dup t f moveto + g t L stroke + /i i w add def + } repeat + grestore + gsave + n 0 gt + % DG/SR modification begin - Nov. 7, 1997 - Patch 1 + %{ 1 setlinecap [ 0 dx n div ] dy n div 2 div setdash } + { 1 setlinecap [ 0 dx n div ] dx n div 2 div setdash } + % DG/SR modification end + { 2 setlinecap } ifelse + /i y1 def + /f x1 dx mul n 0 gt { dx n div 2 div w mul sub } if def + /g x2 dx mul n 0 gt { dx n div 2 div w mul add } if def + y2 y1 sub h mul 1 add dup 1000 gt { pop 1000 } if + { newpath i dy mul dup x0 exch moveto + b 0 gt { gsave c i a cvs dup stringwidth pop + /z2 ED + w 0 gt {z1 z2 add neg} {z1} ifelse + h 0 gt {z1} {b neg} ifelse + rmoveto show grestore } if + dup f exch t moveto + g exch t L stroke + /i i h add def + } repeat + grestore +} def +% +/ArcArrow { + /d ED /b ED /a ED + gsave + newpath 0 -1000 moveto clip + newpath + 0 1 0 0 b + grestore + c mul + /e ED + pop pop pop r a e d PtoC y add exch x add + exch r a PtoC y add exch x add exch b pop pop pop pop a e d CLW 8 div c + mul neg d +} def +% /Ellipse { /mtrx CM def T scale 0 0 1 5 3 roll arc mtrx setmatrix } def % /ArcAdjust { %%%% Vincent Guirardel @@ -366,7 +491,7 @@ dup angle0 sub dup abs 180 gt { 180 add 360 div floor 360 mul sub } { pop } ifel } def % /EllipticArcArrow { - /d ED % add/sub + /d ED % is add or sub /b ED % arrow procedure /a1 ED % angle gsave @@ -381,10 +506,10 @@ dup angle0 sub dup abs 180 gt { 180 add 360 div floor 360 mul sub } { pop } ifel a1 exch ArcAdjust % Angular position of base of arrow. /a2 ED pop pop pop - a2 cos rx mul x add - a2 sin ry mul y add - a1 cos rx mul x add - a1 sin ry mul y add + a2 cos rx mul xOrig add % hv 2007-08-29 x->xOrig + a2 sin ry mul yOrig add % hv 2007-08-29 y->yOrig + a1 cos rx mul xOrig add % + a1 sin ry mul yOrig add % % Now arrow tip coor and base coor are on stack. b pop pop pop pop % Draw arrow, and discard coordinates. a2 CLW 8 div @@ -397,11 +522,16 @@ dup angle0 sub dup abs 180 gt { 180 add 360 div floor 360 mul sub } { pop } ifel %%------------------ tvz/DG/hv (2004-05-10) end -------------------%% % /Rot { CP CP translate 3 -1 roll neg rotate NET } def -/RotBegin { tx@Dict /TMatrix known not { /TMatrix { } def /RAngle { 0 } -def } if /TMatrix [ TMatrix CM ] cvx def /a ED a Rot /RAngle [ RAngle -dup a add ] cvx def } def -/RotEnd { /TMatrix [ TMatrix setmatrix ] cvx def /RAngle [ RAngle pop ] -cvx def } def +% +/RotBegin { + tx@Dict /TMatrix known not { /TMatrix { } def /RAngle { 0 } def } if + /TMatrix [ TMatrix CM ] cvx def + /a ED + a Rot /RAngle [ RAngle dup a add ] cvx def +} def +% +/RotEnd { /TMatrix [ TMatrix setmatrix ] cvx def /RAngle [ RAngle pop ] cvx def } def +% /PutCoor { gsave CP T CM STV exch exec moveto setmatrix CP grestore } def /PutBegin { /TMatrix [ TMatrix CM ] cvx def CP 4 2 roll T moveto } def /PutEnd { CP /TMatrix [ TMatrix setmatrix ] cvx def moveto } def @@ -421,4 +551,6 @@ exch } def neg exch neg exch idtransform T moveto } def /BOL { BeginOL } def /IfVisible true def } def end +%-----------------------------------------------------------------------------% + % END pstricks.pro |