// -*- mode:C++ ; compile-command: "g++ -I.. -g -c rpn.cc" -*-
/*
 *  Copyright (C) 2001 B. Parisse, Institut Fourier, 38402 St Martin d'Heres
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef _GIAC_RPN_H
#define _GIAC_RPN_H
#include "first.h"

#include "gen.h"
#include "vecteur.h"
#include <string>
#include <ctype.h>

#ifndef NO_NAMESPACE_GIAC
namespace giac {
#endif // ndef NO_NAMESPACE_GIAC

  std::string printasconstant(const gen & feuille,const std::string & sommetstr,GIAC_CONTEXT);
  extern bool rpn_mode;
  std::string enmajuscule(const std::string & s);
  gen _PERCENT(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_PERCENT;
  void roll(int i,vecteur & v);
  void ROLL(int i,GIAC_CONTEXT);
  gen symb_ROLL(const gen & args);
  gen _ROLL(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_ROLL;

  void rolld(int i,vecteur & v);
  void ROLLD(int i,GIAC_CONTEXT);
  gen symb_ROLLD(const gen & args);
  gen _ROLLD(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_ROLLD;

  void stack_swap(vecteur & v);
  void SWAP(GIAC_CONTEXT);
  gen symb_SWAP(const gen & args);
  gen _SWAP(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_SWAP;

  void dup(vecteur & v);
  gen symb_DUP(const gen & args);
  gen _DUP(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_DUP;

  void over(vecteur & v);
  gen symb_OVER(const gen & args);
  gen _OVER(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_OVER;

  void pick(int i,vecteur & v);
  gen symb_PICK(const gen & args);
  gen _PICK(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_PICK;

  void drop(vecteur & v);
  gen symb_DROP(const gen & args);
  gen _DROP(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_DROP;

  gen symb_NOP(const gen & args);
  gen _NOP(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_NOP;

  gen symb_IFTE(const gen & args);
  gen _IFTE(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_IFTE;

  gen symb_RPN_LOCAL(const gen & a,const gen & b);
  gen _RPN_LOCAL(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_RPN_LOCAL;

  gen symb_RPN_FOR(const gen & a,const gen & b);
  gen _RPN_FOR(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_RPN_FOR;

  gen symb_RPN_WHILE(const gen & a,const gen & b);
  gen _RPN_WHILE(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_RPN_WHILE;

  gen symb_RPN_UNTIL(const gen & a,const gen & b);
  gen _RPN_UNTIL(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_RPN_UNTIL;

  gen symb_RPN_CASE(const gen & a);
  gen _RPN_CASE(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_RPN_CASE;

  gen symb_RCL(const gen & a,const gen & b);
  gen _RCL(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_RCL;

  gen symb_VARS(const gen & a,const gen & b);
  gen _VARS(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_VARS;

  gen symb_purge(const gen & a,const gen & b);
  gen _purge(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_purge;

  gen symb_rpn(const gen & args);
  gen _rpn(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_rpn;

  gen symb_alg(const gen & args);
  gen _alg(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_alg;

  gen symb_rpn_prog(const gen & args);
  gen _rpn_prog(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_rpn_prog;
  vecteur rpn_eval(const vecteur & prog,vecteur & pile,GIAC_CONTEXT);
  vecteur rpn_eval(const gen & prog,vecteur & pile,GIAC_CONTEXT);

  gen symb_division(const gen & a,const gen & b);
  gen symb_division(const gen & args);
  gen _division(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_division;

  gen symb_binary_minus(const gen & a,const gen & b);
  gen symb_binary_minus(const gen & args);
  gen _binary_minus(const gen & args,GIAC_CONTEXT);
  extern const unary_function_ptr at_binary_minus;
  vecteur tab2vecteur(gen tab[]);

  extern const unary_function_ptr at_SIN ;
  extern const unary_function_ptr at_COS ;
  extern const unary_function_ptr at_TAN ;
  extern const unary_function_ptr at_EXP ;
  extern const unary_function_ptr at_LN ;

#ifndef NO_NAMESPACE_GIAC
} // namespace giac
#endif // ndef NO_NAMESPACE_GIAC

#endif // _GIAC_RPN_H
