Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
82 files changed:
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+import java_api is example
# Get a Java string
var str = java_lang_integer_to_string_int(5678)
# Get a Java string
var str = java_lang_integer_to_string_int(5678)
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module user_test is example
+
import queue
var queue = new JavaQueue
import queue
var queue = new JavaQueue
# Example of a calculation used nitcc
# see `calc.sablecc` for the grammar
# Example of a calculation used nitcc
# see `calc.sablecc` for the grammar
# Reuse the test program to simplify the code
import calc_test_parser
# Reuse the test program to simplify the code
import calc_test_parser
+module minilang is example
+
import minilang_test_parser
# An naive recursive stack-based interpreter of the minilang language.
import minilang_test_parser
# An naive recursive stack-based interpreter of the minilang language.
# limitations under the License.
# Example that uses `shibuqam` to authenticate users and count the number of time they reload.
# limitations under the License.
# Example that uses `shibuqam` to authenticate users and count the number of time they reload.
+module reloadgame is example
import popcorn
import counter
import popcorn
import counter
# * no `client_id`: because we do not want to code a db of clients. The `redirect_uri` can be seen as a simple client_id. We have also no way to present the client to the user since we do not control the authorization page of shibboleth since is done by the reverse proxy.
# * no `scope` and no `authorisation_code` since since there is nothing to access. We just get minimal information after the successful shibboleth login. Thus we have nothing more to authorise once the user is authenticated.
# * no `client_secret`: the user information are already public. There is no need to make the code more complex to protect public information.
# * no `client_id`: because we do not want to code a db of clients. The `redirect_uri` can be seen as a simple client_id. We have also no way to present the client to the user since we do not control the authorization page of shibboleth since is done by the reverse proxy.
# * no `scope` and no `authorisation_code` since since there is nothing to access. We just get minimal information after the successful shibboleth login. Thus we have nothing more to authorise once the user is authenticated.
# * no `client_secret`: the user information are already public. There is no need to make the code more complex to protect public information.
+module shibuqamoauth is example
import popcorn
import popcorn::pop_json
import popcorn
import popcorn::pop_json
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
+module blink is example
+
import wiringPi
if args.length != 1 then
import wiringPi
if args.length != 1 then
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
+module read is example
+
import wiringPi
if args.length != 1 then
import wiringPi
if args.length != 1 then
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
+module wiringPi is example
+
import wiringPi
if args.is_empty or args.length > 2 then
import wiringPi
if args.is_empty or args.length > 2 then
# Example of an implementation of circular lists
# This example shows the usage of generics and somewhat a specialisation of collections.
# Example of an implementation of circular lists
# This example shows the usage of generics and somewhat a specialisation of collections.
+module circular_list is example
# Sequences of elements implemented with a double-linked circular list
class CircularList[E]
# Sequences of elements implemented with a double-linked circular list
class CircularList[E]
# limitations under the License.
# Simple example of refinement where a method is added to the integer class.
# limitations under the License.
# Simple example of refinement where a method is added to the integer class.
+module fibonacci is example
redef class Int
# Calculate the self-th element of the fibonacci sequence.
redef class Int
# Calculate the self-th element of the fibonacci sequence.
# An example that defines and uses stacks of integers.
# The implementation is done with a simple linked list.
# It features: free constructors, nullable types and some adaptive typing.
# An example that defines and uses stacks of integers.
# The implementation is done with a simple linked list.
# It features: free constructors, nullable types and some adaptive typing.
+module int_stack is example
# A stack of integer implemented by a simple linked list.
# Note that this is only a toy class since a real linked list will gain to use
# A stack of integer implemented by a simple linked list.
# Note that this is only a toy class since a real linked list will gain to use
# Example of a procedural program (without explicit class definition).
# This program manipulates arrays of integers.
# Example of a procedural program (without explicit class definition).
# This program manipulates arrays of integers.
+module procedural_array is example
# The sum of the elements of `a'.
# Uses a 'for' control structure.
# The sum of the elements of `a'.
# Uses a 'for' control structure.
# limitations under the License.
# a "Framework" to make Multi-Agent Simulations in Nit
# limitations under the License.
# a "Framework" to make Multi-Agent Simulations in Nit
-module agent_simulation is no_warning("missing-doc")
+module agent_simulation is example, no_warning("missing-doc")
# The steps consist of each agent greeting each other, and
# waiting for every other agent to respond before notifying
# to the `ClockAgent` that they finished their step.
# The steps consist of each agent greeting each other, and
# waiting for every other agent to respond before notifying
# to the `ClockAgent` that they finished their step.
-module simple_simulation
+module simple_simulation is example
#
# Complete description of the chameneos-redux :
# https://benchmarksgame.alioth.debian.org/u64q/chameneosredux-description.html#chameneosredux
#
# Complete description of the chameneos-redux :
# https://benchmarksgame.alioth.debian.org/u64q/chameneosredux-description.html#chameneosredux
-module chameneosredux is no_warning("missing-doc")
+module chameneosredux is example, no_warning("missing-doc")
#
# Complete description of the fannkuch-redux :
# https://benchmarksgame.alioth.debian.org/u64q/fannkuchredux-description.html#fannkuchredux
#
# Complete description of the fannkuch-redux :
# https://benchmarksgame.alioth.debian.org/u64q/fannkuchredux-description.html#fannkuchredux
-module fannkuchredux is no_warning("missing-doc")
+module fannkuchredux is example, no_warning("missing-doc")
#
# Complete description of mandelbrot :
# https://benchmarksgame.alioth.debian.org/u64q/mandelbrot-description.html#mandelbrot
#
# Complete description of mandelbrot :
# https://benchmarksgame.alioth.debian.org/u64q/mandelbrot-description.html#mandelbrot
-module mandelbrot is no_warning("missing-doc")
+module mandelbrot is example, no_warning("missing-doc")
# limitations under the License.
# A very simple example of the actor model
# limitations under the License.
# A very simple example of the actor model
+module simple is example
#
# Complete description of the thread-ring :
# http://benchmarksgame.alioth.debian.org/u64q/threadring-description.html#threadring
#
# Complete description of the thread-ring :
# http://benchmarksgame.alioth.debian.org/u64q/threadring-description.html#threadring
+module thread_ring is example
#
# The shortest plan, in two steps, is to move *up* the tile under the hole (e),
# then to move *left* the tile after the hole (h).
#
# The shortest plan, in two steps, is to move *up* the tile under the hole (e),
# then to move *left* the tile after the hole (h).
+module puzzle is example
+
import ai::search
# The state (`S`) is a square grid, modeled as a one-dimensional array of Tile.
import ai::search
# The state (`S`) is a square grid, modeled as a one-dimensional array of Tile.
#
# This program takes an integer n as argument then display all solutions for the
# n-queens proglem (ie. on a n*n board).
#
# This program takes an integer n as argument then display all solutions for the
# n-queens proglem (ie. on a n*n board).
+module queens is example
# Test for app.nit's UI services
module ui_test is
# Test for app.nit's UI services
module ui_test is
app_name "app.nit UI test"
app_version(0, 1, git_revision)
app_namespace "org.nitlanguage.ui_test"
app_name "app.nit UI test"
app_version(0, 1, git_revision)
app_namespace "org.nitlanguage.ui_test"
# Example for the `app::http_request` main service `AsyncHttpRequest`
module http_request_example is
# Example for the `app::http_request` main service `AsyncHttpRequest`
module http_request_example is
app_name "app.nit HTTP"
app_namespace "org.nitlanguage.http_example"
android_api_target 15
app_name "app.nit HTTP"
app_namespace "org.nitlanguage.http_example"
android_api_target 15
# User interface example using `app::ui`
module ui_example is
# User interface example using `app::ui`
module ui_example is
app_name "app.nit UI"
app_namespace "org.nitlanguage.ui_example"
android_api_min 21
app_name "app.nit UI"
app_namespace "org.nitlanguage.ui_example"
android_api_min 21
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
# Test extern classes from the Cocoa framework and extern factories
# limitations under the License.
# Test extern classes from the Cocoa framework and extern factories
-module cocoa_extern_types
+module cocoa_extern_types is example
# limitations under the License.
# Simple message box using the Cocoa framework
# limitations under the License.
# Simple message box using the Cocoa framework
-module cocoa_message_box
+module cocoa_message_box is example
# limitations under the License.
# Hello world using the Cocoa framework
# limitations under the License.
# Hello world using the Cocoa framework
+module hello_cocoa is example
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module repeating_key_xor_solve is example
+
import base64
import crapto
import base64
import crapto
# limitations under the License.
# Example use of the Curl module
# limitations under the License.
# Example use of the Curl module
+module curl_http is example
# another product.
# Simple XML validity checker using the `dom` module
# another product.
# Simple XML validity checker using the `dom` module
+module checker is example
# limitations under the License.
# Example from http://www.graphviz.org/content/cluster
# limitations under the License.
# Example from http://www.graphviz.org/content/cluster
+module clusters is example
# limitations under the License.
# Example from http://www.graphviz.org/content/hello
# limitations under the License.
# Example from http://www.graphviz.org/content/hello
# limitations under the License.
# Example from http://www.graphviz.org/Gallery/undirected/fdpclust.html
# limitations under the License.
# Example from http://www.graphviz.org/Gallery/undirected/fdpclust.html
+module undirected_clusters is example
# Font support showcase
module fonts_showcase is
# Font support showcase
module fonts_showcase is
app_name "gamnit fonts"
app_namespace "org.gamnit.fonts_showcase"
app_version(1, 0, git_revision)
app_name "gamnit fonts"
app_namespace "org.gamnit.fonts_showcase"
app_version(1, 0, git_revision)
# Template for a 2D gamnit game
module template is
# Template for a 2D gamnit game
module template is
app_name "gamnit template"
app_namespace "org.gamnit.template"
app_version(0, 1, git_revision)
app_name "gamnit template"
app_namespace "org.gamnit.template"
app_version(0, 1, git_revision)
# * The book OpenGL ES 2.0 Programming Guide
# * https://code.google.com/p/opengles-book-samples/source/browse/trunk/LinuxX11/Chapter_2/Hello_Triangle/Hello_Triangle.c
module portable_triangle is
# * The book OpenGL ES 2.0 Programming Guide
# * https://code.google.com/p/opengles-book-samples/source/browse/trunk/LinuxX11/Chapter_2/Hello_Triangle/Hello_Triangle.c
module portable_triangle is
app_name "gamnit Triangle"
app_namespace "org.nitlanguage.triangle"
app_version(1, 1, git_revision)
app_name "gamnit Triangle"
app_namespace "org.nitlanguage.triangle"
app_version(1, 1, git_revision)
# References:
# * The book OpenGL ES 2.0 Programming Guide
# * https://code.google.com/p/opengles-book-samples/source/browse/trunk/LinuxX11/Chapter_2/Hello_Triangle/Hello_Triangle.c
# References:
# * The book OpenGL ES 2.0 Programming Guide
# * https://code.google.com/p/opengles-book-samples/source/browse/trunk/LinuxX11/Chapter_2/Hello_Triangle/Hello_Triangle.c
-module standalone_triangle
+module standalone_triangle is example
import app
import gamnit::display
import app
import gamnit::display
# limitations under the License.
# Sample module showing the use of the i18n annotation
# limitations under the License.
# Sample module showing the use of the i18n annotation
-module langannot is i18n
+module langannot is example, i18n
#
# From the book OpenGL ES 2.0 Programming Guide, see code reference:
# https://code.google.com/p/opengles-book-samples/source/browse/trunk/LinuxX11/Chapter_2/Hello_Triangle/Hello_Triangle.c
#
# From the book OpenGL ES 2.0 Programming Guide, see code reference:
# https://code.google.com/p/opengles-book-samples/source/browse/trunk/LinuxX11/Chapter_2/Hello_Triangle/Hello_Triangle.c
-module opengles2_hello_triangle
+module opengles2_hello_triangle is example
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module html_page is example
+
import html
class NitHomepage
import html
class NitHomepage
# Simple iOS app with a single label
module hello_ios is
# Simple iOS app with a single label
module hello_ios is
app_name "Hello iOS"
app_namespace "nit.app.hello_ios"
app_version(0, 5, git_revision)
app_name "Hello iOS"
app_namespace "nit.app.hello_ios"
app_version(0, 5, git_revision)
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module mpi_simple is example
# Hyper Text Coffee Pot Control Protocol
# A server that implements HTCPCP. At the moment there are no additions.
# Hyper Text Coffee Pot Control Protocol
# A server that implements HTCPCP. At the moment there are no additions.
+module htcpcp_server is example
# The main page, `index.html`, is served dynamicly with `MyAction`.
# The rest of the Web site fetches files from the local directory
# `www/hello_world/`.
# The main page, `index.html`, is served dynamicly with `MyAction`.
# The rest of the Web site fetches files from the local directory
# `www/hello_world/`.
-module nitcorn_hello_world
+module nitcorn_hello_world is example
# limitations under the License.
# Minimal example using a `ProxyAction`
# limitations under the License.
# Minimal example using a `ProxyAction`
+module nitcorn_reverse_proxy is example
# limitations under the License.
# Example for the `restful` annotation documented at `lib/nitcorn/restful.nit`
# limitations under the License.
# Example for the `restful` annotation documented at `lib/nitcorn/restful.nit`
+module restful_annot is example
import nitcorn::restful
import nitcorn::pthreads
import nitcorn::restful
import nitcorn::pthreads
#
# To be safe, it is recommended to run this program with its own username:
# `sudo file_server -u nitcorn:www`
#
# To be safe, it is recommended to run this program with its own username:
# `sudo file_server -u nitcorn:www`
-module simple_file_server
+module simple_file_server is example
import nitcorn
import privileges
import nitcorn
import privileges
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module test_restful_annot is example
+
import nitcorn::restful_annot
import pthreads
import nitcorn::restful_annot
import pthreads
#Â Creates a converter and initializes it
#Â Finally checks for dictionaries
#Â Creates a converter and initializes it
#Â Finally checks for dictionaries
class Converter
super PnaclApp
class Converter
super PnaclApp
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+# This is an example of how to use angular.js with popcorn
+module example_angular is example
+
import popcorn
import popcorn::pop_json
import popcorn
import popcorn::pop_json
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_post_handler is example
+
import popcorn
import template
import popcorn
import template
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_query_string is example
+
import popcorn
import template
import popcorn
import template
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_hello is example
+
import popcorn
class HelloHandler
import popcorn
class HelloHandler
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_advanced_logger is example
+
import popcorn
import realtime
import popcorn
import realtime
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_html_error_handler is example
+
import popcorn
import template
import popcorn
import template
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_simple_logger is example
+
import popcorn
class SimpleLoggerHandler
import popcorn
class SimpleLoggerHandler
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_mongodb is example
+
import popcorn
import mongodb
import template
import popcorn
import mongodb
import template
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_glob_route is example
+
import popcorn
class UserItem
import popcorn
class UserItem
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_param_route is example
+
import popcorn
class UserHome
import popcorn
class UserHome
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_router is example
+
import popcorn
class AppHome
import popcorn
class AppHome
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_session is example
+
import popcorn
redef class Session
import popcorn
redef class Session
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_static is example
+
import popcorn
var app = new App
import popcorn
var app = new App
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_static_default is example
+
import popcorn
var app = new App
import popcorn
var app = new App
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_static_multiple is example
+
import popcorn
var app = new App
import popcorn
var app = new App
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module example_templates is example
+
import popcorn
import popcorn::pop_templates
import popcorn
import popcorn::pop_templates
# limitations under the License.
# Example using the privileges module to drop privileges from root
# limitations under the License.
# Example using the privileges module to drop privileges from root
+module drop_privileges is example
#
# 20 threads share an array and a barrier. They each insert 1000 strings into
# the array and wait at a barrier before finishing.
#
# 20 threads share an array and a barrier. They each insert 1000 strings into
# the array and wait at a barrier before finishing.
-module concurrent_array_and_barrier
+module concurrent_array_and_barrier is example
import pthreads::concurrent_collections
import pthreads::concurrent_collections
# limitations under the License.
# Simple example of joinable task using threadpool
# limitations under the License.
# Simple example of joinable task using threadpool
+module jointask_example is example
# limitations under the License.
# test for threaded annotation
# limitations under the License.
# test for threaded annotation
+module threaded_example is example
# limitations under the License.
# Simple example using threadpool
# limitations under the License.
# Simple example using threadpool
-module threadpool_example
+module threadpool_example is example
# limitations under the License.
# An example to test and demonstrate the `sdl2` lib with `image` and `events`
# limitations under the License.
# An example to test and demonstrate the `sdl2` lib with `image` and `events`
+module minimal is example
#
# The advantage of the approach is that it is done programmatically so can be adapted to real complex use cases.
# Basically, this is half-way between the full automatic serialization and the full manual serialisation.
#
# The advantage of the approach is that it is done programmatically so can be adapted to real complex use cases.
# Basically, this is half-way between the full automatic serialization and the full manual serialisation.
-module custom_serialization
+module custom_serialization is example
import serialization
import json::serialization_write
import serialization
import json::serialization_write
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+module tmpl_composer is example
+
import template
### Here, definition of the specific templates
import template
### Here, definition of the specific templates
# limitations under the License.
# Sample module for a minimal chat server using Websockets on port 8088
# limitations under the License.
# Sample module for a minimal chat server using Websockets on port 8088
+module websocket_server is example
# ~~~raw
# get_mclasses ../../lib core::Array Array care::Arrow Fail
# ~~~
# ~~~raw
# get_mclasses ../../lib core::Array Array care::Arrow Fail
# ~~~
+module get_mclasses is example
import parser_util
import modelbuilder
import parser_util
import modelbuilder
# This is an example of a client of the frontend without command-line processing.
#
# It offers a simple nitcorn web server that offers a textarea and nitpick and nitlignt it.
# This is an example of a client of the frontend without command-line processing.
#
# It offers a simple nitcorn web server that offers a textarea and nitpick and nitlignt it.
-module nitlight_as_a_service
+module nitlight_as_a_service is example
import frontend
import highlight
import frontend
import highlight
# limitations under the License.
# Crawler on the nitweb web API
# limitations under the License.
# Crawler on the nitweb web API
+module nitwebcrawl is example
# Sample program that scan and load things.
#
# It shows the difference betwenn the various services of the `loader`.
# Sample program that scan and load things.
#
# It shows the difference betwenn the various services of the `loader`.
+module test_loader is example