summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-08-24 19:30:11 +0000
committerPaul Buetow <paul@buetow.org>2008-08-24 19:30:11 +0000
commit7f3055c1f4429a81de3715d5d4173353382e2de2 (patch)
treeb90ec08f692d6216ddb7673525a512c3c31fc6e1
parente95e69c55c8e38c39e7ded141272e5e793d05623 (diff)
some mods
-rw-r--r--Makefile2
-rw-r--r--docs/help.txt2
-rw-r--r--docs/stats.txt2
-rw-r--r--docs/version.txt2
-rw-r--r--examples/conditionals.fy24
-rw-r--r--src/argv.c30
-rw-r--r--src/argv.h30
-rw-r--r--src/build.h32
-rw-r--r--src/core/convert.c30
-rw-r--r--src/core/convert.h30
-rw-r--r--src/core/function.c166
-rw-r--r--src/core/function.h34
-rw-r--r--src/core/garbage.c30
-rw-r--r--src/core/garbage.h30
-rw-r--r--src/core/interpret.c72
-rw-r--r--src/core/interpret.h30
-rw-r--r--src/core/scanner.c89
-rw-r--r--src/core/scanner.h31
-rw-r--r--src/core/scope.c30
-rw-r--r--src/core/scope.h30
-rw-r--r--src/core/symbol.c30
-rw-r--r--src/core/symbol.h30
-rw-r--r--src/core/token.c30
-rw-r--r--src/core/token.h30
-rw-r--r--src/data/array.c30
-rw-r--r--src/data/array.h30
-rw-r--r--src/data/dat.c30
-rw-r--r--src/data/dat.h30
-rw-r--r--src/data/hash.c30
-rw-r--r--src/data/hash.h30
-rw-r--r--src/data/list.c30
-rw-r--r--src/data/list.h30
-rw-r--r--src/data/map.c30
-rw-r--r--src/data/map.h30
-rw-r--r--src/data/queue.c30
-rw-r--r--src/data/queue.h30
-rw-r--r--src/data/stack.c30
-rw-r--r--src/data/stack.h30
-rw-r--r--src/data/tree.c30
-rw-r--r--src/data/tree.h30
-rw-r--r--src/data/tupel.c30
-rw-r--r--src/data/tupel.h30
-rw-r--r--src/data/types.h30
-rw-r--r--src/defines.h30
-rw-r--r--src/fype.c30
-rw-r--r--src/fype.h30
-rw-r--r--src/main.c30
47 files changed, 791 insertions, 745 deletions
diff --git a/Makefile b/Makefile
index 375de0f..8f8cb62 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@ SRCS!=find ./src -name '*.c'
OBJS=$(SRCS:.c=.o)
CC?=cc
#CC=mingw32-gcc
-#DEBUG=-g3 -ggdb3
+DEBUG=-g3 -ggdb3
CFLAGS+=-c -Wall -std=c99 -pedantic $(DEBUG)
LDADD+=
HEADER?=docs/header.txt
diff --git a/docs/help.txt b/docs/help.txt
index 6cd5d48..d96ea80 100644
--- a/docs/help.txt
+++ b/docs/help.txt
@@ -1,4 +1,4 @@
-Fype v0.0-devel Build 9003
+Fype v0.0-devel Build 9116
Copyright by Paul C. Buetow (2005 - 2008) <fype@dev.buetow.org>
-e Executes given code string (see synopses)
-h Prints this help
diff --git a/docs/stats.txt b/docs/stats.txt
index 4292895..92e699d 100644
--- a/docs/stats.txt
+++ b/docs/stats.txt
@@ -1,4 +1,4 @@
===> Num of C source files : 42
-===> Num of C source lines : 7201
+===> Num of C source lines : 7256
===> Num of Fype source examples : 13
===> Num of Fype source lines : 320
diff --git a/docs/version.txt b/docs/version.txt
index 64c40e6..37e045d 100644
--- a/docs/version.txt
+++ b/docs/version.txt
@@ -1 +1 @@
-Fype v0.0-devel Build 9003
+Fype v0.0-devel Build 9116
diff --git a/examples/conditionals.fy b/examples/conditionals.fy
index 1260ae2..38bd46d 100644
--- a/examples/conditionals.fy
+++ b/examples/conditionals.fy
@@ -21,21 +21,21 @@ assert 0 == (put 0 == 1);
assert 1 == (say 0 == 0);
# "0110\n"
-assert 0 == (put 1 != 1);
-assert 1 == (put 1 != 0);
-assert 1 == (put 0 != 1);
-assert 0 == (say 0 != 0);
+assert 0 == (put 1 =! 1);
+assert 1 == (put 1 =! 0);
+assert 1 == (put 0 =! 1);
+assert 0 == (say 0 =! 0);
# "1011\n"
-assert 1 == (put 1 <= 1);
-assert 0 == (put 1 <= 0);
-assert 1 == (put 0 <= 1);
-assert 1 == (say 0 <= 0);
+assert 1 == (put 1 =< 1);
+assert 0 == (put 1 =< 0);
+assert 1 == (put 0 =< 1);
+assert 1 == (say 0 =< 0);
## "1101\n"
-assert 1 == (put 1 >= 1);
-assert 1 == (put 1 >= 0);
-assert 0 == (put 0 >= 1);
-assert 1 == (say 0 >= 0);
+assert 1 == (put 1 => 1);
+assert 1 == (put 1 => 0);
+assert 0 == (put 0 => 1);
+assert 1 == (say 0 => 0);
diff --git a/src/argv.c b/src/argv.c
index c7f43f7..426e364 100644
--- a/src/argv.c
+++ b/src/argv.c
@@ -1,13 +1,13 @@
/*:*
*: File: ./src/argv.c
*: A simple interpreter
- *:
+ *:
*: WWW : http://fype.buetow.org
*: E-Mail : fype@dev.buetow.org
- *:
- *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
+ *:
+ *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
*: All rights reserved.
- *:
+ *:
*: Redistribution and use in source and binary forms, with or without modi-
*: fication, are permitted provided that the following conditions are met:
*: * Redistributions of source code must retain the above copyright
@@ -15,20 +15,20 @@
*: * Redistributions in binary form must reproduce the above copyright
*: notice, this list of conditions and the following disclaimer in the
*: documentation and/or other materials provided with the distribution.
- *: * Neither the name of P. B. Labs nor the names of its contributors may
- *: be used to endorse or promote products derived from this software
+ *: * Neither the name of P. B. Labs nor the names of its contributors may
+ *: be used to endorse or promote products derived from this software
*: without specific prior written permission.
- *:
- *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
- *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *:
+ *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
+ *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
- *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
+ *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
*: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*: POSSIBILITY OF SUCH DAMAGE.
*:*/
diff --git a/src/argv.h b/src/argv.h
index ae690b7..745228d 100644
--- a/src/argv.h
+++ b/src/argv.h
@@ -1,13 +1,13 @@
/*:*
*: File: ./src/argv.h
*: A simple interpreter
- *:
+ *:
*: WWW : http://fype.buetow.org
*: E-Mail : fype@dev.buetow.org
- *:
- *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
+ *:
+ *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
*: All rights reserved.
- *:
+ *:
*: Redistribution and use in source and binary forms, with or without modi-
*: fication, are permitted provided that the following conditions are met:
*: * Redistributions of source code must retain the above copyright
@@ -15,20 +15,20 @@
*: * Redistributions in binary form must reproduce the above copyright
*: notice, this list of conditions and the following disclaimer in the
*: documentation and/or other materials provided with the distribution.
- *: * Neither the name of P. B. Labs nor the names of its contributors may
- *: be used to endorse or promote products derived from this software
+ *: * Neither the name of P. B. Labs nor the names of its contributors may
+ *: be used to endorse or promote products derived from this software
*: without specific prior written permission.
- *:
- *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
- *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *:
+ *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
+ *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
- *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
+ *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
*: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*: POSSIBILITY OF SUCH DAMAGE.
*:*/
diff --git a/src/build.h b/src/build.h
index 9be69e8..b5cb296 100644
--- a/src/build.h
+++ b/src/build.h
@@ -1,13 +1,13 @@
/*:*
*: File: ./src/build.h
*: A simple interpreter
- *:
+ *:
*: WWW : http://fype.buetow.org
*: E-Mail : fype@dev.buetow.org
- *:
- *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
+ *:
+ *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
*: All rights reserved.
- *:
+ *:
*: Redistribution and use in source and binary forms, with or without modi-
*: fication, are permitted provided that the following conditions are met:
*: * Redistributions of source code must retain the above copyright
@@ -15,27 +15,27 @@
*: * Redistributions in binary form must reproduce the above copyright
*: notice, this list of conditions and the following disclaimer in the
*: documentation and/or other materials provided with the distribution.
- *: * Neither the name of P. B. Labs nor the names of its contributors may
- *: be used to endorse or promote products derived from this software
+ *: * Neither the name of P. B. Labs nor the names of its contributors may
+ *: be used to endorse or promote products derived from this software
*: without specific prior written permission.
- *:
- *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
- *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *:
+ *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
+ *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
- *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
+ *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
*: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*: POSSIBILITY OF SUCH DAMAGE.
*:*/
#ifndef BUILD_H
#define BUILD_H
-#define BUILDNR 9029
+#define BUILDNR 9120
#define OS_FREEBSD
#endif
diff --git a/src/core/convert.c b/src/core/convert.c
index af36c34..73fb8a2 100644
--- a/src/core/convert.c
+++ b/src/core/convert.c
@@ -1,13 +1,13 @@
/*:*
*: File: ./src/core/convert.c
*: A simple interpreter
- *:
+ *:
*: WWW : http://fype.buetow.org
*: E-Mail : fype@dev.buetow.org
- *:
- *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
+ *:
+ *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
*: All rights reserved.
- *:
+ *:
*: Redistribution and use in source and binary forms, with or without modi-
*: fication, are permitted provided that the following conditions are met:
*: * Redistributions of source code must retain the above copyright
@@ -15,20 +15,20 @@
*: * Redistributions in binary form must reproduce the above copyright
*: notice, this list of conditions and the following disclaimer in the
*: documentation and/or other materials provided with the distribution.
- *: * Neither the name of P. B. Labs nor the names of its contributors may
- *: be used to endorse or promote products derived from this software
+ *: * Neither the name of P. B. Labs nor the names of its contributors may
+ *: be used to endorse or promote products derived from this software
*: without specific prior written permission.
- *:
- *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
- *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *:
+ *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
+ *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
- *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
+ *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
*: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*: POSSIBILITY OF SUCH DAMAGE.
*:*/
diff --git a/src/core/convert.h b/src/core/convert.h
index e38f0e6..0c8b7da 100644
--- a/src/core/convert.h
+++ b/src/core/convert.h
@@ -1,13 +1,13 @@
/*:*
*: File: ./src/core/convert.h
*: A simple interpreter
- *:
+ *:
*: WWW : http://fype.buetow.org
*: E-Mail : fype@dev.buetow.org
- *:
- *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
+ *:
+ *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
*: All rights reserved.
- *:
+ *:
*: Redistribution and use in source and binary forms, with or without modi-
*: fication, are permitted provided that the following conditions are met:
*: * Redistributions of source code must retain the above copyright
@@ -15,20 +15,20 @@
*: * Redistributions in binary form must reproduce the above copyright
*: notice, this list of conditions and the following disclaimer in the
*: documentation and/or other materials provided with the distribution.
- *: * Neither the name of P. B. Labs nor the names of its contributors may
- *: be used to endorse or promote products derived from this software
+ *: * Neither the name of P. B. Labs nor the names of its contributors may
+ *: be used to endorse or promote products derived from this software
*: without specific prior written permission.
- *:
- *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
- *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *:
+ *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
+ *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
- *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
+ *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
*: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*: POSSIBILITY OF SUCH DAMAGE.
*:*/
diff --git a/src/core/function.c b/src/core/function.c
index 7912cf7..06e89bb 100644
--- a/src/core/function.c
+++ b/src/core/function.c
@@ -1,13 +1,13 @@
/*:*
*: File: ./src/core/function.c
*: A simple interpreter
- *:
+ *:
*: WWW : http://fype.buetow.org
*: E-Mail : fype@dev.buetow.org
- *:
- *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
+ *:
+ *: Copyright (c) 2005 2006 2007 2008, Dipl.-Inf. (FH) Paul C. Buetow
*: All rights reserved.
- *:
+ *:
*: Redistribution and use in source and binary forms, with or without modi-
*: fication, are permitted provided that the following conditions are met:
*: * Redistributions of source code must retain the above copyright
@@ -15,20 +15,20 @@
*: * Redistributions in binary form must reproduce the above copyright
*: notice, this list of conditions and the following disclaimer in the
*: documentation and/or other materials provided with the distribution.
- *: * Neither the name of P. B. Labs nor the names of its contributors may
- *: be used to endorse or promote products derived from this software
+ *: * Neither the name of P. B. Labs nor the names of its contributors may
+ *: be used to endorse or promote products derived from this software
*: without specific prior written permission.
- *:
- *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
- *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *:
+ *: THIS SOFTWARE IS PROVIDED BY Paul Buetow AS IS'' AND ANY EXPRESS OR
+ *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
*: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
- *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *: DISCLAIMED. IN NO EVENT SHALL Paul Buetow BE LIABLE FOR ANY DIRECT,
+ *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
*: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*: POSSIBILITY OF SUCH DAMAGE.
*:*/
@@ -53,12 +53,19 @@
void
_process(Interpret *p_interpret, Token *p_token_store, Token *p_token_op,
- Token *p_token_next) {
+ Token *p_token_op2, Token *p_token_next) {
TokenType tt_op = token_get_tt(p_token_op);
+ TokenType tt_op2 = p_token_op2 == NULL
+ ? TT_NONE
+ : token_get_tt(p_token_op2);
#ifdef DEBUG_FUNCTION_PROCESS
- printf("PROCESS OPERATOR %s\n", tt_get_name(tt_op));
+ if (p_token_op2 == NULL)
+ printf("PROCESS OPERATOR %s\n", tt_get_name(tt_op));
+ else
+ printf("PROCESS OPERATOR %s %s\n", tt_get_name(tt_op),
+ tt_get_name(tt_op2));
token_print(p_token_next);
printf("\n");
@@ -66,34 +73,79 @@ _process(Interpret *p_interpret, Token *p_token_store, Token *p_token_op,
printf("\n");
#endif /* DEBUG_FUNCTION_PROCESS */
+ if (p_token_op2 != NULL) {
+#ifdef DEBUG_FUNCTION_PROCESS
+ printf("===> %s %s %s %s\n",
+ tt_get_name(tt_highest),
+ tt_get_name(tt_op),
+ tt_get_name(tt_op2),
+ tt_get_name(tt_highest));
+#endif /* DEBUG_FUNCTION_PROCESS */
- switch (tt_op) {
- case TT_ASSIGN:
- {
- Token *p_token_assign = p_interpret->p_token_temp;
- TokenType tt_assign = token_get_tt(p_token_assign);
-
- if (tt_assign != TT_IDENT) {
- _FUNCTION_ERROR("Can only assign to symbols",
- p_token_store);
+ switch (tt_op) {
+ case TT_NOT:
+ switch (tt_op2) {
+ case TT_ASSIGN:
+ tt_op = TT_NEQ;
+ default:
+ break;
+ }
+ case TT_ASSIGN:
+ switch (tt_op2) {
+ case TT_ASSIGN:
+ tt_op = TT_EQ;
+ break;
+ default:
+ break;
+ }
+ case TT_LT:
+ switch (tt_op2) {
+ case TT_ASSIGN:
+ tt_op = TT_LE;
+ break;
+ default:
+ break;
+ }
+ case TT_GT:
+ switch (tt_op2) {
+ case TT_ASSIGN:
+ tt_op = TT_GE;
+ break;
+ default:
+ break;
+ }
+ default:
+ break;
}
+ } else {
+ switch (tt_op) {
+ case TT_ASSIGN:
+ {
+ Token *p_token_assign = p_interpret->p_token_temp;
+ TokenType tt_assign = token_get_tt(p_token_assign);
+
+ if (tt_assign != TT_IDENT) {
+ _FUNCTION_ERROR("Can only assign to symbols",
+ p_token_store);
+ }
- Symbol *p_symbol = scope_get(p_interpret->p_scope,
- token_get_val(p_token_assign));
+ Symbol *p_symbol = scope_get(p_interpret->p_scope,
+ token_get_val(p_token_assign));
- if (p_symbol == NULL) {
- _FUNCTION_ERROR("No such symbol",
- p_token_assign);
- }
+ if (p_symbol == NULL) {
+ _FUNCTION_ERROR("No such symbol",
+ p_token_assign);
+ }
- symbol_set_val(p_symbol, p_token_store);
- symbol_set_sym(p_symbol, SYM_VARIABLE);
+ symbol_set_val(p_symbol, p_token_store);
+ symbol_set_sym(p_symbol, SYM_VARIABLE);
- return;
- }
+ return;
+ }
- break;
- NO_DEFAULT;
+ break;
+ NO_DEFAULT;
+ }
}
p_token_next = token_new_copy(p_token_next);
@@ -234,89 +286,90 @@ _process(Interpret *p_interpret, Token *p_token_store, Token *p_token_op,
NO_DEFAULT;
}
break;
- case TT_LT:
+ case TT_LE:
+ printf("DFDF\n");
switch (tt_highest) {
case TT_INTEGER:
token_set_ival(p_token_store,
- (int) token_get_ival(p_token_next) <
+ (int) token_get_ival(p_token_next) <=
token_get_ival(p_token_store));
break;
case TT_DOUBLE:
token_set_ival(p_token_store,
- token_get_dval(p_token_next) <
+ token_get_dval(p_token_next) <=
token_get_dval(p_token_store));
token_set_tt(p_token_store, TT_INTEGER);
break;
case TT_STRING:
token_set_ival(p_token_store,
strcmp(token_get_val(p_token_next),
- token_get_val(p_token_store)) < 0);
+ token_get_val(p_token_store)) <= 0);
token_set_tt(p_token_store, TT_INTEGER);
break;
NO_DEFAULT;
}
break;
- case TT_GT:
+ case TT_GE:
switch (tt_highest) {
case TT_INTEGER:
token_set_ival(p_token_store,
- (int) token_get_ival(p_token_next) >
+ (int) token_get_ival(p_token_next) >=
token_get_ival(p_token_store));
break;
case TT_DOUBLE:
token_set_ival(p_token_store,
- token_get_dval(p_token_next) >
+ token_get_dval(p_token_next) >=
token_get_dval(p_token_store));
token_set_tt(p_token_store, TT_INTEGER);
break;
case TT_STRING:
token_set_ival(p_token_store,
strcmp(token_get_val(p_token_next),
- token_get_val(p_token_store)) > 0);
+ token_get_val(p_token_store)) >= 0);
token_set_tt(p_token_store, TT_INTEGER);
break;
NO_DEFAULT;
}
break;
- case TT_LE:
+ case TT_LT:
switch (tt_highest) {
case TT_INTEGER:
token_set_ival(p_token_store,
- (int) token_get_ival(p_token_next) <=
+ (int) token_get_ival(p_token_next) <
token_get_ival(p_token_store));
break;
case TT_DOUBLE:
token_set_ival(p_token_store,
- token_get_dval(p_token_next) <=
+ token_get_dval(p_token_next) <
token_get_dval(p_token_store));
token_set_tt(p_token_store, TT_INTEGER);
break;
case TT_STRING:
token_set_ival(p_token_store,
strcmp(token_get_val(p_token_next),
- token_get_val(p_token_store)) <= 0);
+ token_get_val(p_token_store)) < 0);
token_set_tt(p_token_store, TT_INTEGER);
break;
NO_DEFAULT;
}
break;
- case TT_GE:
+ case TT_GT:
switch (tt_highest) {
case TT_INTEGER:
token_set_ival(p_token_store,
- (int) token_get_ival(p_token_next) >=
+ (int) token_get_ival(p_token_next) >
token_get_ival(p_token_store));
break;
case TT_DOUBLE:
token_set_ival(p_token_store,
- token_get_dval(p_token_next) >=
+ token_get_dval(p_token_next) >
token_get_dval(p_token_store));
token_set_tt(p_token_store, TT_INTEGER);
break;
case TT_STRING:
token_set_ival(p_token_store,
strcmp(token_get_val(p_token_next),
- token_get_val(p_token_store)) >= 0);
+ token_get_val(p_token_store)) > 0);