rncq
Version:
Rational number calculator.
51 lines (39 loc) • 1.82 kB
JavaScript
/*
Copyright (C) 2007-2017 Claude SIMON (http://q37.info/contact/).
This file is part of RNCq.
RNCq is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
RNCq 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
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with RNCq. If not, see <http://www.gnu.org/licenses/>.
*/
var affix = "rncq";
// Begin of generic part.
var njsq = null;
var componentPath = null;
var componentFilename = null;
var path = require("path");
if (process.env.EPEIOS_SRC) {
if (process.platform == 'win32')
componentPath = 'h:/bin/';
else
componentPath = '~/bin/';
njsq = require(componentPath + 'njsq.node');
} else {
njsq = require('njsq');
componentPath = __dirname;
}
componentFilename = path.join(componentPath, affix + "njs").replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/ /g, "\\ ");
const rncq = njsq._register(componentFilename);
module.exports.componentInfo = () => njsq._componentInfo(rncq);
module.exports.wrapperInfo = () => njsq._wrapperInfo();
// End of generic part.
module.exports.returnArgument = (text) => { return njsq._wrapper(rncq, 0, text) };
module.exports.evaluateALG = ( expression, callback ) => { njsq._wrapper( rncq, 1, expression, callback ); };
module.exports.evaluateRPN = (expression, callback) => { njsq._wrapper( rncq, 2, expression, callback); };