# AVSLib :: 'deprecated' package :: 'array' module
# Copyright (c) 2005 George Zarkadas (gzarkadas@users.sourceforge.net)

# This program is free software; you can redistribute it and/or modify it under the terms of 
# the GNU General Public License as published by the Free Software Foundation; either 
# version 2 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
# PURPOSE.  See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program; 
# if not, write to the "Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
# MA  02111-1307  USA"

DefineModule("avslib", "deprecated", "array")

global __load__ = Eval("""
	LoadModule("avslib", "base", "core")
	LoadModule("avslib", "string", "core")
	LoadModule("avslib", "array", "operators")
	LoadModule("avslib", "numeric", "functions")
	""")

# The following functions return an array with the results of applying the corresponding standard function 
# (second part of function's name, after the "Array") to all elements of the initial array.

Function ArrayFloor(string array) { return ArrayOpFunc(array, "Floor") }
Function ArrayCeil(string array) { return ArrayOpFunc(array, "Ceil") }
Function ArrayRound(string array) { return ArrayOpFunc(array, "Round") }
Function ArrayInt(string array) { return ArrayOpFunc(array, "Int") }

Function ArrayFloat(string array) { return ArrayOpFunc(array, "Float") }
Function ArrayFrac(string array) { return ArrayOpFunc(array, "Frac") }
Function ArrayAbs(string array) { return ArrayOpFunc(array, "Abs") }
Function ArraySign(string array) { return ArrayOpFunc(array, "Sign") }

Function ArraySin(string array) { return ArrayOpFunc(array, "Sin") }
Function ArrayCos(string array) { return ArrayOpFunc(array, "Cos") }
Function ArrayLog(string array) { return ArrayOpFunc(array, "Log") }
Function ArrayExp(string array) { return ArrayOpFunc(array, "Exp") }
Function ArrayPow(string array, float power) { return ArrayOpFunc(array, "Pow", String(power)) }
Function ArraySqrt(string array) { return ArrayOpFunc(array, "Sqrt") }

Function ArrayExpBs(string array, float base) { return ArrayOpFunc(array, "ExpBs", String(base)) }
Function ArrayExp10(string array) { return ArrayOpFunc(array, "Exp10") }

Function ArrayLogBs(string array, float base) { return ArrayOpFunc(array, "LogBs", String(base)) }
Function ArrayLog10(string array) { return ArrayOpFunc(array, "Log10") }

Function ArrayTan(string array) { return ArrayOpFunc(array, "Tan") }
Function ArrayCot(string array) { return ArrayOpFunc(array, "Cot") }

Function ArraySinh(string array) { return ArrayOpFunc(array, "Sinh") }
Function ArrayCosh(string array) { return ArrayOpFunc(array, "Cosh") }
Function ArrayTanh(string array) { return ArrayOpFunc(array, "Tanh") }
Function ArrayCoth(string array) { return ArrayOpFunc(array, "Coth") }

Function ArrayAnd(string array1, string array2)
{
	return ArrayOpArray(array1, array2, "&&")
}

Function ArrayOr(string array1, string array2) 
{
	return ArrayOpArray(array1, array2, "||")
}

Function ArrayXor(string array1, string array2)
{
	return ArrayOpArrayFunc(array1, array2, "__xor2")
}

Function ArrayUCase(string array) { return ArrayOpFunc(array, "UCase") }
Function ArrayLCase(string array) { return ArrayOpFunc(array, "LCase") }
Function ArrayRevStr(string array) { return ArrayOpFunc(array, "RevStr") }
Function ArrayStrLen(string array) { return ArrayOpFunc(array, "StrLen") }

Function ArrayFindStr(string array, string str_sought)
{ 
	return ArrayOpFunc(array, "FindStr", StrQuote(str_sought)) 
}

Function ArrayLeftStr(string array, int length)
{ 
	return ArrayOpFunc(array, "LeftStr", String(length)) 
}

Function ArrayRightStr(string array, int length)
{ 
	return ArrayOpFunc(array, "RightStr", String(length)) 
}

Function ArrayMidStr(string array, int start, int "length")
{ 
	xargs = String(start) + (Defined(length) ? "," + String(length) : "")
	return ArrayOpFunc(array, "MidStr", xargs) 
}
