svn merge -r93014:93396 svn+ssh://svn.lindenlab.com/svn/linden/branches/mono-r93014-qar633 dataserver-is-deprecated

master
Dave Hiller 2008-07-31 12:15:15 +00:00
parent f0f2a41691
commit 9a7d68cfce
52 changed files with 3588 additions and 1121 deletions

View File

@ -449,6 +449,14 @@
<key>trusted-sender</key>
<boolean>false</boolean>
</map>
<key>LandStatReply</key>
<map>
<key>flavor</key>
<string>llsd</string>
<key>trusted-sender</key>
<boolean>false</boolean>
</map>
<key>StartGroupProposal</key>
<map>
@ -493,7 +501,7 @@
<boolean>false</boolean>
<key>UpdateScriptAgentInventory</key>
<boolean>true</boolean>
<boolean>false</boolean>
<key>UpdateGestureTaskInventory</key>
<boolean>false</boolean>
@ -502,7 +510,7 @@
<boolean>true</boolean>
<key>UpdateScriptTaskInventory</key>
<boolean>true</boolean>
<boolean>false</boolean>
<key>ViewerStartAuction</key>
<boolean>true</boolean>

View File

@ -17,6 +17,7 @@ set(cmake_SOURCE_FILES
CURL.cmake
CMakeCopyIfDifferent.cmake
CopyWinLibs.cmake
CSharpMacros.cmake
DirectX.cmake
ELFIO.cmake
EXPAT.cmake
@ -25,6 +26,7 @@ set(cmake_SOURCE_FILES
FindCARes.cmake
FindELFIO.cmake
FindGooglePerfTools.cmake
FindMono.cmake
FindMySQL.cmake
FindOpenJPEG.cmake
FindXmlRpcEpi.cmake
@ -55,6 +57,7 @@ set(cmake_SOURCE_FILES
LLXML.cmake
LScript.cmake
Linking.cmake
MonoEmbed.cmake
Mozlib.cmake
MySQL.cmake
NDOF.cmake

View File

@ -0,0 +1,142 @@
# - This is a support module for easy Mono/C# handling with CMake
# It defines the following macros:
#
# ADD_CS_LIBRARY (<target> <source>)
# ADD_CS_EXECUTABLE (<target> <source>)
# INSTALL_GAC (<target>)
#
# Note that the order of the arguments is important.
#
# You can optionally set the variable CS_FLAGS to tell the macros whether
# to pass additional flags to the compiler. This is particularly useful to
# set assembly references, unsafe code, etc... These flags are always reset
# after the target was added so you don't have to care about that.
#
# copyright (c) 2007 Arno Rehn arno@arnorehn.de
#
# Redistribution and use is allowed according to the terms of the GPL license.
# ----- support macros -----
MACRO(GET_CS_LIBRARY_TARGET_DIR)
IF (NOT LIBRARY_OUTPUT_PATH)
SET(CS_LIBRARY_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR})
ELSE (NOT LIBRARY_OUTPUT_PATH)
SET(CS_LIBRARY_TARGET_DIR ${LIBRARY_OUTPUT_PATH})
ENDIF (NOT LIBRARY_OUTPUT_PATH)
ENDMACRO(GET_CS_LIBRARY_TARGET_DIR)
MACRO(GET_CS_EXECUTABLE_TARGET_DIR)
IF (NOT EXECUTABLE_OUTPUT_PATH)
SET(CS_EXECUTABLE_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR})
ELSE (NOT EXECUTABLE_OUTPUT_PATH)
SET(CS_EXECUTABLE_TARGET_DIR ${EXECUTABLE_OUTPUT_PATH})
ENDIF (NOT EXECUTABLE_OUTPUT_PATH)
ENDMACRO(GET_CS_EXECUTABLE_TARGET_DIR)
MACRO(MAKE_PROPER_FILE_LIST)
FOREACH(file ${ARGN})
# first assume it's a relative path
FILE(GLOB globbed ${CMAKE_CURRENT_SOURCE_DIR}/${file})
IF(globbed)
FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${file} native)
ELSE(globbed)
FILE(TO_NATIVE_PATH ${file} native)
ENDIF(globbed)
SET(proper_file_list ${proper_file_list} ${native})
SET(native "")
ENDFOREACH(file)
ENDMACRO(MAKE_PROPER_FILE_LIST)
# ----- end support macros -----
MACRO(ADD_CS_LIBRARY target)
GET_CS_LIBRARY_TARGET_DIR()
SET(target_DLL "${CS_LIBRARY_TARGET_DIR}/${target}.dll")
MAKE_PROPER_FILE_LIST(${ARGN})
FILE(RELATIVE_PATH relative_path ${CMAKE_BINARY_DIR} ${target_DLL})
SET(target_KEY "${CMAKE_CURRENT_SOURCE_DIR}/${target}.key")
SET(target_CS_FLAGS "${CS_FLAGS}")
IF(${target}_CS_FLAGS)
LIST(APPEND target_CS_FLAGS ${${target}_CS_FLAGS})
ENDIF(${target}_CS_FLAGS)
IF(EXISTS ${target_KEY})
LIST(APPEND target_CS_FLAGS -keyfile:${target_KEY})
ENDIF(EXISTS ${target_KEY})
FOREACH(ref ${${target}_REFS})
SET(ref_DLL ${CMAKE_CURRENT_BINARY_DIR}/${ref}.dll)
IF(EXISTS ${ref_DLL})
LIST(APPEND target_CS_FLAGS -r:${ref_DLL})
ELSE(EXISTS ${ref_DLL})
LIST(APPEND target_CS_FLAGS -r:${ref})
ENDIF(EXISTS ${ref_DLL})
ENDFOREACH(ref ${${target}_REFS})
ADD_CUSTOM_COMMAND (OUTPUT ${target_DLL}
COMMAND ${MCS_EXECUTABLE} ${target_CS_FLAGS} -out:${target_DLL} -target:library ${proper_file_list}
MAIN_DEPENDENCY ${proper_file_list}
DEPENDS ${ARGN}
COMMENT "Building ${relative_path}")
ADD_CUSTOM_TARGET (${target} ALL DEPENDS ${target_DLL})
FOREACH(ref ${${target}_REFS})
GET_TARGET_PROPERTY(is_target ${ref} TYPE)
IF(is_target)
ADD_DEPENDENCIES(${target} ${ref})
ENDIF(is_target)
ENDFOREACH(ref ${${target}_REFS})
SET(relative_path "")
SET(proper_file_list "")
ENDMACRO(ADD_CS_LIBRARY)
MACRO(ADD_CS_EXECUTABLE target)
GET_CS_EXECUTABLE_TARGET_DIR()
# Seems like cmake doesn't like the ".exe" ending for custom commands.
# If we call it ${target}.exe, 'make' will later complain about a missing rule.
# Create a fake target instead.
SET(target_EXE "${CS_EXECUTABLE_TARGET_DIR}/${target}.exe")
SET(target_TOUCH "${CS_EXECUTABLE_TARGET_DIR}/${target}.exe-built")
GET_DIRECTORY_PROPERTY(clean ADDITIONAL_MAKE_CLEAN_FILES)
LIST(APPEND clean ${target}.exe)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${clean}")
MAKE_PROPER_FILE_LIST(${ARGN})
FILE(RELATIVE_PATH relative_path ${CMAKE_BINARY_DIR} ${target_EXE})
SET(target_CS_FLAGS "${CS_FLAGS}")
FOREACH(ref ${${target}_REFS})
SET(ref_DLL ${CMAKE_CURRENT_SOURCE_DIR}/${ref}.dll)
IF(EXISTS ${ref_DLL})
LIST(APPEND target_CS_FLAGS -r:${ref_DLL})
ELSE(EXISTS ${ref_DLL})
LIST(APPEND target_CS_FLAGS -r:${ref})
ENDIF(EXISTS ${ref_DLL})
ENDFOREACH(ref ${${target}_REFS})
ADD_CUSTOM_COMMAND (OUTPUT "${target_TOUCH}"
COMMAND ${MCS_EXECUTABLE} ${target_CS_FLAGS} -out:${target_EXE} ${proper_file_list}
COMMAND ${CMAKE_COMMAND} -E touch ${target_TOUCH}
MAIN_DEPENDENCY ${ARGN}
DEPENDS ${ARGN}
COMMENT "Building ${relative_path}")
ADD_CUSTOM_TARGET ("${target}" ALL DEPENDS "${target_TOUCH}")
FOREACH(ref ${${target}_REFS})
GET_TARGET_PROPERTY(is_target ${ref} TYPE)
IF(is_target)
ADD_DEPENDENCIES(${target} ${ref})
ENDIF(is_target)
ENDFOREACH(ref ${${target}_REFS})
SET(relative_path "")
SET(proper_file_list "")
ENDMACRO(ADD_CS_EXECUTABLE)
MACRO(INSTALL_GAC target)
GET_CS_LIBRARY_TARGET_DIR()
INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${GACUTIL_EXECUTABLE} -i ${CS_LIBRARY_TARGET_DIR}/${target}.dll -package 2.0)")
ENDMACRO(INSTALL_GAC target)

View File

@ -0,0 +1,16 @@
# -*- cmake -*-
# Copies a binary back to the source directory
MACRO(COPY_BACK_TO_SOURCE target)
GET_TARGET_PROPERTY(FROM ${target} LOCATION)
SET(TO ${CMAKE_CURRENT_SOURCE_DIR})
#MESSAGE("TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO}")
ADD_CUSTOM_COMMAND(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${FROM} ${TO}
DEPENDS ${FROM}
COMMENT "Copying ${target} to ${CMAKE_CURRENT_BINARY_DIR}"
)
ENDMACRO(COPY_BACK_TO_SOURCE)

View File

