<commit_before>#import <AppKit/NSWorkspace.h>
#import <Cocoa/Cocoa.h>
#include <string>
#include <vector>
#include <sys/types.h>
#include <sys/sysctl.h>


namespace lime {

	bool LaunchBrowser(const char *inUtf8URL) {

		#ifndef OBJC_ARC
			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
		#endif

		NSString *str = [[NSString alloc] initWithUTF8String:inUtf8URL];
		[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: str]];
		
		#ifndef OBJC_ARC
			[str release];
			[pool drain];
		#endif

		return true;

	}

	std::string CapabilitiesGetLanguage() {

		#ifndef OBJC_ARC
			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
		#endif

		NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
		std::string result = (language?[language UTF8String]:"");
		
		#ifndef OBJC_ARC
			[pool drain];
		#endif

		return result;

	}

	double CapabilitiesGetScreenDPI() {

		#ifndef OBJC_ARC
			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
		#endif
		
		NSScreen *screen = [NSScreen mainScreen];
		NSDictionary *description = [screen deviceDescription];
		NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
		CGSize displayPhysicalSize = 
				CGDisplayScreenSize( [[description objectForKey:@"NSScreenNumber"] unsignedIntValue] );
		double result = ((displayPixelSize.width / displayPhysicalSize.width) + (displayPixelSize.height / displayPhysicalSize.height)) * 0.5 * 25.4;
		
		#ifndef OBJC_ARC
			[pool drain];
		#endif

		return result;

	}

	double CapabilitiesGetPixelAspectRatio() {

		#ifndef OBJC_ARC
			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
		#endif
		
		NSScreen *screen = [NSScreen mainScreen];<commit_msg>Added support for retina DPI detection<commit_after>#import <AppKit/NSWorkspace.h>
#import <Cocoa/Cocoa.h>
#include <string>
#include <vector>
#include <sys/types.h>
#include <sys/sysctl.h>


namespace lime {

	bool LaunchBrowser(const char *inUtf8URL) {

		#ifndef OBJC_ARC
			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
		#endif

		NSString *str = [[NSString alloc] initWithUTF8String:inUtf8URL];
		[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: str]];
		
		#ifndef OBJC_ARC
			[str release];
			[pool drain];
		#endif

		return true;

	}

	std::string CapabilitiesGetLanguage() {

		#ifndef OBJC_ARC
			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
		#endif

		NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
		std::string result = (language?[language UTF8String]:"");
		
		#ifndef OBJC_ARC
			[pool drain];
		#endif

		return result;

	}

	double CapabilitiesGetScreenDPI() {

		#ifndef OBJC_ARC
			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
		#endif
		
		NSScreen *screen = [NSScreen mainScreen];
		NSDictionary *description = [screen deviceDescription];
		NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
		CGSize displayPhysicalSize = 
				CGDisplayScreenSize( [[description objectForKey:@"NSScreenNumber"] unsignedIntValue] );
		double result = ((displayPixelSize.width / displayPhysicalSize.width) + (displayPixelSize.height / displayPhysicalSize.height)) * 0.5 * 25.4;
		
		float displayScale = 1;
		if ([screen respondsToSelector:@selector(backingScaleFactor)]) {
			displayScale = [screen backingScaleFactor];
		}
		
		#ifndef OBJC_ARC
			[pool drain];
		#endif

		return result * displayScale;

	}

	double CapabilitiesGetPixelAspectRatio() {

		#ifndef OBJC_ARC
			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
		#endif
		
		NSScreen *screen = [NSScreen mainScreen];
{'fraction_non_alphanumeric': 0.11221395092362835, 'fraction_numerical': 0.005789909015715467, 'mean_word_length': 4.84219001610306, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3203912', 'n_tokens_mistral': 1377, 'n_tokens_neox': 1170, 'n_words': 272}