Skip to content

Commit 58866a6

Browse files
committed
Normalize line-endings
1 parent 7babecc commit 58866a6

30 files changed

+1832
-1633
lines changed

Doc/Makefile

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
.PHONY: default clean tarball
2-
3-
core = client ocr
4-
5-
all:
6-
# @python docgen.py `echo $(core) | sed -r \
7-
# 's/(\w+)/..\/Units\/MMLCore\/\1.pas/g'` > /dev/null
8-
@make -C Pics/
9-
@make -C sphinx/ singlehtml latexpdf
10-
11-
clean:
12-
# @rm -f `echo $(core) | sed -r 's/(\w+)/sphinx\/\1.rst/g'`
13-
@make -C Pics/ clean
14-
@make -C sphinx/ clean
15-
16-
tarball:
17-
@$(MAKE) all
18-
# @tar cjf doc.tar.bz2 -C sphinx/_build/ html
1+
.PHONY: default clean tarball
2+
3+
core = client ocr
4+
5+
all:
6+
# @python docgen.py `echo $(core) | sed -r \
7+
# 's/(\w+)/..\/Units\/MMLCore\/\1.pas/g'` > /dev/null
8+
@make -C Pics/
9+
@make -C sphinx/ singlehtml latexpdf
10+
11+
clean:
12+
# @rm -f `echo $(core) | sed -r 's/(\w+)/sphinx\/\1.rst/g'`
13+
@make -C Pics/ clean
14+
@make -C sphinx/ clean
15+
16+
tarball:
17+
@$(MAKE) all
18+
# @tar cjf doc.tar.bz2 -C sphinx/_build/ html

Doc/docgen.py

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import re
2-
from sys import argv
3-
4-
files = argv[1:]
5-
6-
commentregex = re.compile('\(\*.+?\*\)', re.DOTALL)
7-
8-
for file in files:
9-
print file
10-
f = open(file)
11-
p = file.rfind('/')
12-
filetrim = file[p+1:]
13-
p = filetrim.rfind('.pas')
14-
filetrim2 = filetrim[:p]
15-
16-
o = open('sphinx/mmlref/%s.rst' % filetrim2, 'w+')
17-
c = ''.join([x for x in f])
18-
res = commentregex.findall(c)
19-
for y in res:
20-
o.write(y[2:][:-2])
21-
o.close()
22-
f.close()
1+
import re
2+
from sys import argv
3+
4+
files = argv[1:]
5+
6+
commentregex = re.compile('\(\*.+?\*\)', re.DOTALL)
7+
8+
for file in files:
9+
print file
10+
f = open(file)
11+
p = file.rfind('/')
12+
filetrim = file[p+1:]
13+
p = filetrim.rfind('.pas')
14+
filetrim2 = filetrim[:p]
15+
16+
o = open('sphinx/mmlref/%s.rst' % filetrim2, 'w+')
17+
c = ''.join([x for x in f])
18+
res = commentregex.findall(c)
19+
for y in res:
20+
o.write(y[2:][:-2])
21+
o.close()
22+
f.close()

Examples/(Loop) For.simba

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
program ForLoop_Example;
2-
3-
var
4-
I: Integer;
5-
// This is your counter variable.
6-
7-
begin
8-
// Let's convert this to English:
9-
// - For variable I, which first equals 0, until I is equal to 10, do the following...
10-
for I := 0 to 10 do
11-
begin
12-
Writeln('I = ' + IntToStr(I));
13-
end;
14-
end.
1+
program ForLoop_Example;
2+
3+
var
4+
I: Integer;
5+
// This is your counter variable.
6+
7+
begin
8+
// Let's convert this to English:
9+
// - For variable I, which first equals 0, until I is equal to 10, do the following...
10+
for I := 0 to 10 do
11+
begin
12+
Writeln('I = ' + IntToStr(I));
13+
end;
14+
end.

