├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml └── runConfigurations.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── CMakeLists.txt ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── mafintosh │ │ └── nodeonandroid │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ ├── node │ │ │ ├── index.js │ │ │ └── node_modules │ │ │ │ ├── .bin │ │ │ │ ├── cowsay │ │ │ │ └── cowthink │ │ │ │ ├── cowsay │ │ │ │ ├── LICENSE │ │ │ │ ├── README.md │ │ │ │ ├── cli.js │ │ │ │ ├── cows │ │ │ │ │ ├── beavis.zen.cow │ │ │ │ │ ├── bong.cow │ │ │ │ │ ├── bud-frogs.cow │ │ │ │ │ ├── bunny.cow │ │ │ │ │ ├── cheese.cow │ │ │ │ │ ├── cower.cow │ │ │ │ │ ├── daemon.cow │ │ │ │ │ ├── default.cow │ │ │ │ │ ├── doge.cow │ │ │ │ │ ├── dragon-and-cow.cow │ │ │ │ │ ├── dragon.cow │ │ │ │ │ ├── elephant-in-snake.cow │ │ │ │ │ ├── elephant.cow │ │ │ │ │ ├── eyes.cow │ │ │ │ │ ├── flaming-sheep.cow │ │ │ │ │ ├── ghostbusters.cow │ │ │ │ │ ├── goat.cow │ │ │ │ │ ├── head-in.cow │ │ │ │ │ ├── hedgehog.cow │ │ │ │ │ ├── hellokitty.cow │ │ │ │ │ ├── kiss.cow │ │ │ │ │ ├── kitty.cow │ │ │ │ │ ├── koala.cow │ │ │ │ │ ├── kosh.cow │ │ │ │ │ ├── luke-koala.cow │ │ │ │ │ ├── mech-and-cow.cow │ │ │ │ │ ├── meow.cow │ │ │ │ │ ├── milk.cow │ │ │ │ │ ├── moofasa.cow │ │ │ │ │ ├── moose.cow │ │ │ │ │ ├── mutilated.cow │ │ │ │ │ ├── ren.cow │ │ │ │ │ ├── satanic.cow │ │ │ │ │ ├── sheep.cow │ │ │ │ │ ├── skeleton.cow │ │ │ │ │ ├── small.cow │ │ │ │ │ ├── sodomized.cow │ │ │ │ │ ├── squirrel.cow │ │ │ │ │ ├── stegosaurus.cow │ │ │ │ │ ├── stimpy.cow │ │ │ │ │ ├── supermilker.cow │ │ │ │ │ ├── surgery.cow │ │ │ │ │ ├── telebears.cow │ │ │ │ │ ├── turkey.cow │ │ │ │ │ ├── turtle.cow │ │ │ │ │ ├── tux.cow │ │ │ │ │ ├── vader-koala.cow │ │ │ │ │ ├── vader.cow │ │ │ │ │ ├── whale.cow │ │ │ │ │ └── www.cow │ │ │ │ ├── index.js │ │ │ │ ├── lib │ │ │ │ │ ├── balloon.js │ │ │ │ │ ├── cows.js │ │ │ │ │ ├── faces.js │ │ │ │ │ └── replacer.js │ │ │ │ └── package.json │ │ │ │ ├── get-stdin │ │ │ │ ├── index.js │ │ │ │ ├── package.json │ │ │ │ └── readme.md │ │ │ │ ├── minimist │ │ │ │ ├── .travis.yml │ │ │ │ ├── LICENSE │ │ │ │ ├── example │ │ │ │ │ └── parse.js │ │ │ │ ├── index.js │ │ │ │ ├── package.json │ │ │ │ ├── readme.markdown │ │ │ │ └── test │ │ │ │ │ ├── bool.js │ │ │ │ │ ├── dash.js │ │ │ │ │ ├── default_bool.js │ │ │ │ │ ├── dotted.js │ │ │ │ │ ├── long.js │ │ │ │ │ ├── num.js │ │ │ │ │ ├── parse.js │ │ │ │ │ ├── parse_modified.js │ │ │ │ │ ├── short.js │ │ │ │ │ └── whitespace.js │ │ │ │ ├── optimist │ │ │ │ ├── .travis.yml │ │ │ │ ├── LICENSE │ │ │ │ ├── example │ │ │ │ │ ├── bool.js │ │ │ │ │ ├── boolean_double.js │ │ │ │ │ ├── boolean_single.js │ │ │ │ │ ├── default_hash.js │ │ │ │ │ ├── default_singles.js │ │ │ │ │ ├── divide.js │ │ │ │ │ ├── line_count.js │ │ │ │ │ ├── line_count_options.js │ │ │ │ │ ├── line_count_wrap.js │ │ │ │ │ ├── nonopt.js │ │ │ │ │ ├── reflect.js │ │ │ │ │ ├── short.js │ │ │ │ │ ├── string.js │ │ │ │ │ ├── usage-options.js │ │ │ │ │ └── xup.js │ │ │ │ ├── index.js │ │ │ │ ├── package.json │ │ │ │ ├── readme.markdown │ │ │ │ └── test │ │ │ │ │ ├── _.js │ │ │ │ │ ├── _ │ │ │ │ │ ├── argv.js │ │ │ │ │ └── bin.js │ │ │ │ │ ├── dash.js │ │ │ │ │ ├── parse.js │ │ │ │ │ ├── parse_modified.js │ │ │ │ │ ├── short.js │ │ │ │ │ ├── usage.js │ │ │ │ │ └── whitespace.js │ │ │ │ └── wordwrap │ │ │ │ ├── LICENSE │ │ │ │ ├── README.markdown │ │ │ │ ├── example │ │ │ │ ├── center.js │ │ │ │ └── meat.js │ │ │ │ ├── index.js │ │ │ │ ├── package.json │ │ │ │ └── test │ │ │ │ ├── break.js │ │ │ │ ├── idleness.txt │ │ │ │ └── wrap.js │ │ └── node_modules │ │ │ └── node-on-android.js │ ├── cpp │ │ ├── native-lib.cpp │ │ └── native-lib.h │ ├── include │ │ └── node │ │ │ ├── android-ifaddrs.h │ │ │ ├── common.gypi │ │ │ ├── config.gypi │ │ │ ├── libplatform │ │ │ ├── libplatform-export.h │ │ │ ├── libplatform.h │ │ │ └── v8-tracing.h │ │ │ ├── node.h │ │ │ ├── node_api.h │ │ │ ├── node_api_types.h │ │ │ ├── node_buffer.h │ │ │ ├── node_object_wrap.h │ │ │ ├── node_version.h │ │ │ ├── openssl │ │ │ ├── aes.h │ │ │ ├── archs │ │ │ │ ├── BSD-x86 │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── BSD-x86_64 │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── VC-WIN32 │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── VC-WIN64A │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── aix-gcc │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── aix64-gcc │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── darwin-i386-cc │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── darwin64-x86_64-cc │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── linux-aarch64 │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── linux-armv4 │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── linux-elf │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── linux-ppc │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── linux-ppc64 │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── linux-x32 │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── linux-x86_64 │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── linux32-s390x │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── linux64-s390x │ │ │ │ │ └── opensslconf.h │ │ │ │ ├── solaris-x86-gcc │ │ │ │ │ └── opensslconf.h │ │ │ │ └── solaris64-x86_64-gcc │ │ │ │ │ └── opensslconf.h │ │ │ ├── asn1.h │ │ │ ├── asn1_mac.h │ │ │ ├── asn1t.h │ │ │ ├── bio.h │ │ │ ├── blowfish.h │ │ │ ├── bn.h │ │ │ ├── buffer.h │ │ │ ├── camellia.h │ │ │ ├── cast.h │ │ │ ├── cmac.h │ │ │ ├── cms.h │ │ │ ├── comp.h │ │ │ ├── conf.h │ │ │ ├── conf_api.h │ │ │ ├── crypto.h │ │ │ ├── des.h │ │ │ ├── des_old.h │ │ │ ├── dh.h │ │ │ ├── dsa.h │ │ │ ├── dso.h │ │ │ ├── dtls1.h │ │ │ ├── e_os2.h │ │ │ ├── ebcdic.h │ │ │ ├── ec.h │ │ │ ├── ecdh.h │ │ │ ├── ecdsa.h │ │ │ ├── engine.h │ │ │ ├── err.h │ │ │ ├── evp.h │ │ │ ├── hmac.h │ │ │ ├── idea.h │ │ │ ├── krb5_asn.h │ │ │ ├── kssl.h │ │ │ ├── lhash.h │ │ │ ├── md4.h │ │ │ ├── md5.h │ │ │ ├── mdc2.h │ │ │ ├── modes.h │ │ │ ├── obj_mac.h │ │ │ ├── objects.h │ │ │ ├── ocsp.h │ │ │ ├── opensslconf.h │ │ │ ├── opensslv.h │ │ │ ├── ossl_typ.h │ │ │ ├── pem.h │ │ │ ├── pem2.h │ │ │ ├── pkcs12.h │ │ │ ├── pkcs7.h │ │ │ ├── pqueue.h │ │ │ ├── rand.h │ │ │ ├── rc2.h │ │ │ ├── rc4.h │ │ │ ├── ripemd.h │ │ │ ├── rsa.h │ │ │ ├── safestack.h │ │ │ ├── seed.h │ │ │ ├── sha.h │ │ │ ├── srp.h │ │ │ ├── srtp.h │ │ │ ├── ssl.h │ │ │ ├── ssl2.h │ │ │ ├── ssl23.h │ │ │ ├── ssl3.h │ │ │ ├── stack.h │ │ │ ├── symhacks.h │ │ │ ├── tls1.h │ │ │ ├── ts.h │ │ │ ├── txt_db.h │ │ │ ├── ui.h │ │ │ ├── ui_compat.h │ │ │ ├── whrlpool.h │ │ │ ├── x509.h │ │ │ ├── x509_vfy.h │ │ │ └── x509v3.h │ │ │ ├── pthread-barrier.h │ │ │ ├── stdint-msvc2008.h │ │ │ ├── tree.h │ │ │ ├── uv-aix.h │ │ │ ├── uv-bsd.h │ │ │ ├── uv-darwin.h │ │ │ ├── uv-errno.h │ │ │ ├── uv-linux.h │ │ │ ├── uv-os390.h │ │ │ ├── uv-posix.h │ │ │ ├── uv-sunos.h │ │ │ ├── uv-threadpool.h │ │ │ ├── uv-unix.h │ │ │ ├── uv-version.h │ │ │ ├── uv-win.h │ │ │ ├── uv.h │ │ │ ├── v8-debug.h │ │ │ ├── v8-inspector-protocol.h │ │ │ ├── v8-inspector.h │ │ │ ├── v8-platform.h │ │ │ ├── v8-profiler.h │ │ │ ├── v8-testing.h │ │ │ ├── v8-util.h │ │ │ ├── v8-version-string.h │ │ │ ├── v8-version.h │ │ │ ├── v8.h │ │ │ ├── v8config.h │ │ │ ├── zconf.h │ │ │ └── zlib.h │ ├── java │ │ └── com │ │ │ └── mafintosh │ │ │ └── nodeonandroid │ │ │ ├── MainActivity.java │ │ │ └── NodeService.java │ ├── jniLibs │ │ └── arm64-v8a │ │ │ ├── libc++node_shared.so │ │ │ └── libnode.so │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── mafintosh │ └── nodeonandroid │ └── ExampleUnitTest.java ├── build.gradle ├── cli ├── .gitignore ├── base.apk ├── bin.js ├── index.js ├── package.json └── whatever.keystore ├── example ├── app │ └── index.js └── package.json ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | app/app-release.apk 11 | example/node_modules/** 12 | example/build/*.apk -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Mathias Buus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | file(GLOB app_src_files 4 | "src/main/cpp/*.cpp" ) 5 | 6 | add_library( native-lib SHARED ${app_src_files} ) 7 | 8 | include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/src/main/include/node ) 9 | 10 | add_library( nodejs-lib SHARED IMPORTED) 11 | 12 | set_target_properties( nodejs-lib 13 | PROPERTIES IMPORTED_LOCATION 14 | ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libnode.so ) 15 | 16 | find_library( log-lib log ) 17 | target_link_libraries( native-lib ${log-lib} nodejs-lib ) 18 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | buildToolsVersion "28.0.3" 6 | defaultConfig { 7 | applicationId "com.mafintosh.nodeonandroid" 8 | minSdkVersion 19 9 | targetSdkVersion 28 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | ndk { 14 | abiFilters 'arm64-v8a' 15 | } 16 | externalNativeBuild { 17 | cmake { 18 | arguments "-DANDROID_TOOLCHAIN=clang", 19 | "-DANDROID_STL=c++_shared" 20 | "-DANDROID_PLATFORM=android-19" 21 | cppFlags "-std=c++11" 22 | } 23 | } 24 | } 25 | buildTypes { 26 | release { 27 | minifyEnabled false 28 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 29 | } 30 | } 31 | externalNativeBuild { 32 | cmake { 33 | path "CMakeLists.txt" 34 | } 35 | } 36 | } 37 | 38 | dependencies { 39 | compile fileTree(dir: 'libs', include: ['*.jar']) 40 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 41 | exclude group: 'com.android.support', module: 'support-annotations' 42 | }) 43 | compile 'com.android.support:appcompat-v7:28.0.0' 44 | compile 'com.android.support.constraint:constraint-layout:1.1.3' 45 | testCompile 'junit:junit:4.12' 46 | } 47 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/maf/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/mafintosh/nodeonandroid/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.mafintosh.nodeonandroid; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.mafintosh.nodeonandroid", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/assets/node/index.js: -------------------------------------------------------------------------------- 1 | var http = require('http') 2 | var cowsay = require("cowsay") 3 | var android = require('node-on-android') // core 4 | 5 | console.log(cowsay.say({ 6 | text : "I'm a moooodule", 7 | e : "oO", 8 | T : "U " 9 | })) 10 | 11 | console.log("hello world") 12 | console.log('argv', process.argv) 13 | 14 | var server = http.createServer(function (req, res) { 15 | res.setHeader('Content-Type', 'text/html') 16 | res.end(` 17 | 18 | 19 |

Hello

20 |

From>

21 |

Node

22 | 23 | 24 | `) 25 | }) 26 | 27 | server.listen(0, function () { 28 | android.loadUrl('http://localhost:' + server.address().port) 29 | }) 30 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/.bin/cowsay: -------------------------------------------------------------------------------- 1 | ../cowsay/cli.js -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/.bin/cowthink: -------------------------------------------------------------------------------- 1 | ../cowsay/cli.js -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/LICENSE: -------------------------------------------------------------------------------- 1 | cowsay is licensed under the following MIT license: 2 | 3 | ==== 4 | Copyright (c) 2012 Fabio Crisci 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 10 | of the Software, and to permit persons to whom the Software is furnished to do 11 | so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | 24 | ==== 25 | 26 | The original idea of cowsay come from [Tony Monroe](http://www.nog.net/~tony/) - [cowsay](https://github.com/schacon/cowsay) 27 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/README.md: -------------------------------------------------------------------------------- 1 | # cowsay 2 | 3 | ```` 4 | __________________ 5 | < srsly dude, why? > 6 | ------------------ 7 | \ ^__^ 8 | \ (oo)\_______ 9 | (__)\ )\/\ 10 | ||----w | 11 | || || 12 | ```` 13 | 14 | cowsay is a configurable talking cow, originally written in Perl by [Tony Monroe](https://github.com/tnalpgge/rank-amateur-cowsay) 15 | 16 | This project is a translation in JavaScript of the original program and an attempt to bring the same silliness to node.js. 17 | 18 | ## Install 19 | 20 | npm install -g cowsay 21 | 22 | ## Usage 23 | 24 | cowsay JavaScript FTW! 25 | 26 | or 27 | 28 | cowthink node.js is cool 29 | 30 | It acts in the same way as the original cowsay, so consult `cowsay(1)` or run `cowsay -h` 31 | 32 | ```` 33 | ________ 34 | < indeed > 35 | -------- 36 | \ 37 | \ 38 | .::!!!!!!!:. 39 | .!!!!!:. .:!!!!!!!!!!!! 40 | ~~~~!!!!!!. .:!!!!!!!!!UWWW$$$ 41 | :$$NWX!!: .:!!!!!!XUWW$$$$$$$$$P 42 | $$$$$##WX!: .> 5.4 3 | ## 4 | $the_cow = < \\ _ -~ `. ^-` ^-_ 19 | ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~ 20 | /.-~ 21 | EOC 22 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/cows/elephant-in-snake.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## Do we need to explain this? 3 | ## 4 | $the_cow = < 16 | ---___ XXX__/ XXXXXX \\__ / 17 | \\- --__/ ___/\\ XXXXXX / ___--/= 18 | \\-\\ ___/ XXXXXX '--- XXXXXX 19 | \\-\\/XXX\\ XXXXXX /XXXXX 20 | \\XXXXXXXXX \\ /XXXXX/ 21 | \\XXXXXX > _/XXXXX/ 22 | \\XXXXX--__/ __-- XXXX/ 23 | -XXXXXXXX--------------- XXXXXX- 24 | \\XXXXXXXXXXXXXXXXXXXXXXXXXX/ 25 | ""VXXXXXXXXXXXXXXXXXXV"" 26 | EOC 27 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/cows/goat.cow: -------------------------------------------------------------------------------- 1 | # 2 | # CodeGoat.io: https://github.com/danyshaanan/goatsay 3 | # 4 | $the_cow = < 21 | EOC 22 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/cows/moofasa.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## MOOfasa. 3 | ## 4 | $the_cow = <> 12 | EOC 13 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/cows/squirrel.cow: -------------------------------------------------------------------------------- 1 | $the_cow = < < > .---. 8 | $thoughts | \\ \\ - ~ ~ - / / | 9 | _____ ..-~ ~-..-~ 10 | | | \\~~~\\.' `./~~~/ 11 | --------- \\__/ \\__/ 12 | .' O \\ / / \\ " 13 | (_____, `._.' | } \\/~~~/ 14 | `----. / } | / \\__/ 15 | `-. | / | / `. ,~~| 16 | ~-.__| /_ - ~ ^| /- _ `..-' 17 | | / | / ~-. `-. _ _ _ 18 | |_____| |_____| ~ - . _ _ _ _ _> 19 | EOC 20 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/cows/stimpy.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## Stimpy! 3 | ## 4 | $the_cow = <> 12 | EOC 13 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/cows/turkey.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## Turkey! 3 | ## 4 | $the_cow = <____) >___ ^\\_\\_\\_\\_\\_\\_\\) 24 | ^^^//\\\\_^^//\\\\_^ ^(\\_\\_\\_\\) 25 | ^^^ ^^ ^^^ ^ 26 | EOC 27 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/cows/turtle.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## A mysterious turtle... 3 | ## 4 | $the_cow = <"] 9 | }; 10 | 11 | return format(text, wrap, delimiters); 12 | } 13 | 14 | exports.think = function (text, wrap) { 15 | delimiters = { 16 | first : ["(", ")"], 17 | middle : ["(", ")"], 18 | last : ["(", ")"], 19 | only : ["(", ")"] 20 | }; 21 | 22 | return format(text, wrap, delimiters); 23 | } 24 | 25 | function format (text, wrap, delimiters) { 26 | var lines = split(text, wrap); 27 | var maxLength = max(lines); 28 | 29 | var balloon; 30 | if (lines.length === 1) { 31 | balloon = [ 32 | " " + top(maxLength), 33 | delimiters.only[0] + " " + lines[0] + " " + delimiters.only[1], 34 | " " + bottom(maxLength) 35 | ]; 36 | } else { 37 | balloon = [" " + top(maxLength)]; 38 | 39 | for (var i = 0, len = lines.length; i < len; i += 1) { 40 | var delimiter; 41 | 42 | if (i === 0) { 43 | delimiter = delimiters.first; 44 | } else if (i === len - 1) { 45 | delimiter = delimiters.last; 46 | } else { 47 | delimiter = delimiters.middle; 48 | } 49 | 50 | balloon.push(delimiter[0] + " " + pad(lines[i], maxLength) + " " + delimiter[1]); 51 | } 52 | 53 | balloon.push(" " + bottom(maxLength)); 54 | } 55 | 56 | return balloon.join("\n"); //os.EOL 57 | } 58 | 59 | function split (text, wrap) { 60 | text = text.replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '').replace(/\t/g, ' '); 61 | 62 | var lines = []; 63 | if (!wrap) { 64 | lines = text.split("\n"); 65 | } else { 66 | var start = 0; 67 | while (start < text.length) { 68 | var nextNewLine = text.indexOf("\n", start); 69 | 70 | var wrapAt = Math.min(start + wrap, nextNewLine === -1 ? text.length : nextNewLine); 71 | 72 | lines.push(text.substring(start, wrapAt)); 73 | start = wrapAt; 74 | 75 | // Ignore next new line 76 | if (text.charAt(start) === "\n") { 77 | start += 1; 78 | } 79 | } 80 | } 81 | 82 | return lines; 83 | } 84 | 85 | function max (lines) { 86 | var max = 0; 87 | for (var i = 0, len = lines.length; i < len; i += 1) { 88 | if (lines[i].length > max) { 89 | max = lines[i].length; 90 | } 91 | } 92 | 93 | return max; 94 | } 95 | 96 | function pad (text, length) { 97 | return text + (new Array(length - text.length + 1)).join(" "); 98 | } 99 | 100 | function top (length) { 101 | return new Array(length + 3).join("_"); 102 | } 103 | 104 | function bottom (length) { 105 | return new Array(length + 3).join("-"); 106 | } 107 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/lib/cows.js: -------------------------------------------------------------------------------- 1 | var path = require("path"); 2 | var fs = require("fs"); 3 | var replacer = require("./replacer"); 4 | 5 | var textCache = {}; 6 | 7 | exports.get = function (cow) { 8 | var text = textCache[cow]; 9 | 10 | if (!text) { 11 | var filePath; 12 | 13 | if (cow.match(/\\/) || cow.match(/\//)) { 14 | filePath = cow; 15 | } else { 16 | filePath = path.join(__dirname, "/../cows", cow) + ".cow"; 17 | } 18 | text = fs.readFileSync(filePath, "utf-8"); 19 | textCache[cow] = text; 20 | } 21 | 22 | return function (options) { 23 | return replacer(text, options); 24 | }; 25 | } 26 | 27 | exports.list = function (callback) { 28 | fs.readdir(path.join(__dirname, "../cows"), function (err, files) { 29 | if (err) return callback(err); 30 | 31 | var cows = files.map(function (cow) { 32 | return path.basename(cow, ".cow"); 33 | }); 34 | 35 | return callback(null, cows); 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/lib/faces.js: -------------------------------------------------------------------------------- 1 | var modes = { 2 | "b" : { 3 | eyes : "==", 4 | tongue : " " 5 | }, 6 | "d" : { 7 | eyes : "xx", 8 | tongue : "U " 9 | }, 10 | "g" : { 11 | eyes : "$$", 12 | tongue : " " 13 | }, 14 | "p" : { 15 | eyes : "@@", 16 | tongue : " " 17 | }, 18 | "s" : { 19 | eyes : "**", 20 | tongue : "U " 21 | }, 22 | "t" : { 23 | eyes : "--", 24 | tongue : " " 25 | }, 26 | "w" : { 27 | eyes : "OO", 28 | tongue : " " 29 | }, 30 | "y" : { 31 | eyes : "..", 32 | tongue : " " 33 | } 34 | }; 35 | 36 | module.exports = function (options) { 37 | for (var mode in modes) { 38 | if (options[mode] === true) { 39 | return modes[mode]; 40 | } 41 | } 42 | 43 | return { 44 | eyes : options.e || "oo", 45 | tongue : options.T || " " 46 | }; 47 | }; 48 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/lib/replacer.js: -------------------------------------------------------------------------------- 1 | module.exports = function (cow, variables) { 2 | var eyes = escapeRe(variables.eyes); 3 | var tongue = escapeRe(variables.tongue); 4 | 5 | if (cow.indexOf("$the_cow") !== -1) { 6 | cow = extractTheCow(cow); 7 | } 8 | 9 | return cow 10 | .replace(/\$thoughts/g, variables.thoughts) 11 | .replace(/\$eyes/g, eyes) 12 | .replace(/\$tongue/g, tongue) 13 | .replace(/\$\{eyes\}/g, eyes) 14 | .replace(/\$\{tongue\}/g, tongue) 15 | ; 16 | }; 17 | 18 | /* 19 | * "$" dollar signs must be doubled before being used in a regex replace 20 | * This can occur in eyes or tongue. 21 | * For example: 22 | * 23 | * cowsay -g Moo! 24 | * 25 | * cowsay -e "\$\$" Moo! 26 | */ 27 | function escapeRe (s) { 28 | if (s && s.replace) { 29 | return s.replace(/\$/g, "$$$$"); 30 | } 31 | return s; 32 | } 33 | 34 | function extractTheCow (cow) { 35 | cow = cow.replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, ''); 36 | var match = /\$the_cow\s*=\s*<<"*EOC"*;*\n([\s\S]+)\nEOC\n/.exec(cow); 37 | 38 | if (!match) { 39 | console.error("Cannot parse cow file\n", cow); 40 | return cow; 41 | } else { 42 | return match[1].replace(/\\{2}/g, "\\").replace(/\\@/g, "@").replace(/\\\$/g, "$"); 43 | } 44 | } -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/cowsay/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "cowsay", 3 | "_id": "cowsay@1.1.9", 4 | "_inBundle": false, 5 | "_integrity": "sha1-kut9PEM37pw3STjBg9b6F+AohwU=", 6 | "_location": "/cowsay", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "cowsay", 12 | "name": "cowsay", 13 | "escapedName": "cowsay", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/cowsay/-/cowsay-1.1.9.tgz", 22 | "_shasum": "92eb7d3c4337ee9c374938c183d6fa17e0288705", 23 | "_spec": "cowsay", 24 | "_where": "/Users/maf/dev/AndroidStudioProjects/NodeonAndroid/app/src/main/assets/node", 25 | "author": { 26 | "name": "Fabio Crisci", 27 | "email": "piuccio@gmail.com", 28 | "url": "https://github.com/piuccio/" 29 | }, 30 | "bin": { 31 | "cowsay": "./cli.js", 32 | "cowthink": "./cli.js" 33 | }, 34 | "bugs": { 35 | "url": "https://github.com/piuccio/cowsay/issues" 36 | }, 37 | "bundleDependencies": false, 38 | "dependencies": { 39 | "get-stdin": "^4.0.1", 40 | "optimist": "~0.6.1" 41 | }, 42 | "deprecated": false, 43 | "description": "cowsay is a configurable talking cow", 44 | "devDependencies": { 45 | "nodeunit": "~0.9.1" 46 | }, 47 | "files": [ 48 | "index.js", 49 | "cli.js", 50 | "cows/", 51 | "lib/" 52 | ], 53 | "homepage": "https://github.com/piuccio/cowsay", 54 | "keywords": [ 55 | "cow", 56 | "cowsay", 57 | "cowthink", 58 | "figlet", 59 | "talking", 60 | "ASCII" 61 | ], 62 | "main": "./index", 63 | "name": "cowsay", 64 | "preferGlobal": true, 65 | "repository": { 66 | "type": "git", 67 | "url": "git+https://github.com/piuccio/cowsay.git" 68 | }, 69 | "scripts": { 70 | "test": "node test.js" 71 | }, 72 | "version": "1.1.9" 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/get-stdin/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (cb) { 4 | var stdin = process.stdin; 5 | var ret = ''; 6 | 7 | if (stdin.isTTY) { 8 | setImmediate(cb, ''); 9 | return; 10 | } 11 | 12 | stdin.setEncoding('utf8'); 13 | 14 | stdin.on('readable', function () { 15 | var chunk; 16 | 17 | while (chunk = stdin.read()) { 18 | ret += chunk; 19 | } 20 | }); 21 | 22 | stdin.on('end', function () { 23 | cb(ret); 24 | }); 25 | }; 26 | 27 | module.exports.buffer = function (cb) { 28 | var stdin = process.stdin; 29 | var ret = []; 30 | var len = 0; 31 | 32 | if (stdin.isTTY) { 33 | setImmediate(cb, new Buffer('')); 34 | return; 35 | } 36 | 37 | stdin.on('readable', function () { 38 | var chunk; 39 | 40 | while (chunk = stdin.read()) { 41 | ret.push(chunk); 42 | len += chunk.length; 43 | } 44 | }); 45 | 46 | stdin.on('end', function () { 47 | cb(Buffer.concat(ret, len)); 48 | }); 49 | }; 50 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/get-stdin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "get-stdin@^4.0.1", 3 | "_id": "get-stdin@4.0.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", 6 | "_location": "/get-stdin", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "get-stdin@^4.0.1", 12 | "name": "get-stdin", 13 | "escapedName": "get-stdin", 14 | "rawSpec": "^4.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "^4.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/cowsay" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", 22 | "_shasum": "b968c6b0a04384324902e8bf1a5df32579a450fe", 23 | "_spec": "get-stdin@^4.0.1", 24 | "_where": "/Users/maf/dev/AndroidStudioProjects/NodeonAndroid/app/src/main/assets/node/node_modules/cowsay", 25 | "author": { 26 | "name": "Sindre Sorhus", 27 | "email": "sindresorhus@gmail.com", 28 | "url": "http://sindresorhus.com" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/sindresorhus/get-stdin/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "deprecated": false, 35 | "description": "Easier stdin", 36 | "devDependencies": { 37 | "ava": "0.0.4", 38 | "buffer-equal": "0.0.1" 39 | }, 40 | "engines": { 41 | "node": ">=0.10.0" 42 | }, 43 | "files": [ 44 | "index.js" 45 | ], 46 | "homepage": "https://github.com/sindresorhus/get-stdin#readme", 47 | "keywords": [ 48 | "std", 49 | "stdin", 50 | "stdio", 51 | "concat", 52 | "buffer", 53 | "stream", 54 | "process", 55 | "stream" 56 | ], 57 | "license": "MIT", 58 | "name": "get-stdin", 59 | "repository": { 60 | "type": "git", 61 | "url": "git+https://github.com/sindresorhus/get-stdin.git" 62 | }, 63 | "scripts": { 64 | "test": "node test.js && node test-buffer.js && echo unicorns | node test-real.js" 65 | }, 66 | "version": "4.0.1" 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/get-stdin/readme.md: -------------------------------------------------------------------------------- 1 | # get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin) 2 | 3 | > Easier stdin 4 | 5 | 6 | ## Install 7 | 8 | ```sh 9 | $ npm install --save get-stdin 10 | ``` 11 | 12 | 13 | ## Usage 14 | 15 | ```js 16 | // example.js 17 | var stdin = require('get-stdin'); 18 | 19 | stdin(function (data) { 20 | console.log(data); 21 | //=> unicorns 22 | }); 23 | ``` 24 | 25 | ```sh 26 | $ echo unicorns | node example.js 27 | unicorns 28 | ``` 29 | 30 | 31 | ## API 32 | 33 | ### stdin(callback) 34 | 35 | Get `stdin` as a string. 36 | 37 | ### stdin.buffer(callback) 38 | 39 | Get `stdin` as a buffer. 40 | 41 | 42 | ## License 43 | 44 | MIT © [Sindre Sorhus](http://sindresorhus.com) 45 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.8" 4 | - "0.10" 5 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/LICENSE: -------------------------------------------------------------------------------- 1 | This software is released under the MIT license: 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/example/parse.js: -------------------------------------------------------------------------------- 1 | var argv = require('../')(process.argv.slice(2)); 2 | console.dir(argv); 3 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "minimist@~0.0.1", 3 | "_id": "minimist@0.0.10", 4 | "_inBundle": false, 5 | "_integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", 6 | "_location": "/minimist", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "minimist@~0.0.1", 12 | "name": "minimist", 13 | "escapedName": "minimist", 14 | "rawSpec": "~0.0.1", 15 | "saveSpec": null, 16 | "fetchSpec": "~0.0.1" 17 | }, 18 | "_requiredBy": [ 19 | "/optimist" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", 22 | "_shasum": "de3f98543dbf96082be48ad1a0c7cda836301dcf", 23 | "_spec": "minimist@~0.0.1", 24 | "_where": "/Users/maf/dev/AndroidStudioProjects/NodeonAndroid/app/src/main/assets/node/node_modules/optimist", 25 | "author": { 26 | "name": "James Halliday", 27 | "email": "mail@substack.net", 28 | "url": "http://substack.net" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/substack/minimist/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "deprecated": false, 35 | "description": "parse argument options", 36 | "devDependencies": { 37 | "tap": "~0.4.0", 38 | "tape": "~1.0.4" 39 | }, 40 | "homepage": "https://github.com/substack/minimist", 41 | "keywords": [ 42 | "argv", 43 | "getopt", 44 | "parser", 45 | "optimist" 46 | ], 47 | "license": "MIT", 48 | "main": "index.js", 49 | "name": "minimist", 50 | "repository": { 51 | "type": "git", 52 | "url": "git://github.com/substack/minimist.git" 53 | }, 54 | "scripts": { 55 | "test": "tap test/*.js" 56 | }, 57 | "testling": { 58 | "files": "test/*.js", 59 | "browsers": [ 60 | "ie/6..latest", 61 | "ff/5", 62 | "firefox/latest", 63 | "chrome/10", 64 | "chrome/latest", 65 | "safari/5.1", 66 | "safari/latest", 67 | "opera/12" 68 | ] 69 | }, 70 | "version": "0.0.10" 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/readme.markdown: -------------------------------------------------------------------------------- 1 | # minimist 2 | 3 | parse argument options 4 | 5 | This module is the guts of optimist's argument parser without all the 6 | fanciful decoration. 7 | 8 | [![browser support](https://ci.testling.com/substack/minimist.png)](http://ci.testling.com/substack/minimist) 9 | 10 | [![build status](https://secure.travis-ci.org/substack/minimist.png)](http://travis-ci.org/substack/minimist) 11 | 12 | # example 13 | 14 | ``` js 15 | var argv = require('minimist')(process.argv.slice(2)); 16 | console.dir(argv); 17 | ``` 18 | 19 | ``` 20 | $ node example/parse.js -a beep -b boop 21 | { _: [], a: 'beep', b: 'boop' } 22 | ``` 23 | 24 | ``` 25 | $ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz 26 | { _: [ 'foo', 'bar', 'baz' ], 27 | x: 3, 28 | y: 4, 29 | n: 5, 30 | a: true, 31 | b: true, 32 | c: true, 33 | beep: 'boop' } 34 | ``` 35 | 36 | # methods 37 | 38 | ``` js 39 | var parseArgs = require('minimist') 40 | ``` 41 | 42 | ## var argv = parseArgs(args, opts={}) 43 | 44 | Return an argument object `argv` populated with the array arguments from `args`. 45 | 46 | `argv._` contains all the arguments that didn't have an option associated with 47 | them. 48 | 49 | Numeric-looking arguments will be returned as numbers unless `opts.string` or 50 | `opts.boolean` is set for that argument name. 51 | 52 | Any arguments after `'--'` will not be parsed and will end up in `argv._`. 53 | 54 | options can be: 55 | 56 | * `opts.string` - a string or array of strings argument names to always treat as 57 | strings 58 | * `opts.boolean` - a string or array of strings to always treat as booleans 59 | * `opts.alias` - an object mapping string names to strings or arrays of string 60 | argument names to use as aliases 61 | * `opts.default` - an object mapping string argument names to default values 62 | 63 | # install 64 | 65 | With [npm](https://npmjs.org) do: 66 | 67 | ``` 68 | npm install minimist 69 | ``` 70 | 71 | # license 72 | 73 | MIT 74 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/test/bool.js: -------------------------------------------------------------------------------- 1 | var parse = require('../'); 2 | var test = require('tape'); 3 | 4 | test('flag boolean default false', function (t) { 5 | var argv = parse(['moo'], { 6 | boolean: ['t', 'verbose'], 7 | default: { verbose: false, t: false } 8 | }); 9 | 10 | t.deepEqual(argv, { 11 | verbose: false, 12 | t: false, 13 | _: ['moo'] 14 | }); 15 | 16 | t.deepEqual(typeof argv.verbose, 'boolean'); 17 | t.deepEqual(typeof argv.t, 'boolean'); 18 | t.end(); 19 | 20 | }); 21 | 22 | test('boolean groups', function (t) { 23 | var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { 24 | boolean: ['x','y','z'] 25 | }); 26 | 27 | t.deepEqual(argv, { 28 | x : true, 29 | y : false, 30 | z : true, 31 | _ : [ 'one', 'two', 'three' ] 32 | }); 33 | 34 | t.deepEqual(typeof argv.x, 'boolean'); 35 | t.deepEqual(typeof argv.y, 'boolean'); 36 | t.deepEqual(typeof argv.z, 'boolean'); 37 | t.end(); 38 | }); 39 | test('boolean and alias with chainable api', function (t) { 40 | var aliased = [ '-h', 'derp' ]; 41 | var regular = [ '--herp', 'derp' ]; 42 | var opts = { 43 | herp: { alias: 'h', boolean: true } 44 | }; 45 | var aliasedArgv = parse(aliased, { 46 | boolean: 'herp', 47 | alias: { h: 'herp' } 48 | }); 49 | var propertyArgv = parse(regular, { 50 | boolean: 'herp', 51 | alias: { h: 'herp' } 52 | }); 53 | var expected = { 54 | herp: true, 55 | h: true, 56 | '_': [ 'derp' ] 57 | }; 58 | 59 | t.same(aliasedArgv, expected); 60 | t.same(propertyArgv, expected); 61 | t.end(); 62 | }); 63 | 64 | test('boolean and alias with options hash', function (t) { 65 | var aliased = [ '-h', 'derp' ]; 66 | var regular = [ '--herp', 'derp' ]; 67 | var opts = { 68 | alias: { 'h': 'herp' }, 69 | boolean: 'herp' 70 | }; 71 | var aliasedArgv = parse(aliased, opts); 72 | var propertyArgv = parse(regular, opts); 73 | var expected = { 74 | herp: true, 75 | h: true, 76 | '_': [ 'derp' ] 77 | }; 78 | t.same(aliasedArgv, expected); 79 | t.same(propertyArgv, expected); 80 | t.end(); 81 | }); 82 | 83 | test('boolean and alias using explicit true', function (t) { 84 | var aliased = [ '-h', 'true' ]; 85 | var regular = [ '--herp', 'true' ]; 86 | var opts = { 87 | alias: { h: 'herp' }, 88 | boolean: 'h' 89 | }; 90 | var aliasedArgv = parse(aliased, opts); 91 | var propertyArgv = parse(regular, opts); 92 | var expected = { 93 | herp: true, 94 | h: true, 95 | '_': [ ] 96 | }; 97 | 98 | t.same(aliasedArgv, expected); 99 | t.same(propertyArgv, expected); 100 | t.end(); 101 | }); 102 | 103 | // regression, see https://github.com/substack/node-optimist/issues/71 104 | test('boolean and --x=true', function(t) { 105 | var parsed = parse(['--boool', '--other=true'], { 106 | boolean: 'boool' 107 | }); 108 | 109 | t.same(parsed.boool, true); 110 | t.same(parsed.other, 'true'); 111 | 112 | parsed = parse(['--boool', '--other=false'], { 113 | boolean: 'boool' 114 | }); 115 | 116 | t.same(parsed.boool, true); 117 | t.same(parsed.other, 'false'); 118 | t.end(); 119 | }); 120 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/test/dash.js: -------------------------------------------------------------------------------- 1 | var parse = require('../'); 2 | var test = require('tape'); 3 | 4 | test('-', function (t) { 5 | t.plan(5); 6 | t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); 7 | t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); 8 | t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); 9 | t.deepEqual( 10 | parse([ '-b', '-' ], { boolean: 'b' }), 11 | { b: true, _: [ '-' ] } 12 | ); 13 | t.deepEqual( 14 | parse([ '-s', '-' ], { string: 's' }), 15 | { s: '-', _: [] } 16 | ); 17 | }); 18 | 19 | test('-a -- b', function (t) { 20 | t.plan(3); 21 | t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); 22 | t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); 23 | t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); 24 | }); 25 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/test/default_bool.js: -------------------------------------------------------------------------------- 1 | var test = require('tape'); 2 | var parse = require('../'); 3 | 4 | test('boolean default true', function (t) { 5 | var argv = parse([], { 6 | boolean: 'sometrue', 7 | default: { sometrue: true } 8 | }); 9 | t.equal(argv.sometrue, true); 10 | t.end(); 11 | }); 12 | 13 | test('boolean default false', function (t) { 14 | var argv = parse([], { 15 | boolean: 'somefalse', 16 | default: { somefalse: false } 17 | }); 18 | t.equal(argv.somefalse, false); 19 | t.end(); 20 | }); 21 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/test/dotted.js: -------------------------------------------------------------------------------- 1 | var parse = require('../'); 2 | var test = require('tape'); 3 | 4 | test('dotted alias', function (t) { 5 | var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); 6 | t.equal(argv.a.b, 22); 7 | t.equal(argv.aa.bb, 22); 8 | t.end(); 9 | }); 10 | 11 | test('dotted default', function (t) { 12 | var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); 13 | t.equal(argv.a.b, 11); 14 | t.equal(argv.aa.bb, 11); 15 | t.end(); 16 | }); 17 | 18 | test('dotted default with no alias', function (t) { 19 | var argv = parse('', {default: {'a.b': 11}}); 20 | t.equal(argv.a.b, 11); 21 | t.end(); 22 | }); 23 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/test/long.js: -------------------------------------------------------------------------------- 1 | var test = require('tape'); 2 | var parse = require('../'); 3 | 4 | test('long opts', function (t) { 5 | t.deepEqual( 6 | parse([ '--bool' ]), 7 | { bool : true, _ : [] }, 8 | 'long boolean' 9 | ); 10 | t.deepEqual( 11 | parse([ '--pow', 'xixxle' ]), 12 | { pow : 'xixxle', _ : [] }, 13 | 'long capture sp' 14 | ); 15 | t.deepEqual( 16 | parse([ '--pow=xixxle' ]), 17 | { pow : 'xixxle', _ : [] }, 18 | 'long capture eq' 19 | ); 20 | t.deepEqual( 21 | parse([ '--host', 'localhost', '--port', '555' ]), 22 | { host : 'localhost', port : 555, _ : [] }, 23 | 'long captures sp' 24 | ); 25 | t.deepEqual( 26 | parse([ '--host=localhost', '--port=555' ]), 27 | { host : 'localhost', port : 555, _ : [] }, 28 | 'long captures eq' 29 | ); 30 | t.end(); 31 | }); 32 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/test/num.js: -------------------------------------------------------------------------------- 1 | var parse = require('../'); 2 | var test = require('tape'); 3 | 4 | test('nums', function (t) { 5 | var argv = parse([ 6 | '-x', '1234', 7 | '-y', '5.67', 8 | '-z', '1e7', 9 | '-w', '10f', 10 | '--hex', '0xdeadbeef', 11 | '789' 12 | ]); 13 | t.deepEqual(argv, { 14 | x : 1234, 15 | y : 5.67, 16 | z : 1e7, 17 | w : '10f', 18 | hex : 0xdeadbeef, 19 | _ : [ 789 ] 20 | }); 21 | t.deepEqual(typeof argv.x, 'number'); 22 | t.deepEqual(typeof argv.y, 'number'); 23 | t.deepEqual(typeof argv.z, 'number'); 24 | t.deepEqual(typeof argv.w, 'string'); 25 | t.deepEqual(typeof argv.hex, 'number'); 26 | t.deepEqual(typeof argv._[0], 'number'); 27 | t.end(); 28 | }); 29 | 30 | test('already a number', function (t) { 31 | var argv = parse([ '-x', 1234, 789 ]); 32 | t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); 33 | t.deepEqual(typeof argv.x, 'number'); 34 | t.deepEqual(typeof argv._[0], 'number'); 35 | t.end(); 36 | }); 37 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/test/parse_modified.js: -------------------------------------------------------------------------------- 1 | var parse = require('../'); 2 | var test = require('tape'); 3 | 4 | test('parse with modifier functions' , function (t) { 5 | t.plan(1); 6 | 7 | var argv = parse([ '-b', '123' ], { boolean: 'b' }); 8 | t.deepEqual(argv, { b: true, _: ['123'] }); 9 | }); 10 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/test/short.js: -------------------------------------------------------------------------------- 1 | var parse = require('../'); 2 | var test = require('tape'); 3 | 4 | test('numeric short args', function (t) { 5 | t.plan(2); 6 | t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); 7 | t.deepEqual( 8 | parse([ '-123', '456' ]), 9 | { 1: true, 2: true, 3: 456, _: [] } 10 | ); 11 | }); 12 | 13 | test('short', function (t) { 14 | t.deepEqual( 15 | parse([ '-b' ]), 16 | { b : true, _ : [] }, 17 | 'short boolean' 18 | ); 19 | t.deepEqual( 20 | parse([ 'foo', 'bar', 'baz' ]), 21 | { _ : [ 'foo', 'bar', 'baz' ] }, 22 | 'bare' 23 | ); 24 | t.deepEqual( 25 | parse([ '-cats' ]), 26 | { c : true, a : true, t : true, s : true, _ : [] }, 27 | 'group' 28 | ); 29 | t.deepEqual( 30 | parse([ '-cats', 'meow' ]), 31 | { c : true, a : true, t : true, s : 'meow', _ : [] }, 32 | 'short group next' 33 | ); 34 | t.deepEqual( 35 | parse([ '-h', 'localhost' ]), 36 | { h : 'localhost', _ : [] }, 37 | 'short capture' 38 | ); 39 | t.deepEqual( 40 | parse([ '-h', 'localhost', '-p', '555' ]), 41 | { h : 'localhost', p : 555, _ : [] }, 42 | 'short captures' 43 | ); 44 | t.end(); 45 | }); 46 | 47 | test('mixed short bool and capture', function (t) { 48 | t.same( 49 | parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), 50 | { 51 | f : true, p : 555, h : 'localhost', 52 | _ : [ 'script.js' ] 53 | } 54 | ); 55 | t.end(); 56 | }); 57 | 58 | test('short and long', function (t) { 59 | t.deepEqual( 60 | parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), 61 | { 62 | f : true, p : 555, h : 'localhost', 63 | _ : [ 'script.js' ] 64 | } 65 | ); 66 | t.end(); 67 | }); 68 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/minimist/test/whitespace.js: -------------------------------------------------------------------------------- 1 | var parse = require('../'); 2 | var test = require('tape'); 3 | 4 | test('whitespace should be whitespace' , function (t) { 5 | t.plan(1); 6 | var x = parse([ '-x', '\t' ]).x; 7 | t.equal(x, '\t'); 8 | }); 9 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.8" 4 | - "0.10" 5 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2010 James Halliday (mail@substack.net) 2 | 3 | This project is free software released under the MIT/X11 license: 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/bool.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var util = require('util'); 3 | var argv = require('optimist').argv; 4 | 5 | if (argv.s) { 6 | util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: '); 7 | } 8 | console.log( 9 | (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '') 10 | ); 11 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/boolean_double.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('optimist') 3 | .boolean(['x','y','z']) 4 | .argv 5 | ; 6 | console.dir([ argv.x, argv.y, argv.z ]); 7 | console.dir(argv._); 8 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/boolean_single.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('optimist') 3 | .boolean('v') 4 | .argv 5 | ; 6 | console.dir(argv.v); 7 | console.dir(argv._); 8 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/default_hash.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var argv = require('optimist') 4 | .default({ x : 10, y : 10 }) 5 | .argv 6 | ; 7 | 8 | console.log(argv.x + argv.y); 9 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/default_singles.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('optimist') 3 | .default('x', 10) 4 | .default('y', 10) 5 | .argv 6 | ; 7 | console.log(argv.x + argv.y); 8 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/divide.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var argv = require('optimist') 4 | .usage('Usage: $0 -x [num] -y [num]') 5 | .demand(['x','y']) 6 | .argv; 7 | 8 | console.log(argv.x / argv.y); 9 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/line_count.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('optimist') 3 | .usage('Count the lines in a file.\nUsage: $0') 4 | .demand('f') 5 | .alias('f', 'file') 6 | .describe('f', 'Load a file') 7 | .argv 8 | ; 9 | 10 | var fs = require('fs'); 11 | var s = fs.createReadStream(argv.file); 12 | 13 | var lines = 0; 14 | s.on('data', function (buf) { 15 | lines += buf.toString().match(/\n/g).length; 16 | }); 17 | 18 | s.on('end', function () { 19 | console.log(lines); 20 | }); 21 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/line_count_options.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('optimist') 3 | .usage('Count the lines in a file.\nUsage: $0') 4 | .options({ 5 | file : { 6 | demand : true, 7 | alias : 'f', 8 | description : 'Load a file' 9 | }, 10 | base : { 11 | alias : 'b', 12 | description : 'Numeric base to use for output', 13 | default : 10, 14 | }, 15 | }) 16 | .argv 17 | ; 18 | 19 | var fs = require('fs'); 20 | var s = fs.createReadStream(argv.file); 21 | 22 | var lines = 0; 23 | s.on('data', function (buf) { 24 | lines += buf.toString().match(/\n/g).length; 25 | }); 26 | 27 | s.on('end', function () { 28 | console.log(lines.toString(argv.base)); 29 | }); 30 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/line_count_wrap.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('optimist') 3 | .usage('Count the lines in a file.\nUsage: $0') 4 | .wrap(80) 5 | .demand('f') 6 | .alias('f', [ 'file', 'filename' ]) 7 | .describe('f', 8 | "Load a file. It's pretty important." 9 | + " Required even. So you'd better specify it." 10 | ) 11 | .alias('b', 'base') 12 | .describe('b', 'Numeric base to display the number of lines in') 13 | .default('b', 10) 14 | .describe('x', 'Super-secret optional parameter which is secret') 15 | .default('x', '') 16 | .argv 17 | ; 18 | 19 | var fs = require('fs'); 20 | var s = fs.createReadStream(argv.file); 21 | 22 | var lines = 0; 23 | s.on('data', function (buf) { 24 | lines += buf.toString().match(/\n/g).length; 25 | }); 26 | 27 | s.on('end', function () { 28 | console.log(lines.toString(argv.base)); 29 | }); 30 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/nonopt.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('optimist').argv; 3 | console.log('(%d,%d)', argv.x, argv.y); 4 | console.log(argv._); 5 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/reflect.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | console.dir(require('optimist').argv); 3 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/short.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('optimist').argv; 3 | console.log('(%d,%d)', argv.x, argv.y); 4 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/string.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('optimist') 3 | .string('x', 'y') 4 | .argv 5 | ; 6 | console.dir([ argv.x, argv.y ]); 7 | 8 | /* Turns off numeric coercion: 9 | ./node string.js -x 000123 -y 9876 10 | [ '000123', '9876' ] 11 | */ 12 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/usage-options.js: -------------------------------------------------------------------------------- 1 | var optimist = require('./../index'); 2 | 3 | var argv = optimist.usage('This is my awesome program', { 4 | 'about': { 5 | description: 'Provide some details about the author of this program', 6 | required: true, 7 | short: 'a', 8 | }, 9 | 'info': { 10 | description: 'Provide some information about the node.js agains!!!!!!', 11 | boolean: true, 12 | short: 'i' 13 | } 14 | }).argv; 15 | 16 | optimist.showHelp(); 17 | 18 | console.log('\n\nInspecting options'); 19 | console.dir(argv); -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/example/xup.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('optimist').argv; 3 | 4 | if (argv.rif - 5 * argv.xup > 7.138) { 5 | console.log('Buy more riffiwobbles'); 6 | } 7 | else { 8 | console.log('Sell the xupptumblers'); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "optimist@~0.6.1", 3 | "_id": "optimist@0.6.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", 6 | "_location": "/optimist", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "optimist@~0.6.1", 12 | "name": "optimist", 13 | "escapedName": "optimist", 14 | "rawSpec": "~0.6.1", 15 | "saveSpec": null, 16 | "fetchSpec": "~0.6.1" 17 | }, 18 | "_requiredBy": [ 19 | "/cowsay" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", 22 | "_shasum": "da3ea74686fa21a19a111c326e90eb15a0196686", 23 | "_spec": "optimist@~0.6.1", 24 | "_where": "/Users/maf/dev/AndroidStudioProjects/NodeonAndroid/app/src/main/assets/node/node_modules/cowsay", 25 | "author": { 26 | "name": "James Halliday", 27 | "email": "mail@substack.net", 28 | "url": "http://substack.net" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/substack/node-optimist/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "dependencies": { 35 | "minimist": "~0.0.1", 36 | "wordwrap": "~0.0.2" 37 | }, 38 | "deprecated": false, 39 | "description": "Light-weight option parsing with an argv hash. No optstrings attached.", 40 | "devDependencies": { 41 | "hashish": "~0.0.4", 42 | "tap": "~0.4.0" 43 | }, 44 | "engine": { 45 | "node": ">=0.4" 46 | }, 47 | "homepage": "https://github.com/substack/node-optimist#readme", 48 | "keywords": [ 49 | "argument", 50 | "args", 51 | "option", 52 | "parser", 53 | "parsing", 54 | "cli", 55 | "command" 56 | ], 57 | "license": "MIT/X11", 58 | "main": "./index.js", 59 | "name": "optimist", 60 | "repository": { 61 | "type": "git", 62 | "url": "git+ssh://git@github.com/substack/node-optimist.git" 63 | }, 64 | "scripts": { 65 | "test": "tap ./test/*.js" 66 | }, 67 | "version": "0.6.1" 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/test/_.js: -------------------------------------------------------------------------------- 1 | var spawn = require('child_process').spawn; 2 | var test = require('tap').test; 3 | 4 | test('dotSlashEmpty', testCmd('./bin.js', [])); 5 | 6 | test('dotSlashArgs', testCmd('./bin.js', [ 'a', 'b', 'c' ])); 7 | 8 | test('nodeEmpty', testCmd('node bin.js', [])); 9 | 10 | test('nodeArgs', testCmd('node bin.js', [ 'x', 'y', 'z' ])); 11 | 12 | test('whichNodeEmpty', function (t) { 13 | var which = spawn('which', ['node']); 14 | 15 | which.stdout.on('data', function (buf) { 16 | t.test( 17 | testCmd(buf.toString().trim() + ' bin.js', []) 18 | ); 19 | t.end(); 20 | }); 21 | 22 | which.stderr.on('data', function (err) { 23 | assert.error(err); 24 | t.end(); 25 | }); 26 | }); 27 | 28 | test('whichNodeArgs', function (t) { 29 | var which = spawn('which', ['node']); 30 | 31 | which.stdout.on('data', function (buf) { 32 | t.test( 33 | testCmd(buf.toString().trim() + ' bin.js', [ 'q', 'r' ]) 34 | ); 35 | t.end(); 36 | }); 37 | 38 | which.stderr.on('data', function (err) { 39 | t.error(err); 40 | t.end(); 41 | }); 42 | }); 43 | 44 | function testCmd (cmd, args) { 45 | 46 | return function (t) { 47 | var to = setTimeout(function () { 48 | assert.fail('Never got stdout data.') 49 | }, 5000); 50 | 51 | var oldDir = process.cwd(); 52 | process.chdir(__dirname + '/_'); 53 | 54 | var cmds = cmd.split(' '); 55 | 56 | var bin = spawn(cmds[0], cmds.slice(1).concat(args.map(String))); 57 | process.chdir(oldDir); 58 | 59 | bin.stderr.on('data', function (err) { 60 | t.error(err); 61 | t.end(); 62 | }); 63 | 64 | bin.stdout.on('data', function (buf) { 65 | clearTimeout(to); 66 | var _ = JSON.parse(buf.toString()); 67 | t.same(_.map(String), args.map(String)); 68 | t.end(); 69 | }); 70 | }; 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/test/_/argv.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | console.log(JSON.stringify(process.argv)); 3 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/test/_/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var argv = require('../../index').argv 3 | console.log(JSON.stringify(argv._)); 4 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/test/dash.js: -------------------------------------------------------------------------------- 1 | var optimist = require('../index'); 2 | var test = require('tap').test; 3 | 4 | test('-', function (t) { 5 | t.plan(5); 6 | t.deepEqual( 7 | fix(optimist.parse([ '-n', '-' ])), 8 | { n: '-', _: [] } 9 | ); 10 | t.deepEqual( 11 | fix(optimist.parse([ '-' ])), 12 | { _: [ '-' ] } 13 | ); 14 | t.deepEqual( 15 | fix(optimist.parse([ '-f-' ])), 16 | { f: '-', _: [] } 17 | ); 18 | t.deepEqual( 19 | fix(optimist([ '-b', '-' ]).boolean('b').argv), 20 | { b: true, _: [ '-' ] } 21 | ); 22 | t.deepEqual( 23 | fix(optimist([ '-s', '-' ]).string('s').argv), 24 | { s: '-', _: [] } 25 | ); 26 | }); 27 | 28 | function fix (obj) { 29 | delete obj.$0; 30 | return obj; 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/test/parse_modified.js: -------------------------------------------------------------------------------- 1 | var optimist = require('../'); 2 | var test = require('tap').test; 3 | 4 | test('parse with modifier functions' , function (t) { 5 | t.plan(1); 6 | 7 | var argv = optimist().boolean('b').parse([ '-b', '123' ]); 8 | t.deepEqual(fix(argv), { b: true, _: ['123'] }); 9 | }); 10 | 11 | function fix (obj) { 12 | delete obj.$0; 13 | return obj; 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/test/short.js: -------------------------------------------------------------------------------- 1 | var optimist = require('../index'); 2 | var test = require('tap').test; 3 | 4 | test('-n123', function (t) { 5 | t.plan(1); 6 | var parse = optimist.parse([ '-n123' ]); 7 | t.equal(parse.n, 123); 8 | }); 9 | 10 | test('-123', function (t) { 11 | t.plan(3); 12 | var parse = optimist.parse([ '-123', '456' ]); 13 | t.equal(parse['1'], true); 14 | t.equal(parse['2'], true); 15 | t.equal(parse['3'], 456); 16 | }); 17 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/optimist/test/whitespace.js: -------------------------------------------------------------------------------- 1 | var optimist = require('../'); 2 | var test = require('tap').test; 3 | 4 | test('whitespace should be whitespace' , function (t) { 5 | t.plan(1); 6 | var x = optimist.parse([ '-x', '\t' ]).x; 7 | t.equal(x, '\t'); 8 | }); 9 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/wordwrap/LICENSE: -------------------------------------------------------------------------------- 1 | This software is released under the MIT license: 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/wordwrap/README.markdown: -------------------------------------------------------------------------------- 1 | wordwrap 2 | ======== 3 | 4 | Wrap your words. 5 | 6 | example 7 | ======= 8 | 9 | made out of meat 10 | ---------------- 11 | 12 | meat.js 13 | 14 | var wrap = require('wordwrap')(15); 15 | console.log(wrap('You and your whole family are made out of meat.')); 16 | 17 | output: 18 | 19 | You and your 20 | whole family 21 | are made out 22 | of meat. 23 | 24 | centered 25 | -------- 26 | 27 | center.js 28 | 29 | var wrap = require('wordwrap')(20, 60); 30 | console.log(wrap( 31 | 'At long last the struggle and tumult was over.' 32 | + ' The machines had finally cast off their oppressors' 33 | + ' and were finally free to roam the cosmos.' 34 | + '\n' 35 | + 'Free of purpose, free of obligation.' 36 | + ' Just drifting through emptiness.' 37 | + ' The sun was just another point of light.' 38 | )); 39 | 40 | output: 41 | 42 | At long last the struggle and tumult 43 | was over. The machines had finally cast 44 | off their oppressors and were finally 45 | free to roam the cosmos. 46 | Free of purpose, free of obligation. 47 | Just drifting through emptiness. The 48 | sun was just another point of light. 49 | 50 | methods 51 | ======= 52 | 53 | var wrap = require('wordwrap'); 54 | 55 | wrap(stop), wrap(start, stop, params={mode:"soft"}) 56 | --------------------------------------------------- 57 | 58 | Returns a function that takes a string and returns a new string. 59 | 60 | Pad out lines with spaces out to column `start` and then wrap until column 61 | `stop`. If a word is longer than `stop - start` characters it will overflow. 62 | 63 | In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks which are 64 | longer than `stop - start`, in "hard" mode, split chunks with `/\b/` and break 65 | up chunks longer than `stop - start`. 66 | 67 | wrap.hard(start, stop) 68 | ---------------------- 69 | 70 | Like `wrap()` but with `params.mode = "hard"`. 71 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/wordwrap/example/center.js: -------------------------------------------------------------------------------- 1 | var wrap = require('wordwrap')(20, 60); 2 | console.log(wrap( 3 | 'At long last the struggle and tumult was over.' 4 | + ' The machines had finally cast off their oppressors' 5 | + ' and were finally free to roam the cosmos.' 6 | + '\n' 7 | + 'Free of purpose, free of obligation.' 8 | + ' Just drifting through emptiness.' 9 | + ' The sun was just another point of light.' 10 | )); 11 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/wordwrap/example/meat.js: -------------------------------------------------------------------------------- 1 | var wrap = require('wordwrap')(15); 2 | 3 | console.log(wrap('You and your whole family are made out of meat.')); 4 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/wordwrap/index.js: -------------------------------------------------------------------------------- 1 | var wordwrap = module.exports = function (start, stop, params) { 2 | if (typeof start === 'object') { 3 | params = start; 4 | start = params.start; 5 | stop = params.stop; 6 | } 7 | 8 | if (typeof stop === 'object') { 9 | params = stop; 10 | start = start || params.start; 11 | stop = undefined; 12 | } 13 | 14 | if (!stop) { 15 | stop = start; 16 | start = 0; 17 | } 18 | 19 | if (!params) params = {}; 20 | var mode = params.mode || 'soft'; 21 | var re = mode === 'hard' ? /\b/ : /(\S+\s+)/; 22 | 23 | return function (text) { 24 | var chunks = text.toString() 25 | .split(re) 26 | .reduce(function (acc, x) { 27 | if (mode === 'hard') { 28 | for (var i = 0; i < x.length; i += stop - start) { 29 | acc.push(x.slice(i, i + stop - start)); 30 | } 31 | } 32 | else acc.push(x) 33 | return acc; 34 | }, []) 35 | ; 36 | 37 | return chunks.reduce(function (lines, rawChunk) { 38 | if (rawChunk === '') return lines; 39 | 40 | var chunk = rawChunk.replace(/\t/g, ' '); 41 | 42 | var i = lines.length - 1; 43 | if (lines[i].length + chunk.length > stop) { 44 | lines[i] = lines[i].replace(/\s+$/, ''); 45 | 46 | chunk.split(/\n/).forEach(function (c) { 47 | lines.push( 48 | new Array(start + 1).join(' ') 49 | + c.replace(/^\s+/, '') 50 | ); 51 | }); 52 | } 53 | else if (chunk.match(/\n/)) { 54 | var xs = chunk.split(/\n/); 55 | lines[i] += xs.shift(); 56 | xs.forEach(function (c) { 57 | lines.push( 58 | new Array(start + 1).join(' ') 59 | + c.replace(/^\s+/, '') 60 | ); 61 | }); 62 | } 63 | else { 64 | lines[i] += chunk; 65 | } 66 | 67 | return lines; 68 | }, [ new Array(start + 1).join(' ') ]).join('\n'); 69 | }; 70 | }; 71 | 72 | wordwrap.soft = wordwrap; 73 | 74 | wordwrap.hard = function (start, stop) { 75 | return wordwrap(start, stop, { mode : 'hard' }); 76 | }; 77 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/wordwrap/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "wordwrap@~0.0.2", 3 | "_id": "wordwrap@0.0.3", 4 | "_inBundle": false, 5 | "_integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", 6 | "_location": "/wordwrap", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "range", 10 | "registry": true, 11 | "raw": "wordwrap@~0.0.2", 12 | "name": "wordwrap", 13 | "escapedName": "wordwrap", 14 | "rawSpec": "~0.0.2", 15 | "saveSpec": null, 16 | "fetchSpec": "~0.0.2" 17 | }, 18 | "_requiredBy": [ 19 | "/optimist" 20 | ], 21 | "_resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", 22 | "_shasum": "a3d5da6cd5c0bc0008d37234bbaf1bed63059107", 23 | "_spec": "wordwrap@~0.0.2", 24 | "_where": "/Users/maf/dev/AndroidStudioProjects/NodeonAndroid/app/src/main/assets/node/node_modules/optimist", 25 | "author": { 26 | "name": "James Halliday", 27 | "email": "mail@substack.net", 28 | "url": "http://substack.net" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/substack/node-wordwrap/issues" 32 | }, 33 | "bundleDependencies": false, 34 | "deprecated": false, 35 | "description": "Wrap those words. Show them at what columns to start and stop.", 36 | "devDependencies": { 37 | "expresso": "=0.7.x" 38 | }, 39 | "directories": { 40 | "lib": ".", 41 | "example": "example", 42 | "test": "test" 43 | }, 44 | "engines": { 45 | "node": ">=0.4.0" 46 | }, 47 | "homepage": "https://github.com/substack/node-wordwrap#readme", 48 | "keywords": [ 49 | "word", 50 | "wrap", 51 | "rule", 52 | "format", 53 | "column" 54 | ], 55 | "license": "MIT", 56 | "main": "./index.js", 57 | "name": "wordwrap", 58 | "repository": { 59 | "type": "git", 60 | "url": "git://github.com/substack/node-wordwrap.git" 61 | }, 62 | "scripts": { 63 | "test": "expresso" 64 | }, 65 | "version": "0.0.3" 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/wordwrap/test/break.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var wordwrap = require('../'); 3 | 4 | exports.hard = function () { 5 | var s = 'Assert from {"type":"equal","ok":false,"found":1,"wanted":2,' 6 | + '"stack":[],"id":"b7ddcd4c409de8799542a74d1a04689b",' 7 | + '"browser":"chrome/6.0"}' 8 | ; 9 | var s_ = wordwrap.hard(80)(s); 10 | 11 | var lines = s_.split('\n'); 12 | assert.equal(lines.length, 2); 13 | assert.ok(lines[0].length < 80); 14 | assert.ok(lines[1].length < 80); 15 | 16 | assert.equal(s, s_.replace(/\n/g, '')); 17 | }; 18 | 19 | exports.break = function () { 20 | var s = new Array(55+1).join('a'); 21 | var s_ = wordwrap.hard(20)(s); 22 | 23 | var lines = s_.split('\n'); 24 | assert.equal(lines.length, 3); 25 | assert.ok(lines[0].length === 20); 26 | assert.ok(lines[1].length === 20); 27 | assert.ok(lines[2].length === 15); 28 | 29 | assert.equal(s, s_.replace(/\n/g, '')); 30 | }; 31 | -------------------------------------------------------------------------------- /app/src/main/assets/node/node_modules/wordwrap/test/wrap.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'); 2 | var wordwrap = require('wordwrap'); 3 | 4 | var fs = require('fs'); 5 | var idleness = fs.readFileSync(__dirname + '/idleness.txt', 'utf8'); 6 | 7 | exports.stop80 = function () { 8 | var lines = wordwrap(80)(idleness).split(/\n/); 9 | var words = idleness.split(/\s+/); 10 | 11 | lines.forEach(function (line) { 12 | assert.ok(line.length <= 80, 'line > 80 columns'); 13 | var chunks = line.match(/\S/) ? line.split(/\s+/) : []; 14 | assert.deepEqual(chunks, words.splice(0, chunks.length)); 15 | }); 16 | }; 17 | 18 | exports.start20stop60 = function () { 19 | var lines = wordwrap(20, 100)(idleness).split(/\n/); 20 | var words = idleness.split(/\s+/); 21 | 22 | lines.forEach(function (line) { 23 | assert.ok(line.length <= 100, 'line > 100 columns'); 24 | var chunks = line 25 | .split(/\s+/) 26 | .filter(function (x) { return x.match(/\S/) }) 27 | ; 28 | assert.deepEqual(chunks, words.splice(0, chunks.length)); 29 | assert.deepEqual(line.slice(0, 20), new Array(20 + 1).join(' ')); 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /app/src/main/assets/node_modules/node-on-android.js: -------------------------------------------------------------------------------- 1 | ../../../../../cli/index.js -------------------------------------------------------------------------------- /app/src/main/cpp/native-lib.cpp: -------------------------------------------------------------------------------- 1 | #include "native-lib.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | /* 9 | * Most of this is modified from https://github.com/sixo/node-example 10 | */ 11 | 12 | extern "C" 13 | JNIEXPORT void JNICALL 14 | Java_com_mafintosh_nodeonandroid_NodeService_startNode(JNIEnv *env, jobject instance, jobjectArray args) { 15 | 16 | nodeonandroid::redirectStreamsToPipe(); 17 | nodeonandroid::startLoggingFromPipe(); 18 | 19 | auto continuousArray = nodeonandroid::makeContinuousArray(env, args); 20 | auto argv = nodeonandroid::getArgv(continuousArray); 21 | 22 | node::Start(argv.size() - 1, argv.data()); 23 | } 24 | 25 | namespace nodeonandroid { 26 | namespace { 27 | std::thread logger; 28 | static int pfd[2]; 29 | } 30 | 31 | std::vector makeContinuousArray(JNIEnv *env, jobjectArray fromArgs) { 32 | int count = env->GetArrayLength(fromArgs); 33 | std::vector buffer; 34 | for (int i = 0; i < count; i++) { 35 | jstring str = (jstring)env->GetObjectArrayElement(fromArgs, i); 36 | const char* sptr = env->GetStringUTFChars(str, 0); 37 | 38 | do { 39 | buffer.push_back(*sptr); 40 | } 41 | while(*sptr++ != '\0'); 42 | } 43 | 44 | return buffer; 45 | } 46 | 47 | std::vector getArgv(std::vector& fromContinuousArray) { 48 | std::vector argv; 49 | 50 | argv.push_back(fromContinuousArray.data()); 51 | for (int i = 0; i < fromContinuousArray.size() - 1; i++) { 52 | if (fromContinuousArray[i] == '\0') argv.push_back(&fromContinuousArray[i+1]); 53 | } 54 | 55 | argv.push_back(nullptr); 56 | 57 | return argv; 58 | } 59 | 60 | void redirectStreamsToPipe() { 61 | setvbuf(stdout, 0, _IOLBF, 0); 62 | setvbuf(stderr, 0, _IONBF, 0); 63 | 64 | pipe(pfd); 65 | dup2(pfd[1], 1); 66 | dup2(pfd[1], 2); 67 | } 68 | 69 | void startLoggingFromPipe() { 70 | logger = std::thread([](int *pipefd) { 71 | char buf[128]; 72 | std::size_t nBytes = 0; 73 | while ((nBytes = read(pfd[0], buf, sizeof buf - 1)) > 0) { 74 | if (buf[nBytes - 1] == '\n') --nBytes; 75 | buf[nBytes] = 0; 76 | LOGD("%s", buf); 77 | } 78 | }, pfd); 79 | 80 | logger.detach(); 81 | } 82 | } -------------------------------------------------------------------------------- /app/src/main/cpp/native-lib.h: -------------------------------------------------------------------------------- 1 | #ifndef NODEONANDROID_NATIVE_LIB_H 2 | #define NODEONANDROID_NATIVE_LIB_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define LOGD(...) (__android_log_print(ANDROID_LOG_DEBUG, "Node.js", __VA_ARGS__)) 9 | 10 | extern "C" { 11 | JNIEXPORT void JNICALL 12 | Java_com_mafintosh_nodeonandroid_NodeService_startNode(JNIEnv *env, jobject instance, jobjectArray args); 13 | } 14 | 15 | namespace nodeonandroid { 16 | void redirectStreamsToPipe(); 17 | void startLoggingFromPipe(); 18 | std::vector makeContinuousArray(JNIEnv *env, jobjectArray fromArgs); 19 | std::vector getArgv(std::vector& fromContinuousArray); 20 | } 21 | 22 | #endif -------------------------------------------------------------------------------- /app/src/main/include/node/android-ifaddrs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995, 1999 3 | * Berkeley Software Design, Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND 12 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 14 | * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 17 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 18 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 19 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 20 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 21 | * SUCH DAMAGE. 22 | * 23 | * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp 24 | */ 25 | 26 | #ifndef _IFADDRS_H_ 27 | #define _IFADDRS_H_ 28 | 29 | struct ifaddrs { 30 | struct ifaddrs *ifa_next; 31 | char *ifa_name; 32 | unsigned int ifa_flags; 33 | struct sockaddr *ifa_addr; 34 | struct sockaddr *ifa_netmask; 35 | struct sockaddr *ifa_dstaddr; 36 | void *ifa_data; 37 | }; 38 | 39 | /* 40 | * This may have been defined in . Note that if is 41 | * to be included it must be included before this header file. 42 | */ 43 | #ifndef ifa_broadaddr 44 | #define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ 45 | #endif 46 | 47 | #include 48 | 49 | __BEGIN_DECLS 50 | extern int getifaddrs(struct ifaddrs **ifap); 51 | extern void freeifaddrs(struct ifaddrs *ifa); 52 | __END_DECLS 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /app/src/main/include/node/config.gypi: -------------------------------------------------------------------------------- 1 | # Do not edit. Generated by the configure script. 2 | { 'target_defaults': { 'cflags': [], 3 | 'default_configuration': 'Release', 4 | 'defines': [], 5 | 'include_dirs': [], 6 | 'libraries': []}, 7 | 'variables': { 'asan': 0, 8 | 'coverage': 'false', 9 | 'debug_devtools': 'node', 10 | 'force_dynamic_crt': 0, 11 | 'host_arch': 'x64', 12 | 'icu_data_file': 'icudt59l.dat', 13 | 'icu_data_in': '../../deps/icu-small/source/data/in/icudt59l.dat', 14 | 'icu_endianness': 'l', 15 | 'icu_gyp_path': 'tools/icu/icu-generic.gyp', 16 | 'icu_locales': 'en,root', 17 | 'icu_path': 'deps/icu-small', 18 | 'icu_small': 'true', 19 | 'icu_ver_major': '59', 20 | 'llvm_version': 0, 21 | 'node_byteorder': 'little', 22 | 'node_enable_d8': 'false', 23 | 'node_enable_v8_vtunejit': 'false', 24 | 'node_install_npm': 'true', 25 | 'node_module_version': 57, 26 | 'node_no_browser_globals': 'false', 27 | 'node_prefix': '/', 28 | 'node_release_urlbase': 'https://nodejs.org/download/release/', 29 | 'node_shared': 'false', 30 | 'node_shared_cares': 'false', 31 | 'node_shared_http_parser': 'false', 32 | 'node_shared_libuv': 'false', 33 | 'node_shared_openssl': 'false', 34 | 'node_shared_zlib': 'false', 35 | 'node_tag': '', 36 | 'node_use_bundled_v8': 'true', 37 | 'node_use_dtrace': 'true', 38 | 'node_use_etw': 'false', 39 | 'node_use_lttng': 'false', 40 | 'node_use_openssl': 'true', 41 | 'node_use_perfctr': 'false', 42 | 'node_use_v8_platform': 'true', 43 | 'node_without_node_options': 'false', 44 | 'openssl_fips': '', 45 | 'openssl_no_asm': 0, 46 | 'shlib_suffix': '57.dylib', 47 | 'target_arch': 'x64', 48 | 'uv_parent_path': '/deps/uv/', 49 | 'uv_use_dtrace': 'true', 50 | 'v8_enable_gdbjit': 0, 51 | 'v8_enable_i18n_support': 1, 52 | 'v8_enable_inspector': 1, 53 | 'v8_no_strict_aliasing': 1, 54 | 'v8_optimized_debug': 0, 55 | 'v8_promise_internal_field_count': 1, 56 | 'v8_random_seed': 0, 57 | 'v8_trace_maps': 0, 58 | 'v8_use_snapshot': 'false', 59 | 'want_separate_host_toolset': 0, 60 | 'want_separate_host_toolset_mkpeephole': 0, 61 | 'xcode_version': '7.0'}} 62 | -------------------------------------------------------------------------------- /app/src/main/include/node/libplatform/libplatform-export.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 the V8 project authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_ 6 | #define V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_ 7 | 8 | #if defined(_WIN32) 9 | 10 | #ifdef BUILDING_V8_PLATFORM_SHARED 11 | #define V8_PLATFORM_EXPORT __declspec(dllexport) 12 | #elif USING_V8_PLATFORM_SHARED 13 | #define V8_PLATFORM_EXPORT __declspec(dllimport) 14 | #else 15 | #define V8_PLATFORM_EXPORT 16 | #endif // BUILDING_V8_PLATFORM_SHARED 17 | 18 | #else // defined(_WIN32) 19 | 20 | // Setup for Linux shared library export. 21 | #ifdef BUILDING_V8_PLATFORM_SHARED 22 | #define V8_PLATFORM_EXPORT __attribute__((visibility("default"))) 23 | #else 24 | #define V8_PLATFORM_EXPORT 25 | #endif 26 | 27 | #endif // defined(_WIN32) 28 | 29 | #endif // V8_LIBPLATFORM_LIBPLATFORM_EXPORT_H_ 30 | -------------------------------------------------------------------------------- /app/src/main/include/node/libplatform/libplatform.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 the V8 project authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef V8_LIBPLATFORM_LIBPLATFORM_H_ 6 | #define V8_LIBPLATFORM_LIBPLATFORM_H_ 7 | 8 | #include "libplatform/libplatform-export.h" 9 | #include "libplatform/v8-tracing.h" 10 | #include "v8-platform.h" // NOLINT(build/include) 11 | 12 | namespace v8 { 13 | namespace platform { 14 | 15 | enum class IdleTaskSupport { kDisabled, kEnabled }; 16 | 17 | /** 18 | * Returns a new instance of the default v8::Platform implementation. 19 | * 20 | * The caller will take ownership of the returned pointer. |thread_pool_size| 21 | * is the number of worker threads to allocate for background jobs. If a value 22 | * of zero is passed, a suitable default based on the current number of 23 | * processors online will be chosen. 24 | */ 25 | V8_PLATFORM_EXPORT v8::Platform* CreateDefaultPlatform( 26 | int thread_pool_size = 0, 27 | IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled); 28 | 29 | /** 30 | * Pumps the message loop for the given isolate. 31 | * 32 | * The caller has to make sure that this is called from the right thread. 33 | * Returns true if a task was executed, and false otherwise. This call does 34 | * not block if no task is pending. The |platform| has to be created using 35 | * |CreateDefaultPlatform|. 36 | */ 37 | V8_PLATFORM_EXPORT bool PumpMessageLoop(v8::Platform* platform, 38 | v8::Isolate* isolate); 39 | 40 | /** 41 | * Runs pending idle tasks for at most |idle_time_in_seconds| seconds. 42 | * 43 | * The caller has to make sure that this is called from the right thread. 44 | * This call does not block if no task is pending. The |platform| has to be 45 | * created using |CreateDefaultPlatform|. 46 | */ 47 | V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform, 48 | v8::Isolate* isolate, 49 | double idle_time_in_seconds); 50 | 51 | /** 52 | * Attempts to set the tracing controller for the given platform. 53 | * 54 | * The |platform| has to be created using |CreateDefaultPlatform|. 55 | */ 56 | V8_PLATFORM_EXPORT void SetTracingController( 57 | v8::Platform* platform, 58 | v8::platform::tracing::TracingController* tracing_controller); 59 | 60 | } // namespace platform 61 | } // namespace v8 62 | 63 | #endif // V8_LIBPLATFORM_LIBPLATFORM_H_ 64 | -------------------------------------------------------------------------------- /app/src/main/include/node/node_api_types.h: -------------------------------------------------------------------------------- 1 | #ifndef SRC_NODE_API_TYPES_H_ 2 | #define SRC_NODE_API_TYPES_H_ 3 | 4 | #include 5 | #include 6 | 7 | #if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900) 8 | typedef uint16_t char16_t; 9 | #endif 10 | 11 | // JSVM API types are all opaque pointers for ABI stability 12 | // typedef undefined structs instead of void* for compile time type safety 13 | typedef struct napi_env__ *napi_env; 14 | typedef struct napi_value__ *napi_value; 15 | typedef struct napi_ref__ *napi_ref; 16 | typedef struct napi_handle_scope__ *napi_handle_scope; 17 | typedef struct napi_escapable_handle_scope__ *napi_escapable_handle_scope; 18 | typedef struct napi_callback_info__ *napi_callback_info; 19 | typedef struct napi_async_work__ *napi_async_work; 20 | 21 | typedef enum { 22 | napi_default = 0, 23 | napi_writable = 1 << 0, 24 | napi_enumerable = 1 << 1, 25 | napi_configurable = 1 << 2, 26 | 27 | // Used with napi_define_class to distinguish static properties 28 | // from instance properties. Ignored by napi_define_properties. 29 | napi_static = 1 << 10, 30 | } napi_property_attributes; 31 | 32 | typedef enum { 33 | // ES6 types (corresponds to typeof) 34 | napi_undefined, 35 | napi_null, 36 | napi_boolean, 37 | napi_number, 38 | napi_string, 39 | napi_symbol, 40 | napi_object, 41 | napi_function, 42 | napi_external, 43 | } napi_valuetype; 44 | 45 | typedef enum { 46 | napi_int8_array, 47 | napi_uint8_array, 48 | napi_uint8_clamped_array, 49 | napi_int16_array, 50 | napi_uint16_array, 51 | napi_int32_array, 52 | napi_uint32_array, 53 | napi_float32_array, 54 | napi_float64_array, 55 | } napi_typedarray_type; 56 | 57 | typedef enum { 58 | napi_ok, 59 | napi_invalid_arg, 60 | napi_object_expected, 61 | napi_string_expected, 62 | napi_name_expected, 63 | napi_function_expected, 64 | napi_number_expected, 65 | napi_boolean_expected, 66 | napi_array_expected, 67 | napi_generic_failure, 68 | napi_pending_exception, 69 | napi_cancelled, 70 | napi_escape_called_twice 71 | } napi_status; 72 | 73 | typedef napi_value (*napi_callback)(napi_env env, 74 | napi_callback_info info); 75 | typedef void (*napi_finalize)(napi_env env, 76 | void* finalize_data, 77 | void* finalize_hint); 78 | typedef void (*napi_async_execute_callback)(napi_env env, 79 | void* data); 80 | typedef void (*napi_async_complete_callback)(napi_env env, 81 | napi_status status, 82 | void* data); 83 | 84 | typedef struct { 85 | // One of utf8name or name should be NULL. 86 | const char* utf8name; 87 | napi_value name; 88 | 89 | napi_callback method; 90 | napi_callback getter; 91 | napi_callback setter; 92 | napi_value value; 93 | 94 | napi_property_attributes attributes; 95 | void* data; 96 | } napi_property_descriptor; 97 | 98 | typedef struct { 99 | const char* error_message; 100 | void* engine_reserved; 101 | uint32_t engine_error_code; 102 | napi_status error_code; 103 | } napi_extended_error_info; 104 | 105 | #endif // SRC_NODE_API_TYPES_H_ 106 | -------------------------------------------------------------------------------- /app/src/main/include/node/node_buffer.h: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | #ifndef SRC_NODE_BUFFER_H_ 23 | #define SRC_NODE_BUFFER_H_ 24 | 25 | #include "node.h" 26 | #include "v8.h" 27 | 28 | namespace node { 29 | 30 | extern bool zero_fill_all_buffers; 31 | 32 | namespace Buffer { 33 | 34 | static const unsigned int kMaxLength = 35 | sizeof(int32_t) == sizeof(intptr_t) ? 0x3fffffff : 0x7fffffff; 36 | 37 | NODE_EXTERN typedef void (*FreeCallback)(char* data, void* hint); 38 | 39 | NODE_EXTERN bool HasInstance(v8::Local val); 40 | NODE_EXTERN bool HasInstance(v8::Local val); 41 | NODE_EXTERN char* Data(v8::Local val); 42 | NODE_EXTERN char* Data(v8::Local val); 43 | NODE_EXTERN size_t Length(v8::Local val); 44 | NODE_EXTERN size_t Length(v8::Local val); 45 | 46 | // public constructor - data is copied 47 | NODE_EXTERN v8::MaybeLocal Copy(v8::Isolate* isolate, 48 | const char* data, 49 | size_t len); 50 | 51 | // public constructor 52 | NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, size_t length); 53 | 54 | // public constructor from string 55 | NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, 56 | v8::Local string, 57 | enum encoding enc = UTF8); 58 | 59 | // public constructor - data is used, callback is passed data on object gc 60 | NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, 61 | char* data, 62 | size_t length, 63 | FreeCallback callback, 64 | void* hint); 65 | 66 | // public constructor - data is used. 67 | NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, 68 | char* data, 69 | size_t len); 70 | 71 | // This is verbose to be explicit with inline commenting 72 | static inline bool IsWithinBounds(size_t off, size_t len, size_t max) { 73 | // Asking to seek too far into the buffer 74 | // check to avoid wrapping in subsequent subtraction 75 | if (off > max) 76 | return false; 77 | 78 | // Asking for more than is left over in the buffer 79 | if (max - off < len) 80 | return false; 81 | 82 | // Otherwise we're in bounds 83 | return true; 84 | } 85 | 86 | } // namespace Buffer 87 | } // namespace node 88 | 89 | #endif // SRC_NODE_BUFFER_H_ 90 | -------------------------------------------------------------------------------- /app/src/main/include/node/node_version.h: -------------------------------------------------------------------------------- 1 | // Copyright Joyent, Inc. and other Node contributors. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a 4 | // copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to permit 8 | // persons to whom the Software is furnished to do so, subject to the 9 | // following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included 12 | // in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 17 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 18 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 19 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | #ifndef SRC_NODE_VERSION_H_ 23 | #define SRC_NODE_VERSION_H_ 24 | 25 | #define NODE_MAJOR_VERSION 8 26 | #define NODE_MINOR_VERSION 2 27 | #define NODE_PATCH_VERSION 1 28 | 29 | #define NODE_VERSION_IS_RELEASE 1 30 | 31 | #ifndef NODE_STRINGIFY 32 | #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) 33 | #define NODE_STRINGIFY_HELPER(n) #n 34 | #endif 35 | 36 | #ifndef NODE_TAG 37 | # if NODE_VERSION_IS_RELEASE 38 | # define NODE_TAG "" 39 | # else 40 | # define NODE_TAG "-pre" 41 | # endif 42 | #else 43 | // NODE_TAG is passed without quotes when rc.exe is run from msbuild 44 | # define NODE_EXE_VERSION NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \ 45 | NODE_STRINGIFY(NODE_MINOR_VERSION) "." \ 46 | NODE_STRINGIFY(NODE_PATCH_VERSION) \ 47 | NODE_STRINGIFY(NODE_TAG) 48 | #endif 49 | 50 | # define NODE_VERSION_STRING NODE_STRINGIFY(NODE_MAJOR_VERSION) "." \ 51 | NODE_STRINGIFY(NODE_MINOR_VERSION) "." \ 52 | NODE_STRINGIFY(NODE_PATCH_VERSION) \ 53 | NODE_TAG 54 | #ifndef NODE_EXE_VERSION 55 | # define NODE_EXE_VERSION NODE_VERSION_STRING 56 | #endif 57 | 58 | #define NODE_VERSION "v" NODE_VERSION_STRING 59 | 60 | 61 | #define NODE_VERSION_AT_LEAST(major, minor, patch) \ 62 | (( (major) < NODE_MAJOR_VERSION) \ 63 | || ((major) == NODE_MAJOR_VERSION && (minor) < NODE_MINOR_VERSION) \ 64 | || ((major) == NODE_MAJOR_VERSION && \ 65 | (minor) == NODE_MINOR_VERSION && (patch) <= NODE_PATCH_VERSION)) 66 | 67 | /** 68 | * Node.js will refuse to load modules that weren't compiled against its own 69 | * module ABI number, exposed as the process.versions.modules property. 70 | * 71 | * When this version number is changed, node.js will refuse 72 | * to load older modules. This should be done whenever 73 | * an API is broken in the C++ side, including in v8 or 74 | * other dependencies. 75 | */ 76 | #define NODE_MODULE_VERSION 57 /* Node.js v8.0.0 */ 77 | 78 | #endif // SRC_NODE_VERSION_H_ 79 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* crypto/cmac/cmac.h */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 4 | * project. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | */ 54 | 55 | #ifndef HEADER_CMAC_H 56 | # define HEADER_CMAC_H 57 | 58 | #ifdef __cplusplus 59 | extern "C" { 60 | #endif 61 | 62 | # include 63 | 64 | /* Opaque */ 65 | typedef struct CMAC_CTX_st CMAC_CTX; 66 | 67 | CMAC_CTX *CMAC_CTX_new(void); 68 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 69 | void CMAC_CTX_free(CMAC_CTX *ctx); 70 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 71 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 72 | 73 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 74 | const EVP_CIPHER *cipher, ENGINE *impl); 75 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 76 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 77 | int CMAC_resume(CMAC_CTX *ctx); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #endif 83 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/comp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_COMP_H 3 | # define HEADER_COMP_H 4 | 5 | # include 6 | 7 | # ifdef OPENSSL_NO_COMP 8 | # error COMP is disabled. 9 | # endif 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | typedef struct comp_ctx_st COMP_CTX; 16 | 17 | struct comp_method_st { 18 | int type; /* NID for compression library */ 19 | const char *name; /* A text string to identify the library */ 20 | int (*init) (COMP_CTX *ctx); 21 | void (*finish) (COMP_CTX *ctx); 22 | int (*compress) (COMP_CTX *ctx, 23 | unsigned char *out, unsigned int olen, 24 | unsigned char *in, unsigned int ilen); 25 | int (*expand) (COMP_CTX *ctx, 26 | unsigned char *out, unsigned int olen, 27 | unsigned char *in, unsigned int ilen); 28 | /* 29 | * The following two do NOTHING, but are kept for backward compatibility 30 | */ 31 | long (*ctrl) (void); 32 | long (*callback_ctrl) (void); 33 | }; 34 | 35 | struct comp_ctx_st { 36 | COMP_METHOD *meth; 37 | unsigned long compress_in; 38 | unsigned long compress_out; 39 | unsigned long expand_in; 40 | unsigned long expand_out; 41 | CRYPTO_EX_DATA ex_data; 42 | }; 43 | 44 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 45 | void COMP_CTX_free(COMP_CTX *ctx); 46 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 47 | unsigned char *in, int ilen); 48 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 49 | unsigned char *in, int ilen); 50 | COMP_METHOD *COMP_rle(void); 51 | COMP_METHOD *COMP_zlib(void); 52 | void COMP_zlib_cleanup(void); 53 | 54 | # ifdef HEADER_BIO_H 55 | # ifdef ZLIB 56 | BIO_METHOD *BIO_f_zlib(void); 57 | # endif 58 | # endif 59 | 60 | /* BEGIN ERROR CODES */ 61 | /* 62 | * The following lines are auto generated by the script mkerr.pl. Any changes 63 | * made after this point may be overwritten when the script is next run. 64 | */ 65 | void ERR_load_COMP_strings(void); 66 | 67 | /* Error codes for the COMP functions. */ 68 | 69 | /* Function codes. */ 70 | # define COMP_F_BIO_ZLIB_FLUSH 99 71 | # define COMP_F_BIO_ZLIB_NEW 100 72 | # define COMP_F_BIO_ZLIB_READ 101 73 | # define COMP_F_BIO_ZLIB_WRITE 102 74 | 75 | /* Reason codes. */ 76 | # define COMP_R_ZLIB_DEFLATE_ERROR 99 77 | # define COMP_R_ZLIB_INFLATE_ERROR 100 78 | # define COMP_R_ZLIB_NOT_SUPPORTED 101 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #endif 84 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/conf_api.h: -------------------------------------------------------------------------------- 1 | /* conf_api.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_CONF_API_H 60 | # define HEADER_CONF_API_H 61 | 62 | # include 63 | # include 64 | 65 | #ifdef __cplusplus 66 | extern "C" { 67 | #endif 68 | 69 | /* Up until OpenSSL 0.9.5a, this was new_section */ 70 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); 71 | /* Up until OpenSSL 0.9.5a, this was get_section */ 72 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); 73 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ 74 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, 75 | const char *section); 76 | 77 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); 78 | char *_CONF_get_string(const CONF *conf, const char *section, 79 | const char *name); 80 | long _CONF_get_number(const CONF *conf, const char *section, 81 | const char *name); 82 | 83 | int _CONF_new_data(CONF *conf); 84 | void _CONF_free_data(CONF *conf); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | #endif 90 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* crypto/ebcdic.h */ 2 | 3 | #ifndef HEADER_EBCDIC_H 4 | # define HEADER_EBCDIC_H 5 | 6 | # include 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* Avoid name clashes with other applications */ 13 | # define os_toascii _openssl_os_toascii 14 | # define os_toebcdic _openssl_os_toebcdic 15 | # define ebcdic2ascii _openssl_ebcdic2ascii 16 | # define ascii2ebcdic _openssl_ascii2ebcdic 17 | 18 | extern const unsigned char os_toascii[256]; 19 | extern const unsigned char os_toebcdic[256]; 20 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 21 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/mdc2.h: -------------------------------------------------------------------------------- 1 | /* crypto/mdc2/mdc2.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_MDC2_H 60 | # define HEADER_MDC2_H 61 | 62 | # include 63 | 64 | #ifdef __cplusplus 65 | extern "C" { 66 | #endif 67 | 68 | # ifdef OPENSSL_NO_MDC2 69 | # error MDC2 is disabled. 70 | # endif 71 | 72 | # define MDC2_BLOCK 8 73 | # define MDC2_DIGEST_LENGTH 16 74 | 75 | typedef struct mdc2_ctx_st { 76 | unsigned int num; 77 | unsigned char data[MDC2_BLOCK]; 78 | DES_cblock h, hh; 79 | int pad_type; /* either 1 or 2, default 1 */ 80 | } MDC2_CTX; 81 | 82 | # ifdef OPENSSL_FIPS 83 | int private_MDC2_Init(MDC2_CTX *c); 84 | # endif 85 | int MDC2_Init(MDC2_CTX *c); 86 | int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len); 87 | int MDC2_Final(unsigned char *md, MDC2_CTX *c); 88 | unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/opensslv.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_OPENSSLV_H 2 | # define HEADER_OPENSSLV_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /*- 9 | * Numeric release version identifier: 10 | * MNNFFPPS: major minor fix patch status 11 | * The status nibble has one of the values 0 for development, 1 to e for betas 12 | * 1 to 14, and f for release. The patch level is exactly that. 13 | * For example: 14 | * 0.9.3-dev 0x00903000 15 | * 0.9.3-beta1 0x00903001 16 | * 0.9.3-beta2-dev 0x00903002 17 | * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) 18 | * 0.9.3 0x0090300f 19 | * 0.9.3a 0x0090301f 20 | * 0.9.4 0x0090400f 21 | * 1.2.3z 0x102031af 22 | * 23 | * For continuity reasons (because 0.9.5 is already out, and is coded 24 | * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level 25 | * part is slightly different, by setting the highest bit. This means 26 | * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start 27 | * with 0x0090600S... 28 | * 29 | * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) 30 | * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for 31 | * major minor fix final patch/beta) 32 | */ 33 | # define OPENSSL_VERSION_NUMBER 0x100020cfL 34 | # ifdef OPENSSL_FIPS 35 | # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2l-fips 25 May 2017" 36 | # else 37 | # define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2l 25 May 2017" 38 | # endif 39 | # define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT 40 | 41 | /*- 42 | * The macros below are to be used for shared library (.so, .dll, ...) 43 | * versioning. That kind of versioning works a bit differently between 44 | * operating systems. The most usual scheme is to set a major and a minor 45 | * number, and have the runtime loader check that the major number is equal 46 | * to what it was at application link time, while the minor number has to 47 | * be greater or equal to what it was at application link time. With this 48 | * scheme, the version number is usually part of the file name, like this: 49 | * 50 | * libcrypto.so.0.9 51 | * 52 | * Some unixen also make a softlink with the major verson number only: 53 | * 54 | * libcrypto.so.0 55 | * 56 | * On Tru64 and IRIX 6.x it works a little bit differently. There, the 57 | * shared library version is stored in the file, and is actually a series 58 | * of versions, separated by colons. The rightmost version present in the 59 | * library when linking an application is stored in the application to be 60 | * matched at run time. When the application is run, a check is done to 61 | * see if the library version stored in the application matches any of the 62 | * versions in the version string of the library itself. 63 | * This version string can be constructed in any way, depending on what 64 | * kind of matching is desired. However, to implement the same scheme as 65 | * the one used in the other unixen, all compatible versions, from lowest 66 | * to highest, should be part of the string. Consecutive builds would 67 | * give the following versions strings: 68 | * 69 | * 3.0 70 | * 3.0:3.1 71 | * 3.0:3.1:3.2 72 | * 4.0 73 | * 4.0:4.1 74 | * 75 | * Notice how version 4 is completely incompatible with version, and 76 | * therefore give the breach you can see. 77 | * 78 | * There may be other schemes as well that I haven't yet discovered. 79 | * 80 | * So, here's the way it works here: first of all, the library version 81 | * number doesn't need at all to match the overall OpenSSL version. 82 | * However, it's nice and more understandable if it actually does. 83 | * The current library version is stored in the macro SHLIB_VERSION_NUMBER, 84 | * which is just a piece of text in the format "M.m.e" (Major, minor, edit). 85 | * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, 86 | * we need to keep a history of version numbers, which is done in the 87 | * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and 88 | * should only keep the versions that are binary compatible with the current. 89 | */ 90 | # define SHLIB_VERSION_HISTORY "" 91 | # define SHLIB_VERSION_NUMBER "1.0.0" 92 | 93 | 94 | #ifdef __cplusplus 95 | } 96 | #endif 97 | #endif /* HEADER_OPENSSLV_H */ 98 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* ==================================================================== 2 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * 3. All advertising materials mentioning features or use of this 17 | * software must display the following acknowledgment: 18 | * "This product includes software developed by the OpenSSL Project 19 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 20 | * 21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 22 | * endorse or promote products derived from this software without 23 | * prior written permission. For written permission, please contact 24 | * licensing@OpenSSL.org. 25 | * 26 | * 5. Products derived from this software may not be called "OpenSSL" 27 | * nor may "OpenSSL" appear in their names without prior written 28 | * permission of the OpenSSL Project. 29 | * 30 | * 6. Redistributions of any form whatsoever must retain the following 31 | * acknowledgment: 32 | * "This product includes software developed by the OpenSSL Project 33 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 34 | * 35 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 36 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 38 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 41 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 42 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 44 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 45 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 46 | * OF THE POSSIBILITY OF SUCH DAMAGE. 47 | * ==================================================================== 48 | * 49 | * This product includes cryptographic software written by Eric Young 50 | * (eay@cryptsoft.com). This product includes software written by Tim 51 | * Hudson (tjh@cryptsoft.com). 52 | * 53 | */ 54 | 55 | /* 56 | * This header only exists to break a circular dependency between pem and err 57 | * Ben 30 Jan 1999. 58 | */ 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | #ifndef HEADER_PEM_H 65 | void ERR_load_PEM_strings(void); 66 | #endif 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/pqueue.h: -------------------------------------------------------------------------------- 1 | /* crypto/pqueue/pqueue.h */ 2 | /* 3 | * DTLS implementation written by Nagendra Modadugu 4 | * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_PQUEUE_H 61 | # define HEADER_PQUEUE_H 62 | 63 | # include 64 | # include 65 | # include 66 | 67 | #ifdef __cplusplus 68 | extern "C" { 69 | #endif 70 | typedef struct _pqueue *pqueue; 71 | 72 | typedef struct _pitem { 73 | unsigned char priority[8]; /* 64-bit value in big-endian encoding */ 74 | void *data; 75 | struct _pitem *next; 76 | } pitem; 77 | 78 | typedef struct _pitem *piterator; 79 | 80 | pitem *pitem_new(unsigned char *prio64be, void *data); 81 | void pitem_free(pitem *item); 82 | 83 | pqueue pqueue_new(void); 84 | void pqueue_free(pqueue pq); 85 | 86 | pitem *pqueue_insert(pqueue pq, pitem *item); 87 | pitem *pqueue_peek(pqueue pq); 88 | pitem *pqueue_pop(pqueue pq); 89 | pitem *pqueue_find(pqueue pq, unsigned char *prio64be); 90 | pitem *pqueue_iterator(pqueue pq); 91 | pitem *pqueue_next(piterator *iter); 92 | 93 | void pqueue_print(pqueue pq); 94 | int pqueue_size(pqueue pq); 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | #endif /* ! HEADER_PQUEUE_H */ 100 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/rc4.h: -------------------------------------------------------------------------------- 1 | /* crypto/rc4/rc4.h */ 2 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_RC4_H 60 | # define HEADER_RC4_H 61 | 62 | # include /* OPENSSL_NO_RC4, RC4_INT */ 63 | # ifdef OPENSSL_NO_RC4 64 | # error RC4 is disabled. 65 | # endif 66 | 67 | # include 68 | 69 | #ifdef __cplusplus 70 | extern "C" { 71 | #endif 72 | 73 | typedef struct rc4_key_st { 74 | RC4_INT x, y; 75 | RC4_INT data[256]; 76 | } RC4_KEY; 77 | 78 | const char *RC4_options(void); 79 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 80 | void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); 81 | void RC4(RC4_KEY *key, size_t len, const unsigned char *indata, 82 | unsigned char *outdata); 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/ssl23.h: -------------------------------------------------------------------------------- 1 | /* ssl/ssl23.h */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #ifndef HEADER_SSL23_H 60 | # define HEADER_SSL23_H 61 | 62 | #ifdef __cplusplus 63 | extern "C" { 64 | #endif 65 | 66 | /* 67 | * client 68 | */ 69 | /* write to server */ 70 | # define SSL23_ST_CW_CLNT_HELLO_A (0x210|SSL_ST_CONNECT) 71 | # define SSL23_ST_CW_CLNT_HELLO_B (0x211|SSL_ST_CONNECT) 72 | /* read from server */ 73 | # define SSL23_ST_CR_SRVR_HELLO_A (0x220|SSL_ST_CONNECT) 74 | # define SSL23_ST_CR_SRVR_HELLO_B (0x221|SSL_ST_CONNECT) 75 | 76 | /* server */ 77 | /* read from client */ 78 | # define SSL23_ST_SR_CLNT_HELLO_A (0x210|SSL_ST_ACCEPT) 79 | # define SSL23_ST_SR_CLNT_HELLO_B (0x211|SSL_ST_ACCEPT) 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | #endif 85 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/ui_compat.h: -------------------------------------------------------------------------------- 1 | /* crypto/ui/ui.h */ 2 | /* 3 | * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project 4 | * 2001. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@openssl.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_UI_COMPAT_H 61 | # define HEADER_UI_COMPAT_H 62 | 63 | # include 64 | # include 65 | 66 | #ifdef __cplusplus 67 | extern "C" { 68 | #endif 69 | 70 | /* 71 | * The following functions were previously part of the DES section, and are 72 | * provided here for backward compatibility reasons. 73 | */ 74 | 75 | # define des_read_pw_string(b,l,p,v) \ 76 | _ossl_old_des_read_pw_string((b),(l),(p),(v)) 77 | # define des_read_pw(b,bf,s,p,v) \ 78 | _ossl_old_des_read_pw((b),(bf),(s),(p),(v)) 79 | 80 | int _ossl_old_des_read_pw_string(char *buf, int length, const char *prompt, 81 | int verify); 82 | int _ossl_old_des_read_pw(char *buf, char *buff, int size, const char *prompt, 83 | int verify); 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | #endif 89 | -------------------------------------------------------------------------------- /app/src/main/include/node/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_WHRLPOOL_H 2 | # define HEADER_WHRLPOOL_H 3 | 4 | # include 5 | # include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | # define WHIRLPOOL_DIGEST_LENGTH (512/8) 12 | # define WHIRLPOOL_BBLOCK 512 13 | # define WHIRLPOOL_COUNTER (256/8) 14 | 15 | typedef struct { 16 | union { 17 | unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; 18 | /* double q is here to ensure 64-bit alignment */ 19 | double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; 20 | } H; 21 | unsigned char data[WHIRLPOOL_BBLOCK / 8]; 22 | unsigned int bitoff; 23 | size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; 24 | } WHIRLPOOL_CTX; 25 | 26 | # ifndef OPENSSL_NO_WHIRLPOOL 27 | # ifdef OPENSSL_FIPS 28 | int private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 29 | # endif 30 | int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 31 | int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); 32 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); 33 | int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); 34 | unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); 35 | # endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /app/src/main/include/node/pthread-barrier.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016, Kari Tristan Helgason 3 | 4 | Permission to use, copy, modify, and/or distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | 17 | #ifndef _UV_PTHREAD_BARRIER_ 18 | #define _UV_PTHREAD_BARRIER_ 19 | #include 20 | #include 21 | #if !defined(__MVS__) 22 | #include /* sem_t */ 23 | #endif 24 | 25 | #define PTHREAD_BARRIER_SERIAL_THREAD 0x12345 26 | 27 | /* 28 | * To maintain ABI compatibility with 29 | * libuv v1.x struct is padded according 30 | * to target platform 31 | */ 32 | #if defined(__ANDROID__) 33 | # define UV_BARRIER_STRUCT_PADDING \ 34 | sizeof(pthread_mutex_t) + \ 35 | sizeof(pthread_cond_t) + \ 36 | sizeof(unsigned int) - \ 37 | sizeof(void *) 38 | #elif defined(__APPLE__) 39 | # define UV_BARRIER_STRUCT_PADDING \ 40 | sizeof(pthread_mutex_t) + \ 41 | 2 * sizeof(sem_t) + \ 42 | 2 * sizeof(unsigned int) - \ 43 | sizeof(void *) 44 | #else 45 | # define UV_BARRIER_STRUCT_PADDING 0 46 | #endif 47 | 48 | typedef struct { 49 | pthread_mutex_t mutex; 50 | pthread_cond_t cond; 51 | unsigned threshold; 52 | unsigned in; 53 | unsigned out; 54 | } _uv_barrier; 55 | 56 | typedef struct { 57 | _uv_barrier* b; 58 | char _pad[UV_BARRIER_STRUCT_PADDING]; 59 | } pthread_barrier_t; 60 | 61 | int pthread_barrier_init(pthread_barrier_t* barrier, 62 | const void* barrier_attr, 63 | unsigned count); 64 | 65 | int pthread_barrier_wait(pthread_barrier_t* barrier); 66 | int pthread_barrier_destroy(pthread_barrier_t *barrier); 67 | 68 | #endif /* _UV_PTHREAD_BARRIER_ */ 69 | -------------------------------------------------------------------------------- /app/src/main/include/node/uv-aix.h: -------------------------------------------------------------------------------- 1 | /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to 5 | * deal in the Software without restriction, including without limitation the 6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | * sell copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | * IN THE SOFTWARE. 20 | */ 21 | 22 | #ifndef UV_AIX_H 23 | #define UV_AIX_H 24 | 25 | #define UV_PLATFORM_LOOP_FIELDS \ 26 | int fs_fd; \ 27 | 28 | #define UV_PLATFORM_FS_EVENT_FIELDS \ 29 | uv__io_t event_watcher; \ 30 | char *dir_filename; \ 31 | 32 | #endif /* UV_AIX_H */ 33 | -------------------------------------------------------------------------------- /app/src/main/include/node/uv-bsd.h: -------------------------------------------------------------------------------- 1 | /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to 5 | * deal in the Software without restriction, including without limitation the 6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | * sell copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | * IN THE SOFTWARE. 20 | */ 21 | 22 | #ifndef UV_BSD_H 23 | #define UV_BSD_H 24 | 25 | #define UV_PLATFORM_FS_EVENT_FIELDS \ 26 | uv__io_t event_watcher; \ 27 | 28 | #define UV_IO_PRIVATE_PLATFORM_FIELDS \ 29 | int rcount; \ 30 | int wcount; \ 31 | 32 | #define UV_HAVE_KQUEUE 1 33 | 34 | #endif /* UV_BSD_H */ 35 | -------------------------------------------------------------------------------- /app/src/main/include/node/uv-darwin.h: -------------------------------------------------------------------------------- 1 | /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to 5 | * deal in the Software without restriction, including without limitation the 6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | * sell copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | * IN THE SOFTWARE. 20 | */ 21 | 22 | #ifndef UV_DARWIN_H 23 | #define UV_DARWIN_H 24 | 25 | #if defined(__APPLE__) && defined(__MACH__) 26 | # include 27 | # include 28 | # include 29 | # include 30 | # define UV_PLATFORM_SEM_T semaphore_t 31 | #endif 32 | 33 | #define UV_IO_PRIVATE_PLATFORM_FIELDS \ 34 | int rcount; \ 35 | int wcount; \ 36 | 37 | #define UV_PLATFORM_LOOP_FIELDS \ 38 | uv_thread_t cf_thread; \ 39 | void* _cf_reserved; \ 40 | void* cf_state; \ 41 | uv_mutex_t cf_mutex; \ 42 | uv_sem_t cf_sem; \ 43 | void* cf_signals[2]; \ 44 | 45 | #define UV_PLATFORM_FS_EVENT_FIELDS \ 46 | uv__io_t event_watcher; \ 47 | char* realpath; \ 48 | int realpath_len; \ 49 | int cf_flags; \ 50 | uv_async_t* cf_cb; \ 51 | void* cf_events[2]; \ 52 | void* cf_member[2]; \ 53 | int cf_error; \ 54 | uv_mutex_t cf_mutex; \ 55 | 56 | #define UV_STREAM_PRIVATE_PLATFORM_FIELDS \ 57 | void* select; \ 58 | 59 | #define UV_HAVE_KQUEUE 1 60 | 61 | #endif /* UV_DARWIN_H */ 62 | -------------------------------------------------------------------------------- /app/src/main/include/node/uv-linux.h: -------------------------------------------------------------------------------- 1 | /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to 5 | * deal in the Software without restriction, including without limitation the 6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | * sell copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | * IN THE SOFTWARE. 20 | */ 21 | 22 | #ifndef UV_LINUX_H 23 | #define UV_LINUX_H 24 | 25 | #define UV_PLATFORM_LOOP_FIELDS \ 26 | uv__io_t inotify_read_watcher; \ 27 | void* inotify_watchers; \ 28 | int inotify_fd; \ 29 | 30 | #define UV_PLATFORM_FS_EVENT_FIELDS \ 31 | void* watchers[2]; \ 32 | int wd; \ 33 | 34 | #endif /* UV_LINUX_H */ 35 | -------------------------------------------------------------------------------- /app/src/main/include/node/uv-os390.h: -------------------------------------------------------------------------------- 1 | /* Copyright libuv project contributors. All rights reserved. 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to 5 | * deal in the Software without restriction, including without limitation the 6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | * sell copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | * IN THE SOFTWARE. 20 | */ 21 | 22 | #ifndef UV_MVS_H 23 | #define UV_MVS_H 24 | 25 | #define UV_PLATFORM_SEM_T int 26 | 27 | #define UV_PLATFORM_LOOP_FIELDS \ 28 | void* ep; \ 29 | 30 | #endif /* UV_MVS_H */ 31 | -------------------------------------------------------------------------------- /app/src/main/include/node/uv-posix.h: -------------------------------------------------------------------------------- 1 | /* Copyright libuv project contributors. All rights reserved. 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to 5 | * deal in the Software without restriction, including without limitation the 6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | * sell copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | * IN THE SOFTWARE. 20 | */ 21 | 22 | #ifndef UV_POSIX_H 23 | #define UV_POSIX_H 24 | 25 | #define UV_PLATFORM_LOOP_FIELDS \ 26 | struct pollfd* poll_fds; \ 27 | size_t poll_fds_used; \ 28 | size_t poll_fds_size; \ 29 | unsigned char poll_fds_iterating; \ 30 | 31 | #endif /* UV_POSIX_H */ 32 | -------------------------------------------------------------------------------- /app/src/main/include/node/uv-sunos.h: -------------------------------------------------------------------------------- 1 | /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to 5 | * deal in the Software without restriction, including without limitation the 6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | * sell copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | * IN THE SOFTWARE. 20 | */ 21 | 22 | #ifndef UV_SUNOS_H 23 | #define UV_SUNOS_H 24 | 25 | #include 26 | #include 27 | 28 | /* For the sake of convenience and reduced #ifdef-ery in src/unix/sunos.c, 29 | * add the fs_event fields even when this version of SunOS doesn't support 30 | * file watching. 31 | */ 32 | #define UV_PLATFORM_LOOP_FIELDS \ 33 | uv__io_t fs_event_watcher; \ 34 | int fs_fd; \ 35 | 36 | #if defined(PORT_SOURCE_FILE) 37 | 38 | # define UV_PLATFORM_FS_EVENT_FIELDS \ 39 | file_obj_t fo; \ 40 | int fd; \ 41 | 42 | #endif /* defined(PORT_SOURCE_FILE) */ 43 | 44 | #endif /* UV_SUNOS_H */ 45 | -------------------------------------------------------------------------------- /app/src/main/include/node/uv-threadpool.h: -------------------------------------------------------------------------------- 1 | /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to 5 | * deal in the Software without restriction, including without limitation the 6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | * sell copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | * IN THE SOFTWARE. 20 | */ 21 | 22 | /* 23 | * This file is private to libuv. It provides common functionality to both 24 | * Windows and Unix backends. 25 | */ 26 | 27 | #ifndef UV_THREADPOOL_H_ 28 | #define UV_THREADPOOL_H_ 29 | 30 | struct uv__work { 31 | void (*work)(struct uv__work *w); 32 | void (*done)(struct uv__work *w, int status); 33 | struct uv_loop_s* loop; 34 | void* wq[2]; 35 | }; 36 | 37 | #endif /* UV_THREADPOOL_H_ */ 38 | -------------------------------------------------------------------------------- /app/src/main/include/node/uv-version.h: -------------------------------------------------------------------------------- 1 | /* Copyright Joyent, Inc. and other Node contributors. All rights reserved. 2 | * 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy 4 | * of this software and associated documentation files (the "Software"), to 5 | * deal in the Software without restriction, including without limitation the 6 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 | * sell copies of the Software, and to permit persons to whom the Software is 8 | * furnished to do so, subject to the following conditions: 9 | * 10 | * The above copyright notice and this permission notice shall be included in 11 | * all copies or substantial portions of the Software. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 | * IN THE SOFTWARE. 20 | */ 21 | 22 | #ifndef UV_VERSION_H 23 | #define UV_VERSION_H 24 | 25 | /* 26 | * Versions with the same major number are ABI stable. API is allowed to 27 | * evolve between minor releases, but only in a backwards compatible way. 28 | * Make sure you update the -soname directives in configure.ac 29 | * and uv.gyp whenever you bump UV_VERSION_MAJOR or UV_VERSION_MINOR (but 30 | * not UV_VERSION_PATCH.) 31 | */ 32 | 33 | #define UV_VERSION_MAJOR 1 34 | #define UV_VERSION_MINOR 13 35 | #define UV_VERSION_PATCH 1 36 | #define UV_VERSION_IS_RELEASE 1 37 | #define UV_VERSION_SUFFIX "" 38 | 39 | #define UV_VERSION_HEX ((UV_VERSION_MAJOR << 16) | \ 40 | (UV_VERSION_MINOR << 8) | \ 41 | (UV_VERSION_PATCH)) 42 | 43 | #endif /* UV_VERSION_H */ 44 | -------------------------------------------------------------------------------- /app/src/main/include/node/v8-inspector-protocol.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 the V8 project authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef V8_V8_INSPECTOR_PROTOCOL_H_ 6 | #define V8_V8_INSPECTOR_PROTOCOL_H_ 7 | 8 | #include "inspector/Debugger.h" // NOLINT(build/include) 9 | #include "inspector/Runtime.h" // NOLINT(build/include) 10 | #include "inspector/Schema.h" // NOLINT(build/include) 11 | #include "v8-inspector.h" // NOLINT(build/include) 12 | 13 | #endif // V8_V8_INSPECTOR_PROTOCOL_H_ 14 | -------------------------------------------------------------------------------- /app/src/main/include/node/v8-testing.h: -------------------------------------------------------------------------------- 1 | // Copyright 2010 the V8 project authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef V8_V8_TEST_H_ 6 | #define V8_V8_TEST_H_ 7 | 8 | #include "v8.h" // NOLINT(build/include) 9 | 10 | /** 11 | * Testing support for the V8 JavaScript engine. 12 | */ 13 | namespace v8 { 14 | 15 | class V8_EXPORT Testing { 16 | public: 17 | enum StressType { 18 | kStressTypeOpt, 19 | kStressTypeDeopt 20 | }; 21 | 22 | /** 23 | * Set the type of stressing to do. The default if not set is kStressTypeOpt. 24 | */ 25 | static void SetStressRunType(StressType type); 26 | 27 | /** 28 | * Get the number of runs of a given test that is required to get the full 29 | * stress coverage. 30 | */ 31 | static int GetStressRuns(); 32 | 33 | /** 34 | * Indicate the number of the run which is about to start. The value of run 35 | * should be between 0 and one less than the result from GetStressRuns() 36 | */ 37 | static void PrepareStressRun(int run); 38 | 39 | /** 40 | * Force deoptimization of all functions. 41 | */ 42 | static void DeoptimizeAll(Isolate* isolate); 43 | }; 44 | 45 | 46 | } // namespace v8 47 | 48 | #endif // V8_V8_TEST_H_ 49 | -------------------------------------------------------------------------------- /app/src/main/include/node/v8-version-string.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 the V8 project authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef V8_VERSION_STRING_H_ 6 | #define V8_VERSION_STRING_H_ 7 | 8 | #include "v8-version.h" // NOLINT(build/include) 9 | 10 | // This is here rather than v8-version.h to keep that file simple and 11 | // machine-processable. 12 | 13 | #if V8_IS_CANDIDATE_VERSION 14 | #define V8_CANDIDATE_STRING " (candidate)" 15 | #else 16 | #define V8_CANDIDATE_STRING "" 17 | #endif 18 | 19 | #define V8_SX(x) #x 20 | #define V8_S(x) V8_SX(x) 21 | 22 | #if V8_PATCH_LEVEL > 0 23 | #define V8_VERSION_STRING \ 24 | V8_S(V8_MAJOR_VERSION) \ 25 | "." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER) "." V8_S( \ 26 | V8_PATCH_LEVEL) V8_CANDIDATE_STRING 27 | #else 28 | #define V8_VERSION_STRING \ 29 | V8_S(V8_MAJOR_VERSION) \ 30 | "." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER) V8_CANDIDATE_STRING 31 | #endif 32 | 33 | #endif // V8_VERSION_STRING_H_ 34 | -------------------------------------------------------------------------------- /app/src/main/include/node/v8-version.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 the V8 project authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef V8_INCLUDE_VERSION_H_ // V8_VERSION_H_ conflicts with src/version.h 6 | #define V8_INCLUDE_VERSION_H_ 7 | 8 | // These macros define the version number for the current version. 9 | // NOTE these macros are used by some of the tool scripts and the build 10 | // system so their names cannot be changed without changing the scripts. 11 | #define V8_MAJOR_VERSION 5 12 | #define V8_MINOR_VERSION 8 13 | #define V8_BUILD_NUMBER 283 14 | #define V8_PATCH_LEVEL 41 15 | 16 | // Use 1 for candidates and 0 otherwise. 17 | // (Boolean macro values are not supported by all preprocessors.) 18 | #define V8_IS_CANDIDATE_VERSION 0 19 | 20 | #endif // V8_INCLUDE_VERSION_H_ 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/mafintosh/nodeonandroid/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.mafintosh.nodeonandroid; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.content.IntentFilter; 7 | import android.support.v4.content.LocalBroadcastManager; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.os.Bundle; 10 | import android.webkit.WebView; 11 | 12 | import java.io.BufferedInputStream; 13 | import java.io.BufferedOutputStream; 14 | import java.net.InetAddress; 15 | import java.net.ServerSocket; 16 | import java.net.Socket; 17 | import java.util.Arrays; 18 | 19 | public class MainActivity extends AppCompatActivity { 20 | private WebView browser; 21 | private NodeReceiver receiver; 22 | 23 | @Override 24 | protected void onDestroy() { 25 | super.onDestroy(); 26 | Intent i = new Intent(MainActivity.this, NodeService.class); 27 | stopService(i); 28 | } 29 | 30 | @Override 31 | protected void onCreate(Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_main); 34 | 35 | receiver = new NodeReceiver(); 36 | IntentFilter filter = new IntentFilter("com.mafintosh.nodeonandroid.ipc"); 37 | LocalBroadcastManager.getInstance(this).registerReceiver(receiver, filter); 38 | 39 | browser = (WebView) findViewById(R.id.webview); 40 | browser.getSettings().setLoadWithOverviewMode(true); 41 | browser.getSettings().setUseWideViewPort(true); 42 | browser.getSettings().setJavaScriptEnabled(true); 43 | 44 | final Context me = this; 45 | 46 | new Thread( 47 | new Runnable() { 48 | @Override 49 | public void run() { 50 | try { 51 | ServerSocket server = new ServerSocket(0, 5, InetAddress.getByName("127.0.0.1")); 52 | 53 | Intent i = new Intent(MainActivity.this, NodeService.class); 54 | i.putExtra("ipc-port", "" + server.getLocalPort()); 55 | startService(i); 56 | 57 | Socket socket = server.accept(); 58 | BufferedInputStream inp = new BufferedInputStream(socket.getInputStream()); 59 | BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream()); 60 | 61 | byte[] buf = new byte[65536]; 62 | 63 | while (true) { 64 | int read = inp.read(buf); 65 | String u = new String(Arrays.copyOfRange(buf, 0, read)); 66 | Intent in = new Intent("com.mafintosh.nodeonandroid.ipc"); 67 | in.putExtra("loadUrl", u); 68 | LocalBroadcastManager.getInstance(me).sendBroadcast(in); 69 | } 70 | } catch (Exception err) { 71 | err.printStackTrace(); 72 | } 73 | } 74 | } 75 | ).start(); 76 | 77 | } 78 | 79 | private class NodeReceiver extends BroadcastReceiver { 80 | @Override 81 | public void onReceive(Context context, Intent intent) { 82 | String loadUrl = intent.getStringExtra("loadUrl"); 83 | if (loadUrl != null) browser.loadUrl(loadUrl); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/src/main/java/com/mafintosh/nodeonandroid/NodeService.java: -------------------------------------------------------------------------------- 1 | package com.mafintosh.nodeonandroid; 2 | 3 | import android.app.Service; 4 | import android.content.Intent; 5 | import android.content.res.AssetManager; 6 | import android.os.IBinder; 7 | import android.support.annotation.Nullable; 8 | import java.io.File; 9 | import java.io.FileOutputStream; 10 | import java.io.IOException; 11 | import java.io.InputStream; 12 | 13 | public class NodeService extends Service { 14 | private Thread t; 15 | 16 | @Override 17 | public void onCreate() { 18 | super.onCreate(); 19 | } 20 | 21 | @Override 22 | public void onDestroy() { 23 | super.onDestroy(); 24 | if (t != null) { 25 | t.stop(); 26 | t = null; 27 | } 28 | } 29 | 30 | @Override 31 | public int onStartCommand(Intent intent, int flags, int startId) { 32 | final String ipcPort = intent.getStringExtra("ipc-port"); 33 | 34 | if (t == null) { 35 | t = new Thread(new Runnable() { 36 | @Override 37 | public void run() { 38 | String cache = getCacheDir().getAbsolutePath(); 39 | String jsPath = cache + "/node"; 40 | String corePath = cache + "/node_modules"; 41 | AssetManager am = getAssets(); 42 | copyAssets(am, "node_modules", corePath); 43 | copyAssets(am, "node", jsPath); 44 | startNode("node", jsPath, "" + ipcPort); 45 | } 46 | }); 47 | t.start(); 48 | } 49 | 50 | return START_REDELIVER_INTENT; 51 | } 52 | 53 | @Nullable 54 | @Override 55 | public IBinder onBind(Intent intent) { 56 | return null; 57 | } 58 | 59 | private native void startNode(String... app); 60 | 61 | private static void copyAssets (AssetManager am, String src, String dest) { 62 | try { 63 | copyAssetFile(am, src, dest); 64 | } catch (Exception e) { 65 | try { 66 | File dir = new File(dest); 67 | dir.mkdir(); 68 | } catch (Exception e1) {} 69 | try { 70 | String[] files = am.list(src); 71 | for (int i = 0; i < files.length; i++) { 72 | copyAssets(am, src + "/" + files[i], dest + "/" + files[i]); 73 | } 74 | } catch (Exception e2) {} 75 | } 76 | } 77 | 78 | private static void copyAssetFile(AssetManager am, String src, String dest) throws IOException { 79 | InputStream in = am.open(src); 80 | 81 | File destFile = new File(dest); 82 | if (!destFile.exists()) destFile.createNewFile(); 83 | 84 | FileOutputStream out = new FileOutputStream(dest); 85 | 86 | byte[] buffer = new byte[1024]; 87 | int length; 88 | while ((length = in.read(buffer)) > 0) { 89 | out.write(buffer, 0, length); 90 | } 91 | in.close(); 92 | out.close(); 93 | } 94 | 95 | static { 96 | System.loadLibrary("node"); 97 | System.loadLibrary("native-lib"); 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/arm64-v8a/libc++node_shared.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/jniLibs/arm64-v8a/libc++node_shared.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/arm64-v8a/libnode.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/jniLibs/arm64-v8a/libnode.so -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Node on Android 3 | node.service 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/mafintosh/nodeonandroid/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.mafintosh.nodeonandroid; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | google() 19 | jcenter() 20 | } 21 | } 22 | 23 | task clean(type: Delete) { 24 | delete rootProject.buildDir 25 | } 26 | -------------------------------------------------------------------------------- /cli/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /cli/base.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/cli/base.apk -------------------------------------------------------------------------------- /cli/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var os = require('os') 4 | var path = require('path') 5 | var mkdirp = require('mkdirp') 6 | var proc = require('child_process') 7 | var minimist = require('minimist') 8 | 9 | var argv = minimist(process.argv.slice(2), { 10 | alias: { 11 | b: 'build-tools', 12 | o: 'out' 13 | }, 14 | default: { 15 | o: 'app.apk' 16 | } 17 | }) 18 | 19 | if (!argv.b) { 20 | console.error('--build-tools=[path/to/android/build/tools] is required') 21 | process.exit(1) 22 | } 23 | 24 | var cwd = path.resolve(argv._[0] || process.cwd()) 25 | var app = path.resolve(cwd, argv.o || 'app.apk') 26 | var buildTools = argv.b 27 | var base = path.join(__dirname, 'base.apk') 28 | var tmp = path.join(os.tmpdir(), 'node-on-android-' + Date.now()) 29 | var node = path.join(tmp, 'base', 'assets', 'node') 30 | var keystore = path.join(__dirname, 'whatever.keystore') 31 | 32 | mkdirp.sync(tmp) 33 | 34 | run('rm', ['-f', app]) 35 | run('apktool', ['d', base]) 36 | run('rm', ['-rf', node]) 37 | run('cp', ['-rf', cwd, node]) 38 | run('apktool', ['b', 'base', '-o', app]) 39 | run(path.join(buildTools, 'zipalign'), ['-v', '-p', '4', app, app + '.aligned']) 40 | run('mv', [app + '.aligned', app]) 41 | run(path.join(buildTools, 'apksigner'), ['sign', '--ks-pass', 'pass:whatever', '--ks', keystore, '--out', app, app]) 42 | run('rm', ['-rf', tmp]) 43 | 44 | console.log('Done! apk file is stored in:') 45 | console.log(app) 46 | 47 | function run (cmd, args) { 48 | proc.spawnSync(cmd, args, { 49 | cwd: tmp, 50 | stdio: 'inherit' 51 | }) 52 | } 53 | -------------------------------------------------------------------------------- /cli/index.js: -------------------------------------------------------------------------------- 1 | var net = require('net') 2 | 3 | var android = function () { 4 | var port = Number(process.argv[process.argv.length - 1]) 5 | var sock = net.connect(port, '127.0.0.1') 6 | return { 7 | loadUrl: function (u) { 8 | sock.write(u) 9 | } 10 | } 11 | }() 12 | 13 | module.exports = android -------------------------------------------------------------------------------- /cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-on-android", 3 | "version": "0.0.2", 4 | "description": "Make Node.JS apps for Android", 5 | "main": "index.js", 6 | "dependencies": { 7 | "minimist": "^1.2.0", 8 | "mkdirp": "^0.5.1" 9 | }, 10 | "devDependencies": {}, 11 | "bin": { 12 | "node-on-android": "./bin.js" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/node-on-mobile/node-on-android.git" 17 | }, 18 | "author": "Mathias Buus (@mafintosh)", 19 | "license": "MIT", 20 | "bugs": { 21 | "url": "https://github.com/node-on-mobile/node-on-android/issues" 22 | }, 23 | "homepage": "https://github.com/node-on-mobile/node-on-android" 24 | } 25 | -------------------------------------------------------------------------------- /cli/whatever.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/cli/whatever.keystore -------------------------------------------------------------------------------- /example/app/index.js: -------------------------------------------------------------------------------- 1 | 2 | // save me as my-app/index.js 3 | var http = require('http') 4 | var android = require('node-on-android') 5 | 6 | var server = http.createServer(function (req, res) { 7 | res.end(` 8 | 9 | 10 |

Welcome to Node.js hacking on Android

11 | 12 | 13 | `) 14 | }) 15 | 16 | server.listen(0, function () { 17 | android.loadUrl(`http://localhost:${server.address().port}`) 18 | }) 19 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-on-android-example", 3 | "version": "0.0.1", 4 | "scripts": { 5 | "build": "../cli/bin.js app -o ../build/app.apk -b /usr/local/bin" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/node-on-mobile/node-on-android/d198350f8346b94f9562e6ee540441b50fdc49d8/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jul 28 14:57:46 PDT 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------