LSL preproc from NaCL viewer

Tank_Master 2012-03-03 20:42:59 -08:00
parent 275123d4ec
commit 5ce4e57a29
11 changed files with 1856 additions and 16 deletions

View File

@ -254,9 +254,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>98be22c8833aa2bca184b9fa09fbb82b</string>
<string>b32acce28e8f5dc404ff6d36c140ea65</string>
<key>url</key>
<string>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/boost-1.45.0-windows-20110124.tar.bz2</string>
<string>http://dl.dropbox.com/u/43361170/boost-1.45.0-windows-20120303.tar.bz2</string>
</map>
<key>name</key>
<string>windows</string>

View File

@ -539,10 +539,12 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
// check against words
llwchar prev = cur > base ? *(cur-1) : 0;
if( !isalnum( prev ) && (prev != '_') )
// NaCl - LSL Preprocessor
if( !isalnum( prev ) && (prev != '_') && (prev != '#'))
{
const llwchar* p = cur;
while( isalnum( *p ) || (*p == '_') )
while( isalnum( *p ) || (*p == '_') || (*p == '#') )
// NaCl End
{
p++;
}

View File

@ -2598,6 +2598,16 @@ void LLTextEditor::loadKeywords(const std::string& filename,
}
}
// NaCL - LSL Preprocessor
void LLTextEditor::addToken(LLKeywordToken::TOKEN_TYPE type,
const std::string& key,
const LLColor3& color,
const std::string& tool_tip)
{
mKeywords.addToken(type,key,color,tool_tip);
}
// NaCl End
void LLTextEditor::updateSegments()
{
if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly)

View File

@ -208,6 +208,12 @@ public:
const std::vector<std::string>& funcs,
const std::vector<std::string>& tooltips,
const LLColor3& func_color);
// NaCl - LSL Preprocessor
void addToken(LLKeywordToken::TOKEN_TYPE type,
const std::string& key,
const LLColor3& color,
const std::string& tool_tip = LLStringUtil::null);
// NaCl End
LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); }
LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); }

View File

