|
|
|
@ -2182,6 +2182,9 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
# Название файла профиля директории
|
|
|
|
|
profDirNameFile = ".calculate_directory"
|
|
|
|
|
|
|
|
|
|
# стек глобальных переменных
|
|
|
|
|
stackGlobalVars = []
|
|
|
|
|
|
|
|
|
|
def __init__(self, objVar, servDir=False, dirsFilter=[], filesFilter=[]):
|
|
|
|
|
# Необрабатываемые директории
|
|
|
|
|
self.dirsFilter = dirsFilter
|
|
|
|
@ -2367,7 +2370,13 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
minus = True
|
|
|
|
|
strNum = strNum[1:]
|
|
|
|
|
if localVars.has_key(strNum):
|
|
|
|
|
num = localVars[strNum]
|
|
|
|
|
try:
|
|
|
|
|
num = int(localVars[strNum])
|
|
|
|
|
except:
|
|
|
|
|
print _("error in profile %s")%nameProfile
|
|
|
|
|
print _("error local var %s not int")\
|
|
|
|
|
%str(strNum)
|
|
|
|
|
cl_base.exit(1)
|
|
|
|
|
elif self.objVar.exists(strNum):
|
|
|
|
|
try:
|
|
|
|
|
num = int(self.objVar.Get(strNum))
|
|
|
|
@ -2619,6 +2628,79 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
textProfileTmp[resS.end():]
|
|
|
|
|
return textProfileTmp
|
|
|
|
|
|
|
|
|
|
def funcPush(funTxt,resS,localVars,textProfileTmp):
|
|
|
|
|
"""локальная функция записывает значение переменной
|
|
|
|
|
|
|
|
|
|
в стек глобальных переменных
|
|
|
|
|
"""
|
|
|
|
|
terms = funTxt[5:-1].replace(" ","").split(",")
|
|
|
|
|
# Название локальной переменной
|
|
|
|
|
nameLocVar = terms[0]
|
|
|
|
|
flagFoundVar = False
|
|
|
|
|
if nameLocVar in localVars.keys():
|
|
|
|
|
flagFoundVar = True
|
|
|
|
|
value = localVars[nameLocVar]
|
|
|
|
|
else:
|
|
|
|
|
try:
|
|
|
|
|
value = self.objVar.Get(nameLocVar)
|
|
|
|
|
flagFoundVar = True
|
|
|
|
|
except:
|
|
|
|
|
pass
|
|
|
|
|
if flagFoundVar:
|
|
|
|
|
# Если переменная существует
|
|
|
|
|
if len(terms) == 1:
|
|
|
|
|
self.stackGlobalVars.push(str(value))
|
|
|
|
|
else:
|
|
|
|
|
print _("error in profile %s")%nameProfile
|
|
|
|
|
print _("error profile term %s")%str(funTxt)
|
|
|
|
|
print _("error var %s exists")%str(nameLocVar)
|
|
|
|
|
cl_base.exit(1)
|
|
|
|
|
else:
|
|
|
|
|
# Если переменная не существует
|
|
|
|
|
if len(terms) == 1:
|
|
|
|
|
print _("error in profile %s")%nameProfile
|
|
|
|
|
print _("error profile term %s")%str(funTxt)
|
|
|
|
|
print _("error var %s not exists")%str(nameLocVar)
|
|
|
|
|
cl_base.exit(1)
|
|
|
|
|
elif len(terms) == 2:
|
|
|
|
|
value = terms[1].strip()
|
|
|
|
|
self.stackGlobalVars.push(str(value))
|
|
|
|
|
localVars[nameLocVar] = value
|
|
|
|
|
else:
|
|
|
|
|
print _("error in profile %s")%nameProfile
|
|
|
|
|
print _("error profile term %s")%str(funTxt)
|
|
|
|
|
cl_base.exit(1)
|
|
|
|
|
replace = ""
|
|
|
|
|
textProfileTmp = textProfileTmp[:resS.start()] + replace +\
|
|
|
|
|
textProfileTmp[resS.end():]
|
|
|
|
|
return textProfileTmp
|
|
|
|
|
|
|
|
|
|
def funcPop(funTxt,resS,localVars,textProfileTmp):
|
|
|
|
|
"""локальная функция получает значение
|
|
|
|
|
|
|
|
|
|
из стека глобальных переменных и присвает локальной переменной
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
terms = funTxt[4:-1].replace(" ","").split(",")
|
|
|
|
|
# Название локальной переменной
|
|
|
|
|
nameLocVar = terms[0]
|
|
|
|
|
if len(terms) == 1:
|
|
|
|
|
if self.stackGlobalVars:
|
|
|
|
|
localVars[nameLocVar] = self.stackGlobalVars.pop()
|
|
|
|
|
else:
|
|
|
|
|
print _("error in profile %s")%nameProfile
|
|
|
|
|
print _("error profile term %s")%str(funTxt)
|
|
|
|
|
print _("error, gloval variables stack is empty")
|
|
|
|
|
cl_base.exit(1)
|
|
|
|
|
else:
|
|
|
|
|
print _("error in profile %s")%nameProfile
|
|
|
|
|
print _("error profile term %s")%str(funTxt)
|
|
|
|
|
cl_base.exit(1)
|
|
|
|
|
replace = ""
|
|
|
|
|
textProfileTmp = textProfileTmp[:resS.start()] + replace +\
|
|
|
|
|
textProfileTmp[resS.end():]
|
|
|
|
|
return textProfileTmp
|
|
|
|
|
|
|
|
|
|
# Локальные переменные
|
|
|
|
|
localVars = {}
|
|
|
|
|
# Регулярное выражние для сложения
|
|
|
|
@ -2647,6 +2729,12 @@ class profile(_file, _terms, xmlShare):
|
|
|
|
|
elif funTxt[:5] == "case(":
|
|
|
|
|
textProfileTmp = funcCase(funTxt,resS,textProfileTmp)
|
|
|
|
|
resS = self._reFunc.search(textProfileTmp)
|
|
|
|
|
elif funTxt[:4] == "pop(":
|
|
|
|
|
textProfileTmp = funcPop(funTxt,resS,localVars,textProfileTmp)
|
|
|
|
|
resS = self._reFunc.search(textProfileTmp)
|
|
|
|
|
elif funTxt[:4] == "push(":
|
|
|
|
|
textProfileTmp = funcPush(funTxt,resS,localVars,textProfileTmp)
|
|
|
|
|
resS = self._reFunc.search(textProfileTmp)
|
|
|
|
|
else:
|
|
|
|
|
resS = False
|
|
|
|
|
return textProfileTmp
|
|
|
|
|