Prepare the core scripts for OpenSim.

- Add Makefile and release creation instructions.
- Add a simple Python program to automate the OpenSim conversion based on markings in the code.
- Add .gitignore entries for the generated files.
- Add parentheses around assignments as required by OpenSim. This is done only to the core scripts.
- OpenSim isn't compatible with SL when there are conditions of type key. Those are all converted. Conditions of other types, except integer, are expanded for clarity and optimization, as they generate the same or better code that way, and currently the optimizer can do a better job when they are expanded.
- Floats in scientific notation need a dot.
- llParseStringXXXX doesn't work the same in OpenSim as in SL, when the separator is an Unicode codepoint that doesn't represent a character. For that reason, the internal separator, which is U+FFFD ("Replacement Character") is changed automatically by the Python program to U+001F (Unit Separator control character). For further safety, function strReplace is altered to use osReplaceString instead of llParseStringKeepNulls/llDumpList2String.

Furthermore, the ~ operator has the wrong precedence in OpenSim, but that was handled by a previous commit. Note that appearances of the ~ operator that were not preceded by a ! have only been replaced in the core scripts.
This commit is contained in:
Sei Lisa 2017-08-15 17:40:58 +02:00 committed by Sei-Lisa
parent 4278710ce8
commit 65c067cc30
18 changed files with 236 additions and 69 deletions

View file

@ -0,0 +1,30 @@
#!/usr/bin/env python
# coding: utf8
import sys, re
def prterr(s):
sys.stderr.write(s + "\n")
def main(argc, argv):
if argc < 2:
prterr(u'Need exactly 1 argument (input filename)')
return 1
# Regex that replaces a line by its OSS version when one's specified.
os_re = re.compile(r'^( *)(.*?) // OSS::(.*)$', re.MULTILINE)
f = open(argv[1], "r");
s = f.read()
f.close()
# The U+FFFD character that AVsitter uses causes problems in OpenSim.
# Replace it with U+001F (Unit Separator) which works fine.
s = s.replace(b'\xEF\xBF\xBD', b'\x1F')
s = os_re.sub(r'\1\3', s)
sys.stdout.write(s)
return 0
ret = main(len(sys.argv), sys.argv)
if ret is not None and ret > 0:
sys.exit(ret)