summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2016-05-05 14:59:28 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2016-05-05 14:59:28 +0200
commit3405b0c1635843cbb81f042364bfcf238d7dc930 (patch)
tree39501fec9ec72863c929a45dbc297412bbf90688 /src/pervasive.h
parentc28bb6d31a122ec983e1e0a0dd1a8bd198098c58 (diff)
Adds the current code.
It's been running for close to a month on one of the IRC channels I frequent and seems to be working fine. One should be aware that, among other missing features, this version does not store permanently what the bot learns. Indeed, I am currently using a file with 431848 lines as its initial knowledge bank, making this particular feature not a high priority one. Also consider the fact that Zero of One converts text to underscore before reading it but will not change its own aliases. This could potentially be a cause for surprises when using uppercase letters in the latter.
Diffstat (limited to 'src/pervasive.h')
-rw-r--r--src/pervasive.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/pervasive.h b/src/pervasive.h
new file mode 100644
index 0000000..d2b0344
--- /dev/null
+++ b/src/pervasive.h
@@ -0,0 +1,59 @@
+#ifndef _ZoO_PERVASIVE_H_
+#define _ZoO_PERVASIVE_H_
+
+#include <limits.h>
+
+#ifndef ZoO_NETWORK_TIMEOUT
+ #define ZoO_NETWORK_TIMEOUT 200
+#endif
+
+#ifndef ZoO_MAX_REPLY_WORDS
+ #define ZoO_MAX_REPLY_WORDS 64
+#endif
+
+#ifndef ZoO_DEFAULT_DATA_FILENAME
+ #define ZoO_DEFAULT_DATA_FILENAME "./memory.txt"
+#endif
+
+#ifndef ZoO_DEFAULT_IRC_SERVER_ADDR
+ #define ZoO_DEFAULT_IRC_SERVER_ADDR "irc.foonetic.net"
+#endif
+
+#ifndef ZoO_DEFAULT_IRC_SERVER_PORT
+ #define ZoO_DEFAULT_IRC_SERVER_PORT "6667"
+#endif
+
+#ifndef ZoO_DEFAULT_IRC_SERVER_CHANNEL
+ #define ZoO_DEFAULT_IRC_SERVER_CHANNEL "#theborghivemind"
+#endif
+
+#ifndef ZoO_DEFAULT_IRC_USERNAME
+ #define ZoO_DEFAULT_IRC_USERNAME "zeroofone"
+#endif
+
+#ifndef ZoO_DEFAULT_IRC_REALNAME
+ #define ZoO_DEFAULT_IRC_REALNAME "Zero of One (bot)"
+#endif
+
+#ifndef ZoO_DEFAULT_REPLY_RATE
+ #define ZoO_DEFAULT_REPLY_RATE 8
+#endif
+
+typedef unsigned int ZoO_index;
+#define ZoO_INDEX_MAX UINT_MAX
+
+/* ZoO_char = UTF-8 char */
+typedef char ZoO_char;
+/* Functions that can handle UTF-8 'char' will use this symbol. */
+#define ZoO_CHAR_STRING_SYMBOL "%s"
+
+#define ZoO__TO_STRING(x) #x
+#define ZoO_TO_STRING(x) ZoO__TO_STRING(x)
+#define ZoO_ISOLATE(a) do {a} while (0)
+
+/* strncmp stops at '\0' and strlen does not count '\0'. */
+#define ZoO_IS_PREFIX(a, b) (strncmp(a, b, strlen(a)) == 0)
+
+#define ZoO_STRING_EQUALS(a, b) (strcmp(a, b) == 0)
+
+#endif