X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fparser%2Fdefault_reader.tpl;h=244074fa17fb731ff49e6f448ff8f905fd114911;hp=cfb8236557af323070405da3421f91033ac61798;hb=44f71c740cc727dc30436e240b9a27021a6d7fdf;hpb=1222eac51cee964961d2aad889dc4ceccb144a36 diff --git a/ginac/parser/default_reader.tpl b/ginac/parser/default_reader.tpl index cfb82365..244074fa 100644 --- a/ginac/parser/default_reader.tpl +++ b/ginac/parser/default_reader.tpl @@ -15,7 +15,7 @@ COMMENT a part of GiNaC parser -- construct functions from a byte stream. * * autogen -T [+ (tpl-file) +] [+ (def-file) +] */ -#include "parse_context.hpp" +#include "parse_context.h" #include "power.h" #include "operators.h" #include "inifcns.h" @@ -37,11 +37,22 @@ const prototype_table& get_default_reader() static bool initialized = false; static prototype_table reader; if (!initialized) { -[+ FOR function +] - reader[make_pair("[+ (get "name") +]", [+ - (if (exist? "args") (get "args") "1") - +])] = [+ (get "name") +]_reader;[+ - ENDFOR +] + try { + for ( unsigned ser=0; ; ++ser ) { + GiNaC::function f(ser); + std::string name = f.get_name(); + for ( std::size_t nargs=0; ; ++nargs ) { + try { + function::find_function(name, nargs); + prototype proto = std::pair(name, nargs); + std::pair ins = reader.insert(std::pair(proto, (reader_func)ser)); + if ( ins.second ) break; + } + catch ( std::runtime_error ) { } + } + } + } + catch ( std::runtime_error ) { } initialized = true; } return reader;