answer
stringlengths
15
1.25M
// modification, are permitted provided that the following conditions // are met: // documentation and/or other materials provided with the distribution. // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. description( "Tests that we do ToString conversions correctly when String.prototype.valueOf is initially fine but then gets clobbered, and was a dictionary all along." ); delete String.prototype.trim; delete String.prototype.toLowerCase; delete String.prototype.toLocaleUpperCase; for (var i = 0; i < 1000; ++i) String.prototype["a" + i] = 42; function foo(a) { for (var i = 0; i < 100; ++i) a = new String(a); return a; } var expected = "\"hello\""; for (var i = 0; i < 150; ++i) { if (i == 100) { String.prototype.toString = function() { return 42; } expected = "\"42\""; } shouldBe("\"\" + foo(\"hello\")", expected); }
// Always use -ffp-contract=off option to compile SLEEF. #include <stdint.h> #include <limits.h> #include <float.h> #define ENABLE_BUILTIN_MATH #ifndef ENABLE_BUILTIN_MATH #include <math.h> #define SQRTF sqrtf #else #define SQRTF __builtin_sqrtf #endif #include "misc.h" // debug prints using fprintf #define NDEBUG #if (defined(_MSC_VER)) #pragma fp_contract (off) #endif #include "helpers.h" static INLINE CONST int32_t floatToRawIntBits(float d) { union { float f; int32_t i; } tmp; tmp.f = d; return tmp.i; } static INLINE CONST float intBitsToFloat(int32_t i) { union { float f; int32_t i; } tmp; tmp.i = i; return tmp.f; } static INLINE CONST float fabsfk(float x) { return intBitsToFloat(0x7fffffffL & floatToRawIntBits(x)); } static INLINE CONST float mulsignf(float x, float y) { return intBitsToFloat(floatToRawIntBits(x) ^ (floatToRawIntBits(y) & (1 << 31))); } static INLINE CONST double copysignfk(double x, double y) { return intBitsToFloat((floatToRawIntBits(x) & ~(1 << 31)) ^ (floatToRawIntBits(y) & (1 << 31))); } static INLINE CONST float signf(float d) { return mulsignf(1, d); } static INLINE CONST float mlaf(float x, float y, float z) { return x * y + z; } static INLINE CONST float rintfk(float x) { return x < 0 ? (int)(x - 0.5f) : (int)(x + 0.5f); } static INLINE CONST int ceilfk(float x) { return (int)x + (x < 0 ? 0 : 1); } static INLINE CONST float fminfk(float x, float y) { return x < y ? x : y; } static INLINE CONST float fmaxfk(float x, float y) { return x > y ? x : y; } static INLINE CONST int xisintf(float x) { return (x == (int)x); } static INLINE CONST int xisnanf(float x) { return x != x; } static INLINE CONST int xisinff(float x) { return x == SLEEF_INFINITYf || x == -SLEEF_INFINITYf; } static INLINE CONST int xisminff(float x) { return x == -SLEEF_INFINITYf; } static INLINE CONST int xispinff(float x) { return x == SLEEF_INFINITYf; } static INLINE CONST int xisnegzerof(float x) { return floatToRawIntBits(x) == floatToRawIntBits(-0.0); } static INLINE CONST int xisnumberf(double x) { return !xisinff(x) && !xisnanf(x); } static INLINE CONST int ilogbkf(float d) { int m = d < 5.<API key>; d = m ? 1.<API key> * d : d; int q = (floatToRawIntBits(d) >> 23) & 0xff; q = m ? q - (64 + 0x7f) : q - 0x7f; return q; } // vilogb2kf is similar to ilogbkf, but the argument has to be a // normalized FP value. static INLINE CONST int ilogb2kf(float d) { return ((floatToRawIntBits(d) >> 23) & 0xff) - 0x7f; } EXPORT CONST int xilogbf(float d) { int e = ilogbkf(fabsfk(d)); e = d == 0.0f ? SLEEF_FP_ILOGB0 : e; e = xisnanf(d) ? SLEEF_FP_ILOGBNAN : e; e = xisinff(d) ? INT_MAX : e; return e; } static INLINE CONST float pow2if(int q) { return intBitsToFloat(((int32_t)(q + 0x7f)) << 23); } static INLINE CONST float ldexpkf(float x, int q) { float u; int m; m = q >> 31; m = (((m + q) >> 6) - m) << 4; q = q - (m << 2); m += 127; m = m < 0 ? 0 : m; m = m > 255 ? 255 : m; u = intBitsToFloat(((int32_t)m) << 23); x = x * u * u * u * u; u = intBitsToFloat(((int32_t)(q + 0x7f)) << 23); return x * u; } static INLINE CONST float ldexp2kf(float d, int e) { // faster than ldexpkf, short reach return d * pow2if(e >> 1) * pow2if(e - (e >> 1)); } static INLINE CONST float ldexp3kf(float d, int e) { // very fast, no denormal return intBitsToFloat(floatToRawIntBits(d) + (e << 23)); } #ifndef NDEBUG static int checkfp(float x) { if (xisinff(x) || xisnanf(x)) return 1; return 0; } #endif static INLINE CONST float upperf(float d) { return intBitsToFloat(floatToRawIntBits(d) & 0xfffff000); } static INLINE CONST Sleef_float2 df(float h, float l) { Sleef_float2 ret; ret.x = h; ret.y = l; return ret; } static INLINE CONST Sleef_float2 dfx(double d) { Sleef_float2 ret; ret.x = d; ret.y = d - ret.x; return ret; } static INLINE CONST Sleef_float2 dfnormalize_f2_f2(Sleef_float2 t) { Sleef_float2 s; s.x = t.x + t.y; s.y = t.x - s.x + t.y; return s; } static INLINE CONST Sleef_float2 dfscale_f2_f2_f(Sleef_float2 d, float s) { Sleef_float2 r; r.x = d.x * s; r.y = d.y * s; return r; } static INLINE CONST Sleef_float2 dfneg_f2_f2(Sleef_float2 d) { Sleef_float2 r; r.x = -d.x; r.y = -d.y; return r; } static INLINE CONST Sleef_float2 dfabs_f2_f2(Sleef_float2 x) { return df(x.x < 0 ? -x.x : x.x, x.x < 0 ? -x.y : x.y); } static INLINE CONST Sleef_float2 dfadd_f2_f_f(float x, float y) { // |x| >= |y| Sleef_float2 r; #ifndef NDEBUG if (!(checkfp(x) || checkfp(y) || fabsfk(x) >= fabsfk(y))) fprintf(stderr, "[dfadd_f2_f_f : %g, %g]", x, y); #endif r.x = x + y; r.y = x - r.x + y; return r; } static INLINE CONST Sleef_float2 dfadd2_f2_f_f(float x, float y) { Sleef_float2 r; r.x = x + y; float v = r.x - x; r.y = (x - (r.x - v)) + (y - v); return r; } static INLINE CONST Sleef_float2 dfadd_f2_f2_f(Sleef_float2 x, float y) { // |x| >= |y| Sleef_float2 r; #ifndef NDEBUG if (!(checkfp(x.x) || checkfp(y) || fabsfk(x.x) >= fabsfk(y))) fprintf(stderr, "[dfadd_f2_f2_f : %g %g]", x.x, y); #endif r.x = x.x + y; r.y = x.x - r.x + y + x.y; return r; } static INLINE CONST Sleef_float2 dfadd_f2_f_f2(float x, Sleef_float2 y) { // |x| >= |y| Sleef_float2 r; #ifndef NDEBUG if (!(checkfp(x) || checkfp(y.x) || fabsfk(x) >= fabsfk(y.x))) { fprintf(stderr, "[dfadd_f2_f_f2 : %g %g]\n", x, y.x); fflush(stderr); } #endif r.x = x + y.x; r.y = x - r.x + y.x + y.y; return r; } static INLINE CONST Sleef_float2 dfadd2_f2_f2_f(Sleef_float2 x, float y) { // |x| >= |y| Sleef_float2 r; r.x = x.x + y; float v = r.x - x.x; r.y = (x.x - (r.x - v)) + (y - v); r.y += x.y; return r; } static INLINE CONST Sleef_float2 dfadd2_f2_f_f2(float x, Sleef_float2 y) { Sleef_float2 r; r.x = x + y.x; float v = r.x - x; r.y = (x - (r.x - v)) + (y.x - v) + y.y; return r; } static INLINE CONST Sleef_float2 dfadd_f2_f2_f2(Sleef_float2 x, Sleef_float2 y) { // |x| >= |y| Sleef_float2 r; #ifndef NDEBUG if (!(checkfp(x.x) || checkfp(y.x) || fabsfk(x.x) >= fabsfk(y.x))) fprintf(stderr, "[dfadd_f2_f2_f2 : %g %g]", x.x, y.x); #endif r.x = x.x + y.x; r.y = x.x - r.x + y.x + x.y + y.y; return r; } static INLINE CONST Sleef_float2 dfadd2_f2_f2_f2(Sleef_float2 x, Sleef_float2 y) { Sleef_float2 r; r.x = x.x + y.x; float v = r.x - x.x; r.y = (x.x - (r.x - v)) + (y.x - v); r.y += x.y + y.y; return r; } static INLINE CONST Sleef_float2 dfsub_f2_f2_f2(Sleef_float2 x, Sleef_float2 y) { // |x| >= |y| Sleef_float2 r; #ifndef NDEBUG if (!(checkfp(x.x) || checkfp(y.x) || fabsfk(x.x) >= fabsfk(y.x))) fprintf(stderr, "[dfsub_f2_f2_f2 : %g %g]", x.x, y.x); #endif r.x = x.x - y.x; r.y = x.x - r.x - y.x + x.y - y.y; return r; } static INLINE CONST Sleef_float2 dfdiv_f2_f2_f2(Sleef_float2 n, Sleef_float2 d) { float t = 1.0f / d.x; float dh = upperf(d.x), dl = d.x - dh; float th = upperf(t ), tl = t - th; float nhh = upperf(n.x), nhl = n.x - nhh; Sleef_float2 q; q.x = n.x * t; float u = -q.x + nhh * th + nhh * tl + nhl * th + nhl * tl + q.x * (1 - dh * th - dh * tl - dl * th - dl * tl); q.y = t * (n.y - q.x * d.y) + u; return q; } static INLINE CONST Sleef_float2 dfmul_f2_f_f(float x, float y) { float xh = upperf(x), xl = x - xh; float yh = upperf(y), yl = y - yh; Sleef_float2 r; r.x = x * y; r.y = xh * yh - r.x + xl * yh + xh * yl + xl * yl; return r; } static INLINE CONST Sleef_float2 dfmul_f2_f2_f(Sleef_float2 x, float y) { float xh = upperf(x.x), xl = x.x - xh; float yh = upperf(y ), yl = y - yh; Sleef_float2 r; r.x = x.x * y; r.y = xh * yh - r.x + xl * yh + xh * yl + xl * yl + x.y * y; return r; } static INLINE CONST Sleef_float2 dfmul_f2_f2_f2(Sleef_float2 x, Sleef_float2 y) { float xh = upperf(x.x), xl = x.x - xh; float yh = upperf(y.x), yl = y.x - yh; Sleef_float2 r; r.x = x.x * y.x; r.y = xh * yh - r.x + xl * yh + xh * yl + xl * yl + x.x * y.y + x.y * y.x; return r; } static INLINE CONST float dfmul_f_f2_f2(Sleef_float2 x, Sleef_float2 y) { float xh = upperf(x.x), xl = x.x - xh; float yh = upperf(y.x), yl = y.x - yh; return x.y * yh + xh * y.y + xl * yl + xh * yl + xl * yh + xh * yh; } static INLINE CONST Sleef_float2 dfsqu_f2_f2(Sleef_float2 x) { float xh = upperf(x.x), xl = x.x - xh; Sleef_float2 r; r.x = x.x * x.x; r.y = xh * xh - r.x + (xh + xh) * xl + xl * xl + x.x * (x.y + x.y); return r; } static INLINE CONST float dfsqu_f_f2(Sleef_float2 x) { float xh = upperf(x.x), xl = x.x - xh; return xh * x.y + xh * x.y + xl * xl + (xh * xl + xh * xl) + xh * xh; } static INLINE CONST Sleef_float2 dfrec_f2_f(float d) { float t = 1.0f / d; float dh = upperf(d), dl = d - dh; float th = upperf(t), tl = t - th; Sleef_float2 q; q.x = t; q.y = t * (1 - dh * th - dh * tl - dl * th - dl * tl); return q; } static INLINE CONST Sleef_float2 dfrec_f2_f2(Sleef_float2 d) { float t = 1.0f / d.x; float dh = upperf(d.x), dl = d.x - dh; float th = upperf(t ), tl = t - th; Sleef_float2 q; q.x = t; q.y = t * (1 - dh * th - dh * tl - dl * th - dl * tl - d.y * t); return q; } static INLINE CONST Sleef_float2 dfsqrt_f2_f2(Sleef_float2 d) { float t = SQRTF(d.x + d.y); return dfscale_f2_f2_f(dfmul_f2_f2_f2(dfadd2_f2_f2_f2(d, dfmul_f2_f_f(t, t)), dfrec_f2_f(t)), 0.5f); } static INLINE CONST Sleef_float2 dfsqrt_f2_f(float d) { float t = SQRTF(d); return dfscale_f2_f2_f(dfmul_f2_f2_f2(dfadd2_f2_f_f2(d, dfmul_f2_f_f(t, t)), dfrec_f2_f(t)), 0.5); } EXPORT CONST float xsinf(float d) { int q; float u, s, t = d; q = (int)rintfk(d * (float)M_1_PI); d = mlaf(q, -PI_Af, d); d = mlaf(q, -PI_Bf, d); d = mlaf(q, -PI_Cf, d); d = mlaf(q, -PI_Df, d); s = d * d; if (floatToRawIntBits(d) == floatToRawIntBits(-0.0f)) s = -0.0f; if ((q & 1) != 0) d = -d; u = 2.<API key>; u = mlaf(u, s, -0.<API key>); u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, -0.<API key>); u = mlaf(s, u * d, d); if (xisnegzerof(t) || fabsfk(t) > TRIGRANGEMAXf) u = -0.0f; if (xisinff(t)) u = SLEEF_NANf; return u; } EXPORT CONST float xsinf_u1(float d) { int q; float u; Sleef_float2 s, t, x; if (fabsfk(d) < TRIGRANGEMAX2f) { q = (int)rintfk(d * (float)M_1_PI); u = mlaf(q, -PI_A2f, d); s = dfadd2_f2_f_f(u, q * (-PI_B2f)); s = dfadd_f2_f2_f(s, q * (-PI_C2f)); } else { Sleef_float2 dfq = dfmul_f2_f2_f(df(M_1_PI, M_1_PI - (float)M_1_PI), d); float t = rintfk(dfq.x * (1.0f / (1 << 16))); dfq.y = rintfk(dfq.x - t * (1 << 16) + dfq.y); q = (int)dfq.y; dfq.x = t * (1 << 16); dfq = dfnormalize_f2_f2(dfq); s = dfadd2_f2_f_f2 (d, dfmul_f2_f2_f(dfq, -PI_A3f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_B3f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_C3f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_D3f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_E3f)); s = dfnormalize_f2_f2(s); } t = s; s = dfsqu_f2_f2(s); u = 2.<API key>; u = mlaf(u, s.x, -0.<API key>); u = mlaf(u, s.x, 0.<API key>); x = dfadd_f2_f_f2(1, dfmul_f2_f2_f2(dfadd_f2_f_f(-0.<API key>, u * s.x), s)); u = dfmul_f_f2_f2(t, x); if ((q & 1) != 0) u = -u; if (!xisinff(d) && (xisnegzerof(d) || fabsfk(d) > TRIGRANGEMAX3f)) u = -0.0f; return u; } EXPORT CONST float xcosf(float d) { int q; float u, s, t = d; q = 1 + 2*(int)rintfk(d * (float)M_1_PI - 0.5f); d = mlaf(q, -PI_Af*0.5f, d); d = mlaf(q, -PI_Bf*0.5f, d); d = mlaf(q, -PI_Cf*0.5f, d); d = mlaf(q, -PI_Df*0.5f, d); s = d * d; if ((q & 2) == 0) d = -d; u = 2.<API key>; u = mlaf(u, s, -0.<API key>); u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, -0.<API key>); u = mlaf(s, u * d, d); if (fabsfk(t) > TRIGRANGEMAXf) u = 1.0f; if (xisinff(t)) u = SLEEF_NANf; return u; } EXPORT CONST float xcosf_u1(float d) { float u; Sleef_float2 s, t, x; int q; d = fabsfk(d); if (d < TRIGRANGEMAX2f) { float dq = mlaf(rintfk(d * (float)M_1_PI - 0.5f), 2, 1); q = (int)dq; s = dfadd2_f2_f_f (d, dq * (-PI_A2f*0.5f)); s = dfadd2_f2_f2_f(s, dq * (-PI_B2f*0.5f)); s = dfadd2_f2_f2_f(s, dq * (-PI_C2f*0.5f)); } else { Sleef_float2 dfq = dfadd2_f2_f2_f(dfmul_f2_f2_f(df(M_1_PI, M_1_PI - (float)M_1_PI), d), -0.5f); float t = rintfk(dfq.x * (1.0f / (1 << 16))); dfq.y = rintfk(dfq.x - t * (1 << 16) + dfq.y) * 2 + 1; q = (int)dfq.y; dfq.x = t * (1 << 17); dfq = dfnormalize_f2_f2(dfq); s = dfadd2_f2_f_f2 (d, dfmul_f2_f2_f(dfq, -PI_A3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_B3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_C3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_D3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_E3f*0.5f)); s = dfnormalize_f2_f2(s); } t = s; s = dfsqu_f2_f2(s); u = 2.<API key>; u = mlaf(u, s.x, -0.<API key>); u = mlaf(u, s.x, 0.<API key>); x = dfadd_f2_f_f2(1, dfmul_f2_f2_f2(dfadd_f2_f_f(-0.<API key>, u * s.x), s)); u = dfmul_f_f2_f2(t, x); if ((((int)q) & 2) == 0) u = -u; if (!xisinff(d) && d > TRIGRANGEMAX3f) u = 1.0f; return u; } EXPORT CONST Sleef_float2 xsincosf(float d) { int q; float u, s, t; Sleef_float2 r; q = (int)rintfk(d * ((float)(2 * M_1_PI))); s = d; s = mlaf(q, -PI_Af*0.5f, s); s = mlaf(q, -PI_Bf*0.5f, s); s = mlaf(q, -PI_Cf*0.5f, s); s = mlaf(q, -PI_Df*0.5f, s); t = s; s = s * s; u = -0.<API key>; u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, -0.<API key>); u = u * s * t; r.x = t + u; if (xisnegzerof(d)) r.x = -0.0f; u = -2.<API key>; u = mlaf(u, s, 2.<API key>); u = mlaf(u, s, -0.<API key>); u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, -0.5f); r.y = u * s + 1; if ((q & 1) != 0) { s = r.y; r.y = r.x; r.x = s; } if ((q & 2) != 0) { r.x = -r.x; } if (((q+1) & 2) != 0) { r.y = -r.y; } if (fabsfk(d) > TRIGRANGEMAXf) { r.x = 0; r.y = 1; } if (xisinff(d)) { r.x = r.y = SLEEF_NANf; } return r; } EXPORT CONST Sleef_float2 xsincosf_u1(float d) { int q; float u; Sleef_float2 r, s, t, x; if (fabsfk(d) < TRIGRANGEMAX2f) { q = (int)rintfk(d * (float)(2 * M_1_PI)); u = mlaf(q, -PI_A2f*0.5f, d); s = dfadd2_f2_f_f(u, q * (-PI_B2f*0.5f)); s = dfadd_f2_f2_f(s, q * (-PI_C2f*0.5f)); } else { Sleef_float2 dfq = dfmul_f2_f2_f(df((2 * M_1_PI), (2 * M_1_PI) - (float)(2 * M_1_PI)), d); float t = rintfk(dfq.x * (1.0f / (1 << 16))); dfq.y = rintfk(dfq.x - t * (1 << 16) + dfq.y); q = (int)dfq.y; dfq.x = t * (1 << 16); dfq = dfnormalize_f2_f2(dfq); s = dfadd2_f2_f_f2 (d, dfmul_f2_f2_f(dfq, -PI_A3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_B3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_C3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_D3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_E3f*0.5f)); s = dfnormalize_f2_f2(s); } t = s; s.x = dfsqu_f_f2(s); u = -0.<API key>; u = mlaf(u, s.x, 0.<API key>); u = mlaf(u, s.x, -0.<API key>); u *= s.x * t.x; x = dfadd_f2_f2_f(t, u); r.x = x.x + x.y; if (xisnegzerof(d)) r.x = -0.0f; u = -2.<API key>; u = mlaf(u, s.x, 2.<API key>); u = mlaf(u, s.x, -0.<API key>); u = mlaf(u, s.x, 0.<API key>); u = mlaf(u, s.x, -0.5f); x = dfadd_f2_f_f2(1, dfmul_f2_f_f(s.x, u)); r.y = x.x + x.y; if ((q & 1) != 0) { u = r.y; r.y = r.x; r.x = u; } if ((q & 2) != 0) { r.x = -r.x; } if (((q+1) & 2) != 0) { r.y = -r.y; } if (fabsfk(d) > TRIGRANGEMAX3f) { r.x = 0; r.y = 1; } if (xisinff(d)) { r.x = r.y = SLEEF_NAN; } return r; } EXPORT CONST Sleef_float2 xsincospif_u05(float d) { float u, s, t; Sleef_float2 r, x, s2; u = d * 4; int q = ceilfk(u) & ~(int)1; s = u - (float)q; t = s; s = s * s; s2 = dfmul_f2_f_f(t, t); u = +0.3093842054e-6; u = mlaf(u, s, -0.3657307388e-4); u = mlaf(u, s, +0.2490393585e-2); x = dfadd2_f2_f_f2(u * s, df(-0.<API key>, -1.<API key>)); x = dfadd2_f2_f2_f2(dfmul_f2_f2_f2(s2, x), df(0.<API key>, -2.<API key>)); x = dfmul_f2_f2_f(x, t); r.x = x.x + x.y; if (xisnegzerof(d)) r.x = -0.0f; u = -0.2430611801e-7; u = mlaf(u, s, +0.3590577080e-5); u = mlaf(u, s, -0.3259917721e-3); x = dfadd2_f2_f_f2(u * s, df(0.<API key>, 4.<API key>)); x = dfadd2_f2_f2_f2(dfmul_f2_f2_f2(s2, x), df(-0.<API key>, -9.<API key>)); x = dfadd2_f2_f2_f(dfmul_f2_f2_f2(x, s2), 1); r.y = x.x + x.y; if ((q & 2) != 0) { s = r.y; r.y = r.x; r.x = s; } if ((q & 4) != 0) { r.x = -r.x; } if (((q+2) & 4) != 0) { r.y = -r.y; } if (fabsfk(d) > TRIGRANGEMAXf/4) { r.x = 0; r.y = 1; } if (xisinff(d)) { r.x = r.y = SLEEF_NANf; } return r; } EXPORT CONST Sleef_float2 xsincospif_u35(float d) { float u, s, t; Sleef_float2 r; u = d * 4; int q = ceilfk(u) & ~(int)1; s = u - (float)q; t = s; s = s * s; u = -0.3600925265e-4; u = mlaf(u, s, +0.2490088111e-2); u = mlaf(u, s, -0.8074551076e-1); u = mlaf(u, s, +0.7853981853e+0); r.x = u * t; u = +0.3539815225e-5; u = mlaf(u, s, -0.3259574005e-3); u = mlaf(u, s, +0.1585431583e-1); u = mlaf(u, s, -0.3084251285e+0); u = mlaf(u, s, 1); r.y = u; if ((q & 2) != 0) { s = r.y; r.y = r.x; r.x = s; } if ((q & 4) != 0) { r.x = -r.x; } if (((q+2) & 4) != 0) { r.y = -r.y; } if (fabsfk(d) > TRIGRANGEMAXf/4) { r.x = 0; r.y = 1; } if (xisinff(d)) { r.x = r.y = SLEEF_NANf; } return r; } EXPORT CONST float xtanf(float d) { int q; float u, s, x; q = (int)rintfk(d * (float)(2 * M_1_PI)); x = d; x = mlaf(q, -PI_Af*0.5f, x); x = mlaf(q, -PI_Bf*0.5f, x); x = mlaf(q, -PI_Cf*0.5f, x); x = mlaf(q, -PI_Df*0.5f, x); s = x * x; if ((q & 1) != 0) x = -x; u = 0.<API key>; u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, 0.<API key>); u = mlaf(s, u * x, x); if ((q & 1) != 0) u = 1.0f / u; if (xisinff(d)) u = SLEEF_NANf; return u; } EXPORT CONST float xtanf_u1(float d) { int q; float u; Sleef_float2 s, t, x; if (fabsfk(d) < TRIGRANGEMAX2f) { q = (int)rintfk(d * (float)(2 * M_1_PI)); u = mlaf(q, -PI_A2f*0.5f, d); s = dfadd2_f2_f_f(u, q * (-PI_B2f*0.5f)); s = dfadd_f2_f2_f(s, q * (-PI_C2f*0.5f)); } else { Sleef_float2 dfq = dfmul_f2_f2_f(df((2 * M_1_PI), (2 * M_1_PI) - (float)(2 * M_1_PI)), d); float t = rintfk(dfq.x * (1.0f / (1 << 16))); dfq.y = rintfk(dfq.x - t * (1 << 16) + dfq.y); q = (int)dfq.y; dfq.x = t * (1 << 16); dfq = dfnormalize_f2_f2(dfq); s = dfadd2_f2_f_f2 (d, dfmul_f2_f2_f(dfq, -PI_A3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_B3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_C3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_D3f*0.5f)); s = dfnormalize_f2_f2(s); s = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f(dfq, -PI_E3f*0.5f)); s = dfnormalize_f2_f2(s); } if ((q & 1) != 0) s = dfneg_f2_f2(s); t = s; s = dfsqu_f2_f2(s); s = dfnormalize_f2_f2(s); u = 0.<API key>; u = mlaf(u, s.x, -8.<API key>); u = mlaf(u, s.x, 0.<API key>); u = mlaf(u, s.x, 0.<API key>); u = mlaf(u, s.x, 0.<API key>); x = dfadd_f2_f_f(0.<API key>, u * s.x); x = dfadd_f2_f_f2(1, dfmul_f2_f2_f2(dfadd_f2_f_f2(0.<API key>, dfmul_f2_f2_f2(s, x)), s)); x = dfmul_f2_f2_f2(t, x); if ((q & 1) != 0) x = dfrec_f2_f2(x); u = x.x + x.y; if (!xisinff(d) && (xisnegzerof(d) || fabsfk(d) > TRIGRANGEMAX3f)) u = -0.0f; return u; } EXPORT CONST float xatanf(float s) { float t, u; int q = 0; if (signf(s) == -1) { s = -s; q = 2; } if (s > 1) { s = 1.0f / s; q |= 1; } t = s * s; u = 0.<API key>; u = mlaf(u, t, -0.<API key>); u = mlaf(u, t, 0.<API key>); u = mlaf(u, t, -0.<API key>); u = mlaf(u, t, 0.<API key>); u = mlaf(u, t, -0.<API key>); u = mlaf(u, t, 0.<API key>); u = mlaf(u, t, -0.<API key>); t = s + s * (t * u); if ((q & 1) != 0) t = 1.<API key> - t; if ((q & 2) != 0) t = -t; return t; } static INLINE CONST float atan2kf(float y, float x) { float s, t, u; int q = 0; if (x < 0) { x = -x; q = -2; } if (y > x) { t = x; x = y; y = -t; q += 1; } s = y / x; t = s * s; u = 0.<API key>; u = mlaf(u, t, -0.<API key>); u = mlaf(u, t, 0.<API key>); u = mlaf(u, t, -0.<API key>); u = mlaf(u, t, 0.<API key>); u = mlaf(u, t, -0.<API key>); u = mlaf(u, t, 0.<API key>); u = mlaf(u, t, -0.<API key>); t = u * t * s + s; t = q * (float)(M_PI/2) + t; return t; } EXPORT CONST float xatan2f(float y, float x) { float r = atan2kf(fabsfk(y), x); r = mulsignf(r, x); if (xisinff(x) || x == 0) r = M_PIf/2 - (xisinff(x) ? (signf(x) * (float)(M_PI /2)) : 0); if (xisinff(y) ) r = M_PIf/2 - (xisinff(x) ? (signf(x) * (float)(M_PI*1/4)) : 0); if ( y == 0) r = (signf(x) == -1 ? M_PIf : 0); return xisnanf(x) || xisnanf(y) ? SLEEF_NANf : mulsignf(r, y); } EXPORT CONST float xasinf(float d) { int o = fabsfk(d) < 0.5f; float x2 = o ? (d*d) : ((1-fabsfk(d))*0.5f), x = o ? fabsfk(d) : SQRTF(x2), u; u = +0.4197454825e-1; u = mlaf(u, x2, +0.2424046025e-1); u = mlaf(u, x2, +0.4547423869e-1); u = mlaf(u, x2, +0.7495029271e-1); u = mlaf(u, x2, +0.1666677296e+0); u = mlaf(u, x * x2, x); float r = o ? u : (M_PIf/2 - 2*u); r = mulsignf(r, d); return r; } EXPORT CONST float xacosf(float d) { int o = fabsfk(d) < 0.5f; float x2 = o ? (d*d) : ((1-fabsfk(d))*0.5f), u; float x = o ? fabsfk(d) : SQRTF(x2); x = fabsfk(d) == 1.0 ? 0 : x; u = +0.4197454825e-1; u = mlaf(u, x2, +0.2424046025e-1); u = mlaf(u, x2, +0.4547423869e-1); u = mlaf(u, x2, +0.7495029271e-1); u = mlaf(u, x2, +0.1666677296e+0); u *= x * x2; float y = 3.1415926535897932f/2 - (mulsignf(x, d) + mulsignf(u, d)); x += u; float r = o ? y : (x*2); if (!o && d < 0) r = dfadd_f2_f2_f(df(3.<API key>,-8.<API key>), -r).x; return r; } static Sleef_float2 atan2kf_u1(Sleef_float2 y, Sleef_float2 x) { float u; Sleef_float2 s, t; int q = 0; if (x.x < 0) { x.x = -x.x; x.y = -x.y; q = -2; } if (y.x > x.x) { t = x; x = y; y.x = -t.x; y.y = -t.y; q += 1; } s = dfdiv_f2_f2_f2(y, x); t = dfsqu_f2_f2(s); t = dfnormalize_f2_f2(t); u = -0.<API key>; u = mlaf(u, t.x, 0.<API key>); u = mlaf(u, t.x, -0.<API key>); u = mlaf(u, t.x, 0.<API key>); u = mlaf(u, t.x, -0.<API key>); u = mlaf(u, t.x, 0.<API key>); u = mlaf(u, t.x, -0.<API key>); u = mlaf(u, t.x, 0.<API key>); t = dfmul_f2_f2_f2(t, dfadd_f2_f_f(-0.<API key>, u * t.x)); t = dfmul_f2_f2_f2(s, dfadd_f2_f_f2(1, t)); t = dfadd2_f2_f2_f2(dfmul_f2_f2_f(df(1.<API key>, -4.<API key>), q), t); return t; } EXPORT CONST float xatan2f_u1(float y, float x) { if (fabsfk(x) < 2.<API key>) { y *= (1ULL << 24); x *= (1ULL << 24); } // nexttowardf((1.0 / FLT_MAX), 1) Sleef_float2 d = atan2kf_u1(df(fabsfk(y), 0), df(x, 0)); float r = d.x + d.y; r = mulsignf(r, x); if (xisinff(x) || x == 0) r = (float)M_PI/2 - (xisinff(x) ? (signf(x) * (float)(M_PI /2)) : 0.0f); if (xisinff(y) ) r = (float)M_PI/2 - (xisinff(x) ? (signf(x) * (float)(M_PI*1/4)) : 0.0f); if ( y == 0) r = (signf(x) == -1 ? (float)M_PI : 0.0f); return xisnanf(x) || xisnanf(y) ? SLEEF_NANf : mulsignf(r, y); } EXPORT CONST float xasinf_u1(float d) { int o = fabsfk(d) < 0.5f; float x2 = o ? (d*d) : ((1-fabsfk(d))*0.5f), u; Sleef_float2 x = o ? df(fabsfk(d), 0) : dfsqrt_f2_f(x2); x = fabsfk(d) == 1.0f ? df(0, 0) : x; u = +0.4197454825e-1; u = mlaf(u, x2, +0.2424046025e-1); u = mlaf(u, x2, +0.4547423869e-1); u = mlaf(u, x2, +0.7495029271e-1); u = mlaf(u, x2, +0.1666677296e+0); u *= x2 * x.x; Sleef_float2 y = dfadd_f2_f2_f(dfsub_f2_f2_f2(df(3.<API key>/4,-8.<API key>/4), x), -u); float r = o ? (u + x.x) : ((y.x + y.y)*2); r = mulsignf(r, d); return r; } EXPORT CONST float xacosf_u1(float d) { int o = fabsfk(d) < 0.5f; float x2 = o ? (d*d) : ((1-fabsfk(d))*0.5f), u; Sleef_float2 x = o ? df(fabsfk(d), 0) : dfsqrt_f2_f(x2); x = (fabsfk(d) == 1.0f) ? df(0, 0) : x; u = +0.4197454825e-1; u = mlaf(u, x2, +0.2424046025e-1); u = mlaf(u, x2, +0.4547423869e-1); u = mlaf(u, x2, +0.7495029271e-1); u = mlaf(u, x2, +0.1666677296e+0); u = u * x.x * x2; Sleef_float2 y = dfsub_f2_f2_f2(df(3.<API key>/2,-8.<API key>/2), dfadd_f2_f_f(mulsignf(x.x, d), mulsignf(u, d))); x = dfadd_f2_f2_f(x, u); y = o ? y : dfscale_f2_f2_f(x, 2); if (!o && d < 0) y = dfsub_f2_f2_f2(df(3.<API key>,-8.<API key>), y); return y.x + y.y; } EXPORT CONST float xatanf_u1(float d) { Sleef_float2 d2 = atan2kf_u1(df(fabsfk(d), 0.0f), df(1.0f, 0.0f)); float r = d2.x + d2.y; if (xisinff(d)) r = 1.<API key>; return mulsignf(r, d); } EXPORT CONST float xlogf(float d) { float x, x2, t, m; int e; int o = d < FLT_MIN; if (o) d *= (float)(1LL << 32) * (float)(1LL << 32); e = ilogb2kf(d * (1.0f/0.75f)); m = ldexp3kf(d, -e); if (o) e -= 64; x = (m-1.0f) / (m+1.0f); x2 = x * x; t = 0.<API key>; t = mlaf(t, x2, 0.<API key>); t = mlaf(t, x2, 0.<API key>); t = mlaf(t, x2, 0.<API key>); t = mlaf(t, x2, 2.0f); x = x * t + 0.<API key> * e; if (xisinff(d)) x = SLEEF_INFINITYf; if (d < 0 || xisnanf(d)) x = SLEEF_NANf; if (d == 0) x = -SLEEF_INFINITYf; return x; } EXPORT CONST float xexpf(float d) { int q = (int)rintfk(d * R_LN2f); float s, u; s = mlaf(q, -L2Uf, d); s = mlaf(q, -L2Lf, s); u = 0.<API key>; u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, 0.<API key>); u = mlaf(u, s, 0.5); u = s * s * u + s + 1.0f; u = ldexp2kf(u, q); if (d < -104) u = 0; if (d > 104) u = SLEEF_INFINITYf; return u; } static INLINE CONST float expkf(Sleef_float2 d) { int q = (int)rintfk((d.x + d.y) * R_LN2f); Sleef_float2 s, t; float u; s = dfadd2_f2_f2_f(d, q * -L2Uf); s = dfadd2_f2_f2_f(s, q * -L2Lf); s = dfnormalize_f2_f2(s); u = 0.<API key>; u = mlaf(u, s.x, 0.<API key>); u = mlaf(u, s.x, 0.<API key>); u = mlaf(u, s.x, 0.<API key>); u = mlaf(u, s.x, 0.<API key>); t = dfadd_f2_f2_f2(s, dfmul_f2_f2_f(dfsqu_f2_f2(s), u)); t = dfadd_f2_f_f2(1, t); u = ldexpkf(t.x + t.y, q); if (d.x < -104) u = 0; return u; } static INLINE CONST Sleef_float2 logkf(float d) { Sleef_float2 x, x2, s; float m, t; int e; int o = d < FLT_MIN; if (o) d *= (float)(1LL << 32) * (float)(1LL << 32); e = ilogb2kf(d * (1.0f/0.75f)); m = ldexp3kf(d, -e); if (o) e -= 64; x = dfdiv_f2_f2_f2(dfadd2_f2_f_f(-1, m), dfadd2_f2_f_f(1, m)); x2 = dfsqu_f2_f2(x); t = 0.<API key>; t = mlaf(t, x2.x, 0.<API key>); t = mlaf(t, x2.x, 0.<API key>); Sleef_float2 c = df(0.<API key>, 3.<API key>); s = dfmul_f2_f2_f(df(0.<API key>, -1.<API key>), e); s = dfadd_f2_f2_f2(s, dfscale_f2_f2_f(x, 2)); s = dfadd_f2_f2_f2(s, dfmul_f2_f2_f2(dfmul_f2_f2_f2(x2, x), dfadd2_f2_f2_f2(dfmul_f2_f2_f(x2, t), c))); return s; } EXPORT CONST float xlogf_u1(float d) { Sleef_float2 x, s; float m, t, x2; int e; int o = d < FLT_MIN; if (o) d *= (float)(1LL << 32) * (float)(1LL << 32); e = ilogb2kf(d * (1.0f/0.75f)); m = ldexp3kf(d, -e); if (o) e -= 64; x = dfdiv_f2_f2_f2(dfadd2_f2_f_f(-1, m), dfadd2_f2_f_f(1, m)); x2 = x.x * x.x; t = +0.3027294874e+0f; t = mlaf(t, x2, +0.3996108174e+0f); t = mlaf(t, x2, +0.6666694880e+0f); s = dfmul_f2_f2_f(df(0.<API key>, -1.<API key>), (float)e); s = dfadd_f2_f2_f2(s, dfscale_f2_f2_f(x, 2)); s = dfadd_f2_f2_f(s, x2 * x.x * t); float r = s.x + s.y; if (xisinff(d)) r = SLEEF_INFINITYf; if (d < 0 || xisnanf(d)) r = SLEEF_NANf; if (d == 0) r = -SLEEF_INFINITYf; return r; } static INLINE CONST Sleef_float2 expk2f(Sleef_float2 d) { int q = (int)rintfk((d.x + d.y) * R_LN2f); Sleef_float2 s, t; float u; s = dfadd2_f2_f2_f(d, q * -L2Uf); s = dfadd2_f2_f2_f(s, q * -L2Lf); u = +0.1980960224e-3f; u = mlaf(u, s.x, +0.1394256484e-2f); u = mlaf(u, s.x, +0.8333456703e-2f); u = mlaf(u, s.x, +0.4166637361e-1f); t = dfadd2_f2_f2_f(dfmul_f2_f2_f(s, u), +0.<API key>+0f); t = dfadd2_f2_f2_f(dfmul_f2_f2_f2(s, t), 0.5); t = dfadd2_f2_f2_f2(s, dfmul_f2_f2_f2(dfsqu_f2_f2(s), t)); t = dfadd2_f2_f_f2(1, t); t.x = ldexp2kf(t.x, q); t.y = ldexp2kf(t.y, q); return d.x < -104 ? df(0, 0) : t; } EXPORT CONST float xpowf(float x, float y) { int yisint = (y == (int)y) || (fabsfk(y) >= (float)(1LL << 24)); int yisodd = (1 & (int)y) != 0 && yisint && fabsfk(y) < (float)(1LL << 24); float result = expkf(dfmul_f2_f2_f(logkf(fabsfk(x)), y)); result = xisnanf(result) ? SLEEF_INFINITYf : result; result *= (x >= 0 ? 1 : (!yisint ? SLEEF_NANf : (yisodd ? -1 : 1))); float efx = mulsignf(fabsfk(x) - 1, y); if (xisinff(y)) result = efx < 0 ? 0.0f : (efx == 0 ? 1.0f : SLEEF_INFINITYf); if (xisinff(x) || x == 0) result = (yisodd ? signf(x) : 1) * ((x == 0 ? -y : y) < 0 ? 0 : SLEEF_INFINITYf); if (xisnanf(x) || xisnanf(y)) result = SLEEF_NANf; if (y == 0 || x == 1) result = 1; return result; } EXPORT CONST float xpownf(float x, int y) { return xpowf(x, (float)y); } EXPORT CONST float xpowrf(float x, float y) { if (x < 0.0f) return SLEEF_NAN; if (xisnanf(y)) return y; return xpowf(x, y); } EXPORT CONST float xsinhf(float x) { float y = fabsfk(x); Sleef_float2 d = expk2f(df(y, 0)); d = dfsub_f2_f2_f2(d, dfrec_f2_f2(d)); y = (d.x + d.y) * 0.5f; y = fabsfk(x) > 89 ? SLEEF_INFINITYf : y; y = xisnanf(y) ? SLEEF_INFINITYf : y; y = mulsignf(y, x); y = xisnanf(x) ? SLEEF_NANf : y; return y; } EXPORT CONST float xcoshf(float x) { float y = fabsfk(x); Sleef_float2 d = expk2f(df(y, 0)); d = dfadd_f2_f2_f2(d, dfrec_f2_f2(d)); y = (d.x + d.y) * 0.5f; y = fabsfk(x) > 89 ? SLEEF_INFINITYf : y; y = xisnanf(y) ? SLEEF_INFINITYf : y; y = xisnanf(x) ? SLEEF_NANf : y; return y; } EXPORT CONST float xtanhf(float x) { float y = fabsfk(x); Sleef_float2 d = expk2f(df(y, 0)); Sleef_float2 e = dfrec_f2_f2(d); d = dfdiv_f2_f2_f2(dfsub_f2_f2_f2(d, e), dfadd_f2_f2_f2(d, e)); y = d.x + d.y; y = fabsfk(x) > 18.714973875f ? 1.0f : y; y = xisnanf(y) ? 1.0f : y; y = mulsignf(y, x); y = xisnanf(x) ? SLEEF_NANf : y; return y; } static INLINE CONST Sleef_float2 logk2f(Sleef_float2 d) { Sleef_float2 x, x2, m, s; float t; int e; e = ilogbkf(d.x * (1.0f/0.75f)); m = dfscale_f2_f2_f(d, pow2if(-e)); x = dfdiv_f2_f2_f2(dfadd2_f2_f2_f(m, -1), dfadd2_f2_f2_f(m, 1)); x2 = dfsqu_f2_f2(x); t = 0.<API key>; t = mlaf(t, x2.x, 0.<API key>); t = mlaf(t, x2.x, 0.<API key>); t = mlaf(t, x2.x, 0.<API key>); s = dfmul_f2_f2_f(df(0.<API key>, -1.<API key>), e); s = dfadd_f2_f2_f2(s, dfscale_f2_f2_f(x, 2)); s = dfadd_f2_f2_f2(s, dfmul_f2_f2_f(dfmul_f2_f2_f2(x2, x), t)); return s; } EXPORT CONST float xasinhf(float x) { float y = fabsfk(x); Sleef_float2 d; d = y > 1 ? dfrec_f2_f(x) : df(y, 0); d = dfsqrt_f2_f2(dfadd2_f2_f2_f(dfsqu_f2_f2(d), 1)); d = y > 1 ? dfmul_f2_f2_f(d, y) : d; d = logk2f(dfnormalize_f2_f2(dfadd_f2_f2_f(d, x))); y = d.x + d.y; y = (fabsfk(x) > SQRT_FLT_MAX || xisnanf(y)) ? mulsignf(SLEEF_INFINITYf, x) : y; y = xisnanf(x) ? SLEEF_NANf : y; y = xisnegzerof(x) ? -0.0f : y; return y; } EXPORT CONST float xacoshf(float x) { Sleef_float2 d = logk2f(dfadd2_f2_f2_f(dfmul_f2_f2_f2(dfsqrt_f2_f2(dfadd2_f2_f_f(x, 1)), dfsqrt_f2_f2(dfadd2_f2_f_f(x, -1))), x)); float y = d.x + d.y; y = (x > SQRT_FLT_MAX || xisnanf(y)) ? SLEEF_INFINITYf : y; y = x == 1.0f ? 0.0f : y; y = x < 1.0f ? SLEEF_NANf : y; y = xisnanf(x) ? SLEEF_NANf : y; return y; } EXPORT CONST float xatanhf(float x) { float y = fabsfk(x); Sleef_float2 d = logk2f(dfdiv_f2_f2_f2(dfadd2_f2_f_f(1, y), dfadd2_f2_f_f(1, -y))); y = y > 1.0f ? SLEEF_NANf : (y == 1.0f ? SLEEF_INFINITYf : (d.x + d.y) * 0.5f); y = xisinff(x) || xisnanf(y) ? SLEEF_NANf : y; y = mulsignf(y, x); y = xisnanf(x) ? SLEEF_NANf : y; return y; } EXPORT CONST float xexp2f(float d) { int q = (int)rintfk(d); float s, u; s = d - q; u = +0.1535920892e-3; u = mlaf(u, s, +0.1339262701e-2); u = mlaf(u, s, +0.9618384764e-2); u = mlaf(u, s, +0.5550347269e-1); u = mlaf(u, s, +0.2402264476e+0); u = mlaf(u, s, +0.6931471825e+0); u = dfnormalize_f2_f2(dfadd_f2_f_f2(1, dfmul_f2_f_f(u, s))).x; u = ldexp2kf(u, q); if (d >= 128) u = SLEEF_INFINITYf; if (d < -150) u = 0; return u; } EXPORT CONST float xexp10f(float d) { int q = (int)rintfk(d * (float)LOG10_2); float s, u; s = mlaf(q, -L10Uf, d); s = mlaf(q, -L10Lf, s); u = +0.2064004987e+0; u = mlaf(u, s, +0.5417877436e+0); u = mlaf(u, s, +0.1171286821e+1); u = mlaf(u, s, +0.2034656048e+1); u = mlaf(u, s, +0.2650948763e+1); u = mlaf(u, s, +0.2302585125e+1); u = dfnormalize_f2_f2(dfadd_f2_f_f2(1, dfmul_f2_f_f(u, s))).x; u = ldexp2kf(u, q); if (d > 38.<API key>) u = SLEEF_INFINITYf; // log10(FLT_MAX) if (d < -50) u = 0; return u; } EXPORT CONST float xexpm1f(float a) { Sleef_float2 d = dfadd2_f2_f2_f(expk2f(df(a, 0)), -1.0f); float x = d.x + d.y; if (a > 88.72283172607421875f) x = SLEEF_INFINITYf; if (a < -16.<API key>) x = -1; if (xisnegzerof(a)) x = -0.0f; return x; } EXPORT CONST float xlog10f(float d) { Sleef_float2 x, s; float m, t, x2; int e; int o = d < FLT_MIN; if (o) d *= (float)(1LL << 32) * (float)(1LL << 32); e = ilogb2kf(d * (1.0f/0.75f)); m = ldexp3kf(d, -e); if (o) e -= 64; x = dfdiv_f2_f2_f2(dfadd2_f2_f_f(-1, m), dfadd2_f2_f_f(1, m)); x2 = x.x * x.x; t = +0.1314289868e+0; t = mlaf(t, x2, +0.1735493541e+0); t = mlaf(t, x2, +0.2895309627e+0); s = dfmul_f2_f2_f(df(0.30103001, -1.432098889e-08), (float)e); s = dfadd_f2_f2_f2(s, dfmul_f2_f2_f2(x, df(0.868588984, -2.170757285e-08))); s = dfadd_f2_f2_f(s, x2 * x.x * t); float r = s.x + s.y; if (xisinff(d)) r = SLEEF_INFINITYf; if (d < 0 || xisnanf(d)) r = SLEEF_NANf; if (d == 0) r = -SLEEF_INFINITYf; return r; } EXPORT CONST float xlog2f(float d) { Sleef_float2 x, s; float m, t, x2; int e; int o = d < FLT_MIN; if (o) d *= (float)(1LL << 32) * (float)(1LL << 32); e = ilogb2kf(d * (1.0f/0.75f)); m = ldexp3kf(d, -e); if (o) e -= 64; x = dfdiv_f2_f2_f2(dfadd2_f2_f_f(-1, m), dfadd2_f2_f_f(1, m)); x2 = x.x * x.x; t = +0.4374550283e+0f; t = mlaf(t, x2, +0.5764790177e+0f); t = mlaf(t, x2, +0.9618012905120f); s = dfadd2_f2_f_f2(e, dfmul_f2_f2_f2(x, df(2.8853900432586669922, 3.<API key>))); s = dfadd2_f2_f2_f(s, x2 * x.x * t); float r = s.x + s.y; if (xisinff(d)) r = SLEEF_INFINITYf; if (d < 0 || xisnanf(d)) r = SLEEF_NANf; if (d == 0) r = -SLEEF_INFINITYf; return r; } static INLINE CONST float xlog1pf_fast(float d) { Sleef_float2 x, s; float m, t, x2; int e; float dp1 = d + 1; int o = dp1 < FLT_MIN; if (o) dp1 *= (float)(1LL << 32) * (float)(1LL << 32); e = ilogb2kf(dp1 * (1.0f/0.75f)); t = ldexp3kf(1, -e); m = mlaf(d, t, t-1); if (o) e -= 64; x = dfdiv_f2_f2_f2(df(m, 0), dfadd_f2_f_f(2, m)); x2 = x.x * x.x; t = +0.3027294874e+0f; t = mlaf(t, x2, +0.3996108174e+0f); t = mlaf(t, x2, +0.6666694880e+0f); s = dfmul_f2_f2_f(df(0.<API key>, -1.<API key>), (float)e); s = dfadd_f2_f2_f2(s, dfscale_f2_f2_f(x, 2)); s = dfadd_f2_f2_f(s, x2 * x.x * t); float r = s.x + s.y; if (d == SLEEF_INFINITYf) r = SLEEF_INFINITYf; if (d < -1) r = SLEEF_NANf; if (d == -1) r = -SLEEF_INFINITYf; if (xisnegzerof(d)) r = -0.0f; if (xisnanf(d)) r = d; return r; } EXPORT CONST float xlog1pf(float a) { if (a > 0x1.0p+125) return xlogf(a); else return xlog1pf_fast(a); } EXPORT CONST float xcbrtf(float d) { float x, y, q = 1.0f; int e, r; e = ilogbkf(fabsfk(d))+1; d = ldexp2kf(d, -e); r = (e + 6144) % 3; q = (r == 1) ? 1.<API key> : q; q = (r == 2) ? 1.<API key> : q; q = ldexp2kf(q, (e + 6144) / 3 - 2048); q = mulsignf(q, d); d = fabsfk(d); x = -0.<API key>; x = mlaf(x, d, 2.<API key>); x = mlaf(x, d, -5.<API key>); x = mlaf(x, d, 5.<API key>); x = mlaf(x, d, -3.<API key>); x = mlaf(x, d, 2.<API key>); y = d * x * x; y = (y - (2.0f / 3.0f) * y * (y * x - 1.0f)) * q; return y; } EXPORT CONST float xcbrtf_u1(float d) { float x, y, z; Sleef_float2 q2 = df(1, 0), u, v; int e, r; e = ilogbkf(fabsfk(d))+1; d = ldexp2kf(d, -e); r = (e + 6144) % 3; q2 = (r == 1) ? df(1.2599210739135742188, -2.<API key>) : q2; q2 = (r == 2) ? df(1.5874010324478149414, 1.<API key>) : q2; q2.x = mulsignf(q2.x, d); q2.y = mulsignf(q2.y, d); d = fabsfk(d); x = -0.<API key>; x = mlaf(x, d, 2.<API key>); x = mlaf(x, d, -5.<API key>); x = mlaf(x, d, 5.<API key>); x = mlaf(x, d, -3.<API key>); x = mlaf(x, d, 2.<API key>); y = x * x; y = y * y; x -= (d * y - x) * (1.0 / 3.0f); z = x; u = dfmul_f2_f_f(x, x); u = dfmul_f2_f2_f2(u, u); u = dfmul_f2_f2_f(u, d); u = dfadd2_f2_f2_f(u, -x); y = u.x + u.y; y = -2.0 / 3.0 * y * z; v = dfadd2_f2_f2_f(dfmul_f2_f_f(z, z), y); v = dfmul_f2_f2_f(v, d); v = dfmul_f2_f2_f2(v, q2); z = ldexp2kf(v.x + v.y, (e + 6144) / 3 - 2048); if (xisinff(d)) { z = mulsignf(SLEEF_INFINITYf, q2.x); } if (d == 0) { z = mulsignf(0, q2.x); } return z; } EXPORT CONST float xfabsf(float x) { return fabsfk(x); } EXPORT CONST float xcopysignf(float x, float y) { return copysignfk(x, y); } EXPORT CONST float xfmaxf(float x, float y) { return y != y ? x : (x > y ? x : y); } EXPORT CONST float xfminf(float x, float y) { return y != y ? x : (x < y ? x : y); } EXPORT CONST float xfdimf(float x, float y) { float ret = x - y; if (ret < 0 || x == y) ret = 0; return ret; } EXPORT CONST float xtruncf(float x) { float fr = x - (int32_t)x; return (xisinff(x) || fabsfk(x) >= (float)(1LL << 23)) ? x : copysignfk(x - fr, x); } EXPORT CONST float xfloorf(float x) { float fr = x - (int32_t)x; fr = fr < 0 ? fr+1.0f : fr; return (xisinff(x) || fabsfk(x) >= (float)(1LL << 23)) ? x : copysignfk(x - fr, x); } EXPORT CONST float xceilf(float x) { float fr = x - (int32_t)x; fr = fr <= 0 ? fr : fr-1.0f; return (xisinff(x) || fabsfk(x) >= (float)(1LL << 23)) ? x : copysignfk(x - fr, x); } EXPORT CONST float xroundf(float d) { float x = d + 0.5f; float fr = x - (int32_t)x; if (fr == 0 && x <= 0) x fr = fr < 0 ? fr+1.0f : fr; x = d == 0.<API key> ? 0 : x; // nextafterf(0.5, 0) return (xisinff(d) || fabsfk(d) >= (float)(1LL << 23)) ? d : copysignfk(x - fr, d); } EXPORT CONST float xrintf(float d) { float x = d + 0.5f; int32_t isodd = (1 & (int32_t)x) != 0; float fr = x - (int32_t)x; fr = (fr < 0 || (fr == 0 && isodd)) ? fr+1.0f : fr; x = d == 0.<API key> ? 0 : x; // nextafterf(0.5, 1) return (xisinff(d) || fabsfk(d) >= (float)(1LL << 23)) ? d : copysignfk(x - fr, d); } EXPORT CONST Sleef_float2 xmodff(float x) { float fr = x - (int32_t)x; fr = fabsfk(x) > (float)(1LL << 23) ? 0 : fr; Sleef_float2 ret = { copysignfk(fr, x), copysignfk(x - fr, x) }; return ret; } EXPORT CONST float xldexpf(float x, int exp) { if (exp > 300) exp = 300; if (exp < -300) exp = -300; int e0 = exp >> 2; if (exp < 0) e0++; if (-50 < exp && exp < 50) e0 = 0; int e1 = exp - (e0 << 2); float p = pow2if(e0); float ret = x * pow2if(e1) * p * p * p * p; return ret; } EXPORT CONST float xnextafterf(float x, float y) { union { float f; int32_t i; } cx; cx.f = x == 0 ? mulsignf(0, y) : x; int c = (cx.i < 0) == (y < x); if (c) cx.i = -(cx.i ^ (1 << 31)); if (x != y) cx.i if (c) cx.i = -(cx.i ^ (1 << 31)); if (cx.f == 0 && x != 0) cx.f = mulsignf(0, x); if (x == 0 && y == 0) cx.f = y; if (xisnanf(x) || xisnanf(y)) cx.f = SLEEF_NANf; return cx.f; } EXPORT CONST float xfrfrexpf(float x) { union { float f; int32_t u; } cx; if (xisnanf(x)) return x; if (fabsfk(x) < FLT_MIN) x *= (1 << 30); cx.f = x; cx.u &= ~0x7f800000U; cx.u |= 0x3f000000U; if (xisinff(x)) cx.f = mulsignf(SLEEF_INFINITYf, x); if (x == 0) cx.f = x; return cx.f; } EXPORT CONST int xexpfrexpf(float x) { union { float f; uint32_t u; } cx; int ret = 0; if (fabsfk(x) < FLT_MIN) { x *= (1 << 30); ret = -30; } cx.f = x; ret += (int32_t)(((cx.u >> 23) & 0xff)) - 0x7e; if (x == 0 || xisnanf(x) || xisinff(x)) ret = 0; return ret; } EXPORT CONST float xhypotf_u05(float x, float y) { x = fabsfk(x); y = fabsfk(y); float min = fminfk(x, y), n = min; float max = fmaxfk(x, y), d = max; if (max < FLT_MIN) { n *= 1ULL << 24; d *= 1ULL << 24; } Sleef_float2 t = dfdiv_f2_f2_f2(df(n, 0), df(d, 0)); t = dfmul_f2_f2_f(dfsqrt_f2_f2(dfadd2_f2_f2_f(dfsqu_f2_f2(t), 1)), max); float ret = t.x + t.y; if (xisnanf(ret)) ret = SLEEF_INFINITYf; if (min == 0) ret = max; if (xisnanf(x) || xisnanf(y)) ret = SLEEF_NANf; if (x == SLEEF_INFINITYf || y == SLEEF_INFINITYf) ret = SLEEF_INFINITYf; return ret; } EXPORT CONST float xhypotf_u35(float x, float y) { x = fabsfk(x); y = fabsfk(y); float min = fminfk(x, y); float max = fmaxfk(x, y); float t = min / max; float ret = max * SQRTF(1 + t*t); if (min == 0) ret = max; if (xisnanf(x) || xisnanf(y)) ret = SLEEF_NANf; if (x == SLEEF_INFINITYf || y == SLEEF_INFINITYf) ret = SLEEF_INFINITYf; return ret; } static INLINE CONST float toward0f(float d) { return d == 0 ? 0 : intBitsToFloat(floatToRawIntBits(d)-1); } static INLINE CONST float ptruncf(float x) { return fabsfk(x) >= (float)(1LL << 23) ? x : (x - (x - (int32_t)x)); } EXPORT CONST float xfmodf(float x, float y) { float nu = fabsfk(x), de = fabsfk(y), s = 1, q; if (de < FLT_MIN) { nu *= 1ULL << 25; de *= 1ULL << 25; s = 1.0f / (1ULL << 25); } Sleef_float2 r = df(nu, 0); float rde = toward0f(1.0f / de); for(int i=0;i<8;i++) { // ceil(log2(FLT_MAX) / 22)+1 q = (de+de > r.x && r.x >= de) ? 1.0f : (toward0f(r.x) * rde); r = dfnormalize_f2_f2(dfadd2_f2_f2_f2(r, dfmul_f2_f_f(ptruncf(q), -de))); if (r.x < de) break; } float ret = (r.x + r.y) * s; if (r.x + r.y == de) ret = 0; ret = mulsignf(ret, x); if (nu < de) ret = x; if (de == 0) ret = SLEEF_NANf; return ret; } EXPORT CONST float xsqrtf_u05(float d) { #if __has_builtin(__builtin_sqrtf) return __builtin_sqrtf(d); #else #warning Using software SQRT float q = 0.5f; d = d < 0 ? SLEEF_NANf : d; if (d < 5.<API key>) { d *= 1.8889465931478580e+22f; q = 7.<API key> * 0.5f; } if (d > 1.8446744073709552e+19f) { d *= 5.<API key>; q = 4294967296.0f * 0.5f; } float x = intBitsToFloat(0x5f375a86 - (floatToRawIntBits(d + 1e-45f) >> 1)); x = x * (1.5f - 0.5f * d * x * x); x = x * (1.5f - 0.5f * d * x * x); x = x * (1.5f - 0.5f * d * x * x) * d; Sleef_float2 d2 = dfmul_f2_f2_f2(dfadd2_f2_f_f2(d, dfmul_f2_f_f(x, x)), dfrec_f2_f(x)); float ret = (d2.x + d2.y) * q; ret = d == SLEEF_INFINITYf ? SLEEF_INFINITYf : ret; ret = d == 0 ? d : ret; return ret; #endif } EXPORT CONST float xsqrtf_u35(float d) { float q = 1.0f; d = d < 0 ? SLEEF_NANf : d; if (d < 5.<API key>) { d *= 1.8889465931478580e+22f; q = 7.<API key>; } if (d > 1.8446744073709552e+19f) { d *= 5.<API key>; q = 4294967296.0f; } float x = intBitsToFloat(0x5f375a86 - (floatToRawIntBits(d + 1e-45) >> 1)); x = x * (1.5f - 0.5f * d * x * x); x = x * (1.5f - 0.5f * d * x * x); x = x * (1.5f - 0.5f * d * x * x); x = x * (1.5f - 0.5f * d * x * x); return d == SLEEF_INFINITYf ? SLEEF_INFINITYf : (x * d * q); } EXPORT CONST float xsqrtf(float d) { return SQRTF(d); } EXPORT CONST float xfmaf(float x, float y, float z) { #if __has_builtin(__builtin_fmaf) return __builtin_fmaf(x, y, z); #else #warning Using software FMA float h2 = x * y + z, q = 1; if (fabsfk(h2) < 1e-38f) { const float c0 = 1 << 25, c1 = c0 * c0, c2 = c1 * c1; x *= c1; y *= c1; z *= c2; q = 1.0f / c2; } if (fabsfk(h2) > 1e+38f) { const float c0 = 1 << 25, c1 = c0 * c0, c2 = c1 * c1; x *= 1.0 / c1; y *= 1.0 / c1; z *= 1.0 / c2; q = c2; } Sleef_float2 d = dfmul_f2_f_f(x, y); d = dfadd2_f2_f2_f(d, z); float ret = (x == 0 || y == 0) ? z : (d.x + d.y); if (xisinff(z) && !xisinff(x) && !xisnanf(x) && !xisinff(y) && !xisnanf(y)) h2 = z; return (xisinff(h2) || xisnanf(h2)) ? h2 : ret*q; #endif } static INLINE CONST Sleef_float2 sinpifk(float d) { float u, s, t; Sleef_float2 x, s2; u = d * 4; int q = ceilfk(u) & ~1; int o = (q & 2) != 0; s = u - (float)q; t = s; s = s * s; s2 = dfmul_f2_f_f(t, t); u = o ? -0.2430611801e-7f : +0.3093842054e-6f; u = mlaf(u, s, o ? +0.3590577080e-5f : -0.3657307388e-4f); u = mlaf(u, s, o ? -0.3259917721e-3f : +0.2490393585e-2f); x = dfadd2_f2_f_f2(u * s, o ? df(0.<API key>, 4.<API key>) : df(-0.<API key>, -1.<API key>)); x = dfadd2_f2_f2_f2(dfmul_f2_f2_f2(s2, x), o ? df(-0.<API key>, -9.<API key>) : df(0.<API key>, -2.<API key>)); x = dfmul_f2_f2_f2(x, o ? s2 : df(t, 0)); x = o ? dfadd2_f2_f2_f(x, 1) : x; if ((q & 4) != 0) { x.x = -x.x; x.y = -x.y; } return x; } EXPORT CONST float xsinpif_u05(float d) { Sleef_float2 x = sinpifk(d); float r = x.x + x.y; if (xisnegzerof(d)) r = -0.0; if (fabsfk(d) > TRIGRANGEMAX4f) r = 0; if (xisinff(d)) r = SLEEF_NANf; return r; } static INLINE CONST Sleef_float2 cospifk(float d) { float u, s, t; Sleef_float2 x, s2; u = d * 4; int q = ceilfk(u) & ~1; int o = (q & 2) == 0; s = u - (float)q; t = s; s = s * s; s2 = dfmul_f2_f_f(t, t); u = o ? -0.2430611801e-7f : +0.3093842054e-6f; u = mlaf(u, s, o ? +0.3590577080e-5f : -0.3657307388e-4f); u = mlaf(u, s, o ? -0.3259917721e-3f : +0.2490393585e-2f); x = dfadd2_f2_f_f2(u * s, o ? df(0.<API key>, 4.<API key>) : df(-0.<API key>, -1.<API key>)); x = dfadd2_f2_f2_f2(dfmul_f2_f2_f2(s2, x), o ? df(-0.<API key>, -9.<API key>) : df(0.<API key>, -2.<API key>)); x = dfmul_f2_f2_f2(x, o ? s2 : df(t, 0)); x = o ? dfadd2_f2_f2_f(x, 1) : x; if (((q+2) & 4) != 0) { x.x = -x.x; x.y = -x.y; } return x; } EXPORT CONST float xcospif_u05(float d) { Sleef_float2 x = cospifk(d); float r = x.x + x.y; if (fabsfk(d) > TRIGRANGEMAX4f) r = 1; if (xisinff(d)) r = SLEEF_NANf; return r; } typedef struct { Sleef_float2 a, b; } df2; static CONST df2 gammafk(float a) { Sleef_float2 clc = df(0, 0), clln = df(1, 0), clld = df(1, 0), v = df(1, 0), x, y, z; float t, u; int otiny = fabsfk(a) < 1e-30f, oref = a < 0.5f; x = otiny ? df(0, 0) : (oref ? dfadd2_f2_f_f(1, -a) : df(a, 0)); int o0 = (0.5f <= x.x && x.x <= 1.2), o2 = 2.3 < x.x; y = dfnormalize_f2_f2(dfmul_f2_f2_f2(dfadd2_f2_f2_f(x, 1), x)); y = dfnormalize_f2_f2(dfmul_f2_f2_f2(dfadd2_f2_f2_f(x, 2), y)); clln = (o2 && x.x <= 7) ? y : clln; x = (o2 && x.x <= 7) ? dfadd2_f2_f2_f(x, 3) : x; t = o2 ? (1.0 / x.x) : dfnormalize_f2_f2(dfadd2_f2_f2_f(x, o0 ? -1 : -2)).x; u = o2 ? +0.<API key> : (o0 ? +0.9435157776e+0f : +0.1102489550e-3f); u = mlaf(u, t, o2 ? -5.<API key> : (o0 ? +0.8670063615e+0f : +0.8160019934e-4f)); u = mlaf(u, t, o2 ? -0.<API key> : (o0 ? +0.4826702476e+0f : +0.1528468856e-3f)); u = mlaf(u, t, o2 ? +6.<API key> : (o0 ? -0.8855129778e-1f : -0.2355068718e-3f)); u = mlaf(u, t, o2 ? +0.<API key> : (o0 ? +0.1013825238e+0f : +0.4962242092e-3f)); u = mlaf(u, t, o2 ? -0.<API key> : (o0 ? -0.1493408978e+0f : -0.1193488017e-2f)); u = mlaf(u, t, o2 ? -0.<API key> : (o0 ? +0.1697509140e+0f : +0.2891599433e-2f)); u = mlaf(u, t, o2 ? +0.<API key> : (o0 ? -0.2072454542e+0f : -0.7385451812e-2f)); u = mlaf(u, t, o2 ? +0.<API key> : (o0 ? +0.2705872357e+0f : +0.2058077045e-1f)); y = dfmul_f2_f2_f2(dfadd2_f2_f2_f(x, -0.5), logk2f(x)); y = dfadd2_f2_f2_f2(y, dfneg_f2_f2(x)); y = dfadd2_f2_f2_f2(y, dfx(0.<API key>)); // 0.5*log(2*M_PI) z = dfadd2_f2_f2_f(dfmul_f2_f_f (u, t), o0 ? -0.<API key>+0f : -0.<API key>); z = dfadd2_f2_f2_f(dfmul_f2_f2_f(z, t), o0 ? +0.<API key>+0f : +0.<API key>+0f); z = dfadd2_f2_f2_f(dfmul_f2_f2_f(z, t), o0 ? -0.<API key>+0f : +0.<API key>+0f); z = dfmul_f2_f2_f(z, t); clc = o2 ? y : z; clld = o2 ? dfadd2_f2_f2_f(dfmul_f2_f_f(u, t), 1) : clld; y = clln; clc = otiny ? dfx(41.<API key>) : // log(2^60) (oref ? dfadd2_f2_f2_f2(dfx(1.1447298858494001639), dfneg_f2_f2(clc)) : clc); // log(M_PI) clln = otiny ? df(1, 0) : (oref ? clln : clld); if (oref) x = dfmul_f2_f2_f2(clld, sinpifk(a - (float)(1LL << 12) * (int32_t)(a * (1.0 / (1LL << 12))))); clld = otiny ? df(a*((1LL << 30)*(float)(1LL << 30)), 0) : (oref ? x : y); df2 ret = { clc, dfdiv_f2_f2_f2(clln, clld) }; return ret; } EXPORT CONST float xtgammaf_u1(float a) { df2 d = gammafk(a); Sleef_float2 y = dfmul_f2_f2_f2(expk2f(d.a), d.b); float r = y.x + y.y; r = (a == -SLEEF_INFINITYf || (a < 0 && xisintf(a)) || (xisnumberf(a) && a < 0 && xisnanf(r))) ? SLEEF_NANf : r; r = ((a == SLEEF_INFINITYf || xisnumberf(a)) && a >= -FLT_MIN && (a == 0 || a > 36 || xisnanf(r))) ? mulsignf(SLEEF_INFINITYf, a) : r; return r; } EXPORT CONST float xlgammaf_u1(float a) { df2 d = gammafk(a); Sleef_float2 y = dfadd2_f2_f2_f2(d.a, logk2f(dfabs_f2_f2(d.b))); float r = y.x + y.y; r = (xisinff(a) || (a <= 0 && xisintf(a)) || (xisnumberf(a) && xisnanf(r))) ? SLEEF_INFINITYf : r; return r; } EXPORT CONST Sleef_float2 xlgamma_rf_u1(float a) { df2 d = gammafk(a); Sleef_float2 y = dfadd2_f2_f2_f2(d.a, logk2f(dfabs_f2_f2(d.b))); float r = y.x + y.y; r = (xisinff(a) || (a <= 0 && xisintf(a)) || (xisnumberf(a) && xisnanf(r))) ? SLEEF_INFINITYf : r; Sleef_float2 ret; ret.x = r; ret.y = intBitsToFloat((floatToRawIntBits(d.b.x) & (1 << 31)) | (0x3f800000)); return ret; } EXPORT CONST float xerff_u1(float a) { float s = a, t, u; Sleef_float2 d; a = fabsfk(a); int o0 = a < 1.1f, o1 = a < 2.4f, o2 = a < 4.0f; u = o0 ? (a*a) : a; t = o0 ? +0.7089292194e-4f : o1 ? -0.1792667899e-4f : -0.9495757695e-5f; t = mlaf(t, u, o0 ? -0.7768311189e-3f : o1 ? +0.3937633010e-3f : +0.2481465926e-3f); t = mlaf(t, u, o0 ? +0.5159463733e-2f : o1 ? -0.3949181177e-2f : -0.2918176819e-2f); t = mlaf(t, u, o0 ? -0.2683781274e-1f : o1 ? +0.2445474640e-1f : +0.2059706673e-1f); t = mlaf(t, u, o0 ? +0.1128318012e+0f : o1 ? -0.1070996150e+0f : -0.9901899844e-1f); d = dfmul_f2_f_f(t, u); d = dfadd2_f2_f2_f2(d, o0 ? dfx(-0.<API key>+0) : o1 ? dfx(-0.<API key>+0) : dfx(-0.<API key>+0)); d = dfmul_f2_f2_f(d, u); d = dfadd2_f2_f2_f2(d, o0 ? dfx(+0.<API key>+1) : o1 ? dfx(-0.<API key>+1) : dfx(-0.<API key>+1)); d = dfmul_f2_f2_f(d, a); d = o0 ? d : dfadd_f2_f_f2(1.0, dfneg_f2_f2(expk2f(d))); u = mulsignf(o2 ? (d.x + d.y) : 1, s); u = xisnanf(a) ? SLEEF_NANf : u; return u; } EXPORT CONST float xerfcf_u15(float a) { float s = a, r = 0, t; Sleef_float2 u, d, x; a = fabsfk(a); int o0 = a < 1.0f, o1 = a < 2.2f, o2 = a < 4.3f, o3 = a < 10.1f; u = o1 ? df(a, 0) : dfdiv_f2_f2_f2(df(1, 0), df(a, 0)); t = o0 ? -0.8638041618e-4f : o1 ? -0.6236977242e-5f : o2 ? -0.3869504035e+0f : +0.1115344167e+1f; t = mlaf(t, u.x, o0 ? +0.6000166177e-3f : o1 ? +0.5749821503e-4f : o2 ? +0.1288077235e+1f : -0.9454904199e+0f); t = mlaf(t, u.x, o0 ? -0.1665703603e-2f : o1 ? +0.6002851478e-5f : o2 ? -0.1816803217e+1f : -0.3667259514e+0f); t = mlaf(t, u.x, o0 ? +0.1795156277e-3f : o1 ? -0.2851036377e-2f : o2 ? +0.1249150872e+1f : +0.7155663371e+0f); t = mlaf(t, u.x, o0 ? +0.1914106123e-1f : o1 ? +0.2260518074e-1f : o2 ? -0.1328857988e+0f : -0.1262947265e-1f); d = dfmul_f2_f2_f(u, t); d = dfadd2_f2_f2_f2(d, o0 ? dfx(-0.<API key>+0) : o1 ? dfx(-0.<API key>+0) : o2 ? dfx(-0.<API key>+0) : dfx(-0.<API key>+0)); d = dfmul_f2_f2_f2(d, u); d = dfadd2_f2_f2_f2(d, o0 ? dfx(-0.<API key>+0) : o1 ? dfx(-0.<API key>+0) : o2 ? dfx(-0.<API key>) : dfx(-0.<API key>)); d = dfmul_f2_f2_f2(d, u); d = dfadd2_f2_f2_f2(d, o0 ? dfx(-0.<API key>+1) : o1 ? dfx(-0.<API key>+1) : o2 ? dfx(-0.<API key>+0) : dfx(-0.<API key>+0)); x = dfmul_f2_f2_f(o1 ? d : df(-a, 0), a); x = o1 ? x : dfadd2_f2_f2_f2(x, d); x = expk2f(x); x = o1 ? x : dfmul_f2_f2_f2(x, u); r = o3 ? (x.x + x.y) : 0; if (s < 0) r = 2 - r; r = xisnanf(s) ? SLEEF_NANf : r; return r; } #ifdef ENABLE_MAIN // gcc -w -DENABLE_MAIN -I../common sleefsp.c -lm #include <stdlib.h> int main(int argc, char **argv) { float d1 = atof(argv[1]); //float d2 = atof(argv[2]); //float d3 = atof(argv[3]); //printf("%.20g, %.20g\n", (double)d1, (double)d2); //float i2 = atoi(argv[2]); //float c = xatan2f_u1(d1, d2); //printf("round %.20g\n", (double)d1); printf("test = %.20g\n", (double)xsqrtf_u05(d1)); //printf("correct = %.20g\n", (double)roundf(d1)); //printf("rint %.20g\n", (double)d1); //printf("test = %.20g\n", (double)xrintf(d1)); //printf("correct = %.20g\n", (double)rintf(d1)); //Sleef_float2 r = xsincospif_u35(d); //printf("%g, %g\n", (double)r.x, (double)r.y); } #endif
<?php namespace Sonata\MediaBundle\Tests\Resizer; use Gaufrette\Adapter\InMemory; use Gaufrette\File; use Gaufrette\Filesystem; use Imagine\Image\Box; use Sonata\MediaBundle\Resizer\SimpleResizer; class SimpleResizerTest extends \<API key> { /** * @expectedException \RuntimeException */ public function <API key>() { $adapter = $this->getMock('Imagine\Image\ImagineInterface'); $media = $this->getMock('Sonata\MediaBundle\Model\MediaInterface'); $metadata = $this->getMock('Sonata\MediaBundle\Metadata\<API key>'); $file = $this->getMockBuilder('Gaufrette\File')-><API key>()->getMock(); $resizer = new SimpleResizer($adapter, 'foo', $metadata); $resizer->resize($media, $file, $file, 'bar', array()); } public function testResize() { $image = $this->getMock('Imagine\Image\ImageInterface'); $image->expects($this->once())->method('thumbnail')->will($this->returnValue($image)); $image->expects($this->once())->method('get')->will($this->returnValue(file_get_contents(__DIR__.'/../fixtures/logo.png'))); $adapter = $this->getMock('Imagine\Image\ImagineInterface'); $adapter->expects($this->any())->method('load')->will($this->returnValue($image)); $media = $this->getMock('Sonata\MediaBundle\Model\MediaInterface'); $media->expects($this->exactly(2))->method('getBox')->will($this->returnValue(new Box(535, 132))); $filesystem = new Filesystem(new InMemory()); $in = $filesystem->get('in', true); $in->setContent(file_get_contents(__DIR__.'/../fixtures/logo.png')); $out = $filesystem->get('out', true); $metadata = $this->getMock('Sonata\MediaBundle\Metadata\<API key>'); $metadata->expects($this->once())->method('get')->will($this->returnValue(array())); $resizer = new SimpleResizer($adapter, 'outbound', $metadata); $resizer->resize($media, $in, $out, 'bar', array('height' => null, 'width' => 90, 'quality' => 100)); } /** * @dataProvider getBoxSettings */ public function testGetBox($mode, $settings, Box $mediaSize, Box $result) { $adapter = $this->getMock('Imagine\Image\ImagineInterface'); $media = $this->getMock('Sonata\MediaBundle\Model\MediaInterface'); $media->expects($this->exactly(2))->method('getBox')->will($this->returnValue($mediaSize)); $metadata = $this->getMock('Sonata\MediaBundle\Metadata\<API key>'); $resizer = new SimpleResizer($adapter, $mode, $metadata); $box = $resizer->getBox($media, $settings); $this->assertInstanceOf('Imagine\Image\Box', $box); $this->assertSame($result->getWidth(), $box->getWidth()); $this->assertSame($result->getHeight(), $box->getHeight()); } public static function getBoxSettings() { return array( array('inset', array('width' => 90, 'height' => 90), new Box(100, 120), new Box(75, 90)), array('inset', array('width' => 90, 'height' => 90), new Box(50, 50), new Box(90, 90)), array('inset', array('width' => 90, 'height' => null), new Box(50, 50), new Box(90, 90)), array('inset', array('width' => 90, 'height' => null), new Box(567, 200), new Box(88, 31)), array('inset', array('width' => 100, 'height' => 100), new Box(567, 200), new Box(100, 35)), array('outbound', array('width' => 90, 'height' => 90), new Box(100, 120), new Box(90, 108)), array('outbound', array('width' => 90, 'height' => 90), new Box(50, 50), new Box(90, 90)), array('outbound', array('width' => 90, 'height' => null), new Box(50, 50), new Box(90, 90)), array('outbound', array('width' => 90, 'height' => null), new Box(567, 50), new Box(90, 8)), ); } }
'use strict'; /** * @module team/handler/remove */ const Team = require('../model/team'); /** * Delete an existing Team * @param {Request} request - Hapi request * @param {Reply} reply - Hapi Reply * @returns {Null} responds with redirect to Team list */ function remove (request, reply) { const {prefix} = request.route.realm.modifiers.route; Team .remove({_id: request.params.id}) .then(() => { reply().redirect(`${prefix}/recipe/manage-teams/list`); }); } module.exports = remove;
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports. config.<API key> = true # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true config.cache_store = :memory_store config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Store uploaded files on the local file system (see config/storage.yml for options) config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.<API key> = false config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true # Raises error for missing translations # config.action_view.<API key> = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. # config.file_watcher = ActiveSupport::<API key> end
using System.ComponentModel; using System.Runtime.CompilerServices; using System.Windows; using TUM.CMS.VplControl.Annotations; namespace TUM.CMS.VplControl.Core { public class BindingPoint : <API key> { private Point point; public BindingPoint(double x, double y) { point = new Point(x, y); } public double X { get { return point.X; } set { point.X = value; OnPropertyChanged(); OnPropertyChanged("Point"); } } public double Y { get { return point.Y; } set { point.Y = value; OnPropertyChanged(); OnPropertyChanged("Point"); } } public Point Point { get { return point; } } public event <API key> PropertyChanged; [<API key>] protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { var handler = PropertyChanged; if (handler != null) handler(this, new <API key>(propertyName)); } } }
import selftest from '../tool-testing/selftest.js'; import { parse, markBottom } from '../utils/parse-stack'; import _ from 'underscore'; import Fiber from 'fibers'; import Future from 'fibers/future'; import files from '../fs/files'; selftest.define("parse-stack - parse stack traces without fibers", () => { const err = new Error(); const parsedStack = parse(err).outsideFiber; const firstFilePath = files.<API key>(parsedStack[0].file); selftest.expectEqual(_.last(firstFilePath.split("/")), "parse-stack-test.js"); const lastFilePath = files.<API key>(_.last(parsedStack).file); selftest.expectEqual(_.last(lastFilePath.split("/")), "selftest.js"); markBottom(() => { const markedErr = new Error(); const { outsideFiber, insideFiber } = parse(markedErr); // Don't return an empty array selftest.expectEqual(insideFiber, undefined); // The stack trace should only contain this one function since we marked the // bottom selftest.expectEqual(outsideFiber.length, 1); const <API key> = files.<API key>(outsideFiber[0].file); selftest.expectEqual(_.last(<API key>.split("/")), "parse-stack-test.js"); })(); }); selftest.define("parse-stack - parse stack traces with fibers", () => { const parsedStack = parse({ stack: exampleStackTrace }); selftest.expectEqual(parsedStack.insideFiber[0].file, "template-compiler.js"); selftest.expectEqual(_.last(parsedStack.outsideFiber).file, "template-compiler.js"); }); // XXX I don't know how to actually create one of the crazy fiber stack traces // inside this test environment, so I have a copy-pasted one below that I // actually encountered. const exampleStackTrace = `TypeError: object is not a function at Object.Future.wait (/Users/sashko/git/meteor/dev_bundle/lib/node_modules/fibers/future.js:395:16) at TemplateCompiler.<API key> (caching-compiler.js:312:12) at TemplateCompiler.<API key> (template-compiler.js:28:32) at __bottom_mark__ (/Users/sashko/git/meteor/tools/parse-stack.js:92:14) at /Users/sashko/git/meteor/tools/isobuild/compiler-plugin.js:141:13 at /Users/sashko/git/meteor/tools/buildmessage.js:356:18 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:349:34 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:347:23 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at Object.enterJob (/Users/sashko/git/meteor/tools/buildmessage.js:321:26) at /Users/sashko/git/meteor/tools/isobuild/compiler-plugin.js:130:22 at Function.time (/Users/sashko/git/meteor/tools/profile.js:232:28) at /Users/sashko/git/meteor/tools/isobuild/compiler-plugin.js:129:15 at Function._.each._.forEach (/Users/sashko/git/meteor/dev_bundle/lib/node_modules/underscore/underscore.js:87:22) at [object Object]._.extend.runCompilerPlugins (/Users/sashko/git/meteor/tools/isobuild/compiler-plugin.js:118:7) at [object Object]._.extend._runCompilerPlugins (/Users/sashko/git/meteor/tools/isobuild/bundler.js:702:22) at /Users/sashko/git/meteor/tools/isobuild/bundler.js:504:34 at /Users/sashko/git/meteor/tools/buildmessage.js:356:18 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:349:34 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:347:23 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at Object.enterJob (/Users/sashko/git/meteor/tools/buildmessage.js:321:26) at [object Object]._.extend.make (/Users/sashko/git/meteor/tools/isobuild/bundler.js:498:18) at /Users/sashko/git/meteor/tools/isobuild/bundler.js:2044:14 at /Users/sashko/git/meteor/tools/isobuild/bundler.js:2126:20 at Array.forEach (native) at Function._.each._.forEach (/Users/sashko/git/meteor/dev_bundle/lib/node_modules/underscore/underscore.js:79:11) at /Users/sashko/git/meteor/tools/isobuild/bundler.js:2125:7 at /Users/sashko/git/meteor/tools/buildmessage.js:268:13 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:261:29 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:259:18 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:250:23 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at Object.capture (/Users/sashko/git/meteor/tools/buildmessage.js:249:19) at Object.exports.bundle (/Users/sashko/git/meteor/tools/isobuild/bundler.js:2029:31) at /Users/sashko/git/meteor/tools/run-app.js:557:36 at time (/Users/sashko/git/meteor/tools/profile.js:232:28) at Function.run (/Users/sashko/git/meteor/tools/profile.js:377:12) at bundleApp (/Users/sashko/git/meteor/tools/run-app.js:547:34) at [object Object]._.extend._runOnce (/Users/sashko/git/meteor/tools/run-app.js:600:35) at [object Object]._.extend._fiber (/Users/sashko/git/meteor/tools/run-app.js:848:28) at /Users/sashko/git/meteor/tools/run-app.js:402:12 - - - - - at TemplateCompiler.compileOneFile (template-compiler.js:43:23) at caching-compiler.js:292:32 at /Users/sashko/git/meteor/packages/caching-compiler/.npm/package/node_modules/async/lib/async.js:182:20 at replenish (/Users/sashko/git/meteor/packages/caching-compiler/.npm/package/node_modules/async/lib/async.js:317:21) at /Users/sashko/git/meteor/packages/caching-compiler/.npm/package/node_modules/async/lib/async.js:328:15 at Object.async.forEachLimit.async.eachLimit (/Users/sashko/git/meteor/packages/caching-compiler/.npm/package/node_modules/async/lib/async.js:221:35) at TemplateCompiler.<API key> (caching-compiler.js:277:11) at TemplateCompiler.<API key> (template-compiler.js:28:32) at __bottom_mark__ (/Users/sashko/git/meteor/tools/parse-stack.js:92:14) at /Users/sashko/git/meteor/tools/isobuild/compiler-plugin.js:141:13 at /Users/sashko/git/meteor/tools/buildmessage.js:356:18 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:349:34 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:347:23 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at Object.enterJob (/Users/sashko/git/meteor/tools/buildmessage.js:321:26) at /Users/sashko/git/meteor/tools/isobuild/compiler-plugin.js:130:22 at Function.time (/Users/sashko/git/meteor/tools/profile.js:232:28) at /Users/sashko/git/meteor/tools/isobuild/compiler-plugin.js:129:15 at Function._.each._.forEach (/Users/sashko/git/meteor/dev_bundle/lib/node_modules/underscore/underscore.js:87:22) at [object Object]._.extend.runCompilerPlugins (/Users/sashko/git/meteor/tools/isobuild/compiler-plugin.js:118:7) at [object Object]._.extend._runCompilerPlugins (/Users/sashko/git/meteor/tools/isobuild/bundler.js:702:22) at /Users/sashko/git/meteor/tools/isobuild/bundler.js:504:34 at /Users/sashko/git/meteor/tools/buildmessage.js:356:18 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:349:34 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:347:23 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at Object.enterJob (/Users/sashko/git/meteor/tools/buildmessage.js:321:26) at [object Object]._.extend.make (/Users/sashko/git/meteor/tools/isobuild/bundler.js:498:18) at /Users/sashko/git/meteor/tools/isobuild/bundler.js:2044:14 at /Users/sashko/git/meteor/tools/isobuild/bundler.js:2126:20 at Array.forEach (native) at Function._.each._.forEach (/Users/sashko/git/meteor/dev_bundle/lib/node_modules/underscore/underscore.js:79:11) at /Users/sashko/git/meteor/tools/isobuild/bundler.js:2125:7 at /Users/sashko/git/meteor/tools/buildmessage.js:268:13 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:261:29 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:259:18 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at /Users/sashko/git/meteor/tools/buildmessage.js:250:23 at [object Object]._.extend.withValue (/Users/sashko/git/meteor/tools/fiber-helpers.js:114:14) at Object.capture (/Users/sashko/git/meteor/tools/buildmessage.js:249:19) at Object.exports.bundle (/Users/sashko/git/meteor/tools/isobuild/bundler.js:2029:31) at /Users/sashko/git/meteor/tools/run-app.js:557:36 at time (/Users/sashko/git/meteor/tools/profile.js:232:28) at Function.run (/Users/sashko/git/meteor/tools/profile.js:377:12) at bundleApp (/Users/sashko/git/meteor/tools/run-app.js:547:34) at [object Object]._.extend._runOnce (/Users/sashko/git/meteor/tools/run-app.js:600:35) at [object Object]._.extend._fiber (/Users/sashko/git/meteor/tools/run-app.js:848:28) at /Users/sashko/git/meteor/tools/run-app.js:402:12`;
import Operator from '../Operator'; import Subscriber from '../Subscriber'; /** * Maps every value to the same value every time. * @param {any} value the value to map each incoming value to * @returns {Observable} an observable of the passed value that emits everytime the source does */ export default function mapTo<T, R>(value: R) { return this.lift(new MapToOperator(value)); } class MapToOperator<T, R> implements Operator<T, R> { value: R; constructor(value: R) { this.value = value; } call(subscriber: Subscriber<R>): Subscriber<T> { return new MapToSubscriber(subscriber, this.value); } } class MapToSubscriber<T, R> extends Subscriber<T> { value: R; constructor(destination: Subscriber<R>, value: R) { super(destination); this.value = value; } _next(x) { this.destination.next(this.value); } }
package unfiltered.netty import org.specs2.mutable.Specification import unfiltered.response.{ Pass, Ok, ResponseString } import unfiltered.request.{ GET, Params, Path => UFPath, POST, PUT, RemoteAddr, & } object ServerSpec extends Specification with unfiltered.specs2.netty.Served { def setup = _.plan(planify({ case GET(UFPath("/pass")) => Pass case GET(UFPath("/")) => ResponseString("test") ~> Ok case r @ GET(UFPath("/addr")) => ResponseString(r.remoteAddr) ~> Ok case GET(UFPath("/addr_extractor") & RemoteAddr(addr)) => ResponseString(addr) ~> Ok })).plan(async.Planify({ case GET(UFPath("/pass")) => Pass case req @ GET(UFPath("/planc")) => req.underlying.respond(ResponseString("planc") ~> Ok) })).plan(planify({ case GET(UFPath("/planb")) => ResponseString("planb") ~> Ok case GET(UFPath("/pass")) => ResponseString("pass") ~> Ok })).plan(planify({ case req @ UFPath("/params") & Params(p) & (POST(_) | PUT(_)) => Ok ~> ResponseString(req.method + ":" + p.map { case (k, vs) => vs.map(k + "=" + _).mkString("&") }.mkString("&")) })) "A Server" should { "respond to requests" in { http(req(host)).as_string must_== "test" } "provide a remote address" in { http(req(host / "addr")).as_string must_== "127.0.0.1" } "provide a remote address accounting for X-Forwarded-For header" in { http(req(host / "addr_extractor") <:< Map("X-Forwarded-For" -> "66.108.150.228")).as_string must_== "66.108.150.228" } "provide a remote address accounting for X-Forwarded-For header filtering private addresses" in { http(req(host / "addr_extractor") <:< Map("X-Forwarded-For" -> "172.31.255.255")).as_string must_== "127.0.0.1" } "respond to requests in ustream channel plan" in { http(req(host / "planc")).as_string must_== "planc" } "respond to requests in last channel handler" in { http(req(host / "planb")).as_string must_== "planb" } "pass upstream on Pass, respond in last handler" in { http(req(host / "pass")).as_string must_== "pass" } "echo POST parameters encoded in the entity body" in { http(req(host / "params") << Map("n0" -> "v0") ).as_string must_== "POST:n0=v0" } "echo PUT paremters encoded in the entity body" in { http(req(host / "params").<<(Map("n0" -> "v0"), PUT)).as_string must_== "PUT:n0=v0" } } }
# Security.Properties <API key> **Namespace:** [OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508.md) **Assembly:** OfficeDevPnP.Core.dll ## Syntax C public User[] <API key> { get; set; } Property Value Type: [OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508.User[]](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508.User.md) ## See also - [Security](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508.Security.md) - [OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508.md)
#!/usr/local/bin/ruby # <API key>: false # pi.rb # Calculates 3.1415.... (the number of times that a circle's diameter # will fit around the circle) using J. Machin's formula. require "bigdecimal" require "bigdecimal/math.rb" include BigMath if ARGV.size == 1 print "PI("+ARGV[0]+"):\n" p PI(ARGV[0].to_i) else print "TRY: ruby pi.rb 1000 \n" end
/** * Main JS file for Casper behaviours */ /*globals jQuery, document */ (function ($) { "use strict"; $(document).ready(function(){ $(".post-content").fitVids(); }); }(jQuery));
using System.Net.Security; using System.Security.Authentication.ExtendedProtection; namespace System.Net { internal class SslStreamContext : TransportContext { internal SslStreamContext(SslStream sslStream) { if (sslStream == null && GlobalLog.IsEnabled) { GlobalLog.Assert("SslStreamContext..ctor(): Not expecting a null sslStream!"); } _sslStream = sslStream; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { return _sslStream.GetChannelBinding(kind); } private readonly SslStream _sslStream; } }
basis.require('basis.l10n'); /** * @namespace basis.template */ var namespace = this.path; // import names var Class = basis.Class; var cleaner = basis.cleaner; var path = basis.path; var arraySearch = basis.array.search; var arrayAdd = basis.array.add; var arrayRemove = basis.array.remove; // Main part var templateList = []; var tmplFilesMap = {}; var DECLARATION_VERSION = 2; // token types /** @const */ var TYPE_ELEMENT = 1; /** @const */ var TYPE_ATTRIBUTE = 2; /** @const */ var <API key> = 4; /** @const */ var <API key> = 5; /** @const */ var <API key> = 6; /** @const */ var TYPE_TEXT = 3; /** @const */ var TYPE_COMMENT = 8; // references on fields in declaration /** @const */ var TOKEN_TYPE = 0; /** @const */ var TOKEN_BINDINGS = 1; /** @const */ var TOKEN_REFS = 2; /** @const */ var ATTR_NAME = 3; /** @const */ var ATTR_VALUE = 4; var ATTR_EVENT_RX = /^event-(.+)$/; var ATTR_NAME_BY_TYPE = { 4: 'class', 5: 'style' }; var ATTR_TYPE_BY_NAME = { 'class': <API key>, 'style': <API key> }; var ATTR_VALUE_INDEX = { 2: ATTR_VALUE, 4: ATTR_VALUE - 1, 5: ATTR_VALUE - 1, 6: 2 }; /** @const */ var ELEMENT_NAME = 3; /** @const */ var ELEMENT_ATTRS = 4; /** @const */ var ELEMENT_CHILDS = 5; /** @const */ var TEXT_VALUE = 3; /** @const */ var COMMENT_VALUE = 3; // parsing variables var SYNTAX_ERROR = 'Invalid or unsupported syntax'; // html parsing states var TEXT = /((?:.|[\r\n])*?)(\{(?:l10n:([a-zA-Z_][a-zA-Z0-9_\-]*(?:\.[a-zA-Z_][a-zA-Z0-9_\-]*)*(?:\.\{[a-zA-Z_][a-zA-Z0-9_\-]*\})?)\})?|<(\/|! var TAG_NAME = /([a-z_][a-z0-9\-_]*)(:|\{|\s*(\/?>)?)/ig; var <API key> = /([a-z_][a-z0-9_\-]*)(:|\{|=|\s*)|(\/?>)/ig; var COMMENT = /(.|[\r\n])*? var CLOSE_TAG = /([a-z_][a-z0-9_\-]*(?::[a-z_][a-z0-9_\-]*)?)>/ig; var REFERENCE = /([a-z_][a-z0-9_]*)(\||\}\s*)/ig; var ATTRIBUTE_VALUE = /"((?:(\\")|[^"])*?)"\s*/g; var BREAK_TAG_PARSE = /^/g; var SINGLETON_TAG = /^(area|base|br|col|command|embed|hr|img|input|link|meta|param|source)$/i; var TAG_IGNORE_CONTENT = { text: /((?:.|[\r\n])*?)(?:<\/b:text>|$)/g, style: /((?:.|[\r\n])*?)(?:<\/b:style>|$)/g }; var CSS_CLASSNAME_START = /^\-?([_a-z]|[^\x00-\xb1]|\\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?|\\[^\n\r\f0-9a-f])/i; // http://www.w3.org/TR/css3-selectors/#lex var <API key> = 8; var CSS_NESTED_ATRULE = /^(media|supports|document)\b/i; var <API key> = 8; // maxlength(media | supports | document) = 8 symbols var CSS_FNSELECTOR = /^(not|has|matches|nth-child|nth-last-child)\(/i; var <API key> = 15; // maxlength(not | has | matches | nth-child | nth-last-child) + '(' = 15 symbols var quoteUnescape = /\\"/g; /** * Parse html into tokens. * @param {string} source Source of template * @return {Array.<object>} */ var tokenize = function(source){ var result = []; var tagStack = []; var lastTag = { childs: result }; var sourceText; var token; var bufferPos; var startPos; var parseTag = false; var textStateEndPos = 0; var textEndPos; var state = TEXT; var pos = 0; var m; source = source.trim(); /** @cut */ result.warns = []; while (pos < source.length || state != TEXT) { state.lastIndex = pos; startPos = pos; m = state.exec(source); if (!m || m.index !== pos) { // treat broken comment reference as comment content if (state == REFERENCE && token && token.type == TYPE_COMMENT) { state = COMMENT; continue; } if (parseTag) lastTag = tagStack.pop(); if (token) lastTag.childs.pop(); if (token = lastTag.childs.pop()) { if (token.type == TYPE_TEXT && !token.refs) textStateEndPos -= 'len' in token ? token.len : token.value.length; else lastTag.childs.push(token); } parseTag = false; state = TEXT; continue; } pos = state.lastIndex; //stat[state] = (stat[state] || 0) + 1; switch (state) { case TEXT: textEndPos = startPos + m[1].length; if (textStateEndPos != textEndPos) { sourceText = textStateEndPos == startPos ? m[1] : source.substring(textStateEndPos, textEndPos); token = sourceText.replace(/\s*(\r\n?|\n\r?)\s*/g, ''); if (token) lastTag.childs.push({ type: TYPE_TEXT, len: sourceText.length, value: token }); } textStateEndPos = textEndPos; if (m[3]) { lastTag.childs.push({ type: TYPE_TEXT, refs: ['l10n:' + m[3]], value: '{l10n:' + m[3] + '}' }); } else if (m[2] == '{') { bufferPos = pos - 1; lastTag.childs.push(token = { type: TYPE_TEXT }); state = REFERENCE; } else if (m[4]) { if (m[4] == '/') { token = null; state = CLOSE_TAG; } else //if (m[3] == '!--') { lastTag.childs.push(token = { type: TYPE_COMMENT }); if (m[5]) { bufferPos = pos - m[5].length; state = REFERENCE; } else { bufferPos = pos; state = COMMENT; } } } else if (m[2]) // m[2] == '<' open tag { parseTag = true; tagStack.push(lastTag); lastTag.childs.push(token = { type: TYPE_ELEMENT, attrs: [], childs: [] }); lastTag = token; state = TAG_NAME; } break; case CLOSE_TAG: if (m[1] !== (lastTag.prefix ? lastTag.prefix + ':' : '') + lastTag.name) { //throw 'Wrong close tag'; lastTag.childs.push({ type: TYPE_TEXT, value: '</' + m[0] }); } else lastTag = tagStack.pop(); state = TEXT; break; case TAG_NAME: case <API key>: if (m[2] == ':') { if (token.prefix) // prefix was before, break tag parse state = BREAK_TAG_PARSE; else token.prefix = m[1]; break; } if (m[1]) { // store name (it may be null when check for attribute and end) token.name = m[1]; // store attribute if (token.type == TYPE_ATTRIBUTE) lastTag.attrs.push(token); } if (m[2] == '{') { if (token.type == TYPE_ELEMENT) state = REFERENCE; else state = BREAK_TAG_PARSE; break; } if (m[3]) // end tag declaration { parseTag = false; if (m[3] == '/>' || (!lastTag.prefix && SINGLETON_TAG.test(lastTag.name))) { /** @cut */ if (m[3] != '/>') /** @cut */ result.warns.push('Tag <' + lastTag.name + '> doesn\'t closed explicit (use `/>` as tag ending)'); lastTag = tagStack.pop(); } else { // otherwise m[3] == '>' if (lastTag.prefix == 'b' && lastTag.name in TAG_IGNORE_CONTENT) { state = TAG_IGNORE_CONTENT[lastTag.name]; break; } } state = TEXT; break; } if (m[2] == '=') // <API key> only { state = ATTRIBUTE_VALUE; break; } // m[2] == '\s+' next attr, state doesn't change token = { type: TYPE_ATTRIBUTE }; state = <API key>; break; case COMMENT: token.value = source.substring(bufferPos, pos - 3); state = TEXT; break; case REFERENCE: // add reference to token list name if (token.refs) token.refs.push(m[1]); else token.refs = [m[1]]; // go next if (m[2] != '|') // m[2] == '}\s*' { if (token.type == TYPE_TEXT) { pos -= m[2].length - 1; token.value = source.substring(bufferPos, pos); state = TEXT; } else if (token.type == TYPE_COMMENT) { state = COMMENT; } else if (token.type == TYPE_ATTRIBUTE && source[pos] == '=') { pos++; state = ATTRIBUTE_VALUE; } else // ATTRIBUTE || ELEMENT { token = { type: TYPE_ATTRIBUTE }; state = <API key>; } } // continue to collect references break; case ATTRIBUTE_VALUE: token.value = m[1].replace(quoteUnescape, '"'); token = { type: TYPE_ATTRIBUTE }; state = <API key>; break; case TAG_IGNORE_CONTENT.text: case TAG_IGNORE_CONTENT.style: lastTag.childs.push({ type: TYPE_TEXT, value: m[1] }); lastTag = tagStack.pop(); state = TEXT; break; default: throw 'Parser bug'; // Must never to be here; bug in parser otherwise } if (state == TEXT) textStateEndPos = pos; } if (textStateEndPos != pos) lastTag.childs.push({ type: TYPE_TEXT, value: source.substring(textStateEndPos, pos) }); /** @cut */ if (lastTag.name) /** @cut */ result.warns.push('No close tag for <' + lastTag.name + '>'); /** @cut */ /** @cut */ if (!result.warns.length) /** @cut */ delete result.warns; result.templateTokens = true; return result; }; // Convert tokens to declaration var tokenTemplate = {}; var L10nProxyToken = basis.Token.subclass({ className: namespace + '.L10nProxyToken', token: null, url: '', init: function(token){ this.url = token.dictionary.resource.url + ':' + token.name; this.token = token; this.set(); token.attach(this.set, this); }, set: function(){ return basis.Token.prototype.set.call(this, this.token.type == 'markup' ? processMarkup(this.token.value, this.token.name + '@' + this.token.dictionary.resource.url) : '' ); }, destroy: function(){ basis.Token.prototype.destroy.call(this); this.token = null; } }); function processMarkup(value, id){ // temporary return '<span class="basisjs-markup" data-basisjs-l10n="' + id + '">' + String(value) + '</span>'; } function getL10nTemplate(token){ if (typeof token == 'string') token = basis.l10n.token(token); if (!token) return null; var id = token.basisObjectId; var template = tokenTemplate[id]; if (!template) template = tokenTemplate[id] = new Template(new L10nProxyToken(token)); return template; } function genIsolateMarker(){ return 'i' + basis.genUID() + '__'; } function isolateCss(css, prefix){ function jumpAfter(str, offset){ var index = css.indexOf(str, offset); i = index !== -1 ? index + str.length : sym.length; } function parseString(endSym){ var quote = sym[i]; if (quote !== '"' && quote !== '\'') return; for (i++; i < len && sym[i] !== quote; i++) if (sym[i] === '\\') i++; return true; } function parseBraces(endSym){ var bracket = sym[i]; if (bracket === '(') { jumpAfter(')', i + 1); return true; } if (bracket === '[') { for (i++; i < len && sym[i] !== ']'; i++) parseString(); return true; } } function parseComment(){ if (sym[i] !== '/' || sym[i + 1] !== '*') return; jumpAfter('*/', i + 2); return true; } function parsePseudoContent(){ for (; i < len && sym[i] != ')'; i++) if (parseComment() || parseBraces() || parsePseudo() || parseClassName()) continue; } function parsePseudo(){ if (sym[i] !== ':') return; var m = css.substr(i + 1, <API key>).match(CSS_FNSELECTOR); if (m) { i += m[0].length + 1; parsePseudoContent(); } return true; } function parseAtRule(){ if (sym[i] !== '@') return; var m = css.substr(i + 1, <API key>).match(CSS_NESTED_ATRULE); if (m) { i += m[0].length; nestedStyleSheet = true; } return true; } function parseBlock(){ if (sym[i] !== '{') return; if (nestedStyleSheet) { i++; parseStyleSheet(true); return; } for (i++; i < len && sym[i] !== '}'; i++) parseString() || parseBraces(); return true; } function parseClassName(){ if (sym[i] !== '.') return; var m = css.substr(i + 1, <API key>).match(CSS_CLASSNAME_START); if (m) { i++; result.push(css.substring(lastMatchPos, i), prefix); lastMatchPos = i; } return true; } function parseStyleSheet(nested){ for (nestedStyleSheet = false; i < len; i++) { if (parseComment() || parseAtRule() || parsePseudo() || parseBraces() || parseClassName()) continue; if (nested && sym[i] == '}') return; parseBlock(); } } var result = []; var sym = css.split(''); var len = sym.length; var lastMatchPos = 0; var i = 0; var nestedStyleSheet; if (!prefix) prefix = genIsolateMarker(); parseStyleSheet(false); return result.join('') + css.substring(lastMatchPos); } /** * make compiled version of template */ var makeDeclaration = (function(){ var IDENT = /^[a-z_][a-z0-9_\-]*$/i; var CLASS_ATTR_PARTS = /(\S+)/g; var CLASS_ATTR_BINDING = /^((?:[a-z_][a-z0-9_\-]*)?(?::(?:[a-z_][a-z0-9_\-]*)?)?)\{((anim:)?[a-z_][a-z0-9_\-]*)\}$/i; var STYLE_ATTR_PARTS = /\s*[^:]+?\s*:(?:\(.*?\)|".*?"|'.*?'|[^;]+?)+(?:;|$)/gi; var STYLE_PROPERTY = /\s*([^:]+?)\s*:((?:\(.*?\)|".*?"|'.*?'|[^;]+?)+);?$/i; var STYLE_ATTR_BINDING = /\{([a-z_][a-z0-9_]*)\}/i; var ATTR_BINDING = /\{([a-z_][a-z0-9_]*|l10n:[a-z_][a-z0-9_]*(?:\.[a-z_][a-z0-9_]*)*(?:\.\{[a-z_][a-z0-9_]*\})?)\}/i; var NAMED_CHARACTER_REF = /&([a-z]+|#[0-9]+|#x[0-9a-f]{1,4});?/gi; var tokenMap = basis.NODE_ENV ? __nodejsRequire('./template/htmlentity.json') : {}; var tokenElement = !basis.NODE_ENV ? document.createElement('div') : null; var includeStack = []; var <API key> = {}; function name(token){ return (token.prefix ? token.prefix + ':' : '') + token.name; } function namedCharReplace(m, token){ if (!tokenMap[token]) { if (token.charAt(0) == ' { tokenMap[token] = String.fromCharCode( token.charAt(1) == 'x' || token.charAt(1) == 'X' ? parseInt(token.substr(2), 16) : token.substr(1) ); } else { if (tokenElement) { tokenElement.innerHTML = m; tokenMap[token] = tokenElement.firstChild ? tokenElement.firstChild.nodeValue : m; } } } return tokenMap[token] || m; } function untoken(value){ return value.replace(NAMED_CHARACTER_REF, namedCharReplace); } function refList(token){ var array = token.refs; if (!array || !array.length) return 0; return array; } function buildAttrExpression(parts){ var bindName; var names = []; var expression = []; var map = {}; for (var j = 0; j < parts.length; j++) if (j % 2) { bindName = parts[j]; if (!map[bindName]) { map[bindName] = names.length; names.push(bindName); } expression.push(map[bindName]); } else { if (parts[j]) expression.push(untoken(parts[j])); } return [names, expression]; } function processAttr(name, value){ var bindings = 0; var parts; var m; // other attributes if (value) { switch (name) { case 'class': if (parts = value.match(CLASS_ATTR_PARTS)) { var newValue = []; bindings = []; for (var j = 0, part; part = parts[j]; j++) { if (m = part.match(CLASS_ATTR_BINDING)) bindings.push([m[1] || '', m[2]]); else newValue.push(part); } // set new value value = newValue.join(' '); } break; case 'style': var props = []; bindings = []; if (parts = value.match(STYLE_ATTR_PARTS)) { for (var j = 0, part; part = parts[j]; j++) { var m = part.match(STYLE_PROPERTY); var propertyName = m[1]; var value = m[2].trim(); var valueParts = value.split(STYLE_ATTR_BINDING); if (valueParts.length > 1) { var expr = buildAttrExpression(valueParts); expr.push(propertyName); bindings.push(expr); } else props.push(propertyName + ': ' + untoken(value)); } } else { /** @cut */ if (/\S/.test(value)) /** @cut */ basis.dev.warn('Bad value for style attribute (value ignored):', value); } value = props.join('; '); if (value) value += ';'; break; default: parts = value.split(ATTR_BINDING); if (parts.length > 1) bindings = buildAttrExpression(parts); else value = untoken(value); } } if (bindings && !bindings.length) bindings = 0; return { binding: bindings, value: value, type: ATTR_TYPE_BY_NAME[name] || 2 }; } function attrs(token, declToken, optimizeSize){ var attrs = token.attrs; var result = []; var styleAttr; var display; var m; for (var i = 0, attr; attr = attrs[i]; i++) { // process special attributes (basis namespace) if (attr.prefix == 'b') { switch (attr.name) { case 'ref': var refs = (attr.value || '').trim().split(/\s+/); for (var j = 0; j < refs.length; j++) addTokenRef(declToken, refs[j]); break; case 'show': case 'hide': display = attr; break; } continue; } if (m = attr.name.match(ATTR_EVENT_RX)) { result.push(m[1] == attr.value ? [<API key>, m[1]] : [<API key>, m[1], attr.value]); continue; } var parsed = processAttr(attr.name, attr.value); var item = [ parsed.type, // TOKEN_TYPE = 0 parsed.binding, // TOKEN_BINDINGS = 1 refList(attr) // TOKEN_REFS = 2 ]; // ATTR_NAME = 3 if (parsed.type == 2) item.push(name(attr)); // ATTR_VALUE = 4 if (parsed.value && (!optimizeSize || !parsed.binding || parsed.type != 2)) item.push(parsed.value); if (parsed.type == <API key>) styleAttr = item; result.push(item); } if (display) { if (!styleAttr) { styleAttr = [<API key>, 0, 0]; result.push(styleAttr); } if (!styleAttr[1]) styleAttr[1] = []; var displayExpr = buildAttrExpression((display.value || display.name).split(ATTR_BINDING)); if (displayExpr[0].length - displayExpr[1].length) { // expression has non-binding parts, treat as constant styleAttr[3] = (styleAttr[3] ? styleAttr[3] + '; ' : '') + // visible when: // show & value is not empty // hide & value is empty (display.name == 'show' ^ display.value === '' ? '' : 'display: none'); } else { if (display.name == 'show') styleAttr[3] = (styleAttr[3] ? styleAttr[3] + '; ' : '') + 'display: none'; styleAttr[1].push(displayExpr.concat('display', display.name)); } } return result.length ? result : 0; } function addTokenRef(token, refName){ if (!token[TOKEN_REFS]) token[TOKEN_REFS] = []; arrayAdd(token[TOKEN_REFS], refName); if (refName != 'element') token[TOKEN_BINDINGS] = token[TOKEN_REFS].length == 1 ? refName : 0; } function removeTokenRef(token, refName){ var idx = token[TOKEN_REFS].indexOf(refName); if (idx != -1) { var indexBinding = token[TOKEN_BINDINGS] && typeof token[TOKEN_BINDINGS] == 'number'; token[TOKEN_REFS].splice(idx, 1); if (indexBinding) if (idx == token[TOKEN_BINDINGS] - 1) token[TOKEN_BINDINGS] = refName; if (!token[TOKEN_REFS].length) token[TOKEN_REFS] = 0; else { if (indexBinding) token[TOKEN_BINDINGS] -= idx < (token[TOKEN_BINDINGS] - 1); } } } function tokenAttrs(token){ var result = {}; if (token.attrs) for (var i = 0, attr; attr = token.attrs[i]; i++) result[name(attr)] = attr.value; return result; } function addUnique(array, items){ for (var i = 0; i < items.length; i++) arrayAdd(array, items[i]); } function addStyles(array, items, prefix){ for (var i = 0, item; item = items[i]; i++) if (item[1] !== <API key>) item[1] = prefix + item[1]; array.unshift.apply(array, items); } function addStyle(template, token, src, isolatePrefix){ var url; if (src) { /** @cut */ if (!/^(\.\/|\.\.|\/)/.test(src)) /** @cut */ basis.dev.warn('Bad usage: <b:' + token.name + ' src=\"' + src + '\"/>.\nFilenames should starts with `./`, `..` or `/`. Otherwise it will treats as special reference in next minor release.'); url = path.resolve(template.baseURI + src); } else { var text = token.childs[0]; url = basis.resource.virtual('css', text ? text.value : '', template.sourceUrl).url; } template.resources.push([url, isolatePrefix]); return url; } // main function function process(tokens, template, options, context){ function modifyAttr(token, name, action){ var attrs = tokenAttrs(token); if (name) attrs.name = name; if (!attrs.name) { /** @cut */ template.warns.push('Instruction <b:' + token.name + '> has no attribute name'); return; } if (!IDENT.test(attrs.name)) { /** @cut */ template.warns.push('Bad attribute name `' + attrs.name + '`'); return; } var includedToken = tokenRefMap[attrs.ref || 'element']; if (includedToken) { if (includedToken.token[TOKEN_TYPE] == TYPE_ELEMENT) { var itAttrs = includedToken.token; var isEvent = attrs.name.match(ATTR_EVENT_RX); var itType = isEvent ? <API key> : ATTR_TYPE_BY_NAME[attrs.name] || TYPE_ATTRIBUTE; var valueIdx = ATTR_VALUE_INDEX[itType] || ATTR_VALUE; var itAttrToken = itAttrs && arraySearch(itAttrs, attrs.name, function(token){ if (token[TOKEN_TYPE] == <API key>) return 'event-' + token[1]; return ATTR_NAME_BY_TYPE[token[TOKEN_TYPE]] || token[ATTR_NAME]; }, ELEMENT_ATTRS); if (!itAttrToken && action != 'remove') { if (isEvent) { itAttrToken = [ itType, isEvent[1] ]; } else { itAttrToken = [ itType, 0, 0, itType == TYPE_ATTRIBUTE ? attrs.name : '' ]; if (itType == TYPE_ATTRIBUTE) itAttrToken.push(''); } if (!itAttrs) { itAttrs = []; includedToken.token.push(itAttrs); } itAttrs.push(itAttrToken); } var classOrStyle = attrs.name == 'class' || attrs.name == 'style'; switch (action){ case 'set': // event-* attribute special case if (itAttrToken[TOKEN_TYPE] == <API key>) { if (attrs.value == isEvent[1]) itAttrToken.length = 2; else itAttrToken[valueIdx] = attrs.value; return; } // other attributes var parsed = processAttr(attrs.name, attrs.value); itAttrToken[TOKEN_BINDINGS] = parsed.binding; if (!options.optimizeSize || !itAttrToken[TOKEN_BINDINGS] || classOrStyle) itAttrToken[valueIdx] = parsed.value || ''; else itAttrToken.length = valueIdx; if (classOrStyle) if (!itAttrToken[TOKEN_BINDINGS] && !itAttrToken[valueIdx]) { arrayRemove(itAttrs, itAttrToken); return; } break; case 'append': var parsed = processAttr(attrs.name, attrs.value); if (!isEvent) { if (parsed.binding) { var attrBindings = itAttrToken[TOKEN_BINDINGS]; if (attrBindings) { switch (attrs.name) { case 'style': var oldBindingMap = {}; for (var i = 0, oldBinding; oldBinding = attrBindings[i]; i++) oldBindingMap[oldBinding[2]] = i; for (var i = 0, newBinding; newBinding = parsed.binding[i]; i++) if (newBinding[2] in oldBindingMap) attrBindings[oldBindingMap[newBinding[2]]] = newBinding; else attrBindings.push(newBinding); break; case 'class': attrBindings.push.apply(attrBindings, parsed.binding); break; default: parsed.binding[0].forEach(function(name){ arrayAdd(this, name); }, attrBindings[0]); for (var i = 0; i < parsed.binding[1].length; i++) { var value = parsed.binding[1][i]; if (typeof value == 'number') value = attrBindings[0].indexOf(parsed.binding[0][value]); attrBindings[1].push(value); } } } else { itAttrToken[TOKEN_BINDINGS] = parsed.binding; if (!classOrStyle) itAttrToken[TOKEN_BINDINGS][1].unshift(itAttrToken[valueIdx]); } } else { if (!classOrStyle && itAttrToken[TOKEN_BINDINGS]) itAttrToken[TOKEN_BINDINGS][1].push(attrs.value); } } if (parsed.value) itAttrToken[valueIdx] = (itAttrToken[valueIdx] || '') + (itAttrToken[valueIdx] && (isEvent || classOrStyle) ? ' ' : '') + parsed.value; if (classOrStyle) if (!itAttrToken[TOKEN_BINDINGS] && !itAttrToken[valueIdx]) { arrayRemove(itAttrs, itAttrToken); return; } break; case 'remove': if (itAttrToken) arrayRemove(itAttrs, itAttrToken); break; } } else { /** @cut */ template.warns.push('Attribute modificator is not reference to element token (reference name: ' + (attrs.ref || 'element') + ')'); } } } var result = []; for (var i = 0, token, item; token = tokens[i]; i++) { var refs = refList(token); var bindings = refs && refs.length == 1 ? refs[0] : 0; switch (token.type) { case TYPE_ELEMENT: // special elements (basis namespace) if (token.prefix == 'b') { var elAttrs = tokenAttrs(token); switch (token.name) { case 'style': var styleNamespace = elAttrs.namespace || elAttrs.ns; var styleIsolate = styleNamespace ? <API key> : (context && context.isolate) || ''; var src = addStyle(template, token, elAttrs.src, styleIsolate); if (styleNamespace) { if (src in <API key> == false) <API key>[src] = genIsolateMarker(); template.styleNSPrefix[styleNamespace] = <API key>[src]; } break; case 'isolate': if (!template.isolate) template.isolate = elAttrs.prefix || options.isolate || genIsolateMarker(); /** @cut */ else /** @cut */ basis.dev.warn('<b:isolate> is set already to `' + template.isolate + '`'); break; case 'l10n': /** @cut */ if (template.l10nResolved) /** @cut */ template.warns.push('<b:l10n> must be declared before any `l10n:` token (instruction ignored)'); if (elAttrs.src) { /** @cut */ if (!/^(\.\/|\.\.|\/)/.test(elAttrs.src)) /** @cut */ basis.dev.warn('Bad usage: <b:' + token.name + ' src=\"' + elAttrs.src + '\"/>.\nFilenames should starts with `./`, `..` or `/`. Otherwise it will treats as special reference in next minor release.'); template.dictURI = path.resolve(template.baseURI, elAttrs.src); } break; case 'define': if ('name' in elAttrs && !template.defines[elAttrs.name]) { switch (elAttrs.type) { case 'bool': template.defines[elAttrs.name] = [elAttrs['default'] == 'true' ? 1 : 0]; break; case 'enum': var values = elAttrs.values ? elAttrs.values.trim().split(' ') : []; template.defines[elAttrs.name] = [values.indexOf(elAttrs['default']) + 1, values]; break; /** @cut */ default: /** @cut */ template.warns.push('Bad define type `' + elAttrs.type + '` for ' + elAttrs.name); } } break; case 'text': var text = token.childs[0]; tokens[i--] = basis.object.extend(text, { refs: (elAttrs.ref || '').trim().split(/\s+/), value: 'notrim' in elAttrs ? text.value : text.value.replace(/^\s*[\r\n]+|[\r\n]\s*$/g, '') }); break; case 'include': var templateSrc = elAttrs.src; if (templateSrc) { var isTemplateRef = /^#\d+$/.test(templateSrc); var isDocumentIdRef = /^id:/.test(templateSrc); var url = isTemplateRef ? templateSrc.substr(1) : templateSrc; var resource; if (isTemplateRef) { // <b:include src="#123"/> resource = templateList[url]; } else if (isDocumentIdRef) { // <b:include src="id:foo"/> resource = <API key>(url.substr(3)); } else if (/^[a-z0-9\.]+$/i.test(url) && !/\.tmpl$/.test(url)) { // <b:include src="foo.bar.baz"/> resource = getSourceByPath(url); } else { // <b:include src="./path/to/file.tmpl"/> /** @cut */ if (!/^(\.\/|\.\.|\/)/.test(url)) /** @cut */ basis.dev.warn('Bad usage: <b:include src=\"' + url + '\"/>.\nFilenames should starts with `./`, `..` or `/`. Otherwise it will treats as special reference in next minor release.'); resource = basis.resource(path.resolve(template.baseURI + url)); } if (!resource) { /** @cut */ template.warns.push('<b:include src="' + templateSrc + '"> is not resolved, instruction ignored'); /** @cut */ basis.dev.warn('<b:include src="' + templateSrc + '"> is not resolved, instruction ignored'); continue; } // prevent recursion if (includeStack.indexOf(resource) == -1) { var isolatePrefix = 'isolate' in elAttrs ? elAttrs.isolate || genIsolateMarker() : ''; var decl; if (!isDocumentIdRef) arrayAdd(template.deps, resource); if (isTemplateRef) { // source wrapper if (resource.source.bindingBridge) arrayAdd(template.deps, resource.source); decl = getDeclFromSource(resource.source, resource.baseURI, true, options); } else { decl = getDeclFromSource(resource, resource.url ? path.dirname(resource.url) + '/' : '', true, options); } if (decl.resources && 'no-style' in elAttrs == false) addStyles(template.resources, decl.resources, isolatePrefix); if (decl.deps) addUnique(template.deps, decl.deps); /** @cut */ if (decl.l10n) /** @cut */ addUnique(template.l10n, decl.l10n); var tokenRefMap = normalizeRefs(decl.tokens); var instructions = (token.childs || []).slice(); var styleNSPrefixMap = basis.object.slice(decl.styleNSPrefix); if (elAttrs['class']) instructions.push({ type: TYPE_ELEMENT, prefix: 'b', name: 'append-class', attrs: [ { type: TYPE_ATTRIBUTE, name: 'value', value: elAttrs['class'] } ] }); if (elAttrs.id) instructions.push({ type: TYPE_ELEMENT, prefix: 'b', name: 'set-attr', attrs: [ { type: TYPE_ATTRIBUTE, name: 'name', value: 'id' }, { type: TYPE_ATTRIBUTE, name: 'value', value: elAttrs.id } ] }); if (elAttrs.ref) if (tokenRefMap.element) elAttrs.ref.trim().split(/\s+/).map(function(refName){ addTokenRef(tokenRefMap.element.token, refName); }); for (var j = 0, child; child = instructions[j]; j++) { // process special elements (basis namespace) if (child.type == TYPE_ELEMENT && child.prefix == 'b') { switch (child.name) { case 'style': var childAttrs = tokenAttrs(child); var styleNamespace = childAttrs.namespace || childAttrs.ns; var styleIsolate = styleNamespace ? <API key> : isolatePrefix; var src = addStyle(template, child, childAttrs.src, styleIsolate); if (styleNamespace) { if (src in <API key> == false) <API key>[src] = genIsolateMarker(); styleNSPrefixMap[styleNamespace] = <API key>[src]; } break; case 'replace': case 'remove': case 'before': case 'after': var replaceOrRemove = child.name == 'replace' || child.name == 'remove'; var childAttrs = tokenAttrs(child); var ref = 'ref' in childAttrs || !replaceOrRemove ? childAttrs.ref : 'element'; var tokenRef = ref && tokenRefMap[ref]; //if (!tokenRef) if (tokenRef) { var pos = tokenRef.owner.indexOf(tokenRef.token); if (pos != -1) { var args = [pos + (child.name == 'after'), replaceOrRemove]; if (child.name != 'remove') args = args.concat(process(child.childs, template, options) || []); tokenRef.owner.splice.apply(tokenRef.owner, args); } } break; case 'prepend': case 'append': var childAttrs = tokenAttrs(child); var ref = 'ref' in childAttrs ? childAttrs.ref : 'element'; var tokenRef = ref && tokenRefMap[ref]; var token = tokenRef && tokenRef.token; if (token && token[TOKEN_TYPE] == TYPE_ELEMENT) { var childs = process(child.childs, template, options) || []; if (child.name == 'prepend') token.splice.apply(token, [ELEMENT_ATTRS, 0].concat(childs)); else token.push.apply(token, childs); } break; case 'attr': case 'set-attr': modifyAttr(child, false, 'set'); break; case 'append-attr': modifyAttr(child, false, 'append'); break; case 'remove-attr': modifyAttr(child, false, 'remove'); break; case 'class': case 'append-class': modifyAttr(child, 'class', 'append'); break; case 'set-class': modifyAttr(child, 'class', 'set'); break; case 'remove-class': modifyAttr(child, 'class', 'remove'); break; case 'add-ref': var childAttrs = tokenAttrs(child); var ref = 'ref' in childAttrs ? childAttrs.ref : 'element'; var tokenRef = ref && tokenRefMap[ref]; var token = tokenRef && tokenRef.token; if (token && childAttrs.name) addTokenRef(token, childAttrs.name); break; case 'remove-ref': var childAttrs = tokenAttrs(child); var ref = 'ref' in childAttrs ? childAttrs.ref : 'element'; var tokenRef = ref && tokenRefMap[ref]; var token = tokenRef && tokenRef.token; if (token) removeTokenRef(token, childAttrs.name || childAttrs.ref); break; default: /** @cut */ template.warns.push('Unknown instruction tag <b:' + child.name + '>'); } } else decl.tokens.push.apply(decl.tokens, process([child], template, options) || []); } if (tokenRefMap.element) removeTokenRef(tokenRefMap.element.token, 'element'); // complete template namespace prefix map basis.object.complete(template.styleNSPrefix, styleNSPrefixMap); // isolate if (isolatePrefix) isolateTokens(decl.tokens, isolatePrefix); else // inherit isolate from nested template if (decl.isolate && !template.isolate) template.isolate = options.isolate || genIsolateMarker(); //resources.push.apply(resources, tokens.resources); result.push.apply(result, decl.tokens); } else { /** @cut */ var stack = includeStack.slice(includeStack.indexOf(resource) || 0).concat(resource).map(function(res){ /** @cut */ if (res instanceof Template) /** @cut */ res = res.source; /** @cut */ if (res instanceof L10nProxyToken) /** @cut */ return '{l10n:' + res.token.name + '@' + res.token.dictionary.resource.url + '}'; /** @cut */ return res.url || '[inline template]'; /** @cut */ }); /** @cut */ template.warns.push('Recursion: ', stack.join(' -> ')); /** @cut */ basis.dev.warn('Recursion in template: ', stack.join(' -> ')); } } break; } // don't add to declaration continue; } item = [ 1, // TOKEN_TYPE = 0 bindings, // TOKEN_BINDINGS = 1 refs, // TOKEN_REFS = 2 name(token) // ELEMENT_NAME = 3 ]; item.push.apply(item, attrs(token, item, options.optimizeSize) || []); item.push.apply(item, process(token.childs, template, options) || []); break; case TYPE_TEXT: if (refs && refs.length == 2 && arraySearch(refs, 'element')) bindings = refs[+!refs.lastSearchIndex]; // get first one reference but not `element` // process l10n if (bindings) { var l10nBinding = absl10n(bindings, template.dictURI); // l10n:foo.bar.{binding}@dict/path/to.l10n var parts = l10nBinding.split(/[:@\{]/); // if prefix is l10n: and token has no value bindings if (parts[0] == 'l10n' && parts.length == 3) { // check for dictionary if (!parts[2]) { // reset binding with no dictionary arrayRemove(refs, bindings); if (refs.length == 0) refs = null; bindings = 0; token.value = token.value.replace(/\}$/, '@undefined}'); } else { var l10nId = parts.slice(1).join('@'); var l10nToken = basis.l10n.token(l10nId); var l10nTemplate = getL10nTemplate(l10nToken); template.l10nResolved = true; if (l10nTemplate && l10nToken.type == 'markup') { tokens[i--] = tokenize('<b:include src="#' + l10nTemplate.templateId + '"/>')[0]; continue; } /** @cut for token type change in dev mode */ /** @cut */ else /** @cut */ arrayAdd(template.l10n, l10nId); } } } item = [ 3, // TOKEN_TYPE = 0 bindings, // TOKEN_BINDINGS = 1 refs // TOKEN_REFS = 2 ]; // TEXT_VALUE = 3 if (!refs || token.value != '{' + refs.join('|') + '}') item.push(untoken(token.value)); break; case TYPE_COMMENT: if (options.optimizeSize && !bindings && !refs) continue; item = [ 8, // TOKEN_TYPE = 0 bindings, // TOKEN_BINDINGS = 1 refs // TOKEN_REFS = 2 ]; // COMMENT_VALUE = 3 if (!options.optimizeSize) if (!refs || token.value != '{' + refs.join('|') + '}') item.push(untoken(token.value)); break; } while (item[item.length - 1] === 0) item.pop(); result.push(item); } return result.length ? result : 0; } function absl10n(value, dictURI){ if (typeof value != 'string') return value; var parts = value.split(':'); if (parts.length == 2 && parts[0] == 'l10n' && parts[1].indexOf('@') == -1) parts[1] = parts[1] + '@' + dictURI; return parts.join(':'); } function normalizeRefs(tokens, dictURI, map, stIdx){ if (!map) map = {}; for (var i = stIdx || 0, token; token = tokens[i]; i++) { if (token[TOKEN_TYPE] == <API key>) continue; var refs = token[TOKEN_REFS]; if (refs) { for (var j = refs.length - 1, refName; refName = refs[j]; j { if (refName.indexOf(':') != -1) { removeTokenRef(token, refName); continue; } if (map[refName]) removeTokenRef(map[refName].token, refName); if (token[TOKEN_BINDINGS] == refName) token[TOKEN_BINDINGS] = j + 1; map[refName] = { owner: tokens, token: token }; } } switch (token[TOKEN_TYPE]) { case TYPE_TEXT: token[TOKEN_BINDINGS] = absl10n(token[TOKEN_BINDINGS], dictURI); break; case TYPE_ATTRIBUTE: if (token[TOKEN_BINDINGS]) { var array = token[TOKEN_BINDINGS][0]; for (var j = 0; j < array.length; j++) array[j] = absl10n(array[j], dictURI); } break; case TYPE_ELEMENT: normalizeRefs(token, dictURI, map, ELEMENT_ATTRS); break; } } return map; } function applyDefines(tokens, template, options, stIdx){ var unpredictable = 0; for (var i = stIdx || 0, token; token = tokens[i]; i++) { var tokenType = token[TOKEN_TYPE]; if (tokenType == TYPE_ELEMENT) unpredictable += applyDefines(token, template, options, ELEMENT_ATTRS); if (tokenType == <API key> || (tokenType == TYPE_ATTRIBUTE && token[ATTR_NAME] == 'class')) { var bindings = token[TOKEN_BINDINGS]; var valueIdx = ATTR_VALUE_INDEX[tokenType]; if (bindings) { var newAttrValue = (token[valueIdx] || '').trim().split(' '); for (var k = 0, bind; bind = bindings[k]; k++) { if (bind.length > 2) // bind already processed continue; var bindName = bind[1].split(':').pop(); var bindDef = template.defines[bindName]; if (bindDef) { bind.push.apply(bind, bindDef); bindDef.used = true; if (bindDef[0]) { if (bindDef.length == 1) // bool arrayAdd(newAttrValue, bind[0] + bindName); else // enum arrayAdd(newAttrValue, bind[0] + bindDef[1][bindDef[0] - 1]); } } else { /** @cut */ template.warns.push('Unpredictable value `' + bindName + '` in class binding: ' + bind[0] + '{' + bind[1] + '}'); unpredictable++; } } token[valueIdx] = newAttrValue.join(' '); if (options.optimizeSize && !token[valueIdx]) token.length = valueIdx; } } } return unpredictable; } function isolateTokens(tokens, isolate, template, stIdx){ function processName(name){ var parts = name.split(':'); if (parts.length == 1) return isolate + parts[0]; // don't resolve namespaced names if not template isolate mode if (!template) return name; // global namespace if (!parts[0]) return parts[1]; // if namespace not found, no prefix and show warning if (parts[0] in template.styleNSPrefix == false) { /** @cut */ template.warns.push('Namespace `' + parts[0] + '` is not defined in template, no prefix added'); return name; } return template.styleNSPrefix[parts[0]] + parts[1]; } for (var i = stIdx || 0, token; token = tokens[i]; i++) { var tokenType = token[TOKEN_TYPE]; if (tokenType == TYPE_ELEMENT) isolateTokens(token, isolate, template, ELEMENT_ATTRS); if (tokenType == <API key> || (tokenType == TYPE_ATTRIBUTE && token[ATTR_NAME] == 'class')) { var bindings = token[TOKEN_BINDINGS]; var valueIndex = ATTR_VALUE_INDEX[tokenType]; if (token[valueIndex]) token[valueIndex] = token[valueIndex] .split(/\s+/) .map(processName) .join(' '); if (bindings) for (var k = 0, bind; bind = bindings[k]; k++) bind[0] = processName(bind[0]); } } } return function makeDeclaration(source, baseURI, options, sourceUrl, sourceOrigin){ options = options || {}; var warns = []; /** @cut */ var source_; // result object var result = { sourceUrl: sourceUrl, baseURI: baseURI || '', tokens: null, resources: [], styleNSPrefix: {}, deps: [], /** @cut for token type change in dev mode */ l10n: [], defines: {}, unpredictable: true, warns: warns, isolate: false }; // resolve l10n dictionary url result.dictURI = sourceUrl ? basis.path.resolve(sourceUrl) : baseURI || ''; // normalize dictionary ext name if (result.dictURI) { var extname = basis.path.extname(result.dictURI); if (extname && extname != '.l10n') result.dictURI = result.dictURI.substr(0, result.dictURI.length - extname.length) + '.l10n'; } if (!source.templateTokens) { /** @cut */ source_ = source; source = tokenize(String(source)); } // add tokenizer warnings if any if (source.warns) warns.push.apply(warns, source.warns); // start prevent recursion includeStack.push((sourceOrigin !== true && sourceOrigin) || {}); // basisjs-tools pass true // main task result.tokens = process(source, result, options); // stop prevent recursion includeStack.pop(); // there must be at least one token in result if (!result.tokens) result.tokens = [[3, 0, 0, '']]; // store source for debug /** @cut */ if (source_) /** @cut */ result.tokens.source_ = source_; // normalize refs addTokenRef(result.tokens[0], 'element'); normalizeRefs(result.tokens, result.dictURI); // deal with defines result.unpredictable = !!applyDefines(result.tokens, result, options); /** @cut */ if (/^[^a-z]/i.test(result.isolate)) /** @cut */ basis.dev.error('basis.template: isolation prefix `' + result.isolate + '` should not starts with symbol other than letter, otherwise it leads to incorrect css class names and broken styles'); if (includeStack.length == 0) { // isolate tokens isolateTokens(result.tokens, result.isolate || '', result); // resolve style prefix if (result.isolate) for (var i = 0, item; item = result.resources[i]; i++) if (item[1] !== <API key>) // ignore namespaced styles item[1] = result.isolate + item[1]; // isolate styles result.resources = result.resources // remove duplicates .filter(function(item, idx, array){ return !basis.array.search(array, String(item), String, idx + 1); }) // isolate .map(function(item){ var url = item[0]; var isolate = item[1]; // resolve namespaced style if (isolate === <API key>) isolate = <API key>[url]; // if no isolate prefix -> nothing todo if (!isolate) return url; // otherwise create virtual resource with prefixed classes in selectors var resource = basis.resource.virtual('css', '').ready(function(cssResource){ sourceResource(); basis.object.extend(cssResource, { url: url + '?isolate-prefix=' + isolate, baseURI: basis.path.dirname(url) + '/' }); }); var sourceResource = basis.resource(url).ready(function(cssResource){ var cssText = isolateCss(cssResource.cssText || '', isolate); /** @cut */ if (typeof btoa == 'function') /** @cut */ cssText += '\n/*# sourceMappingURL=data:application/json;base64,' + /** @cut */ btoa('{"version":3,"sources":["' + basis.path.origin + url + '"],' + /** @cut */ '"mappings":"AAAA' + basis.string.repeat(';AACA', cssText.split('\n').length) + /** @cut */ '"}') + ' */'; resource.update(cssText); }); return resource.url; }); } /** @cut */ for (var key in result.defines) /** @cut */ if (!result.defines[key].used) /** @cut */ warns.push('Unused define for ' + key); // delete unnecessary keys delete result.defines; delete result.l10nResolved; if (!warns.length) result.warns = false; return result; }; })(); function startUseResource(uri){ var resource = basis.resource(uri).fetch(); if (typeof resource.startUse == 'function') resource.startUse(); } function stopUseResource(uri){ var resource = basis.resource(uri).fetch(); if (typeof resource.stopUse == 'function') resource.stopUse(); } /** * @func */ function <API key>(){ if (this.destroyBuilder) buildTemplate.call(this); for (var i = 0, attach; attach = this.attaches_[i]; i++) attach.handler.call(attach.context); } function cloneDecl(array){ var result = []; /** @cut */ if (array.source_) /** @cut */ result.source_ = array.source_; for (var i = 0; i < array.length; i++) result.push( Array.isArray(array[i]) ? cloneDecl(array[i]) : array[i] ); return result; } /** * @param {*} source * @param {string=} baseURI * @param {boolean=} clone * @param {object=} options */ function getDeclFromSource(source, baseURI, clone, options){ var result = source; var sourceUrl; if (typeof result == 'function') { baseURI = 'baseURI' in source ? source.baseURI : baseURI; sourceUrl = 'url' in source ? source.url : sourceUrl; result = result(); } if (result instanceof basis.Token) { baseURI = 'baseURI' in source ? source.baseURI : baseURI; sourceUrl = 'url' in source ? source.url : sourceUrl; result = result.get(); } if (Array.isArray(result)) { if (clone) result = cloneDecl(result); result = { tokens: result }; } else { if (typeof result != 'object' || !Array.isArray(result.tokens)) result = String(result); } if (typeof result == 'string') result = makeDeclaration(result, baseURI, options, sourceUrl, source); return result; } /** @cut for token type change in dev mode */ /** @cut */ function l10nHandler(value){ /** @cut */ if (this.type != 'markup' && this.token.type == 'markup') /** @cut */ { /** @cut */ //console.log('rebuild!!!', this.token.name); /** @cut */ buildTemplate.call(this.template); /** @cut */ } /** @cut */ } /** * @func */ function buildTemplate(){ var decl = getDeclFromSource(this.source, this.baseURI, false, { isolate: this.getIsolatePrefix() }); var destroyBuilder = this.destroyBuilder; var funcs = this.builder(decl.tokens, this); // makeFunctions var deps = this.deps_; /** @cut for token type change in dev mode */ /** @cut */ var l10n = this.l10n_; // detach old deps if (deps) { this.deps_ = null; for (var i = 0, dep; dep = deps[i]; i++) dep.bindingBridge.detach(dep, buildTemplate, this); } /** @cut for token type change in dev mode */ /** @cut */ if (l10n) /** @cut */ for (var i = 0, item; item = l10n[i]; i++) /** @cut */ item.token.bindingBridge.detach(item.token, l10nHandler, item); // attach new deps if (decl.deps && decl.deps.length) { deps = decl.deps; this.deps_ = deps; for (var i = 0, dep; dep = deps[i]; i++) dep.bindingBridge.attach(dep, buildTemplate, this); } /** @cut for token type change in dev mode */ /** @cut */ if (decl.l10n) /** @cut */ { /** @cut */ l10n = decl.l10n; /** @cut */ this.l10n_ = {}; /** @cut */ for (var i = 0, key; key = l10n[i]; i++) /** @cut */ { /** @cut */ var l10nToken = basis.l10n.token(key); /** @cut */ l10nToken.bindingBridge.attach(l10nToken, l10nHandler, this.l10n_[key] = { /** @cut */ template: this, /** @cut */ token: l10nToken, /** @cut */ type: l10nToken.type /** @cut */ }); /** @cut */ } /** @cut */ } // apply new values this.createInstance = funcs.createInstance; this.clearInstance = funcs.destroyInstance; this.getBinding = function(){ return { names: funcs.keys }; }; this.destroyBuilder = funcs.destroy; /** @cut */ this.instances_ = funcs.instances_; /** @cut */ this.decl_ = decl; // apply resources var declResources = decl.resources && decl.resources.length > 0 ? decl.resources : null; if (declResources) for (var i = 0, res; res = declResources[i]; i++) startUseResource(res); if (this.resources) for (var i = 0, res; res = this.resources[i]; i++) stopUseResource(res); this.resources = declResources; // destroy old builder instance if exists if (destroyBuilder) destroyBuilder(true); } // source from script by id var <API key> = {}; function <API key>(id){ var resolver = <API key>(id); if (resolver.template) return resolver.template; var host = document.getElementById(id); var source = ''; if (host && host.tagName == 'SCRIPT' && host.type == 'text/basis-template') source = host.textContent || host.text; /** @cut */ else /** @cut */ if (!host) /** @cut */ basis.dev.warn('Template script element with id `' + id + '` not found'); /** @cut */ else /** @cut */ basis.dev.warn('Template should be declared in <script type="text/basis-template"> element (id `' + sourceId + '`)'); return resolver.template = new Template(source); }; function <API key>(sourceId){ var resolver = <API key>[sourceId]; if (!resolver) { resolver = <API key>[sourceId] = function(){ return <API key>(sourceId).source; }; /** @cut */ resolver.id = sourceId; /** @cut */ resolver.url = '<script id="' + sourceId + '"/>'; } return resolver; } /** * Creates DOM structure template from marked HTML. Use {basis.template.html.Template#createInstance} * method to apply template to object. It creates clone of DOM structure and adds * links into object to pointed parts of structure. * * To remove links to DOM structure from object use {basis.template.html.Template#clearInstance} * method. * @example * // create a template * var template = new basis.template.html.Template( * '<li class="listitem item-{num}" title="Item #{num}: {title}">' + * '<a href="{url}">{title}</a>' + * '<span class="description">{description}</span>' + * '</li>' * ); * * // create list container * var list = document.createElement('ul'); * * // create 10 DOM elements using template * for (var i = 0; i < 10; i++) * { * var tmpl = template.createInstance(); * tmpl.set('num', i); * tmpl.set('url', '/foo/bar.html'); * tmpl.set('title, 'some title'); * tmpl.set('description', 'description text'); * list.appendChild(tmpl.element); * } * * @class */ var Template = Class(null, { className: namespace + '.Template', __extend__: function(value){ if (value instanceof Template) return value; if (value instanceof <API key>) return new TemplateSwitcher(value); return new Template(value); }, /** * Template source * @type {string|function|Array} */ source: '', /** * Base url for nested resources. * @type {string} */ baseURI: '', /** * @param {string|function()|Array} source Template source code that will be parsed * into DOM structure prototype. Parsing will be done on first {basis.Html.Template#createInstance} * or {basis.Html.Template#getBinding} call. If function passed it be called and it's result will be * used as template source code. If array passed that it treats as token list. * @constructor */ init: function(source){ if (templateList.length == 4096) throw 'Too many templates (maximum 4096)'; this.attaches_ = []; this.setSource(source || ''); this.templateId = templateList.push(this) - 1; }, bindingBridge: { attach: function(template, handler, context){ for (var i = 0, listener; listener = template.attaches_[i]; i++) if (listener.handler == handler && listener.context == context) return; template.attaches_.push({ handler: handler, context: context }); }, detach: function(template, handler, context){ for (var i = 0, listener; listener = template.attaches_[i]; i++) if (listener.handler == handler && listener.context == context) { template.attaches_.splice(i, 1); return; } }, get: function(){ } }, /** * Create DOM structure and return object with references for it's nodes. * @param {object=} object Object which templateAction method will be called on events. * @param {function=} actionCallback * @param {function=} updateCallback * @param {object=} bindings * @param {object=} bindingInterface Object like { attach: function(object, handler, context), detach: function(object, handler, context) } * @return {object} */ createInstance: function(object, actionCallback, updateCallback, bindings, bindingInterface){ buildTemplate.call(this); return this.createInstance(object, actionCallback, updateCallback, bindings, bindingInterface); }, /** * Remove reference from DOM structure * @param {object=} tmpl Storage of DOM references. */ clearInstance: function(tmpl){ }, /** * Returns base isolation prefix for template's content. Use it only if template content use <b:isolate>. * Template could overload it by `prefix` attribute in <b:isolate> tag. * @return {string} Isolation prefix. */ getIsolatePrefix: function(){ return 'i' + this.templateId + '__'; }, getBinding: function(bindings){ buildTemplate.call(this); return this.getBinding(bindings); }, setSource: function(source){ var oldSource = this.source; if (oldSource != source) { if (typeof source == 'string') { var m = source.match(/^([a-z]+):/); if (m) { var prefix = m[1]; source = source.substr(m[0].length); switch (prefix) { case 'file': source = basis.resource(source); break; case 'id': // source from script element source = <API key>(source); break; case 'tokens': source = basis.string.toObject(source); source.isDecl = true; break; case 'raw': //source = source; break; case 'path': source = getSourceByPath(source); break; default: /** @cut */ basis.dev.warn(namespace + '.Template.setSource: Unknown prefix ' + prefix + ' for template source was ingnored.'); } } } if (oldSource && oldSource.bindingBridge) { var tmplList = oldSource.url && tmplFilesMap[oldSource.url]; if (tmplList) { arrayRemove(tmplList, this); if (!tmplList.length) delete tmplFilesMap[oldSource.url]; } this.baseURI = ''; this.source.bindingBridge.detach(oldSource, <API key>, this); } if (source && source.bindingBridge) { if (source.url) { this.baseURI = path.dirname(source.url) + '/'; if (!tmplFilesMap[source.url]) tmplFilesMap[source.url] = []; arrayAdd(tmplFilesMap[source.url], this); } source.bindingBridge.attach(source, <API key>, this); } this.source = source; <API key>.call(this); } }, destroy: function(){ if (this.destroyBuilder) this.destroyBuilder(); this.attaches_ = null; this.createInstance = null; this.getBinding = null; this.resources = null; this.source = null; /** @cut */ this.instances_ = null; /** @cut */ this.decl_ = null; } }); // template: basis.template.wrapper( // '<b:class value="..."/>' // var TemplateWrapper = Class(Template, { // source_: '', // template: null, // init: function(source, template){ // Template.prototype.init.call(this); // this.setTemplate(template); // setTemplate: function(template){ // if (this.template !== template) // this.template = template; // this.setSource(??) // setSource: function(source){ // if (this.source_ != source) // var newSource = // '<b:include src="#' + this.template.templateId + '">' + // source + // '</b:include>'; // Template.prototype.setSource.call(this, newSource); /** * @class */ var <API key> = function(config){ basis.object.extend(this, config); }; /** * @class */ var TemplateSwitcher = basis.Class(null, { className: namespace + '.TemplateSwitcher', ruleRet_: null, templates_: null, templateClass: Template, ruleEvents: null, rule: String, // return empty string as template source init: function(config){ this.ruleRet_ = []; this.templates_ = []; this.rule = config.rule; var events = config.events; if (events && events.length) { this.ruleEvents = {}; for (var i = 0, eventName; eventName = events[i]; i++) this.ruleEvents[eventName] = true; } cleaner.add(this); }, resolve: function(object){ var ret = this.rule(object); var idx = this.ruleRet_.indexOf(ret); if (idx == -1) { this.ruleRet_.push(ret); idx = this.templates_.push(new this.templateClass(ret)) - 1; } return this.templates_[idx]; }, destroy: function(){ this.rule = null; this.templates_ = null; this.ruleRet_ = null; } }); /** * Helper to create <API key> instance */ function switcher(events, rule){ var args = basis.array(arguments); var rule = args.pop(); return new <API key>({ rule: rule, events: args.join(' ').trim().split(/\s+/) }); } // Theme /** * @class */ var Theme = Class(null, { className: namespace + '.Theme', get: getSourceByPath }); /** * @class */ var SourceWrapper = Class(basis.Token, { className: namespace + '.SourceWrapper', /** * Template source name. * @type {string} */ path: '', /** * Url of wrapped content, if exists. * @type {string} */ url: '', /** * Base URI of wrapped content, if exists. * @type {string} */ baseURI: '', /** * @constructor * @param {*} value * @param {string} path */ init: function(value, path){ this.path = path; basis.Token.prototype.init.call(this, ''); }, /** * @inheritDocs */ get: function(){ return this.value && this.value.bindingBridge ? this.value.bindingBridge.get(this.value) : this.value; }, /** * @inheritDocs */ set: function(){ var content = getThemeSource(currentThemeName, this.path); if (this.value != content) { if (this.value && this.value.bindingBridge) this.value.bindingBridge.detach(this.value, SourceWrapper.prototype.apply, this); this.value = content; this.url = (content && content.url) || ''; this.baseURI = (typeof content == 'object' || typeof content == 'function') && 'baseURI' in content ? content.baseURI : path.dirname(this.url) + '/'; if (this.value && this.value.bindingBridge) this.value.bindingBridge.attach(this.value, SourceWrapper.prototype.apply, this); this.apply(); } }, /** * @destructor */ destroy: function(){ this.url = null; this.baseURI = null; if (this.value && this.value.bindingBridge) this.value.bindingBridge.detach(this.value, this.apply, this); basis.Token.prototype.destroy.call(this); } }); function getSourceByPath(){ var path = basis.array(arguments).join('.'); var source = sourceByPath[path]; if (!source) { source = new SourceWrapper('', path); sourceByPath[path] = source; } return source; } function normalize(list){ var used = {}; var result = []; for (var i = 0; i < list.length; i++) if (!used[list[i]]) { used[list[i]] = true; result.push(list[i]); } return result; } function extendFallback(themeName, list){ var result = []; result.source = normalize(list).join('/'); // map for used themes var used = { base: true }; for (var i = 0; i < list.length; i++) { var name = list[i] || 'base'; // skip if theme already processed if (name == themeName || used[name]) continue; // get or create theme var theme = getTheme(name); // mark theme as used (theme could be only once in list) // and add to lists used[name] = true; result.push(name); // add theme fallback list list.splice.apply(list, [i + 1, 0].concat(themes[name].fallback)); } // special cases: // - theme itself must be the first in source list and not in fallback list // - base theme must be the last for both lists result.unshift(themeName); if (themeName != 'base') result.push('base'); result.value = result.join('/'); return result; } function getThemeSource(name, path){ var sourceList = themes[name].sourcesList; for (var i = 0, map; map = sourceList[i]; i++) if (map.hasOwnProperty(path)) return map[path]; return ''; } function themeHasEffect(themeName){ return themes[currentThemeName].fallback.indexOf(themeName) != -1; } function <API key>(path){ getSourceByPath(path).set(); } function syncCurrentTheme(changed){ /** @cut */ basis.dev.log('re-apply templates'); for (var path in sourceByPath) <API key>(path); } function getTheme(name){ if (!name) name = 'base'; if (themes[name]) return themes[name].theme; if (!/^([a-z0-9\_\-]+)$/.test(name)) throw 'Bad name for theme - ' + name; var sources = {}; var sourceList = [sources]; var themeInterface = new Theme(); themes[name] = { theme: themeInterface, sources: sources, sourcesList: sourceList, fallback: [] }; // closure methods var addSource = function(path, source){ if (path in sources == false) { sources[path] = source; if (themeHasEffect(name)) <API key>(path); } /** @cut */ else /** @cut */ basis.dev.warn('Template path `' + path + '` is already defined for theme `' + name + '` (definition ignored).'); return getSourceByPath(path); }; basis.object.extend(themeInterface, { name: name, fallback: function(value){ if (themeInterface !== baseTheme && arguments.length > 0) { var newFallback = typeof value == 'string' ? value.split('/') : []; // process new fallback var changed = {}; newFallback = extendFallback(name, newFallback); if (themes[name].fallback.source != newFallback.source) { themes[name].fallback.source = newFallback.source; /** @cut */ basis.dev.log('fallback changed'); for (var themeName in themes) { var curFallback = themes[themeName].fallback; var newFallback = extendFallback(themeName, (curFallback.source || '').split('/')); if (newFallback.value != curFallback.value) { changed[themeName] = true; themes[themeName].fallback = newFallback; var sourceList = themes[themeName].sourcesList; sourceList.length = newFallback.length; for (var i = 0; i < sourceList.length; i++) sourceList[i] = themes[newFallback[i]].sources; } } } // re-compure fallback for dependant themes var currentFallback = themes[currentThemeName].fallback; for (var themeName in changed) { if (themeHasEffect(themeName)) { syncCurrentTheme(); break; } } } var result = themes[name].fallback.slice(1); // skip theme itself result.source = themes[name].fallback.source; return result; }, define: function(what, wherewith){ if (typeof what == 'function') what = what(); if (typeof what == 'string') { if (typeof wherewith == 'object') { // define(namespace, dictionary): object // what -> path // wherewith -> dictionary var namespace = what; var dictionary = wherewith; var result = {}; for (var key in dictionary) if (dictionary.hasOwnProperty(key)) result[key] = addSource(namespace + '.' + key, dictionary[key]); return result; } else { if (arguments.length == 1) { return getSourceByPath(what); } else { // define(path, source): Template // what -> path // wherewith -> source return addSource(what, wherewith); } } } else { if (typeof what == 'object') { // define(dictionary): Theme var dictionary = what; for (var path in dictionary) if (dictionary.hasOwnProperty(path)) addSource(path, dictionary[path]); return themeInterface; } else { /** @cut */ basis.dev.warn('Wrong first argument for basis.template.Theme#define'); } } }, apply: function(){ if (name != currentThemeName) { currentThemeName = name; syncCurrentTheme(); for (var i = 0, handler; handler = themeChangeHandlers[i]; i++) handler.fn.call(handler.context, name); /** @cut */ basis.dev.info('Template theme switched to `' + name + '`'); } return themeInterface; }, getSource: function(path, withFallback){ return withFallback ? getThemeSource(name, path) : sources[path]; }, drop: function(path){ if (sources.hasOwnProperty(path)) { delete sources[path]; if (themeHasEffect(name)) <API key>(path); } } }); themes[name].fallback = extendFallback(name, []); sourceList.push(themes.base.sources); return themeInterface; } var themes = {}; var sourceByPath = {}; var baseTheme = getTheme(); var currentThemeName = 'base'; var themeChangeHandlers = []; function onThemeChange(fn, context, fire){ themeChangeHandlers.push({ fn: fn, context: context }); if (fire) fn.call(context, currentThemeName); } // cleanup on page unload cleaner.add({ destroy: function(){ // clear themes for (var path in sourceByPath) sourceByPath[path].destroy(); themes = null; sourceByPath = null; // clear templates for (var i = 0, template; template = templateList[i]; i++) template.destroy(); templateList = null; } }); // export names module.exports = { DECLARATION_VERSION: DECLARATION_VERSION, // const TYPE_ELEMENT: TYPE_ELEMENT, TYPE_ATTRIBUTE: TYPE_ATTRIBUTE, <API key>: <API key>, <API key>: <API key>, <API key>: <API key>, TYPE_TEXT: TYPE_TEXT, TYPE_COMMENT: TYPE_COMMENT, TOKEN_TYPE: TOKEN_TYPE, TOKEN_BINDINGS: TOKEN_BINDINGS, TOKEN_REFS: TOKEN_REFS, ATTR_NAME: ATTR_NAME, ATTR_VALUE: ATTR_VALUE, ATTR_NAME_BY_TYPE: ATTR_NAME_BY_TYPE, ELEMENT_NAME: ELEMENT_NAME, ELEMENT_ATTRS: ELEMENT_ATTRS, ELEMENT_CHILDS: ELEMENT_CHILDS, TEXT_VALUE: TEXT_VALUE, COMMENT_VALUE: COMMENT_VALUE, // classes L10nProxyToken: L10nProxyToken, <API key>: <API key>, TemplateSwitcher: TemplateSwitcher, Template: Template, SourceWrapper: SourceWrapper, switcher: switcher, // for debug purposes tokenize: tokenize, isolateCss: isolateCss, getDeclFromSource: getDeclFromSource, makeDeclaration: makeDeclaration, getL10nTemplate: getL10nTemplate, // theme Theme: Theme, theme: getTheme, getThemeList: function(){ return basis.object.keys(themes); }, currentTheme: function(){ return themes[currentThemeName].theme; }, setTheme: function(name){ return getTheme(name).apply(); }, onThemeChange: onThemeChange, define: baseTheme.define, get: getSourceByPath, getPathList: function(){ return basis.object.keys(sourceByPath); } };
html { font-family: sans-serif; -ms-text-size-adjust: 100%; -<API key>: 100%; } body { margin: 0; } article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { display: block; } audio, canvas, progress, video { display: inline-block; vertical-align: baseline; } audio:not([controls]) { display: none; height: 0; } [hidden], template { display: none; } a { background-color: transparent; } a:active, a:hover { outline: 0; } abbr[title] { border-bottom: 1px dotted; } b, strong { font-weight: bold; } dfn { font-style: italic; } h1 { font-size: 2em; margin: 0.67em 0; } mark { background: #ff0; color: #000; } small { font-size: 80%; } sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } img { border: 0; } svg:not(:root) { overflow: hidden; } figure { margin: 1em 40px; } hr { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; height: 0; } pre { overflow: auto; } code, kbd, pre, samp { font-family: monospace, monospace; font-size: 1em; } button, input, optgroup, select, textarea { color: inherit; font: inherit; margin: 0; } button { overflow: visible; } button, select { text-transform: none; } button, html input[type="button"], input[type="reset"], input[type="submit"] { -webkit-appearance: button; cursor: pointer; } button[disabled], html input[disabled] { cursor: default; } button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; } input { line-height: normal; } input[type="checkbox"], input[type="radio"] { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; padding: 0; } input[type="number"]::-<API key>, input[type="number"]::-<API key> { height: auto; } input[type="search"] { -webkit-appearance: textfield; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; } input[type="search"]::-<API key>, input[type="search"]::-<API key> { -webkit-appearance: none; } fieldset { border: 1px solid #c0c0c0; margin: 0 2px; padding: 0.35em 0.625em 0.75em; } legend { border: 0; padding: 0; } textarea { overflow: auto; } optgroup { font-weight: bold; } table { border-collapse: collapse; border-spacing: 0; } td, th { padding: 0; } * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } *:before, *:after { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } html { font-size: 10px; -<API key>: rgba(0, 0, 0, 0); } body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.42857143; color: #333333; background-color: #ffffff; } input, button, select, textarea { font-family: inherit; font-size: inherit; line-height: inherit; } a { color: #428bca; text-decoration: none; } a:hover, a:focus { color: #2a6496; text-decoration: underline; } a:focus { outline: thin dotted; outline: 5px auto -<API key>; outline-offset: -2px; } figure { margin: 0; } img { vertical-align: middle; } .img-responsive { display: block; max-width: 100%; height: auto; } .img-rounded { border-radius: 6px; } .img-thumbnail { padding: 4px; line-height: 1.42857143; background-color: #ffffff; border: 1px solid #dddddd; border-radius: 4px; -webkit-transition: all 0.2s ease-in-out; -o-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; display: inline-block; max-width: 100%; height: auto; } .img-circle { border-radius: 50%; } hr { margin-top: 20px; margin-bottom: 20px; border: 0; border-top: 1px solid #eeeeee; } .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; } .sr-only-focusable:active, .sr-only-focusable:focus { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; } [role="button"] { cursor: pointer; } .container { margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px; } @media (min-width: 768px) { .container { width: 750px; } } @media (min-width: 992px) { .container { width: 970px; } } @media (min-width: 1200px) { .container { width: 1170px; } } .container-fluid { margin-right: auto; margin-left: auto; padding-left: 15px; padding-right: 15px; } .row { margin-left: -15px; margin-right: -15px; } .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 { position: relative; min-height: 1px; padding-left: 15px; padding-right: 15px; } .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { float: left; } .col-xs-12 { width: 100%; } .col-xs-11 { width: 91.66666667%; } .col-xs-10 { width: 83.33333333%; } .col-xs-9 { width: 75%; } .col-xs-8 { width: 66.66666667%; } .col-xs-7 { width: 58.33333333%; } .col-xs-6 { width: 50%; } .col-xs-5 { width: 41.66666667%; } .col-xs-4 { width: 33.33333333%; } .col-xs-3 { width: 25%; } .col-xs-2 { width: 16.66666667%; } .col-xs-1 { width: 8.33333333%; } .col-xs-pull-12 { right: 100%; } .col-xs-pull-11 { right: 91.66666667%; } .col-xs-pull-10 { right: 83.33333333%; } .col-xs-pull-9 { right: 75%; } .col-xs-pull-8 { right: 66.66666667%; } .col-xs-pull-7 { right: 58.33333333%; } .col-xs-pull-6 { right: 50%; } .col-xs-pull-5 { right: 41.66666667%; } .col-xs-pull-4 { right: 33.33333333%; } .col-xs-pull-3 { right: 25%; } .col-xs-pull-2 { right: 16.66666667%; } .col-xs-pull-1 { right: 8.33333333%; } .col-xs-pull-0 { right: auto; } .col-xs-push-12 { left: 100%; } .col-xs-push-11 { left: 91.66666667%; } .col-xs-push-10 { left: 83.33333333%; } .col-xs-push-9 { left: 75%; } .col-xs-push-8 { left: 66.66666667%; } .col-xs-push-7 { left: 58.33333333%; } .col-xs-push-6 { left: 50%; } .col-xs-push-5 { left: 41.66666667%; } .col-xs-push-4 { left: 33.33333333%; } .col-xs-push-3 { left: 25%; } .col-xs-push-2 { left: 16.66666667%; } .col-xs-push-1 { left: 8.33333333%; } .col-xs-push-0 { left: auto; } .col-xs-offset-12 { margin-left: 100%; } .col-xs-offset-11 { margin-left: 91.66666667%; } .col-xs-offset-10 { margin-left: 83.33333333%; } .col-xs-offset-9 { margin-left: 75%; } .col-xs-offset-8 { margin-left: 66.66666667%; } .col-xs-offset-7 { margin-left: 58.33333333%; } .col-xs-offset-6 { margin-left: 50%; } .col-xs-offset-5 { margin-left: 41.66666667%; } .col-xs-offset-4 { margin-left: 33.33333333%; } .col-xs-offset-3 { margin-left: 25%; } .col-xs-offset-2 { margin-left: 16.66666667%; } .col-xs-offset-1 { margin-left: 8.33333333%; } .col-xs-offset-0 { margin-left: 0%; } @media (min-width: 768px) { .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { float: left; } .col-sm-12 { width: 100%; } .col-sm-11 { width: 91.66666667%; } .col-sm-10 { width: 83.33333333%; } .col-sm-9 { width: 75%; } .col-sm-8 { width: 66.66666667%; } .col-sm-7 { width: 58.33333333%; } .col-sm-6 { width: 50%; } .col-sm-5 { width: 41.66666667%; } .col-sm-4 { width: 33.33333333%; } .col-sm-3 { width: 25%; } .col-sm-2 { width: 16.66666667%; } .col-sm-1 { width: 8.33333333%; } .col-sm-pull-12 { right: 100%; } .col-sm-pull-11 { right: 91.66666667%; } .col-sm-pull-10 { right: 83.33333333%; } .col-sm-pull-9 { right: 75%; } .col-sm-pull-8 { right: 66.66666667%; } .col-sm-pull-7 { right: 58.33333333%; } .col-sm-pull-6 { right: 50%; } .col-sm-pull-5 { right: 41.66666667%; } .col-sm-pull-4 { right: 33.33333333%; } .col-sm-pull-3 { right: 25%; } .col-sm-pull-2 { right: 16.66666667%; } .col-sm-pull-1 { right: 8.33333333%; } .col-sm-pull-0 { right: auto; } .col-sm-push-12 { left: 100%; } .col-sm-push-11 { left: 91.66666667%; } .col-sm-push-10 { left: 83.33333333%; } .col-sm-push-9 { left: 75%; } .col-sm-push-8 { left: 66.66666667%; } .col-sm-push-7 { left: 58.33333333%; } .col-sm-push-6 { left: 50%; } .col-sm-push-5 { left: 41.66666667%; } .col-sm-push-4 { left: 33.33333333%; } .col-sm-push-3 { left: 25%; } .col-sm-push-2 { left: 16.66666667%; } .col-sm-push-1 { left: 8.33333333%; } .col-sm-push-0 { left: auto; } .col-sm-offset-12 { margin-left: 100%; } .col-sm-offset-11 { margin-left: 91.66666667%; } .col-sm-offset-10 { margin-left: 83.33333333%; } .col-sm-offset-9 { margin-left: 75%; } .col-sm-offset-8 { margin-left: 66.66666667%; } .col-sm-offset-7 { margin-left: 58.33333333%; } .col-sm-offset-6 { margin-left: 50%; } .col-sm-offset-5 { margin-left: 41.66666667%; } .col-sm-offset-4 { margin-left: 33.33333333%; } .col-sm-offset-3 { margin-left: 25%; } .col-sm-offset-2 { margin-left: 16.66666667%; } .col-sm-offset-1 { margin-left: 8.33333333%; } .col-sm-offset-0 { margin-left: 0%; } } @media (min-width: 992px) { .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { float: left; } .col-md-12 { width: 100%; } .col-md-11 { width: 91.66666667%; } .col-md-10 { width: 83.33333333%; } .col-md-9 { width: 75%; } .col-md-8 { width: 66.66666667%; } .col-md-7 { width: 58.33333333%; } .col-md-6 { width: 50%; } .col-md-5 { width: 41.66666667%; } .col-md-4 { width: 33.33333333%; } .col-md-3 { width: 25%; } .col-md-2 { width: 16.66666667%; } .col-md-1 { width: 8.33333333%; } .col-md-pull-12 { right: 100%; } .col-md-pull-11 { right: 91.66666667%; } .col-md-pull-10 { right: 83.33333333%; } .col-md-pull-9 { right: 75%; } .col-md-pull-8 { right: 66.66666667%; } .col-md-pull-7 { right: 58.33333333%; } .col-md-pull-6 { right: 50%; } .col-md-pull-5 { right: 41.66666667%; } .col-md-pull-4 { right: 33.33333333%; } .col-md-pull-3 { right: 25%; } .col-md-pull-2 { right: 16.66666667%; } .col-md-pull-1 { right: 8.33333333%; } .col-md-pull-0 { right: auto; } .col-md-push-12 { left: 100%; } .col-md-push-11 { left: 91.66666667%; } .col-md-push-10 { left: 83.33333333%; } .col-md-push-9 { left: 75%; } .col-md-push-8 { left: 66.66666667%; } .col-md-push-7 { left: 58.33333333%; } .col-md-push-6 { left: 50%; } .col-md-push-5 { left: 41.66666667%; } .col-md-push-4 { left: 33.33333333%; } .col-md-push-3 { left: 25%; } .col-md-push-2 { left: 16.66666667%; } .col-md-push-1 { left: 8.33333333%; } .col-md-push-0 { left: auto; } .col-md-offset-12 { margin-left: 100%; } .col-md-offset-11 { margin-left: 91.66666667%; } .col-md-offset-10 { margin-left: 83.33333333%; } .col-md-offset-9 { margin-left: 75%; } .col-md-offset-8 { margin-left: 66.66666667%; } .col-md-offset-7 { margin-left: 58.33333333%; } .col-md-offset-6 { margin-left: 50%; } .col-md-offset-5 { margin-left: 41.66666667%; } .col-md-offset-4 { margin-left: 33.33333333%; } .col-md-offset-3 { margin-left: 25%; } .col-md-offset-2 { margin-left: 16.66666667%; } .col-md-offset-1 { margin-left: 8.33333333%; } .col-md-offset-0 { margin-left: 0%; } } @media (min-width: 1200px) { .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { float: left; } .col-lg-12 { width: 100%; } .col-lg-11 { width: 91.66666667%; } .col-lg-10 { width: 83.33333333%; } .col-lg-9 { width: 75%; } .col-lg-8 { width: 66.66666667%; } .col-lg-7 { width: 58.33333333%; } .col-lg-6 { width: 50%; } .col-lg-5 { width: 41.66666667%; } .col-lg-4 { width: 33.33333333%; } .col-lg-3 { width: 25%; } .col-lg-2 { width: 16.66666667%; } .col-lg-1 { width: 8.33333333%; } .col-lg-pull-12 { right: 100%; } .col-lg-pull-11 { right: 91.66666667%; } .col-lg-pull-10 { right: 83.33333333%; } .col-lg-pull-9 { right: 75%; } .col-lg-pull-8 { right: 66.66666667%; } .col-lg-pull-7 { right: 58.33333333%; } .col-lg-pull-6 { right: 50%; } .col-lg-pull-5 { right: 41.66666667%; } .col-lg-pull-4 { right: 33.33333333%; } .col-lg-pull-3 { right: 25%; } .col-lg-pull-2 { right: 16.66666667%; } .col-lg-pull-1 { right: 8.33333333%; } .col-lg-pull-0 { right: auto; } .col-lg-push-12 { left: 100%; } .col-lg-push-11 { left: 91.66666667%; } .col-lg-push-10 { left: 83.33333333%; } .col-lg-push-9 { left: 75%; } .col-lg-push-8 { left: 66.66666667%; } .col-lg-push-7 { left: 58.33333333%; } .col-lg-push-6 { left: 50%; } .col-lg-push-5 { left: 41.66666667%; } .col-lg-push-4 { left: 33.33333333%; } .col-lg-push-3 { left: 25%; } .col-lg-push-2 { left: 16.66666667%; } .col-lg-push-1 { left: 8.33333333%; } .col-lg-push-0 { left: auto; } .col-lg-offset-12 { margin-left: 100%; } .col-lg-offset-11 { margin-left: 91.66666667%; } .col-lg-offset-10 { margin-left: 83.33333333%; } .col-lg-offset-9 { margin-left: 75%; } .col-lg-offset-8 { margin-left: 66.66666667%; } .col-lg-offset-7 { margin-left: 58.33333333%; } .col-lg-offset-6 { margin-left: 50%; } .col-lg-offset-5 { margin-left: 41.66666667%; } .col-lg-offset-4 { margin-left: 33.33333333%; } .col-lg-offset-3 { margin-left: 25%; } .col-lg-offset-2 { margin-left: 16.66666667%; } .col-lg-offset-1 { margin-left: 8.33333333%; } .col-lg-offset-0 { margin-left: 0%; } } .clearfix:before, .clearfix:after, .container:before, .container:after, .container-fluid:before, .container-fluid:after, .row:before, .row:after { content: " "; display: table; } .clearfix:after, .container:after, .container-fluid:after, .row:after { clear: both; } .center-block { display: block; margin-left: auto; margin-right: auto; } .pull-right { float: right !important; } .pull-left { float: left !important; } .hide { display: none !important; } .show { display: block !important; } .invisible { visibility: hidden; } .text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; } .hidden { display: none !important; } .affix { position: fixed; } @-ms-viewport { width: device-width; } .visible-xs, .visible-sm, .visible-md, .visible-lg { display: none !important; } .visible-xs-block, .visible-xs-inline, .<API key>, .visible-sm-block, .visible-sm-inline, .<API key>, .visible-md-block, .visible-md-inline, .<API key>, .visible-lg-block, .visible-lg-inline, .<API key> { display: none !important; } @media (max-width: 767px) { .visible-xs { display: block !important; } table.visible-xs { display: table !important; } tr.visible-xs { display: table-row !important; } th.visible-xs, td.visible-xs { display: table-cell !important; } } @media (max-width: 767px) { .visible-xs-block { display: block !important; } } @media (max-width: 767px) { .visible-xs-inline { display: inline !important; } } @media (max-width: 767px) { .<API key> { display: inline-block !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm { display: block !important; } table.visible-sm { display: table !important; } tr.visible-sm { display: table-row !important; } th.visible-sm, td.visible-sm { display: table-cell !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-block { display: block !important; } } @media (min-width: 768px) and (max-width: 991px) { .visible-sm-inline { display: inline !important; } } @media (min-width: 768px) and (max-width: 991px) { .<API key> { display: inline-block !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md { display: block !important; } table.visible-md { display: table !important; } tr.visible-md { display: table-row !important; } th.visible-md, td.visible-md { display: table-cell !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-block { display: block !important; } } @media (min-width: 992px) and (max-width: 1199px) { .visible-md-inline { display: inline !important; } } @media (min-width: 992px) and (max-width: 1199px) { .<API key> { display: inline-block !important; } } @media (min-width: 1200px) { .visible-lg { display: block !important; } table.visible-lg { display: table !important; } tr.visible-lg { display: table-row !important; } th.visible-lg, td.visible-lg { display: table-cell !important; } } @media (min-width: 1200px) { .visible-lg-block { display: block !important; } } @media (min-width: 1200px) { .visible-lg-inline { display: inline !important; } } @media (min-width: 1200px) { .<API key> { display: inline-block !important; } } @media (max-width: 767px) { .hidden-xs { display: none !important; } } @media (min-width: 768px) and (max-width: 991px) { .hidden-sm { display: none !important; } } @media (min-width: 992px) and (max-width: 1199px) { .hidden-md { display: none !important; } } @media (min-width: 1200px) { .hidden-lg { display: none !important; } } .visible-print { display: none !important; } @media print { .visible-print { display: block !important; } table.visible-print { display: table !important; } tr.visible-print { display: table-row !important; } th.visible-print, td.visible-print { display: table-cell !important; } } .visible-print-block { display: none !important; } @media print { .visible-print-block { display: block !important; } } .<API key> { display: none !important; } @media print { .<API key> { display: inline !important; } } .<API key> { display: none !important; } @media print { .<API key> { display: inline-block !important; } } @media print { .hidden-print { display: none !important; } }
<form method="post"> <input type="hidden" name="cache" value="123" maxlength="20" /> </form>
package com.microsoft.azure.management.compute.v2017_12_01.implementation; import com.fasterxml.jackson.annotation.JsonProperty; /** * Response after calling a manual recovery walk. */ public class <API key> { /** * Whether the recovery walk was performed. */ @JsonProperty(value = "walkPerformed", access = JsonProperty.Access.WRITE_ONLY) private Boolean walkPerformed; /** * The next update domain that needs to be walked. Null means walk spanning * all update domains has been completed. */ @JsonProperty(value = "<API key>", access = JsonProperty.Access.WRITE_ONLY) private Integer <API key>; /** * Get the walkPerformed value. * * @return the walkPerformed value */ public Boolean walkPerformed() { return this.walkPerformed; } /** * Get the <API key> value. * * @return the <API key> value */ public Integer <API key>() { return this.<API key>; } }
<?php namespace Bigcommerce\Test\Unit\Api\Resources; use Bigcommerce\Api\Resources\Page; use Bigcommerce\Api\Client; class PageTest extends ResourceTestBase { public function <API key>() { $page = new Page(); $this->connection->expects($this->once()) ->method('get') ->with($this->basePath . '/pages'); $page->getAll(); } public function <API key>() { $page = new Page((object)(array('id' => 1))); $this->connection->expects($this->once()) ->method('get') ->with($this->basePath . '/pages/1'); $page->get(); } public function <API key>() { $page = new Page(); $this->connection->expects($this->once()) ->method('post') ->with($this->basePath . '/pages', $page->getCreateFields()); $page->create(); } public function <API key>() { $page = new Page((object)(array('id' => 1))); $this->connection->expects($this->once()) ->method('put') ->with($this->basePath . '/pages/1', $page->getUpdateFields()); $page->update(); } public function <API key>() { $page = new Page((object)(array('id' => 1))); $this->connection->expects($this->once()) ->method('delete') ->with($this->basePath . '/pages/1'); $page->delete(); } }
<div class="umbracoDialog umb-dialog-body with-footer" ng-controller="Umbraco.Editors.MemberTypes.CreateController"> <div class="umb-pane" ng-if="!model.creatingFolder"> <h5><localize key="create_createUnder">Create a type under</localize> {{currentNode.name}}</h5> <ul class="umb-actions umb-actions-child"> <li class="umb-action"> <button type="button" class="umb-action-link umb-outline btn-reset" ng-click="showCreateFolder()"> <i class="large icon icon-folder" aria-hidden="true"></i> <span class="menu-label"><localize key="general_folder"></localize></span> </button> </li> <li class="umb-action"> <button type="button" class="umb-action-link umb-outline btn-reset" ng-click="createMemberType()"> <i class="large icon <API key>"></i> <span class="menu-label"> <localize key="general_new">New</localize>&nbsp; <localize key="content_memberType">Member type</localize> </span> </button> </li> </ul> </div> <div class="umb-pane" ng-if="model.creatingFolder"> <form novalidate name="createFolderForm" ng-submit="createFolder()" val-form-manager> <umb-control-group label="Enter a folder name" hide-label="false"> <input type="text" name="folderName" ng-model="model.folderName" class="umb-textstring textstring input-block-level" required /> </umb-control-group> <button type="submit" class="btn btn-primary"><localize key="general_create">Create</localize></button> </form> </div> </div> <div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-if="!model.creatingFolder"> <button class="btn btn-info" ng-click="nav.hideDialog(true)"> <localize key="<API key>">Do something else</localize> </button> </div>
#ifndef TRANSACTIONRECORD_H #define TRANSACTIONRECORD_H #include "uint256.h" #include <QList> class CWallet; class CWalletTx; /** UI model for transaction status. The transaction status is the part of a transaction that will change over time. */ class TransactionStatus { public: TransactionStatus(): confirmed(false), sortKey(""), maturity(Mature), matures_in(0), status(Offline), depth(0), open_for(0), cur_num_blocks(-1) { } enum Maturity { Immature, Mature, MaturesWarning, /**< Transaction will likely not mature because no nodes have confirmed */ NotAccepted }; enum Status { OpenUntilDate, OpenUntilBlock, Offline, Unconfirmed, HaveConfirmations }; bool confirmed; std::string sortKey; /** @name Generated (mined) transactions @{*/ Maturity maturity; int matures_in; /** @name Reported status @{*/ Status status; int64 depth; int64 open_for; /**< Timestamp if status==OpenUntilDate, otherwise number of blocks */ /** Current number of blocks (to know whether cached status is still valid) */ int cur_num_blocks; }; /** UI model for a transaction. A core transaction can be represented by multiple UI transactions if it has multiple outputs. */ class TransactionRecord { public: enum Type { Other, Generated, Stake, SendToAddress, SendToOther, RecvWithAddress, RecvFromOther, SendToSelf }; /** Number of confirmation needed for transaction */ static const int NumConfirmations = 6; TransactionRecord(): hash(), time(0), type(Other), address(""), debit(0), credit(0), idx(0) { } TransactionRecord(uint256 hash, int64 time): hash(hash), time(time), type(Other), address(""), debit(0), credit(0), idx(0) { } TransactionRecord(uint256 hash, int64 time, Type type, const std::string &address, int64 debit, int64 credit): hash(hash), time(time), type(type), address(address), debit(debit), credit(credit), idx(0) { } /** Decompose CWallet transaction to model transaction records. */ static bool showTransaction(const CWalletTx &wtx); static QList<TransactionRecord> <API key>(const CWallet *wallet, const CWalletTx &wtx); /** @name Immutable transaction attributes @{*/ uint256 hash; int64 time; Type type; std::string address; int64 debit; int64 credit; /** Subtransaction index, for sort key */ int idx; /** Status: can change with block chain update */ TransactionStatus status; /** Return the unique identifier for this transaction (part) */ std::string getTxID(); /** Update status from core wallet tx. */ void updateStatus(const CWalletTx &wtx); /** Return whether a status update is needed. */ bool statusUpdateNeeded(); }; #endif // TRANSACTIONRECORD_H
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="refresh" content="0;URL=../../../libc/constant.IPTOS_ECN_ECT0.html"> </head> <body> <p>Redirecting to <a href="../../../libc/constant.IPTOS_ECN_ECT0.html">../../../libc/constant.IPTOS_ECN_ECT0.html</a>...</p> <script>location.replace("../../../libc/constant.IPTOS_ECN_ECT0.html" + location.search + location.hash);</script> </body> </html>
#! /usr/bin/env ruby -S rspec require '<API key>' describe 'member function' do shared_examples 'item found' do it 'outputs correctly' do apply_manifest(pp, :catch_failures => true) do |r| expect(r.stdout).to match(%r{Notice: output correct}) end end end describe 'success' do pp1 = <<-DOC $a = ['aaa','bbb','ccc'] $b = 'ccc' $c = true $o = member($a,$b) if $o == $c { notify { 'output correct': } } DOC it 'members arrays' do apply_manifest(pp1, :catch_failures => true) do |r| expect(r.stdout).to match(%r{Notice: output correct}) end end describe 'members array of integers' do it_behaves_like 'item found' do let(:pp) do <<-DOC if member( [1,2,3,4], 4 ){ notify { 'output correct': } } DOC end end end describe 'members of mixed array' do it_behaves_like 'item found' do let(:pp) do <<-DOC if member( ['a','4',3], 'a' ){ notify { 'output correct': } } DOC end end end it 'members arrays without members' end describe 'failure' do it 'handles improper argument counts' end end
module.exports={A:{A:{"1":"E A B","2":"H D G mB"},B:{"1":"C K f L N I J q"},C:{"1":"0 1 2 3 4 5 6 8 Q R S T U V W X Y Z a b c d e AB g h i j k l m n o p M r s t u v w x y z EB MB DB BB FB HB IB JB KB LB","2":"jB NB","260":"F O H D G E A B C K f L N I J P dB cB"},D:{"1":"0 1 2 3 4 5 6 8 F O H D G E A B C K f L N I J P Q R S T U V W X Y Z a b c d e AB g h i j k l m n o p M r s t u v w x y z EB MB DB BB FB HB IB JB KB LB bB WB q SB QB rB TB UB"},E:{"1":"F O H D G E A XB YB ZB aB OB","2":"VB PB","513":"7 9 B C K eB"},F:{"1":"0 1 2 3 4 5 6 7 9 B C L N I J P Q R S T U V W X Y Z a b c d e AB g h i j k l m n o p M r s t u v w x y z hB iB GB kB","2":"E fB gB"},G:{"1":"G PB lB CB nB oB pB qB RB sB tB uB","513":"vB wB xB yB zB 0B 1B"},H:{"2":"2B"},I:{"1":"NB F q 5B 6B CB 7B 8B","132":"3B 4B"},J:{"1":"D A"},K:{"1":"7 9 B C M GB","2":"A"},L:{"1":"QB"},M:{"1":"8"},N:{"1":"A B"},O:{"1":"9B"},P:{"1":"F AC BC CC DC EC OB"},Q:{"1":"FC"},R:{"1":"GC"},S:{"1":"HC"}},B:1,C:"Video element"};
<?php return array( 'driver' => 'mysql', 'host' => '127.0.0.1', 'username' => 'root', 'password' => '', 'database' => 'hook_tests', 'collation' => 'utf8_general_ci', 'charset' => 'utf8' );
// /Users/tamc/Documents/github/excel_to_code/spec/test_data/ExampleSpreadsheet.xlsx approximately translated into C // definitions #define NUMBER_OF_REFS 349 #define EXCEL_FILENAME "/Users/tamc/Documents/github/excel_to_code/spec/test_data/ExampleSpreadsheet.xlsx" // end of definitions // First we have c versions of all the excel functions that we know #include <stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <math.h> #include <locale.h> #ifndef NUMBER_OF_REFS #define NUMBER_OF_REFS 0 #endif #ifndef EXCEL_FILENAME #define EXCEL_FILENAME "NoExcelFilename" #endif // Need to retain malloc'd values for a while, so can return to functions that use this library // So to avoid a memory leak we keep an array of all the values we have malloc'd, which we then // free when the reset() function is called. #define <API key> 1000 #define true 1 #define false 0 // These are the various types of excel cell, plus ExcelRange which allows the passing of arrays of cells typedef enum {ExcelEmpty, ExcelNumber, ExcelString, ExcelBoolean, ExcelError, ExcelRange} ExcelType; struct excel_value { ExcelType type; double number; // Used for numbers and for error types char *string; // Used for strings // The following three are used for ranges void *array; int rows; int columns; }; typedef struct excel_value ExcelValue; // These are used in the SUMIF and SUMIFS criteria (e.g., when passed a string like "<20") typedef enum {LessThan, LessThanOrEqual, Equal, NotEqual, MoreThanOrEqual, MoreThan} ExcelComparisonType; struct excel_comparison { ExcelComparisonType type; ExcelValue comparator; }; typedef struct excel_comparison ExcelComparison; // Headers static ExcelValue more_than(ExcelValue a_v, ExcelValue b_v); static ExcelValue more_than_or_equal(ExcelValue a_v, ExcelValue b_v); static ExcelValue not_equal(ExcelValue a_v, ExcelValue b_v); static ExcelValue less_than(ExcelValue a_v, ExcelValue b_v); static ExcelValue less_than_or_equal(ExcelValue a_v, ExcelValue b_v); static ExcelValue average(int array_size, ExcelValue *array); static ExcelValue averageifs(ExcelValue average_range_v, int number_of_arguments, ExcelValue *arguments); static ExcelValue excel_char(ExcelValue number_v); static ExcelValue ensure_is_number(ExcelValue maybe_number_v); static ExcelValue find_2(ExcelValue <API key>, ExcelValue string_to_look_in_v); static ExcelValue find(ExcelValue <API key>, ExcelValue string_to_look_in_v, ExcelValue <API key>); static ExcelValue hlookup_3(ExcelValue lookup_value_v,ExcelValue lookup_table_v, ExcelValue row_number_v); static ExcelValue hlookup(ExcelValue lookup_value_v,ExcelValue lookup_table_v, ExcelValue row_number_v, ExcelValue match_type_v); static ExcelValue iferror(ExcelValue value, ExcelValue value_if_error); static ExcelValue iserr(ExcelValue value); static ExcelValue iserror(ExcelValue value); static ExcelValue excel_index(ExcelValue array_v, ExcelValue row_number_v, ExcelValue column_number_v); static ExcelValue excel_index_2(ExcelValue array_v, ExcelValue row_number_v); static ExcelValue excel_isnumber(ExcelValue number); static ExcelValue excel_isblank(ExcelValue value); static ExcelValue forecast(ExcelValue required_x, ExcelValue known_y, ExcelValue known_x); static ExcelValue large(ExcelValue array_v, ExcelValue k_v); static ExcelValue left(ExcelValue string_v, ExcelValue <API key>); static ExcelValue left_1(ExcelValue string_v); static ExcelValue len(ExcelValue string_v); static ExcelValue excel_log(ExcelValue number); static ExcelValue excel_log_2(ExcelValue number, ExcelValue base); static ExcelValue ln(ExcelValue number); static ExcelValue excel_exp(ExcelValue number); static ExcelValue max(int number_of_arguments, ExcelValue *arguments); static ExcelValue min(int number_of_arguments, ExcelValue *arguments); static ExcelValue mmult(ExcelValue a_v, ExcelValue b_v); static ExcelValue mod(ExcelValue a_v, ExcelValue b_v); static ExcelValue negative(ExcelValue a_v); static ExcelValue number_or_zero(ExcelValue maybe_number_v); static ExcelValue npv(ExcelValue rate, int number_of_arguments, ExcelValue *arguments); static ExcelValue pmt(ExcelValue rate_v, ExcelValue number_of_periods_v, ExcelValue present_value_v); static ExcelValue pmt_4(ExcelValue rate_v, ExcelValue number_of_periods_v, ExcelValue present_value_v, ExcelValue final_value_v); static ExcelValue pmt_5(ExcelValue rate_v, ExcelValue number_of_periods_v, ExcelValue present_value_v, ExcelValue final_value_v, ExcelValue type_v); static ExcelValue power(ExcelValue a_v, ExcelValue b_v); static ExcelValue pv_3(ExcelValue a_v, ExcelValue b_v, ExcelValue c_v); static ExcelValue pv_4(ExcelValue a_v, ExcelValue b_v, ExcelValue c_v, ExcelValue d_v); static ExcelValue pv_5(ExcelValue a_v, ExcelValue b_v, ExcelValue c_v, ExcelValue d_v, ExcelValue e_v); static ExcelValue excel_round(ExcelValue number_v, ExcelValue decimal_places_v); static ExcelValue rank(ExcelValue number_v, ExcelValue range_v, ExcelValue order_v); static ExcelValue rank_2(ExcelValue number_v, ExcelValue range_v); static ExcelValue right(ExcelValue string_v, ExcelValue <API key>); static ExcelValue right_1(ExcelValue string_v); static ExcelValue rounddown(ExcelValue number_v, ExcelValue decimal_places_v); static ExcelValue roundup(ExcelValue number_v, ExcelValue decimal_places_v); static ExcelValue excel_int(ExcelValue number_v); static ExcelValue string_join(int number_of_arguments, ExcelValue *arguments); static ExcelValue subtotal(ExcelValue type, int number_of_arguments, ExcelValue *arguments); static ExcelValue sumifs(ExcelValue sum_range_v, int number_of_arguments, ExcelValue *arguments); static ExcelValue sumif(ExcelValue check_range_v, ExcelValue criteria_v, ExcelValue sum_range_v ); static ExcelValue sumif_2(ExcelValue check_range_v, ExcelValue criteria_v); static ExcelValue sumproduct(int number_of_arguments, ExcelValue *arguments); static ExcelValue text(ExcelValue number_v, ExcelValue format_v); static ExcelValue value(ExcelValue string_v); static ExcelValue vlookup_3(ExcelValue lookup_value_v,ExcelValue lookup_table_v, ExcelValue column_number_v); static ExcelValue vlookup(ExcelValue lookup_value_v,ExcelValue lookup_table_v, ExcelValue column_number_v, ExcelValue match_type_v); // My little heap for keeping pointers to memory that I need to reclaim void **<API key>; int <API key> = 0; int <API key> = -1; static void free_later(void *pointer) { if(<API key> >= <API key>) { if(<API key> <= 0) { <API key> = malloc(<API key>*sizeof(void*)); <API key> = <API key>; } else { <API key> += <API key>; <API key> = realloc(<API key>, <API key> * sizeof(void*)); if(!<API key>) { printf("Could not allocate new memory to memory that needs to be freed array. halting."); exit(-1); } } } <API key>[<API key>] = pointer; <API key>++; } static void <API key>() { int i; for(i = 0; i < <API key>; i++) { free(<API key>[i]); } <API key> = 0; } static int variable_set[NUMBER_OF_REFS]; // Resets all cached and malloc'd values void reset() { <API key>(); memset(variable_set, 0, sizeof(variable_set)); } // Handy macros #define EXCEL_NUMBER(numberdouble) ((ExcelValue) {.type = ExcelNumber, .number = numberdouble}) #define EXCEL_STRING(stringchar) ((ExcelValue) {.type = ExcelString, .string = stringchar}) #define EXCEL_RANGE(arrayofvalues, rangerows, rangecolumns) ((ExcelValue) {.type = ExcelRange, .array = arrayofvalues, .rows = rangerows, .columns = rangecolumns}) static void * <API key>(int size) { ExcelValue *pointer = malloc(sizeof(ExcelValue)*size); // Freed later if(pointer == 0) { printf("Out of memory in <API key>\n"); exit(-1); } free_later(pointer); return pointer; }; // Constants static ExcelValue <API key> = {.type = ExcelString, .string = EXCEL_FILENAME }; const ExcelValue BLANK = {.type = ExcelEmpty, .number = 0}; const ExcelValue ZERO = {.type = ExcelNumber, .number = 0}; const ExcelValue ONE = {.type = ExcelNumber, .number = 1}; const ExcelValue TWO = {.type = ExcelNumber, .number = 2}; const ExcelValue THREE = {.type = ExcelNumber, .number = 3}; const ExcelValue FOUR = {.type = ExcelNumber, .number = 4}; const ExcelValue FIVE = {.type = ExcelNumber, .number = 5}; const ExcelValue SIX = {.type = ExcelNumber, .number = 6}; const ExcelValue SEVEN = {.type = ExcelNumber, .number = 7}; const ExcelValue EIGHT = {.type = ExcelNumber, .number = 8}; const ExcelValue NINE = {.type = ExcelNumber, .number = 9}; const ExcelValue TEN = {.type = ExcelNumber, .number = 10}; // Booleans const ExcelValue TRUE = {.type = ExcelBoolean, .number = true }; const ExcelValue FALSE = {.type = ExcelBoolean, .number = false }; // Errors const ExcelValue VALUE = {.type = ExcelError, .number = 0}; const ExcelValue NAME = {.type = ExcelError, .number = 1}; const ExcelValue DIV0 = {.type = ExcelError, .number = 2}; const ExcelValue REF = {.type = ExcelError, .number = 3}; const ExcelValue NA = {.type = ExcelError, .number = 4}; const ExcelValue NUM = {.type = ExcelError, .number = 5}; // This is the error flag static int conversion_error = 0; // Helpful for debugging static void inspect_excel_value(ExcelValue v) { ExcelValue *array; int i, j, k; switch (v.type) { case ExcelNumber: printf("Number: %f\n",v.number); break; case ExcelBoolean: if(v.number == true) { printf("True\n"); } else if(v.number == false) { printf("False\n"); } else { printf("Boolean with undefined state %f\n",v.number); } break; case ExcelEmpty: if(v.number == 0) { printf("Empty\n"); } else { printf("Empty with unexpected state %f\n",v.number); } break; case ExcelRange: printf("Range rows: %d, columns: %d\n",v.rows,v.columns); array = v.array; for(i = 0; i < v.rows; i++) { printf("Row %d:\n",i+1); for(j = 0; j < v.columns; j++ ) { printf("%d ",j+1); k = (i * v.columns) + j; inspect_excel_value(array[k]); } } break; case ExcelString: printf("String: '%s'\n",v.string); break; case ExcelError: printf("Error number %f ",v.number); switch( (int)v.number) { case 0: printf("VALUE\n"); break; case 1: printf("NAME\n"); break; case 2: printf("DIV0\n"); break; case 3: printf("REF\n"); break; case 4: printf("NA\n"); break; case 5: printf("NUM\n"); break; } break; default: printf("Type %d not recognised",v.type); }; } // Extracts numbers from ExcelValues // Excel treats empty cells as zero static double number_from(ExcelValue v) { char *s; char *p; double n; ExcelValue *array; switch (v.type) { case ExcelNumber: case ExcelBoolean: return v.number; case ExcelEmpty: return 0; case ExcelRange: array = v.array; return number_from(array[0]); case ExcelString: s = v.string; if (s == NULL || *s == '\0' || isspace(*s)) { return 0; } n = strtod (s, &p); if(*p == '\0') { return n; } conversion_error = 1; return 0; case ExcelError: return 0; } return 0; } #define NUMBER(value_name, name) double name; if(value_name.type == ExcelError) { return value_name; }; name = number_from(value_name); #define <API key> if(conversion_error) { conversion_error = 0; return VALUE; }; #define <API key>(name) if(name.type == ExcelError) return name; static ExcelValue excel_abs(ExcelValue a_v) { <API key>(a_v) NUMBER(a_v, a) <API key> if(a >= 0.0 ) { return a_v; } else { return (ExcelValue) {.type = ExcelNumber, .number = -a}; } } static ExcelValue excel_char(ExcelValue a_v) { <API key>(a_v) NUMBER(a_v, a) <API key> if(a <= 0) { return VALUE; } if(a >= 256) { return VALUE; } a = floor(a); char *string = malloc(1); // Freed later if(string == 0) { printf("Out of memory in char"); exit(-1); } string[0] = a; free_later(string); return EXCEL_STRING(string); } static ExcelValue add(ExcelValue a_v, ExcelValue b_v) { <API key>(a_v) <API key>(b_v) NUMBER(a_v, a) NUMBER(b_v, b) <API key> return EXCEL_NUMBER(a + b); } static ExcelValue ensure_is_number(ExcelValue maybe_number_v) { if(maybe_number_v.type == ExcelNumber) { return maybe_number_v; } if(maybe_number_v.type == ExcelError) { return maybe_number_v; } NUMBER(maybe_number_v, maybe_number) <API key> return EXCEL_NUMBER(maybe_number); } static ExcelValue number_or_zero(ExcelValue maybe_number_v) { if(maybe_number_v.type == ExcelNumber) { return maybe_number_v; } if(maybe_number_v.type == ExcelError) { return maybe_number_v; } return ZERO; } static ExcelValue excel_log(ExcelValue number) { return excel_log_2(number, TEN); } static ExcelValue excel_log_2(ExcelValue number_v, ExcelValue base_v) { <API key>(number_v) <API key>(base_v) NUMBER(number_v, n) NUMBER(base_v, b) <API key> if(n<=0) { return NUM; } if(b<=0) { return NUM; } return EXCEL_NUMBER(log(n)/log(b)); } static ExcelValue ln(ExcelValue number_v) { <API key>(number_v) NUMBER(number_v, n) <API key> if(n<=0) { return NUM; } return EXCEL_NUMBER(log(n)); } static ExcelValue excel_exp(ExcelValue number_v) { <API key>(number_v) NUMBER(number_v, n) <API key> return EXCEL_NUMBER(exp(n)); } static ExcelValue excel_and(int array_size, ExcelValue *array) { int i; ExcelValue current_excel_value, array_result; for(i=0;i<array_size;i++) { current_excel_value = array[i]; switch (current_excel_value.type) { case ExcelNumber: case ExcelBoolean: if(current_excel_value.number == false) return FALSE; break; case ExcelRange: array_result = excel_and( current_excel_value.rows * current_excel_value.columns, current_excel_value.array ); if(array_result.type == ExcelError) return array_result; if(array_result.type == ExcelBoolean && array_result.number == false) return FALSE; break; case ExcelString: case ExcelEmpty: break; case ExcelError: return current_excel_value; break; } } return TRUE; } struct average_result { double sum; double count; int has_error; ExcelValue error; }; static struct average_result calculate_average(int array_size, ExcelValue *array) { double sum = 0; double count = 0; int i; ExcelValue current_excel_value; struct average_result array_result, r; for(i=0;i<array_size;i++) { current_excel_value = array[i]; switch (current_excel_value.type) { case ExcelNumber: sum += current_excel_value.number; count++; break; case ExcelRange: array_result = calculate_average( current_excel_value.rows * current_excel_value.columns, current_excel_value.array ); if(array_result.has_error == true) return array_result; sum += array_result.sum; count += array_result.count; break; case ExcelBoolean: case ExcelString: case ExcelEmpty: break; case ExcelError: r.has_error = true; r.error = current_excel_value; return r; break; } } r.count = count; r.sum = sum; r.has_error = false; return r; } static ExcelValue average(int array_size, ExcelValue *array) { struct average_result r = calculate_average(array_size, array); if(r.has_error == true) return r.error; if(r.count == 0) return DIV0; return EXCEL_NUMBER(r.sum/r.count); } static ExcelValue forecast(ExcelValue required_x_v, ExcelValue known_y, ExcelValue known_x) { <API key>(required_x_v) NUMBER(required_x_v, required_x) <API key> if(known_x.type != ExcelRange) { return NA; } if(known_y.type != ExcelRange) { return NA; } int known_x_size = known_x.rows * known_x.columns; int known_y_size = known_y.rows * known_y.columns; int i; ExcelValue *x_array, *y_array; ExcelValue vx, vy; x_array = known_x.array; y_array = known_y.array; for(i=0; i<known_x_size; i++) { vx = x_array[i]; if(vx.type == ExcelError) { return vx; } } for(i=0; i<known_x_size; i++) { vy = y_array[i]; if(vy.type == ExcelError) { return vy; } } if(known_x_size != known_y_size) { return NA; } if(known_x_size == 0) { return NA; } ExcelValue mean_y = average(1, &known_y); ExcelValue mean_x = average(1, &known_x); if(mean_y.type == ExcelError) { return mean_y; } if(mean_x.type == ExcelError) { return mean_x; } float mx = mean_x.number; float my = mean_y.number; float b_numerator, b_denominator, b, a; b_denominator = 0; b_numerator = 0; for(i=0; i<known_x_size; i++) { vx = x_array[i]; vy = y_array[i]; if(vx.type != ExcelNumber) { continue; } if(vy.type != ExcelNumber) { continue; } b_denominator = b_denominator + pow(vx.number - mx, 2); b_numerator = b_numerator + ((vx.number - mx)*(vy.number-my)); } if(b_denominator == 0) { return DIV0; } b = b_numerator / b_denominator; a = mean_y.number - (b*mean_x.number); return EXCEL_NUMBER(a + (b*required_x)); } static ExcelValue choose(ExcelValue index_v, int array_size, ExcelValue *array) { <API key>(index_v) int index = (int) number_from(index_v); <API key> int i; for(i=0;i<array_size;i++) { if(array[i].type == ExcelError) return array[i]; } if(index < 1) return VALUE; if(index > array_size) return VALUE; return array[index-1]; } static ExcelValue count(int array_size, ExcelValue *array) { int i; int n = 0; ExcelValue current_excel_value; for(i=0;i<array_size;i++) { current_excel_value = array[i]; switch (current_excel_value.type) { case ExcelNumber: n++; break; case ExcelRange: n += count( current_excel_value.rows * current_excel_value.columns, current_excel_value.array ).number; break; case ExcelBoolean: case ExcelString: case ExcelEmpty: case ExcelError: break; } } return EXCEL_NUMBER(n); } static ExcelValue counta(int array_size, ExcelValue *array) { int i; int n = 0; ExcelValue current_excel_value; for(i=0;i<array_size;i++) { current_excel_value = array[i]; switch(current_excel_value.type) { case ExcelNumber: case ExcelBoolean: case ExcelString: case ExcelError: n++; break; case ExcelRange: n += counta( current_excel_value.rows * current_excel_value.columns, current_excel_value.array ).number; break; case ExcelEmpty: break; } } return EXCEL_NUMBER(n); } static ExcelValue divide(ExcelValue a_v, ExcelValue b_v) { <API key>(a_v) <API key>(b_v) NUMBER(a_v, a) NUMBER(b_v, b) <API key> if(b == 0) return DIV0; return EXCEL_NUMBER(a / b); } static ExcelValue excel_equal(ExcelValue a_v, ExcelValue b_v) { <API key>(a_v) <API key>(b_v) if(a_v.type != b_v.type) return FALSE; switch (a_v.type) { case ExcelNumber: case ExcelBoolean: case ExcelEmpty: if(a_v.number != b_v.number) return FALSE; return TRUE; case ExcelString: if(strcasecmp(a_v.string,b_v.string) != 0 ) return FALSE; return TRUE; case ExcelError: return a_v; case ExcelRange: return NA; } return FALSE; } static ExcelValue not_equal(ExcelValue a_v, ExcelValue b_v) { ExcelValue result = excel_equal(a_v, b_v); if(result.type == ExcelBoolean) { if(result.number == 0) return TRUE; return FALSE; } return result; } static ExcelValue excel_isnumber(ExcelValue potential_number) { if(potential_number.type == ExcelNumber) { return TRUE; } else { return FALSE; } } static ExcelValue excel_isblank(ExcelValue value) { if(value.type == ExcelEmpty) { return TRUE; } else { return FALSE; } } static ExcelValue excel_if(ExcelValue condition, ExcelValue true_case, ExcelValue false_case ) { <API key>(condition) switch (condition.type) { case ExcelBoolean: if(condition.number == true) return true_case; return false_case; case ExcelNumber: if(condition.number == false) return false_case; return true_case; case ExcelEmpty: return false_case; case ExcelString: return VALUE; case ExcelError: return condition; case ExcelRange: return VALUE; } return condition; } static ExcelValue excel_if_2(ExcelValue condition, ExcelValue true_case ) { return excel_if( condition, true_case, FALSE ); } static ExcelValue excel_index(ExcelValue array_v, ExcelValue row_number_v, ExcelValue column_number_v) { <API key>(array_v) <API key>(row_number_v) <API key>(column_number_v) ExcelValue *array; int rows; int columns; NUMBER(row_number_v, row_number) NUMBER(column_number_v, column_number) <API key> if(array_v.type == ExcelRange) { array = array_v.array; rows = array_v.rows; columns = array_v.columns; } else { ExcelValue tmp_array[] = {array_v}; array = tmp_array; rows = 1; columns = 1; } if(row_number > rows) return REF; if(column_number > columns) return REF; if(row_number == 0 && rows == 1) row_number = 1; if(column_number == 0 && columns == 1) column_number = 1; if(row_number == 0) { // We need the whole column if(column_number < 1) return REF; ExcelValue *result = (ExcelValue *) <API key>(rows); int result_index = 0; ExcelValue r; int array_index; int i; for(i = 0; i < rows; i++) { array_index = (i*columns) + column_number - 1; r = array[array_index]; if(r.type == ExcelEmpty) { result[result_index] = ZERO; } else { result[result_index] = r; } result_index++; } return EXCEL_RANGE(result,rows,1); } else if(column_number == 0 ) { // We need the whole row if(row_number < 1) return REF; ExcelValue *result = (ExcelValue*) <API key>(columns); ExcelValue r; int row_start = ((row_number-1)*columns); int row_finish = row_start + columns; int result_index = 0; int i; for(i = row_start; i < row_finish; i++) { r = array[i]; if(r.type == ExcelEmpty) { result[result_index] = ZERO; } else { result[result_index] = r; } result_index++; } return EXCEL_RANGE(result,1,columns); } else { // We need a precise point if(row_number < 1) return REF; if(column_number < 1) return REF; int position = ((row_number - 1) * columns) + column_number - 1; ExcelValue result = array[position]; if(result.type == ExcelEmpty) return ZERO; return result; } return FALSE; }; static ExcelValue excel_index_2(ExcelValue array_v, ExcelValue offset) { if(array_v.type == ExcelRange) { if(array_v.rows == 1) { return excel_index(array_v,ONE,offset); } else if (array_v.columns == 1) { return excel_index(array_v,offset,ONE); } else { return REF; } } else if (offset.type == ExcelNumber && offset.number == 1) { return array_v; } else { return REF; } return REF; }; int compare_doubles (const void *a, const void *b) { const double *da = (const double *) a; const double *db = (const double *) b; return (*da > *db) - (*da < *db); } static ExcelValue large(ExcelValue range_v, ExcelValue k_v) { <API key>(range_v) <API key>(k_v) int k = (int) number_from(k_v); <API key>; // Check for edge case where just a single number passed if(range_v.type == ExcelNumber) { if( k == 1 ) { return range_v; } else { return NUM; } } // Otherwise grumble if not a range if(!range_v.type == ExcelRange) { return VALUE; } // Check that our k is within bounds if(k < 1) { return NUM; } int range_size = range_v.rows * range_v.columns; // OK this is a really naive implementation. // FIXME: implement the BFPRT algorithm double *sorted = malloc(sizeof(double)*range_size); int sorted_size = 0; ExcelValue *array_v = range_v.array; ExcelValue x_v; int i; for(i = 0; i < range_size; i++ ) { x_v = array_v[i]; if(x_v.type == ExcelError) { free(sorted); return x_v; }; if(x_v.type == ExcelNumber) { sorted[sorted_size] = x_v.number; sorted_size++; } } // Check other bound if(k > sorted_size) { free(sorted); return NUM; } qsort(sorted, sorted_size, sizeof (double), compare_doubles); ExcelValue result = EXCEL_NUMBER(sorted[sorted_size - k]); free(sorted); return result; } static ExcelValue excel_match(ExcelValue lookup_value, ExcelValue lookup_array, ExcelValue match_type ) { <API key>(lookup_value) <API key>(lookup_array) <API key>(match_type) // Blanks are treaked as zeros if(lookup_value.type == ExcelEmpty) lookup_value = ZERO; // Setup the array ExcelValue *array; int size; if(lookup_array.type == ExcelRange) { // Check that the range is a row or column rather than an area if((lookup_array.rows == 1) || (lookup_array.columns == 1)) { array = lookup_array.array; size = lookup_array.rows * lookup_array.columns; } else { // return NA error if covers an area. return NA; }; } else { // Need to wrap the argument up as an array size = 1; ExcelValue tmp_array[1] = {lookup_array}; array = tmp_array; } int type = (int) number_from(match_type); <API key>; int i; ExcelValue x; switch(type) { case 0: for(i = 0; i < size; i++ ) { x = array[i]; if(x.type == ExcelEmpty) x = ZERO; if(excel_equal(lookup_value,x).number == true) return EXCEL_NUMBER(i+1); } return NA; break; case 1: for(i = 0; i < size; i++ ) { x = array[i]; if(x.type == ExcelEmpty) x = ZERO; if(more_than(x,lookup_value).number == true) { if(i==0) return NA; return EXCEL_NUMBER(i); } } return EXCEL_NUMBER(size); break; case -1: for(i = 0; i < size; i++ ) { x = array[i]; if(x.type == ExcelEmpty) x = ZERO; if(less_than(x,lookup_value).number == true) { if(i==0) return NA; return EXCEL_NUMBER(i); } } return EXCEL_NUMBER(size-1); break; } return NA; } static ExcelValue excel_match_2(ExcelValue lookup_value, ExcelValue lookup_array ) { return excel_match(lookup_value, lookup_array, ONE); } static ExcelValue find(ExcelValue find_text_v, ExcelValue within_text_v, ExcelValue start_number_v) { <API key>(find_text_v) <API key>(within_text_v) <API key>(start_number_v) char *find_text; char *within_text; char *within_text_offset; char *result; int start_number = number_from(start_number_v); <API key> // Deal with blanks if(within_text_v.type == ExcelString) { within_text = within_text_v.string; } else if( within_text_v.type == ExcelEmpty) { within_text = ""; } if(find_text_v.type == ExcelString) { find_text = find_text_v.string; } else if( find_text_v.type == ExcelEmpty) { return start_number_v; } // Check length if(start_number < 1) return VALUE; if(start_number > strlen(within_text)) return VALUE; // Offset our within_text pointer // FIXME: No way this is utf-8 compatible within_text_offset = within_text + (start_number - 1); result = strstr(within_text_offset,find_text); if(result) { return EXCEL_NUMBER(result - within_text + 1); } return VALUE; } static ExcelValue find_2(ExcelValue <API key>, ExcelValue string_to_look_in_v) { return find(<API key>, string_to_look_in_v, ONE); }; static ExcelValue left(ExcelValue string_v, ExcelValue <API key>) { <API key>(string_v) <API key>(<API key>) if(string_v.type == ExcelEmpty) return BLANK; if(<API key>.type == ExcelEmpty) return BLANK; int <API key> = (int) number_from(<API key>); <API key> if(<API key> < 0) { return VALUE; } char *string; int <API key> = 0; switch (string_v.type) { case ExcelString: string = string_v.string; break; case ExcelNumber: string = malloc(20); // Freed if(string == 0) { printf("Out of memory in left"); exit(-1); } <API key> = 1; snprintf(string,20,"%0.0f",string_v.number); break; case ExcelBoolean: if(string_v.number == true) { string = "TRUE"; } else { string = "FALSE"; } break; case ExcelEmpty: case ExcelError: case ExcelRange: return string_v; } if(<API key> > strlen(string)) { <API key> = strlen(string); } char *left_string = malloc(<API key>+1); // Freed if(left_string == 0) { printf("Out of memoryn in left"); exit(-1); } memcpy(left_string,string,<API key>); left_string[<API key>] = '\0'; if(<API key> == 1) { free(string); } free_later(left_string); return EXCEL_STRING(left_string); } static ExcelValue left_1(ExcelValue string_v) { return left(string_v, ONE); } static ExcelValue len(ExcelValue string_v) { <API key>(string_v) if(string_v.type == ExcelEmpty) return ZERO; char *string; int <API key> = 0; switch (string_v.type) { case ExcelString: string = string_v.string; break; case ExcelNumber: string = malloc(20); // Freed if(string == 0) { printf("Out of memory in len"); exit(-1); } snprintf(string,20,"%0.0f",string_v.number); <API key> = 1; break; case ExcelBoolean: if(string_v.number == true) { string = "TRUE"; } else { string = "FALSE"; } break; case ExcelEmpty: case ExcelError: case ExcelRange: return string_v; } int length = strlen(string); if(<API key> == 1) { free(string); } return EXCEL_NUMBER(length); } static ExcelValue right(ExcelValue string_v, ExcelValue <API key>) { <API key>(string_v) <API key>(<API key>) if(string_v.type == ExcelEmpty) return BLANK; if(<API key>.type == ExcelEmpty) return BLANK; int <API key> = (int) number_from(<API key>); <API key> if(<API key> < 0) { return VALUE; } char *string; int <API key> = 0; switch (string_v.type) { case ExcelString: string = string_v.string; break; case ExcelNumber: string = malloc(20); // Freed if(string == 0) { printf("Out of memory in right"); exit(-1); } <API key> = 1; snprintf(string,20,"%0.0f",string_v.number); break; case ExcelBoolean: if(string_v.number == true) { string = "TRUE"; } else { string = "FALSE"; } break; case ExcelEmpty: case ExcelError: case ExcelRange: return string_v; } char *right_string = malloc(<API key>+1); // Freed if(right_string == 0) { printf("Out of memory in right"); exit(-1); } int length = strlen(string); if(<API key> > length) { <API key> = length; } memcpy(right_string,string+<API key>,<API key>); right_string[<API key>] = '\0'; if(<API key> == 1) { free(string); } free_later(right_string); return EXCEL_STRING(right_string); } static ExcelValue right_1(ExcelValue string_v) { return right(string_v, ONE); } static ExcelValue iferror(ExcelValue value, ExcelValue value_if_error) { if(value.type == ExcelError) return value_if_error; return value; } static ExcelValue iserr(ExcelValue value) { if(value.type == ExcelError) { if(value.number == NA.number) { return FALSE; } else { return TRUE; } } else { return FALSE; } } static ExcelValue iserror(ExcelValue value) { if(value.type == ExcelError) { return TRUE; } else { return FALSE; } } // Order is TRUE, FALSE, String, Number; Blank is zero static ExcelValue more_than(ExcelValue a_v, ExcelValue b_v) { <API key>(a_v) <API key>(b_v) if(a_v.type == ExcelEmpty) { a_v = ZERO; } if(b_v.type == ExcelEmpty) { b_v = ZERO; } switch (a_v.type) { case ExcelString: switch (b_v.type) { case ExcelString: if(strcasecmp(a_v.string,b_v.string) <= 0 ) {return FALSE;} else {return TRUE;} case ExcelNumber: return TRUE; case ExcelBoolean: return FALSE; // Following shouldn't happen case ExcelEmpty: case ExcelError: case ExcelRange: return NA; } case ExcelBoolean: switch (b_v.type) { case ExcelBoolean: if(a_v.number == true) { if (b_v.number == true) { return FALSE; } else { return TRUE; } } else { // a_v == FALSE return FALSE; } case ExcelString: case ExcelNumber: return TRUE; // Following shouldn't happen case ExcelEmpty: case ExcelError: case ExcelRange: return NA; } case ExcelNumber: switch (b_v.type) { case ExcelNumber: if(a_v.number > b_v.number) { return TRUE; } else { return FALSE; } case ExcelString: case ExcelBoolean: return FALSE; // Following shouldn't happen case ExcelEmpty: case ExcelError: case ExcelRange: return NA; } // Following shouldn't happen case ExcelEmpty: case ExcelError: case ExcelRange: return NA; } // Shouldn't reach here return NA; } static ExcelValue more_than_or_equal(ExcelValue a_v, ExcelValue b_v) { ExcelValue opposite = less_than(a_v, b_v); switch (opposite.type) { case ExcelBoolean: if(opposite.number == true) { return FALSE; } else { return TRUE; } case ExcelError: return opposite; // Shouldn't reach below case ExcelNumber: case ExcelString: case ExcelEmpty: case ExcelRange: return NA; } } // Order is TRUE, FALSE, String, Number; Blank is zero static ExcelValue less_than(ExcelValue a_v, ExcelValue b_v) { <API key>(a_v) <API key>(b_v) if(a_v.type == ExcelEmpty) { a_v = ZERO; } if(b_v.type == ExcelEmpty) { b_v = ZERO; } switch (a_v.type) { case ExcelString: switch (b_v.type) { case ExcelString: if(strcasecmp(a_v.string, b_v.string) >= 0 ) { return FALSE; } else { return TRUE; } case ExcelNumber: return FALSE; case ExcelBoolean: return TRUE; // The following shouldn't happen // FIXME: Should abort if it does case ExcelError: case ExcelRange: case ExcelEmpty: return NA; } case ExcelNumber: switch(b_v.type) { case ExcelNumber: if(a_v.number < b_v.number) { return TRUE; } else { return FALSE; } case ExcelBoolean: case ExcelString: return TRUE; // The following shouldn't happen // FIXME: Should abort if it does case ExcelError: case ExcelRange: case ExcelEmpty: return NA; } case ExcelBoolean: switch(b_v.type) { case ExcelBoolean: if(a_v.number == true) { return FALSE; } else { // a_v.number == false if(b_v.number == true) {return TRUE;} else {return FALSE;} } case ExcelString: case ExcelNumber: return FALSE; // The following shouldn't happen // FIXME: Should abort if it does case ExcelError: case ExcelRange: case ExcelEmpty: return NA; } // The following shouldn't happen // FIXME: Should abort if it does case ExcelError: case ExcelRange: case ExcelEmpty: return VALUE; } // Shouldn't reach here return NA; } static ExcelValue less_than_or_equal(ExcelValue a_v, ExcelValue b_v) { ExcelValue opposite = more_than(a_v, b_v); switch (opposite.type) { case ExcelBoolean: if(opposite.number == true) { return FALSE; } else { return TRUE; } case ExcelError: return opposite; // Shouldn't reach below case ExcelNumber: case ExcelString: case ExcelEmpty: case ExcelRange: return VALUE; } } static ExcelValue subtract(ExcelValue a_v, ExcelValue b_v) { <API key>(a_v) <API key>(b_v) NUMBER(a_v, a) NUMBER(b_v, b) <API key> return EXCEL_NUMBER(a - b); } static ExcelValue multiply(ExcelValue a_v, ExcelValue b_v) { <API key>(a_v) <API key>(b_v) NUMBER(a_v, a) NUMBER(b_v, b) <API key> return EXCEL_NUMBER(a * b); } static ExcelValue sum(int array_size, ExcelValue *array) { double total = 0; int i; ExcelValue r; for(i=0;i<array_size;i++) { switch(array[i].type) { case ExcelNumber: total += array[i].number; break; case ExcelRange: r = sum( array[i].rows * array[i].columns, array[i].array ); if(r.type == ExcelError) { return r; } else { total += number_from(r); } break; case ExcelError: return array[i]; break; default: break; } } return EXCEL_NUMBER(total); } static ExcelValue npv(ExcelValue rate_v, int number_of_arguments, ExcelValue *arguments) { <API key>(rate_v) NUMBER(rate_v, rate) <API key> if(rate == -1) { return DIV0; } double npv = 0; int n = 1; int i; int j; double v; ExcelValue r; ExcelValue r2; ExcelValue *range; for(i=0;i<number_of_arguments;i++) { r = arguments[i]; if(r.type == ExcelError) { return r; } if(r.type == ExcelRange) { range = r.array; for(j=0;j<(r.columns*r.rows);j++) { r2 = range[j]; if(r2.type == ExcelError) { return r2; } v = number_from(r2); if(conversion_error) { conversion_error = 0; return VALUE; } npv = npv + (v/pow(1+rate, n)); n++; } } else { v = number_from(r); if(conversion_error) { conversion_error = 0; return VALUE; } npv = npv + (v/pow(1+rate, n)); n++; } } return EXCEL_NUMBER(npv); } static ExcelValue max(int number_of_arguments, ExcelValue *arguments) { double <API key>; int any_number_found = 0; int i; ExcelValue current_excel_value; for(i=0;i<number_of_arguments;i++) { current_excel_value = arguments[i]; if(current_excel_value.type == ExcelNumber) { if(!any_number_found) { any_number_found = 1; <API key> = current_excel_value.number; } if(current_excel_value.number > <API key>) <API key> = current_excel_value.number; } else if(current_excel_value.type == ExcelRange) { current_excel_value = max( current_excel_value.rows * current_excel_value.columns, current_excel_value.array ); if(current_excel_value.type == ExcelError) return current_excel_value; if(current_excel_value.type == ExcelNumber) if(!any_number_found) { any_number_found = 1; <API key> = current_excel_value.number; } if(current_excel_value.number > <API key>) <API key> = current_excel_value.number; } else if(current_excel_value.type == ExcelError) { return current_excel_value; } } if(!any_number_found) { any_number_found = 1; <API key> = 0; } return EXCEL_NUMBER(<API key>); } static ExcelValue min(int number_of_arguments, ExcelValue *arguments) { double <API key> = 0; int any_number_found = 0; int i; ExcelValue current_excel_value; for(i=0;i<number_of_arguments;i++) { current_excel_value = arguments[i]; if(current_excel_value.type == ExcelNumber) { if(!any_number_found) { any_number_found = 1; <API key> = current_excel_value.number; } if(current_excel_value.number < <API key>) <API key> = current_excel_value.number; } else if(current_excel_value.type == ExcelRange) { current_excel_value = min( current_excel_value.rows * current_excel_value.columns, current_excel_value.array ); if(current_excel_value.type == ExcelError) return current_excel_value; if(current_excel_value.type == ExcelNumber) if(!any_number_found) { any_number_found = 1; <API key> = current_excel_value.number; } if(current_excel_value.number < <API key>) <API key> = current_excel_value.number; } else if(current_excel_value.type == ExcelError) { return current_excel_value; } } if(!any_number_found) { any_number_found = 1; <API key> = 0; } return EXCEL_NUMBER(<API key>); } static ExcelValue mmult_error(ExcelValue a_v, ExcelValue b_v) { int rows = a_v.rows > b_v.rows ? a_v.rows : b_v.rows; int columns = a_v.columns > b_v.columns ? a_v.columns : b_v.columns; int i, j; ExcelValue *result = (ExcelValue*) <API key>(rows*columns); for(i=0; i<rows; i++) { for(j=0; j<columns; j++) { result[(i*columns) + j] = VALUE; } } return EXCEL_RANGE(result, rows, columns); } static ExcelValue mmult(ExcelValue a_v, ExcelValue b_v) { <API key>(a_v) <API key>(b_v) if(a_v.type != ExcelRange) { return VALUE;} if(b_v.type != ExcelRange) { return VALUE;} if(a_v.columns != b_v.rows) { return mmult_error(a_v, b_v); } int n = a_v.columns; int a_rows = a_v.rows; int a_columns = a_v.columns; int b_columns = b_v.columns; ExcelValue *result = (ExcelValue*) <API key>(a_rows*b_columns); int i, j, k; double sum; ExcelValue *array_a = a_v.array; ExcelValue *array_b = b_v.array; ExcelValue a; ExcelValue b; for(i=0; i<a_rows; i++) { for(j=0; j<b_columns; j++) { sum = 0; for(k=0; k<n; k++) { a = array_a[(i*a_columns)+k]; b = array_b[(k*b_columns)+j]; if(a.type != ExcelNumber) { return mmult_error(a_v, b_v); } if(b.type != ExcelNumber) { return mmult_error(a_v, b_v); } sum = sum + (a.number * b.number); } result[(i*b_columns)+j] = EXCEL_NUMBER(sum); } } return EXCEL_RANGE(result, a_rows, b_columns); } static ExcelValue mod(ExcelValue a_v, ExcelValue b_v) { <API key>(a_v) <API key>(b_v) NUMBER(a_v, a) NUMBER(b_v, b) <API key> if(b == 0) return DIV0; return EXCEL_NUMBER(fmod(a,b)); } static ExcelValue negative(ExcelValue a_v) { <API key>(a_v) NUMBER(a_v, a) <API key> return EXCEL_NUMBER(-a); } static ExcelValue pmt(ExcelValue rate_v, ExcelValue number_of_periods_v, ExcelValue present_value_v) { <API key>(rate_v) <API key>(number_of_periods_v) <API key>(present_value_v) NUMBER(rate_v,rate) NUMBER(number_of_periods_v,number_of_periods) NUMBER(present_value_v,present_value) <API key> if(rate == 0) return EXCEL_NUMBER(-(present_value / number_of_periods)); return EXCEL_NUMBER(-present_value*(rate*(pow((1+rate),number_of_periods)))/((pow((1+rate),number_of_periods))-1)); } static ExcelValue pmt_4(ExcelValue rate_v, ExcelValue number_of_periods_v, ExcelValue present_value_v, ExcelValue final_value_v) { <API key>(final_value_v) NUMBER(final_value_v, final_value) <API key> if(final_value == 0) return pmt(rate_v, number_of_periods_v, present_value_v); printf("PMT with non-zero final_value not implemented. halting."); exit(-1); } static ExcelValue pmt_5(ExcelValue rate_v, ExcelValue number_of_periods_v, ExcelValue present_value_v, ExcelValue final_value_v, ExcelValue type_v) { <API key>(type_v) NUMBER(type_v, type) <API key> if(type == 0) return pmt(rate_v, number_of_periods_v, present_value_v); printf("PMT with non-zero type not implemented. halting."); exit(-1); } static ExcelValue pv_3(ExcelValue rate_v, ExcelValue nper_v, ExcelValue pmt_v) { return pv_4(rate_v, nper_v, pmt_v, ZERO); } static ExcelValue pv_4(ExcelValue rate_v, ExcelValue nper_v, ExcelValue pmt_v, ExcelValue fv_v) { return pv_5(rate_v, nper_v, pmt_v, fv_v, ZERO); } static ExcelValue pv_5(ExcelValue rate_v, ExcelValue nper_v, ExcelValue pmt_v, ExcelValue fv_v, ExcelValue type_v ) { <API key>(rate_v) <API key>(nper_v) <API key>(pmt_v) <API key>(fv_v) <API key>(type_v) NUMBER(rate_v, rate) NUMBER(nper_v, nper) NUMBER(pmt_v, payment) NUMBER(fv_v, fv) NUMBER(type_v, start_of_period) <API key> if(rate< 0) { return VALUE; } double present_value = 0; // Sum up the payments if(rate == 0) { present_value = -payment * nper; } else { present_value = -payment * ((1-pow(1+rate,-nper))/rate); } // Adjust for beginning or end of period if(start_of_period == 0) { // Do Nothing } else if(start_of_period == 1) { present_value = present_value * (1+rate); } else { return VALUE; } // Add on the final value present_value = present_value - (fv/pow(1+rate,nper)); return EXCEL_NUMBER(present_value); } static ExcelValue power(ExcelValue a_v, ExcelValue b_v) { <API key>(a_v) <API key>(b_v) NUMBER(a_v, a) NUMBER(b_v, b) <API key> double result = pow(a,b); if(isnan(result) == 1) { return NUM; } else { return EXCEL_NUMBER(result); } } static ExcelValue rank(ExcelValue number_v, ExcelValue range_v, ExcelValue order_v) { <API key>(number_v) <API key>(range_v) <API key>(order_v) NUMBER(number_v, number) NUMBER(order_v, order) ExcelValue *array; int size; <API key> if(range_v.type != ExcelRange) { array = <API key>(1); array[0] = range_v; size = 1; } else { array = range_v.array; size = range_v.rows * range_v.columns; } int ranked = 1; int found = false; int i; ExcelValue cell; for(i=0; i<size; i++) { cell = array[i]; if(cell.type == ExcelError) { return cell; } if(cell.type == ExcelNumber) { if(cell.number == number) { found = true; } if(order == 0) { if(cell.number > number) { ranked++; } } if(order != 0) { if(cell.number < number) { ranked++; } } } } if(found == false) { return NA; } return EXCEL_NUMBER(ranked); } static ExcelValue rank_2(ExcelValue number_v, ExcelValue range_v) { return rank(number_v, range_v, ZERO); } static ExcelValue excel_round(ExcelValue number_v, ExcelValue decimal_places_v) { <API key>(number_v) <API key>(decimal_places_v) NUMBER(number_v, number) NUMBER(decimal_places_v, decimal_places) <API key> double multiple = pow(10,decimal_places); return EXCEL_NUMBER( round(number * multiple) / multiple ); } static ExcelValue rounddown(ExcelValue number_v, ExcelValue decimal_places_v) { <API key>(number_v) <API key>(decimal_places_v) NUMBER(number_v, number) NUMBER(decimal_places_v, decimal_places) <API key> double multiple = pow(10,decimal_places); return EXCEL_NUMBER( trunc(number * multiple) / multiple ); } static ExcelValue roundup(ExcelValue number_v, ExcelValue decimal_places_v) { <API key>(number_v) <API key>(decimal_places_v) NUMBER(number_v, number) NUMBER(decimal_places_v, decimal_places) <API key> double multiple = pow(10,decimal_places); if(number < 0) return EXCEL_NUMBER( floor(number * multiple) / multiple ); return EXCEL_NUMBER( ceil(number * multiple) / multiple ); } static ExcelValue excel_int(ExcelValue number_v) { <API key>(number_v) NUMBER(number_v, number) <API key> return EXCEL_NUMBER(floor(number)); } static ExcelValue string_join(int number_of_arguments, ExcelValue *arguments) { int allocated_length = 100; int used_length = 0; char *string = malloc(allocated_length); // Freed later if(string == 0) { printf("Out of memory in string_join"); exit(-1); } char *current_string; int <API key>; int <API key>; ExcelValue current_v; int i; for(i=0;i<number_of_arguments;i++) { <API key> = 0; current_v = (ExcelValue) arguments[i]; switch (current_v.type) { case ExcelString: current_string = current_v.string; break; case ExcelNumber: current_string = malloc(20); // Freed if(current_string == 0) { printf("Out of memory in string join"); exit(-1); } <API key> = 1; snprintf(current_string,20,"%g",current_v.number); break; case ExcelBoolean: if(current_v.number == true) { current_string = "TRUE"; } else { current_string = "FALSE"; } break; case ExcelEmpty: current_string = ""; break; case ExcelError: free(string); return current_v; case ExcelRange: free(string); return VALUE; } <API key> = strlen(current_string); if( (used_length + <API key> + 1) > allocated_length) { allocated_length = used_length + <API key> + 1 + 100; string = realloc(string,allocated_length); if(!string) { printf("Out of memory in string join realloc trying to increase to %d", allocated_length); exit(-1); } } memcpy(string + used_length, current_string, <API key>); if(<API key> == 1) { free(current_string); } used_length = used_length + <API key>; } // Finished looping through passed strings string = realloc(string,used_length+1); if(!string) { printf("Out of memory in string join realloc trying to increase to %d", used_length+1); exit(-1); } string[used_length] = '\0'; free_later(string); return EXCEL_STRING(string); } static ExcelValue subtotal(ExcelValue subtotal_type_v, int number_of_arguments, ExcelValue *arguments) { <API key>(subtotal_type_v) NUMBER(subtotal_type_v,subtotal_type) <API key> switch((int) subtotal_type) { case 1: case 101: return average(number_of_arguments,arguments); break; case 2: case 102: return count(number_of_arguments,arguments); break; case 3: case 103: return counta(number_of_arguments,arguments); break; case 9: case 109: return sum(number_of_arguments,arguments); break; default: return VALUE; break; } } // FIXME: Check if this deals with errors correctly static ExcelValue filter_range(ExcelValue original_range_v, int number_of_arguments, ExcelValue *arguments) { // First, set up the original_range //<API key>(original_range_v); // Set up the sum range ExcelValue *original_range; int original_range_rows, <API key>; if(original_range_v.type == ExcelRange) { original_range = original_range_v.array; original_range_rows = original_range_v.rows; <API key> = original_range_v.columns; } else { original_range = (ExcelValue*) <API key>(1); original_range[0] = original_range_v; original_range_rows = 1; <API key> = 1; } // This is the filtered range ExcelValue *filtered_range = <API key>(original_range_rows*<API key>); int <API key> = 0; // Then go through and set up the check ranges if(number_of_arguments % 2 != 0) return VALUE; int number_of_criteria = number_of_arguments / 2; ExcelValue *criteria_range = (ExcelValue*) <API key>(number_of_criteria); ExcelValue current_value; int i; for(i = 0; i < number_of_criteria; i++) { current_value = arguments[i*2]; if(current_value.type == ExcelRange) { criteria_range[i] = current_value; if(current_value.rows != original_range_rows) return VALUE; if(current_value.columns != <API key>) return VALUE; } else { if(original_range_rows != 1) return VALUE; if(<API key> != 1) return VALUE; ExcelValue *tmp_array2 = (ExcelValue*) <API key>(1); tmp_array2[0] = current_value; criteria_range[i] = EXCEL_RANGE(tmp_array2,1,1); } } // Now go through and set up the criteria ExcelComparison *criteria = malloc(sizeof(ExcelComparison)*number_of_criteria); // freed at end of function if(criteria == 0) { printf("Out of memory in filter_range\n"); exit(-1); } char *s; char *new_comparator; for(i = 0; i < number_of_criteria; i++) { current_value = arguments[(i*2)+1]; if(current_value.type == ExcelString) { s = current_value.string; if(s[0] == '<') { if( s[1] == '>') { new_comparator = strndup(s+2,strlen(s)-2); free_later(new_comparator); criteria[i].type = NotEqual; criteria[i].comparator = EXCEL_STRING(new_comparator); } else if(s[1] == '=') { new_comparator = strndup(s+2,strlen(s)-2); free_later(new_comparator); criteria[i].type = LessThanOrEqual; criteria[i].comparator = EXCEL_STRING(new_comparator); } else { new_comparator = strndup(s+1,strlen(s)-1); free_later(new_comparator); criteria[i].type = LessThan; criteria[i].comparator = EXCEL_STRING(new_comparator); } } else if(s[0] == '>') { if(s[1] == '=') { new_comparator = strndup(s+2,strlen(s)-2); free_later(new_comparator); criteria[i].type = MoreThanOrEqual; criteria[i].comparator = EXCEL_STRING(new_comparator); } else { new_comparator = strndup(s+1,strlen(s)-1); free_later(new_comparator); criteria[i].type = MoreThan; criteria[i].comparator = EXCEL_STRING(new_comparator); } } else if(s[0] == '=') { new_comparator = strndup(s+1,strlen(s)-1); free_later(new_comparator); criteria[i].type = Equal; criteria[i].comparator = EXCEL_STRING(new_comparator); } else { criteria[i].type = Equal; criteria[i].comparator = current_value; } } else { criteria[i].type = Equal; criteria[i].comparator = current_value; } } int size = <API key> * original_range_rows; int j; int passed = 0; ExcelValue value_to_be_checked; ExcelComparison comparison; ExcelValue comparator; double number; // For each cell in the sum range for(j=0; j < size; j++ ) { passed = 1; for(i=0; i < number_of_criteria; i++) { value_to_be_checked = ((ExcelValue *) ((ExcelValue) criteria_range[i]).array)[j]; comparison = criteria[i]; comparator = comparison.comparator; // For the purposes of comparison, treates a blank criteria as matching zeros. if(comparator.type == ExcelEmpty) { comparator = ZERO; } switch(value_to_be_checked.type) { case ExcelError: // Errors match only errors if(comparison.type != Equal) passed = 0; if(comparator.type != ExcelError) passed = 0; if(value_to_be_checked.number != comparator.number) passed = 0; break; case ExcelBoolean: // Booleans match only booleans (FIXME: I think?) if(comparison.type != Equal) passed = 0; if(comparator.type != ExcelBoolean ) passed = 0; if(value_to_be_checked.number != comparator.number) passed = 0; break; case ExcelEmpty: // if(comparator.type == ExcelEmpty) break; // FIXME: Huh? In excel blank doesn't match blank?! if(comparator.type != ExcelString) { passed = 0; break; } else { if(strlen(comparator.string) != 0) passed = 0; // Empty strings match blanks. break; } case ExcelNumber: if(comparator.type == ExcelNumber) { number = comparator.number; } else if(comparator.type == ExcelString) { number = number_from(comparator); if(conversion_error == 1) { conversion_error = 0; passed = 0; break; } } else { passed = 0; break; } switch(comparison.type) { case Equal: if(value_to_be_checked.number != number) passed = 0; break; case LessThan: if(value_to_be_checked.number >= number) passed = 0; break; case LessThanOrEqual: if(value_to_be_checked.number > number) passed = 0; break; case NotEqual: if(value_to_be_checked.number == number) passed = 0; break; case MoreThanOrEqual: if(value_to_be_checked.number < number) passed = 0; break; case MoreThan: if(value_to_be_checked.number <= number) passed = 0; break; } break; case ExcelString: // First case, the comparator is a number, simplification is that it can only be equal if(comparator.type == ExcelNumber) { if(comparison.type != Equal) { printf("This shouldn't be possible?"); passed = 0; break; } // Special case, empty strings don't match zeros here if(strlen(value_to_be_checked.string) == 0) { passed = 0; break; } number = number_from(value_to_be_checked); if(conversion_error == 1) { conversion_error = 0; passed = 0; break; } if(number != comparator.number) { passed = 0; break; } else { break; } // Second case, the comparator is also a string, so need to be able to do full range of tests } else if(comparator.type == ExcelString) { switch(comparison.type) { case Equal: if(excel_equal(value_to_be_checked,comparator).number == 0) passed = 0; break; case LessThan: if(less_than(value_to_be_checked,comparator).number == 0) passed = 0; break; case LessThanOrEqual: if(less_than_or_equal(value_to_be_checked,comparator).number == 0) passed = 0; break; case NotEqual: if(not_equal(value_to_be_checked,comparator).number == 0) passed = 0; break; case MoreThanOrEqual: if(more_than_or_equal(value_to_be_checked,comparator).number == 0) passed = 0; break; case MoreThan: if(more_than(value_to_be_checked,comparator).number == 0) passed = 0; break; } } else { passed = 0; break; } break; case ExcelRange: free(criteria); return VALUE; } if(passed == 0) break; } if(passed == 1) { current_value = original_range[j]; if(current_value.type == ExcelError) { free(criteria); return current_value; } else if(current_value.type == ExcelNumber) { filtered_range[<API key>] = current_value; <API key> += 1; } } } // Tidy up free(criteria); return EXCEL_RANGE(filtered_range, <API key>, 1); } static ExcelValue sumifs(ExcelValue sum_range_v, int number_of_arguments, ExcelValue *arguments) { ExcelValue filtered_range = filter_range(sum_range_v, number_of_arguments, arguments); return sum(1,&filtered_range); } static ExcelValue averageifs(ExcelValue average_range_v, int number_of_arguments, ExcelValue *arguments) { ExcelValue filtered_range = filter_range(average_range_v, number_of_arguments, arguments); return average(1,&filtered_range); } static ExcelValue sumif(ExcelValue check_range_v, ExcelValue criteria_v, ExcelValue sum_range_v ) { ExcelValue tmp_array_sumif[] = {check_range_v, criteria_v}; return sumifs(sum_range_v,2,tmp_array_sumif); } static ExcelValue sumif_2(ExcelValue check_range_v, ExcelValue criteria_v) { ExcelValue tmp_array_sumif2[] = {check_range_v, criteria_v}; return sumifs(check_range_v,2,tmp_array_sumif2); } static ExcelValue sumproduct(int number_of_arguments, ExcelValue *arguments) { if(number_of_arguments <1) return VALUE; int a; int i; int j; int rows; int columns; ExcelValue current_value; ExcelValue **ranges = malloc(sizeof(ExcelValue *)*number_of_arguments); if(ranges == 0) { printf("Out of memory in sumproduct\n"); exit(-1); } double product = 1; double sum = 0; // Find out dimensions of first argument if(arguments[0].type == ExcelRange) { rows = arguments[0].rows; columns = arguments[0].columns; } else { rows = 1; columns = 1; } // Extract arrays from each of the given ranges, checking for errors and bounds as we go for(a=0;a<number_of_arguments;a++) { current_value = arguments[a]; switch(current_value.type) { case ExcelRange: if(current_value.rows != rows || current_value.columns != columns) { free(ranges); return VALUE; } ranges[a] = current_value.array; break; case ExcelError: free(ranges); return current_value; break; case ExcelEmpty: free(ranges); return VALUE; break; default: if(rows != 1 && columns !=1) { free(ranges); return VALUE; } ranges[a] = (ExcelValue*) <API key>(1); ranges[a][0] = arguments[a]; break; } } for(i=0;i<rows;i++) { for(j=0;j<columns;j++) { product = 1; for(a=0;a<number_of_arguments;a++) { current_value = ranges[a][(i*columns)+j]; if(current_value.type == ExcelNumber) { product *= current_value.number; } else { product *= 0; } } sum += product; } } free(ranges); return EXCEL_NUMBER(sum); } // FIXME: This could do with being done properly, rather than // on a case by case basis. static ExcelValue text(ExcelValue number_v, ExcelValue format_v) { <API key>(number_v) <API key>(format_v) char *s; char *p; double n; ExcelValue result; if(number_v.type == ExcelEmpty) { number_v = ZERO; } if(format_v.type == ExcelEmpty) { return EXCEL_STRING(""); } if(format_v.type == ExcelNumber && format_v.number == 0) { format_v = EXCEL_STRING("0"); } if(number_v.type == ExcelString) { s = number_v.string; if (s == NULL || *s == '\0' || isspace(*s)) { number_v = ZERO; } n = strtod (s, &p); if(*p == '\0') { number_v = EXCEL_NUMBER(n); } } if(number_v.type != ExcelNumber) { return number_v; } if(format_v.type != ExcelString) { return format_v; } // FIXME: Too little? s = malloc(100); setlocale(LC_ALL,""); if(strcmp(format_v.string,"0%") == 0) { snprintf(s, 99, "%0.0f%%", number_v.number*100); } else if(strcmp(format_v.string,"0.0%") == 0) { snprintf(s, 99, "%0.1f%%", number_v.number*100); } else if(strcmp(format_v.string,"0") == 0) { snprintf(s, 99, "%0.0f",number_v.number); } else if(strcmp(format_v.string,"0.0") == 0) { snprintf(s, 99, "%0.1f",number_v.number); } else if(strcmp(format_v.string,"0.00") == 0) { snprintf(s, 99, "%0.2f",number_v.number); } else if(strcmp(format_v.string,"0.000") == 0) { snprintf(s, 99, "%0.3f",number_v.number); } else if(strcmp(format_v.string," snprintf(s, 99, "%'0.0f",number_v.number); } else if(strcmp(format_v.string,"#,##0") == 0) { snprintf(s, 99, "%'0.0f",number_v.number); } else if(strcmp(format_v.string,"#,##0.0") == 0) { snprintf(s, 99, "%'0.1f",number_v.number); } else if(strcmp(format_v.string,"#,##0.00") == 0) { snprintf(s, 99, "%'0.2f",number_v.number); } else if(strcmp(format_v.string,"#,##0.000") == 0) { snprintf(s, 99, "%'0.3f",number_v.number); } else if(strcmp(format_v.string,"0000") == 0) { snprintf(s, 99, "%04.0f",number_v.number); } else { snprintf(s, 99, "Text format not recognised"); } free_later(s); result = EXCEL_STRING(s); // inspect_excel_value(result); return result; } static ExcelValue vlookup_3(ExcelValue lookup_value_v,ExcelValue lookup_table_v, ExcelValue column_number_v) { return vlookup(lookup_value_v,lookup_table_v,column_number_v,TRUE); } static ExcelValue vlookup(ExcelValue lookup_value_v,ExcelValue lookup_table_v, ExcelValue column_number_v, ExcelValue match_type_v) { <API key>(lookup_value_v) <API key>(lookup_table_v) <API key>(column_number_v) <API key>(match_type_v) if(lookup_value_v.type == ExcelEmpty) return NA; if(lookup_table_v.type != ExcelRange) return NA; if(column_number_v.type != ExcelNumber) return NA; if(match_type_v.type == ExcelNumber && match_type_v.number >= 0 && match_type_v.number <= 1) { match_type_v.type = ExcelBoolean; } if(match_type_v.type != ExcelBoolean) return NA; int i; int last_good_match = 0; int rows = lookup_table_v.rows; int columns = lookup_table_v.columns; ExcelValue *array = lookup_table_v.array; ExcelValue possible_match_v; if(column_number_v.number > columns) return REF; if(column_number_v.number < 1) return VALUE; if(match_type_v.number == false) { // Exact match required for(i=0; i< rows; i++) { possible_match_v = array[i*columns]; if(excel_equal(lookup_value_v,possible_match_v).number == true) { return array[(i*columns)+(((int) column_number_v.number) - 1)]; } } return NA; } else { // Highest value that is less than or equal for(i=0; i< rows; i++) { possible_match_v = array[i*columns]; if(lookup_value_v.type != possible_match_v.type) continue; if(more_than(possible_match_v,lookup_value_v).number == true) { if(i == 0) return NA; return array[((i-1)*columns)+(((int) column_number_v.number) - 1)]; } else { last_good_match = i; } } return array[(last_good_match*columns)+(((int) column_number_v.number) - 1)]; } return NA; } static ExcelValue hlookup_3(ExcelValue lookup_value_v,ExcelValue lookup_table_v, ExcelValue row_number_v) { return hlookup(lookup_value_v,lookup_table_v,row_number_v,TRUE); } static ExcelValue hlookup(ExcelValue lookup_value_v,ExcelValue lookup_table_v, ExcelValue row_number_v, ExcelValue match_type_v) { <API key>(lookup_value_v) <API key>(lookup_table_v) <API key>(row_number_v) <API key>(match_type_v) if(lookup_value_v.type == ExcelEmpty) return NA; if(lookup_table_v.type != ExcelRange) return NA; if(row_number_v.type != ExcelNumber) return NA; if(match_type_v.type == ExcelNumber && match_type_v.number >= 0 && match_type_v.number <= 1) { match_type_v.type = ExcelBoolean; } if(match_type_v.type != ExcelBoolean) return NA; int i; int last_good_match = 0; int rows = lookup_table_v.rows; int columns = lookup_table_v.columns; ExcelValue *array = lookup_table_v.array; ExcelValue possible_match_v; if(row_number_v.number > rows) return REF; if(row_number_v.number < 1) return VALUE; if(match_type_v.number == false) { // Exact match required for(i=0; i< columns; i++) { possible_match_v = array[i]; if(excel_equal(lookup_value_v,possible_match_v).number == true) { return array[((((int) row_number_v.number)-1)*columns)+(i)]; } } return NA; } else { // Highest value that is less than or equal for(i=0; i< columns; i++) { possible_match_v = array[i]; if(lookup_value_v.type != possible_match_v.type) continue; if(more_than(possible_match_v,lookup_value_v).number == true) { if(i == 0) return NA; return array[((((int) row_number_v.number)-1)*columns)+(i-1)]; } else { last_good_match = i; } } return array[((((int) row_number_v.number)-1)*columns)+(last_good_match)]; } return NA; } static ExcelValue value(ExcelValue string_v) { <API key>(string_v) NUMBER(string_v, a) <API key> return EXCEL_NUMBER(a); } // Allows numbers to be 0.1% different static ExcelValue roughly_equal(ExcelValue a_v, ExcelValue b_v) { if(a_v.type == ExcelEmpty && b_v.type == ExcelNumber && b_v.number == 0) return TRUE; if(b_v.type == ExcelEmpty && a_v.type == ExcelNumber && a_v.number == 0) return TRUE; if(a_v.type != b_v.type) return FALSE; float epsilon, difference; switch (a_v.type) { case ExcelNumber: // FIXME: Arbitrary choice of epsilons if(b_v.number > -1e-6 && b_v.number < 1e-6) { epsilon = 1e-6; } else { epsilon = b_v.number * 0.001; } if(epsilon < 0) epsilon = -epsilon; difference = a_v.number - b_v.number; if(difference < 0) difference = -difference; if(difference <= epsilon) return TRUE; // For debuging: printf("a: %e b:%e d: %e e: %e", a_v.number, b_v.number, difference, epsilon); return FALSE; case ExcelBoolean: case ExcelEmpty: if(a_v.number != b_v.number) return FALSE; return TRUE; case ExcelString: if(strcasecmp(a_v.string,b_v.string) != 0 ) return FALSE; return TRUE; case ExcelError: if(a_v.number != b_v.number) return FALSE; return TRUE; case ExcelRange: return NA; } return FALSE; } static void assert_equal(ExcelValue expected, ExcelValue actual, char location[]) { ExcelValue comparison = roughly_equal(actual, expected); if(comparison.type == ExcelBoolean && comparison.number == 1) { putchar('.'); } else { printf("\n\nFailed at %s\n", location); printf("Expected: "); inspect_excel_value(expected); printf("Got: "); inspect_excel_value(actual); putchar('\n'); } } // End of the generic c functions // Start of the file specific functions ExcelValue valuetypes_a1(); ExcelValue valuetypes_a2(); ExcelValue valuetypes_a3(); ExcelValue valuetypes_a4(); ExcelValue valuetypes_a5(); ExcelValue valuetypes_a6(); ExcelValue formulaetypes_a1(); ExcelValue formulaetypes_b1(); ExcelValue formulaetypes_a2(); ExcelValue formulaetypes_b2(); ExcelValue formulaetypes_a3(); ExcelValue formulaetypes_b3(); ExcelValue formulaetypes_a4(); ExcelValue formulaetypes_b4(); ExcelValue formulaetypes_a5(); ExcelValue formulaetypes_b5(); ExcelValue formulaetypes_a6(); ExcelValue formulaetypes_b6(); ExcelValue formulaetypes_a7(); ExcelValue formulaetypes_b7(); ExcelValue formulaetypes_a8(); ExcelValue formulaetypes_b8(); ExcelValue ranges_b1(); ExcelValue ranges_c1(); ExcelValue ranges_a2(); ExcelValue ranges_b2(); ExcelValue ranges_c2(); ExcelValue ranges_a3(); ExcelValue ranges_b3(); ExcelValue ranges_c3(); ExcelValue ranges_a4(); ExcelValue ranges_b4(); ExcelValue ranges_c4(); ExcelValue ranges_f4(); ExcelValue ranges_e5(); ExcelValue ranges_f5(); ExcelValue ranges_g5(); ExcelValue ranges_f6(); ExcelValue referencing_a1(); ExcelValue referencing_a2(); ExcelValue referencing_a4(); ExcelValue referencing_b4(); ExcelValue referencing_c4(); ExcelValue referencing_a5(); ExcelValue referencing_b8(); ExcelValue referencing_b9(); ExcelValue referencing_b11(); ExcelValue referencing_c11(); ExcelValue referencing_c15(); ExcelValue referencing_d15(); ExcelValue referencing_e15(); ExcelValue referencing_f15(); ExcelValue referencing_c16(); ExcelValue referencing_d16(); ExcelValue referencing_e16(); ExcelValue referencing_f16(); ExcelValue referencing_c17(); ExcelValue referencing_d17(); ExcelValue referencing_e17(); ExcelValue referencing_f17(); ExcelValue referencing_c18(); ExcelValue referencing_d18(); ExcelValue referencing_e18(); ExcelValue referencing_f18(); ExcelValue referencing_c19(); ExcelValue referencing_d19(); ExcelValue referencing_e19(); ExcelValue referencing_f19(); ExcelValue referencing_c22(); ExcelValue referencing_d22(); ExcelValue referencing_d23(); ExcelValue referencing_d24(); ExcelValue referencing_d25(); ExcelValue referencing_c31(); ExcelValue referencing_o31(); ExcelValue referencing_f33(); ExcelValue referencing_g33(); ExcelValue referencing_h33(); ExcelValue referencing_i33(); ExcelValue referencing_j33(); ExcelValue referencing_k33(); ExcelValue referencing_l33(); ExcelValue referencing_m33(); ExcelValue referencing_n33(); ExcelValue referencing_o33(); ExcelValue referencing_c34(); ExcelValue referencing_d34(); ExcelValue referencing_e34(); ExcelValue referencing_f34(); ExcelValue referencing_g34(); ExcelValue referencing_h34(); ExcelValue referencing_i34(); ExcelValue referencing_j34(); ExcelValue referencing_k34(); ExcelValue referencing_l34(); ExcelValue referencing_m34(); ExcelValue referencing_n34(); ExcelValue referencing_c35(); ExcelValue referencing_d35(); ExcelValue referencing_j35(); ExcelValue referencing_m35(); ExcelValue referencing_n35(); ExcelValue referencing_o35(); ExcelValue referencing_c36(); ExcelValue referencing_d36(); ExcelValue referencing_j36(); ExcelValue referencing_m36(); ExcelValue referencing_n36(); ExcelValue referencing_o36(); ExcelValue referencing_c37(); ExcelValue referencing_d37(); ExcelValue referencing_f37(); ExcelValue referencing_m37(); ExcelValue referencing_n37(); ExcelValue referencing_o37(); ExcelValue referencing_c38(); ExcelValue referencing_d38(); ExcelValue referencing_i38(); ExcelValue referencing_m38(); ExcelValue referencing_n38(); ExcelValue referencing_o38(); ExcelValue referencing_c39(); ExcelValue referencing_d39(); ExcelValue referencing_e39(); ExcelValue referencing_h39(); ExcelValue referencing_m39(); ExcelValue referencing_n39(); ExcelValue referencing_o39(); ExcelValue referencing_c40(); ExcelValue referencing_d40(); ExcelValue referencing_e40(); ExcelValue referencing_g40(); ExcelValue referencing_j40(); ExcelValue referencing_m40(); ExcelValue referencing_n40(); ExcelValue referencing_o40(); ExcelValue referencing_c41(); ExcelValue referencing_d41(); ExcelValue referencing_e41(); ExcelValue referencing_g41(); ExcelValue referencing_j41(); ExcelValue referencing_m41(); ExcelValue referencing_n41(); ExcelValue referencing_o41(); ExcelValue referencing_c42(); ExcelValue referencing_d42(); ExcelValue referencing_f42(); ExcelValue referencing_l42(); ExcelValue referencing_m42(); ExcelValue referencing_o42(); ExcelValue referencing_c43(); ExcelValue referencing_d43(); ExcelValue referencing_f43(); ExcelValue referencing_l43(); ExcelValue referencing_m43(); ExcelValue referencing_o43(); ExcelValue referencing_c44(); ExcelValue referencing_d44(); ExcelValue referencing_l44(); ExcelValue referencing_m44(); ExcelValue referencing_n44(); ExcelValue referencing_o44(); ExcelValue referencing_c45(); ExcelValue referencing_d45(); ExcelValue referencing_g45(); ExcelValue referencing_j45(); ExcelValue referencing_m45(); ExcelValue referencing_n45(); ExcelValue referencing_o45(); ExcelValue referencing_c46(); ExcelValue referencing_d46(); ExcelValue referencing_g46(); ExcelValue referencing_h46(); ExcelValue referencing_m46(); ExcelValue referencing_n46(); ExcelValue referencing_o46(); ExcelValue referencing_c47(); ExcelValue referencing_d47(); ExcelValue referencing_e47(); ExcelValue referencing_k47(); ExcelValue referencing_m47(); ExcelValue referencing_n47(); ExcelValue referencing_o47(); ExcelValue referencing_d50(); ExcelValue referencing_g50(); ExcelValue referencing_d51(); ExcelValue referencing_g51(); ExcelValue referencing_d52(); ExcelValue referencing_g52(); ExcelValue referencing_d53(); ExcelValue referencing_g53(); ExcelValue referencing_d54(); ExcelValue referencing_g54(); ExcelValue referencing_d55(); ExcelValue referencing_g55(); ExcelValue referencing_d56(); ExcelValue referencing_g56(); ExcelValue referencing_d57(); ExcelValue referencing_g57(); ExcelValue referencing_d58(); ExcelValue referencing_g58(); ExcelValue referencing_d59(); ExcelValue referencing_g59(); ExcelValue referencing_d60(); ExcelValue referencing_g60(); ExcelValue referencing_d61(); ExcelValue referencing_g61(); ExcelValue referencing_d62(); ExcelValue referencing_g62(); ExcelValue referencing_d64(); ExcelValue referencing_e64(); ExcelValue referencing_h64(); ExcelValue referencing_e68(); ExcelValue referencing_f68(); ExcelValue referencing_e69(); ExcelValue referencing_f69(); ExcelValue referencing_e70(); ExcelValue referencing_f70(); ExcelValue referencing_e72(); ExcelValue referencing_f72(); ExcelValue referencing_g72(); ExcelValue tables_a1(); ExcelValue tables_b2(); ExcelValue tables_c2(); ExcelValue tables_d2(); ExcelValue tables_b3(); ExcelValue tables_c3(); ExcelValue tables_d3(); ExcelValue tables_b4(); ExcelValue tables_c4(); ExcelValue tables_d4(); ExcelValue tables_f4(); ExcelValue tables_g4(); ExcelValue tables_h4(); ExcelValue tables_b5(); ExcelValue tables_c5(); ExcelValue tables_e6(); ExcelValue tables_f6(); ExcelValue tables_g6(); ExcelValue tables_e7(); ExcelValue tables_f7(); ExcelValue tables_g7(); ExcelValue tables_e8(); ExcelValue tables_f8(); ExcelValue tables_g8(); ExcelValue tables_e9(); ExcelValue tables_f9(); ExcelValue tables_g9(); ExcelValue tables_c10(); ExcelValue tables_e10(); ExcelValue tables_f10(); ExcelValue tables_g10(); ExcelValue tables_c11(); ExcelValue tables_e11(); ExcelValue tables_f11(); ExcelValue tables_g11(); ExcelValue tables_c12(); ExcelValue tables_c13(); ExcelValue tables_c14(); ExcelValue tables_g17(); ExcelValue <API key>(); ExcelValue ranges_f1(); ExcelValue ranges_f2(); ExcelValue ranges_f3(); ExcelValue ranges_a5(); ExcelValue ranges_b5(); ExcelValue ranges_c5(); ExcelValue ranges_d5(); ExcelValue referencing_f35(); ExcelValue referencing_g35(); ExcelValue referencing_h35(); ExcelValue referencing_i35(); ExcelValue referencing_k35(); ExcelValue referencing_l35(); ExcelValue referencing_f36(); ExcelValue referencing_g36(); ExcelValue referencing_h36(); ExcelValue referencing_i36(); ExcelValue referencing_k36(); ExcelValue referencing_l36(); ExcelValue referencing_g37(); ExcelValue referencing_h37(); ExcelValue referencing_i37(); ExcelValue referencing_j37(); ExcelValue referencing_k37(); ExcelValue referencing_l37(); ExcelValue referencing_f38(); ExcelValue referencing_g38(); ExcelValue referencing_h38(); ExcelValue referencing_j38(); ExcelValue referencing_k38(); ExcelValue referencing_l38(); ExcelValue referencing_f39(); ExcelValue referencing_g39(); ExcelValue referencing_i39(); ExcelValue referencing_j39(); ExcelValue referencing_k39(); ExcelValue referencing_l39(); ExcelValue referencing_f40(); ExcelValue referencing_h40(); ExcelValue referencing_i40(); ExcelValue referencing_k40(); ExcelValue referencing_l40(); ExcelValue referencing_f41(); ExcelValue referencing_h41(); ExcelValue referencing_i41(); ExcelValue referencing_k41(); ExcelValue referencing_l41(); ExcelValue referencing_g42(); ExcelValue referencing_h42(); ExcelValue referencing_i42(); ExcelValue referencing_j42(); ExcelValue referencing_k42(); ExcelValue referencing_n42(); ExcelValue referencing_g43(); ExcelValue referencing_h43(); ExcelValue referencing_i43(); ExcelValue referencing_j43(); ExcelValue referencing_k43(); ExcelValue referencing_n43(); ExcelValue referencing_f44(); ExcelValue referencing_g44(); ExcelValue referencing_h44(); ExcelValue referencing_i44(); ExcelValue referencing_j44(); ExcelValue referencing_k44(); ExcelValue referencing_f45(); ExcelValue referencing_h45(); ExcelValue referencing_i45(); ExcelValue referencing_k45(); ExcelValue referencing_l45(); ExcelValue referencing_f46(); ExcelValue referencing_i46(); ExcelValue referencing_j46(); ExcelValue referencing_k46(); ExcelValue referencing_l46(); ExcelValue referencing_f47(); ExcelValue referencing_g47(); ExcelValue referencing_h47(); ExcelValue referencing_i47(); ExcelValue referencing_j47(); ExcelValue referencing_l47(); ExcelValue common0(); ExcelValue common1(); ExcelValue common2(); ExcelValue common3(); ExcelValue common7(); ExcelValue common9(); ExcelValue common10(); // starting the value constants static ExcelValue constant1 = {.type = ExcelString, .string = "Hello"}; static ExcelValue constant2 = {.type = ExcelNumber, .number = 3.1415}; static ExcelValue constant3 = {.type = ExcelString, .string = "Simple"}; static ExcelValue constant4 = {.type = ExcelString, .string = "Sharing"}; static ExcelValue constant5 = {.type = ExcelNumber, .number = 267.7467614837482}; static ExcelValue constant6 = {.type = ExcelString, .string = "Shared"}; static ExcelValue constant7 = {.type = ExcelString, .string = "Array (single)"}; static ExcelValue constant8 = {.type = ExcelString, .string = "Arraying (multiple)"}; static ExcelValue constant9 = {.type = ExcelString, .string = "Not Eight"}; static ExcelValue constant10 = {.type = ExcelString, .string = "Arrayed (multiple)"}; static ExcelValue constant11 = {.type = ExcelString, .string = "This sheet"}; static ExcelValue constant12 = {.type = ExcelString, .string = "Other sheet"}; static ExcelValue constant13 = {.type = ExcelString, .string = "Standard"}; static ExcelValue constant14 = {.type = ExcelString, .string = "Column"}; static ExcelValue constant15 = {.type = ExcelString, .string = "Row"}; static ExcelValue constant16 = {.type = ExcelString, .string = "Named"}; static ExcelValue constant17 = {.type = ExcelString, .string = "Reference"}; static ExcelValue constant18 = {.type = ExcelNumber, .number = 1.4535833325868115}; static ExcelValue constant19 = {.type = ExcelNumber, .number = 1.511726665890284}; static ExcelValue constant20 = {.type = ExcelNumber, .number = 1.5407983325420203}; static ExcelValue constant21 = {.type = ExcelNumber, .number = 9.054545454545455}; static ExcelValue constant22 = {.type = ExcelNumber, .number = 12.0}; static ExcelValue constant23 = {.type = ExcelNumber, .number = 18.0}; static ExcelValue constant24 = {.type = ExcelNumber, .number = 0.3681150635671386}; static ExcelValue constant25 = {.type = ExcelNumber, .number = 0.40588480110308967}; static ExcelValue constant26 = {.type = ExcelNumber, .number = 0.42190146532760275}; static ExcelValue constant27 = {.type = ExcelNumber, .number = 0.651}; static ExcelValue constant28 = {.type = ExcelString, .string = "Technology efficiencies -- hot water -- annual mean"}; static ExcelValue constant29 = {.type = ExcelString, .string = "% of input energy"}; static ExcelValue constant30 = {.type = ExcelString, .string = "Electricity (delivered to end user)"}; static ExcelValue constant31 = {.type = ExcelString, .string = "Electricity (supplied to grid)"}; static ExcelValue constant32 = {.type = ExcelString, .string = "Solid hydrocarbons"}; static ExcelValue constant33 = {.type = ExcelString, .string = "Liquid hydrocarbons"}; static ExcelValue constant34 = {.type = ExcelString, .string = "Gaseous hydrocarbons"}; static ExcelValue constant35 = {.type = ExcelString, .string = "Heat transport"}; static ExcelValue constant36 = {.type = ExcelString, .string = "Environmental heat"}; static ExcelValue constant37 = {.type = ExcelString, .string = "Heating & cooling"}; static ExcelValue constant38 = {.type = ExcelString, .string = "Conversion losses"}; static ExcelValue constant39 = {.type = ExcelString, .string = "Balance"}; static ExcelValue constant40 = {.type = ExcelString, .string = "Code"}; static ExcelValue constant41 = {.type = ExcelString, .string = "Technology"}; static ExcelValue constant42 = {.type = ExcelString, .string = "Notes"}; static ExcelValue constant43 = {.type = ExcelString, .string = "V.01"}; static ExcelValue constant44 = {.type = ExcelString, .string = "V.02"}; static ExcelValue constant45 = {.type = ExcelString, .string = "V.03"}; static ExcelValue constant46 = {.type = ExcelString, .string = "V.04"}; static ExcelValue constant47 = {.type = ExcelString, .string = "V.05"}; static ExcelValue constant48 = {.type = ExcelString, .string = "V.07"}; static ExcelValue constant49 = {.type = ExcelString, .string = "R.07"}; static ExcelValue constant50 = {.type = ExcelString, .string = "H.01"}; static ExcelValue constant51 = {.type = ExcelString, .string = "X.01"}; static ExcelValue constant52 = {.type = ExcelString, .string = "Gas boiler (old)"}; static ExcelValue constant53 = {.type = ExcelNumber, .number = -1.0}; static ExcelValue constant54 = {.type = ExcelNumber, .number = 0.76}; static ExcelValue constant55 = {.type = ExcelNumber, .number = 0.24}; static ExcelValue constant56 = {.type = ExcelString, .string = "Gas boiler (new)"}; static ExcelValue constant57 = {.type = ExcelNumber, .number = 0.91}; static ExcelValue constant58 = {.type = ExcelNumber, .number = 0.09}; static ExcelValue constant59 = {.type = ExcelString, .string = "Resistive heating"}; static ExcelValue constant60 = {.type = ExcelString, .string = "Oil-fired boiler"}; static ExcelValue constant61 = {.type = ExcelNumber, .number = 0.97}; static ExcelValue constant62 = {.type = ExcelNumber, .number = 0.03}; static ExcelValue constant63 = {.type = ExcelNumber, .number = -2.<API key>}; static ExcelValue constant64 = {.type = ExcelString, .string = "Solid-fuel boiler"}; static ExcelValue constant65 = {.type = ExcelString, .string = "[2]"}; static ExcelValue constant66 = {.type = ExcelNumber, .number = 0.87}; static ExcelValue constant67 = {.type = ExcelNumber, .number = 0.13}; static ExcelValue constant68 = {.type = ExcelString, .string = "Stirling engine micro-CHP"}; static ExcelValue constant69 = {.type = ExcelString, .string = "[3]"}; static ExcelValue constant70 = {.type = ExcelNumber, .number = 0.225}; static ExcelValue constant71 = {.type = ExcelNumber, .number = 0.63}; static ExcelValue constant72 = {.type = ExcelNumber, .number = 0.145}; static ExcelValue constant73 = {.type = ExcelString, .string = "Fuel-cell micro-CHP"}; static ExcelValue constant74 = {.type = ExcelNumber, .number = 0.45}; static ExcelValue constant75 = {.type = ExcelNumber, .number = 0.1}; static ExcelValue constant76 = {.type = ExcelString, .string = "Air-source heat pump"}; static ExcelValue constant77 = {.type = ExcelString, .string = "Ground-source heat pump"}; static ExcelValue constant78 = {.type = ExcelNumber, .number = -2.0}; static ExcelValue constant79 = {.type = ExcelString, .string = "Geothermal electricity"}; static ExcelValue constant80 = {.type = ExcelNumber, .number = 0.85}; static ExcelValue constant81 = {.type = ExcelNumber, .number = 0.15}; static ExcelValue constant82 = {.type = ExcelNumber, .number = 11.0}; static ExcelValue constant83 = {.type = ExcelString, .string = "Community scale gas CHP with local district heating"}; static ExcelValue constant84 = {.type = ExcelNumber, .number = 0.38}; static ExcelValue constant85 = {.type = ExcelString, .string = "Community scale solid-fuel CHP with local district heating"}; static ExcelValue constant86 = {.type = ExcelNumber, .number = 0.17}; static ExcelValue constant87 = {.type = ExcelNumber, .number = 0.57}; static ExcelValue constant88 = {.type = ExcelNumber, .number = 0.26}; static ExcelValue constant89 = {.type = ExcelNumber, .number = 13.0}; static ExcelValue constant90 = {.type = ExcelString, .string = "Long distance district heating from large power stations"}; static ExcelValue constant91 = {.type = ExcelString, .string = "[6]"}; static ExcelValue constant92 = {.type = ExcelNumber, .number = 0.9}; static ExcelValue constant93 = {.type = ExcelNumber, .number = 137.26515207025273}; static ExcelValue constant94 = {.type = ExcelNumber, .number = 30.731004194832696}; static ExcelValue constant95 = {.type = ExcelNumber, .number = 20.487336129888465}; static ExcelValue constant96 = {.type = ExcelNumber, .number = 8.194934451955387}; static ExcelValue constant97 = {.type = ExcelString, .string = "Alpha"}; static ExcelValue constant98 = {.type = ExcelString, .string = "Beta"}; static ExcelValue constant99 = {.type = ExcelString, .string = "Gamma"}; static ExcelValue constant100 = {.type = ExcelString, .string = "ColA"}; static ExcelValue constant101 = {.type = ExcelString, .string = "ColB"}; static ExcelValue constant102 = {.type = ExcelString, .string = "Column1"}; static ExcelValue constant103 = {.type = ExcelString, .string = "A"}; static ExcelValue constant104 = {.type = ExcelString, .string = "Z"}; static ExcelValue constant105 = {.type = ExcelString, .string = "B"}; static ExcelValue constant106 = {.type = ExcelString, .string = "ZB"}; // ending the value constants ExcelValue <API key>() { return TRUE; } static ExcelValue <API key>; ExcelValue valuetypes_a1() { if(variable_set[0] == 1) { return <API key>; } else { return <API key>(); } } void set_valuetypes_a1(ExcelValue newValue) { variable_set[0] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant1; } static ExcelValue <API key>; ExcelValue valuetypes_a2() { if(variable_set[1] == 1) { return <API key>; } else { return <API key>(); } } void set_valuetypes_a2(ExcelValue newValue) { variable_set[1] = 1; <API key> = newValue; } ExcelValue <API key>() { return ONE; } static ExcelValue <API key>; ExcelValue valuetypes_a3() { if(variable_set[2] == 1) { return <API key>; } else { return <API key>(); } } void set_valuetypes_a3(ExcelValue newValue) { variable_set[2] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant2; } static ExcelValue <API key>; ExcelValue valuetypes_a4() { if(variable_set[3] == 1) { return <API key>; } else { return <API key>(); } } void set_valuetypes_a4(ExcelValue newValue) { variable_set[3] = 1; <API key> = newValue; } ExcelValue <API key>() { return NAME; } static ExcelValue <API key>; ExcelValue valuetypes_a5() { if(variable_set[4] == 1) { return <API key>; } else { return <API key>(); } } void set_valuetypes_a5(ExcelValue newValue) { variable_set[4] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant1; } static ExcelValue <API key>; ExcelValue valuetypes_a6() { if(variable_set[5] == 1) { return <API key>; } else { return <API key>(); } } void set_valuetypes_a6(ExcelValue newValue) { variable_set[5] = 1; <API key> = newValue; } ExcelValue formulaetypes_a1() { return constant3; } ExcelValue formulaetypes_b1() { static ExcelValue result; if(variable_set[7] == 1) { return result;} result = TWO; variable_set[7] = 1; return result; } ExcelValue formulaetypes_a2() { return constant4; } ExcelValue formulaetypes_b2() { return constant5; } ExcelValue formulaetypes_a3() { return constant6; } ExcelValue formulaetypes_b3() { return constant5; } ExcelValue formulaetypes_a4() { return constant6; } ExcelValue formulaetypes_b4() { return constant5; } ExcelValue formulaetypes_a5() { return constant7; } ExcelValue formulaetypes_b5() { static ExcelValue result; if(variable_set[15] == 1) { return result;} result = TWO; variable_set[15] = 1; return result; } ExcelValue formulaetypes_a6() { return constant8; } ExcelValue formulaetypes_b6() { return constant9; } ExcelValue formulaetypes_a7() { return constant10; } ExcelValue formulaetypes_b7() { return constant9; } ExcelValue formulaetypes_a8() { return constant10; } ExcelValue formulaetypes_b8() { return constant9; } ExcelValue ranges_b1() { return constant11; } ExcelValue ranges_c1() { return constant12; } ExcelValue ranges_a2() { return constant13; } ExcelValue ranges_b2() { static ExcelValue result; if(variable_set[25] == 1) { return result;} ExcelValue array0[] = {ranges_f4(),ranges_f5(),ranges_f6()}; result = sum(3, array0); variable_set[25] = 1; return result; } ExcelValue ranges_c2() { static ExcelValue result; if(variable_set[26] == 1) { return result;} ExcelValue array0[] = {valuetypes_a3(),valuetypes_a4()}; result = sum(2, array0); variable_set[26] = 1; return result; } ExcelValue ranges_a3() { return constant14; } ExcelValue ranges_b3() { static ExcelValue result; if(variable_set[28] == 1) { return result;} static ExcelValue array1[6]; array1[0] = BLANK; array1[1] = BLANK; array1[2] = BLANK; array1[3] = ranges_f4(); array1[4] = ranges_f5(); array1[5] = ranges_f6(); ExcelValue array1_ev = EXCEL_RANGE(array1,6,1); ExcelValue array0[] = {array1_ev}; result = sum(1, array0); variable_set[28] = 1; return result; } ExcelValue ranges_c3() { static ExcelValue result; if(variable_set[29] == 1) { return result;} ExcelValue array0[] = {valuetypes_a1(),valuetypes_a2(),valuetypes_a3(),valuetypes_a4(),valuetypes_a5(),valuetypes_a6()}; result = sum(6, array0); variable_set[29] = 1; return result; } ExcelValue ranges_a4() { return constant15; } ExcelValue ranges_b4() { static ExcelValue result; if(variable_set[31] == 1) { return result;} static ExcelValue array1[7]; array1[0] = BLANK; array1[1] = BLANK; array1[2] = BLANK; array1[3] = BLANK; array1[4] = ranges_e5(); array1[5] = ranges_f5(); array1[6] = ranges_g5(); ExcelValue array1_ev = EXCEL_RANGE(array1,1,7); ExcelValue array0[] = {array1_ev}; result = sum(1, array0); variable_set[31] = 1; return result; } ExcelValue ranges_c4() { static ExcelValue result; if(variable_set[32] == 1) { return result;} result = number_or_zero(valuetypes_a4()); variable_set[32] = 1; return result; } ExcelValue ranges_f4_default() { return ONE; } static ExcelValue ranges_f4_variable; ExcelValue ranges_f4() { if(variable_set[33] == 1) { return ranges_f4_variable; } else { return ranges_f4_default(); } } void set_ranges_f4(ExcelValue newValue) { variable_set[33] = 1; ranges_f4_variable = newValue; } ExcelValue ranges_e5_default() { return ONE; } static ExcelValue ranges_e5_variable; ExcelValue ranges_e5() { if(variable_set[34] == 1) { return ranges_e5_variable; } else { return ranges_e5_default(); } } void set_ranges_e5(ExcelValue newValue) { variable_set[34] = 1; ranges_e5_variable = newValue; } ExcelValue ranges_f5_default() { return TWO; } static ExcelValue ranges_f5_variable; ExcelValue ranges_f5() { if(variable_set[35] == 1) { return ranges_f5_variable; } else { return ranges_f5_default(); } } void set_ranges_f5(ExcelValue newValue) { variable_set[35] = 1; ranges_f5_variable = newValue; } ExcelValue ranges_g5_default() { return THREE; } static ExcelValue ranges_g5_variable; ExcelValue ranges_g5() { if(variable_set[36] == 1) { return ranges_g5_variable; } else { return ranges_g5_default(); } } void set_ranges_g5(ExcelValue newValue) { variable_set[36] = 1; ranges_g5_variable = newValue; } ExcelValue ranges_f6_default() { return THREE; } static ExcelValue ranges_f6_variable; ExcelValue ranges_f6() { if(variable_set[37] == 1) { return ranges_f6_variable; } else { return ranges_f6_default(); } } void set_ranges_f6(ExcelValue newValue) { variable_set[37] = 1; ranges_f6_variable = newValue; } ExcelValue referencing_a1() { return common0(); } ExcelValue referencing_a2() { static ExcelValue result; if(variable_set[39] == 1) { return result;} result = referencing_a1(); variable_set[39] = 1; return result; } ExcelValue <API key>() { return TEN; } static ExcelValue <API key>; ExcelValue referencing_a4() { if(variable_set[40] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_a4(ExcelValue newValue) { variable_set[40] = 1; <API key> = newValue; } ExcelValue referencing_b4() { return common1(); } ExcelValue referencing_c4() { return common0(); } ExcelValue referencing_a5() { static ExcelValue result; if(variable_set[43] == 1) { return result;} result = THREE; variable_set[43] = 1; return result; } ExcelValue referencing_b8() { static ExcelValue result; if(variable_set[44] == 1) { return result;} result = referencing_a1(); variable_set[44] = 1; return result; } ExcelValue referencing_b9() { return common2(); } ExcelValue referencing_b11() { return constant16; } ExcelValue referencing_c11() { return constant17; } ExcelValue <API key>() { return ONE; } static ExcelValue <API key>; ExcelValue referencing_c15() { if(variable_set[48] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_c15(ExcelValue newValue) { variable_set[48] = 1; <API key> = newValue; } ExcelValue <API key>() { return TWO; } static ExcelValue <API key>; ExcelValue referencing_d15() { if(variable_set[49] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_d15(ExcelValue newValue) { variable_set[49] = 1; <API key> = newValue; } ExcelValue <API key>() { return THREE; } static ExcelValue <API key>; ExcelValue referencing_e15() { if(variable_set[50] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_e15(ExcelValue newValue) { variable_set[50] = 1; <API key> = newValue; } ExcelValue <API key>() { return FOUR; } static ExcelValue <API key>; ExcelValue referencing_f15() { if(variable_set[51] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f15(ExcelValue newValue) { variable_set[51] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant18; } static ExcelValue <API key>; ExcelValue referencing_c16() { if(variable_set[52] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_c16(ExcelValue newValue) { variable_set[52] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant18; } static ExcelValue <API key>; ExcelValue referencing_d16() { if(variable_set[53] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_d16(ExcelValue newValue) { variable_set[53] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant19; } static ExcelValue <API key>; ExcelValue referencing_e16() { if(variable_set[54] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_e16(ExcelValue newValue) { variable_set[54] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant20; } static ExcelValue <API key>; ExcelValue referencing_f16() { if(variable_set[55] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f16(ExcelValue newValue) { variable_set[55] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant21; } static ExcelValue <API key>; ExcelValue referencing_c17() { if(variable_set[56] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_c17(ExcelValue newValue) { variable_set[56] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant22; } static ExcelValue <API key>; ExcelValue referencing_d17() { if(variable_set[57] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_d17(ExcelValue newValue) { variable_set[57] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant23; } static ExcelValue <API key>; ExcelValue referencing_e17() { if(variable_set[58] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_e17(ExcelValue newValue) { variable_set[58] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant23; } static ExcelValue <API key>; ExcelValue referencing_f17() { if(variable_set[59] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f17(ExcelValue newValue) { variable_set[59] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant24; } static ExcelValue <API key>; ExcelValue referencing_c18() { if(variable_set[60] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_c18(ExcelValue newValue) { variable_set[60] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant24; } static ExcelValue <API key>; ExcelValue referencing_d18() { if(variable_set[61] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_d18(ExcelValue newValue) { variable_set[61] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant25; } static ExcelValue <API key>; ExcelValue referencing_e18() { if(variable_set[62] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_e18(ExcelValue newValue) { variable_set[62] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant26; } static ExcelValue <API key>; ExcelValue referencing_f18() { if(variable_set[63] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f18(ExcelValue newValue) { variable_set[63] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant27; } static ExcelValue <API key>; ExcelValue referencing_c19() { if(variable_set[64] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_c19(ExcelValue newValue) { variable_set[64] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant27; } static ExcelValue <API key>; ExcelValue referencing_d19() { if(variable_set[65] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_d19(ExcelValue newValue) { variable_set[65] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant27; } static ExcelValue <API key>; ExcelValue referencing_e19() { if(variable_set[66] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_e19(ExcelValue newValue) { variable_set[66] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant27; } static ExcelValue <API key>; ExcelValue referencing_f19() { if(variable_set[67] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f19(ExcelValue newValue) { variable_set[67] = 1; <API key> = newValue; } ExcelValue <API key>() { return FOUR; } static ExcelValue <API key>; ExcelValue referencing_c22() { if(variable_set[68] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_c22(ExcelValue newValue) { variable_set[68] = 1; <API key> = newValue; } ExcelValue referencing_d22() { static ExcelValue result; if(variable_set[69] == 1) { return result;} result = excel_index(common3(),ONE,ONE); variable_set[69] = 1; return result; } ExcelValue referencing_d23() { static ExcelValue result; if(variable_set[70] == 1) { return result;} result = excel_index(common3(),TWO,ONE); variable_set[70] = 1; return result; } ExcelValue referencing_d24() { static ExcelValue result; if(variable_set[71] == 1) { return result;} result = excel_index(common3(),THREE,ONE); variable_set[71] = 1; return result; } ExcelValue referencing_d25() { static ExcelValue result; if(variable_set[72] == 1) { return result;} result = excel_index(common3(),FOUR,ONE); variable_set[72] = 1; return result; } ExcelValue referencing_c31() { return constant28; } ExcelValue referencing_o31() { return constant29; } ExcelValue referencing_f33() { return constant30; } ExcelValue referencing_g33() { return constant31; } ExcelValue referencing_h33() { return constant32; } ExcelValue referencing_i33() { return constant33; } ExcelValue referencing_j33() { return constant34; } ExcelValue referencing_k33() { return constant35; } ExcelValue referencing_l33() { return constant36; } ExcelValue referencing_m33() { return constant37; } ExcelValue referencing_n33() { return constant38; } ExcelValue referencing_o33() { return constant39; } ExcelValue referencing_c34() { return constant40; } ExcelValue referencing_d34() { return constant41; } ExcelValue referencing_e34() { return constant42; } ExcelValue <API key>() { return constant43; } static ExcelValue <API key>; ExcelValue referencing_f34() { if(variable_set[88] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f34(ExcelValue newValue) { variable_set[88] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant44; } static ExcelValue <API key>; ExcelValue referencing_g34() { if(variable_set[89] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g34(ExcelValue newValue) { variable_set[89] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant45; } static ExcelValue <API key>; ExcelValue referencing_h34() { if(variable_set[90] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_h34(ExcelValue newValue) { variable_set[90] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant46; } static ExcelValue <API key>; ExcelValue referencing_i34() { if(variable_set[91] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_i34(ExcelValue newValue) { variable_set[91] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant47; } static ExcelValue <API key>; ExcelValue referencing_j34() { if(variable_set[92] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_j34(ExcelValue newValue) { variable_set[92] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant48; } static ExcelValue <API key>; ExcelValue referencing_k34() { if(variable_set[93] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_k34(ExcelValue newValue) { variable_set[93] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant49; } static ExcelValue <API key>; ExcelValue referencing_l34() { if(variable_set[94] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_l34(ExcelValue newValue) { variable_set[94] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant50; } static ExcelValue <API key>; ExcelValue referencing_m34() { if(variable_set[95] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m34(ExcelValue newValue) { variable_set[95] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant51; } static ExcelValue <API key>; ExcelValue referencing_n34() { if(variable_set[96] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n34(ExcelValue newValue) { variable_set[96] = 1; <API key> = newValue; } ExcelValue referencing_c35() { static ExcelValue result; if(variable_set[97] == 1) { return result;} result = ONE; variable_set[97] = 1; return result; } ExcelValue referencing_d35() { return constant52; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_j35() { if(variable_set[99] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_j35(ExcelValue newValue) { variable_set[99] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant54; } static ExcelValue <API key>; ExcelValue referencing_m35() { if(variable_set[100] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m35(ExcelValue newValue) { variable_set[100] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant55; } static ExcelValue <API key>; ExcelValue referencing_n35() { if(variable_set[101] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n35(ExcelValue newValue) { variable_set[101] = 1; <API key> = newValue; } ExcelValue referencing_o35() { static ExcelValue result; if(variable_set[102] == 1) { return result;} result = ZERO; variable_set[102] = 1; return result; } ExcelValue referencing_c36() { static ExcelValue result; if(variable_set[103] == 1) { return result;} result = TWO; variable_set[103] = 1; return result; } ExcelValue referencing_d36() { return constant56; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_j36() { if(variable_set[105] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_j36(ExcelValue newValue) { variable_set[105] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant57; } static ExcelValue <API key>; ExcelValue referencing_m36() { if(variable_set[106] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m36(ExcelValue newValue) { variable_set[106] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant58; } static ExcelValue <API key>; ExcelValue referencing_n36() { if(variable_set[107] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n36(ExcelValue newValue) { variable_set[107] = 1; <API key> = newValue; } ExcelValue referencing_o36() { static ExcelValue result; if(variable_set[108] == 1) { return result;} result = ZERO; variable_set[108] = 1; return result; } ExcelValue referencing_c37() { static ExcelValue result; if(variable_set[109] == 1) { return result;} result = THREE; variable_set[109] = 1; return result; } ExcelValue referencing_d37() { return constant59; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_f37() { if(variable_set[111] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f37(ExcelValue newValue) { variable_set[111] = 1; <API key> = newValue; } ExcelValue <API key>() { return ONE; } static ExcelValue <API key>; ExcelValue referencing_m37() { if(variable_set[112] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m37(ExcelValue newValue) { variable_set[112] = 1; <API key> = newValue; } ExcelValue <API key>() { return ZERO; } static ExcelValue <API key>; ExcelValue referencing_n37() { if(variable_set[113] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n37(ExcelValue newValue) { variable_set[113] = 1; <API key> = newValue; } ExcelValue referencing_o37() { static ExcelValue result; if(variable_set[114] == 1) { return result;} result = ZERO; variable_set[114] = 1; return result; } ExcelValue referencing_c38() { static ExcelValue result; if(variable_set[115] == 1) { return result;} result = FOUR; variable_set[115] = 1; return result; } ExcelValue referencing_d38() { return constant60; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_i38() { if(variable_set[117] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_i38(ExcelValue newValue) { variable_set[117] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant61; } static ExcelValue <API key>; ExcelValue referencing_m38() { if(variable_set[118] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m38(ExcelValue newValue) { variable_set[118] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant62; } static ExcelValue <API key>; ExcelValue referencing_n38() { if(variable_set[119] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n38(ExcelValue newValue) { variable_set[119] = 1; <API key> = newValue; } ExcelValue referencing_o38() { return constant63; } ExcelValue referencing_c39() { static ExcelValue result; if(variable_set[121] == 1) { return result;} result = FIVE; variable_set[121] = 1; return result; } ExcelValue referencing_d39() { return constant64; } ExcelValue referencing_e39() { return constant65; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_h39() { if(variable_set[124] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_h39(ExcelValue newValue) { variable_set[124] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant66; } static ExcelValue <API key>; ExcelValue referencing_m39() { if(variable_set[125] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m39(ExcelValue newValue) { variable_set[125] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant67; } static ExcelValue <API key>; ExcelValue referencing_n39() { if(variable_set[126] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n39(ExcelValue newValue) { variable_set[126] = 1; <API key> = newValue; } ExcelValue referencing_o39() { static ExcelValue result; if(variable_set[127] == 1) { return result;} result = ZERO; variable_set[127] = 1; return result; } ExcelValue referencing_c40() { static ExcelValue result; if(variable_set[128] == 1) { return result;} result = SIX; variable_set[128] = 1; return result; } ExcelValue referencing_d40() { return constant68; } ExcelValue referencing_e40() { return constant69; } ExcelValue <API key>() { return constant70; } static ExcelValue <API key>; ExcelValue referencing_g40() { if(variable_set[131] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g40(ExcelValue newValue) { variable_set[131] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_j40() { if(variable_set[132] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_j40(ExcelValue newValue) { variable_set[132] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant71; } static ExcelValue <API key>; ExcelValue referencing_m40() { if(variable_set[133] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m40(ExcelValue newValue) { variable_set[133] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant72; } static ExcelValue <API key>; ExcelValue referencing_n40() { if(variable_set[134] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n40(ExcelValue newValue) { variable_set[134] = 1; <API key> = newValue; } ExcelValue referencing_o40() { static ExcelValue result; if(variable_set[135] == 1) { return result;} result = ZERO; variable_set[135] = 1; return result; } ExcelValue referencing_c41() { static ExcelValue result; if(variable_set[136] == 1) { return result;} result = SEVEN; variable_set[136] = 1; return result; } ExcelValue referencing_d41() { return constant73; } ExcelValue referencing_e41() { return constant69; } ExcelValue <API key>() { return constant74; } static ExcelValue <API key>; ExcelValue referencing_g41() { if(variable_set[139] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g41(ExcelValue newValue) { variable_set[139] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_j41() { if(variable_set[140] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_j41(ExcelValue newValue) { variable_set[140] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant74; } static ExcelValue <API key>; ExcelValue referencing_m41() { if(variable_set[141] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m41(ExcelValue newValue) { variable_set[141] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant75; } static ExcelValue <API key>; ExcelValue referencing_n41() { if(variable_set[142] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n41(ExcelValue newValue) { variable_set[142] = 1; <API key> = newValue; } ExcelValue referencing_o41() { static ExcelValue result; if(variable_set[143] == 1) { return result;} result = ZERO; variable_set[143] = 1; return result; } ExcelValue referencing_c42() { static ExcelValue result; if(variable_set[144] == 1) { return result;} result = EIGHT; variable_set[144] = 1; return result; } ExcelValue referencing_d42() { return constant76; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_f42() { if(variable_set[146] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f42(ExcelValue newValue) { variable_set[146] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_l42() { if(variable_set[147] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_l42(ExcelValue newValue) { variable_set[147] = 1; <API key> = newValue; } ExcelValue <API key>() { return TWO; } static ExcelValue <API key>; ExcelValue referencing_m42() { if(variable_set[148] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m42(ExcelValue newValue) { variable_set[148] = 1; <API key> = newValue; } ExcelValue referencing_o42() { static ExcelValue result; if(variable_set[149] == 1) { return result;} result = ZERO; variable_set[149] = 1; return result; } ExcelValue referencing_c43() { static ExcelValue result; if(variable_set[150] == 1) { return result;} result = NINE; variable_set[150] = 1; return result; } ExcelValue referencing_d43() { return constant77; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_f43() { if(variable_set[152] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f43(ExcelValue newValue) { variable_set[152] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant78; } static ExcelValue <API key>; ExcelValue referencing_l43() { if(variable_set[153] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_l43(ExcelValue newValue) { variable_set[153] = 1; <API key> = newValue; } ExcelValue <API key>() { return THREE; } static ExcelValue <API key>; ExcelValue referencing_m43() { if(variable_set[154] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m43(ExcelValue newValue) { variable_set[154] = 1; <API key> = newValue; } ExcelValue referencing_o43() { static ExcelValue result; if(variable_set[155] == 1) { return result;} result = ZERO; variable_set[155] = 1; return result; } ExcelValue referencing_c44() { static ExcelValue result; if(variable_set[156] == 1) { return result;} result = TEN; variable_set[156] = 1; return result; } ExcelValue referencing_d44() { return constant79; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_l44() { if(variable_set[158] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_l44(ExcelValue newValue) { variable_set[158] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant80; } static ExcelValue <API key>; ExcelValue referencing_m44() { if(variable_set[159] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m44(ExcelValue newValue) { variable_set[159] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant81; } static ExcelValue <API key>; ExcelValue referencing_n44() { if(variable_set[160] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n44(ExcelValue newValue) { variable_set[160] = 1; <API key> = newValue; } ExcelValue referencing_o44() { static ExcelValue result; if(variable_set[161] == 1) { return result;} result = ZERO; variable_set[161] = 1; return result; } ExcelValue referencing_c45() { return constant82; } ExcelValue referencing_d45() { return constant83; } ExcelValue <API key>() { return constant84; } static ExcelValue <API key>; ExcelValue referencing_g45() { if(variable_set[164] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g45(ExcelValue newValue) { variable_set[164] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_j45() { if(variable_set[165] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_j45(ExcelValue newValue) { variable_set[165] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant84; } static ExcelValue <API key>; ExcelValue referencing_m45() { if(variable_set[166] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m45(ExcelValue newValue) { variable_set[166] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant55; } static ExcelValue <API key>; ExcelValue referencing_n45() { if(variable_set[167] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n45(ExcelValue newValue) { variable_set[167] = 1; <API key> = newValue; } ExcelValue referencing_o45() { static ExcelValue result; if(variable_set[168] == 1) { return result;} result = ZERO; variable_set[168] = 1; return result; } ExcelValue referencing_c46() { return constant22; } ExcelValue referencing_d46() { return constant85; } ExcelValue <API key>() { return constant86; } static ExcelValue <API key>; ExcelValue referencing_g46() { if(variable_set[171] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g46(ExcelValue newValue) { variable_set[171] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_h46() { if(variable_set[172] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_h46(ExcelValue newValue) { variable_set[172] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant87; } static ExcelValue <API key>; ExcelValue referencing_m46() { if(variable_set[173] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m46(ExcelValue newValue) { variable_set[173] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant88; } static ExcelValue <API key>; ExcelValue referencing_n46() { if(variable_set[174] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n46(ExcelValue newValue) { variable_set[174] = 1; <API key> = newValue; } ExcelValue referencing_o46() { static ExcelValue result; if(variable_set[175] == 1) { return result;} result = ZERO; variable_set[175] = 1; return result; } ExcelValue referencing_c47() { return constant89; } ExcelValue referencing_d47() { return constant90; } ExcelValue referencing_e47() { return constant91; } ExcelValue <API key>() { return constant53; } static ExcelValue <API key>; ExcelValue referencing_k47() { if(variable_set[179] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_k47(ExcelValue newValue) { variable_set[179] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant92; } static ExcelValue <API key>; ExcelValue referencing_m47() { if(variable_set[180] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_m47(ExcelValue newValue) { variable_set[180] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant75; } static ExcelValue <API key>; ExcelValue referencing_n47() { if(variable_set[181] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_n47(ExcelValue newValue) { variable_set[181] = 1; <API key> = newValue; } ExcelValue referencing_o47() { static ExcelValue result; if(variable_set[182] == 1) { return result;} result = ZERO; variable_set[182] = 1; return result; } ExcelValue referencing_d50() { return constant52; } ExcelValue <API key>() { return constant93; } static ExcelValue <API key>; ExcelValue referencing_g50() { if(variable_set[184] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g50(ExcelValue newValue) { variable_set[184] = 1; <API key> = newValue; } ExcelValue referencing_d51() { return constant56; } ExcelValue <API key>() { return constant94; } static ExcelValue <API key>; ExcelValue referencing_g51() { if(variable_set[186] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g51(ExcelValue newValue) { variable_set[186] = 1; <API key> = newValue; } ExcelValue referencing_d52() { return constant59; } ExcelValue <API key>() { return constant95; } static ExcelValue <API key>; ExcelValue referencing_g52() { if(variable_set[188] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g52(ExcelValue newValue) { variable_set[188] = 1; <API key> = newValue; } ExcelValue referencing_d53() { return constant60; } ExcelValue <API key>() { return constant96; } static ExcelValue <API key>; ExcelValue referencing_g53() { if(variable_set[190] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g53(ExcelValue newValue) { variable_set[190] = 1; <API key> = newValue; } ExcelValue referencing_d54() { return constant64; } ExcelValue <API key>() { return constant96; } static ExcelValue <API key>; ExcelValue referencing_g54() { if(variable_set[192] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g54(ExcelValue newValue) { variable_set[192] = 1; <API key> = newValue; } ExcelValue referencing_d55() { return constant68; } ExcelValue <API key>() { return ZERO; } static ExcelValue <API key>; ExcelValue referencing_g55() { if(variable_set[194] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g55(ExcelValue newValue) { variable_set[194] = 1; <API key> = newValue; } ExcelValue referencing_d56() { return constant73; } ExcelValue <API key>() { return ZERO; } static ExcelValue <API key>; ExcelValue referencing_g56() { if(variable_set[196] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g56(ExcelValue newValue) { variable_set[196] = 1; <API key> = newValue; } ExcelValue referencing_d57() { return constant76; } ExcelValue <API key>() { return ZERO; } static ExcelValue <API key>; ExcelValue referencing_g57() { if(variable_set[198] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g57(ExcelValue newValue) { variable_set[198] = 1; <API key> = newValue; } ExcelValue referencing_d58() { return constant77; } ExcelValue <API key>() { return ZERO; } static ExcelValue <API key>; ExcelValue referencing_g58() { if(variable_set[200] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g58(ExcelValue newValue) { variable_set[200] = 1; <API key> = newValue; } ExcelValue referencing_d59() { return constant79; } ExcelValue <API key>() { return ZERO; } static ExcelValue <API key>; ExcelValue referencing_g59() { if(variable_set[202] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g59(ExcelValue newValue) { variable_set[202] = 1; <API key> = newValue; } ExcelValue referencing_d60() { return constant83; } ExcelValue <API key>() { return ZERO; } static ExcelValue <API key>; ExcelValue referencing_g60() { if(variable_set[204] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g60(ExcelValue newValue) { variable_set[204] = 1; <API key> = newValue; } ExcelValue referencing_d61() { return constant85; } ExcelValue <API key>() { return ZERO; } static ExcelValue <API key>; ExcelValue referencing_g61() { if(variable_set[206] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g61(ExcelValue newValue) { variable_set[206] = 1; <API key> = newValue; } ExcelValue referencing_d62() { return constant90; } ExcelValue <API key>() { return ZERO; } static ExcelValue <API key>; ExcelValue referencing_g62() { if(variable_set[208] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_g62(ExcelValue newValue) { variable_set[208] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant50; } static ExcelValue <API key>; ExcelValue referencing_d64() { if(variable_set[209] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_d64(ExcelValue newValue) { variable_set[209] = 1; <API key> = newValue; } ExcelValue referencing_e64() { return constant37; } ExcelValue referencing_h64() { static ExcelValue result; if(variable_set[211] == 1) { return result;} static ExcelValue array1[117]; array1[0] = ZERO; array1[1] = ZERO; array1[2] = ZERO; array1[3] = ZERO; array1[4] = multiply(multiply(divide(referencing_g50(),referencing_m35()),excel_equal(referencing_d64(),referencing_j34())),referencing_j35()); array1[5] = ZERO; array1[6] = ZERO; array1[7] = multiply(multiply(divide(referencing_g50(),referencing_m35()),excel_equal(referencing_d64(),referencing_m34())),referencing_m35()); array1[8] = multiply(multiply(divide(referencing_g50(),referencing_m35()),excel_equal(referencing_d64(),referencing_n34())),referencing_n35()); array1[9] = ZERO; array1[10] = ZERO; array1[11] = ZERO; array1[12] = ZERO; array1[13] = multiply(multiply(divide(referencing_g51(),referencing_m36()),excel_equal(referencing_d64(),referencing_j34())),referencing_j36()); array1[14] = ZERO; array1[15] = ZERO; array1[16] = multiply(multiply(divide(referencing_g51(),referencing_m36()),excel_equal(referencing_d64(),referencing_m34())),referencing_m36()); array1[17] = multiply(multiply(divide(referencing_g51(),referencing_m36()),excel_equal(referencing_d64(),referencing_n34())),referencing_n36()); array1[18] = multiply(multiply(divide(referencing_g52(),referencing_m37()),excel_equal(referencing_d64(),referencing_f34())),referencing_f37()); array1[19] = ZERO; array1[20] = ZERO; array1[21] = ZERO; array1[22] = ZERO; array1[23] = ZERO; array1[24] = ZERO; array1[25] = multiply(multiply(divide(referencing_g52(),referencing_m37()),excel_equal(referencing_d64(),referencing_m34())),referencing_m37()); array1[26] = multiply(multiply(divide(referencing_g52(),referencing_m37()),excel_equal(referencing_d64(),referencing_n34())),referencing_n37()); array1[27] = ZERO; array1[28] = ZERO; array1[29] = ZERO; array1[30] = multiply(multiply(divide(referencing_g53(),referencing_m38()),excel_equal(referencing_d64(),referencing_i34())),referencing_i38()); array1[31] = ZERO; array1[32] = ZERO; array1[33] = ZERO; array1[34] = multiply(multiply(divide(referencing_g53(),referencing_m38()),excel_equal(referencing_d64(),referencing_m34())),referencing_m38()); array1[35] = multiply(multiply(divide(referencing_g53(),referencing_m38()),excel_equal(referencing_d64(),referencing_n34())),referencing_n38()); array1[36] = ZERO; array1[37] = ZERO; array1[38] = multiply(multiply(divide(referencing_g54(),referencing_m39()),excel_equal(referencing_d64(),referencing_h34())),referencing_h39()); array1[39] = ZERO; array1[40] = ZERO; array1[41] = ZERO; array1[42] = ZERO; array1[43] = multiply(multiply(divide(referencing_g54(),referencing_m39()),excel_equal(referencing_d64(),referencing_m34())),referencing_m39()); array1[44] = multiply(multiply(divide(referencing_g54(),referencing_m39()),excel_equal(referencing_d64(),referencing_n34())),referencing_n39()); array1[45] = ZERO; array1[46] = multiply(multiply(divide(referencing_g55(),referencing_m40()),excel_equal(referencing_d64(),referencing_g34())),referencing_g40()); array1[47] = ZERO; array1[48] = ZERO; array1[49] = multiply(multiply(divide(referencing_g55(),referencing_m40()),excel_equal(referencing_d64(),referencing_j34())),referencing_j40()); array1[50] = ZERO; array1[51] = ZERO; array1[52] = multiply(multiply(divide(referencing_g55(),referencing_m40()),excel_equal(referencing_d64(),referencing_m34())),referencing_m40()); array1[53] = multiply(multiply(divide(referencing_g55(),referencing_m40()),excel_equal(referencing_d64(),referencing_n34())),referencing_n40()); array1[54] = ZERO; array1[55] = multiply(multiply(divide(referencing_g56(),referencing_m41()),excel_equal(referencing_d64(),referencing_g34())),referencing_g41()); array1[56] = ZERO; array1[57] = ZERO; array1[58] = multiply(multiply(divide(referencing_g56(),referencing_m41()),excel_equal(referencing_d64(),referencing_j34())),referencing_j41()); array1[59] = ZERO; array1[60] = ZERO; array1[61] = multiply(multiply(divide(referencing_g56(),referencing_m41()),excel_equal(referencing_d64(),referencing_m34())),referencing_m41()); array1[62] = multiply(multiply(divide(referencing_g56(),referencing_m41()),excel_equal(referencing_d64(),referencing_n34())),referencing_n41()); array1[63] = multiply(multiply(divide(referencing_g57(),referencing_m42()),excel_equal(referencing_d64(),referencing_f34())),referencing_f42()); array1[64] = ZERO; array1[65] = ZERO; array1[66] = ZERO; array1[67] = ZERO; array1[68] = ZERO; array1[69] = multiply(multiply(divide(referencing_g57(),referencing_m42()),excel_equal(referencing_d64(),referencing_l34())),referencing_l42()); array1[70] = multiply(multiply(divide(referencing_g57(),referencing_m42()),excel_equal(referencing_d64(),referencing_m34())),referencing_m42()); array1[71] = ZERO; array1[72] = multiply(multiply(divide(referencing_g58(),referencing_m43()),excel_equal(referencing_d64(),referencing_f34())),referencing_f43()); array1[73] = ZERO; array1[74] = ZERO; array1[75] = ZERO; array1[76] = ZERO; array1[77] = ZERO; array1[78] = multiply(multiply(divide(referencing_g58(),referencing_m43()),excel_equal(referencing_d64(),referencing_l34())),referencing_l43()); array1[79] = multiply(multiply(divide(referencing_g58(),referencing_m43()),excel_equal(referencing_d64(),referencing_m34())),referencing_m43()); array1[80] = ZERO; array1[81] = ZERO; array1[82] = ZERO; array1[83] = ZERO; array1[84] = ZERO; array1[85] = ZERO; array1[86] = ZERO; array1[87] = multiply(multiply(divide(referencing_g59(),referencing_m44()),excel_equal(referencing_d64(),referencing_l34())),referencing_l44()); array1[88] = multiply(multiply(divide(referencing_g59(),referencing_m44()),excel_equal(referencing_d64(),referencing_m34())),referencing_m44()); array1[89] = multiply(multiply(divide(referencing_g59(),referencing_m44()),excel_equal(referencing_d64(),referencing_n34())),referencing_n44()); array1[90] = ZERO; array1[91] = multiply(multiply(divide(referencing_g60(),referencing_m45()),excel_equal(referencing_d64(),referencing_g34())),referencing_g45()); array1[92] = ZERO; array1[93] = ZERO; array1[94] = multiply(multiply(divide(referencing_g60(),referencing_m45()),excel_equal(referencing_d64(),referencing_j34())),referencing_j45()); array1[95] = ZERO; array1[96] = ZERO; array1[97] = multiply(multiply(divide(referencing_g60(),referencing_m45()),excel_equal(referencing_d64(),referencing_m34())),referencing_m45()); array1[98] = multiply(multiply(divide(referencing_g60(),referencing_m45()),excel_equal(referencing_d64(),referencing_n34())),referencing_n45()); array1[99] = ZERO; array1[100] = multiply(multiply(divide(referencing_g61(),referencing_m46()),excel_equal(referencing_d64(),referencing_g34())),referencing_g46()); array1[101] = multiply(multiply(divide(referencing_g61(),referencing_m46()),excel_equal(referencing_d64(),referencing_h34())),referencing_h46()); array1[102] = ZERO; array1[103] = ZERO; array1[104] = ZERO; array1[105] = ZERO; array1[106] = multiply(multiply(divide(referencing_g61(),referencing_m46()),excel_equal(referencing_d64(),referencing_m34())),referencing_m46()); array1[107] = multiply(multiply(divide(referencing_g61(),referencing_m46()),excel_equal(referencing_d64(),referencing_n34())),referencing_n46()); array1[108] = ZERO; array1[109] = ZERO; array1[110] = ZERO; array1[111] = ZERO; array1[112] = ZERO; array1[113] = multiply(multiply(divide(referencing_g62(),referencing_m47()),excel_equal(referencing_d64(),referencing_k34())),referencing_k47()); array1[114] = ZERO; array1[115] = multiply(multiply(divide(referencing_g62(),referencing_m47()),excel_equal(referencing_d64(),referencing_m34())),referencing_m47()); array1[116] = multiply(multiply(divide(referencing_g62(),referencing_m47()),excel_equal(referencing_d64(),referencing_n34())),referencing_n47()); ExcelValue array1_ev = EXCEL_RANGE(array1,13,9); ExcelValue array0[] = {array1_ev}; result = sum(1, array0); variable_set[211] = 1; return result; } ExcelValue <API key>() { return constant97; } static ExcelValue <API key>; ExcelValue referencing_e68() { if(variable_set[212] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_e68(ExcelValue newValue) { variable_set[212] = 1; <API key> = newValue; } ExcelValue <API key>() { return ONE; } static ExcelValue <API key>; ExcelValue referencing_f68() { if(variable_set[213] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f68(ExcelValue newValue) { variable_set[213] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant98; } static ExcelValue <API key>; ExcelValue referencing_e69() { if(variable_set[214] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_e69(ExcelValue newValue) { variable_set[214] = 1; <API key> = newValue; } ExcelValue <API key>() { return TWO; } static ExcelValue <API key>; ExcelValue referencing_f69() { if(variable_set[215] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f69(ExcelValue newValue) { variable_set[215] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant99; } static ExcelValue <API key>; ExcelValue referencing_e70() { if(variable_set[216] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_e70(ExcelValue newValue) { variable_set[216] = 1; <API key> = newValue; } ExcelValue <API key>() { return THREE; } static ExcelValue <API key>; ExcelValue referencing_f70() { if(variable_set[217] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_f70(ExcelValue newValue) { variable_set[217] = 1; <API key> = newValue; } ExcelValue <API key>() { return constant98; } static ExcelValue <API key>; ExcelValue referencing_e72() { if(variable_set[218] == 1) { return <API key>; } else { return <API key>(); } } void set_referencing_e72(ExcelValue newValue) { variable_set[218] = 1; <API key> = newValue; } ExcelValue referencing_f72() { return common7(); } ExcelValue referencing_g72() { return common7(); } ExcelValue tables_a1() { static ExcelValue result; if(variable_set[221] == 1) { return result;} result = ZERO; variable_set[221] = 1; return result; } ExcelValue tables_b2_default() { return constant100; } static ExcelValue tables_b2_variable; ExcelValue tables_b2() { if(variable_set[222] == 1) { return tables_b2_variable; } else { return tables_b2_default(); } } void set_tables_b2(ExcelValue newValue) { variable_set[222] = 1; tables_b2_variable = newValue; } ExcelValue tables_c2_default() { return constant101; } static ExcelValue tables_c2_variable; ExcelValue tables_c2() { if(variable_set[223] == 1) { return tables_c2_variable; } else { return tables_c2_default(); } } void set_tables_c2(ExcelValue newValue) { variable_set[223] = 1; tables_c2_variable = newValue; } ExcelValue tables_d2_default() { return constant102; } static ExcelValue tables_d2_variable; ExcelValue tables_d2() { if(variable_set[224] == 1) { return tables_d2_variable; } else { return tables_d2_default(); } } void set_tables_d2(ExcelValue newValue) { variable_set[224] = 1; tables_d2_variable = newValue; } ExcelValue tables_b3_default() { return constant103; } static ExcelValue tables_b3_variable; ExcelValue tables_b3() { if(variable_set[225] == 1) { return tables_b3_variable; } else { return tables_b3_default(); } } void set_tables_b3(ExcelValue newValue) { variable_set[225] = 1; tables_b3_variable = newValue; } ExcelValue tables_c3_default() { return constant103; } static ExcelValue tables_c3_variable; ExcelValue tables_c3() { if(variable_set[226] == 1) { return tables_c3_variable; } else { return tables_c3_default(); } } void set_tables_c3(ExcelValue newValue) { variable_set[226] = 1; tables_c3_variable = newValue; } ExcelValue tables_d3() { static ExcelValue result; if(variable_set[227] == 1) { return result;} ExcelValue array0[] = {tables_b3(),tables_c3()}; result = string_join(2, array0); variable_set[227] = 1; return result; } ExcelValue tables_b4_default() { return constant104; } static ExcelValue tables_b4_variable; ExcelValue tables_b4() { if(variable_set[228] == 1) { return tables_b4_variable; } else { return tables_b4_default(); } } void set_tables_b4(ExcelValue newValue) { variable_set[228] = 1; tables_b4_variable = newValue; } ExcelValue tables_c4_default() { return constant105; } static ExcelValue tables_c4_variable; ExcelValue tables_c4() { if(variable_set[229] == 1) { return tables_c4_variable; } else { return tables_c4_default(); } } void set_tables_c4(ExcelValue newValue) { variable_set[229] = 1; tables_c4_variable = newValue; } ExcelValue tables_d4() { static ExcelValue result; if(variable_set[230] == 1) { return result;} ExcelValue array0[] = {tables_b4(),tables_c4()}; result = string_join(2, array0); variable_set[230] = 1; return result; } ExcelValue tables_f4() { static ExcelValue result; if(variable_set[231] == 1) { return result;} result = tables_c4(); variable_set[231] = 1; return result; } ExcelValue tables_g4() { static ExcelValue result; if(variable_set[232] == 1) { return result;} static ExcelValue array0[3]; array0[0] = tables_b4(); array0[1] = tables_c4(); array0[2] = tables_d4(); ExcelValue array0_ev = EXCEL_RANGE(array0,1,3); result = excel_match(constant106,array0_ev,FALSE); variable_set[232] = 1; return result; } ExcelValue tables_h4() { static ExcelValue result; if(variable_set[233] == 1) { return result;} static ExcelValue array0[2]; array0[0] = tables_c4(); array0[1] = tables_d4(); ExcelValue array0_ev = EXCEL_RANGE(array0,1,2); result = excel_match_2(constant105,array0_ev); variable_set[233] = 1; return result; } ExcelValue tables_b5() { return common9(); } ExcelValue tables_c5() { static ExcelValue result; if(variable_set[235] == 1) { return result;} ExcelValue array0[] = {tables_c3(),tables_c4()}; result = sum(2, array0); variable_set[235] = 1; return result; } ExcelValue tables_e6() { static ExcelValue result; if(variable_set[236] == 1) { return result;} result = tables_b2(); variable_set[236] = 1; return result; } ExcelValue tables_f6() { static ExcelValue result; if(variable_set[237] == 1) { return result;} result = tables_c2(); variable_set[237] = 1; return result; } ExcelValue tables_g6() { static ExcelValue result; if(variable_set[238] == 1) { return result;} result = tables_d2(); variable_set[238] = 1; return result; } ExcelValue tables_e7() { static ExcelValue result; if(variable_set[239] == 1) { return result;} result = tables_b5(); variable_set[239] = 1; return result; } ExcelValue tables_f7() { static ExcelValue result; if(variable_set[240] == 1) { return result;} result = tables_c5(); variable_set[240] = 1; return result; } ExcelValue tables_g7() { static ExcelValue result; if(variable_set[241] == 1) { return result;} result = ZERO; variable_set[241] = 1; return result; } ExcelValue tables_e8() { static ExcelValue result; if(variable_set[242] == 1) { return result;} result = tables_b2(); variable_set[242] = 1; return result; } ExcelValue tables_f8() { static ExcelValue result; if(variable_set[243] == 1) { return result;} result = tables_c2(); variable_set[243] = 1; return result; } ExcelValue tables_g8() { static ExcelValue result; if(variable_set[244] == 1) { return result;} result = tables_d2(); variable_set[244] = 1; return result; } ExcelValue tables_e9() { static ExcelValue result; if(variable_set[245] == 1) { return result;} result = tables_b3(); variable_set[245] = 1; return result; } ExcelValue tables_f9() { static ExcelValue result; if(variable_set[246] == 1) { return result;} result = tables_c3(); variable_set[246] = 1; return result; } ExcelValue tables_g9() { static ExcelValue result; if(variable_set[247] == 1) { return result;} result = tables_d3(); variable_set[247] = 1; return result; } ExcelValue tables_c10() { return common2(); } ExcelValue tables_e10() { static ExcelValue result; if(variable_set[249] == 1) { return result;} result = tables_b4(); variable_set[249] = 1; return result; } ExcelValue tables_f10() { static ExcelValue result; if(variable_set[250] == 1) { return result;} result = tables_c4(); variable_set[250] = 1; return result; } ExcelValue tables_g10() { static ExcelValue result; if(variable_set[251] == 1) { return result;} result = tables_d4(); variable_set[251] = 1; return result; } ExcelValue tables_c11() { return common9(); } ExcelValue tables_e11() { static ExcelValue result; if(variable_set[253] == 1) { return result;} result = tables_b5(); variable_set[253] = 1; return result; } ExcelValue tables_f11() { static ExcelValue result; if(variable_set[254] == 1) { return result;} result = tables_c5(); variable_set[254] = 1; return result; } ExcelValue tables_g11() { static ExcelValue result; if(variable_set[255] == 1) { return result;} result = ZERO; variable_set[255] = 1; return result; } ExcelValue tables_c12() { static ExcelValue result; if(variable_set[256] == 1) { return result;} result = tables_b5(); variable_set[256] = 1; return result; } ExcelValue tables_c13() { return common10(); } ExcelValue tables_c14() { return common10(); } ExcelValue tables_g17() { static ExcelValue result; if(variable_set[259] == 1) { return result;} ExcelValue condition0 = more_than(tables_c4(),tables_d4()); ExcelValue ifresult0; switch(condition0.type) { case ExcelBoolean: if(condition0.number == true) { ifresult0 = TRUE; } else { ifresult0 = FALSE; } break; case ExcelNumber: if(condition0.number == 0) { ifresult0 = FALSE; } else { ifresult0 = TRUE; } break; case ExcelEmpty: ifresult0 = FALSE; break; case ExcelString: case ExcelRange: ifresult0 = VALUE; break; case ExcelError: ifresult0 = condition0; break; } result = ifresult0; variable_set[259] = 1; return result; } ExcelValue <API key>() { static ExcelValue result; if(variable_set[260] == 1) { return result;} result = valuetypes_a3(); variable_set[260] = 1; return result; } ExcelValue ranges_f1() { return BLANK; } ExcelValue ranges_f2() { return BLANK; } ExcelValue ranges_f3() { return BLANK; } ExcelValue ranges_a5() { return BLANK; } ExcelValue ranges_b5() { return BLANK; } ExcelValue ranges_c5() { return BLANK; } ExcelValue ranges_d5() { return BLANK; } ExcelValue referencing_f35() { return BLANK; } ExcelValue referencing_g35() { return BLANK; } ExcelValue referencing_h35() { return BLANK; } ExcelValue referencing_i35() { return BLANK; } ExcelValue referencing_k35() { return BLANK; } ExcelValue referencing_l35() { return BLANK; } ExcelValue referencing_f36() { return BLANK; } ExcelValue referencing_g36() { return BLANK; } ExcelValue referencing_h36() { return BLANK; } ExcelValue referencing_i36() { return BLANK; } ExcelValue referencing_k36() { return BLANK; } ExcelValue referencing_l36() { return BLANK; } ExcelValue referencing_g37() { return BLANK; } ExcelValue referencing_h37() { return BLANK; } ExcelValue referencing_i37() { return BLANK; } ExcelValue referencing_j37() { return BLANK; } ExcelValue referencing_k37() { return BLANK; } ExcelValue referencing_l37() { return BLANK; } ExcelValue referencing_f38() { return BLANK; } ExcelValue referencing_g38() { return BLANK; } ExcelValue referencing_h38() { return BLANK; } ExcelValue referencing_j38() { return BLANK; } ExcelValue referencing_k38() { return BLANK; } ExcelValue referencing_l38() { return BLANK; } ExcelValue referencing_f39() { return BLANK; } ExcelValue referencing_g39() { return BLANK; } ExcelValue referencing_i39() { return BLANK; } ExcelValue referencing_j39() { return BLANK; } ExcelValue referencing_k39() { return BLANK; } ExcelValue referencing_l39() { return BLANK; } ExcelValue referencing_f40() { return BLANK; } ExcelValue referencing_h40() { return BLANK; } ExcelValue referencing_i40() { return BLANK; } ExcelValue referencing_k40() { return BLANK; } ExcelValue referencing_l40() { return BLANK; } ExcelValue referencing_f41() { return BLANK; } ExcelValue referencing_h41() { return BLANK; } ExcelValue referencing_i41() { return BLANK; } ExcelValue referencing_k41() { return BLANK; } ExcelValue referencing_l41() { return BLANK; } ExcelValue referencing_g42() { return BLANK; } ExcelValue referencing_h42() { return BLANK; } ExcelValue referencing_i42() { return BLANK; } ExcelValue referencing_j42() { return BLANK; } ExcelValue referencing_k42() { return BLANK; } ExcelValue referencing_n42() { return BLANK; } ExcelValue referencing_g43() { return BLANK; } ExcelValue referencing_h43() { return BLANK; } ExcelValue referencing_i43() { return BLANK; } ExcelValue referencing_j43() { return BLANK; } ExcelValue referencing_k43() { return BLANK; } ExcelValue referencing_n43() { return BLANK; } ExcelValue referencing_f44() { return BLANK; } ExcelValue referencing_g44() { return BLANK; } ExcelValue referencing_h44() { return BLANK; } ExcelValue referencing_i44() { return BLANK; } ExcelValue referencing_j44() { return BLANK; } ExcelValue referencing_k44() { return BLANK; } ExcelValue referencing_f45() { return BLANK; } ExcelValue referencing_h45() { return BLANK; } ExcelValue referencing_i45() { return BLANK; } ExcelValue referencing_k45() { return BLANK; } ExcelValue referencing_l45() { return BLANK; } ExcelValue referencing_f46() { return BLANK; } ExcelValue referencing_i46() { return BLANK; } ExcelValue referencing_j46() { return BLANK; } ExcelValue referencing_k46() { return BLANK; } ExcelValue referencing_l46() { return BLANK; } ExcelValue referencing_f47() { return BLANK; } ExcelValue referencing_g47() { return BLANK; } ExcelValue referencing_h47() { return BLANK; } ExcelValue referencing_i47() { return BLANK; } ExcelValue referencing_j47() { return BLANK; } ExcelValue referencing_l47() { return BLANK; } ExcelValue common0() { static ExcelValue result; if(variable_set[342] == 1) { return result;} result = add(add(referencing_a4(),ONE),ONE); variable_set[342] = 1; return result; } ExcelValue common1() { static ExcelValue result; if(variable_set[343] == 1) { return result;} result = add(referencing_a4(),ONE); variable_set[343] = 1; return result; } ExcelValue common2() { static ExcelValue result; if(variable_set[344] == 1) { return result;} ExcelValue array0[] = {tables_b5(),tables_c5()}; result = sum(2, array0); variable_set[344] = 1; return result; } ExcelValue common3() { static ExcelValue result; if(variable_set[345] == 1) { return result;} static ExcelValue array0[16]; array0[0] = referencing_c16(); array0[1] = referencing_d16(); array0[2] = referencing_e16(); array0[3] = referencing_f16(); array0[4] = referencing_c17(); array0[5] = referencing_d17(); array0[6] = referencing_e17(); array0[7] = referencing_f17(); array0[8] = referencing_c18(); array0[9] = referencing_d18(); array0[10] = referencing_e18(); array0[11] = referencing_f18(); array0[12] = referencing_c19(); array0[13] = referencing_d19(); array0[14] = referencing_e19(); array0[15] = referencing_f19(); ExcelValue array0_ev = EXCEL_RANGE(array0,4,4); static ExcelValue array1[4]; array1[0] = referencing_c15(); array1[1] = referencing_d15(); array1[2] = referencing_e15(); array1[3] = referencing_f15(); ExcelValue array1_ev = EXCEL_RANGE(array1,1,4); result = excel_index(array0_ev,BLANK,excel_match(referencing_c22(),array1_ev,ZERO)); variable_set[345] = 1; return result; } ExcelValue common7() { static ExcelValue result; if(variable_set[346] == 1) { return result;} static ExcelValue array1[3]; array1[0] = multiply(excel_equal(referencing_e72(),referencing_e68()),referencing_f68()); array1[1] = multiply(excel_equal(referencing_e72(),referencing_e69()),referencing_f69()); array1[2] = multiply(excel_equal(referencing_e72(),referencing_e70()),referencing_f70()); ExcelValue array1_ev = EXCEL_RANGE(array1,3,1); ExcelValue array0[] = {array1_ev}; result = sum(1, array0); variable_set[346] = 1; return result; } ExcelValue common9() { static ExcelValue result; if(variable_set[347] == 1) { return result;} ExcelValue array0[] = {tables_b3(),tables_b4()}; result = sum(2, array0); variable_set[347] = 1; return result; } ExcelValue common10() { static ExcelValue result; if(variable_set[348] == 1) { return result;} ExcelValue array0[] = {tables_b3(),tables_c3(),tables_d3(),tables_b4(),tables_c4(),tables_d4()}; result = sum(6, array0); variable_set[348] = 1; return result; } // Start of named references // End of named references
module Shoulda # :nodoc: module Matchers module ActiveModel # :nodoc: # Ensures that the attribute can be set on mass update. # it { should_not <API key>(:password) } # it { should <API key>(:first_name) } # In Rails 3.1 you can check role as well: # it { should <API key>(:first_name).as(:admin) } def <API key>(value) <API key>.new(value) end class <API key> # :nodoc: attr_reader :<API key>, :<API key> def initialize(attribute) @attribute = attribute.to_s @options = {} end def as(role) if <API key>? raise 'You can specify role only in Rails 3.1 or greater' end @options[:role] = role self end def matches?(subject) @subject = subject if <API key>? if whitelisting? @<API key> = "#{@attribute} was made accessible" else if <API key>.empty? @<API key> = 'no attributes were protected' else @<API key> = "#{class_name} is protecting " << "#{<API key>.to_a.to_sentence}, " << "but not #{@attribute}." end end true else if whitelisting? @<API key> = "Expected #{@attribute} to be accessible" else @<API key> = "Did not expect #{@attribute} to be protected" end false end end def description [base_description, role_description].compact.join(' ') end private def base_description "allow mass assignment of #{@attribute}" end def role_description if role != :default "as #{role}" end end def role @options[:role] || :default end def <API key> @<API key> ||= (@subject.class.<API key> || []) end def <API key> @<API key> ||= (@subject.class.<API key> || []) end def whitelisting? authorizer.kind_of?(::ActiveModel::<API key>::WhiteList) end def <API key>? !authorizer.deny?(@attribute) end def authorizer if <API key>? @subject.class.active_authorizer else @subject.class.active_authorizer[role] end end def class_name @subject.class.name end def <API key>? ::ActiveModel::VERSION::STRING.to_f < 3.1 end end end end end
#!/usr/bin/env ruby # Fetch Elasticache metrics from CloudWatch # for details. # Gets metrics from CloudWatch and puts them in Graphite # Needs aws-sdk gem # By default fetches all available statistics from one minute ago. You may need to fetch further back than this; require 'rubygems' if RUBY_VERSION < '1.9.0' require 'sensu-plugin/metric/cli' require 'aws-sdk' class ElastiCacheMetrics < Sensu::Plugin::Metric::CLI::Graphite option :cacheclusterid, :description => "Name of the Cache Cluster", :short => "-n ELASTICACHE_NAME", :long => "--name ELASTICACHE_NAME", :required => true option :cachenodeid, :description => 'Cache Node ID', :short => '-i CACHE_NODE_ID', :long => '--cache-node-id CACHE_NODE_ID', :default => '0001' option :elasticachetype, :description => "Elasticache type redis or memcached", :short => "-c TYPE", :long => "--cachetype TYPE", :required => true option :scheme, :description => "Metric naming scheme, text to prepend to metric", :short => "-s SCHEME", :long => "--scheme SCHEME", :default => "" option :fetch_age, :description => "How long ago to fetch metrics for", :short => "-f AGE", :long => "--fetch_age", :default => 60, :proc => proc { |a| a.to_i } option :aws_access_key, :short => '-a AWS_ACCESS_KEY', :long => '--aws-access-key AWS_ACCESS_KEY', :description => "AWS Access Key. Either set ENV['AWS_ACCESS_KEY_ID'] or provide it as an option" option :<API key>, :short => '-k <API key>', :long => '--<API key> <API key>', :description => "AWS Secret Access Key. Either set ENV['<API key>'] or provide it as an option" option :aws_region, :short => '-r AWS_REGION', :long => '--aws-region REGION', :description => "AWS Region (such as us-east-1).", :default => 'us-east-1' def run if config[:scheme] == "" graphitepath = "#{config[:elasticachename]}.#{config[:metric].downcase}" else graphitepath = config[:scheme] end statistic_type = { 'redis' => { 'CPUUtilization' => 'Percent', 'SwapUsage' => 'Bytes', 'FreeableMemory' => 'Bytes', 'NetworkBytesIn' => 'Bytes', 'NetworkBytesOut' => 'Bytes', 'GetTypeCmds' => 'Count', 'SetTypeCmds' => 'Count', 'KeyBasedCmds' => 'Count', 'StringBasedCmds' => 'Count', 'HashBasedCmds' => 'Count', 'ListBasedCmds' => 'Count', 'SetBasedCmds' => 'Count', 'SortedSetBasedCmds' => 'Count', 'CurrItems' => 'Count', }, 'memcached' => { 'CPUUtilization' => 'Percent', 'SwapUsage' => 'Bytes', 'FreeableMemory' => 'Bytes', 'NetworkBytesIn' => 'Bytes', 'NetworkBytesOut' => 'Bytes', '<API key>' => 'Bytes', '<API key>' => 'Bytes', '<API key>' => 'Bytes', 'CasBadval' => 'Count', 'CasHits' => 'Count', 'CasMisses' => 'Count', 'CmdFlush' => 'Count', 'CmdGet' => 'Count', 'CmdSet' => 'Count', 'CurrConnections' => 'Count', 'CurrItems' => 'Count', 'DecrHits' => 'Count', 'DecrMisses' => 'Count', 'DeleteHits' => 'Count', 'DeleteMisses' => 'Count', 'Evictions' => 'Count', 'GetHits' => 'Count', 'GetMisses' => 'Count', 'IncrHits' => 'Count', 'IncrMisses' => 'Count', 'Reclaimed' => 'Count', 'BytesUsedForHash' => 'Bytes', 'CmdConfigGet' => 'Count', 'CmdConfigSet' => 'Count', 'CmdTouch' => 'Count', 'CurrConfig' => 'Count', 'EvictedUnfetched' => 'Count', 'ExpiredUnfetched' => 'Count', 'SlabsMoved' => 'Count', 'TouchHits' => 'Count', 'TouchMisses' => 'Count', 'NewConnections' => 'Count', 'NewItems' => 'Count', 'UnusedMemory' => 'Bytes', } } begin AWS.config( :access_key_id => config[:aws_access_key], :secret_access_key => config[:<API key>], :region => config[:aws_region] ) et = Time.now - config[:fetch_age] st = et - 60 cw = AWS::CloudWatch::Client.new # define all options options = { 'namespace' => 'AWS/ElastiCache', 'metric_name' => config[:metric], 'dimensions' => [ { 'name' => 'CacheClusterId', 'value' => config[:cacheclusterid]} ], 'start_time' => st.iso8601, 'end_time' => et.iso8601, 'period' => 60, 'statistics' => ['Average'] } result = {} # Fetch all metrics by elasticachetype (redis or memcached). statistic_type[config[:elasticachetype]].each do |m| options['metric_name'] = m[0] # override metric r = cw.<API key>(options) result[m[0]] = r[:datapoints][0] unless r[:datapoints][0].nil? end unless result.nil? result.each do |name, d| # We only return data when we have some to return output graphitepath + '.' + name.downcase , d[:average], d[:timestamp].to_i end end rescue Exception => e puts "Error: exception: critical end ok end end
#!/bin/sh # Find legacy docs and frame them for file in `ls */index.html` ; do if grep -q ".title ng-bind-template=.UI Router: {{partialTitle}}..Docs..title." $file ; then if head -n 1 $file | grep -q "^---$" ; then echo "skipping $file"; else echo "processing legacy docs: $file"; (echo " echo " echo "{% raw %}"; \ cat $file | sed -e 's/navbar-fixed-top echo "{% endraw %}"; \ ) > $file.tmp && mv -f $file.tmp $file; fi fi done for file in `find . -name "*.html" | grep -v "/partials/"` ; do if head -n 1 $file | grep -q "^---$" ; then echo "skipping $file"; else echo "processing $file"; (echo " echo "---"; cat $file \ ) > $file.tmp && mv -f $file.tmp $file; fi done find . -type d -depth 1 | sort | node ./paths_as_json_array.js > versions.json for i in `find . -type d -depth 1` ; do pushd $i; find . -name "*.html" | sort | node ../paths_as_json_array.js > files.json popd; done
# Portfolio Starter Kit This portfolio is built with **Next.js** and a library called [Nextra](https://nextra.vercel.app/). It allows you to write Markdown and focus on the _content_ of your portfolio. This starter includes: - Automatically configured to handle Markdown/MDX - Generates an RSS feed based on your posts - A beautiful theme included out of the box - Easily categorize posts with tags - Fast, optimized web font loading https://demo.vercel.blog ## Configuration 1. Update your name in `theme.config.js` or change the footer. 1. Update your name and site URL for the RSS feed in `scripts/gen-rss.js`. 1. Update the meta tags in `pages/_document.js`.
layout: post title: Manjaro Lxqt "Ice" 16.05 released We are happy to announce a maintenance release of the latest Manjaro-Lxqt Community edition <img src="https://manjaro.github.io/images/manjaro-lxqt-16.05.jpg"> LXQt is one of the lighter desktops (written in QT5 and based on Openbox) for those who seek speed or have older computers with limited resources, but is still very complete. Latest Manjaro-Tools (0.11.6) and stable repositories were used to create the ISO files. The 32 bit version is CD-sized and needs 300 MB for installation with Calamares. ## Main programs * kernel 4.4.10 LTS, Manjaro settings manager, sddm, plymouth, octopi, compton, plank (64bit) * pcmanfm-qt, gimp, lximage-qt * firefox (64bit) | otter-browser (32bit), hexchat, transmission-qt * abiword, qpdfview, gnumeric (64bit), leafpad * mpv, smplayer, pulseaudio (64bit) | clementine qt5 (32bit) * gparted, qisousb, lxtask, xsensors * ffmpegthumbnailer * capture tool + key Print Screen configured for taking screenshots (also with Alt or Shift) * xscreensaver (64bit) | i3lock-shiver (32bit) * AUR support This release comes with our advanced graphical installer Calamares as well as our CLI-installer. ## Notes Great effort has been made to avoid: * Kde tools * Qt4 * python2 * mplayer/mplayer2 (replaced by mpv) In order to achieve that some utilities were specifically developed: * clementine-lqxt * smplayer-lxqt Other tools, themes and icons are available in the **manjaro-lxqt repository** (maintained by the community). ## Links * [Download](https://sourceforge.net/projects/manjarolinux/files/community/LXQT/2016.05/) * [Forum Post](https://forum.manjaro.org/t/<API key>/1804)
<?php namespace Components\Resources\Models\MediaTracking; use Hubzero\Database\Relational; /** * Detailed media tracking model * * @uses \Hubzero\Database\Relational */ class Detailed extends Relational { /** * The table namespace * * @var string */ protected $namespace = 'media_tracking'; /** * The table to which the class pertains * * This will default to #__{namespace}_{modelName} unless otherwise * overwritten by a given subclass. Definition of this property likely * indicates some derivation from standard naming conventions. * * @var string */ protected $table = '#<API key>'; /** * Default order by for model * * @var string */ public $orderBy = 'id'; /** * Default order direction for select queries * * @var string */ public $orderDir = 'asc'; /** * Fields and their validation criteria * * @var array */ protected $rules = array( 'object_id' => 'positive|nonzero', 'object_type' => 'notempty', 'session_id' => 'notempty', 'ip_address' => 'notempty' ); /** * Get a record by its doi * * @param integer $user_id User ID * @param integer $object_id Object ID * @param string $object_type Object type * @return object */ public static function <API key>($user_id, $object_id, $object_type = 'resource') { $row = self::all() ->whereEquals('user_id', $user_id) ->whereEquals('object_id', $object_id) ->whereEquals('object_type', $object_type) ->row(); return $row; } }
var assert = require('assert'); var common = require('../../common'); var cluster = common.createPoolCluster({ canRetry : true, <API key> : 5 }); var connCount = 0; var poolConfig = common.getTestConfig({port: common.fakeServerPort}); var server = common.createFakeServer(); cluster.add('MASTER', poolConfig); server.listen(common.fakeServerPort, function (err) { assert.ifError(err); cluster.getConnection('MASTER', function (err, connection) { assert.ifError(err); assert.equal(connCount, 2); assert.equal(connection._clusterId, 'MASTER'); server.destroy(); }); }); server.on('connection', function (conn) { connCount += 1; if (connCount < 2) { conn.destroy(); } else { conn.handshake(); } });
<?php namespace Doctrine\ODM\MongoDB\Tests; use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; use Doctrine\ODM\MongoDB\Mapping\ClassMetadata; class GH520Test extends BaseTest { public function <API key>() { $document = new GH520Document(); $document->ref = new GH520Document(); $this->dm->persist($document); $this->dm->flush(); $this->dm->clear(); $query = $this->dm->createQueryBuilder(__NAMESPACE__ . '\GH520Document') ->field('id')->equals($document->id) ->field('ref')->prime(true) ->getQuery(); $document = $query->getSingleResult(); $this->assertInstanceOf('Doctrine\ODM\MongoDB\Proxy\Proxy', $document->ref); $this->assertTrue($document->ref->__isInitialized()); } public function <API key>() { /* Since Query::getSingleResult() exists for Doctrine MongoDB's * IteratorAggregate interface, it executes the query and obtains an * iterator before calling Iterator::getSingleResult(). Since priming * implies an EagerCursor, all documents will be fetched and all of * their references will be primed (not simply the first document and * its references). As a result, users that wish to combine * getSingleResult() with priming should also specify a limit on their * queries. * * This behavior is not ideal, but a workaround would further complicate * ODM's Query class. A userland solution would be to simply enforce a * limit on the query with Builder::limit(). That limit can then be * applied to both queries and commands (where applicable). */ $document1 = new GH520Document(); $document2 = new GH520Document(); $document3 = new GH520Document(); $document4 = new GH520Document(); $document1->ref = $document2; $document3->ref = $document4; $this->dm->persist($document1); $this->dm->persist($document3); $this->dm->flush(); $this->dm->clear(); $primedIds = null; $primer = function(DocumentManager $dm, ClassMetadata $class, array $ids, array $hints) use (&$primedIds) { $primedIds = $ids; }; $query = $this->dm->createQueryBuilder(__NAMESPACE__ . '\GH520Document') ->field('ref')->exists(true)->prime($primer) ->getQuery(); $result = $query->getSingleResult(); $this->assertContains($document2->id, $primedIds); $this->assertContains($document4->id, $primedIds, 'The entire dataset is fetched and primed'); } } /** @ODM\Document */ class GH520Document { /** @ODM\Id */ public $id; /** @ODM\ReferenceOne(targetDocument="GH520Document", cascade={"persist"}) */ public $ref; }
## Essential extensions - [Azure Account](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) - [Azure Functions](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.<API key>) - [Azure IoT Hub](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit) - [C/C++](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) - [Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) - [Github Markdown Preview](https://marketplace.visualstudio.com/items?itemName=bierner.<API key>) - [Live Share](https://marketplace.visualstudio.com/items?itemName=MS-vsliveshare.vsliveshare) - [Markdown Checkboxes](https://marketplace.visualstudio.com/items?itemName=bierner.markdown-checkbox) - [Markdown Emoji](https://marketplace.visualstudio.com/items?itemName=bierner.markdown-emoji) - [Markdown PDF](https://marketplace.visualstudio.com/items?itemName=yzane.markdown-pdf) - [Markdown Preview Github Styling](https://marketplace.visualstudio.com/items?itemName=bierner.<API key>) - [Markdown yaml Preamble](https://marketplace.visualstudio.com/items?itemName=bierner.<API key>) - [Mermaid Markdown Syntax Highlighting](https://marketplace.visualstudio.com/items?itemName=bpruitt-goddard.<API key>) - [Mermaid Preview](https://marketplace.visualstudio.com/items?itemName=vstirbu.<API key>) - [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client)
<?php namespace Backend\Models; use File; use Lang; use Model; use Response; use League\Csv\Writer as CsvWriter; use <API key>; use SplTempFileObject; /** * Model used for exporting data * * @package october\backend * @author Alexey Bobkov, Samuel Georges */ abstract class ExportModel extends Model { /** * Called when data is being exported. * The return value should be an array in the format of: * * [ * 'db_name1' => 'Some attribute value', * 'db_name2' => 'Another attribute value' * ], * [...] * */ abstract public function exportData($columns, $sessionKey = null); /** * Export data based on column names and labels. * The $columns array should be in the format of: * * [ * 'db_name1' => 'Column label', * 'db_name2' => 'Another label', * ... * ] * */ public function export($columns, $options) { $sessionKey = array_get($options, 'sessionKey'); $data = $this->exportData(array_keys($columns), $sessionKey); return $this->processExportData($columns, $data, $options); } /** * Download a previously compiled export file. * @return void */ public function download($name, $outputName = null) { if (!preg_match('/^oc[0-9a-z]*$/i', $name)) { throw new <API key>(Lang::get('backend::lang.import_export.<API key>')); } $csvPath = temp_path() . '/' . $name; if (!file_exists($csvPath)) { throw new <API key>(Lang::get('backend::lang.import_export.<API key>')); } $headers = Response::download($csvPath, $outputName)->headers->all(); $result = Response::make(File::get($csvPath), 200, $headers); @unlink($csvPath); return $result; } /** * Converts a data collection to a CSV file. */ protected function processExportData($columns, $results, $options) { /* * Validate */ if (!$results) { throw new <API key>(Lang::get('backend::lang.import_export.empty_error')); } /* * Parse options */ $defaultOptions = [ 'firstRowTitles' => true, 'useOutput' => false, 'fileName' => 'export.csv', 'delimiter' => null, 'enclosure' => null, 'escape' => null ]; $options = array_merge($defaultOptions, $options); $columns = $this->exportExtendColumns($columns); /* * Prepare CSV */ $csv = CsvWriter::<API key>(new SplTempFileObject); $csv->setOutputBOM(CsvWriter::BOM_UTF8); if ($options['delimiter'] !== null) { $csv->setDelimiter($options['delimiter']); } if ($options['enclosure'] !== null) { $csv->setEnclosure($options['enclosure']); } if ($options['escape'] !== null) { $csv->setEscape($options['escape']); } /* * Add headers */ if ($options['firstRowTitles']) { $headers = $this->getColumnHeaders($columns); $csv->insertOne($headers); } /* * Add records */ foreach ($results as $result) { $data = $this->matchDataToColumns($result, $columns); $csv->insertOne($data); } /* * Output */ if ($options['useOutput']) { $csv->output($options['fileName']); } /* * Save for download */ $csvName = uniqid('oc'); $csvPath = temp_path().'/'.$csvName; $output = $csv->__toString(); File::put($csvPath, $output); return $csvName; } /** * Used to override column definitions at export time. */ protected function exportExtendColumns($columns) { return $columns; } /** * Extracts the headers from the column definitions. */ protected function getColumnHeaders($columns) { $headers = []; foreach ($columns as $column => $label) { $headers[] = Lang::get($label); } return $headers; } /** * Ensures the correct order of the column data. */ protected function matchDataToColumns($data, $columns) { $results = []; foreach ($columns as $column => $label) { $results[] = array_get($data, $column); } return $results; } /** * Implodes a single dimension array using pipes (|) * Multi dimensional arrays are not allowed. * @return string */ protected function encodeArrayValue($data, $delimeter = '|') { $newData = []; foreach ($data as $value) { if (is_array($value)) { $newData[] = 'Array'; } else { $newData[] = str_replace($delimeter, '\\'.$delimeter, $value); } } return implode($delimeter, $newData); } }
package bitfield // NOTE: Don't bother replacing the divisions/modulo with shifts/ands, go is smart. import ( "math/bits" ) // NewBitfield creates a new fixed-sized Bitfield (allocated up-front). // Panics if size is not a multiple of 8. func NewBitfield(size int) Bitfield { if size%8 != 0 { panic("Bitfield size must be a multiple of 8") } return make([]byte, size/8) } func (bf Bitfield) offset(i int) (uint, uint8) { return uint(len(bf)) - (uint(i) / 8) - 1, uint8(i) % 8 } // Bitfield is, well, a bitfield. type Bitfield []byte // Bytes returns the Bitfield as a byte string. // This function *does not* copy. func (bf Bitfield) Bytes() []byte { for i, b := range bf { if b != 0 { return bf[i:] } } return nil } // Bit returns the ith bit. // Panics if the bit is out of bounds. func (bf Bitfield) Bit(i int) bool { idx, off := bf.offset(i) return (bf[idx]>>off)&0x1 != 0 } // SetBit sets the ith bit. // Panics if the bit is out of bounds. func (bf Bitfield) SetBit(i int) { idx, off := bf.offset(i) bf[idx] |= 1 << off } // UnsetBit unsets the ith bit. // Panics if the bit is out of bounds. func (bf Bitfield) UnsetBit(i int) { idx, off := bf.offset(i) bf[idx] &= 0xFF ^ (1 << off) } // SetBytes sets the bits to the given byte array. // Panics if 'b' is larger than the bitfield. func (bf Bitfield) SetBytes(b []byte) { start := len(bf) - len(b) if start < 0 { panic("Bitfield too small") } for i := range bf[:start] { bf[i] = 0 } copy(bf[start:], b) } // Ones returns the number of bits set. func (bf Bitfield) Ones() int { cnt := 0 for _, b := range bf { cnt += bits.OnesCount8(b) } return cnt } // OnesBefore returns the number of bits set *before* this bit. func (bf Bitfield) OnesBefore(i int) int { idx, off := bf.offset(i) cnt := bits.OnesCount8(bf[idx] << (8 - off)) for _, b := range bf[idx+1:] { cnt += bits.OnesCount8(b) } return cnt } // OnesAfter returns the number of bits set *after* this bit. func (bf Bitfield) OnesAfter(i int) int { idx, off := bf.offset(i) cnt := bits.OnesCount8(bf[idx] >> off) for _, b := range bf[:idx] { cnt += bits.OnesCount8(b) } return cnt }
package kodkod.engine.satlab; import java.util.Iterator; import java.util.<API key>; import kodkod.util.collections.Containers; import kodkod.util.ints.IntBitSet; import kodkod.util.ints.IntIterator; import kodkod.util.ints.IntSet; import kodkod.util.ints.Ints; /** * An array-backed implementation of the {@linkplain ResolutionTrace} interface. * Resolvent literals are computed on-demand, and only the resolvents reachable * from the conflict clause are stored. * * @author Emina Torlak */ final class LazyTrace implements ResolutionTrace { /* The trace array encodes the resolution trace as follows. * The first <tt>axioms</tt> entries in the trace array contain * the literals of the clauses added to the prover, in the order * in which they were added. The remaining entries encode the * resolvents as follows. Let i >= <tt>axioms</tt> * represent the ith resolvent. If resolved.contains(i-axioms), then trace[i][0] * contains the number of the resolvent's antecedents; trace[i][1..trace[i][0]] * contains the indices of the resolvent's antecedents in the trace; * and trace[i][trace[i][0]+1..trace[i].length-1] contains the literals of the ith resolvent. * Otherwise, the literals for the given resolvent have not yet been computed so * trace[i][0..trace[i].length-1] contains the indices of the resolvent's antecedents. * * All computed and axiom literals are sorted in the increasing order of absolute values. * All antecedents of a given resolvent precede it in the trace, * and the conflict clause should be the last trace element. */ private final int[][] trace; private final int axioms; private final IntSet core, resolved; /** * Constructs a resolution trace view for the given raw trace. * The first <tt>axioms</tt> entries in the trace array should * contain the literals of the clauses added to the prover, in * the order in which they were added. The literals should be * sorted in the increasing order of absolute values. The remaining entries * should encode the resolvents as follows. Let i be the index * of a resolvent in the raw trace. Then, for all 0 <= j < trace[i].length, * trace[i][j] is the index of the resolvent's jth antecedents in the trace array. * All antecedents of a given resolvent should precede it in the trace, * and the conflict clause should be the last trace element. * * <p><b>Note: </b> the given array's contents must not be modified while * in use by this resolution trace object.</p> */ LazyTrace(int[][] trace, int axioms) { this.axioms = axioms; // find all the clauses that are reachable from the conflict final IntSet reachable = reachable(trace, axioms); // get the core clauses this.core = core(reachable, axioms); // trim the trace so that it contains all axioms but only those resolvents that are reachable from the conflict this.trace = compress(trace, axioms, reachable, core); // we haven't computed any resolvent literals yet ... this.resolved = new IntBitSet(this.trace.length-axioms); } /** * Constructs a resolution trace from the given subtrace and partial * trace. This constructor assumes that <tt>partial</tt> is the result * of solving the subtrace of the <tt>original</tt> trace that is given by the * specified set of indices. The first indices.size() of the partial * trace are assumed to represent the clauses given by original.trace[indices], * in the increasing order of indices; the remaining entries should encode * the resolvents computed from original.trace[indices], as specified by * {@linkplain #LazyTrace(int[][], int)}. The given subtrace of the original * trace must be self-contained, i.e. original.reachable(indices).equals(indices). * * <p><b>Note: </b> the given array's contents must not be modified while * in use by this resolution trace object.</p> */ LazyTrace(LazyTrace original, IntSet indices, int[][] partial) { this.axioms = reconstruct(original, indices, partial); // find all the clauses that are reachable from the conflict final IntSet reachable = reachable(partial, axioms); // get the core clauses this.core = core(reachable, axioms); // trim the trace so that it contains all axioms but only those resolvents that are reachable from the conflict this.trace = compress(partial, axioms, reachable, core); // we haven't computed any resolvent literals yet ... this.resolved = new IntBitSet(this.trace.length-axioms); } /** * Fills the first indices.size() empty positions of the partial trace with the * corresponding clauses from the original trace and returns the number of axioms * in the reconstructed trace. * @requires original, indices, and partial are as specified by {@linkplain #LazyTrace(LazyTrace, IntSet, int[][])} constructor * @ensures modifies partial so that it conforms to the {@linkplain #trace LazyTrace.trace} spec * using the provided original trace and indices. * @return number of axioms in the modified partial trace */ private static int reconstruct(LazyTrace original, IntSet indices, int[][] partial) { int axiomCount = indices.size(); // fill the partial[0..indices.size()-1] with the corresponding clauses from original.trace[indices] final int[][] originalTrace = original.trace; final int[] position = new int[indices.max()+1]; IntIterator itr = indices.iterator(); for(int i = 0, length = indices.size(); i < length; i++) { int index = itr.next(); position[index] = i; if (original.axiom(index)) { // just set the ith pointer to original literals partial[i] = originalTrace[index]; } else { // copy the resolvent and adjust copy's antecedent indices int antes = originalTrace[index][0]; int[] resolvent = new int[antes]; for(int j = 0; j < antes; j++) { resolvent[j] = position[originalTrace[index][j+1]]; } partial[i] = resolvent; axiomCount } } return axiomCount; } /** * Returns the indices of all clauses in the given trace that are * reachable from the conflict clause through the resolvents * in trace[roots..trace.length-1]. This method assumes that * that the last trace[roots..trace.length-1] clauses encode * resolvents as specified by the * {@linkplain #LazyTrace(int[][], int)} constructor. * @return indices of all clauses in the given trace that are * reachable from the conflict clause through the resolvents in * trace[roots..trace.length-1] */ private static IntSet reachable(int[][] trace, int roots) { final IntSet reachable = new IntBitSet(trace.length); reachable.add(trace.length-1); for(int i = trace.length-1; i >= roots; i if (reachable.contains(i)) { int[] resolvent = trace[i]; for(int j = 0; j < resolvent.length; j++) { reachable.add(resolvent[j]); } } } return reachable; } /** * Returns a set that contains the elements from the given * reachable between 0, inclusive, and axioms, exclusive. * @return a set that contains the elements from the given * reachable between 0, inclusive, and axioms, exclusive. */ private static IntSet core(IntSet reachable, int axioms) { final IntSet core = new IntBitSet(axioms); for(IntIterator itr = reachable.iterator(0, axioms-1); itr.hasNext(); ) { core.add(itr.next()); } return Ints.unmodifiableIntSet(core); } /** * Compresses the given src trace into a destination trace that contains the same axioms as the * source but only the resolvents that are reachable from the conflict clause. * @requires src and axioms are as specified by the {@linkplain #LazyTrace(int[][], int)} constructor * @requires reachable.elts = reachable(src, axioms).elts * @requires core.elts = core(reachable, axioms).elts * @ensures invalidates the contents of src; src should not be used after this method returns * @return a new trace that contains the same axioms as the * source but only the resolvents that are reachable from the conflict clause. */ private static int[][] compress(int[][] src, int axioms, IntSet reachable, IntSet core) { final int[][] dest = new int[reachable.size()-core.size()+axioms][]; System.arraycopy(src, 0, dest, 0, axioms); final int[] pos = new int[src.length-axioms]; final IntIterator srcIdxs = reachable.iterator(axioms, src.length); for(int i = axioms; srcIdxs.hasNext(); i++) { int srcIdx = srcIdxs.next(); pos[srcIdx-axioms] = i; // move the resolvent and adjust its antecedent indices int[] resolvent = src[srcIdx]; dest[i] = resolvent; for(int j = 0, lastAnte = resolvent.length; j < lastAnte; j++) { int ante = resolvent[j]; resolvent[j] = ante < axioms ? ante : pos[ante-axioms]; } } return dest; } /** * Returns an array of integers representing the result of * resolving the clauses c1 and c2, sorted in the increasing order * of absolute values. The parameters axiom1 and axiom2 specify * whether c1 and c2 encode axioms or resolvents. In particular, * if axiom1 (resp. axiom2) is true, then all integers in c1 (resp. c2) * are assumed to be literals, sorted in the increasing order of absolute * values. If axiom1 (resp. axiom2) is false, then the integers starting * at c1[0]+1 (resp. c2[0]+1) are assumed to be literals, sorted in the increasing * order of absolute values. * @requires let off1 = axiom1 ? 0 : c1[0] + 1, off2 = axiom2 ? 0 : c2[0]+1 | * (all i: [off1..c1.length), j: [off1..c1.length) | i < j => abs(c1[i]) < abs(c1[j])) and * (all i: [off2..c2.length), j: [off2..c2.length) | i < j => abs(c2[i]) < abs(c2[j])) and * (one i: [off1..c1.length), j: [off2..c2.length) | c1[i] = -c2[j]) * @return an array of integers representing the result of * resolving the clauses c1 and c2, sorted in the increasing order of absolute values */ private static int[] resolve(int[] c1, boolean axiom1, int[] c2, boolean axiom2) { final int len1 = c1.length, len2 = c2.length; int i = axiom1 ? 0 : c1[0] + 1; int j = axiom2 ? 0 : c2[0] + 1; int k = 0; final int[] tmp = new int[(len1-i + len2-j) - 2]; while(i < len1 && j < len2) { int lit1 = c1[i], lit2 = c2[j]; int var1 = StrictMath.abs(lit1), var2 = StrictMath.abs(lit2); if (var1==var2) { if (lit1==lit2) { tmp[k++] = lit1; } i++; j++; } else if (var1 < var2) { tmp[k++] = lit1; i++; } else { // var1 > var2 tmp[k++] = lit2; j++; } } if (i<len1) { final int rem = len1 - i; System.arraycopy(c1, i, tmp, k, rem); k += rem; } if (j<len2) { final int rem = len2 - j; System.arraycopy(c2, j, tmp, k, rem); k += rem; } if (k==tmp.length) { return tmp; } else { final int[] ret = new int[k]; System.arraycopy(tmp, 0, ret, 0, k); return ret; } } /** * Computes the resolvent at the given index, sets this.trace index * to the computed resolvent and returns it. * @ensures computes the resolvent at the given index and sets trace[index] * to the computed array. * @return this.trace'[index] */ private int[] resolve(int index) { if (index < axioms || resolved(index)) return trace[index]; int[] ante = trace[index]; int[] lits = resolve(resolve(ante[0]), ante[0]<axioms, resolve(ante[1]), ante[1]<axioms); for(int j = 2; j < ante.length; j++) { lits = resolve(lits, true, resolve(ante[j]), ante[j]<axioms); } int[] resolvent = new int[ante.length + lits.length + 1]; resolvent[0] = ante.length; System.arraycopy(ante, 0, resolvent, 1, ante.length); System.arraycopy(lits, 0, resolvent, ante.length+1, lits.length); trace[index] = resolvent; resolved.add(index-axioms); return resolvent; } /** @return true if resolvent literals have been computed for the resolvent at the given index */ private boolean resolved(int index) { return resolved.contains(index-axioms); } /** * Returns true if the clause at the given index is an axiom. * @return index < this.axioms */ private boolean axiom(int index) { return index < axioms; } /** * Returns the offset in this.trace[index] array where literal * data is stored, if any. * @return axiom(index) ? 0 : resolved(index) ? this.trace[index][0] + 1 : -1 */ private int litOffset(int index) { return axiom(index) ? 0 : resolved(index) ? trace[index][0] + 1 : -1; } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#size() */ public int size() { return trace.length; } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#core() */ public IntSet core() { return core; } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#axioms() */ public IntSet axioms() { return Ints.rangeSet(Ints.range(0, axioms-1)); } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#resolvents() */ public IntSet resolvents() { return Ints.rangeSet(Ints.range(axioms, trace.length-1)); } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#get(int) */ public Clause get(final int index) { if (index>=0 && index<trace.length) { if (axiom(index)) { // return a self-contained clause return new Clause() { final int[] literals = trace[index]; final int hashCode = Ints.superFastHash(literals); public Iterator<Clause> antecedents() { return Containers.emptyIterator(); } public IntIterator literals() { return new IntArrayIterator(literals,0,literals.length); } public int maxVariable() { return StrictMath.abs(literals[literals.length-1]); } public int numberOfAntecedents() { return 0; } public int size() { return literals.length; } public int[] toArray(int[] array) { if (array.length<literals.length) { array = new int[literals.length]; } System.arraycopy(literals, 0, array, 0, literals.length); return array; } public int hashCode() { return hashCode; } }; } else { return new ClauseView(index); } } throw new <API key>("invalid index: " + index); } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#iterator() */ public Iterator<Clause> iterator() { return new ClauseIterator(new IntIterator() { int index = 0; public boolean hasNext() { return index>=0 && index < trace.length; } public int next() { if (!hasNext()) throw new <API key>(); return index++; } public void remove() { throw new <API key>(); } }); } /** * Returns true if indices.min() >= 0 && indices.max() < this.size() * @requires !indices.isEmpty() * @return indices.min() >= 0 && indices.max() < this.size() */ private boolean valid(IntSet indices) { return indices.min()>=0 && indices.max()<trace.length; } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#iterator(kodkod.util.ints.IntSet) */ public Iterator<Clause> iterator(IntSet indices) { if (indices.isEmpty() || valid(indices)) { return new ClauseIterator(indices.iterator()); } throw new <API key>("invalid indices: " + indices); } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#reverseIterator(kodkod.util.ints.IntSet) */ public Iterator<Clause> reverseIterator(IntSet indices) { if (indices.isEmpty() || valid(indices)) { return new ClauseIterator(indices.iterator(Integer.MAX_VALUE, Integer.MIN_VALUE)); } throw new <API key>("invalid indices: " + indices); } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#implicants(kodkod.util.ints.IntSet) */ public IntSet reachable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); for(int i = indices.max(); i >= axioms; i if (ret.contains(i)) { int[] resolvent = trace[i]; if (resolved(i)) { for(int j = 1, antes = resolvent[0]; j <= antes; j++) { ret.add(resolvent[j]); } } else { for(int j = 0; j < resolvent.length; j++) { ret.add(resolvent[j]); } } } } return ret; } else throw new <API key>("invalid indices: " + indices); } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#backwardReachable(kodkod.util.ints.IntSet) */ public IntSet backwardReachable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); for(int i = axioms, length = trace.length; i < length; i++) { int[] resolvent = trace[i]; if (resolved(i)) { for(int j = 1, antes = resolvent[0]; j <= antes; j++) { if (ret.contains(resolvent[j])) { ret.add(i); break; } } } else { for(int j = 0; j < resolvent.length; j++) { if (ret.contains(resolvent[j])) { ret.add(i); break; } } } } return ret; } else throw new <API key>("invalid indices: " + indices); } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#learnable(kodkod.util.ints.IntSet) */ public IntSet learnable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); TOP: for(int i = axioms, length = trace.length; i < length; i++) { int[] resolvent = trace[i]; if (resolved(i)) { for(int j = 1, antes = resolvent[0]; j <= antes; j++) { if (!ret.contains(resolvent[j])) { continue TOP; } } } else { for(int j = 0; j < resolvent.length; j++) { if (!ret.contains(resolvent[j])) { continue TOP; } } } ret.add(i); } return ret; } else throw new <API key>("invalid indices: " + indices); } /** * {@inheritDoc} * @see kodkod.engine.satlab.ResolutionTrace#directlyLearnable(kodkod.util.ints.IntSet) */ public IntSet directlyLearnable(IntSet indices) { if (indices.isEmpty()) return Ints.EMPTY_SET; else if (valid(indices)) { final IntSet ret = new IntBitSet(trace.length); ret.addAll(indices); TOP: for(int i = axioms, length = trace.length; i < length; i++) { int[] resolvent = trace[i]; if (resolved(i)) { for(int j = 1, antes = resolvent[0]; j <= antes; j++) { if (!indices.contains(resolvent[j])) { continue TOP; } } } else { for(int j = 0; j < resolvent.length; j++) { if (!indices.contains(resolvent[j])) { continue TOP; } } } ret.add(i); } return ret; } else throw new <API key>("invalid indices: " + indices); } /** * {@inheritDoc} * @see java.lang.Object#toString() */ public String toString() { final StringBuilder ret = new StringBuilder(); for(int i = 0; i < axioms; i++) { ret.append("AXIOM. Literals: "); int[] clause = trace[i]; for(int j = 0, c = clause.length; j < c; j++) { ret.append(clause[j]); ret.append(" "); } ret.append("\n"); } for(int i = axioms, max = trace.length; i < max; i++) { ret.append("RESOLVENT. Antecedents: "); int[] clause = trace[i]; if (resolved(i)) { for(int j = 1, c = clause[0]; j <= c; j++) { ret.append(clause[j]); ret.append(" "); } } else { for(int j = 0; j < clause.length; j++) { ret.append(clause[j]); ret.append(" "); } } ret.append("\n"); } return ret.toString(); } /** * A mutable implementation of the Clause interface. * @author Emina Torlak */ private class ClauseView extends Clause { private int[] clause; private int litOffset, index; /** * Constructs a clause view for the ith clause. * @requires 0 <= index < trace.length */ ClauseView(int index) { this.index = index; this.clause = trace[index]; this.litOffset = litOffset(index); } /** * Constructs a clause view for the 0th clause. */ ClauseView() { this(0); } /** * Sets the state of this clause view to represent * the ith clause in the trace and returns this. * @ensures sets the state of this clause view to represent * the ith clause in the trace * @return this */ ClauseView set(int index) { this.index = index; this.clause = trace[index]; this.litOffset = litOffset(index); return this; } void ensureLiterals() { if (litOffset<0) { resolve(index); this.clause = trace[index]; this.litOffset = litOffset(index); } } public int maxVariable() { ensureLiterals(); return StrictMath.abs(clause[clause.length-1]); } public int numberOfAntecedents() { return litOffset<0 ? clause.length : StrictMath.max(0, litOffset-1); } public int size() { ensureLiterals(); return clause.length - litOffset; } public Iterator<Clause> antecedents() { return new ClauseIterator(new IntArrayIterator(clause, 1, litOffset)); } public IntIterator literals() { ensureLiterals(); return new IntArrayIterator(clause, litOffset, clause.length); } public int[] toArray(int[] array) { final int size = size(); if (array.length < size) { array = new int[size]; } System.arraycopy(clause, litOffset, array, 0, size); return array; } } /** * A clause iterator wrapper for an int iterator. * @author Emina Torlak */ private final class ClauseIterator extends ClauseView implements Iterator<Clause> { private final IntIterator itr; /** * Constructs a clause iterator that will iterate over the clauses in this.trace * located at the indices given by itr. The given iterator must return valid indices. */ ClauseIterator(IntIterator itr) { this.itr = itr; } public boolean hasNext() { return itr.hasNext(); } public Clause next() { return set(itr.next()); } public void remove() { throw new <API key>(); } } /** * An int iterator that iterates over the portion of an integer array * in the increasing order of indices. * @author Emina Torlak */ private static final class IntArrayIterator implements IntIterator { private final int[] array; private int from; private final int to; /** * Constructs an int iterator that iterates over the given array, * returning the elements between from, inclusive, and to, exclusive. * @requires 0 <= from < array.length < Integer.MAX_VALUE */ IntArrayIterator(int[] array, int from, int to) { this.array = array; this.from = from; this.to = to; } public boolean hasNext() { return from >= 0 && from < to; } public int next() { if (!hasNext()) throw new <API key>(); return array[from++]; } public void remove() { throw new <API key>(); } } }
/** * <API key> * * This custom tslint rule is highly specific to GitHub Desktop and attempts * to prevent props and state interfaces from being declared with mutable * members. * * While it's technically possible to modify this.props there's never a good * reason to do so and marking our interfaces as read only ensures that we * get compiler support for that fact. */ import * as ts from 'typescript' import * as Lint from 'tslint' export class Rule extends Lint.Rules.AbstractRule { public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { if (sourceFile.languageVariant === ts.LanguageVariant.JSX) { return this.applyWithWalker(new <API key>(sourceFile, this.getOptions())) } else { return [] } } } // The walker takes care of all the work. class <API key> extends Lint.RuleWalker { protected <API key>(node: ts.<API key>): void { if (node.name.text.endsWith('Props')) { this.ensureReadOnly(node.members) } if (node.name.text.endsWith('State')) { this.ensureReadOnly(node.members) } super.<API key>(node) } private ensureReadOnly(members: ts.NodeArray<ts.TypeElement>) { members.forEach(member => { if (member.kind !== ts.SyntaxKind.PropertySignature) { return } const propertySignature = member as ts.PropertySignature if (!this.isReadOnly(propertySignature)) { const start = propertySignature.getStart() const width = propertySignature.getWidth() const error = `Property and state signatures should be read-only` this.addFailure(this.createFailure(start, width, error)) } }) } private isReadOnly(propertySignature: ts.PropertySignature): boolean { const modifiers = propertySignature.modifiers if (!modifiers) { return false } if (modifiers.find(m => m.kind === ts.SyntaxKind.ReadonlyKeyword)) { return true } return false } }
// <API key>.h // Google Mobile Ads SDK #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import <GoogleMobileAds/GADAdLoaderDelegate.h> #import <GoogleMobileAds/GADMediaView.h> #import <GoogleMobileAds/GADNativeAd.h> #import <GoogleMobileAds/GADNativeAdImage.h> #import <GoogleMobileAds/GADVideoController.h> #import <GoogleMobileAds/<API key>.h> <API key> Native ad custom click handler block. |assetID| is the ID of asset that has received a click. typedef void (^<API key>)(NSString *assetID); Asset key for the GADMediaView asset view. extern NSString *const <API key>; Native custom template ad. To request this ad type, you need to pass <API key> (see GADAdLoaderAdTypes.h) to the |adTypes| parameter in GADAdLoader's initializer method. If you request this ad type, your delegate must conform to the <API key> protocol. @interface <API key> : GADNativeAd The ad's custom template ID. @property(nonatomic, readonly) NSString *templateID; Array of available asset keys. @property(nonatomic, readonly) NSArray *availableAssetKeys; Returns video controller for controlling receiver's video. @property(nonatomic, readonly, strong) GADVideoController *videoController; Returns media view for rendering video loaded by the receiver. Returns nil if receiver doesn't has a video. @property(nonatomic, readonly, strong, GAD_NULLABLE) GADMediaView *mediaView; Custom click handler. Set this property only if this template ad is configured with a custom click action, otherwise set it to nil. If this property is set to a non-nil value, the ad's built-in click actions are ignored and |customClickHandler| is executed when a click on the asset is received. @property(atomic, copy) <API key> customClickHandler; Returns the native ad image corresponding to the specified key or nil if the image is not available. - (GADNativeAdImage *GAD_NULLABLE_TYPE)imageForKey:(NSString *)key; Returns the string corresponding to the specified key or nil if the string is not available. - (NSString *GAD_NULLABLE_TYPE)stringForKey:(NSString *)key; Call when the user clicks on the ad. Provide the asset key that best matches the asset the user interacted with. If this ad is configured with a custom click action, ensure the receiver's customClickHandler property is set before calling this method. - (void)<API key>:(NSString *)assetKey; Call when the ad is displayed on screen to the user. Can be called multiple times. Only the first impression is recorded. - (void)recordImpression; Call when the user clicks on the ad. Provide the asset key that best matches the asset the user interacted with. Provide |customClickHandler| only if this template is configured with a custom click action, otherwise pass in nil. If a block is provided, the ad's built-in click actions are ignored and |customClickHandler| is executed after recording the click. This method is deprecated. See <API key>: API. - (void)<API key>:(NSString *)assetKey customClickHandler:(dispatch_block_t GAD_NULLABLE_TYPE)customClickHandler <API key>("Use <API key>:."); @end #pragma mark - Loading Protocol The delegate of a GADAdLoader object implements this protocol to receive <API key> ads. @protocol <API key><GADAdLoaderDelegate> Called when requesting an ad. Asks the delegate for an array of custom template ID strings. - (NSArray *)<API key>:(GADAdLoader *)adLoader; Tells the delegate that a native custom template ad was received. - (void)adLoader:(GADAdLoader *)adLoader <API key>:(<API key> *)<API key>; @end <API key>
#include <debug.h> #include <compiler.h> #include <stm32f0xx.h> #include <arch/arm/cm.h> #include <platform/stm32.h> #include <target/debugconfig.h> #include <lib/cbuf.h> /* un-overridden irq handler */ void stm32_dummy_irq(void) { arm_cm_irq_entry(); panic("unhandled irq\n"); } /* a list of default handlers that are simply aliases to the dummy handler */ #define DEFAULT_HANDLER(x) \ void stm32_##x(void) __WEAK_ALIAS("stm32_dummy_irq"); DEFAULT_HANDLER(WWDG_IRQ) DEFAULT_HANDLER(PVD_IRQ) DEFAULT_HANDLER(RTC_IRQ) DEFAULT_HANDLER(FLASH_IRQ) DEFAULT_HANDLER(RCC_IRQ) DEFAULT_HANDLER(EXTI0_1_IRQ) DEFAULT_HANDLER(EXTI2_3_IRQ) DEFAULT_HANDLER(EXTI4_15_IRQ) DEFAULT_HANDLER(TS_IRQ) DEFAULT_HANDLER(DMA1_Channel1_IRQ) DEFAULT_HANDLER(DMA1_Channel2_3_IRQ) DEFAULT_HANDLER(<API key>) DEFAULT_HANDLER(ADC1_COMP_IRQ) DEFAULT_HANDLER(<API key>) DEFAULT_HANDLER(TIM1_CC_IRQ) DEFAULT_HANDLER(TIM2_IRQ) DEFAULT_HANDLER(TIM3_IRQ) DEFAULT_HANDLER(TIM6_DAC_IRQ) DEFAULT_HANDLER(TIM7_IRQ) DEFAULT_HANDLER(TIM14_IRQ) DEFAULT_HANDLER(TIM15_IRQ) DEFAULT_HANDLER(TIM16_IRQ) DEFAULT_HANDLER(TIM17_IRQ) DEFAULT_HANDLER(I2C1_IRQ) DEFAULT_HANDLER(I2C2_IRQ) DEFAULT_HANDLER(SPI1_IRQ) DEFAULT_HANDLER(SPI2_IRQ) DEFAULT_HANDLER(USART1_IRQ) DEFAULT_HANDLER(USART2_IRQ) DEFAULT_HANDLER(USART3_4_IRQ) DEFAULT_HANDLER(CEC_IRQ) DEFAULT_HANDLER(USB_IRQ) #define VECTAB_ENTRY(x) [x##n] = stm32_##x /* appended to the end of the main vector table */ const void *const __SECTION(".text.boot.vectab2") vectab2[] = { VECTAB_ENTRY(WWDG_IRQ), // Window WatchDog Interrupt VECTAB_ENTRY(PVD_IRQ), // PVD through EXTI Line detect Interrupt VECTAB_ENTRY(RTC_IRQ), // RTC through EXTI Line Interrupt VECTAB_ENTRY(FLASH_IRQ), // FLASH Interrupt VECTAB_ENTRY(RCC_IRQ), // RCC Interrupt VECTAB_ENTRY(EXTI0_1_IRQ), // EXTI Line 0 and 1 Interrupts VECTAB_ENTRY(EXTI2_3_IRQ), // EXTI Line 2 and 3 Interrupts VECTAB_ENTRY(EXTI4_15_IRQ), // EXTI Line 4 to 15 Interrupts VECTAB_ENTRY(TS_IRQ), // Touch sense controller Interrupt VECTAB_ENTRY(DMA1_Channel1_IRQ), // DMA1 Channel 1 Interrupt VECTAB_ENTRY(DMA1_Channel2_3_IRQ), // DMA1 Channel 2 and Channel 3 Interrupts VECTAB_ENTRY(<API key>), // DMA1 Channels 4-7 Interrupts VECTAB_ENTRY(ADC1_COMP_IRQ), // ADC1, COMP1 and COMP2 Interrupts VECTAB_ENTRY(<API key>), // TIM1 Break, Update, Trigger and Commutation Interrupts VECTAB_ENTRY(TIM1_CC_IRQ), // TIM1 Capture Compare Interrupt VECTAB_ENTRY(TIM2_IRQ), // TIM2 Interrupt VECTAB_ENTRY(TIM3_IRQ), // TIM3 Interrupt VECTAB_ENTRY(TIM6_DAC_IRQ), // TIM6 and DAC Interrupts VECTAB_ENTRY(TIM7_IRQ), // TIM7 Interrupts VECTAB_ENTRY(TIM14_IRQ), // TIM14 Interrupt VECTAB_ENTRY(TIM15_IRQ), // TIM15 Interrupt VECTAB_ENTRY(TIM16_IRQ), // TIM16 Interrupt VECTAB_ENTRY(TIM17_IRQ), // TIM17 Interrupt VECTAB_ENTRY(I2C1_IRQ), // I2C1 Interrupt VECTAB_ENTRY(I2C2_IRQ), // I2C2 Interrupt VECTAB_ENTRY(SPI1_IRQ), // SPI1 Interrupt VECTAB_ENTRY(SPI2_IRQ), // SPI2 Interrupt VECTAB_ENTRY(USART1_IRQ), // USART1 Interrupt VECTAB_ENTRY(USART2_IRQ), // USART2 Interrupt VECTAB_ENTRY(USART3_4_IRQ), // USART3 and USART4 Interrupts VECTAB_ENTRY(CEC_IRQ), // CEC Interrupt VECTAB_ENTRY(USB_IRQ), // USB Low Priority global Interrupt };
<?php namespace VotingBundle; /** * Inherited Methods * @method void wantToTest($text) * @method void wantTo($text) * @method void execute($callable) * @method void expectTo($prediction) * @method void expect($prediction) * @method void amGoingTo($argumentation) * @method void am($role) * @method void lookForwardTo($achieveValue) * @method void comment($description) * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) * * @SuppressWarnings(PHPMD) */ class UnitTester extends \Codeception\Actor { use _generated\UnitTesterActions; /** * Define custom actions here */ }
<?php include('../header.php'); echo 'APM Order ' . $_GET['orderCode'] . ' has been marked as pending<br/>';
<!DOCTYPE html> <html lang="en" class="no-js"> <head> <meta charset="UTF-8"> <title>Search Results Data Component</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <!-- build:css css/ui.css --> <link rel="stylesheet" href="css/main.css"> <!-- endbuild --> <style> /* styles for this page only */ </style> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="<API key>+vTu7+<API key>=" crossorigin="anonymous"></script> </head> <body> <div class="ui-library-header"> <h1><a href="index.html">Dash UI Library</a></h1> <h2>Search Results Data Component</h2> </div> <!--#include file="includes/data-results.html" --> <!-- build:js js/ui.js --> <script src="js/<API key>.js"></script> <script src="js/details-polyfill.js"></script> <script src="js/main.js"></script> <!-- endbuild --> </body> </html>
# <API key>.Properties InitiationUrl **Namespace:** [OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508.md) **Assembly:** OfficeDevPnP.Core.dll ## Syntax C public string InitiationUrl { get; set; } Property Value Type: System.String ## See also - [<API key>](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508.<API key>.md) - [OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508](OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml.V201508.md)
class ProductsController < <API key> before_action :set_product, only: [:show, :edit, :update, :destroy] # GET /products # GET /products.json def index @products = Product.all end # GET /products/1 # GET /products/1.json def show end # GET /products/new def new @product = Product.new end # GET /products/1/edit def edit end # POST /products # POST /products.json def create @product = Product.new(product_params) respond_to do |format| if @product.save format.html { redirect_to @product, notice: 'Product was successfully created.' } format.json { render :show, status: :created, location: @product } else format.html { render :new } format.json { render json: @product.errors, status: :<API key> } end end end # PATCH/PUT /products/1 # PATCH/PUT /products/1.json def update respond_to do |format| if @product.update(product_params) format.html { redirect_to @product, notice: 'Product was successfully updated.' } format.json { render :show, status: :ok, location: @product } else format.html { render :edit } format.json { render json: @product.errors, status: :<API key> } end end end # DELETE /products/1 # DELETE /products/1.json def destroy @product.destroy respond_to do |format| format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' } format.json { head :no_content } end end def who_bought @product = Product.find(params[:id]) @latest_order = @product.orders.order(:updated_at).last if stale?(@latest_order) respond_to do |format| format.atom end end end private # Use callbacks to share common setup or constraints between actions. def set_product @product = Product.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def product_params params.require(:product).permit(:title, :description, :image_url, :price) end end
<?php namespace Acme\FooterBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\Loader; class AcmeFooterExtension extends Extension { /** * {@inheritDoc} */ public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this-><API key>($configuration, $configs); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yml'); } }
#import <Foundation/Foundation.h> #import "VIPERProtocols.h" @interface VIPERInteractor : NSObject <<API key>, <API key>> // Properties @property (nonatomic, weak) id <<API key>> presenter; @property (nonatomic, strong) id <<API key>> dataManager; @end
<?php namespace Symfony\Tests\Component\HttpKernel\HttpCache; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Controller\<API key>; use Symfony\Component\EventDispatcher\EventDispatcher; class TestHttpKernel extends HttpKernel implements <API key> { protected $body; protected $status; protected $headers; protected $called; protected $customizer; protected $catch; public function __construct($body, $status, $headers, \Closure $customizer = null) { $this->body = $body; $this->status = $status; $this->headers = $headers; $this->customizer = $customizer; $this->called = false; $this->catch = false; parent::__construct(new EventDispatcher(), $this); } public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) { $this->catch = $catch; return parent::handle($request, $type, $catch); } public function <API key>() { return $this->catch; } public function getController(Request $request) { return array($this, 'callController'); } public function getArguments(Request $request, $controller) { return array($request); } public function callController(Request $request) { $this->called = true; $response = new Response($this->body, $this->status, $this->headers); if (null !== $this->customizer) { call_user_func($this->customizer, $request, $response); } return $response; } public function hasBeenCalled() { return $this->called; } public function reset() { $this->called = false; } }
Meteor.npmRequire = function (moduleName) { var module = Npm.require(moduleName); return module; }; Meteor.require = function (moduleName) { console.warn('Meteor.require is deprecated. Please use Meteor.npmRequire instead!'); return Meteor.npmRequire(moduleName); };
/** * @constructor * @extends {WebInspector.<API key>} * @implements {WebInspector.TargetManager.Observer} */ WebInspector.<API key> = function() { WebInspector.<API key>.call(this, WebInspector.UIString("Async Operation Breakpoints")); this.bodyElement.classList.add("async-operations"); this.emptyElement.textContent = WebInspector.UIString("No Async Operations"); /** @type {!Map.<!WebInspector.Target, !Map.<number, !DebuggerAgent.AsyncOperation>>} */ this.<API key> = new Map(); /** @type {!Map.<number, !Element>} */ this.<API key> = new Map(); this.<API key> = false; this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.DefaultFormatter(30)); WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.<API key>, this.<API key>, this); WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.<API key>, this.<API key>, this); WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.<API key>, this.<API key>, this); WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); WebInspector.context.<API key>(WebInspector.Target, this._targetChanged, this); WebInspector.settings.<API key>.addChangeListener(this._refresh, this); WebInspector.targetManager.observeTargets(this); } WebInspector.<API key>.prototype = { /** * @override * @param {!WebInspector.Target} target */ targetAdded: function(target) { }, /** * @override * @param {!WebInspector.Target} target */ targetRemoved: function(target) { this.<API key>.delete(target); if (this._target === target) { this._clear(); delete this._target; } }, /** * @param {!WebInspector.Event} event */ _targetChanged: function(event) { var target = /** @type {!WebInspector.Target} */ (event.data); if (this._target === target) return; this._target = target; this._refresh(); }, /** @override */ wasShown: function() { if (!this._target) { this._target = WebInspector.context.flavor(WebInspector.Target); this._refresh(); } }, /** * @param {!WebInspector.Target} target */ <API key>: function(target) { if (this._target !== target || this.<API key>) return; this.<API key> = true; this._refresh(); }, /** * @param {!WebInspector.Event} event */ _debuggerResumed: function(event) { var target = /** @type {!WebInspector.Target} */ (event.target.target()); if (this._target !== target || !this.<API key>) return; this.<API key> = false; this._refresh(); }, /** * @param {!WebInspector.Event} event */ <API key>: function(event) { var target = /** @type {!WebInspector.Target} */ (event.data.target); var operation = /** @type {!DebuggerAgent.AsyncOperation} */ (event.data.operation); var operationsMap = this.<API key>.get(target); if (!operationsMap) { operationsMap = new Map(); this.<API key>.set(target, operationsMap) } operationsMap.set(operation.id, operation); if (this._target === target) this.<API key>(operation); }, /** * @param {!WebInspector.Event} event */ <API key>: function(event) { var target = /** @type {!WebInspector.Target} */ (event.data.target); var operationId = /** @type {number} */ (event.data.operationId); var operationsMap = this.<API key>.get(target); if (operationsMap) operationsMap.delete(operationId); if (this._target === target) { var element = this.<API key>.get(operationId); if (element) this.removeListElement(element); this.<API key>.delete(operationId); if (!this.<API key>.size) this._clear(); } }, /** * @param {!WebInspector.Event} event */ <API key>: function(event) { var target = /** @type {!WebInspector.Target} */ (event.data); this.<API key>.delete(target); if (this._target === target) this._clear(); }, _refresh: function() { this._clear(); if (!this._target) return; var operationsMap = this.<API key>.get(this._target); if (!operationsMap || !operationsMap.size) return; // The for..of loop iterates in insertion order. for (var pair of operationsMap) { var operation = /** @type {!DebuggerAgent.AsyncOperation} */ (pair[1]); this.<API key>(operation); } }, /** * @param {!DebuggerAgent.AsyncOperation} operation */ <API key>: function(operation) { var element = createElement("li"); var title = operation.description || WebInspector.UIString("Async Operation"); var label = createCheckboxLabel(title, false); label.classList.add("checkbox-elem"); element.appendChild(label); var callFrame = WebInspector.<API key>.<API key>(this._target, operation.stackTrace, operation.asyncStackTrace, this.<API key>); if (callFrame) element.createChild("div").appendChild(this._linkifier.<API key>(this._target, callFrame)); this.<API key>.set(operation.id, element); this.addListElement(element, this.listElement.firstChild); }, _clear: function() { this.reset(); this.<API key>.clear(); this._linkifier.reset(); }, __proto__: WebInspector.<API key>.prototype }
// Redirect all the existing URLs with fragment identifiers in to the new section ;(function () { 'use strict' var getNewRouteFor = function (fragment) { var baseURL = window.location.protocol + '//' + window.location.host var newRoutes = { '#guide-layout': '/layout', '#layout-spacing': '/layout/#layout-spacing', '#<API key>': '/layout/#<API key>', '#guide-typography': '/typography', '#typography-headings': '/typography/#typography-headings', '#<API key>': '/typography/#<API key>', '#<API key>': '/typography/#<API key>', '#typography-links': '/typography/#typography-links', '#typography-lists': '/typography/#typography-lists', '#<API key>': '/typography/#<API key>', '#<API key>': '/typography/#<API key>', '#guide-colour': '/colour', '#colour-contrast': '/colour/#colour-contrast', '#<API key>': '/colour/#<API key>', '#<API key>': '/colour/#<API key>', '#<API key>': '/colour/#<API key>', '#<API key>': '/colour/#<API key>', '#guide-icons-images': '/icons-images', '#icons': '/icons-images/#icons', '#images': '/icons-images/#images', '#guide-data': '/data', '#data-visualisation': '/data/#data-visualisation', '#data-in-a-table': '/data/#data-in-a-table', '#guide-forms': '/form-elements', '#<API key>': '/form-elements/#<API key>', '#form-labels': '/form-elements/#form-labels', '#form-fields': '/form-elements/#form-fields', '#form-fieldsets': '/form-elements/#form-fieldsets', '#form-focus-states': '/form-elements/#form-focus-states', '#form-spacing': '/form-elements/#form-spacing', '#form-hint-text': '/form-elements/#form-hint-text', '#form-select-boxes': '/form-elements/#form-select-boxes', '#form-radio-buttons': '/form-elements/#form-radio-buttons', '#form-checkboxes': '/form-elements/#form-checkboxes', '#<API key>': '/form-elements/#form-toggle-content', '#guide-buttons': '/buttons', '#buttons-button-text': '/buttons/#button-text', '#<API key>': '/buttons/#creating-buttons', '#<API key>': '/buttons/#button-disabled', '#guide-errors': '/errors', '#<API key>': '/errors/#examples', '#guide-alpha-beta': '/alpha-beta-banners', '#<API key>': '/alpha-beta-banners/#alpha-banner', '#<API key>': '/alpha-beta-banners/#<API key>' } if (typeof newRoutes[fragment] !== 'undefined') { return baseURL + newRoutes[fragment] } return false } var fragment = window.location.hash var newRoute if (fragment === '') { return } newRoute = getNewRouteFor(fragment) if (newRoute) { window.location.href = newRoute } }())
#pragma once #include "UEPyModule.h" PyObject *<API key>(ue_PyUObject *, PyObject *); PyObject *<API key>(ue_PyUObject *, PyObject *); PyObject *<API key>(ue_PyUObject *, PyObject *); PyObject *<API key>(ue_PyUObject *, PyObject *); PyObject *<API key>(ue_PyUObject *, PyObject *); PyObject *<API key>(ue_PyUObject *, PyObject *); PyObject *<API key>(ue_PyUObject *, PyObject *); PyObject *<API key>(ue_PyUObject *, PyObject *); PyObject *<API key>(ue_PyUObject *, PyObject *);
'use strict' const constants = require('../constants') const recursorUtils = require('../recursorUtils') const object = require('./object') const SHALLOW_EQUAL = constants.SHALLOW_EQUAL const UNEQUAL = constants.UNEQUAL function describe (props) { return new DescribedSetValue(Object.assign({ size: props.value.size }, props)) } exports.describe = describe function deserialize (state, recursor) { return new <API key>(state, recursor) } exports.deserialize = deserialize const tag = Symbol('SetValue') exports.tag = tag class SetValue extends object.ObjectValue { constructor (props) { super(props) this.size = props.size } compare (expected) { const result = super.compare(expected) if (result !== SHALLOW_EQUAL) return result return this.size === expected.size ? SHALLOW_EQUAL : UNEQUAL } prepareDiff (expected) { // Sets should be compared, even if they have a different number of items. return {compareResult: super.compare(expected)} } serialize () { return [this.size, super.serialize()] } } Object.defineProperty(SetValue.prototype, 'tag', { value: tag }) class DescribedSetValue extends object.DescribedMixin(SetValue) { <API key> () { const size = this.size if (size === 0) return recursorUtils.NOOP_RECURSOR let index = 0 let members const next = () => { if (index === size) return null if (!members) { members = Array.from(this.value) } const value = members[index] return this.describeItem(index++, this.describeAny(value)) } return { size, next } } } class <API key> extends object.DeserializedMixin(SetValue) { constructor (state, recursor) { super(state[1], recursor) this.size = state[0] } }
#include <stdio.h> #include <stdlib.h> int main() { int i, space, rows, hashtag=0,counttop=0,base,counthash; scanf("%d",&rows); base = (1 + (rows - 1) * 2)-4; counttop= rows-2; if (counttop%2==0) { counthash = (base+1)*(counttop/2);} else {counthash= (base-1)*((counttop-1)/2)+base;} printf("%d\n",counthash); for(i = 1; i < rows; i++) { for(space = 1; space <= rows-i; space++) { printf(" "); } while(hashtag != (2*i - 1)) { if(hashtag==0 || hashtag==2*i-2) printf("*"); else printf(" hashtag++;; } hashtag=0; printf("\n"); } for(i=0; i<2*rows-1; i++){ printf("*"); } return 0; }
package com.gdxjam.utils; import com.badlogic.ashley.core.Entity; import com.badlogic.ashley.core.Family; import com.badlogic.ashley.core.PooledEngine; import com.badlogic.ashley.utils.ImmutableArray; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.ai.msg.MessageManager; import com.gdxjam.ai.state.TelegramMessage; import com.gdxjam.components.FSMComponent; import com.gdxjam.components.FactionComponent.Faction; import com.gdxjam.components.TargetComponent; import com.gdxjam.ecs.Components; import com.gdxjam.systems.GUISystem; public class EntityUtils { private static final String TAG = "[" + EntityUtils.class.getSimpleName() + "]"; private static PooledEngine engine; private static GUISystem guiSystem; public static void setEngine (PooledEngine engine) { EntityUtils.engine = engine; EntityUtils.guiSystem = engine.getSystem(GUISystem.class); } /** Checks to see if two entities are of the same faction * @param entityA * @param entityB * @return true if they are the same faction */ public static boolean isSameFaction (Entity entityA, Entity entityB) { if (!Components.FACTION.has(entityA) || !Components.FACTION.has(entityB)) { Gdx.app.error(TAG, "entity faction comparision is missing faction component"); return false; } Faction factionA = Components.FACTION.get(entityA).getFaction(); Faction factionB = Components.FACTION.get(entityB).getFaction(); return factionA == factionB; } public static void clearTarget (Entity target) { ImmutableArray<Entity> entities = engine.getEntitiesFor(Family.all(TargetComponent.class).get()); for (Entity entity : entities) { TargetComponent targetComp = Components.TARGET.get(entity); if (targetComp.getTarget() == target) { targetComp.setTarget(null); //Dispatch a message to the entites FSM that there target was removed from the engine if (Components.FSM.has(entity)) { FSMComponent fsm = Components.FSM.get(entity); MessageManager.getInstance().dispatchMessage(null, fsm, TelegramMessage.TARGET_REMOVED.ordinal(), target); } } } } public static void removeEntity (Entity entity) { engine.removeEntity(entity); } }
var fs = require('fs') var path = require('path') var spawn = require('child_process').spawn var exe = process.argv[0] var cwd = process.cwd() for (var dep in process.versions) { console.log(' %s@%s', dep, process.versions[dep]) } console.log('') runScripts(fs.readdirSync(__dirname)) function runScripts (fileNames) { var fileName = fileNames.shift() if (!fileName) return if (!/\.js$/i.test(fileName)) return runScripts(fileNames) if (fileName.toLowerCase() === 'index.js') return runScripts(fileNames) var fullPath = path.join(__dirname, fileName) console.log('> %s %s', exe, path.relative(cwd, fullPath)) var proc = spawn(exe, [fullPath], { stdio: 'inherit' }) proc.on('exit', function () { runScripts(fileNames) }) }
HTML_OUTPUTS = { 'simple': ( b'<!DOCTYPE html><html xmlns="http: b'<div id="impress"><div class="step step-level-1" step="0" ' b'data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-x="0" data-y="0" data-z="0"><h1 ' b'id="simple-presentation">Simple Presentation</h1><p>This ' b'presentation has two slides, each with a ' b'header and some text.</p></div><div class="step step-level-1" ' b'step="1" data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-x="1600" data-y="0" data-z="0"><h1 ' b'id="second-slide">Second slide</h1><p>There is no positioning or ' b'anything fancy.</p></div></div><script type="text/javascript" ' b'src="js/impress.js"></script><script type="text/javascript" ' b'src="js/hovercraft-minimal.js"></script></body></html>' ), 'extra_css': ( b'<!DOCTYPE html SYSTEM "about:legacy-compat"><html ' b'xmlns="http: b'rel="stylesheet" href="css/style.css" media="all"></link><link ' b'rel="stylesheet" href="css/print.css" media="print"></link><link ' b'rel="stylesheet" href="css/impressConsole.css" ' b'media="screen,projection"></link><link rel="stylesheet" ' b'href="extra.css" media="all"></link><script type="text/javascript" ' b'src="js/dummy.js"></script></head><body ' b'class="<API key>"><div id="impress"><div class="step ' b'step-level-1" step="0" data-rotate-x="0" data-rotate-y="0" ' b'data-rotate-z="0" data-scale="1" data-x="0" data-y="0" data-z="0">' b'<h1 id="simple-presentation">Simple Presentation</h1><p>This ' b'presentation has two slides, each with a header and some text.</p>' b'</div><div class="step step-level-1" step="1" data-rotate-x="0" ' b'data-rotate-y="0" data-rotate-z="0" data-scale="1" data-x="1600" ' b'data-y="0" data-z="0"><h1 id="second-slide">Second ' b'slide</h1><p>There is no positioning or anything ' b'fancy.</p></div></div><div id="hovercraft-help" ' b'class="show"><table><tr><th>Left, Down, Page Down, Space</th><td>' b'Next slide</td></tr><tr><th>Right, Up, Page Up</th><td>Previous ' b'slide</td></tr><tr><th>H</th><td>Toggle this help</td>' b'</tr></table></div><script type="text/javascript" ' b'src="js/impress.js"></script><script type="text/javascript" ' b'src="js/impressConsole.js"></script><script type="text/javascript" ' b'src="js/hovercraft.js"></script></body></html>' ), 'advanced': ( b'<!DOCTYPE html SYSTEM "about:legacy-compat"><html ' b'xmlns="http: b'title</title><link rel="stylesheet" href="css/style.css" ' b'media="all"></link><link rel="stylesheet" href="css/print.css" ' b'media="print"></link><link rel="stylesheet" ' b'href="css/impressConsole.css" media="screen,projection"></link>' b'<link rel="stylesheet" href="extra.css" media="screen"></link>' b'<script type="text/javascript" src="js/dummy.js"></script></head>' b'<body class="<API key>"><div id="impress" ' b'<API key>="2000" auto-console="True"><div ' b'class="step step-level-1" step="0" data-x="1000" data-y="1600" ' b'data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-z="0"><h1 id="<API key>">Advanced ' b'Presentation</h1><p>Here we show the positioning feature, where we ' b'can explicitly set a position\non one of the steps.</p></div><div ' b'class="step step-level-1" step="1" id="name-this-step" ' b'data-x="2600" data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-y="1600" data-z="0"><h1 id="formatting">' b'Formatting</h1><p>Let us also try some basic formatting, like <em>' b'italic</em>, and <strong>bold</strong>.</p><ul><li>We can also</li>' b'<li>have a list</li><li>of things.</li></ul></div><div class="step ' b'step-level-1" step="2" data-rotate-x="0" data-rotate-y="0" ' b'data-rotate-z="0" data-scale="1" data-x="4200" data-y="1600" ' b'data-z="0"><p>There should also be possible to have\npreformatted ' b'text for code.</p><pre class="highlight code python"><span ' b'class="k">def</span> <span class="nf">foo</span><span class="p">' b'(</span><span class="n">bar</span><span class="p">):</span>\n ' b'<span class="c"># Comment</span>\n <span class="n">a</span> ' b'<span class="o">=</span> <span class="mi">1</span> <span class="o">' b'+</span> <span class="s">"hubbub"</span>\n <span class="k">' b'return</span> <span class="bp">None</span></pre></div><div ' b'class="step step-level-1" step="3" data-rotate-x="0" ' b'data-rotate-y="0" data-rotate-z="0" data-scale="1" data-x="5800" ' b'data-y="1600" data-z="0"><p>An image, with attributes:</p><img ' b'src="images/<API key>.png" width="50%" ' b'class="imageclass"></img></div><div class="step step-level-1" ' b'step="4" data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-x="7400" data-y="1600" data-z="0"><h1 ' b'id="character-sets">Character sets</h1><p>The character set is ' b'UTF-8 as of now. Like this: &#xE5;&#xE4;&#xF6;.</p></div></div>' b'<div id="hovercraft-help" class="show"><table><tr><th>Left, Down, ' b'Page Down, Space</th><td>Next slide</td></tr><tr><th>Right, Up, ' b'Page Up</th><td>Previous slide</td></tr><tr><th>H</th><td>Toggle ' b'this help</td></tr></table></div><script type="text/javascript" ' b'src="js/impress.js"></script><script type="text/javascript" ' b'src="js/impressConsole.js"></script><script type="text/javascript" ' b'src="js/hovercraft.js"></script></body></html>' ), 'default-template': ( b'<!DOCTYPE html><html xmlns="http: b'<title>Presentation title</title><meta name="generator" ' b'content="Hovercraft! 1.0 http://regebro.github.com/hovercraft">' b'</meta><link rel="stylesheet" href="css/hovercraft.css" ' b'media="all"></link><link rel="stylesheet" ' b'href="css/impressConsole.css" media="all"></link>' b'<link rel="stylesheet" href="css/highlight.css" media="all"></link>' b'<link rel="stylesheet" href="extra.css" media="screen"></link>' b'</head><body class="<API key>"><div id="impress" ' b'<API key>="2000" auto-console="True"><div ' b'class="step step-level-1" step="0" data-x="1000" data-y="1600" ' b'data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-z="0"><h1 id="<API key>">Advanced ' b'Presentation</h1><p>Here we show the positioning feature, where we ' b'can explicitly set a position\non one of the steps.</p></div><div ' b'class="step step-level-1" step="1" id="name-this-step" ' b'data-x="2600" data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-y="1600" data-z="0"><h1 id="formatting">' b'Formatting</h1><p>Let us also try some basic formatting, like ' b'<em>italic</em>, and <strong>bold</strong>.</p><ul><li>' b'We can also</li><li>have a list</li><li>of things.</li></ul></div>' b'<div class="step step-level-1" step="2" data-rotate-x="0" ' b'data-rotate-y="0" data-rotate-z="0" data-scale="1" data-x="4200" ' b'data-y="1600" data-z="0"><p>There should also be possible to ' b'have\npreformatted text for code.</p><pre class="highlight code' b' python"><span class="k">def</span> <span class="nf">foo</span>' b'<span class="p">(</span><span class="n">bar</span>' b'<span class="p">):</span>\n <span class="c">' b'# Comment</span>\n <span class="n">a</span> <span class="o">=' b'</span> <span class="mi">1</span> <span class="o">+</span> <span ' b'class="s">"hubbub"</span>\n <span class="k">return</span> <span ' b'class="bp">None</span></pre></div><div class="step step-level-1" ' b'step="3" data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-x="5800" data-y="1600" data-z="0"><p>An image,' b' with attributes:</p><img src="images/<API key>.png" ' b'width="50%" class="imageclass"></img></div><div class="step ' b'step-level-1" step="4" data-rotate-x="0" data-rotate-y="0" ' b'data-rotate-z="0" data-scale="1" data-x="7400" data-y="1600" ' b'data-z="0"><h1 id="character-sets">Character sets</h1>' b'<p>The character set is UTF-8 as of now. Like this: ' b'&#xE5;&#xE4;&#xF6;.</p></div></div><div id="hovercraft-help">' b'<table><tr><th>Space</th><td>Forward</td></tr><tr><th>' b'Right, Down, Page Down</th><td>Next slide</td></tr><tr><th>' b'Left, Up, Page Up</th><td>Previous slide</td></tr><tr><th>P</th>' b'<td>Open presenter console</td></tr><tr><th>H</th><td>Toggle ' b'this help</td></tr></table></div><script type="text/javascript" ' b'src="js/impress.js"></script><script type="text/javascript" ' b'src="js/impressConsole.js"></script><script type="text/javascript" ' b'src="js/hovercraft.js"></script></body></html>' ), 'presenter-notes': ( b'<!DOCTYPE html SYSTEM "about:legacy-compat"><html ' b'xmlns="http: b'title</title><link rel="stylesheet" href="css/style.css" ' b'media="all"></link><link rel="stylesheet" href="css/print.css" ' b'media="print"></link><link rel="stylesheet" ' b'href="css/impressConsole.css" media="screen,projection"></link>' b'<script type="text/javascript" src="js/dummy.js"></script></head>' b'<body class="<API key>"><div id="impress"><div ' b'class="step step-level-1" step="0" data-rotate-x="0" ' b'data-rotate-y="0" data-rotate-z="0" data-scale="1" data-x="0" ' b'data-y="0" data-z="0"><h1 ' b'id="<API key>">Hovercrafts presenter notes</h1>' b'<p>Hovercraft! supports presenter notes. It does this by taking ' b'anything in a\nwhat is calles a "notes-admonition" and making that ' b'into presenter notes.</p><div class="notes"><p>Hence, this will ' b'show up as presenter notes.\nYou have still access to a lot of ' b'formatting, like</p><ul><li>Bullet lists</li><li>And <em>all</em> ' b'types of <strong>inline formatting</strong></li></ul></div></div>' b'<div class="step step-level-1" step="1" data-rotate-x="0" ' b'data-rotate-y="0" data-rotate-z="0" data-scale="1" data-x="1600" ' b'data-y="0" data-z="0"><img ' b'src="images/<API key>.png"></img><div class="notes">' b'<p>You don\'t have to start the text on the same line as\nthe note, ' b'but you can.</p><p>You can also have several paragraphs. You can ' b'not have any\nheadings of any kind though.</p><p><strong>But you ' b'can fake them through bold-text</strong></p><p>And that\'s useful ' b'enough for presentation notes.</p></div></div></div><div ' b'id="hovercraft-help" class="show"><table><tr><th>Left, Down, Page ' b'Down, Space</th><td>Next slide</td></tr><tr><th>Right, Up, Page ' b'Up</th><td>Previous slide</td></tr><tr><th>H</th><td>Toggle this ' b'help</td></tr></table></div><script type="text/javascript" ' b'src="js/impress.js"></script><script type="text/javascript" ' b'src="js/impressConsole.js"></script><script type="text/javascript" ' b'src="js/hovercraft.js"></script></body></html>' ), '<API key>': ( b'<!DOCTYPE html SYSTEM "about:legacy-compat"><html ' b'xmlns="http: b'</title><link rel="stylesheet" href="css/style.css" media="all">' b'</link><link rel="stylesheet" href="css/print.css" media="print">' b'</link><link rel="stylesheet" href="css/impressConsole.css" ' b'media="screen,projection"></link><script type="text/javascript" ' b'src="js/dummy.js"></script></head><body ' b'class="<API key>"><div id="impress"><div class="step ' b'step-level-1" step="0" data-rotate-x="0" data-rotate-y="0" ' b'data-rotate-z="0" data-scale="1" data-x="0" data-y="0" data-z="0">' b'<h1 id="<API key>">Hovercrafts presenter notes' b'</h1><p>Hovercraft! supports presenter notes. It does this by ' b'taking anything in a\nwhat is calles a "notes-admonition" and ' b'making that into presenter notes.</p></div><div class="step ' b'step-level-1" step="1" data-rotate-x="0" data-rotate-y="0" ' b'data-rotate-z="0" data-scale="1" data-x="1600" data-y="0" ' b'data-z="0"><img src="images/<API key>.png">' b'</img></div></div><div id="hovercraft-help" class="show"><table><tr>' b'<th>Left, Down, Page Down, Space</th><td>Next slide</td></tr><tr>' b'<th>Right, Up, Page Up</th><td>Previous slide</td></tr><tr><th>H' b'</th><td>Toggle this help</td></tr></table></div><script ' b'type="text/javascript" src="js/impress.js"></script><script ' b'type="text/javascript" src="js/impressConsole.js"></script><script ' b'type="text/javascript" src="js/hovercraft.js"></script></body>' b'</html>' ), 'table': ( b'<!DOCTYPE html><html xmlns="http: b'<body><div id="impress"><div class="step step-level-1" step="0" ' b'data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-x="0" data-y="0" data-z="0"><table ' b'cellpadding="0" cellspacing="0" class="my-table-class">Truth table ' b'for "not"<thead><tr><th><p>Name</p></th><th><p>Money Owed</p></th>' b'</tr></thead><tbody><tr><td><p>Adam Alpha</p></td><td><p>100</p>' b'</td></tr></tbody></table><table cellpadding="0" cellspacing="0" ' b'id="my-table"><thead><tr><th><p>Number</p></th><th><p>Two</p></th>' b'</tr></thead><tbody><tr><td><p>Adam Alpha</p></td><td><p>100</p>' b'</td></tr></tbody></table></div></div><script ' b'type="text/javascript" src="js/impress.js"></script><script ' b'type="text/javascript" src="js/hovercraft-minimal.js"></script>' b'</body></html>' ), 'slide_with_class': ( b'<!DOCTYPE html><html xmlns="http: b'<div id="impress"><div class="step step-level-1 something-else" ' b'step="0" data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-x="0" data-y="0" data-z="0"><p>This is some ' b'text</p></div></div><script type="text/javascript" ' b'src="js/impress.js"></script><script type="text/javascript" ' b'src="js/hovercraft-minimal.js"></script></body></html>' ), 'container_directive': ( b'<!DOCTYPE html><html xmlns="http: b'<div id="impress"><div class="step step-level-1" step="0" ' b'data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-x="0" data-y="0" data-z="0"><div ' b'class="my-class"><p>This is some text in the container</p></div>' b'<div id="my-thing"><p>This should have an id</p></div></div></div>' b'<script type="text/javascript" src="js/impress.js"></script><script ' b'type="text/javascript" src="js/hovercraft-minimal.js"></script>' b'</body></html>' ), 'class_directive': ( b'<!DOCTYPE html><html xmlns="http: b'<div id="impress"><div class="step step-level-1" step="0" ' b'data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-x="0" data-y="0" data-z="0"><p class="my-class">' b'This is some text in the class</p></div></div><script ' b'type="text/javascript" src="js/impress.js"></script><script ' b'type="text/javascript" src="js/hovercraft-minimal.js"></script>' b'</body></html>' ), 'comment': ( b'<!DOCTYPE html><html xmlns="http: b'<div id="impress"><div class="step step-level-1" step="0" ' b'data-rotate-x="0" data-rotate-y="0" data-rotate-z="0" ' b'data-scale="1" data-x="0" data-y="0" data-z="0"><p>This text ' b'should appear.</p></div></div><script type="text/javascript" ' b'src="js/impress.js"></script><script type="text/javascript" ' b'src="js/hovercraft-minimal.js"></script></body></html>' ) }
package application; import java.io.IOException; import java.util.Stack; import application.logic.BoardClassic; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.layout.BorderPane; import javafx.event.ActionEvent; import javafx.fxml.FXMLLoader; public class Main extends Application { final static String GAMEBOARD = "gameBoard"; final static String GAMEBOARD_FXML = "gameBoard2.fxml"; final static String START_MENU = "startMenu"; final static String START_MENU_FXML = "startMenu.fxml"; final static String EXIT_MENU = "exit"; final static String EXIT_MENU_FXML = "exitMenu.fxml"; static Boolean PAUSE = false; static Boolean newGame = true; static BoardClassic BOARDCLASSIC; static int SCORE = 0; static Boolean DEMO = false; static Group root; static ExitMenuController EMC; public static GameBoardController GBC; static StartMenuController SMC; @Override public void start(Stage primaryStage) { boolean gameLoad, startLoad, exitLoad; ScreensController mainContainer = new ScreensController(); System.out.println("toStringcall::: " + mainContainer.toString()); gameLoad = mainContainer.loadScreen(Main.GAMEBOARD, Main.GAMEBOARD_FXML); startLoad = mainContainer.loadScreen(Main.START_MENU, Main.START_MENU_FXML); exitLoad = mainContainer.loadScreen(Main.EXIT_MENU, Main.EXIT_MENU_FXML); System.out.println("toStringcall::: " + mainContainer.toString()); System.out.println("game loaded? " + gameLoad + " startLoaded? " + startLoad + " exitLoaded? " + exitLoad); mainContainer.setScreen(Main.START_MENU); root = new Group(); root.getChildren().addAll(mainContainer); Scene scene = new Scene(root); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); System.out.println("start init"); } }
// copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // in all copies or substantial portions of the Software. // ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE // OR OTHER DEALINGS IN THE SOFTWARE. #define LUABIND_BUILDING #include <luabind/config.hpp> #include <luabind/detail/class_rep.hpp> #include <luabind/detail/object_rep.hpp> #include <luabind/detail/stack_utils.hpp> #include <luabind/function.hpp> #include <luabind/lua_include.hpp> namespace luabind { namespace detail { LUABIND_API void <API key>(lua_State* L, char const* name) { object_rep* obj = static_cast<object_rep*>(lua_touserdata(L, -1)); assert(obj); lua_pushstring(L, name); lua_gettable(L, -2); lua_replace(L, -2); if (!is_luabind_function(L, -1)) return; // this (usually) means the function has not been // overridden by lua, call the default implementation lua_pop(L, 1); obj->crep()->get_default_table(L); // push the crep table lua_pushstring(L, name); lua_gettable(L, -2); lua_remove(L, -2); // remove the crep table } }}
#!/bin/sh tar xf ${PKG_NAME}-*.tar.*
'use strict' const constants = require('./constants') const describe = require('./describe') const lineBuilder = require('./lineBuilder') const recursorUtils = require('./recursorUtils') const shouldCompareDeep = require('./shouldCompareDeep') const symbolProperties = require('./symbolProperties') const themeUtils = require('./themeUtils') const Circular = require('./Circular') const Indenter = require('./Indenter') const AMBIGUOUS = constants.AMBIGUOUS const DEEP_EQUAL = constants.DEEP_EQUAL const UNEQUAL = constants.UNEQUAL const SHALLOW_EQUAL = constants.SHALLOW_EQUAL const NOOP = Symbol('NOOP') const alwaysFormat = () => true function compareComplexShape (lhs, rhs) { let result = lhs.compare(rhs) if (result === DEEP_EQUAL) return DEEP_EQUAL if (result === UNEQUAL || !shouldCompareDeep(result, lhs, rhs)) return UNEQUAL let <API key> = false let lhsRecursor = lhs.createRecursor() let rhsRecursor = rhs.createRecursor() do { lhs = lhsRecursor() rhs = rhsRecursor() if (lhs === null && rhs === null) return SHALLOW_EQUAL if (lhs === null || rhs === null) return UNEQUAL result = lhs.compare(rhs) if (result === UNEQUAL) return UNEQUAL if ( result === AMBIGUOUS && lhs.isProperty === true && !<API key> && shouldCompareDeep(result, lhs, rhs) ) { <API key> = true const lhsCollector = new symbolProperties.Collector(lhs, lhsRecursor) const rhsCollector = new symbolProperties.Collector(rhs, rhsRecursor) lhsRecursor = recursorUtils.sequence( lhsCollector.createRecursor(), recursorUtils.unshift(lhsRecursor, lhsCollector.collectAll())) rhsRecursor = recursorUtils.sequence( rhsCollector.createRecursor(), recursorUtils.unshift(rhsRecursor, rhsCollector.collectAll())) } } while (true) } function diffDescriptors (lhs, rhs, options) { const theme = themeUtils.normalize(options) const invert = options ? options.invert === true : false const lhsCircular = new Circular() const rhsCircular = new Circular() const maxDepth = (options && options.maxDepth) || 0 let indent = new Indenter(0, ' ') const lhsStack = [] const rhsStack = [] let topIndex = -1 const buffer = lineBuilder.buffer() const diffStack = [] let diffIndex = -1 const isCircular = descriptor => lhsCircular.has(descriptor) || rhsCircular.has(descriptor) const format = (builder, subject, circular) => { if (diffIndex >= 0 && !diffStack[diffIndex].shouldFormat(subject)) return if (circular.has(subject)) { diffStack[diffIndex].formatter.append(builder.single(theme.circular)) return } const formatStack = [] let formatIndex = -1 do { if (circular.has(subject)) { formatStack[formatIndex].formatter.append(builder.single(theme.circular), subject) } else { let didFormat = false if (typeof subject.formatDeep === 'function') { let formatted = subject.formatDeep(themeUtils.applyModifiers(subject, theme), indent) if (formatted !== null) { didFormat = true if (formatIndex === -1) { formatted = builder.setDefaultGutter(formatted) if (diffIndex === -1) { buffer.append(formatted) } else { diffStack[diffIndex].formatter.append(formatted, subject) } } else { formatStack[formatIndex].formatter.append(formatted, subject) } } } if (!didFormat && typeof subject.formatShallow === 'function') { const formatter = subject.formatShallow(themeUtils.applyModifiers(subject, theme), indent) const recursor = subject.createRecursor() if (formatter.increaseIndent && maxDepth > 0 && indent.level === maxDepth) { const isEmpty = recursor() === null let formatted = !isEmpty && typeof formatter.maxDepth === 'function' ? formatter.maxDepth() : formatter.finalize() if (formatIndex === -1) { formatted = builder.setDefaultGutter(formatted) diffStack[diffIndex].formatter.append(formatted, subject) } else { formatStack[formatIndex].formatter.append(formatted, subject) } } else { formatStack.push({ formatter, recursor, decreaseIndent: formatter.increaseIndent, shouldFormat: formatter.shouldFormat || alwaysFormat, subject }) formatIndex++ if (formatter.increaseIndent) indent = indent.increase() circular.add(subject) } } } while (formatIndex >= 0) { do { subject = formatStack[formatIndex].recursor() } while (subject && !formatStack[formatIndex].shouldFormat(subject)) if (subject) { break } const record = formatStack.pop() formatIndex if (record.decreaseIndent) indent = indent.decrease() circular.delete(record.subject) let formatted = record.formatter.finalize() if (formatIndex === -1) { formatted = builder.setDefaultGutter(formatted) if (diffIndex === -1) { buffer.append(formatted) } else { diffStack[diffIndex].formatter.append(formatted, record.subject) } } else { formatStack[formatIndex].formatter.append(formatted, record.subject) } } } while (formatIndex >= 0) } do { let compareResult = NOOP if (lhsCircular.has(lhs)) { compareResult = lhsCircular.get(lhs) === rhsCircular.get(rhs) ? DEEP_EQUAL : UNEQUAL } else if (rhsCircular.has(rhs)) { compareResult = UNEQUAL } let <API key> = false if (lhs.isProperty === true) { compareResult = lhs.compare(rhs) if (compareResult === AMBIGUOUS) { const parent = lhsStack[topIndex].subject <API key> = parent.<API key> !== true && parent.<API key> !== true } } let didFormat = false let mustRecurse = false if (compareResult !== DEEP_EQUAL && !<API key> && typeof lhs.prepareDiff === 'function') { const lhsRecursor = topIndex === -1 ? null : lhsStack[topIndex].recursor const rhsRecursor = topIndex === -1 ? null : rhsStack[topIndex].recursor const instructions = lhs.prepareDiff( rhs, lhsRecursor, rhsRecursor, compareComplexShape, isCircular) if (instructions !== null) { if (topIndex >= 0) { if (typeof instructions.lhsRecursor === 'function') { lhsStack[topIndex].recursor = instructions.lhsRecursor } if (typeof instructions.rhsRecursor === 'function') { rhsStack[topIndex].recursor = instructions.rhsRecursor } } if (instructions.compareResult) { compareResult = instructions.compareResult } if (instructions.mustRecurse === true) { mustRecurse = true } else { if (instructions.actualIsExtraneous === true) { format(lineBuilder.actual, lhs, lhsCircular) didFormat = true } else if (instructions.<API key> === true) { for (const extraneous of instructions.descriptors) { format(lineBuilder.actual, extraneous, lhsCircular) } didFormat = true } else if (instructions.expectedIsMissing === true) { format(lineBuilder.expected, rhs, rhsCircular) didFormat = true } else if (instructions.multipleAreMissing === true) { for (const missing of instructions.descriptors) { format(lineBuilder.expected, missing, rhsCircular) } didFormat = true } else if (instructions.isUnequal === true) { format(lineBuilder.actual, lhs, lhsCircular) format(lineBuilder.expected, rhs, rhsCircular) didFormat = true } else if (!instructions.compareResult) { // TODO: Throw a useful, custom error throw new Error('Illegal result of prepareDiff()') } } } } if (!didFormat) { if (compareResult === NOOP) { compareResult = lhs.compare(rhs) } if (!mustRecurse) { mustRecurse = shouldCompareDeep(compareResult, lhs, rhs) } if (compareResult === DEEP_EQUAL) { format(lineBuilder, lhs, lhsCircular) } else if (mustRecurse) { if (compareResult === AMBIGUOUS && lhs.isProperty === true) { // Replace both sides by a pseudo-descriptor which collects symbol // properties instead. lhs = new symbolProperties.Collector(lhs, lhsStack[topIndex].recursor) rhs = new symbolProperties.Collector(rhs, rhsStack[topIndex].recursor) // Replace the current recursors so they can continue correctly after // the collectors have been "compared". This is necessary since the // collectors eat the first value after the last symbol property. lhsStack[topIndex].recursor = recursorUtils.unshift(lhsStack[topIndex].recursor, lhs.collectAll()) rhsStack[topIndex].recursor = recursorUtils.unshift(rhsStack[topIndex].recursor, rhs.collectAll()) } if (typeof lhs.diffShallow === 'function') { const formatter = lhs.diffShallow(rhs, themeUtils.applyModifiers(lhs, theme), indent) diffStack.push({ formatter, origin: lhs, decreaseIndent: formatter.increaseIndent, exceedsMaxDepth: formatter.increaseIndent && maxDepth > 0 && indent.level >= maxDepth, shouldFormat: formatter.shouldFormat || alwaysFormat }) diffIndex++ if (formatter.increaseIndent) indent = indent.increase() } else if (typeof lhs.formatShallow === 'function') { const formatter = lhs.formatShallow(themeUtils.applyModifiers(lhs, theme), indent) diffStack.push({ formatter, decreaseIndent: formatter.increaseIndent, exceedsMaxDepth: formatter.increaseIndent && maxDepth > 0 && indent.level >= maxDepth, shouldFormat: formatter.shouldFormat || alwaysFormat, subject: lhs }) diffIndex++ if (formatter.increaseIndent) indent = indent.increase() } lhsCircular.add(lhs) rhsCircular.add(rhs) lhsStack.push({ diffIndex, subject: lhs, recursor: lhs.createRecursor() }) rhsStack.push({ diffIndex, subject: rhs, recursor: rhs.createRecursor() }) topIndex++ } else { const diffed = typeof lhs.diffDeep === 'function' ? lhs.diffDeep(rhs, themeUtils.applyModifiers(lhs, theme), indent) : null if (diffed === null) { format(lineBuilder.actual, lhs, lhsCircular) format(lineBuilder.expected, rhs, rhsCircular) } else { if (diffIndex === -1) { buffer.append(diffed) } else { diffStack[diffIndex].formatter.append(diffed, lhs) } } } } while (topIndex >= 0) { lhs = lhsStack[topIndex].recursor() rhs = rhsStack[topIndex].recursor() if (lhs !== null && rhs !== null) { break } if (lhs === null && rhs === null) { const lhsRecord = lhsStack.pop() const rhsRecord = rhsStack.pop() lhsCircular.delete(lhsRecord.subject) rhsCircular.delete(rhsRecord.subject) topIndex if (lhsRecord.diffIndex === diffIndex) { const record = diffStack.pop() diffIndex if (record.decreaseIndent) indent = indent.decrease() let formatted = record.formatter.finalize() if (record.exceedsMaxDepth && !formatted.hasGutter) { // The record exceeds the max depth, but contains no actual diff. // Discard the potentially deep formatting and format just the // original subject. const subject = lhsRecord.subject const formatter = subject.formatShallow(themeUtils.applyModifiers(subject, theme), indent) const isEmpty = subject.createRecursor()() === null formatted = !isEmpty && typeof formatter.maxDepth === 'function' ? formatter.maxDepth() : formatter.finalize() } if (diffIndex === -1) { buffer.append(formatted) } else { diffStack[diffIndex].formatter.append(formatted, record.subject) } } } else { let builder, circular, stack, subject if (lhs === null) { builder = lineBuilder.expected circular = rhsCircular stack = rhsStack subject = rhs } else { builder = lineBuilder.actual circular = lhsCircular stack = lhsStack subject = lhs } do { format(builder, subject, circular) subject = stack[topIndex].recursor() } while (subject !== null) } } } while (topIndex >= 0) return buffer.toString({diff: true, invert, theme}) } exports.diffDescriptors = diffDescriptors function diff (actual, expected, options) { return diffDescriptors(describe(actual, options), describe(expected, options), options) } exports.diff = diff
var helper = require('../lib'); var request = helper.getRequest(); describe('<API key>', function(){ before(function (done) { helper.drakov.run({sourceFiles: 'test/example/md/<API key>.md'}, done); }); after(function (done) { helper.drakov.stop(done); }); describe('/api/sababa/:itemid', function(){ describe('GET', function(){ it('should respond with response from parametrized endpoint', function(done){ request.get('/api/sababa/123456') .expect(200) .expect('Content-type', 'application/json;charset=UTF-8') .expect({ 'response-type': 'parametrized' }) .end(helper.endCb(done)); }); }); }); describe('/api/sababa/static', function(){ describe('GET', function(){ it('should respond with response from static endpoint', function(done){ request.get('/api/sababa/static') .expect(200) .expect('Content-type', 'application/json;charset=UTF-8') .expect({ 'response-type': 'static' }) .end(helper.endCb(done)); }); }); }); });
require "helper" class TestDrop < JekyllUnitTest context "a document drop" do setup do @site = fixture_site({ "collections" => ["methods"], }) @site.process @document = @site.collections["methods"].docs.detect do |d| d.relative_path == "_methods/configuration.md" end @drop = @document.to_liquid end should "raise KeyError if key is not found and no default provided" do assert_raises KeyError do @drop.fetch("not_existing_key") end end should "fetch value without default" do assert_equal "Jekyll.configuration", @drop.fetch("title") end should "fetch default if key is not found" do assert_equal "default", @drop.fetch("not_existing_key", "default") end should "fetch default boolean value correctly" do assert_equal false, @drop.fetch("bar", false) end should "fetch default value from block if key is not found" do assert_equal "default bar", @drop.fetch("bar") { |el| "default end should "fetch default value from block first if both argument and block given" do assert_equal "baz", @drop.fetch("bar", "default") { "baz" } end end end
import { Component, ViewChild, ElementRef } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { @ViewChild('HorizontalDiv') HorizontalDiv: ElementRef; @ViewChild('VerticalDiv') VerticalDiv: ElementRef; <API key>(event: any): void { this.VerticalDiv.nativeElement.innerHTML = 'Vertical (' + parseInt(event.currentValue) + ')'; }; <API key>(event: any): void { this.HorizontalDiv.nativeElement.innerHTML = 'Horizontal (' + parseInt(event.currentValue) + ')'; }; }
{% extends "layout.html" %} {% block page_title %} Apprenticeships {% endblock %} {% block content %} <style> .financial-nav a, .nav-payments a{ {% include "includes/nav-on-state-css.html" %} } </style> <main id="content" role="main"> {% include "includes/phase_banner_alpha.html" %} {% include "includes/breadcrumbStart.html" %} <li><a href="/{% include "includes/sprint-link.html" %}/finance">Finance</a></li> {% include "includes/breadcrumbEnd.html" %} <div id="v1" class="hidden"> <!--div class="column-two-thirds" <h1 class="heading-xlarge" >{% include "includes/account-name-number.html" %}View your transactions</h1> <!--p class="lede"> On this page you can view every transaction in and out of your account. </p <div> <div class="home-figures"> <h2 class="heading-small" >This is your current balance:</h2> <h2 class="bold-xlarge" data-bind="text: displayBalance"></h2> <!--style="color:#08c"--> <p style="font-size:16px" >on <span data-bind="text: displaySystemDate"></span></p> </div> <!--div class="home-figures"> <h2 class="heading-small">Your English fraction is</h2> <h2 class="bold-xlarge">0.81</h2> <p style=" font-size:16px" class="">Since 1 April 2017</p> </div <!--div class="home-figures" style=""> <h2 class="heading-small">Total committed spending:</h2> <h2 class="rjCashMoney">£65,000</h2> <p style="margin-top:0">until 21 Jan 2021</p> </div> <div class="home-figures" style=""> <h2 class="heading-small">Forecasted income:</h2> <h2 class="rjCashMoney">£120,000</h2> <p style="margin-top:0">Until 31 Jan 2019</p> </div </div> <!--h2 class="heading-medium">Account history</h2 <table id="transactions"> <h2 class="heading-medium">Transactions</h2> <thead> <tr> <th scope="col">Date</th> <th scope="col">Description</th> <th scope="col" style="text-align:center">Credit</th> <th class="" scope="col" style="text-align:center">Debit</th> <th class="" scope="col" style="text-align:center">Balance</th> <th scope="col"></th> </tr> </thead> <!--tbody data-bind="foreach: statementLines"> <tr> <td data-bind="text: displayDate"></td> <td data-bind="text: description"></td> <td class="numeric" data-bind="text: displayCredit"></td> <td class="numeric negative" data-bind="text: displayDebit">-</td> <td class="numeric" data-bind="text: $parent.<API key>($index)"></td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/credit-details">View</td> </tr <tr> <td>15 August 2018</td> <td>Payment to provider Hackney Skills and Training Ltd</td> <td class="numeric">&nbsp</td> <td class="numeric ">£379</td> <td class="numeric">£5,340</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</a></td> </tr> <tr> <td>10 August 2018</td> <td>Levy credit August 2018 10% bonus payment</td> <td class="numeric">£70</td> <td class="numeric ">&nbsp</td> <td class="numeric">£5,719</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/top-up-details">View</a></td> </tr> <tr> <td>10 August 2018</td> <td>Levy credit August 2018 </td> <td class="numeric ">£704</td> <td class="numeric negative">&nbsp</span></td> <td class="numeric">£5,649</td> <td class="credit-details"><a href="/{% include "includes/sprint-link.html" %}/finance/credit-details">View</a></td> </tr> <tr> <td>08 August 2018</td> <td>Payment to provider Lots of skills Ltd</td> <td class="numeric">&nbsp</td> <td class="numeric ">£347</td> <td class="numeric">£4,945</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</a></td> </tr> <tr> <td>15 July 2018</td> <td>Payment to provider Hackney Skills and Training Ltd</td> <td class="numeric">&nbsp</td> <td class="numeric ">£379</td> <td class="numeric">£5,292</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</a></td> </tr> <tr> <td>10 July 2018</td> <td>Levy credit July 2018 10% bonus payment</td> <td class="numeric">£70</td> <td class="numeric negative">&nbsp</td> <td class="numeric">£5,671</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/top-up-details">View</a></td> </tr> <tr> <td>10 July 2018</td> <td>Levy credit July 2018</td> <td class="numeric">£704</td> <td class="numeric negative">&nbsp</td> <td class="numeric">£5,601</td> <td class="credit-details"><a href="/{% include "includes/sprint-link.html" %}/finance/credit-details">View</a></td> </tr> <tr> <td>08 July 2018</td> <td>Payment to provider Lots of skills Ltd</td> <td class="numeric">&nbsp</td> <td class="numeric ">£347</td> <td class="numeric">£4,897</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</a></td> </tr> <tr> <td>15 June 2018</td> <td>Payment to provider Hackney Skills and Training Ltd</td> <td class="numeric">&nbsp</td> <td class="numeric negative">£379</td> <td class="numeric">£5,244</td> <td class="<API key>">View</td> </tr> <tr> <td>10 June 2018</td> <td>Levy credit June 2018</td> <td class="numeric">£704</td> <td class="numeric negative">&nbsp</td> <td class="numeric">£5,623</td> <td class="credit-details"><a href="/{% include "includes/sprint-link.html" %}/finance/credit-details">View</a></td> </tr> <tr> <td>10 June 2018</td> <td>Levy credit June 2018 10% bonus payment</td> <td class="numeric">£70</td> <td class="numeric negative">&nbsp</td> <td class="numeric">£4,919</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/top-up-details">View</a></td> </tr> <tr> <td>08 June 2018</td> <td>Payment to provider Lots of Skills Ltd</td> <td class="numeric">&nbsp</td> <td class="numeric">£347</td> <td class="numeric">£4,849</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</a></td> </tr> <!--tr> <td>15 May 2018</td> <td>Payment to provider Hackney Skills and Training Ltd</td> <td class="numeric"></td> <td class="numeric ">£379</td> <td class="numeric">£5,195</td> <td class="<API key>">View</td> </tr> <tr> <td>10 May 2018</td> <td>Skills Funding Agency May 2018 10% bonus payment</td> <td class="numeric">£70</td> <td class="numeric negative"></td> <td class="numeric">£5,574</td> <td class="<API key>">View</td> </tr> <tr> <td>10 May 2018</td> <td>Skills Funding Agency May 2018 Payment</td> <td class="numeric">£704</td> <td class="numeric negative"></td> <td class="numeric">£5,504</td> <td class="<API key>">View</td> </tr> <tr> <td>08 May 2018</td> <td>Payment to provider Lots of skills Ltd</td> <td class="numeric"></td> <td class="numeric ">£347</td> <td class="numeric">£4,800</td> <td class="<API key>">View</td> </tr> <tr> <td>15 April 2018</td> <td>Payment to provider Hackney Skills and Training Ltd</td> <td class="numeric"></td> <td class="numeric ">£379</td> <td class="numeric">£5,147</td> <td class="<API key>">View</td> </tr> <tr> <td>10 April 2018</td> <td>Skills Funding Agency April 2018 10% bonus payment</td> <td class="numeric">£70</td> <td class="numeric "></td> <td class="numeric">£5,526</td> <td class="<API key>">View</td> </tr> <tr> <td>10 April 2018</td> <td>Skills Funding Agency April 2018 Payment</td> <td class="numeric">£704</td> <td class="numeric "></td> <td class="numeric">£5,455</td> <td class="<API key>">View</td> </tr </tbody> </table> </div> <div id="v2" class=""> <!--div class="column-two-thirds" <h1 class="heading-xlarge" > {% include "includes/account-name-number.html" %}View your transactions</h1> <!--p class="lede"> On this page you can view every transaction in and out of your account. </p <div> <div class="home-figures"> <h2 class="heading-small" >This is your current balance:</h2> <h2 class="bold-xlarge" data-bind="text: displayBalance"></h2> <!--style="color:#08c"--> <p style="font-size:16px" >on <span data-bind="text: displaySystemDate"></span></p> </div> <!--div class="home-figures"> <h2 class="heading-small">Your English fraction is</h2> <h2 class="bold-xlarge">0.81</h2> <p style=" font-size:16px" class="">Since 1 April 2017</p> </div <!--div class="home-figures" style=""> <h2 class="heading-small">Total committed spending:</h2> <h2 class="rjCashMoney">£65,000</h2> <p style="margin-top:0">until 21 Jan 2021</p> </div> <div class="home-figures" style=""> <h2 class="heading-small">Forecasted income:</h2> <h2 class="rjCashMoney">£120,000</h2> <p style="margin-top:0">Until 31 Jan 2019</p> </div </div> <!--h2 class="heading-medium">Account history</h2 <table id="transactions"> <h2 class="heading-medium">Transactions</h2> <thead> <tr> <th scope="col">Date</th> <th scope="col">Description</th> <th scope="col">Credit</th> <th class="" scope="col">Debit</th> <th class="" scope="col">Balance</th> <th scope="col"></th> </tr> </thead> <!--tbody data-bind="foreach: statementLines"> <tr> <td data-bind="text: displayDate"></td> <td data-bind="text: description"></td> <td class="numeric" data-bind="text: displayCredit"></td> <td class="numeric negative" data-bind="text: displayDebit">-</td> <td class="numeric" data-bind="text: $parent.<API key>($index)"></td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/credit-details">View</td> </tr <tr> <td>15 August 2018</td> <td>Hackney Skills and Training Ltd</td> <td class="">&nbsp</td> <td class=" ">£379</td> <td class="">£5,340</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</a></td> </tr> <tr> <td>10 August 2018</td> <td>Levy credit</td> <td class="">£774</td> <td class=" ">&nbsp</td> <td class="">£5,719</td> <td class="credit-details"><a href="/{% include "includes/sprint-link.html" %}/finance/credit-details">View</a></td> </tr> <tr> <td>08 August 2018</td> <td>Lots of skills Ltd</td> <td class="">&nbsp</td> <td class=" ">£347</td> <td class="">£4,945</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</a></td> </tr> <tr> <td>15 July 2018</td> <td>Hackney Skills and Training Ltd</td> <td class="">&nbsp</td> <td class=" ">£379</td> <td class="">£5,292</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</a></td> </tr> <tr> <td>10 July 2018</td> <td>Levy credit</td> <td class="">£774</td> <td class=" negative">&nbsp</td> <td class="">£5,671</td> <td class="credit-details"><a href="/{% include "includes/sprint-link.html" %}/finance/credit-details">View</a></td> </tr> <tr> <td>08 July 2018</td> <td>Lots of skills Ltd</td> <td class="">&nbsp</td> <td class=" ">£347</td> <td class="">£4,897</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</a></td> </tr> <tr> <td>15 June 2018</td> <td>Hackney Skills and Training Ltd</td> <td class="">&nbsp</td> <td class=" negative">£379</td> <td class="">£5,244</td> <td class="<API key>">View</td> </tr> <tr> <td>10 June 2018</td> <td>Levy credit</td> <td class="">£774</td> <td class=" negative">&nbsp</td> <td class="">£5,623</td> <td class="credit-details"><a href="/{% include "includes/sprint-link.html" %}/finance/credit-details">View</a></td> </tr> <tr> <td>08 June 2018</td> <td>Lots of Skills Ltd</td> <td class="">&nbsp</td> <td class="">£347</td> <td class="">£4,849</td> <td class=""><a href="/{% include "includes/sprint-link.html" %}/finance/debit-details">View</a></td> </tr> <!--tr> <td>15 May 2018</td> <td>Payment to provider Hackney Skills and Training Ltd</td> <td class="numeric"></td> <td class="numeric ">£379</td> <td class="numeric">£5,195</td> <td class="<API key>">View</td> </tr> <tr> <td>10 May 2018</td> <td>Skills Funding Agency May 2018 10% bonus payment</td> <td class="numeric">£70</td> <td class="numeric negative"></td> <td class="numeric">£5,574</td> <td class="<API key>">View</td> </tr> <tr> <td>10 May 2018</td> <td>Skills Funding Agency May 2018 Payment</td> <td class="numeric">£704</td> <td class="numeric negative"></td> <td class="numeric">£5,504</td> <td class="<API key>">View</td> </tr> <tr> <td>08 May 2018</td> <td>Payment to provider Lots of skills Ltd</td> <td class="numeric"></td> <td class="numeric ">£347</td> <td class="numeric">£4,800</td> <td class="<API key>">View</td> </tr> <tr> <td>15 April 2018</td> <td>Payment to provider Hackney Skills and Training Ltd</td> <td class="numeric"></td> <td class="numeric ">£379</td> <td class="numeric">£5,147</td> <td class="<API key>">View</td> </tr> <tr> <td>10 April 2018</td> <td>Skills Funding Agency April 2018 10% bonus payment</td> <td class="numeric">£70</td> <td class="numeric "></td> <td class="numeric">£5,526</td> <td class="<API key>">View</td> </tr> <tr> <td>10 April 2018</td> <td>Skills Funding Agency April 2018 Payment</td> <td class="numeric">£704</td> <td class="numeric "></td> <td class="numeric">£5,455</td> <td class="<API key>">View</td> </tr </tbody> </table> </div> </main> <!--button class="button">Do the thing</button <script> //jquery that runs the tabs. Uses the jquery.tabs.js from gov.uk $( document ).ready(function() { // change the tabs themselves to active - should be in the above but isn't working because it's looking for a not li so I added this as a quick fix. $("ul#tabs-nav li").click(function(e){ if (!$(this).hasClass("active")) { var tabNum = $(this).index(); var nthChild = tabNum+1; $("ul#tabs-nav li.active").removeClass("active"); $(this).addClass("active"); $("ul#tabs-nav li.active").removeClass("active"); $("ul#tabs-nav li:nth-child("+nthChild+")").addClass("active"); } }); }); $('ul.tabs-nav').each(function(){ // For each set of tabs, we want to keep track of // which tab is active and its associated content var $active, $content, $links = $(this).find('a'); // If the location.hash matches one of the links, use that as the active tab. // If no match is found, use the first link as the initial active tab. $active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]); // $active.addClass('active'); console.log($active) $content = $($active[0].hash); // Hide the remaining content $links.not($active).each(function () { $(this.hash).hide(); }); // Bind the click event handler $(this).on('click', 'a', function(e){ // Make the old tab inactive. // $active.removeClass('active'); $content.hide(); // Update the variables with the new link and content // $active = $(this); $content = $(this.hash); // Make the tab active. // $active.addClass('active'); $content.show(); // Prevent the anchor's default click action e.preventDefault(); }); }); $(document).bind('keypress', function(event) { if( event.which === 32 && event.shiftKey ) { console.log("do something"); $("#v1").removeClass("hidden"); $("#v2").addClass("hidden"); } }); $("#v1 table .credit-details").click(function(e){ e.preventDefault(); window.open("finance/credit-details?ab=v1","_self"); }) $("#v2 table .credit-details").click(function(e){ e.preventDefault(); window.open("finance/credit-details?ab=v2","_self"); }) </script> {% endblock %}
'use strict'; module.exports = { succeed: (res) => {}, fail: (e) => {} };
namespace System.Web.Mvc.Test { using System; using System.Web.Routing; using System.Web.TestUtil; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; [TestClass] public class RedirectResultTest { private static string _baseUrl = "http: [TestMethod] public void ConstructorSetsUrl() { // Act var result = new RedirectResult(_baseUrl); // Assert Assert.AreSame(_baseUrl, result.Url); } [TestMethod] public void <API key>() { // Act & Assert ExceptionHelper.<API key>( delegate { new RedirectResult(String.Empty); }, "url"); } [TestMethod] public void <API key>() { // Act & Assert ExceptionHelper.<API key>( delegate { new RedirectResult(null /* url */); }, "url"); } [TestMethod] public void <API key>() { // Arrange Mock<HttpResponseBase> mockResponse = new Mock<HttpResponseBase>(); mockResponse.Expect(o => o.Redirect(_baseUrl, false /* endResponse */)); Mock<HttpContextBase> mockContext = new Mock<HttpContextBase>(); mockContext.Expect(o => o.Response).Returns(mockResponse.Object); ControllerContext context = new ControllerContext(mockContext.Object, new RouteData(), new Mock<ControllerBase>().Object); var result = new RedirectResult(_baseUrl); // Act result.ExecuteResult(context); // Assert mockResponse.Verify(); } [TestMethod] public void <API key>() { // Arrange var result = new RedirectResult(_baseUrl); // Act & Assert ExceptionHelper.<API key>( delegate { result.ExecuteResult(null /* context */); }, "context"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OpenNLP.Tools.Trees { <summary> A class for tree normalization. The default one does no normalization. Other tree normalizers will change various node labels, or perhaps the whole tree geometry (by doing such things as deleting functional tags or empty elements). Another operation that a <code>TreeNormalizer</code> may wish to perform is interning the <code>string</code>s passed to it. Can be reused as a Singleton. Designed to be extended. The <code>TreeNormalizer</code> methods are in two groups. The contract for this class is that first normalizeTerminal or <API key> will be called on each <code>string</code> that will be put into a <code>Tree</code>, when they are read from files or otherwise created. Then <code>normalizeWholeTree</code> will be called on the <code>Tree</code>. It normally walks the <code>Tree</code> making whatever modifications it wishes to. A <code>TreeNormalizer</code> need not make a deep copy of a <code>Tree</code>. It is assumed to be able to work destructively, because afterwards we will only use the normalized <code>Tree</code>. <i>Implementation note:</i> This is a very old legacy class used in conjunction with PennTreeReader. It seems now that it would be better to move the string normalization into the tokenizer, and then we are just left with a (possibly destructive) TreeTransformer. @author Christopher Manning Code retrieved on the Stanford parser and ported to C </summary> public class TreeNormalizer { <summary> Normalizes a leaf contents (and maybe intern it). </summary> <param name="leaf">The string that decorates the leaf</param> <returns>The normalized form of this leaf String</returns> public virtual string NormalizeTerminal(string leaf) { return leaf; } <summary> Normalizes a nonterminal contents (and maybe intern it) </summary> <param name="category">The string that decorates this nonterminal node</param> <returns>The normalized form of this nonterminal String</returns> public virtual string <API key>(string category) { return category; } <summary> Normalize a whole tree -- this method assumes that the argument that it is passed is the root of a complete <code>Tree</code>. It is normally implemented as a Tree-walking routine. This method may return <code>null</code>. This is interpreted to mean that this is a tree that should not be included in further processing. PennTreeReader recognizes this return value, and asks for another Tree from the input Reader. </summary> <param name="tree">The tree to be normalized</param> <param name="tf">the TreeFactory to create new nodes (if needed)</param> <returns>the normalized tree</returns> public virtual Tree NormalizeWholeTree(Tree tree, ITreeFactory tf) { return tree; } } }
package com.iluwatar.tolerantreader; import java.io.IOException; /** * * Tolerant Reader is an integration pattern that helps creating robust communication systems. The * idea is to be as tolerant as possible when reading data from another service. This way, when the * communication schema changes, the readers must not break. * <p> * In this example we use Java serialization to write representations of {@link RainbowFish} objects * to file. {@link RainbowFish} is the initial version which we can easily read and write using * {@link <API key>} methods. {@link RainbowFish} then evolves to {@link RainbowFishV2} * and we again write it to file with a method designed to do just that. However, the reader client * does not know about the new format and still reads with the method designed for V1 schema. * Fortunately the reading method has been designed with the Tolerant Reader pattern and does not * break even though {@link RainbowFishV2} has new fields that are serialized. * */ public class App { public static void main(String[] args) throws IOException, <API key> { // Write V1 RainbowFish fishV1 = new RainbowFish("Zed", 10, 11, 12); System.out.println(String.format("fishV1 name=%s age=%d length=%d weight=%d", fishV1.getName(), fishV1.getAge(), fishV1.getLengthMeters(), fishV1.getWeightTons())); <API key>.writeV1(fishV1, "fish1.out"); // Read V1 RainbowFish deserializedFishV1 = <API key>.readV1("fish1.out"); System.out.println(String.format("deserializedFishV1 name=%s age=%d length=%d weight=%d", deserializedFishV1.getName(), deserializedFishV1.getAge(), deserializedFishV1.getLengthMeters(), deserializedFishV1.getWeightTons())); // Write V2 RainbowFishV2 fishV2 = new RainbowFishV2("Scar", 5, 12, 15, true, true, true); System.out.println(String.format( "fishV2 name=%s age=%d length=%d weight=%d sleeping=%b hungry=%b angry=%b", fishV2.getName(), fishV2.getAge(), fishV2.getLengthMeters(), fishV2.getWeightTons(), fishV2.getHungry(), fishV2.getAngry(), fishV2.getSleeping())); <API key>.writeV2(fishV2, "fish2.out"); // Read V2 with V1 method RainbowFish deserializedFishV2 = <API key>.readV1("fish2.out"); System.out.println(String.format("deserializedFishV2 name=%s age=%d length=%d weight=%d", deserializedFishV2.getName(), deserializedFishV2.getAge(), deserializedFishV2.getLengthMeters(), deserializedFishV2.getWeightTons())); } }
import { getAbsolutePath } from '../helpers'; import initContext from './initContext'; import <API key> from './helpers/<API key>'; /** * Builds the Roc configuration object without running the cli. */ export default function buildContext(dirPath, projectConfigPath, validate = true) { // Build the complete config object const context = initContext({ directory: getAbsolutePath(dirPath), projectConfigPath, verify: false, runtime: false, }); return <API key>(context, validate); }
package com.microsoft.azure.management.appservice.v2018_02_01; import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.management.appservice.v2018_02_01.implementation.<API key>; import com.microsoft.azure.arm.model.Indexable; import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.appservice.v2018_02_01.implementation.AppServiceManager; import java.util.Map; /** * Type representing TriggeredWebJob. */ public interface TriggeredWebJob extends HasInner<<API key>>, Indexable, Refreshable<TriggeredWebJob>, HasManager<AppServiceManager> { /** * @return the error value. */ String error(); /** * @return the extraInfoUrl value. */ String extraInfoUrl(); /** * @return the historyUrl value. */ String historyUrl(); /** * @return the id value. */ String id(); /** * @return the kind value. */ String kind(); /** * @return the latestRun value. */ TriggeredJobRun latestRun(); /** * @return the name value. */ String name(); /** * @return the runCommand value. */ String runCommand(); /** * @return the schedulerLogsUrl value. */ String schedulerLogsUrl(); /** * @return the settings value. */ Map<String, Object> settings(); /** * @return the type value. */ String type(); /** * @return the url value. */ String url(); /** * @return the usingSdk value. */ Boolean usingSdk(); /** * @return the webJobType value. */ WebJobType webJobType(); }
module Doorkeeper module Generators class ViewsGenerator < ::Rails::Generators::Base source_root File.expand_path('../../../../app/views/doorkeeper', __FILE__) desc 'Copies default Doorkeeper views to your application.' def manifest directory 'applications', 'app/views/doorkeeper/applications' directory 'authorizations', 'app/views/doorkeeper/authorizations' directory '<API key>, 'app/views/doorkeeper/<API key> end end end end
<!DOCTYPE html> <html lang="en"> <head> <title>Matrix Admin</title> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" href="css/bootstrap.min.css" /> <link rel="stylesheet" href="css/<API key>.min.css" /> <link rel="stylesheet" href="css/matrix-style.css" /> <link rel="stylesheet" href="css/matrix-media.css" /> <link href="font-awesome/css/font-awesome.css" rel="stylesheet" /> <link href='http://fonts.useso.com/css?family=Open+Sans:400,700,800' rel='stylesheet' type='text/css'> </head> <body> <!--Header-part <div id="header"> <h1><a href="dashboard.html">Matrix Admin</a></h1> </div> <!--close-Header-part <!--top-Header-menu <div id="user-nav" class="navbar navbar-inverse"> <ul class="nav"> <li class="dropdown" id="profile-messages" ><a title="" href="#" data-toggle="dropdown" data-target="#profile-messages" class="dropdown-toggle"><i class="icon icon-user"></i> <span class="text">Welcome User</span><b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="#"><i class="icon-user"></i> My Profile</a></li> <li class="divider"></li> <li><a href="#"><i class="icon-check"></i> My Tasks</a></li> <li class="divider"></li> <li><a href="login.html"><i class="icon-key"></i> Log Out</a></li> </ul> </li> <li class="dropdown" id="menu-messages"><a href="#" data-toggle="dropdown" data-target="#menu-messages" class="dropdown-toggle"><i class="icon icon-envelope"></i> <span class="text">Messages</span> <span class="label label-important">5</span> <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a class="sAdd" title="" href="#"><i class="icon-plus"></i> new message</a></li> <li class="divider"></li> <li><a class="sInbox" title="" href="#"><i class="icon-envelope"></i> inbox</a></li> <li class="divider"></li> <li><a class="sOutbox" title="" href="#"><i class="icon-arrow-up"></i> outbox</a></li> <li class="divider"></li> <li><a class="sTrash" title="" href="#"><i class="icon-trash"></i> trash</a></li> </ul> </li> <li class=""><a title="" href="#"><i class="icon icon-cog"></i> <span class="text">Settings</span></a></li> <li class=""><a title="" href="login.html"><i class="icon icon-share-alt"></i> <span class="text">Logout</span></a></li> </ul> </div> <!--start-top-serch <div id="search"> <input type="text" placeholder="Search here..."/> <button type="submit" class="tip-bottom" title="Search"><i class="icon-search icon-white"></i></button> </div> <!--close-top-serch <!--sidebar-menu <div id="sidebar"> <a href="#" class="visible-phone"><i class="icon icon-list"></i>Forms</a> <ul> <li><a href="index.html"><i class="icon icon-home"></i> <span>Dashboard</span></a> </li> <li><a href="charts.html"><i class="icon icon-signal"></i> <span>Charts &amp; graphs</span></a> </li> <li><a href="widgets.html"><i class="icon icon-inbox"></i> <span>Widgets</span></a> </li> <li><a href="tables.html"><i class="icon icon-th"></i> <span>Tables</span></a></li> <li><a href="grid.html"><i class="icon icon-fullscreen"></i> <span>Full width</span></a></li> <li class="submenu active"> <a href="#"><i class="icon icon-list"></i> <span>Forms</span> <span class="label label-important">3</span></a> <ul> <li><a href="form-common.html">Basic Form</a></li> <li><a href="form-validation.html">Form with Validation</a></li> <li><a href="form-wizard.html">Form with Wizard</a></li> </ul> </li> <li><a href="buttons.html"><i class="icon icon-tint"></i> <span>Buttons &amp; icons</span></a></li> <li><a href="interface.html"><i class="icon icon-pencil"></i> <span>Eelements</span></a></li> <li class="submenu"> <a href="#"><i class="icon icon-file"></i> <span>Addons</span> <span class="label label-important">5</span></a> <ul> <li><a href="index2.html">Dashboard2</a></li> <li><a href="gallery.html">Gallery</a></li> <li><a href="calendar.html">Calendar</a></li> <li><a href="invoice.html">Invoice</a></li> <li><a href="chat.html">Chat option</a></li> </ul> </li> <li class="submenu"> <a href="#"><i class="icon icon-info-sign"></i> <span>Error</span> <span class="label label-important">4</span></a> <ul> <li><a href="error403.html">Error 403</a></li> <li><a href="error404.html">Error 404</a></li> <li><a href="error405.html">Error 405</a></li> <li><a href="error500.html">Error 500</a></li> </ul> </li> <li class="content"> <span>Monthly Bandwidth Transfer</span> <div class="progress progress-mini progress-danger active progress-striped"> <div style="width: 77%;" class="bar"></div> </div> <span class="percent">77%</span> <div class="stat">21419.94 / 14000 MB</div> </li> <li class="content"> <span>Disk Space Usage</span> <div class="progress progress-mini active progress-striped"> <div style="width: 87%;" class="bar"></div> </div> <span class="percent">87%</span> <div class="stat">604.44 / 4000 MB</div> </li> </ul> </div> <div id="content"> <div id="content-header"> <div id="breadcrumb"> <a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> Home</a> <a href="#">Form elements</a> <a href="#" class="current">Form wizard</a> </div> <h1>Form wizard</h1> </div> <div class="container-fluid"><hr> <div class="row-fluid"> <div class="span12"> <div class="widget-box"> <div class="widget-title"> <span class="icon"> <i class="icon-pencil"></i> </span> <h5>Form wizard &amp; validation</h5> </div> <div class="widget-content nopadding"> <form id="form-wizard" class="form-horizontal" method="post"> <div id="form-wizard-1" class="step"> <div class="control-group"> <label class="control-label">Username</label> <div class="controls"> <input id="username" type="text" name="username" /> </div> </div> <div class="control-group"> <label class="control-label">Password</label> <div class="controls"> <input id="password" type="password" name="password" /> </div> </div> <div class="control-group"> <label class="control-label">Confirm Password</label> <div class="controls"> <input id="password2" type="password" name="password2" /> </div> </div> </div> <div id="form-wizard-2" class="step"> <div class="control-group"> <label class="control-label">Email</label> <div class="controls"> <input id="email" type="text" name="email" /> </div> </div> <div class="control-group"> <label class="control-label">EULA</label> <div class="controls"> <input id="eula" type="checkbox" name="eula" /> </div> </div> </div> <div class="form-actions"> <input id="back" class="btn btn-primary" type="reset" value="Back" /> <input id="next" class="btn btn-primary" type="submit" value="Next" /> <div id="status"></div> </div> <div id="submitted"></div> </form> </div> </div> </div> </div> </div> </div> <!--Footer-part <div class="row-fluid"> <div id="footer" class="span12"> 2013 &copy; Matrix Admin. More Templates <a href="http: </div> <!--end-Footer-part <script src="js/jquery.min.js"></script> <script src="js/jquery.ui.custom.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/jquery.validate.js"></script> <script src="js/jquery.wizard.js"></script> <script src="js/matrix.js"></script> <script src="js/matrix.wizard.js"></script> </body> </html>
<?php namespace Symfony\Component\Security\Guard\Firewall; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\Security\Guard\Guard<API key>; use Symfony\Component\Security\Guard\<API key>; use Symfony\Component\Security\Guard\Token\Pre<API key>; use Symfony\Component\Security\Core\Authentication\<API key>; use Psr\Log\LoggerInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\<API key>; use Symfony\Component\Security\Http\Firewall\ListenerInterface; use Symfony\Component\Security\Http\RememberMe\<API key>; /** * Authentication listener for the "guard" system. * * @author Ryan Weaver <ryan@knpuniversity.com> * @author Amaury Leroux de Lens <amaury@lerouxdelens.com> */ class Guard<API key> implements ListenerInterface { private $guardHandler; private $<API key>; private $providerKey; private $guardAuthenticators; private $logger; private $rememberMeServices; /** * @param Guard<API key> $guardHandler The Guard handler * @param <API key> $<API key> An <API key> instance * @param string $providerKey The provider (i.e. firewall) key * @param iterable|<API key>[] $guardAuthenticators The authenticators, with keys that match what's passed to Guard<API key> * @param LoggerInterface $logger A LoggerInterface instance */ public function __construct(Guard<API key> $guardHandler, <API key> $<API key>, string $providerKey, $guardAuthenticators, LoggerInterface $logger = null) { if (empty($providerKey)) { throw new \<API key>('$providerKey must not be empty.'); } $this->guardHandler = $guardHandler; $this-><API key> = $<API key>; $this->providerKey = $providerKey; $this->guardAuthenticators = $guardAuthenticators; $this->logger = $logger; } /** * Iterates over each authenticator to see if each wants to authenticate the request. */ public function handle(GetResponseEvent $event) { if (null !== $this->logger) { $context = array('firewall_key' => $this->providerKey); if ($this->guardAuthenticators instanceof \Countable || is_array($this->guardAuthenticators)) { $context['authenticators'] = count($this->guardAuthenticators); } $this->logger->debug('Checking for guard authentication credentials.', $context); } foreach ($this->guardAuthenticators as $key => $guardAuthenticator) { // get a key that's unique to *this* guard authenticator // this MUST be the same as Guard<API key> $uniqueGuardKey = $this->providerKey.'_'.$key; $this-><API key>($uniqueGuardKey, $guardAuthenticator, $event); if ($event->hasResponse()) { if (null !== $this->logger) { $this->logger->debug('The "{authenticator}" authenticator set the response. Any later authenticator will not be called', array('authenticator' => get_class($guardAuthenticator))); } break; } } } private function <API key>($uniqueGuardKey, <API key> $guardAuthenticator, GetResponseEvent $event) { $request = $event->getRequest(); try { if (null !== $this->logger) { $this->logger->debug('Calling getCredentials() on guard configurator.', array('firewall_key' => $this->providerKey, 'authenticator' => get_class($guardAuthenticator))); } // abort the execution of the authenticator if it doesn't support the request if (!$guardAuthenticator->supports($request)) { return; } // allow the authenticator to fetch authentication info from the request $credentials = $guardAuthenticator->getCredentials($request); if (null === $credentials) { throw new \<API key>(sprintf('The return value of "%1$s::getCredentials()" must not be null. Return false from "%1$s::supports()" instead.', get_class($guardAuthenticator))); } // create a token with the unique key, so that the provider knows which authenticator to use $token = new Pre<API key>($credentials, $uniqueGuardKey); if (null !== $this->logger) { $this->logger->debug('Passing guard token information to the Guard<API key>, array('firewall_key' => $this->providerKey, 'authenticator' => get_class($guardAuthenticator))); } // pass the token into the <API key> system // this indirectly calls Guard<API key>::authenticate() $token = $this-><API key>>authenticate($token); if (null !== $this->logger) { $this->logger->info('Guard authentication successful!', array('token' => $token, 'authenticator' => get_class($guardAuthenticator))); } // sets the token on the token storage, etc $this->guardHandler-><API key>($token, $request); } catch (<API key> $e) { // oh no! Authentication failed! if (null !== $this->logger) { $this->logger->info('Guard authentication failed.', array('exception' => $e, 'authenticator' => get_class($guardAuthenticator))); } $response = $this->guardHandler->handle<API key>($e, $request, $guardAuthenticator, $this->providerKey); if ($response instanceof Response) { $event->setResponse($response); } return; } // success! $response = $this->guardHandler->handle<API key>($token, $request, $guardAuthenticator, $this->providerKey); if ($response instanceof Response) { if (null !== $this->logger) { $this->logger->debug('Guard authenticator set success response.', array('response' => $response, 'authenticator' => get_class($guardAuthenticator))); } $event->setResponse($response); } else { if (null !== $this->logger) { $this->logger->debug('Guard authenticator set no success response: request continues.', array('authenticator' => get_class($guardAuthenticator))); } } // attempt to trigger the remember me functionality $this->triggerRememberMe($guardAuthenticator, $request, $token, $response); } /** * Should be called if this listener will support remember me. */ public function <API key>(<API key> $rememberMeServices) { $this->rememberMeServices = $rememberMeServices; } /** * Checks to see if remember me is supported in the authenticator and * on the firewall. If it is, the <API key> is notified. */ private function triggerRememberMe(<API key> $guardAuthenticator, Request $request, TokenInterface $token, Response $response = null) { if (null === $this->rememberMeServices) { if (null !== $this->logger) { $this->logger->debug('Remember me skipped: it is not configured for the firewall.', array('authenticator' => get_class($guardAuthenticator))); } return; } if (!$guardAuthenticator->supportsRememberMe()) { if (null !== $this->logger) { $this->logger->debug('Remember me skipped: your authenticator does not support it.', array('authenticator' => get_class($guardAuthenticator))); } return; } if (!$response instanceof Response) { throw new \LogicException(sprintf( '%s::on<API key> *must* return a Response if you want to use the remember me functionality. Return a Response, or set remember_me to false under the guard configuration.', get_class($guardAuthenticator) )); } $this->rememberMeServices->loginSuccess($request, $response, $token); } }
local name = 1 local children = 2 local function ancestry(which, node) if which == node[name] then return { node } end for _, child in ipairs(node[children] or {}) do local _ancestry = ancestry(which, child) if _ancestry then table.insert(_ancestry, 1, node) return _ancestry end end end local function add_child(node, child) node[children] = node[children] or {} table.insert(node[children], child) end local function remove_child(node, which) for i, child in ipairs(node[children]) do if which == child then table.remove(node[children], i) if #node[children] == 0 then node[children] = nil end end end end local function clone_tree(tree) local clone = {} for k, v in pairs(tree) do if type(v) == 'table' then clone[k] = clone_tree(v) else clone[k] = v end end return clone end local function pov_from(node_name) return { of = function(tree) tree = clone_tree(tree) local ancestry = ancestry(node_name, tree) for i = 1, #ancestry - 1 do remove_child(ancestry[i], ancestry[i + 1]) add_child(ancestry[i + 1], ancestry[i]) end return ancestry[#ancestry] end } end local function path_from(source) return { to = function(destination) return { of = function(tree) local ancestry = ancestry(destination, pov_from(source).of(tree)) local path = {} for _, node in ipairs(ancestry) do table.insert(path, node[name]) end return path end } end } end return { pov_from = pov_from, path_from = path_from }
using System; using JetBrains.Annotations; using UnitsNet.Units; // ReSharper disable once CheckNamespace namespace UnitsNet { // Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components // Public structures can't have any members other than public fields, and those fields must be value types or strings. // Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic. public sealed partial class Length { private const double InchesInOneFoot = 12; <summary> Converts the length to a customary feet/inches combination. </summary> public FeetInches FeetInches { get { var inInches = Inches; var feet = Math.Truncate(inInches / InchesInOneFoot); var inches = inInches % InchesInOneFoot; return new FeetInches(feet, inches); } } <summary> Get length from combination of feet and inches. </summary> public static Length FromFeetInches(double feet, double inches) { return FromInches(InchesInOneFoot*feet + inches); } } public sealed class FeetInches { public FeetInches(double feet, double inches) { Feet = feet; Inches = inches; } public double Feet { get; } public double Inches { get; } public override string ToString() { return ToString(null); } public string ToString([CanBeNull] string cultureInfo) { // Note that it isn't customary to use fractions - one wouldn't say "I am 5 feet and 4.5 inches". // So inches are rounded when converting from base units to feet/inches. var footUnit = <API key>.Default.<API key>(LengthUnit.Foot); var inchUnit = <API key>.Default.<API key>(LengthUnit.Inch); return string.Format(GlobalConfiguration.DefaultCulture, "{0:n0} {1} {2:n0} {3}", Feet, footUnit, Math.Round(Inches), inchUnit); } } }
function <API key>(eventobject) { return <API key>.call(this); }
@namespace liberator url("http://vimperator.org/namespaces/liberator"); [liberator|highlight~=HintImage], [liberator|highlight~=Hint] { z-index: 5000; position: absolute !important; } [liberator|highlight~=Search] { display: inline !important; } /* Applied only to completion buffer and MOW */ @-moz-document url-prefix(chrome://liberator/) { *:-moz-loading, *:-moz-broken { display: none !important; } [liberator|highlight~=Completions] { width: 100%; display: table; } [liberator|highlight~=CompItem], [liberator|highlight~=CompTitle] { display: table-row; } [liberator|highlight~=Completions] > ul { display: table-row; } [liberator|highlight~=CompItem] > *, [liberator|highlight~=CompTitle] > * { /* disabled for now, since it throws SecurityErrors to the console */ /* -moz-binding: url(chrome://liberator/content/bindings.xml#compitem-td); */ display: table-cell; vertical-align: middle; } [liberator|highlight~=CompMsg] { height: 1.5em; line-height: 1.5em !important; } .td-span { display: inline-block; overflow: visible; width: 0px; height: 1.5em; line-height: 1.5em !important; } .td-strut { display: inline-block; vertical-align: middle; height: 16px; width: 0px; } .extra-info { color: gray; } .times-executed, .time-average { color: green; } .time-total { color: red; } } /* Applied to completion buffer, MOW, browser window */ @-moz-document url-prefix(chrome: .liberator-container > * { font-family: inherit; } .liberator-floatbox { position: fixed; width: 100%; height: 100%; z-index: 1000; } .liberator-container.animation[collapsed='true'] { opacity: 0; pointer-events: none; max-height: 10px !important; min-height: 10px; } .liberator-floatbox #<API key>, .liberator-floatbox #<API key> { background-color: transparent; } .liberator-floatbox > iframe { height: 100%; width: 100%; } .liberator-container.animation { transition: all 0.2s; } #<API key> { -moz-user-focus: ignore; overflow: -moz-scrollbars-none !important; border-width: 0px !important; } #liberator-bottombar:-moz-lwtheme { text-shadow: none; } /* all elements in the statusline and commandline need some padding to look good */ #<API key> { font-family: monospace; margin: 0px; -moz-appearance: none; border: none !important; min-height: 16px !important; } #<API key>:not([customizing="true"]) :-moz-any(toolbarbutton) { border: none !important; padding: 0 0px !important; background: transparent !important; height: 16px !important; } #<API key> > *, #<API key> > * { padding: 0px 2px; font-family: monospace; } #<API key>.hidden { opacity: 0; pointer-events: none; /* so we can click through when the command line is hidden */ } #<API key>, #<API key> { -moz-box-align: center; } #<API key>[customizing="true"] :-moz-any(#<API key>, #<API key>, #liberator-status) { border: 1px dotted gray; min-width: 1em; min-height: 1em; } #liberator-status > * { padding: 0 1px; margin: 0; } #<API key> { -moz-appearance: none; width: 16px; height: 16px; visibility: collapse; -moz-image-region: rect(0, 16px, 16px, 0); } #<API key>.verifiedIdentity { visibility: visible; list-style-image: url(chrome://browser/skin/<API key>.png); } #<API key>.verifiedDomain { visibility: visible; list-style-image: url(chrome://browser/skin/<API key>.png); } #<API key>.mixedActiveContent { visibility: visible; list-style-image: url(chrome://browser/skin/<API key>.png); } #<API key> { background-color: inherit; margin: 0px; } #<API key> { background-color: inherit; color: inherit; margin: 0px; } #liberator-message { margin: 0px; } .liberator-hiding { opacity: 0; visibility: collapse; transition-property: opacity, visibility; transition-duration: .5s; } #sidebar { max-width: 90% !important; min-width: 10% !important; } /* MOW */ #<API key>, #<API key>, #<API key> { overflow: hidden; background-color: white; color: black; } #<API key>, #<API key>, #<API key> { white-space: pre; font-family: -moz-fixed; margin: 0px; } #<API key> *, #<API key> *, #<API key> *, #<API key> { font: inherit; } #<API key> { max-width: 0; transition-property: max-width; transition-duration: 0.25s; } #<API key> table, #<API key> table { white-space: inherit; border-spacing: 0px; } #<API key> td, #<API key> td, #<API key> th, #<API key> th { padding: 0px 2px; } /* for muttator's composer */ #content-frame, #appcontent { border: 0px; } } /* vim: set fdm=marker sw=4 ts=4 et: */
/** * @requires OpenLayers/Control.js */ /** * Class: OpenLayers.Control.MousePosition * The MousePosition control displays geographic coordinates of the mouse * pointer, as it is moved about the map. * * Inherits from: * - <OpenLayers.Control> */ OpenLayers.Control.MGRSMousePosition = OpenLayers.Class(OpenLayers.Control, { /** * Property: element * {DOMElement} */ element: null, /** * APIProperty: prefix * {String} */ prefix: '', /** * APIProperty: separator * {String} */ separator: ', ', /** * APIProperty: suffix * {String} */ suffix: '', /** * APIProperty: numDigits * {Integer} */ numDigits: 5, /** * APIProperty: granularity * {Integer} */ granularity: 10, /** * Property: lastXy * {<OpenLayers.Pixel>} */ lastXy: null, /** * APIProperty: displayProjection * {<OpenLayers.Projection>} The projection in which the * mouse position is displayed */ displayProjection: null, /** * Constructor: OpenLayers.Control.MousePosition * * Parameters: * options - {Object} Options for control. */ initialize: function(options) { OpenLayers.Control.prototype.initialize.apply(this, arguments); }, /** * Method: destroy */ destroy: function() { if (this.map) { this.map.events.unregister('mousemove', this, this.redraw); } OpenLayers.Control.prototype.destroy.apply(this, arguments); }, /** * Method: draw * {DOMElement} */ draw: function() { OpenLayers.Control.prototype.draw.apply(this, arguments); if (!this.element) { this.div.left = ""; this.div.top = ""; this.element = this.div; } this.redraw(); return this.div; }, /** * Method: redraw */ redraw: function(evt) { var lonLat; if (evt == null) { lonLat = new OpenLayers.LonLat(0, 0); } else { if (this.lastXy == null || Math.abs(evt.xy.x - this.lastXy.x) > this.granularity || Math.abs(evt.xy.y - this.lastXy.y) > this.granularity) { this.lastXy = evt.xy; return; } lonLat = this.map.getLonLatFromPixel(evt.xy); if (!lonLat) { // map has not yet been properly initialized return; } if (this.displayProjection) { lonLat.transform(this.map.getProjectionObject(), this.displayProjection ); } this.lastXy = evt.xy; } var newHtml = this.formatOutput(lonLat); if (newHtml != this.element.innerHTML) { this.element.innerHTML = newHtml; } }, /** * Method: formatOutput * Override to provide custom display output * * Parameters: * lonLat - {<OpenLayers.LonLat>} Location to display */ formatOutput: function(lonLat) { var inches=OpenLayers.INCHES_PER_UNIT; var metersPerPixel = this.map.getResolution()*(inches[this.map.getUnits()]*(1/inches['m'])); var mgdigits = parseInt(6-Math.ceil(Math.log(metersPerPixel)/2.302585092994046)); var digits = parseInt(this.numDigits); var mgrs = new USNG2(); if ((lonLat.lat > -80) && (lonLat.lat < 80)) { var mgrsStr = mgrs.fromLonLat(lonLat, mgdigits-1); } else { var mgrsStr = 'undefined'; } var newHtml = this.prefix + lonLat.lon.toFixed(digits) + this.separator + lonLat.lat.toFixed(digits) + " / MGRS: " + mgrsStr + this.suffix; return newHtml; }, /** * Method: setMap */ setMap: function() { OpenLayers.Control.prototype.setMap.apply(this, arguments); this.map.events.register( 'mousemove', this, this.redraw); }, CLASS_NAME: "OpenLayers.Control.MousePosition" });
package com.microsoft.azure.management.recoveryservices.backup.v2017_07_01; import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; /** * Additional information on backup engine. */ public class <API key> { /** * Database name of backup engine. */ @JsonProperty(value = "databaseName") private String databaseName; /** * Number of protected items in the backup engine. */ @JsonProperty(value = "protectedItemsCount") private Integer protectedItemsCount; /** * Number of protected servers in the backup engine. */ @JsonProperty(value = "<API key>") private Integer <API key>; /** * Number of disks in the backup engine. */ @JsonProperty(value = "diskCount") private Integer diskCount; /** * Diskspace used in the backup engine. */ @JsonProperty(value = "usedDiskSpace") private Double usedDiskSpace; /** * Diskspace currently available in the backup engine. */ @JsonProperty(value = "availableDiskSpace") private Double availableDiskSpace; /** * Last refresh time in the backup engine. */ @JsonProperty(value = "refreshedAt") private DateTime refreshedAt; /** * Protected instances in the backup engine. */ @JsonProperty(value = "<API key>") private Integer <API key>; /** * Get database name of backup engine. * * @return the databaseName value */ public String databaseName() { return this.databaseName; } /** * Set database name of backup engine. * * @param databaseName the databaseName value to set * @return the <API key> object itself. */ public <API key> withDatabaseName(String databaseName) { this.databaseName = databaseName; return this; } /** * Get number of protected items in the backup engine. * * @return the protectedItemsCount value */ public Integer protectedItemsCount() { return this.protectedItemsCount; } /** * Set number of protected items in the backup engine. * * @param protectedItemsCount the protectedItemsCount value to set * @return the <API key> object itself. */ public <API key> <API key>(Integer protectedItemsCount) { this.protectedItemsCount = protectedItemsCount; return this; } /** * Get number of protected servers in the backup engine. * * @return the <API key> value */ public Integer <API key>() { return this.<API key>; } /** * Set number of protected servers in the backup engine. * * @param <API key> the <API key> value to set * @return the <API key> object itself. */ public <API key> <API key>(Integer <API key>) { this.<API key> = <API key>; return this; } /** * Get number of disks in the backup engine. * * @return the diskCount value */ public Integer diskCount() { return this.diskCount; } /** * Set number of disks in the backup engine. * * @param diskCount the diskCount value to set * @return the <API key> object itself. */ public <API key> withDiskCount(Integer diskCount) { this.diskCount = diskCount; return this; } /** * Get diskspace used in the backup engine. * * @return the usedDiskSpace value */ public Double usedDiskSpace() { return this.usedDiskSpace; } /** * Set diskspace used in the backup engine. * * @param usedDiskSpace the usedDiskSpace value to set * @return the <API key> object itself. */ public <API key> withUsedDiskSpace(Double usedDiskSpace) { this.usedDiskSpace = usedDiskSpace; return this; } /** * Get diskspace currently available in the backup engine. * * @return the availableDiskSpace value */ public Double availableDiskSpace() { return this.availableDiskSpace; } /** * Set diskspace currently available in the backup engine. * * @param availableDiskSpace the availableDiskSpace value to set * @return the <API key> object itself. */ public <API key> <API key>(Double availableDiskSpace) { this.availableDiskSpace = availableDiskSpace; return this; } /** * Get last refresh time in the backup engine. * * @return the refreshedAt value */ public DateTime refreshedAt() { return this.refreshedAt; } /** * Set last refresh time in the backup engine. * * @param refreshedAt the refreshedAt value to set * @return the <API key> object itself. */ public <API key> withRefreshedAt(DateTime refreshedAt) { this.refreshedAt = refreshedAt; return this; } /** * Get protected instances in the backup engine. * * @return the <API key> value */ public Integer <API key>() { return this.<API key>; } /** * Set protected instances in the backup engine. * * @param <API key> the <API key> value to set * @return the <API key> object itself. */ public <API key> <API key>(Integer <API key>) { this.<API key> = <API key>; return this; } }
#string-mask A string formatter and validator based on masks. ## Installation ## With npm javascript npm install --save string-mask With bower javascript bower install --save string-mask ## Special mask's characters ## Character | Description | `0` | Any numbers `9` | Any numbers (Optional) `#` | Any numbers (recursive) `A` | Any aphanumeric character __Not implemented yet__ `a` | Any aphanumeric character (Optional) __Not implemented yet__ `S` | Any letter `U` | Any letter (All lower case character will be mapped to uppercase) __Not implemented yet__ `L` | Any letter (All upper case character will be mapped to lowercase) __Not implemented yet__ `$` | Escape character, used to escape any of the special formatting characters. ## Usage ## Number javascript var formatter = new StringMask(' var result = formatter.apply('123'); // 123 Two Decimal number with thousands separators javascript var formatter = new StringMask('#.##0,00', {reverse: true}); var result = formatter.apply('100123456'); // 1.001.234,56 result = formatter.apply('6'); // 0,06 Phone number javascript var formatter = new StringMask('+00 (00) 0000-0000'); var result = formatter.apply('553122222222'); // +55 (31) 2222-2222 Percentage javascript var formatter = new StringMask('#0,00%'); var result = formatter.apply('001'); // 0,01% Brazilian CPF number javascript var formatter = new StringMask('000.000.000-00'); var result = formatter.apply('12965815620'); // 129.658.156-20 Date and time javascript var formatter = new StringMask('90/90/9900'); var result = formatter.apply('1187'); // 1/1/87
import { module, test } from 'qunit'; import { setupTest } from 'ember-qunit'; import { build } from '<API key>'; import { inlineSetup } from '../../helpers/utility-methods'; module('FixtureConverter', function(hooks) { setupTest(hooks); inlineSetup(hooks, '-rest'); test("#<API key> with custom serializer keyForAttribute function", function(assert) { let buildJson = build('manager'); buildJson.unwrap(); let expectedJson = { manager: { id: 1, name: { first_name: 'Tyrion', last_name: 'Lannister' } } }; assert.deepEqual(buildJson, expectedJson); }); test("With a custom transform", function(assert) { let buildJson = build('rod'); buildJson.unwrap(); let expectedJson = { rod: { id: 1, element: 'C' } }; assert.deepEqual(buildJson, expectedJson); }); });
// <auto-generated/> #nullable disable using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.Network.Models { <summary> Result of the request to list P2SVpnGateways. It contains a list of P2SVpnGateways and a URL nextLink to get the next set of results. </summary> public partial class <API key> { <summary> Initializes a new instance of <API key>. </summary> internal <API key>() { Value = new ChangeTrackingList<P2SVpnGateway>(); } <summary> Initializes a new instance of <API key>. </summary> <param name="value"> List of P2SVpnGateways. </param> <param name="nextLink"> URL to get the next set of operation list results if there are any. </param> internal <API key>(IReadOnlyList<P2SVpnGateway> value, string nextLink) { Value = value; NextLink = nextLink; } <summary> List of P2SVpnGateways. </summary> public IReadOnlyList<P2SVpnGateway> Value { get; } <summary> URL to get the next set of operation list results if there are any. </summary> public string NextLink { get; } } }
declare module '*.html' { const value: string; export default value; }
module Evercookie # adds additional things to rails engine module Rails # adds additional things to rails engine class Engine < ::Rails::Engine # adds ec.js to be precompiled initializer "evercookie precompile hook" do |app| app.config.assets.precompile << /ec\.js/ end # registers view helpers config.after_initialize do ActionView::Base.send(:include, Evercookie::ViewHelper) end end end end
<?php namespace Maverick\Console\Command\Build\Step; use <API key>; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use org\bovigo\vfs\vfsStream; use RuntimeException; class <API key> extends <API key> { public function <API key>() { $content = 'the expected script content'; $environment = 'test'; $root = vfsStream::setup(); $source = vfsStream::newFile('app/' . $environment . '.php')->at($root)->withContent($content); $destination = vfsStream::newFile('public/index.php')->at($root)->withContent('bad content'); $instance = new CopyScriptBuildStep(); $instance->configure($this->getMockCommand(), $environment, $root->url()) ->execute($this->getMockInput(), $this->getMockOutput()); $this->assertEquals($content, $destination->getContent()); } public function <API key>() { $environment = 'test'; $root = vfsStream::setup()->url(); $source = $root . '/app/' . $environment . '.php'; $this->expectException(RuntimeException::class); $this-><API key>('Could not find script for ' . $environment . ' at ' . $source); $instance = new CopyScriptBuildStep(); $instance->configure($this->getMockCommand(), $environment, $root) ->execute($this->getMockInput(), $this->getMockOutput()); } protected function getMockCommand() { return $this->getMockBuilder(Command::class) -><API key>() ->getMock(); } protected function getMockInput() { return $this->getMockBuilder(InputInterface::class) ->getMock(); } protected function getMockOutput() { return $this->getMockBuilder(OutputInterface::class) ->getMock(); } }
package peco import ( "fmt" "os" "strings" "time" "github.com/nsf/termbox-go" "github.com/peco/peco/keyseq" ) // Keymap holds all the key sequence to action map type Keymap struct { Config map[string]string Action map[string][]string // custom actions Keyseq *keyseq.Keyseq } // NewKeymap creates a new Keymap struct func NewKeymap(config map[string]string, actions map[string][]string) Keymap { return Keymap{config, actions, keyseq.New()} } // Handler returns the appropriate action for the given termbox event func (km Keymap) Handler(ev termbox.Event) Action { modifier := keyseq.ModNone if (ev.Mod & termbox.ModAlt) != 0 { modifier = keyseq.ModAlt } key := keyseq.Key{modifier, ev.Key, ev.Ch} action, err := km.Keyseq.AcceptKey(key) switch err { case nil: // Found an action! trace("Keymap.Handler: Fetched action") return wrapClearSequence(action.(Action)) case keyseq.ErrInSequence: trace("Keymap.Handler: Waiting for more commands...") return <API key>(ActionFunc(doNothing)) default: trace("Keymap.Handler: Defaulting to doAcceptChar") return wrapClearSequence(ActionFunc(doAcceptChar)) } } func <API key>(a Action) Action { return ActionFunc(func(i *Input, ev termbox.Event) { s, err := keyseq.EventToString(ev) if err == nil { i.currentKeySeq = append(i.currentKeySeq, s) i.SendStatusMsg(strings.Join(i.currentKeySeq, " ")) } a.Execute(i, ev) }) } func wrapClearSequence(a Action) Action { return ActionFunc(func(i *Input, ev termbox.Event) { s, err := keyseq.EventToString(ev) if err == nil { i.currentKeySeq = append(i.currentKeySeq, s) } if len(i.currentKeySeq) > 0 { i.<API key>(strings.Join(i.currentKeySeq, " "), 500*time.Millisecond) i.currentKeySeq = []string{} } a.Execute(i, ev) }) } const <API key> = 100 func (km Keymap) resolveActionName(name string, depth int) (Action, error) { if depth >= <API key> { return nil, fmt.Errorf("error: Could not resolve %s: deep recursion", name) } // Can it be resolved via regular nameToActions ? v, ok := nameToActions[name] if ok { return v, nil } // Can it be resolved via combined actions? l, ok := km.Action[name] if ok { actions := []Action{} for _, actionName := range l { child, err := km.resolveActionName(actionName, depth+1) if err != nil { return nil, err } actions = append(actions, child) } v = makeCombinedAction(actions...) nameToActions[name] = v return v, nil } return nil, fmt.Errorf("error: Could not resolve %s: no such action", name) } // ApplyKeybinding applies all of the custom key bindings on top of // the default key bindings func (km Keymap) ApplyKeybinding() { k := km.Keyseq k.Clear() // Copy the map kb := map[string]Action{} for s, a := range defaultKeyBinding { kb[s] = a } // munge the map using config for s, as := range km.Config { if as == "-" { delete(kb, s) continue } v, err := km.resolveActionName(as, 0) if err != nil { fmt.Fprintln(os.Stderr, err) continue } kb[s] = v } // now compile using kb for s, a := range kb { list, err := keyseq.ToKeyList(s) if err != nil { fmt.Fprintf(os.Stderr, "Unknown key %s: %s", s, err) continue } k.Add(list, a) } k.Compile() } // TODO: this needs to be fixed. func (km Keymap) hasModifierMaps() bool { return false }
package com.microsoft.azure.management.recoveryservices.backup.v2017_07_01; import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; import com.microsoft.rest.<API key>; /** * Defines values for JobStatus. */ public final class JobStatus extends <API key><JobStatus> { /** Static value Invalid for JobStatus. */ public static final JobStatus INVALID = fromString("Invalid"); /** Static value InProgress for JobStatus. */ public static final JobStatus IN_PROGRESS = fromString("InProgress"); /** Static value Completed for JobStatus. */ public static final JobStatus COMPLETED = fromString("Completed"); /** Static value Failed for JobStatus. */ public static final JobStatus FAILED = fromString("Failed"); /** Static value <API key> for JobStatus. */ public static final JobStatus <API key> = fromString("<API key>"); /** Static value Cancelled for JobStatus. */ public static final JobStatus CANCELLED = fromString("Cancelled"); /** Static value Cancelling for JobStatus. */ public static final JobStatus CANCELLING = fromString("Cancelling"); /** * Creates or finds a JobStatus from its string representation. * @param name a name to look for * @return the corresponding JobStatus */ @JsonCreator public static JobStatus fromString(String name) { return fromString(name, JobStatus.class); } /** * @return known JobStatus values */ public static Collection<JobStatus> values() { return values(JobStatus.class); } }
require 'test_helper' class Admin::<API key> < ActionDispatch::IntegrationTest setup do @group = create(:group) end test 'should get index' do get admin_groups_url assert_response :success end test 'should get new' do get new_admin_group_url assert_response :success end test 'should create group' do assert_difference('Group.count') do post admin_groups_url, params: { group: { name: 'Group' } } end <API key> admin_groups_url end test 'should get edit' do get <API key>(@group) assert_response :success end test 'should update group' do patch admin_group_url(@group), params: { group: { name: 'Renamed group' } } <API key> admin_groups_url end test 'should destroy group' do assert_difference('Group.count', -1) do delete admin_group_url(@group) end <API key> admin_groups_url end end
button, html input[type="button"], input[type="reset"], input[type="submit"] { -webkit-appearance: button; cursor: pointer; } [role="button"] { cursor: pointer; } .tooltip { position: absolute; z-index: 1070; display: block; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: normal; font-weight: normal; letter-spacing: normal; line-break: auto; line-height: 1.42857143; text-align: left; text-align: start; text-decoration: none; text-shadow: none; text-transform: none; white-space: normal; word-break: normal; word-spacing: normal; word-wrap: normal; font-size: 12px; opacity: 0; filter: alpha(opacity=0); } .tooltip.in { opacity: 0.9; filter: alpha(opacity=90); } .tooltip.top { margin-top: -3px; padding: 5px 0; } .tooltip.right { margin-left: 3px; padding: 0 5px; } .tooltip.bottom { margin-top: 3px; padding: 5px 0; } .tooltip.left { margin-left: -3px; padding: 0 5px; } .tooltip-inner { max-width: 200px; padding: 3px 8px; color: #ffffff; text-align: center; background-color: #000000; border-radius: 4px; } .tooltip-arrow { position: absolute; width: 0; height: 0; border-color: transparent; border-style: solid; } .tooltip.top .tooltip-arrow { bottom: 0; left: 50%; margin-left: -5px; border-width: 5px 5px 0; border-top-color: #000000; } .tooltip.top-left .tooltip-arrow { bottom: 0; right: 5px; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #000000; } .tooltip.top-right .tooltip-arrow { bottom: 0; left: 5px; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #000000; } .tooltip.right .tooltip-arrow { top: 50%; left: 0; margin-top: -5px; border-width: 5px 5px 5px 0; border-right-color: #000000; } .tooltip.left .tooltip-arrow { top: 50%; right: 0; margin-top: -5px; border-width: 5px 0 5px 5px; border-left-color: #000000; } .tooltip.bottom .tooltip-arrow { top: 0; left: 50%; margin-left: -5px; border-width: 0 5px 5px; border-bottom-color: #000000; } .tooltip.bottom-left .tooltip-arrow { top: 0; right: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #000000; } .tooltip.bottom-right .tooltip-arrow { top: 0; left: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #000000; } .clearfix:before, .clearfix:after { content: " "; display: table; } .clearfix:after { clear: both; } .center-block { display: block; margin-left: auto; margin-right: auto; } .pull-right { float: right !important; } .pull-left { float: left !important; } .hide { display: none !important; } .show { display: block !important; } .invisible { visibility: hidden; } .text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; } .hidden { display: none !important; } .affix { position: fixed; }
import electron from "electron"; import { actions } from "common/actions"; import { Store } from "common/types"; import IntlMessageFormat from "intl-messageformat"; import env from "common/env"; import { _ } from "renderer/t"; import { t } from "common/format/t"; const emptyObj: any = {}; export function <API key>( wc: Electron.WebContents, wind: string, store: Store ) { wc.on("context-menu", (e, props) => { const { i18n } = store.getState(); const editFlags = props.editFlags; const hasText = props.selectionText.trim().length > 0; const can = (type: string) => ((editFlags as any)[`can${type}`] as boolean) && hasText; let menuTpl: Electron.<API key>[] = [ { type: "separator", }, { id: "cut", label: t(i18n, _("web.context_menu.cut")), // needed because of macOS limitation: role: can("Cut") ? "cut" : null, enabled: can("Cut"), visible: props.isEditable, }, { id: "copy", label: t(i18n, _("web.context_menu.copy")), role: can("Copy") ? "copy" : null, enabled: can("Copy"), visible: props.isEditable || hasText, }, { id: "paste", label: t(i18n, _("web.context_menu.paste")), role: editFlags.canPaste ? "paste" : null, enabled: editFlags.canPaste, visible: props.isEditable, }, { type: "separator", }, ]; if (props.linkURL && props.mediaType === "none") { menuTpl = []; if (store.getState().preferences.enableTabs) { menuTpl = [ menuTpl, { type: "separator", }, { id: "openInNewTab", label: t(i18n, _("web.context_menu.open_in_new_tab")), click() { store.dispatch( actions.navigate({ wind, url: props.linkURL, background: true, }) ); }, }, ]; } menuTpl = [ menuTpl, { type: "separator", }, { id: "copyLink", label: t(i18n, _("web.context_menu.copy_link")), click() { if (process.platform === "darwin") { electron.clipboard.writeBookmark(props.linkText, props.linkURL); } else { electron.clipboard.writeText(props.linkURL); } }, }, { type: "separator", }, ]; } // filter out leading/trailing separators menuTpl = delUnusedElements(menuTpl); if (env.development) { menuTpl.push({ id: "inspect", label: t(i18n, _("web.context_menu.inspect")), click() { store.dispatch( actions.inspect({ webContentsId: wc.id, x: props.x, y: props.y, }) ); }, }); } if (menuTpl.length > 0) { const menu = (electron.Menu || electron.remote.Menu).buildFromTemplate( menuTpl as any ); menu.popup({}); } }); } function delUnusedElements(menuTpl: Electron.<API key>[]) { let notDeletedPrevEl: Electron.<API key>; return menuTpl .filter((el) => el.visible !== false) .filter((el, i, arr) => { const toDelete = el.type === "separator" && (!notDeletedPrevEl || i === arr.length - 1 || arr[i + 1].type === "separator"); notDeletedPrevEl = toDelete ? notDeletedPrevEl : el; return !toDelete; }); }
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.Controls\0.18.8\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Fuse.Animations.IResize.h> #include <Fuse.Controls.Shape.h> #include <Fuse.IActualPlacement.h> #include <Fuse.Navigation.INavigationPanel.h> #include <Fuse.Node.h> #include <Fuse.Scripting.INameScope.h> #include <Fuse.Triggers.Actions.ICollapse.h> #include <Fuse.Triggers.Actions.IHide.h> #include <Fuse.Triggers.Actions.IShow.h> #include <Fuse.Triggers.IAddRemove-1.h> namespace g{namespace Fuse{namespace Controls{struct Path;}}} namespace g{namespace Fuse{namespace Drawing{struct PathGeometry;}}} namespace g{namespace Fuse{namespace Internal{struct SizingContainer;}}} namespace g{ namespace Fuse{ namespace Controls{ // public sealed class Path :2659 ::g::Fuse::Controls::Panel_type* Path_typeof(); void Path__ctor_5_fn(Path* __this); void <API key>(Path* __this, int* __retval); void <API key>(Path* __this, int* value); void Path__get_Data_fn(Path* __this, uString** __retval); void Path__set_Data_fn(Path* __this, uString* value); void <API key>(Path* __this, int* __retval); void <API key>(Path* __this, int* value); void <API key>(Path* __this, int* __retval); void <API key>(Path* __this, int* value); void <API key>(Path* __this, ::g::Fuse::Drawing::PathGeometry** __retval); void <API key>(Path* __this, ::g::Fuse::Drawing::PathGeometry* value); void Path__New2_fn(Path** __retval); void <API key>(Path* __this, int* __retval); void <API key>(Path* __this, int* value); void Path__get_Sizing_fn(Path* __this, ::g::Fuse::Internal::SizingContainer** __retval); void <API key>(Path* __this, int* __retval); void <API key>(Path* __this, int* value); void <API key>(Path* __this, int* __retval); void <API key>(Path* __this, int* value); struct Path : ::g::Fuse::Controls::Shape { int _fillRule; int _fitMode; uStrong< ::g::Fuse::Drawing::PathGeometry*> _geometry; int _scaleMode; uStrong< ::g::Fuse::Internal::SizingContainer*> sizing; void ctor_5(); int ContentAlignment(); void ContentAlignment(int value); uString* Data(); void Data(uString* value); int FillRule(); void FillRule(int value); int FitMode(); void FitMode(int value); ::g::Fuse::Drawing::PathGeometry* Geometry(); void Geometry(::g::Fuse::Drawing::PathGeometry* value); int ScaleMode(); void ScaleMode(int value); ::g::Fuse::Internal::SizingContainer* Sizing(); int StretchDirection(); void StretchDirection(int value); int StretchMode(); void StretchMode(int value); static Path* New2(); }; }}} // ::g::Fuse::Controls
@extends(config('seneschal.layout')) {{-- Web site Title --}} @section('title', 'View Group') {{-- Content --}} @section('content') <div class="row"> <div class="twelve columns"> <h4>{{ $group['name'] }} Group</h4> </div> </div> <div class="row"> <div class="six columns"> <strong>Permissions:</strong> <ul> @foreach ($group->getPermissions() as $key => $value) <li>{{ ucfirst($key) }}</li> @endforeach </ul> </div> <div class="six columns"> <div class="medium info btn"> <a onClick="location.href='{{ route('seneschal.groups.edit', array($group->hash)) }}'">Edit Group</a> </div> </div> </div> <div class="row"> <h4>Group Object</h4> <code>{{ var_dump($group) }}</code> </div> @stop
<!DOCTYPE html PUBLIC "- <html xmlns="http: <meta> <!-- Stylesheets --> <link href="../web.css" type="text/css" rel="stylesheet"></link> <link href="../pygmentize.css" type="text/css" rel="stylesheet"></link> <title>VLFeat - Documentation - C API</title> <link rel="stylesheet" type="text/css" href="../doxygen.css"></style> <!-- Scripts--> </meta> <!-- Body Start --> <body> <div id="header"> <!-- Google CSE Search Box Begins --> <form action="http: <div> <input type="hidden" name="cx" value="<API key>:oq23albfeam"></input> <input type="hidden" name="cof" value="FORID:11"></input> <input type="hidden" name="ie" value="UTF-8"></input> <input type="text" name="q" size="31"></input> <input type="submit" name="sa" value="Search"></input> </div> </form> <script src="http: <!-- Google CSE Search Box Ends --> <h1><a shape="rect" href="../index.html" class="plain"><span id="vlfeat">VLFeat</span><span id="dotorg">.org</span></a></h1> </div> <div id="headbanner"> Documentation - C API </div> <div id="pagebody"> <div id="sidebar"> <!-- Navigation Start --> <ul> <li><a href="../index.html">Home</a> </li> <li><a href="../download.html">Download</a> </li> <li><a href="../doc.html">Documentation</a> <ul> <li><a href="../mdoc/mdoc.html">Matlab API</a> </li> <li><a href="index.html" class='active' >C API</a> </li> <li><a href="../man/man.html">Man pages</a> </li> </ul></li> <li><a href="../overview/tut.html">Tutorials</a> </li> <li><a href="../applications/apps.html">Applications</a> </li> </ul> </div> <!-- sidebar --> <div id="content"> <link rel="stylesheet" type="text/css" href="../doxygen.css"></style> <div class="doxygen"> <div> <!-- Generated by Doxygen 1.7.5.1 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="pages.html"><span>Related&#160;Pages</span></a></li> <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Data Structures</a> &#124; <a href="#define-members">Defines</a> &#124; <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">mexutils.h File Reference</div> </div> </div> <div class="contents"> <p>MEX utilities. <a href="#details">More...</a></p> <div class="textblock"><code>#include &quot;mex.h&quot;</code><br/> <code>#include &lt;<a class="el" href="generic_8h.html">vl/generic.h</a>&gt;</code><br/> <code>#include &lt;<a class="el" href="array_8h.html">vl/array.h</a>&gt;</code><br/> <code>#include &lt;ctype.h&gt;</code><br/> <code>#include &lt;string.h&gt;</code><br/> <code>#include &lt;stdio.h&gt;</code><br/> <code>#include &lt;stdarg.h&gt;</code><br/> </div><table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Data Structures</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct__vlmxOption.html">vlmxOption</a></td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">MEX option. <a href="struct__vlmxOption.html#details">More...</a><br/></td></tr> <tr><td colspan="2"><h2><a name="define-members"></a> Defines</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::IN" ref="<API key>" args="(x)" --> #define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">IN</a>(x)&#160;&#160;&#160;(in[IN_ ## x])</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Access MEX input argument. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::OUT" ref="<API key>" args="(x)" --> #define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">OUT</a>(x)&#160;&#160;&#160;(out[OUT_ ## x])</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Access MEX output argument. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">VL_USE_MATLAB_ENV</a></td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Setup VLFeat to be used in a MEX file. <a href="#<API key>"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static mxArray *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>"><API key></a> (double x)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a MATLAB array which is a plain scalar. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static mxArray *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>"><API key></a> (<a class="el" href="structVlArray.html">VlArray</a> const *x)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a MATLAB array from a <a class="el" href="structVlArray.html" title="Numeric array.">VlArray</a>. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="structVlArray.html">VlArray</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>"><API key></a> (<a class="el" href="structVlArray.html">VlArray</a> *v, mxArray *x)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Envelope a MATLAB array in a <a class="el" href="structVlArray.html" title="Numeric array.">VlArray</a> instance. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">uStrICmp</a> (const char *s1, const char *s2)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Case insensitive string comparison. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxNextOption</a> (mxArray const *args[], int nargs, vlmxOption const *options, int *next, mxArray const **<a class="el" href="getopt__long_8h.html#<API key>">optarg</a>)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Parse the next option. <a href="#<API key>"></a><br/></td></tr> <tr><td colspan="2"><div class="groupHeader">Check for array attributes</div></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="host_8h.html#<API key>">vl_bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsOfClass</a> (mxArray const *array, mxClassID classId)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a MATLAB array is of a prescribed class. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="host_8h.html#<API key>">vl_bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsReal</a> (mxArray const *array)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a MATLAB array is real. <a href="#<API key>"></a><br/></td></tr> <tr><td colspan="2"><div class="groupHeader">Check for scalar, vector and matrix arrays</div></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="host_8h.html#<API key>">vl_bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsScalar</a> (mxArray const *array)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a MATLAB array is scalar. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="host_8h.html#<API key>">vl_bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsVector</a> (mxArray const *array, <a class="el" href="host_8h.html#<API key>">vl_index</a> numElements)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a MATLAB array is a vector. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="host_8h.html#<API key>">vl_bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsMatrix</a> (mxArray const *array, <a class="el" href="host_8h.html#<API key>">vl_index</a> M, <a class="el" href="host_8h.html#<API key>">vl_index</a> N)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a MATLAB array is a matrix. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="host_8h.html#<API key>">vl_bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsArray</a> (mxArray const *array, <a class="el" href="host_8h.html#<API key>">vl_index</a> numDimensions, <a class="el" href="host_8h.html#<API key>">vl_index</a> *dimensions)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if the MATLAB array has the specified dimensions. <a href="#<API key>"></a><br/></td></tr> <tr><td colspan="2"><div class="groupHeader">Check for plain arrays</div></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="host_8h.html#<API key>">vl_bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsPlain</a> (mxArray const *array)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a MATLAB array is plain. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="host_8h.html#<API key>">vl_bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsPlainScalar</a> (mxArray const *array)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a MATLAB array is plain scalar. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="host_8h.html#<API key>">vl_bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsPlainVector</a> (mxArray const *array, <a class="el" href="host_8h.html#<API key>">vl_index</a> numElements)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a MATLAB array is a plain vector. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="host_8h.html#<API key>">vl_bool</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsPlainMatrix</a> (mxArray const *array, <a class="el" href="host_8h.html#<API key>">vl_index</a> M, <a class="el" href="host_8h.html#<API key>">vl_index</a> N)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a MATLAB array is a plain matrix. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxIsString</a> (const mxArray *array, <a class="el" href="host_8h.html#<API key>">vl_index</a> length)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if the array is a string. <a href="#<API key>"></a><br/></td></tr> <tr><td colspan="2"><h2><a name="member-group"></a> Error handling</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">VlmxErrorId</a> </td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">VLFeat MEX errors. <br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxError</a> (<a class="el" href="mexutils_8h.html#<API key>">VlmxErrorId</a> errorId, char const *errorMessage,...)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Raise a MEX error with VLFeat format. <a href="#<API key>"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mexutils_8h.html#<API key>">vlmxWarning</a> (<a class="el" href="mexutils_8h.html#<API key>">VlmxErrorId</a> errorId, char const *errorMessage,...)</td></tr> <tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Raise a MEX warning with VLFeat format. <a href="#<API key>"></a><br/></td></tr> </table> <hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"><dl class="author"><dt><b>Author:</b></dt><dd>Andrea Vedaldi</dd></dl> <p>This header file provides helper functions for writing MATLAB MEX files.</p> <ul> <li><a class="el" href="mexutils_8h.html#mexutils-env">VLFeat environment</a></li> <li><a class="el" href="mexutils_8h.html#mexutils-array-test">Array tests</a></li> <li><a class="el" href="mexutils_8h.html#mexutils-options">Parsing options</a></li> </ul> <h2><a class="anchor" id="mexutils-env"></a> VLFeat environment</h2> <p>When the VLFeat DLL is linked to a MATLAB MEX files, at run time the MEX file must configure VLFeat to use MATLAB memory allocation and logging functions. This can be obtained by calling the macro <a class="el" href="mexutils_8h.html#<API key>" title="Setup VLFeat to be used in a MEX file.">VL_USE_MATLAB_ENV</a> as the first line of each MEX file which is linked to the VLFeat DLL.</p> <h2><a class="anchor" id="mexutils-array-test"></a> Array tests</h2> <p>MATLAB supports a variety of array types. Most MEX file arguments are restricted to a few types and must be properly checked at run time. <a class="el" href="mexutils_8h.html">mexutils.h</a> provides some helper functions to make it simpler to check such arguments. MATLAB basic array types are:</p> <ul> <li>Numeric array: <code>mxDOUBLE_CLASS</code>, <code>mxSINGLE_CLASS</code>, <code>mxINT8_CLASS</code>, <code>mxUINT8_CLASS</code>, <code>mxINT16_CLASS</code>, <code>mxUINT16_CLASS</code>, <code>mxINT32_CLASS</code>, <code>mxUINT32_CLASS</code>. Moreover:<ul> <li>all such types have a <em>real</em> component</li> <li>all such types may have a <em>imaginary</em> component</li> <li><code>mxDOUBLE_LCASS</code> arrays with two dimensions can be <em>sparse</em>.</li> </ul> </li> <li>Logical array (<code>mxLOGICAL_CLASS</code>).</li> <li>Character array (<code>mxCHAR_CLASS</code>).</li> </ul> <p>The other MATLAB array types are:</p> <ul> <li>Struct array (<code>mxSTRUCT_CLASS</code>).</li> <li>Cell array (<code>mxCELL_CLASS</code>).</li> <li>Custom class array (<code>mxCLASS_CLASS</code>).</li> <li>Unkown type array (<code>mxUNKNOWN_CLASS</code>).</li> </ul> <p>VLFeat defines a number of common classes of arrays and corresponding tests.</p> <ul> <li><b>Scalar array</b> is a non-sparse array with exactly one element. Note that the array may have an arbitrary number of dimensions, and be of any numeric or other type. All dimensions are singleton (which is implied by having exactly one element). Use <a class="el" href="mexutils_8h.html#<API key>" title="Check if a MATLAB array is scalar.">vlmxIsScalar</a> to test if an array is scalar.</li> </ul> <ul> <li><b>Vector array</b> is a non-sparse array which is either empty (empty vector) or has at most one non-singleton dimension. The array can be of any numeric or other type. The elements of such a MATLAB array are stored as a plain C array with a number of elements equal to the number of elements in the array (obtained with <code><API key></code>). Use <a class="el" href="mexutils_8h.html#<API key>" title="Check if a MATLAB array is a vector.">vlmxIsVector</a> to test if an array is a vector.</li> </ul> <ul> <li><b>Matrix array</b> is a non-sparse array for which all dimensions beyond the first two are singleton, or a non-sparse array which is empty and for which at least one of the first two dimensions is zero. The array can be of any numeric or other type. The non-singleton dimensions can be zero (empty matrix), one, or more. The element of such a MATLAB array are stored as a C array in column major order and its dimensions can be obtained by <code>mxGetM</code> and <code>mxGetN</code>. Use <a class="el" href="mexutils_8h.html#<API key>" title="Check if a MATLAB array is a matrix.">vlmxIsMatrix</a> to test if an array is a matrix.</li> </ul> <ul> <li><b>Real array</b> is a numeric array (as for <code>mxIsNumeric</code>) without a complex component. Use <a class="el" href="mexutils_8h.html#<API key>" title="Check if a MATLAB array is real.">vlmxIsReal</a> to check if an array is real.</li> </ul> <ul> <li>Use <a class="el" href="mexutils_8h.html#<API key>" title="Check if a MATLAB array is of a prescribed class.">vlmxIsOfClass</a> to check if an array is of a prescribed (storage) class, such as <code>mxDOUBLE_CLASS</code>.</li> </ul> <ul> <li><b>Plain scalar, vector, and matrix</b> are a scalar, vector, and matrix arrays which are <em>real</em> and of class <code>mxDOUBLE_CLASS</code>. Use <a class="el" href="mexutils_8h.html#<API key>" title="Check if a MATLAB array is plain scalar.">vlmxIsPlainScalar</a>, <a class="el" href="mexutils_8h.html#<API key>" title="Check if a MATLAB array is a plain vector.">vlmxIsPlainVector</a> and <a class="el" href="mexutils_8h.html#<API key>" title="Check if a MATLAB array is a plain matrix.">vlmxIsPlainMatrix</a> to check this.</li> </ul> <h2><a class="anchor" id="mexutils-options"></a> Parsing options</h2> <p>It is common to pass optional arguments to a MEX file as option type-value pairs. Here type is a string identifying the option and value is a MATLAB array specifing its value. The function <a class="el" href="mexutils_8h.html#<API key>" title="Parse the next option.">vlmxNextOption</a> can be used to simplify parsing a list of such arguments (similar to UNIX <code>getopt</code>). The functions <a class="el" href="mexutils_8h.html#<API key>" title="Raise a MEX error with VLFeat format.">vlmxError</a> and <a class="el" href="mexutils_8h.html#<API key>" title="Raise a MEX warning with VLFeat format.">vlmxWarning</a> are shortcuts to specify VLFeat formatted errors. </p> </div><hr/><h2>Define Documentation</h2> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::VL_USE_MATLAB_ENV" ref="<API key>" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define VL_USE_MATLAB_ENV</td> </tr> </table> </div> <div class="memdoc"> <b>Value:</b><div class="fragment"><pre class="fragment"><a class="code" href="generic_8c.html#<API key>" title="Set memory allocation functions.">vl_set_alloc_func</a> (mxMalloc, mxRealloc, mxCalloc, mxFree) ; \ vl_set_printf_func ((<a class="code" href="generic_8h.html#<API key>" title="Customizable printf function pointer type.">printf_func_t</a>)mexPrintf) ; </pre></div><p>This makes VLFeat use MATLAB version of the memory allocation and logging functions. </p> </div> </div> <hr/><h2>Function Documentation</h2> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::uStrICmp" ref="<API key>" args="(const char *s1, const char *s2)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int uStrICmp </td> <td>(</td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>s1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char *&#160;</td> <td class="paramname"><em>s2</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">s1</td><td>first string. </td></tr> <tr><td class="paramname">s2</td><td>second string.</td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>0 if the strings are equal, &gt;0 if the first string is greater (in lexicographical order) and &lt;0 otherwise. </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::<API key>" ref="<API key>" args="(VlArray const *x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static mxArray* <API key> </td> <td>(</td> <td class="paramtype"><a class="el" href="structVlArray.html">VlArray</a> const *&#160;</td> <td class="paramname"><em>x</em></td><td>)</td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td><a class="el" href="structVlArray.html" title="Numeric array.">VlArray</a> instance. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the new array. </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::<API key>" ref="<API key>" args="(double x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static mxArray* <API key> </td> <td>(</td> <td class="paramtype">double&#160;</td> <td class="paramname"><em>x</em></td><td>)</td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">x</td><td>scalar value. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the new array. </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::<API key>" ref="<API key>" args="(VlArray *v, mxArray *x)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="structVlArray.html">VlArray</a>* <API key> </td> <td>(</td> <td class="paramtype"><a class="el" href="structVlArray.html">VlArray</a> *&#160;</td> <td class="paramname"><em>v</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">mxArray *&#160;</td> <td class="paramname"><em>x</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">v</td><td><a class="el" href="structVlArray.html" title="Numeric array.">VlArray</a> instance (out) </td></tr> <tr><td class="paramname">x</td><td>MATALB array. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><code>v</code>. </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxError" ref="<API key>" args="(VlmxErrorId errorId, char const *errorMessage,...)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void vlmxError </td> <td>(</td> <td class="paramtype"><a class="el" href="mexutils_8h.html#<API key>">VlmxErrorId</a>&#160;</td> <td class="paramname"><em>errorId</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char const *&#160;</td> <td class="paramname"><em>errorMessage</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname"><em>...</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">errorId</td><td>error ID string. </td></tr> <tr><td class="paramname">errorMessage</td><td>error message C-style format string. </td></tr> <tr><td class="paramname">...</td><td>format string arguments.</td></tr> </table> </dd> </dl> <p>The function internally calls <code>mxErrMsgTxtAndId</code>, which causes the MEX file to abort. </p> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsArray" ref="<API key>" args="(mxArray const *array, vl_index numDimensions, vl_index *dimensions)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="host_8h.html#<API key>">vl_bool</a> vlmxIsArray </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="host_8h.html#<API key>">vl_index</a>&#160;</td> <td class="paramname"><em>numDimensions</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="host_8h.html#<API key>">vl_index</a> *&#160;</td> <td class="paramname"><em>dimensions</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>array to check. </td></tr> <tr><td class="paramname">numDimensions</td><td>number of dimensions. </td></tr> <tr><td class="paramname">dimensions</td><td>dimensions. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>true the test succeeds.</dd></dl> <p>The test is true if <em>numDimensions</em> &lt; 0. If not, it is false if the array has not <em>numDimensions</em>. Otherwise it is true is <em>dimensions</em> is <code>NULL</code> or if each entry of <em>dimensions</em> is either negative or equal to the corresponding array dimension. </p> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsMatrix" ref="<API key>" args="(mxArray const *array, vl_index M, vl_index N)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="host_8h.html#<API key>">vl_bool</a> vlmxIsMatrix </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="host_8h.html#<API key>">vl_index</a>&#160;</td> <td class="paramname"><em>M</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="host_8h.html#<API key>">vl_index</a>&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>MATLAB array. </td></tr> <tr><td class="paramname">M</td><td>number of rows (negative for any). </td></tr> <tr><td class="paramname">N</td><td>number of columns (negative for any). </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="host_8h.html#<API key>" title="true (1) constant">VL_TRUE</a> if the array is a matrix of the prescribed size. </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="mexutils_8h.html#mexutils-array-test">Array tests</a> </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsOfClass" ref="<API key>" args="(mxArray const *array, mxClassID classId)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="host_8h.html#<API key>">vl_bool</a> vlmxIsOfClass </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">mxClassID&#160;</td> <td class="paramname"><em>classId</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>MATLAB array. </td></tr> <tr><td class="paramname">classId</td><td>prescribed class of the array. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="host_8h.html#<API key>" title="true (1) constant">VL_TRUE</a> if the class is of the array is of the prescribed class. </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="mexutils_8h.html#mexutils-array-test">Array tests</a> </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsPlain" ref="<API key>" args="(mxArray const *array)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="host_8h.html#<API key>">vl_bool</a> vlmxIsPlain </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>array</em></td><td>)</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>MATLAB array. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="host_8h.html#<API key>" title="true (1) constant">VL_TRUE</a> if the array is plain. </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="mexutils_8h.html#mexutils-array-test">Array tests</a> </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsPlainMatrix" ref="<API key>" args="(mxArray const *array, vl_index M, vl_index N)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="host_8h.html#<API key>">vl_bool</a> vlmxIsPlainMatrix </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="host_8h.html#<API key>">vl_index</a>&#160;</td> <td class="paramname"><em>M</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="host_8h.html#<API key>">vl_index</a>&#160;</td> <td class="paramname"><em>N</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>MATLAB array. </td></tr> <tr><td class="paramname">M</td><td>number of rows (negative for any). </td></tr> <tr><td class="paramname">N</td><td>number of columns (negative for any). </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="host_8h.html#<API key>" title="true (1) constant">VL_TRUE</a> if the array is a plain matrix of the prescribed size. </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="mexutils_8h.html#mexutils-array-test">Array tests</a> </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsPlainScalar" ref="<API key>" args="(mxArray const *array)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="host_8h.html#<API key>">vl_bool</a> vlmxIsPlainScalar </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>array</em></td><td>)</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>MATLAB array. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="host_8h.html#<API key>" title="true (1) constant">VL_TRUE</a> if the array is plain scalar. </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="mexutils_8h.html#mexutils-array-test">Array tests</a> </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsPlainVector" ref="<API key>" args="(mxArray const *array, vl_index numElements)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="host_8h.html#<API key>">vl_bool</a> vlmxIsPlainVector </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="host_8h.html#<API key>">vl_index</a>&#160;</td> <td class="paramname"><em>numElements</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>MATLAB array. </td></tr> <tr><td class="paramname">numElements</td><td>number of elements (negative for any). </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="host_8h.html#<API key>" title="true (1) constant">VL_TRUE</a> if the array is a plain vecotr of the prescribed size. </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="mexutils_8h.html#mexutils-array-test">Array tests</a> </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsReal" ref="<API key>" args="(mxArray const *array)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="host_8h.html#<API key>">vl_bool</a> vlmxIsReal </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>array</em></td><td>)</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>MATLAB array. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="host_8h.html#<API key>" title="true (1) constant">VL_TRUE</a> if the array is real. </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="mexutils_8h.html#mexutils-array-test">Array tests</a> </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsScalar" ref="<API key>" args="(mxArray const *array)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="host_8h.html#<API key>">vl_bool</a> vlmxIsScalar </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>array</em></td><td>)</td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>MATLAB array. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="host_8h.html#<API key>" title="true (1) constant">VL_TRUE</a> if the array is scalar. </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="mexutils_8h.html#mexutils-array-test">Array tests</a> </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsString" ref="<API key>" args="(const mxArray *array, vl_index length)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int vlmxIsString </td> <td>(</td> <td class="paramtype">const mxArray *&#160;</td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="host_8h.html#<API key>">vl_index</a>&#160;</td> <td class="paramname"><em>length</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>array to test. </td></tr> <tr><td class="paramname">length</td><td>string length. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>true if the array is a string of the specified length</dd></dl> <p>The array <em>array</em> satisfies the test if:</p> <ul> <li>its storage class is CHAR;</li> <li>it has two dimensions but only one row;</li> <li><em>length</em> &lt; 0 or the array has <em>length</em> columns. </li> </ul> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxIsVector" ref="<API key>" args="(mxArray const *array, vl_index numElements)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="host_8h.html#<API key>">vl_bool</a> vlmxIsVector </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>array</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="host_8h.html#<API key>">vl_index</a>&#160;</td> <td class="paramname"><em>numElements</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">array</td><td>MATLAB array. </td></tr> <tr><td class="paramname">numElements</td><td>number of elements (negative for any). </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="host_8h.html#<API key>" title="true (1) constant">VL_TRUE</a> if the array is a vecotr of the prescribed size. </dd></dl> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="mexutils_8h.html#mexutils-array-test">Array tests</a> </dd></dl> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxNextOption" ref="<API key>" args="(mxArray const *args[], int nargs, vlmxOption const *options, int *next, mxArray const **optarg)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int vlmxNextOption </td> <td>(</td> <td class="paramtype">mxArray const *&#160;</td> <td class="paramname"><em>args</em>[], </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int&#160;</td> <td class="paramname"><em>nargs</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">vlmxOption const *&#160;</td> <td class="paramname"><em>options</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int *&#160;</td> <td class="paramname"><em>next</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">mxArray const **&#160;</td> <td class="paramname"><em>optarg</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">args</td><td>MEX argument array. </td></tr> <tr><td class="paramname">nargs</td><td>MEX argument array length. </td></tr> <tr><td class="paramname">options</td><td>List of option definitions. </td></tr> <tr><td class="paramname">next</td><td>Pointer to the next option (input and output). </td></tr> <tr><td class="paramname">optarg</td><td>Pointer to the option optional argument (output). </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the code of the next option, or -1 if there are no more options.</dd></dl> <p>The function parses the array <em>args</em> for options. <em>args</em> is expected to be a sequence alternating option names and option values, in the form of <em>nargs</em> instances of <code>mxArray</code>. The function then scans the option starting at position <em>next</em> in the array. The option name is matched (case insensitive) to the table of options <em>options</em>, a pointer to the option value is stored in <em>optarg</em>, <em>next</em> is advanced to the next option, and the option code is returned.</p> <p>The function is typically used in a loop to parse all the available options. <em>next</em> is initialized to zero, and then the function is called until the special code -1 is returned.</p> <p>If the option name cannot be matched to the available options, either because the option name is not a string array or because the name is unknown, the function exits the MEX file with an error. </p> </div> </div> <a class="anchor" id="<API key>"></a><!-- doxytag: member="mexutils.h::vlmxWarning" ref="<API key>" args="(VlmxErrorId errorId, char const *errorMessage,...)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void vlmxWarning </td> <td>(</td> <td class="paramtype"><a class="el" href="mexutils_8h.html#<API key>">VlmxErrorId</a>&#160;</td> <td class="paramname"><em>errorId</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char const *&#160;</td> <td class="paramname"><em>errorMessage</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname"><em>...</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">errorId</td><td>error ID string. </td></tr> <tr><td class="paramname">errorMessage</td><td>error message C-style format string. </td></tr> <tr><td class="paramname">...</td><td>format string arguments.</td></tr> </table> </dd> </dl> <p>The function internally calls <code>mxWarnMsgTxtAndId</code>. </p> </div> </div> </div> <!-- Doc Here --> </div> </div> <div class="clear">&nbsp;</div> </div> <!-- pagebody --> <div id="footer"> &copy; 2007-12 Andrea Vedaldi and Brian Fulkerson </div> <!-- footer --> <!-- Google Analytics Begins --> <script xml:space="preserve" type="text/javascript"> //<![CDATA[ var localre = /vlfeat.org/; if(document.location.host.search(localre) != -1) { var gaJsHost = (("https:" == document.location.protocol) ? "https: document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); } </script> <script xml:space="preserve" type="text/javascript"> //<![CDATA[ var localre = /vlfeat.org/; if(document.location.host.search(localre) != -1) { try { var pageTracker = _gat._getTracker("UA-4936091-2"); pageTracker._trackPageview(); } catch(err) {} } </script> <!-- Google Analytics Ends --> </body> </html>
package themidibus; import javax.sound.midi.MidiMessage; /** * A <API key> can be notified of incomming MIDI messages in MidiMessage form, usually by a MidiBus object which it is connected to. Typically it would analyse and react to incomming MIDI messages in some useful way. * * @version 008 * @author Severin Smith * @see MidiListener * @see RawMidiListener * @see SimpleMidiListener * @see ObjectMidiListener * @see MidiBus * @see javax.sound.midi.MidiMessage */ public interface <API key> extends MidiListener { /** * Objects notifying this <API key> of a new MIDI message call this method and pass the MidiMessage * * @param message the MidiMessage received */ public void midiMessage(MidiMessage message, long timeStamp); }
(function() { var CommandUpsideDown, Icommand, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Icommand = require('../icommand.js'); CommandUpsideDown = (function(superClass) { extend(CommandUpsideDown, superClass); function CommandUpsideDown() {} CommandUpsideDown.prototype.handle = function(sender, text, args, storage, textRouter, commandManager) { var froms, map, message, tos; if (args.length === 1 || (args.length === 2 && args[1] === "")) { return false; } message = args.slice(1).join(" "); if (message.match(/^\s*$/g)) { return false; } froms = "abcdefghijklmopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZɐqɔpǝɟƃɥᴉɾʞlɯodbɹsʇnʌʍxʎz∀qƆpƎℲפHIſʞ˥WNOԀQɹS∩ΛMX⅄Z¯_><".split(""); tos = "ɐqɔpǝɟƃɥᴉɾʞlɯodbɹsʇnʌʍxʎz∀qƆpƎℲפHIſʞ˥WNOԀQɹS∩ΛMX⅄<API key>¯<>".split(""); map = froms.reduce(function(all, key, i) { all[key] = tos[i]; return all; }, {}); message = message.split('').map(function(ch) { return map[ch] || ch; }).reverse().join(''); commandManager.send(sender, textRouter, message); return true; }; CommandUpsideDown.prototype.help = function(commandPrefix) { return ["make this bot to say some message", "this command will send to you according to where you exec this command, Usage", commandPrefix + " [-rj] messages..", "flags:", "r: raw string, no line break", "j: full js format string"]; }; CommandUpsideDown.prototype.hasPermission = function(sender, text, args, storage, textRouter, commandManager, fromBinding) { return true; }; return CommandUpsideDown; })(Icommand); module.exports = CommandUpsideDown; }).call(this);
#ifndef <API key> #ifndef <API key> #define <API key> namespace j2cpp { namespace android { namespace os { class Handler; } } } namespace j2cpp { namespace android { namespace media { namespace JetPlayer_ { class OnJetEventListener; } } } } namespace j2cpp { namespace android { namespace content { namespace res { class AssetFileDescriptor; } } } } namespace j2cpp { namespace java { namespace lang { class String; } } } namespace j2cpp { namespace java { namespace lang { class Object; } } } #include <android/content/res/AssetFileDescriptor.hpp> #include <android/media/JetPlayer.hpp> #include <android/os/Handler.hpp> #include <java/lang/Object.hpp> #include <java/lang/String.hpp> namespace j2cpp { namespace android { namespace media { class JetPlayer; namespace JetPlayer_ { class OnJetEventListener; class OnJetEventListener : public object<OnJetEventListener> { public: J2CPP_DECLARE_CLASS <API key>(0) <API key>(1) <API key>(2) <API key>(3) explicit OnJetEventListener(jobject jobj) : object<OnJetEventListener>(jobj) { } operator local_ref<java::lang::Object>() const; void onJetEvent(local_ref< android::media::JetPlayer > const&, jshort, jbyte, jbyte, jbyte, jbyte); void onJetUserIdUpdate(local_ref< android::media::JetPlayer > const&, jint, jint); void <API key>(local_ref< android::media::JetPlayer > const&, jint); void onJetPauseUpdate(local_ref< android::media::JetPlayer > const&, jint); }; //class OnJetEventListener } //namespace JetPlayer_ class JetPlayer : public object<JetPlayer> { public: J2CPP_DECLARE_CLASS <API key>(0) <API key>(1) <API key>(2) <API key>(3) <API key>(4) <API key>(5) <API key>(6) <API key>(7) <API key>(8) <API key>(9) <API key>(10) <API key>(11) <API key>(12) <API key>(13) <API key>(14) <API key>(15) <API key>(16) <API key>(17) <API key>(18) <API key>(19) typedef JetPlayer_::OnJetEventListener OnJetEventListener; explicit JetPlayer(jobject jobj) : object<JetPlayer>(jobj) { } operator local_ref<java::lang::Object>() const; static local_ref< android::media::JetPlayer > getJetPlayer(); local_ref< java::lang::Object > clone(); void release(); static jint getMaxTracks(); jboolean loadJetFile(local_ref< java::lang::String > const&); jboolean loadJetFile(local_ref< android::content::res::AssetFileDescriptor > const&); jboolean closeJetFile(); jboolean play(); jboolean pause(); jboolean queueJetSegment(jint, jint, jint, jint, jint, jbyte); jboolean <API key>(jint, jint, jint, jint, local_ref< array<jboolean,1> > const&, jbyte); jboolean setMuteFlags(jint, jboolean); jboolean setMuteArray(local_ref< array<jboolean,1> > const&, jboolean); jboolean setMuteFlag(jint, jboolean, jboolean); jboolean triggerClip(jint); jboolean clearQueue(); void setEventListener(local_ref< android::media::JetPlayer_::OnJetEventListener > const&); void setEventListener(local_ref< android::media::JetPlayer_::OnJetEventListener > const&, local_ref< android::os::Handler > const&); }; //class JetPlayer } //namespace media } //namespace android } //namespace j2cpp #endif //<API key> #else //<API key> #ifndef <API key> #define <API key> namespace j2cpp { android::media::JetPlayer_::OnJetEventListener::operator local_ref<java::lang::Object>() const { return local_ref<java::lang::Object>(get_jobject()); } void android::media::JetPlayer_::OnJetEventListener::onJetEvent(local_ref< android::media::JetPlayer > const &a0, jshort a1, jbyte a2, jbyte a3, jbyte a4, jbyte a5) { return call_method< android::media::JetPlayer_::OnJetEventListener::J2CPP_CLASS_NAME, android::media::JetPlayer_::OnJetEventListener::J2CPP_METHOD_NAME(0), android::media::JetPlayer_::OnJetEventListener::<API key>(0), void >(get_jobject(), a0, a1, a2, a3, a4, a5); } void android::media::JetPlayer_::OnJetEventListener::onJetUserIdUpdate(local_ref< android::media::JetPlayer > const &a0, jint a1, jint a2) { return call_method< android::media::JetPlayer_::OnJetEventListener::J2CPP_CLASS_NAME, android::media::JetPlayer_::OnJetEventListener::J2CPP_METHOD_NAME(1), android::media::JetPlayer_::OnJetEventListener::<API key>(1), void >(get_jobject(), a0, a1, a2); } void android::media::JetPlayer_::OnJetEventListener::<API key>(local_ref< android::media::JetPlayer > const &a0, jint a1) { return call_method< android::media::JetPlayer_::OnJetEventListener::J2CPP_CLASS_NAME, android::media::JetPlayer_::OnJetEventListener::J2CPP_METHOD_NAME(2), android::media::JetPlayer_::OnJetEventListener::<API key>(2), void >(get_jobject(), a0, a1); } void android::media::JetPlayer_::OnJetEventListener::onJetPauseUpdate(local_ref< android::media::JetPlayer > const &a0, jint a1) { return call_method< android::media::JetPlayer_::OnJetEventListener::J2CPP_CLASS_NAME, android::media::JetPlayer_::OnJetEventListener::J2CPP_METHOD_NAME(3), android::media::JetPlayer_::OnJetEventListener::<API key>(3), void >(get_jobject(), a0, a1); } J2CPP_DEFINE_CLASS(android::media::JetPlayer_::OnJetEventListener,"android/media/JetPlayer$OnJetEventListener") J2CPP_DEFINE_METHOD(android::media::JetPlayer_::OnJetEventListener,0,"onJetEvent","(Landroid/media/JetPlayer;SBBBB)V") J2CPP_DEFINE_METHOD(android::media::JetPlayer_::OnJetEventListener,1,"onJetUserIdUpdate","(Landroid/media/JetPlayer;II)V") J2CPP_DEFINE_METHOD(android::media::JetPlayer_::OnJetEventListener,2,"<API key>","(Landroid/media/JetPlayer;I)V") J2CPP_DEFINE_METHOD(android::media::JetPlayer_::OnJetEventListener,3,"onJetPauseUpdate","(Landroid/media/JetPlayer;I)V") android::media::JetPlayer::operator local_ref<java::lang::Object>() const { return local_ref<java::lang::Object>(get_jobject()); } local_ref< android::media::JetPlayer > android::media::JetPlayer::getJetPlayer() { return call_static_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(1), android::media::JetPlayer::<API key>(1), local_ref< android::media::JetPlayer > >(); } local_ref< java::lang::Object > android::media::JetPlayer::clone() { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(2), android::media::JetPlayer::<API key>(2), local_ref< java::lang::Object > >(get_jobject()); } void android::media::JetPlayer::release() { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(4), android::media::JetPlayer::<API key>(4), void >(get_jobject()); } jint android::media::JetPlayer::getMaxTracks() { return call_static_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(5), android::media::JetPlayer::<API key>(5), jint >(); } jboolean android::media::JetPlayer::loadJetFile(local_ref< java::lang::String > const &a0) { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(6), android::media::JetPlayer::<API key>(6), jboolean >(get_jobject(), a0); } jboolean android::media::JetPlayer::loadJetFile(local_ref< android::content::res::AssetFileDescriptor > const &a0) { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(7), android::media::JetPlayer::<API key>(7), jboolean >(get_jobject(), a0); } jboolean android::media::JetPlayer::closeJetFile() { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(8), android::media::JetPlayer::<API key>(8), jboolean >(get_jobject()); } jboolean android::media::JetPlayer::play() { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(9), android::media::JetPlayer::<API key>(9), jboolean >(get_jobject()); } jboolean android::media::JetPlayer::pause() { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(10), android::media::JetPlayer::<API key>(10), jboolean >(get_jobject()); } jboolean android::media::JetPlayer::queueJetSegment(jint a0, jint a1, jint a2, jint a3, jint a4, jbyte a5) { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(11), android::media::JetPlayer::<API key>(11), jboolean >(get_jobject(), a0, a1, a2, a3, a4, a5); } jboolean android::media::JetPlayer::<API key>(jint a0, jint a1, jint a2, jint a3, local_ref< array<jboolean,1> > const &a4, jbyte a5) { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(12), android::media::JetPlayer::<API key>(12), jboolean >(get_jobject(), a0, a1, a2, a3, a4, a5); } jboolean android::media::JetPlayer::setMuteFlags(jint a0, jboolean a1) { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(13), android::media::JetPlayer::<API key>(13), jboolean >(get_jobject(), a0, a1); } jboolean android::media::JetPlayer::setMuteArray(local_ref< array<jboolean,1> > const &a0, jboolean a1) { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(14), android::media::JetPlayer::<API key>(14), jboolean >(get_jobject(), a0, a1); } jboolean android::media::JetPlayer::setMuteFlag(jint a0, jboolean a1, jboolean a2) { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(15), android::media::JetPlayer::<API key>(15), jboolean >(get_jobject(), a0, a1, a2); } jboolean android::media::JetPlayer::triggerClip(jint a0) { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(16), android::media::JetPlayer::<API key>(16), jboolean >(get_jobject(), a0); } jboolean android::media::JetPlayer::clearQueue() { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(17), android::media::JetPlayer::<API key>(17), jboolean >(get_jobject()); } void android::media::JetPlayer::setEventListener(local_ref< android::media::JetPlayer_::OnJetEventListener > const &a0) { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(18), android::media::JetPlayer::<API key>(18), void >(get_jobject(), a0); } void android::media::JetPlayer::setEventListener(local_ref< android::media::JetPlayer_::OnJetEventListener > const &a0, local_ref< android::os::Handler > const &a1) { return call_method< android::media::JetPlayer::J2CPP_CLASS_NAME, android::media::JetPlayer::J2CPP_METHOD_NAME(19), android::media::JetPlayer::<API key>(19), void >(get_jobject(), a0, a1); } J2CPP_DEFINE_CLASS(android::media::JetPlayer,"android/media/JetPlayer") J2CPP_DEFINE_METHOD(android::media::JetPlayer,0,"<init>","()V") J2CPP_DEFINE_METHOD(android::media::JetPlayer,1,"getJetPlayer","()Landroid/media/JetPlayer;") J2CPP_DEFINE_METHOD(android::media::JetPlayer,2,"clone","()Ljava/lang/Object;") J2CPP_DEFINE_METHOD(android::media::JetPlayer,3,"finalize","()V") J2CPP_DEFINE_METHOD(android::media::JetPlayer,4,"release","()V") J2CPP_DEFINE_METHOD(android::media::JetPlayer,5,"getMaxTracks","()I") J2CPP_DEFINE_METHOD(android::media::JetPlayer,6,"loadJetFile","(Ljava/lang/String;)Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,7,"loadJetFile","(Landroid/content/res/AssetFileDescriptor;)Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,8,"closeJetFile","()Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,9,"play","()Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,10,"pause","()Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,11,"queueJetSegment","(IIIIIB)Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,12,"<API key>","(IIII[ZB)Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,13,"setMuteFlags","(IZ)Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,14,"setMuteArray","([ZZ)Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,15,"setMuteFlag","(IZZ)Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,16,"triggerClip","(I)Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,17,"clearQueue","()Z") J2CPP_DEFINE_METHOD(android::media::JetPlayer,18,"setEventListener","(Landroid/media/JetPlayer$OnJetEventListener;)V") J2CPP_DEFINE_METHOD(android::media::JetPlayer,19,"setEventListener","(Landroid/media/JetPlayer$OnJetEventListener;Landroid/os/Handler;)V") } //namespace j2cpp #endif //<API key> #endif //<API key>
#ifndef QTDOCKSITE_H #define QTDOCKSITE_H #include "QtFlexManager.h" class DockSiteImpl; class QT_FLEX_API DockSite : public QWidget { Q_OBJECT Q_PROPERTY(bool active READ isActive) Q_PROPERTY(Flex::ViewMode viewMode READ viewMode) public: DockSite(DockWidget* widget = nullptr, QSize baseSize = QSize(0, 0), QWidget* parent = nullptr); ~DockSite(); public: bool addWidget(DockWidget* widget); public: bool insertWidget(DockWidget* widget, int index = -1); public: void setCurrentWidget(DockWidget* widget); public: int currentIndex() const; public: void setCurrentIndex(int index); public: int count() const; public: DockWidget* widget(int index) const; public: int indexOf(DockWidget* widget) const; public: QList<DockWidget*> widgets() const; public: void removeWidgetAt(int index); public: Flex::ViewMode viewMode() const; public: Flex::DockMode dockMode() const; public: void setDockMode(Flex::DockMode dockMode); public: Flex::Features features() const; public: DockSide* dockSide() const; public: FlexWidget* flexWidget() const; public: QString identifier(); public: bool isActive() const; public: void setActive(bool active); public: void activate(); public: bool load(const QJsonObject& object); public: bool save(QJsonObject& object) const; protected: bool event(QEvent*); bool eventFilter(QObject*, QEvent*); void paintEvent(QPaintEvent*); void closeEvent(QCloseEvent*); void mousePressEvent(QMouseEvent*); void mouseMoveEvent(QMouseEvent*); void mouseReleaseEvent(QMouseEvent*); void <API key>(QMouseEvent*); private Q_SLOTS: void <API key>(int index); void on_tabBar_tabMoved(int from, int to); void <API key>(int index); void <API key>(int index); void <API key>(int index); void <API key>(Flex::Button, bool*); private: friend class DockSiteImpl; private: QScopedPointer<DockSiteImpl> impl; }; #endif
<?php namespace HWI\Bundle\OAuthBundle\Tests\OAuth\ResourceOwner; use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\<API key>; use Symfony\Component\HttpFoundation\Request; class GenericO<API key> extends \<API key> { /** * @var <API key> */ protected $resourceOwner; protected $resourceOwnerName; protected $buzzClient; protected $buzzResponse; protected $<API key>; protected $storage; protected $options = array( 'client_id' => 'clientid', 'client_secret' => 'clientsecret', 'infos_url' => 'http://user.info/?test=1', 'request_token_url' => 'http://user.request/?test=2', 'authorization_url' => 'http://user.auth/?test=3', 'access_token_url' => 'http://user.access/?test=4', ); protected $userResponse = '{"id": "1", "foo": "bar"}'; protected $paths = array( 'identifier' => 'id', 'nickname' => 'foo', 'realname' => 'foo_disp', ); public function setUp() { $this->resourceOwnerName = str_replace(array('generic', 'resourceownertest'), '', strtolower(__CLASS__)); $this->resourceOwner = $this->createResourceOwner($this->resourceOwnerName); } /** * @expectedException \Symfony\Component\OptionsResolver\Exception\ExceptionInterface */ public function <API key>() { $this->createResourceOwner($this->resourceOwnerName, array('non_existing' => null)); } /** * @expectedException \Symfony\Component\OptionsResolver\Exception\ExceptionInterface */ public function <API key>() { $this->createResourceOwner($this->resourceOwnerName, array('csrf' => 'invalid')); } public function testHandleRequest() { $request = new Request(array('test' => 'test')); $this->assertFalse($this->resourceOwner->handles($request)); $request = new Request(array('oauth_token' => 'test')); $this->assertTrue($this->resourceOwner->handles($request)); $request = new Request(array('oauth_token' => 'test', 'test' => 'test')); $this->assertTrue($this->resourceOwner->handles($request)); } public function <API key>() { $this->mockBuzz($this->userResponse, 'application/json; charset=utf-8'); $accessToken = array('oauth_token' => 'token', 'oauth_token_secret' => 'secret'); $userResponse = $this->resourceOwner->getUserInformation($accessToken); $this->assertEquals('1', $userResponse->getUsername()); $this->assertEquals('bar', $userResponse->getNickname()); $this->assertEquals($accessToken['oauth_token'], $userResponse->getAccessToken()); $this->assertNull($userResponse->getRefreshToken()); $this->assertNull($userResponse->getExpiresIn()); } public function testGet<API key>() { $this->mockBuzz('{"oauth_token": "token", "oauth_token_secret": "secret"}', 'application/json; charset=utf-8'); $this->storage->expects($this->once()) ->method('save') ->with($this->resourceOwner, array('oauth_token' => 'token', 'oauth_token_secret' => 'secret', 'timestamp' => time())); $this->assertEquals( $this->options['authorization_url'].'&oauth_token=token', $this->resourceOwner->getAuthorizationUrl('http://redirect.to/') ); } /** * @expectedException \Symfony\Component\Security\Core\Exception\<API key> */ public function testGet<API key>() { $this->mockBuzz('{"oauth_token": "token"}', 'application/json; charset=utf-8'); $this->storage->expects($this->never()) ->method('save'); $this->resourceOwner->getAuthorizationUrl('http://redirect.to/'); } /** * @expectedException \Symfony\Component\Security\Core\Exception\<API key> */ public function testGet<API key>() { $this->mockBuzz('oauth_problem=message'); $this->storage->expects($this->never()) ->method('save'); $this->resourceOwner->getAuthorizationUrl('http://redirect.to/'); } /** * @expectedException \Symfony\Component\Security\Core\Exception\<API key> */ public function testGet<API key>() { $this->mockBuzz('o<API key>=false'); $this->storage->expects($this->never()) ->method('save'); $this->resourceOwner->getAuthorizationUrl('http://redirect.to/'); } /** * @expectedException \Symfony\Component\Security\Core\Exception\<API key> */ public function testGet<API key>() { $this->mockBuzz('invalid'); $this->storage->expects($this->never()) ->method('save'); $this->resourceOwner->getAuthorizationUrl('http://redirect.to/'); } public function testGetAccessToken() { $this->mockBuzz('oauth_token=token&oauth_token_secret=secret'); $request = new Request(array('oauth_verifier' => 'code', 'oauth_token' => 'token')); $this->storage->expects($this->once()) ->method('fetch') ->with($this->resourceOwner, 'token') ->will($this->returnValue(array('oauth_token' => 'token2', 'oauth_token_secret' => 'secret2'))); $this->assertEquals( array('oauth_token' => 'token', 'oauth_token_secret' => 'secret'), $this->resourceOwner->getAccessToken($request, 'http://redirect.to/') ); } public function <API key>() { $this->mockBuzz('{"oauth_token": "token", "oauth_token_secret": "secret"}', 'application/json'); $request = new Request(array('oauth_verifier' => 'code', 'oauth_token' => 'token')); $this->storage->expects($this->once()) ->method('fetch') ->with($this->resourceOwner, 'token') ->will($this->returnValue(array('oauth_token' => 'token2', 'oauth_token_secret' => 'secret2'))); $this->assertEquals( array('oauth_token' => 'token', 'oauth_token_secret' => 'secret'), $this->resourceOwner->getAccessToken($request, 'http://redirect.to/') ); } public function testGetAccess<API key>() { $this->mockBuzz('{"oauth_token": "token", "oauth_token_secret": "secret"}', 'application/json; charset=utf-8'); $request = new Request(array('oauth_verifier' => 'code', 'oauth_token' => 'token')); $this->storage->expects($this->once()) ->method('fetch') ->with($this->resourceOwner, 'token') ->will($this->returnValue(array('oauth_token' => 'token2', 'oauth_token_secret' => 'secret2'))); $this->assertEquals( array('oauth_token' => 'token', 'oauth_token_secret' => 'secret'), $this->resourceOwner->getAccessToken($request, 'http://redirect.to/') ); } /** * @expectedException \Symfony\Component\Security\Core\Exception\<API key> */ public function <API key>() { $this->mockBuzz('invalid'); $this->storage->expects($this->once()) ->method('fetch') ->will($this->returnValue(array('oauth_token' => 'token', 'oauth_token_secret' => 'secret'))); $this->storage->expects($this->never()) ->method('save'); $request = new Request(array('oauth_token' => 'token', 'oauth_verifier' => 'code')); $this->resourceOwner->getAccessToken($request, 'http://redirect.to/'); } /** * @expectedException \Symfony\Component\Security\Core\Exception\<API key> */ public function <API key>() { $this->mockBuzz('error=foo'); $this->storage->expects($this->once()) ->method('fetch') ->will($this->returnValue(array('oauth_token' => 'token', 'oauth_token_secret' => 'secret'))); $this->storage->expects($this->never()) ->method('save'); $request = new Request(array('oauth_token' => 'token', 'oauth_verifier' => 'code')); $this->resourceOwner->getAccessToken($request, 'http://redirect.to/'); } /** * @expectedException \Symfony\Component\Security\Core\Exception\<API key> */ public function testGetAccess<API key>() { $this->storage->expects($this->once()) ->method('fetch') ->will($this->throwException(new \<API key>)); $this->buzzClient->expects($this->never()) ->method('send'); $this->storage->expects($this->never()) ->method('save'); $request = new Request(array('oauth_token' => 'token', 'oauth_verifier' => 'code')); $this->resourceOwner->getAccessToken($request, 'http://redirect.to/'); } /** * @expectedException \Symfony\Component\Security\Core\Exception\<API key> */ public function <API key>() { $this->resourceOwner->refreshAccessToken('token'); } /** * @expectedException \Symfony\Component\Security\Core\Exception\<API key> */ public function testRevokeToken() { $this->resourceOwner->revokeToken('token'); } public function testCsrf<API key>() { $this->storage->expects($this->never()) ->method('fetch'); $this->assertTrue($this->resourceOwner->isCsrfTokenValid('valid_token')); } public function testCsrfTokenValid() { $resourceOwner = $this->createResourceOwner($this->resourceOwnerName, array('csrf' => true)); $this->storage->expects($this->never()) ->method('fetch'); $this->assertTrue($resourceOwner->isCsrfTokenValid('valid_token')); } public function testGetSetName() { $this->assertEquals($this->resourceOwnerName, $this->resourceOwner->getName()); $this->resourceOwner->setName('foo'); $this->assertEquals('foo', $this->resourceOwner->getName()); } public function <API key>() { $class = '\HWI\Bundle\OAuthBundle\Tests\Fixtures\CustomUserResponse'; $resourceOwner = $this->createResourceOwner($this->resourceOwnerName, array('user_response_class' => $class)); $this->mockBuzz(); /** * @var $userResponse \HWI\Bundle\OAuthBundle\Tests\Fixtures\CustomUserResponse */ $userResponse = $resourceOwner->getUserInformation(array('oauth_token' => 'token', 'oauth_token_secret' => 'secret')); $this->assertInstanceOf($class, $userResponse); $this->assertEquals('foo666', $userResponse->getUsername()); $this->assertEquals('foo', $userResponse->getNickname()); $this->assertEquals('token', $userResponse->getAccessToken()); $this->assertNull($userResponse->getRefreshToken()); $this->assertNull($userResponse->getExpiresIn()); } public function buzzSendMock($request, $response) { $response->setContent($this->buzzResponse); $response->addHeader('Content-Type: ' . $this-><API key>); } protected function mockBuzz($response = '', $contentType = 'text/plain') { $this->buzzClient->expects($this->once()) ->method('send') ->will($this->returnCallback(array($this, 'buzzSendMock'))); $this->buzzResponse = $response; $this-><API key> = $contentType; } protected function createResourceOwner($name, array $options = array(), array $paths = array()) { $this->buzzClient = $this->getMockBuilder('\Buzz\Client\ClientInterface') -><API key>() ->getMock(); $httpUtils = $this->getMockBuilder('\Symfony\Component\Security\Http\HttpUtils') -><API key>() ->getMock(); $this->storage = $this->getMockBuilder('\HWI\Bundle\OAuthBundle\OAuth\<API key>') -><API key>() ->getMock(); $resourceOwner = $this->setUpResourceOwner($name, $httpUtils, array_merge($this->options, $options)); $resourceOwner->addPaths(array_merge($this->paths, $paths)); return $resourceOwner; } protected function setUpResourceOwner($name, $httpUtils, array $options) { return new <API key>($this->buzzClient, $httpUtils, $options, $name, $this->storage); } }
import React from 'react'; import SparklinesLine from './SparklinesLine'; import SparklinesBars from './SparklinesBars'; import SparklinesSpots from './SparklinesSpots'; import <API key> from './<API key>'; import <API key> from './<API key>'; import DataProcessor from './DataProcessor'; class Sparklines extends React.Component { static propTypes = { data: React.PropTypes.array, limit: React.PropTypes.number, width: React.PropTypes.number, height: React.PropTypes.number, margin: React.PropTypes.number, style: React.PropTypes.object }; static defaultProps = { data: [], width: 120, height: 30, margin: 2 }; constructor (props) { super(props); } <API key>(nextProps, nextState) { return nextProps.data.some((d, i) => d !== this.props.data[i]); } render() { const { data, limit, width, height, margin, style, max, min } = this.props; if (data.length === 0) return false; const points = DataProcessor.dataToPoints(data, limit, width, height, margin, max, min); return ( <svg width={width} height={height} style={style}> { React.Children.map(this.props.children, function(child) { return React.cloneElement(child, { points, width, height, margin }); }) } </svg> ); } } export { Sparklines, SparklinesLine, SparklinesBars, SparklinesSpots, <API key>, <API key>, DataProcessor }