diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/lscript | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/lscript')
38 files changed, 2628 insertions, 3976 deletions
diff --git a/linden/indra/lscript/CMakeLists.txt b/linden/indra/lscript/CMakeLists.txt new file mode 100644 index 0000000..c655aef --- /dev/null +++ b/linden/indra/lscript/CMakeLists.txt | |||
@@ -0,0 +1,18 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | set(lscript_HEADER_FILES | ||
4 | lscript_alloc.h | ||
5 | lscript_byteconvert.h | ||
6 | lscript_byteformat.h | ||
7 | lscript_execute.h | ||
8 | lscript_export.h | ||
9 | lscript_http.h | ||
10 | lscript_library.h | ||
11 | lscript_rt_interface.h | ||
12 | ) | ||
13 | |||
14 | add_subdirectory(lscript_compile) | ||
15 | add_subdirectory(lscript_execute) | ||
16 | |||
17 | add_subdirectory(lscript_library) | ||
18 | |||
diff --git a/linden/indra/lscript/files.lst b/linden/indra/lscript/files.lst deleted file mode 100644 index 3413b4e..0000000 --- a/linden/indra/lscript/files.lst +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | lscript/lscript_compile/indra.l.cpp | ||
2 | lscript/lscript_compile/indra.y.cpp | ||
3 | lscript/lscript_compile/lscript_alloc.cpp | ||
4 | lscript/lscript_compile/lscript_bytecode.cpp | ||
5 | lscript/lscript_compile/lscript_error.cpp | ||
6 | lscript/lscript_compile/lscript_heap.cpp | ||
7 | lscript/lscript_compile/lscript_resource.cpp | ||
8 | lscript/lscript_compile/lscript_scope.cpp | ||
9 | lscript/lscript_compile/lscript_tree.cpp | ||
10 | lscript/lscript_compile/lscript_typecheck.cpp | ||
11 | lscript/lscript_execute/lscript_execute.cpp | ||
12 | lscript/lscript_execute/lscript_heapruntime.cpp | ||
13 | lscript/lscript_execute/lscript_readlso.cpp | ||
14 | lscript/lscript_library/lscript_alloc.cpp | ||
15 | lscript/lscript_library/lscript_library.cpp | ||
16 | lscript/lscript_library/lscript_export.cpp | ||
diff --git a/linden/indra/lscript/lscript_byteconvert.h b/linden/indra/lscript/lscript_byteconvert.h index e17f3fc..9530b63 100644 --- a/linden/indra/lscript/lscript_byteconvert.h +++ b/linden/indra/lscript/lscript_byteconvert.h | |||
@@ -415,7 +415,7 @@ inline void set_fault(const U8 *stream, LSCRIPTRunTimeFaults fault) | |||
415 | reset_hp_to_safe_spot(stream); | 415 | reset_hp_to_safe_spot(stream); |
416 | // lsa_print_heap((U8 *)stream); | 416 | // lsa_print_heap((U8 *)stream); |
417 | } | 417 | } |
418 | fr = LSCRIPTRunTimeFaultBits[fault]; | 418 | fr = fault; |
419 | set_register((U8 *)stream, LREG_FR, fr); | 419 | set_register((U8 *)stream, LREG_FR, fr); |
420 | } | 420 | } |
421 | } | 421 | } |
@@ -1110,7 +1110,7 @@ inline void safe_heap_bytestream_count_char(U8 *stream, S32 &offset) | |||
1110 | ; | 1110 | ; |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | inline void safe_instruction_char2bytestream(U8 *stream, S32 &offset, char *buffer) | 1113 | inline void safe_instruction_char2bytestream(U8 *stream, S32 &offset, const char* buffer) |
1114 | { | 1114 | { |
1115 | while ( (safe_instruction_check_address(stream, offset, 1)) | 1115 | while ( (safe_instruction_check_address(stream, offset, 1)) |
1116 | &&(*(stream + offset++) = *buffer++)) | 1116 | &&(*(stream + offset++) = *buffer++)) |
diff --git a/linden/indra/lscript/lscript_byteformat.h b/linden/indra/lscript/lscript_byteformat.h index 1e54e9c..1f201d8 100644 --- a/linden/indra/lscript/lscript_byteformat.h +++ b/linden/indra/lscript/lscript_byteformat.h | |||
@@ -512,25 +512,11 @@ typedef enum e_lscript_runtime_faults | |||
512 | LSRF_CHAT_OVERRUN, | 512 | LSRF_CHAT_OVERRUN, |
513 | LSRF_TOO_MANY_LISTENS, | 513 | LSRF_TOO_MANY_LISTENS, |
514 | LSRF_NESTING_LISTS, | 514 | LSRF_NESTING_LISTS, |
515 | LSRF_CLI, | ||
515 | LSRF_EOF | 516 | LSRF_EOF |
516 | } LSCRIPTRunTimeFaults; | 517 | } LSCRIPTRunTimeFaults; |
517 | 518 | ||
518 | extern char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/ | 519 | extern const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/ |
519 | |||
520 | const S32 LSCRIPTRunTimeFaultBits[LSRF_EOF] = | ||
521 | { | ||
522 | 0, // LSRF_INVALID | ||
523 | 1, // LSRF_MATH | ||
524 | 2, // LSRF_STACK_HEAP_COLLISION | ||
525 | 3, // LSREF_BOUND_CHECK_ERROR | ||
526 | 4, // LSREF_HEAP_ERROR | ||
527 | 5, // LSREF_VERSION_MISMATCH | ||
528 | 6, // LSREF_MISSING_INVENTORY | ||
529 | 7, // LSRF_SANDBOX | ||
530 | 8, // LSRF_CHAT_OVERRUN | ||
531 | 9, // LSRF_TOO_MANY_LISTENS | ||
532 | 10, // LSRF_NESTING_LISTS | ||
533 | }; | ||
534 | 520 | ||
535 | typedef enum e_lscript_runtime_permissions | 521 | typedef enum e_lscript_runtime_permissions |
536 | { | 522 | { |
diff --git a/linden/indra/lscript/lscript_compile/CMakeLists.txt b/linden/indra/lscript/lscript_compile/CMakeLists.txt new file mode 100644 index 0000000..252085b --- /dev/null +++ b/linden/indra/lscript/lscript_compile/CMakeLists.txt | |||
@@ -0,0 +1,148 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | include(00-Common) | ||
4 | include(LLCommon) | ||
5 | include(LLMath) | ||
6 | include(LLMessage) | ||
7 | include(LLInventory) | ||
8 | include(LScript) | ||
9 | |||
10 | include(FindCygwin) | ||
11 | |||
12 | find_program(FLEX flex | ||
13 | "C:/Program Files/GnuWin32/bin" | ||
14 | ${CYGWIN_INSTALL_PATH}/bin | ||
15 | /bin | ||
16 | /usr/bin | ||
17 | /usr/local/bin | ||
18 | ) | ||
19 | mark_as_advanced(FLEX) | ||
20 | |||
21 | find_program(BISON bison | ||
22 | "C:/Program Files/GnuWin32/bin" | ||
23 | ${CYGWIN_INSTALL_PATH}/bin | ||
24 | /bin | ||
25 | /usr/bin | ||
26 | /usr/local/bin | ||
27 | ) | ||
28 | mark_as_advanced(BISON) | ||
29 | |||
30 | find_program(M4 m4 | ||
31 | "C:/Program Files/GnuWin32/bin" | ||
32 | ${CYGWIN_INSTALL_PATH}/bin | ||
33 | /bin | ||
34 | /usr/bin | ||
35 | /usr/local/bin | ||
36 | ) | ||
37 | mark_as_advanced(M4) | ||
38 | |||
39 | include_directories( | ||
40 | ${LLCOMMON_INCLUDE_DIRS} | ||
41 | ${LLMATH_INCLUDE_DIRS} | ||
42 | ${LLMESSAGE_INCLUDE_DIRS} | ||
43 | ${LLINVENTORY_INCLUDE_DIRS} | ||
44 | ${LSCRIPT_INCLUDE_DIRS} | ||
45 | ) | ||
46 | |||
47 | set(lscript_generated_SOURCE_FILES | ||
48 | indra.l.cpp | ||
49 | indra.y.cpp | ||
50 | ) | ||
51 | |||
52 | set(lscript_compile_SOURCE_FILES | ||
53 | lscript_alloc.cpp | ||
54 | lscript_bytecode.cpp | ||
55 | lscript_error.cpp | ||
56 | lscript_heap.cpp | ||
57 | lscript_resource.cpp | ||
58 | lscript_scope.cpp | ||
59 | lscript_tree.cpp | ||
60 | lscript_typecheck.cpp | ||
61 | ) | ||
62 | |||
63 | set(lscript_compile_HEADER_FILES | ||
64 | CMakeLists.txt | ||
65 | |||
66 | indra.l | ||
67 | indra.y | ||
68 | |||
69 | ../lscript_alloc.h | ||
70 | ../lscript_byteformat.h | ||
71 | ../lscript_byteconvert.h | ||
72 | ../lscript_http.h | ||
73 | |||
74 | lscript_error.h | ||
75 | lscript_bytecode.h | ||
76 | lscript_heap.h | ||
77 | lscript_resource.h | ||
78 | lscript_scope.h | ||
79 | lscript_tree.h | ||
80 | lscript_typecheck.h | ||
81 | ) | ||
82 | |||
83 | set_source_files_properties(${lscript_compile_HEADER_FILES} | ||
84 | PROPERTIES HEADER_FILE_ONLY TRUE) | ||
85 | |||
86 | set_source_files_properties(${lscript_generated_SOURCE_FILES} | ||
87 | PROPERTIES HEADER_FILE_ONLY FALSE GENERATED TRUE) | ||
88 | |||
89 | list(APPEND lscript_compile_SOURCE_FILES ${lscript_generated_SOURCE_FILES} ${lscript_compile_HEADER_FILES}) | ||
90 | |||
91 | add_custom_command( | ||
92 | OUTPUT | ||
93 | ${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp | ||
94 | COMMAND ${FLEX} | ||
95 | ARGS | ||
96 | -o${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp | ||
97 | ${CMAKE_CURRENT_SOURCE_DIR}/indra.l | ||
98 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/indra.l | ||
99 | ) | ||
100 | |||
101 | if (WINDOWS) | ||
102 | set_source_files_properties(indra.l.cpp | ||
103 | PROPERTIES COMPILE_FLAGS /DYY_NO_UNISTD_H) | ||
104 | endif (WINDOWS) | ||
105 | |||
106 | if (WINDOWS) | ||
107 | get_filename_component(M4_PATH ${M4} PATH) | ||
108 | add_custom_command( | ||
109 | OUTPUT | ||
110 | ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp | ||
111 | ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp | ||
112 | COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat | ||
113 | ${BISON} ${M4_PATH} | ||
114 | ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp | ||
115 | ${CMAKE_CURRENT_SOURCE_DIR}/indra.y | ||
116 | DEPENDS | ||
117 | ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat | ||
118 | ${CMAKE_CURRENT_SOURCE_DIR}/indra.y | ||
119 | ) | ||
120 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/windows) | ||
121 | else (WINDOWS) | ||
122 | add_custom_command( | ||
123 | OUTPUT | ||
124 | ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp | ||
125 | ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp | ||
126 | COMMAND | ||
127 | ${BISON} | ||
128 | ARGS | ||
129 | -d -o ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp | ||
130 | ${CMAKE_CURRENT_SOURCE_DIR}/indra.y | ||
131 | DEPENDS | ||
132 | ${CMAKE_CURRENT_SOURCE_DIR}/indra.y | ||
133 | ) | ||
134 | endif (WINDOWS) | ||
135 | |||
136 | if (DARWIN) | ||
137 | # Mac OS X 10.4 compatibility | ||
138 | add_custom_command( | ||
139 | OUTPUT | ||
140 | ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp | ||
141 | COMMAND | ||
142 | mv | ||
143 | ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp.h | ||
144 | ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp | ||
145 | ) | ||
146 | endif (DARWIN) | ||
147 | |||
148 | add_library (lscript_compile ${lscript_compile_SOURCE_FILES}) | ||
diff --git a/linden/indra/lscript/lscript_compile/bison.bat b/linden/indra/lscript/lscript_compile/bison.bat new file mode 100644 index 0000000..54cf023 --- /dev/null +++ b/linden/indra/lscript/lscript_compile/bison.bat | |||
@@ -0,0 +1,11 @@ | |||
1 | @REM Run bison under Windows. This script is needed so that bison can | ||
2 | @REM find m4, even if neither program is present in PATH. | ||
3 | |||
4 | @set bison=%1 | ||
5 | set M4PATH=%2 | ||
6 | set M4= | ||
7 | @set output=%3 | ||
8 | @set input=%4 | ||
9 | |||
10 | set PATH=%M4PATH%;%PATH% | ||
11 | %bison% -d -o %output% %input% | ||
diff --git a/linden/indra/lscript/lscript_compile/indra.l b/linden/indra/lscript/lscript_compile/indra.l index 74e32fd..49ed6fc 100644 --- a/linden/indra/lscript/lscript_compile/indra.l +++ b/linden/indra/lscript/lscript_compile/indra.l | |||
@@ -19,11 +19,7 @@ FS (f|F) | |||
19 | #include "lscript_tree.h" | 19 | #include "lscript_tree.h" |
20 | #include "lscript_typecheck.h" | 20 | #include "lscript_typecheck.h" |
21 | #include "lscript_resource.h" | 21 | #include "lscript_resource.h" |
22 | #if LL_WINDOWS | 22 | #include "indra.y.hpp" |
23 | #include "ytab.h" | ||
24 | #else | ||
25 | #include "indra.y.h" | ||
26 | #endif | ||
27 | #include "lltimer.h" | 23 | #include "lltimer.h" |
28 | #include "indra_constants.h" | 24 | #include "indra_constants.h" |
29 | #include "llagentconstants.h" | 25 | #include "llagentconstants.h" |
@@ -505,6 +501,9 @@ extern "C" { int yyerror(const char *fmt, ...); } | |||
505 | "PRIM_SCULPT_TYPE_TORUS" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_TORUS; return(INTEGER_CONSTANT); } | 501 | "PRIM_SCULPT_TYPE_TORUS" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_TORUS; return(INTEGER_CONSTANT); } |
506 | "PRIM_SCULPT_TYPE_PLANE" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_PLANE; return(INTEGER_CONSTANT); } | 502 | "PRIM_SCULPT_TYPE_PLANE" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_PLANE; return(INTEGER_CONSTANT); } |
507 | "PRIM_SCULPT_TYPE_CYLINDER" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_CYLINDER; return(INTEGER_CONSTANT); } | 503 | "PRIM_SCULPT_TYPE_CYLINDER" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_CYLINDER; return(INTEGER_CONSTANT); } |
504 | "PRIM_SCULPT_TYPE_MASK" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_MASK; return(INTEGER_CONSTANT); } | ||
505 | "PRIM_SCULPT_FLAG_MIRROR" { count(); yylval.ival = LSL_PRIM_SCULPT_FLAG_MIRROR; return(INTEGER_CONSTANT); } | ||
506 | "PRIM_SCULPT_FLAG_INVERT" { count(); yylval.ival = LSL_PRIM_SCULPT_FLAG_INVERT; return(INTEGER_CONSTANT); } | ||
508 | 507 | ||
509 | "MASK_BASE" { count(); yylval.ival = 0; return(INTEGER_CONSTANT); } | 508 | "MASK_BASE" { count(); yylval.ival = 0; return(INTEGER_CONSTANT); } |
510 | "MASK_OWNER" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); } | 509 | "MASK_OWNER" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); } |
@@ -680,7 +679,7 @@ int yyerror(const char *fmt, ...) | |||
680 | //#define EMIT_CIL_ASSEMBLER | 679 | //#define EMIT_CIL_ASSEMBLER |
681 | 680 | ||
682 | BOOL lscript_compile(const char* src_filename, const char* dst_filename, | 681 | BOOL lscript_compile(const char* src_filename, const char* dst_filename, |
683 | const char* err_filename, BOOL is_god_like) | 682 | const char* err_filename, BOOL compile_to_mono, const char* class_name, BOOL is_god_like) |
684 | { | 683 | { |
685 | BOOL b_parse_ok = FALSE; | 684 | BOOL b_parse_ok = FALSE; |
686 | BOOL b_dummy = FALSE; | 685 | BOOL b_dummy = FALSE; |
@@ -696,10 +695,10 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, | |||
696 | init_temp_jumps(); | 695 | init_temp_jumps(); |
697 | gAllocationManager = new LLScriptAllocationManager(); | 696 | gAllocationManager = new LLScriptAllocationManager(); |
698 | 697 | ||
699 | yyin = LLFile::fopen(src_filename, "r"); | 698 | yyin = LLFile::fopen(std::string(src_filename), "r"); |
700 | if (yyin) | 699 | if (yyin) |
701 | { | 700 | { |
702 | yyout = LLFile::fopen(err_filename, "w"); | 701 | yyout = LLFile::fopen(std::string(err_filename), "w"); |
703 | 702 | ||
704 | // Reset the lexer's internal buffering. | 703 | // Reset the lexer's internal buffering. |
705 | 704 | ||
@@ -722,6 +721,8 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, | |||
722 | } | 721 | } |
723 | 722 | ||
724 | gScriptp->mGodLike = is_god_like; | 723 | gScriptp->mGodLike = is_god_like; |
724 | |||
725 | gScriptp->setClassName(class_name); | ||
725 | 726 | ||
726 | gScopeStringTable = new LLStringTable(16384); | 727 | gScopeStringTable = new LLStringTable(16384); |
727 | #ifdef EMERGENCY_DEBUG_PRINTOUTS | 728 | #ifdef EMERGENCY_DEBUG_PRINTOUTS |
@@ -737,34 +738,25 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, | |||
737 | #ifdef EMERGENCY_DEBUG_PRINTOUTS | 738 | #ifdef EMERGENCY_DEBUG_PRINTOUTS |
738 | gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_ASSEMBLY, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); | 739 | gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_ASSEMBLY, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); |
739 | #endif | 740 | #endif |
740 | #ifdef EMIT_CIL_ASSEMBLER | 741 | if(TRUE == compile_to_mono) |
741 | const char* cil_output_file_name = dst_filename? dst_filename : "lscript.cil"; | ||
742 | LLFILE* cilout = LLFile::fopen(cil_output_file_name, "w"); | ||
743 | if(NULL == cilout) | ||
744 | { | 742 | { |
745 | fprintf(yyout, "Error opening cil output file %s\n", cil_output_file_name); | 743 | gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_CIL_ASSEMBLY, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); |
746 | } | 744 | } |
747 | else | 745 | else |
748 | { | 746 | { |
749 | gScriptp->recurse(cilout, 0, 0, LSCP_EMIT_CIL_ASSEMBLY, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); | 747 | gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_BYTE_CODE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); |
750 | if(fclose(cilout) == EOF) | ||
751 | { | ||
752 | fprintf(yyout, "Error closing cil output file %s\n", cil_output_file_name); | ||
753 | } | ||
754 | } | 748 | } |
755 | #endif | ||
756 | gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_BYTE_CODE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); | ||
757 | } | 749 | } |
758 | delete gScopeStringTable; | 750 | delete gScopeStringTable; |
759 | gScopeStringTable = NULL; | 751 | gScopeStringTable = NULL; |
760 | #ifdef EMERGENCY_DEBUG_PRINTOUTS | 752 | #ifdef EMERGENCY_DEBUG_PRINTOUTS |
761 | fclose(compfile); | 753 | fclose(compfile); |
762 | #endif | 754 | #endif |
755 | fclose(yyout); | ||
763 | } | 756 | } |
764 | fclose(yyout); | 757 | fclose(yyin); |
765 | } | 758 | } |
766 | 759 | ||
767 | fclose(yyin); | ||
768 | delete gAllocationManager; | 760 | delete gAllocationManager; |
769 | delete gScopeStringTable; | 761 | delete gScopeStringTable; |
770 | 762 | ||
@@ -772,13 +764,15 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, | |||
772 | } | 764 | } |
773 | 765 | ||
774 | 766 | ||
775 | BOOL lscript_compile(char *filename, BOOL is_god_like = FALSE) | 767 | BOOL lscript_compile(char *filename, BOOL compile_to_mono, BOOL is_god_like = FALSE) |
776 | { | 768 | { |
777 | char src_filename[MAX_STRING]; | 769 | char src_filename[MAX_STRING]; |
778 | sprintf(src_filename, "%s.lsl", filename); | 770 | sprintf(src_filename, "%s.lsl", filename); |
779 | char err_filename[MAX_STRING]; | 771 | char err_filename[MAX_STRING]; |
780 | sprintf(err_filename, "%s.out", filename); | 772 | sprintf(err_filename, "%s.out", filename); |
781 | return lscript_compile(src_filename, NULL, err_filename, is_god_like); | 773 | char class_name[MAX_STRING]; |
774 | sprintf(class_name, "%s", filename); | ||
775 | return lscript_compile(src_filename, NULL, err_filename, compile_to_mono, class_name, is_god_like); | ||
782 | } | 776 | } |
783 | 777 | ||
784 | 778 | ||
diff --git a/linden/indra/lscript/lscript_compile/lscript_bytecode.cpp b/linden/indra/lscript/lscript_compile/lscript_bytecode.cpp index 31ab909..7c2b07f 100644 --- a/linden/indra/lscript/lscript_compile/lscript_bytecode.cpp +++ b/linden/indra/lscript/lscript_compile/lscript_bytecode.cpp | |||
@@ -101,7 +101,7 @@ void LLScriptByteCodeChunk::addU16(U16 data) | |||
101 | addBytes(temp, 2); | 101 | addBytes(temp, 2); |
102 | } | 102 | } |
103 | 103 | ||
104 | void LLScriptByteCodeChunk::addBytes(U8 *bytes, S32 size) | 104 | void LLScriptByteCodeChunk::addBytes(const U8 *bytes, S32 size) |
105 | { | 105 | { |
106 | if (mCodeChunk) | 106 | if (mCodeChunk) |
107 | { | 107 | { |
@@ -118,7 +118,7 @@ void LLScriptByteCodeChunk::addBytes(U8 *bytes, S32 size) | |||
118 | mCurrentOffset += size; | 118 | mCurrentOffset += size; |
119 | } | 119 | } |
120 | 120 | ||
121 | void LLScriptByteCodeChunk::addBytes(char *bytes, S32 size) | 121 | void LLScriptByteCodeChunk::addBytes(const char *bytes, S32 size) |
122 | { | 122 | { |
123 | if (mCodeChunk) | 123 | if (mCodeChunk) |
124 | { | 124 | { |
diff --git a/linden/indra/lscript/lscript_compile/lscript_bytecode.h b/linden/indra/lscript/lscript_compile/lscript_bytecode.h index 272aa60..0da1e37 100644 --- a/linden/indra/lscript/lscript_compile/lscript_bytecode.h +++ b/linden/indra/lscript/lscript_compile/lscript_bytecode.h | |||
@@ -56,8 +56,8 @@ public: | |||
56 | 56 | ||
57 | void addByte(U8 byte); | 57 | void addByte(U8 byte); |
58 | void addU16(U16 data); | 58 | void addU16(U16 data); |
59 | void addBytes(U8 *bytes, S32 size); | 59 | void addBytes(const U8 *bytes, S32 size); |
60 | void addBytes(char *bytes, S32 size); | 60 | void addBytes(const char *bytes, S32 size); |
61 | void addBytes(S32 size); | 61 | void addBytes(S32 size); |
62 | void addBytesDontInc(S32 size); | 62 | void addBytesDontInc(S32 size); |
63 | void addInteger(S32 value); | 63 | void addInteger(S32 value); |
diff --git a/linden/indra/lscript/lscript_compile/lscript_compile.vcproj b/linden/indra/lscript/lscript_compile/lscript_compile.vcproj deleted file mode 100644 index a95c05e..0000000 --- a/linden/indra/lscript/lscript_compile/lscript_compile.vcproj +++ /dev/null | |||
@@ -1,227 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="7.10" | ||
5 | Name="lscript_compile" | ||
6 | ProjectGUID="{44CE6D82-7320-4609-8FC3-5965C19F4808}" | ||
7 | Keyword="Win32Proj"> | ||
8 | <Platforms> | ||
9 | <Platform | ||
10 | Name="Win32"/> | ||
11 | </Platforms> | ||
12 | <Configurations> | ||
13 | <Configuration | ||
14 | Name="Debug|Win32" | ||
15 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
16 | IntermediateDirectory="Debug" | ||
17 | ConfigurationType="4" | ||
18 | CharacterSet="1"> | ||
19 | <Tool | ||
20 | Name="VCCLCompilerTool" | ||
21 | Optimization="0" | ||
22 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
23 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG;YY_NO_UNISTD_H" | ||
24 | MinimalRebuild="TRUE" | ||
25 | BasicRuntimeChecks="3" | ||
26 | RuntimeLibrary="1" | ||
27 | StructMemberAlignment="4" | ||
28 | ForceConformanceInForLoopScope="TRUE" | ||
29 | UsePrecompiledHeader="0" | ||
30 | WarningLevel="3" | ||
31 | WarnAsError="FALSE" | ||
32 | Detect64BitPortabilityProblems="FALSE" | ||
33 | DebugInformationFormat="4" | ||
34 | DisableSpecificWarnings="4065"/> | ||
35 | <Tool | ||
36 | Name="VCCustomBuildTool"/> | ||
37 | <Tool | ||
38 | Name="VCLibrarianTool" | ||
39 | OutputFile="$(OutDir)/lscript_compile.lib"/> | ||
40 | <Tool | ||
41 | Name="VCMIDLTool"/> | ||
42 | <Tool | ||
43 | Name="VCPostBuildEventTool"/> | ||
44 | <Tool | ||
45 | Name="VCPreBuildEventTool"/> | ||
46 | <Tool | ||
47 | Name="VCPreLinkEventTool"/> | ||
48 | <Tool | ||
49 | Name="VCResourceCompilerTool"/> | ||
50 | <Tool | ||
51 | Name="VCWebServiceProxyGeneratorTool"/> | ||
52 | <Tool | ||
53 | Name="VCXMLDataGeneratorTool"/> | ||
54 | <Tool | ||
55 | Name="VCManagedWrapperGeneratorTool"/> | ||
56 | <Tool | ||
57 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
58 | </Configuration> | ||
59 | <Configuration | ||
60 | Name="Release|Win32" | ||
61 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
62 | IntermediateDirectory="Release" | ||
63 | ConfigurationType="4" | ||
64 | CharacterSet="1"> | ||
65 | <Tool | ||
66 | Name="VCCLCompilerTool" | ||
67 | AdditionalOptions="/Oy-" | ||
68 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
69 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE;YY_NO_UNISTD_H" | ||
70 | RuntimeLibrary="0" | ||
71 | StructMemberAlignment="0" | ||
72 | ForceConformanceInForLoopScope="TRUE" | ||
73 | UsePrecompiledHeader="0" | ||
74 | WarningLevel="3" | ||
75 | WarnAsError="FALSE" | ||
76 | Detect64BitPortabilityProblems="FALSE" | ||
77 | DebugInformationFormat="3" | ||
78 | DisableSpecificWarnings="4065"/> | ||
79 | <Tool | ||
80 | Name="VCCustomBuildTool"/> | ||
81 | <Tool | ||
82 | Name="VCLibrarianTool" | ||
83 | OutputFile="$(OutDir)/lscript_compile.lib"/> | ||
84 | <Tool | ||
85 | Name="VCMIDLTool"/> | ||
86 | <Tool | ||
87 | Name="VCPostBuildEventTool"/> | ||
88 | <Tool | ||
89 | Name="VCPreBuildEventTool"/> | ||
90 | <Tool | ||
91 | Name="VCPreLinkEventTool"/> | ||
92 | <Tool | ||
93 | Name="VCResourceCompilerTool"/> | ||
94 | <Tool | ||
95 | Name="VCWebServiceProxyGeneratorTool"/> | ||
96 | <Tool | ||
97 | Name="VCXMLDataGeneratorTool"/> | ||
98 | <Tool | ||
99 | Name="VCManagedWrapperGeneratorTool"/> | ||
100 | <Tool | ||
101 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
102 | </Configuration> | ||
103 | <Configuration | ||
104 | Name="ReleaseNoOpt|Win32" | ||
105 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
106 | IntermediateDirectory="$(ConfigurationName)" | ||
107 | ConfigurationType="4" | ||
108 | CharacterSet="1"> | ||
109 | <Tool | ||
110 | Name="VCCLCompilerTool" | ||
111 | AdditionalOptions="/Oy-" | ||
112 | Optimization="0" | ||
113 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
114 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE;YY_NO_UNISTD_H" | ||
115 | RuntimeLibrary="0" | ||
116 | StructMemberAlignment="0" | ||
117 | ForceConformanceInForLoopScope="TRUE" | ||
118 | UsePrecompiledHeader="0" | ||
119 | WarningLevel="3" | ||
120 | WarnAsError="FALSE" | ||
121 | Detect64BitPortabilityProblems="FALSE" | ||
122 | DebugInformationFormat="3" | ||
123 | DisableSpecificWarnings="4065"/> | ||
124 | <Tool | ||
125 | Name="VCCustomBuildTool"/> | ||
126 | <Tool | ||
127 | Name="VCLibrarianTool" | ||
128 | OutputFile="$(OutDir)/lscript_compile.lib"/> | ||
129 | <Tool | ||
130 | Name="VCMIDLTool"/> | ||
131 | <Tool | ||
132 | Name="VCPostBuildEventTool"/> | ||
133 | <Tool | ||
134 | Name="VCPreBuildEventTool"/> | ||
135 | <Tool | ||
136 | Name="VCPreLinkEventTool"/> | ||
137 | <Tool | ||
138 | Name="VCResourceCompilerTool"/> | ||
139 | <Tool | ||
140 | Name="VCWebServiceProxyGeneratorTool"/> | ||
141 | <Tool | ||
142 | Name="VCXMLDataGeneratorTool"/> | ||
143 | <Tool | ||
144 | Name="VCManagedWrapperGeneratorTool"/> | ||
145 | <Tool | ||
146 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
147 | </Configuration> | ||
148 | </Configurations> | ||
149 | <References> | ||
150 | </References> | ||
151 | <Files> | ||
152 | <Filter | ||
153 | Name="Source Files" | ||
154 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
155 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> | ||
156 | <File | ||
157 | RelativePath=".\lex_yy.cpp"> | ||
158 | </File> | ||
159 | <File | ||
160 | RelativePath=".\lscript_alloc.cpp"> | ||
161 | </File> | ||
162 | <File | ||
163 | RelativePath=".\lscript_bytecode.cpp"> | ||
164 | </File> | ||
165 | <File | ||
166 | RelativePath=".\lscript_error.cpp"> | ||
167 | </File> | ||
168 | <File | ||
169 | RelativePath=".\lscript_heap.cpp"> | ||
170 | </File> | ||
171 | <File | ||
172 | RelativePath=".\lscript_resource.cpp"> | ||
173 | </File> | ||
174 | <File | ||
175 | RelativePath=".\lscript_scope.cpp"> | ||
176 | </File> | ||
177 | <File | ||
178 | RelativePath=".\lscript_tree.cpp"> | ||
179 | </File> | ||
180 | <File | ||
181 | RelativePath=".\lscript_typecheck.cpp"> | ||
182 | </File> | ||
183 | <File | ||
184 | RelativePath=".\ytab.cpp"> | ||
185 | </File> | ||
186 | </Filter> | ||
187 | <Filter | ||
188 | Name="Header Files" | ||
189 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
190 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> | ||
191 | <File | ||
192 | RelativePath=".\generated_lex_yy.hpp"> | ||
193 | </File> | ||
194 | <File | ||
195 | RelativePath=".\generated_ytab.hpp"> | ||
196 | </File> | ||
197 | <File | ||
198 | RelativePath=".\lscript_bytecode.h"> | ||
199 | </File> | ||
200 | <File | ||
201 | RelativePath=".\lscript_error.h"> | ||
202 | </File> | ||
203 | <File | ||
204 | RelativePath=".\lscript_heap.h"> | ||
205 | </File> | ||
206 | <File | ||
207 | RelativePath=".\lscript_resource.h"> | ||
208 | </File> | ||
209 | <File | ||
210 | RelativePath=".\lscript_scope.h"> | ||
211 | </File> | ||
212 | <File | ||
213 | RelativePath=".\lscript_tree.h"> | ||
214 | </File> | ||
215 | <File | ||
216 | RelativePath=".\lscript_typecheck.h"> | ||
217 | </File> | ||
218 | </Filter> | ||
219 | <Filter | ||
220 | Name="Resource Files" | ||
221 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
222 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> | ||
223 | </Filter> | ||
224 | </Files> | ||
225 | <Globals> | ||
226 | </Globals> | ||
227 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_compile/lscript_compile_fb.vcproj b/linden/indra/lscript/lscript_compile/lscript_compile_fb.vcproj deleted file mode 100755 index af823d0..0000000 --- a/linden/indra/lscript/lscript_compile/lscript_compile_fb.vcproj +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="7.10" | ||
5 | Name="lscript_compile_fb" | ||
6 | ProjectGUID="{B771CF1B-E253-47BD-8B0A-6B0440CC9228}" | ||
7 | RootNamespace="lscript_compile_fb" | ||
8 | Keyword="MakeFileProj"> | ||
9 | <Platforms> | ||
10 | <Platform | ||
11 | Name="Win32"/> | ||
12 | </Platforms> | ||
13 | <Configurations> | ||
14 | <Configuration | ||
15 | Name="Debug|Win32" | ||
16 | OutputDirectory="." | ||
17 | IntermediateDirectory="Debug_fb" | ||
18 | ConfigurationType="10"> | ||
19 | <Tool | ||
20 | Name="VCCustomBuildTool"/> | ||
21 | <Tool | ||
22 | Name="VCMIDLTool"/> | ||
23 | <Tool | ||
24 | Name="VCPostBuildEventTool"/> | ||
25 | <Tool | ||
26 | Name="VCPreBuildEventTool"/> | ||
27 | </Configuration> | ||
28 | <Configuration | ||
29 | Name="Release|Win32" | ||
30 | OutputDirectory="." | ||
31 | IntermediateDirectory="Release_fb" | ||
32 | ConfigurationType="10"> | ||
33 | <Tool | ||
34 | Name="VCCustomBuildTool"/> | ||
35 | <Tool | ||
36 | Name="VCMIDLTool"/> | ||
37 | <Tool | ||
38 | Name="VCPostBuildEventTool"/> | ||
39 | <Tool | ||
40 | Name="VCPreBuildEventTool"/> | ||
41 | </Configuration> | ||
42 | </Configurations> | ||
43 | <References> | ||
44 | </References> | ||
45 | <Files> | ||
46 | <Filter | ||
47 | Name="Source Files" | ||
48 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
49 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> | ||
50 | </Filter> | ||
51 | <Filter | ||
52 | Name="Header Files" | ||
53 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
54 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> | ||
55 | </Filter> | ||
56 | <Filter | ||
57 | Name="Resource Files" | ||
58 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
59 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> | ||
60 | </Filter> | ||
61 | <File | ||
62 | RelativePath=".\indra.l"> | ||
63 | <FileConfiguration | ||
64 | Name="Debug|Win32"> | ||
65 | <Tool | ||
66 | Name="VCCustomBuildTool" | ||
67 | Description="Building lex_yy.cpp" | ||
68 | CommandLine="flex.exe -olex_yy.cpp indra.l | ||
69 | " | ||
70 | Outputs="lex_yy.cpp"/> | ||
71 | </FileConfiguration> | ||
72 | <FileConfiguration | ||
73 | Name="Release|Win32"> | ||
74 | <Tool | ||
75 | Name="VCCustomBuildTool" | ||
76 | Description="Building lex_yy.cpp" | ||
77 | CommandLine="flex.exe -olex_yy.cpp indra.l" | ||
78 | Outputs="lex_yy.cpp"/> | ||
79 | </FileConfiguration> | ||
80 | </File> | ||
81 | <File | ||
82 | RelativePath=".\indra.y"> | ||
83 | <FileConfiguration | ||
84 | Name="Debug|Win32"> | ||
85 | <Tool | ||
86 | Name="VCCustomBuildTool" | ||
87 | Description="Building ytab.cpp" | ||
88 | CommandLine="bison.exe -y -d -v -o ytab.cpp indra.y | ||
89 | mv.exe ytab.hpp ytab.h" | ||
90 | Outputs="ytab.cpp;ytab.h"/> | ||
91 | </FileConfiguration> | ||
92 | <FileConfiguration | ||
93 | Name="Release|Win32"> | ||
94 | <Tool | ||
95 | Name="VCCustomBuildTool" | ||
96 | Description="Building ytab.cpp" | ||
97 | CommandLine="bison.exe -y -d -v -o ytab.cpp indra.y | ||
98 | mv.exe ytab.hpp ytab.h" | ||
99 | Outputs="ytab.cpp;ytab.h"/> | ||
100 | </FileConfiguration> | ||
101 | </File> | ||
102 | </Files> | ||
103 | <Globals> | ||
104 | </Globals> | ||
105 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_compile/lscript_compile_fb_vc8.vcproj b/linden/indra/lscript/lscript_compile/lscript_compile_fb_vc8.vcproj deleted file mode 100644 index 91561b9..0000000 --- a/linden/indra/lscript/lscript_compile/lscript_compile_fb_vc8.vcproj +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="8.00" | ||
5 | Name="lscript_compile_fb_vc8" | ||
6 | ProjectGUID="{B771CF1B-E253-47BD-8B0A-6B0440CC9228}" | ||
7 | RootNamespace="lscript_compile_fb" | ||
8 | Keyword="MakeFileProj" | ||
9 | > | ||
10 | <Platforms> | ||
11 | <Platform | ||
12 | Name="Win32" | ||
13 | /> | ||
14 | </Platforms> | ||
15 | <ToolFiles> | ||
16 | </ToolFiles> | ||
17 | <Configurations> | ||
18 | <Configuration | ||
19 | Name="Debug|Win32" | ||
20 | OutputDirectory="." | ||
21 | IntermediateDirectory="Debug_fb" | ||
22 | ConfigurationType="10" | ||
23 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
24 | > | ||
25 | <Tool | ||
26 | Name="VCPreBuildEventTool" | ||
27 | /> | ||
28 | <Tool | ||
29 | Name="VCCustomBuildTool" | ||
30 | /> | ||
31 | <Tool | ||
32 | Name="VCMIDLTool" | ||
33 | /> | ||
34 | <Tool | ||
35 | Name="VCPostBuildEventTool" | ||
36 | /> | ||
37 | </Configuration> | ||
38 | <Configuration | ||
39 | Name="Release|Win32" | ||
40 | OutputDirectory="." | ||
41 | IntermediateDirectory="Release_fb" | ||
42 | ConfigurationType="10" | ||
43 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
44 | > | ||
45 | <Tool | ||
46 | Name="VCPreBuildEventTool" | ||
47 | /> | ||
48 | <Tool | ||
49 | Name="VCCustomBuildTool" | ||
50 | /> | ||
51 | <Tool | ||
52 | Name="VCMIDLTool" | ||
53 | /> | ||
54 | <Tool | ||
55 | Name="VCPostBuildEventTool" | ||
56 | /> | ||
57 | </Configuration> | ||
58 | </Configurations> | ||
59 | <References> | ||
60 | </References> | ||
61 | <Files> | ||
62 | <Filter | ||
63 | Name="Source Files" | ||
64 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
65 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
66 | > | ||
67 | </Filter> | ||
68 | <Filter | ||
69 | Name="Header Files" | ||
70 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
71 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
72 | > | ||
73 | </Filter> | ||
74 | <Filter | ||
75 | Name="Resource Files" | ||
76 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
77 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
78 | > | ||
79 | </Filter> | ||
80 | <File | ||
81 | RelativePath=".\indra.l" | ||
82 | > | ||
83 | <FileConfiguration | ||
84 | Name="Debug|Win32" | ||
85 | > | ||
86 | <Tool | ||
87 | Name="VCCustomBuildTool" | ||
88 | Description="Building lex_yy.cpp" | ||
89 | CommandLine="flex.exe -olex_yy.cpp indra.l
" | ||
90 | Outputs="lex_yy.cpp" | ||
91 | /> | ||
92 | </FileConfiguration> | ||
93 | <FileConfiguration | ||
94 | Name="Release|Win32" | ||
95 | > | ||
96 | <Tool | ||
97 | Name="VCCustomBuildTool" | ||
98 | Description="Building lex_yy.cpp" | ||
99 | CommandLine="flex.exe -olex_yy.cpp indra.l
" | ||
100 | Outputs="lex_yy.cpp" | ||
101 | /> | ||
102 | </FileConfiguration> | ||
103 | </File> | ||
104 | <File | ||
105 | RelativePath=".\indra.y" | ||
106 | > | ||
107 | <FileConfiguration | ||
108 | Name="Debug|Win32" | ||
109 | > | ||
110 | <Tool | ||
111 | Name="VCCustomBuildTool" | ||
112 | Description="Building ytab.cpp" | ||
113 | CommandLine="bison.exe -y -d -v -o ytab.cpp indra.y
mv.exe ytab.hpp ytab.h
" | ||
114 | Outputs="ytab.cpp;ytab.h" | ||
115 | /> | ||
116 | </FileConfiguration> | ||
117 | <FileConfiguration | ||
118 | Name="Release|Win32" | ||
119 | > | ||
120 | <Tool | ||
121 | Name="VCCustomBuildTool" | ||
122 | Description="Building ytab.cpp" | ||
123 | CommandLine="bison.exe -y -d -v -o ytab.cpp indra.y
mv.exe ytab.hpp ytab.h
" | ||
124 | Outputs="ytab.cpp;ytab.h" | ||
125 | /> | ||
126 | </FileConfiguration> | ||
127 | </File> | ||
128 | </Files> | ||
129 | <Globals> | ||
130 | </Globals> | ||
131 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_compile/lscript_compile_fb_vc9.vcproj b/linden/indra/lscript/lscript_compile/lscript_compile_fb_vc9.vcproj deleted file mode 100644 index 62f3ada..0000000 --- a/linden/indra/lscript/lscript_compile/lscript_compile_fb_vc9.vcproj +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="9.00" | ||
5 | Name="lscript_compile_fb_vc8" | ||
6 | ProjectGUID="{B771CF1B-E253-47BD-8B0A-6B0440CC9228}" | ||
7 | RootNamespace="lscript_compile_fb" | ||
8 | Keyword="MakeFileProj" | ||
9 | TargetFrameworkVersion="131072" | ||
10 | > | ||
11 | <Platforms> | ||
12 | <Platform | ||
13 | Name="Win32" | ||
14 | /> | ||
15 | </Platforms> | ||
16 | <ToolFiles> | ||
17 | </ToolFiles> | ||
18 | <Configurations> | ||
19 | <Configuration | ||
20 | Name="Debug|Win32" | ||
21 | OutputDirectory="." | ||
22 | IntermediateDirectory="Debug_fb" | ||
23 | ConfigurationType="10" | ||
24 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
25 | > | ||
26 | <Tool | ||
27 | Name="VCPreBuildEventTool" | ||
28 | /> | ||
29 | <Tool | ||
30 | Name="VCCustomBuildTool" | ||
31 | /> | ||
32 | <Tool | ||
33 | Name="VCMIDLTool" | ||
34 | /> | ||
35 | <Tool | ||
36 | Name="VCPostBuildEventTool" | ||
37 | /> | ||
38 | </Configuration> | ||
39 | <Configuration | ||
40 | Name="Release|Win32" | ||
41 | OutputDirectory="." | ||
42 | IntermediateDirectory="Release_fb" | ||
43 | ConfigurationType="10" | ||
44 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
45 | > | ||
46 | <Tool | ||
47 | Name="VCPreBuildEventTool" | ||
48 | /> | ||
49 | <Tool | ||
50 | Name="VCCustomBuildTool" | ||
51 | /> | ||
52 | <Tool | ||
53 | Name="VCMIDLTool" | ||
54 | /> | ||
55 | <Tool | ||
56 | Name="VCPostBuildEventTool" | ||
57 | /> | ||
58 | </Configuration> | ||
59 | </Configurations> | ||
60 | <References> | ||
61 | </References> | ||
62 | <Files> | ||
63 | <Filter | ||
64 | Name="Source Files" | ||
65 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
66 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
67 | > | ||
68 | </Filter> | ||
69 | <Filter | ||
70 | Name="Header Files" | ||
71 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
72 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
73 | > | ||
74 | </Filter> | ||
75 | <Filter | ||
76 | Name="Resource Files" | ||
77 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
78 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
79 | > | ||
80 | </Filter> | ||
81 | <File | ||
82 | RelativePath=".\indra.l" | ||
83 | > | ||
84 | <FileConfiguration | ||
85 | Name="Debug|Win32" | ||
86 | > | ||
87 | <Tool | ||
88 | Name="VCCustomBuildTool" | ||
89 | Description="Building lex_yy.cpp" | ||
90 | CommandLine="flex.exe -olex_yy.cpp indra.l" | ||
91 | Outputs="lex_yy.cpp" | ||
92 | /> | ||
93 | </FileConfiguration> | ||
94 | <FileConfiguration | ||
95 | Name="Release|Win32" | ||
96 | > | ||
97 | <Tool | ||
98 | Name="VCCustomBuildTool" | ||
99 | Description="Building lex_yy.cpp" | ||
100 | CommandLine="flex.exe -olex_yy.cpp indra.l" | ||
101 | Outputs="lex_yy.cpp" | ||
102 | /> | ||
103 | </FileConfiguration> | ||
104 | </File> | ||
105 | <File | ||
106 | RelativePath=".\indra.y" | ||
107 | > | ||
108 | <FileConfiguration | ||
109 | Name="Debug|Win32" | ||
110 | > | ||
111 | <Tool | ||
112 | Name="VCCustomBuildTool" | ||
113 | Description="Building ytab.cpp" | ||
114 | CommandLine="bison.exe -y -d -v -o ytab.cpp indra.y
mv.exe ytab.hpp ytab.h
" | ||
115 | Outputs="ytab.cpp;ytab.h" | ||
116 | /> | ||
117 | </FileConfiguration> | ||
118 | <FileConfiguration | ||
119 | Name="Release|Win32" | ||
120 | > | ||
121 | <Tool | ||
122 | Name="VCCustomBuildTool" | ||
123 | Description="Building ytab.cpp" | ||
124 | CommandLine="bison.exe -y -d -v -o ytab.cpp indra.y
mv.exe ytab.hpp ytab.h
" | ||
125 | Outputs="ytab.cpp;ytab.h" | ||
126 | /> | ||
127 | </FileConfiguration> | ||
128 | </File> | ||
129 | </Files> | ||
130 | <Globals> | ||
131 | </Globals> | ||
132 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_compile/lscript_compile_ly.vcproj b/linden/indra/lscript/lscript_compile/lscript_compile_ly.vcproj deleted file mode 100644 index c324ed9..0000000 --- a/linden/indra/lscript/lscript_compile/lscript_compile_ly.vcproj +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="7.10" | ||
5 | Name="lscript_compile_ly" | ||
6 | ProjectGUID="{FF8ECB70-C788-47D4-91BF-F88448AE8940}" | ||
7 | RootNamespace="lscript_compile_ly" | ||
8 | Keyword="MakeFileProj"> | ||
9 | <Platforms> | ||
10 | <Platform | ||
11 | Name="Win32"/> | ||
12 | </Platforms> | ||
13 | <Configurations> | ||
14 | <Configuration | ||
15 | Name="Debug|Win32" | ||
16 | OutputDirectory="." | ||
17 | IntermediateDirectory="Debug_ly" | ||
18 | ConfigurationType="10"> | ||
19 | <Tool | ||
20 | Name="VCCustomBuildTool"/> | ||
21 | <Tool | ||
22 | Name="VCMIDLTool"/> | ||
23 | <Tool | ||
24 | Name="VCPostBuildEventTool"/> | ||
25 | <Tool | ||
26 | Name="VCPreBuildEventTool"/> | ||
27 | </Configuration> | ||
28 | <Configuration | ||
29 | Name="Release|Win32" | ||
30 | OutputDirectory="." | ||
31 | IntermediateDirectory="Release_ly" | ||
32 | ConfigurationType="10"> | ||
33 | <Tool | ||
34 | Name="VCCustomBuildTool"/> | ||
35 | <Tool | ||
36 | Name="VCMIDLTool"/> | ||
37 | <Tool | ||
38 | Name="VCPostBuildEventTool"/> | ||
39 | <Tool | ||
40 | Name="VCPreBuildEventTool"/> | ||
41 | </Configuration> | ||
42 | </Configurations> | ||
43 | <References> | ||
44 | </References> | ||
45 | <Files> | ||
46 | <Filter | ||
47 | Name="Source Files" | ||
48 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
49 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> | ||
50 | </Filter> | ||
51 | <Filter | ||
52 | Name="Header Files" | ||
53 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
54 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> | ||
55 | </Filter> | ||
56 | <Filter | ||
57 | Name="Resource Files" | ||
58 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
59 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> | ||
60 | </Filter> | ||
61 | <File | ||
62 | RelativePath=".\indra.l"> | ||
63 | <FileConfiguration | ||
64 | Name="Debug|Win32"> | ||
65 | <Tool | ||
66 | Name="VCCustomBuildTool" | ||
67 | Description="Building lex_yy.cpp" | ||
68 | CommandLine="set ROOTDIR=..\..\..\libraries\i686-win32\mks | ||
69 | ..\..\..\libraries\i686-win32\mks\lex.exe -o lex_yy.cpp indra.l | ||
70 | " | ||
71 | Outputs="lex_yy.cpp"/> | ||
72 | </FileConfiguration> | ||
73 | <FileConfiguration | ||
74 | Name="Release|Win32"> | ||
75 | <Tool | ||
76 | Name="VCCustomBuildTool" | ||
77 | Description="Building lex_yy.cpp" | ||
78 | CommandLine="set ROOTDIR=..\..\..\libraries\i686-win32\mks | ||
79 | ..\..\..\libraries\i686-win32\mks\lex.exe -o lex_yy.cpp indra.l | ||
80 | " | ||
81 | Outputs="lex_yy.cpp"/> | ||
82 | </FileConfiguration> | ||
83 | </File> | ||
84 | <File | ||
85 | RelativePath=".\indra.y"> | ||
86 | <FileConfiguration | ||
87 | Name="Debug|Win32"> | ||
88 | <Tool | ||
89 | Name="VCCustomBuildTool" | ||
90 | Description="Building ytab.cpp" | ||
91 | CommandLine="set ROOTDIR=..\..\..\libraries\i686-win32\mks | ||
92 | ..\..\..\libraries\i686-win32\mks\yacc.exe -o ytab.cpp -v -d indra.y | ||
93 | " | ||
94 | Outputs="ytab.cpp;ytab.h"/> | ||
95 | </FileConfiguration> | ||
96 | <FileConfiguration | ||
97 | Name="Release|Win32"> | ||
98 | <Tool | ||
99 | Name="VCCustomBuildTool" | ||
100 | Description="Building ytab.cpp" | ||
101 | CommandLine="set ROOTDIR=..\..\..\libraries\i686-win32\mks | ||
102 | ..\..\..\libraries\i686-win32\mks\yacc.exe -o ytab.cpp -v -d indra.y | ||
103 | " | ||
104 | Outputs="ytab.cpp;ytab.h"/> | ||
105 | </FileConfiguration> | ||
106 | </File> | ||
107 | </Files> | ||
108 | <Globals> | ||
109 | </Globals> | ||
110 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_compile/lscript_compile_ly_vc8.vcproj b/linden/indra/lscript/lscript_compile/lscript_compile_ly_vc8.vcproj deleted file mode 100644 index f55385e..0000000 --- a/linden/indra/lscript/lscript_compile/lscript_compile_ly_vc8.vcproj +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="8.00" | ||
5 | Name="lscript_compile_ly" | ||
6 | ProjectGUID="{FF8ECB70-C788-47D4-91BF-F88448AE8940}" | ||
7 | RootNamespace="lscript_compile_ly" | ||
8 | Keyword="MakeFileProj" | ||
9 | > | ||
10 | <Platforms> | ||
11 | <Platform | ||
12 | Name="Win32" | ||
13 | /> | ||
14 | </Platforms> | ||
15 | <ToolFiles> | ||
16 | </ToolFiles> | ||
17 | <Configurations> | ||
18 | <Configuration | ||
19 | Name="Debug|Win32" | ||
20 | OutputDirectory="." | ||
21 | IntermediateDirectory="Debug_ly" | ||
22 | ConfigurationType="10" | ||
23 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
24 | > | ||
25 | <Tool | ||
26 | Name="VCPreBuildEventTool" | ||
27 | /> | ||
28 | <Tool | ||
29 | Name="VCCustomBuildTool" | ||
30 | /> | ||
31 | <Tool | ||
32 | Name="VCMIDLTool" | ||
33 | /> | ||
34 | <Tool | ||
35 | Name="VCPostBuildEventTool" | ||
36 | /> | ||
37 | </Configuration> | ||
38 | <Configuration | ||
39 | Name="Release|Win32" | ||
40 | OutputDirectory="." | ||
41 | IntermediateDirectory="Release_ly" | ||
42 | ConfigurationType="10" | ||
43 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
44 | > | ||
45 | <Tool | ||
46 | Name="VCPreBuildEventTool" | ||
47 | /> | ||
48 | <Tool | ||
49 | Name="VCCustomBuildTool" | ||
50 | /> | ||
51 | <Tool | ||
52 | Name="VCMIDLTool" | ||
53 | /> | ||
54 | <Tool | ||
55 | Name="VCPostBuildEventTool" | ||
56 | /> | ||
57 | </Configuration> | ||
58 | </Configurations> | ||
59 | <References> | ||
60 | </References> | ||
61 | <Files> | ||
62 | <Filter | ||
63 | Name="Source Files" | ||
64 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
65 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
66 | > | ||
67 | </Filter> | ||
68 | <Filter | ||
69 | Name="Header Files" | ||
70 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
71 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
72 | > | ||
73 | </Filter> | ||
74 | <Filter | ||
75 | Name="Resource Files" | ||
76 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
77 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
78 | > | ||
79 | </Filter> | ||
80 | <File | ||
81 | RelativePath=".\indra.l" | ||
82 | > | ||
83 | <FileConfiguration | ||
84 | Name="Debug|Win32" | ||
85 | > | ||
86 | <Tool | ||
87 | Name="VCCustomBuildTool" | ||
88 | Description="Building lex_yy.cpp" | ||
89 | CommandLine="set ROOTDIR=..\..\..\libraries\i686-win32\mks
..\..\..\libraries\i686-win32\mks\lex.exe -o lex_yy.cpp indra.l
" | ||
90 | Outputs="lex_yy.cpp" | ||
91 | /> | ||
92 | </FileConfiguration> | ||
93 | <FileConfiguration | ||
94 | Name="Release|Win32" | ||
95 | > | ||
96 | <Tool | ||
97 | Name="VCCustomBuildTool" | ||
98 | Description="Building lex_yy.cpp" | ||
99 | CommandLine="set ROOTDIR=..\..\..\libraries\i686-win32\mks
..\..\..\libraries\i686-win32\mks\lex.exe -o lex_yy.cpp indra.l
" | ||
100 | Outputs="lex_yy.cpp" | ||
101 | /> | ||
102 | </FileConfiguration> | ||
103 | </File> | ||
104 | <File | ||
105 | RelativePath=".\indra.y" | ||
106 | > | ||
107 | <FileConfiguration | ||
108 | Name="Debug|Win32" | ||
109 | > | ||
110 | <Tool | ||
111 | Name="VCCustomBuildTool" | ||
112 | Description="Building ytab.cpp" | ||
113 | CommandLine="set ROOTDIR=..\..\..\libraries\i686-win32\mks
..\..\..\libraries\i686-win32\mks\yacc.exe -o ytab.cpp -v -d indra.y
" | ||
114 | Outputs="ytab.cpp;ytab.h" | ||
115 | /> | ||
116 | </FileConfiguration> | ||
117 | <FileConfiguration | ||
118 | Name="Release|Win32" | ||
119 | > | ||
120 | <Tool | ||
121 | Name="VCCustomBuildTool" | ||
122 | Description="Building ytab.cpp" | ||
123 | CommandLine="set ROOTDIR=..\..\..\libraries\i686-win32\mks
..\..\..\libraries\i686-win32\mks\yacc.exe -o ytab.cpp -v -d indra.y
" | ||
124 | Outputs="ytab.cpp;ytab.h" | ||
125 | /> | ||
126 | </FileConfiguration> | ||
127 | </File> | ||
128 | </Files> | ||
129 | <Globals> | ||
130 | </Globals> | ||
131 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_compile/lscript_compile_vc8.vcproj b/linden/indra/lscript/lscript_compile/lscript_compile_vc8.vcproj deleted file mode 100644 index 9972c52..0000000 --- a/linden/indra/lscript/lscript_compile/lscript_compile_vc8.vcproj +++ /dev/null | |||
@@ -1,331 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="8.00" | ||
5 | Name="lscript_compile" | ||
6 | ProjectGUID="{44CE6D82-7320-4609-8FC3-5965C19F4808}" | ||
7 | RootNamespace="lscript_compile" | ||
8 | Keyword="Win32Proj" | ||
9 | > | ||
10 | <Platforms> | ||
11 | <Platform | ||
12 | Name="Win32" | ||
13 | /> | ||
14 | </Platforms> | ||
15 | <ToolFiles> | ||
16 | </ToolFiles> | ||
17 | <Configurations> | ||
18 | <Configuration | ||
19 | Name="Debug|Win32" | ||
20 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
21 | IntermediateDirectory="Debug" | ||
22 | ConfigurationType="4" | ||
23 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
24 | CharacterSet="1" | ||
25 | > | ||
26 | <Tool | ||
27 | Name="VCPreBuildEventTool" | ||
28 | /> | ||
29 | <Tool | ||
30 | Name="VCCustomBuildTool" | ||
31 | /> | ||
32 | <Tool | ||
33 | Name="VCXMLDataGeneratorTool" | ||
34 | /> | ||
35 | <Tool | ||
36 | Name="VCWebServiceProxyGeneratorTool" | ||
37 | /> | ||
38 | <Tool | ||
39 | Name="VCMIDLTool" | ||
40 | /> | ||
41 | <Tool | ||
42 | Name="VCCLCompilerTool" | ||
43 | Optimization="0" | ||
44 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
45 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG;YY_NO_UNISTD_H" | ||
46 | MinimalRebuild="true" | ||
47 | BasicRuntimeChecks="3" | ||
48 | RuntimeLibrary="1" | ||
49 | StructMemberAlignment="0" | ||
50 | TreatWChar_tAsBuiltInType="false" | ||
51 | ForceConformanceInForLoopScope="true" | ||
52 | UsePrecompiledHeader="0" | ||
53 | WarningLevel="3" | ||
54 | WarnAsError="true" | ||
55 | Detect64BitPortabilityProblems="false" | ||
56 | DebugInformationFormat="4" | ||
57 | /> | ||
58 | <Tool | ||
59 | Name="VCManagedResourceCompilerTool" | ||
60 | /> | ||
61 | <Tool | ||
62 | Name="VCResourceCompilerTool" | ||
63 | /> | ||
64 | <Tool | ||
65 | Name="VCPreLinkEventTool" | ||
66 | /> | ||
67 | <Tool | ||
68 | Name="VCLibrarianTool" | ||
69 | OutputFile="$(OutDir)/lscript_compile.lib" | ||
70 | /> | ||
71 | <Tool | ||
72 | Name="VCALinkTool" | ||
73 | /> | ||
74 | <Tool | ||
75 | Name="VCXDCMakeTool" | ||
76 | /> | ||
77 | <Tool | ||
78 | Name="VCBscMakeTool" | ||
79 | /> | ||
80 | <Tool | ||
81 | Name="VCFxCopTool" | ||
82 | /> | ||
83 | <Tool | ||
84 | Name="VCPostBuildEventTool" | ||
85 | /> | ||
86 | </Configuration> | ||
87 | <Configuration | ||
88 | Name="Release|Win32" | ||
89 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
90 | IntermediateDirectory="Release" | ||
91 | ConfigurationType="4" | ||
92 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
93 | CharacterSet="1" | ||
94 | > | ||
95 | <Tool | ||
96 | Name="VCPreBuildEventTool" | ||
97 | /> | ||
98 | <Tool | ||
99 | Name="VCCustomBuildTool" | ||
100 | /> | ||
101 | <Tool | ||
102 | Name="VCXMLDataGeneratorTool" | ||
103 | /> | ||
104 | <Tool | ||
105 | Name="VCWebServiceProxyGeneratorTool" | ||
106 | /> | ||
107 | <Tool | ||
108 | Name="VCMIDLTool" | ||
109 | /> | ||
110 | <Tool | ||
111 | Name="VCCLCompilerTool" | ||
112 | AdditionalOptions="/Oy-" | ||
113 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
114 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE;YY_NO_UNISTD_H" | ||
115 | RuntimeLibrary="0" | ||
116 | StructMemberAlignment="0" | ||
117 | TreatWChar_tAsBuiltInType="false" | ||
118 | ForceConformanceInForLoopScope="true" | ||
119 | UsePrecompiledHeader="0" | ||
120 | WarningLevel="3" | ||
121 | WarnAsError="true" | ||
122 | Detect64BitPortabilityProblems="false" | ||
123 | DebugInformationFormat="3" | ||
124 | /> | ||
125 | <Tool | ||
126 | Name="VCManagedResourceCompilerTool" | ||
127 | /> | ||
128 | <Tool | ||
129 | Name="VCResourceCompilerTool" | ||
130 | /> | ||
131 | <Tool | ||
132 | Name="VCPreLinkEventTool" | ||
133 | /> | ||
134 | <Tool | ||
135 | Name="VCLibrarianTool" | ||
136 | OutputFile="$(OutDir)/lscript_compile.lib" | ||
137 | /> | ||
138 | <Tool | ||
139 | Name="VCALinkTool" | ||
140 | /> | ||
141 | <Tool | ||
142 | Name="VCXDCMakeTool" | ||
143 | /> | ||
144 | <Tool | ||
145 | Name="VCBscMakeTool" | ||
146 | /> | ||
147 | <Tool | ||
148 | Name="VCFxCopTool" | ||
149 | /> | ||
150 | <Tool | ||
151 | Name="VCPostBuildEventTool" | ||
152 | /> | ||
153 | </Configuration> | ||
154 | <Configuration | ||
155 | Name="ReleaseNoOpt|Win32" | ||
156 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
157 | IntermediateDirectory="$(ConfigurationName)" | ||
158 | ConfigurationType="4" | ||
159 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
160 | CharacterSet="1" | ||
161 | > | ||
162 | <Tool | ||
163 | Name="VCPreBuildEventTool" | ||
164 | /> | ||
165 | <Tool | ||
166 | Name="VCCustomBuildTool" | ||
167 | /> | ||
168 | <Tool | ||
169 | Name="VCXMLDataGeneratorTool" | ||
170 | /> | ||
171 | <Tool | ||
172 | Name="VCWebServiceProxyGeneratorTool" | ||
173 | /> | ||
174 | <Tool | ||
175 | Name="VCMIDLTool" | ||
176 | /> | ||
177 | <Tool | ||
178 | Name="VCCLCompilerTool" | ||
179 | AdditionalOptions="/Oy-" | ||
180 | Optimization="0" | ||
181 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
182 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE;YY_NO_UNISTD_H" | ||
183 | RuntimeLibrary="0" | ||
184 | StructMemberAlignment="0" | ||
185 | TreatWChar_tAsBuiltInType="false" | ||
186 | ForceConformanceInForLoopScope="true" | ||
187 | UsePrecompiledHeader="0" | ||
188 | WarningLevel="3" | ||
189 | WarnAsError="true" | ||
190 | Detect64BitPortabilityProblems="false" | ||
191 | DebugInformationFormat="3" | ||
192 | /> | ||
193 | <Tool | ||
194 | Name="VCManagedResourceCompilerTool" | ||
195 | /> | ||
196 | <Tool | ||
197 | Name="VCResourceCompilerTool" | ||
198 | /> | ||
199 | <Tool | ||
200 | Name="VCPreLinkEventTool" | ||
201 | /> | ||
202 | <Tool | ||
203 | Name="VCLibrarianTool" | ||
204 | OutputFile="$(OutDir)/lscript_compile.lib" | ||
205 | /> | ||
206 | <Tool | ||
207 | Name="VCALinkTool" | ||
208 | /> | ||
209 | <Tool | ||
210 | Name="VCXDCMakeTool" | ||
211 | /> | ||
212 | <Tool | ||
213 | Name="VCBscMakeTool" | ||
214 | /> | ||
215 | <Tool | ||
216 | Name="VCFxCopTool" | ||
217 | /> | ||
218 | <Tool | ||
219 | Name="VCPostBuildEventTool" | ||
220 | /> | ||
221 | </Configuration> | ||
222 | </Configurations> | ||
223 | <References> | ||
224 | </References> | ||
225 | <Files> | ||
226 | <Filter | ||
227 | Name="Source Files" | ||
228 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
229 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
230 | > | ||
231 | <File | ||
232 | RelativePath=".\lex_yy.cpp" | ||
233 | > | ||
234 | </File> | ||
235 | <File | ||
236 | RelativePath=".\lscript_alloc.cpp" | ||
237 | > | ||
238 | </File> | ||
239 | <File | ||
240 | RelativePath=".\lscript_bytecode.cpp" | ||
241 | > | ||
242 | </File> | ||
243 | <File | ||
244 | RelativePath=".\lscript_error.cpp" | ||
245 | > | ||
246 | </File> | ||
247 | <File | ||
248 | RelativePath=".\lscript_heap.cpp" | ||
249 | > | ||
250 | </File> | ||
251 | <File | ||
252 | RelativePath=".\lscript_resource.cpp" | ||
253 | > | ||
254 | </File> | ||
255 | <File | ||
256 | RelativePath=".\lscript_scope.cpp" | ||
257 | > | ||
258 | </File> | ||
259 | <File | ||
260 | RelativePath=".\lscript_tree.cpp" | ||
261 | > | ||
262 | </File> | ||
263 | <File | ||
264 | RelativePath=".\lscript_typecheck.cpp" | ||
265 | > | ||
266 | </File> | ||
267 | <File | ||
268 | RelativePath=".\ytab.cpp" | ||
269 | > | ||
270 | <FileConfiguration | ||
271 | Name="Release|Win32" | ||
272 | > | ||
273 | <Tool | ||
274 | Name="VCCLCompilerTool" | ||
275 | CompileAs="2" | ||
276 | /> | ||
277 | </FileConfiguration> | ||
278 | </File> | ||
279 | </Filter> | ||
280 | <Filter | ||
281 | Name="Header Files" | ||
282 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
283 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
284 | > | ||
285 | <File | ||
286 | RelativePath=".\generated_lex_yy.hpp" | ||
287 | > | ||
288 | </File> | ||
289 | <File | ||
290 | RelativePath=".\generated_ytab.hpp" | ||
291 | > | ||
292 | </File> | ||
293 | <File | ||
294 | RelativePath=".\lscript_bytecode.h" | ||
295 | > | ||
296 | </File> | ||
297 | <File | ||
298 | RelativePath=".\lscript_error.h" | ||
299 | > | ||
300 | </File> | ||
301 | <File | ||
302 | RelativePath=".\lscript_heap.h" | ||
303 | > | ||
304 | </File> | ||
305 | <File | ||
306 | RelativePath=".\lscript_resource.h" | ||
307 | > | ||
308 | </File> | ||
309 | <File | ||
310 | RelativePath=".\lscript_scope.h" | ||
311 | > | ||
312 | </File> | ||
313 | <File | ||
314 | RelativePath=".\lscript_tree.h" | ||
315 | > | ||
316 | </File> | ||
317 | <File | ||
318 | RelativePath=".\lscript_typecheck.h" | ||
319 | > | ||
320 | </File> | ||
321 | </Filter> | ||
322 | <Filter | ||
323 | Name="Resource Files" | ||
324 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
325 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
326 | > | ||
327 | </Filter> | ||
328 | </Files> | ||
329 | <Globals> | ||
330 | </Globals> | ||
331 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_compile/lscript_compile_vc9.vcproj b/linden/indra/lscript/lscript_compile/lscript_compile_vc9.vcproj deleted file mode 100644 index 6167895..0000000 --- a/linden/indra/lscript/lscript_compile/lscript_compile_vc9.vcproj +++ /dev/null | |||
@@ -1,332 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="9.00" | ||
5 | Name="lscript_compile" | ||
6 | ProjectGUID="{44CE6D82-7320-4609-8FC3-5965C19F4808}" | ||
7 | RootNamespace="lscript_compile" | ||
8 | Keyword="Win32Proj" | ||
9 | TargetFrameworkVersion="131072" | ||
10 | > | ||
11 | <Platforms> | ||
12 | <Platform | ||
13 | Name="Win32" | ||
14 | /> | ||
15 | </Platforms> | ||
16 | <ToolFiles> | ||
17 | </ToolFiles> | ||
18 | <Configurations> | ||
19 | <Configuration | ||
20 | Name="Debug|Win32" | ||
21 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
22 | IntermediateDirectory="Debug" | ||
23 | ConfigurationType="4" | ||
24 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
25 | CharacterSet="1" | ||
26 | > | ||
27 | <Tool | ||
28 | Name="VCPreBuildEventTool" | ||
29 | /> | ||
30 | <Tool | ||
31 | Name="VCCustomBuildTool" | ||
32 | /> | ||
33 | <Tool | ||
34 | Name="VCXMLDataGeneratorTool" | ||
35 | /> | ||
36 | <Tool | ||
37 | Name="VCWebServiceProxyGeneratorTool" | ||
38 | /> | ||
39 | <Tool | ||
40 | Name="VCMIDLTool" | ||
41 | /> | ||
42 | <Tool | ||
43 | Name="VCCLCompilerTool" | ||
44 | Optimization="0" | ||
45 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
46 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG;YY_NO_UNISTD_H" | ||
47 | MinimalRebuild="true" | ||
48 | BasicRuntimeChecks="3" | ||
49 | RuntimeLibrary="1" | ||
50 | StructMemberAlignment="0" | ||
51 | TreatWChar_tAsBuiltInType="false" | ||
52 | ForceConformanceInForLoopScope="true" | ||
53 | UsePrecompiledHeader="0" | ||
54 | WarningLevel="3" | ||
55 | WarnAsError="true" | ||
56 | Detect64BitPortabilityProblems="false" | ||
57 | DebugInformationFormat="4" | ||
58 | /> | ||
59 | <Tool | ||
60 | Name="VCManagedResourceCompilerTool" | ||
61 | /> | ||
62 | <Tool | ||
63 | Name="VCResourceCompilerTool" | ||
64 | /> | ||
65 | <Tool | ||
66 | Name="VCPreLinkEventTool" | ||
67 | /> | ||
68 | <Tool | ||
69 | Name="VCLibrarianTool" | ||
70 | OutputFile="$(OutDir)/lscript_compile.lib" | ||
71 | /> | ||
72 | <Tool | ||
73 | Name="VCALinkTool" | ||
74 | /> | ||
75 | <Tool | ||
76 | Name="VCXDCMakeTool" | ||
77 | /> | ||
78 | <Tool | ||
79 | Name="VCBscMakeTool" | ||
80 | /> | ||
81 | <Tool | ||
82 | Name="VCFxCopTool" | ||
83 | /> | ||
84 | <Tool | ||
85 | Name="VCPostBuildEventTool" | ||
86 | /> | ||
87 | </Configuration> | ||
88 | <Configuration | ||
89 | Name="Release|Win32" | ||
90 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
91 | IntermediateDirectory="Release" | ||
92 | ConfigurationType="4" | ||
93 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
94 | CharacterSet="1" | ||
95 | > | ||
96 | <Tool | ||
97 | Name="VCPreBuildEventTool" | ||
98 | /> | ||
99 | <Tool | ||
100 | Name="VCCustomBuildTool" | ||
101 | /> | ||
102 | <Tool | ||
103 | Name="VCXMLDataGeneratorTool" | ||
104 | /> | ||
105 | <Tool | ||
106 | Name="VCWebServiceProxyGeneratorTool" | ||
107 | /> | ||
108 | <Tool | ||
109 | Name="VCMIDLTool" | ||
110 | /> | ||
111 | <Tool | ||
112 | Name="VCCLCompilerTool" | ||
113 | AdditionalOptions="/Oy-" | ||
114 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
115 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE;YY_NO_UNISTD_H" | ||
116 | RuntimeLibrary="0" | ||
117 | StructMemberAlignment="0" | ||
118 | TreatWChar_tAsBuiltInType="false" | ||
119 | ForceConformanceInForLoopScope="true" | ||
120 | UsePrecompiledHeader="0" | ||
121 | WarningLevel="3" | ||
122 | WarnAsError="true" | ||
123 | Detect64BitPortabilityProblems="false" | ||
124 | DebugInformationFormat="3" | ||
125 | /> | ||
126 | <Tool | ||
127 | Name="VCManagedResourceCompilerTool" | ||
128 | /> | ||
129 | <Tool | ||
130 | Name="VCResourceCompilerTool" | ||
131 | /> | ||
132 | <Tool | ||
133 | Name="VCPreLinkEventTool" | ||
134 | /> | ||
135 | <Tool | ||
136 | Name="VCLibrarianTool" | ||
137 | OutputFile="$(OutDir)/lscript_compile.lib" | ||
138 | /> | ||
139 | <Tool | ||
140 | Name="VCALinkTool" | ||
141 | /> | ||
142 | <Tool | ||
143 | Name="VCXDCMakeTool" | ||
144 | /> | ||
145 | <Tool | ||
146 | Name="VCBscMakeTool" | ||
147 | /> | ||
148 | <Tool | ||
149 | Name="VCFxCopTool" | ||
150 | /> | ||
151 | <Tool | ||
152 | Name="VCPostBuildEventTool" | ||
153 | /> | ||
154 | </Configuration> | ||
155 | <Configuration | ||
156 | Name="ReleaseNoOpt|Win32" | ||
157 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
158 | IntermediateDirectory="$(ConfigurationName)" | ||
159 | ConfigurationType="4" | ||
160 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
161 | CharacterSet="1" | ||
162 | > | ||
163 | <Tool | ||
164 | Name="VCPreBuildEventTool" | ||
165 | /> | ||
166 | <Tool | ||
167 | Name="VCCustomBuildTool" | ||
168 | /> | ||
169 | <Tool | ||
170 | Name="VCXMLDataGeneratorTool" | ||
171 | /> | ||
172 | <Tool | ||
173 | Name="VCWebServiceProxyGeneratorTool" | ||
174 | /> | ||
175 | <Tool | ||
176 | Name="VCMIDLTool" | ||
177 | /> | ||
178 | <Tool | ||
179 | Name="VCCLCompilerTool" | ||
180 | AdditionalOptions="/Oy-" | ||
181 | Optimization="0" | ||
182 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;..\..\llvfs;..\..\llmessage;..\..\llinventory;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
183 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE;YY_NO_UNISTD_H" | ||
184 | RuntimeLibrary="0" | ||
185 | StructMemberAlignment="0" | ||
186 | TreatWChar_tAsBuiltInType="false" | ||
187 | ForceConformanceInForLoopScope="true" | ||
188 | UsePrecompiledHeader="0" | ||
189 | WarningLevel="3" | ||
190 | WarnAsError="true" | ||
191 | Detect64BitPortabilityProblems="false" | ||
192 | DebugInformationFormat="3" | ||
193 | /> | ||
194 | <Tool | ||
195 | Name="VCManagedResourceCompilerTool" | ||
196 | /> | ||
197 | <Tool | ||
198 | Name="VCResourceCompilerTool" | ||
199 | /> | ||
200 | <Tool | ||
201 | Name="VCPreLinkEventTool" | ||
202 | /> | ||
203 | <Tool | ||
204 | Name="VCLibrarianTool" | ||
205 | OutputFile="$(OutDir)/lscript_compile.lib" | ||
206 | /> | ||
207 | <Tool | ||
208 | Name="VCALinkTool" | ||
209 | /> | ||
210 | <Tool | ||
211 | Name="VCXDCMakeTool" | ||
212 | /> | ||
213 | <Tool | ||
214 | Name="VCBscMakeTool" | ||
215 | /> | ||
216 | <Tool | ||
217 | Name="VCFxCopTool" | ||
218 | /> | ||
219 | <Tool | ||
220 | Name="VCPostBuildEventTool" | ||
221 | /> | ||
222 | </Configuration> | ||
223 | </Configurations> | ||
224 | <References> | ||
225 | </References> | ||
226 | <Files> | ||
227 | <Filter | ||
228 | Name="Source Files" | ||
229 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
230 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
231 | > | ||
232 | <File | ||
233 | RelativePath=".\lex_yy.cpp" | ||
234 | > | ||
235 | </File> | ||
236 | <File | ||
237 | RelativePath=".\lscript_alloc.cpp" | ||
238 | > | ||
239 | </File> | ||
240 | <File | ||
241 | RelativePath=".\lscript_bytecode.cpp" | ||
242 | > | ||
243 | </File> | ||
244 | <File | ||
245 | RelativePath=".\lscript_error.cpp" | ||
246 | > | ||
247 | </File> | ||
248 | <File | ||
249 | RelativePath=".\lscript_heap.cpp" | ||
250 | > | ||
251 | </File> | ||
252 | <File | ||
253 | RelativePath=".\lscript_resource.cpp" | ||
254 | > | ||
255 | </File> | ||
256 | <File | ||
257 | RelativePath=".\lscript_scope.cpp" | ||
258 | > | ||
259 | </File> | ||
260 | <File | ||
261 | RelativePath=".\lscript_tree.cpp" | ||
262 | > | ||
263 | </File> | ||
264 | <File | ||
265 | RelativePath=".\lscript_typecheck.cpp" | ||
266 | > | ||
267 | </File> | ||
268 | <File | ||
269 | RelativePath=".\ytab.cpp" | ||
270 | > | ||
271 | <FileConfiguration | ||
272 | Name="Release|Win32" | ||
273 | > | ||
274 | <Tool | ||
275 | Name="VCCLCompilerTool" | ||
276 | CompileAs="2" | ||
277 | /> | ||
278 | </FileConfiguration> | ||
279 | </File> | ||
280 | </Filter> | ||
281 | <Filter | ||
282 | Name="Header Files" | ||
283 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
284 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
285 | > | ||
286 | <File | ||
287 | RelativePath=".\generated_lex_yy.hpp" | ||
288 | > | ||
289 | </File> | ||
290 | <File | ||
291 | RelativePath=".\generated_ytab.hpp" | ||
292 | > | ||
293 | </File> | ||
294 | <File | ||
295 | RelativePath=".\lscript_bytecode.h" | ||
296 | > | ||
297 | </File> | ||
298 | <File | ||
299 | RelativePath=".\lscript_error.h" | ||
300 | > | ||
301 | </File> | ||
302 | <File | ||
303 | RelativePath=".\lscript_heap.h" | ||
304 | > | ||
305 | </File> | ||
306 | <File | ||
307 | RelativePath=".\lscript_resource.h" | ||
308 | > | ||
309 | </File> | ||
310 | <File | ||
311 | RelativePath=".\lscript_scope.h" | ||
312 | > | ||
313 | </File> | ||
314 | <File | ||
315 | RelativePath=".\lscript_tree.h" | ||
316 | > | ||
317 | </File> | ||
318 | <File | ||
319 | RelativePath=".\lscript_typecheck.h" | ||
320 | > | ||
321 | </File> | ||
322 | </Filter> | ||
323 | <Filter | ||
324 | Name="Resource Files" | ||
325 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
326 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
327 | > | ||
328 | </Filter> | ||
329 | </Files> | ||
330 | <Globals> | ||
331 | </Globals> | ||
332 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_compile/lscript_error.cpp b/linden/indra/lscript/lscript_compile/lscript_error.cpp index b3c1ffa..3b92bca 100644 --- a/linden/indra/lscript/lscript_compile/lscript_error.cpp +++ b/linden/indra/lscript/lscript_compile/lscript_error.cpp | |||
@@ -49,13 +49,13 @@ void LLScriptFilePosition::fdotabs(LLFILE *fp, S32 tabs, S32 tabsize) | |||
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | char* gWarningText[LSWARN_EOF] = /*Flawfinder: ignore*/ | 52 | const char* gWarningText[LSWARN_EOF] = /*Flawfinder: ignore*/ |
53 | { | 53 | { |
54 | "INVALID", | 54 | "INVALID", |
55 | "Dead code found beyond return statement" | 55 | "Dead code found beyond return statement" |
56 | }; | 56 | }; |
57 | 57 | ||
58 | char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/ | 58 | const char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/ |
59 | { | 59 | { |
60 | "INVALID", | 60 | "INVALID", |
61 | "Syntax error", | 61 | "Syntax error", |
@@ -72,7 +72,10 @@ char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/ | |||
72 | "Use of vector or quaternion method on incorrect type", | 72 | "Use of vector or quaternion method on incorrect type", |
73 | "Lists can't be included in lists", | 73 | "Lists can't be included in lists", |
74 | "Unitialized variables can't be included in lists", | 74 | "Unitialized variables can't be included in lists", |
75 | "Declaration requires a new scope -- use { and }" | 75 | "Declaration requires a new scope -- use { and }", |
76 | "CIL assembler failed", | ||
77 | "Bytecode transformer failed", | ||
78 | "Bytecode verification failed" | ||
76 | }; | 79 | }; |
77 | 80 | ||
78 | void LLScriptGenerateErrorText::writeWarning(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning) | 81 | void LLScriptGenerateErrorText::writeWarning(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning) |
@@ -98,3 +101,8 @@ void LLScriptGenerateErrorText::writeError(LLFILE *fp, S32 line, S32 col, LSCRIP | |||
98 | fprintf(fp, "(%d, %d) : ERROR : %s\n", line, col, gErrorText[error]); | 101 | fprintf(fp, "(%d, %d) : ERROR : %s\n", line, col, gErrorText[error]); |
99 | mTotalErrors++; | 102 | mTotalErrors++; |
100 | } | 103 | } |
104 | |||
105 | std::string getLScriptErrorString(LSCRIPTErrors error) | ||
106 | { | ||
107 | return gErrorText[error]; | ||
108 | } | ||
diff --git a/linden/indra/lscript/lscript_compile/lscript_error.h b/linden/indra/lscript/lscript_compile/lscript_error.h index b5fcadb..5ae8582 100644 --- a/linden/indra/lscript/lscript_compile/lscript_error.h +++ b/linden/indra/lscript/lscript_compile/lscript_error.h | |||
@@ -124,6 +124,9 @@ typedef enum e_lscript_errors | |||
124 | LSERROR_NO_LISTS_IN_LISTS, | 124 | LSERROR_NO_LISTS_IN_LISTS, |
125 | LSERROR_NO_UNITIALIZED_VARIABLES_IN_LISTS, | 125 | LSERROR_NO_UNITIALIZED_VARIABLES_IN_LISTS, |
126 | LSERROR_NEED_NEW_SCOPE, | 126 | LSERROR_NEED_NEW_SCOPE, |
127 | LSERROR_CIL_ASSEMBLER_FAILED = 16, // Mono build error. | ||
128 | LSERROR_BYTECODE_TRANSFORM_FAILED = 17, // Mono build error. | ||
129 | LSERROR_BYTECODE_VERIFICATION_FAILED, // Mono build error. | ||
127 | LSERROR_EOF | 130 | LSERROR_EOF |
128 | } LSCRIPTErrors; | 131 | } LSCRIPTErrors; |
129 | 132 | ||
@@ -147,6 +150,8 @@ public: | |||
147 | S32 mTotalWarnings; | 150 | S32 mTotalWarnings; |
148 | }; | 151 | }; |
149 | 152 | ||
153 | std::string getLScriptErrorString(LSCRIPTErrors error); | ||
154 | |||
150 | extern LLScriptGenerateErrorText gErrorToText; | 155 | extern LLScriptGenerateErrorText gErrorToText; |
151 | 156 | ||
152 | #endif | 157 | #endif |
diff --git a/linden/indra/lscript/lscript_compile/lscript_scope.h b/linden/indra/lscript/lscript_compile/lscript_scope.h index 8174566..a9c1c45 100644 --- a/linden/indra/lscript/lscript_compile/lscript_scope.h +++ b/linden/indra/lscript/lscript_compile/lscript_scope.h | |||
@@ -277,14 +277,14 @@ public: | |||
277 | class LLScriptScopeEntry | 277 | class LLScriptScopeEntry |
278 | { | 278 | { |
279 | public: | 279 | public: |
280 | LLScriptScopeEntry(char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type, S32 count = 0) | 280 | LLScriptScopeEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type, S32 count = 0) |
281 | : mIdentifier(identifier), mIDType(idtype), mType(type), mOffset(0), mSize(0), mAssignable(NULL), mCount(count), mLibraryNumber(0) | 281 | : mIdentifier(identifier), mIDType(idtype), mType(type), mOffset(0), mSize(0), mAssignable(NULL), mCount(count), mLibraryNumber(0) |
282 | { | 282 | { |
283 | } | 283 | } |
284 | 284 | ||
285 | ~LLScriptScopeEntry() {} | 285 | ~LLScriptScopeEntry() {} |
286 | 286 | ||
287 | char *mIdentifier; | 287 | const char *mIdentifier; |
288 | LSCRIPTIdentifierType mIDType; | 288 | LSCRIPTIdentifierType mIDType; |
289 | LSCRIPTType mType; | 289 | LSCRIPTType mType; |
290 | S32 mOffset; | 290 | S32 mOffset; |
@@ -309,9 +309,9 @@ public: | |||
309 | mEntryMap.deleteAllData(); | 309 | mEntryMap.deleteAllData(); |
310 | } | 310 | } |
311 | 311 | ||
312 | LLScriptScopeEntry *addEntry(char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type) | 312 | LLScriptScopeEntry *addEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type) |
313 | { | 313 | { |
314 | char *name = mSTable->addString(identifier); | 314 | const char *name = mSTable->addString(identifier); |
315 | if (!mEntryMap.checkData(name)) | 315 | if (!mEntryMap.checkData(name)) |
316 | { | 316 | { |
317 | if (idtype == LIT_FUNCTION) | 317 | if (idtype == LIT_FUNCTION) |
@@ -329,9 +329,9 @@ public: | |||
329 | } | 329 | } |
330 | } | 330 | } |
331 | 331 | ||
332 | BOOL checkEntry(char *identifier) | 332 | BOOL checkEntry(const char *identifier) |
333 | { | 333 | { |
334 | char *name = mSTable->addString(identifier); | 334 | const char *name = mSTable->addString(identifier); |
335 | if (mEntryMap.checkData(name)) | 335 | if (mEntryMap.checkData(name)) |
336 | { | 336 | { |
337 | return TRUE; | 337 | return TRUE; |
@@ -343,9 +343,9 @@ public: | |||
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
346 | LLScriptScopeEntry *findEntry(char *identifier) | 346 | LLScriptScopeEntry *findEntry(const char *identifier) |
347 | { | 347 | { |
348 | char *name = mSTable->addString(identifier); | 348 | const char *name = mSTable->addString(identifier); |
349 | LLScriptScope *scope = this; | 349 | LLScriptScope *scope = this; |
350 | 350 | ||
351 | while (scope) | 351 | while (scope) |
@@ -360,9 +360,9 @@ public: | |||
360 | return NULL; | 360 | return NULL; |
361 | } | 361 | } |
362 | 362 | ||
363 | LLScriptScopeEntry *findEntryTyped(char *identifier, LSCRIPTIdentifierType idtype) | 363 | LLScriptScopeEntry *findEntryTyped(const char *identifier, LSCRIPTIdentifierType idtype) |
364 | { | 364 | { |
365 | char *name = mSTable->addString(identifier); | 365 | const char *name = mSTable->addString(identifier); |
366 | LLScriptScope *scope = this; | 366 | LLScriptScope *scope = this; |
367 | 367 | ||
368 | while (scope) | 368 | while (scope) |
@@ -397,7 +397,7 @@ public: | |||
397 | mParentScope = scope; | 397 | mParentScope = scope; |
398 | } | 398 | } |
399 | 399 | ||
400 | LLMap<char *, LLScriptScopeEntry *> mEntryMap; | 400 | LLMap<const char *, LLScriptScopeEntry *> mEntryMap; |
401 | LLScriptScope *mParentScope; | 401 | LLScriptScope *mParentScope; |
402 | LLStringTable *mSTable; | 402 | LLStringTable *mSTable; |
403 | S32 mFunctionCount; | 403 | S32 mFunctionCount; |
diff --git a/linden/indra/lscript/lscript_compile/lscript_tree.cpp b/linden/indra/lscript/lscript_compile/lscript_tree.cpp index 204f738..71e7f19 100644 --- a/linden/indra/lscript/lscript_compile/lscript_tree.cpp +++ b/linden/indra/lscript/lscript_compile/lscript_tree.cpp | |||
@@ -43,7 +43,8 @@ | |||
43 | 43 | ||
44 | //#define LSL_INCLUDE_DEBUG_INFO | 44 | //#define LSL_INCLUDE_DEBUG_INFO |
45 | 45 | ||
46 | void print_cil_box(LLFILE* fp, LSCRIPTType type) | 46 | |
47 | static void print_cil_box(LLFILE* fp, LSCRIPTType type) | ||
47 | { | 48 | { |
48 | switch(type) | 49 | switch(type) |
49 | { | 50 | { |
@@ -51,24 +52,28 @@ void print_cil_box(LLFILE* fp, LSCRIPTType type) | |||
51 | fprintf(fp, "box [mscorlib]System.Int32\n"); | 52 | fprintf(fp, "box [mscorlib]System.Int32\n"); |
52 | break; | 53 | break; |
53 | case LST_FLOATINGPOINT: | 54 | case LST_FLOATINGPOINT: |
54 | fprintf(fp, "box [mscorlib]System.Double\n"); | 55 | fprintf(fp, "box [mscorlib]System.Single\n"); |
55 | break; | 56 | break; |
56 | case LST_STRING: | 57 | case LST_STRING: |
58 | // System.String is not a System.ValueType, | ||
59 | // so does not need to be boxed. | ||
60 | break; | ||
57 | case LST_KEY: | 61 | case LST_KEY: |
58 | fprintf(fp, "box [mscorlib]System.String\n"); | 62 | fprintf(fp, "box [ScriptTypes]LindenLab.SecondLife.Key\n"); |
59 | break; | 63 | break; |
60 | case LST_VECTOR: | 64 | case LST_VECTOR: |
61 | fprintf(fp, "box [LScriptLibrary]LLVector\n"); | 65 | fprintf(fp, "box [ScriptTypes]LindenLab.SecondLife.Vector\n"); |
62 | break; | 66 | break; |
63 | case LST_QUATERNION: | 67 | case LST_QUATERNION: |
64 | fprintf(fp, "box [LScriptLibrary]LLQuaternion\n"); | 68 | fprintf(fp, "box [ScriptTypes]LindenLab.SecondLife.Quaternion\n"); |
65 | break; | 69 | break; |
66 | default: | 70 | default: |
71 | llassert(false); | ||
67 | break; | 72 | break; |
68 | } | 73 | } |
69 | } | 74 | } |
70 | 75 | ||
71 | void print_cil_type(LLFILE* fp, LSCRIPTType type) | 76 | static void print_cil_type(LLFILE* fp, LSCRIPTType type) |
72 | { | 77 | { |
73 | switch(type) | 78 | switch(type) |
74 | { | 79 | { |
@@ -79,14 +84,16 @@ void print_cil_type(LLFILE* fp, LSCRIPTType type) | |||
79 | fprintf(fp, "float32"); | 84 | fprintf(fp, "float32"); |
80 | break; | 85 | break; |
81 | case LST_STRING: | 86 | case LST_STRING: |
82 | case LST_KEY: | ||
83 | fprintf(fp, "string"); | 87 | fprintf(fp, "string"); |
88 | break; | ||
89 | case LST_KEY: | ||
90 | fprintf(fp, "valuetype [ScriptTypes]LindenLab.SecondLife.Key"); | ||
84 | break; | 91 | break; |
85 | case LST_VECTOR: | 92 | case LST_VECTOR: |
86 | fprintf(fp, "valuetype [LScriptLibrary]LLVector"); | 93 | fprintf(fp, "class [ScriptTypes]LindenLab.SecondLife.Vector"); |
87 | break; | 94 | break; |
88 | case LST_QUATERNION: | 95 | case LST_QUATERNION: |
89 | fprintf(fp, "valuetype [LScriptLibrary]LLQuaternion"); | 96 | fprintf(fp, "class [ScriptTypes]LindenLab.SecondLife.Quaternion"); |
90 | break; | 97 | break; |
91 | case LST_LIST: | 98 | case LST_LIST: |
92 | fprintf(fp, "class [mscorlib]System.Collections.ArrayList"); | 99 | fprintf(fp, "class [mscorlib]System.Collections.ArrayList"); |
@@ -189,6 +196,7 @@ void LLScriptConstantInteger::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
189 | break; | 196 | break; |
190 | case LSCP_EMIT_CIL_ASSEMBLY: | 197 | case LSCP_EMIT_CIL_ASSEMBLY: |
191 | fprintf(fp, "ldc.i4 %d\n", mValue); | 198 | fprintf(fp, "ldc.i4 %d\n", mValue); |
199 | type = mType; | ||
192 | break; | 200 | break; |
193 | default: | 201 | default: |
194 | break; | 202 | break; |
@@ -236,7 +244,13 @@ void LLScriptConstantFloat::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
236 | } | 244 | } |
237 | break; | 245 | break; |
238 | case LSCP_EMIT_CIL_ASSEMBLY: | 246 | case LSCP_EMIT_CIL_ASSEMBLY: |
239 | fprintf(fp, "ldc.r8 %5.5f\n", mValue); // NOTE: Precision? | 247 | { |
248 | double v = (double)mValue; | ||
249 | U8 * p = (U8 *)&v; // See ECMA-335 Partition VI, Appendix C.4.6 Examples, line 4 | ||
250 | fprintf(fp, "ldc.r8 (%02x %02x %02x %02x %02x %02x %02x %02x)\n", p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); | ||
251 | type = mType; | ||
252 | } | ||
253 | break; | ||
240 | default: | 254 | default: |
241 | break; | 255 | break; |
242 | } | 256 | } |
@@ -247,16 +261,34 @@ S32 LLScriptConstantFloat::getSize() | |||
247 | return LSCRIPTDataSize[LST_FLOATINGPOINT]; | 261 | return LSCRIPTDataSize[LST_FLOATINGPOINT]; |
248 | } | 262 | } |
249 | 263 | ||
250 | void print_escape_quotes(LLFILE* fp, const char* str) | 264 | void print_escaped(LLFILE* fp, const char* str) |
251 | { | 265 | { |
252 | putc('"', fp); | 266 | putc('"', fp); |
253 | for(const char* c = str; *c != '\0'; ++c) | 267 | for(const char* c = str; *c != '\0'; ++c) |
254 | { | 268 | { |
255 | if(*c == '"') | 269 | switch(*c) |
256 | { | 270 | { |
257 | putc('\\', fp); | 271 | case '"': |
272 | putc('\\', fp); | ||
273 | putc(*c, fp); | ||
274 | break; | ||
275 | case '\n': | ||
276 | putc('\\', fp); | ||
277 | putc('n', fp); | ||
278 | break; | ||
279 | case '\t': | ||
280 | putc(' ', fp); | ||
281 | putc(' ', fp); | ||
282 | putc(' ', fp); | ||
283 | putc(' ', fp); | ||
284 | break; | ||
285 | case '\\': | ||
286 | putc('\\', fp); | ||
287 | putc('\\', fp); | ||
288 | break; | ||
289 | default: | ||
290 | putc(*c, fp); | ||
258 | } | 291 | } |
259 | putc(*c, fp); | ||
260 | } | 292 | } |
261 | putc('"', fp); | 293 | putc('"', fp); |
262 | } | 294 | } |
@@ -293,7 +325,7 @@ void LLScriptConstantString::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
293 | case LSCP_TO_STACK: | 325 | case LSCP_TO_STACK: |
294 | { | 326 | { |
295 | chunk->addByte(LSCRIPTOpCodes[LOPC_PUSHARGS]); | 327 | chunk->addByte(LSCRIPTOpCodes[LOPC_PUSHARGS]); |
296 | chunk->addBytes(mValue, (S32)strlen(mValue) + 1); /*Flawfinder: ignore*/ | 328 | chunk->addBytes(mValue, (S32)strlen(mValue) + 1); |
297 | type = mType; | 329 | type = mType; |
298 | } | 330 | } |
299 | break; | 331 | break; |
@@ -304,7 +336,7 @@ void LLScriptConstantString::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
304 | break; | 336 | break; |
305 | case LSCP_EMIT_CIL_ASSEMBLY: | 337 | case LSCP_EMIT_CIL_ASSEMBLY: |
306 | fprintf(fp, "ldstr "); | 338 | fprintf(fp, "ldstr "); |
307 | print_escape_quotes(fp, mValue); | 339 | print_escaped(fp, mValue); |
308 | fprintf(fp, "\n"); | 340 | fprintf(fp, "\n"); |
309 | default: | 341 | default: |
310 | break; | 342 | break; |
@@ -313,10 +345,9 @@ void LLScriptConstantString::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
313 | 345 | ||
314 | S32 LLScriptConstantString::getSize() | 346 | S32 LLScriptConstantString::getSize() |
315 | { | 347 | { |
316 | return (S32)strlen(mValue) + 1; /*Flawfinder: ignore*/ | 348 | return (S32)strlen(mValue) + 1; |
317 | } | 349 | } |
318 | 350 | ||
319 | |||
320 | void LLScriptIdentifier::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 351 | void LLScriptIdentifier::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
321 | { | 352 | { |
322 | if (gErrorToText.getErrors()) | 353 | if (gErrorToText.getErrors()) |
@@ -388,7 +419,7 @@ void LLScriptIdentifier::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
388 | } | 419 | } |
389 | break; | 420 | break; |
390 | case LSCP_EMIT_CIL_ASSEMBLY: | 421 | case LSCP_EMIT_CIL_ASSEMBLY: |
391 | fprintf(fp, "%s", mName); | 422 | fprintf(fp, "'%s'", mName); |
392 | break; | 423 | break; |
393 | default: | 424 | default: |
394 | break; | 425 | break; |
@@ -428,6 +459,12 @@ S32 LLScriptSimpleAssignable::getSize() | |||
428 | return 0; | 459 | return 0; |
429 | } | 460 | } |
430 | 461 | ||
462 | static void print_cil_member(LLFILE* fp, LLScriptIdentifier *ident) | ||
463 | { | ||
464 | print_cil_type(fp, ident->mScopeEntry->mType); | ||
465 | fprintf(fp, " %s::'%s'\n", gScriptp->getClassName(), ident->mScopeEntry->mIdentifier); | ||
466 | } | ||
467 | |||
431 | void LLScriptSAIdentifier::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 468 | void LLScriptSAIdentifier::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
432 | { | 469 | { |
433 | if (gErrorToText.getErrors()) | 470 | if (gErrorToText.getErrors()) |
@@ -497,6 +534,19 @@ void LLScriptSAIdentifier::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
497 | } | 534 | } |
498 | } | 535 | } |
499 | break; | 536 | break; |
537 | |||
538 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
539 | { | ||
540 | fprintf(fp, "ldarg.0\n"); | ||
541 | fprintf(fp, "ldfld "); | ||
542 | print_cil_member(fp, mIdentifier); | ||
543 | fprintf(fp, "\n"); | ||
544 | if (mNextp) | ||
545 | { | ||
546 | mNextp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
547 | } | ||
548 | break; | ||
549 | } | ||
500 | default: | 550 | default: |
501 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 551 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
502 | if (mNextp) | 552 | if (mNextp) |
@@ -553,7 +603,8 @@ S32 LLScriptSAConstant::getSize() | |||
553 | return mConstant->getSize(); | 603 | return mConstant->getSize(); |
554 | } | 604 | } |
555 | 605 | ||
556 | void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) | 606 | |
607 | static void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) | ||
557 | { | 608 | { |
558 | switch(srcType) | 609 | switch(srcType) |
559 | { | 610 | { |
@@ -567,9 +618,8 @@ void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) | |||
567 | fprintf(fp, "call string class [mscorlib]System.Convert::ToString(int32)\n"); | 618 | fprintf(fp, "call string class [mscorlib]System.Convert::ToString(int32)\n"); |
568 | break; | 619 | break; |
569 | case LST_LIST: | 620 | case LST_LIST: |
570 | fprintf(fp, "box [mscorlib]System.Int32\n"); | 621 | print_cil_box(fp, LST_INTEGER); |
571 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LScriptLibrary]LScriptInternal::CreateList()\n"); | 622 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); |
572 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LScriptLibrary]LScriptInternal::AddReturnList(object, class [mscorlib]System.Collections.ArrayList)\n"); | ||
573 | break; | 623 | break; |
574 | default: | 624 | default: |
575 | break; | 625 | break; |
@@ -582,10 +632,11 @@ void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) | |||
582 | fprintf(fp, "conv.i4\n"); | 632 | fprintf(fp, "conv.i4\n"); |
583 | break; | 633 | break; |
584 | case LST_STRING: | 634 | case LST_STRING: |
585 | fprintf(fp, "call string class [mscorlib]System.Convert::ToString(float32)\n"); | 635 | fprintf(fp, "call string [LslLibrary]LindenLab.SecondLife.LslRunTime::ToString(float32)\n"); |
586 | break; | 636 | break; |
587 | case LST_LIST: | 637 | case LST_LIST: |
588 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LScriptLibrary]LScriptInternal::CreateList(object)\n"); | 638 | print_cil_box(fp, LST_FLOATINGPOINT); |
639 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); | ||
589 | break; | 640 | break; |
590 | default: | 641 | default: |
591 | break; | 642 | break; |
@@ -595,19 +646,22 @@ void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) | |||
595 | switch(targetType) | 646 | switch(targetType) |
596 | { | 647 | { |
597 | case LST_INTEGER: | 648 | case LST_INTEGER: |
598 | fprintf(fp, "call int32 valuetype [mscorlib]System.Int32::Parse(string)\n"); | 649 | fprintf(fp, "call int32 [LslLibrary]LindenLab.SecondLife.LslRunTime::StringToInt(string)\n"); |
599 | break; | 650 | break; |
600 | case LST_FLOATINGPOINT: | 651 | case LST_FLOATINGPOINT: |
601 | fprintf(fp, "call float64 valuetype [mscorlib]System.Double::Parse(string)\n"); | 652 | fprintf(fp, "call float32 [LslLibrary]LindenLab.SecondLife.LslRunTime::StringToFloat(string)\n"); |
602 | break; | 653 | break; |
654 | case LST_KEY: | ||
655 | fprintf(fp, "call valuetype [ScriptTypes]LindenLab.SecondLife.Key class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateKey'(string)\n"); | ||
656 | break; | ||
603 | case LST_LIST: | 657 | case LST_LIST: |
604 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LScriptLibrary]LScriptInternal::CreateList(object)\n"); | 658 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); |
605 | break; | 659 | break; |
606 | case LST_VECTOR: | 660 | case LST_VECTOR: |
607 | fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'Parse'(string)\n"); | 661 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'ParseVector'(string)\n"); |
608 | break; | 662 | break; |
609 | case LST_QUATERNION: | 663 | case LST_QUATERNION: |
610 | fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'Parse'(string)\n"); | 664 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'ParseQuaternion'(string)\n"); |
611 | break; | 665 | break; |
612 | default: | 666 | default: |
613 | break; | 667 | break; |
@@ -619,9 +673,11 @@ void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) | |||
619 | case LST_KEY: | 673 | case LST_KEY: |
620 | break; | 674 | break; |
621 | case LST_STRING: | 675 | case LST_STRING: |
676 | fprintf(fp, "call string [LslUserScript]LindenLab.SecondLife.LslUserScript::'ToString'(valuetype [ScriptTypes]LindenLab.SecondLife.Key)\n"); | ||
622 | break; | 677 | break; |
623 | case LST_LIST: | 678 | case LST_LIST: |
624 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LScriptLibrary]LScriptInternal::CreateList(object)\n"); | 679 | print_cil_box(fp, LST_KEY); |
680 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); | ||
625 | break; | 681 | break; |
626 | default: | 682 | default: |
627 | break; | 683 | break; |
@@ -633,10 +689,11 @@ void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) | |||
633 | case LST_VECTOR: | 689 | case LST_VECTOR: |
634 | break; | 690 | break; |
635 | case LST_STRING: | 691 | case LST_STRING: |
636 | fprintf(fp, "call string valuetype [LScriptLibrary]LLVector::'ToString'(valuetype [LScriptLibrary]LLVector)\n"); | 692 | fprintf(fp, "call string [LslUserScript]LindenLab.SecondLife.LslUserScript::'ToString'(valuetype [ScriptTypes]LindenLab.SecondLife.Vector)\n"); |
637 | break; | 693 | break; |
638 | case LST_LIST: | 694 | case LST_LIST: |
639 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LScriptLibrary]LScriptInternal::CreateList(object)\n"); | 695 | print_cil_box(fp, LST_VECTOR); |
696 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); | ||
640 | break; | 697 | break; |
641 | default: | 698 | default: |
642 | break; | 699 | break; |
@@ -648,10 +705,11 @@ void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) | |||
648 | case LST_QUATERNION: | 705 | case LST_QUATERNION: |
649 | break; | 706 | break; |
650 | case LST_STRING: | 707 | case LST_STRING: |
651 | fprintf(fp, "call string valuetype [LScriptLibrary]LLQuaternion::'ToString'(valuetype [LScriptLibrary]LLQuaternion)\n"); | 708 | fprintf(fp, "call string [LslUserScript]LindenLab.SecondLife.LslUserScript::'ToString'(valuetype [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); |
652 | break; | 709 | break; |
653 | case LST_LIST: | 710 | case LST_LIST: |
654 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LScriptLibrary]LScriptInternal::CreateList(object)\n"); | 711 | print_cil_box(fp, LST_QUATERNION); |
712 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); | ||
655 | break; | 713 | break; |
656 | default: | 714 | default: |
657 | break; | 715 | break; |
@@ -663,7 +721,7 @@ void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) | |||
663 | case LST_LIST: | 721 | case LST_LIST: |
664 | break; | 722 | break; |
665 | case LST_STRING: | 723 | case LST_STRING: |
666 | fprintf(fp, "call string [LScriptLibrary]LScriptInternal::ListToString(class [mscorlib]System.Collections.ArrayList)\n"); | 724 | fprintf(fp, "call string [LslLibrary]LindenLab.SecondLife.LslRunTime::ListToString(class [mscorlib]System.Collections.ArrayList)\n"); |
667 | break; | 725 | break; |
668 | default: | 726 | default: |
669 | break; | 727 | break; |
@@ -674,10 +732,57 @@ void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) | |||
674 | } | 732 | } |
675 | } | 733 | } |
676 | 734 | ||
677 | bool is_SA_constant_integer(LLScriptSimpleAssignable* sa) | 735 | static void print_cil_numeric_cast(LLFILE* fp, LSCRIPTType currentArg, LSCRIPTType otherArg) |
678 | { | 736 | { |
679 | // HACK: Downcast based on type. | 737 | if((currentArg == LST_INTEGER) && ((otherArg == LST_FLOATINGPOINT) || (otherArg == LST_VECTOR))) |
680 | return (sa->mType == LSSAT_CONSTANT && ((LLScriptSAConstant*) sa)->mConstant->mType == LST_INTEGER); | 738 | { |
739 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | ||
740 | } | ||
741 | } | ||
742 | |||
743 | static void print_cil_assignment_cast(LLFILE* fp, LSCRIPTType src, | ||
744 | LSCRIPTType dest) | ||
745 | { | ||
746 | if (LST_STRING == src && LST_KEY == dest) | ||
747 | { | ||
748 | print_cil_cast(fp, src, dest); | ||
749 | } | ||
750 | else if(LST_KEY == src && LST_STRING == dest) | ||
751 | { | ||
752 | print_cil_cast(fp, src, dest); | ||
753 | } | ||
754 | else | ||
755 | { | ||
756 | print_cil_numeric_cast(fp, src, dest); | ||
757 | } | ||
758 | } | ||
759 | |||
760 | // HACK! Babbage: should be converted to virtual on LSCRIPTSimpleAssignableType to avoid downcasts. | ||
761 | LSCRIPTType get_type(LLScriptSimpleAssignable* sa) | ||
762 | { | ||
763 | LSCRIPTType result = LST_NULL; | ||
764 | switch(sa->mType) | ||
765 | { | ||
766 | case LSSAT_IDENTIFIER: | ||
767 | result = ((LLScriptSAIdentifier*) sa)->mIdentifier->mScopeEntry->mType; | ||
768 | break; | ||
769 | case LSSAT_CONSTANT: | ||
770 | result = ((LLScriptSAConstant*) sa)->mConstant->mType; | ||
771 | break; | ||
772 | case LSSAT_VECTOR_CONSTANT: | ||
773 | result = LST_VECTOR; | ||
774 | break; | ||
775 | case LSSAT_QUATERNION_CONSTANT: | ||
776 | result = LST_QUATERNION; | ||
777 | break; | ||
778 | case LSSAT_LIST_CONSTANT: | ||
779 | result = LST_LIST; | ||
780 | break; | ||
781 | default: | ||
782 | result = LST_UNDEFINED; | ||
783 | break; | ||
784 | } | ||
785 | return result; | ||
681 | } | 786 | } |
682 | 787 | ||
683 | void LLScriptSAVector::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 788 | void LLScriptSAVector::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
@@ -786,23 +891,23 @@ void LLScriptSAVector::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile | |||
786 | 891 | ||
787 | // Load arguments. | 892 | // Load arguments. |
788 | mEntry1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 893 | mEntry1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
789 | if(is_SA_constant_integer(mEntry1)) | 894 | if(LST_INTEGER == get_type(mEntry1)) |
790 | { | 895 | { |
791 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | 896 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); |
792 | } | 897 | } |
793 | mEntry2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 898 | mEntry2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
794 | if(is_SA_constant_integer(mEntry3)) | 899 | if(LST_INTEGER == get_type(mEntry2)) |
795 | { | 900 | { |
796 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | 901 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); |
797 | } | 902 | } |
798 | mEntry3->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 903 | mEntry3->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
799 | if(is_SA_constant_integer(mEntry3)) | 904 | if(LST_INTEGER == get_type(mEntry3)) |
800 | { | 905 | { |
801 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | 906 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); |
802 | } | 907 | } |
803 | 908 | ||
804 | // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. | 909 | // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. |
805 | fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'create'(float32, float32, float32)\n"); | 910 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n"); |
806 | 911 | ||
807 | // Next. | 912 | // Next. |
808 | if (mNextp) | 913 | if (mNextp) |
@@ -952,28 +1057,28 @@ void LLScriptSAQuaternion::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
952 | 1057 | ||
953 | // Load arguments. | 1058 | // Load arguments. |
954 | mEntry1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1059 | mEntry1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
955 | if(is_SA_constant_integer(mEntry1)) | 1060 | if(LST_INTEGER == get_type(mEntry1)) |
956 | { | 1061 | { |
957 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | 1062 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); |
958 | } | 1063 | } |
959 | mEntry2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1064 | mEntry2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
960 | if(is_SA_constant_integer(mEntry2)) | 1065 | if(LST_INTEGER == get_type(mEntry2)) |
961 | { | 1066 | { |
962 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | 1067 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); |
963 | } | 1068 | } |
964 | mEntry3->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1069 | mEntry3->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
965 | if(is_SA_constant_integer(mEntry3)) | 1070 | if(LST_INTEGER == get_type(mEntry3)) |
966 | { | 1071 | { |
967 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | 1072 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); |
968 | } | 1073 | } |
969 | mEntry4->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1074 | mEntry4->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
970 | if(is_SA_constant_integer(mEntry4)) | 1075 | if(LST_INTEGER == get_type(mEntry4)) |
971 | { | 1076 | { |
972 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | 1077 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); |
973 | } | 1078 | } |
974 | 1079 | ||
975 | // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. | 1080 | // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. |
976 | fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'create'(float32, float32, float32, float32)\n"); | 1081 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n"); |
977 | 1082 | ||
978 | // Next. | 1083 | // Next. |
979 | if (mNextp) | 1084 | if (mNextp) |
@@ -1049,6 +1154,40 @@ void LLScriptSAList::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa | |||
1049 | } | 1154 | } |
1050 | } | 1155 | } |
1051 | break; | 1156 | break; |
1157 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
1158 | { | ||
1159 | // Create list. | ||
1160 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList()\n"); | ||
1161 | |||
1162 | // Add elements. | ||
1163 | LLScriptSimpleAssignable* current_entry = mEntryList; | ||
1164 | LLScriptSimpleAssignable* next_entry = NULL; | ||
1165 | while(NULL != current_entry) | ||
1166 | { | ||
1167 | next_entry = current_entry->mNextp; | ||
1168 | |||
1169 | // Null mNextp pointer, so only current list element is processed. | ||
1170 | current_entry->mNextp = NULL; | ||
1171 | current_entry->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
1172 | |||
1173 | // Restore mNextp pointer. | ||
1174 | current_entry->mNextp = next_entry; | ||
1175 | |||
1176 | // Box element and store in list. | ||
1177 | print_cil_box(fp, get_type(current_entry)); | ||
1178 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(class [mscorlib]System.Collections.ArrayList, object)\n"); | ||
1179 | |||
1180 | // Process next element. | ||
1181 | current_entry = next_entry; | ||
1182 | } | ||
1183 | |||
1184 | // Process next list. | ||
1185 | if (mNextp) | ||
1186 | { | ||
1187 | mNextp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
1188 | } | ||
1189 | } | ||
1190 | break; | ||
1052 | default: | 1191 | default: |
1053 | if (mEntryList) | 1192 | if (mEntryList) |
1054 | mEntryList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, ldata); | 1193 | mEntryList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, ldata); |
@@ -1093,6 +1232,45 @@ void LLScriptGlobalVariable::gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
1093 | } | 1232 | } |
1094 | } | 1233 | } |
1095 | 1234 | ||
1235 | // Push initialised variable of type on to stack. | ||
1236 | static void print_cil_init_variable(LLFILE* fp, LSCRIPTType type) | ||
1237 | { | ||
1238 | switch(type) | ||
1239 | { | ||
1240 | case LST_INTEGER: | ||
1241 | fprintf(fp, "ldc.i4.0\n"); | ||
1242 | break; | ||
1243 | case LST_FLOATINGPOINT: | ||
1244 | fprintf(fp, "ldc.r8 0\n"); | ||
1245 | break; | ||
1246 | case LST_STRING: | ||
1247 | fprintf(fp, "ldstr \"\"\n"); | ||
1248 | break; | ||
1249 | case LST_KEY: | ||
1250 | fprintf(fp, "ldstr \"\"\n"); | ||
1251 | fprintf(fp, "call valuetype [ScriptTypes]LindenLab.SecondLife.Key class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateKey'(string)\n"); | ||
1252 | break; | ||
1253 | case LST_VECTOR: | ||
1254 | fprintf(fp, "ldc.r8 0\n"); | ||
1255 | fprintf(fp, "ldc.r8 0\n"); | ||
1256 | fprintf(fp, "ldc.r8 0\n"); | ||
1257 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n"); | ||
1258 | break; | ||
1259 | case LST_QUATERNION: | ||
1260 | fprintf(fp, "ldc.r8 1\n"); | ||
1261 | fprintf(fp, "ldc.r8 0\n"); | ||
1262 | fprintf(fp, "ldc.r8 0\n"); | ||
1263 | fprintf(fp, "ldc.r8 0\n"); | ||
1264 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n"); | ||
1265 | break; | ||
1266 | case LST_LIST: | ||
1267 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList()\n"); | ||
1268 | break; | ||
1269 | default: | ||
1270 | break; | ||
1271 | } | ||
1272 | } | ||
1273 | |||
1096 | void LLScriptGlobalVariable::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 1274 | void LLScriptGlobalVariable::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
1097 | { | 1275 | { |
1098 | if (gErrorToText.getErrors()) | 1276 | if (gErrorToText.getErrors()) |
@@ -1164,7 +1342,7 @@ void LLScriptGlobalVariable::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
1164 | // it also includes the name of the variable as well as the type | 1342 | // it also includes the name of the variable as well as the type |
1165 | // plus 4 bytes of offset from it's apparent address to the actual data | 1343 | // plus 4 bytes of offset from it's apparent address to the actual data |
1166 | #ifdef LSL_INCLUDE_DEBUG_INFO | 1344 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1167 | count += strlen(mIdentifier->mName) + 1 + 1 + 4; /*Flawfinder: ignore*/ | 1345 | count += strlen(mIdentifier->mName) + 1 + 1 + 4; |
1168 | #else | 1346 | #else |
1169 | count += 1 + 1 + 4; | 1347 | count += 1 + 1 + 4; |
1170 | #endif | 1348 | #endif |
@@ -1187,7 +1365,7 @@ void LLScriptGlobalVariable::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
1187 | chunk->addBytes(&vtype, 1); | 1365 | chunk->addBytes(&vtype, 1); |
1188 | // null terminated name | 1366 | // null terminated name |
1189 | #ifdef LSL_INCLUDE_DEBUG_INFO | 1367 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1190 | chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/ | 1368 | chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); |
1191 | #else | 1369 | #else |
1192 | chunk->addBytes(1); | 1370 | chunk->addBytes(1); |
1193 | #endif | 1371 | #endif |
@@ -1257,16 +1435,27 @@ void LLScriptGlobalVariable::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
1257 | case LSCP_EMIT_CIL_ASSEMBLY: | 1435 | case LSCP_EMIT_CIL_ASSEMBLY: |
1258 | 1436 | ||
1259 | // Initialisation inside ctor. | 1437 | // Initialisation inside ctor. |
1438 | fprintf(fp, "ldarg.0\n"); | ||
1260 | if (mAssignable) | 1439 | if (mAssignable) |
1261 | { | 1440 | { |
1262 | fprintf(fp, "ldarg.0\n"); | 1441 | // Initialise to value. |
1263 | mAssignable->recurse(fp, tabs, tabsize, LSCP_EMIT_CIL_ASSEMBLY, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1442 | mAssignable->recurse(fp, tabs, tabsize, LSCP_EMIT_CIL_ASSEMBLY, |
1264 | fprintf(fp, "stfld "); | 1443 | ptype, prunearg, scope, type, basetype, |
1265 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1444 | count, chunk, heap, stacksize, entry, |
1266 | fprintf(fp," LSL::"); | 1445 | entrycount, NULL); |
1267 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1446 | print_cil_assignment_cast(fp, get_type(mAssignable), mType->mType); |
1268 | fprintf(fp, "\n"); | 1447 | } |
1448 | else | ||
1449 | { | ||
1450 | // Initialise to zero. | ||
1451 | print_cil_init_variable(fp, mType->mType); | ||
1269 | } | 1452 | } |
1453 | // Store value. | ||
1454 | fprintf(fp, "stfld "); | ||
1455 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
1456 | fprintf(fp," %s::", gScriptp->getClassName()); | ||
1457 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
1458 | fprintf(fp, "\n"); | ||
1270 | break; | 1459 | break; |
1271 | default: | 1460 | default: |
1272 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1461 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -1298,6 +1487,20 @@ S32 LLScriptEvent::getSize() | |||
1298 | printf("Event Base Class -- should never get here!\n"); | 1487 | printf("Event Base Class -- should never get here!\n"); |
1299 | return 0; | 1488 | return 0; |
1300 | } | 1489 | } |
1490 | static void checkForDuplicateHandler(LLFILE *fp, LLScriptFilePosition *pos, | ||
1491 | LLScriptScope *scope, | ||
1492 | const char* name) | ||
1493 | { | ||
1494 | LLScriptScope *parent = scope->mParentScope; | ||
1495 | if (parent->checkEntry((char*)name)) | ||
1496 | { | ||
1497 | gErrorToText.writeError(fp, pos, LSERROR_DUPLICATE_NAME); | ||
1498 | } | ||
1499 | else | ||
1500 | { | ||
1501 | parent->addEntry(((char*)name), LIT_HANDLER, LST_NULL); | ||
1502 | } | ||
1503 | } | ||
1301 | 1504 | ||
1302 | void LLScriptStateEntryEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 1505 | void LLScriptStateEntryEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
1303 | { | 1506 | { |
@@ -1314,11 +1517,14 @@ void LLScriptStateEntryEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
1314 | case LSCP_EMIT_ASSEMBLY: | 1517 | case LSCP_EMIT_ASSEMBLY: |
1315 | fprintf(fp, "state_entry()\n"); | 1518 | fprintf(fp, "state_entry()\n"); |
1316 | break; | 1519 | break; |
1520 | case LSCP_SCOPE_PASS1: | ||
1521 | checkForDuplicateHandler(fp, this, scope, "state_entry"); | ||
1522 | break; | ||
1317 | case LSCP_EMIT_BYTE_CODE: | 1523 | case LSCP_EMIT_BYTE_CODE: |
1318 | { | 1524 | { |
1319 | #ifdef LSL_INCLUDE_DEBUG_INFO | 1525 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1320 | char name[] = "state_entry"; | 1526 | char name[] = "state_entry"; |
1321 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 1527 | chunk->addBytes(name, strlen(name) + 1); |
1322 | #endif | 1528 | #endif |
1323 | } | 1529 | } |
1324 | break; | 1530 | break; |
@@ -1347,6 +1553,9 @@ void LLScriptStateExitEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
1347 | fdotabs(fp, tabs, tabsize); | 1553 | fdotabs(fp, tabs, tabsize); |
1348 | fprintf(fp, "state_exit()\n"); | 1554 | fprintf(fp, "state_exit()\n"); |
1349 | break; | 1555 | break; |
1556 | case LSCP_SCOPE_PASS1: | ||
1557 | checkForDuplicateHandler(fp, this, scope, "state_exit"); | ||
1558 | break; | ||
1350 | case LSCP_EMIT_ASSEMBLY: | 1559 | case LSCP_EMIT_ASSEMBLY: |
1351 | fprintf(fp, "state_exit()\n"); | 1560 | fprintf(fp, "state_exit()\n"); |
1352 | break; | 1561 | break; |
@@ -1354,7 +1563,7 @@ void LLScriptStateExitEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
1354 | { | 1563 | { |
1355 | #ifdef LSL_INCLUDE_DEBUG_INFO | 1564 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1356 | char name[] = "state_exit"; | 1565 | char name[] = "state_exit"; |
1357 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 1566 | chunk->addBytes(name, strlen(name) + 1); |
1358 | #endif | 1567 | #endif |
1359 | } | 1568 | } |
1360 | break; | 1569 | break; |
@@ -1388,6 +1597,7 @@ void LLScriptTouchStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
1388 | break; | 1597 | break; |
1389 | break; | 1598 | break; |
1390 | case LSCP_SCOPE_PASS1: | 1599 | case LSCP_SCOPE_PASS1: |
1600 | checkForDuplicateHandler(fp, this, scope, "touch_start"); | ||
1391 | if (scope->checkEntry(mCount->mName)) | 1601 | if (scope->checkEntry(mCount->mName)) |
1392 | { | 1602 | { |
1393 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 1603 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1412,11 +1622,18 @@ void LLScriptTouchStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
1412 | { | 1622 | { |
1413 | #ifdef LSL_INCLUDE_DEBUG_INFO | 1623 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1414 | char name[] = "touch_start"; | 1624 | char name[] = "touch_start"; |
1415 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 1625 | chunk->addBytes(name, strlen(name) + 1); |
1416 | chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ | 1626 | chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); |
1417 | #endif | 1627 | #endif |
1418 | } | 1628 | } |
1419 | break; | 1629 | break; |
1630 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
1631 | fdotabs(fp, tabs, tabsize); | ||
1632 | fprintf(fp, "touch_start( int32 "); | ||
1633 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
1634 | fprintf(fp, " )"); | ||
1635 | break; | ||
1636 | break; | ||
1420 | default: | 1637 | default: |
1421 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1638 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
1422 | break; | 1639 | break; |
@@ -1446,6 +1663,7 @@ void LLScriptTouchEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
1446 | break; | 1663 | break; |
1447 | break; | 1664 | break; |
1448 | case LSCP_SCOPE_PASS1: | 1665 | case LSCP_SCOPE_PASS1: |
1666 | checkForDuplicateHandler(fp, this, scope, "touch"); | ||
1449 | if (scope->checkEntry(mCount->mName)) | 1667 | if (scope->checkEntry(mCount->mName)) |
1450 | { | 1668 | { |
1451 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 1669 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1470,11 +1688,18 @@ void LLScriptTouchEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
1470 | { | 1688 | { |
1471 | #ifdef LSL_INCLUDE_DEBUG_INFO | 1689 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1472 | char name[] = "touch"; | 1690 | char name[] = "touch"; |
1473 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 1691 | chunk->addBytes(name, strlen(name) + 1); |
1474 | chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ | 1692 | chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); |
1475 | #endif | 1693 | #endif |
1476 | } | 1694 | } |
1477 | break; | 1695 | break; |
1696 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
1697 | fdotabs(fp, tabs, tabsize); | ||
1698 | fprintf(fp, "touch( int32 "); | ||
1699 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
1700 | fprintf(fp, " )"); | ||
1701 | break; | ||
1702 | break; | ||
1478 | default: | 1703 | default: |
1479 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1704 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
1480 | break; | 1705 | break; |
@@ -1504,6 +1729,7 @@ void LLScriptTouchEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
1504 | break; | 1729 | break; |
1505 | break; | 1730 | break; |
1506 | case LSCP_SCOPE_PASS1: | 1731 | case LSCP_SCOPE_PASS1: |
1732 | checkForDuplicateHandler(fp, this, scope, "touch_end"); | ||
1507 | if (scope->checkEntry(mCount->mName)) | 1733 | if (scope->checkEntry(mCount->mName)) |
1508 | { | 1734 | { |
1509 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 1735 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1528,11 +1754,18 @@ void LLScriptTouchEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
1528 | { | 1754 | { |
1529 | #ifdef LSL_INCLUDE_DEBUG_INFO | 1755 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1530 | char name[] = "touch_end"; | 1756 | char name[] = "touch_end"; |
1531 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 1757 | chunk->addBytes(name, strlen(name) + 1); |
1532 | chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ | 1758 | chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); |
1533 | #endif | 1759 | #endif |
1534 | } | 1760 | } |
1535 | break; | 1761 | break; |
1762 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
1763 | fdotabs(fp, tabs, tabsize); | ||
1764 | fprintf(fp, "touch_end( int32 "); | ||
1765 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
1766 | fprintf(fp, " )"); | ||
1767 | break; | ||
1768 | break; | ||
1536 | default: | 1769 | default: |
1537 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1770 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
1538 | break; | 1771 | break; |
@@ -1562,6 +1795,7 @@ void LLScriptCollisionStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSC | |||
1562 | break; | 1795 | break; |
1563 | break; | 1796 | break; |
1564 | case LSCP_SCOPE_PASS1: | 1797 | case LSCP_SCOPE_PASS1: |
1798 | checkForDuplicateHandler(fp, this, scope, "collision_start"); | ||
1565 | if (scope->checkEntry(mCount->mName)) | 1799 | if (scope->checkEntry(mCount->mName)) |
1566 | { | 1800 | { |
1567 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 1801 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1586,11 +1820,17 @@ void LLScriptCollisionStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSC | |||
1586 | { | 1820 | { |
1587 | #ifdef LSL_INCLUDE_DEBUG_INFO | 1821 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1588 | char name[] = "collision_start"; | 1822 | char name[] = "collision_start"; |
1589 | chunk->addBytes(name, (S32)strlen(name) + 1); /*Flawfinder: ignore*/ | 1823 | chunk->addBytes(name, (S32)strlen(name) + 1); |
1590 | chunk->addBytes(mCount->mName, (S32)strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ | 1824 | chunk->addBytes(mCount->mName, (S32)strlen(mCount->mName) + 1); |
1591 | #endif | 1825 | #endif |
1592 | } | 1826 | } |
1593 | break; | 1827 | break; |
1828 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
1829 | fdotabs(fp, tabs, tabsize); | ||
1830 | fprintf(fp, "collision_start( int32 "); | ||
1831 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
1832 | fprintf(fp, " )"); | ||
1833 | break; | ||
1594 | default: | 1834 | default: |
1595 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1835 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
1596 | break; | 1836 | break; |
@@ -1620,6 +1860,7 @@ void LLScriptCollisionEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
1620 | break; | 1860 | break; |
1621 | break; | 1861 | break; |
1622 | case LSCP_SCOPE_PASS1: | 1862 | case LSCP_SCOPE_PASS1: |
1863 | checkForDuplicateHandler(fp, this, scope, "collision"); | ||
1623 | if (scope->checkEntry(mCount->mName)) | 1864 | if (scope->checkEntry(mCount->mName)) |
1624 | { | 1865 | { |
1625 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 1866 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1644,11 +1885,16 @@ void LLScriptCollisionEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
1644 | { | 1885 | { |
1645 | #ifdef LSL_INCLUDE_DEBUG_INFO | 1886 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1646 | char name[] = "collision"; | 1887 | char name[] = "collision"; |
1647 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 1888 | chunk->addBytes(name, strlen(name) + 1); |
1648 | chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ | 1889 | chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); |
1649 | #endif | 1890 | #endif |
1650 | } | 1891 | } |
1651 | break; | 1892 | break; |
1893 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
1894 | fprintf(fp, "collision( int32 "); | ||
1895 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
1896 | fprintf(fp, " )"); | ||
1897 | break; | ||
1652 | default: | 1898 | default: |
1653 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1899 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
1654 | break; | 1900 | break; |
@@ -1678,6 +1924,7 @@ void LLScriptCollisionEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRI | |||
1678 | break; | 1924 | break; |
1679 | break; | 1925 | break; |
1680 | case LSCP_SCOPE_PASS1: | 1926 | case LSCP_SCOPE_PASS1: |
1927 | checkForDuplicateHandler(fp, this, scope, "collision_end"); | ||
1681 | if (scope->checkEntry(mCount->mName)) | 1928 | if (scope->checkEntry(mCount->mName)) |
1682 | { | 1929 | { |
1683 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 1930 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1702,11 +1949,17 @@ void LLScriptCollisionEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRI | |||
1702 | { | 1949 | { |
1703 | #ifdef LSL_INCLUDE_DEBUG_INFO | 1950 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1704 | char name[] = "collision_end"; | 1951 | char name[] = "collision_end"; |
1705 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 1952 | chunk->addBytes(name, strlen(name) + 1); |
1706 | chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ | 1953 | chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); |
1707 | #endif | 1954 | #endif |
1708 | } | 1955 | } |
1709 | break; | 1956 | break; |
1957 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
1958 | fdotabs(fp, tabs, tabsize); | ||
1959 | fprintf(fp, "collision_end( int32 "); | ||
1960 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
1961 | fprintf(fp, " )"); | ||
1962 | break; | ||
1710 | default: | 1963 | default: |
1711 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 1964 | mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
1712 | break; | 1965 | break; |
@@ -1735,6 +1988,7 @@ void LLScriptLandCollisionStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, | |||
1735 | fprintf(fp, " )\n"); | 1988 | fprintf(fp, " )\n"); |
1736 | break; | 1989 | break; |
1737 | case LSCP_SCOPE_PASS1: | 1990 | case LSCP_SCOPE_PASS1: |
1991 | checkForDuplicateHandler(fp, this, scope, "land_collision_start"); | ||
1738 | if (scope->checkEntry(mPosition->mName)) | 1992 | if (scope->checkEntry(mPosition->mName)) |
1739 | { | 1993 | { |
1740 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 1994 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1759,11 +2013,17 @@ void LLScriptLandCollisionStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, | |||
1759 | { | 2013 | { |
1760 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2014 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1761 | char name[] = "land_collision_start"; | 2015 | char name[] = "land_collision_start"; |
1762 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2016 | chunk->addBytes(name, strlen(name) + 1); |
1763 | chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); /*Flawfinder: ignore*/ | 2017 | chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); |
1764 | #endif | 2018 | #endif |
1765 | } | 2019 | } |
1766 | break; | 2020 | break; |
2021 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2022 | fdotabs(fp, tabs, tabsize); | ||
2023 | fprintf(fp, "land_collision_start( class [ScriptTypes]LindenLab.SecondLife.Vector "); | ||
2024 | mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2025 | fprintf(fp, " )"); | ||
2026 | break; | ||
1767 | default: | 2027 | default: |
1768 | mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2028 | mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
1769 | break; | 2029 | break; |
@@ -1794,6 +2054,7 @@ void LLScriptLandCollisionEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCR | |||
1794 | fprintf(fp, " )\n"); | 2054 | fprintf(fp, " )\n"); |
1795 | break; | 2055 | break; |
1796 | case LSCP_SCOPE_PASS1: | 2056 | case LSCP_SCOPE_PASS1: |
2057 | checkForDuplicateHandler(fp, this, scope, "land_collision"); | ||
1797 | if (scope->checkEntry(mPosition->mName)) | 2058 | if (scope->checkEntry(mPosition->mName)) |
1798 | { | 2059 | { |
1799 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2060 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1818,11 +2079,17 @@ void LLScriptLandCollisionEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCR | |||
1818 | { | 2079 | { |
1819 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2080 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1820 | char name[] = "land_collision"; | 2081 | char name[] = "land_collision"; |
1821 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2082 | chunk->addBytes(name, strlen(name) + 1); |
1822 | chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); /*Flawfinder: ignore*/ | 2083 | chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); |
1823 | #endif | 2084 | #endif |
1824 | } | 2085 | } |
1825 | break; | 2086 | break; |
2087 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2088 | fdotabs(fp, tabs, tabsize); | ||
2089 | fprintf(fp, "land_collision( class [ScriptTypes]LindenLab.SecondLife.Vector "); | ||
2090 | mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2091 | fprintf(fp, " )"); | ||
2092 | break; | ||
1826 | default: | 2093 | default: |
1827 | mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2094 | mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
1828 | break; | 2095 | break; |
@@ -1852,6 +2119,7 @@ void LLScriptLandCollisionEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, L | |||
1852 | fprintf(fp, " )\n"); | 2119 | fprintf(fp, " )\n"); |
1853 | break; | 2120 | break; |
1854 | case LSCP_SCOPE_PASS1: | 2121 | case LSCP_SCOPE_PASS1: |
2122 | checkForDuplicateHandler(fp, this, scope, "land_collision_end"); | ||
1855 | if (scope->checkEntry(mPosition->mName)) | 2123 | if (scope->checkEntry(mPosition->mName)) |
1856 | { | 2124 | { |
1857 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2125 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1875,12 +2143,18 @@ void LLScriptLandCollisionEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, L | |||
1875 | case LSCP_EMIT_BYTE_CODE: | 2143 | case LSCP_EMIT_BYTE_CODE: |
1876 | { | 2144 | { |
1877 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2145 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1878 | char name[] = "land_collision_end"; /*Flawfinder: ignore*/ | 2146 | char name[] = "land_collision_end"; |
1879 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2147 | chunk->addBytes(name, strlen(name) + 1); |
1880 | chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); /*Flawfinder: ignore*/ | 2148 | chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); |
1881 | #endif | 2149 | #endif |
1882 | } | 2150 | } |
1883 | break; | 2151 | break; |
2152 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2153 | fdotabs(fp, tabs, tabsize); | ||
2154 | fprintf(fp, "land_collision_end( class [ScriptTypes]LindenLab.SecondLife.Vector "); | ||
2155 | mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2156 | fprintf(fp, " )"); | ||
2157 | break; | ||
1884 | default: | 2158 | default: |
1885 | mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2159 | mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
1886 | break; | 2160 | break; |
@@ -1910,6 +2184,7 @@ void LLScriptInventoryEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
1910 | fprintf(fp, " )\n"); | 2184 | fprintf(fp, " )\n"); |
1911 | break; | 2185 | break; |
1912 | case LSCP_SCOPE_PASS1: | 2186 | case LSCP_SCOPE_PASS1: |
2187 | checkForDuplicateHandler(fp, this, scope, "changed"); | ||
1913 | if (scope->checkEntry(mChange->mName)) | 2188 | if (scope->checkEntry(mChange->mName)) |
1914 | { | 2189 | { |
1915 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2190 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1934,11 +2209,17 @@ void LLScriptInventoryEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
1934 | { | 2209 | { |
1935 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2210 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1936 | char name[] = "changed"; | 2211 | char name[] = "changed"; |
1937 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2212 | chunk->addBytes(name, strlen(name) + 1); |
1938 | chunk->addBytes(mChange->mName, strlen(mChange->mName) + 1); /*Flawfinder: ignore*/ | 2213 | chunk->addBytes(mChange->mName, strlen(mChange->mName) + 1); |
1939 | #endif | 2214 | #endif |
1940 | } | 2215 | } |
1941 | break; | 2216 | break; |
2217 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2218 | fdotabs(fp, tabs, tabsize); | ||
2219 | fprintf(fp, "changed( int32 "); | ||
2220 | mChange->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2221 | fprintf(fp, " )"); | ||
2222 | break; | ||
1942 | default: | 2223 | default: |
1943 | mChange->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2224 | mChange->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
1944 | break; | 2225 | break; |
@@ -1967,6 +2248,7 @@ void LLScriptAttachEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
1967 | fprintf(fp, " )\n"); | 2248 | fprintf(fp, " )\n"); |
1968 | break; | 2249 | break; |
1969 | case LSCP_SCOPE_PASS1: | 2250 | case LSCP_SCOPE_PASS1: |
2251 | checkForDuplicateHandler(fp, this, scope, "attach"); | ||
1970 | if (scope->checkEntry(mAttach->mName)) | 2252 | if (scope->checkEntry(mAttach->mName)) |
1971 | { | 2253 | { |
1972 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2254 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -1991,11 +2273,17 @@ void LLScriptAttachEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
1991 | { | 2273 | { |
1992 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2274 | #ifdef LSL_INCLUDE_DEBUG_INFO |
1993 | char name[] = "attach"; | 2275 | char name[] = "attach"; |
1994 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2276 | chunk->addBytes(name, strlen(name) + 1); |
1995 | chunk->addBytes(mAttach->mName, strlen(mAttach->mName) + 1); /*Flawfinder: ignore*/ | 2277 | chunk->addBytes(mAttach->mName, strlen(mAttach->mName) + 1); |
1996 | #endif | 2278 | #endif |
1997 | } | 2279 | } |
1998 | break; | 2280 | break; |
2281 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2282 | fdotabs(fp, tabs, tabsize); | ||
2283 | fprintf(fp, "attach( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); | ||
2284 | mAttach->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2285 | fprintf(fp, " )\n"); | ||
2286 | break; | ||
1999 | default: | 2287 | default: |
2000 | mAttach->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2288 | mAttach->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2001 | break; | 2289 | break; |
@@ -2026,6 +2314,7 @@ void LLScriptDataserverEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
2026 | fprintf(fp, " )\n"); | 2314 | fprintf(fp, " )\n"); |
2027 | break; | 2315 | break; |
2028 | case LSCP_SCOPE_PASS1: | 2316 | case LSCP_SCOPE_PASS1: |
2317 | checkForDuplicateHandler(fp, this, scope, "dataserver"); | ||
2029 | if (scope->checkEntry(mID->mName)) | 2318 | if (scope->checkEntry(mID->mName)) |
2030 | { | 2319 | { |
2031 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2320 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -2061,12 +2350,20 @@ void LLScriptDataserverEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
2061 | { | 2350 | { |
2062 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2351 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2063 | char name[] = "dataserver"; | 2352 | char name[] = "dataserver"; |
2064 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2353 | chunk->addBytes(name, strlen(name) + 1); |
2065 | chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/ | 2354 | chunk->addBytes(mID->mName, strlen(mID->mName) + 1); |
2066 | chunk->addBytes(mData->mName, strlen(mData->mName) + 1); /*Flawfinder: ignore*/ | 2355 | chunk->addBytes(mData->mName, strlen(mData->mName) + 1); |
2067 | #endif | 2356 | #endif |
2068 | } | 2357 | } |
2069 | break; | 2358 | break; |
2359 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2360 | fdotabs(fp, tabs, tabsize); | ||
2361 | fprintf(fp, "dataserver( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); | ||
2362 | mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2363 | fprintf(fp, ", string "); | ||
2364 | mData->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2365 | fprintf(fp, " )"); | ||
2366 | break; | ||
2070 | default: | 2367 | default: |
2071 | mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2368 | mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2072 | mData->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2369 | mData->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -2095,14 +2392,21 @@ void LLScriptTimerEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
2095 | case LSCP_EMIT_ASSEMBLY: | 2392 | case LSCP_EMIT_ASSEMBLY: |
2096 | fprintf(fp, "timer()\n"); | 2393 | fprintf(fp, "timer()\n"); |
2097 | break; | 2394 | break; |
2395 | case LSCP_SCOPE_PASS1: | ||
2396 | checkForDuplicateHandler(fp, this, scope, "timer"); | ||
2397 | break; | ||
2398 | |||
2098 | case LSCP_EMIT_BYTE_CODE: | 2399 | case LSCP_EMIT_BYTE_CODE: |
2099 | { | 2400 | { |
2100 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2401 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2101 | char name[] = "timer"; | 2402 | char name[] = "timer"; |
2102 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2403 | chunk->addBytes(name, strlen(name) + 1); |
2103 | #endif | 2404 | #endif |
2104 | } | 2405 | } |
2105 | break; | 2406 | break; |
2407 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2408 | fprintf(fp, "timer()"); | ||
2409 | break; | ||
2106 | default: | 2410 | default: |
2107 | break; | 2411 | break; |
2108 | } | 2412 | } |
@@ -2126,14 +2430,21 @@ void LLScriptMovingStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIP | |||
2126 | fdotabs(fp, tabs, tabsize); | 2430 | fdotabs(fp, tabs, tabsize); |
2127 | fprintf(fp, "moving_start()\n"); | 2431 | fprintf(fp, "moving_start()\n"); |
2128 | break; | 2432 | break; |
2433 | case LSCP_SCOPE_PASS1: | ||
2434 | checkForDuplicateHandler(fp, this, scope, "moving_start"); | ||
2435 | break; | ||
2436 | |||
2129 | case LSCP_EMIT_BYTE_CODE: | 2437 | case LSCP_EMIT_BYTE_CODE: |
2130 | { | 2438 | { |
2131 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2439 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2132 | char name[] = "moving_start"; | 2440 | char name[] = "moving_start"; |
2133 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2441 | chunk->addBytes(name, strlen(name) + 1); |
2134 | #endif | 2442 | #endif |
2135 | } | 2443 | } |
2136 | break; | 2444 | break; |
2445 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2446 | fprintf(fp, "moving_start()"); | ||
2447 | break; | ||
2137 | default: | 2448 | default: |
2138 | break; | 2449 | break; |
2139 | } | 2450 | } |
@@ -2157,14 +2468,21 @@ void LLScriptMovingEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
2157 | fdotabs(fp, tabs, tabsize); | 2468 | fdotabs(fp, tabs, tabsize); |
2158 | fprintf(fp, "moving_end()\n"); | 2469 | fprintf(fp, "moving_end()\n"); |
2159 | break; | 2470 | break; |
2471 | case LSCP_SCOPE_PASS1: | ||
2472 | checkForDuplicateHandler(fp, this, scope, "moving_end"); | ||
2473 | break; | ||
2474 | |||
2160 | case LSCP_EMIT_BYTE_CODE: | 2475 | case LSCP_EMIT_BYTE_CODE: |
2161 | { | 2476 | { |
2162 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2477 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2163 | char name[] = "moving_end"; | 2478 | char name[] = "moving_end"; |
2164 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2479 | chunk->addBytes(name, strlen(name) + 1); |
2165 | #endif | 2480 | #endif |
2166 | } | 2481 | } |
2167 | break; | 2482 | break; |
2483 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2484 | fprintf(fp, "moving_end()"); | ||
2485 | break; | ||
2168 | default: | 2486 | default: |
2169 | break; | 2487 | break; |
2170 | } | 2488 | } |
@@ -2191,6 +2509,7 @@ void LLScriptRTPEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile | |||
2191 | fprintf(fp, " )\n"); | 2509 | fprintf(fp, " )\n"); |
2192 | break; | 2510 | break; |
2193 | case LSCP_SCOPE_PASS1: | 2511 | case LSCP_SCOPE_PASS1: |
2512 | checkForDuplicateHandler(fp, this, scope, "run_time_perms"); | ||
2194 | if (scope->checkEntry(mRTPermissions->mName)) | 2513 | if (scope->checkEntry(mRTPermissions->mName)) |
2195 | { | 2514 | { |
2196 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2515 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -2215,11 +2534,18 @@ void LLScriptRTPEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile | |||
2215 | { | 2534 | { |
2216 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2535 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2217 | char name[] = "chat"; | 2536 | char name[] = "chat"; |
2218 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2537 | chunk->addBytes(name, strlen(name) + 1); |
2219 | chunk->addBytes(mRTPermissions->mName, strlen(mRTPermissions->mName) + 1); /*Flawfinder: ignore*/ | 2538 | chunk->addBytes(mRTPermissions->mName, strlen(mRTPermissions->mName) + 1); |
2220 | #endif | 2539 | #endif |
2221 | } | 2540 | } |
2222 | break; | 2541 | break; |
2542 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2543 | // NOTE: Not replicating LSL2 bug by calling RTP event hander "chat" | ||
2544 | fdotabs(fp, tabs, tabsize); | ||
2545 | fprintf(fp, "run_time_perms( int32 "); | ||
2546 | mRTPermissions->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2547 | fprintf(fp, " )"); | ||
2548 | break; | ||
2223 | default: | 2549 | default: |
2224 | mRTPermissions->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2550 | mRTPermissions->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2225 | break; | 2551 | break; |
@@ -2254,6 +2580,7 @@ void LLScriptChatEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil | |||
2254 | fprintf(fp, " )\n"); | 2580 | fprintf(fp, " )\n"); |
2255 | break; | 2581 | break; |
2256 | case LSCP_SCOPE_PASS1: | 2582 | case LSCP_SCOPE_PASS1: |
2583 | checkForDuplicateHandler(fp, this, scope, "listen"); // note: this is actually listen in lsl source | ||
2257 | if (scope->checkEntry(mChannel->mName)) | 2584 | if (scope->checkEntry(mChannel->mName)) |
2258 | { | 2585 | { |
2259 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2586 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -2311,14 +2638,26 @@ void LLScriptChatEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil | |||
2311 | { | 2638 | { |
2312 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2639 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2313 | char name[] = "chat"; | 2640 | char name[] = "chat"; |
2314 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2641 | chunk->addBytes(name, strlen(name) + 1); |
2315 | chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1); /*Flawfinder: ignore*/ | 2642 | chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1); |
2316 | chunk->addBytes(mName->mName, strlen(mName->mName) + 1); /*Flawfinder: ignore*/ | 2643 | chunk->addBytes(mName->mName, strlen(mName->mName) + 1); |
2317 | chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/ | 2644 | chunk->addBytes(mID->mName, strlen(mID->mName) + 1); |
2318 | chunk->addBytes(mMessage->mName, strlen(mMessage->mName) + 1); /*Flawfinder: ignore*/ | 2645 | chunk->addBytes(mMessage->mName, strlen(mMessage->mName) + 1); |
2319 | #endif | 2646 | #endif |
2320 | } | 2647 | } |
2321 | break; | 2648 | break; |
2649 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2650 | fdotabs(fp, tabs, tabsize); | ||
2651 | fprintf(fp, "chat( int32 "); | ||
2652 | mChannel->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2653 | fprintf(fp, ", string "); | ||
2654 | mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2655 | fprintf(fp, ", valuetype [ScriptTypes]LindenLab.SecondLife.Key "); | ||
2656 | mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2657 | fprintf(fp, ", string "); | ||
2658 | mMessage->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2659 | fprintf(fp, " )"); | ||
2660 | break; | ||
2322 | default: | 2661 | default: |
2323 | mChannel->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2662 | mChannel->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2324 | mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2663 | mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -2350,6 +2689,7 @@ void LLScriptSensorEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
2350 | fprintf(fp, " )\n"); | 2689 | fprintf(fp, " )\n"); |
2351 | break; | 2690 | break; |
2352 | case LSCP_SCOPE_PASS1: | 2691 | case LSCP_SCOPE_PASS1: |
2692 | checkForDuplicateHandler(fp, this, scope, "sensor"); | ||
2353 | if (scope->checkEntry(mNumber->mName)) | 2693 | if (scope->checkEntry(mNumber->mName)) |
2354 | { | 2694 | { |
2355 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2695 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -2374,11 +2714,17 @@ void LLScriptSensorEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
2374 | { | 2714 | { |
2375 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2715 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2376 | char name[] = "sensor"; | 2716 | char name[] = "sensor"; |
2377 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2717 | chunk->addBytes(name, strlen(name) + 1); |
2378 | chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1); /*Flawfinder: ignore*/ | 2718 | chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1); |
2379 | #endif | 2719 | #endif |
2380 | } | 2720 | } |
2381 | break; | 2721 | break; |
2722 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2723 | fdotabs(fp, tabs, tabsize); | ||
2724 | fprintf(fp, "sensor( int32 "); | ||
2725 | mNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2726 | fprintf(fp, " )"); | ||
2727 | break; | ||
2382 | default: | 2728 | default: |
2383 | mNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2729 | mNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2384 | break; | 2730 | break; |
@@ -2407,6 +2753,7 @@ void LLScriptObjectRezEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
2407 | fprintf(fp, " )\n"); | 2753 | fprintf(fp, " )\n"); |
2408 | break; | 2754 | break; |
2409 | case LSCP_SCOPE_PASS1: | 2755 | case LSCP_SCOPE_PASS1: |
2756 | checkForDuplicateHandler(fp, this, scope, "object_rez"); | ||
2410 | if (scope->checkEntry(mID->mName)) | 2757 | if (scope->checkEntry(mID->mName)) |
2411 | { | 2758 | { |
2412 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2759 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -2431,11 +2778,17 @@ void LLScriptObjectRezEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
2431 | { | 2778 | { |
2432 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2779 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2433 | char name[] = "sensor"; | 2780 | char name[] = "sensor"; |
2434 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2781 | chunk->addBytes(name, strlen(name) + 1); |
2435 | chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/ | 2782 | chunk->addBytes(mID->mName, strlen(mID->mName) + 1); |
2436 | #endif | 2783 | #endif |
2437 | } | 2784 | } |
2438 | break; | 2785 | break; |
2786 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2787 | fdotabs(fp, tabs, tabsize); | ||
2788 | fprintf(fp, "object_rez( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); | ||
2789 | mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2790 | fprintf(fp, " )"); | ||
2791 | break; | ||
2439 | default: | 2792 | default: |
2440 | mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2793 | mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2441 | break; | 2794 | break; |
@@ -2468,6 +2821,7 @@ void LLScriptControlEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
2468 | fprintf(fp, " )\n"); | 2821 | fprintf(fp, " )\n"); |
2469 | break; | 2822 | break; |
2470 | case LSCP_SCOPE_PASS1: | 2823 | case LSCP_SCOPE_PASS1: |
2824 | checkForDuplicateHandler(fp, this, scope, "control"); | ||
2471 | if (scope->checkEntry(mName->mName)) | 2825 | if (scope->checkEntry(mName->mName)) |
2472 | { | 2826 | { |
2473 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2827 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -2514,13 +2868,23 @@ void LLScriptControlEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
2514 | { | 2868 | { |
2515 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2869 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2516 | char name[] = "control"; | 2870 | char name[] = "control"; |
2517 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2871 | chunk->addBytes(name, strlen(name) + 1); |
2518 | chunk->addBytes(mName->mName, strlen(mName->mName) + 1); /*Flawfinder: ignore*/ | 2872 | chunk->addBytes(mName->mName, strlen(mName->mName) + 1); |
2519 | chunk->addBytes(mLevels->mName, strlen(mLevels->mName) + 1); /*Flawfinder: ignore*/ | 2873 | chunk->addBytes(mLevels->mName, strlen(mLevels->mName) + 1); |
2520 | chunk->addBytes(mEdges->mName, strlen(mEdges->mName) + 1); /*Flawfinder: ignore*/ | 2874 | chunk->addBytes(mEdges->mName, strlen(mEdges->mName) + 1); |
2521 | #endif | 2875 | #endif |
2522 | } | 2876 | } |
2523 | break; | 2877 | break; |
2878 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2879 | fdotabs(fp, tabs, tabsize); | ||
2880 | fprintf(fp, "control( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); | ||
2881 | mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2882 | fprintf(fp, ", int32 "); | ||
2883 | mLevels->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2884 | fprintf(fp, ", int32 "); | ||
2885 | mEdges->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2886 | fprintf(fp, " )"); | ||
2887 | break; | ||
2524 | default: | 2888 | default: |
2525 | mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2889 | mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2526 | mLevels->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 2890 | mLevels->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -2557,6 +2921,7 @@ void LLScriptLinkMessageEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIP | |||
2557 | fprintf(fp, " )\n"); | 2921 | fprintf(fp, " )\n"); |
2558 | break; | 2922 | break; |
2559 | case LSCP_SCOPE_PASS1: | 2923 | case LSCP_SCOPE_PASS1: |
2924 | checkForDuplicateHandler(fp, this, scope, "link_message"); | ||
2560 | if (scope->checkEntry(mSender->mName)) | 2925 | if (scope->checkEntry(mSender->mName)) |
2561 | { | 2926 | { |
2562 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 2927 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -2614,14 +2979,26 @@ void LLScriptLinkMessageEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIP | |||
2614 | { | 2979 | { |
2615 | #ifdef LSL_INCLUDE_DEBUG_INFO | 2980 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2616 | char name[] = "link_message"; | 2981 | char name[] = "link_message"; |
2617 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 2982 | chunk->addBytes(name, strlen(name) + 1); |
2618 | chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1); /*Flawfinder: ignore*/ | 2983 | chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1); |
2619 | chunk->addBytes(mNum->mName, strlen(mNum->mName) + 1); /*Flawfinder: ignore*/ | 2984 | chunk->addBytes(mNum->mName, strlen(mNum->mName) + 1); |
2620 | chunk->addBytes(mStr->mName, strlen(mStr->mName) + 1); /*Flawfinder: ignore*/ | 2985 | chunk->addBytes(mStr->mName, strlen(mStr->mName) + 1); |
2621 | chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/ | 2986 | chunk->addBytes(mID->mName, strlen(mID->mName) + 1); |
2622 | #endif | 2987 | #endif |
2623 | } | 2988 | } |
2624 | break; | 2989 | break; |
2990 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
2991 | fdotabs(fp, tabs, tabsize); | ||
2992 | fprintf(fp, "link_message( int32 "); | ||
2993 | mSender->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2994 | fprintf(fp, ", int32 "); | ||
2995 | mNum->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2996 | fprintf(fp, ", string "); | ||
2997 | mStr->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
2998 | fprintf(fp, ", valuetype [ScriptTypes]LindenLab.SecondLife.Key "); | ||
2999 | mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3000 | fprintf(fp, " )"); | ||
3001 | break; | ||
2625 | default: | 3002 | default: |
2626 | mSender->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3003 | mSender->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2627 | mNum->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3004 | mNum->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -2663,6 +3040,7 @@ void LLScriptRemoteEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
2663 | fprintf(fp, " )\n"); | 3040 | fprintf(fp, " )\n"); |
2664 | break; | 3041 | break; |
2665 | case LSCP_SCOPE_PASS1: | 3042 | case LSCP_SCOPE_PASS1: |
3043 | checkForDuplicateHandler(fp, this, scope, "remote_event"); | ||
2666 | if (scope->checkEntry(mType->mName)) | 3044 | if (scope->checkEntry(mType->mName)) |
2667 | { | 3045 | { |
2668 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 3046 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -2742,16 +3120,32 @@ void LLScriptRemoteEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
2742 | { | 3120 | { |
2743 | #ifdef LSL_INCLUDE_DEBUG_INFO | 3121 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2744 | char name[] = "remote_event"; | 3122 | char name[] = "remote_event"; |
2745 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 3123 | chunk->addBytes(name, strlen(name) + 1); |
2746 | chunk->addBytes(mType->mName, strlen(mType->mName) + 1); /*Flawfinder: ignore*/ | 3124 | chunk->addBytes(mType->mName, strlen(mType->mName) + 1); |
2747 | chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1); /*Flawfinder: ignore*/ | 3125 | chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1); |
2748 | chunk->addBytes(mMessageID->mName, strlen(mMessageID->mName) + 1); /*Flawfinder: ignore*/ | 3126 | chunk->addBytes(mMessageID->mName, strlen(mMessageID->mName) + 1); |
2749 | chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1); /*Flawfinder: ignore*/ | 3127 | chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1); |
2750 | chunk->addBytes(mIntVal->mName, strlen(mIntVal->mName) + 1); /*Flawfinder: ignore*/ | 3128 | chunk->addBytes(mIntVal->mName, strlen(mIntVal->mName) + 1); |
2751 | chunk->addBytes(mStrVal->mName, strlen(mStrVal->mName) + 1); /*Flawfinder: ignore*/ | 3129 | chunk->addBytes(mStrVal->mName, strlen(mStrVal->mName) + 1); |
2752 | #endif | 3130 | #endif |
2753 | } | 3131 | } |
2754 | break; | 3132 | break; |
3133 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
3134 | fdotabs(fp, tabs, tabsize); | ||
3135 | fprintf(fp, "remote_event( int32 "); | ||
3136 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3137 | fprintf(fp, ", valuetype [ScriptTypes]LindenLab.SecondLife.Key "); | ||
3138 | mChannel->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3139 | fprintf(fp, ", valuetype [ScriptTypes]LindenLab.SecondLife.Key "); | ||
3140 | mMessageID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3141 | fprintf(fp, ", string "); | ||
3142 | mSender->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3143 | fprintf(fp, ", int32 "); | ||
3144 | mIntVal->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3145 | fprintf(fp, ", string "); | ||
3146 | mStrVal->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3147 | fprintf(fp, " )"); | ||
3148 | break; | ||
2755 | default: | 3149 | default: |
2756 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3150 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2757 | mChannel->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3151 | mChannel->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -2784,7 +3178,7 @@ void LLScriptHTTPResponseEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRI | |||
2784 | mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3178 | mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2785 | fprintf(fp, ", integer "); | 3179 | fprintf(fp, ", integer "); |
2786 | mStatus->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3180 | mStatus->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2787 | fprintf(fp, ", list "); | 3181 | fprintf(fp, ", class [mscorlib]System.Collections.ArrayList "); |
2788 | mMetadata->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3182 | mMetadata->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2789 | fprintf(fp, ", string "); | 3183 | fprintf(fp, ", string "); |
2790 | mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3184 | mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -2792,6 +3186,7 @@ void LLScriptHTTPResponseEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRI | |||
2792 | break; | 3186 | break; |
2793 | 3187 | ||
2794 | case LSCP_SCOPE_PASS1: | 3188 | case LSCP_SCOPE_PASS1: |
3189 | checkForDuplicateHandler(fp, this, scope, "http_response"); | ||
2795 | if (scope->checkEntry(mRequestId->mName)) | 3190 | if (scope->checkEntry(mRequestId->mName)) |
2796 | { | 3191 | { |
2797 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 3192 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -2857,15 +3252,26 @@ void LLScriptHTTPResponseEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRI | |||
2857 | { | 3252 | { |
2858 | #ifdef LSL_INCLUDE_DEBUG_INFO | 3253 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2859 | char name[] = "http_response"; | 3254 | char name[] = "http_response"; |
2860 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 3255 | chunk->addBytes(name, strlen(name) + 1); |
2861 | chunk->addBytes(mRequestId->mName, strlen(mRequestId->mName) + 1); /*Flawfinder: ignore*/ | 3256 | chunk->addBytes(mRequestId->mName, strlen(mRequestId->mName) + 1); |
2862 | chunk->addBytes(mStatus->mName, strlen(mStatus->mName) + 1); /*Flawfinder: ignore*/ | 3257 | chunk->addBytes(mStatus->mName, strlen(mStatus->mName) + 1); |
2863 | chunk->addBytes(mMetadata->mName, strlen(mMetadata->mName) + 1); /*Flawfinder: ignore*/ | 3258 | chunk->addBytes(mMetadata->mName, strlen(mMetadata->mName) + 1); |
2864 | chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); /*Flawfinder: ignore*/ | 3259 | chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); |
2865 | #endif | 3260 | #endif |
2866 | } | 3261 | } |
2867 | break; | 3262 | break; |
2868 | 3263 | case LSCP_EMIT_CIL_ASSEMBLY: | |
3264 | fdotabs(fp, tabs, tabsize); | ||
3265 | fprintf(fp, "http_response( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); | ||
3266 | mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3267 | fprintf(fp, ", int32 "); | ||
3268 | mStatus->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3269 | fprintf(fp, ", class [mscorlib]System.Collections.ArrayList "); | ||
3270 | mMetadata->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3271 | fprintf(fp, ", string "); | ||
3272 | mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3273 | fprintf(fp, " )\n"); | ||
3274 | break; | ||
2869 | default: | 3275 | default: |
2870 | mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3276 | mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2871 | mStatus->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3277 | mStatus->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -2900,6 +3306,7 @@ void LLScriptMoneyEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
2900 | fprintf(fp, " )\n"); | 3306 | fprintf(fp, " )\n"); |
2901 | break; | 3307 | break; |
2902 | case LSCP_SCOPE_PASS1: | 3308 | case LSCP_SCOPE_PASS1: |
3309 | checkForDuplicateHandler(fp, this, scope, "money"); | ||
2903 | if (scope->checkEntry(mName->mName)) | 3310 | if (scope->checkEntry(mName->mName)) |
2904 | { | 3311 | { |
2905 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 3312 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -2935,12 +3342,20 @@ void LLScriptMoneyEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
2935 | { | 3342 | { |
2936 | #ifdef LSL_INCLUDE_DEBUG_INFO | 3343 | #ifdef LSL_INCLUDE_DEBUG_INFO |
2937 | char name[] = "money"; | 3344 | char name[] = "money"; |
2938 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 3345 | chunk->addBytes(name, strlen(name) + 1); |
2939 | chunk->addBytes(mName->mName, strlen(mName->mName) + 1); /*Flawfinder: ignore*/ | 3346 | chunk->addBytes(mName->mName, strlen(mName->mName) + 1); |
2940 | chunk->addBytes(mAmount->mName, strlen(mAmount->mName) + 1); /*Flawfinder: ignore*/ | 3347 | chunk->addBytes(mAmount->mName, strlen(mAmount->mName) + 1); |
2941 | #endif | 3348 | #endif |
2942 | } | 3349 | } |
2943 | break; | 3350 | break; |
3351 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
3352 | fdotabs(fp, tabs, tabsize); | ||
3353 | fprintf(fp, "money( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); | ||
3354 | mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3355 | fprintf(fp, ", int32 "); | ||
3356 | mAmount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3357 | fprintf(fp, " )"); | ||
3358 | break; | ||
2944 | default: | 3359 | default: |
2945 | mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3360 | mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
2946 | mAmount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3361 | mAmount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -2978,6 +3393,7 @@ void LLScriptEmailEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
2978 | fprintf(fp, " )\n"); | 3393 | fprintf(fp, " )\n"); |
2979 | break; | 3394 | break; |
2980 | case LSCP_SCOPE_PASS1: | 3395 | case LSCP_SCOPE_PASS1: |
3396 | checkForDuplicateHandler(fp, this, scope, "email"); | ||
2981 | if (scope->checkEntry(mTime->mName)) | 3397 | if (scope->checkEntry(mTime->mName)) |
2982 | { | 3398 | { |
2983 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 3399 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -3046,15 +3462,29 @@ void LLScriptEmailEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
3046 | { | 3462 | { |
3047 | #ifdef LSL_INCLUDE_DEBUG_INFO | 3463 | #ifdef LSL_INCLUDE_DEBUG_INFO |
3048 | char name[] = "email"; | 3464 | char name[] = "email"; |
3049 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 3465 | chunk->addBytes(name, strlen(name) + 1); |
3050 | chunk->addBytes(mTime->mName, strlen(mTime->mName) + 1); /*Flawfinder: ignore*/ | 3466 | chunk->addBytes(mTime->mName, strlen(mTime->mName) + 1); |
3051 | chunk->addBytes(mAddress->mName, strlen(mAddress->mName) + 1); /*Flawfinder: ignore*/ | 3467 | chunk->addBytes(mAddress->mName, strlen(mAddress->mName) + 1); |
3052 | chunk->addBytes(mSubject->mName, strlen(mSubject->mName) + 1); /*Flawfinder: ignore*/ | 3468 | chunk->addBytes(mSubject->mName, strlen(mSubject->mName) + 1); |
3053 | chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); /*Flawfinder: ignore*/ | 3469 | chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); |
3054 | chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1); /*Flawfinder: ignore*/ | 3470 | chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1); |
3055 | #endif | 3471 | #endif |
3056 | } | 3472 | } |
3057 | break; | 3473 | break; |
3474 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
3475 | fdotabs(fp, tabs, tabsize); | ||
3476 | fprintf(fp, "email( string "); | ||
3477 | mTime->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3478 | fprintf(fp, ", string "); | ||
3479 | mAddress->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3480 | fprintf(fp, ", string "); | ||
3481 | mSubject->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3482 | fprintf(fp, ", string "); | ||
3483 | mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3484 | fprintf(fp, ", int32 "); | ||
3485 | mNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3486 | fprintf(fp, " )"); | ||
3487 | break; | ||
3058 | default: | 3488 | default: |
3059 | mTime->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3489 | mTime->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
3060 | mAddress->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3490 | mAddress->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -3087,6 +3517,7 @@ void LLScriptRezEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile | |||
3087 | fprintf(fp, " )\n"); | 3517 | fprintf(fp, " )\n"); |
3088 | break; | 3518 | break; |
3089 | case LSCP_SCOPE_PASS1: | 3519 | case LSCP_SCOPE_PASS1: |
3520 | checkForDuplicateHandler(fp, this, scope, "rez"); | ||
3090 | if (scope->checkEntry(mStartParam->mName)) | 3521 | if (scope->checkEntry(mStartParam->mName)) |
3091 | { | 3522 | { |
3092 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 3523 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -3111,11 +3542,17 @@ void LLScriptRezEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile | |||
3111 | { | 3542 | { |
3112 | #ifdef LSL_INCLUDE_DEBUG_INFO | 3543 | #ifdef LSL_INCLUDE_DEBUG_INFO |
3113 | char name[] = "rez"; | 3544 | char name[] = "rez"; |
3114 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 3545 | chunk->addBytes(name, strlen(name) + 1); |
3115 | chunk->addBytes(mStartParam->mName, strlen(mStartParam->mName) + 1); /*Flawfinder: ignore*/ | 3546 | chunk->addBytes(mStartParam->mName, strlen(mStartParam->mName) + 1); |
3116 | #endif | 3547 | #endif |
3117 | } | 3548 | } |
3118 | break; | 3549 | break; |
3550 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
3551 | fdotabs(fp, tabs, tabsize); | ||
3552 | fprintf(fp, "rez( int32 "); | ||
3553 | mStartParam->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3554 | fprintf(fp, " )"); | ||
3555 | break; | ||
3119 | default: | 3556 | default: |
3120 | mStartParam->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3557 | mStartParam->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
3121 | break; | 3558 | break; |
@@ -3143,14 +3580,20 @@ void LLScriptNoSensorEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
3143 | case LSCP_EMIT_ASSEMBLY: | 3580 | case LSCP_EMIT_ASSEMBLY: |
3144 | fprintf(fp, "no_sensor()\n"); | 3581 | fprintf(fp, "no_sensor()\n"); |
3145 | break; | 3582 | break; |
3146 | case LSCP_EMIT_BYTE_CODE: | 3583 | case LSCP_SCOPE_PASS1: |
3584 | checkForDuplicateHandler(fp, this, scope, "no_sensor"); | ||
3585 | break; | ||
3586 | case LSCP_EMIT_BYTE_CODE: | ||
3147 | { | 3587 | { |
3148 | #ifdef LSL_INCLUDE_DEBUG_INFO | 3588 | #ifdef LSL_INCLUDE_DEBUG_INFO |
3149 | char name[] = "no_sensor"; | 3589 | char name[] = "no_sensor"; |
3150 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 3590 | chunk->addBytes(name, strlen(name) + 1); |
3151 | #endif | 3591 | #endif |
3152 | } | 3592 | } |
3153 | break; | 3593 | break; |
3594 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
3595 | fprintf(fp, "no_sensor()"); | ||
3596 | break; | ||
3154 | default: | 3597 | default: |
3155 | break; | 3598 | break; |
3156 | } | 3599 | } |
@@ -3181,6 +3624,7 @@ void LLScriptAtTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile | |||
3181 | fprintf(fp, " )\n"); | 3624 | fprintf(fp, " )\n"); |
3182 | break; | 3625 | break; |
3183 | case LSCP_SCOPE_PASS1: | 3626 | case LSCP_SCOPE_PASS1: |
3627 | checkForDuplicateHandler(fp, this, scope, "at_target"); | ||
3184 | if (scope->checkEntry(mTargetNumber->mName)) | 3628 | if (scope->checkEntry(mTargetNumber->mName)) |
3185 | { | 3629 | { |
3186 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 3630 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -3226,14 +3670,24 @@ void LLScriptAtTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile | |||
3226 | case LSCP_EMIT_BYTE_CODE: | 3670 | case LSCP_EMIT_BYTE_CODE: |
3227 | { | 3671 | { |
3228 | #ifdef LSL_INCLUDE_DEBUG_INFO | 3672 | #ifdef LSL_INCLUDE_DEBUG_INFO |
3229 | char name[] = "at_target"; /*Flawfinder: ignore*/ | 3673 | char name[] = "at_target"; |
3230 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 3674 | chunk->addBytes(name, strlen(name) + 1); |
3231 | chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1); /*Flawfinder: ignore*/ | 3675 | chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1); |
3232 | chunk->addBytes(mTargetPosition->mName, strlen(mTargetPosition->mName) + 1); /*Flawfinder: ignore*/ | 3676 | chunk->addBytes(mTargetPosition->mName, strlen(mTargetPosition->mName) + 1); |
3233 | chunk->addBytes(mOurPosition->mName, strlen(mOurPosition->mName) + 1); /*Flawfinder: ignore*/ | 3677 | chunk->addBytes(mOurPosition->mName, strlen(mOurPosition->mName) + 1); |
3234 | #endif | 3678 | #endif |
3235 | } | 3679 | } |
3236 | break; | 3680 | break; |
3681 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
3682 | fdotabs(fp, tabs, tabsize); | ||
3683 | fprintf(fp, "at_target( int32 "); | ||
3684 | mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3685 | fprintf(fp, ", class [ScriptTypes]LindenLab.SecondLife.Vector "); | ||
3686 | mTargetPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3687 | fprintf(fp, ", class [ScriptTypes]LindenLab.SecondLife.Vector "); | ||
3688 | mOurPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3689 | fprintf(fp, " )"); | ||
3690 | break; | ||
3237 | default: | 3691 | default: |
3238 | mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3692 | mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
3239 | mTargetPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3693 | mTargetPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -3265,14 +3719,21 @@ void LLScriptNotAtTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
3265 | case LSCP_EMIT_ASSEMBLY: | 3719 | case LSCP_EMIT_ASSEMBLY: |
3266 | fprintf(fp, "not_at_target()\n"); | 3720 | fprintf(fp, "not_at_target()\n"); |
3267 | break; | 3721 | break; |
3722 | case LSCP_SCOPE_PASS1: | ||
3723 | checkForDuplicateHandler(fp, this, scope, "not_at_target"); | ||
3724 | break; | ||
3725 | |||
3268 | case LSCP_EMIT_BYTE_CODE: | 3726 | case LSCP_EMIT_BYTE_CODE: |
3269 | { | 3727 | { |
3270 | #ifdef LSL_INCLUDE_DEBUG_INFO | 3728 | #ifdef LSL_INCLUDE_DEBUG_INFO |
3271 | char name[] = "not_at_target"; /*Flawfinder: ignore*/ | 3729 | char name[] = "not_at_target"; |
3272 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 3730 | chunk->addBytes(name, strlen(name) + 1); |
3273 | #endif | 3731 | #endif |
3274 | } | 3732 | } |
3275 | break; | 3733 | break; |
3734 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
3735 | fprintf(fp, "not_at_target()"); | ||
3736 | break; | ||
3276 | default: | 3737 | default: |
3277 | break; | 3738 | break; |
3278 | } | 3739 | } |
@@ -3294,7 +3755,7 @@ void LLScriptAtRotTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
3294 | case LSCP_PRETTY_PRINT: | 3755 | case LSCP_PRETTY_PRINT: |
3295 | case LSCP_EMIT_ASSEMBLY: | 3756 | case LSCP_EMIT_ASSEMBLY: |
3296 | fdotabs(fp, tabs, tabsize); | 3757 | fdotabs(fp, tabs, tabsize); |
3297 | fprintf(fp, "at_target( integer "); | 3758 | fprintf(fp, "at_rot_target( integer "); |
3298 | mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3759 | mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
3299 | fprintf(fp, ", quaternion "); | 3760 | fprintf(fp, ", quaternion "); |
3300 | mTargetRotation->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3761 | mTargetRotation->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -3303,6 +3764,7 @@ void LLScriptAtRotTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
3303 | fprintf(fp, " )\n"); | 3764 | fprintf(fp, " )\n"); |
3304 | break; | 3765 | break; |
3305 | case LSCP_SCOPE_PASS1: | 3766 | case LSCP_SCOPE_PASS1: |
3767 | checkForDuplicateHandler(fp, this, scope, "at_rot_target"); | ||
3306 | if (scope->checkEntry(mTargetNumber->mName)) | 3768 | if (scope->checkEntry(mTargetNumber->mName)) |
3307 | { | 3769 | { |
3308 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); | 3770 | gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); |
@@ -3349,13 +3811,23 @@ void LLScriptAtRotTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
3349 | { | 3811 | { |
3350 | #ifdef LSL_INCLUDE_DEBUG_INFO | 3812 | #ifdef LSL_INCLUDE_DEBUG_INFO |
3351 | char name[] = "at_rot_target"; | 3813 | char name[] = "at_rot_target"; |
3352 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 3814 | chunk->addBytes(name, strlen(name) + 1); |
3353 | chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1); /*Flawfinder: ignore*/ | 3815 | chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1); |
3354 | chunk->addBytes(mTargetRotation->mName, strlen(mTargetRotation->mName) + 1); /*Flawfinder: ignore*/ | 3816 | chunk->addBytes(mTargetRotation->mName, strlen(mTargetRotation->mName) + 1); |
3355 | chunk->addBytes(mOurRotation->mName, strlen(mOurRotation->mName) + 1); /*Flawfinder: ignore*/ | 3817 | chunk->addBytes(mOurRotation->mName, strlen(mOurRotation->mName) + 1); |
3356 | #endif | 3818 | #endif |
3357 | } | 3819 | } |
3358 | break; | 3820 | break; |
3821 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
3822 | fdotabs(fp, tabs, tabsize); | ||
3823 | fprintf(fp, "at_rot_target( int32 "); | ||
3824 | mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3825 | fprintf(fp, ", class [ScriptTypes]LindenLab.SecondLife.Quaternion "); | ||
3826 | mTargetRotation->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3827 | fprintf(fp, ", class [ScriptTypes]LindenLab.SecondLife.Quaternion "); | ||
3828 | mOurRotation->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3829 | fprintf(fp, " )"); | ||
3830 | break; | ||
3359 | default: | 3831 | default: |
3360 | mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3832 | mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
3361 | mTargetRotation->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 3833 | mTargetRotation->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -3391,10 +3863,17 @@ void LLScriptNotAtRotTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTC | |||
3391 | { | 3863 | { |
3392 | #ifdef LSL_INCLUDE_DEBUG_INFO | 3864 | #ifdef LSL_INCLUDE_DEBUG_INFO |
3393 | char name[] = "not_at_rot_target"; | 3865 | char name[] = "not_at_rot_target"; |
3394 | chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ | 3866 | chunk->addBytes(name, strlen(name) + 1); |
3395 | #endif | 3867 | #endif |
3396 | } | 3868 | } |
3397 | break; | 3869 | break; |
3870 | case LSCP_SCOPE_PASS1: | ||
3871 | checkForDuplicateHandler(fp, this, scope, "not_at_rot_target"); | ||
3872 | break; | ||
3873 | |||
3874 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
3875 | fprintf(fp, "not_at_rot_target()"); | ||
3876 | break; | ||
3398 | default: | 3877 | default: |
3399 | break; | 3878 | break; |
3400 | } | 3879 | } |
@@ -3563,6 +4042,25 @@ S32 LLScriptForExpressionList::getSize() | |||
3563 | return 0; | 4042 | return 0; |
3564 | } | 4043 | } |
3565 | 4044 | ||
4045 | // CIL code generation requires both caller and callee scope entries, so cannot use normal recurse signature. | ||
4046 | // TODO: Refactor general purpose recurse calls in to pass specific virtuals using visitor pattern to select method by pass and node type. | ||
4047 | static void print_cil_func_expression_list(LLScriptFuncExpressionList* self, LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata, LLScriptScopeEntry *callee_entry) | ||
4048 | { | ||
4049 | self->mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
4050 | LSCRIPTType argtype = callee_entry->mFunctionArgs.getType(entrycount); | ||
4051 | if (argtype != self->mFirstp->mReturnType) | ||
4052 | { | ||
4053 | print_cil_cast(fp, self->mFirstp->mReturnType, argtype); | ||
4054 | } | ||
4055 | entrycount++; | ||
4056 | if (self->mSecondp) | ||
4057 | { | ||
4058 | llassert(LET_FUNC_EXPRESSION_LIST == self->mSecondp->mType); | ||
4059 | print_cil_func_expression_list((LLScriptFuncExpressionList*) self->mSecondp, fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL, callee_entry); | ||
4060 | |||
4061 | } | ||
4062 | } | ||
4063 | |||
3566 | void LLScriptFuncExpressionList::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 4064 | void LLScriptFuncExpressionList::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
3567 | { | 4065 | { |
3568 | if (gErrorToText.getErrors()) | 4066 | if (gErrorToText.getErrors()) |
@@ -3660,31 +4158,6 @@ void LLScriptFuncExpressionList::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCR | |||
3660 | } | 4158 | } |
3661 | } | 4159 | } |
3662 | break; | 4160 | break; |
3663 | /* TODO: Fix conflict between global/local variable determination needing caller scope and cast determination here needs callee scope... | ||
3664 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
3665 | { | ||
3666 | mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3667 | LSCRIPTType argtype = entry->mFunctionArgs.getType(entrycount); | ||
3668 | if (argtype != mFirstp->mReturnType) | ||
3669 | { | ||
3670 | print_cil_cast(fp, mFirstp->mReturnType, argtype); | ||
3671 | } | ||
3672 | entrycount++; | ||
3673 | if (mSecondp) | ||
3674 | { | ||
3675 | mSecondp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3676 | if (mSecondp->mReturnType) | ||
3677 | { | ||
3678 | argtype = entry->mFunctionArgs.getType(entrycount); | ||
3679 | if (argtype != mSecondp->mReturnType) | ||
3680 | { | ||
3681 | print_cil_cast(fp, mFirstp->mReturnType, argtype); | ||
3682 | } | ||
3683 | } | ||
3684 | } | ||
3685 | } | ||
3686 | break; | ||
3687 | */ | ||
3688 | default: | 4161 | default: |
3689 | mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 4162 | mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
3690 | if (mSecondp) | 4163 | if (mSecondp) |
@@ -3753,8 +4226,13 @@ void LLScriptListExpressionList::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCR | |||
3753 | } | 4226 | } |
3754 | break; | 4227 | break; |
3755 | case LSCP_EMIT_CIL_ASSEMBLY: | 4228 | case LSCP_EMIT_CIL_ASSEMBLY: |
3756 | // Evaluate expressions in reverse order so first expression is on top of stack. | 4229 | mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
3757 | // Results can then be popped and appended to list to result in list with correct order. | 4230 | if (mFirstp->mType != LET_LIST_EXPRESSION_LIST) |
4231 | { | ||
4232 | // Box value. | ||
4233 | print_cil_box(fp, mFirstp->mReturnType); | ||
4234 | ++count; | ||
4235 | } | ||
3758 | if (mSecondp) | 4236 | if (mSecondp) |
3759 | { | 4237 | { |
3760 | mSecondp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 4238 | mSecondp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -3762,18 +4240,9 @@ void LLScriptListExpressionList::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCR | |||
3762 | { | 4240 | { |
3763 | // Box value. | 4241 | // Box value. |
3764 | print_cil_box(fp, mSecondp->mReturnType); | 4242 | print_cil_box(fp, mSecondp->mReturnType); |
3765 | |||
3766 | ++count; | 4243 | ++count; |
3767 | } | 4244 | } |
3768 | } | 4245 | } |
3769 | mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
3770 | if (mFirstp->mType != LET_LIST_EXPRESSION_LIST) | ||
3771 | { | ||
3772 | // Box value. | ||
3773 | print_cil_box(fp, mFirstp->mReturnType); | ||
3774 | |||
3775 | ++count; | ||
3776 | } | ||
3777 | break; | 4246 | break; |
3778 | default: | 4247 | default: |
3779 | mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 4248 | mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -3793,14 +4262,22 @@ S32 LLScriptListExpressionList::getSize() | |||
3793 | // Returns true if identifier is a parameter and false if identifier is a local variable within function_scope. | 4262 | // Returns true if identifier is a parameter and false if identifier is a local variable within function_scope. |
3794 | bool is_parameter(LLScriptIdentifier* identifier, LLScriptScopeEntry* function_scope) | 4263 | bool is_parameter(LLScriptIdentifier* identifier, LLScriptScopeEntry* function_scope) |
3795 | { | 4264 | { |
3796 | // Function offset stores offset of first local. | 4265 | // Function stores offset of first local. |
3797 | // Compare variable offset with function offset to | 4266 | if(0 == function_scope->mOffset) |
3798 | // determine whether variable is local or parameter. | 4267 | { |
3799 | return (identifier->mScopeEntry->mOffset < function_scope->mOffset); | 4268 | // Function offset 0 -> no parameters -> identifier is a local. |
4269 | return false; | ||
4270 | } | ||
4271 | else | ||
4272 | { | ||
4273 | // Compare variable offset with function offset to | ||
4274 | // determine whether variable is local or parameter. | ||
4275 | return (identifier->mScopeEntry->mOffset < function_scope->mOffset); | ||
4276 | } | ||
3800 | } | 4277 | } |
3801 | 4278 | ||
3802 | // If assignment is to global variable, pushes this pointer on to stack. | 4279 | // If assignment is to global variable, pushes this pointer on to stack. |
3803 | void print_cil_load_address(LLFILE* fp, LLScriptExpression* exp, LLScriptScopeEntry* function_scope) | 4280 | static void print_cil_load_address(LLFILE* fp, LLScriptExpression* exp, LLScriptScopeEntry* function_scope) |
3804 | { | 4281 | { |
3805 | LLScriptLValue *lvalue = (LLScriptLValue *) exp; | 4282 | LLScriptLValue *lvalue = (LLScriptLValue *) exp; |
3806 | LLScriptIdentifier *ident = lvalue->mIdentifier; | 4283 | LLScriptIdentifier *ident = lvalue->mIdentifier; |
@@ -3811,7 +4288,7 @@ void print_cil_load_address(LLFILE* fp, LLScriptExpression* exp, LLScriptScopeEn | |||
3811 | fprintf(fp, "ldarg.0\n"); | 4288 | fprintf(fp, "ldarg.0\n"); |
3812 | } | 4289 | } |
3813 | 4290 | ||
3814 | // If accessor, load address of object. | 4291 | // If accessor, load value type address, consumed by ldfld. |
3815 | if(lvalue->mAccessor) | 4292 | if(lvalue->mAccessor) |
3816 | { | 4293 | { |
3817 | if(ident->mScopeEntry->mIDType == LIT_VARIABLE) | 4294 | if(ident->mScopeEntry->mIDType == LIT_VARIABLE) |
@@ -3819,7 +4296,7 @@ void print_cil_load_address(LLFILE* fp, LLScriptExpression* exp, LLScriptScopeEn | |||
3819 | if(is_parameter(ident, function_scope)) | 4296 | if(is_parameter(ident, function_scope)) |
3820 | { | 4297 | { |
3821 | // Parameter, load by name. | 4298 | // Parameter, load by name. |
3822 | fprintf(fp, "ldarga.s %s\n", ident->mScopeEntry->mIdentifier); | 4299 | fprintf(fp, "ldarga.s '%s'\n", ident->mScopeEntry->mIdentifier); |
3823 | } | 4300 | } |
3824 | else | 4301 | else |
3825 | { | 4302 | { |
@@ -3830,13 +4307,13 @@ void print_cil_load_address(LLFILE* fp, LLScriptExpression* exp, LLScriptScopeEn | |||
3830 | else if (ident->mScopeEntry->mIDType == LIT_GLOBAL) | 4307 | else if (ident->mScopeEntry->mIDType == LIT_GLOBAL) |
3831 | { | 4308 | { |
3832 | fprintf(fp, "ldflda "); | 4309 | fprintf(fp, "ldflda "); |
3833 | print_cil_type(fp, ident->mScopeEntry->mType); | 4310 | print_cil_member(fp, ident); |
3834 | fprintf(fp, " LSL::%s\n", ident->mScopeEntry->mIdentifier); | ||
3835 | } | 4311 | } |
3836 | } | 4312 | } |
3837 | } | 4313 | } |
3838 | 4314 | ||
3839 | void print_cil_accessor(LLFILE* fp, LLScriptLValue *lvalue) | 4315 | static void print_cil_accessor(LLFILE* fp, LLScriptLValue *lvalue) |
4316 | |||
3840 | { | 4317 | { |
3841 | LLScriptIdentifier *ident = lvalue->mIdentifier; | 4318 | LLScriptIdentifier *ident = lvalue->mIdentifier; |
3842 | print_cil_type(fp, lvalue->mReturnType); | 4319 | print_cil_type(fp, lvalue->mReturnType); |
@@ -3845,12 +4322,6 @@ void print_cil_accessor(LLFILE* fp, LLScriptLValue *lvalue) | |||
3845 | fprintf(fp, "::%s\n", lvalue->mAccessor->mName); | 4322 | fprintf(fp, "::%s\n", lvalue->mAccessor->mName); |
3846 | } | 4323 | } |
3847 | 4324 | ||
3848 | void print_cil_member(LLFILE* fp, LLScriptIdentifier *ident) | ||
3849 | { | ||
3850 | print_cil_type(fp, ident->mScopeEntry->mType); | ||
3851 | fprintf(fp, " LSL::%s\n", ident->mScopeEntry->mIdentifier); | ||
3852 | } | ||
3853 | |||
3854 | void LLScriptLValue::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 4325 | void LLScriptLValue::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
3855 | { | 4326 | { |
3856 | if (gErrorToText.getErrors()) | 4327 | if (gErrorToText.getErrors()) |
@@ -4106,7 +4577,7 @@ void LLScriptLValue::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa | |||
4106 | if(is_parameter(mIdentifier, entry)) | 4577 | if(is_parameter(mIdentifier, entry)) |
4107 | { | 4578 | { |
4108 | // Parameter, load by name. | 4579 | // Parameter, load by name. |
4109 | fprintf(fp, "ldarg.s %s\n", mIdentifier->mScopeEntry->mIdentifier); | 4580 | fprintf(fp, "ldarg.s '%s'\n", mIdentifier->mScopeEntry->mIdentifier); |
4110 | } | 4581 | } |
4111 | else | 4582 | else |
4112 | { | 4583 | { |
@@ -4136,7 +4607,7 @@ S32 LLScriptLValue::getSize() | |||
4136 | return 0; | 4607 | return 0; |
4137 | } | 4608 | } |
4138 | 4609 | ||
4139 | void print_asignment(LLFILE *fp, LLScriptExpression *exp) | 4610 | static void print_assignment(LLFILE *fp, LLScriptExpression *exp) |
4140 | { | 4611 | { |
4141 | LLScriptLValue *lvalue = (LLScriptLValue *)exp; | 4612 | LLScriptLValue *lvalue = (LLScriptLValue *)exp; |
4142 | LLScriptIdentifier *ident = lvalue->mIdentifier; | 4613 | LLScriptIdentifier *ident = lvalue->mIdentifier; |
@@ -4164,7 +4635,7 @@ void print_asignment(LLFILE *fp, LLScriptExpression *exp) | |||
4164 | } | 4635 | } |
4165 | } | 4636 | } |
4166 | 4637 | ||
4167 | void print_cil_asignment(LLFILE *fp, LLScriptExpression *exp, LLScriptScopeEntry* function_scope) | 4638 | static void print_cil_assignment(LLFILE *fp, LLScriptExpression *exp, LLScriptScopeEntry* function_scope) |
4168 | { | 4639 | { |
4169 | LLScriptLValue *lvalue = (LLScriptLValue *) exp; | 4640 | LLScriptLValue *lvalue = (LLScriptLValue *) exp; |
4170 | LLScriptIdentifier *ident = lvalue->mIdentifier; | 4641 | LLScriptIdentifier *ident = lvalue->mIdentifier; |
@@ -4191,7 +4662,7 @@ void print_cil_asignment(LLFILE *fp, LLScriptExpression *exp, LLScriptScopeEntry | |||
4191 | if(is_parameter(ident, function_scope)) | 4662 | if(is_parameter(ident, function_scope)) |
4192 | { | 4663 | { |
4193 | // Parameter, store by name. | 4664 | // Parameter, store by name. |
4194 | fprintf(fp, "starg.s %s\n", ident->mScopeEntry->mIdentifier); | 4665 | fprintf(fp, "starg.s '%s'\n", ident->mScopeEntry->mIdentifier); |
4195 | } | 4666 | } |
4196 | else | 4667 | else |
4197 | { | 4668 | { |
@@ -4319,14 +4790,6 @@ void store2stack(LLScriptExpression *exp, LLScriptExpression *lv, LLScriptByteCo | |||
4319 | chunk->addInteger(address); | 4790 | chunk->addInteger(address); |
4320 | } | 4791 | } |
4321 | 4792 | ||
4322 | void print_cil_numeric_cast(LLFILE* fp, LSCRIPTType currentArg, LSCRIPTType otherArg) | ||
4323 | { | ||
4324 | if((currentArg == LST_INTEGER) && (otherArg == LST_FLOATINGPOINT)) | ||
4325 | { | ||
4326 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | ||
4327 | } | ||
4328 | } | ||
4329 | |||
4330 | void LLScriptAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 4793 | void LLScriptAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
4331 | { | 4794 | { |
4332 | if (gErrorToText.getErrors()) | 4795 | if (gErrorToText.getErrors()) |
@@ -4344,7 +4807,7 @@ void LLScriptAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
4344 | { | 4807 | { |
4345 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 4808 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4346 | print_cast(fp, mReturnType, mRightType); | 4809 | print_cast(fp, mReturnType, mRightType); |
4347 | print_asignment(fp, mLValue); | 4810 | print_assignment(fp, mLValue); |
4348 | } | 4811 | } |
4349 | break; | 4812 | break; |
4350 | case LSCP_TYPE: | 4813 | case LSCP_TYPE: |
@@ -4370,8 +4833,8 @@ void LLScriptAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
4370 | { | 4833 | { |
4371 | print_cil_load_address(fp, mLValue, entry); | 4834 | print_cil_load_address(fp, mLValue, entry); |
4372 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 4835 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4373 | print_cil_numeric_cast(fp, mRightType, mReturnType); | 4836 | print_cil_assignment_cast(fp, mRightType, mReturnType); |
4374 | print_cil_asignment(fp, mLValue, entry); | 4837 | print_cil_assignment(fp, mLValue, entry); |
4375 | } | 4838 | } |
4376 | break; | 4839 | break; |
4377 | default: | 4840 | default: |
@@ -4387,8 +4850,15 @@ S32 LLScriptAssignment::getSize() | |||
4387 | return 0; | 4850 | return 0; |
4388 | } | 4851 | } |
4389 | 4852 | ||
4390 | void print_cil_add(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | 4853 | static void print_cil_add(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) |
4391 | { | 4854 | { |
4855 | if(LST_LIST == right_type && LST_LIST != left_type) | ||
4856 | { | ||
4857 | print_cil_box(fp, left_type); | ||
4858 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Prepend(class [mscorlib]System.Collections.ArrayList, object)\n"); | ||
4859 | return; | ||
4860 | } | ||
4861 | |||
4392 | switch(left_type) | 4862 | switch(left_type) |
4393 | { | 4863 | { |
4394 | case LST_INTEGER: | 4864 | case LST_INTEGER: |
@@ -4402,27 +4872,49 @@ void print_cil_add(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | |||
4402 | case LST_KEY: | 4872 | case LST_KEY: |
4403 | 4873 | ||
4404 | // String concatenation. | 4874 | // String concatenation. |
4405 | fprintf(fp, "call string valuetype [mscorlib]System.String::Concat(string, string)"); | 4875 | fprintf(fp, "call string valuetype [LslUserScript]LindenLab.SecondLife.LslUserScript::Add(string, string)\n"); |
4406 | break; | 4876 | break; |
4407 | 4877 | ||
4408 | case LST_VECTOR: | 4878 | case LST_VECTOR: |
4409 | 4879 | ||
4410 | // Vector addition. | 4880 | // Vector addition. |
4411 | // TODO: Inline (requires temporary variables, which must be identified in earlier pass). | 4881 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Add'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); |
4412 | fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'add_vec'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLVector)\n"); | ||
4413 | break; | 4882 | break; |
4414 | 4883 | ||
4415 | case LST_QUATERNION: | 4884 | case LST_QUATERNION: |
4416 | 4885 | ||
4417 | // Rotation addition. | 4886 | // Rotation addition. |
4418 | // TODO: Inline (requires temporary variables, which must be identified in earlier pass). | 4887 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Add'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); |
4419 | fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'add_quat'(valuetype [LScriptLibrary]LLQuaternion, valuetype [LScriptLibrary]LLQuaternion)\n"); | ||
4420 | break; | 4888 | break; |
4421 | 4889 | ||
4422 | case LST_LIST: | 4890 | case LST_LIST: |
4423 | print_cil_box(fp, right_type); | 4891 | switch(right_type) |
4424 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LScriptLibrary]LScriptInternal::AddReturnList(class [mscorlib]System.Collections.ArrayList, object)\n"); | 4892 | { |
4425 | break; | 4893 | case LST_LIST: |
4894 | // Concatenate lists. | ||
4895 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(class [mscorlib]System.Collections.ArrayList, class [mscorlib]System.Collections.ArrayList)\n"); | ||
4896 | break; | ||
4897 | case LST_INTEGER: | ||
4898 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(int32, class [mscorlib]System.Collections.ArrayList)\n"); | ||
4899 | break; | ||
4900 | case LST_FLOATINGPOINT: | ||
4901 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(float32, class [mscorlib]System.Collections.ArrayList)\n"); | ||
4902 | break; | ||
4903 | case LST_STRING: | ||
4904 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(string, class [mscorlib]System.Collections.ArrayList)\n"); | ||
4905 | break; | ||
4906 | case LST_KEY: | ||
4907 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(valuetype [ScriptTypes]LindenLab.SecondLife.Key, class [mscorlib]System.Collections.ArrayList)\n"); | ||
4908 | break; | ||
4909 | case LST_VECTOR: | ||
4910 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(valuetype [ScriptTypes]LindenLab.SecondLife.Vector, class [mscorlib]System.Collections.ArrayList)\n"); | ||
4911 | break; | ||
4912 | case LST_QUATERNION: | ||
4913 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(valuetype [ScriptTypes]LindenLab.SecondLife.Quaternion, class [mscorlib]System.Collections.ArrayList)\n"); | ||
4914 | break; | ||
4915 | default: | ||
4916 | break; | ||
4917 | } | ||
4426 | 4918 | ||
4427 | default: | 4919 | default: |
4428 | break; | 4920 | break; |
@@ -4447,7 +4939,7 @@ void LLScriptAddAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4447 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 4939 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4448 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 4940 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4449 | fprintf(fp, "ADD %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); | 4941 | fprintf(fp, "ADD %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); |
4450 | print_asignment(fp, mLValue); | 4942 | print_assignment(fp, mLValue); |
4451 | } | 4943 | } |
4452 | break; | 4944 | break; |
4453 | case LSCP_TYPE: | 4945 | case LSCP_TYPE: |
@@ -4475,12 +4967,12 @@ void LLScriptAddAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4475 | case LSCP_EMIT_CIL_ASSEMBLY: | 4967 | case LSCP_EMIT_CIL_ASSEMBLY: |
4476 | { | 4968 | { |
4477 | print_cil_load_address(fp, mLValue, entry); | 4969 | print_cil_load_address(fp, mLValue, entry); |
4478 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
4479 | print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); | ||
4480 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 4970 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4481 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); | 4971 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); |
4972 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
4973 | print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); | ||
4482 | print_cil_add(fp, mLValue->mReturnType, mRightSide->mReturnType); | 4974 | print_cil_add(fp, mLValue->mReturnType, mRightSide->mReturnType); |
4483 | print_cil_asignment(fp, mLValue, entry); | 4975 | print_cil_assignment(fp, mLValue, entry); |
4484 | } | 4976 | } |
4485 | break; | 4977 | break; |
4486 | default: | 4978 | default: |
@@ -4496,29 +4988,30 @@ S32 LLScriptAddAssignment::getSize() | |||
4496 | return 0; | 4988 | return 0; |
4497 | } | 4989 | } |
4498 | 4990 | ||
4499 | void print_cil_sub(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | 4991 | static void print_cil_sub(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) |
4500 | { | 4992 | { |
4501 | switch(left_type) | 4993 | switch(left_type) |
4502 | { | 4994 | { |
4503 | case LST_INTEGER: | 4995 | case LST_INTEGER: |
4996 | if(LST_INTEGER == right_type) | ||
4997 | { | ||
4998 | fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::Subtract(int32, int32)\n"); | ||
4999 | break; | ||
5000 | } | ||
4504 | case LST_FLOATINGPOINT: | 5001 | case LST_FLOATINGPOINT: |
4505 | |||
4506 | // Numeric subtraction. | 5002 | // Numeric subtraction. |
4507 | fprintf(fp, "sub\n"); | 5003 | fprintf(fp, "call float64 [LslUserScript]LindenLab.SecondLife.LslUserScript::Subtract(float64, float64)\n"); |
4508 | break; | 5004 | break; |
4509 | |||
4510 | case LST_VECTOR: | 5005 | case LST_VECTOR: |
4511 | 5006 | ||
4512 | // Vector subtraction. | 5007 | // Vector subtraction. |
4513 | // TODO: Inline (requires temporary variables, which must be identified in earlier pass). | 5008 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Subtract'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); |
4514 | fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'subtract_vec'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLVector)\n"); | ||
4515 | break; | 5009 | break; |
4516 | 5010 | ||
4517 | case LST_QUATERNION: | 5011 | case LST_QUATERNION: |
4518 | 5012 | ||
4519 | // Rotation subtraction. | 5013 | // Rotation subtraction. |
4520 | // TODO: Inline (requires temporary variables, which must be identified in earlier pass). | 5014 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Subtract'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); |
4521 | fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'subtract_quat'(valuetype [LScriptLibrary]LLQuaternion, valuetype [LScriptLibrary]LLQuaternion)\n"); | ||
4522 | break; | 5015 | break; |
4523 | 5016 | ||
4524 | default: | 5017 | default: |
@@ -4546,7 +5039,7 @@ void LLScriptSubAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4546 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5039 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4547 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5040 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4548 | fprintf(fp, "SUB %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); | 5041 | fprintf(fp, "SUB %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); |
4549 | print_asignment(fp, mLValue); | 5042 | print_assignment(fp, mLValue); |
4550 | } | 5043 | } |
4551 | break; | 5044 | break; |
4552 | case LSCP_TYPE: | 5045 | case LSCP_TYPE: |
@@ -4574,12 +5067,12 @@ void LLScriptSubAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4574 | case LSCP_EMIT_CIL_ASSEMBLY: | 5067 | case LSCP_EMIT_CIL_ASSEMBLY: |
4575 | { | 5068 | { |
4576 | print_cil_load_address(fp, mLValue, entry); | 5069 | print_cil_load_address(fp, mLValue, entry); |
4577 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
4578 | print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); | ||
4579 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5070 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4580 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); | 5071 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); |
5072 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5073 | print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); | ||
4581 | print_cil_sub(fp, mLValue->mReturnType, mRightSide->mReturnType); | 5074 | print_cil_sub(fp, mLValue->mReturnType, mRightSide->mReturnType); |
4582 | print_cil_asignment(fp, mLValue, entry); | 5075 | print_cil_assignment(fp, mLValue, entry); |
4583 | } | 5076 | } |
4584 | break; | 5077 | break; |
4585 | default: | 5078 | default: |
@@ -4595,41 +5088,93 @@ S32 LLScriptSubAssignment::getSize() | |||
4595 | return 0; | 5088 | return 0; |
4596 | } | 5089 | } |
4597 | 5090 | ||
4598 | void print_cil_mul(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | 5091 | static void print_cil_neg(LLFILE* fp, LSCRIPTType type) |
4599 | { | 5092 | { |
4600 | switch(left_type) | 5093 | switch(type) |
4601 | { | 5094 | { |
4602 | case LST_INTEGER: | 5095 | case LST_INTEGER: |
4603 | case LST_FLOATINGPOINT: | 5096 | case LST_FLOATINGPOINT: |
5097 | fprintf(fp, "neg\n"); | ||
5098 | break; | ||
5099 | case LST_VECTOR: | ||
5100 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Negate'(class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); | ||
5101 | break; | ||
5102 | case LST_QUATERNION: | ||
5103 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Negate'(class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); | ||
5104 | break; | ||
5105 | default: | ||
5106 | break; | ||
5107 | } | ||
5108 | } | ||
4604 | 5109 | ||
4605 | // Numeric multiplication. | 5110 | static void print_cil_mul(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) |
4606 | fprintf(fp, "mul\n"); | 5111 | { |
5112 | switch(left_type) | ||
5113 | { | ||
5114 | case LST_INTEGER: | ||
5115 | |||
5116 | switch(right_type) | ||
5117 | { | ||
5118 | case LST_INTEGER: | ||
5119 | case LST_FLOATINGPOINT: | ||
5120 | |||
5121 | // Numeric multiplication. | ||
5122 | fprintf(fp, "mul\n"); | ||
5123 | break; | ||
5124 | |||
5125 | case LST_VECTOR: | ||
5126 | |||
5127 | // Vector scaling. | ||
5128 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(class [ScriptTypes]LindenLab.SecondLife.Vector, float32)\n"); | ||
5129 | break; | ||
5130 | default: | ||
5131 | break; | ||
5132 | } | ||
4607 | break; | 5133 | break; |
4608 | 5134 | ||
4609 | case LST_VECTOR: | 5135 | case LST_FLOATINGPOINT: |
4610 | 5136 | ||
4611 | switch(right_type) | 5137 | switch(right_type) |
4612 | { | 5138 | { |
4613 | case LST_INTEGER: | 5139 | case LST_INTEGER: |
5140 | case LST_FLOATINGPOINT: | ||
4614 | 5141 | ||
4615 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | 5142 | // Numeric multiplication. |
5143 | fprintf(fp, "mul\n"); | ||
5144 | break; | ||
5145 | |||
5146 | case LST_VECTOR: | ||
5147 | |||
5148 | // Vector scaling. | ||
5149 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(class [ScriptTypes]LindenLab.SecondLife.Vector, float32)\n"); | ||
5150 | break; | ||
5151 | |||
5152 | default: | ||
5153 | break; | ||
5154 | } | ||
5155 | break; | ||
5156 | |||
5157 | case LST_VECTOR: | ||
4616 | 5158 | ||
5159 | switch(right_type) | ||
5160 | { | ||
5161 | case LST_INTEGER: | ||
4617 | case LST_FLOATINGPOINT: | 5162 | case LST_FLOATINGPOINT: |
4618 | 5163 | ||
4619 | // Vector scaling. | 5164 | // Vector scaling. |
4620 | fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'multiply_float'(valuetype [LScriptLibrary]LLVector, float32)\n"); | 5165 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(float32, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); |
4621 | break; | 5166 | break; |
4622 | 5167 | ||
4623 | case LST_VECTOR: | 5168 | case LST_VECTOR: |
4624 | 5169 | ||
4625 | // Dot product. | 5170 | // Dot product. |
4626 | fprintf(fp, "call float32 valuetype [LScriptLibrary]LLVector::'multiply_vec'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLVector)\n"); | 5171 | fprintf(fp, "call float32 class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); |
4627 | break; | 5172 | break; |
4628 | 5173 | ||
4629 | case LST_QUATERNION: | 5174 | case LST_QUATERNION: |
4630 | 5175 | ||
4631 | // Vector rotation. | 5176 | // Vector rotation. |
4632 | fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'multiply_quat'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLQuaternion)\n"); | 5177 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); |
4633 | break; | 5178 | break; |
4634 | 5179 | ||
4635 | default: | 5180 | default: |
@@ -4640,7 +5185,7 @@ void print_cil_mul(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | |||
4640 | case LST_QUATERNION: | 5185 | case LST_QUATERNION: |
4641 | 5186 | ||
4642 | // Rotation multiplication. | 5187 | // Rotation multiplication. |
4643 | fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'multiply_quat'(valuetype [LScriptLibrary]LLQuaternion, valuetype [LScriptLibrary]LLQuaternion)\n"); | 5188 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); |
4644 | break; | 5189 | break; |
4645 | 5190 | ||
4646 | default: | 5191 | default: |
@@ -4668,7 +5213,7 @@ void LLScriptMulAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4668 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5213 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4669 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5214 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4670 | fprintf(fp, "MUL %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); | 5215 | fprintf(fp, "MUL %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); |
4671 | print_asignment(fp, mLValue); | 5216 | print_assignment(fp, mLValue); |
4672 | } | 5217 | } |
4673 | break; | 5218 | break; |
4674 | case LSCP_TYPE: | 5219 | case LSCP_TYPE: |
@@ -4677,7 +5222,7 @@ void LLScriptMulAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4677 | mLeftType = type; | 5222 | mLeftType = type; |
4678 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5223 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4679 | mRightType = type; | 5224 | mRightType = type; |
4680 | if (!legal_binary_expression(mReturnType, mLeftType, mRightType, mType)) | 5225 | if (!legal_binary_expression(mReturnType, mLeftType, mRightType, mType) /*|| !legal_assignment(mLValue->mReturnType, mReturnType)*/) |
4681 | { | 5226 | { |
4682 | gErrorToText.writeError(fp, this, LSERROR_TYPE_MISMATCH); | 5227 | gErrorToText.writeError(fp, this, LSERROR_TYPE_MISMATCH); |
4683 | } | 5228 | } |
@@ -4696,12 +5241,17 @@ void LLScriptMulAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4696 | case LSCP_EMIT_CIL_ASSEMBLY: | 5241 | case LSCP_EMIT_CIL_ASSEMBLY: |
4697 | { | 5242 | { |
4698 | print_cil_load_address(fp, mLValue, entry); | 5243 | print_cil_load_address(fp, mLValue, entry); |
4699 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
4700 | print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); | ||
4701 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5244 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4702 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); | 5245 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); |
5246 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5247 | print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); | ||
4703 | print_cil_mul(fp, mLValue->mReturnType, mRightSide->mReturnType); | 5248 | print_cil_mul(fp, mLValue->mReturnType, mRightSide->mReturnType); |
4704 | print_cil_asignment(fp, mLValue, entry); | 5249 | if((mLValue->mReturnType == LST_INTEGER) && |
5250 | (mRightSide->mReturnType == LST_FLOATINGPOINT)) | ||
5251 | { | ||
5252 | print_cil_cast(fp, LST_FLOATINGPOINT, LST_INTEGER); | ||
5253 | } | ||
5254 | print_cil_assignment(fp, mLValue, entry); | ||
4705 | } | 5255 | } |
4706 | break; | 5256 | break; |
4707 | default: | 5257 | default: |
@@ -4717,15 +5267,20 @@ S32 LLScriptMulAssignment::getSize() | |||
4717 | return 0; | 5267 | return 0; |
4718 | } | 5268 | } |
4719 | 5269 | ||
4720 | void print_cil_div(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | 5270 | static void print_cil_div(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) |
4721 | { | 5271 | { |
4722 | switch(left_type) | 5272 | switch(left_type) |
4723 | { | 5273 | { |
4724 | case LST_INTEGER: | 5274 | case LST_INTEGER: |
5275 | if(LST_INTEGER == right_type) | ||
5276 | { | ||
5277 | fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::Divide(int32, int32)\n"); | ||
5278 | break; | ||
5279 | } | ||
4725 | case LST_FLOATINGPOINT: | 5280 | case LST_FLOATINGPOINT: |
4726 | 5281 | ||
4727 | // Numeric addition. | 5282 | // Numeric division. |
4728 | fprintf(fp, "div\n"); | 5283 | fprintf(fp, "call float64 [LslUserScript]LindenLab.SecondLife.LslUserScript::Divide(float64, float64)\n"); |
4729 | break; | 5284 | break; |
4730 | 5285 | ||
4731 | case LST_VECTOR: | 5286 | case LST_VECTOR: |
@@ -4733,19 +5288,16 @@ void print_cil_div(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | |||
4733 | switch(right_type) | 5288 | switch(right_type) |
4734 | { | 5289 | { |
4735 | case LST_INTEGER: | 5290 | case LST_INTEGER: |
4736 | |||
4737 | print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); | ||
4738 | |||
4739 | case LST_FLOATINGPOINT: | 5291 | case LST_FLOATINGPOINT: |
4740 | 5292 | ||
4741 | // Scale. | 5293 | // Scale. |
4742 | fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'divide_float'(valuetype [LScriptLibrary]LLVector, float32)\n"); | 5294 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Divide'(float32, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); |
4743 | break; | 5295 | break; |
4744 | 5296 | ||
4745 | case LST_QUATERNION: | 5297 | case LST_QUATERNION: |
4746 | 5298 | ||
4747 | // Inverse rotation. | 5299 | // Inverse rotation. |
4748 | fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'divide_quat'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLQuaternion)\n"); | 5300 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Divide'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); |
4749 | break; | 5301 | break; |
4750 | 5302 | ||
4751 | default: | 5303 | default: |
@@ -4755,7 +5307,7 @@ void print_cil_div(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | |||
4755 | 5307 | ||
4756 | case LST_QUATERNION: | 5308 | case LST_QUATERNION: |
4757 | 5309 | ||
4758 | fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'divide_quat'(valuetype [LScriptLibrary]LLQuaternion, valuetype [LScriptLibrary]LLQuaternion)\n"); | 5310 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Divide'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); |
4759 | break; | 5311 | break; |
4760 | 5312 | ||
4761 | default: | 5313 | default: |
@@ -4783,7 +5335,7 @@ void LLScriptDivAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4783 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5335 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4784 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5336 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4785 | fprintf(fp, "DIV %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); | 5337 | fprintf(fp, "DIV %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); |
4786 | print_asignment(fp, mLValue); | 5338 | print_assignment(fp, mLValue); |
4787 | } | 5339 | } |
4788 | break; | 5340 | break; |
4789 | case LSCP_TYPE: | 5341 | case LSCP_TYPE: |
@@ -4811,12 +5363,12 @@ void LLScriptDivAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4811 | case LSCP_EMIT_CIL_ASSEMBLY: | 5363 | case LSCP_EMIT_CIL_ASSEMBLY: |
4812 | { | 5364 | { |
4813 | print_cil_load_address(fp, mLValue, entry); | 5365 | print_cil_load_address(fp, mLValue, entry); |
4814 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
4815 | print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); | ||
4816 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5366 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4817 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); | 5367 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); |
5368 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5369 | print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); | ||
4818 | print_cil_div(fp, mLValue->mReturnType, mRightSide->mReturnType); | 5370 | print_cil_div(fp, mLValue->mReturnType, mRightSide->mReturnType); |
4819 | print_cil_asignment(fp, mLValue, entry); | 5371 | print_cil_assignment(fp, mLValue, entry); |
4820 | } | 5372 | } |
4821 | break; | 5373 | break; |
4822 | default: | 5374 | default: |
@@ -4832,20 +5384,20 @@ S32 LLScriptDivAssignment::getSize() | |||
4832 | return 0; | 5384 | return 0; |
4833 | } | 5385 | } |
4834 | 5386 | ||
4835 | void print_cil_mod(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | 5387 | static void print_cil_mod(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) |
4836 | { | 5388 | { |
4837 | switch(left_type) | 5389 | switch(left_type) |
4838 | { | 5390 | { |
4839 | case LST_INTEGER: | 5391 | case LST_INTEGER: |
4840 | 5392 | ||
4841 | // Numeric remainder. | 5393 | // Numeric remainder. |
4842 | fprintf(fp, "rem\n"); | 5394 | fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::Modulo(int32, int32)\n"); |
4843 | break; | 5395 | break; |
4844 | 5396 | ||
4845 | case LST_VECTOR: | 5397 | case LST_VECTOR: |
4846 | 5398 | ||
4847 | // Vector cross product. | 5399 | // Vector cross product. |
4848 | fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'mod_vec'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLVector)\n"); | 5400 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Modulo'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); |
4849 | break; | 5401 | break; |
4850 | 5402 | ||
4851 | default: | 5403 | default: |
@@ -4873,7 +5425,7 @@ void LLScriptModAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4873 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5425 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4874 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5426 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
4875 | fprintf(fp, "MOD %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); | 5427 | fprintf(fp, "MOD %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); |
4876 | print_asignment(fp, mLValue); | 5428 | print_assignment(fp, mLValue); |
4877 | } | 5429 | } |
4878 | break; | 5430 | break; |
4879 | case LSCP_TYPE: | 5431 | case LSCP_TYPE: |
@@ -4901,10 +5453,10 @@ void LLScriptModAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
4901 | case LSCP_EMIT_CIL_ASSEMBLY: | 5453 | case LSCP_EMIT_CIL_ASSEMBLY: |
4902 | { | 5454 | { |
4903 | print_cil_load_address(fp, mLValue, entry); | 5455 | print_cil_load_address(fp, mLValue, entry); |
4904 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
4905 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5456 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5457 | mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
4906 | print_cil_mod(fp, mLValue->mReturnType, mRightSide->mReturnType); | 5458 | print_cil_mod(fp, mLValue->mReturnType, mRightSide->mReturnType); |
4907 | print_cil_asignment(fp, mLValue, entry); | 5459 | print_cil_assignment(fp, mLValue, entry); |
4908 | } | 5460 | } |
4909 | break; | 5461 | break; |
4910 | default: | 5462 | default: |
@@ -4920,9 +5472,10 @@ S32 LLScriptModAssignment::getSize() | |||
4920 | return 0; | 5472 | return 0; |
4921 | } | 5473 | } |
4922 | 5474 | ||
4923 | void print_cil_eq(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | 5475 | static void print_cil_eq(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) |
4924 | { | 5476 | { |
4925 | switch(left_type) | 5477 | |
5478 | switch(right_type) | ||
4926 | { | 5479 | { |
4927 | case LST_INTEGER: | 5480 | case LST_INTEGER: |
4928 | case LST_FLOATINGPOINT: | 5481 | case LST_FLOATINGPOINT: |
@@ -4932,26 +5485,36 @@ void print_cil_eq(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) | |||
4932 | break; | 5485 | break; |
4933 | 5486 | ||
4934 | case LST_STRING: | 5487 | case LST_STRING: |
4935 | case LST_KEY: | 5488 | // NOTE: babbage: strings and keys can be compared, so a cast |
4936 | 5489 | // may be required | |
5490 | print_cil_cast(fp, left_type, right_type); | ||
4937 | // String equality. | 5491 | // String equality. |
4938 | fprintf(fp, "call bool valuetype [mscorlib]System.String::op_Equality(string, string)\n"); | 5492 | fprintf(fp, "call bool valuetype [mscorlib]System.String::op_Equality(string, string)\n"); |
4939 | break; | 5493 | break; |
5494 | |||
5495 | case LST_KEY: | ||
5496 | // NOTE: babbage: strings and keys can be compared, so a cast | ||
5497 | // may be required | ||
5498 | print_cil_cast(fp, left_type, right_type); | ||
5499 | |||
5500 | // Key equality. | ||
5501 | fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::'Equals'(valuetype [ScriptTypes]LindenLab.SecondLife.Key, valuetype [ScriptTypes]LindenLab.SecondLife.Key)\n"); | ||
5502 | break; | ||
4940 | 5503 | ||
4941 | case LST_VECTOR: | 5504 | case LST_VECTOR: |
4942 | 5505 | ||
4943 | // Vector equality. | 5506 | // Vector equality. |
4944 | fprintf(fp, "call bool [LScriptLibrary]LLVector::'equals_vec'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLVector)\n"); | 5507 | fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::'Equals'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); |
4945 | break; | 5508 | break; |
4946 | 5509 | ||
4947 | case LST_QUATERNION: | 5510 | case LST_QUATERNION: |
4948 | 5511 | ||
4949 | // Rotation equality. | 5512 | // Rotation equality. |
4950 | fprintf(fp, "call bool [LScriptLibrary]LLQuaternion::'equals_quat'(valuetype [LScriptLibrary]LLQuaternion, valuetype [LScriptLibrary]LLQuaternion)\n"); | 5513 | fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::'Equals'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); |
4951 | break; | 5514 | break; |
4952 | 5515 | ||
4953 | case LST_LIST: | 5516 | case LST_LIST: |
4954 | fprintf(fp, "call bool [LScriptLibrary]LScriptInternal::EqualsList(class [mscorlib]System.Collections.ArrayList, class [mscorlib]System.Collections.ArrayList)\n"); | 5517 | fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::Equals(class [mscorlib]System.Collections.ArrayList, class [mscorlib]System.Collections.ArrayList)\n"); |
4955 | break; | 5518 | break; |
4956 | 5519 | ||
4957 | default: | 5520 | default: |
@@ -5002,10 +5565,10 @@ void LLScriptEquality::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile | |||
5002 | } | 5565 | } |
5003 | break; | 5566 | break; |
5004 | case LSCP_EMIT_CIL_ASSEMBLY: | 5567 | case LSCP_EMIT_CIL_ASSEMBLY: |
5005 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5006 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5007 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5568 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5008 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); | 5569 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); |
5570 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5571 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5009 | print_cil_eq(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | 5572 | print_cil_eq(fp, mLeftSide->mReturnType, mRightSide->mReturnType); |
5010 | break; | 5573 | break; |
5011 | default: | 5574 | default: |
@@ -5063,10 +5626,19 @@ void LLScriptNotEquals::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil | |||
5063 | break; | 5626 | break; |
5064 | case LSCP_EMIT_CIL_ASSEMBLY: | 5627 | case LSCP_EMIT_CIL_ASSEMBLY: |
5065 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5628 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5629 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); | ||
5066 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5630 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5067 | fprintf(fp, "ceq\n"); | 5631 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); |
5068 | fprintf(fp, "ldc.i4.0\n"); | 5632 | if (LST_LIST == mLeftSide->mReturnType) |
5069 | fprintf(fp, "ceq\n"); // Compare result of first compare equal with 0 to get compare not equal. | 5633 | { |
5634 | fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::NotEquals(class [mscorlib]System.Collections.ArrayList, class [mscorlib]System.Collections.ArrayList)\n"); | ||
5635 | } | ||
5636 | else | ||
5637 | { | ||
5638 | print_cil_eq(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5639 | fprintf(fp, "ldc.i4.0\n"); | ||
5640 | fprintf(fp, "ceq\n"); // Compare result of first compare equal with 0 to get compare not equal. | ||
5641 | } | ||
5070 | break; | 5642 | break; |
5071 | default: | 5643 | default: |
5072 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5644 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -5081,6 +5653,14 @@ S32 LLScriptNotEquals::getSize() | |||
5081 | return 0; | 5653 | return 0; |
5082 | } | 5654 | } |
5083 | 5655 | ||
5656 | static void print_cil_lte(LLFILE* fp) | ||
5657 | { | ||
5658 | // NOTE: LSL pushes operands backwards, so <= becomes >= | ||
5659 | fprintf(fp, "clt\n"); | ||
5660 | fprintf(fp, "ldc.i4.0\n"); | ||
5661 | fprintf(fp, "ceq\n"); | ||
5662 | } | ||
5663 | |||
5084 | void LLScriptLessEquals::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 5664 | void LLScriptLessEquals::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
5085 | { | 5665 | { |
5086 | if (gErrorToText.getErrors()) | 5666 | if (gErrorToText.getErrors()) |
@@ -5122,11 +5702,11 @@ void LLScriptLessEquals::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
5122 | } | 5702 | } |
5123 | break; | 5703 | break; |
5124 | case LSCP_EMIT_CIL_ASSEMBLY: | 5704 | case LSCP_EMIT_CIL_ASSEMBLY: |
5125 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5126 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5705 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5127 | fprintf(fp, "cgt\n"); // Test greater than. | 5706 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); |
5128 | fprintf(fp, "ldc.i4.0\n"); // Use (b == 0) implementation of boolean not. | 5707 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5129 | fprintf(fp, "ceq\n"); // Apply boolean not to greater than. If not greater than, then less or equal. | 5708 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); |
5709 | print_cil_lte(fp); | ||
5130 | break; | 5710 | break; |
5131 | default: | 5711 | default: |
5132 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5712 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -5141,6 +5721,14 @@ S32 LLScriptLessEquals::getSize() | |||
5141 | return 0; | 5721 | return 0; |
5142 | } | 5722 | } |
5143 | 5723 | ||
5724 | static void print_cil_gte(LLFILE* fp) | ||
5725 | { | ||
5726 | // NOTE: LSL pushes operands backwards, so >= becomes <= | ||
5727 | fprintf(fp, "cgt\n"); | ||
5728 | fprintf(fp, "ldc.i4.0\n"); | ||
5729 | fprintf(fp, "ceq\n"); | ||
5730 | } | ||
5731 | |||
5144 | void LLScriptGreaterEquals::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 5732 | void LLScriptGreaterEquals::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
5145 | { | 5733 | { |
5146 | if (gErrorToText.getErrors()) | 5734 | if (gErrorToText.getErrors()) |
@@ -5182,11 +5770,11 @@ void LLScriptGreaterEquals::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
5182 | } | 5770 | } |
5183 | break; | 5771 | break; |
5184 | case LSCP_EMIT_CIL_ASSEMBLY: | 5772 | case LSCP_EMIT_CIL_ASSEMBLY: |
5185 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5186 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5773 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5187 | fprintf(fp, "clt\n"); // Test less than. | 5774 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); |
5188 | fprintf(fp, "ldc.i4.0\n"); // Use (b == 0) implementation of boolean not. | 5775 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5189 | fprintf(fp, "ceq\n"); // Apply boolean not to less than. If not less than, then greater or equal. | 5776 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); |
5777 | print_cil_gte(fp); | ||
5190 | break; | 5778 | break; |
5191 | default: | 5779 | default: |
5192 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5780 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -5201,6 +5789,12 @@ S32 LLScriptGreaterEquals::getSize() | |||
5201 | return 0; | 5789 | return 0; |
5202 | } | 5790 | } |
5203 | 5791 | ||
5792 | static void print_cil_lt(LLFILE* fp) | ||
5793 | { | ||
5794 | // NOTE: LSL pushes operands backwards, so < becomes > | ||
5795 | fprintf(fp, "cgt\n"); | ||
5796 | } | ||
5797 | |||
5204 | void LLScriptLessThan::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 5798 | void LLScriptLessThan::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
5205 | { | 5799 | { |
5206 | if (gErrorToText.getErrors()) | 5800 | if (gErrorToText.getErrors()) |
@@ -5242,9 +5836,11 @@ void LLScriptLessThan::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile | |||
5242 | } | 5836 | } |
5243 | break; | 5837 | break; |
5244 | case LSCP_EMIT_CIL_ASSEMBLY: | 5838 | case LSCP_EMIT_CIL_ASSEMBLY: |
5245 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5246 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5839 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5247 | fprintf(fp, "clt\n"); | 5840 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); |
5841 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5842 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5843 | print_cil_lt(fp); | ||
5248 | break; | 5844 | break; |
5249 | default: | 5845 | default: |
5250 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5846 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -5259,6 +5855,12 @@ S32 LLScriptLessThan::getSize() | |||
5259 | return 0; | 5855 | return 0; |
5260 | } | 5856 | } |
5261 | 5857 | ||
5858 | static void print_cil_gt(LLFILE* fp) | ||
5859 | { | ||
5860 | // NOTE: LSL pushes operands backwards, so > becomes < | ||
5861 | fprintf(fp, "clt\n"); | ||
5862 | } | ||
5863 | |||
5262 | void LLScriptGreaterThan::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 5864 | void LLScriptGreaterThan::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
5263 | { | 5865 | { |
5264 | if (gErrorToText.getErrors()) | 5866 | if (gErrorToText.getErrors()) |
@@ -5300,9 +5902,11 @@ void LLScriptGreaterThan::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
5300 | } | 5902 | } |
5301 | break; | 5903 | break; |
5302 | case LSCP_EMIT_CIL_ASSEMBLY: | 5904 | case LSCP_EMIT_CIL_ASSEMBLY: |
5303 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5304 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5905 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5305 | fprintf(fp, "cgt\n"); | 5906 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); |
5907 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5908 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5909 | print_cil_gt(fp); | ||
5306 | break; | 5910 | break; |
5307 | default: | 5911 | default: |
5308 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5912 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -5358,10 +5962,10 @@ void LLScriptPlus::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass | |||
5358 | } | 5962 | } |
5359 | break; | 5963 | break; |
5360 | case LSCP_EMIT_CIL_ASSEMBLY: | 5964 | case LSCP_EMIT_CIL_ASSEMBLY: |
5361 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5362 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5363 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 5965 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5364 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); | 5966 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); |
5967 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5968 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5365 | print_cil_add(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | 5969 | print_cil_add(fp, mLeftSide->mReturnType, mRightSide->mReturnType); |
5366 | break; | 5970 | break; |
5367 | default: | 5971 | default: |
@@ -5418,10 +6022,10 @@ void LLScriptMinus::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas | |||
5418 | } | 6022 | } |
5419 | break; | 6023 | break; |
5420 | case LSCP_EMIT_CIL_ASSEMBLY: | 6024 | case LSCP_EMIT_CIL_ASSEMBLY: |
5421 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5422 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5423 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6025 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5424 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); | 6026 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); |
6027 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
6028 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5425 | print_cil_sub(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | 6029 | print_cil_sub(fp, mLeftSide->mReturnType, mRightSide->mReturnType); |
5426 | break; | 6030 | break; |
5427 | default: | 6031 | default: |
@@ -5478,10 +6082,10 @@ void LLScriptTimes::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas | |||
5478 | } | 6082 | } |
5479 | break; | 6083 | break; |
5480 | case LSCP_EMIT_CIL_ASSEMBLY: | 6084 | case LSCP_EMIT_CIL_ASSEMBLY: |
5481 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5482 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5483 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6085 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5484 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); | 6086 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); |
6087 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
6088 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5485 | print_cil_mul(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | 6089 | print_cil_mul(fp, mLeftSide->mReturnType, mRightSide->mReturnType); |
5486 | break; | 6090 | break; |
5487 | default: | 6091 | default: |
@@ -5538,10 +6142,10 @@ void LLScriptDivide::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa | |||
5538 | } | 6142 | } |
5539 | break; | 6143 | break; |
5540 | case LSCP_EMIT_CIL_ASSEMBLY: | 6144 | case LSCP_EMIT_CIL_ASSEMBLY: |
5541 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5542 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5543 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6145 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5544 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); | 6146 | print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); |
6147 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
6148 | print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | ||
5545 | print_cil_div(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | 6149 | print_cil_div(fp, mLeftSide->mReturnType, mRightSide->mReturnType); |
5546 | break; | 6150 | break; |
5547 | default: | 6151 | default: |
@@ -5598,8 +6202,8 @@ void LLScriptMod::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass | |||
5598 | } | 6202 | } |
5599 | break; | 6203 | break; |
5600 | case LSCP_EMIT_CIL_ASSEMBLY: | 6204 | case LSCP_EMIT_CIL_ASSEMBLY: |
5601 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5602 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6205 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6206 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5603 | print_cil_mod(fp, mLeftSide->mReturnType, mRightSide->mReturnType); | 6207 | print_cil_mod(fp, mLeftSide->mReturnType, mRightSide->mReturnType); |
5604 | break; | 6208 | break; |
5605 | default: | 6209 | default: |
@@ -5654,8 +6258,8 @@ void LLScriptBitAnd::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa | |||
5654 | } | 6258 | } |
5655 | break; | 6259 | break; |
5656 | case LSCP_EMIT_CIL_ASSEMBLY: | 6260 | case LSCP_EMIT_CIL_ASSEMBLY: |
5657 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5658 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6261 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6262 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5659 | fprintf(fp, "and\n"); | 6263 | fprintf(fp, "and\n"); |
5660 | break; | 6264 | break; |
5661 | default: | 6265 | default: |
@@ -5710,8 +6314,8 @@ void LLScriptBitOr::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas | |||
5710 | } | 6314 | } |
5711 | break; | 6315 | break; |
5712 | case LSCP_EMIT_CIL_ASSEMBLY: | 6316 | case LSCP_EMIT_CIL_ASSEMBLY: |
5713 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5714 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6317 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6318 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5715 | fprintf(fp, "or\n"); | 6319 | fprintf(fp, "or\n"); |
5716 | break; | 6320 | break; |
5717 | default: | 6321 | default: |
@@ -5766,8 +6370,8 @@ void LLScriptBitXor::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa | |||
5766 | } | 6370 | } |
5767 | break; | 6371 | break; |
5768 | case LSCP_EMIT_CIL_ASSEMBLY: | 6372 | case LSCP_EMIT_CIL_ASSEMBLY: |
5769 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5770 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6373 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6374 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5771 | fprintf(fp, "xor\n"); | 6375 | fprintf(fp, "xor\n"); |
5772 | break; | 6376 | break; |
5773 | default: | 6377 | default: |
@@ -5822,9 +6426,15 @@ void LLScriptBooleanAnd::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
5822 | } | 6426 | } |
5823 | break; | 6427 | break; |
5824 | case LSCP_EMIT_CIL_ASSEMBLY: | 6428 | case LSCP_EMIT_CIL_ASSEMBLY: |
5825 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5826 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6429 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5827 | fprintf(fp, "and\n"); | 6430 | fprintf(fp, "ldc.i4.0\n"); |
6431 | fprintf(fp, "ceq\n"); | ||
6432 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
6433 | fprintf(fp, "ldc.i4.0\n"); | ||
6434 | fprintf(fp, "ceq\n"); | ||
6435 | fprintf(fp, "or\n"); | ||
6436 | fprintf(fp, "ldc.i4.0\n"); | ||
6437 | fprintf(fp, "ceq\n"); | ||
5828 | break; | 6438 | break; |
5829 | default: | 6439 | default: |
5830 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6440 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -5881,6 +6491,10 @@ void LLScriptBooleanOr::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil | |||
5881 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6491 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5882 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6492 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5883 | fprintf(fp, "or\n"); | 6493 | fprintf(fp, "or\n"); |
6494 | fprintf(fp, "ldc.i4.0\n"); | ||
6495 | fprintf(fp, "ceq\n"); | ||
6496 | fprintf(fp, "ldc.i4.0\n"); | ||
6497 | fprintf(fp, "ceq\n"); | ||
5884 | break; | 6498 | break; |
5885 | default: | 6499 | default: |
5886 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6500 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -5934,9 +6548,9 @@ void LLScriptShiftLeft::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil | |||
5934 | } | 6548 | } |
5935 | break; | 6549 | break; |
5936 | case LSCP_EMIT_CIL_ASSEMBLY: | 6550 | case LSCP_EMIT_CIL_ASSEMBLY: |
5937 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5938 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6551 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5939 | fprintf(fp, "shl\n"); | 6552 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6553 | fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::ShiftLeft(int32, int32)\n"); | ||
5940 | break; | 6554 | break; |
5941 | default: | 6555 | default: |
5942 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6556 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -5991,9 +6605,9 @@ void LLScriptShiftRight::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
5991 | } | 6605 | } |
5992 | break; | 6606 | break; |
5993 | case LSCP_EMIT_CIL_ASSEMBLY: | 6607 | case LSCP_EMIT_CIL_ASSEMBLY: |
5994 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
5995 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6608 | mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
5996 | fprintf(fp, "shr\n"); | 6609 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6610 | fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::ShiftRight(int32, int32)\n"); | ||
5997 | break; | 6611 | break; |
5998 | default: | 6612 | default: |
5999 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6613 | mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -6076,6 +6690,12 @@ void LLScriptUnaryMinus::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi | |||
6076 | chunk->addByte(typebyte); | 6690 | chunk->addByte(typebyte); |
6077 | } | 6691 | } |
6078 | break; | 6692 | break; |
6693 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
6694 | { | ||
6695 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
6696 | print_cil_neg(fp, mLeftType); | ||
6697 | } | ||
6698 | break; | ||
6079 | default: | 6699 | default: |
6080 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6700 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6081 | break; | 6701 | break; |
@@ -6219,7 +6839,7 @@ void LLScriptPreIncrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
6219 | { | 6839 | { |
6220 | fprintf(fp, "Unexpected Type\n"); | 6840 | fprintf(fp, "Unexpected Type\n"); |
6221 | } | 6841 | } |
6222 | print_asignment(fp, mExpression); | 6842 | print_assignment(fp, mExpression); |
6223 | } | 6843 | } |
6224 | break; | 6844 | break; |
6225 | case LSCP_TYPE: | 6845 | case LSCP_TYPE: |
@@ -6266,21 +6886,21 @@ void LLScriptPreIncrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
6266 | print_cil_load_address(fp, mExpression, entry); | 6886 | print_cil_load_address(fp, mExpression, entry); |
6267 | if (mReturnType == LST_INTEGER) | 6887 | if (mReturnType == LST_INTEGER) |
6268 | { | 6888 | { |
6269 | fprintf(fp, "ldc.i4.1\n"); | ||
6270 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6889 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6890 | fprintf(fp, "ldc.i4.1\n"); | ||
6271 | fprintf(fp, "add\n"); | 6891 | fprintf(fp, "add\n"); |
6272 | } | 6892 | } |
6273 | else if (mReturnType == LST_FLOATINGPOINT) | 6893 | else if (mReturnType == LST_FLOATINGPOINT) |
6274 | { | 6894 | { |
6275 | fprintf(fp, "ldc.r8.1\n"); | ||
6276 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6895 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6896 | fprintf(fp, "ldc.r8 1\n"); | ||
6277 | fprintf(fp, "add\n"); | 6897 | fprintf(fp, "add\n"); |
6278 | } | 6898 | } |
6279 | else | 6899 | else |
6280 | { | 6900 | { |
6281 | fprintf(fp, "Unexpected Type\n"); | 6901 | fprintf(fp, "Unexpected Type\n"); |
6282 | } | 6902 | } |
6283 | print_cil_asignment(fp, mExpression, entry); | 6903 | print_cil_assignment(fp, mExpression, entry); |
6284 | } | 6904 | } |
6285 | break; | 6905 | break; |
6286 | default: | 6906 | default: |
@@ -6327,7 +6947,7 @@ void LLScriptPreDecrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
6327 | { | 6947 | { |
6328 | fprintf(fp, "Unexpected Type\n"); | 6948 | fprintf(fp, "Unexpected Type\n"); |
6329 | } | 6949 | } |
6330 | print_asignment(fp, mExpression); | 6950 | print_assignment(fp, mExpression); |
6331 | } | 6951 | } |
6332 | break; | 6952 | break; |
6333 | case LSCP_TYPE: | 6953 | case LSCP_TYPE: |
@@ -6374,21 +6994,21 @@ void LLScriptPreDecrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
6374 | print_cil_load_address(fp, mExpression, entry); | 6994 | print_cil_load_address(fp, mExpression, entry); |
6375 | if (mReturnType == LST_INTEGER) | 6995 | if (mReturnType == LST_INTEGER) |
6376 | { | 6996 | { |
6377 | fprintf(fp, "ldc.i4.1\n"); | ||
6378 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 6997 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6998 | fprintf(fp, "ldc.i4.1\n"); | ||
6379 | fprintf(fp, "sub\n"); | 6999 | fprintf(fp, "sub\n"); |
6380 | } | 7000 | } |
6381 | else if (mReturnType == LST_FLOATINGPOINT) | 7001 | else if (mReturnType == LST_FLOATINGPOINT) |
6382 | { | 7002 | { |
6383 | fprintf(fp, "ldc.r8.1\n"); | ||
6384 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 7003 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
7004 | fprintf(fp, "ldc.r8 1\n"); | ||
6385 | fprintf(fp, "sub\n"); | 7005 | fprintf(fp, "sub\n"); |
6386 | } | 7006 | } |
6387 | else | 7007 | else |
6388 | { | 7008 | { |
6389 | fprintf(fp, "Unexpected Type\n"); | 7009 | fprintf(fp, "Unexpected Type\n"); |
6390 | } | 7010 | } |
6391 | print_cil_asignment(fp, mExpression, entry); | 7011 | print_cil_assignment(fp, mExpression, entry); |
6392 | } | 7012 | } |
6393 | break; | 7013 | break; |
6394 | default: | 7014 | default: |
@@ -6555,7 +7175,7 @@ void LLScriptVectorInitializer::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRI | |||
6555 | print_cil_cast(fp, mExpression3->mReturnType, LST_FLOATINGPOINT); | 7175 | print_cil_cast(fp, mExpression3->mReturnType, LST_FLOATINGPOINT); |
6556 | } | 7176 | } |
6557 | // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. | 7177 | // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. |
6558 | fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'create'(float32, float32, float32)\n"); | 7178 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n"); |
6559 | break; | 7179 | break; |
6560 | default: | 7180 | default: |
6561 | mExpression1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 7181 | mExpression1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -6696,7 +7316,7 @@ void LLScriptQuaternionInitializer::recurse(LLFILE *fp, S32 tabs, S32 tabsize, L | |||
6696 | } | 7316 | } |
6697 | 7317 | ||
6698 | // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. | 7318 | // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. |
6699 | fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'create'(float32, float32, float32, float32)\n"); | 7319 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n"); |
6700 | break; | 7320 | break; |
6701 | default: | 7321 | default: |
6702 | mExpression1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 7322 | mExpression1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -6743,14 +7363,15 @@ void LLScriptListInitializer::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
6743 | mReturnType = type = LST_LIST; | 7363 | mReturnType = type = LST_LIST; |
6744 | break; | 7364 | break; |
6745 | case LSCP_TO_STACK: | 7365 | case LSCP_TO_STACK: |
7366 | { | ||
6746 | if (mExpressionList) | 7367 | if (mExpressionList) |
6747 | { | 7368 | { |
6748 | pass = LSCP_TO_STACK; | 7369 | pass = LSCP_TO_STACK; |
6749 | count = 0; | 7370 | U64 list_element_count = 0; |
6750 | mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 7371 | mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, list_element_count, chunk, heap, stacksize, entry, entrycount, NULL); |
6751 | chunk->addByte(LSCRIPTOpCodes[LOPC_STACKTOL]); | 7372 | chunk->addByte(LSCRIPTOpCodes[LOPC_STACKTOL]); |
6752 | chunk->addInteger((S32)count); | 7373 | chunk->addInteger((S32)list_element_count); |
6753 | count = 0; | 7374 | |
6754 | } | 7375 | } |
6755 | else | 7376 | else |
6756 | { | 7377 | { |
@@ -6758,26 +7379,26 @@ void LLScriptListInitializer::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
6758 | chunk->addInteger(0); | 7379 | chunk->addInteger(0); |
6759 | } | 7380 | } |
6760 | break; | 7381 | break; |
7382 | } | ||
6761 | case LSCP_EMIT_CIL_ASSEMBLY: | 7383 | case LSCP_EMIT_CIL_ASSEMBLY: |
6762 | 7384 | { | |
6763 | // Push boxed elements on stack. | 7385 | // Push boxed elements on stack. |
6764 | count = 0; | 7386 | U64 list_element_count = 0; |
6765 | if (mExpressionList) | 7387 | if (mExpressionList) |
6766 | { | 7388 | { |
6767 | mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 7389 | mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, list_element_count, chunk, heap, stacksize, entry, entrycount, NULL); |
6768 | } | 7390 | } |
6769 | 7391 | ||
6770 | // Create list on stack, consuming first boxed element. | 7392 | // Create list on stack. |
6771 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LScriptLibrary]LScriptInternal::CreateList()\n"); | 7393 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList()\n"); |
6772 | 7394 | ||
6773 | // Call AddReturnList to add remaining boxed expressions. | 7395 | // Call Prepend to add remaining boxed expressions. |
6774 | for(U64 i = 0; i < count; i++) | 7396 | for(U64 i = 0; i < list_element_count; i++) |
6775 | { | 7397 | { |
6776 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LScriptLibrary]LScriptInternal::AddReturnList(object, class [mscorlib]System.Collections.ArrayList)\n"); | 7398 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Prepend(object, class [mscorlib]System.Collections.ArrayList)\n"); |
6777 | } | 7399 | } |
6778 | count = 0; | ||
6779 | |||
6780 | break; | 7400 | break; |
7401 | } | ||
6781 | default: | 7402 | default: |
6782 | if (mExpressionList) | 7403 | if (mExpressionList) |
6783 | { | 7404 | { |
@@ -6824,7 +7445,7 @@ void LLScriptPostIncrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
6824 | { | 7445 | { |
6825 | fprintf(fp, "Unexpected Type\n"); | 7446 | fprintf(fp, "Unexpected Type\n"); |
6826 | } | 7447 | } |
6827 | print_asignment(fp, mExpression); | 7448 | print_assignment(fp, mExpression); |
6828 | fprintf(fp, "%s\n", LSCRIPTTypePop[mReturnType]); | 7449 | fprintf(fp, "%s\n", LSCRIPTTypePop[mReturnType]); |
6829 | } | 7450 | } |
6830 | break; | 7451 | break; |
@@ -6893,24 +7514,34 @@ void LLScriptPostIncrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
6893 | break; | 7514 | break; |
6894 | case LSCP_EMIT_CIL_ASSEMBLY: | 7515 | case LSCP_EMIT_CIL_ASSEMBLY: |
6895 | { | 7516 | { |
7517 | // Push original value on to stack. | ||
7518 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
7519 | |||
7520 | // Load address if needed for store. | ||
6896 | print_cil_load_address(fp, mExpression, entry); | 7521 | print_cil_load_address(fp, mExpression, entry); |
7522 | |||
7523 | // Load value again. | ||
7524 | // TODO: Work out if sideeffects can result in 2 evaluations of expression giving different values. | ||
7525 | // Original LSL2 uses this method, so any bugs due to side effects will probably be identical ;-) | ||
6897 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 7526 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
6898 | fprintf(fp,"dup\n"); // Copy expression result to use as increment operand. | ||
6899 | if (mReturnType == LST_INTEGER) | 7527 | if (mReturnType == LST_INTEGER) |
6900 | { | 7528 | { |
6901 | fprintf(fp, "ldc.i4.1\n"); | 7529 | fprintf(fp, "ldc.i4.1\n"); |
6902 | } | 7530 | } |
6903 | else if (mReturnType == LST_FLOATINGPOINT) | 7531 | else if (mReturnType == LST_FLOATINGPOINT) |
6904 | { | 7532 | { |
6905 | fprintf(fp, "ldc.r8.1\n"); | 7533 | fprintf(fp, "ldc.r8 1\n"); |
6906 | } | 7534 | } |
6907 | else | 7535 | else |
6908 | { | 7536 | { |
6909 | fprintf(fp, "Unexpected Type\n"); | 7537 | fprintf(fp, "Unexpected Type\n"); |
6910 | } | 7538 | } |
6911 | fprintf(fp, "add\n"); | 7539 | fprintf(fp, "add\n"); |
6912 | print_cil_asignment(fp, mExpression, entry); | 7540 | print_cil_assignment(fp, mExpression, entry); |
6913 | fprintf(fp, "pop\n"); // Pop assignment result to leave original expression result on stack. TODO: Optimise away redundant pop/dup pairs. | 7541 | |
7542 | // Pop assignment result to leave original expression result on stack. | ||
7543 | // TODO: Optimise away redundant pop/dup pairs. | ||
7544 | fprintf(fp, "pop\n"); | ||
6914 | } | 7545 | } |
6915 | break; | 7546 | break; |
6916 | default: | 7547 | default: |
@@ -6956,7 +7587,7 @@ void LLScriptPostDecrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
6956 | { | 7587 | { |
6957 | fprintf(fp, "Unexpected Type\n"); | 7588 | fprintf(fp, "Unexpected Type\n"); |
6958 | } | 7589 | } |
6959 | print_asignment(fp, mExpression); | 7590 | print_assignment(fp, mExpression); |
6960 | fprintf(fp, "%s\n", LSCRIPTTypePop[mReturnType]); | 7591 | fprintf(fp, "%s\n", LSCRIPTTypePop[mReturnType]); |
6961 | } | 7592 | } |
6962 | break; | 7593 | break; |
@@ -7025,24 +7656,34 @@ void LLScriptPostDecrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo | |||
7025 | break; | 7656 | break; |
7026 | case LSCP_EMIT_CIL_ASSEMBLY: | 7657 | case LSCP_EMIT_CIL_ASSEMBLY: |
7027 | { | 7658 | { |
7659 | // Push original value on to stack. | ||
7660 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
7661 | |||
7662 | // Load address if needed for store. | ||
7028 | print_cil_load_address(fp, mExpression, entry); | 7663 | print_cil_load_address(fp, mExpression, entry); |
7664 | |||
7665 | // Load value again. | ||
7666 | // TODO: Work out if sideeffects can result in 2 evaluations of expression giving different values. | ||
7667 | // Original LSL2 uses this method, so any bugs due to side effects will probably be identical ;-) | ||
7029 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 7668 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
7030 | fprintf(fp,"dup\n"); // Copy expression result to use as decrement operand. | ||
7031 | if (mReturnType == LST_INTEGER) | 7669 | if (mReturnType == LST_INTEGER) |
7032 | { | 7670 | { |
7033 | fprintf(fp, "ldc.i4.1\n"); | 7671 | fprintf(fp, "ldc.i4.1\n"); |
7034 | } | 7672 | } |
7035 | else if (mReturnType == LST_FLOATINGPOINT) | 7673 | else if (mReturnType == LST_FLOATINGPOINT) |
7036 | { | 7674 | { |
7037 | fprintf(fp, "ldc.r8.1\n"); | 7675 | fprintf(fp, "ldc.r8 1\n"); |
7038 | } | 7676 | } |
7039 | else | 7677 | else |
7040 | { | 7678 | { |
7041 | fprintf(fp, "Unexpected Type\n"); | 7679 | fprintf(fp, "Unexpected Type\n"); |
7042 | } | 7680 | } |
7043 | fprintf(fp, "sub\n"); | 7681 | fprintf(fp, "sub\n"); |
7044 | print_cil_asignment(fp, mExpression, entry); | 7682 | print_cil_assignment(fp, mExpression, entry); |
7045 | fprintf(fp, "pop\n"); // Pop assignment result to leave original expression result on stack. TODO: Optimise away redundant pop/dup pairs. | 7683 | |
7684 | // Pop assignment result to leave original expression result on stack. | ||
7685 | // TODO: Optimise away redundant pop/dup pairs. | ||
7686 | fprintf(fp, "pop\n"); | ||
7046 | } | 7687 | } |
7047 | break; | 7688 | break; |
7048 | default: | 7689 | default: |
@@ -7058,16 +7699,19 @@ S32 LLScriptPostDecrement::getSize() | |||
7058 | } | 7699 | } |
7059 | 7700 | ||
7060 | // Generate arg list. | 7701 | // Generate arg list. |
7061 | void print_cil_arg_list(LLFILE *fp, LLScriptFuncExpressionList* exp_list) | 7702 | static void print_cil_arg_list(LLFILE *fp, LLScriptArgString& args) |
7062 | { | 7703 | { |
7063 | // Print first argument. | 7704 | int i = 0; |
7064 | print_cil_type(fp, exp_list->mFirstp->mReturnType); | 7705 | bool finished = (i >= args.getNumber()); |
7065 | 7706 | while(! finished) | |
7066 | // Recursively print next arguments. | ||
7067 | if(exp_list->mSecondp != NULL) | ||
7068 | { | 7707 | { |
7069 | fprintf(fp, ", "); | 7708 | print_cil_type(fp, args.getType(i)); |
7070 | print_cil_arg_list(fp, (LLScriptFuncExpressionList*) exp_list->mSecondp); | 7709 | ++i; |
7710 | finished = (i >= args.getNumber()); | ||
7711 | if(! finished) | ||
7712 | { | ||
7713 | fprintf(fp, ", "); | ||
7714 | } | ||
7071 | } | 7715 | } |
7072 | } | 7716 | } |
7073 | 7717 | ||
@@ -7146,7 +7790,7 @@ void LLScriptFunctionCall::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
7146 | gErrorToText.writeError(fp, this, LSERROR_FUNCTION_TYPE_ERROR); | 7790 | gErrorToText.writeError(fp, this, LSERROR_FUNCTION_TYPE_ERROR); |
7147 | } | 7791 | } |
7148 | } | 7792 | } |
7149 | else if (argcount != strlen(mIdentifier->mScopeEntry->mFunctionArgs.mString)) /*Flawfinder: ignore*/ | 7793 | else if (argcount != strlen(mIdentifier->mScopeEntry->mFunctionArgs.mString)) |
7150 | { | 7794 | { |
7151 | gErrorToText.writeError(fp, this, LSERROR_FUNCTION_TYPE_ERROR); | 7795 | gErrorToText.writeError(fp, this, LSERROR_FUNCTION_TYPE_ERROR); |
7152 | } | 7796 | } |
@@ -7217,13 +7861,15 @@ void LLScriptFunctionCall::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
7217 | // Load args on to stack. | 7861 | // Load args on to stack. |
7218 | if (mExpressionList) | 7862 | if (mExpressionList) |
7219 | { | 7863 | { |
7220 | mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry /* Needed for is_parameter calls */, 0, NULL); | 7864 | //mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry /* Needed for is_parameter calls */, 0, NULL); |
7865 | llassert(LET_FUNC_EXPRESSION_LIST == mExpressionList->mType); | ||
7866 | print_cil_func_expression_list((LLScriptFuncExpressionList*) mExpressionList, fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry /* Caller entry needed for is_parameter calls */, 0, NULL, mIdentifier->mScopeEntry /* Callee entry needed for argument casting */); | ||
7221 | } | 7867 | } |
7222 | 7868 | ||
7223 | // Make call. | 7869 | // Make call. |
7224 | if (! library_call) | 7870 | if (! library_call) |
7225 | { | 7871 | { |
7226 | fprintf(fp, "callvirt instance "); | 7872 | fprintf(fp, "call instance "); |
7227 | } | 7873 | } |
7228 | else | 7874 | else |
7229 | { | 7875 | { |
@@ -7233,16 +7879,18 @@ void LLScriptFunctionCall::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
7233 | fprintf(fp, " class "); | 7879 | fprintf(fp, " class "); |
7234 | if (library_call) | 7880 | if (library_call) |
7235 | { | 7881 | { |
7236 | fprintf(fp, "[LScriptLibrary]LScriptLibrary"); | 7882 | fprintf(fp, "[LslLibrary]LindenLab.SecondLife.Library::'"); |
7237 | } | 7883 | } |
7238 | else | 7884 | else |
7239 | { | 7885 | { |
7240 | fprintf(fp, "LSL"); | 7886 | // Prefix function name with g to distinguish from |
7887 | // event handlers. | ||
7888 | fprintf(fp, gScriptp->getClassName()); | ||
7889 | fprintf(fp, "::'g"); | ||
7241 | } | 7890 | } |
7242 | fprintf(fp, "::"); | 7891 | fprintf(fp, mIdentifier->mName); |
7243 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 7892 | fprintf(fp, "'("); |
7244 | fprintf(fp, "("); | 7893 | print_cil_arg_list(fp, mIdentifier->mScopeEntry->mFunctionArgs); |
7245 | if (mExpressionList) {print_cil_arg_list(fp, (LLScriptFuncExpressionList*) mExpressionList);} | ||
7246 | fprintf(fp, ")\n"); | 7894 | fprintf(fp, ")\n"); |
7247 | } | 7895 | } |
7248 | break; | 7896 | break; |
@@ -7287,6 +7935,11 @@ void LLScriptPrint::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas | |||
7287 | chunk->addByte(LSCRIPTOpCodes[LOPC_PRINT]); | 7935 | chunk->addByte(LSCRIPTOpCodes[LOPC_PRINT]); |
7288 | chunk->addByte(LSCRIPTTypeByte[mLeftType]); | 7936 | chunk->addByte(LSCRIPTTypeByte[mLeftType]); |
7289 | break; | 7937 | break; |
7938 | case LSCP_EMIT_CIL_ASSEMBLY: | ||
7939 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | ||
7940 | print_cil_cast(fp, mLeftType, LST_STRING); | ||
7941 | fprintf(fp, "call void class [LslLibrary]LindenLab.SecondLife.Library::Print(string)"); | ||
7942 | break; | ||
7290 | default: | 7943 | default: |
7291 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 7944 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
7292 | break; | 7945 | break; |
@@ -7404,8 +8057,19 @@ void LLScriptStatementSequence::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRI | |||
7404 | mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8057 | mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
7405 | if (prunearg) | 8058 | if (prunearg) |
7406 | { | 8059 | { |
8060 | // babbage: only warn on first dead code block found. | ||
8061 | if(ptype != LSPRUNE_DEAD_CODE) | ||
8062 | { | ||
8063 | gErrorToText.writeWarning(fp, this, LSWARN_DEAD_CODE); | ||
8064 | } | ||
8065 | |||
8066 | // babbage: set prune type to LSPRUNE_DEAD_CODE to mask other | ||
8067 | // prune errors. | ||
7407 | ptype = LSPRUNE_DEAD_CODE; | 8068 | ptype = LSPRUNE_DEAD_CODE; |
7408 | gErrorToText.writeWarning(fp, this, LSWARN_DEAD_CODE); | 8069 | |
8070 | // babbage: reset prunearg, to track whether return needed at | ||
8071 | // end of dead code path as CIL always needs a return/throw. | ||
8072 | prunearg = FALSE; | ||
7409 | } | 8073 | } |
7410 | mSecondp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8074 | mSecondp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
7411 | break; | 8075 | break; |
@@ -7444,10 +8108,7 @@ void LLScriptNOOP::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass | |||
7444 | fprintf(fp, ";\n"); | 8108 | fprintf(fp, ";\n"); |
7445 | break; | 8109 | break; |
7446 | case LSCP_PRUNE: | 8110 | case LSCP_PRUNE: |
7447 | if (ptype == LSPRUNE_DEAD_CODE) | 8111 | prunearg = FALSE; |
7448 | prunearg = TRUE; | ||
7449 | else | ||
7450 | prunearg = FALSE; | ||
7451 | break; | 8112 | break; |
7452 | default: | 8113 | default: |
7453 | break; | 8114 | break; |
@@ -7462,7 +8123,7 @@ void add_exit_pops(LLScriptByteCodeChunk *chunk, LLScriptScopeEntry *entry) | |||
7462 | 8123 | ||
7463 | if (entry->mLocals.mString) | 8124 | if (entry->mLocals.mString) |
7464 | { | 8125 | { |
7465 | number = (S32)strlen(entry->mLocals.mString); /*Flawfinder: ignore*/ | 8126 | number = (S32)strlen(entry->mLocals.mString); |
7466 | for (i = number - 1; i >= 0; i--) | 8127 | for (i = number - 1; i >= 0; i--) |
7467 | { | 8128 | { |
7468 | switch(entry->mLocals.getType(i)) | 8129 | switch(entry->mLocals.getType(i)) |
@@ -7495,7 +8156,7 @@ void add_exit_pops(LLScriptByteCodeChunk *chunk, LLScriptScopeEntry *entry) | |||
7495 | 8156 | ||
7496 | if (entry->mFunctionArgs.mString) | 8157 | if (entry->mFunctionArgs.mString) |
7497 | { | 8158 | { |
7498 | number = (S32)strlen(entry->mFunctionArgs.mString); /*Flawfinder: ignore*/ | 8159 | number = (S32)strlen(entry->mFunctionArgs.mString); |
7499 | for (i = number - 1; i >= 0; i--) | 8160 | for (i = number - 1; i >= 0; i--) |
7500 | { | 8161 | { |
7501 | switch(entry->mFunctionArgs.getType(i)) | 8162 | switch(entry->mFunctionArgs.getType(i)) |
@@ -7534,7 +8195,7 @@ void print_exit_pops(LLFILE *fp, LLScriptScopeEntry *entry) | |||
7534 | 8195 | ||
7535 | if (entry->mLocals.mString) | 8196 | if (entry->mLocals.mString) |
7536 | { | 8197 | { |
7537 | number = (S32)strlen(entry->mLocals.mString); /*Flawfinder: ignore*/ | 8198 | number = (S32)strlen(entry->mLocals.mString); |
7538 | for (i = number - 1; i >= 0; i--) | 8199 | for (i = number - 1; i >= 0; i--) |
7539 | { | 8200 | { |
7540 | fprintf(fp, "%s", LSCRIPTTypePop[entry->mLocals.getType(i)]); | 8201 | fprintf(fp, "%s", LSCRIPTTypePop[entry->mLocals.getType(i)]); |
@@ -7543,7 +8204,7 @@ void print_exit_pops(LLFILE *fp, LLScriptScopeEntry *entry) | |||
7543 | 8204 | ||
7544 | if (entry->mFunctionArgs.mString) | 8205 | if (entry->mFunctionArgs.mString) |
7545 | { | 8206 | { |
7546 | number = (S32)strlen(entry->mFunctionArgs.mString); /*Flawfinder: ignore*/ | 8207 | number = (S32)strlen(entry->mFunctionArgs.mString); |
7547 | for (i = number - 1; i >= 0; i--) | 8208 | for (i = number - 1; i >= 0; i--) |
7548 | { | 8209 | { |
7549 | fprintf(fp, "%s", LSCRIPTTypePop[entry->mFunctionArgs.getType(i)]); | 8210 | fprintf(fp, "%s", LSCRIPTTypePop[entry->mFunctionArgs.getType(i)]); |
@@ -7583,10 +8244,7 @@ void LLScriptStateChange::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
7583 | { | 8244 | { |
7584 | gErrorToText.writeError(fp, this, LSERROR_STATE_CHANGE_IN_GLOBAL); | 8245 | gErrorToText.writeError(fp, this, LSERROR_STATE_CHANGE_IN_GLOBAL); |
7585 | } | 8246 | } |
7586 | if (ptype == LSPRUNE_DEAD_CODE) | 8247 | prunearg = FALSE; |
7587 | prunearg = TRUE; | ||
7588 | else | ||
7589 | prunearg = FALSE; | ||
7590 | break; | 8248 | break; |
7591 | case LSCP_SCOPE_PASS2: | 8249 | case LSCP_SCOPE_PASS2: |
7592 | { | 8250 | { |
@@ -7610,10 +8268,10 @@ void LLScriptStateChange::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
7610 | } | 8268 | } |
7611 | break; | 8269 | break; |
7612 | case LSCP_EMIT_CIL_ASSEMBLY: | 8270 | case LSCP_EMIT_CIL_ASSEMBLY: |
7613 | fprintf(fp, "ldstr \""); | 8271 | fprintf(fp, "ldarg.0\n"); |
7614 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8272 | fprintf(fp, "ldstr \"%s\"\n", mIdentifier->mName); |
7615 | fprintf(fp, "\"\n"); | 8273 | fprintf(fp, "call instance void class [LslUserScript]LindenLab.SecondLife.LslUserScript::ChangeState(string)\n"); |
7616 | fprintf(fp, "call void class [LScriptLibrary]LScriptInternal::change_state(string)\n"); | 8274 | fprintf(fp, "ret\n"); |
7617 | break; | 8275 | break; |
7618 | default: | 8276 | default: |
7619 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8277 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -7647,10 +8305,7 @@ void LLScriptJump::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass | |||
7647 | fprintf(fp, "\n"); | 8305 | fprintf(fp, "\n"); |
7648 | break; | 8306 | break; |
7649 | case LSCP_PRUNE: | 8307 | case LSCP_PRUNE: |
7650 | if (ptype == LSPRUNE_DEAD_CODE) | 8308 | prunearg = FALSE; |
7651 | prunearg = TRUE; | ||
7652 | else | ||
7653 | prunearg = FALSE; | ||
7654 | break; | 8309 | break; |
7655 | case LSCP_SCOPE_PASS2: | 8310 | case LSCP_SCOPE_PASS2: |
7656 | { | 8311 | { |
@@ -7820,6 +8475,10 @@ void LLScriptReturn::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa | |||
7820 | mType = basetype; | 8475 | mType = basetype; |
7821 | } | 8476 | } |
7822 | } | 8477 | } |
8478 | else if (basetype != LST_NULL) | ||
8479 | { | ||
8480 | gErrorToText.writeError(fp, this, LSERROR_TYPE_MISMATCH); | ||
8481 | } | ||
7823 | break; | 8482 | break; |
7824 | case LSCP_EMIT_BYTE_CODE: | 8483 | case LSCP_EMIT_BYTE_CODE: |
7825 | if (mExpression) | 8484 | if (mExpression) |
@@ -7863,6 +8522,7 @@ void LLScriptReturn::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa | |||
7863 | if (mExpression) | 8522 | if (mExpression) |
7864 | { | 8523 | { |
7865 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8524 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8525 | print_cil_cast(fp, mExpression->mReturnType, mType); | ||
7866 | } | 8526 | } |
7867 | fprintf(fp, "ret\n"); | 8527 | fprintf(fp, "ret\n"); |
7868 | break; | 8528 | break; |
@@ -7902,10 +8562,7 @@ void LLScriptExpressionStatement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSC | |||
7902 | } | 8562 | } |
7903 | break; | 8563 | break; |
7904 | case LSCP_PRUNE: | 8564 | case LSCP_PRUNE: |
7905 | if (ptype == LSPRUNE_DEAD_CODE) | 8565 | prunearg = FALSE; |
7906 | prunearg = TRUE; | ||
7907 | else | ||
7908 | prunearg = FALSE; | ||
7909 | break; | 8566 | break; |
7910 | case LSCP_EMIT_BYTE_CODE: | 8567 | case LSCP_EMIT_BYTE_CODE: |
7911 | mExpression->recurse(fp, tabs, tabsize, LSCP_TO_STACK, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8568 | mExpression->recurse(fp, tabs, tabsize, LSCP_TO_STACK, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -7951,6 +8608,58 @@ S32 LLScriptIf::getSize() | |||
7951 | return 0; | 8608 | return 0; |
7952 | } | 8609 | } |
7953 | 8610 | ||
8611 | static void print_cil_if_test(LLFILE* fp, LSCRIPTType type) | ||
8612 | { | ||
8613 | switch(type) | ||
8614 | { | ||
8615 | case LST_INTEGER: | ||
8616 | break; | ||
8617 | case LST_FLOATINGPOINT: | ||
8618 | fprintf(fp, "ldc.r8 0\n"); | ||
8619 | fprintf(fp, "ceq\n"); | ||
8620 | fprintf(fp, "ldc.i4.0\n"); | ||
8621 | fprintf(fp, "ceq\n"); | ||
8622 | break; | ||
8623 | case LST_VECTOR: | ||
8624 | fprintf(fp, "ldc.r8 0\n"); | ||
8625 | fprintf(fp, "ldc.r8 0\n"); | ||
8626 | fprintf(fp, "ldc.r8 0\n"); | ||
8627 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n"); | ||
8628 | fprintf(fp, "call bool [LslUserScript]LindenLab.SecondLife.LslUserScript::'Equals'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); | ||
8629 | fprintf(fp, "ldc.i4.0\n"); | ||
8630 | fprintf(fp, "ceq\n"); | ||
8631 | break; | ||
8632 | case LST_QUATERNION: | ||
8633 | fprintf(fp, "ldc.r8 0\n"); | ||
8634 | fprintf(fp, "ldc.r8 0\n"); | ||
8635 | fprintf(fp, "ldc.r8 0\n"); | ||
8636 | fprintf(fp, "ldc.r8 1\n"); | ||
8637 | fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n"); | ||
8638 | fprintf(fp, "call bool [LslUserScript]LindenLab.SecondLife.LslUserScript::'Equals'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); | ||
8639 | fprintf(fp, "ldc.i4.0\n"); | ||
8640 | fprintf(fp, "ceq\n"); | ||
8641 | break; | ||
8642 | case LST_KEY: | ||
8643 | fprintf(fp, "call bool [LslUserScript]LindenLab.SecondLife.LslUserScript::'IsNonNullUuid'(valuetype [ScriptTypes]LindenLab.SecondLife.Key)\n"); | ||
8644 | break; | ||
8645 | case LST_STRING: | ||
8646 | fprintf(fp, "ldstr \"\"\n"); | ||
8647 | fprintf(fp, "call bool string::op_Equality(string, string)\n"); | ||
8648 | fprintf(fp, "ldc.i4.0\n"); | ||
8649 | fprintf(fp, "ceq\n"); | ||
8650 | break; | ||
8651 | case LST_LIST: | ||
8652 | fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList()\n"); | ||
8653 | fprintf(fp, "call bool [LslUserScript]LindenLab.SecondLife.LslUserScript::Equals(class [mscorlib]System.Collections.ArrayList, class [mscorlib]System.Collections.ArrayList)\n"); | ||
8654 | fprintf(fp, "ldc.i4.0\n"); | ||
8655 | fprintf(fp, "ceq\n"); | ||
8656 | break; | ||
8657 | default: | ||
8658 | break; | ||
8659 | } | ||
8660 | |||
8661 | } | ||
8662 | |||
7954 | void LLScriptIf::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) | 8663 | void LLScriptIf::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) |
7955 | { | 8664 | { |
7956 | if (gErrorToText.getErrors()) | 8665 | if (gErrorToText.getErrors()) |
@@ -7976,10 +8685,7 @@ void LLScriptIf::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass p | |||
7976 | } | 8685 | } |
7977 | break; | 8686 | break; |
7978 | case LSCP_PRUNE: | 8687 | case LSCP_PRUNE: |
7979 | if (ptype == LSPRUNE_DEAD_CODE) | 8688 | prunearg = FALSE; |
7980 | prunearg = TRUE; | ||
7981 | else | ||
7982 | prunearg = FALSE; | ||
7983 | break; | 8689 | break; |
7984 | case LSCP_TYPE: | 8690 | case LSCP_TYPE: |
7985 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8691 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -8004,6 +8710,7 @@ void LLScriptIf::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass p | |||
8004 | { | 8710 | { |
8005 | S32 tjump = gTempJumpCount++; | 8711 | S32 tjump = gTempJumpCount++; |
8006 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8712 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8713 | print_cil_if_test(fp, mExpression->mReturnType); | ||
8007 | fprintf(fp, "brfalse LabelTempJump%d\n", tjump); | 8714 | fprintf(fp, "brfalse LabelTempJump%d\n", tjump); |
8008 | mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8715 | mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8009 | fprintf(fp, "LabelTempJump%d:\n", tjump); | 8716 | fprintf(fp, "LabelTempJump%d:\n", tjump); |
@@ -8093,6 +8800,7 @@ void LLScriptIfElse::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa | |||
8093 | S32 tjump1 = gTempJumpCount++; | 8800 | S32 tjump1 = gTempJumpCount++; |
8094 | S32 tjump2 = gTempJumpCount++; | 8801 | S32 tjump2 = gTempJumpCount++; |
8095 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8802 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8803 | print_cil_if_test(fp, mExpression->mReturnType); | ||
8096 | fprintf(fp, "brfalse LabelTempJump%d\n", tjump1); | 8804 | fprintf(fp, "brfalse LabelTempJump%d\n", tjump1); |
8097 | mStatement1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8805 | mStatement1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8098 | fprintf(fp, "br LabelTempJump%d\n", tjump2); | 8806 | fprintf(fp, "br LabelTempJump%d\n", tjump2); |
@@ -8155,10 +8863,7 @@ void LLScriptFor::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass | |||
8155 | } | 8863 | } |
8156 | break; | 8864 | break; |
8157 | case LSCP_PRUNE: | 8865 | case LSCP_PRUNE: |
8158 | if (ptype == LSPRUNE_DEAD_CODE) | 8866 | prunearg = FALSE; |
8159 | prunearg = TRUE; | ||
8160 | else | ||
8161 | prunearg = FALSE; | ||
8162 | break; | 8867 | break; |
8163 | case LSCP_TYPE: | 8868 | case LSCP_TYPE: |
8164 | if(mSequence) | 8869 | if(mSequence) |
@@ -8203,6 +8908,7 @@ void LLScriptFor::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass | |||
8203 | mSequence->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8908 | mSequence->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8204 | fprintf(fp, "LabelTempJump%d:\n", tjump1); | 8909 | fprintf(fp, "LabelTempJump%d:\n", tjump1); |
8205 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8910 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8911 | print_cil_if_test(fp, mExpression->mReturnType); | ||
8206 | fprintf(fp, "brfalse LabelTempJump%d\n", tjump2); | 8912 | fprintf(fp, "brfalse LabelTempJump%d\n", tjump2); |
8207 | if(mStatement) | 8913 | if(mStatement) |
8208 | mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8914 | mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -8257,10 +8963,7 @@ void LLScriptDoWhile::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP | |||
8257 | } | 8963 | } |
8258 | break; | 8964 | break; |
8259 | case LSCP_PRUNE: | 8965 | case LSCP_PRUNE: |
8260 | if (ptype == LSPRUNE_DEAD_CODE) | 8966 | prunearg = FALSE; |
8261 | prunearg = TRUE; | ||
8262 | else | ||
8263 | prunearg = FALSE; | ||
8264 | break; | 8967 | break; |
8265 | case LSCP_TYPE: | 8968 | case LSCP_TYPE: |
8266 | mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8969 | mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -8287,6 +8990,7 @@ void LLScriptDoWhile::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP | |||
8287 | fprintf(fp, "LabelTempJump%d:\n", tjump1); | 8990 | fprintf(fp, "LabelTempJump%d:\n", tjump1); |
8288 | mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8991 | mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8289 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 8992 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8993 | print_cil_if_test(fp, mExpression->mReturnType); | ||
8290 | fprintf(fp, "brtrue LabelTempJump%d\n", tjump1); | 8994 | fprintf(fp, "brtrue LabelTempJump%d\n", tjump1); |
8291 | } | 8995 | } |
8292 | break; | 8996 | break; |
@@ -8331,10 +9035,7 @@ void LLScriptWhile::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas | |||
8331 | } | 9035 | } |
8332 | break; | 9036 | break; |
8333 | case LSCP_PRUNE: | 9037 | case LSCP_PRUNE: |
8334 | if (ptype == LSPRUNE_DEAD_CODE) | 9038 | prunearg = FALSE; |
8335 | prunearg = TRUE; | ||
8336 | else | ||
8337 | prunearg = FALSE; | ||
8338 | break; | 9039 | break; |
8339 | case LSCP_TYPE: | 9040 | case LSCP_TYPE: |
8340 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 9041 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -8367,6 +9068,7 @@ void LLScriptWhile::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas | |||
8367 | S32 tjump2 = gTempJumpCount++; | 9068 | S32 tjump2 = gTempJumpCount++; |
8368 | fprintf(fp, "LabelTempJump%d:\n", tjump1); | 9069 | fprintf(fp, "LabelTempJump%d:\n", tjump1); |
8369 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 9070 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
9071 | print_cil_if_test(fp, mExpression->mReturnType); | ||
8370 | fprintf(fp, "brfalse LabelTempJump%d\n", tjump2); | 9072 | fprintf(fp, "brfalse LabelTempJump%d\n", tjump2); |
8371 | mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 9073 | mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8372 | fprintf(fp, "br LabelTempJump%d\n", tjump1); | 9074 | fprintf(fp, "br LabelTempJump%d\n", tjump1); |
@@ -8429,10 +9131,7 @@ void LLScriptDeclaration::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
8429 | } | 9131 | } |
8430 | break; | 9132 | break; |
8431 | case LSCP_PRUNE: | 9133 | case LSCP_PRUNE: |
8432 | if (ptype == LSPRUNE_DEAD_CODE) | 9134 | prunearg = FALSE; |
8433 | prunearg = TRUE; | ||
8434 | else | ||
8435 | prunearg = FALSE; | ||
8436 | break; | 9135 | break; |
8437 | case LSCP_SCOPE_PASS1: | 9136 | case LSCP_SCOPE_PASS1: |
8438 | // Check to see if a declaration is valid here. | 9137 | // Check to see if a declaration is valid here. |
@@ -8604,24 +9303,13 @@ void LLScriptDeclaration::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
8604 | if (mExpression) | 9303 | if (mExpression) |
8605 | { | 9304 | { |
8606 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 9305 | mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
8607 | if (mIdentifier->mScopeEntry->mIDType == LIT_VARIABLE) | 9306 | print_cil_cast(fp, mExpression->mReturnType, mIdentifier->mScopeEntry->mType); |
8608 | { | 9307 | } |
8609 | if(is_parameter(mIdentifier, entry)) | 9308 | else |
8610 | { | 9309 | { |
8611 | // Parameter, store by name. | 9310 | print_cil_init_variable(fp, mIdentifier->mScopeEntry->mType); |
8612 | fprintf(fp, "starg.s %s\n", mIdentifier->mScopeEntry->mIdentifier); | ||
8613 | } | ||
8614 | else | ||
8615 | { | ||
8616 | // Local, store by index. | ||
8617 | fprintf(fp, "stloc.s %d\n", mIdentifier->mScopeEntry->mCount); | ||
8618 | } | ||
8619 | } | ||
8620 | else if (mIdentifier->mScopeEntry->mIDType == LIT_GLOBAL) | ||
8621 | { | ||
8622 | gErrorToText.writeError(fp, this, LSERROR_UNDEFINED_NAME); | ||
8623 | } | ||
8624 | } | 9311 | } |
9312 | fprintf(fp, "stloc.s %d\n", mIdentifier->mScopeEntry->mCount); | ||
8625 | break; | 9313 | break; |
8626 | default: | 9314 | default: |
8627 | if (mExpression) | 9315 | if (mExpression) |
@@ -8751,7 +9439,7 @@ S32 LLScriptEventHandler::getSize() | |||
8751 | 9439 | ||
8752 | U64 gCurrentHandler = 0; | 9440 | U64 gCurrentHandler = 0; |
8753 | 9441 | ||
8754 | void print_cil_local_init(LLFILE* fp, LLScriptScopeEntry* scopeEntry) | 9442 | static void print_cil_local_init(LLFILE* fp, LLScriptScopeEntry* scopeEntry) |
8755 | { | 9443 | { |
8756 | if(scopeEntry->mLocals.getNumber() > 0) | 9444 | if(scopeEntry->mLocals.getNumber() > 0) |
8757 | { | 9445 | { |
@@ -8956,6 +9644,10 @@ void LLScriptEventHandler::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
8956 | // first determine resource counts for globals | 9644 | // first determine resource counts for globals |
8957 | count = 0; | 9645 | count = 0; |
8958 | mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 9646 | mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
9647 | |||
9648 | // Store offset of first local as with global functions, so locals and arguments can be distinguished with is_parameter when compiling to CIL. | ||
9649 | mScopeEntry->mOffset = (S32) count; | ||
9650 | |||
8959 | if (mStatement) | 9651 | if (mStatement) |
8960 | { | 9652 | { |
8961 | entrycount = 0; | 9653 | entrycount = 0; |
@@ -9024,8 +9716,11 @@ void LLScriptEventHandler::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
9024 | // Method signature prefix. | 9716 | // Method signature prefix. |
9025 | fprintf(fp, ".method public hidebysig instance default void "); | 9717 | fprintf(fp, ".method public hidebysig instance default void "); |
9026 | 9718 | ||
9027 | // Mangle event handler name by prefixing it with state name. Allows state changing by finding handlers prefixed with new state name. | 9719 | // Mangle event handler name by prefixing it with state name. |
9028 | fprintf(fp, entry->mIdentifier); /*Flawfinder: ignore*/ | 9720 | // Allows state changing by finding handlers prefixed with new |
9721 | // state name. Prefix disambiguates functions and event handlers. | ||
9722 | fprintf(fp, "e"); | ||
9723 | fprintf(fp, entry->mIdentifier); | ||
9029 | 9724 | ||
9030 | // Handler name and arguments. | 9725 | // Handler name and arguments. |
9031 | mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 9726 | mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -9047,7 +9742,11 @@ void LLScriptEventHandler::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom | |||
9047 | } | 9742 | } |
9048 | 9743 | ||
9049 | // Function footer. | 9744 | // Function footer. |
9050 | fprintf(fp, "\nret\n"); // TODO: Check whether return needed? | 9745 | if (mbNeedTrailingReturn) |
9746 | { | ||
9747 | // TODO: throw exception? | ||
9748 | fprintf(fp, "ret\n"); | ||
9749 | } | ||
9051 | fprintf(fp, "}\n"); | 9750 | fprintf(fp, "}\n"); |
9052 | 9751 | ||
9053 | break; | 9752 | break; |
@@ -9161,7 +9860,7 @@ void LLScriptFunctionDec::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
9161 | chunk->addBytes(&typereturn, 1); | 9860 | chunk->addBytes(&typereturn, 1); |
9162 | // name | 9861 | // name |
9163 | #ifdef LSL_INCLUDE_DEBUG_INFO | 9862 | #ifdef LSL_INCLUDE_DEBUG_INFO |
9164 | chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/ | 9863 | chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); |
9165 | #else | 9864 | #else |
9166 | chunk->addBytes(1); | 9865 | chunk->addBytes(1); |
9167 | #endif | 9866 | #endif |
@@ -9176,6 +9875,10 @@ void LLScriptFunctionDec::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp | |||
9176 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 9875 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
9177 | fprintf(fp, " "); | 9876 | fprintf(fp, " "); |
9178 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 9877 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
9878 | if(NULL != mNextp) | ||
9879 | { | ||
9880 | fprintf(fp, ","); | ||
9881 | } | ||
9179 | break; | 9882 | break; |
9180 | default: | 9883 | default: |
9181 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 9884 | mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
@@ -9398,7 +10101,7 @@ void LLScriptGlobalFunctions::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
9398 | 10101 | ||
9399 | // null terminated function name | 10102 | // null terminated function name |
9400 | #ifdef LSL_INCLUDE_DEBUG_INFO | 10103 | #ifdef LSL_INCLUDE_DEBUG_INFO |
9401 | chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/ | 10104 | chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); |
9402 | #else | 10105 | #else |
9403 | chunk->addBytes(1); | 10106 | chunk->addBytes(1); |
9404 | #endif | 10107 | #endif |
@@ -9444,11 +10147,13 @@ void LLScriptGlobalFunctions::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
9444 | break; | 10147 | break; |
9445 | case LSCP_EMIT_CIL_ASSEMBLY: | 10148 | case LSCP_EMIT_CIL_ASSEMBLY: |
9446 | { | 10149 | { |
9447 | // Function header. | 10150 | // Function header. Prefix function name with g to distinguish |
10151 | // from event handlers. | ||
9448 | fprintf(fp, ".method public hidebysig instance default "); | 10152 | fprintf(fp, ".method public hidebysig instance default "); |
9449 | print_cil_type(fp, mType ? mType->mType : LST_NULL); | 10153 | print_cil_type(fp, mType ? mType->mType : LST_NULL); |
9450 | fprintf(fp, " "); | 10154 | fprintf(fp, " 'g"); |
9451 | mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 10155 | fprintf(fp, mIdentifier->mName); |
10156 | fprintf(fp, "'"); | ||
9452 | if (mParameters) | 10157 | if (mParameters) |
9453 | { | 10158 | { |
9454 | fprintf(fp, "( "); | 10159 | fprintf(fp, "( "); |
@@ -9473,6 +10178,7 @@ void LLScriptGlobalFunctions::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT | |||
9473 | // Function footer. | 10178 | // Function footer. |
9474 | if (mbNeedTrailingReturn) | 10179 | if (mbNeedTrailingReturn) |
9475 | { | 10180 | { |
10181 | // TODO: throw exception? | ||
9476 | fprintf(fp, "ret\n"); | 10182 | fprintf(fp, "ret\n"); |
9477 | } | 10183 | } |
9478 | fprintf(fp, "}\n"); | 10184 | fprintf(fp, "}\n"); |
@@ -9587,10 +10293,12 @@ void LLScriptState::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas | |||
9587 | { | 10293 | { |
9588 | mIdentifier->mScopeEntry = scope->addEntry(mIdentifier->mName, LIT_STATE, LST_NULL); | 10294 | mIdentifier->mScopeEntry = scope->addEntry(mIdentifier->mName, LIT_STATE, LST_NULL); |
9589 | } | 10295 | } |
10296 | mStateScope = new LLScriptScope(gScopeStringTable); | ||
10297 | mStateScope->addParentScope(scope); | ||
9590 | // now do the events | 10298 | // now do the events |
9591 | if (mEvent) | 10299 | if (mEvent) |
9592 | { | 10300 | { |
9593 | mEvent->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 10301 | mEvent->recurse(fp, tabs, tabsize, pass, ptype, prunearg, mStateScope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
9594 | } | 10302 | } |
9595 | break; | 10303 | break; |
9596 | case LSCP_SCOPE_PASS2: | 10304 | case LSCP_SCOPE_PASS2: |
@@ -9649,7 +10357,7 @@ void LLScriptState::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas | |||
9649 | 10357 | ||
9650 | // null terminated state name | 10358 | // null terminated state name |
9651 | #ifdef LSL_INCLUDE_DEBUG_INFO | 10359 | #ifdef LSL_INCLUDE_DEBUG_INFO |
9652 | chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/ | 10360 | chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); |
9653 | #else | 10361 | #else |
9654 | chunk->addBytes(1); | 10362 | chunk->addBytes(1); |
9655 | #endif | 10363 | #endif |
@@ -9693,6 +10401,38 @@ void LLScriptState::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas | |||
9693 | gonext(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 10401 | gonext(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
9694 | } | 10402 | } |
9695 | 10403 | ||
10404 | // Converts string to a valid CIL class name and stores the result | ||
10405 | // in the supplied buffer, which should be at least 32 chars long. | ||
10406 | // If the string starts with a UUID, all characters in the UUID are included | ||
10407 | // in the generated name. | ||
10408 | void to_class_name(char* buffer, const char* string) | ||
10409 | { | ||
10410 | strcpy(buffer, "LSL-"); | ||
10411 | strcat(buffer, string); | ||
10412 | char* current_char = buffer; | ||
10413 | while((*current_char) != 0) | ||
10414 | { | ||
10415 | if(isalnum(*current_char)) | ||
10416 | { | ||
10417 | ++current_char; | ||
10418 | } | ||
10419 | else if((*current_char) == '-') | ||
10420 | { | ||
10421 | (*current_char) = '_'; | ||
10422 | ++current_char; | ||
10423 | } | ||
10424 | else | ||
10425 | { | ||
10426 | (*current_char) = 0; | ||
10427 | } | ||
10428 | } | ||
10429 | } | ||
10430 | |||
10431 | void LLScriptScript::setClassName(const char* class_name) | ||
10432 | { | ||
10433 | to_class_name(mClassName, class_name); | ||
10434 | } | ||
10435 | |||
9696 | S32 LLScriptScript::getSize() | 10436 | S32 LLScriptScript::getSize() |
9697 | { | 10437 | { |
9698 | return 0; | 10438 | return 0; |
@@ -9704,8 +10444,8 @@ LLScriptScript::LLScriptScript(LLScritpGlobalStorage *globals, | |||
9704 | mStates(states), mGlobalScope(NULL), mGlobals(NULL), mGlobalFunctions(NULL), mGodLike(FALSE) | 10444 | mStates(states), mGlobalScope(NULL), mGlobals(NULL), mGlobalFunctions(NULL), mGodLike(FALSE) |
9705 | { | 10445 | { |
9706 | const char DEFAULT_BYTECODE_FILENAME[] = "lscript.lso"; | 10446 | const char DEFAULT_BYTECODE_FILENAME[] = "lscript.lso"; |
9707 | strncpy(mBytecodeDest, DEFAULT_BYTECODE_FILENAME, sizeof(mBytecodeDest) -1); /*Flawfinder: ignore*/ | 10447 | |
9708 | mBytecodeDest[MAX_STRING-1] = '\0'; | 10448 | mBytecodeDest = DEFAULT_BYTECODE_FILENAME; |
9709 | LLScriptGlobalVariable *tvar; | 10449 | LLScriptGlobalVariable *tvar; |
9710 | LLScriptGlobalFunctions *tfunc; | 10450 | LLScriptGlobalFunctions *tfunc; |
9711 | LLScritpGlobalStorage *temp; | 10451 | LLScritpGlobalStorage *temp; |
@@ -9751,17 +10491,14 @@ LLScriptScript::LLScriptScript(LLScritpGlobalStorage *globals, | |||
9751 | 10491 | ||
9752 | void LLScriptScript::setBytecodeDest(const char* dst_filename) | 10492 | void LLScriptScript::setBytecodeDest(const char* dst_filename) |
9753 | { | 10493 | { |
9754 | strncpy(mBytecodeDest, dst_filename, MAX_STRING); /*Flawfinder: ignore*/ | 10494 | mBytecodeDest = ll_safe_string(dst_filename); |
9755 | mBytecodeDest[MAX_STRING-1] = '\0'; | ||
9756 | } | 10495 | } |
9757 | 10496 | ||
9758 | void print_cil_globals(LLFILE* fp, LLScriptGlobalVariable* global) | 10497 | static void print_cil_globals(LLFILE* fp, LLScriptGlobalVariable* global) |
9759 | { | 10498 | { |
9760 | fprintf(fp, ".field private "); | 10499 | fprintf(fp, ".field public "); |
9761 | print_cil_type(fp, global->mType->mType); | 10500 | print_cil_type(fp, global->mType->mType); |
9762 | fprintf(fp, " "); | 10501 | fprintf(fp, " '%s'\n", global->mIdentifier->mName); |
9763 | fprintf(fp, global->mIdentifier->mName); /*Flawfinder: ignore*/ | ||
9764 | fprintf(fp, "\n"); | ||
9765 | if(NULL != global->mNextp) | 10502 | if(NULL != global->mNextp) |
9766 | { | 10503 | { |
9767 | print_cil_globals(fp, global->mNextp); | 10504 | print_cil_globals(fp, global->mNextp); |
@@ -9804,7 +10541,7 @@ void LLScriptScript::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa | |||
9804 | mGlobalScope = new LLScriptScope(gScopeStringTable); | 10541 | mGlobalScope = new LLScriptScope(gScopeStringTable); |
9805 | // zeroth, add library functions to global scope | 10542 | // zeroth, add library functions to global scope |
9806 | S32 i; | 10543 | S32 i; |
9807 | char *arg; | 10544 | const char *arg; |
9808 | LLScriptScopeEntry *sentry; | 10545 | LLScriptScopeEntry *sentry; |
9809 | for (i = 0; i < gScriptLibrary.mNextNumber; i++) | 10546 | for (i = 0; i < gScriptLibrary.mNextNumber; i++) |
9810 | { | 10547 | { |
@@ -9948,72 +10685,66 @@ void LLScriptScript::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa | |||
9948 | } | 10685 | } |
9949 | break; | 10686 | break; |
9950 | case LSCP_EMIT_CIL_ASSEMBLY: | 10687 | case LSCP_EMIT_CIL_ASSEMBLY: |
10688 | { | ||
10689 | LLFILE *bcfp = LLFile::fopen(mBytecodeDest, "wb"); | ||
9951 | 10690 | ||
9952 | // Output dependencies. | 10691 | // Output dependencies. |
9953 | fprintf(fp, ".assembly extern mscorlib {.ver 1:0:5000:0}\n"); | 10692 | fprintf(bcfp, ".assembly extern mscorlib {.ver 1:0:5000:0}\n"); |
9954 | fprintf(fp, ".assembly extern LScriptLibrary {.ver 0:0:0:0}\n"); | 10693 | fprintf(bcfp, ".assembly extern LslLibrary {.ver 0:1:0:0}\n"); |
10694 | fprintf(bcfp, ".assembly extern LslUserScript {.ver 0:1:0:0}\n"); | ||
10695 | fprintf(bcfp, ".assembly extern ScriptTypes {.ver 0:1:0:0}\n"); | ||
9955 | 10696 | ||
9956 | // Output assembly name. | 10697 | // Output assembly name. |
9957 | fprintf(fp, ".assembly 'lsl' {.ver 0:0:0:0}\n"); | 10698 | fprintf(bcfp, ".assembly '%s' {.ver 0:0:0:0}\n", gScriptp->getClassName()); |
9958 | 10699 | ||
9959 | // Output class header. | 10700 | // Output class header. |
9960 | fprintf(fp, ".class public auto ansi beforefieldinit LSL extends [mscorlib]System.Object\n"); | 10701 | fprintf(bcfp, ".class public auto ansi serializable beforefieldinit %s extends [LslUserScript]LindenLab.SecondLife.LslUserScript\n", gScriptp->getClassName()); |
9961 | fprintf(fp, "{\n"); | 10702 | fprintf(bcfp, "{\n"); |
9962 | 10703 | ||
9963 | // Output globals as members. | 10704 | // Output globals as members. |
9964 | if(NULL != mGlobals) | 10705 | if(NULL != mGlobals) |
9965 | { | 10706 | { |
9966 | print_cil_globals(fp, mGlobals); | 10707 | print_cil_globals(bcfp, mGlobals); |
9967 | } | 10708 | } |
9968 | |||
9969 | // Output "runtime". Only needed to allow stand alone execution. Not needed when compiling to DLL and using embedded runtime. | ||
9970 | fprintf(fp, ".method public static hidebysig default void Main () cil managed\n"); | ||
9971 | fprintf(fp, "{\n"); | ||
9972 | fprintf(fp, ".entrypoint\n"); | ||
9973 | fprintf(fp, ".maxstack 2\n"); | ||
9974 | fprintf(fp, ".locals init (class LSL V_0)\n"); | ||
9975 | fprintf(fp, "newobj instance void class LSL::.ctor()\n"); | ||
9976 | fprintf(fp, "stloc.0\n"); | ||
9977 | fprintf(fp, "ldloc.0\n"); | ||
9978 | fprintf(fp, "callvirt instance void class LSL::defaultstate_entry()\n"); | ||
9979 | fprintf(fp, "ret\n"); | ||
9980 | fprintf(fp, "}\n"); | ||
9981 | 10709 | ||
9982 | // Output ctor header. | 10710 | // Output ctor header. |
9983 | fprintf(fp, ".method public hidebysig specialname rtspecialname instance default void .ctor () cil managed\n"); | 10711 | fprintf(bcfp, ".method public hidebysig specialname rtspecialname instance default void .ctor () cil managed\n"); |
9984 | fprintf(fp, "{\n"); | 10712 | fprintf(bcfp, "{\n"); |
9985 | fprintf(fp, ".maxstack 500\n"); | 10713 | fprintf(bcfp, ".maxstack 500\n"); |
9986 | 10714 | ||
9987 | // Initialise globals as members in ctor. | 10715 | // Initialise globals as members in ctor. |
9988 | if (mGlobals) | 10716 | if (mGlobals) |
9989 | { | 10717 | { |
9990 | fdotabs(fp, tabs, tabsize); | 10718 | fdotabs(bcfp, tabs, tabsize); |
9991 | mGlobals->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 10719 | mGlobals->recurse(bcfp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
9992 | fprintf(fp, "\n"); | 10720 | fprintf(bcfp, "\n"); |
9993 | } | 10721 | } |
9994 | 10722 | ||
9995 | // Output ctor footer. | 10723 | // Output ctor footer. |
9996 | fprintf(fp, "ldarg.0\n"); | 10724 | fprintf(bcfp, "ldarg.0\n"); |
9997 | fprintf(fp, "call instance void valuetype [mscorlib]System.Object::.ctor()\n"); | 10725 | fprintf(bcfp, "call instance void [LslUserScript]LindenLab.SecondLife.LslUserScript::.ctor()\n"); |
9998 | fprintf(fp, "ret\n"); | 10726 | fprintf(bcfp, "ret\n"); |
9999 | fprintf(fp, "}\n"); | 10727 | fprintf(bcfp, "}\n"); |
10000 | 10728 | ||
10001 | // Output functions as methods. | 10729 | // Output functions as methods. |
10002 | if (mGlobalFunctions) | 10730 | if (mGlobalFunctions) |
10003 | { | 10731 | { |
10004 | fdotabs(fp, tabs, tabsize); | 10732 | fdotabs(bcfp, tabs, tabsize); |
10005 | mGlobalFunctions->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 10733 | mGlobalFunctions->recurse(bcfp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
10006 | fprintf(fp, "\n"); | 10734 | fprintf(bcfp, "\n"); |
10007 | } | 10735 | } |
10008 | 10736 | ||
10009 | // Output states as name mangled methods. | 10737 | // Output states as name mangled methods. |
10010 | fdotabs(fp, tabs, tabsize); | 10738 | fdotabs(bcfp, tabs, tabsize); |
10011 | mStates->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); | 10739 | mStates->recurse(bcfp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); |
10012 | fprintf(fp, "\n"); | 10740 | fprintf(bcfp, "\n"); |
10013 | 10741 | ||
10014 | // Output class footer. | 10742 | // Output class footer. |
10015 | fprintf(fp, "}\n"); | 10743 | fprintf(bcfp, "}\n"); |
10016 | 10744 | ||
10745 | // Close file. | ||
10746 | fclose(bcfp); | ||
10747 | } | ||
10017 | break; | 10748 | break; |
10018 | default: | 10749 | default: |
10019 | if (mGlobals) | 10750 | if (mGlobals) |
diff --git a/linden/indra/lscript/lscript_compile/lscript_tree.h b/linden/indra/lscript/lscript_compile/lscript_tree.h index 1c2ba1f..7c0d883 100644 --- a/linden/indra/lscript/lscript_compile/lscript_tree.h +++ b/linden/indra/lscript/lscript_compile/lscript_tree.h | |||
@@ -2197,11 +2197,11 @@ public: | |||
2197 | void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); | 2197 | void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); |
2198 | S32 getSize(); | 2198 | S32 getSize(); |
2199 | 2199 | ||
2200 | LSCRIPTStateType mType; | 2200 | LSCRIPTStateType mType; |
2201 | LLScriptIdentifier *mIdentifier; | 2201 | LLScriptIdentifier *mIdentifier; |
2202 | LLScriptEventHandler *mEvent; | 2202 | LLScriptEventHandler *mEvent; |
2203 | LLScriptState *mNextp; | 2203 | LLScriptState *mNextp; |
2204 | 2204 | LLScriptScope *mStateScope; | |
2205 | }; | 2205 | }; |
2206 | 2206 | ||
2207 | class LLScritpGlobalStorage : public LLScriptFilePosition | 2207 | class LLScritpGlobalStorage : public LLScriptFilePosition |
@@ -2262,6 +2262,9 @@ public: | |||
2262 | 2262 | ||
2263 | void setBytecodeDest(const char* dst_filename); | 2263 | void setBytecodeDest(const char* dst_filename); |
2264 | 2264 | ||
2265 | void setClassName(const char* class_name); | ||
2266 | const char* getClassName() {return mClassName;} | ||
2267 | |||
2265 | LLScriptState *mStates; | 2268 | LLScriptState *mStates; |
2266 | LLScriptScope *mGlobalScope; | 2269 | LLScriptScope *mGlobalScope; |
2267 | LLScriptGlobalVariable *mGlobals; | 2270 | LLScriptGlobalVariable *mGlobals; |
@@ -2269,7 +2272,8 @@ public: | |||
2269 | BOOL mGodLike; | 2272 | BOOL mGodLike; |
2270 | 2273 | ||
2271 | private: | 2274 | private: |
2272 | char mBytecodeDest[MAX_STRING]; /*Flawfinder: ignore*/ | 2275 | std::string mBytecodeDest; |
2276 | char mClassName[MAX_STRING]; | ||
2273 | }; | 2277 | }; |
2274 | 2278 | ||
2275 | class LLScriptAllocationManager | 2279 | class LLScriptAllocationManager |
diff --git a/linden/indra/lscript/lscript_compile/lscript_typecheck.cpp b/linden/indra/lscript/lscript_compile/lscript_typecheck.cpp index 8c3738d..118aea0 100644 --- a/linden/indra/lscript/lscript_compile/lscript_typecheck.cpp +++ b/linden/indra/lscript/lscript_compile/lscript_typecheck.cpp | |||
@@ -66,7 +66,13 @@ LSCRIPTType implicit_casts(LSCRIPTType left_side, LSCRIPTType right_side) | |||
66 | { | 66 | { |
67 | // shouldn't be doing an operation on void types | 67 | // shouldn't be doing an operation on void types |
68 | case LST_NULL: | 68 | case LST_NULL: |
69 | return LST_NULL; | 69 | switch(right_side) |
70 | { | ||
71 | case LST_NULL: | ||
72 | return LST_NULL; | ||
73 | default: | ||
74 | return LST_UNDEFINED; | ||
75 | } | ||
70 | // shouldn't be doing an operation on undefined types | 76 | // shouldn't be doing an operation on undefined types |
71 | case LST_UNDEFINED: | 77 | case LST_UNDEFINED: |
72 | return LST_UNDEFINED; | 78 | return LST_UNDEFINED; |
diff --git a/linden/indra/lscript/lscript_execute.h b/linden/indra/lscript/lscript_execute.h index 997e04d..ac23ff3 100644 --- a/linden/indra/lscript/lscript_execute.h +++ b/linden/indra/lscript/lscript_execute.h | |||
@@ -367,20 +367,158 @@ public: | |||
367 | class LLScriptExecute | 367 | class LLScriptExecute |
368 | { | 368 | { |
369 | public: | 369 | public: |
370 | LLScriptExecute(LLFILE *fp); | 370 | LLScriptExecute(); |
371 | LLScriptExecute(U8 *buffer); | 371 | virtual ~LLScriptExecute() {;} |
372 | ~LLScriptExecute(); | 372 | |
373 | virtual S32 getVersion() = 0; | ||
374 | virtual void deleteAllEvents() = 0; | ||
375 | virtual void addEvent(LLScriptDataCollection* event) = 0; | ||
376 | virtual U32 getEventCount() = 0; | ||
377 | virtual void removeEventType(LSCRIPTStateEventType event_type) = 0; | ||
378 | virtual S32 getFaults() = 0; | ||
379 | virtual void setFault(LSCRIPTRunTimeFaults fault) = 0; | ||
380 | virtual U32 getFreeMemory() = 0; | ||
381 | virtual S32 getParameter() = 0; | ||
382 | virtual void setParameter(S32 value) = 0; | ||
383 | virtual F32 getSleep() const = 0; | ||
384 | virtual void setSleep(F32 value) = 0; | ||
385 | virtual F32 getEnergy() const = 0; | ||
386 | virtual void setEnergy(F32 value) = 0; | ||
387 | virtual U64 getCurrentEvents(S32 version) = 0; | ||
388 | virtual void setCurrentEvents(U64 value, S32 version) = 0; | ||
389 | virtual U64 getEventHandlers(S32 version) = 0; | ||
390 | virtual void setEventHandlers(U64 value, S32 version) = 0; | ||
391 | virtual U64 getCurrentHandler(S32 version) = 0; | ||
392 | virtual void setCurrentHandler(U64 value, S32 version) = 0; | ||
393 | virtual BOOL isFinished() const = 0; | ||
394 | virtual BOOL isStateChangePending() const = 0; | ||
395 | virtual S32 writeState(U8 **dest, U32 header_size, U32 footer_size) = 0; // Allocate memory for header, state and footer return size of state. | ||
396 | virtual U32 getEventsSavedSize() = 0; // Returns 0 if events are written with state. | ||
397 | virtual S32 writeEvents(U8 *dest) = 0; // Must write and return exactly the number of bytes returned by getEventsSavedSize. | ||
398 | virtual void readEvents(U8* src, S32& offset) = 0; | ||
399 | virtual S32 readState(U8 *src) = 0; // Returns number of bytes read. | ||
400 | virtual void reset(); | ||
401 | virtual const U8* getBytecode() const = 0; | ||
402 | virtual U32 getBytecodeSize() const = 0; | ||
403 | virtual bool isMono() const = 0; | ||
404 | virtual void error() {;} // Processing that must be performed when error flag is set and so run is not called. | ||
405 | |||
406 | // Run current event handler for a maximum of time_slice seconds. | ||
407 | // Updates current handler and current events registers. | ||
408 | virtual void resumeEventHandler(BOOL b_print, const LLUUID &id, F32 time_slice) = 0; | ||
409 | |||
410 | // Run handler for event for a maximum of time_slice seconds. | ||
411 | // Updates current handler and current events registers. | ||
412 | virtual void callEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice) = 0;; | ||
413 | |||
414 | // Run handler for next queued event for maximum of time_slice seconds. | ||
415 | // Updates current handler and current events registers. | ||
416 | // Removes processed event from queue. | ||
417 | virtual void callNextQueuedEventHandler(U64 event_register, S32 major_version, const LLUUID &id, F32 time_slice) = 0; | ||
418 | |||
419 | // Run handler for event for a maximum of time_slice seconds. | ||
420 | // Updates current handler and current events registers. | ||
421 | // Removes processed event from queue. | ||
422 | virtual void callQueuedEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice) = 0; | ||
423 | |||
424 | // Switch to next state. | ||
425 | // Returns new set of handled events. | ||
426 | virtual U64 nextState() = 0; | ||
427 | |||
428 | // Returns time taken. | ||
429 | virtual F32 runQuanta(BOOL b_print, const LLUUID &id, | ||
430 | const char **errorstr, | ||
431 | BOOL &state_transition, F32 quanta, | ||
432 | U32& events_processed, LLTimer& timer); | ||
433 | |||
434 | // Run smallest possible amount of code: an instruction for LSL2, a segment | ||
435 | // between save tests for Mono | ||
436 | void runInstructions(BOOL b_print, const LLUUID &id, | ||
437 | const char **errorstr, | ||
438 | BOOL &state_transition, U32& events_processed, | ||
439 | F32 quanta); | ||
440 | |||
441 | bool isYieldDue() const; | ||
442 | |||
443 | void setReset(BOOL b) {mReset = b;} | ||
444 | BOOL getReset() const { return mReset; } | ||
445 | |||
446 | private: | ||
447 | |||
448 | BOOL mReset; | ||
449 | }; | ||
450 | |||
451 | class LLScriptExecuteLSL2 : public LLScriptExecute | ||
452 | { | ||
453 | public: | ||
454 | LLScriptExecuteLSL2(LLFILE *fp); | ||
455 | LLScriptExecuteLSL2(const U8* bytecode, U32 bytecode_size); | ||
456 | virtual ~LLScriptExecuteLSL2(); | ||
457 | |||
458 | virtual S32 getVersion() {return get_register(mBuffer, LREG_VN);} | ||
459 | virtual void deleteAllEvents() {mEventData.mEventDataList.deleteAllData();} | ||
460 | virtual void addEvent(LLScriptDataCollection* event); | ||
461 | virtual U32 getEventCount() {return mEventData.mEventDataList.getLength();} | ||
462 | virtual void removeEventType(LSCRIPTStateEventType event_type); | ||
463 | virtual S32 getFaults() {return get_register(mBuffer, LREG_FR);} | ||
464 | virtual void setFault(LSCRIPTRunTimeFaults fault) {set_fault(mBuffer, fault);} | ||
465 | virtual U32 getFreeMemory(); | ||
466 | virtual S32 getParameter(); | ||
467 | virtual void setParameter(S32 value); | ||
468 | virtual F32 getSleep() const; | ||
469 | virtual void setSleep(F32 value); | ||
470 | virtual F32 getEnergy() const; | ||
471 | virtual void setEnergy(F32 value); | ||
472 | virtual U64 getCurrentEvents(S32 version) {return get_event_register(mBuffer, LREG_CE, version);} | ||
473 | virtual void setCurrentEvents(U64 value, S32 version) {return set_event_register(mBuffer, LREG_CE, value, version);} | ||
474 | virtual U64 getEventHandlers(S32 version) {return get_event_register(mBuffer, LREG_ER, version);} | ||
475 | virtual void setEventHandlers(U64 value, S32 version) {set_event_register(mBuffer, LREG_ER, value, version);} | ||
476 | virtual U64 getCurrentHandler(S32 version); | ||
477 | virtual void setCurrentHandler(U64 value, S32 version) {return set_event_register(mBuffer, LREG_IE, value, version);} | ||
478 | virtual BOOL isFinished() const {return get_register(mBuffer, LREG_IP) == 0;} | ||
479 | virtual BOOL isStateChangePending() const {return get_register(mBuffer, LREG_CS) != get_register(mBuffer, LREG_NS);} | ||
480 | virtual S32 writeState(U8 **dest, U32 header_size, U32 footer_size); // Not including Events. | ||
481 | virtual U32 getEventsSavedSize() {return mEventData.getSavedSize();} | ||
482 | virtual S32 writeEvents(U8 *dest) {return mEventData.write2bytestream(dest);} | ||
483 | virtual void readEvents(U8* src, S32& offset) {mEventData.set(src, offset);} | ||
484 | virtual S32 writeBytecode(U8 **dest); | ||
485 | virtual S32 readState(U8 *src); | ||
486 | virtual void reset(); | ||
487 | virtual const U8* getBytecode() const {return mBytecode;} | ||
488 | virtual U32 getBytecodeSize() const {return mBytecodeSize;} | ||
489 | virtual bool isMono() const {return false;} | ||
490 | |||
491 | // Run current event handler for a maximum of time_slice seconds. | ||
492 | // Updates current handler and current events registers. | ||
493 | virtual void resumeEventHandler(BOOL b_print, const LLUUID &id, F32 time_slice); | ||
494 | |||
495 | // Run handler for event for a maximum of time_slice seconds. | ||
496 | // Updates current handler and current events registers. | ||
497 | virtual void callEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice); | ||
498 | |||
499 | // Run handler for next queued event for maximum of time_slice seconds. | ||
500 | // Updates current handler and current events registers. | ||
501 | // Removes processed event from queue. | ||
502 | virtual void callNextQueuedEventHandler(U64 event_register, S32 major_version, const LLUUID &id, F32 time_slice); | ||
503 | |||
504 | // Run handler for event for a maximum of time_slice seconds. | ||
505 | // Updates current handler and current events registers. | ||
506 | // Removes processed event from queue. | ||
507 | virtual void callQueuedEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice); | ||
508 | |||
509 | // Switch to next state. | ||
510 | // Returns new set of handled events. | ||
511 | virtual U64 nextState(); | ||
373 | 512 | ||
374 | void init(); | 513 | void init(); |
375 | U32 run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL &state_transition); | ||
376 | 514 | ||
377 | BOOL (*mExecuteFuncs[0x100])(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id); | 515 | BOOL (*mExecuteFuncs[0x100])(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id); |
378 | 516 | ||
379 | U32 mInstructionCount; | 517 | U32 mInstructionCount; |
380 | U8 *mBuffer; | 518 | U8 *mBuffer; |
381 | LLScriptEventData mEventData; | 519 | LLScriptEventData mEventData; |
382 | 520 | U8* mBytecode; // Initial state and bytecode. | |
383 | static S64 sGlobalInstructionCount; | 521 | U32 mBytecodeSize; |
384 | 522 | ||
385 | private: | 523 | private: |
386 | void recordBoundaryError( const LLUUID &id ); | 524 | void recordBoundaryError( const LLUUID &id ); |
diff --git a/linden/indra/lscript/lscript_execute/CMakeLists.txt b/linden/indra/lscript/lscript_execute/CMakeLists.txt new file mode 100644 index 0000000..f30915b --- /dev/null +++ b/linden/indra/lscript/lscript_execute/CMakeLists.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | include(00-Common) | ||
4 | include(LLCommon) | ||
5 | include(LLMath) | ||
6 | include(LScript) | ||
7 | |||
8 | include_directories( | ||
9 | ${LLCOMMON_INCLUDE_DIRS} | ||
10 | ${LLMATH_INCLUDE_DIRS} | ||
11 | ${LSCRIPT_INCLUDE_DIRS} | ||
12 | ) | ||
13 | |||
14 | set(lscript_execute_SOURCE_FILES | ||
15 | lscript_execute.cpp | ||
16 | lscript_heapruntime.cpp | ||
17 | lscript_readlso.cpp | ||
18 | ) | ||
19 | |||
20 | set(lscript_execute_HEADER_FILES | ||
21 | CMakeLists.txt | ||
22 | |||
23 | ../lscript_execute.h | ||
24 | ../lscript_rt_interface.h | ||
25 | lscript_heapruntime.h | ||
26 | lscript_readlso.h | ||
27 | ) | ||
28 | |||
29 | set_source_files_properties(${lscript_execute_HEADER_FILES} | ||
30 | PROPERTIES HEADER_FILE_ONLY TRUE) | ||
31 | |||
32 | list(APPEND lscript_execute_SOURCE_FILES ${lscript_execute_HEADER_FILES}) | ||
33 | |||
34 | add_library (lscript_execute ${lscript_execute_SOURCE_FILES}) | ||
diff --git a/linden/indra/lscript/lscript_execute/lscript_execute.cpp b/linden/indra/lscript/lscript_execute/lscript_execute.cpp index 643f3f6..3adfe32 100644 --- a/linden/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/linden/indra/lscript/lscript_execute/lscript_execute.cpp | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include "linden_common.h" | 32 | #include "linden_common.h" |
33 | 33 | ||
34 | #include <algorithm> | ||
34 | #include <sstream> | 35 | #include <sstream> |
35 | 36 | ||
36 | #include "lscript_execute.h" | 37 | #include "lscript_execute.h" |
@@ -43,9 +44,9 @@ | |||
43 | void (*binary_operations[LST_EOF][LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); | 44 | void (*binary_operations[LST_EOF][LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); |
44 | void (*unary_operations[LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); | 45 | void (*unary_operations[LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); |
45 | 46 | ||
46 | char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ | 47 | const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ |
47 | { | 48 | { |
48 | "invalid", // LSRF_INVALID, | 49 | "Invalid", // LSRF_INVALID, |
49 | "Math Error", // LSRF_MATH, | 50 | "Math Error", // LSRF_MATH, |
50 | "Stack-Heap Collision", // LSRF_STACK_HEAP_COLLISION, | 51 | "Stack-Heap Collision", // LSRF_STACK_HEAP_COLLISION, |
51 | "Bounds Check Error", // LSRF_BOUND_CHECK_ERROR, | 52 | "Bounds Check Error", // LSRF_BOUND_CHECK_ERROR, |
@@ -55,13 +56,11 @@ char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ | |||
55 | "Hit Sandbox Limit", // LSRF_SANDBOX, | 56 | "Hit Sandbox Limit", // LSRF_SANDBOX, |
56 | "Chat Overrun", // LSRF_CHAT_OVERRUN, | 57 | "Chat Overrun", // LSRF_CHAT_OVERRUN, |
57 | "Too Many Listens", // LSRF_TOO_MANY_LISTENS, | 58 | "Too Many Listens", // LSRF_TOO_MANY_LISTENS, |
58 | "Lists may not contain lists" // LSRF_NESTING_LISTS, | 59 | "Lists may not contain lists", // LSRF_NESTING_LISTS, |
60 | "CLI Exception" // LSRF_CLI | ||
59 | }; | 61 | }; |
60 | 62 | ||
61 | //static | 63 | LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp) |
62 | S64 LLScriptExecute::sGlobalInstructionCount = 0; | ||
63 | |||
64 | LLScriptExecute::LLScriptExecute(LLFILE *fp) | ||
65 | { | 64 | { |
66 | U8 sizearray[4]; | 65 | U8 sizearray[4]; |
67 | S32 filesize; | 66 | S32 filesize; |
@@ -84,19 +83,26 @@ LLScriptExecute::LLScriptExecute(LLFILE *fp) | |||
84 | init(); | 83 | init(); |
85 | } | 84 | } |
86 | 85 | ||
87 | LLScriptExecute::LLScriptExecute(U8 *buffer) | 86 | LLScriptExecuteLSL2::LLScriptExecuteLSL2(const U8* bytecode, U32 bytecode_size) |
88 | { | 87 | { |
89 | mBuffer = buffer; | 88 | mBuffer = new U8[TOP_OF_MEMORY]; |
90 | 89 | memset(mBuffer + bytecode_size, 0, TOP_OF_MEMORY - bytecode_size); | |
90 | S32 src_offset = 0; | ||
91 | S32 dest_offset = 0; | ||
92 | bytestream2bytestream(mBuffer, dest_offset, bytecode, src_offset, bytecode_size); | ||
93 | mBytecodeSize = bytecode_size; | ||
94 | mBytecode = new U8[mBytecodeSize]; | ||
95 | memcpy(mBytecode, bytecode, mBytecodeSize); | ||
91 | init(); | 96 | init(); |
92 | } | 97 | } |
93 | 98 | ||
94 | LLScriptExecute::~LLScriptExecute() | 99 | LLScriptExecuteLSL2::~LLScriptExecuteLSL2() |
95 | { | 100 | { |
96 | delete [] mBuffer; | 101 | delete[] mBuffer; |
102 | delete[] mBytecode; | ||
97 | } | 103 | } |
98 | 104 | ||
99 | void LLScriptExecute::init() | 105 | void LLScriptExecuteLSL2::init() |
100 | { | 106 | { |
101 | S32 i, j; | 107 | S32 i, j; |
102 | 108 | ||
@@ -270,7 +276,7 @@ void LLScriptExecute::init() | |||
270 | 276 | ||
271 | 277 | ||
272 | // Utility routine for when there's a boundary error parsing bytecode | 278 | // Utility routine for when there's a boundary error parsing bytecode |
273 | void LLScriptExecute::recordBoundaryError( const LLUUID &id ) | 279 | void LLScriptExecuteLSL2::recordBoundaryError( const LLUUID &id ) |
274 | { | 280 | { |
275 | set_fault(mBuffer, LSRF_BOUND_CHECK_ERROR); | 281 | set_fault(mBuffer, LSRF_BOUND_CHECK_ERROR); |
276 | llwarns << "Script boundary error for ID " << id << llendl; | 282 | llwarns << "Script boundary error for ID " << id << llendl; |
@@ -278,7 +284,7 @@ void LLScriptExecute::recordBoundaryError( const LLUUID &id ) | |||
278 | 284 | ||
279 | 285 | ||
280 | // set IP to the event handler with some error checking | 286 | // set IP to the event handler with some error checking |
281 | void LLScriptExecute::setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEventType event, const LLUUID &id ) | 287 | void LLScriptExecuteLSL2::setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEventType event, const LLUUID &id ) |
282 | { | 288 | { |
283 | S32 opcode_start = get_state_event_opcoode_start( mBuffer, state, event ); | 289 | S32 opcode_start = get_state_event_opcoode_start( mBuffer, state, event ); |
284 | if ( opcode_start == -1 ) | 290 | if ( opcode_start == -1 ) |
@@ -296,12 +302,474 @@ void LLScriptExecute::setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEv | |||
296 | 302 | ||
297 | S32 lscript_push_variable(LLScriptLibData *data, U8 *buffer); | 303 | S32 lscript_push_variable(LLScriptLibData *data, U8 *buffer); |
298 | 304 | ||
299 | U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL &state_transition) | 305 | void LLScriptExecuteLSL2::resumeEventHandler(BOOL b_print, const LLUUID &id, F32 time_slice) |
306 | { | ||
307 | // call opcode run function pointer with buffer and IP | ||
308 | mInstructionCount++; | ||
309 | S32 value = get_register(mBuffer, LREG_IP); | ||
310 | S32 tvalue = value; | ||
311 | S32 opcode = safe_instruction_bytestream2byte(mBuffer, tvalue); | ||
312 | mExecuteFuncs[opcode](mBuffer, value, b_print, id); | ||
313 | set_ip(mBuffer, value); | ||
314 | add_register_fp(mBuffer, LREG_ESR, -0.1f); | ||
315 | // lsa_print_heap(mBuffer); | ||
316 | |||
317 | if (b_print) | ||
318 | { | ||
319 | lsa_print_heap(mBuffer); | ||
320 | printf("ip: 0x%X\n", get_register(mBuffer, LREG_IP)); | ||
321 | printf("sp: 0x%X\n", get_register(mBuffer, LREG_SP)); | ||
322 | printf("bp: 0x%X\n", get_register(mBuffer, LREG_BP)); | ||
323 | printf("hr: 0x%X\n", get_register(mBuffer, LREG_HR)); | ||
324 | printf("hp: 0x%X\n", get_register(mBuffer, LREG_HP)); | ||
325 | } | ||
326 | |||
327 | // NOTE: Babbage: all mExecuteFuncs return false. | ||
328 | } | ||
329 | |||
330 | void LLScriptExecuteLSL2::callEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice) | ||
331 | { | ||
332 | // push a zero to be popped | ||
333 | lscript_push(mBuffer, 0); | ||
334 | // push sp as current bp | ||
335 | S32 sp = get_register(mBuffer, LREG_SP); | ||
336 | lscript_push(mBuffer, sp); | ||
337 | |||
338 | // Update current handler and current events registers. | ||
339 | set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); | ||
340 | U64 current_events = get_event_register(mBuffer, LREG_CE, major_version); | ||
341 | current_events &= ~LSCRIPTStateBitField[event]; | ||
342 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | ||
343 | |||
344 | // now, push any additional stack space | ||
345 | U32 current_state = get_register(mBuffer, LREG_CS); | ||
346 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event); | ||
347 | lscript_pusharge(mBuffer, additional_size); | ||
348 | |||
349 | // now set the bp correctly | ||
350 | sp = get_register(mBuffer, LREG_SP); | ||
351 | sp += additional_size; | ||
352 | set_bp(mBuffer, sp); | ||
353 | |||
354 | // set IP to the function | ||
355 | S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); | ||
356 | set_ip(mBuffer, opcode_start); | ||
357 | } | ||
358 | |||
359 | //void callStateExitHandler() | ||
360 | //{ | ||
361 | // // push a zero to be popped | ||
362 | // lscript_push(mBuffer, 0); | ||
363 | // // push sp as current bp | ||
364 | // S32 sp = get_register(mBuffer, LREG_SP); | ||
365 | // lscript_push(mBuffer, sp); | ||
366 | // | ||
367 | // // now, push any additional stack space | ||
368 | // S32 additional_size = get_event_stack_size(mBuffer, current_state, LSTT_STATE_EXIT); | ||
369 | // lscript_pusharge(mBuffer, additional_size); | ||
370 | // | ||
371 | // sp = get_register(mBuffer, LREG_SP); | ||
372 | // sp += additional_size; | ||
373 | // set_bp(mBuffer, sp); | ||
374 | // | ||
375 | // // set IP to the event handler | ||
376 | // S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, LSTT_STATE_EXIT); | ||
377 | // set_ip(mBuffer, opcode_start); | ||
378 | //} | ||
379 | // | ||
380 | //void callStateEntryHandler() | ||
381 | //{ | ||
382 | // // push a zero to be popped | ||
383 | // lscript_push(mBuffer, 0); | ||
384 | // // push sp as current bp | ||
385 | // S32 sp = get_register(mBuffer, LREG_SP); | ||
386 | // lscript_push(mBuffer, sp); | ||
387 | // | ||
388 | // event = return_first_event((S32)LSCRIPTStateBitField[LSTT_STATE_ENTRY]); | ||
389 | // set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); | ||
390 | // current_events &= ~LSCRIPTStateBitField[event]; | ||
391 | // set_event_register(mBuffer, LREG_CE, current_events, major_version); | ||
392 | // | ||
393 | // // now, push any additional stack space | ||
394 | // S32 additional_size = get_event_stack_size(mBuffer, current_state, event) - size; | ||
395 | // lscript_pusharge(mBuffer, additional_size); | ||
396 | // | ||
397 | // // now set the bp correctly | ||
398 | // sp = get_register(mBuffer, LREG_SP); | ||
399 | // sp += additional_size + size; | ||
400 | // set_bp(mBuffer, sp); | ||
401 | // // set IP to the function | ||
402 | // S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); | ||
403 | // set_ip(mBuffer, opcode_start); | ||
404 | //} | ||
405 | |||
406 | void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice) | ||
407 | { | ||
408 | LLScriptDataCollection* eventdata; | ||
409 | |||
410 | for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData()) | ||
411 | { | ||
412 | if (eventdata->mType == event) | ||
413 | { | ||
414 | // push a zero to be popped | ||
415 | lscript_push(mBuffer, 0); | ||
416 | // push sp as current bp | ||
417 | S32 sp = get_register(mBuffer, LREG_SP); | ||
418 | lscript_push(mBuffer, sp); | ||
419 | |||
420 | // Update current handler and current events registers. | ||
421 | set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); | ||
422 | U64 current_events = get_event_register(mBuffer, LREG_CE, major_version); | ||
423 | current_events &= ~LSCRIPTStateBitField[event]; | ||
424 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | ||
425 | |||
426 | // push any arguments that need to be pushed onto the stack | ||
427 | // last piece of data will be type LST_NULL | ||
428 | LLScriptLibData *data = eventdata->mData; | ||
429 | U32 size = 0; | ||
430 | while (data->mType) | ||
431 | { | ||
432 | size += lscript_push_variable(data, mBuffer); | ||
433 | data++; | ||
434 | } | ||
435 | // now, push any additional stack space | ||
436 | U32 current_state = get_register(mBuffer, LREG_CS); | ||
437 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event) - size; | ||
438 | lscript_pusharge(mBuffer, additional_size); | ||
439 | |||
440 | // now set the bp correctly | ||
441 | sp = get_register(mBuffer, LREG_SP); | ||
442 | sp += additional_size + size; | ||
443 | set_bp(mBuffer, sp); | ||
444 | |||
445 | // set IP to the function | ||
446 | S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); | ||
447 | set_ip(mBuffer, opcode_start); | ||
448 | |||
449 | mEventData.mEventDataList.deleteCurrentData(); | ||
450 | break; | ||
451 | } | ||
452 | } | ||
453 | } | ||
454 | |||
455 | void LLScriptExecuteLSL2::callNextQueuedEventHandler(U64 event_register, S32 major_version, const LLUUID &id, F32 time_slice) | ||
456 | { | ||
457 | LLScriptDataCollection* eventdata = mEventData.getNextEvent(); | ||
458 | if (eventdata) | ||
459 | { | ||
460 | LSCRIPTStateEventType event = eventdata->mType; | ||
461 | |||
462 | // make sure that we can actually handle this one | ||
463 | if (LSCRIPTStateBitField[event] & event_register) | ||
464 | { | ||
465 | // push a zero to be popped | ||
466 | lscript_push(mBuffer, 0); | ||
467 | // push sp as current bp | ||
468 | S32 sp = get_register(mBuffer, LREG_SP); | ||
469 | lscript_push(mBuffer, sp); | ||
470 | |||
471 | // Update current handler and current events registers. | ||
472 | set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); | ||
473 | U64 current_events = get_event_register(mBuffer, LREG_CE, major_version); | ||
474 | current_events &= ~LSCRIPTStateBitField[event]; | ||
475 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | ||
476 | |||
477 | // push any arguments that need to be pushed onto the stack | ||
478 | // last piece of data will be type LST_NULL | ||
479 | LLScriptLibData *data = eventdata->mData; | ||
480 | U32 size = 0; | ||
481 | while (data->mType) | ||
482 | { | ||
483 | size += lscript_push_variable(data, mBuffer); | ||
484 | data++; | ||
485 | } | ||
486 | |||
487 | // now, push any additional stack space | ||
488 | U32 current_state = get_register(mBuffer, LREG_CS); | ||
489 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event) - size; | ||
490 | lscript_pusharge(mBuffer, additional_size); | ||
491 | |||
492 | // now set the bp correctly | ||
493 | sp = get_register(mBuffer, LREG_SP); | ||
494 | sp += additional_size + size; | ||
495 | set_bp(mBuffer, sp); | ||
496 | |||
497 | // set IP to the function | ||
498 | S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); | ||
499 | set_ip(mBuffer, opcode_start); | ||
500 | } | ||
501 | else | ||
502 | { | ||
503 | llwarns << "Shit, somehow got an event that we're not registered for!" << llendl; | ||
504 | } | ||
505 | delete eventdata; | ||
506 | } | ||
507 | } | ||
508 | |||
509 | U64 LLScriptExecuteLSL2::nextState() | ||
510 | { | ||
511 | // copy NS to CS | ||
512 | S32 next_state = get_register(mBuffer, LREG_NS); | ||
513 | set_register(mBuffer, LREG_CS, next_state); | ||
514 | |||
515 | // copy new state's handled events into ER (SR + CS*4 + 4) | ||
516 | return get_handled_events(mBuffer, next_state); | ||
517 | } | ||
518 | |||
519 | //virtual | ||
520 | void LLScriptExecuteLSL2::addEvent(LLScriptDataCollection* event) | ||
521 | { | ||
522 | mEventData.addEventData(event); | ||
523 | } | ||
524 | |||
525 | //virtual | ||
526 | void LLScriptExecuteLSL2::removeEventType(LSCRIPTStateEventType event_type) | ||
527 | { | ||
528 | mEventData.removeEventType(event_type); | ||
529 | } | ||
530 | |||
531 | //virtual | ||
532 | F32 LLScriptExecuteLSL2::getSleep() const | ||
533 | { | ||
534 | return get_register_fp(mBuffer, LREG_SLR); | ||
535 | } | ||
536 | |||
537 | //virtual | ||
538 | void LLScriptExecuteLSL2::setSleep(F32 value) | ||
539 | { | ||
540 | set_register_fp(mBuffer, LREG_SLR, value); | ||
541 | } | ||
542 | |||
543 | //virtual | ||
544 | U64 LLScriptExecuteLSL2::getCurrentHandler(S32 version) | ||
545 | { | ||
546 | return get_event_register(mBuffer, LREG_IE, version); | ||
547 | } | ||
548 | |||
549 | //virtual | ||
550 | F32 LLScriptExecuteLSL2::getEnergy() const | ||
551 | { | ||
552 | return get_register_fp(mBuffer, LREG_ESR); | ||
553 | } | ||
554 | |||
555 | //virtual | ||
556 | void LLScriptExecuteLSL2::setEnergy(F32 value) | ||
557 | { | ||
558 | set_register_fp(mBuffer, LREG_ESR, value); | ||
559 | } | ||
560 | |||
561 | //virtual | ||
562 | U32 LLScriptExecuteLSL2::getFreeMemory() | ||
563 | { | ||
564 | return get_register(mBuffer, LREG_SP) - get_register(mBuffer, LREG_HP); | ||
565 | } | ||
566 | |||
567 | //virtual | ||
568 | S32 LLScriptExecuteLSL2::getParameter() | ||
569 | { | ||
570 | return get_register(mBuffer, LREG_PR); | ||
571 | } | ||
572 | |||
573 | //virtual | ||
574 | void LLScriptExecuteLSL2::setParameter(S32 value) | ||
575 | { | ||
576 | set_register(mBuffer, LREG_PR, value); | ||
577 | } | ||
578 | |||
579 | |||
580 | S32 LLScriptExecuteLSL2::writeState(U8 **dest, U32 header_size, U32 footer_size) | ||
581 | { | ||
582 | // data format: | ||
583 | // 4 bytes of size of Registers, Name and Description, and Global Variables | ||
584 | // Registers, Name and Description, and Global Variables data | ||
585 | // 4 bytes of size of Heap | ||
586 | // Heap data | ||
587 | // 4 bytes of stack size | ||
588 | // Stack data | ||
589 | |||
590 | S32 registers_size = get_register(mBuffer, LREG_GFR); | ||
591 | |||
592 | if (get_register(mBuffer, LREG_HP) > TOP_OF_MEMORY) | ||
593 | reset_hp_to_safe_spot(mBuffer); | ||
594 | |||
595 | S32 heap_size = get_register(mBuffer, LREG_HP) - get_register(mBuffer, LREG_HR); | ||
596 | S32 stack_size = get_register(mBuffer, LREG_TM) - get_register(mBuffer, LREG_SP); | ||
597 | S32 total_size = registers_size + LSCRIPTDataSize[LST_INTEGER] + | ||
598 | heap_size + LSCRIPTDataSize[LST_INTEGER] + | ||
599 | stack_size + LSCRIPTDataSize[LST_INTEGER]; | ||
600 | |||
601 | // actually allocate data | ||
602 | delete[] *dest; | ||
603 | *dest = new U8[header_size + total_size + footer_size]; | ||
604 | memset(*dest, 0, header_size + total_size + footer_size); | ||
605 | S32 dest_offset = header_size; | ||
606 | S32 src_offset = 0; | ||
607 | |||
608 | // registers | ||
609 | integer2bytestream(*dest, dest_offset, registers_size); | ||
610 | |||
611 | // llinfos << "Writing CE: " << getCurrentEvents() << llendl; | ||
612 | bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, registers_size); | ||
613 | |||
614 | // heap | ||
615 | integer2bytestream(*dest, dest_offset, heap_size); | ||
616 | |||
617 | src_offset = get_register(mBuffer, LREG_HR); | ||
618 | bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, heap_size); | ||
619 | |||
620 | // stack | ||
621 | integer2bytestream(*dest, dest_offset, stack_size); | ||
622 | |||
623 | src_offset = get_register(mBuffer, LREG_SP); | ||
624 | bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, stack_size); | ||
625 | |||
626 | return total_size; | ||
627 | } | ||
628 | |||
629 | S32 LLScriptExecuteLSL2::writeBytecode(U8 **dest) | ||
630 | { | ||
631 | // data format: | ||
632 | // registers through top of heap | ||
633 | // Heap data | ||
634 | S32 total_size = get_register(mBuffer, LREG_HP); | ||
635 | |||
636 | // actually allocate data | ||
637 | delete [] *dest; | ||
638 | *dest = new U8[total_size]; | ||
639 | S32 dest_offset = 0; | ||
640 | S32 src_offset = 0; | ||
641 | |||
642 | bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, total_size); | ||
643 | |||
644 | return total_size; | ||
645 | } | ||
646 | |||
647 | S32 LLScriptExecuteLSL2::readState(U8 *src) | ||
648 | { | ||
649 | // first, blitz heap and stack | ||
650 | S32 hr = get_register(mBuffer, LREG_HR); | ||
651 | S32 tm = get_register(mBuffer, LREG_TM); | ||
652 | memset(mBuffer + hr, 0, tm - hr); | ||
653 | |||
654 | S32 src_offset = 0; | ||
655 | S32 dest_offset = 0; | ||
656 | S32 size; | ||
657 | |||
658 | // read register size | ||
659 | size = bytestream2integer(src, src_offset); | ||
660 | |||
661 | // copy data into register area | ||
662 | bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); | ||
663 | // llinfos << "Read CE: " << getCurrentEvents() << llendl; | ||
664 | if (get_register(mBuffer, LREG_TM) != TOP_OF_MEMORY) | ||
665 | { | ||
666 | llwarns << "Invalid state. Top of memory register does not match" | ||
667 | << " constant." << llendl; | ||
668 | reset_hp_to_safe_spot(mBuffer); | ||
669 | return -1; | ||
670 | } | ||
671 | |||
672 | // read heap size | ||
673 | size = bytestream2integer(src, src_offset); | ||
674 | |||
675 | // set dest offset | ||
676 | dest_offset = get_register(mBuffer, LREG_HR); | ||
677 | |||
678 | if (dest_offset + size > TOP_OF_MEMORY) | ||
679 | { | ||
680 | reset_hp_to_safe_spot(mBuffer); | ||
681 | return -1; | ||
682 | } | ||
683 | |||
684 | // copy data into heap area | ||
685 | bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); | ||
686 | |||
687 | // read stack size | ||
688 | size = bytestream2integer(src, src_offset); | ||
689 | |||
690 | // set dest offset | ||
691 | dest_offset = get_register(mBuffer, LREG_SP); | ||
692 | |||
693 | if (dest_offset + size > TOP_OF_MEMORY) | ||
694 | { | ||
695 | reset_hp_to_safe_spot(mBuffer); | ||
696 | return -1; | ||
697 | } | ||
698 | |||
699 | // copy data into heap area | ||
700 | bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); | ||
701 | |||
702 | // Return offset to first byte after read data. | ||
703 | return src_offset; | ||
704 | } | ||
705 | |||
706 | void LLScriptExecuteLSL2::reset() | ||
707 | { | ||
708 | LLScriptExecute::reset(); | ||
709 | |||
710 | const U8 *src = getBytecode(); | ||
711 | S32 size = getBytecodeSize(); | ||
712 | |||
713 | if (!src) | ||
714 | return; | ||
715 | |||
716 | // first, blitz heap and stack | ||
717 | S32 hr = get_register(mBuffer, LREG_HR); | ||
718 | S32 tm = get_register(mBuffer, LREG_TM); | ||
719 | memset(mBuffer + hr, 0, tm - hr); | ||
720 | |||
721 | S32 dest_offset = 0; | ||
722 | S32 src_offset = 0; | ||
723 | |||
724 | bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); | ||
725 | } | ||
726 | |||
727 | LLScriptExecute::LLScriptExecute() : | ||
728 | mReset(FALSE) | ||
729 | { | ||
730 | } | ||
731 | |||
732 | void LLScriptExecute::reset() | ||
733 | { | ||
734 | mReset = FALSE; | ||
735 | } | ||
736 | |||
737 | bool LLScriptExecute::isYieldDue() const | ||
738 | { | ||
739 | if(mReset) | ||
740 | { | ||
741 | return true; | ||
742 | } | ||
743 | |||
744 | if(getSleep() > 0.f) | ||
745 | { | ||
746 | return true; | ||
747 | } | ||
748 | |||
749 | if(isFinished()) | ||
750 | { | ||
751 | return true; | ||
752 | } | ||
753 | |||
754 | if(isStateChangePending()) | ||
755 | { | ||
756 | return true; | ||
757 | } | ||
758 | |||
759 | return false; | ||
760 | } | ||
761 | |||
762 | // Run smallest number of instructions possible: | ||
763 | // a single instruction for LSL2, a segment between save tests for Mono | ||
764 | void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id, | ||
765 | const char **errorstr, | ||
766 | BOOL &state_transition, | ||
767 | U32& events_processed, | ||
768 | F32 quanta) | ||
300 | { | 769 | { |
301 | // is there a fault? | 770 | // is there a fault? |
302 | // if yes, print out message and exit | 771 | // if yes, print out message and exit |
303 | state_transition = FALSE; | 772 | S32 value = getVersion(); |
304 | S32 value = get_register(mBuffer, LREG_VN); | ||
305 | S32 major_version = 0; | 773 | S32 major_version = 0; |
306 | if (value == LSL2_VERSION1_END_NUMBER) | 774 | if (value == LSL2_VERSION1_END_NUMBER) |
307 | { | 775 | { |
@@ -313,323 +781,151 @@ U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL & | |||
313 | } | 781 | } |
314 | else | 782 | else |
315 | { | 783 | { |
316 | set_fault(mBuffer, LSRF_VERSION_MISMATCH); | 784 | setFault(LSRF_VERSION_MISMATCH); |
317 | } | 785 | } |
318 | value = get_register(mBuffer, LREG_FR); | 786 | value = getFaults(); |
319 | if (value) | 787 | if (value > LSRF_INVALID && value < LSRF_EOF) |
320 | { | 788 | { |
321 | if (b_print) | 789 | if (b_print) |
322 | { | 790 | { |
323 | printf("Error!\n"); | 791 | printf("Error!\n"); |
324 | } | 792 | } |
325 | *errorstr = LSCRIPTRunTimeFaultStrings[value]; | 793 | *errorstr = LSCRIPTRunTimeFaultStrings[value]; |
326 | return NO_DELETE_FLAG; | 794 | return; |
327 | } | 795 | } |
328 | else | 796 | else |
329 | { | 797 | { |
330 | *errorstr = NULL; | 798 | *errorstr = NULL; |
331 | } | 799 | } |
332 | 800 | ||
333 | // Get IP | 801 | if (! isFinished()) |
334 | // is IP nonzero? | ||
335 | value = get_register(mBuffer, LREG_IP); | ||
336 | |||
337 | if (value) | ||
338 | { | 802 | { |
339 | // if yes, we're in opcodes, execute the next opcode by: | 803 | resumeEventHandler(b_print, id, quanta); |
340 | // call opcode run function pointer with buffer and IP | 804 | return; |
341 | mInstructionCount++; | ||
342 | sGlobalInstructionCount++; | ||
343 | S32 tvalue = value; | ||
344 | S32 opcode = safe_instruction_bytestream2byte(mBuffer, tvalue); | ||
345 | S32 b_ret_val = mExecuteFuncs[opcode](mBuffer, value, b_print, id); | ||
346 | set_ip(mBuffer, value); | ||
347 | add_register_fp(mBuffer, LREG_ESR, -0.1f); | ||
348 | // lsa_print_heap(mBuffer); | ||
349 | |||
350 | if (b_print) | ||
351 | { | ||
352 | lsa_print_heap(mBuffer); | ||
353 | printf("ip: 0x%X\n", get_register(mBuffer, LREG_IP)); | ||
354 | printf("sp: 0x%X\n", get_register(mBuffer, LREG_SP)); | ||
355 | printf("bp: 0x%X\n", get_register(mBuffer, LREG_BP)); | ||
356 | printf("hr: 0x%X\n", get_register(mBuffer, LREG_HR)); | ||
357 | printf("hp: 0x%X\n", get_register(mBuffer, LREG_HP)); | ||
358 | } | ||
359 | // update IP | ||
360 | if (b_ret_val) | ||
361 | { | ||
362 | return DELETE_FLAG | CREDIT_MONEY_FLAG; | ||
363 | } | ||
364 | else | ||
365 | { | ||
366 | return NO_DELETE_FLAG; | ||
367 | } | ||
368 | } | 805 | } |
369 | else | 806 | else |
370 | { | 807 | { |
371 | // make sure that IE is zero | 808 | // make sure that IE is zero |
372 | set_event_register(mBuffer, LREG_IE, 0, major_version); | 809 | setCurrentHandler(0, major_version); |
373 | 810 | ||
374 | // if no, we're in a state and waiting for an event | 811 | // if no, we're in a state and waiting for an event |
375 | S32 next_state = get_register(mBuffer, LREG_NS); | 812 | U64 current_events = getCurrentEvents(major_version); |
376 | S32 current_state = get_register(mBuffer, LREG_CS); | 813 | U64 event_register = getEventHandlers(major_version); |
377 | U64 current_events = get_event_register(mBuffer, LREG_CE, major_version); | 814 | |
378 | U64 event_register = get_event_register(mBuffer, LREG_ER, major_version); | 815 | // check NS to see if need to switch states (NS != CS) |
379 | // check NS to see if need to switch states (NS != CS) | 816 | if (isStateChangePending()) |
380 | if (next_state != current_state) | ||
381 | { | 817 | { |
382 | state_transition = TRUE; | 818 | state_transition = TRUE; |
819 | |||
383 | // ok, blow away any pending events | 820 | // ok, blow away any pending events |
384 | mEventData.mEventDataList.deleteAllData(); | 821 | deleteAllEvents(); |
385 | 822 | ||
386 | // if yes, check state exit flag is set | 823 | // if yes, check state exit flag is set |
387 | if (current_events & LSCRIPTStateBitField[LSTT_STATE_EXIT]) | 824 | if (current_events & LSCRIPTStateBitField[LSTT_STATE_EXIT]) |
388 | { | 825 | { |
389 | // if yes, clear state exit flag | 826 | // if yes, clear state exit flag |
390 | set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[LSTT_STATE_EXIT], major_version); | 827 | setCurrentHandler(LSCRIPTStateBitField[LSTT_STATE_EXIT], major_version); |
391 | current_events &= ~LSCRIPTStateBitField[LSTT_STATE_EXIT]; | 828 | current_events &= ~LSCRIPTStateBitField[LSTT_STATE_EXIT]; |
392 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | 829 | setCurrentEvents(current_events, major_version); |
393 | // check state exit event handler | 830 | |
394 | // if there is a handler, call it | 831 | // check state exit event handler |
832 | // if there is a handler, call it | ||
395 | if (event_register & LSCRIPTStateBitField[LSTT_STATE_EXIT]) | 833 | if (event_register & LSCRIPTStateBitField[LSTT_STATE_EXIT]) |
396 | { | 834 | { |
397 | // push a zero to be popped | 835 | ++events_processed; |
398 | lscript_push(mBuffer, 0); | 836 | callEventHandler(LSTT_STATE_EXIT, major_version, id, quanta); |
399 | // push sp as current bp | 837 | return; |
400 | S32 sp = get_register(mBuffer, LREG_SP); | ||
401 | lscript_push(mBuffer, sp); | ||
402 | |||
403 | // now, push any additional stack space | ||
404 | S32 additional_size = get_event_stack_size(mBuffer, current_state, LSTT_STATE_EXIT); | ||
405 | if ( additional_size == -1 ) | ||
406 | { | ||
407 | recordBoundaryError( id ); | ||
408 | } | ||
409 | else | ||
410 | { | ||
411 | lscript_pusharge(mBuffer, additional_size); | ||
412 | |||
413 | sp = get_register(mBuffer, LREG_SP); | ||
414 | sp += additional_size; | ||
415 | set_bp(mBuffer, sp); | ||
416 | // set IP to the event handler | ||
417 | setStateEventOpcoodeStartSafely( current_state, LSTT_STATE_EXIT, id ); | ||
418 | } | ||
419 | return NO_DELETE_FLAG; | ||
420 | } | 838 | } |
421 | } | 839 | } |
422 | // if no handler or no state exit flag switch to new state | 840 | |
423 | // set state entry flag and clear other CE flags | 841 | // if no handler or no state exit flag switch to new state |
842 | // set state entry flag and clear other CE flags | ||
424 | current_events = LSCRIPTStateBitField[LSTT_STATE_ENTRY]; | 843 | current_events = LSCRIPTStateBitField[LSTT_STATE_ENTRY]; |
425 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | 844 | setCurrentEvents(current_events, major_version); |
426 | // copy NS to CS | 845 | |
427 | set_register(mBuffer, LREG_CS, next_state); | 846 | U64 handled_events = nextState(); |
428 | // copy new state's handled events into ER (SR + CS*4 + 4) | 847 | setEventHandlers(handled_events, major_version); |
429 | U64 handled_events = get_handled_events(mBuffer, next_state); | ||
430 | set_event_register(mBuffer, LREG_ER, handled_events, major_version); | ||
431 | } | 848 | } |
432 | // check to see if any current events are covered by events handled by this state (CE & ER != 0) | 849 | |
433 | // now, we want to look like we were called like a function | 850 | // try to get next event from stack |
434 | // 0x0000: 00 00 00 00 (return ip) | ||
435 | // 0x0004: bp (current sp) | ||
436 | // 0x0008: parameters | ||
437 | // push sp | ||
438 | // add parameter size | ||
439 | // pop bp | ||
440 | // set ip | ||
441 | |||
442 | S32 size = 0; | ||
443 | // try to get next event from stack | ||
444 | BOOL b_done = FALSE; | 851 | BOOL b_done = FALSE; |
445 | LSCRIPTStateEventType event = LSTT_NULL; | 852 | LSCRIPTStateEventType event = LSTT_NULL; |
446 | LLScriptDataCollection *eventdata; | ||
447 | 853 | ||
448 | next_state = get_register(mBuffer, LREG_NS); | 854 | current_events = getCurrentEvents(major_version); |
449 | current_state = get_register(mBuffer, LREG_CS); | 855 | event_register = getEventHandlers(major_version); |
450 | current_events = get_event_register(mBuffer, LREG_CE, major_version); | ||
451 | event_register = get_event_register(mBuffer, LREG_ER, major_version); | ||
452 | 856 | ||
453 | // first, check to see if state_entry or onrez are raised and handled | 857 | // first, check to see if state_entry or onrez are raised and handled |
454 | if ( (current_events & LSCRIPTStateBitField[LSTT_STATE_ENTRY]) | 858 | if ((current_events & LSCRIPTStateBitField[LSTT_STATE_ENTRY]) |
455 | &&(current_events & event_register)) | 859 | &&(current_events & event_register)) |
456 | { | 860 | { |
457 | // ok, this is easy since there isn't any data waiting, just set it | 861 | ++events_processed; |
458 | // push a zero to be popped | 862 | callEventHandler(LSTT_STATE_ENTRY, major_version, id, quanta); |
459 | lscript_push(mBuffer, 0); | ||
460 | // push sp as current bp | ||
461 | S32 sp = get_register(mBuffer, LREG_SP); | ||
462 | lscript_push(mBuffer, sp); | ||
463 | |||
464 | event = return_first_event((S32)LSCRIPTStateBitField[LSTT_STATE_ENTRY]); | ||
465 | set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); | ||
466 | current_events &= ~LSCRIPTStateBitField[event]; | ||
467 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | ||
468 | // now, push any additional stack space | ||
469 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event); | ||
470 | if ( additional_size == -1 ) | ||
471 | { // b_done will be set, so we'll exit the loop at the bottom | ||
472 | recordBoundaryError( id ); | ||
473 | } | ||
474 | else | ||
475 | { | ||
476 | additional_size -= size; | ||
477 | lscript_pusharge(mBuffer, additional_size); | ||
478 | |||
479 | // now set the bp correctly | ||
480 | sp = get_register(mBuffer, LREG_SP); | ||
481 | sp += additional_size + size; | ||
482 | set_bp(mBuffer, sp); | ||
483 | // set IP to the function | ||
484 | setStateEventOpcoodeStartSafely( current_state, event, id ); | ||
485 | } | ||
486 | b_done = TRUE; | 863 | b_done = TRUE; |
487 | } | 864 | } |
488 | else if ( (current_events & LSCRIPTStateBitField[LSTT_REZ]) | 865 | else if ((current_events & LSCRIPTStateBitField[LSTT_REZ]) |
489 | &&(current_events & event_register)) | 866 | &&(current_events & event_register)) |
490 | { | 867 | { |
491 | for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData()) | 868 | ++events_processed; |
492 | { | 869 | callQueuedEventHandler(LSTT_REZ, major_version, id, quanta); |
493 | if (eventdata->mType & LSCRIPTStateBitField[LSTT_REZ]) | 870 | b_done = TRUE; |
494 | { | ||
495 | // push a zero to be popped | ||
496 | lscript_push(mBuffer, 0); | ||
497 | // push sp as current bp | ||
498 | S32 sp = get_register(mBuffer, LREG_SP); | ||
499 | lscript_push(mBuffer, sp); | ||
500 | |||
501 | set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); | ||
502 | current_events &= ~LSCRIPTStateBitField[event]; | ||
503 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | ||
504 | |||
505 | // push any arguments that need to be pushed onto the stack | ||
506 | // last piece of data will be type LST_NULL | ||
507 | LLScriptLibData *data = eventdata->mData; | ||
508 | while (data->mType) | ||
509 | { | ||
510 | size += lscript_push_variable(data, mBuffer); | ||
511 | data++; | ||
512 | } | ||
513 | // now, push any additional stack space | ||
514 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event); | ||
515 | if ( additional_size == -1 ) | ||
516 | { // b_done will be set, so we'll exit the loop at the bottom | ||
517 | recordBoundaryError( id ); | ||
518 | } | ||
519 | else | ||
520 | { | ||
521 | additional_size -= size; | ||
522 | lscript_pusharge(mBuffer, additional_size); | ||
523 | |||
524 | // now set the bp correctly | ||
525 | sp = get_register(mBuffer, LREG_SP); | ||
526 | sp += additional_size + size; | ||
527 | set_bp(mBuffer, sp); | ||
528 | // set IP to the function | ||
529 | setStateEventOpcoodeStartSafely( current_state, event, id ); | ||
530 | mEventData.mEventDataList.deleteCurrentData(); | ||
531 | } | ||
532 | b_done = TRUE; | ||
533 | break; | ||
534 | } | ||
535 | } | ||
536 | } | 871 | } |
537 | 872 | ||
538 | while (!b_done) | 873 | while (!b_done) |
539 | { | 874 | { |
540 | eventdata = mEventData.getNextEvent(); | 875 | // Call handler for next queued event. |
541 | if (eventdata) | 876 | if(getEventCount() > 0) |
542 | { | 877 | { |
543 | event = eventdata->mType; | 878 | ++events_processed; |
544 | 879 | callNextQueuedEventHandler(event_register, major_version, id, quanta); | |
545 | // make sure that we can actually handle this one | 880 | b_done = TRUE; |
546 | if (LSCRIPTStateBitField[event] & event_register) | ||
547 | { | ||
548 | // push a zero to be popped | ||
549 | lscript_push(mBuffer, 0); | ||
550 | // push sp as current bp | ||
551 | S32 sp = get_register(mBuffer, LREG_SP); | ||
552 | lscript_push(mBuffer, sp); | ||
553 | |||
554 | set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); | ||
555 | current_events &= ~LSCRIPTStateBitField[event]; | ||
556 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | ||
557 | |||
558 | // push any arguments that need to be pushed onto the stack | ||
559 | // last piece of data will be type LST_NULL | ||
560 | LLScriptLibData *data = eventdata->mData; | ||
561 | while (data->mType) | ||
562 | { | ||
563 | size += lscript_push_variable(data, mBuffer); | ||
564 | data++; | ||
565 | } | ||
566 | b_done = TRUE; | ||
567 | // now, push any additional stack space | ||
568 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event); | ||
569 | if ( additional_size == -1 ) | ||
570 | { // b_done was just set, so we'll exit the loop at the bottom | ||
571 | recordBoundaryError( id ); | ||
572 | } | ||
573 | else | ||
574 | { | ||
575 | additional_size -= size; | ||
576 | lscript_pusharge(mBuffer, additional_size); | ||
577 | |||
578 | // now set the bp correctly | ||
579 | sp = get_register(mBuffer, LREG_SP); | ||
580 | sp += additional_size + size; | ||
581 | set_bp(mBuffer, sp); | ||
582 | // set IP to the function | ||
583 | setStateEventOpcoodeStartSafely( current_state, event, id ); | ||
584 | } | ||
585 | } | ||
586 | else | ||
587 | { | ||
588 | llwarns << "Shit, somehow got an event that we're not registered for!" << llendl; | ||
589 | } | ||
590 | delete eventdata; | ||
591 | } | 881 | } |
592 | else | 882 | else |
593 | { | 883 | { |
594 | // if no data waiting, do it the old way: | 884 | // if no data waiting, do it the old way: |
595 | U64 handled_current = current_events & event_register; | 885 | U64 handled_current = current_events & event_register; |
596 | if (handled_current) | 886 | if (handled_current) |
597 | { | 887 | { |
598 | // push a zero to be popped | ||
599 | lscript_push(mBuffer, 0); | ||
600 | // push sp as current bp | ||
601 | S32 sp = get_register(mBuffer, LREG_SP); | ||
602 | lscript_push(mBuffer, sp); | ||
603 | |||
604 | event = return_first_event((S32)handled_current); | 888 | event = return_first_event((S32)handled_current); |
605 | set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); | 889 | ++events_processed; |
606 | current_events &= ~LSCRIPTStateBitField[event]; | 890 | callEventHandler(event, major_version, id, quanta); |
607 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | ||
608 | // now, push any additional stack space | ||
609 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event); | ||
610 | if ( additional_size == -1 ) | ||
611 | { // b_done will be set, so we'll exit the loop at the bottom | ||
612 | recordBoundaryError( id ); | ||
613 | } | ||
614 | else | ||
615 | { | ||
616 | additional_size -= size; | ||
617 | lscript_pusharge(mBuffer, additional_size); | ||
618 | |||
619 | // now set the bp correctly | ||
620 | sp = get_register(mBuffer, LREG_SP); | ||
621 | sp += additional_size + size; | ||
622 | set_bp(mBuffer, sp); | ||
623 | // set IP to the function | ||
624 | setStateEventOpcoodeStartSafely( current_state, event, id ); | ||
625 | } | ||
626 | } | 891 | } |
627 | b_done = TRUE; | 892 | b_done = TRUE; |
628 | } | 893 | } |
629 | } // while (!b_done) | 894 | } |
630 | } // end of else ... in state processing code | 895 | } |
896 | } | ||
631 | 897 | ||
632 | return NO_DELETE_FLAG; | 898 | // Run for a single timeslice, or until a yield is due |
899 | F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **errorstr, BOOL &state_transition, F32 quanta, U32& events_processed, LLTimer& timer) | ||
900 | { | ||
901 | U32 timer_checks = 0; | ||
902 | F32 inloop = 0; | ||
903 | |||
904 | // Loop while not finished, yield not due and time remaining | ||
905 | // NOTE: Default implementation does not do adaptive timer skipping | ||
906 | // to preserve current LSL behaviour and not break scripts that rely | ||
907 | // on current execution speed. | ||
908 | while(true) | ||
909 | { | ||
910 | runInstructions(b_print, id, errorstr, state_transition, | ||
911 | events_processed, quanta); | ||
912 | |||
913 | static const S32 lsl_timer_check_skip = 4; | ||
914 | if(isYieldDue()) | ||
915 | { | ||
916 | break; | ||
917 | } | ||
918 | else if(timer_checks++ == lsl_timer_check_skip) | ||
919 | { | ||
920 | inloop = timer.getElapsedTimeF32(); | ||
921 | if(inloop > quanta) | ||
922 | { | ||
923 | break; | ||
924 | } | ||
925 | timer_checks = 0; | ||
926 | } | ||
927 | } | ||
928 | return inloop; | ||
633 | } | 929 | } |
634 | 930 | ||
635 | BOOL run_noop(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | 931 | BOOL run_noop(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) |
@@ -2309,14 +2605,24 @@ void list_list_operation(U8 *buffer, LSCRIPTOpCodesEnum opcode) | |||
2309 | } | 2605 | } |
2310 | } | 2606 | } |
2311 | 2607 | ||
2608 | static U8 safe_op_index(U8 index) | ||
2609 | { | ||
2610 | if(index >= LST_EOF) | ||
2611 | { | ||
2612 | // Operations on LST_NULL will always be unknown_operation. | ||
2613 | index = LST_NULL; | ||
2614 | } | ||
2615 | return index; | ||
2616 | } | ||
2617 | |||
2312 | BOOL run_add(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | 2618 | BOOL run_add(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) |
2313 | { | 2619 | { |
2314 | if (b_print) | 2620 | if (b_print) |
2315 | printf("[0x%X]\tADD ", offset); | 2621 | printf("[0x%X]\tADD ", offset); |
2316 | offset++; | 2622 | offset++; |
2317 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2623 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2318 | U8 arg1 = arg >> 4; | 2624 | U8 arg1 = safe_op_index(arg >> 4); |
2319 | U8 arg2 = arg & 0xf; | 2625 | U8 arg2 = safe_op_index(arg & 0xf); |
2320 | if (b_print) | 2626 | if (b_print) |
2321 | { | 2627 | { |
2322 | print_type(arg1); | 2628 | print_type(arg1); |
@@ -2334,8 +2640,8 @@ BOOL run_sub(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
2334 | printf("[0x%X]\tSUB ", offset); | 2640 | printf("[0x%X]\tSUB ", offset); |
2335 | offset++; | 2641 | offset++; |
2336 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2642 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2337 | U8 arg1 = arg >> 4; | 2643 | U8 arg1 = safe_op_index(arg >> 4); |
2338 | U8 arg2 = arg & 0xf; | 2644 | U8 arg2 = safe_op_index(arg & 0xf); |
2339 | if (b_print) | 2645 | if (b_print) |
2340 | { | 2646 | { |
2341 | print_type(arg1); | 2647 | print_type(arg1); |
@@ -2352,8 +2658,8 @@ BOOL run_mul(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
2352 | printf("[0x%X]\tMUL ", offset); | 2658 | printf("[0x%X]\tMUL ", offset); |
2353 | offset++; | 2659 | offset++; |
2354 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2660 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2355 | U8 arg1 = arg >> 4; | 2661 | U8 arg1 = safe_op_index(arg >> 4); |
2356 | U8 arg2 = arg & 0xf; | 2662 | U8 arg2 = safe_op_index(arg & 0xf); |
2357 | if (b_print) | 2663 | if (b_print) |
2358 | { | 2664 | { |
2359 | print_type(arg1); | 2665 | print_type(arg1); |
@@ -2370,8 +2676,8 @@ BOOL run_div(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
2370 | printf("[0x%X]\tDIV ", offset); | 2676 | printf("[0x%X]\tDIV ", offset); |
2371 | offset++; | 2677 | offset++; |
2372 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2678 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2373 | U8 arg1 = arg >> 4; | 2679 | U8 arg1 = safe_op_index(arg >> 4); |
2374 | U8 arg2 = arg & 0xf; | 2680 | U8 arg2 = safe_op_index(arg & 0xf); |
2375 | if (b_print) | 2681 | if (b_print) |
2376 | { | 2682 | { |
2377 | print_type(arg1); | 2683 | print_type(arg1); |
@@ -2388,8 +2694,8 @@ BOOL run_mod(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
2388 | printf("[0x%X]\tMOD ", offset); | 2694 | printf("[0x%X]\tMOD ", offset); |
2389 | offset++; | 2695 | offset++; |
2390 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2696 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2391 | U8 arg1 = arg >> 4; | 2697 | U8 arg1 = safe_op_index(arg >> 4); |
2392 | U8 arg2 = arg & 0xf; | 2698 | U8 arg2 = safe_op_index(arg & 0xf); |
2393 | if (b_print) | 2699 | if (b_print) |
2394 | { | 2700 | { |
2395 | print_type(arg1); | 2701 | print_type(arg1); |
@@ -2407,8 +2713,8 @@ BOOL run_eq(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
2407 | printf("[0x%X]\tEQ ", offset); | 2713 | printf("[0x%X]\tEQ ", offset); |
2408 | offset++; | 2714 | offset++; |
2409 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2715 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2410 | U8 arg1 = arg >> 4; | 2716 | U8 arg1 = safe_op_index(arg >> 4); |
2411 | U8 arg2 = arg & 0xf; | 2717 | U8 arg2 = safe_op_index(arg & 0xf); |
2412 | if (b_print) | 2718 | if (b_print) |
2413 | { | 2719 | { |
2414 | print_type(arg1); | 2720 | print_type(arg1); |
@@ -2425,8 +2731,8 @@ BOOL run_neq(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
2425 | printf("[0x%X]\tNEQ ", offset); | 2731 | printf("[0x%X]\tNEQ ", offset); |
2426 | offset++; | 2732 | offset++; |
2427 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2733 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2428 | U8 arg1 = arg >> 4; | 2734 | U8 arg1 = safe_op_index(arg >> 4); |
2429 | U8 arg2 = arg & 0xf; | 2735 | U8 arg2 = safe_op_index(arg & 0xf); |
2430 | if (b_print) | 2736 | if (b_print) |
2431 | { | 2737 | { |
2432 | print_type(arg1); | 2738 | print_type(arg1); |
@@ -2443,8 +2749,8 @@ BOOL run_leq(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
2443 | printf("[0x%X]\tLEQ ", offset); | 2749 | printf("[0x%X]\tLEQ ", offset); |
2444 | offset++; | 2750 | offset++; |
2445 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2751 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2446 | U8 arg1 = arg >> 4; | 2752 | U8 arg1 = safe_op_index(arg >> 4); |
2447 | U8 arg2 = arg & 0xf; | 2753 | U8 arg2 = safe_op_index(arg & 0xf); |
2448 | if (b_print) | 2754 | if (b_print) |
2449 | { | 2755 | { |
2450 | print_type(arg1); | 2756 | print_type(arg1); |
@@ -2461,8 +2767,8 @@ BOOL run_geq(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
2461 | printf("[0x%X]\tGEQ ", offset); | 2767 | printf("[0x%X]\tGEQ ", offset); |
2462 | offset++; | 2768 | offset++; |
2463 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2769 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2464 | U8 arg1 = arg >> 4; | 2770 | U8 arg1 = safe_op_index(arg >> 4); |
2465 | U8 arg2 = arg & 0xf; | 2771 | U8 arg2 = safe_op_index(arg & 0xf); |
2466 | if (b_print) | 2772 | if (b_print) |
2467 | { | 2773 | { |
2468 | print_type(arg1); | 2774 | print_type(arg1); |
@@ -2479,8 +2785,8 @@ BOOL run_less(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
2479 | printf("[0x%X]\tLESS ", offset); | 2785 | printf("[0x%X]\tLESS ", offset); |
2480 | offset++; | 2786 | offset++; |
2481 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2787 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2482 | U8 arg1 = arg >> 4; | 2788 | U8 arg1 = safe_op_index(arg >> 4); |
2483 | U8 arg2 = arg & 0xf; | 2789 | U8 arg2 = safe_op_index(arg & 0xf); |
2484 | if (b_print) | 2790 | if (b_print) |
2485 | { | 2791 | { |
2486 | print_type(arg1); | 2792 | print_type(arg1); |
@@ -2497,8 +2803,8 @@ BOOL run_greater(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
2497 | printf("[0x%X]\tGREATER ", offset); | 2803 | printf("[0x%X]\tGREATER ", offset); |
2498 | offset++; | 2804 | offset++; |
2499 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2805 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); |
2500 | U8 arg1 = arg >> 4; | 2806 | U8 arg1 = safe_op_index(arg >> 4); |
2501 | U8 arg2 = arg & 0xf; | 2807 | U8 arg2 = safe_op_index(arg & 0xf); |
2502 | if (b_print) | 2808 | if (b_print) |
2503 | { | 2809 | { |
2504 | print_type(arg1); | 2810 | print_type(arg1); |
@@ -2640,13 +2946,12 @@ void quaternion_operation(U8 *buffer, LSCRIPTOpCodesEnum opcode) | |||
2640 | } | 2946 | } |
2641 | } | 2947 | } |
2642 | 2948 | ||
2643 | |||
2644 | BOOL run_neg(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | 2949 | BOOL run_neg(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) |
2645 | { | 2950 | { |
2646 | if (b_print) | 2951 | if (b_print) |
2647 | printf("[0x%X]\tNEG ", offset); | 2952 | printf("[0x%X]\tNEG ", offset); |
2648 | offset++; | 2953 | offset++; |
2649 | U8 arg = safe_instruction_bytestream2byte(buffer, offset); | 2954 | U8 arg = safe_op_index(safe_instruction_bytestream2byte(buffer, offset)); |
2650 | if (b_print) | 2955 | if (b_print) |
2651 | { | 2956 | { |
2652 | print_type(arg); | 2957 | print_type(arg); |
@@ -3675,56 +3980,50 @@ BOOL run_print(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | |||
3675 | } | 3980 | } |
3676 | 3981 | ||
3677 | 3982 | ||
3678 | void lscript_run(char *filename, BOOL b_debug) | 3983 | void lscript_run(const std::string& filename, BOOL b_debug) |
3679 | { | 3984 | { |
3680 | LLTimer timer; | 3985 | LLTimer timer; |
3681 | if (filename == NULL) | 3986 | |
3987 | const char *error; | ||
3988 | BOOL b_state; | ||
3989 | LLScriptExecuteLSL2 *execute = NULL; | ||
3990 | |||
3991 | if (filename.empty()) | ||
3682 | { | 3992 | { |
3683 | llerrs << "filename is NULL" << llendl; | 3993 | llerrs << "filename is NULL" << llendl; |
3684 | // Just reporting error is likely not enough. Need | 3994 | // Just reporting error is likely not enough. Need |
3685 | // to check how to abort or error out gracefully | 3995 | // to check how to abort or error out gracefully |
3686 | // from this function. XXXTBD | 3996 | // from this function. XXXTBD |
3687 | } | 3997 | } |
3688 | else | 3998 | LLFILE* file = LLFile::fopen(filename, "r"); /* Flawfinder: ignore */ |
3999 | if(file) | ||
3689 | { | 4000 | { |
3690 | char *error; | 4001 | execute = new LLScriptExecuteLSL2(file); |
3691 | BOOL b_state; | 4002 | fclose(file); |
3692 | LLScriptExecute *execute = NULL; | 4003 | } |
3693 | 4004 | if (execute) | |
3694 | LLFILE* file = LLFile::fopen(filename, "r"); | 4005 | { |
3695 | if (file) | 4006 | timer.reset(); |
3696 | { | 4007 | F32 time_slice = 3600.0f; // 1 hr. |
3697 | execute = new LLScriptExecute(file); | 4008 | U32 events_processed = 0; |
3698 | // note: LLScriptExecute() closes file for us | 4009 | |
3699 | } | 4010 | do { |
3700 | file = LLFile::fopen(filename, "r"); | 4011 | LLTimer timer2; |
3701 | if (file) | 4012 | execute->runQuanta(b_debug, LLUUID::null, &error, b_state, |
3702 | { | 4013 | time_slice, events_processed, timer2); |
3703 | LLFILE* fp = LLFile::fopen("lscript.parse", "w"); /*Flawfinder: ignore*/ | 4014 | } while (!execute->isFinished()); |
3704 | LLScriptLSOParse *parse = new LLScriptLSOParse(file); | 4015 | |
3705 | parse->printData(fp); | 4016 | F32 time = timer.getElapsedTimeF32(); |
3706 | delete parse; | 4017 | F32 ips = execute->mInstructionCount / time; |
3707 | fclose(file); | 4018 | llinfos << execute->mInstructionCount << " instructions in " << time << " seconds" << llendl; |
3708 | fclose(fp); | 4019 | llinfos << ips/1000 << "K instructions per second" << llendl; |
3709 | } | 4020 | printf("ip: 0x%X\n", get_register(execute->mBuffer, LREG_IP)); |
3710 | file = LLFile::fopen(filename, "r"); | 4021 | printf("sp: 0x%X\n", get_register(execute->mBuffer, LREG_SP)); |
3711 | if (file && execute) | 4022 | printf("bp: 0x%X\n", get_register(execute->mBuffer, LREG_BP)); |
3712 | { | 4023 | printf("hr: 0x%X\n", get_register(execute->mBuffer, LREG_HR)); |
3713 | timer.reset(); | 4024 | printf("hp: 0x%X\n", get_register(execute->mBuffer, LREG_HP)); |
3714 | while (!execute->run(b_debug, LLUUID::null, &error, b_state)) | 4025 | delete execute; |
3715 | ; | 4026 | fclose(file); |
3716 | F32 time = timer.getElapsedTimeF32(); | ||
3717 | F32 ips = execute->mInstructionCount / time; | ||
3718 | llinfos << execute->mInstructionCount << " instructions in " << time << " seconds" << llendl; | ||
3719 | llinfos << ips/1000 << "K instructions per second" << llendl; | ||
3720 | printf("ip: 0x%X\n", get_register(execute->mBuffer, LREG_IP)); | ||
3721 | printf("sp: 0x%X\n", get_register(execute->mBuffer, LREG_SP)); | ||
3722 | printf("bp: 0x%X\n", get_register(execute->mBuffer, LREG_BP)); | ||
3723 | printf("hr: 0x%X\n", get_register(execute->mBuffer, LREG_HR)); | ||
3724 | printf("hp: 0x%X\n", get_register(execute->mBuffer, LREG_HP)); | ||
3725 | delete execute; | ||
3726 | fclose(file); | ||
3727 | } | ||
3728 | } | 4027 | } |
3729 | } | 4028 | } |
3730 | 4029 | ||
diff --git a/linden/indra/lscript/lscript_execute/lscript_execute.vcproj b/linden/indra/lscript/lscript_execute/lscript_execute.vcproj deleted file mode 100644 index 682ee83..0000000 --- a/linden/indra/lscript/lscript_execute/lscript_execute.vcproj +++ /dev/null | |||
@@ -1,191 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="7.10" | ||
5 | Name="lscript_execute" | ||
6 | ProjectGUID="{F882263E-4F2A-43D9-A45A-FA4C8EC66552}" | ||
7 | Keyword="Win32Proj"> | ||
8 | <Platforms> | ||
9 | <Platform | ||
10 | Name="Win32"/> | ||
11 | </Platforms> | ||
12 | <Configurations> | ||
13 | <Configuration | ||
14 | Name="Debug|Win32" | ||
15 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
16 | IntermediateDirectory="Debug" | ||
17 | ConfigurationType="4" | ||
18 | CharacterSet="1"> | ||
19 | <Tool | ||
20 | Name="VCCLCompilerTool" | ||
21 | Optimization="0" | ||
22 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
23 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG" | ||
24 | MinimalRebuild="TRUE" | ||
25 | BasicRuntimeChecks="3" | ||
26 | RuntimeLibrary="1" | ||
27 | StructMemberAlignment="4" | ||
28 | ForceConformanceInForLoopScope="TRUE" | ||
29 | UsePrecompiledHeader="0" | ||
30 | WarningLevel="3" | ||
31 | WarnAsError="TRUE" | ||
32 | Detect64BitPortabilityProblems="FALSE" | ||
33 | DebugInformationFormat="4"/> | ||
34 | <Tool | ||
35 | Name="VCCustomBuildTool"/> | ||
36 | <Tool | ||
37 | Name="VCLibrarianTool" | ||
38 | OutputFile="$(OutDir)/lscript_execute.lib"/> | ||
39 | <Tool | ||
40 | Name="VCMIDLTool"/> | ||
41 | <Tool | ||
42 | Name="VCPostBuildEventTool"/> | ||
43 | <Tool | ||
44 | Name="VCPreBuildEventTool"/> | ||
45 | <Tool | ||
46 | Name="VCPreLinkEventTool"/> | ||
47 | <Tool | ||
48 | Name="VCResourceCompilerTool"/> | ||
49 | <Tool | ||
50 | Name="VCWebServiceProxyGeneratorTool"/> | ||
51 | <Tool | ||
52 | Name="VCXMLDataGeneratorTool"/> | ||
53 | <Tool | ||
54 | Name="VCManagedWrapperGeneratorTool"/> | ||
55 | <Tool | ||
56 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
57 | </Configuration> | ||
58 | <Configuration | ||
59 | Name="Release|Win32" | ||
60 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
61 | IntermediateDirectory="Release" | ||
62 | ConfigurationType="4" | ||
63 | CharacterSet="1"> | ||
64 | <Tool | ||
65 | Name="VCCLCompilerTool" | ||
66 | AdditionalOptions="/Oy-" | ||
67 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
68 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" | ||
69 | RuntimeLibrary="0" | ||
70 | StructMemberAlignment="0" | ||
71 | ForceConformanceInForLoopScope="TRUE" | ||
72 | UsePrecompiledHeader="0" | ||
73 | WarningLevel="3" | ||
74 | WarnAsError="TRUE" | ||
75 | Detect64BitPortabilityProblems="FALSE" | ||
76 | DebugInformationFormat="3"/> | ||
77 | <Tool | ||
78 | Name="VCCustomBuildTool"/> | ||
79 | <Tool | ||
80 | Name="VCLibrarianTool" | ||
81 | OutputFile="$(OutDir)/lscript_execute.lib"/> | ||
82 | <Tool | ||
83 | Name="VCMIDLTool"/> | ||
84 | <Tool | ||
85 | Name="VCPostBuildEventTool"/> | ||
86 | <Tool | ||
87 | Name="VCPreBuildEventTool"/> | ||
88 | <Tool | ||
89 | Name="VCPreLinkEventTool"/> | ||
90 | <Tool | ||
91 | Name="VCResourceCompilerTool"/> | ||
92 | <Tool | ||
93 | Name="VCWebServiceProxyGeneratorTool"/> | ||
94 | <Tool | ||
95 | Name="VCXMLDataGeneratorTool"/> | ||
96 | <Tool | ||
97 | Name="VCManagedWrapperGeneratorTool"/> | ||
98 | <Tool | ||
99 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
100 | </Configuration> | ||
101 | <Configuration | ||
102 | Name="ReleaseNoOpt|Win32" | ||
103 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
104 | IntermediateDirectory="$(ConfigurationName)" | ||
105 | ConfigurationType="4" | ||
106 | CharacterSet="1"> | ||
107 | <Tool | ||
108 | Name="VCCLCompilerTool" | ||
109 | AdditionalOptions="/Oy-" | ||
110 | Optimization="0" | ||
111 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
112 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" | ||
113 | RuntimeLibrary="0" | ||
114 | StructMemberAlignment="0" | ||
115 | ForceConformanceInForLoopScope="TRUE" | ||
116 | UsePrecompiledHeader="0" | ||
117 | WarningLevel="3" | ||
118 | WarnAsError="TRUE" | ||
119 | Detect64BitPortabilityProblems="FALSE" | ||
120 | DebugInformationFormat="3"/> | ||
121 | <Tool | ||
122 | Name="VCCustomBuildTool"/> | ||
123 | <Tool | ||
124 | Name="VCLibrarianTool" | ||
125 | OutputFile="$(OutDir)/lscript_execute.lib"/> | ||
126 | <Tool | ||
127 | Name="VCMIDLTool"/> | ||
128 | <Tool | ||
129 | Name="VCPostBuildEventTool"/> | ||
130 | <Tool | ||
131 | Name="VCPreBuildEventTool"/> | ||
132 | <Tool | ||
133 | Name="VCPreLinkEventTool"/> | ||
134 | <Tool | ||
135 | Name="VCResourceCompilerTool"/> | ||
136 | <Tool | ||
137 | Name="VCWebServiceProxyGeneratorTool"/> | ||
138 | <Tool | ||
139 | Name="VCXMLDataGeneratorTool"/> | ||
140 | <Tool | ||
141 | Name="VCManagedWrapperGeneratorTool"/> | ||
142 | <Tool | ||
143 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
144 | </Configuration> | ||
145 | </Configurations> | ||
146 | <References> | ||
147 | </References> | ||
148 | <Files> | ||
149 | <Filter | ||
150 | Name="Source Files" | ||
151 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
152 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> | ||
153 | <File | ||
154 | RelativePath=".\lscript_execute.cpp"> | ||
155 | </File> | ||
156 | <File | ||
157 | RelativePath=".\lscript_heapruntime.cpp"> | ||
158 | </File> | ||
159 | <File | ||
160 | RelativePath=".\lscript_readlso.cpp"> | ||
161 | </File> | ||
162 | </Filter> | ||
163 | <Filter | ||
164 | Name="Header Files" | ||
165 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
166 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> | ||
167 | <File | ||
168 | RelativePath="..\lscript_byteconvert.h"> | ||
169 | </File> | ||
170 | <File | ||
171 | RelativePath="..\lscript_byteformat.h"> | ||
172 | </File> | ||
173 | <File | ||
174 | RelativePath="..\lscript_execute.h"> | ||
175 | </File> | ||
176 | <File | ||
177 | RelativePath=".\lscript_heapruntime.h"> | ||
178 | </File> | ||
179 | <File | ||
180 | RelativePath=".\lscript_readlso.h"> | ||
181 | </File> | ||
182 | </Filter> | ||
183 | <Filter | ||
184 | Name="Resource Files" | ||
185 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
186 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> | ||
187 | </Filter> | ||
188 | </Files> | ||
189 | <Globals> | ||
190 | </Globals> | ||
191 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_execute/lscript_execute_vc8.vcproj b/linden/indra/lscript/lscript_execute/lscript_execute_vc8.vcproj deleted file mode 100644 index 8a1e4c6..0000000 --- a/linden/indra/lscript/lscript_execute/lscript_execute_vc8.vcproj +++ /dev/null | |||
@@ -1,279 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="8.00" | ||
5 | Name="lscript_execute" | ||
6 | ProjectGUID="{F882263E-4F2A-43D9-A45A-FA4C8EC66552}" | ||
7 | RootNamespace="lscript_execute" | ||
8 | Keyword="Win32Proj" | ||
9 | > | ||
10 | <Platforms> | ||
11 | <Platform | ||
12 | Name="Win32" | ||
13 | /> | ||
14 | </Platforms> | ||
15 | <ToolFiles> | ||
16 | </ToolFiles> | ||
17 | <Configurations> | ||
18 | <Configuration | ||
19 | Name="Debug|Win32" | ||
20 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
21 | IntermediateDirectory="Debug" | ||
22 | ConfigurationType="4" | ||
23 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
24 | CharacterSet="1" | ||
25 | > | ||
26 | <Tool | ||
27 | Name="VCPreBuildEventTool" | ||
28 | /> | ||
29 | <Tool | ||
30 | Name="VCCustomBuildTool" | ||
31 | /> | ||
32 | <Tool | ||
33 | Name="VCXMLDataGeneratorTool" | ||
34 | /> | ||
35 | <Tool | ||
36 | Name="VCWebServiceProxyGeneratorTool" | ||
37 | /> | ||
38 | <Tool | ||
39 | Name="VCMIDLTool" | ||
40 | /> | ||
41 | <Tool | ||
42 | Name="VCCLCompilerTool" | ||
43 | Optimization="0" | ||
44 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
45 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG" | ||
46 | MinimalRebuild="true" | ||
47 | BasicRuntimeChecks="3" | ||
48 | RuntimeLibrary="1" | ||
49 | StructMemberAlignment="4" | ||
50 | TreatWChar_tAsBuiltInType="false" | ||
51 | ForceConformanceInForLoopScope="true" | ||
52 | UsePrecompiledHeader="0" | ||
53 | WarningLevel="3" | ||
54 | WarnAsError="true" | ||
55 | Detect64BitPortabilityProblems="false" | ||
56 | DebugInformationFormat="4" | ||
57 | /> | ||
58 | <Tool | ||
59 | Name="VCManagedResourceCompilerTool" | ||
60 | /> | ||
61 | <Tool | ||
62 | Name="VCResourceCompilerTool" | ||
63 | /> | ||
64 | <Tool | ||
65 | Name="VCPreLinkEventTool" | ||
66 | /> | ||
67 | <Tool | ||
68 | Name="VCLibrarianTool" | ||
69 | OutputFile="$(OutDir)/lscript_execute.lib" | ||
70 | /> | ||
71 | <Tool | ||
72 | Name="VCALinkTool" | ||
73 | /> | ||
74 | <Tool | ||
75 | Name="VCXDCMakeTool" | ||
76 | /> | ||
77 | <Tool | ||
78 | Name="VCBscMakeTool" | ||
79 | /> | ||
80 | <Tool | ||
81 | Name="VCFxCopTool" | ||
82 | /> | ||
83 | <Tool | ||
84 | Name="VCPostBuildEventTool" | ||
85 | /> | ||
86 | </Configuration> | ||
87 | <Configuration | ||
88 | Name="Release|Win32" | ||
89 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
90 | IntermediateDirectory="Release" | ||
91 | ConfigurationType="4" | ||
92 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
93 | CharacterSet="1" | ||
94 | > | ||
95 | <Tool | ||
96 | Name="VCPreBuildEventTool" | ||
97 | /> | ||
98 | <Tool | ||
99 | Name="VCCustomBuildTool" | ||
100 | /> | ||
101 | <Tool | ||
102 | Name="VCXMLDataGeneratorTool" | ||
103 | /> | ||
104 | <Tool | ||
105 | Name="VCWebServiceProxyGeneratorTool" | ||
106 | /> | ||
107 | <Tool | ||
108 | Name="VCMIDLTool" | ||
109 | /> | ||
110 | <Tool | ||
111 | Name="VCCLCompilerTool" | ||
112 | AdditionalOptions="/Oy-" | ||
113 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
114 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
115 | RuntimeLibrary="0" | ||
116 | StructMemberAlignment="0" | ||
117 | TreatWChar_tAsBuiltInType="false" | ||
118 | ForceConformanceInForLoopScope="true" | ||
119 | UsePrecompiledHeader="0" | ||
120 | WarningLevel="3" | ||
121 | WarnAsError="true" | ||
122 | Detect64BitPortabilityProblems="false" | ||
123 | DebugInformationFormat="3" | ||
124 | /> | ||
125 | <Tool | ||
126 | Name="VCManagedResourceCompilerTool" | ||
127 | /> | ||
128 | <Tool | ||
129 | Name="VCResourceCompilerTool" | ||
130 | /> | ||
131 | <Tool | ||
132 | Name="VCPreLinkEventTool" | ||
133 | /> | ||
134 | <Tool | ||
135 | Name="VCLibrarianTool" | ||
136 | OutputFile="$(OutDir)/lscript_execute.lib" | ||
137 | /> | ||
138 | <Tool | ||
139 | Name="VCALinkTool" | ||
140 | /> | ||
141 | <Tool | ||
142 | Name="VCXDCMakeTool" | ||
143 | /> | ||
144 | <Tool | ||
145 | Name="VCBscMakeTool" | ||
146 | /> | ||
147 | <Tool | ||
148 | Name="VCFxCopTool" | ||
149 | /> | ||
150 | <Tool | ||
151 | Name="VCPostBuildEventTool" | ||
152 | /> | ||
153 | </Configuration> | ||
154 | <Configuration | ||
155 | Name="ReleaseNoOpt|Win32" | ||
156 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
157 | IntermediateDirectory="$(ConfigurationName)" | ||
158 | ConfigurationType="4" | ||
159 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
160 | CharacterSet="1" | ||
161 | > | ||
162 | <Tool | ||
163 | Name="VCPreBuildEventTool" | ||
164 | /> | ||
165 | <Tool | ||
166 | Name="VCCustomBuildTool" | ||
167 | /> | ||
168 | <Tool | ||
169 | Name="VCXMLDataGeneratorTool" | ||
170 | /> | ||
171 | <Tool | ||
172 | Name="VCWebServiceProxyGeneratorTool" | ||
173 | /> | ||
174 | <Tool | ||
175 | Name="VCMIDLTool" | ||
176 | /> | ||
177 | <Tool | ||
178 | Name="VCCLCompilerTool" | ||
179 | AdditionalOptions="/Oy-" | ||
180 | Optimization="0" | ||
181 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
182 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
183 | RuntimeLibrary="0" | ||
184 | StructMemberAlignment="0" | ||
185 | TreatWChar_tAsBuiltInType="false" | ||
186 | ForceConformanceInForLoopScope="true" | ||
187 | UsePrecompiledHeader="0" | ||
188 | WarningLevel="3" | ||
189 | WarnAsError="true" | ||
190 | Detect64BitPortabilityProblems="false" | ||
191 | DebugInformationFormat="3" | ||
192 | /> | ||
193 | <Tool | ||
194 | Name="VCManagedResourceCompilerTool" | ||
195 | /> | ||
196 | <Tool | ||
197 | Name="VCResourceCompilerTool" | ||
198 | /> | ||
199 | <Tool | ||
200 | Name="VCPreLinkEventTool" | ||
201 | /> | ||
202 | <Tool | ||
203 | Name="VCLibrarianTool" | ||
204 | OutputFile="$(OutDir)/lscript_execute.lib" | ||
205 | /> | ||
206 | <Tool | ||
207 | Name="VCALinkTool" | ||
208 | /> | ||
209 | <Tool | ||
210 | Name="VCXDCMakeTool" | ||
211 | /> | ||
212 | <Tool | ||
213 | Name="VCBscMakeTool" | ||
214 | /> | ||
215 | <Tool | ||
216 | Name="VCFxCopTool" | ||
217 | /> | ||
218 | <Tool | ||
219 | Name="VCPostBuildEventTool" | ||
220 | /> | ||
221 | </Configuration> | ||
222 | </Configurations> | ||
223 | <References> | ||
224 | </References> | ||
225 | <Files> | ||
226 | <Filter | ||
227 | Name="Source Files" | ||
228 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
229 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
230 | > | ||
231 | <File | ||
232 | RelativePath=".\lscript_execute.cpp" | ||
233 | > | ||
234 | </File> | ||
235 | <File | ||
236 | RelativePath=".\lscript_heapruntime.cpp" | ||
237 | > | ||
238 | </File> | ||
239 | <File | ||
240 | RelativePath=".\lscript_readlso.cpp" | ||
241 | > | ||
242 | </File> | ||
243 | </Filter> | ||
244 | <Filter | ||
245 | Name="Header Files" | ||
246 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
247 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
248 | > | ||
249 | <File | ||
250 | RelativePath="..\lscript_byteconvert.h" | ||
251 | > | ||
252 | </File> | ||
253 | <File | ||
254 | RelativePath="..\lscript_byteformat.h" | ||
255 | > | ||
256 | </File> | ||
257 | <File | ||
258 | RelativePath="..\lscript_execute.h" | ||
259 | > | ||
260 | </File> | ||
261 | <File | ||
262 | RelativePath=".\lscript_heapruntime.h" | ||
263 | > | ||
264 | </File> | ||
265 | <File | ||
266 | RelativePath=".\lscript_readlso.h" | ||
267 | > | ||
268 | </File> | ||
269 | </Filter> | ||
270 | <Filter | ||
271 | Name="Resource Files" | ||
272 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
273 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
274 | > | ||
275 | </Filter> | ||
276 | </Files> | ||
277 | <Globals> | ||
278 | </Globals> | ||
279 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_execute/lscript_execute_vc9.vcproj b/linden/indra/lscript/lscript_execute/lscript_execute_vc9.vcproj deleted file mode 100644 index eb41122..0000000 --- a/linden/indra/lscript/lscript_execute/lscript_execute_vc9.vcproj +++ /dev/null | |||
@@ -1,280 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="9.00" | ||
5 | Name="lscript_execute" | ||
6 | ProjectGUID="{F882263E-4F2A-43D9-A45A-FA4C8EC66552}" | ||
7 | RootNamespace="lscript_execute" | ||
8 | Keyword="Win32Proj" | ||
9 | TargetFrameworkVersion="131072" | ||
10 | > | ||
11 | <Platforms> | ||
12 | <Platform | ||
13 | Name="Win32" | ||
14 | /> | ||
15 | </Platforms> | ||
16 | <ToolFiles> | ||
17 | </ToolFiles> | ||
18 | <Configurations> | ||
19 | <Configuration | ||
20 | Name="Debug|Win32" | ||
21 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
22 | IntermediateDirectory="Debug" | ||
23 | ConfigurationType="4" | ||
24 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
25 | CharacterSet="1" | ||
26 | > | ||
27 | <Tool | ||
28 | Name="VCPreBuildEventTool" | ||
29 | /> | ||
30 | <Tool | ||
31 | Name="VCCustomBuildTool" | ||
32 | /> | ||
33 | <Tool | ||
34 | Name="VCXMLDataGeneratorTool" | ||
35 | /> | ||
36 | <Tool | ||
37 | Name="VCWebServiceProxyGeneratorTool" | ||
38 | /> | ||
39 | <Tool | ||
40 | Name="VCMIDLTool" | ||
41 | /> | ||
42 | <Tool | ||
43 | Name="VCCLCompilerTool" | ||
44 | Optimization="0" | ||
45 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
46 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG" | ||
47 | MinimalRebuild="true" | ||
48 | BasicRuntimeChecks="3" | ||
49 | RuntimeLibrary="1" | ||
50 | StructMemberAlignment="4" | ||
51 | TreatWChar_tAsBuiltInType="false" | ||
52 | ForceConformanceInForLoopScope="true" | ||
53 | UsePrecompiledHeader="0" | ||
54 | WarningLevel="3" | ||
55 | WarnAsError="true" | ||
56 | Detect64BitPortabilityProblems="false" | ||
57 | DebugInformationFormat="4" | ||
58 | /> | ||
59 | <Tool | ||
60 | Name="VCManagedResourceCompilerTool" | ||
61 | /> | ||
62 | <Tool | ||
63 | Name="VCResourceCompilerTool" | ||
64 | /> | ||
65 | <Tool | ||
66 | Name="VCPreLinkEventTool" | ||
67 | /> | ||
68 | <Tool | ||
69 | Name="VCLibrarianTool" | ||
70 | OutputFile="$(OutDir)/lscript_execute.lib" | ||
71 | /> | ||
72 | <Tool | ||
73 | Name="VCALinkTool" | ||
74 | /> | ||
75 | <Tool | ||
76 | Name="VCXDCMakeTool" | ||
77 | /> | ||
78 | <Tool | ||
79 | Name="VCBscMakeTool" | ||
80 | /> | ||
81 | <Tool | ||
82 | Name="VCFxCopTool" | ||
83 | /> | ||
84 | <Tool | ||
85 | Name="VCPostBuildEventTool" | ||
86 | /> | ||
87 | </Configuration> | ||
88 | <Configuration | ||
89 | Name="Release|Win32" | ||
90 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
91 | IntermediateDirectory="Release" | ||
92 | ConfigurationType="4" | ||
93 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
94 | CharacterSet="1" | ||
95 | > | ||
96 | <Tool | ||
97 | Name="VCPreBuildEventTool" | ||
98 | /> | ||
99 | <Tool | ||
100 | Name="VCCustomBuildTool" | ||
101 | /> | ||
102 | <Tool | ||
103 | Name="VCXMLDataGeneratorTool" | ||
104 | /> | ||
105 | <Tool | ||
106 | Name="VCWebServiceProxyGeneratorTool" | ||
107 | /> | ||
108 | <Tool | ||
109 | Name="VCMIDLTool" | ||
110 | /> | ||
111 | <Tool | ||
112 | Name="VCCLCompilerTool" | ||
113 | AdditionalOptions="/Oy-" | ||
114 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
115 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
116 | RuntimeLibrary="0" | ||
117 | StructMemberAlignment="0" | ||
118 | TreatWChar_tAsBuiltInType="false" | ||
119 | ForceConformanceInForLoopScope="true" | ||
120 | UsePrecompiledHeader="0" | ||
121 | WarningLevel="3" | ||
122 | WarnAsError="true" | ||
123 | Detect64BitPortabilityProblems="false" | ||
124 | DebugInformationFormat="3" | ||
125 | /> | ||
126 | <Tool | ||
127 | Name="VCManagedResourceCompilerTool" | ||
128 | /> | ||
129 | <Tool | ||
130 | Name="VCResourceCompilerTool" | ||
131 | /> | ||
132 | <Tool | ||
133 | Name="VCPreLinkEventTool" | ||
134 | /> | ||
135 | <Tool | ||
136 | Name="VCLibrarianTool" | ||
137 | OutputFile="$(OutDir)/lscript_execute.lib" | ||
138 | /> | ||
139 | <Tool | ||
140 | Name="VCALinkTool" | ||
141 | /> | ||
142 | <Tool | ||
143 | Name="VCXDCMakeTool" | ||
144 | /> | ||
145 | <Tool | ||
146 | Name="VCBscMakeTool" | ||
147 | /> | ||
148 | <Tool | ||
149 | Name="VCFxCopTool" | ||
150 | /> | ||
151 | <Tool | ||
152 | Name="VCPostBuildEventTool" | ||
153 | /> | ||
154 | </Configuration> | ||
155 | <Configuration | ||
156 | Name="ReleaseNoOpt|Win32" | ||
157 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
158 | IntermediateDirectory="$(ConfigurationName)" | ||
159 | ConfigurationType="4" | ||
160 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
161 | CharacterSet="1" | ||
162 | > | ||
163 | <Tool | ||
164 | Name="VCPreBuildEventTool" | ||
165 | /> | ||
166 | <Tool | ||
167 | Name="VCCustomBuildTool" | ||
168 | /> | ||
169 | <Tool | ||
170 | Name="VCXMLDataGeneratorTool" | ||
171 | /> | ||
172 | <Tool | ||
173 | Name="VCWebServiceProxyGeneratorTool" | ||
174 | /> | ||
175 | <Tool | ||
176 | Name="VCMIDLTool" | ||
177 | /> | ||
178 | <Tool | ||
179 | Name="VCCLCompilerTool" | ||
180 | AdditionalOptions="/Oy-" | ||
181 | Optimization="0" | ||
182 | AdditionalIncludeDirectories="..;..\..\llcommon;..\..\llmath;"..\..\..\libraries\i686-win32\include";..\..\..\libraries\include" | ||
183 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
184 | RuntimeLibrary="0" | ||
185 | StructMemberAlignment="0" | ||
186 | TreatWChar_tAsBuiltInType="false" | ||
187 | ForceConformanceInForLoopScope="true" | ||
188 | UsePrecompiledHeader="0" | ||
189 | WarningLevel="3" | ||
190 | WarnAsError="true" | ||
191 | Detect64BitPortabilityProblems="false" | ||
192 | DebugInformationFormat="3" | ||
193 | /> | ||
194 | <Tool | ||
195 | Name="VCManagedResourceCompilerTool" | ||
196 | /> | ||
197 | <Tool | ||
198 | Name="VCResourceCompilerTool" | ||
199 | /> | ||
200 | <Tool | ||
201 | Name="VCPreLinkEventTool" | ||
202 | /> | ||
203 | <Tool | ||
204 | Name="VCLibrarianTool" | ||
205 | OutputFile="$(OutDir)/lscript_execute.lib" | ||
206 | /> | ||
207 | <Tool | ||
208 | Name="VCALinkTool" | ||
209 | /> | ||
210 | <Tool | ||
211 | Name="VCXDCMakeTool" | ||
212 | /> | ||
213 | <Tool | ||
214 | Name="VCBscMakeTool" | ||
215 | /> | ||
216 | <Tool | ||
217 | Name="VCFxCopTool" | ||
218 | /> | ||
219 | <Tool | ||
220 | Name="VCPostBuildEventTool" | ||
221 | /> | ||
222 | </Configuration> | ||
223 | </Configurations> | ||
224 | <References> | ||
225 | </References> | ||
226 | <Files> | ||
227 | <Filter | ||
228 | Name="Source Files" | ||
229 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
230 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
231 | > | ||
232 | <File | ||
233 | RelativePath=".\lscript_execute.cpp" | ||
234 | > | ||
235 | </File> | ||
236 | <File | ||
237 | RelativePath=".\lscript_heapruntime.cpp" | ||
238 | > | ||
239 | </File> | ||
240 | <File | ||
241 | RelativePath=".\lscript_readlso.cpp" | ||
242 | > | ||
243 | </File> | ||
244 | </Filter> | ||
245 | <Filter | ||
246 | Name="Header Files" | ||
247 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
248 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
249 | > | ||
250 | <File | ||
251 | RelativePath="..\lscript_byteconvert.h" | ||
252 | > | ||
253 | </File> | ||
254 | <File | ||
255 | RelativePath="..\lscript_byteformat.h" | ||
256 | > | ||
257 | </File> | ||
258 | <File | ||
259 | RelativePath="..\lscript_execute.h" | ||
260 | > | ||
261 | </File> | ||
262 | <File | ||
263 | RelativePath=".\lscript_heapruntime.h" | ||
264 | > | ||
265 | </File> | ||
266 | <File | ||
267 | RelativePath=".\lscript_readlso.h" | ||
268 | > | ||
269 | </File> | ||
270 | </Filter> | ||
271 | <Filter | ||
272 | Name="Resource Files" | ||
273 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
274 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
275 | > | ||
276 | </Filter> | ||
277 | </Files> | ||
278 | <Globals> | ||
279 | </Globals> | ||
280 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_execute_mono/assembly.cpp b/linden/indra/lscript/lscript_execute_mono/assembly.cpp new file mode 100644 index 0000000..dd8b284 --- /dev/null +++ b/linden/indra/lscript/lscript_execute_mono/assembly.cpp | |||
@@ -0,0 +1,74 @@ | |||
1 | /** | ||
2 | * @file llassembly.cpp | ||
3 | * @brief keeps track of user scripts, ensures that only one copy exists for each | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2007&license=internal$ | ||
6 | * | ||
7 | * Copyright (c) 2007-2008, Linden Research, Inc. | ||
8 | * | ||
9 | * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of | ||
10 | * this source code is governed by the Linden Lab Source Code Disclosure | ||
11 | * Agreement ("Agreement") previously entered between you and Linden | ||
12 | * Lab. By accessing, using, copying, modifying or distributing this | ||
13 | * software, you acknowledge that you have been informed of your | ||
14 | * obligations under the Agreement and agree to abide by those obligations. | ||
15 | * | ||
16 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
17 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
18 | * COMPLETENESS OR PERFORMANCE. | ||
19 | * $/LicenseInfo$ | ||
20 | */ | ||
21 | |||
22 | |||
23 | #include "llassembly.h" | ||
24 | #include <map> | ||
25 | |||
26 | |||
27 | static std::map<std::string, LLAssembly*> sAssemblyMap; | ||
28 | |||
29 | boost::intrusive_ptr<LLAssembly> LLAssembly::create(const std::string& name, | ||
30 | const U8* buffer, U32 size) | ||
31 | { | ||
32 | std::map<std::string, LLAssembly*>::iterator it = sAssemblyMap.find(name); | ||
33 | if (it != sAssemblyMap.end()) | ||
34 | { | ||
35 | return it->second; | ||
36 | } | ||
37 | else | ||
38 | { | ||
39 | LLAssembly* a = new LLAssembly(name, buffer, size); | ||
40 | sAssemblyMap[name] = a; | ||
41 | return a; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | |||
46 | LLAssembly::LLAssembly(const std::string &name, const U8* buffer, U32 size) : | ||
47 | mName(name), mRefCount(0), mBuffer(buffer, buffer+size) | ||
48 | { | ||
49 | } | ||
50 | |||
51 | LLAssembly::~LLAssembly() | ||
52 | { | ||
53 | std::map<std::string, LLAssembly*>::iterator it = sAssemblyMap.find(mName); | ||
54 | if (it != sAssemblyMap.end()) | ||
55 | { | ||
56 | sAssemblyMap.erase(it); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | |||
61 | void intrusive_ptr_add_ref(LLAssembly* p) | ||
62 | { | ||
63 | ++(p->mRefCount); | ||
64 | } | ||
65 | |||
66 | void intrusive_ptr_release(LLAssembly* p) | ||
67 | { | ||
68 | if (0 == --(p->mRefCount)) | ||
69 | { | ||
70 | delete p; | ||
71 | } | ||
72 | } | ||
73 | |||
74 | |||
diff --git a/linden/indra/lscript/lscript_execute_mono/size.cpp b/linden/indra/lscript/lscript_execute_mono/size.cpp new file mode 100644 index 0000000..f9ca7a3 --- /dev/null +++ b/linden/indra/lscript/lscript_execute_mono/size.cpp | |||
@@ -0,0 +1,182 @@ | |||
1 | /** | ||
2 | * NOTE: none of this actually applies as this file was taken from mono/samples | ||
3 | * @file size.c | ||
4 | * @brief file from mono samples | ||
5 | * | ||
6 | * $LicenseInfo:firstyear=2007&license=internal$ | ||
7 | * | ||
8 | * Copyright (c) 2007-2008, Linden Research, Inc. | ||
9 | * | ||
10 | * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of | ||
11 | * this source code is governed by the Linden Lab Source Code Disclosure | ||
12 | * Agreement ("Agreement") previously entered between you and Linden | ||
13 | * Lab. By accessing, using, copying, modifying or distributing this | ||
14 | * software, you acknowledge that you have been informed of your | ||
15 | * obligations under the Agreement and agree to abide by those obligations. | ||
16 | * | ||
17 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
18 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
19 | * COMPLETENESS OR PERFORMANCE. | ||
20 | * $/LicenseInfo$ | ||
21 | */ | ||
22 | |||
23 | #include <glib.h> | ||
24 | #include <mono/jit/jit.h> | ||
25 | #include <mono/metadata/environment.h> | ||
26 | #include <mono/metadata/profiler.h> | ||
27 | #include <mono/metadata/tokentype.h> | ||
28 | #include <mono/metadata/debug-helpers.h> | ||
29 | #include <mono/metadata/llassembly.h> | ||
30 | #include <string.h> | ||
31 | |||
32 | #include "stdtypes.h" | ||
33 | #include "linden_common.h" | ||
34 | |||
35 | #define FIELD_ATTRIBUTE_STATIC 0x10 | ||
36 | #define FIELD_ATTRIBUTE_HAS_FIELD_RVA 0x100 | ||
37 | |||
38 | static int memory_usage (MonoObject *obj, GHashTable *visited, | ||
39 | int (*functor)(MonoObject*, MonoType*, int)); | ||
40 | |||
41 | static int | ||
42 | memory_usage_array (MonoArray *array, GHashTable *visited, | ||
43 | int (*functor)(MonoObject*, MonoType*, int)) | ||
44 | { | ||
45 | int total = 0; | ||
46 | MonoClass *array_class = mono_object_get_class ((MonoObject *) array); | ||
47 | MonoClass *element_class = mono_class_get_element_class (array_class); | ||
48 | MonoType *element_type = mono_class_get_type (element_class); | ||
49 | |||
50 | if (MONO_TYPE_IS_REFERENCE (element_type)) { | ||
51 | int i; | ||
52 | |||
53 | for (i = 0; i < mono_array_length (array); i++) { | ||
54 | MonoObject *element = (MonoObject*)mono_array_get (array, gpointer, i); | ||
55 | |||
56 | if (element != NULL) | ||
57 | total += memory_usage (element, visited, functor); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | return total; | ||
62 | } | ||
63 | |||
64 | static int | ||
65 | memory_usage (MonoObject *obj, GHashTable *visited, | ||
66 | int (*functor)(MonoObject*, MonoType*, int)) | ||
67 | { | ||
68 | int total = 0; | ||
69 | MonoClass *klass; | ||
70 | MonoType *type; | ||
71 | gpointer iter = NULL; | ||
72 | MonoClassField *field; | ||
73 | |||
74 | if (g_hash_table_lookup (visited, obj)) | ||
75 | return 0; | ||
76 | |||
77 | g_hash_table_insert (visited, obj, obj); | ||
78 | |||
79 | klass = mono_object_get_class (obj); | ||
80 | type = mono_class_get_type (klass); | ||
81 | |||
82 | /* This is an array, so drill down into it */ | ||
83 | if (type->type == MONO_TYPE_SZARRAY) | ||
84 | total += memory_usage_array ((MonoArray *) obj, visited, functor); | ||
85 | |||
86 | while ((field = mono_class_get_fields (klass, &iter)) != NULL) { | ||
87 | MonoType *ftype = mono_field_get_type (field); | ||
88 | gpointer value; | ||
89 | |||
90 | if ((ftype->attrs & (FIELD_ATTRIBUTE_STATIC | FIELD_ATTRIBUTE_HAS_FIELD_RVA)) != 0) | ||
91 | continue; | ||
92 | |||
93 | /* FIXME: There are probably other types we need to drill down into */ | ||
94 | switch (ftype->type) { | ||
95 | |||
96 | case MONO_TYPE_CLASS: | ||
97 | case MONO_TYPE_OBJECT: | ||
98 | mono_field_get_value (obj, field, &value); | ||
99 | |||
100 | if (value != NULL) | ||
101 | total += memory_usage ((MonoObject *) value, visited, functor); | ||
102 | |||
103 | break; | ||
104 | |||
105 | case MONO_TYPE_STRING: | ||
106 | mono_field_get_value (obj, field, &value); | ||
107 | if (value != NULL) | ||
108 | total += mono_object_get_size ((MonoObject *) value); | ||
109 | break; | ||
110 | |||
111 | case MONO_TYPE_SZARRAY: | ||
112 | mono_field_get_value (obj, field, &value); | ||
113 | |||
114 | if (value != NULL) { | ||
115 | total += memory_usage_array ((MonoArray *) value, visited, functor); | ||
116 | total += mono_object_get_size ((MonoObject *) value); | ||
117 | } | ||
118 | |||
119 | break; | ||
120 | |||
121 | default: | ||
122 | /* printf ("Got type 0x%x\n", ftype->type); */ | ||
123 | /* ignore, this will be included in mono_object_get_size () */ | ||
124 | break; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | total = functor(obj, type, total); | ||
129 | |||
130 | return total; | ||
131 | } | ||
132 | |||
133 | |||
134 | int addObjectSize(MonoObject* obj, MonoType* type, int total) | ||
135 | { | ||
136 | return total + mono_object_get_size (obj); | ||
137 | } | ||
138 | |||
139 | /* | ||
140 | * Only returns data for instances, not for static fields, those might | ||
141 | * be larger, or hold larger structures | ||
142 | */ | ||
143 | int | ||
144 | GetMemoryUsage (MonoObject *obj) | ||
145 | { | ||
146 | GHashTable *visited = g_hash_table_new (NULL, NULL); | ||
147 | int n; | ||
148 | |||
149 | n = memory_usage (obj, visited, addObjectSize); | ||
150 | |||
151 | g_hash_table_destroy (visited); | ||
152 | |||
153 | return n; | ||
154 | } | ||
155 | |||
156 | |||
157 | |||
158 | int printObjectSize(MonoObject* obj, MonoType* type, int total) | ||
159 | { | ||
160 | total += mono_object_get_size (obj); | ||
161 | llinfos << "Object type: " << mono_type_full_name(type) << " size: " | ||
162 | << total << llendl; | ||
163 | |||
164 | return total; | ||
165 | } | ||
166 | |||
167 | /* | ||
168 | * Only returns data for instances, not for static fields, those might | ||
169 | * be larger, or hold larger structures | ||
170 | */ | ||
171 | int | ||
172 | PrintMemoryUsage (MonoObject *obj) | ||
173 | { | ||
174 | GHashTable *visited = g_hash_table_new (NULL, NULL); | ||
175 | int n; | ||
176 | |||
177 | n = memory_usage (obj, visited, printObjectSize); | ||
178 | |||
179 | g_hash_table_destroy (visited); | ||
180 | |||
181 | return n; | ||
182 | } | ||
diff --git a/linden/indra/lscript/lscript_library.h b/linden/indra/lscript/lscript_library.h index 458ab25..077c02b 100644 --- a/linden/indra/lscript/lscript_library.h +++ b/linden/indra/lscript/lscript_library.h | |||
@@ -43,16 +43,16 @@ class LLScriptLibData; | |||
43 | class LLScriptLibraryFunction | 43 | class LLScriptLibraryFunction |
44 | { | 44 | { |
45 | public: | 45 | public: |
46 | LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only = FALSE); | 46 | LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, const char *desc, BOOL god_only = FALSE); |
47 | ~LLScriptLibraryFunction(); | 47 | ~LLScriptLibraryFunction(); |
48 | 48 | ||
49 | F32 mEnergyUse; | 49 | F32 mEnergyUse; |
50 | F32 mSleepTime; | 50 | F32 mSleepTime; |
51 | void (*mExecFunc)(LLScriptLibData *, LLScriptLibData *, const LLUUID &); | 51 | void (*mExecFunc)(LLScriptLibData *, LLScriptLibData *, const LLUUID &); |
52 | char *mName; | 52 | const char *mName; |
53 | char *mReturnType; | 53 | const char *mReturnType; |
54 | char *mArgs; | 54 | const char *mArgs; |
55 | char *mDesc; | 55 | const char *mDesc; |
56 | BOOL mGodOnly; | 56 | BOOL mGodOnly; |
57 | }; | 57 | }; |
58 | 58 | ||
@@ -65,7 +65,7 @@ public: | |||
65 | void init(); | 65 | void init(); |
66 | 66 | ||
67 | void addFunction(LLScriptLibraryFunction *func); | 67 | void addFunction(LLScriptLibraryFunction *func); |
68 | void assignExec(char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)); | 68 | void assignExec(const char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)); |
69 | 69 | ||
70 | S32 mNextNumber; | 70 | S32 mNextNumber; |
71 | LLScriptLibraryFunction **mFunctions; | 71 | LLScriptLibraryFunction **mFunctions; |
@@ -146,9 +146,9 @@ public: | |||
146 | return FALSE; | 146 | return FALSE; |
147 | } | 147 | } |
148 | 148 | ||
149 | S32 getListLength() | 149 | S32 getListLength() const |
150 | { | 150 | { |
151 | LLScriptLibData *data = this; | 151 | const LLScriptLibData *data = this; |
152 | S32 retval = 0; | 152 | S32 retval = 0; |
153 | while (data->mListp) | 153 | while (data->mListp) |
154 | { | 154 | { |
@@ -365,7 +365,7 @@ public: | |||
365 | void print(std::ostream &s, BOOL b_prepend_comma); | 365 | void print(std::ostream &s, BOOL b_prepend_comma); |
366 | void print_separator(std::ostream& ostr, BOOL b_prepend_sep, char* sep); | 366 | void print_separator(std::ostream& ostr, BOOL b_prepend_sep, char* sep); |
367 | 367 | ||
368 | void setFromCSV(char *src) | 368 | void setFromCSV(const char *src) |
369 | { | 369 | { |
370 | mType = LST_STRING; | 370 | mType = LST_STRING; |
371 | mString = new char[strlen(src) + 1]; /* Flawfinder: ignore */ | 371 | mString = new char[strlen(src) + 1]; /* Flawfinder: ignore */ |
@@ -387,27 +387,10 @@ public: | |||
387 | 387 | ||
388 | LLScriptLibData(const LLUUID &id) : mType(LST_KEY), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) | 388 | LLScriptLibData(const LLUUID &id) : mType(LST_KEY), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) |
389 | { | 389 | { |
390 | mKey = new char[UUID_STR_LENGTH]; | 390 | std::string idstr; |
391 | id.toString(mKey); | 391 | id.toString(idstr); |
392 | } | 392 | mKey = new char[idstr.length()+1]; |
393 | 393 | LLStringUtil::copy(mKey,idstr.c_str(),idstr.length()+1); | |
394 | LLScriptLibData(char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) | ||
395 | { | ||
396 | if (!string) | ||
397 | { | ||
398 | mString = new char[1]; | ||
399 | mString[0] = 0; | ||
400 | } | ||
401 | else | ||
402 | { | ||
403 | mString = new char[strlen(string) + 1]; /* Flawfinder: ignore */ | ||
404 | if (mString == NULL) | ||
405 | { | ||
406 | llerrs << "Memory Allocation Failed" << llendl; | ||
407 | return; | ||
408 | } | ||
409 | strcpy(mString, string); /* Flawfinder: ignore */ | ||
410 | } | ||
411 | } | 394 | } |
412 | 395 | ||
413 | LLScriptLibData(const char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) | 396 | LLScriptLibData(const char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) |
diff --git a/linden/indra/lscript/lscript_library/CMakeLists.txt b/linden/indra/lscript/lscript_library/CMakeLists.txt new file mode 100644 index 0000000..f6bc67a --- /dev/null +++ b/linden/indra/lscript/lscript_library/CMakeLists.txt | |||
@@ -0,0 +1,32 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | include(00-Common) | ||
4 | include(LLCommon) | ||
5 | include(LLMath) | ||
6 | include(LScript) | ||
7 | |||
8 | set(lscript_library_SOURCE_FILES | ||
9 | lscript_alloc.cpp | ||
10 | lscript_export.cpp | ||
11 | lscript_library.cpp | ||
12 | ) | ||
13 | |||
14 | set(lscript_library_HEADER_FILES | ||
15 | CMakeLists.txt | ||
16 | |||
17 | ../lscript_library.h | ||
18 | ../lscript_export.h | ||
19 | ) | ||
20 | |||
21 | set_source_files_properties(${lscript_library_HEADER_FILES} | ||
22 | PROPERTIES HEADER_FILE_ONLY TRUE) | ||
23 | |||
24 | list(APPEND lscript_library_SOURCE_FILES ${lscript_library_HEADER_FILES}) | ||
25 | |||
26 | include_directories( | ||
27 | ${LLCOMMON_INCLUDE_DIRS} | ||
28 | ${LLMATH_INCLUDE_DIRS} | ||
29 | ${LSCRIPT_INCLUDE_DIRS} | ||
30 | ) | ||
31 | |||
32 | add_library (lscript_library ${lscript_library_SOURCE_FILES}) | ||
diff --git a/linden/indra/lscript/lscript_library/lscript_library.cpp b/linden/indra/lscript/lscript_library/lscript_library.cpp index 14019d0..e7d8284 100644 --- a/linden/indra/lscript/lscript_library/lscript_library.cpp +++ b/linden/indra/lscript/lscript_library/lscript_library.cpp | |||
@@ -398,9 +398,8 @@ void LLScriptLibrary::init() | |||
398 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCameraPos", "v", "", "vector llGetCameraPos()\nGets current camera position for agent task has permissions for.")); | 398 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCameraPos", "v", "", "vector llGetCameraPos()\nGets current camera position for agent task has permissions for.")); |
399 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCameraRot", "q", "", "rotation llGetCameraRot()\nGets current camera orientation for agent task has permissions for.")); | 399 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCameraRot", "q", "", "rotation llGetCameraRot()\nGets current camera orientation for agent task has permissions for.")); |
400 | 400 | ||
401 | addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llSetPrimURL", NULL, "s", "llSetPrimURL(string url)\nUpdates the URL for the web page shown on the sides of the object.")); | 401 | addFunction(new LLScriptLibraryFunction(10.f, 20.f, dummy_func, "llSetPrimURL", NULL, "s", "llSetPrimURL(string url)\nUpdates the URL for the web page shown on the sides of the object.")); |
402 | addFunction(new LLScriptLibraryFunction(10.f, 20.f, dummy_func, "llRefreshPrimURL", NULL, "", "llRefreshPrimURL()\nReloads the web page shown on the sides of the object.")); | 402 | addFunction(new LLScriptLibraryFunction(10.f, 20.f, dummy_func, "llRefreshPrimURL", NULL, "", "llRefreshPrimURL()\nReloads the web page shown on the sides of the object.")); |
403 | |||
404 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llEscapeURL", "s", "s", "string llEscapeURL(string url)\nReturns and escaped/encoded version of url, replacing spaces with %20 etc.")); | 403 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llEscapeURL", "s", "s", "string llEscapeURL(string url)\nReturns and escaped/encoded version of url, replacing spaces with %20 etc.")); |
405 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llUnescapeURL", "s", "s", "string llUnescapeURL(string url)\nReturns and unescaped/unencoded version of url, replacing %20 with spaces etc.")); | 404 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llUnescapeURL", "s", "s", "string llUnescapeURL(string url)\nReturns and unescaped/unencoded version of url, replacing %20 with spaces etc.")); |
406 | 405 | ||
@@ -436,10 +435,20 @@ void LLScriptLibrary::init() | |||
436 | 435 | ||
437 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStringTrim", "s", "si", "string llStringTrim(string src, integer trim_type)\nTrim leading and/or trailing spaces from a string.\nUses trim_type of STRING_TRIM, STRING_TRIM_HEAD or STRING_TRIM_TAIL.")); | 436 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStringTrim", "s", "si", "string llStringTrim(string src, integer trim_type)\nTrim leading and/or trailing spaces from a string.\nUses trim_type of STRING_TRIM, STRING_TRIM_HEAD or STRING_TRIM_TAIL.")); |
438 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRegionSay", NULL, "is", "llRegionSay(integer channel, string msg)\nbroadcasts msg to entire region on channel (not 0.)")); | 437 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRegionSay", NULL, "is", "llRegionSay(integer channel, string msg)\nbroadcasts msg to entire region on channel (not 0.)")); |
439 | |||
440 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectDetails", "l", "kl", "list llGetObjectDetails(key id, list params)\nGets the object details specified in params for the object with key id.\nDetails are OBJECT_NAME, _DESC, _POS, _ROT, _VELOCITY, _OWNER, _GROUP, _CREATOR.")); | 438 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectDetails", "l", "kl", "list llGetObjectDetails(key id, list params)\nGets the object details specified in params for the object with key id.\nDetails are OBJECT_NAME, _DESC, _POS, _ROT, _VELOCITY, _OWNER, _GROUP, _CREATOR.")); |
439 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetClickAction", NULL, "i", "llSetClickAction(integer action)\nSets the action performed when a prim is clicked upon.")); | ||
440 | |||
441 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionAgentCount", "i", NULL, "int llGetRegionAgentCount()\nreturns the number of agents in a region")); | ||
442 | addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llTextBox", NULL, "ksi", "llTextBox(key avatar, string message, integer chat_channel\nShows a dialog box on the avatar's screen with the message.\nA text box asks for input, and if entered the text is chatted on chat_channel.")); | ||
443 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAgentLanguage", "s", "k", "string llGetAgentLanguage(key id)\nGets the agents preferred language..")); | ||
444 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedTouchUV", "v", "i", "vector llDetectedTouchUV(integer number)\nreturns the u and v coordinates in the first two components of a vector, for a triggered touch event")); | ||
445 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedTouchFace", "i", "i", "integer llDetectedTouchFace(integer number)\nreturns the index of the face on the object for a triggered touch event")); | ||
446 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedTouchPos", "v", "i", "vector llDetectedTouchPos(integer number)\nreturns the position touched for a triggered touch event")); | ||
447 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedTouchNormal", "v", "i", "vector llDetectedTouchNormal(integer number)\nreturns the surface normal for a triggered touch event")); | ||
448 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedTouchBinormal", "v", "i", "vector llDetectedTouchBinormal(integer number)\nreturns the surface binormal for a triggered touch event")); | ||
449 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedTouchST", "v", "i", "vector llDetectedTouchST(integer number)\nreturns the s and t coordinates in the first two components of a vector, for a triggered touch event")); | ||
450 | |||
441 | 451 | ||
442 | addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetClickAction", NULL, "i", "llSetClickAction(integer action)\nSets the action performed when a prim is clicked upon.")); | ||
443 | 452 | ||
444 | // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only | 453 | // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only |
445 | 454 | ||
@@ -448,32 +457,14 @@ void LLScriptLibrary::init() | |||
448 | // existing scripts will crash. | 457 | // existing scripts will crash. |
449 | } | 458 | } |
450 | 459 | ||
451 | //Ventrella Follow Cam Script Stuff | 460 | LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, const char *desc, BOOL god_only) |
452 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPitch", NULL, "f", "llSetCamPitch(-45 to 80)\n(Adjusts the angular amount that the camera aims straight ahead vs. straight down, maintaining the same distance. Analogous to 'incidence'.")); | ||
453 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamVerticalOffset", NULL, "f", "llSetCamVerticalOffset(-2 to 2)\nAdjusts the vertical position of the camera focus position relative to the subject")); | ||
454 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionLag", NULL, "f", "llSetCamPositionLag(0 to 3) \nHow much the camera lags as it tries to move towards its 'ideal' position")); | ||
455 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusLag", NULL, "f", "llSetCamFocusLag(0 to 3)\nHow much the camera lags as it tries to aim towards the subject")); | ||
456 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamDistance", NULL, "f", "llSetCamDistance(0.5 to 10)\nSets how far away the camera wants to be from its subject")); | ||
457 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamBehindnessAngle", NULL, "f", "llSetCamBehindnessAngle(0 to 180)\nSets the angle in degrees within which the camera is not constrained by changes in subject rotation")); | ||
458 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamBehindnessLag", NULL, "f", "llSetCamBehindnessLag(0 to 3)\nSets how strongly the camera is forced to stay behind the target if outside of behindness angle")); | ||
459 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionThreshold", NULL, "f", "llSetCamPositionThreshold(0 to 4)\nSets the radius of a sphere around the camera's ideal position within which it is not affected by subject motion")); | ||
460 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusThreshold", NULL, "f", "llSetCamFocusThreshold(0 to 4)\nSets the radius of a sphere around the camera's subject position within which its focus is not affected by subject motion")); | ||
461 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamScriptControl", NULL, "i", "llSetCamScriptControl(TRUE or FALSE)\nTurns on or off scripted control of the camera")); | ||
462 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPosition", NULL, "v", "llSetCamPosition(vector)\nSets the position of the camera")); | ||
463 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocus", NULL, "v", "llSetCamFocus(vector focus)\nSets the focus (target position) of the camera")); | ||
464 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionLocked", NULL, "i", "llSetCamPositionLocked(TRUE or FALSE)\nLocks the camera position so it will not move")); | ||
465 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusLocked", NULL, "i", "llSetCamFocusLocked(TRUE or FALSE)\nLocks the camera focus so it will not move")); | ||
466 | |||
467 | //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForSale", "i", "ii", "integer llSetForSale(integer selltype, integer price)\nSets this object for sale in mode selltype for price. Returns TRUE if successfully set for sale.")); | ||
468 | |||
469 | LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only) | ||
470 | : mEnergyUse(eu), mSleepTime(st), mExecFunc(exec_func), mName(name), mReturnType(ret_type), mArgs(args), mGodOnly(god_only) | 461 | : mEnergyUse(eu), mSleepTime(st), mExecFunc(exec_func), mName(name), mReturnType(ret_type), mArgs(args), mGodOnly(god_only) |
471 | { | 462 | { |
472 | mDesc = new char[512]; | 463 | char *mDesc_ = new char[512]; |
473 | if (mSleepTime) | 464 | if (mSleepTime) |
474 | { | 465 | { |
475 | snprintf( /* Flawfinder: ignore */ | 466 | snprintf( /* Flawfinder: ignore */ |
476 | mDesc, | 467 | mDesc_, |
477 | 512, | 468 | 512, |
478 | "%s\nSleeps script for %.1f seconds.", | 469 | "%s\nSleeps script for %.1f seconds.", |
479 | desc, | 470 | desc, |
@@ -481,9 +472,10 @@ LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_fun | |||
481 | } | 472 | } |
482 | else | 473 | else |
483 | { | 474 | { |
484 | strncpy(mDesc, desc, 512); /* Flawfinder: ignore */ | 475 | strncpy(mDesc_, desc, 512); /* Flawfinder: ignore */ |
485 | mDesc[511] = '\0'; // just in case. | 476 | mDesc_[511] = '\0'; // just in case. |
486 | } | 477 | } |
478 | mDesc = mDesc_; | ||
487 | } | 479 | } |
488 | 480 | ||
489 | LLScriptLibraryFunction::~LLScriptLibraryFunction() | 481 | LLScriptLibraryFunction::~LLScriptLibraryFunction() |
@@ -507,7 +499,7 @@ void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func) | |||
507 | mNextNumber++; | 499 | mNextNumber++; |
508 | } | 500 | } |
509 | 501 | ||
510 | void LLScriptLibrary::assignExec(char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)) | 502 | void LLScriptLibrary::assignExec(const char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)) |
511 | { | 503 | { |
512 | S32 i; | 504 | S32 i; |
513 | for (i = 0; i < mNextNumber; i++) | 505 | for (i = 0; i < mNextNumber; i++) |
diff --git a/linden/indra/lscript/lscript_library/lscript_library.vcproj b/linden/indra/lscript/lscript_library/lscript_library.vcproj deleted file mode 100644 index 1a42773..0000000 --- a/linden/indra/lscript/lscript_library/lscript_library.vcproj +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="7.10" | ||
5 | Name="lscript_library" | ||
6 | ProjectGUID="{BFA102B0-C891-4E13-B1CF-C2F28073DA8E}" | ||
7 | Keyword="Win32Proj"> | ||
8 | <Platforms> | ||
9 | <Platform | ||
10 | Name="Win32"/> | ||
11 | </Platforms> | ||
12 | <Configurations> | ||
13 | <Configuration | ||
14 | Name="Debug|Win32" | ||
15 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
16 | IntermediateDirectory="Debug" | ||
17 | ConfigurationType="4" | ||
18 | CharacterSet="1"> | ||
19 | <Tool | ||
20 | Name="VCCLCompilerTool" | ||
21 | Optimization="0" | ||
22 | AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;"..\..\..\libraries\i686-win32";..\..\..\libraries\include" | ||
23 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;LL_DEBUG" | ||
24 | MinimalRebuild="TRUE" | ||
25 | BasicRuntimeChecks="3" | ||
26 | RuntimeLibrary="1" | ||
27 | StructMemberAlignment="4" | ||
28 | ForceConformanceInForLoopScope="TRUE" | ||
29 | UsePrecompiledHeader="0" | ||
30 | WarningLevel="3" | ||
31 | WarnAsError="TRUE" | ||
32 | Detect64BitPortabilityProblems="FALSE" | ||
33 | DebugInformationFormat="4"/> | ||
34 | <Tool | ||
35 | Name="VCCustomBuildTool"/> | ||
36 | <Tool | ||
37 | Name="VCLibrarianTool" | ||
38 | OutputFile="$(OutDir)/lscript_library.lib"/> | ||
39 | <Tool | ||
40 | Name="VCMIDLTool"/> | ||
41 | <Tool | ||
42 | Name="VCPostBuildEventTool"/> | ||
43 | <Tool | ||
44 | Name="VCPreBuildEventTool"/> | ||
45 | <Tool | ||
46 | Name="VCPreLinkEventTool"/> | ||
47 | <Tool | ||
48 | Name="VCResourceCompilerTool"/> | ||
49 | <Tool | ||
50 | Name="VCWebServiceProxyGeneratorTool"/> | ||
51 | <Tool | ||
52 | Name="VCXMLDataGeneratorTool"/> | ||
53 | <Tool | ||
54 | Name="VCManagedWrapperGeneratorTool"/> | ||
55 | <Tool | ||
56 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
57 | </Configuration> | ||
58 | <Configuration | ||
59 | Name="Release|Win32" | ||
60 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
61 | IntermediateDirectory="Release" | ||
62 | ConfigurationType="4" | ||
63 | CharacterSet="1"> | ||
64 | <Tool | ||
65 | Name="VCCLCompilerTool" | ||
66 | AdditionalOptions="/Oy-" | ||
67 | AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;"..\..\..\libraries\i686-win32";..\..\..\libraries\include" | ||
68 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" | ||
69 | RuntimeLibrary="0" | ||
70 | StructMemberAlignment="0" | ||
71 | ForceConformanceInForLoopScope="TRUE" | ||
72 | UsePrecompiledHeader="0" | ||
73 | WarningLevel="3" | ||
74 | WarnAsError="TRUE" | ||
75 | Detect64BitPortabilityProblems="FALSE" | ||
76 | DebugInformationFormat="3"/> | ||
77 | <Tool | ||
78 | Name="VCCustomBuildTool"/> | ||
79 | <Tool | ||
80 | Name="VCLibrarianTool" | ||
81 | OutputFile="$(OutDir)/lscript_library.lib"/> | ||
82 | <Tool | ||
83 | Name="VCMIDLTool"/> | ||
84 | <Tool | ||
85 | Name="VCPostBuildEventTool"/> | ||
86 | <Tool | ||
87 | Name="VCPreBuildEventTool"/> | ||
88 | <Tool | ||
89 | Name="VCPreLinkEventTool"/> | ||
90 | <Tool | ||
91 | Name="VCResourceCompilerTool"/> | ||
92 | <Tool | ||
93 | Name="VCWebServiceProxyGeneratorTool"/> | ||
94 | <Tool | ||
95 | Name="VCXMLDataGeneratorTool"/> | ||
96 | <Tool | ||
97 | Name="VCManagedWrapperGeneratorTool"/> | ||
98 | <Tool | ||
99 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
100 | </Configuration> | ||
101 | <Configuration | ||
102 | Name="ReleaseNoOpt|Win32" | ||
103 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
104 | IntermediateDirectory="$(ConfigurationName)" | ||
105 | ConfigurationType="4" | ||
106 | CharacterSet="1"> | ||
107 | <Tool | ||
108 | Name="VCCLCompilerTool" | ||
109 | AdditionalOptions="/Oy-" | ||
110 | Optimization="0" | ||
111 | AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;"..\..\..\libraries\i686-win32";..\..\..\libraries\include" | ||
112 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;LL_RELEASE" | ||
113 | RuntimeLibrary="0" | ||
114 | StructMemberAlignment="0" | ||
115 | ForceConformanceInForLoopScope="TRUE" | ||
116 | UsePrecompiledHeader="0" | ||
117 | WarningLevel="3" | ||
118 | WarnAsError="TRUE" | ||
119 | Detect64BitPortabilityProblems="FALSE" | ||
120 | DebugInformationFormat="3"/> | ||
121 | <Tool | ||
122 | Name="VCCustomBuildTool"/> | ||
123 | <Tool | ||
124 | Name="VCLibrarianTool" | ||
125 | OutputFile="$(OutDir)/lscript_library.lib"/> | ||
126 | <Tool | ||
127 | Name="VCMIDLTool"/> | ||
128 | <Tool | ||
129 | Name="VCPostBuildEventTool"/> | ||
130 | <Tool | ||
131 | Name="VCPreBuildEventTool"/> | ||
132 | <Tool | ||
133 | Name="VCPreLinkEventTool"/> | ||
134 | <Tool | ||
135 | Name="VCResourceCompilerTool"/> | ||
136 | <Tool | ||
137 | Name="VCWebServiceProxyGeneratorTool"/> | ||
138 | <Tool | ||
139 | Name="VCXMLDataGeneratorTool"/> | ||
140 | <Tool | ||
141 | Name="VCManagedWrapperGeneratorTool"/> | ||
142 | <Tool | ||
143 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
144 | </Configuration> | ||
145 | </Configurations> | ||
146 | <References> | ||
147 | </References> | ||
148 | <Files> | ||
149 | <Filter | ||
150 | Name="Source Files" | ||
151 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
152 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> | ||
153 | <File | ||
154 | RelativePath=".\lscript_alloc.cpp"> | ||
155 | </File> | ||
156 | <File | ||
157 | RelativePath=".\lscript_export.cpp"> | ||
158 | </File> | ||
159 | <File | ||
160 | RelativePath=".\lscript_library.cpp"> | ||
161 | </File> | ||
162 | </Filter> | ||
163 | <Filter | ||
164 | Name="Header Files" | ||
165 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
166 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> | ||
167 | <File | ||
168 | RelativePath="..\lscript_alloc.h"> | ||
169 | </File> | ||
170 | <File | ||
171 | RelativePath="..\lscript_export.h"> | ||
172 | </File> | ||
173 | <File | ||
174 | RelativePath="..\lscript_library.h"> | ||
175 | </File> | ||
176 | </Filter> | ||
177 | <Filter | ||
178 | Name="Resource Files" | ||
179 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
180 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> | ||
181 | </Filter> | ||
182 | </Files> | ||
183 | <Globals> | ||
184 | </Globals> | ||
185 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_library/lscript_library_vc8.vcproj b/linden/indra/lscript/lscript_library/lscript_library_vc8.vcproj deleted file mode 100644 index 38a951b..0000000 --- a/linden/indra/lscript/lscript_library/lscript_library_vc8.vcproj +++ /dev/null | |||
@@ -1,271 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="8.00" | ||
5 | Name="lscript_library" | ||
6 | ProjectGUID="{BFA102B0-C891-4E13-B1CF-C2F28073DA8E}" | ||
7 | RootNamespace="lscript_library" | ||
8 | Keyword="Win32Proj" | ||
9 | > | ||
10 | <Platforms> | ||
11 | <Platform | ||
12 | Name="Win32" | ||
13 | /> | ||
14 | </Platforms> | ||
15 | <ToolFiles> | ||
16 | </ToolFiles> | ||
17 | <Configurations> | ||
18 | <Configuration | ||
19 | Name="Debug|Win32" | ||
20 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
21 | IntermediateDirectory="Debug" | ||
22 | ConfigurationType="4" | ||
23 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
24 | CharacterSet="1" | ||
25 | > | ||
26 | <Tool | ||
27 | Name="VCPreBuildEventTool" | ||
28 | /> | ||
29 | <Tool | ||
30 | Name="VCCustomBuildTool" | ||
31 | /> | ||
32 | <Tool | ||
33 | Name="VCXMLDataGeneratorTool" | ||
34 | /> | ||
35 | <Tool | ||
36 | Name="VCWebServiceProxyGeneratorTool" | ||
37 | /> | ||
38 | <Tool | ||
39 | Name="VCMIDLTool" | ||
40 | /> | ||
41 | <Tool | ||
42 | Name="VCCLCompilerTool" | ||
43 | Optimization="0" | ||
44 | AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;"..\..\..\libraries\i686-win32";..\..\..\libraries\include" | ||
45 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG" | ||
46 | MinimalRebuild="true" | ||
47 | BasicRuntimeChecks="3" | ||
48 | RuntimeLibrary="1" | ||
49 | StructMemberAlignment="4" | ||
50 | TreatWChar_tAsBuiltInType="false" | ||
51 | ForceConformanceInForLoopScope="true" | ||
52 | UsePrecompiledHeader="0" | ||
53 | WarningLevel="3" | ||
54 | WarnAsError="true" | ||
55 | Detect64BitPortabilityProblems="false" | ||
56 | DebugInformationFormat="4" | ||
57 | /> | ||
58 | <Tool | ||
59 | Name="VCManagedResourceCompilerTool" | ||
60 | /> | ||
61 | <Tool | ||
62 | Name="VCResourceCompilerTool" | ||
63 | /> | ||
64 | <Tool | ||
65 | Name="VCPreLinkEventTool" | ||
66 | /> | ||
67 | <Tool | ||
68 | Name="VCLibrarianTool" | ||
69 | OutputFile="$(OutDir)/lscript_library.lib" | ||
70 | /> | ||
71 | <Tool | ||
72 | Name="VCALinkTool" | ||
73 | /> | ||
74 | <Tool | ||
75 | Name="VCXDCMakeTool" | ||
76 | /> | ||
77 | <Tool | ||
78 | Name="VCBscMakeTool" | ||
79 | /> | ||
80 | <Tool | ||
81 | Name="VCFxCopTool" | ||
82 | /> | ||
83 | <Tool | ||
84 | Name="VCPostBuildEventTool" | ||
85 | /> | ||
86 | </Configuration> | ||
87 | <Configuration | ||
88 | Name="Release|Win32" | ||
89 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
90 | IntermediateDirectory="Release" | ||
91 | ConfigurationType="4" | ||
92 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
93 | CharacterSet="1" | ||
94 | > | ||
95 | <Tool | ||
96 | Name="VCPreBuildEventTool" | ||
97 | /> | ||
98 | <Tool | ||
99 | Name="VCCustomBuildTool" | ||
100 | /> | ||
101 | <Tool | ||
102 | Name="VCXMLDataGeneratorTool" | ||
103 | /> | ||
104 | <Tool | ||
105 | Name="VCWebServiceProxyGeneratorTool" | ||
106 | /> | ||
107 | <Tool | ||
108 | Name="VCMIDLTool" | ||
109 | /> | ||
110 | <Tool | ||
111 | Name="VCCLCompilerTool" | ||
112 | AdditionalOptions="/Oy-" | ||
113 | AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;"..\..\..\libraries\i686-win32";..\..\..\libraries\include" | ||
114 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
115 | RuntimeLibrary="0" | ||
116 | StructMemberAlignment="0" | ||
117 | TreatWChar_tAsBuiltInType="false" | ||
118 | ForceConformanceInForLoopScope="true" | ||
119 | UsePrecompiledHeader="0" | ||
120 | WarningLevel="3" | ||
121 | WarnAsError="true" | ||
122 | Detect64BitPortabilityProblems="false" | ||
123 | DebugInformationFormat="3" | ||
124 | /> | ||
125 | <Tool | ||
126 | Name="VCManagedResourceCompilerTool" | ||
127 | /> | ||
128 | <Tool | ||
129 | Name="VCResourceCompilerTool" | ||
130 | /> | ||
131 | <Tool | ||
132 | Name="VCPreLinkEventTool" | ||
133 | /> | ||
134 | <Tool | ||
135 | Name="VCLibrarianTool" | ||
136 | OutputFile="$(OutDir)/lscript_library.lib" | ||
137 | /> | ||
138 | <Tool | ||
139 | Name="VCALinkTool" | ||
140 | /> | ||
141 | <Tool | ||
142 | Name="VCXDCMakeTool" | ||
143 | /> | ||
144 | <Tool | ||
145 | Name="VCBscMakeTool" | ||
146 | /> | ||
147 | <Tool | ||
148 | Name="VCFxCopTool" | ||
149 | /> | ||
150 | <Tool | ||
151 | Name="VCPostBuildEventTool" | ||
152 | /> | ||
153 | </Configuration> | ||
154 | <Configuration | ||
155 | Name="ReleaseNoOpt|Win32" | ||
156 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
157 | IntermediateDirectory="$(ConfigurationName)" | ||
158 | ConfigurationType="4" | ||
159 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
160 | CharacterSet="1" | ||
161 | > | ||
162 | <Tool | ||
163 | Name="VCPreBuildEventTool" | ||
164 | /> | ||
165 | <Tool | ||
166 | Name="VCCustomBuildTool" | ||
167 | /> | ||
168 | <Tool | ||
169 | Name="VCXMLDataGeneratorTool" | ||
170 | /> | ||
171 | <Tool | ||
172 | Name="VCWebServiceProxyGeneratorTool" | ||
173 | /> | ||
174 | <Tool | ||
175 | Name="VCMIDLTool" | ||
176 | /> | ||
177 | <Tool | ||
178 | Name="VCCLCompilerTool" | ||
179 | AdditionalOptions="/Oy-" | ||
180 | Optimization="0" | ||
181 | AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;"..\..\..\libraries\i686-win32";..\..\..\libraries\include" | ||
182 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
183 | RuntimeLibrary="0" | ||
184 | StructMemberAlignment="0" | ||
185 | TreatWChar_tAsBuiltInType="false" | ||
186 | ForceConformanceInForLoopScope="true" | ||
187 | UsePrecompiledHeader="0" | ||
188 | WarningLevel="3" | ||
189 | WarnAsError="true" | ||
190 | Detect64BitPortabilityProblems="false" | ||
191 | DebugInformationFormat="3" | ||
192 | /> | ||
193 | <Tool | ||
194 | Name="VCManagedResourceCompilerTool" | ||
195 | /> | ||
196 | <Tool | ||
197 | Name="VCResourceCompilerTool" | ||
198 | /> | ||
199 | <Tool | ||
200 | Name="VCPreLinkEventTool" | ||
201 | /> | ||
202 | <Tool | ||
203 | Name="VCLibrarianTool" | ||
204 | OutputFile="$(OutDir)/lscript_library.lib" | ||
205 | /> | ||
206 | <Tool | ||
207 | Name="VCALinkTool" | ||
208 | /> | ||
209 | <Tool | ||
210 | Name="VCXDCMakeTool" | ||
211 | /> | ||
212 | <Tool | ||
213 | Name="VCBscMakeTool" | ||
214 | /> | ||
215 | <Tool | ||
216 | Name="VCFxCopTool" | ||
217 | /> | ||
218 | <Tool | ||
219 | Name="VCPostBuildEventTool" | ||
220 | /> | ||
221 | </Configuration> | ||
222 | </Configurations> | ||
223 | <References> | ||
224 | </References> | ||
225 | <Files> | ||
226 | <Filter | ||
227 | Name="Source Files" | ||
228 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
229 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
230 | > | ||
231 | <File | ||
232 | RelativePath=".\lscript_alloc.cpp" | ||
233 | > | ||
234 | </File> | ||
235 | <File | ||
236 | RelativePath=".\lscript_export.cpp" | ||
237 | > | ||
238 | </File> | ||
239 | <File | ||
240 | RelativePath=".\lscript_library.cpp" | ||
241 | > | ||
242 | </File> | ||
243 | </Filter> | ||
244 | <Filter | ||
245 | Name="Header Files" | ||
246 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
247 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
248 | > | ||
249 | <File | ||
250 | RelativePath="..\lscript_alloc.h" | ||
251 | > | ||
252 | </File> | ||
253 | <File | ||
254 | RelativePath="..\lscript_export.h" | ||
255 | > | ||
256 | </File> | ||
257 | <File | ||
258 | RelativePath="..\lscript_library.h" | ||
259 | > | ||
260 | </File> | ||
261 | </Filter> | ||
262 | <Filter | ||
263 | Name="Resource Files" | ||
264 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
265 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
266 | > | ||
267 | </Filter> | ||
268 | </Files> | ||
269 | <Globals> | ||
270 | </Globals> | ||
271 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_library/lscript_library_vc9.vcproj b/linden/indra/lscript/lscript_library/lscript_library_vc9.vcproj deleted file mode 100644 index 63ffbac..0000000 --- a/linden/indra/lscript/lscript_library/lscript_library_vc9.vcproj +++ /dev/null | |||
@@ -1,272 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="9.00" | ||
5 | Name="lscript_library" | ||
6 | ProjectGUID="{BFA102B0-C891-4E13-B1CF-C2F28073DA8E}" | ||
7 | RootNamespace="lscript_library" | ||
8 | Keyword="Win32Proj" | ||
9 | TargetFrameworkVersion="131072" | ||
10 | > | ||
11 | <Platforms> | ||
12 | <Platform | ||
13 | Name="Win32" | ||
14 | /> | ||
15 | </Platforms> | ||
16 | <ToolFiles> | ||
17 | </ToolFiles> | ||
18 | <Configurations> | ||
19 | <Configuration | ||
20 | Name="Debug|Win32" | ||
21 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
22 | IntermediateDirectory="Debug" | ||
23 | ConfigurationType="4" | ||
24 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
25 | CharacterSet="1" | ||
26 | > | ||
27 | <Tool | ||
28 | Name="VCPreBuildEventTool" | ||
29 | /> | ||
30 | <Tool | ||
31 | Name="VCCustomBuildTool" | ||
32 | /> | ||
33 | <Tool | ||
34 | Name="VCXMLDataGeneratorTool" | ||
35 | /> | ||
36 | <Tool | ||
37 | Name="VCWebServiceProxyGeneratorTool" | ||
38 | /> | ||
39 | <Tool | ||
40 | Name="VCMIDLTool" | ||
41 | /> | ||
42 | <Tool | ||
43 | Name="VCCLCompilerTool" | ||
44 | Optimization="0" | ||
45 | AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;"..\..\..\libraries\i686-win32";..\..\..\libraries\include" | ||
46 | PreprocessorDefinitions="WIN32;_DEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_DEBUG" | ||
47 | MinimalRebuild="true" | ||
48 | BasicRuntimeChecks="3" | ||
49 | RuntimeLibrary="1" | ||
50 | StructMemberAlignment="4" | ||
51 | TreatWChar_tAsBuiltInType="false" | ||
52 | ForceConformanceInForLoopScope="true" | ||
53 | UsePrecompiledHeader="0" | ||
54 | WarningLevel="3" | ||
55 | WarnAsError="true" | ||
56 | Detect64BitPortabilityProblems="false" | ||
57 | DebugInformationFormat="4" | ||
58 | /> | ||
59 | <Tool | ||
60 | Name="VCManagedResourceCompilerTool" | ||
61 | /> | ||
62 | <Tool | ||
63 | Name="VCResourceCompilerTool" | ||
64 | /> | ||
65 | <Tool | ||
66 | Name="VCPreLinkEventTool" | ||
67 | /> | ||
68 | <Tool | ||
69 | Name="VCLibrarianTool" | ||
70 | OutputFile="$(OutDir)/lscript_library.lib" | ||
71 | /> | ||
72 | <Tool | ||
73 | Name="VCALinkTool" | ||
74 | /> | ||
75 | <Tool | ||
76 | Name="VCXDCMakeTool" | ||
77 | /> | ||
78 | <Tool | ||
79 | Name="VCBscMakeTool" | ||
80 | /> | ||
81 | <Tool | ||
82 | Name="VCFxCopTool" | ||
83 | /> | ||
84 | <Tool | ||
85 | Name="VCPostBuildEventTool" | ||
86 | /> | ||
87 | </Configuration> | ||
88 | <Configuration | ||
89 | Name="Release|Win32" | ||
90 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
91 | IntermediateDirectory="Release" | ||
92 | ConfigurationType="4" | ||
93 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
94 | CharacterSet="1" | ||
95 | > | ||
96 | <Tool | ||
97 | Name="VCPreBuildEventTool" | ||
98 | /> | ||
99 | <Tool | ||
100 | Name="VCCustomBuildTool" | ||
101 | /> | ||
102 | <Tool | ||
103 | Name="VCXMLDataGeneratorTool" | ||
104 | /> | ||
105 | <Tool | ||
106 | Name="VCWebServiceProxyGeneratorTool" | ||
107 | /> | ||
108 | <Tool | ||
109 | Name="VCMIDLTool" | ||
110 | /> | ||
111 | <Tool | ||
112 | Name="VCCLCompilerTool" | ||
113 | AdditionalOptions="/Oy-" | ||
114 | AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;"..\..\..\libraries\i686-win32";..\..\..\libraries\include" | ||
115 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
116 | RuntimeLibrary="0" | ||
117 | StructMemberAlignment="0" | ||
118 | TreatWChar_tAsBuiltInType="false" | ||
119 | ForceConformanceInForLoopScope="true" | ||
120 | UsePrecompiledHeader="0" | ||
121 | WarningLevel="3" | ||
122 | WarnAsError="true" | ||
123 | Detect64BitPortabilityProblems="false" | ||
124 | DebugInformationFormat="3" | ||
125 | /> | ||
126 | <Tool | ||
127 | Name="VCManagedResourceCompilerTool" | ||
128 | /> | ||
129 | <Tool | ||
130 | Name="VCResourceCompilerTool" | ||
131 | /> | ||
132 | <Tool | ||
133 | Name="VCPreLinkEventTool" | ||
134 | /> | ||
135 | <Tool | ||
136 | Name="VCLibrarianTool" | ||
137 | OutputFile="$(OutDir)/lscript_library.lib" | ||
138 | /> | ||
139 | <Tool | ||
140 | Name="VCALinkTool" | ||
141 | /> | ||
142 | <Tool | ||
143 | Name="VCXDCMakeTool" | ||
144 | /> | ||
145 | <Tool | ||
146 | Name="VCBscMakeTool" | ||
147 | /> | ||
148 | <Tool | ||
149 | Name="VCFxCopTool" | ||
150 | /> | ||
151 | <Tool | ||
152 | Name="VCPostBuildEventTool" | ||
153 | /> | ||
154 | </Configuration> | ||
155 | <Configuration | ||
156 | Name="ReleaseNoOpt|Win32" | ||
157 | OutputDirectory="../../lib_$(ConfigurationName)/i686-win32" | ||
158 | IntermediateDirectory="$(ConfigurationName)" | ||
159 | ConfigurationType="4" | ||
160 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
161 | CharacterSet="1" | ||
162 | > | ||
163 | <Tool | ||
164 | Name="VCPreBuildEventTool" | ||
165 | /> | ||
166 | <Tool | ||
167 | Name="VCCustomBuildTool" | ||
168 | /> | ||
169 | <Tool | ||
170 | Name="VCXMLDataGeneratorTool" | ||
171 | /> | ||
172 | <Tool | ||
173 | Name="VCWebServiceProxyGeneratorTool" | ||
174 | /> | ||
175 | <Tool | ||
176 | Name="VCMIDLTool" | ||
177 | /> | ||
178 | <Tool | ||
179 | Name="VCCLCompilerTool" | ||
180 | AdditionalOptions="/Oy-" | ||
181 | Optimization="0" | ||
182 | AdditionalIncludeDirectories="..\;..\..\llmath;..\..\llcommon;"..\..\..\libraries\i686-win32";..\..\..\libraries\include" | ||
183 | PreprocessorDefinitions="WIN32;NDEBUG;_LIB;LL_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T;LL_RELEASE" | ||
184 | RuntimeLibrary="0" | ||
185 | StructMemberAlignment="0" | ||
186 | TreatWChar_tAsBuiltInType="false" | ||
187 | ForceConformanceInForLoopScope="true" | ||
188 | UsePrecompiledHeader="0" | ||
189 | WarningLevel="3" | ||
190 | WarnAsError="true" | ||
191 | Detect64BitPortabilityProblems="false" | ||
192 | DebugInformationFormat="3" | ||
193 | /> | ||
194 | <Tool | ||
195 | Name="VCManagedResourceCompilerTool" | ||
196 | /> | ||
197 | <Tool | ||
198 | Name="VCResourceCompilerTool" | ||
199 | /> | ||
200 | <Tool | ||
201 | Name="VCPreLinkEventTool" | ||
202 | /> | ||
203 | <Tool | ||
204 | Name="VCLibrarianTool" | ||
205 | OutputFile="$(OutDir)/lscript_library.lib" | ||
206 | /> | ||
207 | <Tool | ||
208 | Name="VCALinkTool" | ||
209 | /> | ||
210 | <Tool | ||
211 | Name="VCXDCMakeTool" | ||
212 | /> | ||
213 | <Tool | ||
214 | Name="VCBscMakeTool" | ||
215 | /> | ||
216 | <Tool | ||
217 | Name="VCFxCopTool" | ||
218 | /> | ||
219 | <Tool | ||
220 | Name="VCPostBuildEventTool" | ||
221 | /> | ||
222 | </Configuration> | ||
223 | </Configurations> | ||
224 | <References> | ||
225 | </References> | ||
226 | <Files> | ||
227 | <Filter | ||
228 | Name="Source Files" | ||
229 | Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
230 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
231 | > | ||
232 | <File | ||
233 | RelativePath=".\lscript_alloc.cpp" | ||
234 | > | ||
235 | </File> | ||
236 | <File | ||
237 | RelativePath=".\lscript_export.cpp" | ||
238 | > | ||
239 | </File> | ||
240 | <File | ||
241 | RelativePath=".\lscript_library.cpp" | ||
242 | > | ||
243 | </File> | ||
244 | </Filter> | ||
245 | <Filter | ||
246 | Name="Header Files" | ||
247 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
248 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
249 | > | ||
250 | <File | ||
251 | RelativePath="..\lscript_alloc.h" | ||
252 | > | ||
253 | </File> | ||
254 | <File | ||
255 | RelativePath="..\lscript_export.h" | ||
256 | > | ||
257 | </File> | ||
258 | <File | ||
259 | RelativePath="..\lscript_library.h" | ||
260 | > | ||
261 | </File> | ||
262 | </Filter> | ||
263 | <Filter | ||
264 | Name="Resource Files" | ||
265 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | ||
266 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
267 | > | ||
268 | </Filter> | ||
269 | </Files> | ||
270 | <Globals> | ||
271 | </Globals> | ||
272 | </VisualStudioProject> | ||
diff --git a/linden/indra/lscript/lscript_rt_interface.h b/linden/indra/lscript/lscript_rt_interface.h index ec474a0..32545ca 100644 --- a/linden/indra/lscript/lscript_rt_interface.h +++ b/linden/indra/lscript/lscript_rt_interface.h | |||
@@ -32,10 +32,10 @@ | |||
32 | #ifndef LL_LSCRIPT_RT_INTERFACE_H | 32 | #ifndef LL_LSCRIPT_RT_INTERFACE_H |
33 | #define LL_LSCRIPT_RT_INTERFACE_H | 33 | #define LL_LSCRIPT_RT_INTERFACE_H |
34 | 34 | ||
35 | BOOL lscript_compile(char *filename, BOOL is_god_like = FALSE); | 35 | BOOL lscript_compile(char *filename, BOOL compile_to_mono, BOOL is_god_like = FALSE); |
36 | BOOL lscript_compile(const char* src_filename, const char* dst_filename, | 36 | BOOL lscript_compile(const char* src_filename, const char* dst_filename, |
37 | const char* err_filename, BOOL is_god_like = FALSE); | 37 | const char* err_filename, BOOL compile_to_mono, const char* class_name, BOOL is_god_like = FALSE); |
38 | void lscript_run(char *filename, BOOL b_debug); | 38 | void lscript_run(const std::string& filename, BOOL b_debug); |
39 | 39 | ||
40 | 40 | ||
41 | #endif | 41 | #endif |