Examples/(Loop) Repeat.simba

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
program RepeatLoop_Example;
2-
3-
var
4-
Counter: Integer;
5-
6-
begin
7-
Counter := 0; // First we have to tell Simba what Counter equals :-)
8-
9-
repeat
10-
Writeln('Counter = ' + IntToStr(Counter));
11-
12-
Counter := Counter + 1; // This needs to be in place to tell Simba to
13-
// - increase the variable 'Counter' by 1 (one).
14-
// Because if we don't, then 'Counter' will
15-
// - always equal 1, and it will always be
16-
// - less than 10. So this while loop will keep
17-
// - going forever, and ever, and ever, and ever...
18-
19-
Until(Counter > 10);
20-
// Let's convert the above statement into English:
21-
// - Repeat the following .... until the variable 'Counter' is greater than 10.
22-
end.
1+
program RepeatLoop_Example;
2+
3+
var
4+
Counter: Integer;
5+
6+
begin
7+
Counter := 0; // First we have to tell Simba what Counter equals :-)
8+
9+
repeat
10+
Writeln('Counter = ' + IntToStr(Counter));
11+
12+
Counter := Counter + 1; // This needs to be in place to tell Simba to
13+
// - increase the variable 'Counter' by 1 (one).
14+
// Because if we don't, then 'Counter' will
15+
// - always equal 1, and it will always be
16+
// - less than 10. So this while loop will keep
17+
// - going forever, and ever, and ever, and ever...
18+
19+
Until(Counter > 10);
20+
// Let's convert the above statement into English:
21+
// - Repeat the following .... until the variable 'Counter' is greater than 10.
22+
end.

Examples/(Loop) While.simba

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
program WhileLoop_Example;
2-
3-
var
4-
Counter: Integer;
5-
6-
begin
7-
Counter := 1; // First we have to tell Simba what Counter equals :-)
8-
9-
// Let's conver this to English:
10-
// - While the Counter variable is less than or equal to 10, do the following...
11-
while (Counter <= 10) do
12-
begin
13-
Writeln('Counter = ' + IntToStr(Counter));
14-
15-
Counter := Counter + 1; // This needs to be in place to tell Simba to
16-
// - increase the variable 'Counter' by 1 (one).
17-
// Because if we don't, then 'Counter' will
18-
// - always equal 1, and it will always be
19-
// - less than 10. So this while loop will keep
20-
// - going forever, and ever, and ever, and ever...
21-
22-
end;
23-
end.
1+
program WhileLoop_Example;
2+
3+
var
4+
Counter: Integer;
5+
6+
begin
7+
Counter := 1; // First we have to tell Simba what Counter equals :-)
8+
9+
// Let's conver this to English:
10+
// - While the Counter variable is less than or equal to 10, do the following...
11+
while (Counter <= 10) do
12+
begin
13+
Writeln('Counter = ' + IntToStr(Counter));
14+
15+
Counter := Counter + 1; // This needs to be in place to tell Simba to
16+
// - increase the variable 'Counter' by 1 (one).
17+
// Because if we don't, then 'Counter' will
18+
// - always equal 1, and it will always be
19+
// - less than 10. So this while loop will keep
20+
// - going forever, and ever, and ever, and ever...
21+
22+
end;
23+
end.

Examples/Algorithms/Average.simba

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
{
2-
NOTE: Things in the examples representing algorithms may contain the number
3-
'2' appending the name. This is because this method is already offered
4-
by Simba and is readily available. It is therefore recommended to not
5-
recreate the created (for speed, etc).
6-
7-
SECOND NOTE: In the case of this example method implementation, 'AverageTIA'
8-
and 'AverageExtended' exist in Simba.
9-
}
10-
11-
//Returns the average of TFP.
12-
function Average(TEA: TExtendedArray): Extended;
13-
var
14-
i, bI: Integer;
15-
begin
16-
Result := 0.0;
17-
bI := High(TEA);
18-
for i := 0 to bI do
19-
Result := Result + TEA[i];
20-
Result := Result / (bI + 1.0);
21-
end;
22-
23-
begin
24-
Writeln(Average([5.1, -4.2, 1.2, 3, 5, 1.1, 24.95, 1.95]));
25-
end.
1+
{
2+
NOTE: Things in the examples representing algorithms may contain the number
3+
'2' appending the name. This is because this method is already offered
4+
by Simba and is readily available. It is therefore recommended to not
5+
recreate the created (for speed, etc).
6+
7+
SECOND NOTE: In the case of this example method implementation, 'AverageTIA'
8+
and 'AverageExtended' exist in Simba.
9+
}
10+
11+
//Returns the average of TFP.
12+
function Average(TEA: TExtendedArray): Extended;
13+
var
14+
i, bI: Integer;
15+
begin
16+
Result := 0.0;
17+
bI := High(TEA);
18+
for i := 0 to bI do
19+
Result := Result + TEA[i];
20+
Result := Result / (bI + 1.0);
21+
end;
22+
23+
begin
24+
Writeln(Average([5.1, -4.2, 1.2, 3, 5, 1.1, 24.95, 1.95]));
25+
end.

