From e336174d3d359ec623b2643cda9de36d33db42c2 Mon Sep 17 00:00:00 2001
From: GeneralGuy4872
Date: Sun, 6 Oct 2019 22:53:20 -0500
Subject: [PATCH] OVERHAUL use perl
---
.gitattributes | 36 +-
README.md | 166 +++----
depricated/crossfire/extensionlang.lex | 235 ++++++++++
depricated/crossfire/extensionlang.y | 407 ++++++++++++++++++
.../crossfire}/precedanceprelim | 0
depricated/perlpp.sh | 36 ++
manual/bsd/man3p/goeshere | 2 +
manual/html/style.css | 24 +-
manual/linux/man3p/goeshere | 2 +
manual/pod/goeshere | 2 +
src/extensionlanguage/docprelim | 31 --
src/extensionlanguage/dummy_extensionlang.h | 1 -
src/extensionlanguage/extensionlang.lex | 170 --------
src/extensionlanguage/extensionlang.y | 312 --------------
src/extensionlanguage/runtime.h | 49 ---
src/greedy/astar.c | 98 ++---
src/greedy/dijkstra.c | 96 ++---
src/greedy/greedy.messy | 102 ++---
src/iwannaflycurses.messy | 242 ++++-------
src/macro.h | 113 +++++
src/modules/IWannaFly/Macro.pm | 52 +++
src/modules/IWannaFly/Main.pm | 140 ++++++
src/modules/IWannaFly/Null.pm | 13 +
.../Types/Struct/classtyp/XSLIB/classtyp.xs | 60 +++
.../Types/Struct/classtyp/classtyp.pm | 33 ++
src/modules/IWannaFly/Types/XSLIB/free.xs | 12 +
src/modules/IWannaFly/Types/free.pm | 19 +
src/paths.h | 2 +
28 files changed, 1494 insertions(+), 961 deletions(-)
create mode 100644 depricated/crossfire/extensionlang.lex
create mode 100644 depricated/crossfire/extensionlang.y
rename {src/extensionlanguage => depricated/crossfire}/precedanceprelim (100%)
create mode 100644 depricated/perlpp.sh
create mode 100644 manual/bsd/man3p/goeshere
create mode 100644 manual/linux/man3p/goeshere
create mode 100644 manual/pod/goeshere
delete mode 100644 src/extensionlanguage/docprelim
delete mode 100644 src/extensionlanguage/dummy_extensionlang.h
delete mode 100644 src/extensionlanguage/extensionlang.lex
delete mode 100644 src/extensionlanguage/extensionlang.y
delete mode 100644 src/extensionlanguage/runtime.h
create mode 100644 src/macro.h
create mode 100644 src/modules/IWannaFly/Macro.pm
create mode 100644 src/modules/IWannaFly/Main.pm
create mode 100644 src/modules/IWannaFly/Null.pm
create mode 100644 src/modules/IWannaFly/Types/Struct/classtyp/XSLIB/classtyp.xs
create mode 100644 src/modules/IWannaFly/Types/Struct/classtyp/classtyp.pm
create mode 100644 src/modules/IWannaFly/Types/XSLIB/free.xs
create mode 100644 src/modules/IWannaFly/Types/free.pm
diff --git a/.gitattributes b/.gitattributes
index 489990b..d737ede 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -11,31 +11,38 @@ core.autocrlf=false
*.hh = linguist-language=C++
*.m = linguist-language=Objective-C
*.mm = linguist-language=Objective-C++
-*.m4 = linguist-language=M4
+# *.xs = linguist-language=XS
+# *.m4 = linguist-language=M4
+# *.gpp = linguist-language=GPP
# *.pas = linguist-language=Pascal
# *.p = linguist-language=Pascal
# *.pp = linguist-language=Pascal
-*.a68 = linguist-language=Algol
-*.icn = linguist-language=icon
-*.u = linguist-language=unicon
+# *.a68 = linguist-language=Algol
+# *.icn = linguist-language=icon
+# *.u = linguist-language=unicon
# *.awk = linguist-language=Awk
-*.pl = linguist-language=Perl
-*.cl = linguist-language=Lisp
-*.scm = linguist-language=Scheme
-*.sno = linguist-language=SNOBOL4
+# *.pl = linguist-language=Perl
+# *.pm = linguist-language=Perl
+# *.PL = linguist-language=Perl
+# *.cl = linguist-language=Lisp
+*.clp = linguist-language=Lisp
+# *.scm = linguist-language=Scheme
+# *.sno = linguist-language=SNOBOL4
# *.bas = linguist-language=BASIC
-*.apl = linguist-language=APL
+# *.apl = linguist-language=APL
# *.fth = linguist-language=forth
-*.asm = linguist-language=assembly
+# *.asm = linguist-language=assembly
# *.lua = linguist-language=lua
# *.py = linguist-language=python
# *.js = linguist-language=javascript
# *.sh = linguist-language=Shell
# *.lex = linguist-language=Lex
# *.y = linguist-language=Yacc
+*.yp = linguist-language=Yacc
make = linguist-language=makefile
-*.cmake = linguist-language=CMake
-CMakeLists.txt = linguist-language=CMake
+# *.mk = linguist-language=makefile
+# *.cmake = linguist-language=CMake
+# CMakeLists.txt = linguist-language=CMake
# *.ini = linguist-language=INI
# *.tab = linguist-language=tsv
# *.tsv = linguist-language=tsv
@@ -49,7 +56,7 @@ CMakeLists.txt = linguist-language=CMake
# *.html = linguist-language=HTML
# *.css = linguist-language=CSS
# *.sgml = linguist-language=SGML
-*.sgml.* = linguist-language=SGML
+# *.sgml.* = linguist-language=SGML
*.txt = linguist-language=text
*.hex = binary diff
*.bin = binary diff
@@ -60,7 +67,6 @@ CMakeLists.txt = linguist-language=CMake
*.tar = binary diff
*.tar.* = binary diff
*.midi = binary diff
-*.nfo = binary linguist-language=text linguist-vendored=false linguist-documentation=false linguist-detectable=true diff
+*.nfo = binary linguist-language=text diff
*.dump = linguist-language=unknown
-*.iwfcext = linguist-language=unknown
*.midibas = linguist-language=unknown
diff --git a/README.md b/README.md
index 32e8ec5..ba574d6 100644
--- a/README.md
+++ b/README.md
@@ -14,105 +14,111 @@
Iwannafly
=========
-*roguelike game with plugin interface written in C useing minimal propagating dependencies*
+*roguelike game library written in C and Perl with extension interface useing minimal external propagating dependencies*
Dependencies:
-(listed by file to be distro-independent)
Build Deps:
-- cp
-- ls
-- sh
-- cc
-- ld
-- sed
maybe?
-- awk
maybe?
-- perl
maybe?
-- flex
-- byacc
-- make
+- Command cp
+- Command ls
+- Command sh
+- Command cc
+- Command ld
+- Command sed
+- Command awk
(maybe?)
+- Command perl
+- Command flex
+- Command byacc
+- Command make
+- Perl module ExtUtils::MakeMaker
Build Recommends:
-- uname
-- grep
-- sed
-
-Depends (libraries by header):
-- \
-- \
-- \
-- \
-- \
-- \
-- \
-- \
-- \
-- \
-- \
-- \
-- \
-- \
-- \
probably
-- \
probably
-- \
maybe?
-- \
maybe?
-- \
probably
-- \
probably
-- \<\CODE> maybe?
-- \
-- \
-- \
-- \
-- \
maybe?
-- \
maybe?
+- Command uname
+- Command cpan
+
+Depends:
+- UTF-8 Console Support
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
(probably)
+- C library \
(probably)
+- C library \
(maybe?)
+- C library \
(maybe?)
+- C library \
(probably)
+- C library \
(probably)
+- C library \
(maybe?)
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
+- C library \
(maybe?)
+- C library \
(maybe?)
+- C library \
+- C library \
+- C library "XSUB.h"
+- C library "INLINE.h"
+- Perl feature "switch"
+- Perl module Safe
+- Perl module boolean
+- Perl module Exporter
+- Perl module optimize::int
+- Perl module Test::Simple
+- Perl module Test::Type
+- Perl module Scalar::Util
+- Perl module Hash::Util
+- Perl module FastGlob
(maybe?)
+- Perl module goto::file
+- Perl module JSON
+- Perl module Config::Tiny
+- Perl module IO::Pipe
(maybe?)
+- Perl module IO::Pty
(possibly?)
+- Perl module Filter::Simple
+- Perl module Tie::File
+- Perl module (XS
|Dyna
)Loader
+- Perl module Inline
'C'
+- Perl module POSIX::
(ceil
|floor
)
+- Perl module Acme::don't
(no-ops during testing)
Recommends:
-- xterm
, unicode, color
-- /usr/share/fonts/X11/misc/6x13.\*
- - aka -Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO10646-1
-
-Devkit Suggests:
-- m4
-- gpp
-- sed
|| awk
|| perl
-- emacs
|| vim
+- Command xterm
(UTF-8, Color)
+- Font -Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO10646-1
Doc Depends:
-- man
-- info
+- Command man
+- Command info
Doc Build Deps:
-- mandb
-- makeinfo
-- install-info
-- cp
+- Command mandb
+- Command makeinfo
+- Command install-info
+- Command cp
Doc Recommends:
-- xdvi
-
-Obfuscated C
-------------
-
-To save my poor eyes, I'm using the following macros for C builtins:
-
-- ≥
means \>=
-- ≤
means \<=
-- →
means -\>
-- forever
means for (;;)
-
-I am given to understand that using macros for functions like this
-is called "obfuscated C"
+- Command xdvi
NEWS (and Olds)
---------------
During Alpha, the project will be optemized for Devuan Linux, however,
there are (theoretically) no distro-dependent elements, and the code should
-run on ANY \*nix with properly fufilled dependancies by configuring paths.h
-
-Manpages will be provided in Linux's ROFF-man and BSD's ROFF-mdoc;
-the documentation installed will be determined by uname
.
-Extended documentation will be provided in plaintext, Texinfo, and HTML
+Dependencies:
-Lore can be found at my Neocities site: https://generalguy4872.neocities.org/Games/
+Build Deps:
+- Command cp
+- Command ls
+- Command sh
+- Command cc
diff --git a/depricated/crossfire/extensionlang.lex b/depricated/crossfire/extensionlang.lex
new file mode 100644
index 0000000..253e6f7
--- /dev/null
+++ b/depricated/crossfire/extensionlang.lex
@@ -0,0 +1,235 @@
+BOOLEAN ("[Tt]("RUE"|"rue")|[Ff]("ALSE"|"alse"))
+NAME [A-Za-z_\xC2-\xF4][A-Za-z0-9_\x80-\xBF\xC2-\xF4]*
+LABEL [A-Za-z_\xC2-\xF4][A-Za-z0-9_\x80-\xBF\xC2-\xF4]*:
+NUMBER -?[0-9]+
+UNSIGNED \+[0-9]+
+DIGITS [0-9]+
+TAILINDEX -[1-9][0-9]*
+FLOAT -?([0-9]+)?\.[0-9]+
+NANTOK [Nn][Aa][Nn]
+INFTOK [Ii]("NF"|"nf"|"NFINITY"|"nfinity")
+UNFTOK -[Ii]("NF"|"nf"|"NFINITY"|"nfinity")
+HEX ("0x")[0-9a-fA-F]+
+OCTAL @[0-7]+
+ENDQUOTE [^\\]"
+ENDPQ [^\\]\)
+ENDPRIME [^\\]'
+TEXT [.]+
+CHAR [\0-\x7F]
+UTF8 ("\xC0\x80"|[\xC2-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF][\x80-\xBF]|[\xF0-\xF4][\x80-\xBF][\x80-\xBF][\x80-\xBF]|
+ERRVAL ([Oo][Kk]("AY"|"ay")?|[Ee]("RR"|"rr"))
+NEW [Nn]("EW"|"ew")
+FREE [Ff]("REE"|"ree")
+
+LARR ("<-"|"←")
+RARR ("->"|"→")
+BITLEFT ("<<"|"«")
+LE ("<="|"≤"|[Ll][Ee])
+LT ("<"|[Ll][Tt])
+BITRIGHT (">>"|"»")
+GE (">="|"≥"|[Gg][Ee])
+GT (">"|[Gg][Tt])
+DIFF ([Dd]("IFF"|"iff")|"⇔"|"<=>")
+LOGAND ("&&"|[Aa]("ND"|"nd"))
+LOGOR ("||"|[Oo][Rr])
+LOGNAND ("!&&"|[Nn][Aa]("ND"|"nd"))
+LOGNOR ("!||"|[Nn][Oo][Rr])
+LOGIFF ([Ii]("FF"|"ff")|"↔"|"<->")
+LOGXOR ([Ee]?[Xx][Oo][Rr])
+CMP [Cc]("MP"|"mp")
+EQ ([Ee][Qq]|"==="|"≡")
+EQUALS ("=="|[Ee]("QUAL"|"qual"))
+APPROX ("=~"|[Aa]("PPROX"|"pprox")|"≈")
+BITNOR ("~|"|"¥")
+NE ("!="|"≠"|[Nn][Ee])
+NPR [Nn][Pp][RrKk]
+NCR [Nn][Cc][RrKk]
+WHITESPACE [\a\t-\r\034- ]+
+NEWLINE [\n-\r\x1c-\x1f]+
+NULLTOK [Nn]("ULL"|"ull")
+NILTOK [Nn]("IL"|"il")
+
+QUANTUM ([Qq]("ANTUM"|"antum")|[Cc]("AT"|"at")([Aa]("LIVE"|"live")|[Dd]("EAD"|"ead")))
+CURRENT [Cc]("URRENT"|"urrent")
+SWITCH [Ss]("WITCH"|"witch")
+CASE [Cc]("ASE"|"ase")
+IF [Ii][Ff]
+IN [Ii][Nn]
+UNLESS [Uu][Nn]("LESS"|"less")
+ELSE [Ee]("LSE"|"lse")
+WHILE [Ww]("HILE"|"hile")
+UNTIL [Uu]("NTIL"|"ntil")
+FOR [Ff]("OR"|"or")
+THEN [Tt]("HEN"|"hen")
+FOREVER [Ff]("OR"|"or")[Ee]("VER"|"ver")
+FOREACH [Ff]("OR"|"or")[Ee]("ACH"|"ach")
+DO [Dd][Oo]
+ONCE [Oo]("NCE"|"nce")
+AFTER [Aa]("FTER"|"fter")
+BREAK [Bb]("REAK"|"reak")
+GOTO [Gg][Oo][Tt][Oo]
+RETURN [Rr]("ETURN"|"eturn")
+BEGIN [Bb]("EGIN"|"egin")
+END [Ee]("ND"|"nd")
+FI [Ff][Ii]
+ASSERT [Aa]("SSERT"|"ssert")
+DIE ([Dd]("IE"|"ie")|[Aa]("BORT"|"bort")|[Gg][Oo][Mm][Ff])
+EXIT ([Ee]("XIT"|"xit")|[Qq]("UIT"|"uit"))
+
+%option noyywrap
+%top{
+#include
+#include
+#include
+#include "y.tab.h"
+%}
+%s EXPR INSIDE
+%x STRING COMMENT CHARVAL TYPE SNOBOL LVALUE INITYPE SUBSCR DESTROY
+%%
+"\"" yy_push_state(STRING);
+{ENDQUOTE} yy_pop_state();
+{TEXT} yyval.string = strdup(yytext);return(CTEXT);
+
+"\`" yy_push_state(FUN);
+{NAME} yyval.string = strdup(yytext);return(FNAME);yy_pop_state();
+
+"\'" yy_push_state(CHARVAL);
+{ENDPRIME} yy_pop_state();
+{CHAR} yyval.number = *yytext;return(NUMBER);
+{UTF8} yyval.string = strdup(yytext);return(UTF8);
+
+"[" yy_push_state(SUBSCR);return '[';
+{DIGITS} yyval.deadbeef = strtoul(yytext,NULL,10);return(RAW);
+{HEX} yyval.deadbeef = strtoul(yytext,NULL,16);return(RAW);
+{OCTAL} yyval.deadbeef = strtoul(yytext,NULL,8);return(RAW);
+{TAILINDEX} yyval.number = atoi(yytext);return(TAIL);
+{NAME} yyval.string = strdup(yytext);return(NAME);
+"@" return '@';
+"(" yy_push_state(EXPR);return '(';
+"]" yy_pop_state();return ']';
+
+")>" yy_pop_state();
+"){" yy_pop_state();return(LSTRUCT);
+{NAME} yyval.string = strdup(yytext);return(TYPENAME);
+"*" return(PTR);
+"[" return '[';
+
+")>" yy_pop_state();
+{NAME} yyval.string = strdup(yytext);return(TYPENAME);
+"*" return(PTR);
+
+"<(" yy_push_state(INITYPE);
+{NAME} yyval.string = strdup(yytext);return(NAME);
+"[" return '[';
+";" yy_pop_state();return ';'
+
+{WHITESPACE} return ' ';
+{NAME} yyval.string = strdup(yytext);return(NAME);
+"$" return '$';
+";" yy_pop_state();return ';';
+
+"(" yy_push_state(EXPR);return '(';
+{WHITESPACE} return ' ';
+")" yy_pop_state();return ')';
+<0>"(" return '(';
+<0>")" return ')';
+
+"/*" yy_push_state(COMMENT);
+"/*" yy_push_state(COMMENT);
+"*/" yy_pop_state();
+{TEXT};
+
+<0,INSIDE>{LABEL} yyval.string = strdup(yytext);return(LABEL);
+{NAME} yyval.string = strdup(yytext);return(NAME);
+<0>{NAME} yyval.string = strdup(yytext);return(NAME);
+{NUMBER} yyval.number = atoi(yytext);return(NUMBER)
+{UNSIGNED} yyval.deadbeef = strtoul(yytext,NULL,10);return(RAW);
+{FLOAT} yyval.dval = atof(yytext);return(FLOAT);
+{NANTOK} yyval.dval = atof(yytext);return(NANTOK);
+{HEX} yyval.deadbeef = strtoul(yytext,NULL,16);return(RAW);
+{OCTAL} yyval.deadbeef = strtoul(yytext,NULL,8);return(RAW);
+{BOOLEAN} yyval.boolean = !(strcmp(toupper(yytext),"TRUE"));return(BOOLEAN);
+{ERRVAL} yyval.number = -(!(strcmp(toupper(yytext),"ERR"))));return(ERRVAL);
+{NULLTOK} yyval.ptr = NULL;return(NULLTOK);
+{NILTOK} yyval.string = "";return(NILTOK);
+{NANTOK} yyval.dval = NAN;return(NANTOK);
+{INFTOK} yyval.dval = HUGE_VAL;return(INFTOK);
+{UNFTOK} yyval.dval = -HUGE_VAL;return(INFTOK);
+"{" return '{';
+"}" return '}';
+"$" return '$';
+"+" return '+';
+{RARR} return(RARR);
+"-" return '-';
+"*" return '*';
+"/" return '/';
+"DICE" return 'D';
+"dice" return 'd';
+"%" return '%';
+{BITLEFT} return(BITLEFT);
+{CMP} return(CMP)
+{DIFF} return(DIFF);
+{LOGIFF} return(LOGIFF);
+{LE} return(LE);
+{LARR} yy_pop_state();return(LARR);
+"<(" yy_push_state(TYPE);
+{LT} return '<';
+{BITRIGHT} return(BITRIGHT);
+{GE} return(GE);
+{GT} return '>';
+{EQ} return(EQ);
+{EQUALS} return(EQUALS);
+{APPROX} return(APPROX);
+"=" return '=';
+{NE} return(NE);
+{NPR} return(NPR);
+{NCR} return(NCR);
+{LOGXOR} return(LOGXOR);
+{LOGNAND} return(LOGNAND);
+{LOGNOR} return(LOGNOR);
+"!!" return(LOGVAL);
+"!" return '!';
+{BITNOR} return(BITNOR);
+"~" return '~';
+"¬" return '~';
+{LOGAND} return(LOGAND);
+"&" return '&';
+{LOGOR} return(LOGOR);
+"|" return '|';
+"^" return '^';
+"?" return '?';
+":" return ':';
+<0>"S(" return 'S';
+<0>"F(" return 'F';
+"." return '.';
+";" return ';';
+"," return ',';
+"`" yy_push_state(EXPR);return'`';
+"\\" return '\\';
+{ALLOC} yy_push_state(LVALUE);return(ALLOC);
+{FREE} yy_push_state(DESTROY);return(FREE);
+{QUANTUM} return(QUANTUM);
+{SWITCH} return(SWITCH);
+{CASE} return(CASE);
+{IF} return(IF);
+{IN} return(IN);
+{UNLESS} return(UNLESS);
+{THEN} return(THEN);
+{ELSE} return(ELSE);
+{WHILE} return(WHILE);
+{UNTIL} return(UNTIL);
+{FOR} return(FOR);
+{FOREVER} return(FOREVER);
+{DO} return(DO);
+{ONCE} return(ONCE);
+{AFTER} return(AFTER);
+{BREAK} return(BREAK);
+{RETURN} return(RETURN);
+{FI} return(FI);
+<0>{BEGIN} BEGIN(INSIDE);return(BEGIN);
+{END} BEGIN(0);return(END);
+{GOTO} return(GOTO);
+{ASSERT} return(ASSERT);
+{EXIT} return(EXIT);
+{DIE} return(DIE);
+%%
diff --git a/depricated/crossfire/extensionlang.y b/depricated/crossfire/extensionlang.y
new file mode 100644
index 0000000..c8bce28
--- /dev/null
+++ b/depricated/crossfire/extensionlang.y
@@ -0,0 +1,407 @@
+%token PTR LSTRUCT LARR RARR BITLEFT LE BITRIGHT GE LOGAND LOGOR LOGNAND LOGNOR LOGIFF LOGXOR DIFF CMP EQ EQUALS APPROX BITNOR NE ALLOC FREE NULLTOK NILTOK NANTOK INFTOK UNFTOK SWITCH CASE IF UNLESS THEN ELSE WHILE UNTIL FOR FOREVER FOREACH DO ONCE AFTER BREAK GOTO RETURN FI BEGIN END DIE EXIT QUANTUM CURRENT IN ASSERT
+%token NUMBER ERRVAL TAIL
+%token RAW
+%token BOOLEAN
+%token FNAME NAME LABEL TEXT UTF8 TYPENAME NILTOK
+%token FLOAT NANTOK
+%token NULLTOK
+
+%union
+{
+ bool boolean;
+ int number;
+ char* string;
+ double dval;
+ uintptr_t deadbeef;
+ void* ptr;
+}
+
+%%
+illegal
+ : DIE
+ | atat NULLTOK
+ ;
+
+cast
+ : TYPENAME
+ | cast TYPENAME
+ ;
+
+atat
+ : '@'
+ | atat '@'
+ ;
+
+ptrptr
+ : PTR
+ | ptrptr PTR
+
+pointercast
+ : cast ptrptr
+ ;
+
+pointer
+ : pointercast variable
+ | '$' variable
+ ;
+
+arrayinit
+ : '[' ']'
+ | '[' RAW ']'
+ | arrayinit arrayinit
+ ;
+
+subscript
+ : '[' ']'
+ | '[' RAW ']'
+ | '[' TAIL ']'
+ | '[' NAME ']'
+ | '[' atat NAME ']'
+ | '[' parenth ']'
+ | '[' ']'
+ ;
+
+arraycast
+ : cast arrayinit
+ | pointercast arrayinit
+ ;
+
+arrayliteral
+ : TEXT
+ | '{' commalist '}'
+ ;
+
+array
+ : pointervariable
+ | arraycast variable
+ ;
+
+arrayfield
+ : arrayvariable subscript
+ | arrayfield subscript
+ ;
+
+structliteral
+ : cast LSTRUCT commalist '}'
+ ;
+
+structfield
+ : variable '.' NAME
+ | pointer RARR NAME
+ | variable '.' NAME
+ | pointer RARR NAME
+ | structfield '.' NAME
+ | structfield RARR NAME
+ ;
+
+anycast
+ : cast
+ | pointercast
+ | arraycast
+ ;
+
+variable
+ : NAME
+ | atat variable
+ | pointer
+ | arrayliteral
+ | array
+ | arrayfield
+ | structliteral
+ | structfield
+ ;
+
+names
+ : NAME
+ | names NAME
+ ;
+
+lvalues
+ : cast names
+ | cast ptrptr names
+ ;
+
+lvalue
+ : cast NAME
+ | cast ptrptr NAME
+ ;
+
+larray
+ : cast NAME arrayinit
+ | cast ptrptr NAME arrayinit
+ | cast '('ptrptr NAME ')' arrayinit
+ | cast ptrptr '(' ptrptr NAME ')' arrayinit
+ ;
+
+spacepointers
+ : NAME
+ | '$' NAME
+ | spacepointers ' ' NAME
+ | spacepointers ' ' '$' NAME
+ ;
+
+allocate
+ : ALLOC lvalue ':' '=' quantityliteral ';'
+ : ALLOC lvalue LARR structliteral ';'
+ | ALLOC larray LARR arrayliteral ';'
+ | ALLOC lvalues ';'
+ ;
+
+release
+ : FREE spacepointers ';'
+ ;
+
+assignment
+ : variable ':' '=' anything
+ | variable '+' '=' quantity
+ | variable '-' '=' quantity
+ | variable '*' '=' quantity
+ | variable '/' '=' quantity
+ | variable '%' '=' intergal
+ | variable BITLEFT '=' intergal
+ | variable BITRIGHT '=' intergal
+ | variable '&' '=' intergal
+ | variable '|' '=' intergal
+ | variable '~' '&' '=' intergal
+ | variable '&' '~' '=' intergal
+ | variable BITNOR '=' intergal
+ | variable '^' '=' intergal
+ | variable EQ '=' intergal
+ | variable '~' '=' intergal
+ | variable LARR array
+ ;
+ /* section complete! */
+
+anything
+ : variable
+ | itmoves
+ | verb
+ | assertion
+ | EXIT
+ ;
+
+assertion
+ : ASSERT variable
+ | ASSERT itmoves
+ | ASSERT verb
+ ;
+
+constant
+ : quantityliteral
+ | arrayliteral
+ | structliteral
+ ;
+
+quantityliteral
+ : intergaliteral
+ | FLOAT
+ | NANTOK
+ | INFTOK
+ | UNFTOK
+ ;
+
+intergaliteral
+ : NUMBER
+ | BOOLEAN
+ | RAW
+ | ERRVAL
+ | NULLTOK
+ ;
+
+random
+ : literalexpression ' ' 'D' ' ' literalexpression
+ | literalexpression ' ' 'd' ' ' literalexpression
+ | QUANTUM
+ ;
+
+literalexpression
+ : intergaliteral
+ | literalparenth
+ | literalexpression ' ' '+' ' ' literalexpression
+ | literalexpression ' ' '-' ' ' literalexpression
+ | literalexpression ' ' '*' ' ' literalexpression
+ | literalexpression ' ' '/' ' ' literalexpression
+ | literalexpression ' ' '*' '*' ' ' literalexpression
+ | literalexpression ' ' '*' '*' '*' ' ' literalexpression
+ | '!' literalexpression
+ | literalexpression '?' literalexpression ':' literalexpression
+ ;
+ /* more later
+ * these are the reducibles
+ */
+
+literalexpressionf
+ : quantityliteral
+ | literalparenth
+ | literalfparenth
+ | literalexpressionf ' ' '+' ' ' literalexpressionf
+ | literalexpressionf ' ' '-' ' ' literalexpressionf
+ | literalexpressionf ' ' '*' ' ' literalexpressionf
+ | literalexpressionf ' ' '/' ' ' literalexpressionf
+ | literalexpressionf ' ' '*' '*' ' ' literalexpressionf
+ | literalexpressionf ' ' '*' '*' '*' ' ' literalexpressionf
+ | literalexpressionf '!'
+ | literalexpression '?' literalexpression ':' literalexpression
+ ;
+
+expression
+ : anything
+ | literalexpression
+ | literalexpressionf
+ | expression ' ' '+' ' ' expression
+ | expression ' ' '-' ' ' expression
+ | expression ' ' '*' ' ' expression
+ | expression ' ' '/' ' ' expression
+ | expression ' ' '*' '*' ' ' expression
+ | expression ' ' '*' '*' '*' ' ' expression
+ | '!' expression
+ | expression '?' expression ':' expression
+ ;
+
+commalist
+ : anything ',' anything
+ | commalist ',' anything
+ ;
+
+spacelist
+ : anything ' ' anything
+ | spacelist ' ' anything
+ ;
+
+structure
+ : cast LSTRUCT commalist '}'
+ ;
+
+itmoves
+ : allocate
+ | release
+ | assignment
+ ;
+
+verb
+ : random
+ | parenth
+ | function
+ | ifthen
+ | simpleloop
+ | forloop
+ | switchtable
+ | foreach
+ ;
+
+literalparenth
+ : '(' optsp literalexpression optsp ')'
+ ;
+literalparenthf
+ : '(' optsp literalexpressionf optsp ')'
+ | literalparenth
+ ;
+
+parenth
+ : '(' optsp anything optsp ')'
+ | '(' optsp expression optsp ')'
+ | '(' optsp assignment optsp ')'
+ | '(' optsp allocate optsp ')'
+ | '(' optsp release optsp ')'
+ | literalparenth {$$ = $1}
+ ;
+
+function
+ : FNAME
+ | FNAME '{' anything '}'
+ | FNAME '{' commalist '}'
+ | '(' optsp FNAME '`' ' ' anything optsp ')'
+ | '(' optsp FNAME '`' ' ' spacelist optsp ')'
+ | '+' '+' variable
+ | '-' '-' variable
+ | variable '+' '+'
+ | variable '-' '-'
+ | anything 'D' anything
+ | anything 'd' anything
+ ;
+ /* section complete! */
+
+dostuff
+ : anything
+ | returnval
+ | BREAK
+ | dostuff ';' dostuff
+ ;
+
+snobranch
+ : ':' '(' NAME ')'
+ | ':' 'S' NAME ')'
+ | ':' 'F' NAME '('
+ | ':' 'S' NAME ')' 'F' NAME ')'
+ | ':' 'F' NAME ')' 'S' NAME ')'
+ ;
+
+subroutine
+ : BEGIN dostuff END
+ | ASSERT BEGIN dostuff END
+ | LABEL BEGIN dostuff END
+ | LABEL ASSERT BEGIN dostuff END
+ | BEGIN dostuff END snobranch
+ | ASSERT BEGIN dostuff END ':' '(' NAME ')'
+ | LABEL BEGIN dostuff END snobranch
+ | LABEL ASSERT BEGIN dostuff END ':' '(' NAME ')'
+ ;
+
+ifthen
+ : IF '(' expression ')' THEN dostuff else___
+ | UNLESS '(' expression ')' THEN dostuff else___
+ | IF '(' expression ')' THEN dostuff FI
+ | UNLESS '(' expression ')' THEN dostuff FI
+ ;
+
+else___
+ : ELSE dostuff FI {$$ = $2}
+ | ELSE ifthen {$$ = $2}
+ | FI
+ ;
+
+simpleloop
+ : WHILE '(' expression ')' DO dostuff FI {$$ = runtime__queue_while($3,$6)}
+ | UNTIL '(' expression ')' DO dostuff FI {$$ = runtime__queue_until($3,$6)}
+ | DO dostuff ONCE FI
+ | DO dostuff WHILE '(' expression ')' FI {$$ = runtime__queue_dowhile($2,$5)}
+ | DO dostuff UNTIL '(' expression ')' FI {$$ = runtime__queue_dountil($2,$5)}
+ | FOREVER DO dostuff FI {$$ = runtime__queue_forever($3)}
+ | FOREACH anycast IN array DO dostuff FI
+ ;
+
+returnval
+ : RETURN anything
+ | RETURN
+ ;
+
+fordeclare
+ : lvalues ';'
+ | lvalue ':' '=' quantityliteral ';'
+ | lvalue LARR structliteral ';'
+ | larray LARR arrayliteral ';'
+ ;
+
+forloop
+ : FOR assignment ';' WHILE '(' expression ')' DO dostuff AFTER dostuff FI
+ | FOR assignment ';' UNTIL '(' expression ')' DO dostuff AFTER dostuff FI
+ ;
+
+switchtable
+ : SWITCH variable DO caselist FI {$$ = runtime__queue_switch($2,$4)}
+ ;
+
+caseentry
+ : CASE quantity THEN dostuff FI {$$ = runtime__case($2,$4)}
+ | CASE quantity LOGOR casentry {$$ = runtime__case_multi($2,$4)}
+ ;
+
+caselist
+ : caseentry caseentry {$$ = runtime__concat_case($1,$2)}
+ | caselist caseentry {$$ = runtime__concat_case($1,$2)}
+ ;
+
+optsp
+ : /* empty */
+ | ' '
+ ;
diff --git a/src/extensionlanguage/precedanceprelim b/depricated/crossfire/precedanceprelim
similarity index 100%
rename from src/extensionlanguage/precedanceprelim
rename to depricated/crossfire/precedanceprelim
diff --git a/depricated/perlpp.sh b/depricated/perlpp.sh
new file mode 100644
index 0000000..f476166
--- /dev/null
+++ b/depricated/perlpp.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+while getopts ":I:o:" opt; do
+ case $opt in
+ I)
+ perlpp_include="$OPTARG"
+ ;;
+ p)
+ perlpp_outfile="$OPTARG"
+ ;;
+ \?)
+ echo "Invalid option -$OPTARG" >2
+ undef perpp_include
+ undef perpp_outfile
+ exit 1
+ ;;
+ esac
+done
+if [ -z "$perlpp_include" ]
+ then
+ if [ -z "$perlpp_outfile" ]
+ then
+ gpp -I $perlpp_include -o $perlpp-outfile --nostdinc --warninglevel 0 -n -U "" "" "(" "," ")" "(" ")" "♯" "" -M "♯" "\n" " " " " "\n" "" "" +c "/*" "*/" +c "//" "\n" +c "\\\n" "" +s "`" "`" "\\" +s "'" "'" "\\" +s "s(" ")" "\\"
+ else
+ gpp -I $perlpp-include --nostdinc --warninglevel 0 -U -n "" "" "(" "," ")" "(" ")" "♯" "" -M "♯" "\n" " " " " "\n" "" "" +c "/*" "*/" +c "//" "\n" +c "\\\n" "" +s "`" "`" "\\" +s "'" "'" "\\" +s "s(" ")" "\\"
+ fi
+else
+ if [ -z "$perlpp_outfile" ]
+ then
+ gpp -o $perlpp-outfile --nostdinc --warninglevel 0 -n -U "" "" "(" "," ")" "(" ")" "♯" "" -M "♯" "\n" " " " " "\n" "" "" +c "/*" "*/" +c "//" "\n" +c "\\\n" "" +s "`" "`" "\\" +s "'" "'" "\\" +s "s(" ")" "\\"
+ else
+ gpp --nostdinc --warninglevel 0 -U -n "" "" "(" "," ")" "(" ")" "♯" "" -M "♯" "\n" " " " " "\n" "" "" +c "/*" "*/" +c "//" "\n" +c "\\\n" "" +s "`" "`" "\\" +s "'" "'" "\\" +s "s(" ")" "\\"
+ fi
+fi
+undef perlpp_include
+undef perlpp_outfile
+exit 0
diff --git a/manual/bsd/man3p/goeshere b/manual/bsd/man3p/goeshere
new file mode 100644
index 0000000..66a978d
--- /dev/null
+++ b/manual/bsd/man3p/goeshere
@@ -0,0 +1,2 @@
+what goes here:
+ Perl package documentation
diff --git a/manual/html/style.css b/manual/html/style.css
index 8f73ede..baca6a7 100644
--- a/manual/html/style.css
+++ b/manual/html/style.css
@@ -30,16 +30,30 @@ pre {
display: block;
white-space: pre-wrap;
border-style: solid;
+}
+strong {
+ display: block;
+ background-color: salmon;
+ border-style: dashed;
+ border-color: red;
border-width: 1px 1px 1px 1px;
}
-.greenscreen {
+kbd {
+ display: inline;
+ font-family: monospace;
+ border-style: outset;
+ border-width: 2px 3px 3px 3px;
+}
+tt {
+ display: block;
+ white-space: pre-wrap;
+ border-style: solid;
background-color: black;
color: lime;
+ border-color: beige;
+ border-style: solid;
+ border-width: 2px 3px 2px 3px;
}
-.basic {
- background-color: mediumslateblue;
- color: snow;
-}
.oxturn {
transform: scale(-1, 1);
}
diff --git a/manual/linux/man3p/goeshere b/manual/linux/man3p/goeshere
new file mode 100644
index 0000000..36e158f
--- /dev/null
+++ b/manual/linux/man3p/goeshere
@@ -0,0 +1,2 @@
+what goes here:
+ perl package documentation
diff --git a/manual/pod/goeshere b/manual/pod/goeshere
new file mode 100644
index 0000000..b4f4b03
--- /dev/null
+++ b/manual/pod/goeshere
@@ -0,0 +1,2 @@
+what goes here:
+ documentation of perl commands
diff --git a/src/extensionlanguage/docprelim b/src/extensionlanguage/docprelim
deleted file mode 100644
index 7f994c7..0000000
--- a/src/extensionlanguage/docprelim
+++ /dev/null
@@ -1,31 +0,0 @@
-The extension language runtime executor works in the following way:
-
-1. As code is collected, literal numbers with primative operators are optimized out bottom-up
-2. remaining collected code is used to build an execution tree, top-down
-3. ALL remaining code in a BEGIN-END block is passed to the runtime, where it is then:
- executed from start to finish
- freed bottom-up
-4. each BEGIN-END block is processed thus until
-
-if code is to be transpiled instead of interpreted,
-C code could will be emitted at step 3
-instead of executing the runtime.
-
-because of how the parser is constructed, it is extreamly bulky,
-and probably always will be, even if moved away from a lex/yacc toolchain.
-(so what's the point?)
-
-to reduce it's parser overhead, a program should be broken into as many
-BEGIN-END blocks as possible, as the allocated program is flushed and
-executed after END.
-
-The parser is designed to generate calls from syntactically valid code;
-this early version cares not if this code is programatically sane, however,
-leading to the probability that untested code will crash games which call
-it in varying and spectacular fashion.
-
-aside from silently dropping invalid tokens, this language has very little
-error checking, as a result of a copious use of void*. most garbage data
-would be passed streight through to the running game, where it might catch
-in the clockwork. especially bogus data might even cause the language's
-runtime to throw hard errors.
diff --git a/src/extensionlanguage/dummy_extensionlang.h b/src/extensionlanguage/dummy_extensionlang.h
deleted file mode 100644
index 0081ea2..0000000
--- a/src/extensionlanguage/dummy_extensionlang.h
+++ /dev/null
@@ -1 +0,0 @@
-#define EXT_PARSE_VERSION "Prealpha"
\ No newline at end of file
diff --git a/src/extensionlanguage/extensionlang.lex b/src/extensionlanguage/extensionlang.lex
deleted file mode 100644
index 666de69..0000000
--- a/src/extensionlanguage/extensionlang.lex
+++ /dev/null
@@ -1,170 +0,0 @@
-BOOLEAN ("T"|[Tt]("RUE"|"rue")|[Nn]("IL"|"il")|[Ff]("ALSE"|"alse"))
- /*not lowercase t, that might be needed*/
-NAME [A-Za-z_\xC2-\xF4][A-Za-z0-9_\x80-\xBF\xC2-\xF4]*
-VAR $([A-SU-Za-z]|[A-Za-z_\xC2-\xF4][A-Za-z0-9_\x80-\xBF\xC2-\xF4]+)
-PTRVAR [\*&]+([A-SU-Za-z]|[A-Za-z_\xC2-\xF4][A-Za-z0-9_\x80-\xBF\xC2-\xF4]+)
-NUMBER -?[0-9]+
-FLOAT -?([0-9]+)?\.[0-9]+
-NANTOK (-?[Ii]("NFINITY"|"nfinity")|[Nn][Aa][Nn])
-HEX ("0x")[0-9a-fA-F]+
-OCTAL @[0-7]+
-ENDQUOTE [^\\]"
-ENDPRIME [^\\]'
-TEXT [.]+
-CHAR [\0-\x7F]
-UTF8 ("\xC0\x80"|[\xC2-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF][\x80-\xBF]|[\xF0-\xF4][\x80-\xBF][\x80-\xBF][\x80-\xBF]|
-ERRVAL ([Oo][Kk]("AY"|"ay")?|[Ee]("RR"|"rr"))
-
-STRUCTPTR ("->"|"→")
-BITLEFT ("<<"|"«")
-LE ("<="|"≤"|[Ll][Ee])
-LT ("<"|[Ll][Tt])
-BITRIGHT (">>"|"»")
-GE (">="|"≥"|[Gg][Ee])
-GT (">"|[Gg][Tt])
-LOGAND ("&&"|[Aa]("ND"|"nd"))
-LOGOR ("||"|[Oo][Rr])
-LOGNAND ("!&&"|[Nn][Aa]("ND"|"nd"))
-LOGNOR ("!||"|[Nn][Oo][Rr])
-LOGIFF ([Ii]("FF"|"ff")|"⇔"|"<>")
-LOGXOR ([Ee]?[Xx][Oo][Rr])
-EQ ([Ee][Qq]|"≡")
-EQUALS ([=][=]|[Ee]("QUAL"|"qual"))
-APPROX ("=~"|[Aa]("PPROX"|"pprox")|"≈")
-BITNOR ("~|"|"¥")
-NE ("!="|"≠"|[Nn][Ee])
-NPR [Nn][Pp][RrKk]
-NCR [Nn][Cc][RrKk]
-ASSIGN (":="|"←")
-WHITESPACE [\a\t-\r\034- ]+
-NULLTOK [Nn]("ULL"|"ull")
-
-FLIP [Ff]("LIP"|"lip")
-SWITCH [Ss]("WITCH"|witch")
-CASE [Cc]("ASE"|"ase")
-IF [Ii][Ff]
-ELSE [Ee]("LSE"|"lse")
-WHILE [Ww]("HILE"|"hile")
-UNTIL [Uu]("NTIL"|"ntil")
-FOR [Ff]("OR"|"or")
-THEN [Tt]("HEN"|"hen")
-FOREVER [Ff]("OREVER"|"orever")
-DO [Dd][Oo]
-AFTER [Aa]("FTER"|"fter")
-BREAK [Bb]("REAK"|"reak")
-RETURN [Rr]("ETURN"|"eturn")
-BEGIN [Bb]("EGIN"|"egin")
-END [Ee]("ND"|"nd")
-FI [Ff][Ii]
-
-%option noyywrap
-%top{
-#include
-#include
-#include
-#include "y.tab.h"
-%}
-%s FUNC EXPR ARR
-%x STRING COMMENT CHARVAL TYPE
-%%
-"\"" yy_push_state(STRING);
-{ENDQUOTE} yy_pop_state();
-{TEXT} yyval.string = strdup(yytext);return(TEXT);
-
-"\'" yy_push_state(CHARVAL);
-{ENDPRIME} yy_pop_state();
-{CHAR} yyval.number = *yytext;return(NUMBER);
-{UTF8} yyval.string = strdup(yytext);return(UTF8);
-
-"`" yy_push_state(TYPE);
-"`" yy_pop_state()
-"{`" yy_pop_state();return(LSTRUCT);
-{NAME} yyval.string = strdup(yytext);return(TYPENAME);
-'*' return(TYPEPTR);
-'&' return(DEREF);
-
-"/*" yy_push_state(COMMENT);
-"/*" yy_push_state(COMMENT);
-"*/" yy_pop_state();
-{TEXT};
-
-{WHITESPACE} return ' ';
-
-"(" yy_push_state(EXPR); return '(';
-")" yy_pop_state(); return ')';
-
-"{" yy_push_state(ARR); return '{';
-"}" yy_pop_state(); return '}';
-
-"[" yy_push_state(FUNC); return '[';
-"]" yy_pop_state(); return ']';
-
-{NAME} yyval.string = strdup(yytext);return(NAME);
-{VAR} yyval.string = strdup(&(yytext[1]));return(VAR);
-{PTRVAR} yyval.string = strdup(yytext);return(VAR);
-{NUMBER} yyval.number = atoi(yytext);return(NUMBER);
-{FLOAT} yyval.dval = atof(yytext);return(FLOAT);
-{NANTOK} yyval.dval = atof(yytext);return(NANTOK);
-{HEX} yyval.deadbeef = strtoul(yytext,NULL,16);return(RAW);
-{OCTAL} yyval.deadbeef = strtoul(yytext,NULL,8);return(RAW);
-{BOOLEAN} yyval.boolean = !(strcmp(yytext,"T") || strcmp(toupper(yytext),"TRUE"));return(BOOLEAN);
-{ERRVAL} yyval.number = -(!(strcmp(toupper(yytext),"ERR"))));return(ERRVAL);
-{NULLTOK} return(NULLTOK);
-"+" return '+';
-{STRUCTPTR} return(STRUCTPTR);
-"-" return '-';
-"*" return '*';
-"/" return '/';
-"D%" return 'D';
-"d%" return 'd';
-"%" return '%';
-{BITLEFT} return(BITLEFT);
-{LOGIFF} return(LOGIFF);
-{LE} return(LE);
-{LT} return '<';
-{BITRIGHT} return(BITRIGHT);
-{GE} return(GE);
-{GT} return '>';
-{EQUALS} return(EQUALS);
-'=' return '=';
-{NE} return(NE);
-{NPR} return(NPR);
-{NCR} return(NCR);
-{LOGXOR} return(LOGXOR);
-{LOGNAND} return(LOGNAND);
-{LOGNOR} return(LOGNOR);
-"!" return '!';
-{APPROX} return(APPROX);
-{BITNOR} return(BITNOR);
-"~" return '~';
-"¬" return "~";
-{LOGAND} return(LOGAND);
-"&" return '&';
-{LOGOR} return(LOGOR);
-"|" return '|';
-"^" return '^';
-{EQ} return(EQ);
-"?" return '?';
-":" return ':';
-"." return '.';
-";" return ';';
-"," return ',';
-"\\" return '\\';
-{FLIP} return(FLIP);
-{SWITCH} return(SWITCH);
-{CASE} return(CASE);
-{IF} return(IF);
-{THEN} return(THEN);
-{ELSE} return(ELSE);
-{WHILE} return(WHILE);
-{UNTIL} return(UNTIL);
-{FOR} return(FOR);
-{FOREVER} return(FOREVER);
-{DO} return(DO);
-{AFTER} return(AFTER);
-{BREAK} return(BREAK);
-{RETURN} return(RETURN);
-{FI} return(FI);
-{BEGIN} return(BEGIN);
-{END} return(END);
-%%
diff --git a/src/extensionlanguage/extensionlang.y b/src/extensionlanguage/extensionlang.y
deleted file mode 100644
index 1c3bb1c..0000000
--- a/src/extensionlanguage/extensionlang.y
+++ /dev/null
@@ -1,312 +0,0 @@
-%token LSTRUCT STRUCTPTR BITLEFT LE BITRIGHT GE LOGAND LOGOR LOGNAND LOGNOR LOGIFF LOGXOR EQ EQUALS APPROX BITNOR NE ASSIGN NULLTOK FLIP SWITCH CASE IF THEN ELSE WHILE UNTIL FOR FOREVER DO AFTER BREAK RETURN FI BEGIN END
-%token NUMBER ERRVAL
-%token RAW
-%token BOOLEAN
-%token NAME VAR TEXT UTF8 TYPENAME
-%token FLOAT NANTOK
-
-%top {
-#include stuff here
-#include "runtime.c"
-%}
-
-%union
-{
- bool boolean;
- int number;
- char* string;
- double dval;
- uintptr_t deadbeef;
- void* ptr;
-}
-
-%%
-cast
- : TYPENAME {
- $$ = malloc(sizeof(stringlistyp))
- $$→prev = $$
- $$→next = NULL
- $$→text = $1
- }
- | cast TYPENAME {
- $$ = $1
- foo = malloc(sizeof(stringlistyp))
- $$→prev→next = foo
- foo→prev = $$→prev
- $$→prev = foo
- foo→next = NULL
- foo→text = $2
- }
- | cast TYPEPTR {
- $$ = $1
- foo = malloc(sizeof(stringlistyp))
- $$→prev→next = foo
- foo→prev = $$→prev
- $$→prev = foo
- foo→next = NULL
- foo→text = "*"
- }
- ;
-
-typecast
- : cast anything {$$ = runtime__cast($1,$2)}
- | DEREF anything {$$ = runtime__deref($2)}
- ;
-
-variable
- : VAR {$$ = runtime__fetch($1)}
- | variable STRUCTPTR NAME {$$ = runtime__struct_pointer($1,$3)}
- | variable '.' NAME {$$ = runtime__struct($1,$3)}
- | variable '[' intergaliteral ']' {$$ = runtime__arraysub($1,$3)}
- | variable '[' literalparenth ']' {$$ = runtime__arraysub($1,$3)}
- | variable '[' anything ']' {$$ = runtime__arraysub_noncon($1,$3)}
- ;
-
-assignment
- : variable optsp ASSIGN optsp anything {$$ = runtime__assign($1,0,$5)}
- | variable optsp '+' '=' optsp quantity {$$ = runtime__assign($1,'+',$6)}
- | variable optsp '-' '=' optsp quantity {$$ = runtime__assign($1,'-',$6)}
- | variable optsp '*' '=' optsp quantity {$$ = runtime__assign($1,'*',$6)}
- | variable optsp '/' '=' optsp quantity {$$ = runtime__assign($1,'/',$6)}
- | variable optsp '%' '=' optsp intergal {$$ = runtime__assign($1,'%',$6)}
- | variable optsp BITLEFT '=' optsp intergal {$$ = runtime__assign($1,'<',$6)}
- | variable optsp BITRIGHT '=' optsp intergal {$$ = runtime__assign($1,'>',$6)}
- | variable optsp '&' '=' optsp intergal {$$ = runtime__assign($1,'&',$6)}
- | variable optsp '|' '=' optsp intergal {$$ = runtime__assign($1,'|',$6)}
- | variable optsp '~' '&' '=' optsp intergal {$$ = runtime__assign($1,~'&',$7)}
- | variable optsp '&' '~' '=' optsp intergal {$$ = runtime__assign($1,'~',$7)}
- | variable optsp BITNOR '=' optsp intergal {$$ = runtime__assign($1,~'|',$6)}
- | variable optsp '^' '=' optsp intergal {$$ = runtime__assign($1,'^',$6)}
- | variable optsp EQ '=' optsp intergal {$$ = runtime__assign($1,~'^',$6)}
- | variable optsp '~' '=' optsp intergal {$$ = runtime__assign($1,-1,$6)}
- ;
- /* section complete! */
-
-anything
- : quantity
- | pointer
- | function
- | parenth
- ;
-
-quantity
- : real
- | NANTOK
- | pointer
- ;
-
-quantityliteral
- : intergaliteral
- | FLOAT
- | NANTOK
- | NULLTOK {$$ = NULL}
- ;
-
-pointer
- : array
- | NULLTOK {$$ = NULL}
- ;
-
-intergal
- : intergaliteral
- | variable
- | pointer
- ;
-
-intergaliteral
- : NUMBER
- | BOOLEAN
- | RAW
- | ERRVAL
- | NULLTOK {$$ = NULL}
- ;
-
-real
- : FLOAT
- | intergal
- ;
-
-expression
- : anything
- | literalexpression
- | expression
- | typecast
- ;
- /* more later */
-
-literalexpression
- : quantityliteral
- | literalparenth
- | literalexpression ' ' '+' ' ' literalexpression {$$ = $2 + $5}
- | literalexpression ' ' '-' ' ' literalexpression {$$ = $2 - $5}
- | literalexpression ' ' '*' ' ' literalexpression {$$ = $2 * $5}
- | literalexpression ' ' '/' ' ' literalexpression {$$ = $2 / $5}
- | literalexpression ' ' '*' '*' ' ' literalexpression {$$ = pow($2,$6)}
- | literalexpression ' ' '*' '*' '*' ' ' literalexpression {$$ = pow($2,pow($2,$7))}
- | '!' literalexpression {$$ = !($2)}
- | literalexpression '!' {$$ = util__factorial($1)}
- | literalexpression optsp '?' optsp literalexpression optsp ':' optsp literalexpression {$$ = $1 ? $5 : $9}
- | literalexpression 'D' literalexpression {$$ = util__roll($1,$2,true)}
- | literalexpression 'd' literalexpression {$$ = util__roll($1,$2,false)}
- | FLIP {$$ = util__flip}
- ;
- /* more later
- * these are the reducibles
- */
-
-commalist
- : anything ',' anything {
- $$ = malloc(sizeof(struct runtime__list));
- $$->next = malloc(sizeof(struct runtime__list));
- $$->prev = $$->next;
- $$->next->next = NULL;
- $$->next->prev = $$;
- $$->string = $1->string;
- $$->number = $1->number;
- $$->ddval = $1->ddval;
- $$->next->string = $3->string;
- $$->next->number = $3->number;
- $$->next->ddval = $3->ddval;
- }
- | commalist ',' anything {
- $$ = $1; {
- foo = malloc(sizeof(struct parser__list));
- $$->prev->next = foo;
- foo->prev = $$->prev;
- $$->prev = foo;
- foo->next = NULL;
- foo->string = $3->string;
- foo->number = $3->number;
- foo->ddval = $3->ddval;
- }
- }
- ;
-
-spacelist
- : anything ' ' anything {
- $$ = malloc(sizeof(struct runtime__list));
- $$->next = malloc(sizeof(struct runtime__list));
- $$->prev = $$->next;
- $$->next->next = $$;
- $$->next->prev = $$;
- $$->string = $1->string;
- $$->number = $1->number;
- $$->ddval = $1->ddval;
- $$->next->string = $3->string;
- $$->next->number = $3->number;
- $$->next->ddval = $3->ddval;
- }
- | spacelist ' ' anything {
- $$ = $1; {
- foo = malloc(sizeof(struct parser__list));
- $$->prev->next = foo;
- foo->prev = $$->prev;
- $$->prev = foo;
- foo->next = $$;
- foo->string = $3->string;
- foo->number = $3->number;
- foo->ddval = $3->ddval;
- }
- }
- ;
-
-structure
- : cast LSTRUCT commalist '}' {$$ = runtime__queue_struct($1,$3)}
- ;
-
-array
- : '{' commalist '}' {$$ = runtime__makearray($2)}
- | TEXT {$$ = $1}
- | TEXT TEXT {$$ = strcat($1,$2)}
- ;
-
-literalparenth
- : '(' optsp literalexpression optsp ')' {$$ = $3}
- ;
-
-parenth
- : '(' optsp anything optsp ')' {$$ = $3}
- | '(' optsp expression optsp ')' {$$ = $3}
- | '(' optsp assignment optsp ')' {$$ = $3}
- | literalparenth {$$ = $1}
- ;
-
-function
- : NAME '[' ']' {$$ = runtime__queue_noargs($1)}
- | NAME '[' anything ']' {$$ = runtime__queue($1,$3)}
- | NAME '[' commalist ']' {$$ = runtime__queue_list($1,$3)}
- | '(' optsp NAME optsp ')' {$$ = runtime__queue_noargs($3)}
- | '(' optsp NAME ' ' anything optsp ')' {$$ = runtime__queue($3,$5)}
- | '(' optsp NAME ' ' spacelist optsp ')' {$$ = runtime__queue_list($3,$5)}
- | '+' '+' variable {$$ = runtime__queue_incr_pre($3)}
- | '-' '-' variable {$$ = runtime__queue_decr_pre($3)}
- | variable '+' '+' {$$ = runtime__queue_incr_post($1)}
- | variable '-' '-' {$$ = runtime__queue_decr_post($1)}
- | anything 'D' anything {$$ = runtime__roll($1,$2,true)}
- | anything 'd' anything {$$ = runtime__roll($1,$2,false)}
- ;
- /* section complete! */
-
-dostuff
- : function {$$ = $1}
- | parenth {$$ = $1}
- | assignment {$$ = runtime__queue_sane($1)}
- | ifthen {$$ = $1}
- | simpleloop {$$ = $1}
- | forloop {$$ = $1}
- | switchtable {$$ = $1}
- | returnval {$$ = runtime__queue_return($1)}
- | BREAK {$$ = runtime__queue_dobreak()}
- | dostuff ';' dostuff {runtime__concat_queue($1,$3)}
- ;
-
-execute
- : BEGIN dostuff END {$$ = runtime__execute($2)}
-
-ifthen
- : IF '(' expression ')' THEN dostuff else___ {$$ = runtime__queue_ifthenelse($3,$6,$7)}
- | IF '(' expression ')' THEN dostuff END {$$ = runtime__queue_ifthen($3,$6)}
- ;
-
-else___
- : ELSE dostuff END {$$ = $2}
- | ELSE ifthen {$$ = $2}
- | END
- ;
-
-simpleloop
- : WHILE '(' expression ')' DO dostuff END {$$ = runtime__queue_while($3,$6)}
- | UNTIL '(' expression ')' DO dostuff END {$$ = runtime__queue_until($3,$6)}
- | DO dostuff WHILE '(' expression ')' END {$$ = runtime__queue_dowhile($2,$5)}
- | DO dostuff UNTIL '(' expression ')' END {$$ = runtime__queue_dountil($2,$5)}
- | FOREVER DO dostuff END {$$ = runtime__queue_forever($3)}
- ;
-
-returnval
- : RETURN anything {$$ = $2}
- | RETURN {$$ = OK}
- ;
-
-forloop
- : FOR assignment ';' WHILE '(' expression ')' DO dostuff AFTER dostuff END {$$ = runtime__queue_for($2,$6,$9,$11)}
- | FOR assignment ';' UNTIL '(' expression ')' DO dostuff AFTER dostuff END {$$ = runtime__queue_fornot($2,$6,$9,$11)}
- ;
-
-switchtable
- : SWITCH variable DO caselist END {$$ = runtime__queue_switch($2,$4)}
- ;
-
-caseentry
- : CASE quantity THEN dostuff END {$$ = runtime__case($2,$4)}
- | CASE quantity LOGOR casentry {$$ = runtime__case_multi($2,$4)}
- ;
-
-caselist
- : caseentry caseentry {$$ = runtime__concat_case($1,$2)}
- | caselist caseentry {$$ = runtime__concat_case($1,$2)}
- ;
-
-optsp
- : /* empty */
- | ' '
- ;
diff --git a/src/extensionlanguage/runtime.h b/src/extensionlanguage/runtime.h
deleted file mode 100644
index 1687281..0000000
--- a/src/extensionlanguage/runtime.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "../dummy.c"
-
-union runtime__union {
- bool boolean;
- int number;
- char* string;
- double dval;
- uintptr_t deadbeef;
- void* ptr;
- }
-
-enum runtime__type {boolean,number,string,dval,deadbeef,ptr}
-
-struct runtime__arg {
-runtime__union data;
-runtime__type type;
-}
-
-struct runtime__instruction {
-struct runtime__instruction *prev
-struct runtime__instruction *next
-
-runtime__OPCODES type
-
-runtime__arg left
-runtime__arg right
-runtime__arg foo
-runtime__arg bar
-}
-
-struct runtime__list {
-struct runtime__list *prev;
-struct runtime__list *next;
-YYSTYPE data
-}
-
-enum runtime__OPCODES {OPCODE_FETCH,OPCODE_ASSIGN,OPCODE_VALUE,
-OPCODE_CAST,OPCODE_DEREF,OPCODE_STRUCT,OPCODE_STRUCT_POINTER,
-OPCODE_ARRAYSUB,OPCODE_EXPRESSION,OPCODE_FUNCTION,OPCODE_IF,OPCODE_IF_ELSE,
-OPCODE_WHILE,OPCODE_UNTIL,OPCODE_FOREVER,OPCODE_FOR,OPCODE_FORNOT,
-OPCODE_PRE_INCR,OPCODE_POST_INCR,OPCODE_PRE_DECR,OPCODE_POST_DECR,
-OPCODE_ADD,OPCODE_SUB,OPCODE_MULT,OPCODE_DIV,OPCODE_MOD,OPCODE_LOGAND,
-OPCODE_LOGOR,OPCODE_LOGNAND,OPCODE_LOGNOR,OPCODE_LOGXOR,OPCODE_IFF,
-OPCODE_LOGNOT,OPCODE_AND,OPCODE_OR,OPCODE_NAND,OPCODE_NOR,OPCODE_XOR,
-OPCODE_EQ,OPCODE_NOT,OPCODE_GT,OPCODE_GE,OPCODE_EQUAL,OPCODE_NE,OPCODE_LT,
-OPCODE_LE,OPCODE_APPROX,OPCODE_EXP,OPCODE_TETRA,OPCODE_RETURN,OPCODE_BREAK,
-OPCODE_NPR,OPCODE_NCR,OPCODE_FACT,OPCODE_ROLL}
-/*each opcode defines what to do to the arguments*/
-
diff --git a/src/greedy/astar.c b/src/greedy/astar.c
index ef6ded7..4d1712b 100644
--- a/src/greedy/astar.c
+++ b/src/greedy/astar.c
@@ -45,7 +45,7 @@ forever {
for (schar xdiff = -1; xdiff < 2; xdiff++) {
for (schar ydiff = -1; ydiff < 2; ydiff++) {
for (schar zdiff = -1; zdiff < 2; zdiff++) {
- if (best ≤ (datakeeper.grid[COORDSUB(current→z,current→y,current→x)].runningdist + step)) {goto(reap)}
+ if (best ≤ (datakeeper.grid[COORDSUB(current->z,current->y,current->x)].runningdist + step)) {goto(reap)}
switch ((abs(xdiff) + abs(ydiff) + abs(zdiff)) : {
case 1 : step = 1; break;
case 2 : step = diagonal2; break;
@@ -54,43 +54,43 @@ forever {
}
if (
!(( ((abs(xdiff) + abs(ydiff) + abs(zdiff)) > 1) && args.ortho)
- (current→x + xdiff < MAX_X) &&
- (current→x + xdiff ≥ 0) &&
- (current→y + ydiff < MAX_Y) &&
- (current→x + xdiff ≥ 0) &&
- (current→z + zdiff < CEILING) &&
- (current→z + zdiff ≥ 0) &&
- (!(datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].obs)) && (
- ((datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].runningdist) > (datakeeper.grid[COORDSUB(current→z,current→y,current→x)].runningdist + step)) ||
- ((datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].runningdist) < 0)
+ (current->x + xdiff < MAX_X) &&
+ (current->x + xdiff ≥ 0) &&
+ (current->y + ydiff < MAX_Y) &&
+ (current->x + xdiff ≥ 0) &&
+ (current->z + zdiff < CEILING) &&
+ (current->z + zdiff ≥ 0) &&
+ (!(datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].obs)) && (
+ ((datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].runningdist) > (datakeeper.grid[COORDSUB(current->z,current->y,current->x)].runningdist + step)) ||
+ ((datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].runningdist) < 0)
)
) {
- datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].runningdist = datakeeper.grid[COORDSUB(current→z,current→y,current→x)].runningdist + step
- datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].xup = current→x
- datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].yup = current→y
- datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].zup = current→z
+ datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].runningdist = datakeeper.grid[COORDSUB(current->z,current->y,current->x)].runningdist + step
+ datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].xup = current->x
+ datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].yup = current->y
+ datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].zup = current->z
setcoord3* tmp = malloc(sizeof(setcoord3))
- tmp→x = current→x + xdiff
- tmp→y = current→y + ydiff
- tmp→z = current→z + zdiff
- tmp→prev = last
- last→next = tmp
- datakeeper.hydra_ptr→prev = tmp
- tmp→next = datakeeper.hydra_ptr
+ tmp->x = current->x + xdiff
+ tmp->y = current->y + ydiff
+ tmp->z = current->z + zdiff
+ tmp->prev = last
+ last->next = tmp
+ datakeeper.hydra_ptr->prev = tmp
+ tmp->next = datakeeper.hydra_ptr
last = tmp
neighborhood[zdiff+1][ydiff+1][xdiff+1] = tmp
}
}
reap:
if (current == datakeeper.hydra_ptr) {
- if (datakeeper.hydra_ptr == datakeeper.hydra_ptr→next) {
+ if (datakeeper.hydra_ptr == datakeeper.hydra_ptr->next) {
free(current)
current = NULL
goto(breakout)
}
- datakeeper.hydra_ptr→next→prev = datakeeper.hydra_ptr→prev
- datakeeper.hydra_ptr→prev→next = datakeeper.hydra_ptr→next
- datakeeper.hydra_ptr = datakeeper.hydra_ptr→next
+ datakeeper.hydra_ptr->next->prev = datakeeper.hydra_ptr->prev
+ datakeeper.hydra_ptr->prev->next = datakeeper.hydra_ptr->next
+ datakeeper.hydra_ptr = datakeeper.hydra_ptr->next
}
free(current)
@@ -99,7 +99,7 @@ forever {
for (uchar y = 0,y < 3,y++) {
for (uchar x = 0,x < 3,x++) {
if (neighborhood[z][y][x] != NULL) {
- if (datakeeper.grid[COORDSUB(neighborhood[z][y][x]→z,neighborhood[z][y][x]→y,neighborhood[z][y][x]→x)].goaldist < winning) {current = neighborhood[z][y][x]}
+ if (datakeeper.grid[COORDSUB(neighborhood[z][y][x]->z,neighborhood[z][y][x]->y,neighborhood[z][y][x]->x)].goaldist < winning) {current = neighborhood[z][y][x]}
}
}
}
@@ -107,30 +107,30 @@ forever {
RESETNEIGHBORHOOD
if (current == NULL) {
current = datakeeper.hydra_ptr
- ptrnext = datakeeper.hydra_ptr→next
- for (;ptrnext != datakeeper.hydra_ptr;ptrnext = ptrnext→next) {
- (ptrnext→runningdist + ptrnext→goaldist) < (current→runningdist + current→goaldist) ? noop() : current = ptrnext
+ ptrnext = datakeeper.hydra_ptr->next
+ for (;ptrnext != datakeeper.hydra_ptr;ptrnext = ptrnext->next) {
+ (ptrnext->runningdist + ptrnext->goaldist) < (current->runningdist + current->goaldist) ? noop() : current = ptrnext
}
}
skip:
- if (((current→x == pointb.x) && (current→y == pointb.y) && (current→z == pointb.z)) && !args.indecisive) {goto(breakout)}
+ if (((current->x == pointb.x) && (current->y == pointb.y) && (current->z == pointb.z)) && !args.indecisive) {goto(breakout)}
}
breakout:
coord3 currentcoord
-currentcoord.x = current→x
-currentcoord.y = current→y
-currentcoord.z = current→z
+currentcoord.x = current->x
+currentcoord.y = current->y
+currentcoord.z = current->z
-current = datakeeper.hydra_ptr→prev
-setcoord3* previous = datakeeper.hydra_ptr→prev→prev
-datakeeper.hydra_ptr→next = NULL
-datakeeper.hydra_ptr→prev = NULL
+current = datakeeper.hydra_ptr->prev
+setcoord3* previous = datakeeper.hydra_ptr->prev->prev
+datakeeper.hydra_ptr->next = NULL
+datakeeper.hydra_ptr->prev = NULL
while (previous != NULL) {
free (current)
current = previous
- previous = previous→prev
+ previous = previous->prev
}
free(current)
current = NULL
@@ -138,11 +138,11 @@ current = NULL
coord3 nextcoord
setcoord3* output = malloc(sizeof(setcoord3))
-output→next = output_head
-output→prev = output_head
-output→x = currentcoord
-output→y = currentcoord
-output→z = currentcoord
+output->next = output_head
+output->prev = output_head
+output->x = currentcoord
+output->y = currentcoord
+output->z = currentcoord
setcoord3* newoutput
@@ -152,13 +152,13 @@ while (!((currentcoord.x == pointa.x) && (currentcoord.y == pointa.y) && (curren
nextcoord.z = datakeeper.grid[COORDSUB(currentcoord.z,currentcoord.y,currentcoord.x)].zup
currentcoord = nextcoord
newoutput = malloc(sizeof(setcoord3))
- newoutput→next = output
- newoutput→prev = output→prev
+ newoutput->next = output
+ newoutput->prev = output->prev
output = newoutput
- output→x = currentcoord.x
- output→y = currentcoord.y
- output→z = currentcoord.z
+ output->x = currentcoord.x
+ output->y = currentcoord.y
+ output->z = currentcoord.z
}
return output
}
-#undef RESETNEIGHBORHOOD
\ No newline at end of file
+#undef RESETNEIGHBORHOOD
diff --git a/src/greedy/dijkstra.c b/src/greedy/dijkstra.c
index 2b09aac..7a92f90 100644
--- a/src/greedy/dijkstra.c
+++ b/src/greedy/dijkstra.c
@@ -26,7 +26,7 @@ forever {
for (schar xdiff = -1; xdiff < 2; xdiff++) {
for (schar ydiff = -1; ydiff < 2; ydiff++) {
for (schar zdiff = -1; zdiff < 2; zdiff++) {
- if (best ≤ (datakeeper.grid[COORDSUB(current→z,current→y,current→x)].runningdist + step)) {goto(reap)}
+ if (best ≤ (datakeeper.grid[COORDSUB(current->z,current->y,current->x)].runningdist + step)) {goto(reap)}
switch ((abs(xdiff) + abs(ydiff) + abs(zdiff)) : {
case 1 : step = 1; break;
case 2 : step = diagonal2; break;
@@ -35,68 +35,68 @@ forever {
}
if (
!(( ((abs(xdiff) + abs(ydiff) + abs(zdiff)) > 1) && args.ortho)
- (current→x + xdiff < MAX_X) &&
- (current→x + xdiff ≥ 0) &&
- (current→y + ydiff < MAX_Y) &&
- (current→x + xdiff ≥ 0) &&
- (current→z + zdiff ≤ activeroom→ceiling) &&
- (current→z + zdiff ≥ 0) &&
- (!(datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].obs)) && (
- ((datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].runningdist) > (datakeeper.grid[COORDSUB(current→z,current→y,current→x)].runningdist + step)) ||
- ((datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].runningdist) < 0)
+ (current->x + xdiff < MAX_X) &&
+ (current->x + xdiff ≥ 0) &&
+ (current->y + ydiff < MAX_Y) &&
+ (current->x + xdiff ≥ 0) &&
+ (current->z + zdiff ≤ activeroom->ceiling) &&
+ (current->z + zdiff ≥ 0) &&
+ (!(datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].obs)) && (
+ ((datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].runningdist) > (datakeeper.grid[COORDSUB(current->z,current->y,current->x)].runningdist + step)) ||
+ ((datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].runningdist) < 0)
)
) {
- datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].runningdist = datakeeper.grid[COORDSUB(current→z,current→y,current→x)].runningdist + step
- datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].xup = current→x
- datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].yup = current→y
- datakeeper.grid[COORDSUB(current→z + zdiff,current→y + ydiff,current→x + xdiff)].zup = current→z
+ datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].runningdist = datakeeper.grid[COORDSUB(current->z,current->y,current->x)].runningdist + step
+ datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].xup = current->x
+ datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].yup = current->y
+ datakeeper.grid[COORDSUB(current->z + zdiff,current->y + ydiff,current->x + xdiff)].zup = current->z
setcoord3* tmp = malloc(sizeof(setcoord3))
- tmp→x = current→x + xdiff
- tmp→y = current→y + ydiff
- tmp→z = current→z + zdiff
- tmp→prev = last
- last→next = tmp
- datakeeper.hydra_ptr→prev = tmp
- tmp→next = datakeeper.hydra_ptr
+ tmp->x = current->x + xdiff
+ tmp->y = current->y + ydiff
+ tmp->z = current->z + zdiff
+ tmp->prev = last
+ last->next = tmp
+ datakeeper.hydra_ptr->prev = tmp
+ tmp->next = datakeeper.hydra_ptr
last = tmp
}
}
reap:
if (current == datakeeper.hydra_ptr) {
- if (datakeeper.hydra_ptr == datakeeper.hydra_ptr→next) {
+ if (datakeeper.hydra_ptr == datakeeper.hydra_ptr->next) {
free(current)
current = NULL
goto(breakout)
}
- datakeeper.hydra_ptr→next→prev = datakeeper.hydra_ptr→prev
- datakeeper.hydra_ptr→prev→next = datakeeper.hydra_ptr→next
- datakeeper.hydra_ptr = datakeeper.hydra_ptr→next
+ datakeeper.hydra_ptr->next->prev = datakeeper.hydra_ptr->prev
+ datakeeper.hydra_ptr->prev->next = datakeeper.hydra_ptr->next
+ datakeeper.hydra_ptr = datakeeper.hydra_ptr->next
}
free(current)
current = datakeeper.hydra_ptr
- ptrnext = datakeeper.hydra_ptr→next
- for (;ptrnext != datakeeper.hydra_ptr;ptrnext = ptrnext→next) {
- ptrnext→runningdist < current→runningdist ? noop() : current = ptrnext
+ ptrnext = datakeeper.hydra_ptr->next
+ for (;ptrnext != datakeeper.hydra_ptr;ptrnext = ptrnext->next) {
+ ptrnext->runningdist < current->runningdist ? noop() : current = ptrnext
}
skip:
- if (((current→x == pointb.x) && (current→y == pointb.y) && (current→z == pointb.z)) && !args.indecisive) {goto(breakout)}
+ if (((current->x == pointb.x) && (current->y == pointb.y) && (current->z == pointb.z)) && !args.indecisive) {goto(breakout)}
}
breakout:
coord3 currentcoord
-currentcoord.x = current→x
-currentcoord.y = current→y
-currentcoord.z = current→z
+currentcoord.x = current->x
+currentcoord.y = current->y
+currentcoord.z = current->z
-current = datakeeper.hydra_ptr→prev
-setcoord3* previous = datakeeper.hydra_ptr→prev→prev
-datakeeper.hydra_ptr→next = NULL
-datakeeper.hydra_ptr→prev = NULL
+current = datakeeper.hydra_ptr->prev
+setcoord3* previous = datakeeper.hydra_ptr->prev->prev
+datakeeper.hydra_ptr->next = NULL
+datakeeper.hydra_ptr->prev = NULL
while (previous != NULL) {
free (current)
current = previous
- previous = previous→prev
+ previous = previous->prev
}
free(current)
current = NULL
@@ -104,11 +104,11 @@ current = NULL
coord3 nextcoord
setcoord3* output = malloc(sizeof(setcoord3))
-output→next = output_head
-output→prev = output_head
-output→x = currentcoord
-output→y = currentcoord
-output→z = currentcoord
+output->next = output_head
+output->prev = output_head
+output->x = currentcoord
+output->y = currentcoord
+output->z = currentcoord
setcoord3* newoutput
@@ -118,12 +118,12 @@ while (!((currentcoord.x == pointa.x) && (currentcoord.y == pointa.y) && (curren
nextcoord.z = datakeeper.grid[COORDSUB(currentcoord.z,currentcoord.y,currentcoord.x)].zup
currentcoord = nextcoord
newoutput = malloc(sizeof(setcoord3))
- newoutput→next = output
- newoutput→prev = output→prev
+ newoutput->next = output
+ newoutput->prev = output->prev
output = newoutput
- output→x = currentcoord.x
- output→y = currentcoord.y
- output→z = currentcoord.z
+ output->x = currentcoord.x
+ output->y = currentcoord.y
+ output->z = currentcoord.z
}
return output
-}
\ No newline at end of file
+}
diff --git a/src/greedy/greedy.messy b/src/greedy/greedy.messy
index 007de48..cf39a62 100644
--- a/src/greedy/greedy.messy
+++ b/src/greedy/greedy.messy
@@ -51,16 +51,16 @@ uchar downstair_x downstair_y upstair_x upstair_y ceiling home_x home_y home_z
tileset *hightiles
{
metaroomtyp* output = malloc(sizeof(metaroomtyp))
-output→tiledata = calloc((ceiling + 1) * MAX_Y * MAX_X,sizeof(schar))
-output→downstair→x = downstair_x
-output→downstair→y = downstair_y
-output→upstair→x = upstair_x
-output→upstair→y = upstair_y
-output→home→x = home_x
-output→home→y = home_y
-output→home→z = home_z
-output→do_downstair = do_downstair
-output→do_upstair = do_upstair
+output->tiledata = calloc((ceiling + 1) * MAX_Y * MAX_X,sizeof(schar))
+output->downstair->x = downstair_x
+output->downstair->y = downstair_y
+output->upstair->x = upstair_x
+output->upstair->y = upstair_y
+output->home->x = home_x
+output->home->y = home_y
+output->home->z = home_z
+output->do_downstair = do_downstair
+output->do_upstair = do_upstair
}
pathfinderdata makepathgrid(xcoord,ycoord,zcoord,parent)
@@ -68,8 +68,8 @@ uchar xcoord ycoord zcoord
metaroomtyp* parent
{
pathfinderdata output
-setpathnode* pathgrid = calloc((parent→ceiling + 1) * MAX_Y * MAX_X,sizeof(pathfinderdata))
-for (uchar z;z ≤ parent→ceiling;z++) {
+setpathnode* pathgrid = calloc((parent->ceiling + 1) * MAX_Y * MAX_X,sizeof(pathfinderdata))
+for (uchar z;z ≤ parent->ceiling;z++) {
for (uchar y;y < MAX_Y;y++) {
for (uchar x;x < MAX_X;x++) {
pathgrid[COORDSUB(z,y,x)].runningdist = -1
@@ -78,11 +78,11 @@ for (uchar z;z ≤ parent→ceiling;z++) {
}
}
setcoord3* urhydra = malloc(sizeof(setcoord3))
-urhydra→prev = urhydra
-urhydra→next = urhydra
-urhydra→x = xcoord
-urhydra→y = ycoord
-urhydra→z = zcoord
+urhydra->prev = urhydra
+urhydra->next = urhydra
+urhydra->x = xcoord
+urhydra->y = ycoord
+urhydra->z = zcoord
output.grid = pathgrid
output.hydra_ptr = urhydra
return output
@@ -100,11 +100,11 @@ for (uchar y;y < MAX_Y;y++) {
}
}
setcoord3* urhydra = malloc(sizeof(setcoord3))
-urhydra→prev = urhydra
-urhydra→next = urhydra
-urhydra→x = xcoord
-urhydra→y = ycoord
-urhydra→z = 0
+urhydra->prev = urhydra
+urhydra->next = urhydra
+urhydra->x = xcoord
+urhydra->y = ycoord
+urhydra->z = 0
output.grid = pathgrid
output.hydra_ptr = urhydra
return output
@@ -120,8 +120,8 @@ uchar xcoord ycoord zcoord
metaroomtyp* parent
{
dijkstradata output
-setpathnode* pathgrid = calloc((parent→ceiling + 1) * MAX_Y * MAX_X,sizeof(dijkstradata))
-for (uchar z;z ≤ parent→ceiling;z++) {
+setpathnode* pathgrid = calloc((parent->ceiling + 1) * MAX_Y * MAX_X,sizeof(dijkstradata))
+for (uchar z;z ≤ parent->ceiling;z++) {
for (uchar y;y < MAX_Y;y++) {
for (uchar x;x < MAX_X;x++) {
pathgrid[COORDSUB(z,y,x)].runningdist = -1
@@ -129,11 +129,11 @@ for (uchar z;z ≤ parent→ceiling;z++) {
}
}
setcoord3* urhydra = malloc(sizeof(setcoord3))
-urhydra→prev = urhydra
-urhydra→next = urhydra
-urhydra→x = xcoord
-urhydra→y = ycoord
-urhydra→z = zcoord
+urhydra->prev = urhydra
+urhydra->next = urhydra
+urhydra->x = xcoord
+urhydra->y = ycoord
+urhydra->z = zcoord
output.grid = pathgrid
output.hydra_ptr = urhydra
return output
@@ -150,11 +150,11 @@ for (uchar y;y < MAX_Y;y++) {
}
}
setcoord3* urhydra = malloc(sizeof(setcoord3))
-urhydra→prev = urhydra
-urhydra→next = urhydra
-urhydra→x = xcoord
-urhydra→y = ycoord
-urhydra→z = 0
+urhydra->prev = urhydra
+urhydra->next = urhydra
+urhydra->x = xcoord
+urhydra->y = ycoord
+urhydra->z = 0
output.grid = pathgrid
output.hydra_ptr = urhydra
return output
@@ -195,12 +195,12 @@ return (ushort) (abs(xrel) + abs(yrel) + abs(zrel));
/*pseudocode*/mapgenunderground
rooms:
-for 0→50 do
- roll → index
+for 0->50 do
+ roll -> index
rotateby 1d4
- roll 1d(MAX_Y-subrooms[index].dim.y) → posY
- roll 1d(MAX_X-subrooms[index].dim.x) → posX
- roll 1d(8-subrooms[index].dim.z) → posZ
+ roll 1d(MAX_Y-subrooms[index].dim.y) -> posY
+ roll 1d(MAX_X-subrooms[index].dim.x) -> posX
+ roll 1d(8-subrooms[index].dim.z) -> posZ
try put subrooms[index] at (posX,posY,posZ)
if !overlapping
draw room
@@ -330,7 +330,7 @@ setcoord3* sollin(pathfindargs args,setedge *forest,metaroomtyp* activeroom)
* for an edge with non-zero membership that has a pointa or pointb
* which matches either the pointa or pointb of the current edge
*
- * node iteration→tree iteration ; shortest first
+ * node iteration->tree iteration ; shortest first
*/
setcoord3* makemaze(uchar gridspacing,uchar floorspacing,mazealignparamtyp maze,metaroomtyp* activeroom) //sets basic aspects of the room, generates a grid of points, puts upstair, downstair, and home on that grid.
@@ -340,21 +340,21 @@ shadowmask* walltrace(schar tile,uchar height,metaroomtyp* activeroom) //outline
shadowmask* attractor(bool replace,schar tile,setcoord *coordlist,uchar iterations,bool invert,metaroomtyp* activeroom)
/* uchar xcoord = roll 1dMAX_X
* uchar ycoord = roll 1dMAX_Y
- * uchar zcoord = roll 1d(activeroom→ceiling + 1)
+ * uchar zcoord = roll 1d(activeroom->ceiling + 1)
*
* uint rotate = random()
- * for (;rotate;rotate--) {coordlist = coordlist→next}
- * xcoord = (xcoord + list→x) / 2
- * ycoord = (ycoord + list→y) / 2
- * zcoord = (zcoord + list→z) / 2
+ * for (;rotate;rotate--) {coordlist = coordlist->next}
+ * xcoord = (xcoord + list->x) / 2
+ * ycoord = (ycoord + list->y) / 2
+ * zcoord = (zcoord + list->z) / 2
* if ( (!tile(xcoord,ycoord,zcoord) || (replace) ) {put tile (xcoord,ycoord,zcoord)}
*
* for (;iterations;iterations--) {
* uint rotate = random()
- * for (;rotate;rotate--) {coordlist = coordlist→next}
- * xcoord = (xcoord + list→x) / 2
- * ycoord = (ycoord + list→y) / 2
- * zcoord = (zcoord + list→z) / 2
+ * for (;rotate;rotate--) {coordlist = coordlist->next}
+ * xcoord = (xcoord + list->x) / 2
+ * ycoord = (ycoord + list->y) / 2
+ * zcoord = (zcoord + list->z) / 2
* if ( (!tile(xcoord,ycoord,zcoord) || (replace) ) {put tile(xcoord,ycoord,zcoord)}
* }
*/
@@ -367,7 +367,7 @@ shadowmask* spikenoise(replace,tile,floor or ceiling,metaroomtyp* activeroom)
*/
shadowmask* hailofdice(replace,tile,number,metaroomtyp* activeroom)
- //while number { roll(1dMAX_X,1dMAX_Y,1d(activeroom→ceiling + 1)); put tile; number--; }
+ //while number { roll(1dMAX_X,1dMAX_Y,1d(activeroom->ceiling + 1)); put tile; number--; }
tiles_cubefill(bool overwrite,schar tile,coord3 pointa,coord3 pointb,metaroomtyp* activeroom)
tiles_cubeshell(bool overwrite,bool blank,schar tile,coord3 pointa,coord3 pointb,metaroomtyp* activeroom)
@@ -413,4 +413,4 @@ batchtile_mask(metaroomtyp* target,setcoord3* batch,schar tile,bool obs)
/* ai can use modifyed versions of dijkstra or any of the astar varients
* particularly, they must be able to handle multiple destinations for the aggro ais
* or the ability to cycle through a list of checkpoints for passive ais
- */
\ No newline at end of file
+ */
diff --git a/src/iwannaflycurses.messy b/src/iwannaflycurses.messy
index 12f11ff..7a72387 100644
--- a/src/iwannaflycurses.messy
+++ b/src/iwannaflycurses.messy
@@ -192,12 +192,20 @@
//#include
//#include
//#include
+#include
/**compression libraries**/
#include
#include
#include
+/**perl libraries**/
+#define PERL_NO_GET_CONTEXT
+#include
+#include
+#include "XSUB.h"
+
+
/**ncurses libraries**/
#include
//#include
@@ -206,28 +214,6 @@
// need to find a MIDI library.
-#ifndef OK
-#define OK 0
-#endif
-
-#ifndef ERR
-#define ERR -1
-#endif
-
-#ifndef EOF
-#error now you're just TRYING to break stuff...
-#endif
-
-#ifndef NULL
-#warning ... ...wh ... ... how??
-#define NULL ((void*)0)
-#endif
-
-#define TRUE true
-#define FALSE false
-#define T true
-#define NIL ((intptr_t)0) /*should be false and NULL equivilant, might be kept even if the others are purged*/
-
mvaddch16(int x,int y,char16_t raw) {
const wchar_t wch = raw;
mvaddnwstr(13,16,&wch,1);
@@ -251,52 +237,9 @@ addnwstr(&wch,1);
*/
/*ENVIROMENTALS*/
-#define BUFFER_MAX 512
-#define FLOPPYSIZE 1474560
-#define DRUMSIZE 16384
-#define BGCOLORS 8
-#define FGCOLORS 8
char16_t TILDEWIDE
-#define BLINKY "\033[5m_\033[25m"
char* TERM
-/*VERSION*/
-#define ENGINE_VERSION "Prealpha"
-#define RULES_VERSION "Prealpha"
-#define API_VERSION "Prealpha"
-#ifndef SAVE_VERSION
-#define SAVE_VERSION "MISSING"
-#endif
-#ifndef EXT_PARS_VERSION
-#define EXT_PARSE_VERSION "MISSING"
-#endif
-#ifndef RUNCOM_VERSION
-#define RUNCOM_VERSION "MISSING"
-#endif
-#ifndef MIDIBAS_VERSION
-#define MIDIBAS_VERSION "MISSING"
-#endif
-#ifndef MIDI_TYPE
-#define MIDI_TYPE "MISSING"
-#endif
-
-/*FUNCTION MACROS*/
-#define BACKGROUND 010
-#define MAX(A,B) (A > B ? A : B)
-#define MIN(A,B) (A < B ? A : B)
-#define INTERVAL(A,N,B) MIN(MAX(A,N),B)
-#define COORDSUB(Z,Y,X) ((MAX_Y * Z) + (MAX_X * Y) + X)
-
-// kludge so that stdio and ncurses play nice together
-#define RESET "\033c\033[2J\033[0H"
-#define BREAKCURSES clear();refresh();endwin();printf(RESET);fflush(stdout);
-#define FIXCURSES printf(RESET);fflush(stdout);initialize();while (fgetc(stdin) != '\n');refresh;
-
-// prettify the tokens my eyes don't parse
-#define ≥ >=
-#define ≤ <=
-#define → ->
-#define forever for (;;)
/* ɛ̩̍ will be used for "and", the conjunction, in comments where logical && would give a meaning that
* could be validly, but incompatibly, interpreted as compleatly different from what is intended.
* if confusion arises from or, similar mesures will be implemented for it, too.
@@ -336,9 +279,9 @@ void* drumalloc (ptr,amount)
struct drum ptr
size_t amount
{
-if ((ptr→top + amount) ≤ (DRUMSIZE)) {
- void* output = ptr→data[ptr→top]
- ptr→top += amount
+if ((ptr->top + amount) ≤ (DRUMSIZE)) {
+ void* output = ptr->data[ptr->top]
+ ptr->top += amount
return output
}
else {return NULL}
@@ -348,7 +291,7 @@ drumpop (ptr,amount)
struct drum ptr
size_t amount
{
-ptr→top = MAX(ptr→top - amount,0)
+ptr->top = MAX(ptr->top - amount,0)
}
setlocale(LC_ALL, "");
@@ -628,7 +571,7 @@ roomtyp* ROOM
#define MAX_X 64
#define MAX_Y 24 //MAX_X ≥ MAX_Y ≥ MAX_Z
#define MAX_Z 16
-#define CEILING ROOM→ceiling
+#define CEILING ROOM->ceiling
#define ROOF 201 //it is decreed: mortals shall fly no higher. (this means you!)
#define EQUATOR 360 //the number of rooms in the circumfrence of the sphere
int(latlontyp)* ROOMGENCALL[ROOF + 1][EQUATOR/2 + 1][EQUATOR]
@@ -642,7 +585,7 @@ uchar ROOMTURN
ullong KILLS
char* SAVEPATH
followtype *FOLLOW_ptr //pursuers, i.e. paid assasins, ninjas, the reaper...
-eventtyp *EVNT_ptr //FOO_ptr refers to the doubly linked list's head. the tail is FOO_ptr→prev
+eventtyp *EVNT_ptr //FOO_ptr refers to the doubly linked list's head. the tail is FOO_ptr->prev
placetyp *PLACE_ptr
stringlistyp *HINT_ptr
eventstringtyp *HEYLISTEN_ptr
@@ -820,9 +763,9 @@ forever {
if ((ch > UCHAR_MAX) || (ch < 0)) {
switch ch : {
case KEY_ENTER : goto(fin);
- case KEY_BACKSPACE : subscript = INTERVAL(0,subscript-1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
- case KEY_LEFT : subscript = INTERVAL(0,subscript-1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
- case KEY_RIGHT : subscript = INTERVAL(0,subscript+1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
+ case KEY_BACKSPACE : subscript = INTVL(0,subscript-1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
+ case KEY_LEFT : subscript = INTVL(0,subscript-1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
+ case KEY_RIGHT : subscript = INTVL(0,subscript+1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
case KEY_HOME : subscript = 0; offset = subscript < 4 ? subscript-4 : subscript-3; break;
case KEY_SLEFT : subscript = 0; offset = subscript < 4 ? subscript-4 : subscript-3; break;
case KEY_HOME : subscript = 7; offset = subscript < 4 ? subscript-4 : subscript-3; break;
@@ -833,9 +776,9 @@ forever {
else {
switch ch : {
case '\n' : goto(fin);
- case '\b' : subscript = INTERVAL(0,subscript-1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
- case ' ' : subscript = INTERVAL(0,subscript+1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
- default: if (isxdigit(ch)) {hexbuffer[subscript] = ch; printw(ch);}; subscript = INTERVAL(0,subscript+1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
+ case '\b' : subscript = INTVL(0,subscript-1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
+ case ' ' : subscript = INTVL(0,subscript+1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
+ default: if (isxdigit(ch)) {hexbuffer[subscript] = ch; printw(ch);}; subscript = INTVL(0,subscript+1,7); offset = subscript < 4 ? subscript-4 : subscript-3; break;
}
}
move(y,x+offset);
@@ -889,7 +832,7 @@ DAY = ((6 ≤ DATE.hour) && (DATE.hour < 18))
NIGHT = ((DATE.hour < 6) || (18 ≤ DATE.hour))
}
-//cartesian projection, →x ↓y ↑z (+y=-z)
+//cartesian projection, ->x ↓y ↑z (+y=-z)
struct coord3:
uchar x
@@ -1336,42 +1279,42 @@ int itemswap (item1,item2)
heldobjtyp *item1
heldobjtyp *item2
{
-heldobjtyp *prev1 = item1→prev
-heldobjtyp *prev2 = item2→prev
-heldobjtyp *next1 = item1→next
-heldobjtyp *next2 = item2→next
-if (item1→next = item2) {
- prev1→next = item2
- item2→prev = prev1
-
- item2→next = item1
- item1→prev = item2
-
- next2→prev = item1
- item1→next = next2
+heldobjtyp *prev1 = item1->prev
+heldobjtyp *prev2 = item2->prev
+heldobjtyp *next1 = item1->next
+heldobjtyp *next2 = item2->next
+if (item1->next = item2) {
+ prev1->next = item2
+ item2->prev = prev1
+
+ item2->next = item1
+ item1->prev = item2
+
+ next2->prev = item1
+ item1->next = next2
}
-if (item2→next = item1) {
- prev2→next = item1
- item1→prev = prev2
+if (item2->next = item1) {
+ prev2->next = item1
+ item1->prev = prev2
- item1→next = item2
- item2→prev = item1
+ item1->next = item2
+ item2->prev = item1
- next1→prev = item2
- item2→next = next1
+ next1->prev = item2
+ item2->next = next1
}
else {
- prev1→next = item2
- item2→prev = prev1
+ prev1->next = item2
+ item2->prev = prev1
- next1→prev = item2
- item2→next = next1
+ next1->prev = item2
+ item2->next = next1
- prev2→next = item1
- item1→prev = prev2
+ prev2->next = item1
+ item1->prev = prev2
- next2→prev = item1
- item1→next = next2
+ next2->prev = item1
+ item1->next = next2
}
}
@@ -1823,14 +1766,14 @@ uchar subject : 2 //0 = cooking, 1 = weapons, 2 = language, 3 = spellcraft
uchar uses : 6
*void contents
-char* wandmaterials[16] = {"oak","ash","yew","honeylocust","silver","bronze","iron","orichalcum","marble","bone","dragon fang","unicorn horn","glass","lead crystal","adamantine","stardust"} //stoning → marble
+char* wandmaterials[16] = {"oak","ash","yew","honeylocust","silver","bronze","iron","orichalcum","marble","bone","dragon fang","unicorn horn","glass","lead crystal","adamantine","stardust"} //stoning -> marble
wandtyp:
uchar matter : 4
uchar uses : 4
symtabref bound : 8
-char* baubmaterials[8] = {"yew","bronze","silver","gold","soapstone","ivory","obsidian","stardust"} //stoning → soapstone
+char* baubmaterials[8] = {"yew","bronze","silver","gold","soapstone","ivory","obsidian","stardust"} //stoning -> soapstone
baubtype :
schar type : 2 //0=ring, 1=bracelet, -1=amulet, -2=tiara
@@ -1897,7 +1840,6 @@ lightyp *lamp_ptr
* .dump : a debugger data dump, with a format somwhere between JSON, INI, and C-like pseudocode. essentialy a dat file in readable (and non-raw) format.
*
* if the following new extensions collide with anything, I will change them. I specifically chose ones that were not a TLA or EFLA to try and avoid this, because there have been TDMTLA since before I came along.
- * .iwfcext : a plugin. "iwfc" should be replaced with the abbiviation of the final name.
* .midibas : midiBASIC, to be parsed by the midi generator into a .h file. Represents a different subset of general midi than regular midi files, but does so in a human readable format.
*/
@@ -2657,66 +2599,66 @@ roomtyp* roomptr
{
if (roomptr == NULL) {roomptr = ROOM}
{
- encontyp* current = roomptr→encon_ptr→prev
- encontyp* previous = roomptr→encon_ptr→prev→prev
- roomptr→encon_ptr→prev→next = NULL
- roomptr→encon_ptr→prev = NULL
+ encontyp* current = roomptr->encon_ptr->prev
+ encontyp* previous = roomptr->encon_ptr->prev->prev
+ roomptr->encon_ptr->prev->next = NULL
+ roomptr->encon_ptr->prev = NULL
while (previous != NULL) {
free(current)
current = previous
- previous = previous→prev
+ previous = previous->prev
}
free(current)
current = NULL
}
{
- setcoord3* current = roomptr→encon_ptr→prev
- setcoord3* previous = roomptr→encon_ptr→prev→prev
- roomptr→encon_ptr→prev→next = NULL
- roomptr→encon_ptr→prev = NULL
+ setcoord3* current = roomptr->encon_ptr->prev
+ setcoord3* previous = roomptr->encon_ptr->prev->prev
+ roomptr->encon_ptr->prev->next = NULL
+ roomptr->encon_ptr->prev = NULL
while (previous != NULL) {
free(current)
current = previous
- previous = previous→prev
+ previous = previous->prev
}
free(current)
current = NULL
}
{
- enttyp* current = roomptr→encon_ptr→prev
- enttyp* previous = roomptr→encon_ptr→prev→prev
- roomptr→encon_ptr→prev→next = NULL
- roomptr→encon_ptr→prev = NULL
+ enttyp* current = roomptr->encon_ptr->prev
+ enttyp* previous = roomptr->encon_ptr->prev->prev
+ roomptr->encon_ptr->prev->next = NULL
+ roomptr->encon_ptr->prev = NULL
while (previous != NULL) {
free(current)
current = previous
- previous = previous→prev
+ previous = previous->prev
}
free(current)
current = NULL
}
{
- mapobjtyp* current = roomptr→encon_ptr→prev
- mapobjtyp* previous = roomptr→encon_ptr→prev→prev
- roomptr→encon_ptr→prev→next = NULL
- roomptr→encon_ptr→prev = NULL
+ mapobjtyp* current = roomptr->encon_ptr->prev
+ mapobjtyp* previous = roomptr->encon_ptr->prev->prev
+ roomptr->encon_ptr->prev->next = NULL
+ roomptr->encon_ptr->prev = NULL
while (previous != NULL) {
free(current)
current = previous
- previous = previous→prev
+ previous = previous->prev
}
free(current)
current = NULL
}
{
- lightyp* current = roomptr→encon_ptr→prev
- lightyp* previous = roomptr→encon_ptr→prev→prev
- roomptr→encon_ptr→prev→next = NULL
- roomptr→encon_ptr→prev = NULL
+ lightyp* current = roomptr->encon_ptr->prev
+ lightyp* previous = roomptr->encon_ptr->prev->prev
+ roomptr->encon_ptr->prev->next = NULL
+ roomptr->encon_ptr->prev = NULL
while (previous != NULL) {
free(current)
current = previous
- previous = previous→prev
+ previous = previous->prev
}
free(current)
current = NULL
@@ -2881,7 +2823,7 @@ forever {
typ* ptr =
while (ptr != NULL) {
_act(&ptr) //&ptr's turn
- ptr = ptr→next
+ ptr = ptr->next
}
}
@@ -2891,13 +2833,13 @@ uchar tableid
{
encontyp *ptr = ROOM.encon_head
for (;tableid != 0;tableid--) {
- ptr = ptr→next
+ ptr = ptr->next
}
uchar try;
for (;count != 0;count--) {
try = mainh_roll(10,20,1)
- if (try > ptr→tobeat) {
- summonfunc(ptr→spawn)
+ if (try > ptr->tobeat) {
+ summonfunc(ptr->spawn)
}
}
}
@@ -3003,23 +2945,23 @@ FILE* list = fopen(path)
char buffer[BUFFERMAX]
stringlistyp* output = malloc(sizeof(stringlistyp))
fgets(buffer,BUFFERMAX - 1,list)
-output→prev = output
-output→next = output
-output→text = calloc(stringlen(buffer),sizeof(char))
-strcpy(output→text,buffer)
+output->prev = output
+output->next = output
+output->text = calloc(stringlen(buffer),sizeof(char))
+strcpy(output->text,buffer)
stringlistyp* new
while (EOF != fgets(buffer,511,list)) {
new = malloc(sizeof(stringlistyp))
fgets(buffer,BUFFERMAX - 1,list)
- output→prev = output
- output→next = output
- output→text = calloc(stringlen(buffer),sizeof(char))
- strcpy(output→text,buffer)
- output→prev→next = new
- new→prev = output→prev
- new→next = output
- output→prev = new
+ output->prev = output
+ output->next = output
+ output->text = calloc(stringlen(buffer),sizeof(char))
+ strcpy(output->text,buffer)
+ output->prev->next = new
+ new->prev = output->prev
+ new->next = output
+ output->prev = new
}
}
diff --git a/src/macro.h b/src/macro.h
new file mode 100644
index 0000000..331a05c
--- /dev/null
+++ b/src/macro.h
@@ -0,0 +1,113 @@
+// prettify the tokens my eyes don't parse
+#define ≥ >=
+#define ≤ <=
+#define forever for (;;)
+
+#ifndef OK
+#define OK 0
+#endif
+
+#ifndef ERR
+#define ERR -1
+#endif
+
+#ifndef EOF
+#error now you're just TRYING to break stuff...
+#endif
+
+#ifndef NULL
+#warning ... ...wh ... ... how??
+#define NULL ((void*)0)
+#endif
+
+#define TRUE true
+#define FALSE false
+#define NIL ""
+
+/*ENVIROMENTALS*/
+#define BUFFER_MAX 512
+#define FLOPPYSIZE 1474560
+#define DRUMSIZE 16384
+#define BGCOLORS 8
+#define FGCOLORS 8
+
+/*VERSION*/
+#define ENGINE_VERSION "Prealpha"
+#define RULES_VERSION "Prealpha"
+#define API_VERSION "Prealpha"
+#ifndef SAVE_VERSION
+#define SAVE_VERSION "MISSING"
+#endif
+#ifndef EXT_PARS_VERSION
+#define EXT_PARSE_VERSION "MISSING"
+#endif
+#ifndef RUNCOM_VERSION
+#define RUNCOM_VERSION "MISSING"
+#endif
+#ifndef MIDIBAS_VERSION
+#define MIDIBAS_VERSION "MISSING"
+#endif
+#ifndef MIDI_TYPE
+#define MIDI_TYPE "MISSING"
+#endif
+
+/*FUNCTION MACROS*/
+#define BACKGROUND 010
+#define MAX(A,B) (A > B ? A : B)
+#define MIN(A,B) (A < B ? A : B)
+#define SGN(N) (N < 0 ? 1 : (N > 0 ? -1 : (N == 0 ? 0 : NAN)))
+#define INTVL(A,N,B) MIN(MAX(A,N),B)
+#define COORDSUB(Z,Y,X) ((MAX_Y * Z) + (MAX_X * Y) + X)
+
+// kludge so that stdio and ncurses play nice together
+#define RESET "\033c\033[2J\033[0H"
+#define BREAKCURSES clear();refresh();endwin();printf(RESET);fflush(stdout);
+#define FIXCURSES printf(RESET);fflush(stdout);initialize();while (fgetc(stdin) != '\n');refresh;
+#define BLINKY "\033[5m_\033[25m"
+
+#define MACRO__DLLIST_NOCIRC_PUSH(HEAD,NEW) {\
+ NEW->prev = HEAD->prev;\
+ HEAD->prev->next = NEW;\
+ NEW->next = NULL;\
+ HEAD->prev = NEW;\
+ }
+
+#define MACRO__DLLIST_NOCIRC_FREE(HEAD,DEADBEEF) {\
+ if (HEAD->prev == DEADBEEF) {\
+ HEAD->prev = HEAD->prev->prev;\
+ HEAD->prev->next = NULL;\
+ }\
+ else if (HEAD == DEADBEEF) {\
+ HEAD = HEAD->next;\
+ HEAD->prev = DEADBEEF->prev;\
+ }\
+ else {\
+ DEADBEEF->next->prev = DEADBEEF->prev;\
+ DEADBEEF->prev->next = DEADBEEF->next;\
+ }\
+ free(DEADBEEF);\
+ }\
+
+#define MACRO__DLLIST_INSERT(PREV,NEW) {\
+ NEW->prev = PREV;\
+ NEW->next = PREV->next;\
+ PREV->next->prev = NEW;\
+ PREV->next = NEW;\
+ }
+
+#define MACRO__DLLIST_CIRCLE_FREE(HEAD,DEADBEEF) {\
+ if (HEAD->prev == DEADBEEF) {\
+ HEAD->prev = HEAD->prev->prev;\
+ HEAD->prev->next = HEAD;\
+ }\
+ else if (HEAD == DEADBEEF) {\
+ HEAD = HEAD->next;\
+ HEAD->prev = DEADBEEF->prev;\
+ HEAD->prev->next = HEAD;\
+ }\
+ else {\
+ DEADBEEF->next->prev = DEADBEEF->prev;\
+ DEADBEEF->prev->next = DEADBEEF->next;\
+ }\
+ free(DEADBEEF);\
+ }\
diff --git a/src/modules/IWannaFly/Macro.pm b/src/modules/IWannaFly/Macro.pm
new file mode 100644
index 0000000..c4aa38c
--- /dev/null
+++ b/src/modules/IWannaFly/Macro.pm
@@ -0,0 +1,52 @@
+package IWannaFly;
+
+use warnings;
+use strict;
+use boolean;
+use Scalar::Utils;
+use Filter::Simple;
+
+FILTER_ONLY
+ code => sub { s/).*)-->//g };
+FILTER_ONLY
+ code => sub { s/≤/<=/g };
+FILTER_ONLY
+ code => sub { s/≥/>=/g };
+FILTER_ONLY
+ code => sub { s/NaN/"NaN"/ig };
+FILTER_ONLY
+ code => sub { s/(-?)INF(INITY)?/"$1Inf"/ig };
+FILTER_ONLY
+ code => sub { s/T(RUE|rue)/true/g };
+FILTER_ONLY
+ code => sub { s/F(ALSE|alse)/false/g };
+FILTER_ONLY
+ code => sub { s/NIL/''/g };
+FILTER_ONLY
+ code => sub { s/¤/\$/g };
+FILTER_ONLY
+ code => sub { s/¢/\$/g };
+FILTER_ONLY
+ code => sub { s/£/\$/g };
+FILTER_ONLY
+ code => sub { s/€/\$/g };
+FILTER_ONLY
+ code => sub { s/§/\$/g };
+FILTER_ONLY
+ code => sub { s/♯/\$/g };
+FILTER_ONLY
+ code => sub { s/¶/\$/g };
+FILTER_ONLY
+ code => sub { s/‽(\()?/refaddr$1 /g };
+FILTER_ONLY
+ code => sub { s/OK(AY)?/0/g };
+FILTER_ONLY
+ code => sub { s/OKAY/0/ig };
+FILTER_ONLY
+ code => sub { s/ERR/-1/ig };
+FILTER_ONLY
+ code => sub { s/«((?!»).*)»[\t]+:\(([\w]+)\)$/$1;\n\tgoto $2;\n/gm };
+FILTER_ONLY
+ code => sub { s/«((?!»).*)»[\t]+:S\(([\w]+)\)F\(([\w]+)\)\n$/if ( $1 ) {\n\tgoto $2;\n} else {\n\tgoto $3;\n}/gm };
+FILTER_ONLY
+ code => sub { s/: int;/: optimize(int);/g };
diff --git a/src/modules/IWannaFly/Main.pm b/src/modules/IWannaFly/Main.pm
new file mode 100644
index 0000000..c0e9590
--- /dev/null
+++ b/src/modules/IWannaFly/Main.pm
@@ -0,0 +1,140 @@
+package IWannaFly::Main;
+use lib '..';
+use strict;
+use warnings;
+
+use IWannaFly::Struct;
+use IWannaFly'Macro;
+use IWannaFly'Null;
+
+
+# this program uses tight integration between C and Perl,
+# using what I am terming "Black Magic" scalars
+# (following the theme of the perl internal docs),
+# as they are have the potential to aquire...ultimate power.
+#
+# the interaction these functions is Thus:
+#
+# C <+> Perl <+> C
+# \________/
+#
+# The XSUB is able to _leak_ newly created variables back to the
+# grandparent C program by throwing them on the heap. in theory.
+# It may instead anger the MMU, but there should be ways around this...
+# (Thread safety? what's that?)
+# I call this tunneling.
+#
+# These scalars will use special sigils:
+#
+# £foo is a complicated struct object ref
+# ¢foo is a singly, circularly linked list
+# €foo is a doubly, half-circularly linked list object
+# §foo is a doubly, circularly linked list object
+#
+# any struct pointer fields are converted to tied hash objects,
+# and a Ptr field will be added to these objects to hold the heap
+# pointer that values are tied to. the DESTROY routine is
+#
+# Similarly, prev, next, or other pointer fields may be NULL
+# (a Filter::Simple macro in IWannaFly'Null, which wrapps the C NULL),
+# and ANY field may be undef or absent if it is to be untouched.
+# circularly linked list iteration is terminated when
+# $HEAD->Ptr == $CURR->next->Ptr
+# all other linked list iteration is terminated when
+# !$CURR->next
+#
+# more mundane sigils are also added:
+#
+# ¤bar is a reference
+# °bar is a C pointer
+# ♯bar is a bitfield or boolean
+# ¶bar is a string
+# ‽$bar is the refaddr function
+#
+# all these extra sigils except ‰ and ‽ are processed to $ by
+# Filter::Simple in IWannaFly::Macro. they mearly provide
+# disambiguation of special scalars/fields while inspecting code.
+# since THEY ARE ALL INTERCHANGEABLE WITH EACHOTHER AND $, their usage
+# is akin to a footnote comment that referrs back here.
+# when declaring a new ♯, you should use it with ": optimize(int);"
+# from optimize::int, or the Filter::Simple macro for it in
+# IWannaFly'Macro, which is simply ": int;"
+#
+# scalars generated from primatives will require a complementery pointer
+# to be provided in order to be synced, while this is built in to the
+# object resulting from a struct.
+#
+# modules for providing type support will be provided.
+# every type will provide an assciated class.
+# they will provide malloc, calloc, new, and fetch(°)
+# these must be called by full name.
+#
+# ::malloc and ::calloc are wrappers for the C functions.
+# they create a tunnelable heap object and pass the pointer
+#
+# ::new creates a blank object
+#
+# ::fetch(°ptr) creates a hash or scaler from a given °ptr
+#
+# once an object is created, a ->SYNC method will be created for it,
+# which writes to ->Ptr
+#
+# fields which contain circularly linked lists may call IndexFwd and
+# IndexBack on the reference itself to change the object pointed to.
+# calling this on a half-circularly linked list will break it.
+# calling IndexFwd on a Singly linked list creates a memory leak,
+# calling IndexBack on a Singly linked list is a Bad Idea.
+#
+# free(♯Ptr) is untyped, and provided blessed.
+
+
+
+sub MAX($$) {return ($_[0] ≥ $_[1] ? $_[0] : $_[1])}
+bless MAX, NIL;
+
+sub MIN($$) {return ($_[0] ≤ $_[1] ? $_[0] : $_[1])}
+bless MIN, NIL;
+
+sub SGN($) {$_ <=> 0}
+bless SGN, NIL;
+
+sub INTVL($$$) {return MIN( MAX( $_[0],$_[1] ) ,$_[2] )}
+bless INTVL, NIL;
+
+sub DLLIST_NOCIRC_PUSH(€€) {
+ my (€HEAD,€PUSHY) = @_;
+ €PUSHY->prev = €HEAD->prev;
+ €PUSHY->prevptr = €HEAD->prevptr;
+ €HEAD->prev->next = €PUSHY;
+ €HEAD->prev->nextptr = €PUSHY->ptr;
+ €PUSHY->next = undef;
+ €PUSHY->nextptr = NULL;
+ €HEAD->prev = €PUSHY;
+ €HEAD->prevptr = €PUSHY->ptr;
+ }
+
+sub DLLIST_NOCIRC_FREE(€€) {
+ my (€HEAD,€DEAD) = @_;
+ if (‽€HEAD->prev == ‽€DEAD) {
+ €HEAD->prev = €HEAD->prev->prev;
+ €HEAD->prev->next = undef;
+ €HEAD->prev->nextptr = NULL;
+ }
+ elsif (addrof(€HEAD) == addrof(§DEAD)) {
+ unless ((!€HEAD->next) || (€HEAD->next == NULL)) {
+ €HEAD = €HEAD->next;
+ €HEAD->prev = €DEAD->prev;
+ €HEAD->prevptr = €DEAD->prevptr;
+ }
+ else {
+ €DEAD->next->prev = €DEAD->prev;
+ €DEAD->next->prevptr = €DEAD->prevptr;
+ €DEAD->prev->next = €DEAD->next;
+ €DEAD->prev->nextptr = €DEAD->nextptr;
+ €DEAD->prev->next = €DEAD->next;
+ }
+ free(€DEAD);
+ }
+
+
diff --git a/src/modules/IWannaFly/Null.pm b/src/modules/IWannaFly/Null.pm
new file mode 100644
index 0000000..6cf1bec
--- /dev/null
+++ b/src/modules/IWannaFly/Null.pm
@@ -0,0 +1,13 @@
+package IWannafly'Null;
+require Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT = qw(NULL);
+use Inline 'C';
+sub NULL {
+ iwfperl_inline_null;
+ }
+__END__
+__C__
+void* iwfperl__inline__null() {
+ return NULL;
+ }
diff --git a/src/modules/IWannaFly/Types/Struct/classtyp/XSLIB/classtyp.xs b/src/modules/IWannaFly/Types/Struct/classtyp/XSLIB/classtyp.xs
new file mode 100644
index 0000000..7fd9a99
--- /dev/null
+++ b/src/modules/IWannaFly/Types/Struct/classtyp/XSLIB/classtyp.xs
@@ -0,0 +1,60 @@
+ #define PERL_NO_GET_CONTEXT
+ #include
+ #include "EXTERN.h"
+ #include "perl.h"
+ #include "XSUB.h"
+ extern struct classtyp;
+ MODULE="IWannaFly::Types::Struct::classtype'xs" PACKAGE="IWannaFly::Types::Struct::classtype'xs"
+
+ void*
+ iwfperl_malloc_struct_classtyp()
+ CODE:
+ RETVAL = malloc(sizeof(struct classtyp));
+ OUTPUT:
+ RETVAL
+
+ void*
+ iwfperl_calloc_struct_classtyp()
+ CODE:
+ RETVAL = calloc(1,sizeof(struct classtyp));
+ OUTPUT:
+ RETVAL
+
+ HV*
+ iwfperl_new_struct_classtyp()
+ CODE:
+ RETVAL = newHV();
+ hv_store(RETVAL,"Ptr",3,newSViv(NULL),0);
+ hv_store(RETVAL,"role",4,newSV(0),0);
+ hv_store(RETVAL,"class",5,newSV(0),0);
+ hv_store(RETVAL,"align",5,newSV(0),0);
+ hv_store(RETVAL,"charismatic",11,newSV(0),0);
+ hv_store(RETVAL,"scorned",7,newSV(0),0);
+ OUTPUT:
+ RETVAL
+
+ HV*
+ iwfperl_fetch_struct_classtyp(ptr)
+ struct classtyp* ptr;
+ CODE:
+ RETVAL = newHV();
+ hv_store(RETVAL,"Ptr",3,newSViv(ptr),0);
+ hv_store(RETVAL,"role",4,newSViv(ptr->role),0);
+ hv_store(RETVAL,"class",5,newSViv(ptr->class),0);
+ hv_store(RETVAL,"align",5,newSViv(ptr->align),0);
+ hv_store(RETVAL,"charismatic",11,newSViv(ptr->charismatic),0);
+ hv_store(RETVAL,"scorned",7,newSViv(ptr->scorned),0);
+ OUTPUT:
+ RETVAL
+
+ void
+ iwfperl_sync_struct_classtype(input)
+ HV* input
+ CODE:
+ struct classtyp* ptr = hv_fetch(input,"Ptr",3,0);
+ if (ptr != NULL) {
+ ((struct classtyp*)SvIV(*ptr))->role = hv_fetch(foo,"role",4,0);
+ ((struct classtyp*)SvIV(*ptr))->class = hv_fetch(foo,"class",5,0);
+ ((struct classtyp*)SvIV(*ptr))->align = hv_fetch(foo,"align",5,0);
+ ((struct classtyp*)SvIV(*ptr))->charismatic = hv_fetch(foo,"charismatic",11,0);
+ ((struct classtyp*)SvIV(*ptr))->scorned = hv_fetch(foo,"scorned",7,0);
diff --git a/src/modules/IWannaFly/Types/Struct/classtyp/classtyp.pm b/src/modules/IWannaFly/Types/Struct/classtyp/classtyp.pm
new file mode 100644
index 0000000..233ebda
--- /dev/null
+++ b/src/modules/IWannaFly/Types/Struct/classtyp/classtyp.pm
@@ -0,0 +1,33 @@
+package IWannaFly::Types::Struct::classtyp
+use warnings;
+use strict;
+use Hash::Util;
+use IWannaFly::Macro
+use IWannaFly::Types::Struct::classtyp'xs;
+
+sub malloc {
+ °Ptr = IWannaFly::Types::Struct::classtyp'xs::iwfperl_malloc_struct_classtyp;
+ °Ptr;
+ }
+
+sub calloc {
+ °Ptr = IWannaFly::Types::Struct::classtyp'xs::iwfperl_calloc_struct_classtyp;
+ °Ptr;
+ }
+
+sub new($) {
+ my $self = shift;
+ £struct = IWannaFly::Types::Struct::classtyp'xs::iwfperl_new_struct_classtyp;
+ £struct->{sync} = IWannaFly::Types::classtyp'xs::iwfperl_sync_struct_classtype(£struct->{Ptr});
+ lock_keys(%£struct);
+ bless £struct, $self;
+ }
+
+sub fetch($°) {
+ my $self = shift;
+ my °Ptr = shift;
+ £struct = IWannaFly::Types::Struct::classtyp'xs::iwfperl_fetch_struct_classtyp(°Ptr);
+ £struct->{sync} = IWannaFly::Types::classtyp'xs::iwfperl_sync_struct_classtype(£struct->{Ptr});
+ lock_keys(%£struct);
+ bless £struct, $self;
+ }
diff --git a/src/modules/IWannaFly/Types/XSLIB/free.xs b/src/modules/IWannaFly/Types/XSLIB/free.xs
new file mode 100644
index 0000000..8326fec
--- /dev/null
+++ b/src/modules/IWannaFly/Types/XSLIB/free.xs
@@ -0,0 +1,12 @@
+ #define PERL_NO_GET_CONTEXT
+ #include
+ #include "EXTERN.h"
+ #include "perl.h"
+ #include "XSUB.h"
+ MODULE="IWannaFly::Types::free'xs" PACKAGE="IWannaFly::Types::free'xs"
+
+ void
+ iwfperl_free(input)
+ void* input
+ CODE:
+ free(input);
diff --git a/src/modules/IWannaFly/Types/free.pm b/src/modules/IWannaFly/Types/free.pm
new file mode 100644
index 0000000..2965860
--- /dev/null
+++ b/src/modules/IWannaFly/Types/free.pm
@@ -0,0 +1,19 @@
+use warnings;
+use strict;
+use IWannaFly'Macro;
+use IWannaFly::Types::free'xs;
+require Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT = qw(free destructor);
+
+sub free(°) {
+ my °Ptr = shift;
+ IWannaFly::Types::free'xs::iwfperl_free(°Ptr);
+ TRUE;
+ }
+
+sub destructor(£) {
+ my £struct = shift;
+ free(£struct->{Ptr});
+ undef £struct;
+ }
diff --git a/src/paths.h b/src/paths.h
index a311a56..877d261 100644
--- a/src/paths.h
+++ b/src/paths.h
@@ -28,3 +28,5 @@
//where non-game executables are installed
#define DOT_PATH "~/.iwannaflycurses/"
//where the config files are found
+#define PERL_PATH "/usr/lib/i386-linux-gnu/perl/5.24.1/CORE/"
+ //where the perl headers are hiding