| T_SYMBOL '(' exprseq ')' {
fcn_tab::const_iterator i = find_function($1, $3.nops());
if (i->second.is_ginac) {
- $$ = ((fcnp2)(i->second.p))(static_cast<const exprseq &>(*($3.bp)), i->second.serial);
+ $$ = ((fcnp2)(i->second.p))(ex_to<exprseq>($3), i->second.serial);
} else {
- $$ = (i->second.p)(static_cast<const exprseq &>(*($3.bp)));
+ $$ = (i->second.p)(ex_to<exprseq>($3));
}
}
| T_DIGITS '=' T_NUMBER {$$ = $3; Digits = ex_to<numeric>($3).to_int();}
- | T_SYMBOL '=' exp {$$ = $3; ex_to_nonconst_symbol($1).assign($3);}
+ | T_SYMBOL '=' exp {$$ = $3; const_cast<symbol&>(ex_to<symbol>($1)).assign($3);}
| exp T_EQUAL exp {$$ = $1 == $3;}
| exp T_NOTEQ exp {$$ = $1 != $3;}
| exp '<' exp {$$ = $1 < $3;}
;
exprseq : exp {$$ = exprseq($1);}
- | exprseq ',' exp {exprseq es(static_cast<exprseq &>(*($1.bp))); $$ = es.append($3);}
+ | exprseq ',' exp {exprseq es(ex_to<exprseq>($1)); $$ = es.append($3);}
;
list_or_empty: /* empty */ {$$ = *new lst;}
;
list : exp {$$ = lst($1);}
- | list ',' exp {lst l(static_cast<lst &>(*($1.bp))); $$ = l.append($3);}
+ | list ',' exp {lst l(ex_to<lst>($1)); $$ = l.append($3);}
;
matrix : '[' row ']' {$$ = lst($2);}
- | matrix ',' '[' row ']' {lst l(static_cast<lst &>(*($1.bp))); $$ = l.append($4);}
+ | matrix ',' '[' row ']' {lst l(ex_to<lst>($1)); $$ = l.append($4);}
;
row : exp {$$ = lst($1);}
- | row ',' exp {lst l(static_cast<lst &>(*($1.bp))); $$ = l.append($3);}
+ | row ',' exp {lst l(ex_to<lst>($1)); $$ = l.append($3);}
;
ex apply;
public:
apply_map_function(const ex & a) : apply(a) {}
+ virtual ~apply_map_function() {}
ex operator()(const ex & e) { return apply.subs(wild() == e, true); }
};
static ex f_unassign(const exprseq &e)
{
CHECK_ARG(0, symbol, unassign);
- ex_to_nonconst_symbol(e[0]).unassign();
+ const_cast<symbol&>(ex_to<symbol>(e[0])).unassign();
return e[0];
}
* Function name completion functions for readline
*/
-static char *fcn_generator(char *text, int state)
+static char *fcn_generator(const char *text, int state)
{
static int len; // Length of word to complete
static fcn_tab::const_iterator index; // Iterator to function being currently considered
return NULL;
}
-static char **fcn_completion(char *text, int start, int end)
+static char **fcn_completion(const char *text, int start, int end)
{
if (rl_line_buffer[0] == '!') {
// For shell commands, revert back to filename completion
rl_basic_word_break_characters = orig_basic_word_break_characters;
rl_completer_word_break_characters = rl_basic_word_break_characters;
#if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2)
- return completion_matches(text, (CPFunction *)filename_completion_function);
+ return completion_matches(const_cast<char *>(text), (CPFunction *)filename_completion_function);
#else
- return rl_completion_matches(text, (CPFunction *)rl_filename_completion_function);
+ return rl_completion_matches(text, rl_filename_completion_function);
#endif
} else {
// Otherwise, complete function names
rl_basic_word_break_characters = " \t\n\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~";
rl_completer_word_break_characters = rl_basic_word_break_characters;
#if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2)
- return completion_matches(text, (CPFunction *)fcn_generator);
+ return completion_matches(const_cast<char *>(text), (CPFunction *)fcn_generator);
#else
- return rl_completion_matches(text, (CPFunction *)fcn_generator);
+ return rl_completion_matches(text, fcn_generator);
#endif
}
}
// Init readline completer
rl_readline_name = argv[0];
+#if (GINAC_RL_VERSION_MAJOR < 4) || (GINAC_RL_VERSION_MAJOR == 4 && GINAC_RL_VERSION_MINOR < 2)
rl_attempted_completion_function = (CPPFunction *)fcn_completion;
+#else
+ rl_attempted_completion_function = fcn_completion;
+#endif
orig_completion_append_character = rl_completion_append_character;
orig_basic_word_break_characters = rl_basic_word_break_characters;