Skip to content

Commit c206fd8

Browse files
author
Neil Matthew
committed
Added Build Notes
1 parent 2e4f5d2 commit c206fd8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+19574
-0
lines changed

bdwgc.tar.gz

928 KB
Binary file not shown.

debian/.debhelper/bucket/files/19c12bb2ca19e68724c2854ed0512469518df19b0710cc2011a5ca540810979c

Lines changed: 1480 additions & 0 deletions
Large diffs are not rendered by default.

debian/.debhelper/bucket/files/f7197ddfb309e86d5fbd7d3b440a5ababfbd4aac1e1f53b492e28e54db58b222

Lines changed: 1801 additions & 0 deletions
Large diffs are not rendered by default.

debian/.debhelper/bucket/index

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
19c12bb2ca19e68724c2854ed0512469518df19b0710cc2011a5ca540810979c bdwgc/libatomic_ops/config.guess
2+
19c12bb2ca19e68724c2854ed0512469518df19b0710cc2011a5ca540810979c bdwgc/config.guess
3+
f7197ddfb309e86d5fbd7d3b440a5ababfbd4aac1e1f53b492e28e54db58b222 bdwgc/libatomic_ops/config.sub
4+
f7197ddfb309e86d5fbd7d3b440a5ababfbd4aac1e1f53b492e28e54db58b222 bdwgc/config.sub

examples/conform.a68

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
PROGRAM conform CONTEXT VOID
2+
USE standard
3+
BEGIN
4+
PROC conform =
5+
(UNION(LONG INT, INT, SHORT INT) x) VOID:
6+
CASE x IN
7+
(LONG INT x):
8+
print(("LONG INT: ",x,newline)),
9+
(UNION(INT, SHORT INT) x):
10+
print(("SHORTER INT: ",x,newline))
11+
ESAC;
12+
13+
PROC conform2 =
14+
(UNION(LONG INT, INT, SHORT INT) x) VOID:
15+
CASE x IN
16+
(LONG INT x):
17+
print(("LONG INT: ",x,newline)),
18+
(INT x):
19+
print(("INT: ",x,newline)),
20+
(SHORT INT x):
21+
print(("SHORT INT: ",x,newline))
22+
ESAC;
23+
24+
conform(LONG 99999999999);
25+
conform(9999);
26+
27+
conform2(LONG 99999999999);
28+
conform2(9999);
29+
conform2(SHORTEN 99)
30+
31+
END
32+
FINISH
33+

examples/logic/Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
PROGRAM = logic
2+
ALGOLW_SOURCES = logic.alw
3+
C_SOURCES = argv.c
4+
EXTRA_FILES = expected.output README logic68.a68 logicpas.pas tests.sh
5+
6+
test : clean logic
7+
sh tests.sh ./logic
8+
./logic '~a \/ b, a -> b' > actual.output
9+
diff expected.output actual.output
10+
11+
# an additional cleaning rule:
12+
clean ::
13+
rm -f actual.output logicpas logicpas.o logic68 logic68.c logic68.o
14+
15+
# Bonus Algol 68 program! You need Algol 68RS to compile this.
16+
logic68: logic68.a68
17+
ca -u AAAAAAA logic68.a68
18+
sh tests.sh ./logic68
19+
./logic68 '~a \/ b, a -> b' > actual.output
20+
diff expected.output actual.output
21+
22+
# Bonus Pascal program! You need Free Pascal to compile this.
23+
logicpas: logicpas.pas
24+
fpc logicpas.pas
25+
sh tests.sh ./logicpas
26+
./logicpas '~a \/ b, a -> b' > actual.output
27+
diff expected.output actual.output
28+
29+
include awe.mk

examples/logic/README

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
This is a toy intepreter for predicates (boolean expressions).
2+
It produces a table of all possible valuations. You can put in
3+
multiple predicates separated by commas, all of them will be
4+
shown in the right hand columns.
5+
6+
a b | ~a \/ b, a -> b
7+
0 0 | 1 1
8+
0 1 | 1 1
9+
1 0 | 0 0
10+
1 1 | 1 1
11+
12+
The program compiles an infix expression into RPN notion and
13+
interprets that on a stack machine. It is the toy program that I write
14+
when learning a new computer language. (I've included my Pascal and
15+
Algol 68 versions for comparison.)
16+
17+
This program is also a demonstration of how to mix Algol W and C code.
18+
The Algol W program uses C functions to access the command line.
19+
20+
Boolean expression syntax:
21+
22+
predicates = equivalence ("," equivalence)*
23+
equivalence = implication ("<->" implication)*
24+
implication = exclusiveOR ("->" exclusiveOR)*
25+
exclusiveOR = disjunction ("@" disjunction)*
26+
disjunction = conjunction ("\/" conjunction)*
27+
conjunction = unary ("/\" unary)*
28+
unary = "0" | "1" | variable | "~" unary | "(" equivalence ")"
29+
30+
Variables are any letter but "T" or "F". Spaces are ignored.
31+
32+
Alternative symbols:
33+
34+
"/\" --> "."
35+
"\/" --> "+"
36+
"<->" --> "="
37+
"->" --> ">"
38+
"0" --> "F"
39+
"1" --> "T"

examples/logic/argv.c

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* argc.c -- external procedures to let Algol W programs to access argc and argv. */
2+
3+
#include <awe.h>
4+
#include <string.h>
5+
#include <assert.h>
6+
#include <stdlib.h>
7+
8+
#include "logic.awe.h" /* Prototypes for external procedures. Generated by the Makefile. */
9+
10+
11+
#define STRING_LENGTH 100 /* This MUST match the string length in the Algol W declarations. */
12+
13+
14+
/* Note: '_awe_argc' and '_awe_argc' are global copies of the 'main' function's arguments. */
15+
16+
17+
int
18+
get_argc (void)
19+
{
20+
return _awe_argc;
21+
}
22+
23+
24+
int
25+
get_argv_length (int index)
26+
{
27+
assert(_awe_argv != NULL);
28+
if (index < 0 || index > _awe_argc)
29+
_awe_error(_awe_HERE, "attempted to access argv[%i], argc is %i\n", index, _awe_argc);
30+
assert(_awe_argv[index] != NULL);
31+
return strlen(_awe_argv[index]);
32+
}
33+
34+
35+
_awe_str
36+
get_argv (int index)
37+
{
38+
int len;
39+
40+
assert(_awe_argv != NULL);
41+
if (index < 0 || index > _awe_argc)
42+
_awe_error(_awe_HERE, "attempted to access argv[%i], argc is %i\n", index, _awe_argc);
43+
assert(_awe_argv[index] != NULL);
44+
len = strlen(_awe_argv[index]);
45+
if (len > STRING_LENGTH)
46+
_awe_error(_awe_HERE, "strlen(argv[%i] == %i: greater than target string's length of %i", index, len, STRING_LENGTH);
47+
return _awe_str_cast(_awe_argv[index], len, STRING_LENGTH);
48+
}
49+
50+
51+
void
52+
do_exit (int code)
53+
{
54+
_awe_finalize(_awe_HERE);
55+
exit(code);
56+
}
57+
58+
59+
/* end */

examples/logic/expected.output

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
a b | ~a \/ b, a -> b
3+
0 0 | 1 1
4+
0 1 | 1 1
5+
1 0 | 0 0
6+
1 1 | 1 1
7+

0 commit comments

Comments
 (0)