As a small optimization, accesses to private attributes in Text are replaced by direct accesses as in `file` or `collection`.
On the compiler this yields between 3 and 4% improvement in performances, however in some programs like nitmd, this yields around 15% optimization.
Pull-Request: #1683
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Christophe Gigax <christophe.gigax@viacesi.fr>
Julien Pagès <julien.projet@gmail.com>
+
+Mehdi Ait Younes <overpex@gmail.com>
+
+Hervé Matysiak <herve.matysiak@viacesi.fr>
-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
+[project]
+name=benitlux
+tags=network
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/benitlux/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/benitlux/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# Generate email and fill the attributes `email_content` and `email_title`
fun generate_email(beer_events: BeerEvents)
do
- email_title = beer_events.to_email_title
+ email_title = "Benitlux {street.capitalized}{beer_events.to_email_title}"
email_content = beer_events.to_email_content
end
var mail = new Mail("Benitlux <benitlux@xymus.net>", email_title, content)
mail.to.add email
mail.header["Content-Type"] = "text/html; charset=\"UTF-8\""
+ mail.header["List-Unsubscribe"] = unsub_link
+ mail.header["Precedence"] = "bulk"
mail.encrypt_with_base64
mail.send
# Get a pretty and short version of `self`
fun to_email_title: String
do
- var title = "Benelux Beer Menu"
-
# New beers
var new_beers_name = new Array[String]
for beer in self.new_beers do new_beers_name.add beer.name
if not new_beers_name.is_empty then
- title += " (+ {new_beers_name.join(", ")})"
+ return " (+ {new_beers_name.join(", ")})"
end
- return title
+ return ""
end
end
--- /dev/null
+[project]
+name=brainfuck
+tags=language
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/brainfuck/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/brainfuck/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+Crazy Moles, a very simple portable whack-a-mole style game with particle effects!
--- /dev/null
+[project]
+name=crazy_moles
+tags=game
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/crazy_moles/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/crazy_moles/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
module moles_android
-import mnit_android
+import mnit::android
import android::portrait
import moles
module moles_linux
-import mnit_linux
+import mnit::linux
import moles
import effects
--- /dev/null
+[project]
+name=friendz
+tags=game
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/friendz/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/friendz/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
module friendz_android
import friendz
-import mnit_android
+import mnit::android
import android::landscape
redef class App
module friendz_linux
import friendz
-import mnit_linux
+import mnit::linux
redef class Display
redef fun wanted_width do return app.screen_width
--- /dev/null
+[project]
+name=github_merge
+tags=cli
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/github_merge.nit
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/github_merge.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
var res = new Array[String]
for l in logins do
var u = get_and_check("https://api.github.com/users/{l}").json_as_map
- if not u.has_key("name") then
- print "No public name for user {l}"
+ if not u.has_key("name") or u["name"] == null or not u.has_key("email")or u["email"] == null then
+ print "No public name/email for user {l}"
continue
end
var r = "{u["name"].to_s} <{u["email"].to_s}>"
--- /dev/null
+Seach Github for repositories possibly using the JNI.
--- /dev/null
+[project]
+name=github_search_for_jni
+tags=cli
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/github_search_for_jni/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/github_search_for_jni/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=header_keeper
+tags=devel,cli
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/header_keeper/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/header_keeper/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
-# 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>
--- /dev/null
+[project]
+name=inkscape_tools
+tags=devel,cli
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/inkscape_tools/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/inkscape_tools/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# limitations under the License.
import s2pn
-import mnit_android
+import mnit::android
# limitations under the License.
import s2pn
-import mnit_linux
+import mnit::linux
-_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.
--- /dev/null
+[project]
+name=jwrapper
+tags=java,devel,cli
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/jwrapper/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/jwrapper/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=mnit_test
+tags=
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/mnit_simple/
+git=https://github.com/nitlang/nit.git
+git.directory=examples/mnit_simple/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
android_manifest """<uses-permission android:name="android.permission.VIBRATE" />"""
end
-import mnit_android
+import mnit::android
import android::portrait
import serialization
module simple_linux
import simple
-import mnit_linux
+import mnit::linux
import test_data_store
--- /dev/null
+[project]
+name=neo_doxygen
+tags=devel,cli
+maintainer=Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/neo_doxygen/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/neo_doxygen/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=nitcc
+tags=devel,cli
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/nitcc/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/nitcc/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=nitester
+tags=devel,cli
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/nitester/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/nitester/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=nitiwiki
+tags=web,cli
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/nitiwiki/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/nitiwiki/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=nitrpg
+tags=devel,web,cli
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/nitrpg/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/nitrpg/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=objcwrapper
+tags=devel,cli
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/objcwrapper/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/objcwrapper/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=online_ide
+tags=devel,web
+maintainer=Johan Kayser <johan.kayser@viacesi.fr>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/online_ide/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/online_ide/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=opportunity
+tags=web
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/opportunity/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/opportunity/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
-# 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/.
--- /dev/null
+[project]
+name=pep8analysis
+tags=educ,web,cli
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/pep8analysis/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/pep8analysis/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=physical_interface_for_mpd_on_rpi
+tags=embedded,cli
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/physical_interface_for_mpd_on_rpi/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/physical_interface_for_mpd_on_rpi/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=refund
+tags=example,cli
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/refund/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/refund/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
-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.
--- /dev/null
+[project]
+name=rss_downloader
+tags=network,cli
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/rss_downloader/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/rss_downloader/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=simplan
+tags=ai,example,cli
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/simplan/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/simplan/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
-# 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.
--- /dev/null
+[project]
+name=sort_downloads
+tags=cli
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/sort_downloads/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/sort_downloads/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=tinks
+tags=game
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/tinks/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/tinks/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
android_api_target 10
end
-import mnit_android
+import mnit::android
import android::audio
import android::vibration
import android::landscape
# GNU/Linux client with config saved to `config.json`
module linux_client
-import mnit_linux
+import mnit::linux
import linux::audio
import json::serialization
-Tnitter is a Twitter-like micro-blogging platform
+Tnitter, a Twitter-like micro-blogging platform
# Compile and execute
--- /dev/null
+[project]
+name=tnitter
+tags=web
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/tnitter/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/tnitter/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=wiringPi
+tags=embedded,wrapper
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/contrib/wiringPi/
+git=https://github.com/nitlang/nit.git
+git.directory=contrib/wiringPi/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /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`.
--- /dev/null
+[project]
+name=calculator
+tags=example
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/calculator/
+git=https://github.com/nitlang/nit.git
+git.directory=examples/calculator/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=circular_list
+tags=algo,example
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/circular_list.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/circular_list.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=clock
+tags=example
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/clock.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/clock.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=clock_more
+tags=example
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/clock_more.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/clock_more.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=draw_operation
+tags=
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/draw_operation.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/draw_operation.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
`{
--- /dev/null
+[project]
+name=extern_methods
+tags=wrapper,example
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/extern_methods.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/extern_methods.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
+[project]
+name=fibonacci
+tags=example
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/fibonacci.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/fibonacci.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=hello_world
+tags=example
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/hello_world.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/hello_world.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=int_stack
+tags=example
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/int_stack.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/int_stack.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=leapfrog
+tags=game,terminal
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/leapfrog/
+git=https://github.com/nitlang/nit.git
+git.directory=examples/leapfrog/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=mnit_ballz
+tags=game
+maintainer=Romain Chanoir <romain.chanoir@viacesi.fr>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/mnit_ballz/
+git=https://github.com/nitlang/nit.git
+git.directory=examples/mnit_ballz/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
module game_logic
-import mnit_android
+import mnit::android
import android::sensors
class Ball
--- /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.
--- /dev/null
+[project]
+name=mnit_dino
+tags=game
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/mnit_dino/
+git=https://github.com/nitlang/nit.git
+git.directory=examples/mnit_dino/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
import dino
-import mnit_android
+import mnit::android
import android::portrait
import android::vibration
import dino
-import mnit_linux
+import mnit::linux
redef class ImageSet
redef fun start_over_path do return "images/play_again.png"
--- /dev/null
+[project]
+name=montecarlo
+tags=example
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/montecarlo.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/montecarlo.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=print_arguments
+tags=example
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/print_arguments.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/print_arguments.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=procedural_array
+tags=example
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/procedural_array.nit
+git=https://github.com/nitlang/nit.git
+git.directory=examples/procedural_array.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=rosettacode
+tags=example
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/rosettacode/
+git=https://github.com/nitlang/nit.git
+git.directory=examples/rosettacode/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=shoot
+tags=game
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/examples/shoot/
+git=https://github.com/nitlang/nit.git
+git.directory=examples/shoot/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
module shoot_android
import shoot
-import mnit_android
+import mnit::android
super
module shoot_linux
import shoot
-import mnit_linux
+import mnit::linux
super
--- /dev/null
+[project]
+name=a_star
+tags=algo,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/a_star.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/a_star.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=ai
+tags=ai,algo,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/ai/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/ai/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
-The `android` module provides support for the Android platform
+Android platform support and APIs
# Compilation for Android
# Pointer and hardware key events
module input_events
-import mnit_input
+import mnit::input
import android
in "C header" `{
--- /dev/null
+[project]
+name=android
+tags=platform,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/android/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/android/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
-_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:
--- /dev/null
+[project]
+name=app
+tags=lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/app/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/app/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=array_debug
+tags=debug,lib
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/array_debug.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/array_debug.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=base64
+tags=encoding,lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/base64.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/base64.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=bcm2835
+tags=embedded,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/bcm2835/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/bcm2835/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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")
--- /dev/null
+[project]
+name=binary
+tags=io,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/binary/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/binary/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=bitmap
+tags=lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/bitmap/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/bitmap/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=bucketed_game
+tags=game,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/bucketed_game.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/bucketed_game.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=buffered_ropes
+tags=algo,text,lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/buffered_ropes.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/buffered_ropes.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=c
+tags=language,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/c.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/c.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=cartesian
+tags=algo,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/cartesian.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/cartesian.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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.
#
--- /dev/null
+[project]
+name=cocoa
+tags=wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/cocoa/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/cocoa/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=combinations
+tags=algo,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/combinations.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/combinations.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=console
+tags=terminal,lib
+maintainer=Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/console.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/console.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=core
+tags=lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/core
+git=https://github.com/nitlang/nit.git
+git.directory=lib/core
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# Ignore case when matching letters
var ignore_case = false is writable
- # Optimize `self` for `is_in` and `String::has`, but do not support searches
+ # Optimize `self` for `String::has` and `is_in`, but do not support searches
#
# If `true`, `self` cannont be used with `String::search_all`, `String::replace`
# or `String::split`.
- var optimize_is_in = false is writable
+ var optimize_has = false is writable
# Treat a newline in string as dividing string into multiple lines
#
var cflags = 0
if extended then cflags |= flag_extended
if ignore_case then cflags |= flag_icase
- if optimize_is_in then cflags |= flag_nosub
+ if optimize_has then cflags |= flag_nosub
if newline then cflags |= flag_newline
var native = self.native
private fun get_error(errcode: Int): String
do
+ var native = native
+ assert native != null
+
# Error, should be out of memory but we cover any possible error anyway
var error_cstr = native.regerror(errcode)
var comp_res = compile
assert comp_res == null else "Regex compilation failed with: {comp_res.message}\n".output
+ var native = native
+ assert native != null
+
# Actually execute
var eflags = gather_eflags
var res = native.regexec_match_only(text.to_cstring, eflags)
abort
end
- # require: not optimize_is_in
+ # require: not optimize_has
#
# assert "l".to_re.search_index_in("hello world", 0) == 2
# assert "el+o".to_re.search_index_in("hello world", 0) == 1
# assert "z".to_re.search_index_in("hello world", 0) == -1
redef fun search_index_in(text, from)
do
- assert not optimize_is_in
+ assert not optimize_has
var comp_res = compile
assert comp_res == null else "Regex compilation failed with: {comp_res.message}\n".output
+ var native = native
+ assert native != null
+
# Actually execute
text = text.to_s
var cstr = text.substring_from(from).to_cstring
abort
end
- # require: not optimize_is_in
+ # require: not optimize_has
#
# assert "l".to_re.search_in("hello world", 0).from == 2
# assert "el+o".to_re.search_in("hello world", 0).from == 1
# assert "l+".to_re.search_in("hello world", 3).from == 3
# assert "z".to_re.search_in("hello world", 0) == null
+ # assert "cd(e)".to_re.search_in("abcdef", 2)[1].to_s == "e"
redef fun search_in(text, from)
do
- assert not optimize_is_in
+ assert not optimize_has
var comp_res = compile
assert comp_res == null else "Regex compilation failed with: {comp_res.message}\n".output
+ var native = native
+ assert native != null
+
# Actually execute
text = text.to_s
var sub = text.substring_from(from)
# Found one?
if res == 0 then
- var bso = bstr.byte_to_char_index(native_match.rm_so)
- var ln = bstr.byte_to_char_index(native_match.rm_eo - native_match.rm_so - 1)
+ var first_char = bstr.byte_to_char_index(native_match.rm_so)
+ var length_char = bstr.byte_to_char_index(native_match.rm_eo - native_match.rm_so - 1) # FIXME For issue #1684
var match = new Match(text,
- from + bso,
- ln + 1)
+ from + first_char,
+ length_char + 1)
# Add sub expressions
for i in [1 .. nsub] do
- bso = bstr.byte_to_char_index(native_match[i].rm_so)
- ln = bstr.byte_to_char_index(native_match[i].rm_eo - native_match[i].rm_so - 1)
+ first_char = bstr.byte_to_char_index(native_match[i].rm_so)
+ length_char = bstr.byte_to_char_index(native_match[i].rm_eo - native_match[i].rm_so - 1) # FIXME For issue #1684
match.subs.add new Match( text,
- bso ,
- ln + 1)
+ from + first_char,
+ length_char + 1)
end
return match
abort
end
- # require: not optimize_is_in
+ # require: not optimize_has
#
# assert "ab".to_re.search_all_in("abbab").join(", ") == "ab, ab"
# assert "b+".to_re.search_all_in("abbabaabbbbbcab").join(", ") == "bb, b, bbbbb, b"
redef fun search_all_in(text)
do
- assert not optimize_is_in
+ assert not optimize_has
var comp_res = compile
assert comp_res == null else "Regex compilation failed with: {comp_res.message}\n".output
+ var native = native
+ assert native != null
+
# Actually execute
text = text.to_s
var cstr = text.to_cstring
--- /dev/null
+[project]
+name=counter
+tags=algo,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/counter.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/counter.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=cpp
+tags=language,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/cpp.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/cpp.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=crypto
+tags=crypto,algo,lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/crypto.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/crypto.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=csv
+tags=format,lib
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/csv/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/csv/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=curl
+tags=network,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/curl/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/curl/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=curses
+tags=ui,terminal,wrapper,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/curses/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/curses/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=date
+tags=lib
+maintainer=Mehdi Ait Younes <overpex@gmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/date.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/date.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=deriving
+tags=lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/deriving.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/deriving.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=dom
+tags=xml,lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/dom/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/dom/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=dummy_array
+tags=algo,lib
+maintainer=Floréal Morandat <morandat@lirmm.fr>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/dummy_array.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/dummy_array.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=egl
+tags=graphics,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/egl.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/egl.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
+[project]
+name=emscripten
+tags=platform,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/emscripten
+git=https://github.com/nitlang/nit.git
+git.directory=lib/emscripten
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=filter_stream
+tags=io,lib
+maintainer=Floréal Morandat <morandat@lirmm.fr>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/filter_stream.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/filter_stream.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=for_abuse
+tags=algo,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/for_abuse.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/for_abuse.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=gamnit
+tags=game,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/gamnit/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/gamnit/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=geometry
+tags=algo,lib
+maintainer=Romain Chanoir <romain.chanoir@viacesi.fr>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/geometry/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/geometry/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=gettext
+tags=i18n,lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/gettext
+git=https://github.com/nitlang/nit.git
+git.directory=lib/gettext
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=github
+tags=web,lib
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/github/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/github/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=glesv2
+tags=graphics,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/glesv2/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/glesv2/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
+++ /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
--- /dev/null
+[project]
+name=graphs
+tags=algo,lib
+maintainer=Alexandre Blondin Massé <alexandre.blondin.masse@gmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/graphs/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/graphs/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=gtk
+tags=ui,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/gtk/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/gtk/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=hash_debug
+tags=debug,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/hash_debug.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/hash_debug.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=html
+tags=format,lib
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/html/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/html/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=ini
+tags=format,lib
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/ini.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/ini.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=ios
+tags=wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/ios/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/ios/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=java
+tags=java,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/java/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/java/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=json
+tags=format,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/json/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/json/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=jvm
+tags=java,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/jvm.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/jvm.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=libevent
+tags=wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/libevent.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/libevent.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
module audio
import app::audio
-import mnit_linux::linux_assets
+import mnit::linux::linux_assets
# Simple audio asset
redef class Sound
--- /dev/null
+[project]
+name=linux
+tags=lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/linux/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/linux/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=markdown
+tags=format,lib
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/markdown/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/markdown/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=md5
+tags=encoding,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/md5.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/md5.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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`
#
# ~~~
--- /dev/null
+[project]
+name=meta
+tags=lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/meta.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/meta.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# limitations under the License.
# Android support for MNit
-module mnit_android
+module android
import android_app
import android_opengles1
"""
import mnit
-import android
import mnit::opengles1
+import ::android
intrude import ::android::input_events
in "C" `{
module android_opengles1 is ldflags "-lEGL -lGLESv1_CM"
import android_app
-import android
in "C" `{
#include <android_native_app_glue.h>
module assets
import mnit_app
-import mnit_display
+import mnit::display
# General asset
interface Asset
# limitations under the License.
# Defines abstract display classes
-module mnit_display
+module display
-import mnit_input
+import mnit::input
# Any class with a size
interface Sized
# Defines abstract classes for user and general inputs to the application.
# Implemented independantly for each platforms and technologies.
-module mnit_input
+module input
# Input to the App, propagated through `App::input`.
interface InputEvent
# limitations under the License.
# Linux support for MNit
-module mnit_linux
+module linux
import linux_app
import linux_opengles1
import mnit
import sdl
import linux_opengles1
-import linux
+import ::linux
in "C" `{
#include <EGL/egl.h>
# See the License for the specific language governing permissions and
# limitations under the License.
-# General module for cross-compatibility between multiple platforms
+# Multiplatform game framework for Nit
module mnit
import mnit_app
module mnit_app
import ::app
-import mnit_display
+import mnit::display
# An App instance serves as base to every Mnit projects.
#
# OpenGL ES1 general support (most of it)
module opengles1 is pkgconfig("glesv1_cm", "egl")
-import mnit_display
+import mnit::display
in "C header" `{
#include <EGL/egl.h>
--- /dev/null
+[project]
+name=mnit
+tags=lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/mnit/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/mnit/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# Manage images that are tileset or glyphset (for bitmap fonts)
module tileset
-import mnit_display
+import mnit::display
# Efficiently retrieve tiles in a big image
class TileSet
--- /dev/null
+[project]
+name=mongodb
+tags=database,lib
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/mongodb/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/mongodb/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=more_collections
+tags=algo,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/more_collections.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/more_collections.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=mpd
+tags=sound,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/mpd.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/mpd.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=mpi
+tags=parallelism,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/mpi
+git=https://github.com/nitlang/nit.git
+git.directory=lib/mpi
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=neo4j
+tags=database,lib
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/neo4j/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/neo4j/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=nitcc_runtime
+tags=lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/nitcc_runtime.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/nitcc_runtime.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=nitcorn
+tags=network,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/nitcorn/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/nitcorn/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=niti_runtime
+tags=lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/niti_runtime.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/niti_runtime.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=noise
+tags=algo,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/noise.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/noise.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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
--- /dev/null
+[project]
+name=opts
+tags=cli,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/opts.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/opts.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=ordered_tree
+tags=algo,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/ordered_tree.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/ordered_tree.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=parser_base
+tags=format,lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/parser_base.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/parser_base.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=perfect_hashing
+tags=algo,lib
+maintainer=Julien Pagès <julien.projet@gmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/perfect_hashing.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/perfect_hashing.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=performance_analysis
+tags=debug,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/performance_analysis.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/performance_analysis.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=pipeline
+tags=algo,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/pipeline.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/pipeline.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=pnacl
+tags=platform,lib
+maintainer=Johan Kayser <johan.kayser@viacesi.fr>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/pnacl
+git=https://github.com/nitlang/nit.git
+git.directory=lib/pnacl
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=poset
+tags=algo,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/poset.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/poset.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=posix_ext
+tags=wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/posix_ext.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/posix_ext.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=privileges
+tags=lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/privileges/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/privileges/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=progression
+tags=lib
+maintainer=Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/progression.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/progression.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=pthreads
+tags=parallelism,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/pthreads/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/pthreads/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=realtime
+tags=lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/realtime.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/realtime.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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" `{
--- /dev/null
+[project]
+name=ropes_debug
+tags=debug,lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/ropes_debug.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/ropes_debug.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=sax
+tags=xml,format,lib
+maintainer=Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/sax/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/sax/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=saxophonit
+tags=xml,format,lib
+maintainer=Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/saxophonit/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/saxophonit/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
init do
- qname_re.optimize_is_in = true
+ qname_re.optimize_has = true
features[feature_namespaces_uri] = true
features[feature_namespace_prefixes_uri] = false
end
--- /dev/null
+[project]
+name=scene2d
+tags=game,lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/scene2d.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/scene2d.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=sdl
+tags=graphics,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/sdl.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/sdl.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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")
end
-import mnit_display
+import mnit::display
import c
in "C header" `{
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
--- /dev/null
+[project]
+name=sdl2
+tags=graphics,wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/sdl2/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/sdl2/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=sendmail
+tags=network,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/sendmail.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/sendmail.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=serialization
+tags=lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/serialization/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/serialization/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=sexp
+tags=format,lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/sexp.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/sexp.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=sha1
+tags=encoding,lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/sha1.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/sha1.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=signals
+tags=wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/signals.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/signals.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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:
#
--- /dev/null
+[project]
+name=socket
+tags=network,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/socket/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/socket/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=sqlite3
+tags=database,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/sqlite3/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/sqlite3/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=standard
+tags=lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/standard.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/standard.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=symbol
+tags=lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/symbol.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/symbol.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=template
+tags=lib
+maintainer=Jean Privat <jean@pryen.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/template/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/template/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=test_suite
+tags=devel,lib
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/test_suite.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/test_suite.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=trees
+tags=algo,lib
+maintainer=Alexandre Terrasa <alexandre@moz-code.org>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/trees/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/trees/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=websocket
+tags=network,lib
+maintainer=Lucas Bajolet <r4pass@hotmail.com>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/websocket/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/websocket/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+[project]
+name=x11
+tags=ui,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/x11.nit
+git=https://github.com/nitlang/nit.git
+git.directory=lib/x11.nit
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
# 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));
--- /dev/null
+[project]
+name=xdg_basedir
+tags=wrapper,lib
+maintainer=Alexis Laferrière <alexis.laf@xymus.net>
+license=Apache-2.0
+[upstream]
+browse=https://github.com/nitlang/nit/tree/master/lib/xdg_basedir/
+git=https://github.com/nitlang/nit.git
+git.directory=lib/xdg_basedir/
+homepage=http://nitlanguage.org
+issues=https://github.com/nitlang/nit/issues
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# 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.
+
+# Basic catalog generator for Nit projects
+#
+# See: <http://nitlanguage.org/catalog/>
+#
+# The tool scans projects and generates the HTML files of a catalog.
+#
+# ## Features
+#
+# * [X] scan projects and their `.ini`
+# * [X] generate lists of projects
+# * [X] generate a page per project with the readme and most metadata
+# * [ ] link/include/be included in the documentation
+# * [ ] propose `related projects`
+# * [ ] show directory content (a la nitls)
+# * [X] gather git information from the working directory
+# * [ ] gather git information from the repository
+# * [ ] gather project information from github
+# * [ ] gather people information from github
+# * [ ] reify people
+# * [ ] separate information gathering from rendering
+# * [ ] move up information gathering in (existing or new) service modules
+# * [ ] add command line options
+# * [ ] harden HTML (escaping, path injection, etc)
+# * [ ] nitcorn server with RESTful API
+#
+# ## Issues and limitations
+#
+# The tool works likee the other tools and expects to find valid Nit source code in the directories
+#
+# * cruft and temporary files will be collected
+# * missing source file (e.g. not yet generated by nitcc) will make information
+# incomplete (e.g. invalid module thus partial dependency and metrics)
+#
+# How to use the tool as the basis of a Nit code archive on the web usable with a package manager is not clear.
+module nitcatalog
+
+import loader # Scan&load projects, groups and modules
+import doc::doc_down # Display mdoc
+import md5 # To get gravatar images
+import counter # For statistics
+import modelize # To process and count classes and methods
+
+redef class MProject
+ # Return the associated metadata from the `ini`, if any
+ fun metadata(key: String): nullable String
+ do
+ var ini = self.ini
+ if ini == null then return null
+ return ini[key]
+ end
+
+ # The list of maintainers
+ var maintainers = new Array[String]
+
+ # The list of contributors
+ var contributors = new Array[String]
+
+ # The date of the most recent commit
+ var last_date: nullable String = null
+
+ # The date of the oldest commit
+ var first_date: nullable String = null
+end
+
+# A HTML page in a catalog
+#
+# This is just a template with the header pre-filled and the footer injected at rendering.
+# Therefore, once instantiated, the content can just be added to it.
+class CatalogPage
+ super Template
+
+ # Placeholder to include additional things before the `</head>`.
+ var more_head = new Template
+
+ redef init
+ do
+ add """
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <link rel="stylesheet" media="all" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
+ <link rel="stylesheet" media="all" href="style.css">
+"""
+ add more_head
+
+ add """
+</head>
+<body>
+<div class='container-fluid'>
+ <div class='row'>
+ <nav id='topmenu' class='navbar navbar-default navbar-fixed-top' role='navigation'>
+ <div class='container-fluid'>
+ <div class='navbar-header'>
+ <button type='button' class='navbar-toggle' data-toggle='collapse' data-target='#topmenu-collapse'>
+ <span class='sr-only'>Toggle menu</span>
+ <span class='icon-bar'></span>
+ <span class='icon-bar'></span>
+ <span class='icon-bar'></span>
+ </button>
+ <span class='navbar-brand'><a href="http://nitlanguage.org/">Nitlanguage.org</a></span>
+ </div>
+ <div class='collapse navbar-collapse' id='topmenu-collapse'>
+ <ul class='nav navbar-nav'>
+ <li><a href="index.html">Catalog</a></li>
+ </ul>
+ </div>
+ </div>
+ </nav>
+ </div>
+"""
+ end
+
+ redef fun rendering
+ do
+ add """
+</div> <!-- container-fluid -->
+<script src='https://code.jquery.com/jquery-latest.min.js'></script>
+<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js'></script>
+<script src='https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.8.1/bootstrap-table-all.min.js'></script>
+</body>
+</html>
+"""
+ end
+end
+
+redef class Int
+ # Returns `log(self+1)`. Used to compute score of projects
+ fun score: Float do return (self+1).to_f.log
+end
+
+# The main class of the calatog generator that has the knowledge
+class Catalog
+
+ # The modelbuilder
+ # used to access the files and count source lines of code
+ var modelbuilder: ModelBuilder
+
+ # Projects by tag
+ var tag2proj = new MultiHashMap[String, MProject]
+
+ # Projects by category
+ var cat2proj = new MultiHashMap[String, MProject]
+
+ # Projects by maintainer
+ var maint2proj = new MultiHashMap[String, MProject]
+
+ # Projects by contributors
+ var contrib2proj = new MultiHashMap[String, MProject]
+
+ # Dependency between projects
+ var deps = new POSet[MProject]
+
+ # Number of modules by project
+ var mmodules = new Counter[MProject]
+
+ # Number of classes by project
+ var mclasses = new Counter[MProject]
+
+ # Number of methods by project
+ var mmethods = new Counter[MProject]
+
+ # Number of line of code by project
+ var loc = new Counter[MProject]
+
+ # Number of commits by project
+ var commits = new Counter[MProject]
+
+ # Score by project
+ #
+ # The score is loosely computed using other metrics
+ var score = new Counter[MProject]
+
+ # Scan, register and add a contributor to a project
+ fun add_contrib(person: String, mproject: MProject, res: Template)
+ do
+ var projs = contrib2proj[person]
+ if not projs.has(mproject) then projs.add mproject
+ var name = person
+ var email = null
+ var page = null
+
+ # Regular expressions are broken, need to investigate.
+ # So split manually.
+ #
+ #var re = "([^<(]*?)(<([^>]*?)>)?(\\((.*)\\))?".to_re
+ #var m = (person+" ").search(re)
+ #print "{person}: `{m or else "?"}` `{m[1] or else "?"}` `{m[3] or else "?"}` `{m[5] or else "?"}`"
+ do
+ var sp1 = person.split_once_on("<")
+ if sp1.length < 2 then
+ break
+ end
+ var sp2 = sp1.last.split_once_on(">")
+ if sp2.length < 2 then
+ break
+ end
+ name = sp1.first.trim
+ email = sp2.first.trim
+ var sp3 = sp2.last.split_once_on("(")
+ if sp3.length < 2 then
+ break
+ end
+ var sp4 = sp3.last.split_once_on(")")
+ if sp4.length < 2 then
+ break
+ end
+ page = sp4.first.trim
+ end
+
+ var e = name.html_escape
+ res.add "<li>"
+ if page != null then
+ res.add "<a href=\"{page.html_escape}\">"
+ end
+ if email != null then
+ # TODO get more things from github by using the email as a key
+ # "https://api.github.com/search/users?q={email}+in:email"
+ var md5 = email.md5.to_lower
+ res.add "<img src=\"https://secure.gravatar.com/avatar/{md5}?size=20&default=retro\"> "
+ end
+ res.add "{e}"
+ if page != null then res.add "</a>"
+ res.add "</li>"
+ end
+
+
+ # Compute information and generate a full HTML page for a project
+ fun project_page(mproject: MProject): Writable
+ do
+ var res = new CatalogPage
+ var score = score[mproject].to_f
+ var name = mproject.name.html_escape
+ res.more_head.add """<title>{{{name}}}</title>"""
+
+ res.add """
+<div class="content">
+<h1 class="package-name">{{{name}}}</h1>
+"""
+ var mdoc = mproject.mdoc_or_fallback
+ if mdoc != null then
+ score += 100.0
+ res.add mdoc.html_documentation
+ score += mdoc.content.length.score
+ end
+ res.add """
+</div>
+<div class="sidebar">
+<ul class="box">
+"""
+ var homepage = mproject.metadata("upstream.homepage")
+ if homepage != null then
+ score += 5.0
+ var e = homepage.html_escape
+ res.add "<li><a href=\"{e}\">{e}</a></li>\n"
+ end
+ var maintainer = mproject.metadata("project.maintainer")
+ if maintainer != null then
+ score += 5.0
+ add_contrib(maintainer, mproject, res)
+ mproject.maintainers.add maintainer
+ var projs = maint2proj[maintainer]
+ if not projs.has(mproject) then projs.add mproject
+ end
+ var license = mproject.metadata("project.license")
+ if license != null then
+ score += 5.0
+ var e = license.html_escape
+ res.add "<li><a href=\"http://opensource.org/licenses/{e}\">{e}</a> license</li>\n"
+ end
+ res.add "</ul>\n"
+
+ res.add "<h3>Source Code</h3>\n<ul class=\"box\">\n"
+ var browse = mproject.metadata("upstream.browse")
+ if browse != null then
+ score += 5.0
+ var e = browse.html_escape
+ res.add "<li><a href=\"{e}\">{e}</a></li>\n"
+ end
+ var git = mproject.metadata("upstream.git")
+ if git != null then
+ var e = git.html_escape
+ res.add "<li><tt>{e}</tt></li>\n"
+ end
+ var last_date = mproject.last_date
+ if last_date != null then
+ var e = last_date.html_escape
+ res.add "<li>most recent commit: {e}</li>\n"
+ end
+ var first_date = mproject.first_date
+ if first_date != null then
+ var e = first_date.html_escape
+ res.add "<li>oldest commit: {e}</li>\n"
+ end
+ var commits = commits[mproject]
+ if commits != 0 then
+ res.add "<li>{commits} commits</li>\n"
+ end
+ res.add "</ul>\n"
+
+ res.add "<h3>Tags</h3>\n"
+ var tags = mproject.metadata("project.tags")
+ var ts2 = new Array[String]
+ var cat = null
+ if tags != null then
+ var ts = tags.split(",")
+ for t in ts do
+ t = t.trim
+ if t == "" then continue
+ if cat == null then cat = t
+ tag2proj[t].add mproject
+ t = t.html_escape
+ ts2.add "<a href=\"index.html#tag_{t}\">{t}</a>"
+ end
+ res.add_list(ts2, ", ", ", ")
+ end
+ if ts2.is_empty then
+ var t = "none"
+ cat = t
+ tag2proj[t].add mproject
+ res.add "<a href=\"index.html#tag_{t}\">{t}</a>"
+ end
+ if cat != null then cat2proj[cat].add mproject
+ score += ts2.length.score
+
+ var reqs = deps[mproject].greaters.to_a
+ reqs.remove(mproject)
+ alpha_comparator.sort(reqs)
+ res.add "<h3>Requirements</h3>\n"
+ if reqs.is_empty then
+ res.add "none"
+ else
+ var list = new Array[String]
+ for r in reqs do
+ var direct = deps.has_direct_edge(mproject, r)
+ var s = "<a href=\"{r}.html\">"
+ if direct then s += "<strong>"
+ s += r.to_s
+ if direct then s += "</strong>"
+ s += "</a>"
+ list.add s
+ end
+ res.add_list(list, ", ", " and ")
+ end
+
+ reqs = deps[mproject].smallers.to_a
+ reqs.remove(mproject)
+ alpha_comparator.sort(reqs)
+ res.add "<h3>Clients</h3>\n"
+ if reqs.is_empty then
+ res.add "none"
+ else
+ var list = new Array[String]
+ for r in reqs do
+ var direct = deps.has_direct_edge(r, mproject)
+ var s = "<a href=\"{r}.html\">"
+ if direct then s += "<strong>"
+ s += r.to_s
+ if direct then s += "</strong>"
+ s += "</a>"
+ list.add s
+ end
+ res.add_list(list, ", ", " and ")
+ end
+
+ score += deps[mproject].greaters.length.score
+ score += deps[mproject].direct_greaters.length.score
+ score += deps[mproject].smallers.length.score
+ score += deps[mproject].direct_smallers.length.score
+
+ var contributors = mproject.contributors
+ if not contributors.is_empty then
+ res.add "<h3>Contributors</h3>\n<ul class=\"box\">"
+ for c in contributors do
+ add_contrib(c, mproject, res)
+ end
+ res.add "</ul>"
+ end
+ score += contributors.length.to_f
+
+ var mmodules = 0
+ var mclasses = 0
+ var mmethods = 0
+ var loc = 0
+ for g in mproject.mgroups do
+ mmodules += g.module_paths.length
+ for m in g.mmodules do
+ var am = modelbuilder.mmodule2node(m)
+ if am != null then
+ var file = am.location.file
+ if file != null then
+ loc += file.line_starts.length - 1
+ end
+ end
+ for cd in m.mclassdefs do
+ mclasses += 1
+ for pd in cd.mpropdefs do
+ if not pd isa MMethodDef then continue
+ mmethods += 1
+ end
+ end
+ end
+ end
+ self.mmodules[mproject] = mmodules
+ self.mclasses[mproject] = mclasses
+ self.mmethods[mproject] = mmethods
+ self.loc[mproject] = loc
+
+ #score += mmodules.score
+ score += mclasses.score
+ score += mmethods.score
+ score += loc.score
+
+ res.add """
+<h3>Stats</h3>
+<ul class="box">
+<li>{{{mmodules}}} modules</li>
+<li>{{{mclasses}}} classes</li>
+<li>{{{mmethods}}} methods</li>
+<li>{{{loc}}} lines of code</li>
+</ul>
+"""
+
+ res.add """
+</div>
+"""
+ self.score[mproject] = score.to_i
+
+ return res
+ end
+
+ # Return a short HTML sequence for a project
+ #
+ # Intended to use in lists.
+ fun li_project(p: MProject): String
+ do
+ var res = ""
+ var f = "{p.name}.html"
+ res += "<a href=\"{f}\">{p}</a>"
+ var d = p.mdoc_or_fallback
+ if d != null then res += " - {d.html_synopsis.write_to_string}"
+ return res
+ end
+
+ # List projects by group.
+ #
+ # For each key of the `map` a `<h3>` is generated.
+ # Each project is then listed.
+ #
+ # The list of keys is generated first to allow fast access to the correct `<h3>`.
+ # `id_prefix` is used to give an id to the `<h3>` element.
+ fun list_by(map: MultiHashMap[String, MProject], id_prefix: String): Template
+ do
+ var res = new Template
+ var keys = map.keys.to_a
+ alpha_comparator.sort(keys)
+ var list = [for x in keys do "<a href=\"#{id_prefix}{x.html_escape}\">{x.html_escape}</a>"]
+ res.add_list(list, ", ", " and ")
+
+ for k in keys do
+ var projs = map[k].to_a
+ alpha_comparator.sort(projs)
+ var e = k.html_escape
+ res.add "<h3 id=\"{id_prefix}{e}\">{e} ({projs.length})</h3>\n<ul>\n"
+ for p in projs do
+ res.add "<li>"
+ res.add li_project(p)
+ res.add "</li>"
+ end
+ res.add "</ul>"
+ end
+ return res
+ end
+
+ # List the 10 best projects from `cpt`
+ fun list_best(cpt: Counter[MProject]): Template
+ do
+ var res = new Template
+ res.add "<ul>"
+ var best = cpt.sort
+ for i in [1..10] do
+ if i > best.length then break
+ var p = best[best.length-i]
+ res.add "<li>"
+ res.add li_project(p)
+ # res.add " ({cpt[p]})"
+ res.add "</li>"
+ end
+ res.add "</ul>"
+ return res
+ end
+
+ # Collect more information on a project using the `git` tool.
+ fun git_info(mproject: MProject)
+ do
+ var ini = mproject.ini
+ if ini == null then return
+
+ # TODO use real git info
+ #var repo = ini.get_or_null("upstream.git")
+ #var branch = ini.get_or_null("upstream.git.branch")
+ #var directory = ini.get_or_null("upstream.git.directory")
+
+ var dirpath = mproject.root.filepath
+ if dirpath == null then return
+
+ # Collect commits info
+ var res = git_run("log", "--no-merges", "--follow", "--pretty=tformat:%ad;%aN <%aE>", "--", dirpath)
+ var contributors = new Counter[String]
+ var commits = res.split("\n")
+ if commits.not_empty and commits.last == "" then commits.pop
+ self.commits[mproject] = commits.length
+ for l in commits do
+ var s = l.split_once_on(';')
+ if s.length != 2 or s.last == "" then continue
+
+ # Collect date of last and first commit
+ if mproject.last_date == null then mproject.last_date = s.first
+ mproject.first_date = s.first
+
+ # Count contributors
+ contributors.inc(s.last)
+ end
+ for c in contributors.sort.reverse_iterator do
+ mproject.contributors.add c
+ end
+
+ end
+
+ # Produce a HTML table containig information on the projects
+ #
+ # `project_page` must have been called before so that information is computed.
+ fun table_projects(mprojects: Array[MProject]): Template
+ do
+ alpha_comparator.sort(mprojects)
+ var res = new Template
+ res.add "<table data-toggle=\"table\" data-sort-name=\"name\" data-sort-order=\"desc\" width=\"100%\">\n"
+ res.add "<thead><tr>\n"
+ res.add "<th data-field=\"name\" data-sortable=\"true\">name</th>\n"
+ res.add "<th data-field=\"maint\" data-sortable=\"true\">maint</th>\n"
+ res.add "<th data-field=\"contrib\" data-sortable=\"true\">contrib</th>\n"
+ res.add "<th data-field=\"reqs\" data-sortable=\"true\">reqs</th>\n"
+ res.add "<th data-field=\"dreqs\" data-sortable=\"true\">direct<br>reqs</th>\n"
+ res.add "<th data-field=\"cli\" data-sortable=\"true\">clients</th>\n"
+ res.add "<th data-field=\"dcli\" data-sortable=\"true\">direct<br>clients</th>\n"
+ res.add "<th data-field=\"mod\" data-sortable=\"true\">modules</th>\n"
+ res.add "<th data-field=\"cla\" data-sortable=\"true\">classes</th>\n"
+ res.add "<th data-field=\"met\" data-sortable=\"true\">methods</th>\n"
+ res.add "<th data-field=\"loc\" data-sortable=\"true\">lines</th>\n"
+ res.add "<th data-field=\"score\" data-sortable=\"true\">score</th>\n"
+ res.add "</tr></thead>"
+ for p in mprojects do
+ res.add "<tr>"
+ res.add "<td><a href=\"{p.name}.html\">{p.name}</a></td>"
+ var maint = "?"
+ if p.maintainers.not_empty then maint = p.maintainers.first
+ res.add "<td>{maint}</td>"
+ res.add "<td>{p.contributors.length}</td>"
+ res.add "<td>{deps[p].greaters.length-1}</td>"
+ res.add "<td>{deps[p].direct_greaters.length}</td>"
+ res.add "<td>{deps[p].smallers.length-1}</td>"
+ res.add "<td>{deps[p].direct_smallers.length}</td>"
+ res.add "<td>{mmodules[p]}</td>"
+ res.add "<td>{mclasses[p]}</td>"
+ res.add "<td>{mmethods[p]}</td>"
+ res.add "<td>{loc[p]}</td>"
+ res.add "<td>{score[p]}</td>"
+ res.add "</tr>\n"
+ end
+ res.add "</table>\n"
+ return res
+ end
+end
+
+# Execute a git command and return the result
+fun git_run(command: String...): String
+do
+ # print "git {command.join(" ")}"
+ var p = new ProcessReader("git", command...)
+ var res = p.read_all
+ p.close
+ p.wait
+ return res
+end
+
+var model = new Model
+var tc = new ToolContext
+
+tc.process_options(sys.args)
+tc.keep_going = true
+
+var modelbuilder = new ModelBuilder(model, tc)
+var catalog = new Catalog(modelbuilder)
+
+# Get files or groups
+for a in tc.option_context.rest do
+ modelbuilder.get_mgroup(a)
+ modelbuilder.identify_file(a)
+end
+
+# Scan projects and compute information
+for p in model.mprojects do
+ var g = p.root
+ assert g != null
+ modelbuilder.scan_group(g)
+
+ # Load the module to process importation information
+ modelbuilder.parse_group(g)
+
+ catalog.deps.add_node(p)
+ for gg in p.mgroups do for m in gg.mmodules do
+ for im in m.in_importation.direct_greaters do
+ var ip = im.mproject
+ if ip == null or ip == p then continue
+ catalog.deps.add_edge(p, ip)
+ end
+ end
+
+ catalog.git_info(p)
+end
+
+# Run phases to modelize classes and properties (so we can count them)
+#modelbuilder.run_phases
+
+var out = "out"
+out.mkdir
+
+# Generate the css (hard coded)
+var css = """
+body {
+margin-top: 15px;
+background-color: #f8f8f8;
+}
+
+a {
+color: #0D8921;
+text-decoration: none;
+}
+
+a:hover {
+color: #333;
+text-decoration: none;
+}
+
+h1 {
+font-weight: bold;
+color: #0D8921;
+font-size: 22px;
+}
+
+h2 {
+color: #6C6C6C;
+font-size: 18px;
+border-bottom: solid 3px #CCC;
+}
+
+h3 {
+color: #6C6C6C;
+font-size: 15px;
+border-bottom: solid 1px #CCC;
+}
+
+ul {
+list-style-type: square;
+}
+
+dd {
+color: #6C6C6C;
+margin-top: 1em;
+margin-bottom: 1em;
+}
+
+pre {
+border: 1px solid #CCC;
+font-family: Monospace;
+color: #2d5003;
+background-color: rgb(250, 250, 250);
+}
+
+code {
+font-family: Monospace;
+color: #2d5003;
+}
+
+footer {
+margin-top: 20px;
+}
+
+.container {
+margin: 0 auto;
+padding: 0 20px;
+}
+
+.content {
+float: left;
+margin-top: 40px;
+width: 65%;
+}
+
+.sidebar {
+float: right;
+margin-top: 40px;
+width: 30%
+}
+
+.sidebar h3 {
+color: #0D8921;
+font-size: 18px;
+border-bottom: 0px;
+}
+
+.box {
+margin: 0;
+padding: 0;
+}
+
+.box li {
+line-height: 2.5;
+white-space: nowrap;
+overflow: hidden;
+text-overflow: ellipsis;
+padding-right: 10px;
+border-bottom: 1px solid rgba(0,0,0,0.2);
+}
+"""
+css.write_to_file(out/"style.css")
+
+# PAGES
+
+for p in model.mprojects do
+ # print p
+ var f = "{p.name}.html"
+ catalog.project_page(p).write_to_file(out/f)
+end
+
+# INDEX
+
+var index = new CatalogPage
+index.more_head.add "<title>Projects in Nit</title>"
+
+index.add """
+<div class="content">
+<h1>Projects in Nit</h1>
+"""
+
+index.add "<h2>Highlighted Projects</h2>\n"
+index.add catalog.list_best(catalog.score)
+
+index.add "<h2>Most Required</h2>\n"
+var reqs = new Counter[MProject]
+for p in model.mprojects do
+ reqs[p] = catalog.deps[p].smallers.length - 1
+end
+index.add catalog.list_best(reqs)
+
+index.add "<h2>By First Tag</h2>\n"
+index.add catalog.list_by(catalog.cat2proj, "cat_")
+
+index.add "<h2>By Any Tag</h2>\n"
+index.add catalog.list_by(catalog.tag2proj, "tag_")
+
+index.add """
+</div>
+<div class="sidebar">
+<h3>Stats</h3>
+<ul class="box">
+<li>{{{model.mprojects.length}}} projects</li>
+<li>{{{catalog.maint2proj.length}}} maintainers</li>
+<li>{{{catalog.contrib2proj.length}}} contributors</li>
+<li>{{{catalog.tag2proj.length}}} tags</li>
+<li>{{{catalog.mmodules.sum}}} modules</li>
+<li>{{{catalog.mclasses.sum}}} classes</li>
+<li>{{{catalog.mmethods.sum}}} methods</li>
+<li>{{{catalog.loc.sum}}} lines of code</li>
+</ul>
+</div>
+"""
+
+index.write_to_file(out/"index.html")
+
+# PEOPLE
+
+var page = new CatalogPage
+page.more_head.add "<title>People of Nit</title>"
+page.add """<div class="content">\n<h1>People of Nit</h1>\n"""
+page.add "<h2>By Maintainer</h2>\n"
+page.add catalog.list_by(catalog.maint2proj, "maint_")
+page.add "<h2>By Contributor</h2>\n"
+page.add catalog.list_by(catalog.contrib2proj, "contrib_")
+page.add "</div>\n"
+page.write_to_file(out/"people.html")
+
+# TABLE
+
+page = new CatalogPage
+page.more_head.add "<title>Projets of Nit</title>"
+page.add """<div class="content">\n<h1>People of Nit</h1>\n"""
+page.add "<h2>Table of Projets</h2>\n"
+page.add catalog.table_projects(model.mprojects)
+page.add "</div>\n"
+page.write_to_file(out/"table.html")
[project]
name=nitc
tags=devel,cli
-author=Jean Privat <jean@pryen.org>
+maintainer=Jean Privat <jean@pryen.org>
license=Apache-2.0
[upstream]
browse=https://github.com/nitlang/nit/tree/master/src
-../lib/mnit_linux/linux_app.nit:29,16--31: Redef Error: a virtual type cannot be refined.
-../lib/mnit_linux/linux_app.nit:30,16--29: Redef Error: a virtual type cannot be refined.
+../lib/mnit/linux/linux_app.nit:29,16--31: Redef Error: a virtual type cannot be refined.
+../lib/mnit/linux/linux_app.nit:30,16--29: Redef Error: a virtual type cannot be refined.
--- /dev/null
+Usage: [OPTION]... [ARG]...
+Use --help for help
-../lib/mnit_linux/linux_app.nit:29,16--31: Redef Error: a virtual type cannot be refined.
-../lib/mnit_linux/linux_app.nit:30,16--29: Redef Error: a virtual type cannot be refined.
+../lib/mnit/linux/linux_app.nit:29,16--31: Redef Error: a virtual type cannot be refined.
+../lib/mnit/linux/linux_app.nit:30,16--29: Redef Error: a virtual type cannot be refined.
-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