core :: union_find
union–find algorithm using an efficient disjoint-set data structureapp.nit
on Android using a custom Java entry point
gamnit :: camera_control_android
Two fingers camera manipulation, pinch to zoom and slide to scroll
# Advanced Android logging services
module log is ldflags "-llog"
import platform
in "C" `{
#include <android/log.h>
`}
# Use Android logs to print
redef fun print(object)
do
log_write(priority_info, app.log_prefix.to_cstring, object.to_s.to_cstring)
end
# Use Android logs to print errors
redef fun print_error(object)
do
log_write(priority_error, app.log_prefix.to_cstring, object.to_s.to_cstring)
end
# Use Android logs to print warnings
redef fun print_warning(object)
do
log_write(priority_warn, app.log_prefix.to_cstring, object.to_s.to_cstring)
end
redef class App
# Prefix to all log messages
protected fun log_prefix: String do return "app.nit"
end
# Default Android log priority
private fun priority_default: Int do return 1
# Verbose Android log priority
private fun priority_verbose: Int do return 2
# Debug Android log priority
private fun priority_debug: Int do return 3
# Info Android log priority
private fun priority_info: Int do return 4
# Warn Android log priority
private fun priority_warn: Int do return 5
# Error Android log priority
private fun priority_error: Int do return 6
# Fatal Android log priority
private fun priority_fatal: Int do return 7
# Silent Android log priority
private fun priority_silent: Int do return 8
# Write `text` to Android log at priority `level` with tag `tag`
private fun log_write(level: Int, tag, text: CString) `{
__android_log_write(level, tag, text);
`}
lib/android/log.nit:17,1--76,2