diff options
| author | admin (centauri.fritz.box) <puppet@mx.buetow.org> | 2014-06-30 23:53:04 +0200 |
|---|---|---|
| committer | admin (centauri.fritz.box) <puppet@mx.buetow.org> | 2014-06-30 23:53:04 +0200 |
| commit | adc4b59a3e7c9db6f33670164490830d87331228 (patch) | |
| tree | adc5d21856852bfb5c3cca794a9c07ad476d877e /src/core | |
| parent | 63cf3028445d8d213ffc774f77aafd7283cb4fbd (diff) | |
| parent | 5ab5de91eb0ae6ed9db78a2c8c47ec67f105e504 (diff) | |
Mergebuild-010393-lambda
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/convert.c | 216 | ||||
| -rw-r--r-- | src/core/convert.h | 55 | ||||
| -rw-r--r-- | src/core/frame.c | 30 | ||||
| -rw-r--r-- | src/core/frame.h | 30 | ||||
| -rw-r--r-- | src/core/function.c | 51 | ||||
| -rw-r--r-- | src/core/function.h | 46 | ||||
| -rw-r--r-- | src/core/functions.c | 985 | ||||
| -rw-r--r-- | src/core/functions.h | 64 | ||||
| -rw-r--r-- | src/core/garbage.c | 144 | ||||
| -rw-r--r-- | src/core/garbage.h | 60 | ||||
| -rw-r--r-- | src/core/interpret.c | 32 | ||||
| -rw-r--r-- | src/core/interpret.h | 32 | ||||
| -rw-r--r-- | src/core/lambda.c | 30 | ||||
| -rw-r--r-- | src/core/lambda.h | 30 | ||||
| -rw-r--r-- | src/core/promise.c | 30 | ||||
| -rw-r--r-- | src/core/promise.h | 30 | ||||
| -rw-r--r-- | src/core/reference.c | 57 | ||||
| -rw-r--r-- | src/core/reference.h | 52 | ||||
| -rw-r--r-- | src/core/scanner.c | 32 | ||||
| -rw-r--r-- | src/core/scanner.h | 32 | ||||
| -rw-r--r-- | src/core/scope.c | 169 | ||||
| -rw-r--r-- | src/core/scope.h | 60 | ||||
| -rw-r--r-- | src/core/symbol.c | 122 | ||||
| -rw-r--r-- | src/core/symbol.h | 71 | ||||
| -rw-r--r-- | src/core/token.c | 30 | ||||
| -rw-r--r-- | src/core/token.h | 30 | ||||
| -rw-r--r-- | src/core/tools.c | 30 | ||||
| -rw-r--r-- | src/core/tools.h | 30 | ||||
| -rw-r--r-- | src/core/variable.c | 30 | ||||
| -rw-r--r-- | src/core/variable.h | 30 |
30 files changed, 244 insertions, 2396 deletions
diff --git a/src/core/convert.c b/src/core/convert.c deleted file mode 100644 index cf8987e..0000000 --- a/src/core/convert.c +++ /dev/null @@ -1,216 +0,0 @@ -/*:* - *: File: ./src/core/convert.c - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#include "convert.h" -#include "../data/array.h" - -void -convert_to_integer(Token *p_token) { - switch (token_get_tt(p_token)) { - case TT_INTEGER: - break; - case TT_DOUBLE: - token_set_tt(p_token, TT_INTEGER); - token_set_ival(p_token, (int)token_get_dval(p_token)); - break; - case TT_STRING: - token_set_tt(p_token, TT_INTEGER); - token_set_ival(p_token, atoi(token_get_val(p_token))); - break; - case TT_ARRAY: - token_set_tt(p_token, TT_INTEGER); - token_set_ival(p_token, array_get_size(p_token->p_array)); - break; - default: - ERROR("Ouups(%s)", tt_get_name(token_get_tt(p_token))); - break; - } -} - -int -convert_to_integer_get(Token *p_token) { - switch (token_get_tt(p_token)) { - case TT_INTEGER: - return (token_get_ival(p_token)); - case TT_DOUBLE: - return ((int) token_get_dval(p_token)); - case TT_STRING: - return (atoi(token_get_val(p_token))); - case TT_ARRAY: - return (array_get_size(p_token->p_array)); - break; - default: - ERROR("Ouups(%s)", tt_get_name(token_get_tt(p_token))); - } - - return (0); /* Never reach this point */ -} - -void -convert_to_double(Token *p_token) { - switch (token_get_tt(p_token)) { - case TT_INTEGER: - token_set_tt(p_token, TT_DOUBLE); - token_set_dval(p_token, token_get_ival(p_token)); - break; - case TT_DOUBLE: - break; - case TT_STRING: - token_set_tt(p_token, TT_DOUBLE); - token_set_dval(p_token, atof(token_get_val(p_token))); - break; - case TT_ARRAY: - token_set_tt(p_token, TT_DOUBLE); - token_set_dval(p_token, array_get_size(p_token->p_array)); - break; - default: - token_print_val(p_token); - ERROR("Datatype conversion error '%s'", token_get_val(p_token)); - break; - } -} - -void -convert_to_string(Token *p_token) { - switch (token_get_tt(p_token)) { - case TT_INTEGER: - { - token_set_tt(p_token, TT_STRING); - char c_tmp[1024]; - sprintf(c_tmp, "%d", token_get_ival(p_token)); - int i_len = strlen(c_tmp); - p_token->c_val = realloc(p_token->c_val, sizeof(char) * (i_len + 1)); - strcpy(p_token->c_val, c_tmp); - p_token->c_val[i_len] = 0; - } - break; - case TT_DOUBLE: - { - token_set_tt(p_token, TT_STRING); - char c_tmp[1024]; - sprintf(c_tmp, "%f", token_get_dval(p_token)); - int i_len = strlen(c_tmp); - p_token->c_val = realloc(p_token->c_val, sizeof(char) * (i_len + 1)); - strcpy(p_token->c_val, c_tmp); - p_token->c_val[i_len] = 0; - } - case TT_ARRAY: - { - token_set_tt(p_token, TT_STRING); - char c_tmp[1024]; - sprintf(c_tmp, "%d", array_get_size(p_token->p_array)); - int i_len = strlen(c_tmp); - p_token->c_val = realloc(p_token->c_val, sizeof(char) * (i_len + 1)); - strcpy(p_token->c_val, c_tmp); - p_token->c_val[i_len] = 0; - } - break; - case TT_STRING: - break; - default: - ERROR("Datatype conversion error"); - break; - } -} - -void -convert_to_array(Token *p_token) { - ERROR("not yet implemented"); -} - -void -convert_to_tt(Token *p_token, TokenType tt) { - switch (tt) { - case TT_INTEGER: - convert_to_integer(p_token); - break; - case TT_DOUBLE: - convert_to_double(p_token); - break; - case TT_STRING: - convert_to_string(p_token); - break; - case TT_ARRAY: - convert_to_array(p_token); - break; - default: - ERROR("Ouups!"); - } -} - -TokenType -convert_to_highest(Token *p_token1, Token *p_token2) { - TokenType tt_highest = token_get_tt(p_token1); - - if (tt_highest < token_get_tt(p_token2)) { - tt_highest = token_get_tt(p_token2); - - convert_to_tt(p_token1, tt_highest); - - } else { - convert_to_tt(p_token2, tt_highest); - } - - return (tt_highest); -} - -TokenType -convert_function_arg_types_to_highest(Stack *p_stack_args, int i_args) { - - if (i_args <= 0) - i_args = stack_size(p_stack_args); - - StackIterator *p_iter = stackiterator_new(p_stack_args); - TokenType tt_highest = TT_INTEGER; - - for (int i = 0; i < i_args && stackiterator_has_next(p_iter); ++i) { - Token *p_token = stackiterator_next(p_iter); - if (token_get_tt(p_token) > tt_highest) - tt_highest = token_get_tt(p_token); - } - - stackiterator_delete(p_iter); - p_iter = stackiterator_new(p_stack_args); - - for (int i = 0; i < i_args && stackiterator_has_next(p_iter); ++i) { - Token *p_token = stackiterator_next(p_iter); - convert_to_tt(p_token, tt_highest); - } - - stackiterator_delete(p_iter); - - return (tt_highest); -} - diff --git a/src/core/convert.h b/src/core/convert.h deleted file mode 100644 index 9dcf23e..0000000 --- a/src/core/convert.h +++ /dev/null @@ -1,55 +0,0 @@ -/*:* - *: File: ./src/core/convert.h - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#ifndef CONVERT_H -#define CONVERT_H - -#include "../defines.h" - -#include "../data/stack.h" - -#include "token.h" - -int convert_to_integer_get(Token *p_token); -void convert_to_integer(Token *p_token); -void convert_to_double(Token *p_token); -void convert_to_string(Token *p_token); -void convert_to_array(Token *p_token); -void convert_to_tt(Token *p_token, TokenType tt); -TokenType convert_to_highest(Token *p_token1, Token *p_token2); -TokenType convert_function_arg_types_to_highest(Stack *p_stack_args, int - i_args); - -#endif diff --git a/src/core/frame.c b/src/core/frame.c index 9143a0d..fb4665d 100644 --- a/src/core/frame.c +++ b/src/core/frame.c @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/frame.c *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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/frame.h b/src/core/frame.h index d1e01f5..d9d3970 100644 --- a/src/core/frame.h +++ b/src/core/frame.h @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/frame.h *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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 deleted file mode 100644 index 70166ed..0000000 --- a/src/core/function.c +++ /dev/null @@ -1,51 +0,0 @@ -/*:* - *: File: ./src/core/function.c - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#include "../defines.h" - -#include "function.h" - -Function* -function_new() { - Function *p_function = malloc(sizeof(Function)); - - return (p_function); -} - -void -function_delete(Function *p_function) { - free(p_function); -} - diff --git a/src/core/function.h b/src/core/function.h deleted file mode 100644 index 748ebce..0000000 --- a/src/core/function.h +++ /dev/null @@ -1,46 +0,0 @@ -/*:* - *: File: ./src/core/function.h - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#ifndef FUNCTION_H -#define FUNCTION_H - -typedef struct { - char *c_name; -} Function; - -Function* function_new(); -void function_delete(Function *p_function); - -#endif /* FUNCTION_H */ diff --git a/src/core/functions.c b/src/core/functions.c deleted file mode 100644 index 82efc4f..0000000 --- a/src/core/functions.c +++ /dev/null @@ -1,985 +0,0 @@ -/*:* - *: File: ./src/core/functions.c - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#include <stdlib.h> -#include <sys/types.h> -#include <unistd.h> - -#include "functions.h" - -#include "convert.h" -#include "scope.h" -#include "symbol.h" - -#define _FUNCTIONS_ERROR(m,t) \ - ERROR(\ - "%s: Function error in %s line %d pos %d near '%s'", m, \ - token_get_filename(t), \ - token_get_line_nr(t), \ - token_get_pos_nr(t), \ - token_get_val(t) \ - ) - -Functions* -functions_new() { - Functions *p_functions = malloc(sizeof(Functions)); - - p_functions->p_hash_functions = hash_new(1024); - functions_init(p_functions); - - return (p_functions); -} - -void -functions_delete(Functions *p_functions) { - hash_delete(p_functions->p_hash_functions); - free(p_functions); -} - - -void -_process(Interpret *p_interpret, Token *p_token_store, Token *p_token_op, - 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 - if (p_token_op2 == NULL) - printf("DEBUG::FUNCTION::PROCESS: Operator %s\n", tt_get_name(tt_op)); - else - printf("DEBUG::FUNCTION::PROCESS: Operator %s %s\n", tt_get_name(tt_op), - tt_get_name(tt_op2)); - - token_print(p_token_next); - printf("\n"); - token_print(p_token_store); - printf("\n"); -#endif /* DEBUG_FUNCTION_PROCESS */ - - if (p_token_op2 != NULL) { - switch (tt_op) { - case TT_NOT: - switch (tt_op2) { - case TT_ASSIGN: - tt_op = TT_NEQ; - break; - default: - break; - } - break; - case TT_ASSIGN: - switch (tt_op2) { - case TT_ASSIGN: - tt_op = TT_EQ; - break; - default: - break; - } - break; - case TT_LT: - switch (tt_op2) { - case TT_ASSIGN: - tt_op = TT_LE; - break; - default: - break; - } - break; - case TT_GT: - switch (tt_op2) { - case TT_ASSIGN: - tt_op = TT_GE; - break; - default: - break; - } - break; - case TT_DDOT: - switch (tt_op2) { - case TT_LT: - tt_op = TT_LSHIFT; - break; - case TT_GT: - tt_op = TT_RSHIFT; - break; - default: - break; - } - 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) { - _FUNCTIONS_ERROR("Can only assign to symbols", - p_token_store); - } - - Symbol *p_symbol = scope_get(p_interpret->p_scope, - token_get_val(p_token_assign)); - - if (p_symbol == NULL) { - _FUNCTIONS_ERROR("No such symbol", - p_token_assign); - } - - symbol_set_val(p_symbol, p_token_store); - symbol_set_sym(p_symbol, SYM_VARIABLE); - - return; - } - - break; - NO_DEFAULT; - } - } - - p_token_next = token_new_copy(p_token_next); - TokenType tt_highest = convert_to_highest(p_token_store, p_token_next); - -#ifdef DEBUG_FUNCTION_PROCESS - printf("DEBUG::FUNCTION::PROCESS: ===> %s %s %s\n", - tt_get_name(tt_highest), - tt_get_name(tt_op), - tt_get_name(tt_highest)); -#endif /* DEBUG_FUNCTION_PROCESS */ - - switch (tt_op) { - case TT_ADD: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - token_get_ival(p_token_next) + - token_get_ival(p_token_store)); - break; - case TT_DOUBLE: - token_set_dval(p_token_store, - token_get_dval(p_token_next) + - token_get_dval(p_token_store)); - break; - case TT_STRING: - token_set_ival(p_token_store, - atoi(token_get_val(p_token_next)) + - atoi(token_get_val(p_token_store))); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - array_append(p_token_store->p_array, - p_token_next->p_array); - break; - NO_DEFAULT; - } - break; - case TT_SUB: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - token_get_ival(p_token_next) - - token_get_ival(p_token_store)); - break; - case TT_DOUBLE: - token_set_dval(p_token_store, - token_get_dval(p_token_next) - - token_get_dval(p_token_store)); - break; - case TT_STRING: - token_set_ival(p_token_store, - atoi(token_get_val(p_token_next)) - - atoi(token_get_val(p_token_store))); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("TT_ARRAY - TT_ARRAY not yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_MULT: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - token_get_ival(p_token_next) * - token_get_ival(p_token_store)); - break; - case TT_DOUBLE: - token_set_dval(p_token_store, - token_get_dval(p_token_next) * - token_get_dval(p_token_store)); - break; - case TT_STRING: - token_set_ival(p_token_store, - atoi(token_get_val(p_token_next)) * - atoi(token_get_val(p_token_store))); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("TT_ARRAY * TT_ARRAY not yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_DIV: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (int) token_get_ival(p_token_next) / - token_get_ival(p_token_store)); - break; - case TT_DOUBLE: - token_set_dval(p_token_store, - token_get_dval(p_token_next) / - token_get_dval(p_token_store)); - break; - case TT_STRING: - token_set_dval(p_token_store, - atof(token_get_val(p_token_next)) / - atof(token_get_val(p_token_store))); - token_set_tt(p_token_store, TT_DOUBLE); - break; - case TT_ARRAY: - ERROR("TT_ARRAY / TT_ARRAY not yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_EQ: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (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_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_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("TT_ARRAY eq TT_ARRAY not yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_NEQ: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (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_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_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("ARRAY bla yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_LE: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (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_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_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("ARRAY bla yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_GE: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (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_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_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("ARRAY bla yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_LT: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (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_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_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("ARRAY bla yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_GT: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (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_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_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("ARRAY bla yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_AND: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (int) token_get_ival(p_token_next) & - token_get_ival(p_token_store)); - break; - case TT_DOUBLE: - token_set_ival(p_token_store, - (int) token_get_dval(p_token_next) & - (int) token_get_dval(p_token_store)); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_STRING: - token_set_ival(p_token_store, - atoi(token_get_val(p_token_next)) & - atoi(token_get_val(p_token_store))); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("ARRAY bla yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_OR: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (int) token_get_ival(p_token_next) | - token_get_ival(p_token_store)); - break; - case TT_DOUBLE: - token_set_ival(p_token_store, - (int) token_get_dval(p_token_next) | - (int) token_get_dval(p_token_store)); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_STRING: - token_set_ival(p_token_store, - atoi(token_get_val(p_token_next)) | - atoi(token_get_val(p_token_store))); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("ARRAY bla yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_XOR: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (int) token_get_ival(p_token_next) ^ - token_get_ival(p_token_store)); - break; - case TT_DOUBLE: - token_set_ival(p_token_store, - (int) token_get_dval(p_token_next) ^ - (int) token_get_dval(p_token_store)); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_STRING: - token_set_ival(p_token_store, - atoi(token_get_val(p_token_next)) ^ - atoi(token_get_val(p_token_store))); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("ARRAY bla yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_LSHIFT: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (int) token_get_ival(p_token_next) << - token_get_ival(p_token_store)); - break; - case TT_DOUBLE: - token_set_ival(p_token_store, - (int) token_get_dval(p_token_next) << - (int) token_get_dval(p_token_store)); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_STRING: - token_set_ival(p_token_store, - atoi(token_get_val(p_token_next)) << - atoi(token_get_val(p_token_store))); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("ARRAY bla yet implemented"); - break; - NO_DEFAULT; - } - break; - case TT_RSHIFT: - switch (tt_highest) { - case TT_INTEGER: - token_set_ival(p_token_store, - (int) token_get_ival(p_token_next) >> - token_get_ival(p_token_store)); - break; - case TT_DOUBLE: - token_set_ival(p_token_store, - (int) token_get_dval(p_token_next) >> - (int) token_get_dval(p_token_store)); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_STRING: - token_set_ival(p_token_store, - atoi(token_get_val(p_token_next)) >> - atoi(token_get_val(p_token_store))); - token_set_tt(p_token_store, TT_INTEGER); - break; - case TT_ARRAY: - ERROR("ARRAY bla yet implemented"); - break; - NO_DEFAULT; - } - break; - - default: - _FUNCTIONS_ERROR("No such function/operator", p_token_op); - } - -#ifdef DEBUG_FUNCTION_PROCESS - token_print(p_token_store); - printf("\n\n"); -#endif /* DEBUG_FUNCTION_PROCESS */ - - token_delete(p_token_next); -} - -void -function_process(Interpret *p_interpret, Token *p_token_op, - Token *p_token_op2, Stack *p_stack_args, int i_args) { - - Token *p_token_store = token_new_copy(stack_pop(p_stack_args)); - - for (int i = 0; i < i_args -1 && !stack_empty(p_stack_args); ++i) { - Token *p_token_next = stack_pop(p_stack_args); - - _process(p_interpret, p_token_store, p_token_op, - p_token_op2, p_token_next); - } - - stack_push(p_stack_args, p_token_store); -} - -_Bool -function_is_buildin(Token *p_token_ident) { - /* TODO: optimize this function */ - if (strcmp("assert", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("decr", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("double", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("end", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("exit", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("fork", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("gc", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("incr", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("ind", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("integer", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("len", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("ln", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("neg", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("no", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("put", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("scope", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("say", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("string", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("yes", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("not", token_get_val(p_token_ident)) == 0) - return (true); - - if (strcmp("refs", token_get_val(p_token_ident)) == 0) - return (true); - - return (false); -} - -void -function_process_buildin(Interpret *p_interpret, Token *p_token_ident, - Stack *p_stack_args) { - - Token *p_token = stack_top(p_stack_args); - - if (token_get_tt(p_token) == TT_ARRAY) { - if (strcmp("len", token_get_val(p_token_ident)) == 0) { - stack_pop(p_stack_args); - stack_push(p_stack_args, - token_new_integer(array_get_used(p_token->p_array))); - - } else if (strcmp("ind", token_get_val(p_token_ident)) == 0) { - stack_pop(p_stack_args); - stack_push(p_stack_args, - token_new_integer(array_get_ind(p_token->p_array))); - - } else { - ArrayIterator *p_iter = arrayiterator_new(p_token->p_array); - - while (arrayiterator_has_next(p_iter)) { - stack_push(p_stack_args, arrayiterator_next(p_iter)); - function_process_buildin(p_interpret, p_token_ident, - p_stack_args); - stack_pop(p_stack_args); - } - - arrayiterator_delete(p_iter); - } - - return; - } - - if (strcmp("assert", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - switch (token_get_tt(p_token)) { - case TT_INTEGER: - if (token_get_ival(p_token) == 0) - _FUNCTIONS_ERROR("Assert failed", p_token); - break; - case TT_DOUBLE: - if (token_get_dval(p_token) == 0) - _FUNCTIONS_ERROR("Assert failed", p_token); - break; - case TT_STRING: - if (atoi(token_get_val(p_token)) == 0) - _FUNCTIONS_ERROR("Assert failed", p_token); - break; - NO_DEFAULT; - } - - } else if (strcmp("decr", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - switch (token_get_tt(p_token)) { - case TT_INTEGER: - token_set_ival(p_token, token_get_ival(p_token) - 1); - break; - case TT_DOUBLE: - token_set_dval(p_token, token_get_dval(p_token) - 1); - break; - case TT_STRING: - convert_to_integer(p_token); - token_set_ival(p_token, token_get_ival(p_token) - 1); - break; - NO_DEFAULT; - } - - } else if (strcmp("double", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - Token *p_token = token_new_copy(stack_pop(p_stack_args)); - convert_to_double(p_token); - stack_push(p_stack_args, p_token); - - } else if (strcmp("end", token_get_val(p_token_ident)) == 0) { - exit(0); - - } else if (strcmp("fork", token_get_val(p_token_ident)) == 0) { - Token *p_token = token_new_integer((int) fork()); - stack_push(p_stack_args, p_token); - - } else if (strcmp("gc", token_get_val(p_token_ident)) == 0) { - int i_count = garbage_collect(); - Token *p_token = token_new_integer(i_count); - stack_push(p_stack_args, p_token); - - } else if (strcmp("exit", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - p_token = token_new_copy(p_token); - convert_to_integer(p_token); - exit(token_get_ival(p_token)); - - } else if (strcmp("incr", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - switch (token_get_tt(p_token)) { - case TT_INTEGER: - token_set_ival(p_token, token_get_ival(p_token) + 1); - break; - case TT_DOUBLE: - token_set_dval(p_token, token_get_dval(p_token) + 1); - break; - case TT_STRING: - convert_to_integer(p_token); - token_set_ival(p_token, token_get_ival(p_token) + 1); - break; - NO_DEFAULT; - } - - } else if (strcmp("ind", token_get_val(p_token_ident)) == 0) { - _FUNCTIONS_ERROR("Expected array", p_token_ident); - - } else if (strcmp("integer", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - Token *p_token = token_new_copy(stack_pop(p_stack_args)); - convert_to_integer(p_token); - stack_push(p_stack_args, p_token); - - } else if (strcmp("len", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - Token *p_token = token_new_copy(stack_pop(p_stack_args)); - convert_to_string(p_token); - token_set_tt(p_token, TT_INTEGER); - token_set_ival(p_token, strlen(token_get_val(p_token))); - stack_push(p_stack_args, p_token); - - } else if (strcmp("ln", token_get_val(p_token_ident)) == 0) { - printf("\n"); - - } else if (strcmp("neg", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - Token *p_token = token_new_copy(stack_pop(p_stack_args)); - stack_push(p_stack_args, p_token); - - switch (token_get_tt(p_token)) { - case TT_INTEGER: - token_set_ival(p_token, -token_get_ival(p_token)); - break; - case TT_DOUBLE: - token_set_dval(p_token, -token_get_dval(p_token)); - break; - case TT_STRING: - token_set_ival(p_token, -atoi(token_get_val(p_token))); - token_set_tt(p_token, TT_INTEGER); - break; - NO_DEFAULT; - } - - } else if (strcmp("no", token_get_val(p_token_ident)) == 0) { - Token *p_token = NULL; - - if (0 == stack_size(p_stack_args)) { - p_token = token_new_integer(0); - - } else { - p_token = token_new_copy(stack_pop(p_stack_args)); - - switch (token_get_tt(p_token)) { - case TT_INTEGER: - token_set_ival(p_token, !token_get_ival(p_token)); - break; - case TT_DOUBLE: - token_set_dval(p_token, !token_get_dval(p_token)); - break; - case TT_STRING: - token_set_ival(p_token, !atoi(token_get_val(p_token))); - token_set_tt(p_token, TT_INTEGER); - break; - NO_DEFAULT; - } - } - - stack_push(p_stack_args, p_token); - - } else if (strcmp("put", token_get_val(p_token_ident)) == 0) { - StackIterator *p_iter = stackiterator_new(p_stack_args); - while (stackiterator_has_next(p_iter)) { - Token *p_token = stackiterator_next(p_iter); - switch (token_get_tt(p_token)) { - case TT_INTEGER: - printf("%d", token_get_ival(p_token)); - break; - case TT_DOUBLE: - printf("%f", token_get_dval(p_token)); - break; - case TT_STRING: - printf("%s", token_get_val(p_token)); - break; - NO_DEFAULT; - } - } - stackiterator_delete(p_iter); - - } else if (strcmp("scope", token_get_val(p_token_ident)) == 0) { - scope_print(p_interpret->p_scope); - - } else if (strcmp("say", token_get_val(p_token_ident)) == 0) { - StackIterator *p_iter = stackiterator_new(p_stack_args); - while (stackiterator_has_next(p_iter)) { - Token *p_token = stackiterator_next(p_iter); - switch (token_get_tt(p_token)) { - case TT_INTEGER: - printf("%d", token_get_ival(p_token)); - break; - case TT_DOUBLE: - printf("%f", token_get_dval(p_token)); - break; - case TT_STRING: - printf("%s", token_get_val(p_token)); - break; - } - } - stackiterator_delete(p_iter); - printf("\n"); - - } else if (strcmp("string", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - Token *p_token = token_new_copy(stack_pop(p_stack_args)); - convert_to_string(p_token); - stack_push(p_stack_args, p_token); - - } else if (strcmp("yes", token_get_val(p_token_ident)) == 0) { - Token *p_token = NULL; - - if (0 == stack_size(p_stack_args)) { - p_token = token_new_integer(1); - - } else { - p_token = token_new_copy(stack_pop(p_stack_args)); - token_set_ival(p_token, 1); - token_set_tt(p_token, TT_INTEGER); - - } - - stack_push(p_stack_args, p_token); - - } else if (strcmp("not", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - Token *p_token = token_new_copy(stack_pop(p_stack_args)); - stack_push(p_stack_args, p_token); - - switch (token_get_tt(p_token)) { - case TT_INTEGER: - token_set_ival(p_token, !token_get_ival(p_token)); - break; - case TT_DOUBLE: - token_set_dval(p_token, !token_get_dval(p_token)); - break; - case TT_STRING: - token_set_ival(p_token, !atoi(token_get_val(p_token))); - token_set_tt(p_token, TT_INTEGER); - break; - NO_DEFAULT; - } - - } else if (strcmp("refs", token_get_val(p_token_ident)) == 0) { - if (0 == stack_size(p_stack_args)) - _FUNCTIONS_ERROR("No argument given", p_token_ident); - - Token *p_token_top = stack_pop(p_stack_args); - Token *p_token = token_new_integer(p_token_top->i_ref_count); - stack_push(p_stack_args, p_token); - } -} - -_Bool -function_is_self_defined(Interpret *p_interpret) { - Symbol *p_symbol = scope_get(p_interpret->p_scope, - token_get_val(p_interpret->p_token)); - - if (p_symbol == NULL) - return (false); - - switch (symbol_get_sym(p_symbol)) { - case SYM_PROCEDURE: - case SYM_FUNCTION: - return (true); - NO_DEFAULT; - } - - return (false); -} - -void -function_process_self_defined(Interpret *p_interpret, Token *p_token_ident) { - Symbol *p_symbol = scope_get(p_interpret->p_scope, - token_get_val(p_token_ident)); - - switch (symbol_get_sym(p_symbol)) { - case SYM_PROCEDURE: - { - List *p_list_token = symbol_get_val(p_symbol); - interpret_subprocess(p_interpret, p_list_token); - } - break; - case SYM_FUNCTION: - { - List *p_list_token = symbol_get_val(p_symbol); - scope_up(p_interpret->p_scope); - interpret_subprocess(p_interpret, p_list_token); - scope_down(p_interpret->p_scope); - } - NO_DEFAULT; - } -} - -void -functions_init(Functions *p_functions) { -} diff --git a/src/core/functions.h b/src/core/functions.h deleted file mode 100644 index 4e00dc2..0000000 --- a/src/core/functions.h +++ /dev/null @@ -1,64 +0,0 @@ -/*:* - *: File: ./src/core/functions.h - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#ifndef FUNCTIONS_H -#define FUNCTIONS_H - -#include "token.h" - -#include "interpret.h" -#include "../data/stack.h" -#include "../data/hash.h" - -typedef struct { - Hash *p_hash_functions; -} Functions; - -Functions* functions_new(); -void functions_delete(Functions *p_functions); -void functions_init(Functions *p_functions); - -void function_process(Interpret *p_interp, Token *p_token_op, - Token *p_token_op2, Stack *p_stack_args, - int i_args); -_Bool function_is_buildin(Token *p_token_ident); -void function_process_buildin(Interpret *p_interpret, - Token *p_token_ident, - Stack *p_stack_args); -_Bool function_is_self_defined(Interpret *p_interpret); -void function_process_self_defined(Interpret *p_interpret, - Token *p_token_ident); - -#endif /* FUNCTIONS_H */ diff --git a/src/core/garbage.c b/src/core/garbage.c deleted file mode 100644 index 23c73b8..0000000 --- a/src/core/garbage.c +++ /dev/null @@ -1,144 +0,0 @@ -/*:* - *: File: ./src/core/garbage.c - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#include "garbage.h" - -#define _GARBAGE_ERROR(m) \ - ERROR("%s: Garbage error", m); - -List *LIST_GARBAGE = NULL; - -typedef struct { - void (*p_func)(void*); - void (*p_print)(void*); - int *p_ref_count; - void *p_2free; - GarbageType type; -} _Garbage; - -void -garbage_init() { - LIST_GARBAGE = list_new(); -} - -void -garbage_destroy() { - garbage_collect(); - if (!list_empty(LIST_GARBAGE)) { - EPRINTF("The garbage collector still has %d registered items " - " which don't have a zero ref count!\n", - list_size(LIST_GARBAGE)); - - _GARBAGE_ERROR("Garbage left"); - } - - list_delete(LIST_GARBAGE); -} - -int -garbage_collect() { - ListIterator *p_iter = listiterator_new(LIST_GARBAGE); - List *p_list_garbage_new = list_new(); - int i_count = 0; - - while (listiterator_has_next(p_iter)) { - _Garbage *p_garbage = listiterator_next(p_iter); - - if (p_garbage->p_ref_count == NULL || *p_garbage->p_ref_count <= 0) { -#ifdef DEBUG_GC - printf("DEBUG::GC: Freeing "); - if (NULL != p_garbage->p_print) - (*p_garbage->p_print) (p_garbage->p_2free); - else - printf("0x%x\n", (int) p_garbage->p_2free); -#endif /* DEBUG_GC */ - (*p_garbage->p_func) (p_garbage->p_2free); - free(p_garbage); - ++i_count; - - } else { - list_add_back(p_list_garbage_new, p_garbage); - } - } - - listiterator_delete(p_iter); - - list_delete(LIST_GARBAGE); - LIST_GARBAGE = p_list_garbage_new; -#ifdef DEBUG_GC - printf("DEBUG::GC: Freed %d items\n", i_count); -#endif /* DEBUG_GC */ - - return (i_count); -} - -void -garbage_add(void *p, GarbageType type) { - garbage_add2(p, free, NULL, type); -} - -void -garbage_add2(void *p, - void (*p_func)(void*), - int *p_ref_count, - GarbageType type) { - garbage_add3(p, free, p_func, NULL, type); -} - -void -garbage_add3(void *p, - void (*p_func)(void*), - void (*p_print)(void*), - int *p_ref_count, - GarbageType type) { - - _Garbage *p_garbage = malloc(sizeof(_Garbage)); - - p_garbage->p_2free = p; - p_garbage->p_func = p_func; - p_garbage->p_print = p_print; - p_garbage->p_ref_count = p_ref_count; - p_garbage->type = type; - - list_add_back(LIST_GARBAGE, p_garbage); -} - -void -garbage_add_token(Token *p_token) { - garbage_add3(p_token, - token_delete_cb, - token_print_cb, - &p_token->i_ref_count, GC_TOKEN); -} diff --git a/src/core/garbage.h b/src/core/garbage.h deleted file mode 100644 index f7533eb..0000000 --- a/src/core/garbage.h +++ /dev/null @@ -1,60 +0,0 @@ -/*:* - *: File: ./src/core/garbage.h - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#ifndef GARBAGE_H -#define GARBAGE_H - -#include "../defines.h" -#include "../data/list.h" -#include "token.h" - -typedef enum { - GC_TOKEN, -} GarbageType; - -void garbage_init(); -void garbage_destroy(); -int garbage_collect(); -void garbage_add(void *p, GarbageType type); -void garbage_add2(void *p, void (*p_func)(void*), - int *p_ref_count, - GarbageType type); -void garbage_add3(void *p, void (*p_func)(void*), - void (*p_print)(void*), - int *p_ref_count, - GarbageType type); -void garbage_add_token(Token *p_token); - -#endif diff --git a/src/core/interpret.c b/src/core/interpret.c index 28239ef..3dea81a 100644 --- a/src/core/interpret.c +++ b/src/core/interpret.c @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/interpret.c *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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. *:*/ @@ -77,7 +77,7 @@ interpret_delete(Interpret *p_inter) { } void -interpret_run(PBSc *p_fype) { +interpret_run(Fype *p_fype) { Interpret *p_inter = interpret_new(p_fype->p_list_token); diff --git a/src/core/interpret.h b/src/core/interpret.h index 6d3a4a5..7834ef6 100644 --- a/src/core/interpret.h +++ b/src/core/interpret.h @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/interpret.h *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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,6 +53,6 @@ typedef struct _Interpret { Interpret* interpret_new(List *p_list_token); Interpret* interpret_new_lambda(Interpret *p_inter, Lambda *p_lambda); void interpret_delete(Interpret *p_inter); -void interpret_run(PBSc *p_fype); +void interpret_run(Fype *p_fype); #endif /* INTERPRET_H */ diff --git a/src/core/lambda.c b/src/core/lambda.c index c6ad9a2..cbd2928 100644 --- a/src/core/lambda.c +++ b/src/core/lambda.c @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/lambda.c *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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/lambda.h b/src/core/lambda.h index 8377c30..6d75bbe 100644 --- a/src/core/lambda.h +++ b/src/core/lambda.h @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/lambda.h *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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/promise.c b/src/core/promise.c index fa50e78..e21c584 100644 --- a/src/core/promise.c +++ b/src/core/promise.c @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/promise.c *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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/promise.h b/src/core/promise.h index 76cd162..668f155 100644 --- a/src/core/promise.h +++ b/src/core/promise.h @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/promise.h *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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/reference.c b/src/core/reference.c deleted file mode 100644 index 3eccaaa..0000000 --- a/src/core/reference.c +++ /dev/null @@ -1,57 +0,0 @@ -/*:* - *: File: ./src/core/reference.c - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#include "reference.h" - -Reference* -reference_new(Symbol *p_symbol) { - Reference *p_reference = malloc(sizeof(Reference)); - - symbol_ref_up(p_symbol); - p_reference->p_symbol = p_symbol; - - return (p_reference); -} - -void -reference_delete_cb(void *p_void) { - reference_delete(p_void); -} - -void -reference_delete(Reference *p_reference) { - symbol_delete(p_reference->p_symbol); - free(p_reference); -} diff --git a/src/core/reference.h b/src/core/reference.h deleted file mode 100644 index 6cda63d..0000000 --- a/src/core/reference.h +++ /dev/null @@ -1,52 +0,0 @@ -/*:* - *: File: ./src/core/reference.h - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#ifndef REFERENCE_H -#define REFERENCE_H - -#include "../defines.h" -#include "symbol.h" - -#define reference_get_sym(r) (r->p_symbol) - -typedef struct { - Symbol *p_symbol; -} Reference; - -Reference* reference_new(Symbol *p_symbol); -void reference_delete_cb(void *p_void); -void reference_delete(Reference *p_reference); - -#endif /* REFERENCE_H */ diff --git a/src/core/scanner.c b/src/core/scanner.c index a2b2b10..8b4c373 100644 --- a/src/core/scanner.c +++ b/src/core/scanner.c @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/scanner.c *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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. *:*/ @@ -98,7 +98,7 @@ _scanner_get_next_char(Scanner *p_scanner) { } void -scanner_run(PBSc *p_fype) { +scanner_run(Fype *p_fype) { Scanner *p_scanner = scanner_new(p_fype->p_list_token, p_fype->p_tupel_argv); diff --git a/src/core/scanner.h b/src/core/scanner.h index b15707b..6a729bc 100644 --- a/src/core/scanner.h +++ b/src/core/scanner.h @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/scanner.h *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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. *:*/ @@ -58,7 +58,7 @@ typedef struct { TokenType tt_last; } Scanner; -void scanner_run(PBSc *p_fype); +void scanner_run(Fype *p_fype); Scanner *scanner_new(List *p_list_token, Tupel *p_tupel_argv); void scanner_delete(Scanner *p_scanner); void scanner_add_token(Scanner *p_scanner, char **cc_token, int *p_token_len, diff --git a/src/core/scope.c b/src/core/scope.c deleted file mode 100644 index a9098a9..0000000 --- a/src/core/scope.c +++ /dev/null @@ -1,169 +0,0 @@ -/*:* - *: File: ./src/core/scope.c - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#include "garbage.h" -#include "scope.h" -#include "symbol.h" - -Scope* -scope_new(Hash *p_hash_syms) { - Scope *p_scope = malloc(sizeof(Scope)); - - p_scope->p_hash_global = p_hash_syms; - p_scope->p_stack_scopes = stack_new(); - - return (p_scope); -} - -void -scope_delete(Scope *p_scope) { - while (!stack_empty(p_scope->p_stack_scopes)) - scope_down(p_scope); - - stack_delete(p_scope->p_stack_scopes); - - free(p_scope); -} - -void -scope_up(Scope *p_scope) { - stack_push(p_scope->p_stack_scopes, hash_new(1024)); -} - -void -scope_down(Scope *p_scope) { - Hash *p_hash_syms = stack_pop(p_scope->p_stack_scopes); - hash_iterate(p_hash_syms, symbol_cleanup_hash_syms_cb); - hash_delete(p_hash_syms); -} - -static Hash* -_scope_get_hash(Scope *p_scope, char *c_key) { - StackIterator *p_iter = stackiterator_new(p_scope->p_stack_scopes); - - while (stackiterator_has_next(p_iter)) { - Hash *p_hash_syms = stackiterator_next(p_iter); - Symbol *p_symbol = hash_get(p_hash_syms, c_key); - - if (p_symbol != NULL) { - stackiterator_delete(p_iter); - return (p_hash_syms); - } - } - - stackiterator_delete(p_iter); - - if (hash_get(p_scope->p_hash_global, c_key)) - return (p_scope->p_hash_global); - - return (NULL); -} - -Symbol* -scope_get(Scope *p_scope, char *c_key) { - Hash *p_hash_syms = _scope_get_hash(p_scope, c_key); - - if (p_hash_syms == NULL) - return (NULL); - - return (hash_get(p_hash_syms, c_key)); -} - -Symbol* -scope_remove(Scope *p_scope, char *c_key) { - Hash *p_hash_syms = _scope_get_hash(p_scope, c_key); - - if (p_hash_syms == NULL) - return (NULL); - - Symbol *p_symbol = hash_remove(p_hash_syms, c_key); - - return (p_symbol); -} - -_Bool -scope_exists(Scope *p_scope, char *c_key) { - return (scope_get(p_scope, c_key) != NULL); -} - -_Bool -scope_reset(Scope *p_scope, char *c_key, Symbol *p_symbol) { - Hash *p_hash_syms = _scope_get_hash(p_scope, c_key); - - if (p_hash_syms == NULL) - return (false); - - hash_remove(p_hash_syms, c_key); - hash_insert(p_hash_syms, c_key, p_symbol); - - return (true); -} - -_Bool -scope_newset(Scope *p_scope, char *c_key, Symbol *p_symbol) { - Hash *p_hash_syms = NULL; - - if (stack_empty(p_scope->p_stack_scopes)) { - if (hash_get(p_scope->p_hash_global, c_key) != NULL) - return (false); - - p_hash_syms = p_scope->p_hash_global; - - } else { - p_hash_syms = stack_top(p_scope->p_stack_scopes); - } - - hash_insert(p_hash_syms, c_key, p_symbol); - - return (true); -} - -void -_scope_print_cb(void *p_void, int i_level) { - Hash *p_hash_syms = p_void; - if (i_level > 0) - printf("%d level(s) up:\n", i_level); - hash_iterate_key(p_hash_syms, symbol_print_cb); -} - -void -scope_print(Scope *p_scope) { - printf("Scopes:\n"); - printf("Scope stack size: %d\n", stack_size(p_scope->p_stack_scopes)); - printf("Global symbols:\n"); - hash_iterate_key(p_scope->p_hash_global, symbol_print_cb); - printf("Local symbols:\n"); - stack_iterate_level(p_scope->p_stack_scopes, _scope_print_cb); -} diff --git a/src/core/scope.h b/src/core/scope.h deleted file mode 100644 index c1193c9..0000000 --- a/src/core/scope.h +++ /dev/null @@ -1,60 +0,0 @@ -/*:* - *: File: ./src/core/scope.h - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#ifndef SCOPE_H -#define SCOPE_H - -#include "../data/hash.h" -#include "../data/stack.h" -#include "../defines.h" -#include "symbol.h" - -typedef struct { - Hash *p_hash_global; - Stack *p_stack_scopes; -} Scope; - -Scope* scope_new(Hash *p_hash_syms); -void scope_delete(Scope *p_scope); -Symbol *scope_get(Scope *p_scope, char *c_key); -Symbol *scope_remove(Scope *p_scope, char *c_key); -_Bool scope_exists(Scope *p_scope, char *c_key); -_Bool scope_newset(Scope *p_scope, char *c_key, Symbol *p_symbol); -_Bool scope_reset(Scope *p_scope, char *c_key, Symbol *p_symbol); -void scope_down(Scope *p_scope); -void scope_up(Scope *p_scope); -void scope_print(Scope *p_scope); - -#endif /* SCOPE_H */ diff --git a/src/core/symbol.c b/src/core/symbol.c deleted file mode 100644 index f4ad990..0000000 --- a/src/core/symbol.c +++ /dev/null @@ -1,122 +0,0 @@ -/*:* - *: File: ./src/core/symbol.c - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#include "symbol.h" - -#include "../data/list.h" -#include "token.h" - -Symbol* -symbol_new(SymbolType sym, void *p_val) { - Symbol *p_symbol = malloc(sizeof(Symbol)); - - p_symbol->sym = sym; - p_symbol->p_val = p_val; - p_symbol->i_refs = 1; - - return p_symbol; -} - -void -symbol_delete(Symbol *p_symbol) { - if (--p_symbol->i_refs == 0) { - switch (symbol_get_sym(p_symbol)) { - case SYM_PROCEDURE: - { - List *p_list_token = symbol_get_val(p_symbol); - list_delete(p_list_token); - } - case SYM_ARRAY: - symbol_delete(symbol_get_val(p_symbol)); - break; - NO_DEFAULT; - } - free(p_symbol); - } -} - -void -symbol_cleanup_hash_syms_cb(void *p_void) { - symbol_delete(p_void); -} - -void -symbol_print(Symbol *p_symbol, char *c_key) { - printf("%s: %s", sym_get_name(p_symbol->sym), c_key); - - switch (p_symbol->sym) { - case SYM_BUILDIN: - case SYM_CONSTANT: - break; - case SYM_PROCEDURE: - case SYM_FUNCTION: - //list_iterate(symbol_get_val(p_symbol), token_print_cb); - break; - case SYM_ARRAY: - break; - case SYM_VARIABLE: - printf(" "); - token_print(symbol_get_val(p_symbol)); - break; - } - - printf("\n"); -} - -void -symbol_print_cb(void *p_void, char *c_key) { - symbol_print(p_void, c_key); -} - -char* -sym_get_name(SymbolType sym) { - switch (sym) { - case SYM_CONSTANT: - return ("SYM_CONSTANT"); - case SYM_ARRAY: - return ("SYM_ARRAY"); - case SYM_VARIABLE: - return ("SYM_VARIABLE"); - case SYM_BUILDIN: - return ("SYM_BUILDIN"); - case SYM_PROCEDURE: - return ("SYM_PROCEDURE"); - case SYM_FUNCTION: - return ("SYM_FUNCTION"); - } - - // Never reach this point - return ("NONE"); -} diff --git a/src/core/symbol.h b/src/core/symbol.h deleted file mode 100644 index 56f0e44..0000000 --- a/src/core/symbol.h +++ /dev/null @@ -1,71 +0,0 @@ -/*:* - *: File: ./src/core/symbol.h - *: A simple interpreter - *: - *: WWW : http://fype.buetow.org - *: AUTHOR : http://paul.buetow.org - *: E-Mail : fype at dev.buetow.org - *: - *: Copyright (c) 2005 - 2009, Dipl.-Inform. (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 - *: notice, this list of conditions and the following disclaimer. - *: * 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 buetow.org 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 C. 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 C. 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 - *: POSSIBILITY OF SUCH DAMAGE. - *:*/ - -#ifndef SYMBOL_H -#define SYMBOL_H - -#include "../defines.h" - -#define symbol_set_val(s,v) s->p_val = v -#define symbol_set_sym(s,st) s->sym = st -#define symbol_get_val(s) s->p_val -#define symbol_get_sym(s) s->sym -#define symbol_ref_up(s) ++s->i_refs -#define IS_A_FUNCTION(s) (s == SYM_INLINEFUNCTION || s == SYM_FUNCTION) -#define IS_NOT_A_FUNCTION(s) !IS_A_FUNCTION(s) - -typedef enum { - SYM_BUILDIN, - SYM_CONSTANT, - SYM_FUNCTION, - SYM_PROCEDURE, - SYM_ARRAY, - SYM_VARIABLE, -} SymbolType; - -typedef struct { - SymbolType sym; - void *p_val; - unsigned i_refs; -} Symbol; - -Symbol* symbol_new(SymbolType sym, void *p_val); -void symbol_delete(Symbol *p_symbol); -void symbol_cleanup_hash_syms_cb(void *p_void); -void symbol_print(Symbol *p_symbol, char *c_key); -void symbol_print_cb(void *p_void, char *c_key); -char* sym_get_name(SymbolType sym); - -#endif diff --git a/src/core/token.c b/src/core/token.c index a0a6ad0..dd3f327 100644 --- a/src/core/token.c +++ b/src/core/token.c @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/token.c *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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/token.h b/src/core/token.h index 8f1ab53..ae3f146 100644 --- a/src/core/token.h +++ b/src/core/token.h @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/token.h *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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/tools.c b/src/core/tools.c index 6b6dbab..ed36af5 100644 --- a/src/core/tools.c +++ b/src/core/tools.c @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/tools.c *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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/tools.h b/src/core/tools.h index 19d9fa6..6c61eec 100644 --- a/src/core/tools.h +++ b/src/core/tools.h @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/tools.h *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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/variable.c b/src/core/variable.c index 2b924a5..0cd9f34 100644 --- a/src/core/variable.c +++ b/src/core/variable.c @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/variable.c *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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/variable.h b/src/core/variable.h index 7a7d27c..aa06630 100644 --- a/src/core/variable.h +++ b/src/core/variable.h @@ -1,13 +1,13 @@ /*:* *: File: ./src/core/variable.h *: A simple Fype interpreter - *: + *: *: WWW: http://fype.buetow.org *: AUTHOR: http://paul.buetow.org *: E-Mail: fype at dev.buetow.org - *: - *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow - *: + *: + *: The Fype Language; (c) 2005 - 2010 Paul Buetow + *: *: 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 buetow.org nor the names of its contributors may - *: be used to endorse or promote products derived from this software + *: * Neither the name of buetow.org 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 C. BUETOW AS IS'' AND ANY EXPRESS OR - *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. 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 C. 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 C. 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. *:*/ |
