diff --git a/index.html b/index.html index 5f970c5..e022453 100644 --- a/index.html +++ b/index.html @@ -27,7 +27,7 @@ h1 { background: #2080C0; color: white; padding:25px 5% 8px; margin: 4% 7% 0px;
LSL PyOptimizer is a LSL2 script optimizer written in Python 2. Currently it only supports code memory optimization (no speed optimization), only for Mono (no LSO), and only for the Second Life flavour of LSL (no OpenSim etc.).
+LSL PyOptimizer is a LSL2 script optimizer written in Python 2.7. Currently it only supports code memory optimization (no speed optimization), only for Mono (no LSO), and only for the Second Life flavour of LSL (no OpenSim etc.).
The original LSL compiler does not do any optimizations whatsoever. Either the programmer does the optimization, or the scripts take more memory than necessary when writing something as simple as a = -1;
(yes, the sign takes code memory!).
switch()
statements, for compatibility with Firestorm.identifier[index]
), for compatibility with Firestorm.cpp
and for mcpp.#pragma
and #line
preprocessor directivescpp
and for mcpp (since 0.1.3alpha).#pragma
and #line
preprocessor directives (0.2.1beta).The project is hosted on GitHub. The latest version is available at: https://github.com/Sei-Lisa/LSL-PyOptimizer
-In order to run the program, you need Python 2 installed. Python 3 will not work. Download and install Python 2 if you don't have it already.
+In order to run the program, you need Python 2.7 installed. Python 3.x will not work. Download and install Python 2.7 if you don't have it already.
In versions 0.1.3alpha and below, there was a similar option called skippreproc
that merely skipped any preprocessor directives. That option is now removed.
The option inline
in the command line options enables a syntax extension that allows you to use functions as if they were macros. This option is active by default.
This feature is in an experimental stage. Use at your own risk. Currently, inlined functions in loop conditions don't work properly.
+ +To declare a function as inline, add the word inline
after the close parenthesis of the parameter list. For example, this definition:
say(string s) inline
+{
+ llOwnerSay(s);
+}
+
+
+allows you to use say
as if it were llOwnerSay
, without actually defining a new function in the optimized output. Of course, the same can be done with a preprocessor macro.
Caveats:
+ +___letters__numbers
. If you use names like these, you risk causing a name collision.The input script must be encoded in UTF-8. If you're using an editor, make sure it saves UTF-8.
-Running it by hand to optimize your scripts can be cumbersome. The intention is for it to act as a filter that is transparent to the user; however, as of this writing there's no support for any viewer or IDE, as it is still a young project. Run it without parameters to see the invocation help, for example with python main.py
. Redirect the output to a file if you want to store the result, possibly to open it with an editor and copy it to the clipboard. Or under X Window, if you install the package xclip, you can pipe the output directly to xclip -quiet -selection clipboard
to copy it to the clipboard, rather than using a file, so you can paste it into the viewer. It's a good idea to use the option --bom
to include a UTF-8 byte order mark that other applications can use to recognize the encoding. Examples:
Running it by hand to optimize your scripts can be cumbersome. The intention is for it to act as a filter that is transparent to the user; however, as of this writing there's no support for any viewer or IDE. Run it without parameters to see the invocation help, for example with python main.py
. Redirect the output to a file if you want to store the result, possibly to open it with an editor and copy it to the clipboard. Or under X Window, if you install the package xclip, you can pipe the output directly to xclip -quiet -selection clipboard
to copy it to the clipboard, rather than using a file, so you can paste it into the viewer. It's a good idea to use the option --bom
to include a UTF-8 byte order mark that other applications can use to recognize the encoding. Examples:
python main.py --bom myscript.lsl | xclip -quiet -selection clipboard
@@ -463,7 +489,7 @@ but this will cause an error:
to copy the optimized output to the clipboard. Under OS X, pbcopy
does the same as xclip
and clip
.
The clip
application does not recognize the byte order mark, therefore Windows users may need to execute chcp 65001
before using the optimizer, to switch their console to UTF-8 and make the clip
program work.
The clip
application does not recognize the byte order mark, therefore Windows users may need to execute chcp 65001
before using the optimizer, to switch their console to UTF-8 and make the clip
program work properly with non-ASCII characters.
An external preprocessor is supported. If your system has a GNU C Compiler suite already installed, then the cpp
that comes with it (or gcc
adding the -E
option) should be enough. If you don't have it, the recommended preprocessor is mcpp, because it's a standalone executable, easy to install. Download it from http://mcpp.sourceforge.net/download.html, unpack the executable somewhere in the system path (or specify the path to the executable every time with the --precmd
option of the program) and you're ready to go.