Examples/Algorithms/BubbleSort.simba

+38-38
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
{
2-
NOTE: Things in the examples representing algorithms may contain the number
3-
'2' appending the name. This is because this method is already offered
4-
by Simba and is readily available. It is therefore recommended to not
5-
recreate the created (for speed, etc).
6-
}
7-
8-
//Sorts an array of Integers (TIA) using the bubble sorting algorithm in
9-
//ascending order (Lowest to Highest).
10-
procedure BubbleSort2(var TIA: TIntegerArray);
11-
var
12-
i, bI, TMP: Integer;
13-
UnSorted: Boolean;
14-
begin
15-
UnSorted := True;
16-
bI := High(TIA);
17-
while (UnSorted) do
18-
begin
19-
UnSorted := False;
20-
for i := bI downto 1 do
21-
if(TIA[i] < TIA[i - 1]) then
22-
begin
23-
TMP := TIA[i];
24-
TIA[i] := TIA[i - 1];
25-
TIA[i - 1] := TMP;
26-
UnSorted := True;
27-
end;
28-
end;
29-
end;
30-
31-
var
32-
UnsortedArray: TIntegerArray;
33-
34-
begin
35-
UnsortedArray := [5, 1, 23, -3, 9, -7];
36-
BubbleSort2(UnsortedArray);
37-
Writeln(UnsortedArray); // Well, now the SortedArray :-P
38-
end.
1+
{
2+
NOTE: Things in the examples representing algorithms may contain the number
3+
'2' appending the name. This is because this method is already offered
4+
by Simba and is readily available. It is therefore recommended to not
5+
recreate the created (for speed, etc).
6+
}
7+
8+
//Sorts an array of Integers (TIA) using the bubble sorting algorithm in
9+
//ascending order (Lowest to Highest).
10+
procedure BubbleSort2(var TIA: TIntegerArray);
11+
var
12+
i, bI, TMP: Integer;
13+
UnSorted: Boolean;
14+
begin
15+
UnSorted := True;
16+
bI := High(TIA);
17+
while (UnSorted) do
18+
begin
19+
UnSorted := False;
20+
for i := bI downto 1 do
21+
if(TIA[i] < TIA[i - 1]) then
22+
begin
23+
TMP := TIA[i];
24+
TIA[i] := TIA[i - 1];
25+
TIA[i - 1] := TMP;
26+
UnSorted := True;
27+
end;
28+
end;
29+
end;
30+
31+
var
32+
UnsortedArray: TIntegerArray;
33+
34+
begin
35+
UnsortedArray := [5, 1, 23, -3, 9, -7];
36+
BubbleSort2(UnsortedArray);
37+
Writeln(UnsortedArray); // Well, now the SortedArray :-P
38+
end.

Examples/Algorithms/Distance.simba

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
{
2-
NOTE: Things in the examples representing algorithms may contain the number
3-
'2' appending the name. This is because this method is already offered
4-
by Simba and is readily available. It is therefore recommended to not
5-
recreate the created (for speed, etc).
6-
}
7-
8-
//Returns the distance between x1, y1 and x2, y2.
9-
function Distance2(x1, y1, x2, y2: Integer): Integer;
10-
begin
11-
Result:= Round(Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
12-
end;
13-
14-
begin
15-
Writeln(Distance2(5, 5, 15, 15));
16-
end.
1+
{
2+
NOTE: Things in the examples representing algorithms may contain the number
3+
'2' appending the name. This is because this method is already offered
4+
by Simba and is readily available. It is therefore recommended to not
5+
recreate the created (for speed, etc).
6+
}
7+
8+
//Returns the distance between x1, y1 and x2, y2.
9+
function Distance2(x1, y1, x2, y2: Integer): Integer;
10+
begin
11+
Result:= Round(Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)));
12+
end;
13+
14+
begin
15+
Writeln(Distance2(5, 5, 15, 15));
16+
end.

0 commit comments

Comments
 (0)