<commit_before>const { app, BrowserWindow } = require('electron')
const path = require('path')
const url = require('url')

console.log(process.argv);

/*

if ( process.env.EPEIOS_SRC ) {
 var addonPath = null;
 if ( process.platform == 'win32' )
  addonPath = 'h:/bin/';
 else
  addonPath = '~/bin/';
 const xdhelcq = require( addonPath + 'xdhelcq.node');
} else {
 const binary = require( 'node-pre-gyp' );
 const path = require( 'path' );
 const xdhelcq_path = binary.find( path.resolve( path.join( __dirname, './package.json' ) ) );
 xdhelcq = require( xdhelcq_path );	
}

*/
/*
const xdhelcq = require( 'h:\\bin\\xdhelcq.node');

console.log( xdhelcq.wrapperInfo() );
*/

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win

function createWindow() {
  // Create the browser window.
  win = new BrowserWindow({ width: 800, height: 600 })

  // and load the index.html of the app.
  /*
  win.loadURL(url.format({
    pathname: path.join(__dirname, 'XDHELCq.html'),
    protocol: 'file:',
    slashes: true
  }))
  */

  let html = [
    '<!DOCTYPE html>',
    '<html>',
    '	<head>',
    '		<meta charset="UTF-8" />',
    '		<meta http-equiv="X-UA-Compatible" content="IE=edge" />',
    '		<script src="corpus/js/xdhtml.js"></script>',
    '		<script src="tools/xdhelcq/XDHELCq.js"></script>',
    '		<script>handleQuery("?_action=")</script>',
    '	</head>',
    '	<body id="XDHRoot">',
    '	</body>'
  ].join("\n");

  win.loadURL("data:text/html;charset=utf-8," + encodeURI(html), {baseURLForDataURL: "file://h:/hg/epeios/"});

  // Open the DevTools.
  win.webContents.openDevTools()

  // Emitted when the window is closed.
  win.on('closed', () => {
    // Dereference the window object, usually you would store windows<commit_msg>18/02/2018 17:30:49<commit_after>const { app, BrowserWindow } = require('electron')
const path = require('path')
const url = require('url')

console.log("!!!!", process.argv);

/*

if ( process.env.EPEIOS_SRC ) {
 var addonPath = null;
 if ( process.platform == 'win32' )
  addonPath = 'h:/bin/';
 else
  addonPath = '~/bin/';
 const xdhelcq = require( addonPath + 'xdhelcq.node');
} else {
 const binary = require( 'node-pre-gyp' );
 const path = require( 'path' );
 const xdhelcq_path = binary.find( path.resolve( path.join( __dirname, './package.json' ) ) );
 xdhelcq = require( xdhelcq_path );	
}

*/
/*
const xdhelcq = require( 'h:\\bin\\xdhelcq.node');

console.log( xdhelcq.wrapperInfo() );
*/

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win

function createWindow() {
  // Create the browser window.
  win = new BrowserWindow({ width: 800, height: 600 })

  // and load the index.html of the app.
  /*
  win.loadURL(url.format({
    pathname: path.join(__dirname, 'XDHELCq.html'),
    protocol: 'file:',
    slashes: true
  }))
  */

  let html = [
    '<!DOCTYPE html>',
    '<html>',
    ' <head>',
    ' <meta charset="UTF-8" />',
    '	<meta http-equiv="X-UA-Compatible" content="IE=edge" />',
    '	<script src="file://h:/hg/epeios/corpus/js/xdhtml.js"></script>',
    ' <script>',
    ' function attachDebugger()',
    ' {',
	  '  alert( "Attach debugger !" );',
    ' }',
    ' function log( message )',
    ' {',
    '  console.log( message );',
    ' }',
    ' function launchEvent( digest )',
    ' {',
    '  xdhelcq.launchEvent( digest );',
    ' }',
    ' function initialize( arguments ) {',
    '  var mergedArguments = "";',
    '  var length = arguments.length;',
    '',
    '   while ( length-- ) {',
    ' 	 mergedArguments = \'"\' + arguments[length] + \'" \' + mergedArguments;',
    '	  }',
    '',
    '  //	console.log( mergedArguments );',
    '	 xdhelcq.initialize( mergedArguments );',
    ' }',
    'function userHead() {',
    ' try {',
    '  return require(fs) .readFileSync("head.html");',
    ' } catch (err) {',
    '  return "";',
    ' }',
    '}',
    '',
    '</script>',
    '</head>',
    '<body id="XDHRoot">',
    '<script>',
    'attachDebugger();',
    '',
    'var xdhelcqPath = null;',
    '',
    'if ( process.env.EPEIOS_SRC ) {',
    ' var addonPath = null;',
    ' if ( process.platform == \'win32\' )',
    '  addonPath =\'h:/bin/\';',
    ' else',
    '  addonPath = \'~/bin/\';',
    ' xdhelcqPath = addonPath + \'xdhelcq.node\';',
    '} else {',
    ' xdhelcqPath = \'./xdhelcq.node\';',
    '}',
    '',
    'const xdhelcq =require( xdhelcqPath );',
    '// console.log( require(\'electron\').remote.process.argv );',
    'initialize( require(\'electron\').remote.process.argv );',
    '	</script>',
    '</body>',
  ].join("\n");

  console.log( "Av.");
  win.loadURL("data:text/html;charset=utf-8," + encodeURI(html), {baseURLForDataURL: "file://h:/hg/epeios/tools/xdhq/examples/common/blank/"});
//  win.loadURL("data:text/html;charset=utf-8," + encodeURI(html));
console.log( "Ap.");

  // Open the DevTools.
  win.webContents.openDevTools()

  // Emitted when the window is closed.
  win.on('closed', () => {
    // Dereference the window object, usually you would store windows
{'fraction_non_alphanumeric': 0.20429283250287467, 'fraction_numerical': 0.007090839402069758, 'mean_word_length': 3.0053722179585574, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2194329', 'n_tokens_mistral': 1914, 'n_tokens_neox': 1893, 'n_words': 386}