From 931b27a04a5af60f297dd66288fd6163c277b181 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Thu, 29 Jun 2017 18:42:47 +1000 Subject: Reworked css for nav, pre, code tags, added some colour --- project/templates/fltkada.html | 29 ++++++++++--------- project/templates/grasp.html | 19 ++++++------- project/templates/thue2a.html | 63 +++++++++++++++++++----------------------- 3 files changed, 52 insertions(+), 59 deletions(-) (limited to 'project/templates') diff --git a/project/templates/fltkada.html b/project/templates/fltkada.html index 584e4f8..cea8cac 100644 --- a/project/templates/fltkada.html +++ b/project/templates/fltkada.html @@ -28,30 +28,29 @@ be enough to write a text editor. It's a thick, loosely coupled binding, accompl the interface to C, then importing that to Ada. Attempted usage of the internal C interface as a binding on its own is not supported.

-

A typical FLTK Hello World program in Ada: +

A typical FLTK Hello World program in Ada:

- with - FLTK.Widgets.Groups.Windows, - FLTK.Widgets.Boxes; +with + FLTK.Widgets.Groups.Windows, + FLTK.Widgets.Boxes; - function Hello_World return Integer is +function Hello_World return Integer is - My_Win : FLTK.Widgets.Groups.Windows.Window := - FLTK.Widgets.Groups.Windows.Create (100, 100, 200, 200, "Untitled"); + My_Win : FLTK.Widgets.Groups.Windows.Window := + FLTK.Widgets.Groups.Windows.Create (100, 100, 200, 200, "Untitled"); - My_Box : FLTK.Widgets.Boxes.Box := - FLTK.Widgets.Boxes.Create (50, 50, 100, 100, "Hello, World!"); + My_Box : FLTK.Widgets.Boxes.Box := + FLTK.Widgets.Boxes.Create (50, 50, 100, 100, "Hello, World!"); - begin +begin - My_Win.Add (My_Box); - My_Win.Show; + My_Win.Add (My_Box); + My_Win.Show; - return FLTK.Run; + return FLTK.Run; - end Hello_World; +end Hello_World; -

Aside from reworking the types to better fit the strongly typed philosophy of Ada, the entire library has been structured to avoid explicit heap usage. As you can see from the above example, the intended use is to diff --git a/project/templates/grasp.html b/project/templates/grasp.html index 54e625a..c340483 100644 --- a/project/templates/grasp.html +++ b/project/templates/grasp.html @@ -52,18 +52,17 @@ uses a subset of the DOT graph description language for the file format, to enab as well as relatively easy conversion to a graph image. If a format that more readily converts to a comprehensible graph image is found, a parser for it may be added.

-

The above example is recorded as follows: +

The above example is recorded as follows:

- digraph { - 1 [label="puts"] - 2 [label="grasp:main"] - 3 [label="Hello world!"] - - 1 -> 2 [label="name"] - 1 -> 3 [label="in"] - } +digraph { + 1 [label="puts"] + 2 [label="grasp:main"] + 3 [label="Hello world!"] + + 1 -> 2 [label="name"] + 1 -> 3 [label="in"] +} -

Source code is available here.

diff --git a/project/templates/thue2a.html b/project/templates/thue2a.html index f4dac4f..6cb4680 100644 --- a/project/templates/thue2a.html +++ b/project/templates/thue2a.html @@ -18,18 +18,17 @@ a sequence of symbols to replace and a sequence of symbols to replace with, and state of the program. Applicable rules are then applied to the inital state in a random order until no more are applicable, at which point the program terminates.

-

An example Thue program that increments a binary number surrounded by '_' characters: +

An example Thue program that increments a binary number surrounded by '_' characters:

- 1_::=1++ - 0_::=1 - 01++::=10 - 11++::=1++0 - _0::=_ - _1++::=10 - ::= - _1111111_ +1_::=1++ +0_::=1 +01++::=10 +11++::=1++0 +_0::=_ +_1++::=10 +::= +_1111111_ -

The before and after symbols in each rule are separated by '::=' and the list of rules is ended by a blank rule. Note that whitespace in rules and the inital state is NOT ignored.

@@ -37,26 +36,24 @@ ended by a blank rule. Note that whitespace in rules and the inital state is NOT

Output is handled by prefixing the right hand side with '~', which causes those symbols to go to stdout and the replacement in the program to be the empty string.

-

The traditional Hello World program: +

The traditional Hello World program:

- a::=~Hello World! - ::= - a +a::=~Hello World! +::= +a -

Input is handled by having the right hand side of a rule be ':::', which causes the left hand side symbols to be replaced with a line from the standard output. Unfortunately, this immediately causes problems.

The following is an innocent piece of code that accepts a single line of input and does nothing -more. Maybe. +more. Maybe.

- a::=::: - ::= - a +a::=::: +::= +a -

If a string involving the letter 'a' is entered into the above program, the single input rule will again become applicable and another line of input will be obtained. In other words, the @@ -67,28 +64,26 @@ version 2a. In this version, all symbols obtained through stdin are treated as d ordinary symbols. Rules can refer to and manipulate symbols obtained through stdin by surrounding them in double quotes.

-

A rule that replaces an ordinary symbol 'a' with 'abc': +

A rule that replaces an ordinary symbol 'a' with 'abc':

- a::=abc +a::=abc -

-

A rule that replaces the letter 'a' that was obtained from stdin with 'abc': +

A rule that replaces the letter 'a' that was obtained from stdin with 'abc':

- "a"::=abc +"a"::=abc -

-

For convenience, a number of escaped characters are also available: +

For convenience, a number of escaped characters are also available:

-    \\ -> backslash
-    \r -> return
-    \n -> newline
-    \: -> colon
-    \" -> double quote
-    \EOT -> end of file
+\\ -> backslash
+\r -> return
+\n -> newline
+\: -> colon
+\" -> double quote
+\EOT -> end of file
 
-

+

While this doesn't solve all the problems Thue has (try writing a Thue program that asks for and greets the user by name!) it should solve this one particular issue. Source code is -- cgit