Add command-line options to change default builtins and SEF table files.

This commit is contained in:
Sei Lisa 2017-04-28 23:43:15 +02:00
parent 2d78239d23
commit 0af2349ef9
2 changed files with 23 additions and 6 deletions

View file

@ -2668,13 +2668,19 @@ list lazy_list_set(list L, integer i, list v)
return self.parse(script, options)
def __init__(self, builtins = 'builtins.txt', seftable = 'seftable.txt'):
def __init__(self, builtins = None, seftable = None):
"""Reads the library."""
self.events = {}
self.constants = {}
self.funclibrary = {}
if builtins is None:
builtins = lslcommon.DataPath + 'builtins.txt'
if seftable is None:
seftable = lslcommon.DataPath + 'seftable.txt'
self.parse_directive_re = None
# Library read code
@ -2694,7 +2700,7 @@ list lazy_list_set(list L, integer i, list v)
parse_num_re = re.compile(r'^\s*(-?(?=[0-9]|\.[0-9])[0-9]*((?:\.[0-9]*)?(?:[Ee][+-]?[0-9]+)?))\s*$')
parse_str_re = re.compile(ur'^"((?:[^"\\]|\\.)*)"$')
f = open(lslcommon.DataPath + builtins, 'rb')
f = open(builtins, 'rb')
try:
linenum = 0
try:
@ -2850,7 +2856,7 @@ list lazy_list_set(list L, integer i, list v)
# that includes domain data (min, max) and possibly input
# parameter transformations e.g.
# llSensor(..., PI, ...) -> llSensor(..., 4, ...).
f = open(lslcommon.DataPath + seftable, 'rb')
f = open(seftable, 'rb')
try:
while True:
line = f.readline()