First commit
This commit is contained in:
12
framework/node_modules/node-gpp/.gpp/sourceTest/test.js
generated
vendored
Normal file
12
framework/node_modules/node-gpp/.gpp/sourceTest/test.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LIGHT_WINDOWS
|
||||
|
||||
|
||||
|
||||
2
framework/node_modules/node-gpp/.gpp/sourceTest/test2.js
generated
vendored
Normal file
2
framework/node_modules/node-gpp/.gpp/sourceTest/test2.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
Dit werkt ook
|
||||
0
framework/node_modules/node-gpp/api_example.data
generated
vendored
Normal file
0
framework/node_modules/node-gpp/api_example.data
generated
vendored
Normal file
5580
framework/node_modules/node-gpp/api_example.js
generated
vendored
Normal file
5580
framework/node_modules/node-gpp/api_example.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
framework/node_modules/node-gpp/api_example.wasm
generated
vendored
Normal file
BIN
framework/node_modules/node-gpp/api_example.wasm
generated
vendored
Normal file
Binary file not shown.
47
framework/node_modules/node-gpp/asset_dir/application.js
generated
vendored
Normal file
47
framework/node_modules/node-gpp/asset_dir/application.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
|
||||
#define CLIENT
|
||||
|
||||
|
||||
|
||||
#define DARK
|
||||
|
||||
|
||||
|
||||
#define PC
|
||||
|
||||
|
||||
|
||||
#define WINDOWS
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import extender from '../../../../../../framework/unify/extender.js?disableCache=0974';
|
||||
|
||||
import leftSide from './leftSide/leftSide.js?disableCache=0974';
|
||||
|
||||
import rightSide from './rightSide/rightSide.js?disableCache=0974';
|
||||
|
||||
export default class application{
|
||||
|
||||
__className = "application";
|
||||
|
||||
__sourcePath = "news/application.js";
|
||||
|
||||
leftSide = new leftSide();
|
||||
|
||||
rightSide = new rightSide();
|
||||
|
||||
height = "100vh";
|
||||
|
||||
mode = "development"
|
||||
|
||||
os = "Windows";
|
||||
|
||||
device = "pc";
|
||||
|
||||
theme = "Dark";
|
||||
|
||||
}
|
||||
13
framework/node_modules/node-gpp/asset_dir/otherTest.js
generated
vendored
Normal file
13
framework/node_modules/node-gpp/asset_dir/otherTest.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
#define A n /n
|
||||
|
||||
#define B
|
||||
|
||||
#ifdef A
|
||||
|
||||
#ifdef B
|
||||
|
||||
Mooi
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
47
framework/node_modules/node-gpp/asset_dir/test.js
generated
vendored
Normal file
47
framework/node_modules/node-gpp/asset_dir/test.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
|
||||
#define CLIENT
|
||||
|
||||
|
||||
|
||||
#define DARK
|
||||
|
||||
|
||||
|
||||
#define PC
|
||||
|
||||
|
||||
|
||||
#define WINDOWS
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import extender from '../../../../../../framework/unify/extender.js?disableCache=0974';
|
||||
|
||||
import leftSide from './leftSide/leftSide.js?disableCache=0974';
|
||||
|
||||
import rightSide from './rightSide/rightSide.js?disableCache=0974';
|
||||
|
||||
export default class application{
|
||||
|
||||
__className = "application";
|
||||
|
||||
__sourcePath = "news/application.js";
|
||||
|
||||
leftSide = new leftSide();
|
||||
|
||||
rightSide = new rightSide();
|
||||
|
||||
height = "100vh";
|
||||
|
||||
mode = "development"
|
||||
|
||||
os = "Windows";
|
||||
|
||||
device = "pc";
|
||||
|
||||
theme = "Dark";
|
||||
|
||||
}
|
||||
141
framework/node_modules/node-gpp/child.js
generated
vendored
Normal file
141
framework/node_modules/node-gpp/child.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2020, 2023, The Unified Company.
|
||||
|
||||
This code is part of Unify.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the ESA Software Community License - Strong Copyleft,
|
||||
|
||||
https://unifyjs.org
|
||||
|
||||
*/
|
||||
|
||||
|
||||
String.prototype.replaceAll = function replaceAll(search, replace) { return this.split(search).join(replace); }
|
||||
|
||||
|
||||
|
||||
var execPromises = new Array();
|
||||
|
||||
|
||||
if( process.platform == "android" ) {
|
||||
|
||||
exports.gpp = class gpp{
|
||||
|
||||
convert( a ) {
|
||||
|
||||
return a;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
var factory = require('./api_example.js');
|
||||
|
||||
var path = require('path');
|
||||
|
||||
const util = require('util');
|
||||
|
||||
const childProcess = require('child_process');
|
||||
|
||||
const { gpp } = require('./gpp.js');
|
||||
|
||||
var spawn = childProcess.spawn;
|
||||
|
||||
var batchSize = 70;
|
||||
|
||||
|
||||
var gppInstance = new gpp();
|
||||
|
||||
|
||||
|
||||
exports.gpp = class gppManager{
|
||||
|
||||
getNumberOfDots( numberOfBatches ) {
|
||||
|
||||
if( numberOfBatches < 100 ){
|
||||
|
||||
return numberOfBatches;
|
||||
|
||||
} else {
|
||||
|
||||
return 100;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
logConverter( coreNumber, inputFiles, numberOfBatches ) {
|
||||
|
||||
console.log( "Batches", numberOfBatches );
|
||||
|
||||
console.log( "Processing", inputFiles.length, "files" );
|
||||
|
||||
console.log( "Multicore support: processing batches with ", coreNumber, "cores." );
|
||||
|
||||
//console.log("[");
|
||||
|
||||
//process.stdout.moveCursor( numberOfDots + 2, -1);
|
||||
|
||||
//console.log("]");
|
||||
|
||||
console.log("");
|
||||
|
||||
}
|
||||
|
||||
async convert_files() {
|
||||
|
||||
var filesPath = path.resolve( "./framework/cache/platforms/files.json" );
|
||||
|
||||
var sourceRaw = await fs.readFileSync( filesPath, "utf8" )
|
||||
|
||||
var inputFiles = JSON.parse( sourceRaw );
|
||||
|
||||
var numberOfBatches = Math.floor( inputFiles.length / batchSize );
|
||||
|
||||
var totalFiles = batchSize * numberOfBatches + 1;
|
||||
|
||||
var os = require('os');
|
||||
|
||||
var readline = require('readline');
|
||||
|
||||
const coreNumber = os.cpus().length;
|
||||
|
||||
|
||||
var numberOfDots = this.getNumberOfDots( numberOfBatches );
|
||||
|
||||
|
||||
this.logConverter( coreNumber, inputFiles, numberOfBatches );
|
||||
|
||||
|
||||
if( process.stdout.moveCursor ) {
|
||||
|
||||
for (var i = 0; i < numberOfBatches + 1; i++) {
|
||||
|
||||
gppInstance.convert( inputFiles, i );
|
||||
|
||||
process.stdout.moveCursor( Math.floor( (i * numberOfDots) / numberOfBatches ) , -1 );
|
||||
|
||||
console.log("·");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await Promise.all( gppInstance.execPromises );
|
||||
|
||||
console.log("Done.");
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1121
framework/node_modules/node-gpp/file_packager.py
generated
vendored
Normal file
1121
framework/node_modules/node-gpp/file_packager.py
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3491
framework/node_modules/node-gpp/gpp.c
generated
vendored
Normal file
3491
framework/node_modules/node-gpp/gpp.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
86
framework/node_modules/node-gpp/gpp.js
generated
vendored
Normal file
86
framework/node_modules/node-gpp/gpp.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2020, 2023, The Unified Company.
|
||||
|
||||
This code is part of Unify.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the ESA Software Community License - Strong Copyleft,
|
||||
|
||||
https://unifyjs.org
|
||||
|
||||
*/
|
||||
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const util = require('util');
|
||||
|
||||
const exec = util.promisify( require('child_process').exec );
|
||||
|
||||
|
||||
exports.gpp = class gpp{
|
||||
|
||||
batchSize = 70;
|
||||
|
||||
execPromises = new Array();
|
||||
|
||||
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
async initialise() {
|
||||
|
||||
this.instance = await new factory();
|
||||
|
||||
}
|
||||
|
||||
createBatchesDirectory() {
|
||||
|
||||
if( !fs.existsSync( "./framework/cache/platforms/batches/" ) ) {
|
||||
|
||||
fs.mkdirSync("./framework/cache/platforms/batches/");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async convert( inputFiles, i ) {
|
||||
|
||||
this.createBatchesDirectory();
|
||||
|
||||
|
||||
var file = path.resolve( "./framework/cache/platforms/batches/" + i + ".json");
|
||||
|
||||
var n = i * this.batchSize;
|
||||
|
||||
var inputFilesSliced = inputFiles.slice( n, this.batchSize + n );
|
||||
|
||||
var inputFilesJoined = inputFilesSliced.join("\n");
|
||||
|
||||
|
||||
fs.writeFileSync( file, JSON.stringify( inputFilesJoined ) );
|
||||
|
||||
await this.spawnBatch( file, i );
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
async spawnBatch( file, i ) {
|
||||
|
||||
var cWrapper = path.resolve("./framework/node_modules/node-gpp/instanceChild.js");
|
||||
|
||||
var args = new Array( cWrapper, "file=" + file, "index=" + i );
|
||||
|
||||
var defaults = { file:file, env: process.env };
|
||||
|
||||
var execPromise = exec("node " + cWrapper + " file=" + file + " index=" + i );
|
||||
|
||||
this.execPromises.push(execPromise);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
framework/node_modules/node-gpp/how to compile
generated
vendored
Normal file
1
framework/node_modules/node-gpp/how to compile
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
emcc -Wimplicit-function-declaration ./gpp.c -o api_example.js -sMODULARIZE -sEXPORTED_RUNTIME_METHODS=ccall,cwrap --preload-file asset_dir -sDISABLE_EXCEPTION_CATCHING=0 -sALLOW_MEMORY_GROWTH -fsanitize=undefined -lnodefs.js
|
||||
35
framework/node_modules/node-gpp/how to install
generated
vendored
Normal file
35
framework/node_modules/node-gpp/how to install
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
# Fetch the latest version of the emsdk (not needed the first time you clone)
|
||||
git pull
|
||||
|
||||
# Download and install the latest SDK tools.
|
||||
./emsdk install latest
|
||||
|
||||
# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
|
||||
./emsdk activate latest
|
||||
|
||||
# Activate PATH and other environment variables in the current terminal
|
||||
source ./emsdk_env.sh
|
||||
|
||||
|
||||
|
||||
|
||||
./emsdk install 1.38.45
|
||||
|
||||
|
||||
|
||||
# Fetch the latest registry of available tools.
|
||||
./emsdk update
|
||||
|
||||
# Download and install the latest SDK tools.
|
||||
./emsdk install latest
|
||||
|
||||
# Set up the compiler configuration to point to the "latest" SDK.
|
||||
./emsdk activate latest
|
||||
|
||||
# Activate PATH and other environment variables in the current terminal
|
||||
source ./emsdk_env.sh
|
||||
|
||||
To build
|
||||
|
||||
emcc -Wimplicit-function-declaration ./gpp.c -o api_example.js -sMODULARIZE -sEXPORTED_RUNTIME_METHODS=ccall,cwrap --preload-file asset_dir
|
||||
102
framework/node_modules/node-gpp/instanceChild.js
generated
vendored
Normal file
102
framework/node_modules/node-gpp/instanceChild.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2020, 2023, The Unified Company.
|
||||
|
||||
This code is part of Unify.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the ESA Software Community License - Strong Copyleft,
|
||||
|
||||
https://unifyjs.org
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
var factory = require('./api_example.js');
|
||||
|
||||
//var parser = require('args-parser');
|
||||
|
||||
var path = require('path');
|
||||
|
||||
const util = require('util');
|
||||
|
||||
const fse = require('fs');
|
||||
|
||||
const fast = util.promisify(factory);
|
||||
|
||||
|
||||
var commandLineArguments = process.argv;
|
||||
|
||||
for (var i = 0; i < commandLineArguments.length; i++) {
|
||||
|
||||
var row = commandLineArguments[i]
|
||||
|
||||
if(row.includes("file")) {
|
||||
|
||||
var file = row.split("=")[1];
|
||||
|
||||
}
|
||||
|
||||
if(row.includes("index")) {
|
||||
|
||||
var index = row.split("=")[1];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
var filePath = file;
|
||||
|
||||
var source = fs.readFileSync(filePath, "utf8")
|
||||
|
||||
var inputFiles = JSON.parse(source);
|
||||
|
||||
var i = index;
|
||||
|
||||
var batchSize = 70;
|
||||
|
||||
|
||||
class gppWrapper{
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
async initialise() {
|
||||
|
||||
this.instance = await new factory();
|
||||
|
||||
}
|
||||
|
||||
async convert( inputFiles, i ) {
|
||||
|
||||
if( !this.instance ) {
|
||||
|
||||
await this.initialise();
|
||||
|
||||
}
|
||||
|
||||
let init_esm = this.instance.cwrap( 'init_esm', null, null );
|
||||
|
||||
let updateCodeFunction = this.instance.cwrap( 'updateCode', null, [ 'int','string', 'string', 'int' ]);
|
||||
|
||||
init_esm();
|
||||
|
||||
var n = i * batchSize;
|
||||
|
||||
updateCodeFunction( inputFiles.length, inputFiles );
|
||||
|
||||
console.log( "Processed", batchSize, "files" );
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var gppInstance = new gppWrapper();
|
||||
|
||||
gppInstance.convert( inputFiles, i )
|
||||
18
framework/node_modules/node-gpp/package.json
generated
vendored
Normal file
18
framework/node_modules/node-gpp/package.json
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
|
||||
"name": "node-gpp",
|
||||
|
||||
"version": 0.1,
|
||||
|
||||
"dependencies": {
|
||||
|
||||
"args-parser": "^1.3.0",
|
||||
|
||||
"get-cursor-position": "^2.0.0",
|
||||
|
||||
"wasi": "^0.0.6"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user