@ -0,0 +1,68 @@
# - Try to find the mono, mcs, gmcs and gacutil
#
# defines
#
# MONO_FOUND - system has mono, mcs, gmcs and gacutil
# MONO_PATH - where to find 'mono'
# MCS_PATH - where to find 'mcs'
# GMCS_PATH - where to find 'gmcs'
# GACUTIL_PATH - where to find 'gacutil'
#
# copyright (c) 2007 Arno Rehn arno@arnorehn.de
#
# Redistribution and use is allowed according to the terms of the GPL license.
# Removed the check for gmcs
FIND_PROGRAM (MONO_EXECUTABLE mono
"C:/Program Files/Mono-1.9.1/bin"
"C:/Program Files/Mono-1.2.6/bin"
/bin
/usr/bin
/usr/local/bin
)
FIND_PROGRAM (MCS_EXECUTABLE mcs
"C:/Program Files/Mono-1.9.1/bin"
"C:/Program Files/Mono-1.2.6/bin"
/bin
/usr/bin
/usr/local/bin
)
FIND_PROGRAM (GMCS_EXECUTABLE gmcs
"C:/Program Files/Mono-1.9.1/bin"
"C:/Program Files/Mono-1.2.6/bin"
/bin
/usr/bin
/usr/local/bin
)
FIND_PROGRAM (GACUTIL_EXECUTABLE gacutil
"C:/Program Files/Mono-1.9.1/bin"
"C:/Program Files/Mono-1.2.6/bin"
/bin
/usr/bin
/usr/local/bin
)
FIND_PROGRAM (ILASM_EXECUTABLE
ilasm
NO_DEFAULT_PATH
PATHS "C:/Program Files/Mono-1.9.1/bin" "C:/Apps/Mono-1.2.6/bin" "C:/Program Files/Mono-1.2.6/bin" /bin /usr/bin /usr/local/bin
)
SET (MONO_FOUND FALSE)
IF (MONO_EXECUTABLE AND MCS_EXECUTABLE AND GACUTIL_EXECUTABLE)
SET (MONO_FOUND TRUE)
ENDIF (MONO_EXECUTABLE AND MCS_EXECUTABLE AND GACUTIL_EXECUTABLE)
IF (MONO_FOUND)
IF (NOT Mono_FIND_QUIETLY)
MESSAGE(STATUS "Found mono: ${MONO_EXECUTABLE}")
MESSAGE(STATUS "Found mcs: ${MCS_EXECUTABLE}")
MESSAGE(STATUS "Found gacutil: ${GACUTIL_EXECUTABLE}")
ENDIF (NOT Mono_FIND_QUIETLY)
ELSE (MONO_FOUND)
IF (Mono_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find one or more of the following programs: mono, mcs, gacutil")
ENDIF (Mono_FIND_REQUIRED)
ENDIF (MONO_FOUND)
MARK_AS_ADVANCED(MONO_EXECUTABLE MCS_EXECUTABLE GACUTIL_EXECUTABLE)

View File

@ -3,11 +3,14 @@
set(LSCRIPT_INCLUDE_DIRS
${LIBS_OPEN_DIR}/lscript
${LIBS_OPEN_DIR}/lscript/lscript_compile
${LIBS_OPEN_DIR}/lscript/lscript_execute
${LIBS_OPEN_DIR}/lscript/lscript_execute
${LIBS_OPEN_DIR}/lscript/lscript_execute_mono
)
set(LSCRIPT_LIBRARIES
lscript_compile
lscript_execute
lscript_execute
lscript_library
)
set(LSCRIPT_EXECUTE_MONO_LIBRARIES lscript_execute_mono)

View File

@ -0,0 +1,48 @@
# -*- cmake -*-
set(MONO_PREBUILT_LIBRARIES_DIR ${LIBS_PREBUILT_DIR}/mono/1.0)
set(MONO_PREBUILT_LIBRARIES
Iesi.Collections.dll
Iesi.Collections.pdb
Mono.CompilerServices.SymbolWriter.dll
Mono.PEToolkit.dll
Mono.PEToolkit.pdb
Mono.Security.dll
PEAPI.dll
RAIL.dll
RAIL.pdb
)
set(MONO_CORE_LIBRARIES
System.dll
System.Xml.dll
mscorlib.dll)
if(WINDOWS)
set(MONO_DEPENDENCIES
DomainCreator
DomainRegister
LslLibrary
LslUserScript
Script
ScriptTypes
TestFormat
UserScript
UThread
UThreadInjector
)
else(WINDOWS)
set(MONO_DEPENDENCIES
DomainCreator_POST_BUILD
DomainRegister_POST_BUILD
LslLibrary_POST_BUILD
LslUserScript_POST_BUILD
Script_POST_BUILD
ScriptTypes_POST_BUILD
TestFormat_POST_BUILD
UserScript_POST_BUILD
UThread_POST_BUILD
UThreadInjector_POST_BUILD
)
endif(WINDOWS)

View File

@ -0,0 +1,57 @@
# -*- cmake -*-
include(Prebuilt)
use_prebuilt_binary(libmono)
SET(GLIB_2_0 glib-2.0)
if (WINDOWS)
SET(MONO_LIB mono)
else (WINDOWS)
SET(MONO_LIB mono)
SET(M_LIBRARIES m)
SET(GTHREAD_2_0 gthread-2.0)
endif(WINDOWS)
IF (DARWIN)
FIND_LIBRARY(MONO_LIBRARY NAMES Mono)
# Find_file doesnt work as expected. Hardcode relative to Mono.framework.
#FIND_FILE(GLIB_CONFIG glibconfig.h ${MONO_LIBRARY})
#FIND_FILE(MONO_GLIB_LIBRARY glib.h ${MONO_LIBRARY})
SET(MONO_GLIB_LIBRARY ${MONO_LIBRARY}/Headers/glib-2.0/)
SET(GLIB_CONFIG ${MONO_LIBRARY}/Libraries/glib-2.0/include/)
SET(MONO_LIB_DIRECTORY ${MONO_LIBRARY}/Libraries)
IF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
MESSAGE("-- Found Mono for embedding")
INCLUDE_DIRECTORIES(${MONO_GLIB_LIBRARY} ${GLIB_CONFIG})
LINK_DIRECTORIES(${MONO_LIB_DIRECTORY})
ELSE (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
MESSAGE("-- Mono not found for embedding")
MESSAGE(${MONO_LIBRARY})
MESSAGE(${MONO_GLIB_LIBRARY})
MESSAGE(${GLIB_CONFIG})
ENDIF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
ELSE (DARWIN)
SET(MONO_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
SET(GLIB_2_0_PLATFORM_INCLUDE_DIR
${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/glib-2.0)
SET(GLIB_2_0_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/glib-2.0)
INCLUDE_DIRECTORIES(
${MONO_INCLUDE_DIR}
${GLIB_2_0_PLATFORM_INCLUDE_DIR}
${GLIB_2_0_INCLUDE_DIR})
ENDIF (DARWIN)
SET(MONO_LIBRARIES
${MONO_LIB}
${M_LIBRARIES}
${GLIB_2_0}
${GTHREAD_2_0}
)

View File

@ -128,7 +128,7 @@ const char* LLAssetType::mAssetTypeNames[LLAssetType::AT_COUNT] =
"jpeg",
"animatn",
"gesture",
"simstate",
"simstate"
};
// This table is meant for decoding to human readable form. Put any
@ -158,7 +158,7 @@ const char* LLAssetType::mAssetTypeHumanNames[LLAssetType::AT_COUNT] =
"jpeg image",
"animation",
"gesture",
"simstate",
"simstate"
};
///----------------------------------------------------------------------------

View File

@ -63,7 +63,8 @@ enum
LL_SIM_STAT_SIMPHYSICSSTEPMS,
LL_SIM_STAT_SIMPHYSICSSHAPEMS,
LL_SIM_STAT_SIMPHYSICSOTHERMS,
LL_SIM_STAT_SIMPHYSICSMEMORY
LL_SIM_STAT_SIMPHYSICSMEMORY,
LL_SIM_STAT_SCRIPT_EPS,
};
#endif

View File

@ -122,7 +122,7 @@ namespace
{
public:
RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {}
virtual ~RawInjector() {}
virtual ~RawInjector() {delete mData;}
const char* contentType() { return "application/octet-stream"; }
@ -153,16 +153,21 @@ namespace
LLBufferStream ostream(channels, buffer.get());
llifstream fstream(mFilename, std::iostream::binary | std::iostream::out);
fstream.seekg(0, std::ios::end);
U32 fileSize = fstream.tellg();
fstream.seekg(0, std::ios::beg);
char* fileBuffer;
fileBuffer = new char [fileSize];
fstream.read(fileBuffer, fileSize);
ostream.write(fileBuffer, fileSize);
fstream.close();
eos = true;
return STATUS_DONE;
if(fstream.is_open())
{
fstream.seekg(0, std::ios::end);
U32 fileSize = fstream.tellg();
fstream.seekg(0, std::ios::beg);
char* fileBuffer;
fileBuffer = new char [fileSize];
fstream.read(fileBuffer, fileSize);
ostream.write(fileBuffer, fileSize);
fstream.close();
eos = true;
return STATUS_DONE;
}
return STATUS_ERROR;
}
const std::string mFilename;
@ -402,7 +407,7 @@ void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr r
request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout);
}
void LLHTTPClient::post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout)
void LLHTTPClient::postRaw(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout)
{
request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout);
}

View File

@ -72,8 +72,12 @@ public:
static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
static void post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
/** Takes ownership of data and deletes it when sent */
static void postRaw(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
#
static void postFile(const std::string& url, const LLUUID& uuid,
LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);

View File

@ -94,8 +94,8 @@ const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27);
const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28);
const U32 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29);
const U32 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30);
const U32 REGION_FLAGS_DENY_AGEUNVERIFIED = (1 << 30);
const U32 REGION_FLAGS_SKIP_MONO_SCRIPTS = (1 << 31);
const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK |
REGION_FLAGS_ALLOW_SET_HOME |

View File

@ -71,14 +71,20 @@ LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum
}
if(! input[block].isArray())
{
llerrs << "block " << block << " not found" << llendl;
// NOTE: babbage: need to return default for missing blocks to allow
// backwards/forwards compatibility - handlers must cope with default
// values.
llwarns << "block " << block << " not found" << llendl;
return LLSD();
}
LLSD result = input[block][blocknum][var];
if(result.isUndefined())
{
llerrs << "var " << var << " not found" << llendl;
// NOTE: babbage: need to return default for missing vars to allow
// backwards/forwards compatibility - handlers must cope with default
// values.
llwarns << "var " << var << " not found" << llendl;
}
return result;
}

View File

@ -11,7 +11,8 @@ set(lscript_HEADER_FILES
lscript_rt_interface.h
)
add_subdirectory (lscript_compile)
add_subdirectory (lscript_execute)
add_subdirectory (lscript_library)
add_subdirectory(lscript_compile)
add_subdirectory(lscript_execute)
add_subdirectory(lscript_library)

View File

@ -415,7 +415,7 @@ inline void set_fault(const U8 *stream, LSCRIPTRunTimeFaults fault)
reset_hp_to_safe_spot(stream);
// lsa_print_heap((U8 *)stream);
}
fr = LSCRIPTRunTimeFaultBits[fault];
fr = fault;
set_register((U8 *)stream, LREG_FR, fr);
}
}

View File

@ -512,26 +512,12 @@ typedef enum e_lscript_runtime_faults
LSRF_CHAT_OVERRUN,
LSRF_TOO_MANY_LISTENS,
LSRF_NESTING_LISTS,
LSRF_CLI,
LSRF_EOF
} LSCRIPTRunTimeFaults;
extern const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/
const S32 LSCRIPTRunTimeFaultBits[LSRF_EOF] =
{
0, // LSRF_INVALID
1, // LSRF_MATH
2, // LSRF_STACK_HEAP_COLLISION
3, // LSREF_BOUND_CHECK_ERROR
4, // LSREF_HEAP_ERROR
5, // LSREF_VERSION_MISMATCH
6, // LSREF_MISSING_INVENTORY
7, // LSRF_SANDBOX
8, // LSRF_CHAT_OVERRUN
9, // LSRF_TOO_MANY_LISTENS
10, // LSRF_NESTING_LISTS
};
typedef enum e_lscript_runtime_permissions
{
SCRIPT_PERMISSION_DEBIT,

View File

@ -676,7 +676,7 @@ int yyerror(const char *fmt, ...)
//#define EMIT_CIL_ASSEMBLER
BOOL lscript_compile(const char* src_filename, const char* dst_filename,
const char* err_filename, BOOL is_god_like)
const char* err_filename, BOOL compile_to_mono, const char* class_name, BOOL is_god_like)
{
BOOL b_parse_ok = FALSE;
BOOL b_dummy = FALSE;
@ -718,6 +718,8 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename,
}
gScriptp->mGodLike = is_god_like;
gScriptp->setClassName(class_name);
gScopeStringTable = new LLStringTable(16384);
#ifdef EMERGENCY_DEBUG_PRINTOUTS
@ -733,34 +735,25 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename,
#ifdef EMERGENCY_DEBUG_PRINTOUTS
gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_ASSEMBLY, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL);
#endif
#ifdef EMIT_CIL_ASSEMBLER
const char* cil_output_file_name = dst_filename? dst_filename : "lscript.cil";
LLFILE* cilout = LLFile::fopen(cil_output_file_name, "w");
if(NULL == cilout)
if(TRUE == compile_to_mono)
{
fprintf(yyout, "Error opening cil output file %s\n", cil_output_file_name);
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);
}
else
{
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);
if(fclose(cilout) == EOF)
{
fprintf(yyout, "Error closing cil output file %s\n", cil_output_file_name);
}
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);
}
#endif
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);
}
delete gScopeStringTable;
gScopeStringTable = NULL;
#ifdef EMERGENCY_DEBUG_PRINTOUTS
fclose(compfile);
#endif
fclose(yyout);
}
fclose(yyout);
fclose(yyin);
}
fclose(yyin);
delete gAllocationManager;
delete gScopeStringTable;
@ -768,13 +761,15 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename,
}
BOOL lscript_compile(char *filename, BOOL is_god_like = FALSE)
BOOL lscript_compile(char *filename, BOOL compile_to_mono, BOOL is_god_like = FALSE)
{
char src_filename[MAX_STRING];
sprintf(src_filename, "%s.lsl", filename);
char err_filename[MAX_STRING];
sprintf(err_filename, "%s.out", filename);
return lscript_compile(src_filename, NULL, err_filename, is_god_like);
char class_name[MAX_STRING];
sprintf(class_name, "%s", filename);
return lscript_compile(src_filename, NULL, err_filename, compile_to_mono, class_name, is_god_like);
}

View File

@ -72,7 +72,10 @@ const char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/
"Use of vector or quaternion method on incorrect type",
"Lists can't be included in lists",
"Unitialized variables can't be included in lists",
"Declaration requires a new scope -- use { and }"
"Declaration requires a new scope -- use { and }",
"CIL assembler failed",
"Bytecode transformer failed",
"Bytecode verification failed"
};
void LLScriptGenerateErrorText::writeWarning(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning)
@ -98,3 +101,8 @@ void LLScriptGenerateErrorText::writeError(LLFILE *fp, S32 line, S32 col, LSCRIP
fprintf(fp, "(%d, %d) : ERROR : %s\n", line, col, gErrorText[error]);
mTotalErrors++;
}
std::string getLScriptErrorString(LSCRIPTErrors error)
{
return gErrorText[error];
}