@ -97,6 +97,7 @@ set(viewer_SOURCE_FILES
fskeywords.cpp
fslslbridge.cpp
fslslbridgerequest.cpp
fslslpreproc.cpp
fsfloaterprofile.cpp
fspanelprofile.cpp
fsradarlistctrl.cpp
@ -707,6 +708,7 @@ set(viewer_HEADER_FILES
fskeywords.h
fslslbridge.h
fslslbridgerequest.h
fslslpreproc.h
fsfloaterprofile.h
fspanelprofile.h
fsradarlistctrl.h

View File

@ -16732,6 +16732,83 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>4</integer>
</map>
<key>_NACL_LSLPreprocessor</key>
<map>
<key>Comment</key>
<string>LSL Preprocessor</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>_NACL_PreProcLSLOptimizer</key>
<map>
<key>Comment</key>
<string>LSL Optimizer</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>_NACL_PreProcLSLTextCompress</key>
<map>
<key>Comment</key>
<string>LSL Text Compress</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>_NACL_PreProcLSLLazyLists</key>
<map>
<key>Comment</key>
<string>LSL Lazy Lists</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>_NACL_PreProcLSLSwitch</key>
<map>
<key>Comment</key>
<string>LSL Switch</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>_NACL_PreProcEnableHDDInclude</key>
<map>
<key>Comment</key>
<string>orly</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>_NACL_PreProcHDDIncludeLocation</key>
<map>
<key>Comment</key>
<string>toast</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string></string>
</map>
<key>FSMarkObjects</key>
<map>
<key>Comment</key>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
/* Copyright (c) 2010
*
* Modular Systems All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* 3. Neither the name Modular Systems nor the names of its contributors
* may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY MODULAR SYSTEMS AND CONTRIBUTORS AS IS
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MODULAR SYSTEMS OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "llviewerprecompiledheaders.h"
#include "llpreviewscript.h"
#define DARWINPREPROC
//force preproc on mac
class FSLSLPreprocessor
{
public:
FSLSLPreprocessor(LLScriptEdCore* corep)
: mCore(corep), waving(FALSE), mClose(FALSE)
{}
static bool mono_directive(std::string& text, bool agent_inv = true);
std::string encode(std::string script);
std::string decode(std::string script);
std::string lslopt(std::string script);
std::string lslcomp(std::string script);
static LLUUID findInventoryByName(std::string name);
static void FSProcCacheCallback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type,
void *userdata, S32 result, LLExtStat extstat);
void preprocess_script(BOOL close = FALSE, BOOL defcache = FALSE);
void start_process();
void display_error(std::string err);
std::string uncollide_string_literals(std::string script);
//dual function, determines if files have been modified this session and if we have cached them
//also assetids exposed in-preprocessing as a predefined macro for use in include once style include files, e.g. #define THISFILE file_ ## __ASSETIDRAW__
//in case it isn't obvious, the viewer only sets the asset id on a successful script save (of a full perm script), or in preproc on-cache
//so this is only applicable to fully permissive scripts; which is just fine, since if it isn't full perm it isn't really useful as a include anyway.
//in the event of a no-trans script (only less than full thats readable), the server sends null key, and we will set a random uuid.
//This uuid should be overwritten if they edit that script, whether with the real id or null key is irrelevant in this case.
//theoretically, if the asset IDs were exposed for full perm scripts without downloading the script at least once, it would save unnecessary caching
//as this isn't the case I'm not going to preserve this structure across logins.
//(it seems rather dumb that readable scripts don't show the asset id without a DL, but thats beside the point.)
static std::map<std::string,LLUUID> cached_assetids;
static std::map<std::string,std::string> decollided_literals;
std::set<std::string> caching_files;
std::set<std::string> defcached_files;
bool mDefinitionCaching;
LLScriptEdCore* mCore;
BOOL waving;
BOOL mClose;
BOOL mHDDInclude;
std::string mMainScriptName;
};

View File

@ -92,6 +92,10 @@
#include "rlvlocks.h"
// [/RLVa:KB]
// NaCl - LSL Preprocessor
#include "fslslpreproc.h"
// NaCl End
const std::string HELLO_LSL =
"default\n"
"{\n"
@ -207,7 +211,17 @@ LLScriptEdCore::LLScriptEdCore(
setFollowsAll();
setBorderVisible(FALSE);
setXMLFilename("panel_script_ed.xml");
// NaCl - Script Preprocessor
static LLCachedControl<bool> _NACL_LSLPreprocessor(gSavedSettings,"_NACL_LSLPreprocessor", 0);
BOOL preproc = _NACL_LSLPreprocessor;
if(preproc)
{
setXMLFilename("panel_script_ed_preproc.xml");
mLSLProc = new FSLSLPreprocessor(this);
}
else
setXMLFilename("panel_script_ed.xml");
// NaCl End
llassert_always(mContainer != NULL);
}
@ -226,6 +240,7 @@ LLScriptEdCore::~LLScriptEdCore()
delete mLiveFile;
}
BOOL LLScriptEdCore::postBuild()
{
mLineCol=getChild<LLTextBox>("line_col");
@ -239,10 +254,24 @@ BOOL LLScriptEdCore::postBuild()
mEditor = getChild<LLViewerTextEditor>("Script Editor");
// NaCl - LSL Preprocessor
static LLCachedControl<bool> _NACL_LSLPreprocessor(gSavedSettings,"_NACL_LSLPreprocessor", 0);
BOOL preproc = _NACL_LSLPreprocessor;
if(preproc)
{
mPostEditor = getChild<LLViewerTextEditor>("Post Editor");
if(mPostEditor)
{
mPostEditor->setFollowsAll();
mPostEditor->setEnabled(TRUE);
}
}
// NaCl End
childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this);
childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,FALSE));
childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this));
initMenu();
@ -299,6 +328,66 @@ BOOL LLScriptEdCore::postBuild()
}
}
// NaCl - LSL Preprocessor
if(gSavedSettings.getBOOL("_NACL_LSLPreprocessor"))
if(mPostEditor)
{
mPostEditor->loadKeywords(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords.ini"), funcs, tooltips, color);
mEditor->addToken(LLKeywordToken::WORD,"#assert",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#define",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#elif",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#else",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#endif",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#error",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#ident",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#sccs",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#if",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#ifdef",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#ifndef",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#import",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#include",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#include_next",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#line",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#pragma",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#unassert",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#undef",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#warning",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"#",LLColor3(0.0f,0.0f,0.8f),
std::string("Preprocessor command. See Advanced menu of the script editor."));
if(gSavedSettings.getBOOL("_NACL_PreProcLSLSwitch"))
{
mEditor->addToken(LLKeywordToken::WORD,"switch",LLColor3(0.0f,0.0f,0.8f),
std::string("Switch statement. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"case",LLColor3(0.0f,0.0f,0.8f),
std::string("Switch case. See Advanced menu of the script editor."));
mEditor->addToken(LLKeywordToken::WORD,"break",LLColor3(0.0f,0.0f,0.8f),
std::string("Switch break. See Advanced menu of the script editor."));
}
//couldn'tr define in file because # represented a comment
}
// NaCl End
// Case-insensitive dictionary sort for primary keywords. We don't sort the secondary
// keywords. They're intelligently grouped in keywords.ini.
std::stable_sort( primary_keywords.begin(), primary_keywords.end(), LLSECKeywordCompare() );
@ -376,15 +465,50 @@ void LLScriptEdCore::initMenu()
menuItem->setEnableCallback(boost::bind(&LLScriptEdCore::enableSaveToFileMenu, this));
}
// NaCl - LSL Preprocessor
void LLScriptEdCore::onToggleProc(void* userdata)
{
LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
corep->mErrorList->setCommentText(std::string("Toggling the preprocessor will not take full effect unless you close and reopen this editor."));
corep->mErrorList->selectFirstItem();
gSavedSettings.setBOOL("_NACL_LSLPreprocessor",!gSavedSettings.getBOOL("_NACL_LSLPreprocessor"));
}
// NaCl End
void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid)
{
if (mEditor)
{
mEditor->setText(text);
// NaCl - LSL Preprocessor
std::string ntext = text;
if(gSavedSettings.getBOOL("_NACL_LSLPreprocessor"))
{
if(mPostEditor)mPostEditor->setText(ntext);
ntext = mLSLProc->decode(ntext);
}
LLStringUtil::replaceTabsWithSpaces(ntext, 4);
// NaCl End
mEditor->setText(ntext);
mHasScriptData = is_valid;
}
}
// NaCl - LSL Preprocessor
std::string LLScriptEdCore::getScriptText()
{
if(gSavedSettings.getBOOL("_NACL_LSLPreprocessor") && mPostEditor)
{
//return mPostEditor->getText();
return mPostScript;
}
else if (mEditor)
{
return mEditor->getText();
}
return std::string();
}
// NaCl End
bool LLScriptEdCore::loadScriptText(const std::string& filename)
{
if (filename.empty())
@ -442,7 +566,9 @@ bool LLScriptEdCore::writeToFile(const std::string& filename)
return false;
}
std::string utf8text = mEditor->getText();
// NaCl - LSL Preprocessor
std::string utf8text = this->getScriptText();
// NaCl End
// Special case for a completely empty script - stuff in one space so it can store properly. See SL-46889
if (utf8text.size() == 0)
@ -812,14 +938,36 @@ void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata)
}
void LLScriptEdCore::doSave( BOOL close_after_save )
{
// NaCl - LSL Preprocessor
if(gSavedSettings.getBOOL("_NACL_LSLPreprocessor"))
{
llinfos << "passing to preproc" << llendl;
this->mLSLProc->preprocess_script(close_after_save);
}
else
{
if( mSaveCallback )
{
mSaveCallback( mUserdata, close_after_save );
}
}
// NaCl End
}
// NaCl - LSL Preprocessor
void LLScriptEdCore::doSaveComplete( void* userdata, BOOL close_after_save )
{
LLViewerStats::getInstance()->incStat( LLViewerStats::ST_LSL_SAVE_COUNT );
//LLScriptEdCore* self = (LLScriptEdCore*) userdata;
if( mSaveCallback )
{
mSaveCallback( mUserdata, close_after_save );
}
}
// NaCl End
void LLScriptEdCore::openInExternalEditor()
{
@ -890,8 +1038,22 @@ void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data)
sscanf(line.c_str(), "%d %d", &row, &column);
//llinfos << "LLScriptEdCore::onErrorList() - " << row << ", "
//<< column << llendl;
self->mEditor->setCursor(row, column);
self->mEditor->setFocus(TRUE);
// NaCl - LSL Preprocessor
if(gSavedSettings.getBOOL("_NACL_LSLPreprocessor") && self->mPostEditor)
{
LLPanel* tab = self->getChild<LLPanel>("Preprocessed");
LLTabContainer* tabset = self->getChild<LLTabContainer>("Tabset");
if(tabset)tabset->selectTabByName("Preprocessed");
if(tab)tab->setFocus(TRUE);
self->mPostEditor->setFocus(TRUE);
self->mPostEditor->setCursor(row, column);
}
else
{
self->mEditor->setCursor(row, column);
self->mEditor->setFocus(TRUE);
}
// NaCl End
}
}
@ -957,7 +1119,16 @@ BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask)
if(mSaveCallback)
{
// don't close after saving
mSaveCallback(mUserdata, FALSE);
// NaCl - LSL Preprocessor
if (!hasChanged())
{
llinfos << "Save Not Needed" << llendl;
return TRUE;
}
doSave(FALSE);
// NaCl End
//mSaveCallback(mUserdata, FALSE);
}
return TRUE;
@ -1305,7 +1476,7 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/)
std::string filename = filepath + ".lsl";
mScriptEd->writeToFile(filename);
if (sync)
{
mScriptEd->sync();
@ -1314,13 +1485,30 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/)
const LLInventoryItem *inv_item = getItem();
// save it out to asset server
std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
// NaCL - LSL Preprocessor
BOOL domono = FSLSLPreprocessor::mono_directive(mScriptEd->getScriptText());
if(domono == FALSE)
{
LLSD row;
if(gSavedSettings.getBOOL("_NACL_SaveInventoryScriptsAsMono"))
{
row["columns"][0]["value"] = "Detected compile-as-LSL2 directive, but debug setting SaveInventoryScriptsAsMono overrided it.";
domono = TRUE;
}else row["columns"][0]["value"] = "Detected compile-as-LSL2 directive";
//domono = FALSE;
row["columns"][0]["font"] = "SANSSERIF_SMALL";
mScriptEd->mErrorList->addElement(row);
}
// NaCl End
if(inv_item)
{
getWindow()->incBusyCount();
mPendingUploads++;
if (!url.empty())
{
uploadAssetViaCaps(url, filename, mItemUUID);
// NaCL - LSL Preprocessor
uploadAssetViaCaps(url, filename, mItemUUID, domono);
}
else if (gAssetStorage)
{
@ -1331,7 +1519,8 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/)
void LLPreviewLSL::uploadAssetViaCaps(const std::string& url,
const std::string& filename,
const LLUUID& item_id)
const LLUUID& item_id,
bool mono)
{
llinfos << "Update Agent Inventory via capability" << llendl;
LLSD body;
@ -1433,8 +1622,11 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename,
// static
void LLPreviewLSL::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
void LLPreviewLSL::onSaveComplete(const LLUUID& iuuid, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed)
{
// NaCl - LSL Preprocessor
LLUUID asset_uuid = iuuid;
// NaCl End
LLScriptSaveInfo* info = reinterpret_cast<LLScriptSaveInfo*>(user_data);
if(0 == status)
{
@ -1445,6 +1637,10 @@ void LLPreviewLSL::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32
if(item)
{
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
// NaCl - LSL Preprocessor
if(asset_uuid.isNull())
asset_uuid.generate();
// NaCl End
new_item->setAssetUUID(asset_uuid);
new_item->setTransactionID(info->mTransactionID);
new_item->updateServer(FALSE);

View File

@ -49,6 +49,9 @@ class LLKeywordToken;
class LLVFS;
class LLViewerInventoryItem;
class LLScriptEdContainer;
// NaCl - LSL Preprocessor
class FSLSLPreprocessor;
// NaCl End
// Inner, implementation class. LLPreviewScript and LLLiveLSLEditor each own one of these.
class LLScriptEdCore : public LLPanel
@ -58,6 +61,9 @@ class LLScriptEdCore : public LLPanel
friend class LLLiveLSLEditor;
// friend class LLFloaterScriptSearch;
friend class LLScriptEdContainer;
// NaCl - LSL Preprocessor
friend class FSLSLPreprocessor;
// NaCl End
protected:
// Supposed to be invoked only by the container.
@ -82,6 +88,10 @@ public:
bool canLoadOrSaveToFile( void* userdata );
void setScriptText(const std::string& text, BOOL is_valid);
// NaCL - LSL Preprocessor
std::string getScriptText();
void doSaveComplete(void* userdata, BOOL close_after_save );
// NaCl End
bool loadScriptText(const std::string& filename);
bool writeToFile(const std::string& filename);
void sync();
@ -108,6 +118,9 @@ public:
virtual bool hasAccelerators() const { return true; }
private:
// NaCl - LSL Preprocessor
static void onToggleProc(void* userdata);
// NaCl End
void onBtnHelp();
void onBtnDynamicHelp();
void onBtnUndoChanges();
@ -148,6 +161,11 @@ private:
LLLiveLSLFile* mLiveFile;
LLTextBox* mLineCol;
LLView* mSaveBtn;
// NaCl - LSL Preprocessor
FSLSLPreprocessor* mLSLProc;
LLTextEditor* mPostEditor;
std::string mPostScript;
// NaCl End
LLScriptEdContainer* mContainer; // parent view
};
@ -187,9 +205,12 @@ protected:
virtual void loadAsset();
/*virtual*/ void saveIfNeeded(bool sync = true);
// NaCl - LSL Preprocessor
void uploadAssetViaCaps(const std::string& url,
const std::string& filename,
const LLUUID& item_id);
const LLUUID& item_id,
bool mono);
// NaCl End
void uploadAssetLegacy(const std::string& filename,
const LLUUID& item_id,
const LLTransactionID& tid);

View File

@ -0,0 +1,248 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
bevel_style="none"
border_style="line"
follows="left|top|right|bottom"
height="542"
layout="topleft"
left="0"
name="script panel"
width="497">
<panel.string
name="loading">
Loading...
</panel.string>
<panel.string
name="can_not_view">
You can not view or edit this script, since it has been set as &quot;no copy&quot;. You need full permissions to view or edit a script inside an object.
</panel.string>
<panel.string
name="public_objects_can_not_run">
Public Objects cannot run scripts
</panel.string>
<panel.string
name="script_running">
Running
</panel.string>
<panel.string
name="Title">
Script: [NAME]
</panel.string>
<panel.string
name="external_editor_not_set">
Select an editor by setting the environment variable LL_SCRIPT_EDITOR or the ExternalEditor setting.
</panel.string>
<menu_bar
bg_visible="false"
follows="left|top"
height="18"
layout="topleft"
left="0"
mouse_opaque="false"
name="script_menu"
width="476">
<menu
top="0"
height="62"
label="File"
layout="topleft"
left="0"
mouse_opaque="false"
name="File"
width="138">
<menu_item_call
label="Save"
layout="topleft"
name="Save" />
<menu_item_separator
layout="topleft" />
<menu_item_call
label="Revert All Changes"
layout="topleft"
name="Revert All Changes" />
</menu>
<menu
top="0"
height="198"
label="Edit"
layout="topleft"
mouse_opaque="false"
name="Edit"
width="139">
<menu_item_call
enabled="false"
label="Undo"
layout="topleft"
name="Undo" />
<menu_item_call
enabled="false"
label="Redo"
layout="topleft"
name="Redo" />
<menu_item_separator
layout="topleft" />
<menu_item_call
enabled="false"
label="Cut"
layout="topleft"
name="Cut" />
<menu_item_call
enabled="false"
label="Copy"
layout="topleft"
name="Copy" />
<menu_item_call
enabled="false"
label="Paste"
layout="topleft"
name="Paste" />
<menu_item_separator
layout="topleft"
name="separator2" />
<menu_item_call
label="Select All"
layout="topleft"
name="Select All" />
<menu_item_call
enabled="false"
label="Deselect"
layout="topleft"
name="Deselect" />
<menu_item_separator
layout="topleft"
name="separator3" />
<menu_item_call
label="Search / Replace..."
layout="topleft"
name="Search / Replace..." />
</menu>
<menu
top="0"
height="34"
label="Help"
layout="topleft"
mouse_opaque="false"
name="Help"
width="112">
<menu_item_call
label="Help..."
layout="topleft"
name="Help..." />
<menu_item_call
label="Keyword Help..."
layout="topleft"
name="Keyword Help..." />
</menu>
</menu_bar>
<tab_container
follows="all"
halign="left"
height="410"
left="0"
name="Tabset"
tab_position="top"
tab_width="100"
tab_padding_right="0"
tab_height="25"
top="521"
width="500">
<panel
bevel_style="none"
border_style="line"
follows="left|top|right|bottom"
height="376"
layout="topleft"
left="0"
name="Script"
label="Script"
width="490">
<text_editor
left="0"
type="string"
length="1"
follows="left|top|right|bottom"
font="Monospace"
height="376"
ignore_tab="false"
layout="topleft"
max_length="65536"
name="Script Editor"
text_readonly_color="DkGray"
width="487"
show_line_numbers="true"
word_wrap="true">
Loading...
</text_editor>
</panel>
<panel
bevel_style="none"
border_style="line"
follows="left|top|right|bottom"
height="376"
layout="topleft"
left="0"
name="Preprocessed"
label="Preprocessed"
width="490">
<text_editor
left="0"
type="string"
length="1"
follows="left|top|right|bottom"
font="Monospace"
height="376"
ignore_tab="false"
layout="topleft"
max_length="65536"
name="Post Editor"
text_readonly_color="DkGray"
width="487"
show_line_numbers="true"
word_wrap="true">
Loading...
</text_editor>
</panel>
</tab_container>
<scroll_list
top_pad="10"
left="0"
follows="left|right|bottom"
height="60"
layout="topleft"
name="lsl errors"
width="487" />
<text
follows="left|bottom"
height="12"
layout="topleft"
left="0"
name="line_col"
width="128" />
<combo_box
follows="left|bottom"
height="23"
label="Insert..."
layout="topleft"
name="Insert..."
width="128" />
<button
follows="right|bottom"
height="23"
label="Save"
label_selected="Save"
layout="topleft"
top_pad="-35"
right="487"
name="Save_btn"
width="81" />
<button
enabled="false"
follows="right|bottom"
height="23"
label="Edit..."
layout="topleft"
top_pad="-23"
right="400"
name="Edit_btn"
width="81" />
</panel>