]> code.delx.au - gnu-emacs/commitdiff
Merge from emacs--devo--0
authorMiles Bader <miles@gnu.org>
Sat, 29 Dec 2007 02:51:57 +0000 (02:51 +0000)
committerMiles Bader <miles@gnu.org>
Sat, 29 Dec 2007 02:51:57 +0000 (02:51 +0000)
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-307

14 files changed:
doc/misc/ChangeLog
doc/misc/calc.texi
lisp/ChangeLog
lisp/calc/README
lisp/calc/calc-aent.el
lisp/calc/calc-ext.el
lisp/calc/calc-help.el
lisp/calc/calc-lang.el
lisp/calc/calc-menu.el
lisp/calc/calc.el
lisp/calc/calccomp.el
lisp/vc-hg.el
src/ChangeLog
src/process.c

index 07d74fc32ed67ef6b7e1f5a37c1c6c8d3aa31871..a007f4da3a8f08ab5e8d543b6e32185941b5ea33 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-29  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc.tex (Yacas Language, Maxima Language, Giac Language):
+       New sections.
+
 2007-12-29  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * gnus.texi (Group Parameters): Reorder the text and add a note about
index b8a42f3c74622168d707b3c4baab6cc901e95b90..1a0729748b243f5ee2c82d7fd0935e72398e7922 100644 (file)
@@ -13802,6 +13802,9 @@ shifted letter key.
 * C FORTRAN Pascal::
 * TeX and LaTeX Language Modes::
 * Eqn Language Mode::
+* Yacas Language Mode::
+* Maxima Language Mode::
+* Giac Language Mode::
 * Mathematica Language Mode::
 * Maple Language Mode::
 * Compositions::
@@ -13965,13 +13968,13 @@ entered this way or using square brackets.  Since FORTRAN uses round
 parentheses for both function calls and array subscripts, Calc displays
 both in the same way; @samp{a(i)} is interpreted as a function call
 upon reading, and subscripts must be entered as @samp{subscr(a, i)}.