View File

@ -124,6 +124,9 @@ typedef enum e_lscript_errors
LSERROR_NO_LISTS_IN_LISTS,
LSERROR_NO_UNITIALIZED_VARIABLES_IN_LISTS,
LSERROR_NEED_NEW_SCOPE,
LSERROR_CIL_ASSEMBLER_FAILED = 16, // Mono build error.
LSERROR_BYTECODE_TRANSFORM_FAILED = 17, // Mono build error.
LSERROR_BYTECODE_VERIFICATION_FAILED, // Mono build error.
LSERROR_EOF
} LSCRIPTErrors;
@ -147,6 +150,8 @@ public:
S32 mTotalWarnings;
};
std::string getLScriptErrorString(LSCRIPTErrors error);
extern LLScriptGenerateErrorText gErrorToText;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -2197,11 +2197,11 @@ public:
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);
S32 getSize();
LSCRIPTStateType mType;
LLScriptIdentifier *mIdentifier;
LLScriptEventHandler *mEvent;
LLScriptState *mNextp;
LSCRIPTStateType mType;
LLScriptIdentifier *mIdentifier;
LLScriptEventHandler *mEvent;
LLScriptState *mNextp;
LLScriptScope *mStateScope;
};
class LLScritpGlobalStorage : public LLScriptFilePosition
@ -2262,6 +2262,9 @@ public:
void setBytecodeDest(const char* dst_filename);
void setClassName(const char* class_name);
const char* getClassName() {return mClassName;}
LLScriptState *mStates;
LLScriptScope *mGlobalScope;
LLScriptGlobalVariable *mGlobals;
@ -2270,6 +2273,7 @@ public:
private:
std::string mBytecodeDest;
char mClassName[MAX_STRING];
};
class LLScriptAllocationManager

View File

@ -66,7 +66,13 @@ LSCRIPTType implicit_casts(LSCRIPTType left_side, LSCRIPTType right_side)
{
// shouldn't be doing an operation on void types
case LST_NULL:
return LST_NULL;
switch(right_side)
{
case LST_NULL:
return LST_NULL;
default:
return LST_UNDEFINED;
}
// shouldn't be doing an operation on undefined types
case LST_UNDEFINED:
return LST_UNDEFINED;

View File

@ -367,20 +367,158 @@ public:
class LLScriptExecute
{
public:
LLScriptExecute(LLFILE *fp);
LLScriptExecute(U8 *buffer);
~LLScriptExecute();
LLScriptExecute();
virtual ~LLScriptExecute() {;}
virtual S32 getVersion() = 0;
virtual void deleteAllEvents() = 0;
virtual void addEvent(LLScriptDataCollection* event) = 0;
virtual U32 getEventCount() = 0;
virtual void removeEventType(LSCRIPTStateEventType event_type) = 0;
virtual S32 getFaults() = 0;
virtual void setFault(LSCRIPTRunTimeFaults fault) = 0;
virtual U32 getFreeMemory() = 0;
virtual S32 getParameter() = 0;
virtual void setParameter(S32 value) = 0;
virtual F32 getSleep() const = 0;
virtual void setSleep(F32 value) = 0;
virtual F32 getEnergy() const = 0;
virtual void setEnergy(F32 value) = 0;
virtual U64 getCurrentEvents(S32 version) = 0;
virtual void setCurrentEvents(U64 value, S32 version) = 0;
virtual U64 getEventHandlers(S32 version) = 0;
virtual void setEventHandlers(U64 value, S32 version) = 0;
virtual U64 getCurrentHandler(S32 version) = 0;
virtual void setCurrentHandler(U64 value, S32 version) = 0;
virtual BOOL isFinished() const = 0;
virtual BOOL isStateChangePending() const = 0;
virtual S32 writeState(U8 **dest, U32 header_size, U32 footer_size) = 0; // Allocate memory for header, state and footer return size of state.
virtual U32 getEventsSavedSize() = 0; // Returns 0 if events are written with state.
virtual S32 writeEvents(U8 *dest) = 0; // Must write and return exactly the number of bytes returned by getEventsSavedSize.
virtual void readEvents(U8* src, S32& offset) = 0;
virtual S32 readState(U8 *src) = 0; // Returns number of bytes read.
virtual void reset();
virtual const U8* getBytecode() const = 0;
virtual U32 getBytecodeSize() const = 0;
virtual bool isMono() const = 0;
virtual void error() {;} // Processing that must be performed when error flag is set and so run is not called.
// Run current event handler for a maximum of time_slice seconds.
// Updates current handler and current events registers.
virtual void resumeEventHandler(BOOL b_print, const LLUUID &id, F32 time_slice) = 0;
// Run handler for event for a maximum of time_slice seconds.
// Updates current handler and current events registers.
virtual void callEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice) = 0;;
// Run handler for next queued event for maximum of time_slice seconds.
// Updates current handler and current events registers.
// Removes processed event from queue.
virtual void callNextQueuedEventHandler(U64 event_register, S32 major_version, const LLUUID &id, F32 time_slice) = 0;
// Run handler for event for a maximum of time_slice seconds.
// Updates current handler and current events registers.
// Removes processed event from queue.
virtual void callQueuedEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice) = 0;
// Switch to next state.
// Returns new set of handled events.
virtual U64 nextState() = 0;
// Returns time taken.
virtual F32 runQuanta(BOOL b_print, const LLUUID &id,
const char **errorstr,
BOOL &state_transition, F32 quanta,
U32& events_processed, LLTimer& timer);
// Run smallest possible amount of code: an instruction for LSL2, a segment
// between save tests for Mono
void runInstructions(BOOL b_print, const LLUUID &id,
const char **errorstr,
BOOL &state_transition, U32& events_processed,
F32 quanta);
bool isYieldDue() const;
void setReset(BOOL b) {mReset = b;}
BOOL getReset() const { return mReset; }
private:
BOOL mReset;
};
class LLScriptExecuteLSL2 : public LLScriptExecute
{
public:
LLScriptExecuteLSL2(LLFILE *fp);
LLScriptExecuteLSL2(const U8* bytecode, U32 bytecode_size);
virtual ~LLScriptExecuteLSL2();
virtual S32 getVersion() {return get_register(mBuffer, LREG_VN);}
virtual void deleteAllEvents() {mEventData.mEventDataList.deleteAllData();}
virtual void addEvent(LLScriptDataCollection* event);
virtual U32 getEventCount() {return mEventData.mEventDataList.getLength();}
virtual void removeEventType(LSCRIPTStateEventType event_type);
virtual S32 getFaults() {return get_register(mBuffer, LREG_FR);}
virtual void setFault(LSCRIPTRunTimeFaults fault) {set_fault(mBuffer, fault);}
virtual U32 getFreeMemory();
virtual S32 getParameter();
virtual void setParameter(S32 value);
virtual F32 getSleep() const;
virtual void setSleep(F32 value);
virtual F32 getEnergy() const;
virtual void setEnergy(F32 value);
virtual U64 getCurrentEvents(S32 version) {return get_event_register(mBuffer, LREG_CE, version);}
virtual void setCurrentEvents(U64 value, S32 version) {return set_event_register(mBuffer, LREG_CE, value, version);}
virtual U64 getEventHandlers(S32 version) {return get_event_register(mBuffer, LREG_ER, version);}
virtual void setEventHandlers(U64 value, S32 version) {set_event_register(mBuffer, LREG_ER, value, version);}
virtual U64 getCurrentHandler(S32 version);
virtual void setCurrentHandler(U64 value, S32 version) {return set_event_register(mBuffer, LREG_IE, value, version);}
virtual BOOL isFinished() const {return get_register(mBuffer, LREG_IP) == 0;}
virtual BOOL isStateChangePending() const {return get_register(mBuffer, LREG_CS) != get_register(mBuffer, LREG_NS);}
virtual S32 writeState(U8 **dest, U32 header_size, U32 footer_size); // Not including Events.
virtual U32 getEventsSavedSize() {return mEventData.getSavedSize();}
virtual S32 writeEvents(U8 *dest) {return mEventData.write2bytestream(dest);}
virtual void readEvents(U8* src, S32& offset) {mEventData.set(src, offset);}
virtual S32 writeBytecode(U8 **dest);
virtual S32 readState(U8 *src);
virtual void reset();
virtual const U8* getBytecode() const {return mBytecode;}
virtual U32 getBytecodeSize() const {return mBytecodeSize;}
virtual bool isMono() const {return false;}
// Run current event handler for a maximum of time_slice seconds.
// Updates current handler and current events registers.
virtual void resumeEventHandler(BOOL b_print, const LLUUID &id, F32 time_slice);
// Run handler for event for a maximum of time_slice seconds.
// Updates current handler and current events registers.
virtual void callEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice);
// Run handler for next queued event for maximum of time_slice seconds.
// Updates current handler and current events registers.
// Removes processed event from queue.
virtual void callNextQueuedEventHandler(U64 event_register, S32 major_version, const LLUUID &id, F32 time_slice);
// Run handler for event for a maximum of time_slice seconds.
// Updates current handler and current events registers.
// Removes processed event from queue.
virtual void callQueuedEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice);
// Switch to next state.
// Returns new set of handled events.
virtual U64 nextState();
void init();
U32 run(BOOL b_print, const LLUUID &id, const char **errorstr, BOOL &state_transition);
BOOL (*mExecuteFuncs[0x100])(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id);
U32 mInstructionCount;
U8 *mBuffer;
LLScriptEventData mEventData;
static S64 sGlobalInstructionCount;
U8* mBytecode; // Initial state and bytecode.
U32 mBytecodeSize;
private:
void recordBoundaryError( const LLUUID &id );

File diff suppressed because it is too large Load Diff

View File

@ -146,9 +146,9 @@ public:
return FALSE;
}
S32 getListLength()
S32 getListLength() const
{
LLScriptLibData *data = this;
const LLScriptLibData *data = this;
S32 retval = 0;
while (data->mListp)
{

View File

@ -398,9 +398,8 @@ void LLScriptLibrary::init()
addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCameraPos", "v", "", "vector llGetCameraPos()\nGets current camera position for agent task has permissions for."));
addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCameraRot", "q", "", "rotation llGetCameraRot()\nGets current camera orientation for agent task has permissions for."));
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."));
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."));
addFunction(new LLScriptLibraryFunction(10.f, 20.f, dummy_func, "llRefreshPrimURL", NULL, "", "llRefreshPrimURL()\nReloads the web page shown on the sides of the object."));
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."));
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."));
@ -458,24 +457,6 @@ void LLScriptLibrary::init()
// existing scripts will crash.
}
//Ventrella Follow Cam Script Stuff
//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'."));
//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"));
//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"));
//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"));
//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"));
//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"));
//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"));
//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"));
//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"));
//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"));
//addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPosition", NULL, "v", "llSetCamPosition(vector)\nSets the position of the camera"));
//addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocus", NULL, "v", "llSetCamFocus(vector focus)\nSets the focus (target position) of the camera"));
//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"));
//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"));
//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."));
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)
: mEnergyUse(eu), mSleepTime(st), mExecFunc(exec_func), mName(name), mReturnType(ret_type), mArgs(args), mGodOnly(god_only)
{

View File

@ -32,9 +32,9 @@
#ifndef LL_LSCRIPT_RT_INTERFACE_H
#define LL_LSCRIPT_RT_INTERFACE_H
BOOL lscript_compile(char *filename, BOOL is_god_like = FALSE);
BOOL lscript_compile(char *filename, BOOL compile_to_mono, BOOL is_god_like = FALSE);
BOOL lscript_compile(const char* src_filename, const char* dst_filename,
const char* err_filename, BOOL is_god_like = FALSE);
const char* err_filename, BOOL compile_to_mono, const char* class_name, BOOL is_god_like = FALSE);
void lscript_run(const std::string& filename, BOOL b_debug);

View File

