Add generated JNI detection, update samples

This commit is contained in:
Ted Nyman
2013-11-04 19:14:34 -08:00
parent 6ee999617e
commit 81176f8dfa
4 changed files with 112 additions and 20 deletions

View File

@@ -58,7 +58,8 @@ module Linguist
generated_parser? ||
generated_net_docfile? ||
generated_net_designer_file? ||
generated_protocol_buffer?
generated_protocol_buffer? ||
generated_jni_header?
end
# Internal: Is the blob an XCode project file?
@@ -181,5 +182,16 @@ module Linguist
return lines[0].include?("Generated by the protocol buffer compiler. DO NOT EDIT!")
end
# Internal: Is the blob a C/C++ header generated by the Java JNI tool javah?
#
# Returns true of false.
def generated_jni_header?
return false unless extname == '.h'
return false unless lines.count > 2
return lines[0].include?("/* DO NOT EDIT THIS FILE - it is machine generated */")
return lines[1].include?("#include <jni.h>")
end
end
end

View File

@@ -424,8 +424,8 @@
".gemrc"
]
},
"tokens_total": 415223,
"languages_total": 457,
"tokens_total": 415313,
"languages_total": 458,
"tokens": {
"ABAP": {
"*/**": 1,
@@ -2110,19 +2110,19 @@
"preempts": 1
},
"C": {
"#include": 149,
"#include": 150,
"const": 358,
"char": 529,
"*blob_type": 2,
";": 5440,
";": 5446,
"struct": 359,
"blob": 6,
"*lookup_blob": 2,
"(": 6219,
"(": 6225,
"unsigned": 140,
"*sha1": 16,
")": 6221,
"{": 1529,
")": 6227,
"{": 1530,
"object": 10,
"*obj": 9,
"lookup_object": 2,
@@ -2139,22 +2139,22 @@
"sha1_to_hex": 8,
"typename": 2,
"NULL": 330,
"}": 1545,
"*": 253,
"}": 1546,
"*": 259,
"int": 446,
"parse_blob_buffer": 2,
"*item": 10,
"void": 279,
"void": 284,
"*buffer": 6,
"long": 105,
"size": 120,
"item": 24,
"object.parsed": 4,
"#ifndef": 84,
"#ifndef": 85,
"BLOB_H": 2,
"#define": 911,
"extern": 37,
"#endif": 236,
"#define": 912,
"extern": 38,
"#endif": 239,
"git_cache_init": 1,
"git_cache": 4,
"*cache": 4,
@@ -2487,7 +2487,7 @@
"<linux/mutex.h>": 1,
"<linux/gfp.h>": 1,
"<linux/suspend.h>": 1,
"#ifdef": 64,
"#ifdef": 66,
"CONFIG_SMP": 1,
"DEFINE_MUTEX": 1,
"cpu_add_remove_lock": 3,
@@ -3536,7 +3536,7 @@
"paused": 3,
"HPE_PAUSED": 2,
"http_parser_h": 2,
"__cplusplus": 18,
"__cplusplus": 20,
"HTTP_PARSER_VERSION_MAJOR": 1,
"HTTP_PARSER_VERSION_MINOR": 1,
"<sys/types.h>": 2,
@@ -3627,6 +3627,22 @@
"*http_method_str": 1,
"*http_errno_name": 1,
"*http_errno_description": 1,
"<jni.h>": 1,
"_Included_jni_JniLayer": 2,
"JNIEXPORT": 6,
"jlong": 6,
"JNICALL": 6,
"Java_jni_JniLayer_jni_1layer_1initialize": 1,
"JNIEnv": 6,
"jobject": 6,
"jintArray": 1,
"jint": 7,
"Java_jni_JniLayer_jni_1layer_1mainloop": 1,
"Java_jni_JniLayer_jni_1layer_1set_1button": 1,
"Java_jni_JniLayer_jni_1layer_1set_1analog": 1,
"jfloat": 1,
"Java_jni_JniLayer_jni_1layer_1report_1analog_1chg": 1,
"Java_jni_JniLayer_jni_1layer_1kill": 1,
"strncasecmp": 2,
"_strnicmp": 1,
"REF_TABLE_SIZE": 1,
@@ -41512,7 +41528,7 @@
"AutoHotkey": 3,
"Awk": 544,
"Bluespec": 1298,
"C": 58768,
"C": 58858,
"C++": 21480,
"Ceylon": 50,
"COBOL": 90,
@@ -41623,7 +41639,7 @@
"AutoHotkey": 1,
"Awk": 1,
"Bluespec": 2,
"C": 25,
"C": 26,
"C++": 20,
"Ceylon": 1,
"COBOL": 4,
@@ -41725,5 +41741,5 @@
"Xtend": 2,
"YAML": 1
},
"md5": "b4a3a57fb23d04d031c0a6976ae4ffbc"
"md5": "e1daa29f986e203ade56a02091d24c99"
}

61
samples/C/jni_layer.h Normal file
View File

@@ -0,0 +1,61 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class jni_JniLayer */
#ifndef _Included_jni_JniLayer
#define _Included_jni_JniLayer
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: jni_JniLayer
* Method: jni_layer_initialize
* Signature: ([II)J
*/
JNIEXPORT jlong JNICALL Java_jni_JniLayer_jni_1layer_1initialize
(JNIEnv *, jobject, jintArray, jint, jint);
/*
* Class: jni_JniLayer
* Method: jni_layer_mainloop
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_jni_JniLayer_jni_1layer_1mainloop
(JNIEnv *, jobject, jlong);
/*
* Class: jni_JniLayer
* Method: jni_layer_set_button
* Signature: (JII)V
*/
JNIEXPORT void JNICALL Java_jni_JniLayer_jni_1layer_1set_1button
(JNIEnv *, jobject, jlong, jint, jint);
/*
* Class: jni_JniLayer
* Method: jni_layer_set_analog
* Signature: (JIIF)V
*/
JNIEXPORT void JNICALL Java_jni_JniLayer_jni_1layer_1set_1analog
(JNIEnv *, jobject, jlong, jint, jint, jfloat);
/*
* Class: jni_JniLayer
* Method: jni_layer_report_analog_chg
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_jni_JniLayer_jni_1layer_1report_1analog_1chg
(JNIEnv *, jobject, jlong, jint);
/*
* Class: jni_JniLayer
* Method: jni_layer_kill
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_jni_JniLayer_jni_1layer_1kill
(JNIEnv *, jobject, jlong);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -198,6 +198,9 @@ class TestBlob < Test::Unit::TestCase
assert blob("Java/ProtocolBuffer.java").generated?
assert blob("Python/protocol_buffer_pb2.py").generated?
# Generated JNI
assert blob("C/jni_layer.h").generated?
# Minified CSS
assert !blob("CSS/bootstrap.css").generated?
assert blob("CSS/bootstrap.min.css").generated?