summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro')
-rw-r--r--Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro93
1 files changed, 40 insertions, 53 deletions
diff --git a/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro b/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro
index 8d385084718..79541bfe970 100644
--- a/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro
+++ b/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro
@@ -1,38 +1,20 @@
+%!
% PostScript prologue for pstricks-add.tex.
-% Version 0.09, 2006/10/06
+% Version 0.10, 2006/10/15
% For distribution, see pstricks.tex.
%
-% HISTORY
-% 2006/08/10 : - cvi for the wavelength to get an integer
-% 2006/05/31 : - changes to the code
-% 2006/04/21 : - Improved parser -> generic with derivative and translator into ps
-% 2006/01/16 : - EXP -> Exp to prevent missmatch with pst-math
-% 2005/09/28 : - rename it to pstricks-add.pro
-% - add support for Gouraud shading
-% 2005/05/20 : small (unimportant) changes (hv)
-% 2005/02/25 : white space removal from expression
-% 2004/12/16 : addition of Sum and IfTE
-% 2004/11/14 : correction of a priority problem
-% ^ before unary - (new rule FS)
-/tx@addDict 410 dict def tx@addDict begin
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% HISTORY -> see file Changes
+%
+tx@Dict begin % make it global for TeX
%% Pi and Euler are defined in pstricks.pro
+/psTan { 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
/PIdiv2 1.57079632680 def
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% PS ANALYZER FOR ALGEBRAIC EXPRESSION V1.12
-% E->T|E+T
-% T->FS|T*FS %%% NEW 2004/11/14
-% FS -> F | +SF | -SF %%% NEW 2004/11/14
-% F->P|F^P %%% OLD
-% F->P|F^SF %%% NEW 2004/11/14 ???? ^FS
-% P->(E)|literal
-% literal->number|var|var[E]|func(params)%%|-P|+P%%% OLD
-% params->E|E,param
+end
%
-% E expression, T term, SF signed factor, F factor, P power
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/tx@addDict 410 dict def tx@addDict begin
%% parser
%% str -> [ LIFO vector ]
/AlgParser { tx@AlgToPs begin AlgToPs end } def
@@ -60,31 +42,31 @@
shfill
closepath
mtrx
- setmatrix grestore} def
+ setmatrix grestore} def
%
%% convertisseur longueur d'onde ->R,G,B Manuel Luque
-%% lambda max=780 nanomètres
-%% lambda min=380 nanomètres
+%% lambda max=780 nanomètres
+%% lambda min=380 nanomètres
%% adaptation de :
%% http://www.physics.sfasu.edu/astro/color.html
%% www.efg2.com/lab
%
/Gamma 0.8 def
/calculateRGB {
- /Red 0 def /Green 0 def /Blue 0 def
+ lambda 379 le {/Red 0 def /Green 0 def /Blue 0 def} if
+ lambda 781 ge {/Red 0 def /Green 0 def /Blue 0 def} if
lambda 380 ge {lambda 439 le {
/R {lambda 440 sub neg 440 380 sub div} def
/Red R factor mul Gamma exp def
/G 0 def
/Green G factor mul Gamma exp def
/B 1 def
- /Blue B factor mul Gamma exp def } if
+ /Blue B factor mul Gamma exp def} if
} if
lambda 440 ge { lambda 489 le {
/G {lambda 440 sub 490 440 sub div} def
/Green G factor mul Gamma exp def
-% /R 0 def
-% /Red 0 def
+ /R 0 def /Red 0 def
/B 1 def
/Blue B factor mul Gamma exp def } if
} if
@@ -98,22 +80,22 @@
lambda 510 ge {lambda 579 le {
/R {lambda 510 sub 580 510 sub div } def
/Red R factor mul Gamma exp def
-% /Blue 0 def
+ /Blue 0 def
/G 1 def
/Green G factor mul Gamma exp def } if
} if
lambda 580 ge {lambda 644 le {
/G {lambda 645 sub neg 645 580 sub div } def
/Green G factor mul Gamma exp def
-% /Blue 0 def
+ /Blue 0 def
/R 1 def
/Red R factor mul Gamma exp def } if
} if
lambda 645 ge { lambda 780 le {
/Red 1 factor mul Gamma exp def
-% /Blue 0 def
-% /Green 0 def
- } if } if
+ /Blue 0 def
+ /Green 0 def } if
+ } if
} def
%
/factor {
@@ -121,13 +103,12 @@
lambda 420 ge {lambda 700 le { 1 } if } if
lambda 701 ge {lambda 780 le { 0.3 0.7 780 lambda sub mul 780 700 sub div add} if } if
} def
-
+%
/wavelengthToRGB { % the wavelength in nm must be on top of the stack
cvi /lambda exch def % no floating point here
calculateRGB
} def % now the colors are saved in Red Green Blue
-
-
+%
/axfill {
8 dict begin
/xw exch def /nl exch def
@@ -153,7 +134,7 @@ systemdict /shfill known not {
/Emulate_shfill 32 dict def Emulate_shfill begin
/NumberOfLayers 128 def
-
+
/assert { not { (assert) /typecheck signalerror} if } bind def
/assert /pop load def
@@ -322,7 +303,8 @@ end
} def
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% STR index STR[index] -> STR index
-/AnalyzeLiteral { IsNumber { EvalNumber } { EvalLiteral } ifelse } def
+%/AnalyzeLiteral { IsNumber { EvalNumber } { EvalLiteral } ifelse } def
+/AnalyzeLiteral { dup IsUnaryOp exch IsNumber or { EvalNumber } { EvalLiteral } ifelse } def%%dr 09102006
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% recognize + or -
%% chr -> T/F
@@ -674,10 +656,10 @@ end%%%tx@CoreAnalyzerDict
4 -2 roll 7 index (0) eq
{%%if du=0 then (u^v)'=v'ln(u)u^v
4 index (0) eq
- { (0) StrConcat }
- { tutu 4 index (1) ne { AddOpPar 4 index StrConcat (\)*) StrConcat } if
- (ln\() StrConcat 8 index StrConcat (\)*\() StrConcat
- 8 index StrConcat (\)^\() StrConcat 5 index StrConcat AddClPar } ifelse
+ { (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
@@ -687,7 +669,10 @@ end%%%tx@CoreAnalyzerDict
{ StrConcat }
{ dup dup (1) eq exch (1.0) eq or
{ StrConcat }
- { StrConcat (*\() StrConcat 8 index StrConcat (\)) 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
@@ -847,7 +832,7 @@ end%%%tx@CoreAnalyzerDict
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% literal switch -> func call, vector, variables
/EvalFunc_IfTE {%
- 3 -1 roll pop 1 add NextNonBlankChar pop SkipCond
+ 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
@@ -945,7 +930,7 @@ end%%%tx@CoreAnalyzerDict
/Argth { dup 1 add exch 1 exch sub div ln 2 div } def
%% modified exponential funtion for 0
%% x n -> x^n
-/Exp { exch dup 0 eq { pop pop 0 }{ exch dup 0 eq { pop pop 1 } { exp } ifelse } ifelse } bind def
+/Exp { dup 0 eq { pop pop 1 } { exp } ifelse } bind def
%% modified exponential funtion for 0
%% x -> e^x
/Ex { 2.71828182846 exch exp } bind def
@@ -955,6 +940,8 @@ end%%%tx@CoreAnalyzerDict
/Fact { 1 exch 2 exch 1 exch { mul } for } bind def
/fact { Fact } bind def
/PI 3.14159265358 def
+/e 2.71828182846 def
end
% END pstricks-add.pro
+