@ -66,6 +66,7 @@ set(viewer_SOURCE_FILES
llanimstatelabels.cpp
llappviewer.cpp
llassetuploadresponders.cpp
llassetuploadqueue.cpp
llaudiosourcevo.cpp
llbbox.cpp
llbox.cpp
@ -454,6 +455,7 @@ set(viewer_HEADER_FILES
llappearance.h
llappviewer.h
llassetuploadresponders.h
llassetuploadqueue.h
llaudiosourcevo.h
llbbox.h
llbox.h

View File

@ -1,5 +1,6 @@
/* Localized versions of Info.plist keys */
CFBundleName = "Second Life";
CFBundleShortVersionString = "Second Life version 1.20.6.86975";
CFBundleGetInfoString = "Second Life version 1.20.6.86975, Copyright 2004-2008 Linden Research, Inc.";
CFBundleShortVersionString = "Second Life version 1.20.9.87416";
CFBundleGetInfoString = "Second Life version 1.20.9.87416, Copyright 2004-2008 Linden Research, Inc.";

View File

@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.20.6.86975</string>
<string>1.20.9.87416</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>

View File

@ -0,0 +1,194 @@
/**
* @file llassetupload.cpp
* @brief Serializes asset upload request
* Copyright (c) 2007, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llassetuploadqueue.h"
#include "llviewerregion.h"
#include "llviewerobjectlist.h"
#include "llassetuploadresponders.h"
#include "llsd.h"
#include <iostream>
class LLAssetUploadChainResponder : public LLUpdateTaskInventoryResponder
{
public:
LLAssetUploadChainResponder(const LLSD& post_data,
const std::string& file_name,
const LLUUID& queue_id,
U8* data,
U32 data_size,
std::string script_name,
LLAssetUploadQueueSupplier *supplier) :
LLUpdateTaskInventoryResponder(post_data, file_name, queue_id, LLAssetType::AT_LSL_TEXT),
mSupplier(supplier),
mData(data),
mDataSize(data_size),
mScriptName(script_name)
{
}
virtual ~LLAssetUploadChainResponder()
{
if(mSupplier)
{
LLAssetUploadQueue *queue = mSupplier->get();
if (queue)
{
// Give ownership of supplier back to queue.
queue->mSupplier = mSupplier;
mSupplier = NULL;
}
}
delete mSupplier;
delete mData;
}
virtual void error(U32 statusNum, const std::string& reason)
{
llwarns << "Error: " << reason << llendl;
LLUpdateTaskInventoryResponder::error(statusNum, reason);
LLAssetUploadQueue *queue = mSupplier->get();
if (queue)
{
queue->request(&mSupplier);
}
}
virtual void result(const LLSD& content)
{
LLUpdateTaskInventoryResponder::result(content);
LLAssetUploadQueue *queue = mSupplier->get();
if (queue)
{
// Responder is reused across 2 phase upload,
// so only start next upload after 2nd phase complete.
std::string state = content["state"];
if(state == "complete")
{
queue->request(&mSupplier);
}
}
}
virtual void uploadUpload(const LLSD& content)
{
std::string uploader = content["uploader"];
mSupplier->log(std::string("Compiling " + mScriptName).c_str());
llinfos << "Compiling " << llendl;
// postRaw takes ownership of mData and will delete it.
LLHTTPClient::postRaw(uploader, mData, mDataSize, this);
mData = NULL;
mDataSize = 0;
}
virtual void uploadComplete(const LLSD& content)
{
// Bytecode save completed
if (content["compiled"])
{
mSupplier->log("Compilation succeeded");
llinfos << "Compiled!" << llendl;
}
else
{
LLSD compile_errors = content["errors"];
for(LLSD::array_const_iterator line = compile_errors.beginArray();
line < compile_errors.endArray(); line++)
{
mSupplier->log(line->asString());
llinfos << content["errors"] << llendl;
}
}
LLUpdateTaskInventoryResponder::uploadComplete(content);
}
LLAssetUploadQueueSupplier *mSupplier;
U8* mData;
U32 mDataSize;
std::string mScriptName;
};
LLAssetUploadQueue::LLAssetUploadQueue(LLAssetUploadQueueSupplier *supplier) :
mSupplier(supplier)
{
}
//virtual
LLAssetUploadQueue::~LLAssetUploadQueue()
{
delete mSupplier;
}
// Takes ownership of supplier.
void LLAssetUploadQueue::request(LLAssetUploadQueueSupplier** supplier)
{
if (mQueue.empty())
return;
UploadData data = mQueue.front();
mQueue.pop_front();
LLSD body;
body["task_id"] = data.mTaskId;
body["item_id"] = data.mItemId;
body["is_script_running"] = data.mIsRunning;
body["target"] = data.mIsTargetMono? "mono" : "lsl2";
std::string url = "";
LLViewerObject* object = gObjectList.findObject(data.mTaskId);
if (object)
{
url = object->getRegion()->getCapability("UpdateScriptTaskInventory");
LLHTTPClient::post(url, body,
new LLAssetUploadChainResponder(
body, data.mFilename, data.mQueueId,
data.mData, data.mDataSize, data.mScriptName, *supplier));
}
*supplier = NULL;
}
void LLAssetUploadQueue::queue(const std::string& filename,
const LLUUID& task_id,
const LLUUID& item_id,
BOOL is_running,
BOOL is_target_mono,
const LLUUID& queue_id,
U8* script_data,
U32 data_size,
std::string script_name)
{
UploadData data;
data.mTaskId = task_id;
data.mItemId = item_id;
data.mIsRunning = is_running;
data.mIsTargetMono = is_target_mono;
data.mQueueId = queue_id;
data.mFilename = filename;
data.mData = script_data;
data.mDataSize = data_size;
data.mScriptName = script_name;
mQueue.push_back(data);
if(mSupplier)
{
request(&mSupplier);
}
}
LLAssetUploadQueueSupplier::~LLAssetUploadQueueSupplier()
{
}

View File

@ -0,0 +1,74 @@
/**
* @file llassetuploadqueue.h
* @brief Serializes asset upload request
* Copyright (c) 2007, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
* $/LicenseInfo$
*/
#ifndef LL_LLASSETUPLOADQUEUE_H
#define LL_LLASSETUPLOADQUEUE_H
#include "lluuid.h"
#include <string>
#include <deque>
class LLAssetUploadQueueSupplier;
class LLAssetUploadQueue
{
public:
// Takes ownership of supplier.
LLAssetUploadQueue(LLAssetUploadQueueSupplier* supplier);
virtual ~LLAssetUploadQueue();
void queue(const std::string& filename,
const LLUUID& task_id,
const LLUUID& item_id,
BOOL is_running,
BOOL is_target_mono,
const LLUUID& queue_id,
U8* data,
U32 data_size,
std::string script_name);
bool isEmpty() const {return mQueue.empty();}
private:
friend class LLAssetUploadChainResponder;
struct UploadData
{
std::string mFilename;
LLUUID mTaskId;
LLUUID mItemId;
BOOL mIsRunning;
BOOL mIsTargetMono;
LLUUID mQueueId;
U8* mData;
U32 mDataSize;
std::string mScriptName;
};
// Ownership of mSupplier passed to currently waiting responder
// and returned to queue when no requests in progress.
LLAssetUploadQueueSupplier* mSupplier;
std::deque<UploadData> mQueue;
// Passes on ownership of mSupplier if request is made.
void request(LLAssetUploadQueueSupplier** supplier);
};
class LLAssetUploadQueueSupplier
{
public:
virtual ~LLAssetUploadQueueSupplier();
virtual LLAssetUploadQueue* get() const = 0;
virtual void log(std::string message) const = 0;
};
#endif // LL_LLASSETUPLOADQUEUE_H

View File

@ -34,6 +34,7 @@
#include "llassetuploadresponders.h"
#include "llagent.h"
#include "llcompilequeue.h"
#include "llfloaterbuycurrency.h"
#include "lleconomy.h"
#include "llfilepicker.h"
@ -73,11 +74,12 @@ LLAssetUploadResponder::LLAssetUploadResponder(const LLSD &post_data,
}
LLAssetUploadResponder::LLAssetUploadResponder(const LLSD &post_data,
const std::string& file_name)
const std::string& file_name,
LLAssetType::EType asset_type)
: LLHTTPClient::Responder(),
mPostData(post_data),
mAssetType(LLAssetType::AT_NONE),
mFileName(file_name)
mFileName(file_name),
mAssetType(asset_type)
{
}
@ -182,8 +184,8 @@ LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data
{
}
LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name)
: LLAssetUploadResponder(post_data, file_name)
LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name, LLAssetType::EType asset_type)
: LLAssetUploadResponder(post_data, file_name, asset_type)
{
}
@ -301,8 +303,9 @@ LLUpdateAgentInventoryResponder::LLUpdateAgentInventoryResponder(const LLSD& pos
}
LLUpdateAgentInventoryResponder::LLUpdateAgentInventoryResponder(const LLSD& post_data,
const std::string& file_name)
: LLAssetUploadResponder(post_data, file_name)
const std::string& file_name,
LLAssetType::EType asset_type)
: LLAssetUploadResponder(post_data, file_name, asset_type)
{
}
@ -410,8 +413,17 @@ LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_
}
LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_data,
const std::string& file_name)
: LLAssetUploadResponder(post_data, file_name)
const std::string& file_name,
LLAssetType::EType asset_type)
: LLAssetUploadResponder(post_data, file_name, asset_type)
{
}
LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_data,
const std::string& file_name,
const LLUUID& queue_id,
LLAssetType::EType asset_type)
: LLAssetUploadResponder(post_data, file_name, asset_type), mQueueId(queue_id)
{
}
@ -422,35 +434,16 @@ void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content)
LLUUID item_id = mPostData["item_id"];
LLUUID task_id = mPostData["task_id"];
LLViewerObject* object = gObjectList.findObject(task_id);
if (!object)
{
llwarns << "LLUpdateTaskInventoryResponder::uploadComplete task " << task_id
<< " no longer exist." << llendl;
return;
}
LLViewerInventoryItem* item = (LLViewerInventoryItem*)object->getInventoryObject(item_id);
if (!item)
{
llwarns << "LLUpdateTaskInventoryResponder::uploadComplete item "
<< item_id << " is no longer in task " << task_id
<< "'s inventory." << llendl;
return;
}
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
// Update Viewer inventory
object->updateViewerInventoryAsset(new_item, content["new_asset"]);
dialog_refresh_all();
LLInventoryType::EType inventory_type = new_item->getInventoryType();
switch(inventory_type)
switch(mAssetType)
{
case LLInventoryType::IT_NOTECARD:
case LLAssetType::AT_NOTECARD:
{
// Update the UI with the new asset.
LLPreviewNotecard* nc;
nc = (LLPreviewNotecard*)LLPreview::find(new_item->getUUID());
nc = (LLPreviewNotecard*)LLPreview::find(item_id);
if(nc)
{
// *HACK: we have to delete the asset in the VFS so
@ -470,28 +463,39 @@ void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content)
}
}
break;
case LLInventoryType::IT_LSL:
case LLAssetType::AT_LSL_TEXT:
{
LLLiveLSLEditor* preview = LLLiveLSLEditor::find(item_id, task_id);
if (preview)
if(mQueueId.notNull())
{
// Bytecode save completed
if (content["compiled"])
LLFloaterCompileQueue* queue =
(LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId);
if(NULL != queue)
{
preview->callbackLSLCompileSucceeded(
task_id,
item_id,
mPostData["is_script_running"]);
queue->removeItemByItemID(item_id);
}
else
}
else
{
LLLiveLSLEditor* preview = LLLiveLSLEditor::find(item_id, task_id);
if (preview)
{
preview->callbackLSLCompileFailed(content["errors"]);
// Bytecode save completed
if (content["compiled"])
{
preview->callbackLSLCompileSucceeded(
task_id,
item_id,
mPostData["is_script_running"]);
}
else
{
preview->callbackLSLCompileFailed(content["errors"]);
}
}
}
}
break;
case LLInventoryType::IT_WEARABLE:
default:
break;
default:
break;
}
}

View File

