// // gapbind14 // Copyright (C) 2020-2022 James D. Mitchell // // 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, see <https://www.gnu.org/licenses/>. //
#include"gapbind14/gapbind14.hpp"
#include <stdio.h> // for fprintf, stderr #include <string.h> // for memcpy, strchr, strrchr
#include <unordered_set> // for unordered_set, unordered_set<>::iterator
//////////////////////////////////////////////////////////////////////// // Copied from gap/src/modules.c, should be exposed in header TODO(later) ////////////////////////////////////////////////////////////////////////
static Obj ValidatedArgList(constchar *name, int nargs, constchar *argStr) {
Obj args = ArgStringToList(argStr); int len = LEN_PLIST(args); if (nargs >= 0 && len != nargs)
fprintf(stderr, "#W %s takes %d arguments, but argument string is '%s'" " which implies %d arguments\n",
name,
nargs,
argStr,
len); return args;
}
staticvoid SetupFuncInfo(Obj func, constChar *cookie) { // The string <cookie> usually has the form "PATH/TO/FILE.c:FUNCNAME". // We check if that is the case, and if so, split it into the parts before // and after the colon. In addition, the file path is cut to only contain // the last two '/'-separated components. constChar *pos = strchr(cookie, ':'); if (pos) {
Obj location = MakeImmString(pos + 1);
auto it = detail::init_funcs().find(std::string(name)); if (it == detail::init_funcs().end()) { throw std::runtime_error(std::string("No init function for module ")
+ name + " found");
}
it->second(); // installs all functions in the current module.
module().finalize();
InitHdlrFuncsFromTable(module().funcs());
for (auto ptr : module()) {
InitHdlrFuncsFromTable(module().mem_funcs(ptr->name()));
}
}
// init functions from m in the record named name // This is done to avoid polluting the global namespace
Obj global_rec = NEW_PREC(0);
SET_LEN_PREC(global_rec, 0);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.14Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.