<commit_before>package nme;
#if (cpp || neko)


import haxe.Timer;
import nme.display.BitmapData;
import nme.display.ManagedStage;
import nme.display.MovieClip;
import nme.display.Stage;
import nme.net.URLRequest;
import nme.Lib;
import nme.Loader;


class Lib
{
	
	static public var FULLSCREEN = 0x0001;
	static public var BORDERLESS = 0x0002;
	static public var RESIZABLE = 0x0004;
	static public var HARDWARE = 0x0008;
	static public var VSYNC = 0x0010;
	static public var HW_AA = 0x0020;
	static public var HW_AA_HIRES = 0x0060;
	
	public static var current(nmeGetCurrent, null):MovieClip;
	public static var initHeight(default, null):Int;
	public static var initWidth(default, null):Int;
	public static var stage(nmeGetStage, null):Stage;
	
	private static var nmeCurrent:MovieClip = null;
	private static var nmeMainFrame:Dynamic = null;
	private static var nmeStage:Stage = null;
	private static var sIsInit = false;

	
	public static function close()
	{
		var close = Loader.load("nme_close", 0);
		close();
	}
	
	
	public static function create(inOnLoaded:Void->Void, inWidth:Int, inHeight:Int, inFrameRate:Float = 60.0,  inColour:Int = 0xffffff, inFlags:Int = 0x0f, inTitle:String = "NME", inPackage:String = "", ?inIcon:BitmapData)
	{
		if (sIsInit)
		{
			throw("nme.Lib.create called multiple times. This function is automatically called by the project code.");
		}
		sIsInit = true;
		initWidth = inWidth;
		initHeight = inHeight;
		var create_main_frame = Loader.load("nme_create_main_frame", -1);
		create_main_frame(
			function(inFrameHandle:Dynamic) {
				#if android try { #end
				nmeMainFrame = inFrameHandle;
				var stage_handle = nme_get_frame_stage(nmeMainFrame);
				Lib.nmeStage = new Stage(stage_handle, inWidth, inHeight);
				Lib.nmeStage.frameRate = inFrameRate;
				Lib.nmeStage.opaqueBackground = inColour;
				Lib.nmeStage.onQuit = close;
				if (nmeCurrent != null) // Already created...
					Lib.nmeStage.addChild(nmeCurrent);
				inOnLoaded();
				#if android } catch (e:Dynamic) { trace("ERROR: " +  e); } #end
			},
			inWidth, inHeight, inFlags, inTitle, inPackage, inIcon == null?null:inIcon.nmeHandle);
	}


	public static function createManagedStage(inWidth:Int, inHeight:Int)
	{
		initWidth = inWidth;
		initHeight = inHeight;
		var result = new ManagedStage(inWidth, inHeight);
		nmeStage = result;
		return result;
	}
	
	
	public static function exit()
	{
		var quit = stage.onQuit;
		if (quit != null)
			quit();
	}
	
	
	public static function forceClose()
	{
		// Terminates the process straight away, bypassing graceful shutdown
		var terminate = Loader.load("nme_terminate", 0);
		terminate();
	}
	
	
	static public function getTimer():Int
	{
		// Be careful not to blow precision, since storing ms since 1970 can overflow...
		return Std.int(Timer.stamp() * 1000.0);<commit_msg>Lib.exit will now close the process on Android, instead of minimizing<commit_after>package nme;
#if (cpp || neko)


import cpp.Sys;
import haxe.Timer;
import nme.display.BitmapData;
import nme.display.ManagedStage;
import nme.display.MovieClip;
import nme.display.Stage;
import nme.net.URLRequest;
import nme.Lib;
import nme.Loader;


class Lib
{
	
	static public var FULLSCREEN = 0x0001;
	static public var BORDERLESS = 0x0002;
	static public var RESIZABLE = 0x0004;
	static public var HARDWARE = 0x0008;
	static public var VSYNC = 0x0010;
	static public var HW_AA = 0x0020;
	static public var HW_AA_HIRES = 0x0060;
	
	public static var current(nmeGetCurrent, null):MovieClip;
	public static var initHeight(default, null):Int;
	public static var initWidth(default, null):Int;
	public static var stage(nmeGetStage, null):Stage;
	
	private static var nmeCurrent:MovieClip = null;
	private static var nmeMainFrame:Dynamic = null;
	private static var nmeStage:Stage = null;
	private static var sIsInit = false;

	
	public static function close()
	{
		var close = Loader.load("nme_close", 0);
		close();
	}
	
	
	public static function create(inOnLoaded:Void->Void, inWidth:Int, inHeight:Int, inFrameRate:Float = 60.0,  inColour:Int = 0xffffff, inFlags:Int = 0x0f, inTitle:String = "NME", inPackage:String = "", ?inIcon:BitmapData)
	{
		if (sIsInit)
		{
			throw("nme.Lib.create called multiple times. This function is automatically called by the project code.");
		}
		sIsInit = true;
		initWidth = inWidth;
		initHeight = inHeight;
		var create_main_frame = Loader.load("nme_create_main_frame", -1);
		create_main_frame(
			function(inFrameHandle:Dynamic) {
				#if android try { #end
				nmeMainFrame = inFrameHandle;
				var stage_handle = nme_get_frame_stage(nmeMainFrame);
				Lib.nmeStage = new Stage(stage_handle, inWidth, inHeight);
				Lib.nmeStage.frameRate = inFrameRate;
				Lib.nmeStage.opaqueBackground = inColour;
				Lib.nmeStage.onQuit = close;
				if (nmeCurrent != null) // Already created...
					Lib.nmeStage.addChild(nmeCurrent);
				inOnLoaded();
				#if android } catch (e:Dynamic) { trace("ERROR: " +  e); } #end
			},
			inWidth, inHeight, inFlags, inTitle, inPackage, inIcon == null?null:inIcon.nmeHandle);
	}


	public static function createManagedStage(inWidth:Int, inHeight:Int)
	{
		initWidth = inWidth;
		initHeight = inHeight;
		var result = new ManagedStage(inWidth, inHeight);
		nmeStage = result;
		return result;
	}
	
	
	public static function exit()
	{
		var quit = stage.onQuit;
		if (quit != null)
		{
			#if android
			if (quit == close)
			{
				Sys.exit (0);
			}
			#end
			quit();
		}
	}
	
	
	public static function forceClose()
	{
		// Terminates the process straight away, bypassing graceful shutdown
		var terminate = Loader.load("nme_terminate", 0);
		terminate();
	}
	
	
	static public function getTimer():Int
	{
		// Be careful not to blow precision, since storing ms since 1970 can overflow...
		return Std.int(Timer.stamp() * 1000.0);
{'fraction_non_alphanumeric': 0.10700154825391364, 'fraction_numerical': 0.018407018751075175, 'mean_word_length': 4.154255319148936, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5466329', 'n_tokens_mistral': 2251, 'n_tokens_neox': 1951, 'n_words': 533}