@ -42,7 +42,9 @@ public:
LLAssetUploadResponder(const LLSD& post_data,
const LLUUID& vfile_id,
LLAssetType::EType asset_type);
LLAssetUploadResponder(const LLSD& post_data, const std::string& file_name);
LLAssetUploadResponder(const LLSD& post_data,
const std::string& file_name,
LLAssetType::EType asset_type);
~LLAssetUploadResponder();
virtual void error(U32 statusNum, const std::string& reason);
virtual void result(const LLSD& content);
@ -52,8 +54,8 @@ public:
protected:
LLSD mPostData;
LLUUID mVFileID;
LLAssetType::EType mAssetType;
LLUUID mVFileID;
std::string mFileName;
};
@ -63,7 +65,8 @@ public:
LLNewAgentInventoryResponder(const LLSD& post_data,
const LLUUID& vfile_id,
LLAssetType::EType asset_type);
LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name);
LLNewAgentInventoryResponder(const LLSD& post_data, const std::string& file_name,
LLAssetType::EType asset_type);
virtual void uploadComplete(const LLSD& content);
};
@ -74,7 +77,8 @@ public:
const LLUUID& vfile_id,
LLAssetType::EType asset_type);
LLUpdateAgentInventoryResponder(const LLSD& post_data,
const std::string& file_name);
const std::string& file_name,
LLAssetType::EType asset_type);
virtual void uploadComplete(const LLSD& content);
};
@ -85,8 +89,17 @@ public:
const LLUUID& vfile_id,
LLAssetType::EType asset_type);
LLUpdateTaskInventoryResponder(const LLSD& post_data,
const std::string& file_name);
const std::string& file_name,
LLAssetType::EType asset_type);
LLUpdateTaskInventoryResponder(const LLSD& post_data,
const std::string& file_name,
const LLUUID& queue_id,
LLAssetType::EType asset_type);
virtual void uploadComplete(const LLSD& content);
private:
LLUUID mQueueId;
};
#endif // LL_LLASSETUPLOADRESPONDER_H

View File

@ -42,6 +42,8 @@
#include "llcompilequeue.h"
#include "llagent.h"
#include "llassetuploadqueue.h"
#include "llassetuploadresponders.h"
#include "llchat.h"
#include "llviewerwindow.h"
#include "llviewerobject.h"
@ -72,20 +74,15 @@ const std::string RUN_START_STRING("set running");
const std::string NOT_RUN_QUEUE_TITLE("Set Not Running Progress");
const std::string NOT_RUN_START_STRING("set not running");
struct LLCompileQueueData
{
LLUUID mQueueID;
LLUUID mOldAssetID;
LLCompileQueueData(const LLUUID& q_id, const LLUUID& old_asset_id) :
mQueueID(q_id), mOldAssetID(old_asset_id) {}
};
struct LLScriptQueueData
{
LLUUID mQueueID;
std::string mScriptName;
LLScriptQueueData(const LLUUID& q_id, const std::string& name) :
mQueueID(q_id), mScriptName(name) {}
LLUUID mTaskId;
LLUUID mItemId;
LLScriptQueueData(const LLUUID& q_id, const std::string& name, const LLUUID& task_id, const LLUUID& item_id) :
mQueueID(q_id), mScriptName(name), mTaskId(task_id), mItemId(item_id) {}
};
///----------------------------------------------------------------------------
@ -105,7 +102,8 @@ LLFloaterScriptQueue::LLFloaterScriptQueue(const std::string& name,
RESIZE_YES, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT,
DRAG_ON_TOP, MINIMIZE_YES, CLOSE_YES)
{
mID.generate();
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_queue.xml");
childSetAction("close",onCloseBtn,this);
@ -113,11 +111,8 @@ LLFloaterScriptQueue::LLFloaterScriptQueue(const std::string& name,
setTitle(title);
if (!getHost())
{
LLRect curRect = getRect();
translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop);
}
LLRect curRect = getRect();
translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop);
mStartString = start_string;
mDone = FALSE;
@ -279,14 +274,57 @@ BOOL LLFloaterScriptQueue::popNext()
///----------------------------------------------------------------------------
// static
LLFloaterCompileQueue* LLFloaterCompileQueue::create()
LLFloaterCompileQueue* LLFloaterCompileQueue::create(BOOL mono)
{
S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top);
LLRect rect = gSavedSettings.getRect("CompileOutputRect");
rect.translate(left - rect.mLeft, top - rect.mTop);
LLFloaterCompileQueue* new_queue = new LLFloaterCompileQueue("queue", rect);
new_queue->open(); /*Flawfinder: ignore*/
class LLCompileFloaterUploadQueueSupplier : public LLAssetUploadQueueSupplier
{
public:
LLCompileFloaterUploadQueueSupplier(const LLUUID& queue_id) :
mQueueId(queue_id)
{
}
virtual LLAssetUploadQueue* get() const
{
LLFloaterCompileQueue* queue =
(LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId);
if(NULL == queue)
{
return NULL;
}
return queue->mUploadQueue;
}
virtual void log(std::string message) const
{
LLFloaterCompileQueue* queue =
(LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId);
if(NULL == queue)
{
return;
}
LLScrollListCtrl* list = queue->getChild<LLScrollListCtrl>("queue output");
list->addCommentText(message.c_str());
}
private:
LLUUID mQueueId;
};
new_queue->mUploadQueue = new LLAssetUploadQueue(new LLCompileFloaterUploadQueueSupplier(new_queue->getID()));
new_queue->mMono = mono;
new_queue->open();
return new_queue;
}
@ -304,7 +342,7 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object,
// find all of the lsl, leaving off duplicates. We'll remove
// all matching asset uuids on compilation success.
typedef std::map<LLUUID, LLPointer<LLInventoryItem> > uuid_item_map;
typedef std::multimap<LLUUID, LLPointer<LLInventoryItem> > uuid_item_map;
uuid_item_map asset_item_map;
InventoryObjectList::const_iterator it = inv->begin();
@ -315,17 +353,12 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object,
{
LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
// Check permissions before allowing the user to retrieve data.
if (item->getPermissions().allowModifyBy(gAgent.getID()) &&
item->getPermissions().allowCopyBy(gAgent.getID()) )
if (item->getPermissions().allowModifyBy(gAgent.getID(), gAgent.getGroupID()) &&
item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) )
{
LLPointer<LLViewerInventoryItem> script = new LLViewerInventoryItem(item);
mCurrentScripts.put(script);
if (!asset_item_map.count(item->getAssetUUID()))
{
// No entry, put in an entry for this supposedly permissive script
asset_item_map[item->getAssetUUID()] = item;
}
asset_item_map.insert(std::make_pair(item->getAssetUUID(), item));
}
}
}
@ -342,7 +375,10 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object,
for(iter = asset_item_map.begin(); iter != asset_item_map.end(); iter++)
{
LLInventoryItem *itemp = iter->second;
LLScriptQueueData* datap = new LLScriptQueueData(getID(), itemp->getName());
LLScriptQueueData* datap = new LLScriptQueueData(getID(),
itemp->getName(),
viewer_object->getID(),
itemp->getUUID());
//llinfos << "ITEM NAME 2: " << names.get(i) << llendl;
gAssetStorage->getInvItemAsset(viewer_object->getRegion()->getHost(),
@ -359,7 +395,6 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object,
}
}
// This is the callback for when each script arrives
// static
void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
@ -382,31 +417,58 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
std::string uuid_str;
asset_id.toString(uuid_str);
filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_str) + llformat(".%s",LLAssetType::lookup(type));
LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/
if (fp)
const bool is_running = true;
LLViewerObject* object = gObjectList.findObject(data->mTaskId);
if (object)
{
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/
std::string url = object->getRegion()->getCapability("UpdateScriptTaskInventory");
if(!url.empty())
{
if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1)
{
// return a bad file error if we can't write the whole thing
status = LL_ERR_CANNOT_OPEN_FILE;
}
// Read script source in to buffer.
U32 script_size = file.getSize();
U8* script_data = new U8[script_size];
file.read(script_data, script_size);
queue->mUploadQueue->queue(filename, data->mTaskId,
data->mItemId, is_running, queue->mMono, queue->getID(),
script_data, script_size, data->mScriptName);
}
else
{
// It's now in the file, now compile it.
buffer = std::string("Downloaded, now compiling: ") + data->mScriptName; // *TODO: Translate
fclose(fp);
// Write script to local file for compilation.
LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/
if (fp)
{
const S32 buf_size = 65536;
U8 copy_buf[buf_size];
while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/
{
if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1)
{
// return a bad file error if we can't write the whole thing
status = LL_ERR_CANNOT_OPEN_FILE;
}
}
fclose(fp);
}
else
{
llerrs << "Unable to find object to compile" << llendl;
}
// TODO: babbage: No compile if no cap.
queue->compile(filename, data->mItemId);
// Delete it after we're done compiling?
LLFile::remove(filename);
}
}
// *TODO: translate
// It's now in the file, now compile it.
buffer = std::string("Downloaded, now compiling: ") + data->mScriptName; // *TODO: Translate
queue->compile(filename, asset_id);
// Delete it after we're done compiling?
LLFile::remove(filename);
}
else
{
@ -430,9 +492,9 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
}
llwarns << "Problem downloading script asset." << llendl;
if(queue) queue->removeItemByAssetID(asset_id);
if(queue) queue->removeItemByItemID(data->mItemId);
}
if(queue)
if(queue && (buffer.size() > 0))
{
LLScrollListCtrl* list = queue->getChild<LLScrollListCtrl>("queue output");
list->addCommentText(buffer);
@ -462,9 +524,8 @@ void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void*
(LLFloaterScriptQueue::findInstance(data->mQueueID));
if(queue && (0 == status) && data)
{
queue->updateAssetID(data->mOldAssetID, asset_id);
queue->saveItemByAssetID(asset_id);
queue->removeItemByAssetID(asset_id);
queue->saveItemByItemID(data->mItemId);
queue->removeItemByItemID(data->mItemId);
}
else
{
@ -479,7 +540,7 @@ void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void*
// compile the file given and save it out.
void LLFloaterCompileQueue::compile(const std::string& filename,
const LLUUID& asset_id)
const LLUUID& item_id)
{
LLUUID new_asset_id;
LLTransactionID tid;
@ -496,29 +557,34 @@ void LLFloaterCompileQueue::compile(const std::string& filename,
gAssetStorage->storeAssetData(filename, tid,
LLAssetType::AT_LSL_TEXT,
&onSaveTextComplete, NULL, FALSE);
if(!lscript_compile(filename.c_str(), dst_filename.c_str(), err_filename.c_str(), gAgent.isGodlike()))
const BOOL compile_to_mono = FALSE;
if(!lscript_compile(filename.c_str(), dst_filename.c_str(),
err_filename.c_str(), compile_to_mono,
uuid_string.c_str(), gAgent.isGodlike()))
{
llwarns << "compile failed" << llendl;
removeItemByAssetID(asset_id);
removeItemByItemID(item_id);
}
else
{
llinfos << "compile successful." << llendl;
// Save the bytecode
LLCompileQueueData* data = new LLCompileQueueData(mID, asset_id);
gAssetStorage->storeAssetData(dst_filename, tid,
LLAssetType::AT_LSL_BYTECODE,
&onSaveBytecodeComplete,
(void*)data, FALSE);
// Save LSL bytecode
LLCompileQueueData* data = new LLCompileQueueData(mID, item_id);
gAssetStorage->storeAssetData(dst_filename, new_asset_id,
LLAssetType::AT_LSL_BYTECODE,
&LLFloaterCompileQueue::onSaveBytecodeComplete,
(void*)data, FALSE);
}
}
void LLFloaterCompileQueue::removeItemByAssetID(const LLUUID& asset_id)
void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id)
{
llinfos << "LLFloaterCompileQueue::removeItemByAssetID()" << llendl;
for(S32 i = 0; i < mCurrentScripts.count(); )
{
if(asset_id == mCurrentScripts.get(i)->getAssetUUID())
if(asset_id == mCurrentScripts.get(i)->getUUID())
{
mCurrentScripts.remove(i);
}
@ -533,7 +599,21 @@ void LLFloaterCompileQueue::removeItemByAssetID(const LLUUID& asset_id)
}
}
void LLFloaterCompileQueue::saveItemByAssetID(const LLUUID& asset_id)
const LLInventoryItem* LLFloaterCompileQueue::findItemByItemID(const LLUUID& asset_id) const
{
LLInventoryItem* result = NULL;
S32 count = mCurrentScripts.count();
for(S32 i = 0; i < count; ++i)
{
if(asset_id == mCurrentScripts.get(i)->getUUID())
{
result = mCurrentScripts.get(i);
}
}
return result;
}
void LLFloaterCompileQueue::saveItemByItemID(const LLUUID& asset_id)
{
llinfos << "LLFloaterCompileQueue::saveItemByAssetID()" << llendl;
LLViewerObject* viewer_object = gObjectList.findObject(mCurrentObjectID);
@ -542,7 +622,7 @@ void LLFloaterCompileQueue::saveItemByAssetID(const LLUUID& asset_id)
S32 count = mCurrentScripts.count();
for(S32 i = 0; i < count; ++i)
{
if(asset_id == mCurrentScripts.get(i)->getAssetUUID())
if(asset_id == mCurrentScripts.get(i)->getUUID())
{
// *FIX: this auto-resets active to TRUE. That might
// be a bad idea.
@ -556,20 +636,6 @@ void LLFloaterCompileQueue::saveItemByAssetID(const LLUUID& asset_id)
}
}
// find old_asst_id, and set the asset id to new_asset_id
void LLFloaterCompileQueue::updateAssetID(const LLUUID& old_asset_id,
const LLUUID& new_asset_id)
{
S32 count = mCurrentScripts.count();
for(S32 i = 0; i < count; ++i)
{
if(old_asset_id == mCurrentScripts.get(i)->getAssetUUID())
{
mCurrentScripts.get(i)->setAssetUUID(new_asset_id);
}
}
}
///----------------------------------------------------------------------------
/// Class LLFloaterResetQueue
///----------------------------------------------------------------------------
@ -582,7 +648,8 @@ LLFloaterResetQueue* LLFloaterResetQueue::create()
LLRect rect = gSavedSettings.getRect("CompileOutputRect");
rect.translate(left - rect.mLeft, top - rect.mTop);
LLFloaterResetQueue* new_queue = new LLFloaterResetQueue("queue", rect);
new_queue->open(); /*Flawfinder: ignore*/
gFloaterView->addChild(new_queue);
new_queue->open();
return new_queue;
}

View File

@ -64,6 +64,9 @@ public:
// start() returns TRUE if the queue has started, otherwise FALSE.
BOOL start();
// find an instance by ID. Return NULL if it does not exist.
static LLFloaterScriptQueue* findInstance(const LLUUID& id);
protected:
LLFloaterScriptQueue(const std::string& name, const LLRect& rect,
const std::string& title, const std::string& start_string);
@ -92,9 +95,6 @@ protected:
// Get this instances ID.
const LLUUID& getID() const { return mID; }
// find an instance by ID. Return NULL if it does not exist.
static LLFloaterScriptQueue* findInstance(const LLUUID& id);
protected:
// UI
@ -118,12 +118,29 @@ protected:
// This script queue will recompile each script.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
struct LLCompileQueueData
{
LLUUID mQueueID;
LLUUID mItemId;
LLCompileQueueData(const LLUUID& q_id, const LLUUID& item_id) :
mQueueID(q_id), mItemId(item_id) {}
};
class LLAssetUploadQueue;
class LLFloaterCompileQueue : public LLFloaterScriptQueue
{
public:
// Use this method to create a compile queue. Once created, it
// will be responsible for it's own destruction.
static LLFloaterCompileQueue* create();
static LLFloaterCompileQueue* create(BOOL mono);
static void onSaveBytecodeComplete(const LLUUID& asset_id,
void* user_data,
S32 status);
// remove any object in mScriptScripts with the matching uuid.
void removeItemByItemID(const LLUUID& item_id);
protected:
LLFloaterCompileQueue(const std::string& name, const LLRect& rect);
@ -139,6 +156,7 @@ protected:
void* user_data, S32 status, LLExtStat ext_status);
static void onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status);
static void onSaveBytecodeComplete(const LLUUID& asset_id,
void* user_data,
S32 status, LLExtStat ext_status);
@ -149,14 +167,18 @@ protected:
// remove any object in mScriptScripts with the matching uuid.
void removeItemByAssetID(const LLUUID& asset_id);
// save the items indicatd by the asset id.
void saveItemByAssetID(const LLUUID& asset_id);
// save the items indicated by the item id.
void saveItemByItemID(const LLUUID& item_id);
// find old_asst_id, and set the asset id to new_asset_id
void updateAssetID(const LLUUID& old_asset_id, const LLUUID& new_asset_id);
// find InventoryItem given item id.
const LLInventoryItem* findItemByItemID(const LLUUID& item_id) const;
protected:
LLViewerInventoryItem::item_array_t mCurrentScripts;
private:
BOOL mMono; // Compile to mono.
LLAssetUploadQueue* mUploadQueue;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -170,6 +170,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
F32 score;
std::string name_buf;
std::string owner_buf;
F32 mono_score;
msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block);
msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block);
@ -192,6 +193,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
element["columns"][0]["column"] = "score";
element["columns"][0]["value"] = llformat("%0.3f", score);
element["columns"][0]["font"] = "SANSSERIF";
element["columns"][1]["column"] = "name";
element["columns"][1]["value"] = name_buf;
element["columns"][1]["font"] = "SANSSERIF";
@ -205,6 +207,14 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data)
element["columns"][3]["value"] = formatted_time((time_t)time_stamp);
element["columns"][3]["font"] = "SANSSERIF";
if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS)
{
msg->getF32Fast(_PREHASH_ReportData, "MonoScore", mono_score, block);
element["columns"][4]["column"] = "Mono Time";
element["columns"][4]["value"] = llformat("%0.3f", mono_score);
element["columns"][4]["font"] = "SANSSERIF";
}
list->addElement(element);
mObjectListData.append(element);

