X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginsh%2Fginsh_parser.ypp;h=e224fda93cafb5a240b298673799678f04ba6d15;hp=20243ba75ebf63a166a84695e4cd9b86a637e396;hb=f9880838cc42de5dfbedcbc181eaedf6c07bfc75;hpb=c12c8ec3c5cf0c75f061f6c52d04206277bbdcca diff --git a/ginsh/ginsh_parser.ypp b/ginsh/ginsh_parser.ypp index 20243ba7..e224fda9 100644 --- a/ginsh/ginsh_parser.ypp +++ b/ginsh/ginsh_parser.ypp @@ -4,7 +4,7 @@ * This file must be processed with yacc/bison. */ /* - * GiNaC Copyright (C) 1999-2016 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2020 Johannes Gutenberg University Mainz, Germany * * 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 @@ -45,6 +45,9 @@ #include "ginsh.h" +using namespace std; +using namespace GiNaC; + #define YYERROR_VERBOSE 1 #ifdef HAVE_LIBREADLINE @@ -90,7 +93,7 @@ typedef ex (*fcnp)(const exprseq &e); typedef ex (*fcnp2)(const exprseq &e, int serial); struct fcn_desc { - fcn_desc() : p(NULL), num_params(0), is_ginac(false), serial(0) {} + fcn_desc() : p(nullptr), num_params(0), is_ginac(false), serial(0) {} fcn_desc(fcnp func, int num) : p(func), num_params(num), is_ginac(false), serial(0) {} fcn_desc(fcnp2 func, int num, int ser) : p((fcnp)func), num_params(num), is_ginac(true), serial(ser) {} @@ -238,7 +241,7 @@ line : ';' exp : T_NUMBER {$$ = $1;} | T_SYMBOL { - exmap::const_iterator i = assigned_symbol_table.find($1); + auto i = assigned_symbol_table.find($1); if (i == assigned_symbol_table.end()) $$ = $1; else @@ -251,7 +254,7 @@ exp : T_NUMBER {$$ = $1;} | T_QUOTE2 {$$ = exstack[1];} | T_QUOTE3 {$$ = exstack[2];} | T_SYMBOL '(' exprseq ')' { - fcn_tab::const_iterator i = find_function($1, $3.nops()); + auto i = find_function($1, $3.nops()); if (i->second.is_ginac) { $$ = ((fcnp2)(i->second.p))(ex_to($3), i->second.serial); } else { @@ -343,7 +346,7 @@ static ex f_lcoeff(const exprseq &e) {return e[0].lcoeff(e[1]);} static ex f_ldegree(const exprseq &e) {return e[0].ldegree(e[1]);} static ex f_lsolve(const exprseq &e) {return lsolve(e[0], e[1]);} static ex f_nops(const exprseq &e) {return e[0].nops();} -static ex f_normal1(const exprseq &e) {return e[0].normal();} +static ex f_normal(const exprseq &e) {return e[0].normal();} static ex f_numer(const exprseq &e) {return e[0].numer();} static ex f_numer_denom(const exprseq &e) {return e[0].numer_denom();} static ex f_pow(const exprseq &e) {return pow(e[0], e[1]);} @@ -439,7 +442,7 @@ static ex f_integer_content(const exprseq &e) static ex f_integral(const exprseq &e) { CHECK_ARG(0, symbol, integral); - return integral(e[0], e[1], e[2], e[3]); + return GiNaC::integral(e[0], e[1], e[2], e[3]); } static ex f_inverse(const exprseq &e) @@ -480,12 +483,6 @@ static ex f_match(const exprseq &e) throw std::runtime_error("FAIL"); } -static ex f_normal2(const exprseq &e) -{ - CHECK_ARG(1, numeric, normal); - return e[0].normal(ex_to(e[1]).to_int()); -} - static ex f_op(const exprseq &e) { CHECK_ARG(1, numeric, op); @@ -626,8 +623,7 @@ static const fcn_init builtin_fcns[] = { {"map", f_map, 2}, {"match", f_match, 2}, {"nops", f_nops, 1}, - {"normal", f_normal1, 1}, - {"normal", f_normal2, 2}, + {"normal", f_normal, 1}, {"numer", f_numer, 1}, {"numer_denom", f_numer_denom, 1}, {"op", f_op, 2}, @@ -654,7 +650,7 @@ static const fcn_init builtin_fcns[] = { {"transpose", f_transpose, 1}, {"unassign", f_unassign, 1}, {"unit", f_unit, 2}, - {NULL, f_dummy, 0} // End marker + {nullptr, f_dummy, 0} // End marker }; struct fcn_help_init { @@ -692,7 +688,7 @@ static const fcn_help_init builtin_help[] = { {"H", "harmonic polylogarithm"}, {"Order", "order term function (for truncated power series)"}, {"Derivative", "inert differential operator"}, - {NULL, NULL} // End marker + {nullptr, nullptr} // End marker }; #include "ginsh_extensions.h" @@ -847,7 +843,7 @@ static char *fcn_generator(const char *text, int state) if (strncmp(fcn_name, text, len) == 0) return strdup(fcn_name); } - return NULL; + return nullptr; } #ifdef HAVE_LIBREADLINE @@ -883,7 +879,7 @@ static void ginsh_readline_init(char* name) void greeting(void) { cout << "ginsh - GiNaC Interactive Shell (GiNaC V" << GINACLIB_VERSION << ")" << endl; - cout << " __, _______ Copyright (C) 1999-2016 Johannes Gutenberg University Mainz,\n" + cout << " __, _______ Copyright (C) 1999-2020 Johannes Gutenberg University Mainz,\n" << " (__) * | Germany. This is free software with ABSOLUTELY NO WARRANTY.\n" << " ._) i N a C | You are welcome to redistribute it under certain conditions.\n" << "<-------------' For details type `warranty;'.\n" << endl; @@ -930,7 +926,7 @@ int main(int argc, char **argv) file_list = argv + 1; if (num_files) { yyin = fopen(*file_list, "r"); - if (yyin == NULL) { + if (yyin == nullptr) { cerr << "Can't open " << *file_list << endl; exit(1); }