<commit_before>
# pull in external modules
require './runtime'
util = require './util'
ClassData = require '../src/ClassData'
{ReferenceClassData} = ClassData
fs = node?.fs ? require 'fs'
{trace} = require '../src/logging'
{c2t} = require '../src/types'
"use strict"

# things assigned to root will be available outside this module
root = exports ? this.jvm = {}

root.classpath = []
root.jspath = []

root.read_classfile = (cls, cb) ->
  for p in root.jspath
    filename = "#{p}/#{cls}.js"
    continue unless fs.existsSync filename
    cb(require "../#{filename}")
    return
  for p in root.classpath
    filename = "#{p}/#{cls}.class"
    continue unless fs.existsSync filename
    try
      data = util.bytestr_to_array fs.readFileSync(filename, 'binary')
      cb(new ReferenceClassData data) if data?
      return
    catch e
      unless ReferenceClassData? then trace "WHY IS IT NOT HERE #{ClassData}"
      for key in Object.keys ClassData
        trace "key: #{key}"
      cb(null) # Signifies an error occurred.

# main function that gets called from the frontend
root.run_class = (rs, class_name, cmdline_args, done_cb) ->
  main_spec = class: class_name, sig: 'main([Ljava/lang/String;)V'
  main_method = null
  run_main = -><commit_msg>I need to get better at removing debug code...<commit_after>
# pull in external modules
require './runtime'
util = require './util'
ClassData = require '../src/ClassData'
{ReferenceClassData} = ClassData
fs = node?.fs ? require 'fs'
{trace} = require '../src/logging'
{c2t} = require '../src/types'
"use strict"

# things assigned to root will be available outside this module
root = exports ? this.jvm = {}

root.classpath = []
root.jspath = []

root.read_classfile = (cls, cb) ->
  for p in root.jspath
    filename = "#{p}/#{cls}.js"
    continue unless fs.existsSync filename
    cb(require "../#{filename}")
    return
  for p in root.classpath
    filename = "#{p}/#{cls}.class"
    continue unless fs.existsSync filename
    try
      data = util.bytestr_to_array fs.readFileSync(filename, 'binary')
      cb(new ReferenceClassData data) if data?
      return
    catch e
      cb(null) # Signifies an error occurred.

# main function that gets called from the frontend
root.run_class = (rs, class_name, cmdline_args, done_cb) ->
  main_spec = class: class_name, sig: 'main([Ljava/lang/String;)V'
  main_method = null
  run_main = ->
{'fraction_non_alphanumeric': 0.13043478260869565, 'fraction_numerical': 0.0008361204013377926, 'mean_word_length': 3.3908256880733947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5581400', 'n_tokens_mistral': 752, 'n_tokens_neox': 758, 'n_words': 240}