View File

@ -139,6 +139,12 @@ const S32 TEXT_EDIT_COLUMN_HEIGHT = 16;
const S32 MAX_HISTORY_COUNT = 10;
const F32 LIVE_HELP_REFRESH_TIME = 1.f;
static bool have_script_upload_cap(LLUUID& object_id)
{
LLViewerObject* object = gObjectList.findObject(object_id);
return object && (! object->getRegion()->getCapability("UpdateScriptTaskInventory").empty());
}
/// ---------------------------------------------------------------------------
/// LLFloaterScriptSearch
/// ---------------------------------------------------------------------------
@ -173,7 +179,7 @@ private:
LLFloaterScriptSearch* LLFloaterScriptSearch::sInstance = NULL;
LLFloaterScriptSearch::LLFloaterScriptSearch(std::string title, LLRect rect, LLScriptEdCore* editor_core)
: LLFloater(std::string("script search"),rect,title), mEditorCore(editor_core)
: LLFloater("script search",rect,title), mEditorCore(editor_core)
{
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_search.xml");
@ -306,14 +312,15 @@ LLScriptEdCore::LLScriptEdCore(
mUserdata( userdata ),
mForceClose( FALSE ),
mLastHelpToken(NULL),
mLiveHelpHistorySize(0)
mLiveHelpHistorySize(0),
mEnableSave(FALSE)
{
setFollowsAll();
setBorderVisible(FALSE);
LLUICtrlFactory::getInstance()->buildPanel(this, "floater_script_ed_panel.xml");
mErrorList = getChild<LLScrollListCtrl>("lsl errors");
mFunctions = getChild<LLComboBox>( "Insert...");
@ -439,13 +446,13 @@ BOOL LLScriptEdCore::hasChanged(void* userdata)
LLScriptEdCore* self = (LLScriptEdCore*)userdata;
if (!self || !self->mEditor) return FALSE;
return !self->mEditor->isPristine();
return !self->mEditor->isPristine() || self->mEnableSave;
}
void LLScriptEdCore::draw()
{
BOOL script_changed = !mEditor->isPristine();
childSetEnabled("Save_btn", script_changed);
BOOL script_changed = hasChanged(this);
childSetEnabled("Save_btn", script_changed);
if( mEditor->hasFocus() )
{
@ -594,7 +601,7 @@ void LLScriptEdCore::addHelpItemToHistory(const std::string& help_string)
BOOL LLScriptEdCore::canClose()
{
if(mForceClose || mEditor->isPristine())
if(mForceClose || !hasChanged(this))
{
return TRUE;
}
@ -1133,7 +1140,9 @@ void LLPreviewLSL::callbackLSLCompileFailed(const LLSD& compile_errors)
line++)
{
LLSD row;
row["columns"][0]["value"] = line->asString();
std::string error_message = line->asString();
LLStringUtil::stripNonprintable(error_message);
row["columns"][0]["value"] = error_message;
row["columns"][0]["font"] = "OCRA";
mScriptEd->mErrorList->addElement(row);
}
@ -1247,7 +1256,7 @@ void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save)
void LLPreviewLSL::saveIfNeeded()
{
// llinfos << "LLPreviewLSL::saveIfNeeded()" << llendl;
if(mScriptEd->mEditor->isPristine())
if(!LLScriptEdCore::hasChanged(mScriptEd))
{
return;
}
@ -1305,7 +1314,8 @@ void LLPreviewLSL::uploadAssetViaCaps(const std::string& url,
llinfos << "Update Agent Inventory via capability" << llendl;
LLSD body;
body["item_id"] = item_id;
LLHTTPClient::post(url, body, new LLUpdateAgentInventoryResponder(body, filename));
body["target"] = "lsl2";
LLHTTPClient::post(url, body, new LLUpdateAgentInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT));
}
void LLPreviewLSL::uploadAssetLegacy(const std::string& filename,
@ -1326,9 +1336,12 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename,
std::string dst_filename = llformat("%s.lso", filepath.c_str());
std::string err_filename = llformat("%s.out", filepath.c_str());
const BOOL compile_to_mono = FALSE;
if(!lscript_compile(filename.c_str(),
dst_filename.c_str(),
err_filename.c_str(),
compile_to_mono,
asset_id.asString().c_str(),
gAgent.isGodlike()))
{
llinfos << "Compile failed!" << llendl;
@ -1601,7 +1614,8 @@ LLLiveLSLEditor::LLLiveLSLEditor(const std::string& name,
mAskedForRunningInfo(FALSE),
mHaveRunningInfo(FALSE),
mCloseAfterSave(FALSE),
mPendingUploads(0)
mPendingUploads(0),
mIsModifiable(FALSE)
{
@ -1615,13 +1629,14 @@ LLLiveLSLEditor::LLLiveLSLEditor(const std::string& name,
LLLiveLSLEditor::sInstances.addData(mItemID ^ mObjectID, this);
LLCallbackMap::map_t factory_map;
factory_map["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this);
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_live_lsleditor.xml", &factory_map);
mMonoCheckbox = getChild<LLCheckBoxCtrl>("mono");
childSetCommitCallback("mono", &LLLiveLSLEditor::onMonoCheckboxClicked, this);
childSetEnabled("mono", FALSE);
childSetCommitCallback("running", LLLiveLSLEditor::onRunningCheckboxClicked, this);
childSetEnabled("running", FALSE);
@ -1633,7 +1648,6 @@ LLLiveLSLEditor::LLLiveLSLEditor(const std::string& name,
mScriptEd->mEditor->makePristine();
loadAsset(is_new);
mScriptEd->mEditor->setFocus(TRUE);
if (!getHost())
{
@ -1677,7 +1691,9 @@ void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors)
line++)
{
LLSD row;
row["columns"][0]["value"] = line->asString();
std::string error_message = line->asString();
LLStringUtil::stripNonprintable(error_message);
row["columns"][0]["value"] = error_message;
row["columns"][0]["font"] = "OCRA";
mScriptEd->mErrorList->addElement(row);
}
@ -1712,6 +1728,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new)
mScriptEd->mEditor->setText(getString("not_allowed"));
mScriptEd->mEditor->makePristine();
mScriptEd->mEditor->setEnabled(FALSE);
mScriptEd->enableSave(FALSE);
mAssetStatus = PREVIEW_ASSET_LOADED;
}
else if(item && mItem.notNull())
@ -1745,12 +1762,14 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new)
mAssetStatus = PREVIEW_ASSET_LOADED;
}
if(item
&& !gAgent.allowOperation(PERM_MODIFY, item->getPermissions(),
GP_OBJECT_MANIPULATE))
mIsModifiable = item && gAgent.allowOperation(PERM_MODIFY,
item->getPermissions(),
GP_OBJECT_MANIPULATE);
if(!mIsModifiable)
{
mScriptEd->mEditor->setEnabled(FALSE);
}
// This is commented out, because we don't completely
// handle script exports yet.
/*
@ -1784,8 +1803,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new)
else
{
mScriptEd->mEditor->setText(std::string(HELLO_LSL));
//mScriptEd->mEditor->setText(LLStringUtil::null);
//mScriptEd->mEditor->makePristine();
mScriptEd->enableSave(FALSE);
LLPermissions perm;
perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID());
perm.initMasks(PERM_ALL, PERM_ALL, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER);
@ -1955,22 +1973,43 @@ void LLLiveLSLEditor::draw()
{
LLViewerObject* object = gObjectList.findObject(mObjectID);
LLCheckBoxCtrl* runningCheckbox = getChild<LLCheckBoxCtrl>( "running");
if(object && mAskedForRunningInfo && mHaveRunningInfo)
if(object && mAskedForRunningInfo && mHaveRunningInfo)
{
if(object->permAnyOwner())
{
runningCheckbox->setLabel(getString("script_running"));
runningCheckbox->setEnabled(TRUE);
if(object->permAnyOwner())
{
runningCheckbox->setLabel(getString("script_running"));
runningCheckbox->setEnabled(TRUE);
}
else
{
runningCheckbox->setLabel(getString("public_objects_can_not_run"));
runningCheckbox->setEnabled(FALSE);
// *FIX: Set it to false so that the ui is correct for
// a box that is released to public. It could be
// incorrect after a release/claim cycle, but will be
// correct after clicking on it.
runningCheckbox->set(FALSE);
mMonoCheckbox->set(FALSE);
}
}
else
{
runningCheckbox->setLabel(getString("public_objects_can_not_run"));
runningCheckbox->setEnabled(FALSE);
// *FIX: Set it to false so that the ui is correct for
// a box that is released to public. It could be
// incorrect after a release/claim cycle, but will be
// correct after clicking on it.
runningCheckbox->set(FALSE);
mMonoCheckbox->setEnabled(FALSE);
// object may have fallen out of range.
mHaveRunningInfo = FALSE;
}
}
else if(!object)
@ -2044,7 +2083,7 @@ void LLLiveLSLEditor::saveIfNeeded()
}
// Don't need to save if we're pristine
if(mScriptEd->mEditor->isPristine())
if(!LLScriptEdCore::hasChanged(mScriptEd))
{
return;
}
@ -2052,6 +2091,7 @@ void LLLiveLSLEditor::saveIfNeeded()
mPendingUploads = 0;
// save the script
mScriptEd->enableSave(FALSE);
mScriptEd->mEditor->makePristine();
mScriptEd->mErrorList->deleteAllItems();
@ -2091,7 +2131,7 @@ void LLLiveLSLEditor::saveIfNeeded()
fp = NULL;
// save it out to asset server
std::string url = gAgent.getRegion()->getCapability("UpdateScriptTaskInventory");
std::string url = object->getRegion()->getCapability("UpdateScriptTaskInventory");
getWindow()->incBusyCount();
mPendingUploads++;
BOOL is_running = getChild<LLCheckBoxCtrl>( "running")->get();
@ -2117,8 +2157,9 @@ void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url,
body["task_id"] = task_id;
body["item_id"] = item_id;
body["is_script_running"] = is_running;
body["target"] = monoChecked() ? "mono" : "lsl2";
LLHTTPClient::post(url, body,
new LLUpdateTaskInventoryResponder(body, filename));
new LLUpdateTaskInventoryResponder(body, filename, LLAssetType::AT_LSL_TEXT));
}
void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename,
@ -2141,9 +2182,12 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename,
std::string err_filename = llformat("%s.out", filepath.c_str());
LLFILE *fp;
const BOOL compile_to_mono = FALSE;
if(!lscript_compile(filename.c_str(),
dst_filename.c_str(),
err_filename.c_str(),
compile_to_mono,
asset_id.asString().c_str(),
gAgent.isGodlike()))
{
// load the error file into the error scrolllist
@ -2384,6 +2428,11 @@ void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**)
msg->getBOOLFast(_PREHASH_Script, _PREHASH_Running, running);
LLCheckBoxCtrl* runningCheckbox = instance->getChild<LLCheckBoxCtrl>("running");
runningCheckbox->set(running);
BOOL mono;
msg->getBOOLFast(_PREHASH_Script, "Mono", mono);
LLCheckBoxCtrl* monoCheckbox = instance->getChild<LLCheckBoxCtrl>("mono");
monoCheckbox->setEnabled(instance->getIsModifiable() && have_script_upload_cap(object_id));
monoCheckbox->set(mono);
}
}
@ -2398,3 +2447,19 @@ void LLLiveLSLEditor::reshape(S32 width, S32 height, BOOL called_from_parent)
gSavedSettings.setRect("PreviewScriptRect", getRect());
}
}
void LLLiveLSLEditor::onMonoCheckboxClicked(LLUICtrl*, void* userdata)
{
LLLiveLSLEditor* self = static_cast<LLLiveLSLEditor*>(userdata);
self->mMonoCheckbox->setEnabled(have_script_upload_cap(self->mObjectID));
self->mScriptEd->enableSave(self->getIsModifiable());
}
BOOL LLLiveLSLEditor::monoChecked() const
{
if(NULL != mMonoCheckbox)
{
return mMonoCheckbox->getValue()? TRUE : FALSE;
}
return FALSE;
}

View File

@ -118,13 +118,14 @@ public:
void selectFirstError();
virtual BOOL handleKeyHere(KEY key, MASK mask);
void enableSave(BOOL b) {mEnableSave = b;}
protected:
void deleteBridges();
void setHelpPage(const std::string& help_string);
void updateDynamicHelp(BOOL immediate = FALSE);
void addHelpItemToHistory(const std::string& help_string);
static void onErrorList(LLUICtrl*, void* user_data);
virtual const char *getTitleName() const { return "Script"; }
@ -147,6 +148,7 @@ private:
LLKeywordToken* mLastHelpToken;
LLFrameTimer mLiveHelpTimer;
S32 mLiveHelpHistorySize;
BOOL mEnableSave;
};
@ -184,8 +186,9 @@ protected:
void* user_data, S32 status, LLExtStat ext_status);
static void onSaveComplete(const LLUUID& uuid, void* user_data, S32 status, LLExtStat ext_status);
static void onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status);
public:
static LLPreviewLSL* getInstance(const LLUUID& uuid);
protected:
static void* createScriptEdPanel(void* userdata);
@ -195,6 +198,7 @@ protected:
LLScriptEdCore* mScriptEd;
// Can safely close only after both text and bytecode are uploaded
S32 mPendingUploads;
};
@ -277,6 +281,15 @@ protected:
S32 mPendingUploads;
static LLMap<LLUUID, LLLiveLSLEditor*> sInstances;
BOOL getIsModifiable() const { return mIsModifiable; } // Evaluated on load assert
private:
static void onMonoCheckboxClicked(LLUICtrl*, void* userdata);
BOOL monoChecked() const;
LLCheckBoxCtrl* mMonoCheckbox;
BOOL mIsModifiable;
};
#endif // LL_LLPREVIEWSCRIPT_H

View File

@ -3381,13 +3381,13 @@ void init_stat_view()
stat_barp->mDisplayBar = FALSE;
stat_barp->mDisplayMean = FALSE;
stat_barp = sim_statviewp->addStat("Script Perf", &(LLViewerStats::getInstance()->mSimLSLIPS));
stat_barp->setUnitLabel(" ips");
stat_barp = sim_statviewp->addStat("Script Events", &(LLViewerStats::getInstance()->mSimScriptEPS));
stat_barp->setUnitLabel(" eps");
stat_barp->mPrecision = 0;
stat_barp->mMinBar = 0.f;
stat_barp->mMaxBar = 100000.f;
stat_barp->mTickSpacing = 25000.f;
stat_barp->mLabelSpacing = 50000.f;
stat_barp->mMaxBar = 20000.f;
stat_barp->mTickSpacing = 2500.f;
stat_barp->mLabelSpacing = 5000.f;
stat_barp->mPerSec = FALSE;
stat_barp->mDisplayBar = FALSE;
stat_barp->mDisplayMean = FALSE;

View File

@ -6160,9 +6160,13 @@ class LLToolsSelectedScriptAction : public view_listener_t
{
std::string action = userdata.asString();
LLFloaterScriptQueue* queue = NULL;
if (action == "compile")
if (action == "compile mono")
{
queue = LLFloaterCompileQueue::create();
queue = LLFloaterCompileQueue::create(TRUE);
}
if (action == "compile lsl")
{
queue = LLFloaterCompileQueue::create(FALSE);
}
else if (action == "reset")
{
@ -6405,16 +6409,36 @@ BOOL enable_more_than_one_selected(void* )
return (LLSelectMgr::getInstance()->getSelection()->getObjectCount() > 1);
}
static bool is_editable_selected()
{
return (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL);
}
class LLEditableSelected : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
bool new_value = (LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() != NULL);
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
gMenuHolder->findControl(userdata["control"].asString())->setValue(is_editable_selected());
return true;
}
};
class LLEditableSelectedMono : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLViewerRegion* region = gAgent.getRegion();
if(region && gMenuHolder && gMenuHolder->findControl(userdata["control"].asString()))
{
bool have_cap = (! region->getCapability("UpdateScriptTaskInventory").empty());
bool selected = is_editable_selected() && have_cap;
gMenuHolder->findControl(userdata["control"].asString())->setValue(selected);
return true;
}
return false;
}
};
class LLToolsEnableTakeCopy : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
@ -7842,4 +7866,5 @@ void initialize_menus()
addMenu(new LLSomethingSelected(), "SomethingSelected");
addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD");
addMenu(new LLEditableSelected(), "EditableSelected");
addMenu(new LLEditableSelectedMono(), "EditableSelectedMono");
}

View File

@ -3464,8 +3464,8 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data)
case LL_SIM_STAT_NUMSCRIPTSACTIVE:
LLViewerStats::getInstance()->mSimActiveScripts.addValue(stat_value);
break;
case LL_SIM_STAT_LSLIPS:
LLViewerStats::getInstance()->mSimLSLIPS.addValue(stat_value);
case LL_SIM_STAT_SCRIPT_EPS:
LLViewerStats::getInstance()->mSimScriptEPS.addValue(stat_value);
break;
case LL_SIM_STAT_INPPS:
LLViewerStats::getInstance()->mSimInPPS.addValue(stat_value);

View File

@ -2145,7 +2145,7 @@ void LLViewerObject::deleteInventoryItem(const LLUUID& item_id)
}
void LLViewerObject::doUpdateInventory(
LLViewerInventoryItem* item,
LLPointer<LLViewerInventoryItem>& item,
U8 key,
bool is_new)
{
@ -2217,7 +2217,8 @@ void LLViewerObject::doUpdateInventory(
--mInventorySerialNum;
}
}
LLViewerInventoryItem* new_item = new LLViewerInventoryItem(item);
LLViewerInventoryItem* oldItem = item;
LLViewerInventoryItem* new_item = new LLViewerInventoryItem(oldItem);
new_item->setPermissions(perm);
mInventory->push_front(new_item);
doInventoryCallback();
@ -2608,6 +2609,21 @@ void LLViewerObject::updateInventory(
doUpdateInventory(task_item, key, is_new);
}
void LLViewerObject::updateInventoryLocal(LLInventoryItem* item, U8 key)
{
LLPointer<LLViewerInventoryItem> task_item =
new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(),
item->getAssetUUID(), item->getType(),
item->getInventoryType(),
item->getName(), item->getDescription(),
item->getSaleInfo(), item->getFlags(),
item->getCreationDate());
// do the internal logic
const bool is_new = false;
doUpdateInventory(task_item, key, is_new);
}
LLInventoryObject* LLViewerObject::getInventoryObject(const LLUUID& item_id)
{
LLInventoryObject* rv = NULL;

View File

@ -384,6 +384,7 @@ public:
// manager, so do no call updateInventory() from the selection
// manager until we have better iterators.
void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
void updateInventoryLocal(LLInventoryItem* item, U8 key); // Update without messaging.
LLInventoryObject* getInventoryObject(const LLUUID& item_id);
void getInventoryContents(InventoryObjectList& objects);
LLInventoryObject* getInventoryRoot();
@ -540,7 +541,7 @@ protected:
// do the update/caching logic. called by saveScript and
// updateInventory.
void doUpdateInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
void doUpdateInventory(LLPointer<LLViewerInventoryItem>& item, U8 key, bool is_new);
static LLViewerObject *createObject(const LLUUID &id, LLPCode pcode, LLViewerRegion *regionp);

View File

@ -63,7 +63,7 @@ public:
LLStat mSimFPS;
LLStat mSimPhysicsFPS;
LLStat mSimAgentUPS;
LLStat mSimLSLIPS;
LLStat mSimScriptEPS;
LLStat mSimFrameMsec;
LLStat mSimNetMsec;

View File

@ -231,8 +231,8 @@ TOOLMEDIAOPEN CURSOR "toolmediaopen.cur"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,19,1,83014
PRODUCTVERSION 1,19,1,83014
FILEVERSION 1,20,9,87416
PRODUCTVERSION 1,20,9,87416
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -249,12 +249,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Linden Lab"
VALUE "FileDescription", "Second Life"
VALUE "FileVersion", "1.19.1.83014"
VALUE "FileVersion", "1.20.9.87416"
VALUE "InternalName", "Second Life"
VALUE "LegalCopyright", "Copyright © 2001-2008, Linden Research, Inc."
VALUE "OriginalFilename", "SecondLife.exe"
VALUE "ProductName", "Second Life"
VALUE "ProductVersion", "1.19.1.83014"
VALUE "ProductVersion", "1.20.9.87416"
END
END
BLOCK "VarFileInfo"

View File

@ -0,0 +1,178 @@
/**
* @file asset_upload_queue_tut.cpp
* @brief Tests for newview/llassetuploadqueue.cpp
* Copyright (c) 2007, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "lltut.h"
#include "mock_http_client.h"
#include "../newview/llassetuploadqueue.cpp"
// Mock implementation.
LLAssetUploadResponder::LLAssetUploadResponder(const LLSD& post_data,
const LLUUID& vfile_id,
LLAssetType::EType asset_type)
{
}
LLAssetUploadResponder::LLAssetUploadResponder(const LLSD& post_data, const std::string& file_name)
{
}
LLAssetUploadResponder::~LLAssetUploadResponder()
{
}
void LLAssetUploadResponder::error(U32 statusNum, const std::string& reason)
{
}
void LLAssetUploadResponder::result(const LLSD& content)
{
}
void LLAssetUploadResponder::uploadUpload(const LLSD& content)
{
}
void LLAssetUploadResponder::uploadComplete(const LLSD& content)
{
}
void LLAssetUploadResponder::uploadFailure(const LLSD& content)
{
}
LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_data,
const LLUUID& vfile_id,
LLAssetType::EType asset_type) :
LLAssetUploadResponder(post_data, vfile_id, asset_type)
{
}
LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_data,
const std::string& file_name) :
LLAssetUploadResponder(post_data, file_name)
{
}
LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_data,
const std::string& file_name,
const LLUUID& queue_id) :
LLAssetUploadResponder(post_data, file_name)
{
}
void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content)
{
}
namespace tut
{
class asset_upload_queue_test_data : public MockHttpClient {};
typedef test_group<asset_upload_queue_test_data> asset_upload_queue_test;
typedef asset_upload_queue_test::object asset_upload_queue_object;
tut::asset_upload_queue_test asset_upload_queue("asset_upload_queue");
void queue(LLAssetUploadQueue& q, const std::string& filename)
{
LLUUID task_id;
LLUUID item_id;
BOOL is_running = FALSE;
BOOL is_target_mono = TRUE;
LLUUID queue_id;
q.queue(filename, task_id, item_id, is_running, is_target_mono, queue_id);
}
class LLTestSupplier : public LLAssetUploadQueueSupplier
{
public:
void set(LLAssetUploadQueue* queue) {mQueue = queue;}
virtual LLAssetUploadQueue* get() const
{
return mQueue;
}
private:
LLAssetUploadQueue* mQueue;
};
template<> template<>
void asset_upload_queue_object::test<1>()
{
setupTheServer();
reset();
LLTestSupplier* supplier = new LLTestSupplier();
LLAssetUploadQueue q("http://localhost:8888/test/success", supplier);
supplier->set(&q);
queue(q, "foo.bar");
ensure("upload queue not empty before request", q.isEmpty());
runThePump(10);
ensure("upload queue not empty after request", q.isEmpty());
}
template<> template<>
void asset_upload_queue_object::test<2>()
{
reset();
LLTestSupplier* supplier = new LLTestSupplier();
LLAssetUploadQueue q("http://localhost:8888/test/error", supplier);
supplier->set(&q);
queue(q, "foo.bar");
ensure("upload queue not empty before request", q.isEmpty());
runThePump(10);
ensure("upload queue not empty after request", q.isEmpty());
}
template<> template<>
void asset_upload_queue_object::test<3>()
{
reset();
LLTestSupplier* supplier = new LLTestSupplier();
LLAssetUploadQueue q("http://localhost:8888/test/timeout", supplier);
supplier->set(&q);
queue(q, "foo.bar");
ensure("upload queue not empty before request", q.isEmpty());
runThePump(10);
ensure("upload queue not empty after request", q.isEmpty());
}
template<> template<>
void asset_upload_queue_object::test<4>()
{
reset();
LLTestSupplier* supplier = new LLTestSupplier();
LLAssetUploadQueue q("http://localhost:8888/test/success", supplier);
supplier->set(&q);
queue(q, "foo.bar");
queue(q, "baz.bar");
ensure("upload queue empty before request", !q.isEmpty());
runThePump(10);
ensure("upload queue not empty before request", q.isEmpty());
runThePump(10);
ensure("upload queue not empty after request", q.isEmpty());
}
template<> template<>
void asset_upload_queue_object::test<5>()
{
reset();
LLTestSupplier* supplier = new LLTestSupplier();
LLAssetUploadQueue q("http://localhost:8888/test/success", supplier);
supplier->set(&q);
queue(q, "foo.bar");
runThePump(10);
ensure("upload queue not empty before request", q.isEmpty());
queue(q, "baz.bar");
ensure("upload queue not empty after request", q.isEmpty());
runThePump(10);
killServer();
}
}

View File

@ -0,0 +1,66 @@
/**
* @file mock_http_client.cpp
* @brief Framework for testing HTTP requests
* Copyright (c) 2007, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llsdhttpserver.h"
#include "lliohttpserver.h"
namespace tut
{
class SuccessNode : public LLHTTPNode
{
public:
void get(ResponsePtr r, const LLSD& context) const
{
LLSD result;
result["state"] = "complete";
result["test"] = "test";
r->result(result);
}
void post(ResponsePtr r, const LLSD& context, const LLSD& input) const
{
LLSD result;
result["state"] = "complete";
result["test"] = "test";
r->result(result);
}
};
class ErrorNode : public LLHTTPNode
{
public:
void get(ResponsePtr r, const LLSD& context) const
{ r->status(599, "Intentional error"); }
void post(ResponsePtr r, const LLSD& context, const LLSD& input) const
{ r->status(input["status"], input["reason"]); }
};
class TimeOutNode : public LLHTTPNode
{
public:
void get(ResponsePtr r, const LLSD& context) const
{
/* do nothing, the request will eventually time out */
}
};
LLSD storage;
class LLSDStorageNode : public LLHTTPNode
{
public:
LLSD get() const{ return storage; }
LLSD put(const LLSD& value) const{ storage = value; return LLSD(); }
};
LLHTTPRegistration<LLSDStorageNode> gStorageNode("/test/storage");
LLHTTPRegistration<SuccessNode> gSuccessNode("/test/success");
LLHTTPRegistration<ErrorNode> gErrorNode("/test/error");
LLHTTPRegistration<TimeOutNode> gTimeOutNode("/test/timeout");
}

View File

@ -0,0 +1,174 @@
/**
* @file mock_http_client.cpp
* @brief Framework for testing HTTP requests
* Copyright (c) 2007, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
* $/LicenseInfo$
*/
#include "llsdhttpserver.h"
#include "lliohttpserver.h"
#include "llhttpclient.h"
#include "llformat.h"
#include "llpipeutil.h"
#include "llpumpio.h"
namespace tut
{
struct MockHttpClient
{
public:
MockHttpClient()
{
apr_pool_create(&mPool, NULL);
mServerPump = new LLPumpIO(mPool);
mClientPump = new LLPumpIO(mPool);
LLHTTPClient::setPump(*mClientPump);
}
~MockHttpClient()
{
delete mServerPump;
delete mClientPump;
apr_pool_destroy(mPool);
}
void setupTheServer()
{
LLHTTPNode& root = LLIOHTTPServer::create(mPool, *mServerPump, 8888);
LLHTTPStandardServices::useServices();
LLHTTPRegistrar::buildAllServices(root);
}
void runThePump(float timeout = 100.0f)
{
LLTimer timer;
timer.setTimerExpirySec(timeout);
while(!mSawCompleted && !timer.hasExpired())
{
if (mServerPump)
{
mServerPump->pump();
mServerPump->callback();
}
if (mClientPump)
{
mClientPump->pump();
mClientPump->callback();
}
}
}
void killServer()
{
delete mServerPump;
mServerPump = NULL;
}
private:
apr_pool_t* mPool;
LLPumpIO* mServerPump;
LLPumpIO* mClientPump;
protected:
void ensureStatusOK()
{
if (mSawError)
{
std::string msg =
llformat("error() called when not expected, status %d",
mStatus);
fail(msg);
}
}
void ensureStatusError()
{
if (!mSawError)
{
fail("error() wasn't called");
}
}
LLSD getResult()
{
return mResult;
}
protected:
bool mSawError;
U32 mStatus;
std::string mReason;
bool mSawCompleted;
LLSD mResult;
bool mResultDeleted;
class Result : public LLHTTPClient::Responder
{
protected:
Result(MockHttpClient& client)
: mClient(client)
{
}
public:
static boost::intrusive_ptr<Result> build(MockHttpClient& client)
{
return boost::intrusive_ptr<Result>(new Result(client));
}
~Result()
{
mClient.mResultDeleted = true;
}
virtual void error(U32 status, const std::string& reason)
{
mClient.mSawError = true;
mClient.mStatus = status;
mClient.mReason = reason;
}
virtual void result(const LLSD& content)
{
mClient.mResult = content;
}
virtual void completed(
U32 status, const std::string& reason,
const LLSD& content)
{
LLHTTPClient::Responder::completed(status, reason, content);
mClient.mSawCompleted = true;
}
private:
MockHttpClient& mClient;
};
friend class Result;
protected:
void reset()
{
mSawError = false;
mStatus = 0;
mSawCompleted = false;
mResult.clear();
mResultDeleted = false;
}
LLHTTPClient::ResponderPtr newResult()
{
reset();
return Result::build(*this);
}
};
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<?xml version="1.0"?>
<llsd>
<map>
<key>installables</key>
@ -377,9 +377,9 @@
<key>linux</key>
<map>
<key>md5sum</key>
<string>589a8385979d2b0561daaec2148f8b77</string>
<string>f1161282d7fc11fbe17d0aa077ee054b</string>
<key>url</key>
<uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/google-linux-20080613.tar.bz2</uri>
<uri>http://int.codex.lindenlab.com/~babbage/install_pkgs/google-linux-20080617.tar.bz2</uri>
</map>
</map>
</map>
@ -411,9 +411,9 @@
<key>linux</key>
<map>
<key>md5sum</key>
<string>83eddf6114f1e306c61fbda16ad02f0c</string>
<string>21c16a74f8fc9a62e3ab944a6eb7403d</string>
<key>url</key>
<uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/gtk-atk-pango-glib-linux-20080613.tar.bz2</uri>
<uri>http://int.codex.lindenlab.com/~babbage/install_pkgs/gtk-atk-pango-glib-linux-20080616.tar.bz</uri>
</map>
<key>windows</key>
<map>
@ -556,6 +556,40 @@
</map>
</map>
</map>
<key>libmono</key>
<map>
<key>copyright</key>
<string>(C) 2005 Novell, Inc. http://www.novell.com</string>
<key>description</key>
<string>An open source implementation of the ECMA/ISO ECMA-334 Common L\
anguage Infrstructure (CLI) international standard</string>
<key>license</key>
<string>lgpl</string>
<key>packages</key>
<map>
<key>linux</key>
<map>
<key>md5sum</key>
<string>df73b95b0980e631ba1ecd930120699f</string>
<key>url</key>
<uri>http://int.codex.lindenlab.com/~daveh/install_pkgs/mono-linux-20080722.tar.bz2</uri>
</map>
<key>darwin</key>
<map>
<key>md5sum</key>
<string>39a803fcbe6f11b72358fc78b7777b6c</string>
<key>url</key>
<uri>http://int.codex.lindenlab.com/~daveh/install_pkgs/mono-darwin-20080724.tar.bz2</uri>
</map>
<key>windows</key>
<map>
<key>md5sum</key>
<string>7293312a6c76e5a38ec1b58ff87828d9</string>
<key>url</key>
<uri>http://int.codex.lindenlab.com/~daveh/install_pkgs/mono-windows-20080723.tar.bz2</uri>
</map>
</map>
</map>
<key>libpng</key>
<map>
<key>copyright</key>

View File

@ -5335,6 +5335,7 @@ version 2.0
{ ObjectID LLUUID }
{ ItemID LLUUID }
{ Running BOOL }
// { Mono BOOL } Added to LLSD message
}
}
@ -8851,4 +8852,4 @@ version 2.0
{ ObjectLocalID U32 }
{ IncludeInSearch BOOL }
}
}
}