diff --git a/lib/vis_milkdrop/evallib/CAL_TAB.C b/lib/vis_milkdrop/evallib/CAL_TAB.C deleted file mode 100644 index 2b904a0..0000000 --- a/lib/vis_milkdrop/evallib/CAL_TAB.C +++ /dev/null @@ -1,601 +0,0 @@ -/* - LICENSE - ------- -Copyright 2005 Nullsoft, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -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 Nullsoft 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR -CONTRIBUTORS 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 -//#include -#include -#include "Compiler.h" -#include "eval.h" - -#define VALUE 258 -#define IDENTIFIER 259 -#define FUNCTION1 260 -#define FUNCTION2 261 -#define FUNCTION3 262 -#define UMINUS 263 -#define UPLUS 264 -#define YYSTYPE int - -int yyerror(char *); -int yylex(char **exp); - -extern int result; - -typedef struct -{ - int timestamp; - int first_line; - int first_column; - int last_line; - int last_column; - char *text; -} yyltype; - -#define YYLTYPE yyltype - -#define YYFINAL 51 -#define YYFLAG -32768 -#define YYNTBASE 21 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 264 ? yytranslate[x] : 26) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 14, 9, 2, 18, - 19, 12, 10, 20, 11, 2, 13, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 17, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 8, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, - 6, 7, 15, 16 -}; - - -static const short yyr1[] = { 0, - 21, 21, 22, 23, 23, 23, 24, 24, 24, 24, - 24, 24, 24, 24, 24, 24, 24, 25, 25, 25 -}; - -static const short yyr2[] = { 0, - 1, 3, 1, 1, 1, 3, 1, 3, 3, 3, - 3, 3, 3, 3, 2, 2, 1, 4, 6, 8 -}; - -static const short yydefact[] = { 0, - 3, 4, 0, 0, 0, 0, 0, 0, 5, 7, - 1, 17, 0, 0, 0, 0, 4, 16, 15, 0, - 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, - 0, 6, 14, 13, 11, 12, 8, 9, 10, 18, - 0, 0, 0, 0, 19, 0, 0, 20, 0, 0, - 0 -}; - -static const short yydefgoto[] = { 49, - 9, 10, 11, 12 -}; - -static const short yypact[] = { 19, --32768, -11, -7, -5, -4, 38, 38, 38,-32768,-32768, - 136,-32768, 38, 38, 38, 38,-32768,-32768,-32768, 88, - 38, 38, 38, 38, 38, 38, 38, 136, 100, 49, - 62,-32768, 41, 54, -9, -9,-32768,-32768,-32768,-32768, - 38, 38, 112, 75,-32768, 38, 124,-32768, 12, 27, --32768 -}; - -static const short yypgoto[] = {-32768, --32768,-32768, -6,-32768 -}; - - -#define YYLAST 150 - - -static const short yytable[] = { 18, - 19, 20, 25, 26, 27, 13, 28, 29, 30, 31, - 14, 50, 15, 16, 33, 34, 35, 36, 37, 38, - 39, 1, 2, 3, 4, 5, 51, 0, 6, 7, - 0, 0, 0, 0, 43, 44, 8, 0, 0, 47, - 1, 17, 3, 4, 5, 0, 0, 6, 7, 22, - 23, 24, 25, 26, 27, 8, 21, 22, 23, 24, - 25, 26, 27, 23, 24, 25, 26, 27, 41, 21, - 22, 23, 24, 25, 26, 27, 0, 0, 0, 0, - 0, 42, 21, 22, 23, 24, 25, 26, 27, 0, - 0, 0, 0, 0, 46, 21, 22, 23, 24, 25, - 26, 27, 0, 0, 0, 0, 32, 21, 22, 23, - 24, 25, 26, 27, 0, 0, 0, 0, 40, 21, - 22, 23, 24, 25, 26, 27, 0, 0, 0, 0, - 45, 21, 22, 23, 24, 25, 26, 27, 0, 0, - 0, 0, 48, 21, 22, 23, 24, 25, 26, 27 -}; - -static const short yycheck[] = { 6, - 7, 8, 12, 13, 14, 17, 13, 14, 15, 16, - 18, 0, 18, 18, 21, 22, 23, 24, 25, 26, - 27, 3, 4, 5, 6, 7, 0, -1, 10, 11, - -1, -1, -1, -1, 41, 42, 18, -1, -1, 46, - 3, 4, 5, 6, 7, -1, -1, 10, 11, 9, - 10, 11, 12, 13, 14, 18, 8, 9, 10, 11, - 12, 13, 14, 10, 11, 12, 13, 14, 20, 8, - 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, - -1, 20, 8, 9, 10, 11, 12, 13, 14, -1, - -1, -1, -1, -1, 20, 8, 9, 10, 11, 12, - 13, 14, -1, -1, -1, -1, 19, 8, 9, 10, - 11, 12, 13, 14, -1, -1, -1, -1, 19, 8, - 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, - 19, 8, 9, 10, 11, 12, 13, 14, -1, -1, - -1, -1, 19, 8, 9, 10, 11, 12, 13, 14 -}; -#define YYPURE 1 - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) - -#define YYTERROR 1 -#define YYERRCODE 256 - -#ifndef YYIMPURE -#define YYLEX yylex(&exp) -#endif - -#ifndef YYPURE -#define YYLEX yylex(&yylval)//, &yylloc) MY MODIF! -#endif - -/* If nonreentrant, generate the variables here */ - -#ifndef YYIMPURE - -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ - - -int yynerrs; /* number of parse errors so far */ -#endif /* YYIMPURE */ - -/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -#define YYINITDEPTH 5000 -#define YYMAXDEPTH 5000 - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -#define __yy_bcopy(from,to,count) memcpy(to,from,(count)>0?(count):0) - -//#ln 131 "bison.simple" -int yyparse(char *exp) -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - - int yystacksize = YYINITDEPTH; - -#ifndef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#endif - - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ - - int yylen; - - yylval = 0; - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. */ - - yyssp = yyss - 1; - yyvsp = yyvs; - -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - - *++yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; - - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; - - if (yystacksize >= YYMAXDEPTH) - { - yyerror("internal error: parser stack overflow"); - return 2; - } - - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; - - - if (yyssp >= yyss + yystacksize - 1) YYABORT; - } - - -// yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { -// yyStackSize = yyssp - (yyss - 1); - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - - } - else - { - yychar1 = YYTRANSLATE(yychar); - - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; - - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - - yystate = yyn; - goto yynewstate; - -/* Do the default action for the current state. */ -yydefault: - - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - -/* Do a reduction. yyn is the number of a rule to reduce with. */ -yyreduce: - yylen = yyr2[yyn]; - yyval = yyvsp[1-yylen]; /* implement default value of the action */ - - - switch (yyn) { - -case 1: -//#ln 32 "cal.y" -{ yyval = yyvsp[0]; result = yyvsp[0]; ; - break;} -case 2: -//#ln 34 "cal.y" -{ { - int i = (int)setVar((int)yyvsp[-2], 0); - int v = createCompiledValue(0, &(varTable[i].value)); - yyval = createCompiledFunction2(MATH_SIMPLE, FN_ASSIGN, v, (int)yyvsp[0]); - result = yyval; - } - ; - break;} -case 3: -//#ln 50 "cal.y" -{ yyval = yyvsp[0] ; - break;} -case 4: -//#ln 55 "cal.y" -{ yyval = getVar((int)yyvsp[0]);; - break;} -case 5: -//#ln 57 "cal.y" -{ yyval = yyvsp[0];; - break;} -case 6: -//#ln 59 "cal.y" -{ yyval = yyvsp[-1];; - break;} -case 7: -//#ln 64 "cal.y" -{ yyval = yyvsp[0]; ; - break;} -case 8: -//#ln 66 "cal.y" -{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_MULTIPLY, yyvsp[-2], yyvsp[0]); - break;} -case 9: -//#ln 72 "cal.y" -{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_DIVIDE, yyvsp[-2], yyvsp[0]); - break;} -case 10: -//#ln 78 "cal.y" -{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_MODULO, yyvsp[-2], yyvsp[0]); - break;} -case 11: -//#ln 84 "cal.y" -{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_ADD, yyvsp[-2], yyvsp[0]); - break;} -case 12: -//#ln 90 "cal.y" -{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_SUB, yyvsp[-2], yyvsp[0]); - break;} -case 13: -//#ln 96 "cal.y" -{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_AND, yyvsp[-2], yyvsp[0]); - break;} -case 14: -//#ln 102 "cal.y" -{ yyval = createCompiledFunction2(MATH_SIMPLE, FN_OR, yyvsp[-2], yyvsp[0]); - break;} -case 15: -//#ln 108 "cal.y" -{ yyval = createCompiledFunction1(MATH_SIMPLE, FN_UMINUS, yyvsp[0]); - break;} -case 16: -//#ln 114 "cal.y" -{ yyval = createCompiledFunction1(MATH_SIMPLE, FN_UPLUS, yyvsp[0]); - break;} -case 17: -//#ln 120 "cal.y" -{ yyval = yyvsp[0]; - break;} -case 18: -//#ln 125 "cal.y" -{ yyval = createCompiledFunction1(MATH_FN, (int)yyvsp[-3], yyvsp[-1]); - break;} -case 19: -//#ln 131 "cal.y" -{ yyval = createCompiledFunction2(MATH_FN, (int)yyvsp[-5], yyvsp[-3], yyvsp[-1]); - break;} -case 20: -//#ln 137 "cal.y" -{ yyval = createCompiledFunction3(MATH_FN, (int)yyvsp[-7], yyvsp[-5], yyvsp[-3], yyvsp[-1]); - break;} -} - /* the action file gets copied in in place of this dollarsign */ -//#ln 362 "bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; - - *++yyvsp = yyval; - - - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - -yyerrlab: /* here on detecting error */ - - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; -#error this should not compile - msg = (char *) xmalloc(size + 15); - strcpy(msg, "syntax error"); - - if (count < 5) - { - count = 0; - for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("syntax error"); - } - -//yyerrlab1: /* here on error raised explicitly by an action */ - - if (yyerrstatus == 3) - { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) YYABORT; - - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - -yyerrdefault: /* current state does not do anything special for the error token. */ - -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif - -yyerrpop: /* pop the current state because it cannot handle the error token */ - - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; - - -yyerrhandle: - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - - *++yyvsp = yylval; - - yystate = yyn; - goto yynewstate; -} diff --git a/lib/vis_milkdrop/evallib/CMakeLists.txt b/lib/vis_milkdrop/evallib/CMakeLists.txt deleted file mode 100644 index 69c4252..0000000 --- a/lib/vis_milkdrop/evallib/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -project(evallib) - -enable_language(C) - -cmake_minimum_required(VERSION 2.6) - -set(SOURCES CAL_TAB.C - cfunc.c - Compiler.c - eval.c - Gettok.c - Lextab.c - LLSAVE.C - Yylex.c) - -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - # disable optimization for cfunc.c and Compiler.c - set_source_files_properties(cfunc.c Compiler.c COMPILE_FLAGS -Od) -endif() - -add_library(evallib STATIC ${SOURCES}) diff --git a/lib/vis_milkdrop/evallib/Compiler.c b/lib/vis_milkdrop/evallib/Compiler.c deleted file mode 100644 index f1c0562..0000000 --- a/lib/vis_milkdrop/evallib/Compiler.c +++ /dev/null @@ -1,424 +0,0 @@ -/* - LICENSE - ------- -Copyright 2005 Nullsoft, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -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 Nullsoft 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR -CONTRIBUTORS 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 -//#include -#include -#include -#include "Compiler.h" -#include "eval.h" - -#define LLB_DSIZE (65536-64) -typedef struct _llBlock { - struct _llBlock *next; - int sizeused; - char block[LLB_DSIZE]; -} llBlock; - -typedef struct _startPtr { - struct _startPtr *next; - void *startptr; -} startPtr; - -typedef struct { - llBlock *blocks; - startPtr *startpts; - } codeHandleType; - -static llBlock *blocks_head = NULL; - -double computTable[16384]; -double *nextBlock=computTable; - -extern CRITICAL_SECTION g_eval_cs; - -static void *newBlock(int size); -static void freeBlocks(llBlock *start); - - -void _asm_sin(void); -void _asm_cos(void); -void _asm_tan(void); -void _asm_int(void); -void _asm_asin(void); -void _asm_acos(void); -void _asm_atan(void); -void _asm_atan2(void); -void _asm_sqr(void); -void _asm_sqrt(void); -void _asm_pow(void); -void _asm_exp(void); -void _asm_log(void); -void _asm_log10(void); -void _asm_abs(void); -void _asm_min(void); -void _asm_max(void); -void _asm_sig(void); -void _asm_sign(void); -void _asm_rand(void); -void _asm_band(void); -void _asm_bor(void); -void _asm_bnot(void); -void _asm_if(void); -void _asm_equal(void); -void _asm_below(void); -void _asm_above(void); -void _asm_assign(void); -void _asm_add(void); -void _asm_sub(void); -void _asm_mul(void); -void _asm_div(void); -void _asm_mod(void); -void _asm_or(void); -void _asm_and(void); -void _asm_uplus(void); -void _asm_uminus(void); -void _asm_function3(void); -void _asm_function3_end(void); -void _asm_function2(void); -void _asm_function2_end(void); -void _asm_function1(void); -void _asm_function1_end(void); -void _asm_simpleValue(void); -void _asm_simpleValue_end(void); - -functionType fnTable[27] = {{ "sin", _asm_sin, 1 }, - { "cos", _asm_cos, 1 }, - { "tan", _asm_tan, 1 }, - { "int", _asm_int, 1 }, - { "asin", _asm_asin, 1 }, - { "acos", _asm_acos, 1 }, - { "atan", _asm_atan, 1 }, - { "atan2", _asm_atan2, 2 }, - { "sqr", _asm_sqr, 1 }, - { "sqrt", _asm_sqrt, 1 }, - { "pow", _asm_pow, 2 }, - { "exp", _asm_exp, 1 }, - { "log", _asm_log, 1 }, - { "log10", _asm_log10, 1 }, - { "abs", _asm_abs, 1 }, - { "min", _asm_min, 2 }, - { "max", _asm_max, 2 }, - { "sigmoid",_asm_sig, 2 } , - { "sign", _asm_sign, 1 } , - { "rand", _asm_rand, 1 } , - { "band", _asm_band, 2 } , - { "bor", _asm_bor, 2 } , - { "bnot", _asm_bnot, 1 } , - { "if", _asm_if, 3 }, - { "equal", _asm_equal, 2 }, - { "below", _asm_below, 2 }, - { "above", _asm_above, 2 }, - }; - - -//--------------------------------------------------------------------------------------------------------------- -void *realAddress(void *fn) -{ -#if defined(_DEBUG) - unsigned char *ptr = (char *)fn; - if(*ptr == 0xE9) - ptr += (*(int *)((ptr+1))+5); - return ptr; -#else - // Release Mode - return fn; -#endif -} - -//#define realAddress(a) a - -//--------------------------------------------------------------------------------------------------------------- -static void freeBlocks(llBlock *start) -{ - while (start) - { - llBlock *llB = start->next; - VirtualFree(start, 0, MEM_RELEASE); - start=llB; - } -} - -//--------------------------------------------------------------------------------------------------------------- -static void *newBlock(int size) -{ - llBlock *llb; - int alloc_size; - if (blocks_head && (LLB_DSIZE - blocks_head->sizeused) >= size) - { - void *t=blocks_head->block+blocks_head->sizeused; - blocks_head->sizeused+=size; - return t; - } - alloc_size=sizeof(llBlock); - if ((int)size > LLB_DSIZE) alloc_size += size - LLB_DSIZE; - llb = (llBlock *)VirtualAlloc(NULL, alloc_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); // grab bigger block if absolutely necessary (heh) - llb->sizeused=size; - llb->next = blocks_head; - blocks_head = llb; - return llb->block; -} - -//--------------------------------------------------------------------------------------------------------------- -static int *findFBlock(char *p) -{ - while (*(int *)p != 0xFFFFFFFF) p++; - return (int*)p; -} - - -//--------------------------------------------------------------------------------------------------------------- -int createCompiledValue(double value, double *addrValue) -{ - int size; - char *block; - double *dupValue; - int i =0; - char *p; - char txt[512]; - - //size=(int)_asm_simpleValue_end-(int)_asm_simpleValue; - size = 0x10; - block=(char *)newBlock(size); - - if (addrValue == NULL) - *(dupValue = (double *)newBlock(sizeof(double))) = value; - else - dupValue = addrValue; - - memcpy(block, realAddress(_asm_simpleValue), size); - - p = block; - while (*(int *)p != 0xFFFFFFFF) - { - txt[i++] = *p; - p++; - }; - txt[i] = 0; - - *findFBlock(block)=(int)dupValue; - - return ((int)(block)); - -} - -//--------------------------------------------------------------------------------------------------------------- -int getFunctionAddress(int fntype, int fn) -{ - switch (fntype) - { - case MATH_SIMPLE: - switch (fn) - { - case FN_ASSIGN: - return (int)realAddress(_asm_assign); - case FN_ADD: - return (int)realAddress(_asm_add); - case FN_SUB: - return (int)realAddress(_asm_sub); - case FN_MULTIPLY: - return (int)realAddress(_asm_mul); - case FN_DIVIDE: - return (int)realAddress(_asm_div); - case FN_MODULO: - return (int)realAddress(_asm_mod); - case FN_AND: - return (int)realAddress(_asm_and); - case FN_OR: - return (int)realAddress(_asm_or); - case FN_UPLUS: - return (int)realAddress(_asm_uplus); - case FN_UMINUS: - return (int)realAddress(_asm_uminus); - } - case MATH_FN: - return (int)realAddress(fnTable[fn].afunc); - } - return 0; -} - - -//--------------------------------------------------------------------------------------------------------------- -int createCompiledFunction3(int fntype, int fn, int code1, int code2, int code3) -{ - int *p; - int size; - char *block; - -// size=(int)_asm_function3_end-(int)_asm_function3; - size = 0x30; - block=(char *)newBlock(size); - - memcpy(block, realAddress(_asm_function3), size); - - p=findFBlock(block); *p++=code1; - p=findFBlock((char*)p); *p++=code2; - p=findFBlock((char*)p); *p++=code3; - p=findFBlock((char*)p); *p++=getFunctionAddress(fntype, fn); - - return ((int)(block)); -} - -//--------------------------------------------------------------------------------------------------------------- -int createCompiledFunction2(int fntype, int fn, int code1, int code2) -{ - int *p; - int size; - char *block; - -// size=(int)_asm_function2_end-(int)_asm_function2; - size = 0x20; - block=(char *)newBlock(size); - - memcpy(block, realAddress(_asm_function2), size); - - p=findFBlock(block); *p++=code1; - p=findFBlock((char*)p); *p++=code2; - p=findFBlock((char*)p); *p++=getFunctionAddress(fntype, fn); - - return ((int)(block)); -} - - -//--------------------------------------------------------------------------------------------------------------- -int createCompiledFunction1(int fntype, int fn, int code) -{ - int size; - int *p; - char *block; - -// size=(int)_asm_function1_end-(int)_asm_function1; - size = 0x20; - block=(char *)newBlock(size); - - memcpy(block, realAddress(_asm_function1), size); - - p=findFBlock(block); *p++=code; - p=findFBlock((char*)p); *p++=getFunctionAddress(fntype, fn); - - return ((int)(block)); -} - -//------------------------------------------------------------------------------ -int compileCode(char *expression) -{ - char expr[4096]; - codeHandleType *handle; - startPtr *scode=NULL; - blocks_head=0; - - if (!expression || !*expression) return 0; - if (!varTable) return 0; - - handle = (codeHandleType*)newBlock(sizeof(codeHandleType)); - - if (!handle) return 0; - - memset(handle,0,sizeof(codeHandleType)); - - while (*expression) - { - startPtr *tmp; - char *expr_ptr; - int l=4095; - colCount=0; - - // single out segment - while (*expression == ';' || *expression == ' ' || *expression == '\n' || - *expression == '\r' || *expression == '\t') expression++; - if (!*expression) break; - expr_ptr = expr; - while (l-->0) - { - int a=*expression; - if (a) expression++; - if (!a || a == ';') break; - if (a == '\n' || a=='\r' || a=='\t') a=' '; - *expr_ptr++ = a; - } - *expr_ptr = 0; - - // parse - tmp=(startPtr*) newBlock(sizeof(startPtr)); - if (!tmp) break; - tmp->startptr=compileExpression(expr); - if (!tmp->startptr) { scode=NULL; break; } - tmp->next=NULL; - if (!scode) scode=handle->startpts=tmp; - else - { - scode->next=tmp; - scode=tmp; - } - } - - // check to see if failed on the first startingCode - if (!scode) - { - freeBlocks(blocks_head); // free blocks - handle=NULL; // return NULL (after resetting blocks_head) - } - else handle->blocks = blocks_head; - - blocks_head=0; - - return (int)handle; -} - -//------------------------------------------------------------------------------ -void executeCode(int handle) -{ - codeHandleType *h = (codeHandleType *)handle; - startPtr *p; - if (!h) return; -// EnterCriticalSection(&g_eval_cs); - p=h->startpts; - while (p) - { - void *startPoint=p->startptr; - if (!startPoint) break; - p=p->next; - nextBlock=computTable; - __asm pusha // Lets cover our ass - __asm call startPoint - __asm popa - } -// LeaveCriticalSection(&g_eval_cs); -} - -//------------------------------------------------------------------------------ -void freeCode(int handle) -{ - codeHandleType *h = (codeHandleType *)handle; - if (h != NULL) - { - freeBlocks(h->blocks); - } -} - diff --git a/lib/vis_milkdrop/evallib/Compiler.h b/lib/vis_milkdrop/evallib/Compiler.h deleted file mode 100644 index 8781876..0000000 --- a/lib/vis_milkdrop/evallib/Compiler.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - LICENSE - ------- -Copyright 2005 Nullsoft, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -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 Nullsoft 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR -CONTRIBUTORS 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 __COMPILER_H -#define __COMPILER_H - -#define FN_ASSIGN 0 -#define FN_MULTIPLY 1 -#define FN_DIVIDE 2 -#define FN_MODULO 3 -#define FN_ADD 4 -#define FN_SUB 5 -#define FN_AND 6 -#define FN_OR 7 -#define FN_UMINUS 8 -#define FN_UPLUS 9 - -#define MATH_SIMPLE 0 -#define MATH_FN 1 - -#ifdef __cplusplus -extern "C" { -#endif - - -int compileCode(char *exp); -void executeCode(int handle); -void freeCode(int handle); - - - -typedef struct { - char *name; - void *afunc; - int nParams; - } functionType; -extern functionType fnTable[27]; - -int createCompiledValue(double value, double *addrValue); -int createCompiledFunction1(int fntype, int fn, int code); -int createCompiledFunction2(int fntype, int fn, int code1, int code2); -int createCompiledFunction3(int fntype, int fn, int code1, int code2, int code3); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/lib/vis_milkdrop/evallib/Gettok.c b/lib/vis_milkdrop/evallib/Gettok.c deleted file mode 100644 index 02dd6b0..0000000 --- a/lib/vis_milkdrop/evallib/Gettok.c +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Bob Denny 28-Aug-82 Remove reference to stdio.h - * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C - */ - -#include "lex.h" diff --git a/lib/vis_milkdrop/evallib/LEX.H b/lib/vis_milkdrop/evallib/LEX.H deleted file mode 100644 index 2a6af32..0000000 --- a/lib/vis_milkdrop/evallib/LEX.H +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Bob Denny 28-Aug-82 Remove reference to FILE *lexin to - * eliminate dependency on standard I/O library. Only - * lexgetc() used it, and it's there now. - * Add EOF definition for standalone uses. - * Corrected comment for llnxtmax. - * - * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C. Removed - * equivalence of yylval and lexval since - * a multi-typed parser wants yylval to be - * typed to be the union of the types (YYSTYPE). - */ - -/* - * lex library header file -- accessed through - * #include - */ - -#include - -/* - * Description of scanning tables. The entries at the front of - * the struct must remain in place for the assembler routines to find. - */ -struct lextab { - int llendst; /* Last state number */ - char *lldefault; /* Default state table */ - char *llnext; /* Next state table */ - char *llcheck; /* Check table */ - int *llbase; /* Base table */ - int llnxtmax; /* Last in next table */ - int (*llmove)(); /* Move between states */ - char *llfinal; /* Final state descriptions */ - int (*llactr)(); /* Action routine */ - int *lllook; /* Look ahead vector if != NULL */ - char *llign; /* Ignore char vec if != NULL */ - char *llbrk; /* Break char vec if != NULL */ - char *llill; /* Illegal char vec if != NULL */ -}; - -#define NBPW 16 -#define LEXERR 256 -#define LEXSKIP (-1) -#define EOF (-1) -//#define NULL (0) -#define LEXECHO(fp) {lexecho((fp));} - -#define lextext llbuf -#define lexlast llend - -extern FILE *lexin; -extern llstin(); - diff --git a/lib/vis_milkdrop/evallib/LLSAVE.C b/lib/vis_milkdrop/evallib/LLSAVE.C deleted file mode 100644 index 23c5e47..0000000 --- a/lib/vis_milkdrop/evallib/LLSAVE.C +++ /dev/null @@ -1,6 +0,0 @@ -/* - * This is linked from lexlib to resolve a global in yylex which - * will be undefined if the user grammar has not defined any rules - * with right-context (look-ahead) - */ -char *llsave[1]; /* Look ahead buffer */ diff --git a/lib/vis_milkdrop/evallib/Lexget.c b/lib/vis_milkdrop/evallib/Lexget.c deleted file mode 100644 index b4c76f9..0000000 --- a/lib/vis_milkdrop/evallib/Lexget.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * lexget.c - * - * Bob Denny 28-Aug-82 Move stdio dependencies to lexerr(), lexget(), - * lexech() and mapch(). This is one of 4 modules - * in lexlib which depend upon the standard I/O package. - * - * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C. - */ - -#include -#include "lex.h" -extern char expression[4096]; -extern int pos; -lexgetc() -{ -char c = expression[pos]; -if (c) pos++; - return( c != 0 ? c : -1); -} diff --git a/lib/vis_milkdrop/evallib/Lexswi.c b/lib/vis_milkdrop/evallib/Lexswi.c deleted file mode 100644 index 4999200..0000000 --- a/lib/vis_milkdrop/evallib/Lexswi.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * lexswitch -- switch lex tables - */ - -/* - * Bob Denny 28-Aug-82 Remove reference to stdio.h - * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C - */ - -#include "lex.h" - -extern struct lextab *_tabp; - -struct lextab * -lexswitch(lp) -struct lextab *lp; -{ - register struct lextab *olp; - - olp = _tabp; - _tabp = lp; - return(olp); -} diff --git a/lib/vis_milkdrop/evallib/Lextab.c b/lib/vis_milkdrop/evallib/Lextab.c deleted file mode 100644 index a8a1f12..0000000 --- a/lib/vis_milkdrop/evallib/Lextab.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Created by IBM PC LEX from file "scan.l" - * - for use with standard I/O - */ - -#include -#include "lex.h" -#define LL16BIT int - -int _lmovb(struct lextab *lp, int c, int st) -{ - int base; - - while ((base = lp->llbase[st]+c) > lp->llnxtmax || - (lp->llcheck[base] & 0377) != st) { - - if (st != lp->llendst) { - base = lp->lldefault[st] & 0377; - st = base; - } - else - return(-1); - } - return(lp->llnext[base]&0377); -} - -int lexval; -char lbuf[]; - -#define YYSTYPE int -#include "cal_tab.h" -int c; - -extern YYSTYPE yylval; -int translate(int type); -void count(void); -void setLastVar(void); -int lookup(int *typeOfObject); - - -#define INTCONST 1 -#define DBLCONST 2 -#define HEXCONST 3 -#define VARIABLE 4 -#define OTHER 5 - -int _Alextab(__na__) -{ - if (__na__ >= 0 && __na__ <= 19) count(); - switch (__na__) - { - case 0: yylval = translate(HEXCONST); return VALUE; - case 1: yylval = translate(INTCONST); return VALUE; - case 2: yylval = translate(INTCONST); return VALUE; - case 3: yylval = translate(DBLCONST); return VALUE; - case 4: - case 5: setLastVar(); yylval = lookup(&__na__); return __na__; - case 6: return '+'; - case 7: return '-'; - case 8: return '*'; - case 9: return '/'; - case 10: return '%'; - case 11: return '&'; - case 12: return '|'; - case 13: return '('; - case 14: return ')'; - case 15: return '='; - case 16: return ','; - case 17: return ';'; - } - return (LEXSKIP); -} - - -char _Flextab[] = - { - 1, 18, 17, 16, 15, 14, 13, 12, - 11, 10, 9, 8, 7, 6, 4, 5, - 5, 4, 4, 3, 3, 3, 3, 4, - 0, 4, 5, 0, 5, 4, 1, 3, - 0, 2, -1, 1, -1, - }; - - -char _Nlextab[] = - { - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 1, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 1, 36, 36, 36, 36, 9, 8, 36, - 6, 5, 11, 13, 3, 12, 19, 10, - 30, 30, 30, 30, 30, 30, 30, 30, - 30, 30, 36, 2, 36, 4, 36, 36, - 36, 29, 29, 29, 29, 29, 29, 18, - 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 36, 36, 36, 36, 18, - 36, 29, 29, 29, 29, 29, 23, 18, - 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 14, 18, - 18, 18, 18, 36, 7, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 36, - 36, 36, 36, 36, 36, 36, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 36, 36, 36, 36, 17, 36, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 36, 36, 36, 36, 36, 36, - 36, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 36, 36, 36, 36, 16, - 36, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 36, - 20, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 36, 36, 36, 36, 36, - 36, 36, 25, 25, 25, 25, 25, 25, - 36, 24, 36, 36, 36, 36, 36, 36, - 20, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 25, 25, 25, 25, 25, 25, - 36, 24, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 36, 36, 36, 36, - 36, 36, 36, 28, 28, 28, 28, 28, - 28, 36, 27, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 28, 28, 28, 28, 28, - 28, 31, 27, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 36, 36, 36, - 36, 36, 36, 36, 34, 34, 34, 33, - 34, 34, 36, 32, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 34, 34, 34, 33, - 34, 34, 36, 32, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 36, 36, - 36, 36, 36, 36, 36, 34, 34, 34, - 34, 34, 34, 36, 32, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 34, 34, 34, - 34, 34, 34, 36, 32, - }; - -char _Clextab[] = - { - -1, -1, -1, -1, -1, -1, -1, -1, - -1, 0, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - 0, -1, -1, -1, -1, 0, 0, -1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -1, 0, -1, 0, -1, -1, - -1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -1, -1, -1, -1, 0, - -1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -1, 0, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, -1, - -1, -1, -1, -1, -1, -1, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - -1, -1, -1, -1, 14, -1, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, -1, -1, -1, -1, -1, -1, - -1, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, -1, -1, -1, -1, 15, - -1, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, -1, - 19, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, -1, -1, -1, -1, -1, - -1, -1, 23, 23, 23, 23, 23, 23, - -1, 23, -1, -1, -1, -1, -1, -1, - 19, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 23, 23, 23, 23, 23, 23, - -1, 23, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, -1, -1, -1, -1, - -1, -1, -1, 26, 26, 26, 26, 26, - 26, -1, 26, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 26, 26, 26, 26, 26, - 26, 30, 26, 30, 30, 30, 30, 30, - 30, 30, 30, 30, 30, -1, -1, -1, - -1, -1, -1, -1, 30, 30, 30, 30, - 30, 30, -1, 30, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 30, 30, 30, 30, - 30, 30, -1, 30, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, -1, -1, - -1, -1, -1, -1, -1, 33, 33, 33, - 33, 33, 33, -1, 33, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 33, 33, 33, - 33, 33, 33, -1, 33, - }; - -char _Dlextab[] = - { - 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, - 15, 14, 14, 36, 36, 20, 19, 14, - 14, 23, 15, 15, 26, 23, 36, 19, - 36, 36, 33, 30, - }; - -int _Blextab[] = - { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 77, 152, - 0, 0, 0, 227, 237, 0, 0, 249, - 0, 0, 306, 0, 0, 0, 363, 0, - 0, 420, 0, 0, 0, - }; - -struct lextab lextab = { - 36, - _Dlextab, - _Nlextab, - _Clextab, - _Blextab, - 524, - _lmovb, - _Flextab, - _Alextab, - - NULL, - 0, - 0, - 0, - }; - - diff --git a/lib/vis_milkdrop/evallib/Lmovb.c b/lib/vis_milkdrop/evallib/Lmovb.c deleted file mode 100644 index 8be9ec7..0000000 --- a/lib/vis_milkdrop/evallib/Lmovb.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Bob Denny 28-Aug-82 Remove reference to stdio.h - * Scott Guthery 20-Nov-83 Adapt for IBM PC & DeSmet C - */ - -#include "lex.h" - -_lmovb(lp, c, st) -register int c, st; -register struct lextab *lp; -{ - int base; - - while ((base = lp->llbase[st]+c) > lp->llnxtmax || - (lp->llcheck[base] & 0377) != st) { - - if (st != lp->llendst) { -/* - * This miscompiled on Decus C many years ago: - * st = lp->lldefault[st] & 0377; - */ - base = lp->lldefault[st] & 0377; - st = base; - } - else - return(-1); - } - return(lp->llnext[base]&0377); -} diff --git a/lib/vis_milkdrop/evallib/Scan.l b/lib/vis_milkdrop/evallib/Scan.l deleted file mode 100644 index 2513433..0000000 --- a/lib/vis_milkdrop/evallib/Scan.l +++ /dev/null @@ -1,54 +0,0 @@ -%{ -#define YYSTYPE double -#include "cal_tab.h" -int c; - -extern YYSTYPE yylval; -double translate(int type); -void count(void); -void setLastVar(void); -int lookup(int *typeOfObject); -struct lextab *lexswitch(struct lextab *lp); - - -#define INTCONST 1 -#define DBLCONST 2 -#define HEXCONST 3 -#define VARIABLE 4 -#define OTHER 5 - -%} - -digit = [0-9]; -letter = [a-zA-Z_]; -hex = [a-fA-F0-9]; -/* -- */ -space = [\40]; -/*number = (digit* | "-" digit*);*/ -number = digit*; -exp = [Ee] number; -doubl = number "." (digit* | digit* exp); - -%% -hex hex* [hH] { count(); yylval = translate(HEXCONST); return VALUE; } -digit* { count(); yylval = translate(INTCONST); return VALUE; } -digit digit* [Dd] { count(); yylval = translate(INTCONST); return VALUE; } -doubl { count(); yylval = translate(DBLCONST); return VALUE; } -letter* { count(); { int typeOfObject; setLastVar(); yylval = lookup(&typeOfObject); return typeOfObject; }} -letter (letter|digit)* { count(); { int typeOfObject; setLastVar(); yylval = lookup(&typeOfObject); return typeOfObject; }} -'+' { count(); return '+'; } -'-' { count(); return '-'; } -'*' { count(); return '*'; } -'/' { count(); return '/'; } -'%' { count(); return '%'; } -'&' { count(); return '&'; } -'|' { count(); return '|'; } -'(' { count(); return '('; } -')' { count(); return ')'; } -'=' { count(); return '='; } -',' { count(); return ','; } -';' { count(); return ';'; } -[ \t\v\f] { count(); } -. { count(); } - -%% diff --git a/lib/vis_milkdrop/evallib/Yylex.c b/lib/vis_milkdrop/evallib/Yylex.c deleted file mode 100644 index 37d685d..0000000 --- a/lib/vis_milkdrop/evallib/Yylex.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - LICENSE - ------- -Copyright 2005 Nullsoft, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -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 Nullsoft 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR -CONTRIBUTORS 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 "lex.h" - -#define ERROR 256 /* yacc's value */ - -static int llset(void); -static int llinp(char **exp); -static int lexgetc(char **exp) -{ - char c= **exp; - if (c) (*exp)++; - return( c != 0 ? c : -1); -} -static int tst__b(register int c, char tab[]) -{ - return (tab[(c >> 3) & 037] & (1 << (c & 07)) ); -} - -static char *llsave[16]; /* Look ahead buffer */ -static char llbuf[100]; /* work buffer */ -static char *llp1 = &llbuf[0]; /* pointer to next avail. in token */ -static char *llp2 = &llbuf[0]; /* pointer to end of lookahead */ -static char *llend = &llbuf[0]; /* pointer to end of token */ -static char *llebuf = &llbuf[sizeof llbuf]; -static int lleof; -static int yyline = 0; -extern struct lextab lextab; - -int gettoken(char *lltb, int lltbsiz) -{ - register char *lp, *tp, *ep; - - tp = lltb; - ep = tp+lltbsiz-1; - for (lp = llbuf; lp < llend && tp < ep;) - *tp++ = *lp++; - *tp = 0; - return(tp-lltb); -} - - -int yylex(char **exp) -{ - register int c, st; - int final, l, llk, i; - register struct lextab *lp; - char *cp; - - while (1) - { - llk = 0; - if (llset()) return(0); - st = 0; - final = -1; - lp = &lextab; - - do { - if (lp->lllook && (l = lp->lllook[st])) { - for (c=0; cllfinal[st]) != -1) { - final = i; - llend = llp1; - } - if ((c = llinp(exp)) < 0) - break; - if ((cp = lp->llbrk) && llk==0 && tst__b(c, cp)) { - llp1--; - break; - } - } while ((st = (*lp->llmove)(lp, c, st)) != -1); - - - if (llp2 < llp1) - llp2 = llp1; - if (final == -1) { - llend = llp1; - if (st == 0 && c < 0) - return(0); - if ((cp = lp->llill) && tst__b(c, cp)) { - continue; - } - return(ERROR); - } - if (c = (final >> 11) & 037) - llend = llsave[c-1]; - if ((c = (*lp->llactr)(final&03777)) >= 0) - return(c); - } -} - -void llinit(viud) -{ - llp1 = llp2 = llend = llbuf; - llebuf = llbuf + sizeof(llbuf); - lleof = yyline = 0; -} - - -static int llinp(char **exp) -{ - register c; - register struct lextab *lp; - register char *cp; - - lp = &lextab; - cp = lp->llign; /* Ignore class */ - for (;;) { - /* - * Get the next character from the save buffer (if possible) - * If the save buffer's empty, then return EOF or the next - * input character. Ignore the character if it's in the - * ignore class. - */ - c = (llp1 < llp2) ? *llp1 & 0377 : (lleof) ? EOF : lexgetc(exp); - if (c >= 0) { /* Got a character? */ - if (cp && tst__b(c, cp)) - continue; /* Ignore it */ - if (llp1 >= llebuf) { /* No, is there room? */ - return -1; - } - *llp1++ = c; /* Store in token buff */ - } else - lleof = 1; /* Set EOF signal */ - return(c); - } -} - -static int llset(void) -/* - * Return TRUE if EOF and nothing was moved in the look-ahead buffer - */ -{ - register char *lp1, *lp2; - - for (lp1 = llbuf, lp2 = llend; lp2 < llp2;) - *lp1++ = *lp2++; - llend = llp1 = llbuf; - llp2 = lp1; - return(lleof && lp1 == llbuf); -} diff --git a/lib/vis_milkdrop/evallib/cal.y b/lib/vis_milkdrop/evallib/cal.y deleted file mode 100644 index 3844ac0..0000000 --- a/lib/vis_milkdrop/evallib/cal.y +++ /dev/null @@ -1,155 +0,0 @@ - - %{ - #define YYSTYPE double - #include - #include - #include "Compiler.h" - #include "eval.h" - - yyerror(char *); - yylex(); - - extern int yyStackSize; - extern double result; - - int regs[26]; - int base; - - %} - - %token VALUE IDENTIFIER FUNCTION1 FUNCTION2 FUNCTION3 - - %left '|' - %left '&' - %left '+' '-' - %left '*' '/' '%' - %left UMINUS /*supplies precedence for unary minus */ - %left UPLUS /*supplies precedence for unary plus */ - - %% /*beginning of rules section */ - - stat : math_expr - { $$ = $1; result = $1; } - | IDENTIFIER '=' math_expr - { if (parseType == PARSE_EVAL) - { - setVar((int)$1, $3); - $$ = $3; - result = $3; - } - else - { - double i = setVar((int)$1, 0); - double v = createCompiledValue(0, &(varTable[(int)i].value)); - $$ = createCompiledFunction2(MATH_SIMPLE, FN_ASSIGN, v, $3); - result = $$; - } - } - ; - - value : VALUE { $$ = $1 } - - - primary_expr - : IDENTIFIER - { $$ = getVar((int)$1);} - | value - { $$ = $1;} - | '(' math_expr ')' - { $$ = $2;} - ; - - math_expr - : primary_expr - { $$ = $1; } - | math_expr '*' math_expr - { if (parseType == PARSE_EVAL) - $$ = $1 * $3; - else - $$ = createCompiledFunction2(MATH_SIMPLE, FN_MULTIPLY, $1, $3); - } - | math_expr '/' math_expr - { if (parseType == PARSE_EVAL) - $$ = $1 / $3; - else - $$ = createCompiledFunction2(MATH_SIMPLE, FN_DIVIDE, $1, $3); - } - | math_expr '%' math_expr - { if (parseType == PARSE_EVAL) - $$ = (double)((int)$1 % (int)$3); - else - $$ = createCompiledFunction2(MATH_SIMPLE, FN_MODULO, $1, $3); - } - | math_expr '+' math_expr - { if (parseType == PARSE_EVAL) - $$ = $1 + $3; - else - $$ = createCompiledFunction2(MATH_SIMPLE, FN_ADD, $1, $3); - } - | math_expr '-' math_expr - { if (parseType == PARSE_EVAL) - $$ = $1 - $3; - else - $$ = createCompiledFunction2(MATH_SIMPLE, FN_SUB, $1, $3); - } - | math_expr '&' math_expr - { if (parseType == PARSE_EVAL) - $$ = (double)((int)$1 & (int)$3); - else - $$ = createCompiledFunction2(MATH_SIMPLE, FN_AND, $1, $3); - } - | math_expr '|' math_expr - { if (parseType == PARSE_EVAL) - $$ = (double)((int)$1 | (int)$3); - else - $$ = createCompiledFunction2(MATH_SIMPLE, FN_OR, $1, $3); - } - | '-' math_expr %prec UMINUS - { if (parseType == PARSE_EVAL) - $$ = -$2; - else - $$ = createCompiledFunction1(MATH_SIMPLE, FN_UMINUS, $2); - } - | '+' math_expr %prec UPLUS - { if (parseType == PARSE_EVAL) - $$ = +$2; - else - $$ = createCompiledFunction1(MATH_SIMPLE, FN_UPLUS, $2); - } - | fonction - { $$ = $1; } - ; - - fonction - : FUNCTION1 '(' math_expr ')' - { if (parseType == PARSE_EVAL) - $$ = calcFunction1((int)$1, $3); - else - $$ = createCompiledFunction1(MATH_FN, (int)$1, $3); - } - | FUNCTION2 '(' math_expr ',' math_expr ')' - { if (parseType == PARSE_EVAL) - $$ = calcFunction2((int)$1, $3, $5); - else - $$ = createCompiledFunction2(MATH_FN, (int)$1, $3, $5); - } - | FUNCTION3 '(' math_expr ',' math_expr ',' math_expr ')' - { if (parseType == PARSE_EVAL) - $$ = calcFunction3((int)$1, $3, $5, $7); - else - $$ = createCompiledFunction3(MATH_FN, (int)$1, $3, $5, $7); - } - ; - - - - %% - main() - { - return(yyparse()); - } - - yywrap() - { - return(1); - } diff --git a/lib/vis_milkdrop/evallib/cal_tab.h b/lib/vis_milkdrop/evallib/cal_tab.h deleted file mode 100644 index 3621332..0000000 --- a/lib/vis_milkdrop/evallib/cal_tab.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - LICENSE - ------- -Copyright 2005 Nullsoft, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -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 Nullsoft 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR -CONTRIBUTORS 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 YYSTYPE -#define YYSTYPE int -#endif -#define VALUE 258 -#define IDENTIFIER 259 -#define FUNCTION1 260 -#define FUNCTION2 261 -#define FUNCTION3 262 -#define UMINUS 263 -#define UPLUS 264 - - -YYSTYPE yylval; diff --git a/lib/vis_milkdrop/evallib/cfunc.c b/lib/vis_milkdrop/evallib/cfunc.c deleted file mode 100644 index 30940b8..0000000 --- a/lib/vis_milkdrop/evallib/cfunc.c +++ /dev/null @@ -1,879 +0,0 @@ -/* - LICENSE - ------- -Copyright 2005 Nullsoft, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -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 Nullsoft 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR -CONTRIBUTORS 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 -//#include -#include -#include -#include "Compiler.h" -#include "eval.h" -#pragma warning(disable: 4312) - -static float g_cmpaddtab[2]={0.0,1.0}; -static double g_closefact = 0.00001, g_half=0.5; -extern double *nextBlock; - - -// FUNCTION CALL TEMPLATES - THESE ARE NEVER ACTUALLY CALLED, -// BUT COPIED AND MODIFIED. -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_simpleValue(void) -{ - __asm - { - mov eax, 0FFFFFFFFh; - ret - } -} -__declspec ( naked ) void _asm_simpleValue_end(void){} - - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_function3(void) -{ - __asm - { - mov ecx, 0FFFFFFFFh - call ecx - push eax - mov ecx, 0FFFFFFFFh - call ecx - push eax - mov ecx, 0FFFFFFFFh - call ecx - pop ebx - pop ecx - mov edx, 0FFFFFFFFh - jmp edx - } -} -__declspec ( naked ) void _asm_function3_end(void){} - - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_function2(void) -{ - __asm - { - mov ecx, 0FFFFFFFFh - call ecx - push eax - mov ecx, 0FFFFFFFFh - call ecx - pop ebx - mov ecx, 0FFFFFFFFh - jmp ecx - } -} -__declspec ( naked ) void _asm_function2_end(void){} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_function1(void) -{ - __asm - { - mov ecx, 0FFFFFFFFh - call ecx - mov ecx, 0FFFFFFFFh - jmp ecx - } -} -__declspec ( naked ) void _asm_function1_end(void){} - -// END FUNCTION CALL TEMPLATES - - - -// our registers -static int a,b; -static double *res; - - -#define isnonzero(x) (fabs(x) > g_closefact) - -//--------------------------------------------------------------------------------------------------------------- -static double _rand(double x) -{ - if (x < 1.0) x=1.0; - return (double)(rand()%(int)max(x,1.0)); -} - -//--------------------------------------------------------------------------------------------------------------- -static double _band(double var, double var2) -{ -return isnonzero(var) && isnonzero(var2) ? 1 : 0; -} - -//--------------------------------------------------------------------------------------------------------------- -static double _bor(double var, double var2) -{ -return isnonzero(var) || isnonzero(var2) ? 1 : 0; -} - -//--------------------------------------------------------------------------------------------------------------- -static double _sig(double x, double constraint) -{ -double t = (1+exp(-x*constraint)); -return isnonzero(t) ? 1.0/t : 0; -} - - - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_int(void) -{ - __asm mov dword ptr a, eax - - res = nextBlock++; - - _asm mov edx, DWORD PTR a - _asm fld QWORD PTR [edx] - _asm mov edx, DWORD PTR res - _asm fistp DWORD PTR [edx] - _asm fild DWORD PTR[edx] - _asm fstp QWORD PTR [edx] - _asm mov eax, res - _asm ret - -/* - MrC - The old version uses _ftol2_sse which stomps over our stack - *res = (double) ((int)(*((double*)a))); - __asm - { - mov eax, res - ret - } -*/ -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_asin(void) -{ - __asm mov dword ptr a, eax - - res = nextBlock++; - - *res = asin(*(double*)a); - __asm - { - mov eax, res - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_acos(void) -{ - __asm mov dword ptr a, eax - - res = nextBlock++; - - *res = acos(*(double*)a); - __asm - { - mov eax, res - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_atan(void) -{ - __asm mov dword ptr a, eax - - res = nextBlock++; - - *res = atan(*(double*)a); - __asm - { - mov eax, res - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_atan2(void) -{ - __asm - { - mov dword ptr a, eax - mov dword ptr b, ebx - } - - res = nextBlock++; - *res = atan2(*(double*)b, *(double*)a); - __asm - { - mov eax, res - ret - } -} - - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_sig(void) -{ - __asm - { - mov dword ptr a, eax - mov dword ptr b, ebx - } - res = nextBlock++; - *res = _sig(*(double*)b, *(double*)a); - __asm - { - mov eax, dword ptr res - ret - } -} -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_rand(void) -{ - __asm - { - mov dword ptr a, eax - } - - res = nextBlock++; - *res = _rand(*(double*)a); - - __asm - { - mov eax, res - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_band(void) -{ - __asm - { - mov dword ptr a, eax - mov dword ptr b, ebx - } - - res = nextBlock++; - *res = _band(*(double*)b, *(double*)a); - __asm - { - mov eax, res - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_bor(void) -{ - __asm - { - mov dword ptr a, eax - mov dword ptr b, ebx - } - - res = nextBlock++; - *res = _bor(*(double*)b, *(double*)a); - __asm - { - mov eax, res - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_pow(void) -{ - __asm - { - mov dword ptr a, eax - mov dword ptr b, ebx - } - - res = nextBlock++; - *res = pow(*(double*)b, *(double*)a); - __asm - { - mov eax, res - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_exp(void) -{ - __asm mov dword ptr a, eax - - res = nextBlock++; - - *res = exp(*(double*)a); - __asm - { - mov eax, res - ret - } -} - - - - - - - - - - -// these below are all asm, no loops, radness - - - - - - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_sin(void) -{ - __asm - { - fld qword ptr [eax] - mov eax, nextBlock - fsin - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_cos(void) -{ - __asm - { - fld qword ptr [eax] - mov eax, nextBlock - fcos - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_tan(void) -{ - __asm - { - fld qword ptr [eax] - mov eax, nextBlock - fsincos - fdiv - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_sqr(void) -{ - __asm - { - fld qword ptr [eax] - fld st(0) - mov eax, nextBlock - fmul - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_sqrt(void) -{ - __asm - { - fld qword ptr [eax] - mov eax, nextBlock - fabs - fsqrt - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_log(void) -{ - __asm - { - fld1 - fldl2e - fdiv - fld qword ptr [eax] - mov eax, nextBlock - fyl2x - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_log10(void) -{ - __asm - { - fld1 - fldl2t - fdiv - fld qword ptr [eax] - mov eax, nextBlock - fyl2x - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_abs(void) -{ - __asm - { - fld qword ptr [eax] - mov eax, nextBlock - fabs - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_assign(void) -{ - __asm - { - mov ecx, [eax] - mov edx, [eax+4] - mov [ebx], ecx - mov [ebx+4], edx - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_add(void) -{ - __asm - { - fld qword ptr [eax] - mov eax, nextBlock - fld qword ptr [ebx] - fadd - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_sub(void) -{ - __asm - { - fld qword ptr [ebx] - fld qword ptr [eax] - mov eax, nextBlock - fsub - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_mul(void) -{ - __asm - { - fld qword ptr [ebx] - fld qword ptr [eax] - mov eax, nextBlock - fmul - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_div(void) -{ - __asm - { - fld qword ptr [ebx] - fdiv qword ptr [eax] - mov eax, nextBlock - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_mod(void) -{ - __asm - { - fld qword ptr [ebx] - - fld qword ptr [eax] - fsub dword ptr [g_cmpaddtab+4] - fabs - fadd qword ptr [eax] - fadd dword ptr [g_cmpaddtab+4] - - fmul qword ptr [g_half] - - mov ebx, nextBlock - - fistp dword ptr [ebx] - fistp dword ptr [ebx+4] - mov eax, [ebx+4] - xor edx, edx - div dword ptr [ebx] - mov [ebx], edx - fild dword ptr [ebx] - fstp qword ptr [ebx] - mov eax, ebx - add ebx, 8 - mov nextBlock, ebx // eax is still good - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_or(void) -{ - __asm - { - fld qword ptr [ebx] - fld qword ptr [eax] - mov eax, nextBlock - fistp qword ptr [eax] - fistp qword ptr [eax+8] - mov ebx, [eax] - or [eax+4], ebx - mov ebx, [eax+8] - or [eax+12], ebx - fild qword ptr [eax] - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_and(void) -{ - __asm - { - fld qword ptr [ebx] - fld qword ptr [eax] - mov eax, nextBlock - fistp qword ptr [eax] - fistp qword ptr [eax+8] - mov ebx, [eax] - and [eax+4], ebx - mov ebx, [eax+8] - and [eax+12], ebx - fild qword ptr [eax] - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_uplus(void) -{ - __asm - { - mov ebx, nextBlock - mov ecx, [eax] - mov [ebx], ecx - mov ecx, [eax+4] - mov [ebx+4], ecx - mov eax, ebx - add ebx, 8 - mov nextBlock, ebx - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_uminus(void) -{ - __asm - { - mov ebx, nextBlock - mov ecx, [eax] - mov [ebx], ecx - mov ecx, [eax+4] - xor ecx, 0x80000000 - mov [ebx+4], ecx - mov eax, ebx - add ebx, 8 - mov nextBlock, ebx - ret - } -} - - - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_sign(void) -{ - __asm - { - fld qword ptr [eax] - fld st(0) - fabs - mov eax, nextBlock - fld qword ptr [g_closefact] - fadd - fdiv - fstp qword ptr [eax] - add eax, 8 - mov nextBlock, eax - sub eax, 8 - ret - } -} - - - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_bnot(void) -{ - __asm - { - mov ebx, nextBlock - fld qword ptr [g_closefact] - fld qword ptr [eax] - fabs - fcompp - fstsw ax - shr eax, 6 - and eax, (1<<2) - add eax, offset g_cmpaddtab - fld dword ptr [eax] - fstp qword ptr [ebx] - mov eax, ebx - add ebx, 8 - mov nextBlock, ebx - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_if(void) -{ - __asm - { - fld qword ptr [eax] - fld qword ptr [ebx] - fld qword ptr [g_closefact] - fld qword ptr [ecx] - fabs - fcompp - fstsw ax - mov ebx, nextBlock - fstp qword ptr [ebx] - fstp qword ptr [ebx+8] - shr eax, 5 - and eax, (1<<3) - add eax, ebx - fld qword ptr [eax] - fstp qword ptr [ebx] - mov eax, ebx - add ebx, 8 - mov nextBlock, ebx - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_equal(void) -{ - __asm - { - fld qword ptr [g_closefact] - fld qword ptr [eax] - fld qword ptr [ebx] - fsub - fabs - fcompp - fstsw ax - shr eax, 6 - and eax, (1<<2) - add eax, offset g_cmpaddtab - fld dword ptr [eax] - mov eax, nextBlock - fstp qword ptr [eax] - mov ebx, eax - add ebx, 8 - mov nextBlock, ebx - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_below(void) -{ - __asm - { - fld qword ptr [eax] - fld qword ptr [ebx] - mov ebx, nextBlock - fcompp - fstsw ax - shr eax, 6 - and eax, (1<<2) - add eax, offset g_cmpaddtab - fld dword ptr [eax] - fstp qword ptr [ebx] - mov eax, ebx - add ebx, 8 - mov nextBlock, ebx - ret - } -} - -//--------------------------------------------------------------------------------------------------------------- -__declspec ( naked ) void _asm_above(void) -{ - __asm - { - fld qword ptr [ebx] - fld qword ptr [eax] - mov ebx, nextBlock - fcompp - fstsw ax - shr eax, 6 - and eax, (1<<2) - add eax, offset g_cmpaddtab - fld dword ptr [eax] - fstp qword ptr [ebx] - mov eax, ebx - add ebx, 8 - mov nextBlock, ebx - ret - } -} - - -__declspec ( naked ) void _asm_min(void) -{ - __asm - { - fld qword ptr [eax] - fld qword ptr [ebx] - fld st(1) - mov eax, nextBlock - fld st(1) - add eax, 8 - fsub - mov nextBlock, eax - fabs // stack contains fabs(1-2),1,2 - fchs - sub eax, 8 - fadd - fadd - fld qword ptr [g_half] - fmul - fstp qword ptr [eax] - ret - } -} - -__declspec ( naked ) void _asm_max(void) -{ - __asm - { - fld qword ptr [eax] - fld qword ptr [ebx] - fld st(1) - mov eax, nextBlock - fld st(1) - add eax, 8 - fsub - mov nextBlock, eax - fabs // stack contains fabs(1-2),1,2 - sub eax, 8 - fadd - fadd - fld qword ptr [g_half] - fmul - fstp qword ptr [eax] - ret - } -} diff --git a/lib/vis_milkdrop/evallib/eval.c b/lib/vis_milkdrop/evallib/eval.c deleted file mode 100644 index 27d5d61..0000000 --- a/lib/vis_milkdrop/evallib/eval.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - LICENSE - ------- -Copyright 2005 Nullsoft, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -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 Nullsoft 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR -CONTRIBUTORS 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 -//#include -#include -#include -#include -#include -#include -#include "cal_tab.h" -#include "compiler.h" -#include "eval.h" -#include "CAL_TAB.C" - -#define INTCONST 1 -#define DBLCONST 2 -#define HEXCONST 3 -#define VARIABLE 4 -#define OTHER 5 - -#define strnicmp _strnicmp -#define strcmpi _strcmpi - -int yyparse(char *exp); -void llinit(void); -int gettoken(char *lltb, int lltbsiz); -char yytext[256]=""; -char expression[4096]=""; -char lastVar[256]=""; -int *errPtr; -int result; -int colCount=0; - -varType *varTable; - - -//------------------------------------------------------------------------------ -void *compileExpression(char *exp) -{ - int errv=0; - errPtr=&errv; - llinit(); - if (!yyparse(exp) && !*errPtr) - { - return (void*)result; - } - return 0; -} - -// NOTE: be sure to initialize & clean these up from your app! (InitializeCriticalSection(&g_eval_cs);) -CRITICAL_SECTION g_eval_cs; -BOOL g_eval_cs_valid; - -//------------------------------------------------------------------------------ -void resetVars(varType *vars) -{ - if (!g_eval_cs_valid) - { - g_eval_cs_valid = TRUE; -// InitializeCriticalSection(&g_eval_cs); - } - -// if (vars) EnterCriticalSection(&g_eval_cs); - varTable=vars; -// if (!vars) LeaveCriticalSection(&g_eval_cs); -} - -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -void setLastVar(void) -{ - gettoken(lastVar, sizeof lastVar); -} - -//------------------------------------------------------------------------------ -int setVar(int varNum, double value) -{ - int i=varNum; - if (varNum < 0) - for (i=0;i= '0' && a <= '9') v+=a-'0'; - else if (a >= 'A' && a <= 'F') v+=10+a-'A'; - else if (a >= 'a' && a <= 'f') v+=10+a-'a'; - else break; - v<<=4; - } - return createCompiledValue((double)v, NULL); - } - return 0; -} - -//------------------------------------------------------------------------------ -int objectId(int nParams) -{ - switch (nParams) - { - case 1: return FUNCTION1; - case 2: return FUNCTION2; - case 3: return FUNCTION3; - } - return IDENTIFIER; -} - -//------------------------------------------------------------------------------ -int lookup(int *typeOfObject) -{ - int i; - gettoken(yytext, sizeof yytext); - for (i=0;i