diff --git a/.gitignore b/.gitignore
index f6b286c..e5df7b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ captures/
# Intellij
*.iml
.idea/workspace.xml
+.idea/libraries
# Keystore files
*.jks
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..a042d3c
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+codeview-release
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..3673071
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..5d19981
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..e98f7a8
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..889cdfd
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,25 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ ext.kotlin_version = '1.0.3'
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.1.3'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/codeview/.gitignore b/codeview/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/codeview/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/codeview/build.gradle b/codeview/build.gradle
new file mode 100644
index 0000000..57383ae
--- /dev/null
+++ b/codeview/build.gradle
@@ -0,0 +1,36 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+
+android {
+ compileSdkVersion 24
+ buildToolsVersion "24.0.1"
+
+ defaultConfig {
+ minSdkVersion 15
+ targetSdkVersion 24
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ testCompile 'junit:junit:4.12'
+
+ compile 'com.android.support:appcompat-v7:24.1.1'
+ compile 'com.android.support:recyclerview-v7:24.1.1'
+ compile 'com.github.twalcari:java-prettify:1.2.2'
+ compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+}
+repositories {
+ mavenCentral()
+}
diff --git a/codeview/proguard-rules.pro b/codeview/proguard-rules.pro
new file mode 100644
index 0000000..531d366
--- /dev/null
+++ b/codeview/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/macuser/Library/Android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/codeview/src/androidTest/java/io/github/kbiakov/codeview/ApplicationTest.java b/codeview/src/androidTest/java/io/github/kbiakov/codeview/ApplicationTest.java
new file mode 100644
index 0000000..7d49519
--- /dev/null
+++ b/codeview/src/androidTest/java/io/github/kbiakov/codeview/ApplicationTest.java
@@ -0,0 +1,13 @@
+package io.github.kbiakov.codeview;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/codeview/src/main/AndroidManifest.xml b/codeview/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..c5cd343
--- /dev/null
+++ b/codeview/src/main/AndroidManifest.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/codeview/src/main/assets/fonts/DroidSansMonoSlashed.ttf b/codeview/src/main/assets/fonts/DroidSansMonoSlashed.ttf
new file mode 100644
index 0000000..8c44b47
Binary files /dev/null and b/codeview/src/main/assets/fonts/DroidSansMonoSlashed.ttf differ
diff --git a/codeview/src/main/assets/training-set/c++/NaClFile.cpp b/codeview/src/main/assets/training-set/c++/NaClFile.cpp
new file mode 100755
index 0000000..5a295dd
--- /dev/null
+++ b/codeview/src/main/assets/training-set/c++/NaClFile.cpp
@@ -0,0 +1,143 @@
+
+#define NACLFILE_CPP
+#include "NaClFile.h"
+#include "NaClFileSystem.h"
+
+//#include
+//#define EOF -1
+
+FILE * nacl_fopen ( const char * path, const char *mode ) {
+
+ return ( FILE * )NaClFileSystem::Get ()->fopen ( path, mode );
+}
+
+int nacl_fclose ( FILE *file ) {
+
+ return NaClFileSystem::Get ()->fclose ((NaClFile *) file );
+}
+
+int nacl_fread ( void *ptr, int size, int count, FILE *file ) {
+
+ return NaClFileSystem::Get ()->fread ( ptr, size, count, (NaClFile *) file );
+}
+
+int nacl_fwrite ( const void * ptr, int size, int count, FILE *file ) {
+
+ return NaClFileSystem::Get ()->fwrite ( ptr, size, count, (NaClFile *) file );
+}
+
+int nacl_feof ( FILE * void_file ) {
+
+ NaClFile * file = ( NaClFile * ) void_file;
+ return ( file->mOffset == file->mSize );
+}
+
+int nacl_ferror ( FILE * void_file ) {
+
+ //unimplemented
+ return 0;
+}
+
+void nacl_clearerr ( FILE * void_file ) {
+ //do nothing
+}
+
+int nacl_fgetc ( FILE * void_file ) {
+
+ NaClFile * file = ( NaClFile * ) void_file;
+
+ if( file && file->mIsHttpLoaded ) {
+
+ int remainingSize = file->mSize - file->mOffset;
+
+ if ( remainingSize ) {
+ int data = file->mData [ file->mOffset ];
+ file->mOffset += 1;
+ return data;
+ }
+ else {
+ return EOF;
+ }
+ }
+ return 0;
+}
+
+int nacl_ungetc (int c, FILE *void_file) {
+
+ NaClFile * file = ( NaClFile * ) void_file;
+
+ if( file && file->mIsHttpLoaded ) {
+
+ if ( file->mOffset ) {
+ file->mOffset -= 1;
+ file->mData [ file->mOffset ] = c;
+ return file->mData [ file->mOffset ];
+ }
+ else {
+ return EOF;
+ }
+ }
+ return 0;
+}
+
+int nacl_fseek ( FILE * void_file, long int offset, int origin ) {
+
+ NaClFile * file = ( NaClFile * ) void_file;
+
+ int originPosition;
+ switch ( origin ) {
+ case SEEK_SET:
+ originPosition = 0;
+ break;
+ case SEEK_CUR:
+ originPosition = file->mOffset;
+ break;
+ case SEEK_END:
+ originPosition = file->mSize;
+ break;
+ }
+ int position = originPosition + offset;
+ if ( position <= file->mSize ) {
+
+ file->mOffset = position;
+ return 0;
+ }
+
+ return -1;
+}
+
+long int nacl_ftell ( FILE * void_file ) {
+
+ NaClFile * file = ( NaClFile * ) void_file;
+
+ return file->mOffset;
+}
+
+int nacl_stat ( const char *path, struct stat *s ) {
+
+ //open file with Head
+ int foundFile = NaClFileSystem::Get ()->stat ( path, s );
+
+ if ( !foundFile ) {
+
+ s->st_mode = S_IFREG;
+ s->st_ctime = 0;
+ s->st_mtime = 0;
+ s->st_atime = 0;
+
+ return 0;
+ }
+
+ return -1;
+}
+
+char *nacl_getcwd(char *buf, size_t size) {
+
+ for ( int i = 0; i < size; ++i ) {
+ buf [ i ] = ( char ) 0;
+ }
+
+ buf [ 0 ] = '/';
+
+ return buf;
+}
diff --git a/codeview/src/main/assets/training-set/c++/c++.cpp b/codeview/src/main/assets/training-set/c++/c++.cpp
new file mode 100755
index 0000000..8f71f58
--- /dev/null
+++ b/codeview/src/main/assets/training-set/c++/c++.cpp
@@ -0,0 +1,1618 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+#include "node.h"
+#include "node_buffer.h"
+
+#include "v8.h"
+#include "v8-profiler.h"
+
+#include
+#include // malloc, free
+#include // memcpy
+
+#ifdef __POSIX__
+# include // htons, htonl
+#endif
+
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+#define BUFFER_CLASS_ID (0xBABE)
+
+namespace node {
+
+using namespace v8;
+
+#define SLICE_ARGS(start_arg, end_arg) \
+ if (!start_arg->IsInt32() || !end_arg->IsInt32()) { \
+ return ThrowException(Exception::TypeError( \
+ String::New("Bad argument."))); \
+ } \
+ int32_t start = start_arg->Int32Value(); \
+ int32_t end = end_arg->Int32Value(); \
+ if (start < 0 || end < 0) { \
+ return ThrowException(Exception::TypeError( \
+ String::New("Bad argument."))); \
+ } \
+ if (!(start <= end)) { \
+ return ThrowException(Exception::Error( \
+ String::New("Must have start <= end"))); \
+ } \
+ if ((size_t)end > parent->length_) { \
+ return ThrowException(Exception::Error( \
+ String::New("end cannot be longer than parent.length"))); \
+ }
+
+
+static Persistent length_symbol;
+static Persistent chars_written_sym;
+static Persistent write_sym;
+Persistent Buffer::constructor_template;
+
+
+static inline size_t base64_decoded_size(const char *src, size_t size) {
+ const char *const end = src + size;
+ const int remainder = size % 4;
+
+ size = (size / 4) * 3;
+ if (remainder) {
+ if (size == 0 && remainder == 1) {
+ // special case: 1-byte input cannot be decoded
+ size = 0;
+ } else {
+ // non-padded input, add 1 or 2 extra bytes
+ size += 1 + (remainder == 3);
+ }
+ }
+
+ // check for trailing padding (1 or 2 bytes)
+ if (size > 0) {
+ if (end[-1] == '=') size--;
+ if (end[-2] == '=') size--;
+ }
+
+ return size;
+}
+
+
+static size_t ByteLength (Handle string, enum encoding enc) {
+ HandleScope scope;
+
+ if (enc == UTF8) {
+ return string->Utf8Length();
+ } else if (enc == BASE64) {
+ String::Utf8Value v(string);
+ return base64_decoded_size(*v, v.length());
+ } else if (enc == UCS2) {
+ return string->Length() * 2;
+ } else if (enc == HEX) {
+ return string->Length() / 2;
+ } else {
+ return string->Length();
+ }
+}
+
+
+Handle