Skip to content

Commit

Permalink
Merge pull request #817 from fesch/bugfix
Browse files Browse the repository at this point in the history
Version 3.30-05 candidate
  • Loading branch information
fesch authored Feb 17, 2020
2 parents cba802a + ad7eaa0 commit 943772a
Show file tree
Hide file tree
Showing 74 changed files with 2,141 additions and 1,295 deletions.
4 changes: 2 additions & 2 deletions buildapp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
name="Structorizer"
displayname="Structorizer"
identifier="lu.fisch.Structorizer"
shortversion="3.30-04"
version="3.30-04"
shortversion="3.30-05"
version="3.30-05"
icon="icons/Structorizer.icns"
mainclassname="Structorizer"
copyright="Bob Fisch"
Expand Down
17 changes: 3 additions & 14 deletions samples/export/C#/ELIZA_2.3.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by Structorizer 3.30-03
// Generated by Structorizer 3.30-05
//
// Copyright (C) 2018-05-14 Kay Gürtzig
// License: GPLv3-link
Expand All @@ -25,17 +25,6 @@
/// </summary>
public class ELIZA {













// histArray contains the most recent user replies as ring buffer;
// histIndex is the index where the next reply is to be stored (= index of the oldest
Expand Down Expand Up @@ -327,13 +316,13 @@ private static int[] findKeyword(const array of KeyMapEntry keyMap, string sente
/// <return> TODO </return>
private static string normalizeInput(string sentence) {
// TODO: Check and accomplish variable declarations:
string symbol;
char symbol;
string result;
int position;


sentence = lowercase(sentence);
foreach (String symbol in new String[]{'.', ',', ';', '!', '?'}) {
foreach (char symbol in new char[]{'.', ',', ';', '!', '?'}) {
position = pos(symbol, sentence);
while (position > 0) {
sentence = copy(sentence, 1, position-1) + copy(sentence, position+1, length(sentence));
Expand Down
38 changes: 1 addition & 37 deletions samples/export/C#/TextDemo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by Structorizer 3.30-03
// Generated by Structorizer 3.30-05
//
// Copyright (C) 2019-10-10 Kay Gürtzig
// License: GPLv3-link
Expand All @@ -18,42 +18,6 @@
/// </summary>
public class TextDemo {







































/// <param name="args"> array of command line arguments </param>
Expand Down
4 changes: 2 additions & 2 deletions samples/export/C++/ELIZA_2.3.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by Structorizer 3.30-03
// Generated by Structorizer 3.30-05
//
// Copyright (C) 2018-05-14 Kay Gürtzig
// License: GPLv3-link
Expand Down Expand Up @@ -183,7 +183,7 @@ int[2] findKeyword(const array of KeyMapEntry keyMap, string sentence)
string normalizeInput(string sentence)
{
// TODO: Check and accomplish variable declarations:
string symbol;
char symbol;
string result;
int position;

Expand Down
90 changes: 53 additions & 37 deletions samples/export/C/ELIZA_2.3.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// program ELIZA
// Generated by Structorizer 3.30-03
// Generated by Structorizer 3.30-05
//
// Copyright (C) 2018-05-14 Kay Gürtzig
// License: GPLv3-link
Expand Down Expand Up @@ -56,10 +56,10 @@ char* adjustSpelling(char* sentence)
insert(uppercase(start), result, 1);
}
{
char* array324bf690[2] = {" i ", " i\'"};
int index324bf690;
for (index324bf690 = 0; index324bf690 < 2; index324bf690++) {
char* word = array324bf690[index324bf690];
char* array6bb5b405[2] = {" i ", " i\'"};
int index6bb5b405;
for (index6bb5b405 = 0; index6bb5b405 < 2; index6bb5b405++) {
char* word = array6bb5b405[index6bb5b405];
position = pos(word, result);
while (position > 0) {
delete(result, position+1, 1);
Expand Down Expand Up @@ -91,13 +91,14 @@ bool checkGoodBye(char* text, char* phrases[][2])

{
// TODO: Find out and fill in the number of elements of the array phrases here!
int count14015767 = ???;
int index14015767;
for (index14015767 = 0; index14015767 < count14015767; index14015767++) {
char* pair[] = phrases[index14015767];
int count23872844 = ???;
int index23872844;
for (index23872844 = 0; index23872844 < count23872844; index23872844++) {
char* pair[] = phrases[index23872844];
if (pos(pair[0], text) > 0) {
saidBye = true;
printf("TODO: specify format\n", pair[1]);
// TODO: check format specifiers, replace all '?'!
printf("%?\n", pair[1]);
return true;
}
}
Expand Down Expand Up @@ -146,10 +147,10 @@ char* conjugateStrings(char* sentence, char* key, int keyPos, char* flexions[][2
result = " " + copy(sentence, keyPos + length(key), length(sentence)) + " ";
{
// TODO: Find out and fill in the number of elements of the array flexions here!
int count6e7cbe69 = ???;
int index6e7cbe69;
for (index6e7cbe69 = 0; index6e7cbe69 < count6e7cbe69; index6e7cbe69++) {
char* pair[] = flexions[index6e7cbe69];
int countb7edb3b = ???;
int indexb7edb3b;
for (indexb7edb3b = 0; indexb7edb3b < countb7edb3b; indexb7edb3b++) {
char* pair[] = flexions[indexb7edb3b];
left = "";
right = result;
position = pos(pair[0], right);
Expand Down Expand Up @@ -221,10 +222,10 @@ char* normalizeInput(char* sentence)

sentence = lowercase(sentence);
{
char arrayb4f79f[5] = {'.', ',', ';', '!', '?'};
int indexb4f79f;
for (indexb4f79f = 0; indexb4f79f < 5; indexb4f79f++) {
char symbol = arrayb4f79f[indexb4f79f];
char array4fb2597d[5] = {'.', ',', ';', '!', '?'};
int index4fb2597d;
for (index4fb2597d = 0; index4fb2597d < 5; index4fb2597d++) {
char symbol = array4fb2597d[index4fb2597d];
position = pos(symbol, sentence);
while (position > 0) {
sentence = copy(sentence, 1, position-1) + copy(sentence, position+1, length(sentence));
Expand All @@ -240,7 +241,7 @@ char* normalizeInput(char* sentence)
// function setupGoodByePhrases(): array of array[0..1] of string
// TODO: Revise the return type and declare the parameters.
// C does not permit to return arrays - find an other way to pass the result!
char*[][2] setupGoodByePhrases()
char*[][2] setupGoodByePhrases(void)
{
// TODO: Check and accomplish variable declarations:
char* phrases[][2];
Expand All @@ -259,7 +260,7 @@ char*[][2] setupGoodByePhrases()
// reply ring as defined in `setupReplies()´.
// TODO: Revise the return type and declare the parameters.
// C does not permit to return arrays - find an other way to pass the result!
KeyMapEntry[] setupKeywords()
KeyMapEntry[] setupKeywords(void)
{
// TODO: Check and accomplish variable declarations:
// The empty key string (last entry) is the default clause - will always be found
Expand Down Expand Up @@ -354,7 +355,7 @@ KeyMapEntry[] setupKeywords()
// Returns an array of pairs of mutualy substitutable
// TODO: Revise the return type and declare the parameters.
// C does not permit to return arrays - find an other way to pass the result!
char*[][2] setupReflexions()
char*[][2] setupReflexions(void)
{
// TODO: Check and accomplish variable declarations:
char* reflexions[][2];
Expand Down Expand Up @@ -389,7 +390,7 @@ char*[][2] setupReflexions()
// in `setupMapping()´
// TODO: Revise the return type and declare the parameters.
// C does not permit to return arrays - find an other way to pass the result!
char*[][/*???*/] setupReplies()
char*[][/*???*/] setupReplies(void)
{
// TODO: Check and accomplish variable declarations:
char* setupReplies[][/*???*/];
Expand Down Expand Up @@ -569,18 +570,30 @@ int main(void)
// http://en.wikipedia.org/wiki/Printf#printf_format_placeholders

// Title information
printf("TODO: specify format\n", "************* ELIZA **************");
printf("TODO: specify format\n", "* Original design by J. Weizenbaum");
printf("TODO: specify format\n", "**********************************");
printf("TODO: specify format\n", "* Adapted for Basic on IBM PC by");
printf("TODO: specify format\n", "* - Patricia Danielson");
printf("TODO: specify format\n", "* - Paul Hashfield");
printf("TODO: specify format\n", "**********************************");
printf("TODO: specify format\n", "* Adapted for Structorizer by");
printf("TODO: specify format\n", "* - Kay Gürtzig / FH Erfurt 2016");
printf("TODO: specify format\n", "* Version: 2.3 (2019-11-28)");
printf("TODO: specify format\n", "* (Requires at least Structorizer 3.30-03 to run)");
printf("TODO: specify format\n", "**********************************");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "************* ELIZA **************");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "* Original design by J. Weizenbaum");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "**********************************");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "* Adapted for Basic on IBM PC by");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "* - Patricia Danielson");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "* - Paul Hashfield");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "**********************************");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "* Adapted for Structorizer by");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "* - Kay Gürtzig / FH Erfurt 2016");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "* Version: 2.3 (2019-11-28)");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "* (Requires at least Structorizer 3.30-03 to run)");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "**********************************");
// Stores the last five inputs of the user in a ring buffer,
// the second component is the rolling (over-)write index.
history.histArray[0] = "";
Expand All @@ -592,9 +605,11 @@ int main(void)
offsets[length(keyMap)-1] = 0;
isGone = false;
// Starter
printf("TODO: specify format\n", "Hi! I\'m your new therapist. My name is Eliza. What\'s your problem?");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "Hi! I\'m your new therapist. My name is Eliza. What\'s your problem?");
do {
scanf("TODO: specify format", &userInput);
// TODO: check format specifiers, replace all '?'!
scanf("%s", userInput);
// Converts the input to lowercase, cuts out interpunctation
// and pads the string
// Converts the input to lowercase, cuts out interpunctation
Expand Down Expand Up @@ -632,7 +647,8 @@ int main(void)
}
reply = adjustSpelling(reply);
}
printf("TODO: specify format\n", reply);
// TODO: check format specifiers, replace all '?'!
printf("%s\n", reply);
}
} while (!(isGone));

Expand Down
17 changes: 11 additions & 6 deletions samples/export/C/SORTING_TEST_MAIN.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// program SORTING_TEST_MAIN
// Generated by Structorizer 3.30-03
// Generated by Structorizer 3.30-05
//
// Copyright (C) 2019-10-02 Kay Gürtzig
// License: GPLv3-link
Expand Down Expand Up @@ -281,10 +281,12 @@ int main(void)
// http://en.wikipedia.org/wiki/Printf#printf_format_placeholders

do {
scanf("TODO: specify format", &elementCount);
// TODO: check format specifiers, replace all '?'!
scanf("%?", &elementCount);
} while (!(elementCount >= 1));
do {
printf("Filling: 1 = random, 2 = increasing, 3 = decreasing"); scanf("TODO: specify format", &modus);
// TODO: check format specifiers, replace all '?'!
printf("Filling: 1 = random, 2 = increasing, 3 = decreasing"); scanf("%?", &modus);
} while (!(modus == 1 || modus == 2 || modus == 3));
for (i = 0; i <= elementCount-1; i += (1)) {
switch (modus) {
Expand Down Expand Up @@ -342,16 +344,19 @@ int main(void)
if (! ok1 || ! ok2 || ! ok3) {
for (i = 0; i <= elementCount-1; i += (1)) {
if (values1[i] != values2[i] || values1[i] != values3[i]) {
printf("TODO: specify format\n", "Difference at [", i, "]: ", values1[i], " <-> ", values2[i], " <-> ", values3[i]);
// TODO: check format specifiers, replace all '?'!
printf("%s%d%s%?%s%?%s%?\n", "Difference at [", i, "]: ", values1[i], " <-> ", values2[i], " <-> ", values3[i]);
}
}
}
do {
printf("Show arrays (yes/no)?"); scanf("TODO: specify format", &show);
// TODO: check format specifiers, replace all '?'!
printf("Show arrays (yes/no)?"); scanf("%?", &show);
} while (!(show == "yes" || show == "no"));
if (show == "yes") {
for (i = 0; i <= elementCount - 1; i += (1)) {
printf("TODO: specify format\n", "[", i, "]:\t", values1[i], "\t", values2[i], "\t", values3[i]);
// TODO: check format specifiers, replace all '?'!
printf("%s%d%s%?%s%?%s%?\n", "[", i, "]:\t", values1[i], "\t", values2[i], "\t", values3[i]);
}
}

Expand Down
14 changes: 9 additions & 5 deletions samples/export/C/TextDemo.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// program TextDemo
// Generated by Structorizer 3.30-03
// Generated by Structorizer 3.30-05
//
// Copyright (C) 2019-10-10 Kay Gürtzig
// License: GPLv3-link
Expand Down Expand Up @@ -1280,20 +1280,24 @@ int main(void)
// For any output using the 'printf' function you need to fill the first argument:
// http://en.wikipedia.org/wiki/Printf#printf_format_placeholders

printf("TODO: specify format\n", "This is a demo program for text writing with Turleizer.");
// TODO: check format specifiers, replace all '?'!
printf("%s\n", "This is a demo program for text writing with Turleizer.");
showTurtle();
penDown();
y = 0;
do {
printf("Enter some text (empty string to exit)"); scanf("TODO: specify format", &text);
// TODO: check format specifiers, replace all '?'!
printf("Enter some text (empty string to exit)"); scanf("%?", &text);
// Make sure the content is interpreted as string
text = "" + text;
if (text != "") {
do {
printf("Height of the text (pixels)"); scanf("TODO: specify format", &height);
// TODO: check format specifiers, replace all '?'!
printf("Height of the text (pixels)"); scanf("%?", &height);
} while (!(height >= 5));
do {
printf("Colour (1=black, 2=red, 3=yellow, 4=green, 5=cyan, 6=blue, 7=pink, 8=gray, 9=orange, 10=violet)"); scanf("TODO: specify format", &colour);
// TODO: check format specifiers, replace all '?'!
printf("Colour (1=black, 2=red, 3=yellow, 4=green, 5=cyan, 6=blue, 7=pink, 8=gray, 9=orange, 10=violet)"); scanf("%?", &colour);
} while (!(colour >= 1 && colour <= 10));
y = y + height + 2;
gotoXY(0, y - 2);
Expand Down
6 changes: 3 additions & 3 deletions samples/export/Java/ELIZA_2.3.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by Structorizer 3.30-03
// Generated by Structorizer 3.30-05
//
// Copyright (C) 2018-05-14 Kay Gürtzig
// License: GPLv3-link
Expand Down Expand Up @@ -316,13 +316,13 @@ private static int[] findKeyword(final array of KeyMapEntry keyMap, String sente
*/
private static String normalizeInput(String sentence) {
// TODO: Check and accomplish variable declarations:
String symbol;
char symbol;
String result;
int position;


sentence = lowercase(sentence);
for (String symbol : new String[]{'.', ',', ';', '!', '?'}) {
for (char symbol : new char[]{'.', ',', ';', '!', '?'}) {
position = pos(symbol, sentence);
while (position > 0) {
sentence = copy(sentence, 1, position-1) + copy(sentence, position+1, length(sentence));
Expand Down
2 changes: 1 addition & 1 deletion samples/export/Java/TextDemo.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated by Structorizer 3.30-03
// Generated by Structorizer 3.30-05
//
// Copyright (C) 2019-10-10 Kay Gürtzig
// License: GPLv3-link
Expand Down
Loading

0 comments on commit 943772a

Please sign in to comment.