core :: union_find
union–find algorithm using an efficient disjoint-set data structurenitc :: actors_generation_phase
Generate a support module for each module that contain a class annotated withis actor
nitc :: actors_injection_phase
Injects model for the classes annotated with "is actor" sonitc :: api_metrics
nitc :: astbuilder
Instantiation and transformation of semantic nodes in the AST of expressions and statementsbucketed_game :: bucketed_game
Game framework with an emphasis on efficient event coordinationcflags
and ldflags
to specify
accept_scroll_and_zoom
gamnit :: camera_control_android
Two fingers camera manipulation, pinch to zoom and slide to scrollgamnit :: camera_control_linux
Mouse wheel and middle mouse button to control cameranitc :: commands_ini
pthreads :: concurrent_array_and_barrier
A basic usage example of the modulespthreads
and pthreads::cocurrent_collections
pthreads :: concurrent_collections
Introduces thread-safe concurrent collectionsserialization :: custom_serialization
Example of an ad hoc serializer that is tailored to transform business specific objects into customized representation.nitc :: detect_variance_constraints
Collect metrics about detected variances constraints on formal types.egl
, sdl
and x11
extra_java_files
to compile extra java files
FileServer
action, which is a standard and minimal file server
cocoa :: foundation
The Foundation Kit provides basic Objective-C classes and structuresfunctional_types.nit
functional :: functional_types
This module provides functional type to represents various function forms.gtk :: gtk_assistant
gtk :: gtk_dialogs
HttpRequest
class and services to create it
app::http_request
main service AsyncHttpRequest
nitc :: i18n_phase
Basic support of internationalization through the generation of id-to-string tablesSerializable::inspect
to show more useful information
Iterator
.
nitc :: light_only
Compiler support for the light FFI only, detects unsupported usage of callbacksactors :: mandelbrot
Example implemented from "The computer Language Benchmarks Game" - Mandelbrotmarkdown2 :: markdown_html_rendering
HTML rendering of Markdown documentsmarkdown2 :: markdown_latex_rendering
LaTeX rendering of Markdown documentsmarkdown2 :: markdown_man_rendering
Manpages rendering of Markdown documentsmarkdown2 :: markdown_md_rendering
Markdown rendering of Markdown documentsnitc
.
nitc :: modelbuilder
more_collections :: more_collections
Highly specific, but useful, collections-related classes.mpi :: mpi_simple
curl :: native_curl
Binding of C libCurl which allow us to interact with network.app.nit
on Android using a custom Java entry point
nitcc_runtime :: nitcc_runtime
Runtime library required by parsers and lexers generated by nitccnitc :: nitmetrics
A program that collects various metrics on nit programs and librariesnitc :: nitrestful
Tool generating boilerplate code linking RESTful actions to Nit methodsnlp :: nlp_server
glesv2 :: opengles2_hello_triangle
Basic example of OpenGL ES 2.0 usage using SDL 2threaded
annotation
performance_analysis :: performance_analysis
Services to gather information on the performance of events by categoriesrestful
annotation documented at lib/nitcorn/restful.nit
sax :: sax_locator
Interface for associating a SAX event with a document location.Locator
.
nitc :: separate_erasure_compiler
Separate compilation of a Nit program with generic type erasurenitc :: serialization_code_gen_phase
Phase generating methods (code) to serialize Nit objectsmsgpack :: serialization_common
Serialization services forserialization_write
and serialization_read
serialization :: serialization_core
Abstract services to serialize Nit objects to different formatsnitc :: serialization_model_phase
Phase generating methods (model-only) to serialize Nit objectsdeserialize_json
and JsonDeserializer
msgpack :: serialization_write
Serialize full Nit objects to MessagePack formatserialize_to_json
and JsonSerializer
root
to execute
agent_simulation
by refining the Agent class to make
socket :: socket_simple_server
Simple server example using a non-blockingTCPServer
EulerCamera
and App::frame_core_draw
to get a stereoscopic view
clone
method of the astbuilder tool
gamnit :: texture_atlas_parser
Tool to parse XML texture atlas and generated Nit code to access subtexturesnitc :: toolcontext
Common command-line tool infrastructure than handle options and error messagesnitc :: uml_module
Services for generation of a UML package diagram based on aModel
# Codec for UTF-8 I/O
module utf8
import codec_base
intrude import text::flat
intrude import bytes
# Codec supporting UTF-8
private class UTF8Codec
super Codec
redef fun char_max_size do return 4
redef fun codet_size do return 1
redef fun max_lookahead do return 4
redef fun encode_char(c) do
var ns = new CString(c.u8char_len)
add_char_to(c, ns)
return ns
end
redef fun add_char_to(c, stream) do
c.u8char_tos(stream, c.u8char_len)
return c.u8char_len
end
redef fun encode_string(s) do
var buf = new Bytes.with_capacity(s.byte_length)
add_string_to(s, buf)
return buf
end
redef fun add_string_to(s, b) do
s.append_to_bytes(b)
return s.byte_length
end
redef fun is_valid_char(ns, len) do
if len == 0 then return 2
if not ns[0].is_valid_utf8_start then return 2
for i in [1 .. len[ do if ns[i] & 0b1100_0000 != 0b1000_0000 then return 2
if len != ns[0].u8len then return 1
return 0
end
redef fun decode_char(b) do
var c = b.char_at(0)
var cp = c.code_point
if cp >= 0xD800 and cp <= 0xDFFF then return 0xFFFD.code_point
if cp == 0xFFFE or cp == 0xFFFF then return 0xFFFD.code_point
return c
end
redef fun decode_string(ns, len) do
assert len >= 0
var ret = ns.to_s_unsafe(len, copy=false)
var rit = ret.as(FlatString).items
if rit == ns then
var nns = new CString(len)
rit.copy_to(nns, len, 0, 0)
return nns.to_s_unsafe(ret.byte_length, ret.length, copy=false)
end
return ret
end
end
# Returns the instance of a UTF-8 Codec
fun utf8_codec: Codec do return once new UTF8Codec
lib/core/codecs/utf8.nit:15,1--84,50