This should fix/complete the synopses of my projects. The few cases left are where the doc is in the main module of a contrib without a readme, like with `header_keeper`. I'm not sure what to do with those yet, maybe simply removing the src folder.
I seizes this opportunity to improve the `extern_methods` example and create missing readme files. And also reorganized the mnit platform implementations. There is still similar work to do with apps and submodules names to clean in mnit, but it will be for a future PR.
Pull-Request: #1671
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
-Benitlux is an unofficial mailing list to keep faithful bargoers informed of the current beer offer at the excellent Brasserie Bénélux <http://brasseriebenelux.com/>.
+An unofficial mailing list and other tools to keep faithful bargoers informed of the beers available at the excellent Brasserie Bénélux.
This project is composed of two softwares:
--- /dev/null
+Crazy Moles, a very simple portable whack-a-mole style game with particle effects!
--- /dev/null
+Seach Github for repositories possibly using the JNI.
-# SVG to PNG and Nit
+# Tools to extract images from SVG files using Inkscape, either to create icons or game sprites
This tool uses Inkscape to prepare assets for Nit applications from a single SVG file.
It selects objects to extract from the SVG file when their id begins with `0`.
The minimal test in `tests/app/` shows the basic usage of this tool.
The Dino example `../../../../examples/mnit_dino` also uses this tool and is a more complete and practical example.
-
-# Authors
-
-Alexis Laferrière <alexis.laf@xymus.net>
-_jwrapper_, an extern class generator from Java class files
+Generator of Nit extern classes to wrap Java APIs.
# Description
_jwrapper_ automates wrapping Java classes so they can be accessed from Nit code. It generates Nit extern classes by analyzing Java class files.
-# Pep/8 Analysis
-
-This project provides tools to statically analyze Pep/8 programs in order to detect bugs or bad programming practices.
+# Pep/8 Analysis, static checker to detect bugs and bad programming practices in Pep/8 programs
For more information about the Pep/8 assembly language visit http://code.google.com/p/pep8-1/.
# See the License for the specific language governing permissions and
# limitations under the License.
-# This programs interprets the input of a physical interface thought the
-# GPIO pins of a Raspberry Pi to control an MPD server.
+# Backend to a hardware interface to control an MPD server from a Raspberry Pi
#
-# It suppot two inputs: a play/pause button and a rotary encoder to adjust
+# It supports two inputs: a play/pause button and a rotary encoder to adjust
# the volume.
#
# The each data output of the volume control are connected to the board
-This tool downloads files pointed by RSS feeds.
+A tool to download files listed in RSS feeds according to local folders.
It fetches the content of the RSS feed, then filters it according to custom patterns and to existing folders on disk. Selected elements will be downloaded to the given folder.
-# sort_downloads
+Script to sort content of a folder in many folders according to their names.
This scripts sorts files from a given directory to subfolders in the destination directory. It uses directory names as patterns to sort the files and thus moves each file to a directory with a similar name. Multiple directories may be used to specify the patterns to look for, but the files will only be copied to subfolders in the target directory. This features ensures a clean support for a multi-disk system.
-Tnitter is a Twitter-like micro-blogging platform
+Tnitter, a Twitter-like micro-blogging platform
# Compile and execute
--- /dev/null
+Portable calculator built using _app.nit_
+
+# Project structure
+
+* `calculator_logic` defines `CalculatorContext` with all the business logic of a calculator.
+ It takes as input operations and numbers, and outputs the text to display.
+* `calculator` implements the portable graphical interface using the _app.nit_ framework
+* `calculator_test` test `CalculatorContext` as a black box.
+
+# Usage
+
+1. Compile with a call to `make`.
+2. Run with either:
+ 1. The desktop version, `bin/calculator`.
+ 2. The Android version by install the APK at `bin/calculator.apk`.
# See the License for the specific language governing permissions and
# limitations under the License.
-# Draws an arithmetic operation to the terminal
+# Sample program which draws an arithmetic operation to the terminal
+#
+# Output (and input) example:
+# ~~~nitish
+# Left operand: 23
+# Right operand: 15
+# Operator (+, -, *, /, %): +
+# Char to display: #
+# Size of text: 5
+# Space between digits: 1
+# ##### #####
+# # #
+# ##### #####
+# # #
+# ##### #####
+#
+# # #####
+# + ## #
+# +++++ # #####
+# + # #
+# ##### #####
+#
+# __________________
+#
+# ##### #####
+# # # #
+# ##### #####
+# # # #
+# ##### #####
+# ~~~
module draw_operation
`{
# See the License for the specific language governing permissions and
# limitations under the License.
-# This module illustrates some uses of the FFI, specifically
-# how to use extern methods. Which means to implement a Nit method in C.
+# Sample program using extern methods implemented in C and other FFI services
module extern_methods
redef enum Int
- # Returns self'th fibonnaci number
- # implemented here in C for optimization purposes
+ # Get the `self`th Fibonacci number
+ #
+ # The FFI can be used to optimize performance critical methods.
+ # Although this implementation is recursive, so there is not much gain.
+ # Notice the `import fib` telling the compiler that there is a callback to `foo` from the C code.
+ # From C, `foo` is called through the function `Int_fib` with the receiver as argument.
fun fib: Int import fib `{
if (self < 2)
return self;
return Int_fib(self-1) + Int_fib(self-2);
`}
- # System call to sleep for "self" seconds
+ # System call to sleep for `self` seconds
+ #
+ # You can use the FFI to access any system functions, sometimes it's extremely simple.
fun sleep `{
sleep(self);
`}
- # Return atan2l(self, x) from libmath
- fun atan_with(x: Int): Float `{
- return atan2(self, x);
- `}
-
- # This method callback to Nit methods from C code
- # It will use from C code:
- # * the local fib method
- # * the + operator, a method of Int
- # * to_s, a method of all objects
- # * String.to_cstring, a method of String to return an equivalent char*
+ # Print the result of adding `self` to `self.fib` with callbacks from C
+ #
+ # This method illustrates many forms of callbacks from C,
+ # but it would have been better implemented in Nit (as done by `bar`).
+ #
+ # It is recommended to avoid callbacks when possible, use each language according to their strengths.
+ # Nit is better than C to call methods and manipulate objects.
+ # C has easy access to system functions, native libraries and it does low-level stuff.
+ #
+ # The implementation calls:
+ # * the local `fib` method,
+ # * the `+` operator, a method of `Int`,
+ # * `to_s`, a method of all objects,
+ # * `String.to_cstring`, a method of `String` to get as a `char*`.
fun foo import fib, +, to_s, String.to_cstring `{
long self_fib = Int_fib(self);
long self_plus_fib = Int__plus(self, self_fib);
printf("from C: self + fib(self) = %s\n", c_string);
`}
- # Equivalent to foo but written in pure Nit
+ # Equivalent to `foo` but written in pure Nit
fun bar do print "from Nit: self + fib(self) = {self+self.fib}"
end
+redef class Float
+ # Arctangent of `self` and `other` using `atan2` from `math.h`
+ #
+ # Universal types (Int, Float, Bool, etc.) are converted to their closest equivalent in C
+ # (long, double, int, etc.).
+ fun atan_with(other: Float): Float `{
+ return atan2(self, other);
+ `}
+end
+
print 12.fib
print "sleeping 1 second..."
1.sleep
-print 100.atan_with(200)
+print 100.0.atan_with(200.0)
8.foo
8.bar
-
--- /dev/null
+Dino vs cavemen portable action game where the player plays the dino
+
+# Project Structure
+
+* `game_logic` defines, as its name implies, the full game logic and the basic entities.
+* `graphism` defines how the game is drawn on screen with fully portable code.
+* `dino` implements the the portable app structure.
+* `dino_android` and `dino_linux` adapt the portable game for specific platforms.
+* `fancy_dino` is an optional module which tweaks how the dino itself is drawn on screen
+ to create the flat rotation effect.
+* `splash` defines the splash screen used while the app loads.
# See the License for the specific language governing permissions and
# limitations under the License.
-# Services related to pathfinding of graphs using A*
-# A single graph may have different properties according to the `PathContext` used
+# A* pathfinding in graphs
#
+# A single graph may have different properties according to the `PathContext` used
#
# Usage:
#
# With a large graph it can cause a stack overflow.
#
# Instead, we serialize the nodes first and then the links.
- redef fun core_serialize_to(serializer: Serializer)
+ redef fun core_serialize_to(serializer)
do
serializer.serialize_attribute("graph", graph)
end
# Used to check if nodes have been searched in one pathfinding
private var pathfinding_current_evocation: Int = 0
- redef fun core_serialize_to(serializer: Serializer)
+ redef fun core_serialize_to(serializer)
do
serializer.serialize_attribute("nodes", nodes)
serializer.serialize_attribute("links", links)
self.worst_cost = worst_cost
end
- redef var worst_cost: Int is noinit
+ redef var worst_cost is noinit
redef fun cost(l) do
return l.weight
-The `android` module provides support for the Android platform
+Android platform support and APIs
# Compilation for Android
-_app.nit_ is a framework to create cross-platform applications
+_app.nit_, a framework for portable applications
The framework provides services to manage common needs of modern mobile applications:
# See the License for the specific language governing permissions and
# limitations under the License.
-# Services to control the bcm2835 chipset as used in the Raspberry Pi
-# model B revision 1 Uses the C library by Mike McCauley from
-# http://www.airspayce.com/mikem/bcm2835/
+# Services to control the bcm2835 chipset used in the Raspberry Pi
+#
+# Uses the C library by Mike McCauley available at http://www.airspayce.com/mikem/bcm2835/
+#
+# This module targets the model B revision 1, it could be tweaked for other versions.
module bcm2835
-import gpio
-
in "C Header" `{
#include <bcm2835.h>
`}
protected fun bcm2835_debug=(v: Bool) `{ bcm2835_set_debug(v); `}
end
+# A physical binary pin
+interface Pin
+ # Set the output of this pin
+ fun write(high: Bool) is abstract
+end
+
extern class RPiPin `{ RPiGPIOPin `}
super Pin
# See the License for the specific language governing permissions and
# limitations under the License.
-# Add reading and writing binary services
+# Read and write binary data with any `Reader` and `Writer`
#
# ~~~
# var w = new FileWriter.open("/tmp/data.bin")
# See the License for the specific language governing permissions and
# limitations under the License.
-# Provides basic game logic utilities using buckets to coordinate and
-# optimize actions on game turn ends. Supports both action at each
-# end of turn as well as actions on some end of turns.
+# Game framework with an emphasis on efficient event coordination
#
-# Allows for fast support of a large number of entities with rare actions,
-# such as a forest with many individual trees.
+# Provides basic game logic entities to manage a game where the logic is executed by turns:
+# `Game`, `GameTurn`, `GameEvent`, `Turnable`.
+# Also offers a bucket system to plan future events at a known number of turns in the future:
+# `Bucketable` and the services `act_next` and `act_in`.
+#
+# Efficiently support large number of entities with rare or sparse actions,
+# such as a forest with many individual trees growing slowly.
module bucketed_game is serialize
import serialization
# See the License for the specific language governing permissions and
# limitations under the License.
-# Utilities and performant structure for the FFI with C
+# Structures and services for compatibility with the C language
module c
+
import core
intrude import core::collection::array
# See the License for the specific language governing permissions and
# limitations under the License.
-# The Cocoa API is the development layer of OS X
+# Cocoa API, the development layer of OS X
#
# This module is only compatible with OS X.
#
# See the License for the specific language governing permissions and
# limitations under the License.
-# Offers features to interface with C++ code and libraries
+# Services for compatibility with C++ code and libraries
module cpp is
new_annotation cppflags
end
# See the License for the specific language governing permissions and
# limitations under the License.
-# Curl services: `CurlHTTPRequest` and `CurlMail`
+# Data transfer with URL syntax
+#
+# Download or upload over HTTP with `CurlHTTPRequest` and send emails with `CurlMail`.
module curl
import native_curl
# See the License for the specific language governing permissions and
# limitations under the License.
-# EGL is an interface between the rendering APIs OpenGL, OpenGL ES, etc.
-# and the native windowing system.
+# Interface between rendering APIs (OpenGL, OpenGL ES, etc.) and the native windowing system.
#
# Most services of this module are a direct wrapper of the underlying
# C library. If a method or class is not documented in Nit, refer to
+++ /dev/null
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Copyright 2013 Alexis Laferrière <alexis.laf@xymus.net>
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# 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.
-
-# GPIO related functionnalities
-module gpio
-
-# A physical binary pin
-interface Pin
- # Set the output of this pin
- fun write(high: Bool) is abstract
-end
# See the License for the specific language governing permissions and
# limitations under the License.
-# Provides GTK+ widgets and functionalities
+# GTK+ widgets and services
#
-# By default it provides services from GTK+ v3.4. You can get newer
-# features by importing submodules v3_6 or v3_8 with `import gtk::v3_6`.
+# By default provides services from GTK+ v3.4.
+# Newer features from v3.6 and v3.8 are available in the submodules v3_6 and v3_8 respectively.
module gtk
import v3_4
# See the License for the specific language governing permissions and
# limitations under the License.
-# iOS services for Nit app on iOS
+# iOS platform support
module ios
import platform
# See the License for the specific language governing permissions and
# limitations under the License.
-# Provides two APIs to manipulate JSON strings.
+# Libraries to manipulate JSON strings.
#
# Both `dynamic` and `static` modules provide at least a method to parse a
# value written in JSON, but only `static` provide a method to translate a
# See the License for the specific language governing permissions and
# limitations under the License.
-# Manipulates the Java Virtual Machine
+# Java Virtual Machine services
#
# See: http://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/jniTOC.html
module jvm is
# See the License for the specific language governing permissions and
# limitations under the License.
-# Implements the md5 function in C
+# Native MD5 digest implementation as `Text::md5`
module md5
in "C Header" `{
}
`}
-redef class String
+redef class Text
# MD5 digest of `self`
#
# ~~~
# See the License for the specific language governing permissions and
# limitations under the License.
-# Client for a MPD server
+# Music Player Daemon client library
module mpd
import socket
# See the License for the specific language governing permissions and
# limitations under the License.
-# Provides the noise generators `PerlinNoise` and `InterpolatedNoise`
+# Noise generators `PerlinNoise` and `InterpolatedNoise`
module noise is serialize
import serialization
# You are allowed to redistribute it and sell it, alone or is a part of
# another product.
-# Provides the Clock utility class to keep time of real time flow
+# Services to keep time of the wall clock time
module realtime is ldflags "-lrt"
in "C header" `{
# See the License for the specific language governing permissions and
# limitations under the License.
-# SDL display support (used in Linux for windows and inputes only)
+# Simple DirectMedia Layer
module sdl is
cflags exec("sdl-config", "--cflags")
ldflags(exec("sdl-config", "--libs"), "-lSDL_image -lSDL_ttf")
SDL_FillRect(self, NULL, SDL_MapRGB(self->format,r,g,b));
`}
- redef fun width: Int `{ return self->w; `}
- redef fun height: Int `{ return self->h; `}
+ redef fun width `{ return self->w; `}
+ redef fun height `{ return self->h; `}
# Fill a rectangle with given color
fun fill_rect(rect: SDLRectangle, r, g, b: Int) `{
SDL_FillRect(self, rect, SDL_MapRGB(self->format,r,g,b));
`}
- redef fun clear(r, g, b: Float) `{
+ redef fun clear(r, g, b) `{
Uint8 ri, gi, bi;
ri = (Uint8)r*255;
gi = (Uint8)g*255;
# Destroy the image and free the memory
redef fun destroy `{ SDL_FreeSurface(self); `}
- redef fun width: Int `{ return self->w; `}
- redef fun height: Int `{ return self->h; `}
+ redef fun width `{ return self->w; `}
+ redef fun height `{ return self->h; `}
fun is_ok: Bool do return not address_is_null
var button: Int
- redef var pressed: Bool
- redef fun depressed: Bool do return not pressed
+ redef var pressed
+ redef fun depressed do return not pressed
# Is this event raised by the left button?
fun is_left_button: Bool do return button == 1
var rel_x: Float
var rel_y: Float
- redef var pressed: Bool
- redef fun depressed: Bool do return not pressed
+ redef var pressed
+ redef fun depressed do return not pressed
init (x, y, rel_x, rel_y: Float, pressed: Bool)
do
self.down = down
end
- redef fun to_c: nullable Char
+ redef fun to_c
do
if name.length == 1 then return name.chars.first
return null
# See the License for the specific language governing permissions and
# limitations under the License.
-# Module to manage standard C signals
+# ANSI C signal handling
#
# Common usage imply 5 steps:
#
# See the License for the specific language governing permissions and
# limitations under the License.
-# Serices from the X11 library
+# Services from the X11 library
module x11 is pkgconfig
`{
# Open a specific display
#
# `name` is in the format: "hostname:number.screen_number"
-#
+#
# See <http://www.x.org/releases/X11R7.7/doc/man/man3/XOpenDisplay.3.xhtml>
fun x_open_display(name: String): Pointer import String.to_cstring `{
return (void*)XOpenDisplay(String_to_cstring(name));
-Runtime error: Assert failed (../lib/c.nit:45)
+Runtime error: Assert failed (../lib/c.nit:46)
-Runtime error: Assert failed (../lib/c.nit:37)
+Runtime error: Assert failed (../lib/c.nit:38)
0
-Runtime error: Assert failed (../lib/c.nit:37)
+Runtime error: Assert failed (../lib/c.nit:38)
0
-Runtime error: Assert failed (../lib/c.nit:36)
+Runtime error: Assert failed (../lib/c.nit:37)
0
0
1