Skip to content

Commit a225e46

Browse files
committed
feat: temp commit
1 parent b55983d commit a225e46

File tree

2 files changed

+964
-504
lines changed

2 files changed

+964
-504
lines changed

lib/node_modules/@stdlib/math/base/special/gammainc/scripts/evalpoly.js

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,15 @@
2424
// MODULES //
2525

2626
var resolve = require( 'path' ).resolve;
27+
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
2728
var writeFileSync = require( '@stdlib/fs/write-file' ).sync;
2829
var currentYear = require( '@stdlib/time/current-year' );
2930
var licenseHeader = require( '@stdlib/_tools/licenses/header' );
3031
var compile = require( '@stdlib/math/base/tools/evalpoly-compile' );
32+
var compileC = require( '@stdlib/math/base/tools/evalpoly-compile-c' );
33+
var substringBefore = require( '@stdlib/string/substring-before' );
34+
var substringAfter = require( '@stdlib/string/substring-after' );
35+
var format = require( '@stdlib/string/format' );
3136

3237

3338
// VARIABLES //
@@ -139,6 +144,33 @@ var header = licenseHeader( 'Apache-2.0', 'js', {
139144
header += '\n/* This is a generated file. Do not edit directly. */\n';
140145

141146

147+
// FUNCTIONS //
148+
149+
/**
150+
* Inserts a compiled function into file content.
151+
*
152+
* @private
153+
* @param {string} text - source content
154+
* @param {string} id - function identifier
155+
* @param {string} str - function string
156+
* @returns {string} updated content
157+
*/
158+
function insert( text, id, str ) {
159+
var before;
160+
var after;
161+
var begin;
162+
var end;
163+
164+
begin = '// BEGIN: '+id;
165+
end = '// END: '+id;
166+
167+
before = substringBefore( text, begin );
168+
after = substringAfter( text, end );
169+
170+
return format( '%s// BEGIN: %s\n\n%s\n%s%s', before, id, str, end, after );
171+
}
172+
173+
142174
// MAIN //
143175

144176
/**
@@ -148,7 +180,9 @@ header += '\n/* This is a generated file. Do not edit directly. */\n';
148180
*/
149181
function main() {
150182
var fpath;
183+
var copts;
151184
var opts;
185+
var file;
152186
var str;
153187

154188
opts = {
@@ -190,6 +224,51 @@ function main() {
190224
fpath = resolve( __dirname, '..', 'lib', 'polyval_c8.js' );
191225
str = header + compile( C8 );
192226
writeFileSync( fpath, str, opts );
227+
228+
copts = {
229+
'dtype': 'double',
230+
'name': ''
231+
};
232+
fpath = resolve( __dirname, '..', 'src', 'main.c' );
233+
file = readFileSync( fpath, opts );
234+
235+
copts.name = 'polyval_c0';
236+
str = compileC( C0, copts );
237+
file = insert( file, copts.name, str );
238+
239+
copts.name = 'polyval_c1';
240+
str = compileC( C1, copts );
241+
file = insert( file, copts.name, str );
242+
243+
copts.name = 'polyval_c2';
244+
str = compileC( C2, copts );
245+
file = insert( file, copts.name, str );
246+
247+
copts.name = 'polyval_c3';
248+
str = compileC( C3, copts );
249+
file = insert( file, copts.name, str );
250+
251+
copts.name = 'polyval_c4';
252+
str = compileC( C4, copts );
253+
file = insert( file, copts.name, str );
254+
255+
copts.name = 'polyval_c5';
256+
str = compileC( C5, copts );
257+
file = insert( file, copts.name, str );
258+
259+
copts.name = 'polyval_c6';
260+
str = compileC( C6, copts );
261+
file = insert( file, copts.name, str );
262+
263+
copts.name = 'polyval_c7';
264+
str = compileC( C7, copts );
265+
file = insert( file, copts.name, str );
266+
267+
copts.name = 'polyval_c8';
268+
str = compileC( C8, copts );
269+
file = insert( file, copts.name, str );
270+
271+
writeFileSync( fpath, file, opts );
193272
}
194273

195274
main();

0 commit comments

Comments
 (0)