-Also, if the variable @code{a} has been declared to have type
-@code{vector} or @code{matrix} then @samp{a(i)} will be parsed as a
-subscript.  (@xref{Declarations}.)  Usually it doesn't matter, though;
-if you enter the subscript expression @samp{a(i)} and Calc interprets
-it as a function call, you'll never know the difference unless you
-switch to another language mode or replace @code{a} with an actual
-vector (or unless @code{a} happens to be the name of a built-in
+If the variable @code{a} has been declared to have type
+@code{vector} or @code{matrix}, however,  then @samp{a(i)} will be
+parsed as a subscript.  (@xref{Declarations}.)  Usually it doesn't
+matter, though; if you enter the subscript expression @samp{a(i)} and
+Calc interprets it as a function call, you'll never know the difference
+unless you switch to another language mode or replace @code{a} with an
+actual vector (or unless @code{a} happens to be the name of a built-in
 function!).
 
 Underscores are allowed in variable and function names in all of these
@@ -14404,7 +14407,7 @@ $$ \pmatrix{ {a \over b} & 0 \cr 0 & 2^{(x + 1)} } $$
 @sp 2
 @end iftex
 
-@node Eqn Language Mode, Mathematica Language Mode, TeX and LaTeX Language Modes, Language Modes
+@node Eqn Language Mode, Yacas Language Mode, TeX and LaTeX Language Modes, Language Modes
 @subsection Eqn Language Mode
 
 @noindent
@@ -14480,7 +14483,87 @@ The words @code{lcol} and @code{rcol} are recognized as synonyms
 for @code{ccol} during input, and are generated instead of @code{ccol}
 if the matrix justification mode so specifies.
 
-@node Mathematica Language Mode, Maple Language Mode, Eqn Language Mode, Language Modes
+@node Yacas Language Mode, Maxima Language Mode, Eqn Language Mode, Language Modes
+@subsection Yacas Language Mode
+
+@noindent
+@kindex d Y
+@pindex calc-yacas-language
+@cindex Yacas language
+The @kbd{d Y} (@code{calc-yacas-language}) command selects the
+conventions of Yacas, a free computer algebra system.  While the
+operators and functions in Yacas are similar to those of Calc, the names
+of built-in functions in Yacas are capitalized.  The Calc formula 
+@samp{sin(2 x)}, for example, is entered and displayed @samp{Sin(2 x)}
+in Yacas mode,  and `@samp{arcsin(x^2)} is @samp{ArcSin(x^2)} in Yacas
+mode.  Complex numbers are written  are written @samp{3 + 4 I}.
+The standard special constants are written @code{Pi}, @code{E},
+@code{I}, @code{GoldenRatio} and @code{Gamma}.  @code{Infinity}
+represents both @code{inf} and @code{uinf}, and @code{Undefined}
+represents @code{nan}.
+
+Certain operators on functions, such as @code{D} for differentiation 
+and @code{Integrate} for integration, take a prefix form in Yacas.  For
+example, the derivative of @w{@samp{e^x sin(x)}} can be computed with 
+@w{@samp{D(x) Exp(x)*Sin(x)}}.
+
+Other notable differences between Yacas and standard Calc expressions
+are that vectors and matrices use curly braces in Yacas, and subscripts
+use square brackets.  If, for example, @samp{A} represents the list
+@samp{@{a,2,c,4@}}, then @samp{A[3]} would equal @samp{c}.
+
+
+@node Maxima Language Mode, Giac Language Mode, Yacas Language Mode, Language Modes
+@subsection Maxima Language Mode
+
+@noindent
+@kindex d X
+@pindex calc-maxima-language
+@cindex Maxima language
+The @kbd{d X} (@code{calc-maxima-language}) command selects the
+conventions of Maxima, another free computer algebra system.  The
+function names in Maxima are similar, but not always identical, to Calc.
+For example, instead of @samp{arcsin(x)}, Maxima will use 
+@samp{asin(x)}.  Complex numbers are written @samp{3 + 4 %i}.  The
+standard special constants are written @code{%pi},  @code{%e},
+@code{%i}, @code{%phi} and @code{%gamma}.  In Maxima,  @code{inf} means
+the same as in Calc, but @code{infinity} represents Calc's @code{uinf}.
+
+Underscores as well as percent signs are allowed in function and
+variable names in Maxima mode.  The underscore again is equivalent to
+the @samp{#} in Normal mode, and the percent sign is equivalent to 
+@samp{o'o}.  
+
+Maxima uses square brackets for lists and vectors, and matrices are
+written as calls to the function @code{matrix}, given the row vectors of
+the matrix as arguments.  Square brackets are also used as subscripts.
+
+@node Giac Language Mode, Mathematica Language Mode, Maxima Language Mode, Language Modes
+@subsection Giac Language Mode
+
+@noindent
+@kindex d A
+@pindex calc-giac-language
+@cindex Giac language
+The @kbd{d A} (@code{calc-giac-language}) command selects the
+conventions of Giac, another free computer algebra system.  The function
+names in Giac are similar to Maxima.  Complex numbers are written
+@samp{3 + 4 i}.  The standard special constants in Giac are the same as
+in Calc, except that @code{infinity} represents both Calc's @code{inf}
+and @code{uinf}. 
+
+Underscores are allowed in function and variable names in Giac mode.
+Brackets are used for subscripts.  In Giac, indexing of lists begins at
+0, instead of 1 as in Calc.  So if  @samp{A} represents the list
+@samp{[a,2,c,4]}, then @samp{A[2]} would equal @samp{c}.  In general,
+@samp{A[n]} in Giac mode corresponds to @samp{A_(n+1)} in Normal mode.
+
+The Giac interval notation @samp{2 .. 3} has no surrounding brackets;
+Calc reads @samp{2 .. 3} as the closed interval @samp{[2 .. 3]} and
+writes any kind of interval as @samp{2 .. 3}.  This means you cannot see
+the difference between an open and a closed interval while in Giac mode.
+
+@node Mathematica Language Mode, Maple Language Mode, Giac Language Mode, Language Modes
 @subsection Mathematica Language Mode
 
 @noindent
@@ -14525,11 +14608,8 @@ pass through Calc.  As a special case, matrices are written as calls
 to the function @code{matrix}, given a list of lists as the argument,
 and can be read in this form or with all-capitals @code{MATRIX}.
 
-The Maple interval notation @samp{2 .. 3} has no surrounding brackets;
-Calc reads @samp{2 .. 3} as the closed interval @samp{[2 .. 3]}, and
-writes any kind of interval as @samp{2 .. 3}.  This means you cannot
-see the difference between an open and a closed interval while in
-Maple display mode.
+The Maple interval notation @samp{2 .. 3} is like Giac's interval
+notation, and is handled the same by Calc.
 
 Maple writes complex numbers as @samp{3 + 4*I}.  Its special constants
 are @code{Pi}, @code{E}, @code{I}, and @code{infinity} (all three of
index ec710caa81b300e4403dfd014930b7e977da3bec..7c3655b30445c05bf24353d69340714e5bb593a1 100644 (file)
@@ -1,3 +1,43 @@
+2007-12-29  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc-aent.el (math-read-token): Fix misplaced
+       parentheses.
+
+       * calc/calc-lang.el (calc-yacas-language, calc-maxima-language)
+       (calc-giac-language, math-yacas-parse-Sum, math-yacas-compose-sum)
+       (math-yacas-compose-deriv, math-yacas-compose-taylor)
+       (math-maxima-parse-subst, math-maxima-parse-taylor)
+       (math-maxima-compose-taylor, math-maxima-compose-subst)
+       (math-maxima-compose-if, math-lang-switch-args)
+       (math-lang-compose-switch-args, math-read-giac-subscr):
+       New functions.
+       (calc-lang-allow-underscores, calc-lang-allow-percentsigns)
+       (calc-lang-brackets-are-subscripts, calc-lang-c-type-hex):
+       Add languages.
+       (math-vector-brackets, math-complex-format, math-variable-table)
+       (math-parse-table, math-oper-table, math-function-table)
+       (math-special-function-table, math-compose-subscr):
+       Add values for new languages.
+
+       * calc/calccomp.el (math-compose-expr): Add new languages.
+
+       * calc/calc.el (calc-language): Add languages to docstring.
+
+       * calc/calc-ext.el (calc-init-extensions): Add keybindings
+       for new languages.  Autoload commands to change languages.
+
+       * calc/calc-help.el (calc-d-prefix-help): Add new languages.
+
+       * calc/calc-menu.el (calc-modes-menu): Add new languages.
+
+2007-12-28  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * vc-hg.el (vc-hg-registered): Return the false when vc-hg-state
+       returns 'ignored or 'unregistered.
+       (vc-hg-state): Pass "-A" to the status command and deal with the
+       output.
+       (vc-hg-dir-state): Pass "-A" to the status command.
+
 2007-12-29  Richard Stallman  <rms@gnu.org>
 
        * progmodes/compile.el (compilation-start): Set initial visible
index fbbd73b8fee96a32a1280dcd4f2eb35c3ca9f8b7..2ddd8645227c347ea85440bdd9c19bdb8649d6e2 100644 (file)
@@ -72,6 +72,8 @@ opinions.
 Summary of changes to "Calc"
 ------- -- ------- --  ----
 
+* Added support for Yacas, Maxima and Giac languages.
+
 * Added a menu.
 
 * Added logistic non-linear curves to curve-fitting.
index 5b93a544397c85a2244ed1aa4a67d9441f9f4af7..22022d8b0ce1912d424c70ff5a8c64e5232c8529 100644 (file)
@@ -775,9 +775,9 @@ in Calc algebraic input.")
              (setq math-exp-token 'string
                    math-expr-data (math-match-substring math-exp-str 1)
                    math-exp-pos (match-end 0)))
-            ((and (setq adfn (get calc-language 'math-lang-read)))
+            ((and (setq adfn (get calc-language 'math-lang-read))
                   (eval (nth 0 adfn))
-                  (eval (nth 1 adfn)))
+                  (eval (nth 1 adfn))))
            ((eq (string-match "%%.*$" math-exp-str math-exp-pos) math-exp-pos)
             (setq math-exp-pos (match-end 0))
             (math-read-token))
index 56b95ef218ebea508978c174968970360e999471..bde8d419203fa8b3a1ab4d6fa29e1172df65c6f7 100644 (file)
   (define-key calc-mode-map "dt" 'calc-truncate-stack)
   (define-key calc-mode-map "dw" 'calc-auto-why)
   (define-key calc-mode-map "dz" 'calc-leading-zeros)
+  (define-key calc-mode-map "dA" 'calc-giac-language)
   (define-key calc-mode-map "dB" 'calc-big-language)
   (define-key calc-mode-map "dD" 'calc-redo)
   (define-key calc-mode-map "dC" 'calc-c-language)
   (define-key calc-mode-map "dL" 'calc-latex-language)
   (define-key calc-mode-map "dU" 'calc-unformatted-language)
   (define-key calc-mode-map "dW" 'calc-maple-language)
+  (define-key calc-mode-map "dX" 'calc-maxima-language)
+  (define-key calc-mode-map "dY" 'calc-yacas-language)
   (define-key calc-mode-map "d[" 'calc-truncate-up)
   (define-key calc-mode-map "d]" 'calc-truncate-down)
   (define-key calc-mode-map "d." 'calc-point-char)
@@ -1053,6 +1056,7 @@ calc-keypad-press)
 
  ("calc-lang" calc-big-language calc-c-language calc-eqn-language
 calc-flat-language calc-fortran-language calc-maple-language
+calc-yacas-language calc-maxima-language calc-giac-language
 calc-mathematica-language calc-normal-language calc-pascal-language
 calc-tex-language calc-latex-language calc-unformatted-language)
 
index 49d1fd937ba1319b5833bc0b7a0c70ee42483ce8..409f96d13bccb96722c2b30a4ba0cf8d97a59b6b 100644 (file)
@@ -601,6 +601,7 @@ C-w  Describe how there is no warranty for Calc."
      "\" (strings); Truncate, [, ]; SPC (refresh), RET, @"
      "SHIFT + language: Normal, One-line, Big, Unformatted"
      "SHIFT + language: C, Pascal, Fortran; TeX, LaTeX, Eqn"
+     "SHIFT + language: Yacas, X=Maxima, A=Giac"
      "SHIFT + language: Mathematica, W=Maple")
    "display" ?d))
 
index 8d01914a06ed1ba49d176e02d250b1d65319ad5a..3c7a22b5ff09b67e2f191118ecb9a4f92ece2d81 100644 (file)
         (if (memq (nth 1 a) '(0 2)) ")" "]")))
 
 
+;;; Yacas
+
+(defun calc-yacas-language ()
+  "Change the Calc language to be Yacas-like."
+  (interactive)
+  (calc-wrapper
+   (calc-set-language 'yacas)
+   (message "`Yacas' language mode")))
+
+(put 'yacas 'math-vector-brackets "{}")
+
+(put 'yacas 'math-complex-format 'I)
+
+(add-to-list 'calc-lang-brackets-are-subscripts 'yacas)
+
+(put 'yacas 'math-variable-table
+     '(( Infinity    . var-inf)
+       ( Infinity    . var-uinf)
+       ( Undefined   . var-nan)
+       ( Pi          . var-pi)
+       ( E           . var-e) ;; Not really in Yacas
+       ( GoldenRatio . var-phi)
+       ( Gamma       . var-gamma)))
+
+(put 'yacas 'math-parse-table
+     '((("Deriv(" 0 ")" 0) 
+        calcFunc-deriv (var ArgB var-ArgB) (var ArgA var-ArgA))
+       (("D(" 0 ")" 0) 
+        calcFunc-deriv (var ArgB var-ArgB) (var ArgA var-ArgA))
+       (("Integrate(" 0 ")" 0) 
+        calcFunc-integ (var ArgB var-ArgB)(var ArgA var-ArgA))
+       (("Integrate(" 0 "," 0 "," 0 ")" 0) 
+        calcFunc-integ (var ArgD var-ArgD) (var ArgA var-ArgA) 
+        (var ArgB var-ArgB) (var ArgC var-ArgC))
+       (("Subst(" 0 "," 0 ")" 0) 
+        calcFunc-subst (var ArgC var-ArgC) (var ArgA var-ArgA) 
+        (var ArgB var-ArgB))
+       (("Taylor(" 0 "," 0 "," 0 ")" 0) 
+        calcFunc-taylor (var ArgD var-ArgD) 
+        (calcFunc-eq (var ArgA var-ArgA) (var ArgB var-ArgB)) 
+        (var ArgC var-ArgC))))
+
+(put 'yacas 'math-oper-table
+     '(("+"    +               30  30)
+       ("-"    -               30  60)
+       ("*"    *               60  60)
+       ("/"    /               70  70)
+       ("u-"   neg             -1  60)
+       ("^"    ^               80  80)
+       ("u+"   ident           -1  30)
+       ("<<"   calcFunc-lsh    80  80)
+       (">>"   calcFunc-rsh    80  80)
+       ("!"    calcFunc-fact   80  -1)
+       ("!!"   calcFunc-dfact  80  -1)
+       ("X"    calcFunc-cross  70  70)
+       ("="    calcFunc-eq     10  10)
+       ("!="   calcFunc-neq    10  10)
+       ("<"    calcFunc-lt     10  10)
+       (">"    calcFunc-gt     10  10)
+       ("<="   calcFunc-leq    10  10)
+       (">="   calcFunc-geq    10  10)
+       ("And"  calcFunc-land    5   5)
+       ("Or"   calcFunc-or      4   4)
+       ("Not"  calcFunc-lnot   -1   3)
+       (":="   calcFunc-assign  1   1)))
+
+(put 'yacas 'math-function-table
+     '(( Div   .  calcFunc-idiv)
+       ( Mod   .  calcFunc-mod)
+       ( Abs   .  calcFunc-abs)
+       ( Sign  .  calcFunc-sign)
+       ( Sqrt  .  calcFunc-sqrt)
+       ( Max   .  calcFunc-max)
+       ( Min   .  calcFunc-min)
+       ( Floor .  calcFunc-floor)
+       ( Ceil  .  calcFunc-ceil)
+       ( Round .  calcFunc-round)
+       ( Conjugate . calcFunc-conj)
+       ( Arg   .  calcFunc-arg)
+       ( Re    .  calcFunc-re)
+       ( Im    .  calcFunc-im)
+       ( Rationalize . calcFunc-pfrac)
+       ( Sin   .  calcFunc-sin)
+       ( Cos   .  calcFunc-cos)
+       ( Tan   .  calcFunc-tan)
+       ( Sec   .  calcFunc-sec)
+       ( Csc   .  calcFunc-csc)
+       ( Cot   .  calcFunc-cot)
+       ( ArcSin . calcFunc-arcsin)
+       ( ArcCos . calcFunc-arccos)
+       ( ArcTan . calcFunc-arctan)
+       ( Sinh   .  calcFunc-sinh)
+       ( Cosh   .  calcFunc-cosh)
+       ( Tanh   .  calcFunc-tanh)
+       ( Sech   .  calcFunc-sech)
+       ( Csch   .  calcFunc-csch)
+       ( Coth   .  calcFunc-coth)
+       ( ArcSinh . calcFunc-arcsinh)
+       ( ArcCosh . calcFunc-arccosh)
+       ( ArcTanh . calcFunc-arctanh)
+       ( Ln     .  calcFunc-ln)
+       ( Exp    .  calcFunc-exp)
+       ( Gamma  .  calcFunc-gamma)
+       ( Gcd    .  calcFunc-gcd)
+       ( Lcm    .  calcFunc-lcm)
+       ( Bin    .  calcFunc-choose)
+       ( Bernoulli . calcFunc-bern)
+       ( Euler  .  calcFunc-euler)
+       ( StirlingNumber1 . calcFunc-stir1)
+       ( StirlingNumber2 . calcFunc-stir2)
+       ( IsPrime .  calcFunc-prime)
+       ( Factors . calcFunc-prfac)
+       ( NextPrime . calcFunc-nextprime)
+       ( Moebius . calcFunc-moebius)
+       ( Random  . calcFunc-random)
+       ( Concat  . calcFunc-vconcat)
+       ( Head    . calcFunc-head)
+       ( Tail    . calcFunc-tail)
+       ( Length  . calcFunc-vlen)
+       ( Reverse . calcFunc-rev)
+       ( CrossProduct . calcFunc-cross)
+       ( Dot . calcFunc-mul)
+       ( DiagonalMatrix . calcFunc-diag)
+       ( Transpose . calcFunc-trn)
+       ( Inverse . calcFunc-inv)
+       ( Determinant . calcFunc-det)
+       ( Trace . calcFunc-tr)
+       ( RemoveDuplicates . calcFunc-rdup)
+       ( Union . calcFunc-vunion)
+       ( Intersection . calcFunc-vint)
+       ( Difference . calcFunc-vdiff)
+       ( Apply . calcFunc-apply)
+       ( Map . calcFunc-map)
+       ( Simplify . calcFunc-simplify)
+       ( ExpandBrackets . calcFunc-expand)
+       ( Solve . calcFunc-solve)
+       ( Degree . calcFunc-pdeg)
+       ( If     . calcFunc-if)
+       ( Contains . (math-lang-switch-args calcFunc-in))
+       ( Sum . (math-yacas-parse-Sum calcFunc-sum))
+       ( Factorize . (math-yacas-parse-Sum calcFunc-prod))))
+
+(put 'yacas 'math-special-function-table
+     '(( calcFunc-sum  . (math-yacas-compose-sum "Sum"))
+       ( calcFunc-prod . (math-yacas-compose-sum "Factorize"))
+       ( calcFunc-deriv . (math-yacas-compose-deriv "Deriv"))
+       ( calcFunc-integ . (math-yacas-compose-deriv "Integrate"))
+       ( calcFunc-taylor . math-yacas-compose-taylor)
+       ( calcFunc-in    .  (math-lang-compose-switch-args "Contains"))))
+
+(put 'yacas 'math-compose-subscr
+     (function
+      (lambda (a)
+        (let ((args (cdr (cdr a))))
+          (list 'horiz
+                (math-compose-expr (nth 1 a) 1000)
+                "["
+                (math-compose-vector args ", " 0)
+                "]")))))
+
+(defun math-yacas-parse-Sum (f val)
+  "Read in the arguments to \"Sum\" in Calc's Yacas mode."
+  (let ((args (math-read-expr-list)))
+    (math-read-token)
+    (list (nth 2 f)
+          (nth 3 args)
+          (nth 0 args)
+          (nth 1 args)
+          (nth 2 args))))
+
+(defun math-yacas-compose-sum (a fn)
+  "Compose the \"Sum\" function in Calc's Yacas mode."
+  (list 'horiz
+        (nth 1 fn)
+        "("
+        (math-compose-expr (nth 2 a) -1)
+        ","
+        (math-compose-expr (nth 3 a) -1)
+        ","
+        (math-compose-expr (nth 4 a) -1)
+        ","
+        (math-compose-expr (nth 1 a) -1)
+        ")"))
+
+(defun math-yacas-compose-deriv (a fn)
+  "Compose the \"Deriv\" function in Calc's Yacas mode."
+  (list 'horiz
+        (nth 1 fn)
+        "("
+        (math-compose-expr (nth 2 a) -1)
+        (if (not (nth 3 a))
+            ")"
+          (concat 
+           ","
+           (math-compose-expr (nth 3 a) -1)
+           ","
+           (math-compose-expr (nth 4 a) -1)
+           ")"))
+        " "
+        (math-compose-expr (nth 1 a) -1)))
+
+(defun math-yacas-compose-taylor (a)
+  "Compose the \"Taylor\" function in Calc's Yacas mode."
+  (list 'horiz
+        "Taylor("
+        (if (eq (car-safe (nth 2 a)) 'calcFunc-eq)
+            (concat (math-compose-expr (nth 1 (nth 2 a)) -1)
+                    ","
+                    (math-compose-expr (nth 2 (nth 2 a)) -1))
+          (concat (math-compose-expr (nth 2 a) -1) ",0"))
+        ","
+        (math-compose-expr (nth 3 a) -1)
+        ") "
+        (math-compose-expr (nth 1 a) -1)))
+
+
+;;; Maxima
+
+(defun calc-maxima-language ()
+  "Change the Calc language to be Maxima-like."
+  (interactive)
+  (calc-wrapper
+   (calc-set-language 'maxima)
+   (message "`Maxima' language mode")))
+
+(put 'maxima 'math-oper-table
+     '(("+"    +               100  100)
+       ("-"    -               100  134)
+       ("*"    *               120  120)
+       ("."    *               130  129)       
+       ("/"    /               120  120)
+       ("u-"   neg              -1  180)
+       ("u+"   ident            -1  180)
+       ("^"    ^               140  139)
+       ("**"   ^               140  139)
+       ("!"    calcFunc-fact   160   -1)
+       ("!!"   calcFunc-dfact  160   -1)
+       ("="    calcFunc-eq      80   80)
+       ("#"    calcFunc-neq     80   80)
+       ("<"    calcFunc-lt      80   80)
+       (">"    calcFunc-gt      80   80)
+       ("<="   calcFunc-leq     80   80)
+       (">="   calcFunc-geq     80   80)
+       ("and"  calcFunc-land    65   65)
+       ("or"   calcFunc-or      60   60)
+       ("not"  calcFunc-lnot    -1   70)
+       (":"    calcFunc-assign 180   20)))
+
+
+(put 'maxima 'math-function-table
+     '(( matrix .  vec)
+       ( abs    .  calcFunc-abs)
+       ( cabs   .  calcFunc-abs)
+       ( signum .  calcFunc-sign)
+       ( floor  .  calcFunc-floor)
+       ( entier .  calcFunc-floor)
+       ( fix    .  calcFunc-floor)
+       ( conjugate . calcFunc-conj )
+       ( carg   .  calcFunc-arg)
+       ( realpart . calcFunc-re)
+       ( imagpart . calcFunc-im)
+       ( rationalize . calcFunc-pfrac)
+       ( asin   .  calcFunc-arcsin)
+       ( acos   .  calcFunc-arccos)
+       ( atan   .  calcFunc-arctan)
+       ( atan2  .  calcFunc-arctan2)
+       ( asinh  .  calcFunc-arcsinh)
+       ( acosh  .  calcFunc-arccosh)
+       ( atanh  .  calcFunc-arctanh)
+       ( log    .  calcFunc-ln)
+       ( plog    .  calcFunc-ln)
+       ( bessel_j . calcFunc-besJ)
+       ( bessel_y . calcFunc-besY)
+       ( factorial . calcFunc-fact)
+       ( binomial . calcFunc-choose)
+       ( primep  . calcFunc-prime)
+       ( next_prime . calcFunc-nextprime)
+       ( prev_prime . calcFunc-prevprime)
+       ( append  .  calcFunc-vconcat)
+       ( rest  .  calcFunc-tail)
+       ( reverse . calcFunc-rev)
+       ( innerproduct . calcFunc-mul)
+       ( inprod . calcFunc-mul)
+       ( row . calcFunc-mrow)
+       ( columnvector . calcFunc-mcol)
+       ( covect . calcFunc-mcol)
+       ( transpose . calcFunc-trn)
+       ( invert . calcFunc-inv)
+       ( determinant . calcFunc-det)
+       ( mattrace . calcFunc-tr)
+       ( member . calcFunc-in)
+       ( lmax . calcFunc-vmax)
+       ( lmin . calcFunc-vmin)
+       ( distrib . calcFunc-expand)
+       ( partfrac . calcFunc-apart)
+       ( rat . calcFunc-nrat)
+       ( product . calcFunc-prod)
+       ( diff . calcFunc-deriv)
+       ( integrate . calcFunc-integ)
+       ( quotient . calcFunc-pdiv)
+       ( remainder . calcFunc-prem)
+       ( divide . calcFunc-pdivrem)
+       ( equal  . calcFunc-eq)
+       ( notequal . calcFunc-neq)
+       ( rhs  . calcFunc-rmeq)
+       ( subst . (math-maxima-parse-subst))
+       ( substitute . (math-maxima-parse-subst))
+       ( taylor . (math-maxima-parse-taylor))))
+
+(defun math-maxima-parse-subst (f val)
+  "Read in the arguments to \"subst\" in Calc's Maxima mode."
+  (let ((args (math-read-expr-list)))
+    (math-read-token)
+    (list 'calcFunc-subst
+          (nth 1 args)
+          (nth 2 args)
+          (nth 0 args))))
+
+(defun math-maxima-parse-taylor (f val)
+  "Read in the arguments to \"taylor\" in Calc's Maxima mode."
+  (let ((args (math-read-expr-list)))
+    (math-read-token)
+    (list 'calcFunc-taylor
+          (nth 0 args)
+          (list 'calcFunc-eq
+                (nth 1 args)
+                (nth 2 args))
+          (nth 3 args))))
+
+(put 'maxima 'math-parse-table
+     '((("if" 0 "then" 0 "else" 0) 
+        calcFunc-if 
+        (var ArgA var-ArgA) 
+        (var ArgB var-ArgB)
+        (var ArgC var-ArgC))))
+
+(put 'maxima 'math-special-function-table
+     '(( calcFunc-taylor . math-maxima-compose-taylor)
+       ( calcFunc-subst .  math-maxima-compose-subst)
+       ( calcFunc-if    .  math-maxima-compose-if)))
+
+(defun math-maxima-compose-taylor (a)
+  "Compose the \"taylor\" function in Calc's Maxima mode."
+  (list 'horiz
+        "taylor("
+        (math-compose-expr (nth 1 a) -1)
+        ","
+        (if (eq (car-safe (nth 2 a)) 'calcFunc-eq)
+            (concat (math-compose-expr (nth 1 (nth 2 a)) -1)
+                    ","
+                    (math-compose-expr (nth 2 (nth 2 a)) -1))
+          (concat (math-compose-expr (nth 2 a) -1) ",0"))
+        ","
+        (math-compose-expr (nth 3 a) -1)
+        ")"))
+
+(defun math-maxima-compose-subst (a)
+  "Compose the \"subst\" function in Calc's Maxima mode."
+  (list 'horiz
+        "substitute("
+        (math-compose-expr (nth 2 a) -1)
+        ","
+        (math-compose-expr (nth 3 a) -1)
+        ","
+        (math-compose-expr (nth 1 a) -1)
+        ")"))
+
+(defun math-maxima-compose-if (a)
+  "Compose the \"if\" function in Calc's Maxima mode."
+  (list 'horiz
+        "if "
+        (math-compose-expr (nth 1 a) -1)
+        " then "
+        (math-compose-expr (nth 2 a) -1)
+        " else "
+        (math-compose-expr (nth 3 a) -1)))
+
+(put 'maxima 'math-variable-table
+     '(( infinity    . var-uinf)
+       ( %pi         . var-pi)
+       ( %e          . var-e)
+       ( %i          . var-i)
+       ( %phi        . var-phi)
+       ( %gamma      . var-gamma)))
+
+(put 'maxima 'math-complex-format '%i)
+
+(add-to-list 'calc-lang-allow-underscores 'maxima)
+
+(add-to-list 'calc-lang-allow-percentsigns 'maxima)
+
+(add-to-list 'calc-lang-brackets-are-subscripts 'maxima)
+
+(put 'maxima 'math-compose-subscr
+     (function
+      (lambda (a)
+        (let ((args (cdr (cdr a))))
+          (list 'horiz
+                (math-compose-expr (nth 1 a) 1000)
+                "["
+                (math-compose-vector args ", " 0)
+                "]")))))
+
+(put 'maxima 'math-matrix-formatter
+     (function
+      (lambda (a)
+        (list 'horiz
+              "matrix("
+              (math-compose-vector (cdr a) 
+                                   (concat math-comp-comma " ")
+                                   math-comp-vector-prec)
+              ")"))))
+
+
+;;; Giac
+
+(defun calc-giac-language ()
+  "Change the Calc language to be Giac-like."
+  (interactive)
+  (calc-wrapper
+   (calc-set-language 'giac)
+   (message "`Giac' language mode")))
+
+(put 'giac 'math-oper-table
+  '( ( "["    (math-read-giac-subscr) 250 -1 )
+     ( "+"     +            180 181 )
+     ( "-"     -            180 181 )
+     ( "/"     /            191 192 )
+     ( "*"     *            191 192 )
+     ( "^"     ^            201 200 )
+     ( "u+"    ident        -1  197 )
+     ( "u-"    neg          -1  197 )
+     ( "!"     calcFunc-fact  210 -1 )
+     ( ".."    (math-read-maple-dots) 165 165 )
+     ( "\\dots" (math-read-maple-dots) 165 165 )
+     ( "intersect" calcFunc-vint 191 192 )
+     ( "union" calcFunc-vunion 180 181 )
+     ( "minus" calcFunc-vdiff 180 181 )
+     ( "<"     calcFunc-lt   160 160 )
+     ( ">"     calcFunc-gt   160 160 )
+     ( "<="    calcFunc-leq  160 160 )
+     ( ">="    calcFunc-geq  160 160 )
+     ( "="     calcFunc-eq   160 160 )
+     ( "=="    calcFunc-eq   160 160 )
+     ( "!="    calcFunc-neq  160 160 )
+     ( "and"   calcFunc-land 110 111 )
+     ( "or"    calcFunc-lor  100 101 )
+     ( "&&"    calcFunc-land 110 111 )
+     ( "||"    calcFunc-lor  100 101 )
+     ( "not"   calcFunc-lnot -1  121 )
+     ( ":="    calcFunc-assign 51 50 )))
+
+
+(put 'giac 'math-function-table
+     '(( rdiv   .  calcFunc-div)
+       ( iquo   .  calcFunc-idiv)
+       ( irem   .  calcFunc-mod)
+       ( remain .  calcFunc-mod)
+       ( floor  .  calcFunc-floor)
+       ( iPart  .  calcFunc-floor)
+       ( ceil   .  calcFunc-ceil)
+       ( ceiling .  calcFunc-ceil)
+       ( re     .  calcFunc-re)
+       ( real   .  calcFunc-re)
+       ( im     .  calcFunc-im)
+       ( imag   .  calcFunc-im)
+       ( float2rational . calcFunc-pfrac)
+       ( exact  .  calcFunc-pfrac)
+       ( evalf  .  calcFunc-pfloat)
+       ( bitand .  calcFunc-and)
+       ( bitor  .  calcFunc-or)
+       ( bitxor .  calcFunc-xor)
+       ( asin   .  calcFunc-arcsin)
+       ( acos   .  calcFunc-arccos)
+       ( atan   .  calcFunc-arctan)
+       ( asinh  .  calcFunc-arcsinh)
+       ( acosh  .  calcFunc-arccosh)
+       ( atanh  .  calcFunc-arctanh)
+       ( log    .  calcFunc-ln)
+       ( logb   .  calcFunc-log)
+       ( factorial . calcFunc-fact)
+       ( comb   .  calcFunc-choose)
+       ( binomial . calcFunc-choose)
+       ( nCr    .  calcFunc-choose)
+       ( perm   .  calcFunc-perm)
+       ( nPr    .  calcFunc-perm)
+       ( bernoulli . calcFunc-bern)
+       ( is_prime . calcFunc-prime)
+       ( isprime  . calcFunc-prime)
+       ( isPrime  . calcFunc-prime)
+       ( ifactors . calcFunc-prfac)
+       ( euler    . calcFunc-totient)
+       ( phi      . calcFunc-totient)
+       ( rand     . calcFunc-random)
+       ( concat   . calcFunc-vconcat)
+       ( augment  . calcFunc-vconcat)
+       ( mid      . calcFunc-subvec)
+       ( length   . calcFunc-length)
+       ( size     . calcFunc-length)
+       ( nops     . calcFunc-length)
+       ( SortA    . calcFunc-sort)
+       ( SortB    . calcFunc-rsort)
+       ( revlist  . calcFunc-rev)
+       ( cross    . calcFunc-cross)
+       ( crossP   . calcFunc-cross)
+       ( crossproduct . calcFunc-cross)
+       ( mul      . calcFunc-mul)
+       ( dot      . calcFunc-mul)
+       ( dotprod  . calcFunc-mul)
+       ( dotP     . calcFunc-mul)
+       ( scalar_product . calcFunc-mul)
+       ( scalar_Product . calcFunc-mul)
+       ( row      . calcFunc-mrow)
+       ( col      . calcFunc-mcol)
+       ( dim      . calcFunc-mdims)
+       ( tran     . calcFunc-trn)
+       ( transpose . calcFunc-trn)
+       ( lu       . calcFunc-lud)
+       ( trace    . calcFunc-tr)
+       ( member   . calcFunc-in)
+       ( sum      . calcFunc-vsum)
+       ( add      . calcFunc-vsum)
+       ( product  . calcFunc-vprod)
+       ( mean     . calcFunc-vmean)
+       ( median   . calcFunc-vmedian)
+       ( stddev   . calcFunc-vsdev)
+       ( stddevp  . calcFunc-vpsdev)
+       ( variance . calcFunc-vpvar)
+       ( map      . calcFunc-map)
+       ( apply    . calcFunc-map)
+       ( of       . calcFunc-map)
+       ( zip      . calcFunc-map)
+       ( expand   . calcFunc-expand)
+       ( fdistrib . calcFunc-expand)
+       ( partfrac . calcFunc-apart)
+       ( ratnormal . calcFunc-nrat)
+       ( diff     . calcFunc-deriv)
+       ( derive   . calcFunc-deriv)
+       ( integrate . calcFunc-integ)
+       ( int      . calcFunc-integ)
+       ( Int      . calcFunc-integ)
+       ( romberg  . calcFunc-ninteg)
+       ( nInt     . calcFunc-ninteg)
+       ( lcoeff   . calcFunc-plead)
+       ( content  . calcFunc-pcont)
+       ( primpart . calcFunc-pprim)
+       ( quo      . calcFunc-pdiv)
+       ( rem      . calcFunc-prem)
+       ( quorem   . calcFunc-pdivrem)
+       ( divide   . calcFunc-pdivrem)
+       ( equal    . calcFunc-eq)
+       ( ifte     . calcFunc-if)
+       ( not      . calcFunc-lnot)
+       ( rhs      . calcFunc-rmeq)
+       ( right    . calcFunc-rmeq)
+       ( prepend  . (math-lang-switch-args calcFunc-cons))
+       ( contains . (math-lang-switch-args calcFunc-in))
+       ( has      . (math-lang-switch-args calcFunc-refers))))
+
+(defun math-lang-switch-args (f val)
+  "Read the arguments to a Calc function in reverse order.
+This is used for various language modes which have functions in reverse
+order to Calc's."
+  (let ((args (math-read-expr-list)))
+    (math-read-token)
+    (list (nth 2 f)
+          (nth 1 args)
+          (nth 0 args))))
+
+(put 'giac 'math-parse-table
+     '((("set" 0) 
+        calcFunc-rdup
+        (var ArgA var-ArgA))))
+
+(put 'giac 'math-special-function-table
+     '((calcFunc-cons . (math-lang-compose-switch-args "prepend"))
+       (calcFunc-in   . (math-lang-compose-switch-args "contains"))
+       (calcFunc-refers . (math-lang-compose-switch-args "has"))
+       (intv . math-compose-maple-intv)))
+
+(defun math-lang-compose-switch-args (a fn)
+  "Compose the arguments to a Calc function in reverse order.
+This is used for various language modes which have functions in reverse
+order to Calc's."
+  (list 'horiz (nth 1 fn) 
+        "("
+        (math-compose-expr (nth 2 a) 0)
+        ","
+        (math-compose-expr (nth 1 a) 0)
+        ")"))
+
+(put 'giac 'math-variable-table
+     '(( infinity    . var-inf)
+       ( infinity    . var-uinf)))
+
+(add-to-list 'calc-lang-allow-underscores 'giac)
+
+(put 'giac 'math-compose-subscr
+     (function
+      (lambda (a)
+        (let ((args (cdr (cdr a))))
+          (list 'horiz
+                (math-compose-expr (nth 1 a) 1000)
+                "["
+                (math-compose-expr 
+                 (calc-normalize (list '- (nth 2 a) 1)) 0)
+                "]")))))
+
+(defun math-read-giac-subscr (x op)
+  (let ((idx (math-read-expr-level 0)))
+    (or (equal math-expr-data "]")
+       (throw 'syntax "Expected ']'"))
+    (math-read-token)
+    (list 'calcFunc-subscr x (calc-normalize (list '+ idx 1)))))
+
+(add-to-list 'calc-lang-c-type-hex 'giac)
+
+
 (defun calc-mathematica-language ()
   (interactive)
   (calc-wrapper
index 22c42adc124627fe3ae8f2e842d4de63b219fb4b..dd9ec9a2542afe5dd6a92e7531f44b3019729277 100644 (file)
                  (call-interactively 'calc-eqn-language))
                :keys "d E"
                :style radio
-               :selected (eq calc-language 'eqn)])
+               :selected (eq calc-language 'eqn)]
+              ["Yacas"
+               (progn
+                 (require 'calc-lang)
+                 (call-interactively 'calc-yacas-language))
+               :keys "d Y"
+               :style radio
+               :selected (eq calc-language 'yacas)]
+              ["Maxima"
+               (progn
+                 (require 'calc-lang)
+                 (call-interactively 'calc-maxima-language))
+               :keys "d X"
+               :style radio
+               :selected (eq calc-language 'maxima)]
+              ["Giac"
+               (progn
+                 (require 'calc-lang)
+                 (call-interactively 'calc-giac-language))
+               :keys "d A"
+               :style radio
+               :selected (eq calc-language 'giac)])
         "----"
         ["Save mode settings" calc-save-modes :keys "m m"]
         "----"
index 76b01a61ec4aebce8417795216f69738b738414c..3b3e308eb18c9c21943bec9d61bae40b968e90f4 100644 (file)
@@ -685,6 +685,9 @@ If `C' is present, display outer brackets for matrices (centered).")
   tex          Use TeX notation.
   latex         Use LaTeX notation.
   eqn          Use eqn notation.
+  yacas         Use Yacas notation.
+  maxima        Use Maxima notation.
+  giac          Use Giac notation.
   math         Use Mathematica(tm) notation.
   maple                Use Maple notation.")
 
index 2b81363af47782ecf157e5755b622154bf6a21f6..e54d86dc2964c9c11f88fcd68a20e8bf698370b8 100644 (file)
                                      ( tex . math-compose-tex )
                                      ( latex . math-compose-latex )
                                      ( eqn . math-compose-eqn )
+                                      ( yacas . math-compose-yacas )
+                                      ( maxima . math-compose-maxima )
+                                      ( giac . math-compose-giac )
                                      ( math . math-compose-math )
                                      ( maple . math-compose-maple ))))
                    (setq op (get (car a) (cdr op)))
index 592bccaf5177352be6a9b7f36d4000a20b8b84ea..41cc883c0a4cd5920edbcb1f65c3fcd70e5fb02a 100644 (file)
 (defun vc-hg-registered (file)
   "Return non-nil if FILE is registered with hg."
   (when (vc-hg-root file)           ; short cut
-    (vc-file-setprop file 'vc-state (vc-hg-state file)))) ; expensive
+    (let ((state (vc-hg-state file)))  ; expensive
+      (vc-file-setprop file 'vc-state state)
+      (not (memq state '(ignored unregistered))))))
 
 (defun vc-hg-state (file)
   "Hg-specific version of `vc-state'."
                      ;; Ignore all errors.
                      (call-process
                       "hg" nil t nil "--cwd" (file-name-directory file)
-                      "status" (file-name-nondirectory file))
+                      "status" "-A" (file-name-nondirectory file))
                    ;; Some problem happened.  E.g. We can't find an `hg'
                    ;; executable.
                    (error nil)))))))
     (when (eq 0 status)
-      (if (eq 0 (length out)) 'up-to-date
        (when (null (string-match ".*: No such file or directory$" out))
          (let ((state (aref out 0)))
            (cond
+            ((eq state ?C) 'up-to-date)
             ((eq state ?A) 'edited)
             ((eq state ?M) 'edited)
             ((eq state ?I) 'ignored)
             ((eq state ?R) 'unregistered)
             ((eq state ??) 'unregistered)
-            (t 'up-to-date))))))))
+            (t 'up-to-date)))))))
 
 (defun vc-hg-dir-state (dir)
   (with-temp-buffer
     (buffer-disable-undo)              ;; Because these buffers can get huge
-    (vc-hg-command (current-buffer) nil nil "status")
+    (vc-hg-command (current-buffer) nil nil "status" "-A")
     (goto-char (point-min))
     (let ((status-char nil)
          (file nil))
index be2c5824f51470ede9927380762a5ecc22ce5c6b..aca22996d14f117b3aa268d67ceafc2ffd0f1719 100644 (file)
@@ -1,8 +1,5 @@
 2007-12-24  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
-       * process.c (make_process): Initialize pty_flag to Qnil instead of 0
-       as it is not a bit field on Emacs 22 yet.
-
        * xdisp.c (phys_cursor_in_rect_p): Check if cursor is in fringe area.
 
 2007-12-22  Eli Zaretskii  <eliz@gnu.org>
index 542bf4fdda5e265ec889e5e519704d0ade042a41..c2f0c82a6a85cc7ca5454f8c92c50bbbdc164e1c 100644 (file)
@@ -631,7 +631,7 @@ make_process (name)
   p->tick = 0;
   p->update_tick = 0;
   p->pid = 0;
-  p->pty_flag = Qnil;
+  p->pty_flag = 0;
   p->raw_status_new = 0;
   p->status = Qrun;
   p->mark = Fmake_marker ();