answer
stringlengths 15
1.25M
|
|---|
# -*- encoding: utf-8 -*-
# OpenERP, Open Source Management Solution
# This program is free software: you can redistribute it and/or modify
# published by the Free Software Foundation, either version 3 of the
# This program is distributed in the hope that it will be useful,
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
from . import account
from . import res_partner
from . import ir_actions
|
# -*- coding: utf-8 -*-
from odoo.tests.common import HttpCase
from odoo.exceptions import ValidationError
class AccountingTestCase(HttpCase):
""" This class extends the base TransactionCase, in order to test the
accounting with localization setups. It is configured to run the tests after
the installation of all modules, and will SKIP TESTS ifit cannot find an already
configured accounting (which means no localization module has been installed).
"""
post_install = True
at_install = False
def setUp(self):
super(AccountingTestCase, self).setUp()
domain = [('company_id', '=', self.env.ref('base.main_company').id)]
if not self.env['account.account'].search_count(domain):
self.skipTest("No Chart of account found")
def check_complete_move(self, move, theorical_lines):
for aml in move.line_ids:
line = (aml.name, round(aml.debit, 2), round(aml.credit, 2))
if line in theorical_lines:
theorical_lines.remove(line)
else:
raise ValidationError('Unexpected journal item. (label: %s, debit: %s, credit: %s)' % (aml.name, round(aml.debit, 2), round(aml.credit, 2)))
if theorical_lines:
raise ValidationError('Remaining theorical line (not found). %s)' % ([(aml[0], aml[1], aml[2]) for aml in theorical_lines]))
return True
def <API key>(self, property_name):
'''Ensure the ir.property targetting an account.account passed as parameter exists.
In case it's not: create it with a random account. This is useful when testing with
partially defined localization (missing stock properties for example)
:param property_name: The name of the property.
'''
company_id = self.env.user.company_id
field_id = self.env['ir.model.fields'].search(
[('model', '=', 'product.template'), ('name', '=', property_name)], limit=1)
property_id = self.env['ir.property'].search([
('company_id', '=', company_id.id),
('name', '=', property_name),
('res_id', '=', None),
('fields_id', '=', field_id.id)], limit=1)
account_id = self.env['account.account'].search([('company_id', '=', company_id.id)], limit=1)
value_reference = 'account.account,%d' % account_id.id
if property_id and not property_id.value_reference:
property_id.value_reference = value_reference
else:
self.env['ir.property'].create({
'name': property_name,
'company_id': company_id.id,
'fields_id': field_id.id,
'value_reference': value_reference,
})
|
#ifdef __cplusplus
extern "C" {
#endif
#include "v3p_netlib.h"
/* Table of constant values */
static integer c__1 = 1;
static complex c_b8 = {(float)1.,(float)0.};
static complex c_b53 = {(float)-1.,(float)0.};
/*< subroutine csvdc(x,ldx,n,p,s,e,u,ldu,v,ldv,work,job,info) >*/
/* Subroutine */ int csvdc_(complex *x, integer *ldx, integer *n, integer *p,
complex *s, complex *e, complex *u, integer *ldu, complex *v, integer
*ldv, complex *work, integer *job, integer *info)
{
/* System generated locals */
integer x_dim1, x_offset, u_dim1, u_offset, v_dim1, v_offset, i__1, i__2,
i__3, i__4;
real r__1, r__2, r__3, r__4;
complex q__1, q__2, q__3;
/* Builtin functions */
double r_imag(complex *), c_abs(complex *);
void c_div(complex *, complex *, complex *), r_cnjg(complex *, complex *);
double sqrt(doublereal);
/* Local variables */
real b, c__, f, g;
integer i__, j, k, l=0, m;
complex r__, t;
real t1, el;
integer kk;
real cs;
integer ll, mm, ls=0;
real sl;
integer lu;
real sm, sn;
integer lm1, mm1, lp1, mp1, nct, ncu, lls, nrt;
real emm1, smm1;
integer kase, jobu, iter;
real test;
integer nctp1, nrtp1;
extern /* Subroutine */ int cscal_(integer *, complex *, complex *,
integer *);
real scale;
extern /* Complex */ VOID cdotc_(complex *, integer *, complex *, integer
*, complex *, integer *);
real shift;
extern /* Subroutine */ int cswap_(integer *, complex *, integer *,
complex *, integer *);
integer maxit;
extern /* Subroutine */ int caxpy_(integer *, complex *, complex *,
integer *, complex *, integer *), csrot_(integer *, complex *,
integer *, complex *, integer *, real *, real *);
logical wantu, wantv;
extern /* Subroutine */ int srotg_(real *, real *, real *, real *);
real ztest;
extern doublereal scnrm2_(integer *, complex *, integer *);
/*< integer ldx,n,p,ldu,ldv,job,info >*/
/*< complex x(ldx,1),s(1),e(1),u(ldu,1),v(ldv,1),work(1) >*/
/* csvdc is a subroutine to reduce a complex nxp matrix x by */
/* unitary transformations u and v to diagonal form. the */
/* diagonal elements s(i) are the singular values of x. the */
/* columns of u are the corresponding left singular vectors, */
/* and the columns of v the right singular vectors. */
/* on entry */
/* x complex(ldx,p), where ldx.ge.n. */
/* x contains the matrix whose singular value */
/* decomposition is to be computed. x is */
/* destroyed by csvdc. */
/* ldx integer. */
/* ldx is the leading dimension of the array x. */
/* n integer. */
/* n is the number of rows of the matrix x. */
/* p integer. */
/* p is the number of columns of the matrix x. */
/* ldu integer. */
/* ldu is the leading dimension of the array u */
/* (see below). */
/* ldv integer. */
/* ldv is the leading dimension of the array v */
/* (see below). */
/* work complex(n). */
/* work is a scratch array. */
/* job integer. */
/* job controls the computation of the singular */
/* vectors. it has the decimal expansion ab */
/* with the following meaning */
/* a.eq.0 do not compute the left singular */
/* vectors. */
/* a.eq.1 return the n left singular vectors */
/* in u. */
/* a.ge.2 returns the first min(n,p) */
/* left singular vectors in u. */
/* b.eq.0 do not compute the right singular */
/* vectors. */
/* b.eq.1 return the right singular vectors */
/* in v. */
/* on return */
/* s complex(mm), where mm=min(n+1,p). */
/* the first min(n,p) entries of s contain the */
/* singular values of x arranged in descending */
/* order of magnitude. */
/* e complex(p). */
/* e ordinarily contains zeros. however see the */
/* discussion of info for exceptions. */
/* u complex(ldu,k), where ldu.ge.n. if joba.eq.1 then */
/* k.eq.n, if joba.ge.2 then */
/* k.eq.min(n,p). */
/* u contains the matrix of left singular vectors. */
/* u is not referenced if joba.eq.0. if n.le.p */
/* or if joba.gt.2, then u may be identified with x */
/* in the subroutine call. */
/* v complex(ldv,p), where ldv.ge.p. */
/* v contains the matrix of right singular vectors. */
/* v is not referenced if jobb.eq.0. if p.le.n, */
/* then v may be identified whth x in the */
/* subroutine call. */
/* info integer. */
/* the singular values (and their corresponding */
/* singular vectors) s(info+1),s(info+2),...,s(m) */
/* are correct (here m=min(n,p)). thus if */
/* info.eq.0, all the singular values and their */
/* vectors are correct. in any event, the matrix */
/* b = ctrans(u)*x*v is the bidiagonal matrix */
/* with the elements of s on its diagonal and the */
/* elements of e on its super-diagonal (ctrans(u) */
/* is the conjugate-transpose of u). thus the */
/* singular values of x and b are the same. */
/* linpack. this version dated 03/19/79 . */
/* correction to shift calculation made 2/85. */
/* g.w. stewart, university of maryland, argonne national lab. */
/* csvdc uses the following functions and subprograms. */
/* external csrot */
/* blas caxpy,cdotc,cscal,cswap,scnrm2,srotg */
/* fortran abs,aimag,amax1,cabs,cmplx */
/* fortran conjg,max0,min0,mod,real,sqrt */
/* internal variables */
/*< complex cdotc,t,r >*/
/*< logical wantu,wantv >*/
/*< complex csign,zdum,zdum1,zdum2 >*/
/*< real cabs1 >*/
/*< cabs1(zdum) = abs(real(zdum)) + abs(aimag(zdum)) >*/
/*< csign(zdum1,zdum2) = cabs(zdum1)*(zdum2/cabs(zdum2)) >*/
/* set the maximum number of iterations. */
/*< maxit = 1000 >*/
/* Parameter adjustments */
x_dim1 = *ldx;
x_offset = 1 + x_dim1;
x -= x_offset;
--s;
--e;
u_dim1 = *ldu;
u_offset = 1 + u_dim1;
u -= u_offset;
v_dim1 = *ldv;
v_offset = 1 + v_dim1;
v -= v_offset;
--work;
/* Function Body */
maxit = 1000;
/* determine what is to be computed. */
/*< wantu = .false. >*/
wantu = FALSE_;
/*< wantv = .false. >*/
wantv = FALSE_;
/*< jobu = mod(job,100)/10 >*/
jobu = *job % 100 / 10;
/*< ncu = n >*/
ncu = *n;
/*< if (jobu .gt. 1) ncu = min0(n,p) >*/
if (jobu > 1) {
ncu = min(*n,*p);
}
/*< if (jobu .ne. 0) wantu = .true. >*/
if (jobu != 0) {
wantu = TRUE_;
}
/*< if (mod(job,10) .ne. 0) wantv = .true. >*/
if (*job % 10 != 0) {
wantv = TRUE_;
}
/* reduce x to bidiagonal form, storing the diagonal elements */
/* in s and the super-diagonal elements in e. */
/*< info = 0 >*/
*info = 0;
/*< nct = min0(n-1,p) >*/
/* Computing MIN */
i__1 = *n - 1;
nct = min(i__1,*p);
/*< nrt = max0(0,min0(p-2,n)) >*/
/* Computing MAX */
/* Computing MIN */
i__3 = *p - 2;
i__1 = 0, i__2 = min(i__3,*n);
nrt = max(i__1,i__2);
/*< lu = max0(nct,nrt) >*/
lu = max(nct,nrt);
/*< if (lu .lt. 1) go to 170 >*/
if (lu < 1) {
goto L170;
}
/*< do 160 l = 1, lu >*/
i__1 = lu;
for (l = 1; l <= i__1; ++l) {
/*< lp1 = l + 1 >*/
lp1 = l + 1;
/*< if (l .gt. nct) go to 20 >*/
if (l > nct) {
goto L20;
}
/* compute the transformation for the l-th column and */
/* place the l-th diagonal in s(l). */
/*< s(l) = cmplx(scnrm2(n-l+1,x(l,l),1),0.0e0) >*/
i__2 = l;
i__3 = *n - l + 1;
r__1 = scnrm2_(&i__3, &x[l + l * x_dim1], &c__1);
q__1.r = r__1, q__1.i = (float)0.;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< if (cabs1(s(l)) .eq. 0.0e0) go to 10 >*/
i__2 = l;
if ((r__1 = s[i__2].r, dabs(r__1)) + (r__2 = r_imag(&s[l]), dabs(r__2)
) == (float)0.) {
goto L10;
}
/*< if (cabs1(x(l,l)) .ne. 0.0e0) s(l) = csign(s(l),x(l,l)) >*/
i__2 = l + l * x_dim1;
if ((r__1 = x[i__2].r, dabs(r__1)) + (r__2 = r_imag(&x[l + l * x_dim1]
), dabs(r__2)) != (float)0.) {
i__3 = l;
r__3 = c_abs(&s[l]);
i__4 = l + l * x_dim1;
r__4 = c_abs(&x[l + l * x_dim1]);
q__2.r = x[i__4].r / r__4, q__2.i = x[i__4].i / r__4;
q__1.r = r__3 * q__2.r, q__1.i = r__3 * q__2.i;
s[i__3].r = q__1.r, s[i__3].i = q__1.i;
}
/*< call cscal(n-l+1,1.0e0/s(l),x(l,l),1) >*/
i__2 = *n - l + 1;
c_div(&q__1, &c_b8, &s[l]);
cscal_(&i__2, &q__1, &x[l + l * x_dim1], &c__1);
/*< x(l,l) = (1.0e0,0.0e0) + x(l,l) >*/
i__2 = l + l * x_dim1;
i__3 = l + l * x_dim1;
q__1.r = x[i__3].r + (float)1., q__1.i = x[i__3].i + (float)0.;
x[i__2].r = q__1.r, x[i__2].i = q__1.i;
/*< 10 continue >*/
L10:
/*< s(l) = -s(l) >*/
i__2 = l;
i__3 = l;
q__1.r = -s[i__3].r, q__1.i = -s[i__3].i;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< 20 continue >*/
L20:
/*< if (p .lt. lp1) go to 50 >*/
if (*p < lp1) {
goto L50;
}
/*< do 40 j = lp1, p >*/
i__2 = *p;
for (j = lp1; j <= i__2; ++j) {
/*< if (l .gt. nct) go to 30 >*/
if (l > nct) {
goto L30;
}
/*< if (cabs1(s(l)) .eq. 0.0e0) go to 30 >*/
i__3 = l;
if ((r__1 = s[i__3].r, dabs(r__1)) + (r__2 = r_imag(&s[l]), dabs(
r__2)) == (float)0.) {
goto L30;
}
/* apply the transformation. */
/*< t = -cdotc(n-l+1,x(l,l),1,x(l,j),1)/x(l,l) >*/
i__3 = *n - l + 1;
cdotc_(&q__3, &i__3, &x[l + l * x_dim1], &c__1, &x[l + j * x_dim1]
, &c__1);
q__2.r = -q__3.r, q__2.i = -q__3.i;
c_div(&q__1, &q__2, &x[l + l * x_dim1]);
t.r = q__1.r, t.i = q__1.i;
/*< call caxpy(n-l+1,t,x(l,l),1,x(l,j),1) >*/
i__3 = *n - l + 1;
caxpy_(&i__3, &t, &x[l + l * x_dim1], &c__1, &x[l + j * x_dim1], &
c__1);
/*< 30 continue >*/
L30:
/* place the l-th row of x into e for the */
/* subsequent calculation of the row transformation. */
/*< e(j) = conjg(x(l,j)) >*/
i__3 = j;
r_cnjg(&q__1, &x[l + j * x_dim1]);
e[i__3].r = q__1.r, e[i__3].i = q__1.i;
/*< 40 continue >*/
/* L40: */
}
/*< 50 continue >*/
L50:
/*< if (.not.wantu .or. l .gt. nct) go to 70 >*/
if (! wantu || l > nct) {
goto L70;
}
/* place the transformation in u for subsequent back */
/* multiplication. */
/*< do 60 i = l, n >*/
i__2 = *n;
for (i__ = l; i__ <= i__2; ++i__) {
/*< u(i,l) = x(i,l) >*/
i__3 = i__ + l * u_dim1;
i__4 = i__ + l * x_dim1;
u[i__3].r = x[i__4].r, u[i__3].i = x[i__4].i;
/*< 60 continue >*/
/* L60: */
}
/*< 70 continue >*/
L70:
/*< if (l .gt. nrt) go to 150 >*/
if (l > nrt) {
goto L150;
}
/* compute the l-th row transformation and place the */
/* l-th super-diagonal in e(l). */
/*< e(l) = cmplx(scnrm2(p-l,e(lp1),1),0.0e0) >*/
i__2 = l;
i__3 = *p - l;
r__1 = scnrm2_(&i__3, &e[lp1], &c__1);
q__1.r = r__1, q__1.i = (float)0.;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< if (cabs1(e(l)) .eq. 0.0e0) go to 80 >*/
i__2 = l;
if ((r__1 = e[i__2].r, dabs(r__1)) + (r__2 = r_imag(&e[l]), dabs(r__2)
) == (float)0.) {
goto L80;
}
/*< if (cabs1(e(lp1)) .ne. 0.0e0) e(l) = csign(e(l),e(lp1)) >*/
i__2 = lp1;
if ((r__1 = e[i__2].r, dabs(r__1)) + (r__2 = r_imag(&e[lp1]), dabs(
r__2)) != (float)0.) {
i__3 = l;
r__3 = c_abs(&e[l]);
i__4 = lp1;
r__4 = c_abs(&e[lp1]);
q__2.r = e[i__4].r / r__4, q__2.i = e[i__4].i / r__4;
q__1.r = r__3 * q__2.r, q__1.i = r__3 * q__2.i;
e[i__3].r = q__1.r, e[i__3].i = q__1.i;
}
/*< call cscal(p-l,1.0e0/e(l),e(lp1),1) >*/
i__2 = *p - l;
c_div(&q__1, &c_b8, &e[l]);
cscal_(&i__2, &q__1, &e[lp1], &c__1);
/*< e(lp1) = (1.0e0,0.0e0) + e(lp1) >*/
i__2 = lp1;
i__3 = lp1;
q__1.r = e[i__3].r + (float)1., q__1.i = e[i__3].i + (float)0.;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< 80 continue >*/
L80:
/*< e(l) = -conjg(e(l)) >*/
i__2 = l;
r_cnjg(&q__2, &e[l]);
q__1.r = -q__2.r, q__1.i = -q__2.i;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< if (lp1 .gt. n .or. cabs1(e(l)) .eq. 0.0e0) go to 120 >*/
i__2 = l;
if (lp1 > *n || (r__1 = e[i__2].r, dabs(r__1)) + (r__2 = r_imag(&e[l])
, dabs(r__2)) == (float)0.) {
goto L120;
}
/* apply the transformation. */
/*< do 90 i = lp1, n >*/
i__2 = *n;
for (i__ = lp1; i__ <= i__2; ++i__) {
/*< work(i) = (0.0e0,0.0e0) >*/
i__3 = i__;
work[i__3].r = (float)0., work[i__3].i = (float)0.;
/*< 90 continue >*/
/* L90: */
}
/*< do 100 j = lp1, p >*/
i__2 = *p;
for (j = lp1; j <= i__2; ++j) {
/*< call caxpy(n-l,e(j),x(lp1,j),1,work(lp1),1) >*/
i__3 = *n - l;
caxpy_(&i__3, &e[j], &x[lp1 + j * x_dim1], &c__1, &work[lp1], &
c__1);
/*< 100 continue >*/
/* L100: */
}
/*< do 110 j = lp1, p >*/
i__2 = *p;
for (j = lp1; j <= i__2; ++j) {
i__3 = *n - l;
i__4 = j;
q__3.r = -e[i__4].r, q__3.i = -e[i__4].i;
c_div(&q__2, &q__3, &e[lp1]);
r_cnjg(&q__1, &q__2);
caxpy_(&i__3, &q__1, &work[lp1], &c__1, &x[lp1 + j * x_dim1], &
c__1);
/*< 110 continue >*/
/* L110: */
}
/*< 120 continue >*/
L120:
/*< if (.not.wantv) go to 140 >*/
if (! wantv) {
goto L140;
}
/* place the transformation in v for subsequent */
/* back multiplication. */
/*< do 130 i = lp1, p >*/
i__2 = *p;
for (i__ = lp1; i__ <= i__2; ++i__) {
/*< v(i,l) = e(i) >*/
i__3 = i__ + l * v_dim1;
i__4 = i__;
v[i__3].r = e[i__4].r, v[i__3].i = e[i__4].i;
/*< 130 continue >*/
/* L130: */
}
/*< 140 continue >*/
L140:
/*< 150 continue >*/
L150:
/*< 160 continue >*/
/* L160: */
;
}
/*< 170 continue >*/
L170:
/* set up the final bidiagonal matrix or order m. */
/*< m = min0(p,n+1) >*/
/* Computing MIN */
i__1 = *p, i__2 = *n + 1;
m = min(i__1,i__2);
/*< nctp1 = nct + 1 >*/
nctp1 = nct + 1;
/*< nrtp1 = nrt + 1 >*/
nrtp1 = nrt + 1;
/*< if (nct .lt. p) s(nctp1) = x(nctp1,nctp1) >*/
if (nct < *p) {
i__1 = nctp1;
i__2 = nctp1 + nctp1 * x_dim1;
s[i__1].r = x[i__2].r, s[i__1].i = x[i__2].i;
}
/*< if (n .lt. m) s(m) = (0.0e0,0.0e0) >*/
if (*n < m) {
i__1 = m;
s[i__1].r = (float)0., s[i__1].i = (float)0.;
}
/*< if (nrtp1 .lt. m) e(nrtp1) = x(nrtp1,m) >*/
if (nrtp1 < m) {
i__1 = nrtp1;
i__2 = nrtp1 + m * x_dim1;
e[i__1].r = x[i__2].r, e[i__1].i = x[i__2].i;
}
/*< e(m) = (0.0e0,0.0e0) >*/
i__1 = m;
e[i__1].r = (float)0., e[i__1].i = (float)0.;
/* if required, generate u. */
/*< if (.not.wantu) go to 300 >*/
if (! wantu) {
goto L300;
}
/*< if (ncu .lt. nctp1) go to 200 >*/
if (ncu < nctp1) {
goto L200;
}
/*< do 190 j = nctp1, ncu >*/
i__1 = ncu;
for (j = nctp1; j <= i__1; ++j) {
/*< do 180 i = 1, n >*/
i__2 = *n;
for (i__ = 1; i__ <= i__2; ++i__) {
/*< u(i,j) = (0.0e0,0.0e0) >*/
i__3 = i__ + j * u_dim1;
u[i__3].r = (float)0., u[i__3].i = (float)0.;
/*< 180 continue >*/
/* L180: */
}
/*< u(j,j) = (1.0e0,0.0e0) >*/
i__2 = j + j * u_dim1;
u[i__2].r = (float)1., u[i__2].i = (float)0.;
/*< 190 continue >*/
/* L190: */
}
/*< 200 continue >*/
L200:
/*< if (nct .lt. 1) go to 290 >*/
if (nct < 1) {
goto L290;
}
/*< do 280 ll = 1, nct >*/
i__1 = nct;
for (ll = 1; ll <= i__1; ++ll) {
/*< l = nct - ll + 1 >*/
l = nct - ll + 1;
/*< if (cabs1(s(l)) .eq. 0.0e0) go to 250 >*/
i__2 = l;
if ((r__1 = s[i__2].r, dabs(r__1)) + (r__2 = r_imag(&s[l]), dabs(r__2)
) == (float)0.) {
goto L250;
}
/*< lp1 = l + 1 >*/
lp1 = l + 1;
/*< if (ncu .lt. lp1) go to 220 >*/
if (ncu < lp1) {
goto L220;
}
/*< do 210 j = lp1, ncu >*/
i__2 = ncu;
for (j = lp1; j <= i__2; ++j) {
/*< t = -cdotc(n-l+1,u(l,l),1,u(l,j),1)/u(l,l) >*/
i__3 = *n - l + 1;
cdotc_(&q__3, &i__3, &u[l + l * u_dim1], &c__1, &u[l + j * u_dim1]
, &c__1);
q__2.r = -q__3.r, q__2.i = -q__3.i;
c_div(&q__1, &q__2, &u[l + l * u_dim1]);
t.r = q__1.r, t.i = q__1.i;
/*< call caxpy(n-l+1,t,u(l,l),1,u(l,j),1) >*/
i__3 = *n - l + 1;
caxpy_(&i__3, &t, &u[l + l * u_dim1], &c__1, &u[l + j * u_dim1], &
c__1);
/*< 210 continue >*/
/* L210: */
}
/*< 220 continue >*/
L220:
/*< call cscal(n-l+1,(-1.0e0,0.0e0),u(l,l),1) >*/
i__2 = *n - l + 1;
cscal_(&i__2, &c_b53, &u[l + l * u_dim1], &c__1);
/*< u(l,l) = (1.0e0,0.0e0) + u(l,l) >*/
i__2 = l + l * u_dim1;
i__3 = l + l * u_dim1;
q__1.r = u[i__3].r + (float)1., q__1.i = u[i__3].i + (float)0.;
u[i__2].r = q__1.r, u[i__2].i = q__1.i;
/*< lm1 = l - 1 >*/
lm1 = l - 1;
/*< if (lm1 .lt. 1) go to 240 >*/
if (lm1 < 1) {
goto L240;
}
/*< do 230 i = 1, lm1 >*/
i__2 = lm1;
for (i__ = 1; i__ <= i__2; ++i__) {
/*< u(i,l) = (0.0e0,0.0e0) >*/
i__3 = i__ + l * u_dim1;
u[i__3].r = (float)0., u[i__3].i = (float)0.;
/*< 230 continue >*/
/* L230: */
}
/*< 240 continue >*/
L240:
/*< go to 270 >*/
goto L270;
/*< 250 continue >*/
L250:
/*< do 260 i = 1, n >*/
i__2 = *n;
for (i__ = 1; i__ <= i__2; ++i__) {
/*< u(i,l) = (0.0e0,0.0e0) >*/
i__3 = i__ + l * u_dim1;
u[i__3].r = (float)0., u[i__3].i = (float)0.;
/*< 260 continue >*/
/* L260: */
}
/*< u(l,l) = (1.0e0,0.0e0) >*/
i__2 = l + l * u_dim1;
u[i__2].r = (float)1., u[i__2].i = (float)0.;
/*< 270 continue >*/
L270:
/*< 280 continue >*/
/* L280: */
;
}
/*< 290 continue >*/
L290:
/*< 300 continue >*/
L300:
/* if it is required, generate v. */
/*< if (.not.wantv) go to 350 >*/
if (! wantv) {
goto L350;
}
/*< do 340 ll = 1, p >*/
i__1 = *p;
for (ll = 1; ll <= i__1; ++ll) {
/*< l = p - ll + 1 >*/
l = *p - ll + 1;
/*< lp1 = l + 1 >*/
lp1 = l + 1;
/*< if (l .gt. nrt) go to 320 >*/
if (l > nrt) {
goto L320;
}
/*< if (cabs1(e(l)) .eq. 0.0e0) go to 320 >*/
i__2 = l;
if ((r__1 = e[i__2].r, dabs(r__1)) + (r__2 = r_imag(&e[l]), dabs(r__2)
) == (float)0.) {
goto L320;
}
/*< do 310 j = lp1, p >*/
i__2 = *p;
for (j = lp1; j <= i__2; ++j) {
/*< t = -cdotc(p-l,v(lp1,l),1,v(lp1,j),1)/v(lp1,l) >*/
i__3 = *p - l;
cdotc_(&q__3, &i__3, &v[lp1 + l * v_dim1], &c__1, &v[lp1 + j *
v_dim1], &c__1);
q__2.r = -q__3.r, q__2.i = -q__3.i;
c_div(&q__1, &q__2, &v[lp1 + l * v_dim1]);
t.r = q__1.r, t.i = q__1.i;
/*< call caxpy(p-l,t,v(lp1,l),1,v(lp1,j),1) >*/
i__3 = *p - l;
caxpy_(&i__3, &t, &v[lp1 + l * v_dim1], &c__1, &v[lp1 + j *
v_dim1], &c__1);
/*< 310 continue >*/
/* L310: */
}
/*< 320 continue >*/
L320:
/*< do 330 i = 1, p >*/
i__2 = *p;
for (i__ = 1; i__ <= i__2; ++i__) {
/*< v(i,l) = (0.0e0,0.0e0) >*/
i__3 = i__ + l * v_dim1;
v[i__3].r = (float)0., v[i__3].i = (float)0.;
/*< 330 continue >*/
/* L330: */
}
/*< v(l,l) = (1.0e0,0.0e0) >*/
i__2 = l + l * v_dim1;
v[i__2].r = (float)1., v[i__2].i = (float)0.;
/*< 340 continue >*/
/* L340: */
}
/*< 350 continue >*/
L350:
/* transform s and e so that they are real. */
/*< do 380 i = 1, m >*/
i__1 = m;
for (i__ = 1; i__ <= i__1; ++i__) {
/*< if (cabs1(s(i)) .eq. 0.0e0) go to 360 >*/
i__2 = i__;
if ((r__1 = s[i__2].r, dabs(r__1)) + (r__2 = r_imag(&s[i__]), dabs(
r__2)) == (float)0.) {
goto L360;
}
/*< t = cmplx(cabs(s(i)),0.0e0) >*/
r__1 = c_abs(&s[i__]);
q__1.r = r__1, q__1.i = (float)0.;
t.r = q__1.r, t.i = q__1.i;
/*< r = s(i)/t >*/
c_div(&q__1, &s[i__], &t);
r__.r = q__1.r, r__.i = q__1.i;
/*< s(i) = t >*/
i__2 = i__;
s[i__2].r = t.r, s[i__2].i = t.i;
/*< if (i .lt. m) e(i) = e(i)/r >*/
if (i__ < m) {
i__2 = i__;
c_div(&q__1, &e[i__], &r__);
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
}
/*< if (wantu) call cscal(n,r,u(1,i),1) >*/
if (wantu) {
cscal_(n, &r__, &u[i__ * u_dim1 + 1], &c__1);
}
/*< 360 continue >*/
L360:
/* ...exit */
/*< if (i .eq. m) go to 390 >*/
if (i__ == m) {
goto L390;
}
/*< if (cabs1(e(i)) .eq. 0.0e0) go to 370 >*/
i__2 = i__;
if ((r__1 = e[i__2].r, dabs(r__1)) + (r__2 = r_imag(&e[i__]), dabs(
r__2)) == (float)0.) {
goto L370;
}
/*< t = cmplx(cabs(e(i)),0.0e0) >*/
r__1 = c_abs(&e[i__]);
q__1.r = r__1, q__1.i = (float)0.;
t.r = q__1.r, t.i = q__1.i;
/*< r = t/e(i) >*/
c_div(&q__1, &t, &e[i__]);
r__.r = q__1.r, r__.i = q__1.i;
/*< e(i) = t >*/
i__2 = i__;
e[i__2].r = t.r, e[i__2].i = t.i;
/*< s(i+1) = s(i+1)*r >*/
i__2 = i__ + 1;
i__3 = i__ + 1;
q__1.r = s[i__3].r * r__.r - s[i__3].i * r__.i, q__1.i = s[i__3].r *
r__.i + s[i__3].i * r__.r;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< if (wantv) call cscal(p,r,v(1,i+1),1) >*/
if (wantv) {
cscal_(p, &r__, &v[(i__ + 1) * v_dim1 + 1], &c__1);
}
/*< 370 continue >*/
L370:
/*< 380 continue >*/
/* L380: */
;
}
/*< 390 continue >*/
L390:
/* main iteration loop for the singular values. */
/*< mm = m >*/
mm = m;
/*< iter = 0 >*/
iter = 0;
/*< 400 continue >*/
L400:
/* quit if all the singular values have been found. */
/* ...exit */
/*< if (m .eq. 0) go to 660 >*/
if (m == 0) {
goto L660;
}
/* if too many iterations have been performed, set */
/* flag and return. */
/*< if (iter .lt. maxit) go to 410 >*/
if (iter < maxit) {
goto L410;
}
/*< info = m >*/
*info = m;
/* ......exit */
/*< go to 660 >*/
goto L660;
/*< 410 continue >*/
L410:
/* this section of the program inspects for */
/* negligible elements in the s and e arrays. on */
/* completion the variables kase and l are set as follows. */
/* kase = 1 if s(m) and e(l-1) are negligible and l.lt.m */
/* kase = 2 if s(l) is negligible and l.lt.m */
/* kase = 3 if e(l-1) is negligible, l.lt.m, and */
/* s(l), ..., s(m) are not negligible (qr step). */
/* kase = 4 if e(m-1) is negligible (convergence). */
/*< do 430 ll = 1, m >*/
i__1 = m;
for (ll = 1; ll <= i__1; ++ll) {
/*< l = m - ll >*/
l = m - ll;
/* ...exit */
/*< if (l .eq. 0) go to 440 >*/
if (l == 0) {
goto L440;
}
/*< test = cabs(s(l)) + cabs(s(l+1)) >*/
test = c_abs(&s[l]) + c_abs(&s[l + 1]);
/*< ztest = test + cabs(e(l)) >*/
ztest = test + c_abs(&e[l]);
/*< if (ztest .ne. test) go to 420 >*/
if (ztest != test) {
goto L420;
}
/*< e(l) = (0.0e0,0.0e0) >*/
i__2 = l;
e[i__2].r = (float)0., e[i__2].i = (float)0.;
/* ......exit */
/*< go to 440 >*/
goto L440;
/*< 420 continue >*/
L420:
/*< 430 continue >*/
/* L430: */
;
}
/*< 440 continue >*/
L440:
/*< if (l .ne. m - 1) go to 450 >*/
if (l != m - 1) {
goto L450;
}
/*< kase = 4 >*/
kase = 4;
/*< go to 520 >*/
goto L520;
/*< 450 continue >*/
L450:
/*< lp1 = l + 1 >*/
lp1 = l + 1;
/*< mp1 = m + 1 >*/
mp1 = m + 1;
/*< do 470 lls = lp1, mp1 >*/
i__1 = mp1;
for (lls = lp1; lls <= i__1; ++lls) {
/*< ls = m - lls + lp1 >*/
ls = m - lls + lp1;
/* ...exit */
/*< if (ls .eq. l) go to 480 >*/
if (ls == l) {
goto L480;
}
/*< test = 0.0e0 >*/
test = (float)0.;
/*< if (ls .ne. m) test = test + cabs(e(ls)) >*/
if (ls != m) {
test += c_abs(&e[ls]);
}
/*< if (ls .ne. l + 1) test = test + cabs(e(ls-1)) >*/
if (ls != l + 1) {
test += c_abs(&e[ls - 1]);
}
/*< ztest = test + cabs(s(ls)) >*/
ztest = test + c_abs(&s[ls]);
/*< if (ztest .ne. test) go to 460 >*/
if (ztest != test) {
goto L460;
}
/*< s(ls) = (0.0e0,0.0e0) >*/
i__2 = ls;
s[i__2].r = (float)0., s[i__2].i = (float)0.;
/* ......exit */
/*< go to 480 >*/
goto L480;
/*< 460 continue >*/
L460:
/*< 470 continue >*/
/* L470: */
;
}
/*< 480 continue >*/
L480:
/*< if (ls .ne. l) go to 490 >*/
if (ls != l) {
goto L490;
}
/*< kase = 3 >*/
kase = 3;
/*< go to 510 >*/
goto L510;
/*< 490 continue >*/
L490:
/*< if (ls .ne. m) go to 500 >*/
if (ls != m) {
goto L500;
}
/*< kase = 1 >*/
kase = 1;
/*< go to 510 >*/
goto L510;
/*< 500 continue >*/
L500:
/*< kase = 2 >*/
kase = 2;
/*< l = ls >*/
l = ls;
/*< 510 continue >*/
L510:
/*< 520 continue >*/
L520:
/*< l = l + 1 >*/
++l;
/* perform the task indicated by kase. */
/*< go to (530, 560, 580, 610), kase >*/
switch (kase) {
case 1: goto L530;
case 2: goto L560;
case 3: goto L580;
case 4: goto L610;
}
/* deflate negligible s(m). */
/*< 530 continue >*/
L530:
/*< mm1 = m - 1 >*/
mm1 = m - 1;
/*< f = real(e(m-1)) >*/
i__1 = m - 1;
f = e[i__1].r;
/*< e(m-1) = (0.0e0,0.0e0) >*/
i__1 = m - 1;
e[i__1].r = (float)0., e[i__1].i = (float)0.;
/*< do 550 kk = l, mm1 >*/
i__1 = mm1;
for (kk = l; kk <= i__1; ++kk) {
/*< k = mm1 - kk + l >*/
k = mm1 - kk + l;
/*< t1 = real(s(k)) >*/
i__2 = k;
t1 = s[i__2].r;
/*< call srotg(t1,f,cs,sn) >*/
srotg_(&t1, &f, &cs, &sn);
/*< s(k) = cmplx(t1,0.0e0) >*/
i__2 = k;
q__1.r = t1, q__1.i = (float)0.;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< if (k .eq. l) go to 540 >*/
if (k == l) {
goto L540;
}
/*< f = -sn*real(e(k-1)) >*/
i__2 = k - 1;
f = -sn * e[i__2].r;
/*< e(k-1) = cs*e(k-1) >*/
i__2 = k - 1;
i__3 = k - 1;
q__1.r = cs * e[i__3].r, q__1.i = cs * e[i__3].i;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< 540 continue >*/
L540:
/*< if (wantv) call csrot(p,v(1,k),1,v(1,m),1,cs,sn) >*/
if (wantv) {
csrot_(p, &v[k * v_dim1 + 1], &c__1, &v[m * v_dim1 + 1], &c__1, &
cs, &sn);
}
/*< 550 continue >*/
/* L550: */
}
/*< go to 650 >*/
goto L650;
/* split at negligible s(l). */
/*< 560 continue >*/
L560:
/*< f = real(e(l-1)) >*/
i__1 = l - 1;
f = e[i__1].r;
/*< e(l-1) = (0.0e0,0.0e0) >*/
i__1 = l - 1;
e[i__1].r = (float)0., e[i__1].i = (float)0.;
/*< do 570 k = l, m >*/
i__1 = m;
for (k = l; k <= i__1; ++k) {
/*< t1 = real(s(k)) >*/
i__2 = k;
t1 = s[i__2].r;
/*< call srotg(t1,f,cs,sn) >*/
srotg_(&t1, &f, &cs, &sn);
/*< s(k) = cmplx(t1,0.0e0) >*/
i__2 = k;
q__1.r = t1, q__1.i = (float)0.;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< f = -sn*real(e(k)) >*/
i__2 = k;
f = -sn * e[i__2].r;
/*< e(k) = cs*e(k) >*/
i__2 = k;
i__3 = k;
q__1.r = cs * e[i__3].r, q__1.i = cs * e[i__3].i;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< if (wantu) call csrot(n,u(1,k),1,u(1,l-1),1,cs,sn) >*/
if (wantu) {
csrot_(n, &u[k * u_dim1 + 1], &c__1, &u[(l - 1) * u_dim1 + 1], &
c__1, &cs, &sn);
}
/*< 570 continue >*/
/* L570: */
}
/*< go to 650 >*/
goto L650;
/* perform one qr step. */
/*< 580 continue >*/
L580:
/* calculate the shift. */
/* Computing MAX */
r__1 = c_abs(&s[m]), r__2 = c_abs(&s[m - 1]), r__1 = max(r__1,r__2), r__2
= c_abs(&e[m - 1]), r__1 = max(r__1,r__2), r__2 = c_abs(&s[l]),
r__1 = max(r__1,r__2), r__2 = c_abs(&e[l]);
scale = dmax(r__1,r__2);
/*< sm = real(s(m))/scale >*/
i__1 = m;
sm = s[i__1].r / scale;
/*< smm1 = real(s(m-1))/scale >*/
i__1 = m - 1;
smm1 = s[i__1].r / scale;
/*< emm1 = real(e(m-1))/scale >*/
i__1 = m - 1;
emm1 = e[i__1].r / scale;
/*< sl = real(s(l))/scale >*/
i__1 = l;
sl = s[i__1].r / scale;
/*< el = real(e(l))/scale >*/
i__1 = l;
el = e[i__1].r / scale;
/*< b = ((smm1 + sm)*(smm1 - sm) + emm1**2)/2.0e0 >*/
/* Computing 2nd power */
r__1 = emm1;
b = ((smm1 + sm) * (smm1 - sm) + r__1 * r__1) / (float)2.;
/*< c = (sm*emm1)**2 >*/
/* Computing 2nd power */
r__1 = sm * emm1;
c__ = r__1 * r__1;
/*< shift = 0.0e0 >*/
shift = (float)0.;
/*< if (b .eq. 0.0e0 .and. c .eq. 0.0e0) go to 590 >*/
if (b == (float)0. && c__ == (float)0.) {
goto L590;
}
/*< shift = sqrt(b**2+c) >*/
/* Computing 2nd power */
r__1 = b;
shift = sqrt(r__1 * r__1 + c__);
/*< if (b .lt. 0.0e0) shift = -shift >*/
if (b < (float)0.) {
shift = -shift;
}
/*< shift = c/(b + shift) >*/
shift = c__ / (b + shift);
/*< 590 continue >*/
L590:
/*< f = (sl + sm)*(sl - sm) + shift >*/
f = (sl + sm) * (sl - sm) + shift;
/*< g = sl*el >*/
g = sl * el;
/* chase zeros. */
/*< mm1 = m - 1 >*/
mm1 = m - 1;
/*< do 600 k = l, mm1 >*/
i__1 = mm1;
for (k = l; k <= i__1; ++k) {
/*< call srotg(f,g,cs,sn) >*/
srotg_(&f, &g, &cs, &sn);
/*< if (k .ne. l) e(k-1) = cmplx(f,0.0e0) >*/
if (k != l) {
i__2 = k - 1;
q__1.r = f, q__1.i = (float)0.;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
}
/*< f = cs*real(s(k)) + sn*real(e(k)) >*/
i__2 = k;
i__3 = k;
f = cs * s[i__2].r + sn * e[i__3].r;
/*< e(k) = cs*e(k) - sn*s(k) >*/
i__2 = k;
i__3 = k;
q__2.r = cs * e[i__3].r, q__2.i = cs * e[i__3].i;
i__4 = k;
q__3.r = sn * s[i__4].r, q__3.i = sn * s[i__4].i;
q__1.r = q__2.r - q__3.r, q__1.i = q__2.i - q__3.i;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
/*< g = sn*real(s(k+1)) >*/
i__2 = k + 1;
g = sn * s[i__2].r;
/*< s(k+1) = cs*s(k+1) >*/
i__2 = k + 1;
i__3 = k + 1;
q__1.r = cs * s[i__3].r, q__1.i = cs * s[i__3].i;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< if (wantv) call csrot(p,v(1,k),1,v(1,k+1),1,cs,sn) >*/
if (wantv) {
csrot_(p, &v[k * v_dim1 + 1], &c__1, &v[(k + 1) * v_dim1 + 1], &
c__1, &cs, &sn);
}
/*< call srotg(f,g,cs,sn) >*/
srotg_(&f, &g, &cs, &sn);
/*< s(k) = cmplx(f,0.0e0) >*/
i__2 = k;
q__1.r = f, q__1.i = (float)0.;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< f = cs*real(e(k)) + sn*real(s(k+1)) >*/
i__2 = k;
i__3 = k + 1;
f = cs * e[i__2].r + sn * s[i__3].r;
/*< s(k+1) = -sn*e(k) + cs*s(k+1) >*/
i__2 = k + 1;
r__1 = -sn;
i__3 = k;
q__2.r = r__1 * e[i__3].r, q__2.i = r__1 * e[i__3].i;
i__4 = k + 1;
q__3.r = cs * s[i__4].r, q__3.i = cs * s[i__4].i;
q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
s[i__2].r = q__1.r, s[i__2].i = q__1.i;
/*< g = sn*real(e(k+1)) >*/
i__2 = k + 1;
g = sn * e[i__2].r;
/*< e(k+1) = cs*e(k+1) >*/
i__2 = k + 1;
i__3 = k + 1;
q__1.r = cs * e[i__3].r, q__1.i = cs * e[i__3].i;
e[i__2].r = q__1.r, e[i__2].i = q__1.i;
if (wantu && k < *n) {
csrot_(n, &u[k * u_dim1 + 1], &c__1, &u[(k + 1) * u_dim1 + 1], &
c__1, &cs, &sn);
}
/*< 600 continue >*/
/* L600: */
}
/*< e(m-1) = cmplx(f,0.0e0) >*/
i__1 = m - 1;
q__1.r = f, q__1.i = (float)0.;
e[i__1].r = q__1.r, e[i__1].i = q__1.i;
/*< iter = iter + 1 >*/
++iter;
/*< go to 650 >*/
goto L650;
/* convergence. */
/*< 610 continue >*/
L610:
/* make the singular value positive */
/*< if (real(s(l)) .ge. 0.0e0) go to 620 >*/
i__1 = l;
if (s[i__1].r >= (float)0.) {
goto L620;
}
/*< s(l) = -s(l) >*/
i__1 = l;
i__2 = l;
q__1.r = -s[i__2].r, q__1.i = -s[i__2].i;
s[i__1].r = q__1.r, s[i__1].i = q__1.i;
/*< if (wantv) call cscal(p,(-1.0e0,0.0e0),v(1,l),1) >*/
if (wantv) {
cscal_(p, &c_b53, &v[l * v_dim1 + 1], &c__1);
}
/*< 620 continue >*/
L620:
/* order the singular value. */
/*< 630 if (l .eq. mm) go to 640 >*/
L630:
if (l == mm) {
goto L640;
}
/* ...exit */
/*< if (real(s(l)) .ge. real(s(l+1))) go to 640 >*/
i__1 = l;
i__2 = l + 1;
if (s[i__1].r >= s[i__2].r) {
goto L640;
}
/*< t = s(l) >*/
i__1 = l;
t.r = s[i__1].r, t.i = s[i__1].i;
/*< s(l) = s(l+1) >*/
i__1 = l;
i__2 = l + 1;
s[i__1].r = s[i__2].r, s[i__1].i = s[i__2].i;
/*< s(l+1) = t >*/
i__1 = l + 1;
s[i__1].r = t.r, s[i__1].i = t.i;
if (wantv && l < *p) {
cswap_(p, &v[l * v_dim1 + 1], &c__1, &v[(l + 1) * v_dim1 + 1], &c__1);
}
if (wantu && l < *n) {
cswap_(n, &u[l * u_dim1 + 1], &c__1, &u[(l + 1) * u_dim1 + 1], &c__1);
}
/*< l = l + 1 >*/
++l;
/*< go to 630 >*/
goto L630;
/*< 640 continue >*/
L640:
/*< iter = 0 >*/
iter = 0;
/*< m = m - 1 >*/
--m;
/*< 650 continue >*/
L650:
/*< go to 400 >*/
goto L400;
/*< 660 continue >*/
L660:
/*< return >*/
return 0;
/*< end >*/
} /* csvdc_ */
#ifdef __cplusplus
}
#endif
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Editor.VisualBasic.KeywordHighlighting
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting
Public Class <API key>
Inherits <API key>
Friend Overrides Function CreateHighlighter() As IHighlighter
Return New <API key>()
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestWhileBlock1() As Task
Await TestAsync(<Text>
Class C
Sub M()
{|Cursor:[|While|]|} True
If x Then
[|Exit While|]
Else
[|Continue While|]
End If
[|End While|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestWhileBlock2() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|While|] True
If x Then
{|Cursor:[|Exit While|]|}
Else
[|Continue While|]
End If
[|End While|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestWhileBlock3() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|While|] True
If x Then
[|Exit While|]
Else
{|Cursor:[|Continue While|]|}
End If
[|End While|]
End Sub
End Class</Text>)
End Function
<Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
Public Async Function TestWhileBlock4() As Task
Await TestAsync(<Text>
Class C
Sub M()
[|While|] True
If x Then
[|Exit While|]
Else
[|Continue While|]
End If
{|Cursor:[|End While|]|}
End Sub
End Class</Text>)
End Function
End Class
End Namespace
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=constant.LC_PAPER.html">
</head>
<body>
<p>Redirecting to <a href="constant.LC_PAPER.html">constant.LC_PAPER.html</a>...</p>
<script>location.replace("constant.LC_PAPER.html" + location.search + location.hash);</script>
</body>
</html>
|
var RokIEWarn=new Class({site:"sitename",initialize:function(f){var d=f;this.box=new Element("div",{id:"iewarn"}).inject(document.body,"top");var g=new Element("div").inject(this.box).set("html",d);
var e=this.toggle.bind(this);var c=new Element("a",{id:"iewarn_close"}).addEvents({mouseover:function(){this.addClass("cHover");},mouseout:function(){this.removeClass("cHover");
},click:function(){e();}}).inject(g,"top");this.height=document.id("iewarn").getSize().y;this.fx=new Fx.Morph(this.box,{duration:1000}).set({top:document.id("iewarn").getStyle("top").toInt()});
this.open=false;var b=Cookie.read("rokIEWarn"),a=this.height;if(!b||b=="open"){this.show();}else{this.fx.set({top:-a});}return;},show:function(){this.fx.start({top:0});
this.open=true;Cookie.write("rokIEWarn","open",{duration:7});},close:function(){var a=this.height;this.fx.start({top:-a});this.open=false;Cookie.write("rokIEWarn","close",{duration:7});
},status:function(){return this.open;},toggle:function(){if(this.open){this.close();}else{this.show();}}});
|
from sentry.testutils.cases import RuleTestCase
from sentry.rules.conditions.first_seen_event import <API key>
class <API key>(RuleTestCase):
rule_cls = <API key>
def <API key>(self):
rule = self.get_rule()
self.assertPasses(rule, self.event, is_new=True)
self.assertDoesNotPass(rule, self.event, is_new=False)
|
<?php
namespace lithium\tests\cases\console\command\create;
use lithium\console\command\create\Model;
use lithium\console\Request;
use lithium\core\Libraries;
class ModelTest extends \lithium\test\Unit {
public $request;
protected $_backup = array();
protected $_testPath = null;
public function skip() {
$this->_testPath = Libraries::get(true, 'resources') . '/tmp/tests';
$this->skipIf(!is_writable($this->_testPath), "Path `{$this->_testPath}` is not writable.");
}
public function setUp() {
$this->classes = array('response' => 'lithium\tests\mocks\console\MockResponse');
$this->_backup['cwd'] = getcwd();
$this->_backup['_SERVER'] = $_SERVER;
$_SERVER['argv'] = array();
Libraries::add('create_test', array('path' => $this->_testPath . '/create_test'));
$this->request = new Request(array('input' => fopen('php://temp', 'w+')));
$this->request->params = array('library' => 'create_test');
}
public function tearDown() {
$_SERVER = $this->_backup['_SERVER'];
chdir($this->_backup['cwd']);
$this->_cleanUp();
}
public function testClass() {
$this->request->params = array(
'command' => 'model', 'action' => 'Posts'
);
$model = new Model(array(
'request' => $this->request, 'classes' => $this->classes
));
$expected = 'Posts';
$result = $model->invokeMethod('_class', array($this->request));
$this->assertEqual($expected, $result);
}
}
?>
|
// <auto-generated>
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
#region Designer generated code
#pragma warning disable
namespace Orchard.Specs
{
using TechTalk.SpecFlow;
[System.CodeDom.Compiler.<API key>("TechTalk.SpecFlow", "1.9.0.77")]
[System.Runtime.CompilerServices.<API key>()]
[NUnit.Framework.<API key>()]
[NUnit.Framework.<API key>("DateTime Field")]
public partial class <API key>
{
private static TechTalk.SpecFlow.ITestRunner testRunner;
#line 1 "DateTime.feature"
#line hidden
[NUnit.Framework.<API key>()]
public virtual void FeatureSetup()
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "DateTime Field", " In order to add Date content to my types\r\nAs an administrator\r\n I want to crea" +
"te, edit and publish DateTime fields", ProgrammingLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
[NUnit.Framework.<API key>()]
public virtual void FeatureTearDown()
{
testRunner.OnFeatureEnd();
testRunner = null;
}
[NUnit.Framework.SetUpAttribute()]
public virtual void TestInitialize()
{
}
[NUnit.Framework.TearDownAttribute()]
public virtual void ScenarioTearDown()
{
testRunner.OnScenarioEnd();
}
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
{
testRunner.OnScenarioStart(scenarioInfo);
}
public virtual void ScenarioCleanup()
{
testRunner.<API key>();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.<API key>("Creating and using Date fields")]
public virtual void <API key>()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using Date fields", ((string[])(null)));
#line 6
this.ScenarioSetup(scenarioInfo);
#line 9
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 10
testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 11
testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 12
testRunner.Then("I should see \"<a[^>]*>.*?Create new type</a>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 13
testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table1.AddRow(new string[] {
"DisplayName",
"Event"});
table1.AddRow(new string[] {
"Name",
"Event"});
#line 14
testRunner.And("I fill in", ((string)(null)), table1, "And ");
#line 18
testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 19
testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 20
testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 23
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 24
testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table2.AddRow(new string[] {
"DisplayName",
"Date of the event"});
table2.AddRow(new string[] {
"Name",
"EventDate"});
table2.AddRow(new string[] {
"FieldTypeName",
"DateTimeField"});
#line 25
testRunner.And("I fill in", ((string)(null)), table2, "And ");
#line 30
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 31
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 32
testRunner.Then("I should see \"The \\\"Date of the event\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 35
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 36
testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table3.AddRow(new string[] {
"Event.EventDate.Date",
"31/01/2012"});
table3.AddRow(new string[] {
"Event.EventDate.Time",
"12:00 AM"});
#line 37
testRunner.When("I fill in", ((string)(null)), table3, "When ");
#line 41
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 42
testRunner.Then("I should see \"Date of the event is an invalid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 45
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 46
testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table4.AddRow(new string[] {
"Event.EventDate.Date",
"01/31/2012"});
#line 47
testRunner.When("I fill in", ((string)(null)), table4, "When ");
#line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table5.AddRow(new string[] {
"Event.EventDate.Time",
"12:00 AM"});
#line 50
testRunner.And("I fill in", ((string)(null)), table5, "And ");
#line 53
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 54
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 55
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 56
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 57
testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 58
testRunner.And("I should see \"1/31/2012 12:00\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 61
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table6.AddRow(new string[] {
"Fields[0].<API key>.Hint",
"Enter the date of the event"});
#line 62
testRunner.And("I fill in", ((string)(null)), table6, "And ");
#line 65
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 66
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 67
testRunner.Then("I should see \"Enter the date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 70
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table7.AddRow(new string[] {
"Fields[0].<API key>.Display",
"DateOnly"});
#line 71
testRunner.And("I fill in", ((string)(null)), table7, "And ");
#line 74
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 75
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 76
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 77
testRunner.And("I should not see \"Event.EventDate.Time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 80
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table8.AddRow(new string[] {
"Fields[0].<API key>.Display",
"TimeOnly"});
#line 81
testRunner.And("I fill in", ((string)(null)), table8, "And ");
#line 84
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 85
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 86
testRunner.Then("I should see \"Event.EventDate.Time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 87
testRunner.And("I should not see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 90
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table9.AddRow(new string[] {
"Fields[0].<API key>.Display",
"DateAndTime"});
table9.AddRow(new string[] {
"Fields[0].<API key>.Required",
"true"});
#line 91
testRunner.And("I fill in", ((string)(null)), table9, "And ");
#line 95
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 96
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 97
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table10.AddRow(new string[] {
"Event.EventDate.Date",
"01/31/2012"});
table10.AddRow(new string[] {
"Event.EventDate.Time",
"12:00 AM"});
#line 98
testRunner.When("I fill in", ((string)(null)), table10, "When ");
#line 102
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 103
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 104
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 105
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table11.AddRow(new string[] {
"Event.EventDate.Date",
"01/31/2012"});
#line 106
testRunner.And("I fill in", ((string)(null)), table11, "And ");
#line 109
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 110
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 111
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table12.AddRow(new string[] {
"Event.EventDate.Time",
"12:00 AM"});
#line 112
testRunner.And("I fill in", ((string)(null)), table12, "And ");
#line 115
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 116
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 119
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table13.AddRow(new string[] {
"Fields[0].<API key>.Display",
"DateOnly"});
table13.AddRow(new string[] {
"Fields[0].<API key>.Required",
"true"});
#line 120
testRunner.And("I fill in", ((string)(null)), table13, "And ");
#line 124
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 125
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 126
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 127
testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 128
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 131
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table14.AddRow(new string[] {
"Fields[0].<API key>.Display",
"TimeOnly"});
table14.AddRow(new string[] {
"Fields[0].<API key>.Required",
"true"});
#line 132
testRunner.And("I fill in", ((string)(null)), table14, "And ");
#line 136
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 137
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 138
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 139
testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 140
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.<API key>("Creating and using date time fields in another culture")]
public virtual void <API key>()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using date time fields in another culture", ((string[])(null)));
#line 142
this.ScenarioSetup(scenarioInfo);
#line 145
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 146
testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 147
testRunner.And("I have the file \"Content\\orchard.core.po\" in \"Core\\App_Data\\Localization\\fr-FR\\or" +
"chard.core.po\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 148
testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 149
testRunner.Then("I should see \"<a[^>]*>.*?Create new type</a>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 150
testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table15.AddRow(new string[] {
"DisplayName",
"Event"});
table15.AddRow(new string[] {
"Name",
"Event"});
#line 151
testRunner.And("I fill in", ((string)(null)), table15, "And ");
#line 155
testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 156
testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 157
testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 160
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 161
testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table16.AddRow(new string[] {
"DisplayName",
"Date of the event"});
table16.AddRow(new string[] {
"Name",
"EventDate"});
table16.AddRow(new string[] {
"FieldTypeName",
"DateTimeField"});
#line 162
testRunner.And("I fill in", ((string)(null)), table16, "And ");
#line 167
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 168
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 169
testRunner.Then("I should see \"The \\\"Date of the event\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 172
testRunner.When("I have \"fr-FR\" as the default culture", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 173
testRunner.And("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table17.AddRow(new string[] {
"Fields[0].<API key>.Display",
"DateAndTime"});
table17.AddRow(new string[] {
"Fields[0].<API key>.Required",
"true"});
#line 174
testRunner.And("I fill in", ((string)(null)), table17, "And ");
#line 178
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 179
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table18.AddRow(new string[] {
"Event.EventDate.Date",
"01/31/2012"});
table18.AddRow(new string[] {
"Event.EventDate.Time",
"12:00 AM"});
#line 180
testRunner.And("I fill in", ((string)(null)), table18, "And ");
#line 184
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 185
testRunner.Then("I should see \"Date of the event is an invalid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 186
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table19.AddRow(new string[] {
"Event.EventDate.Date",
"31/01/2012"});
table19.AddRow(new string[] {
"Event.EventDate.Time",
"18:00"});
#line 187
testRunner.And("I fill in", ((string)(null)), table19, "And ");
#line 191
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 192
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 193
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
}
}
#pragma warning restore
#endregion
|
require "helper"
describe Octokit::<API key>::Orgs do
before do
Octokit.reset!
@admin_client = <API key>
end
describe ".create_organization", :vcr do
it "creates a new organization" do
@admin_client.create_organization('SuchAGreatOrg', 'gjtorikian')
expect(@admin_client.last_response.status).to eq(201)
assert_requested :post, <API key>("admin/organizations")
end
end # .create_organization
end
|
// Type definitions for es6-promise
interface Thenable<T> {
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
}
declare class Promise<T> implements Thenable<T> {
/**
* If you call resolve in the body of the callback passed to the constructor,
* your promise is fulfilled with result object passed to resolve.
* If you call reject your promise is rejected with the object passed to reject.
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
* Any errors thrown in the constructor callback will be implicitly passed to reject().
*/
constructor(callback: (resolve : (value?: T | Thenable<T>) => void, reject: (error?: any) => void) => void);
/**
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
* If an error is thrown in the callback, the returned promise rejects with that error.
*
* @param onFulfilled called when/if "promise" resolves
* @param onRejected called when/if "promise" rejects
*/
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
/**
* Sugar for promise.then(undefined, onRejected)
*
* @param onRejected called when/if "promise" rejects
*/
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
}
declare namespace Promise {
/**
* Make a new promise from the thenable.
* A thenable is promise-like in as far as it has a "then" method.
*/
function resolve<T>(value?: T | Thenable<T>): Promise<T>;
/**
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
*/
function reject(error: any): Promise<any>;
function reject<T>(error: T): Promise<T>;
/**
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
* the array passed to all can be a mixture of promise-like objects and other objects.
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
*/
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>, T10 | Thenable<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
function all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>, T9 | Thenable<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
function all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>, T8 | Thenable<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
function all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>, T7 | Thenable<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
function all<T1, T2, T3, T4, T5, T6>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>, T6 | Thenable<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
function all<T1, T2, T3, T4, T5>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>, T5 | Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
function all<T1, T2, T3, T4>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>, T4 | Thenable <T4>]): Promise<[T1, T2, T3, T4]>;
function all<T1, T2, T3>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>, T3 | Thenable<T3>]): Promise<[T1, T2, T3]>;
function all<T1, T2>(values: [T1 | Thenable<T1>, T2 | Thenable<T2>]): Promise<[T1, T2]>;
function all<T>(values: (T | Thenable<T>)[]): Promise<T[]>;
/**
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
*/
function race<T>(promises: (T | Thenable<T>)[]): Promise<T>;
}
declare module 'es6-promise' {
var foo: typeof Promise; // Temp variable to reference Promise in local context
namespace rsvp {
export var Promise: typeof foo;
export function polyfill(): void;
}
export = rsvp;
}
|
<?php
namespace Kunstmaan\GeneratorBundle\Generator;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
/**
* Generates all classes/files for a new page
*/
class PageGenerator extends KunstmaanGenerator
{
/**
* @var BundleInterface
*/
private $bundle;
/**
* @var string
*/
private $entity;
/**
* @var string
*/
private $prefix;
/**
* @var array
*/
private $fields;
/**
* @var string
*/
private $template;
/**
* @var array
*/
private $sections;
/**
* @var array
*/
private $parentPages;
/**
* Generate the page.
*
* @param BundleInterface $bundle The bundle
* @param string $entity The entity name
* @param string $prefix The database prefix
* @param array $fields The fields
* @param string $template The page template
* @param array $sections The page sections
* @param array $parentPages The parent pages
*
* @throws \RuntimeException
*/
public function generate(
BundleInterface $bundle,
$entity,
$prefix,
array $fields,
$template,
array $sections,
array $parentPages
) {
$this->bundle = $bundle;
$this->entity = $entity;
$this->prefix = $prefix;
$this->fields = $fields;
$this->template = $template;
$this->sections = $sections;
$this->parentPages = $parentPages;
$this->generatePageEntity();
$this-><API key>();
$this-><API key>();
$this->updateParentPages();
}
/**
* Generate the page entity.
*
* @throws \RuntimeException
*/
private function generatePageEntity()
{
list($entityCode, $entityPath) = $this->generateEntity(
$this->bundle,
$this->entity,
$this->fields,
'Pages',
$this->prefix,
'Kunstmaan\NodeBundle\Entity\AbstractPage'
);
// Add implements <API key>
$search = 'extends \Kunstmaan\NodeBundle\Entity\AbstractPage';
$entityCode = str_replace(
$search,
$search . ' implements \Kunstmaan\PagePartBundle\Helper\<API key>',
$entityCode
);
// Add some extra functions in the generated entity :s
$params = array(
'bundle' => $this->bundle->getName(),
'page' => $this->entity,
'template' => substr($this->template, 0, strlen($this->template) - 4),
'sections' => array_map(
function ($val) {
return substr($val, 0, strlen($val) - 4);
},
$this->sections
),
'adminType' => '\\' . $this->bundle->getNamespace() . '\\Form\\Pages\\' . $this->entity . 'AdminType',
'namespace' => $this->registry->getAliasNamespace($this->bundle->getName()) . '\\Pages\\' . $this->entity
);
$extraCode = $this->render('/Entity/Pages/ExtraFunctions.php', $params);
$pos = strrpos($entityCode, '}');
$trimmed = substr($entityCode, 0, $pos);
$entityCode = $trimmed . $extraCode . "\n}";
// Write class to filesystem
$this->filesystem->mkdir(dirname($entityPath));
file_put_contents($entityPath, $entityCode);
$this->assistant->writeLine('Generating entity : <info>OK</info>');
}
/**
* Generate the admin form type entity.
*/
private function <API key>()
{
$this-><API key>(
$this->bundle,
$this->entity,
'Pages',
$this->fields,
'\Kunstmaan\NodeBundle\Form\PageAdminType'
);
$this->assistant->writeLine('Generating form type : <info>OK</info>');
}
/**
* Generate the page template -and pagepart configuration.
*/
private function <API key>()
{
$this-><API key>($this->bundle);
$this-><API key>($this->bundle);
$this->assistant->writeLine('Generating template configuration : <info>OK</info>');
}
/**
* Update the <API key> function of the parent Page classes
*/
private function updateParentPages()
{
$phpCode = " array(\n";
$phpCode .= " 'name' => '" . $this->entity . "',\n";
$phpCode .= " 'class'=> '" .
$this->bundle->getNamespace() .
"\\Entity\\Pages\\" . $this->entity . "'\n";
$phpCode .= " ),";
// When there is a BehatTestPage, we should also allow the new page as sub page
$behatTestPage = $this->bundle->getPath() . '/Entity/Pages/BehatTestPage.php';
if (file_exists($behatTestPage)) {
$this->parentPages[] = $behatTestPage;
}
foreach ($this->parentPages as $file) {
$data = file_get_contents($file);
$data = preg_replace(
'/(function\s*<API key>\s*\(\)\s*\{\s*return\s*array\s*\()/',
"$1\n$phpCode",
$data
);
file_put_contents($file, $data);
}
}
}
|
var obj = {
num: 123,
str: 'hello',
};
obj.
|
function error_log(message, message_type, destination, extra_headers) {
// % note 1: The dependencies, mail(), syslog(), and file_put_contents()
// % note 1: are either not fullly implemented or implemented at all
// - depends on: mail
// - depends on: syslog
// - depends on: file_put_contents
// * example 1: error_log('Oops!');
// * returns 1: true
var that = this,
_sapi = function() { // SAPI logging (we treat console as the "server" logging; the
// syslog option could do so potentially as well)
if (!that.window.console || !that.window.console.log) {
return false;
}
that.window.console.log(message);
return true;
};
message_type = message_type || 0;
switch (message_type) {
case 1: // Email
var subject = 'PHP error_log message'; // Apparently no way to customize the subject
return this.mail(destination, subject, message, extra_headers);
case 2: // No longer an option in PHP, but had been to send via TCP/IP to 'destination' (name or IP:port)
// use socket_create() and socket_send()?
return false;
case 0: // syslog or file depending on ini
var log = this.php_js && this.php_js.ini && this.php_js.ini.error_log && this.php_js.ini.error_log.local_value;
if (!log) {
return _sapi();
}
if (log === 'syslog') {
return this.syslog(4, message); // presumably 'LOG_ERR' (4) is correct?
}
destination = log;
// Fall-through
case 3: // File logging
var ret = this.file_put_contents(destination, message, 8); // FILE_APPEND (8)
return ret === false ? false : true;
case 4: // SAPI logging
return _sapi();
default: // Unrecognized value
return false;
}
return false; // Shouldn't get here
}
|
namespace Nancy.Tests.Unit.Json
{
using System;
public class <API key> : IEquatable<<API key>>
{
public int Data;
public bool Equals(<API key> other)
{
if (other == null)
return false;
return (this.Data == other.Data);
}
public override bool Equals(object obj)
{
return this.Equals(obj as <API key>);
}
public override int GetHashCode()
{
return this.Data.GetHashCode();
}
}
}
|
# <API key>: GPL-2.0
# Makefile for the Linux kernel device drivers.
# 15 Sep 2000, Christoph Hellwig <hch@infradead.org>
# Rewritten to use lists instead of if-statements.
obj-y += irqchip/
obj-y += bus/
obj-$(CONFIG_GENERIC_PHY) += phy/
# GPIO must come after pinctrl as gpios may need to mux pins etc
obj-$(CONFIG_PINCTRL) += pinctrl/
obj-$(CONFIG_GPIOLIB) += gpio/
obj-y += pwm/
obj-y += pci/
obj-$(CONFIG_PARISC) += parisc/
obj-$(CONFIG_RAPIDIO) += rapidio/
obj-y += video/
obj-y += idle/
# IPMI must come before ACPI in order to provide IPMI opregion support
obj-y += char/ipmi/
obj-$(CONFIG_ACPI) += acpi/
# PnP must come after ACPI since it will eventually need to check if acpi
# was used and do nothing if so
obj-$(CONFIG_PNP) += pnp/
obj-y += amba/
obj-y += clk/
# Many drivers will want to use DMA so this has to be made available
# really early.
obj-$(CONFIG_DMADEVICES) += dma/
# SOC specific infrastructure drivers.
obj-y += soc/
obj-$(CONFIG_VIRTIO) += virtio/
obj-$(<API key>) += virtio/
obj-$(CONFIG_VDPA) += vdpa/
obj-$(CONFIG_XEN) += xen/
# regulators early, since some subsystems rely on them to initialize
obj-$(CONFIG_REGULATOR) += regulator/
# reset controllers early, since gpu drivers might rely on them to initialize
obj-$(<API key>) += reset/
# tty/ comes before char/ so that the VT console is the boot-time
# default.
obj-y += tty/
obj-y += char/
# iommu/ comes before gpu as gpu are using iommu controllers
obj-y += iommu/
# gpu/ comes after char for AGP vs DRM startup and after iommu
obj-y += gpu/
obj-$(CONFIG_CONNECTOR) += connector/
# i810fb and intelfb depend on char/agp/
obj-$(CONFIG_FB_I810) += video/fbdev/i810/
obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/
obj-$(CONFIG_PARPORT) += parport/
obj-$(CONFIG_NVM) += lightnvm/
obj-y += base/ block/ misc/ mfd/ nfc/
obj-$(CONFIG_LIBNVDIMM) += nvdimm/
obj-$(CONFIG_DAX) += dax/
obj-$(CONFIG_CXL_BUS) += cxl/
obj-$(<API key>) += dma-buf/
obj-$(CONFIG_NUBUS) += nubus/
obj-y += macintosh/
obj-$(CONFIG_IDE) += ide/
obj-y += scsi/
obj-y += nvme/
obj-$(CONFIG_ATA) += ata/
obj-$(CONFIG_TARGET_CORE) += target/
obj-$(CONFIG_MTD) += mtd/
obj-$(CONFIG_SPI) += spi/
obj-$(CONFIG_SPMI) += spmi/
obj-$(CONFIG_HSI) += hsi/
obj-$(CONFIG_SLIMBUS) += slimbus/
obj-y += net/
obj-$(CONFIG_ATM) += atm/
obj-$(CONFIG_FUSION) += message/
obj-y += firewire/
obj-$(CONFIG_UIO) += uio/
obj-$(CONFIG_VFIO) += vfio/
obj-y += cdrom/
obj-y += auxdisplay/
obj-$(CONFIG_PCCARD) += pcmcia/
obj-$(CONFIG_DIO) += dio/
obj-$(CONFIG_SBUS) += sbus/
obj-$(CONFIG_ZORRO) += zorro/
obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/
obj-$(CONFIG_PARIDE) += block/paride/
obj-$(CONFIG_TC) += tc/
obj-$(CONFIG_USB_PHY) += usb/
obj-$(CONFIG_USB) += usb/
obj-$(CONFIG_USB_SUPPORT) += usb/
obj-$(CONFIG_PCI) += usb/
obj-$(CONFIG_USB_GADGET) += usb/
obj-$(CONFIG_OF) += usb/
obj-$(CONFIG_SERIO) += input/serio/
obj-$(CONFIG_GAMEPORT) += input/gameport/
obj-$(CONFIG_INPUT) += input/
obj-$(CONFIG_RTC_LIB) += rtc/
obj-y += i2c/ i3c/ media/
obj-$(CONFIG_PPS) += pps/
obj-y += ptp/
obj-$(CONFIG_W1) += w1/
obj-y += power/
obj-$(CONFIG_HWMON) += hwmon/
obj-$(CONFIG_THERMAL) += thermal/
obj-$(CONFIG_WATCHDOG) += watchdog/
obj-$(CONFIG_MD) += md/
obj-$(CONFIG_BT) += bluetooth/
obj-$(<API key>) += accessibility/
obj-$(CONFIG_ISDN) += isdn/
obj-$(CONFIG_EDAC) += edac/
obj-$(CONFIG_EISA) += eisa/
obj-$(CONFIG_PM_OPP) += opp/
obj-$(CONFIG_CPU_FREQ) += cpufreq/
obj-$(CONFIG_CPU_IDLE) += cpuidle/
obj-y += mmc/
obj-$(CONFIG_MEMSTICK) += memstick/
obj-$(CONFIG_NEW_LEDS) += leds/
obj-$(CONFIG_INFINIBAND) += infiniband/
obj-y += firmware/
obj-$(CONFIG_CRYPTO) += crypto/
obj-$(CONFIG_SUPERH) += sh/
obj-y += clocksource/
obj-$(CONFIG_DCA) += dca/
obj-$(CONFIG_HID) += hid/
obj-$(CONFIG_PPC_PS3) += ps3/
obj-$(CONFIG_OF) += of/
obj-$(CONFIG_SSB) += ssb/
obj-$(CONFIG_BCMA) += bcma/
obj-$(CONFIG_VHOST_RING) += vhost/
obj-$(CONFIG_VHOST_IOTLB) += vhost/
obj-$(CONFIG_VHOST) += vhost/
obj-$(CONFIG_VLYNQ) += vlynq/
obj-$(CONFIG_GREYBUS) += greybus/
obj-$(CONFIG_COMEDI) += comedi/
obj-$(CONFIG_STAGING) += staging/
obj-y += platform/
obj-$(CONFIG_MAILBOX) += mailbox/
obj-$(CONFIG_HWSPINLOCK) += hwspinlock/
obj-$(CONFIG_REMOTEPROC) += remoteproc/
obj-$(CONFIG_RPMSG) += rpmsg/
obj-$(CONFIG_SOUNDWIRE) += soundwire/
# Virtualization drivers
obj-$(CONFIG_VIRT_DRIVERS) += virt/
obj-$(CONFIG_HYPERV) += hv/
obj-$(CONFIG_PM_DEVFREQ) += devfreq/
obj-$(CONFIG_EXTCON) += extcon/
obj-$(CONFIG_MEMORY) += memory/
obj-$(CONFIG_IIO) += iio/
obj-$(CONFIG_VME_BUS) += vme/
obj-$(CONFIG_IPACK_BUS) += ipack/
obj-$(CONFIG_NTB) += ntb/
obj-$(CONFIG_POWERCAP) += powercap/
obj-$(CONFIG_MCB) += mcb/
obj-$(CONFIG_PERF_EVENTS) += perf/
obj-$(CONFIG_RAS) += ras/
obj-$(CONFIG_USB4) += thunderbolt/
obj-$(CONFIG_CORESIGHT) += hwtracing/coresight/
obj-y += hwtracing/intel_th/
obj-$(CONFIG_STM) += hwtracing/stm/
obj-$(CONFIG_ANDROID) += android/
obj-$(CONFIG_NVMEM) += nvmem/
obj-$(CONFIG_FPGA) += fpga/
obj-$(CONFIG_FSI) += fsi/
obj-$(CONFIG_TEE) += tee/
obj-$(CONFIG_MULTIPLEXER) += mux/
obj-$(<API key>) += visorbus/
obj-$(CONFIG_SIOX) += siox/
obj-$(CONFIG_GNSS) += gnss/
obj-$(CONFIG_INTERCONNECT) += interconnect/
obj-$(CONFIG_COUNTER) += counter/
obj-$(CONFIG_MOST) += most/
|
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/uaccess.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/dma-mapping.h>
#include <linux/msm_audio_7X30.h>
#include <linux/msm_audio_amrnb.h>
#include <asm/atomic.h>
#include <asm/ioctls.h>
#include <mach/msm_adsp.h>
#include <mach/qdsp5v2/qdsp5audreccmdi.h>
#include <mach/qdsp5v2/qdsp5audrecmsg.h>
#include <mach/qdsp5v2/audpreproc.h>
#include <mach/qdsp5v2/audio_dev_ctl.h>
#include <mach/debug_mm.h>
/* FRAME_NUM must be a power of two */
#define FRAME_NUM (8)
#define FRAME_SIZE (22 * 2) /* 36 bytes data */
#define DMASZ (FRAME_SIZE * FRAME_NUM)
struct buffer {
void *data;
uint32_t size;
uint32_t read;
uint32_t addr;
};
struct audio_in {
struct buffer in[FRAME_NUM];
spinlock_t dsp_lock;
atomic_t in_bytes;
atomic_t in_samples;
struct mutex lock;
struct mutex read_lock;
wait_queue_head_t wait;
wait_queue_head_t wait_enable;
struct msm_adsp_module *audrec;
/* configuration to use on next enable */
uint32_t buffer_size; /* Frame size (36 bytes) */
uint32_t enc_type;
int dtx_mode;
uint32_t frame_format;
uint32_t used_mode;
uint32_t rec_mode;
uint32_t dsp_cnt;
uint32_t in_head; /* next buffer dsp will write */
uint32_t in_tail; /* next buffer read() will read */
uint32_t in_count; /* number of buffers available to read() */
uint32_t mode;
const char *module_name;
unsigned queue_ids;
uint16_t enc_id;
uint16_t source; /* Encoding source bit mask */
uint32_t device_events;
uint32_t in_call;
uint32_t dev_cnt;
int voice_state;
spinlock_t dev_lock;
/* data allocated for various buffers */
char *data;
dma_addr_t phys;
int opened;
int enabled;
int running;
int stopped; /* set when stopped, cleared on flush */
};
struct audio_frame {
uint16_t frame_count_lsw;
uint16_t frame_count_msw;
uint16_t frame_length;
uint16_t erased_pcm;
unsigned char raw_bitstream[]; /* samples */
} __attribute__((packed));
/* Audrec Queue command sent macro's */
#define <API key>(audio, cmd, len) \
msm_adsp_write(audio->audrec, ((audio->queue_ids & 0xFFFF0000) >> 16),\
cmd, len)
#define <API key>(audio, cmd, len) \
msm_adsp_write(audio->audrec, (audio->queue_ids & 0x0000FFFF),\
cmd, len)
struct audio_in the_audio_amrnb_in;
/* DSP command send functions */
static int <API key>(struct audio_in *audio, int enable);
static int <API key>(struct audio_in *audio);
static int <API key>(struct audio_in *audio);
static int <API key>(struct audio_in *audio, int enable);
static int <API key>(struct audio_in *audio, uint32_t read_cnt);
static void <API key>(struct audio_in *audio);
static void audamrnb_in_flush(struct audio_in *audio);
static void amrnb_in_listener(u32 evt_id, union auddev_evt_data *evt_payload,
void *private_data)
{
struct audio_in *audio = (struct audio_in *) private_data;
unsigned long flags;
MM_DBG("evt_id = 0x%8x\n", evt_id);
switch (evt_id) {
case AUDDEV_EVT_DEV_RDY: {
MM_DBG("AUDDEV_EVT_DEV_RDY\n");
spin_lock_irqsave(&audio->dev_lock, flags);
audio->dev_cnt++;
if (!audio->in_call)
audio->source |= (0x1 << evt_payload->routing_id);
<API key>(&audio->dev_lock, flags);
if ((audio->running == 1) && (audio->enabled == 1))
<API key>(audio, 1);
break;
}
case AUDDEV_EVT_DEV_RLS: {
MM_DBG("AUDDEV_EVT_DEV_RLS\n");
spin_lock_irqsave(&audio->dev_lock, flags);
audio->dev_cnt
if (!audio->in_call)
audio->source &= ~(0x1 << evt_payload->routing_id);
<API key>(&audio->dev_lock, flags);
if ((!audio->running) || (!audio->enabled))
break;
/* Turn of as per source */
if (audio->source)
<API key>(audio, 1);
else
/* Turn off all */
<API key>(audio, 0);
break;
}
case <API key>: {
MM_DBG("<API key>, state = %d\n",
evt_payload->voice_state);
audio->voice_state = evt_payload->voice_state;
if (audio->in_call && audio->running) {
if (audio->voice_state == VOICE_STATE_INCALL)
<API key>(audio, 1);
else if (audio->voice_state == VOICE_STATE_OFFCALL) {
<API key>(audio, 0);
wake_up(&audio->wait);
}
}
break;
}
default:
MM_AUD_ERR("wrong event %d\n", evt_id);
break;
}
}
static void <API key>(void *data, unsigned id, void *msg)
{
struct audio_in *audio = data;
switch (id) {
case <API key>: {
struct audpreproc_err_msg *err_msg = msg;
MM_AUD_ERR("ERROR_MSG: stream id %d err idx %d\n",
err_msg->stream_id, err_msg->aud_preproc_err_idx);
/* Error case */
wake_up(&audio->wait_enable);
break;
}
case <API key>: {
MM_DBG("CMD_CFG_DONE_MSG \n");
break;
}
case <API key>: {
struct <API key> *enc_cfg_msg = msg;
MM_DBG("<API key>: stream id %d enc type \
0x%8x\n", enc_cfg_msg->stream_id,
enc_cfg_msg->rec_enc_type);
/* Encoder enable success */
if (enc_cfg_msg->rec_enc_type & ENCODE_ENABLE)
<API key>(audio);
else { /* Encoder disable success */
audio->running = 0;
<API key>(audio, 0);
}
break;
}
case <API key>: {
MM_DBG("<API key> \n");
<API key>(audio);
break;
}
case <API key>: {
MM_DBG("<API key> \n");
wake_up(&audio->wait_enable);
break;
}
default:
MM_AUD_ERR("Unknown Event id %d\n", id);
}
}
static void audrec_dsp_event(void *data, unsigned id, size_t len,
void (*getevent)(void *ptr, size_t len))
{
struct audio_in *audio = data;
switch (id) {
case <API key>: {
MM_DBG("CMD_MEM_CFG_DONE MSG DONE\n");
audio->running = 1;
if ((!audio->in_call && (audio->dev_cnt > 0)) ||
(audio->in_call &&
(audio->voice_state == VOICE_STATE_INCALL)))
<API key>(audio, 1);
break;
}
case <API key>: {
struct <API key> fatal_err_msg;
getevent(&fatal_err_msg, <API key>);
MM_AUD_ERR("FATAL_ERR_MSG: err id %d\n",
fatal_err_msg.audrec_err_id);
/* Error stop the encoder */
audio->stopped = 1;
wake_up(&audio->wait);
break;
}
case <API key>: {
struct <API key> pkt_ready_msg;
getevent(&pkt_ready_msg, <API key>);
MM_DBG("UP_PACKET_READY_MSG: write cnt lsw %d \
write cnt msw %d read cnt lsw %d read cnt msw %d \n",\
pkt_ready_msg.<API key>, \
pkt_ready_msg.<API key>, \
pkt_ready_msg.<API key>, \
pkt_ready_msg.<API key>);
<API key>(audio);
break;
}
default:
MM_AUD_ERR("Unknown Event id %d\n", id);
}
}
static void <API key>(struct audio_in *audio)
{
struct audio_frame *frame;
uint32_t index;
unsigned long flags;
index = audio->in_head;
frame = (void *) (((char *)audio->in[index].data) - \
sizeof(*frame));
spin_lock_irqsave(&audio->dsp_lock, flags);
audio->in[index].size = frame->frame_length;
/* statistics of read */
atomic_add(audio->in[index].size, &audio->in_bytes);
atomic_add(1, &audio->in_samples);
audio->in_head = (audio->in_head + 1) & (FRAME_NUM - 1);
/* If overflow, move the tail index foward. */
if (audio->in_head == audio->in_tail)
audio->in_tail = (audio->in_tail + 1) & (FRAME_NUM - 1);
else
audio->in_count++;
<API key>(audio, audio->dsp_cnt++);
<API key>(&audio->dsp_lock, flags);
wake_up(&audio->wait);
}
struct msm_adsp_ops <API key> = {
.event = audrec_dsp_event,
};
static int <API key>(struct audio_in *audio, int enable)
{
struct <API key> cmd;
memset(&cmd, 0, sizeof(cmd));
cmd.cmd_id = <API key>;
cmd.stream_id = audio->enc_id;
if (enable)
cmd.audrec_enc_type = audio->enc_type | ENCODE_ENABLE;
else
cmd.audrec_enc_type &= ~(ENCODE_ENABLE);
return <API key>(&cmd, sizeof(cmd));
}
static int <API key>(struct audio_in *audio)
{
struct <API key> cmd;
memset(&cmd, 0, sizeof(cmd));
cmd.common.cmd_id = <API key>;
cmd.common.stream_id = audio->enc_id;
cmd.dtx_mode = audio->dtx_mode;
cmd.test_mode = -1; /* Default set to -1 */
cmd.used_mode = audio->used_mode;
return <API key>(&cmd, sizeof(cmd));
}
/* To Do: <API key>(audio->enc_id); */
static int <API key>(struct audio_in *audio, int enable)
{
struct <API key> cmd;
memset(&cmd, 0, sizeof(cmd));
cmd.cmd_id = <API key>;
cmd.stream_id = audio->enc_id;
if (enable)
cmd.<API key> = <API key>;
else
cmd.<API key> = <API key>;
cmd.source_mix_mask = audio->source;
if (audio->enc_id == 2) {
if ((cmd.source_mix_mask &
<API key>) ||
(cmd.source_mix_mask & <API key>) ||
(cmd.source_mix_mask & <API key>) ||
(cmd.source_mix_mask & <API key>)) {
cmd.pipe_id = SOURCE_PIPE_1;
}
if (cmd.source_mix_mask &
<API key>)
cmd.pipe_id |= SOURCE_PIPE_0;
}
return <API key>(&cmd, sizeof(cmd));
}
static int <API key>(struct audio_in *audio)
{
struct <API key> cmd;
uint16_t *data = (void *) audio->data;
int n;
memset(&cmd, 0, sizeof(cmd));
cmd.cmd_id = <API key>;
cmd.<API key> = 1;
cmd.<API key> = audio->phys >> 16;
cmd.<API key> = audio->phys;
cmd.<API key> = FRAME_NUM;
/* prepare buffer pointers:
* 36 bytes amrnb packet + 4 halfword header
*/
for (n = 0; n < FRAME_NUM; n++) {
audio->in[n].data = data + 4;
data += (FRAME_SIZE/2); /* word increment */
MM_DBG("0x%8x\n", (int)(audio->in[n].data - 8));
}
return <API key>(audio, &cmd, sizeof(cmd));
}
static int <API key>(struct audio_in *audio, uint32_t read_cnt)
{
struct <API key> cmd;
memset(&cmd, 0, sizeof(cmd));
cmd.cmd_id = <API key>;
cmd.<API key> = read_cnt >> 16;
cmd.<API key> = read_cnt;
return <API key>(audio, &cmd, sizeof(cmd));
}
/* must be called with audio->lock held */
static int audamrnb_in_enable(struct audio_in *audio)
{
if (audio->enabled)
return 0;
if (audpreproc_enable(audio->enc_id, &<API key>, audio)) {
MM_AUD_ERR("msm_adsp_enable(audpreproc) failed\n");
return -ENODEV;
}
if (msm_adsp_enable(audio->audrec)) {
MM_AUD_ERR("msm_adsp_enable(audrec) failed\n");
audpreproc_disable(audio->enc_id, audio);
return -ENODEV;
}
audio->enabled = 1;
<API key>(audio, 1);
return 0;
}
/* must be called with audio->lock held */
static int audamrnb_in_disable(struct audio_in *audio)
{
if (audio->enabled) {
audio->enabled = 0;
<API key>(audio, 0);
wake_up(&audio->wait);
<API key>(audio->wait_enable,
audio->running == 0, 1*HZ);
msm_adsp_disable(audio->audrec);
audpreproc_disable(audio->enc_id, audio);
}
return 0;
}
static void audamrnb_in_flush(struct audio_in *audio)
{
int i;
audio->dsp_cnt = 0;
audio->in_head = 0;
audio->in_tail = 0;
audio->in_count = 0;
for (i = 0; i < FRAME_NUM; i++) {
audio->in[i].size = 0;
audio->in[i].read = 0;
}
MM_DBG("in_bytes %d\n", atomic_read(&audio->in_bytes));
MM_DBG("in_samples %d\n", atomic_read(&audio->in_samples));
atomic_set(&audio->in_bytes, 0);
atomic_set(&audio->in_samples, 0);
}
static long audamrnb_in_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct audio_in *audio = file->private_data;
int rc = 0;
if (cmd == AUDIO_GET_STATS) {
struct msm_audio_stats stats;
stats.byte_count = atomic_read(&audio->in_bytes);
stats.sample_count = atomic_read(&audio->in_samples);
if (copy_to_user((void *) arg, &stats, sizeof(stats)))
return -EFAULT;
return rc;
}
mutex_lock(&audio->lock);
switch (cmd) {
case AUDIO_START: {
uint32_t freq;
freq = 48000;
MM_DBG("AUDIO_START\n");
if (audio->in_call && (audio->voice_state !=
VOICE_STATE_INCALL)) {
rc = -EPERM;
break;
}
rc = <API key>(&freq, audio->enc_id,
SNDDEV_CAP_TX, AUDDEV_CLNT_ENC);
MM_DBG("sample rate configured %d\n", freq);
if (rc < 0) {
MM_DBG(" Sample rate can not be set, return code %d\n",
rc);
<API key>(audio->enc_id,
SNDDEV_CAP_TX, AUDDEV_CLNT_ENC);
MM_DBG("<API key>\n");
break;
}
rc = audamrnb_in_enable(audio);
if (!rc) {
rc =
<API key>(audio->wait_enable,
audio->running != 0, 1*HZ);
MM_DBG("state %d rc = %d\n", audio->running, rc);
if (audio->running == 0)
rc = -ENODEV;
else
rc = 0;
}
audio->stopped = 0;
break;
}
case AUDIO_STOP: {
rc = audamrnb_in_disable(audio);
rc = <API key>(audio->enc_id,
SNDDEV_CAP_TX, AUDDEV_CLNT_ENC);
MM_DBG("<API key>\n");
audio->stopped = 1;
break;
}
case AUDIO_FLUSH: {
if (audio->stopped) {
/* Make sure we're stopped and we wake any threads
* that might be blocked holding the read_lock.
* While audio->stopped read threads will always
* exit immediately.
*/
wake_up(&audio->wait);
mutex_lock(&audio->read_lock);
audamrnb_in_flush(audio);
mutex_unlock(&audio->read_lock);
}
break;
}
case <API key>: {
struct <API key> cfg;
if (copy_from_user(&cfg, (void *) arg, sizeof(cfg))) {
rc = -EFAULT;
break;
}
/* Allow only single frame */
if (cfg.buffer_size != (FRAME_SIZE - 8))
rc = -EINVAL;
else
audio->buffer_size = cfg.buffer_size;
break;
}
case <API key>: {
struct <API key> cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.buffer_size = audio->buffer_size;
cfg.buffer_count = FRAME_NUM;
if (copy_to_user((void *) arg, &cfg, sizeof(cfg)))
rc = -EFAULT;
break;
}
case <API key>: {
struct <API key> cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.dtx_enable = ((audio->dtx_mode == -1) ? 1 : 0);
cfg.band_mode = audio->used_mode;
cfg.frame_format = audio->frame_format;
if (copy_to_user((void *) arg, &cfg, sizeof(cfg)))
rc = -EFAULT;
break;
}
case <API key>: {
struct <API key> cfg;
if (copy_from_user(&cfg, (void *) arg, sizeof(cfg))) {
rc = -EFAULT;
break;
}
/* DSP does not support any other than default format */
if (audio->frame_format != cfg.frame_format) {
rc = -EINVAL;
break;
}
if (cfg.dtx_enable == 0)
audio->dtx_mode = 0;
else if (cfg.dtx_enable == 1)
audio->dtx_mode = -1;
else {
rc = -EINVAL;
break;
}
audio->used_mode = cfg.band_mode;
break;
}
case AUDIO_SET_INCALL: {
struct msm_voicerec_mode cfg;
unsigned long flags;
if (copy_from_user(&cfg, (void *) arg, sizeof(cfg))) {
rc = -EFAULT;
break;
}
if (cfg.rec_mode != VOC_REC_BOTH &&
cfg.rec_mode != VOC_REC_UPLINK &&
cfg.rec_mode != VOC_REC_DOWNLINK) {
MM_AUD_ERR("invalid rec_mode\n");
rc = -EINVAL;
break;
} else {
spin_lock_irqsave(&audio->dev_lock, flags);
if (cfg.rec_mode == VOC_REC_UPLINK)
audio->source = <API key>;
else if (cfg.rec_mode == VOC_REC_DOWNLINK)
audio->source = <API key>;
else
audio->source = <API key> |
<API key> ;
audio->in_call = 1;
<API key>(&audio->dev_lock, flags);
}
break;
}
case <API key>: {
if (copy_to_user((void *) arg, &audio->enc_id,
sizeof(unsigned short))) {
rc = -EFAULT;
}
break;
}
default:
rc = -EINVAL;
}
mutex_unlock(&audio->lock);
return rc;
}
static ssize_t audamrnb_in_read(struct file *file,
char __user *buf,
size_t count, loff_t *pos)
{
struct audio_in *audio = file->private_data;
unsigned long flags;
const char __user *start = buf;
void *data;
uint32_t index;
uint32_t size;
int rc = 0;
mutex_lock(&audio->read_lock);
while (count > 0) {
rc = <API key>(
audio->wait, (audio->in_count > 0) || audio->stopped
|| (audio->in_call && audio->running &&
(audio->voice_state == VOICE_STATE_OFFCALL)));
if (rc < 0)
break;
if (!audio->in_count) {
if (audio->stopped) {
rc = 0;/* End of File */
break;
} else if (audio->in_call && audio->running &&
(audio->voice_state == VOICE_STATE_OFFCALL)) {
MM_DBG("Not Permitted Voice Terminated\n");
rc = -EPERM; /* Voice Call stopped */
break;
}
}
index = audio->in_tail;
data = (uint8_t *) audio->in[index].data;
size = audio->in[index].size;
if (count >= size) {
if (copy_to_user(buf, data, size)) {
rc = -EFAULT;
break;
}
spin_lock_irqsave(&audio->dsp_lock, flags);
if (index != audio->in_tail) {
/* overrun -- data is
* invalid and we need to retry */
<API key>(&audio->dsp_lock, flags);
continue;
}
audio->in[index].size = 0;
audio->in_tail = (audio->in_tail + 1) & (FRAME_NUM - 1);
audio->in_count
<API key>(&audio->dsp_lock, flags);
count -= size;
buf += size;
} else {
MM_AUD_ERR("short read\n");
break;
}
}
mutex_unlock(&audio->read_lock);
if (buf > start)
return buf - start;
return rc;
}
static ssize_t audamrnb_in_write(struct file *file,
const char __user *buf,
size_t count, loff_t *pos)
{
return -EINVAL;
}
static int audamrnb_in_release(struct inode *inode, struct file *file)
{
struct audio_in *audio = file->private_data;
MM_DBG("\n");
mutex_lock(&audio->lock);
audio->in_call = 0;
/* with draw frequency for session
incase not stopped the driver */
<API key>(audio->enc_id, SNDDEV_CAP_TX,
AUDDEV_CLNT_ENC);
<API key>(AUDDEV_CLNT_ENC, audio->enc_id);
audamrnb_in_disable(audio);
audamrnb_in_flush(audio);
msm_adsp_put(audio->audrec);
<API key>(audio->enc_id);
audio->audrec = NULL;
audio->opened = 0;
mutex_unlock(&audio->lock);
return 0;
}
static int audamrnb_in_open(struct inode *inode, struct file *file)
{
struct audio_in *audio = &the_audio_amrnb_in;
int rc;
int encid;
mutex_lock(&audio->lock);
if (audio->opened) {
rc = -EBUSY;
goto done;
}
if ((file->f_mode & FMODE_WRITE) &&
(file->f_mode & FMODE_READ)) {
rc = -EACCES;
MM_AUD_ERR("Non tunnel encoding is not supported\n");
goto done;
} else if (!(file->f_mode & FMODE_WRITE) &&
(file->f_mode & FMODE_READ)) {
audio->mode = <API key>;
MM_DBG("Opened for tunnel mode encoding\n");
} else {
rc = -EACCES;
goto done;
}
/* Settings will be re-config at AUDIO_SET_CONFIG,
* but at least we need to have initial config
*/
audio->buffer_size = (FRAME_SIZE - 8);
audio->enc_type = ENC_TYPE_AMRNB | audio->mode;
audio->dtx_mode = -1;
audio->frame_format = 0;
audio->used_mode = 7; /* Bit Rate 12.2 kbps MR122 */
encid = <API key>(audio->enc_type, &audio->module_name,
&audio->queue_ids);
if (encid < 0) {
MM_AUD_ERR("No free encoder available\n");
rc = -ENODEV;
goto done;
}
audio->enc_id = encid;
rc = msm_adsp_get(audio->module_name, &audio->audrec,
&<API key>, audio);
if (rc) {
<API key>(audio->enc_id);
goto done;
}
audio->stopped = 0;
audio->source = 0;
audamrnb_in_flush(audio);
audio->device_events = AUDDEV_EVT_DEV_RDY | AUDDEV_EVT_DEV_RLS |
<API key>;
audio->voice_state = VOICE_STATE_INCALL;
rc = <API key>(audio->device_events,
AUDDEV_CLNT_ENC, audio->enc_id,
amrnb_in_listener, (void *) audio);
if (rc) {
MM_AUD_ERR("failed to register device event listener\n");
goto evt_error;
}
file->private_data = audio;
audio->opened = 1;
done:
mutex_unlock(&audio->lock);
return rc;
evt_error:
msm_adsp_put(audio->audrec);
<API key>(audio->enc_id);
mutex_unlock(&audio->lock);
return rc;
}
static const struct file_operations audio_in_fops = {
.owner = THIS_MODULE,
.open = audamrnb_in_open,
.release = audamrnb_in_release,
.read = audamrnb_in_read,
.write = audamrnb_in_write,
.unlocked_ioctl = audamrnb_in_ioctl,
};
struct miscdevice audio_amrnb_in_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = "msm_amrnb_in",
.fops = &audio_in_fops,
};
static int __init audamrnb_in_init(void)
{
the_audio_amrnb_in.data = dma_alloc_coherent(NULL, DMASZ,
&the_audio_amrnb_in.phys, GFP_KERNEL);
MM_DBG("Memory addr = 0x%8x Phy addr= 0x%8x
(int) the_audio_amrnb_in.data, (int) the_audio_amrnb_in.phys);
if (!the_audio_amrnb_in.data) {
MM_AUD_ERR("Unable to allocate DMA buffer\n");
return -ENOMEM;
}
mutex_init(&the_audio_amrnb_in.lock);
mutex_init(&the_audio_amrnb_in.read_lock);
spin_lock_init(&the_audio_amrnb_in.dsp_lock);
spin_lock_init(&the_audio_amrnb_in.dev_lock);
init_waitqueue_head(&the_audio_amrnb_in.wait);
init_waitqueue_head(&the_audio_amrnb_in.wait_enable);
return misc_register(&audio_amrnb_in_misc);
}
device_initcall(audamrnb_in_init);
|
#include "chrome/browser/extensions/api/content_settings/<API key>.h"
#include <set>
#include "base/debug/alias.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "chrome/browser/content_settings/<API key>.h"
#include "chrome/browser/content_settings/<API key>.h"
#include "chrome/browser/content_settings/<API key>.h"
#include "chrome/browser/extensions/api/content_settings/<API key>.h"
#include "chrome/browser/extensions/api/content_settings/<API key>.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
using content_settings::<API key>;
using content_settings::Rule;
using content_settings::RuleIterator;
using content_settings::<API key>;
using content_settings::ResourceIdentifier;
using content_settings::<API key>;
namespace extensions {
namespace helpers = <API key>;
namespace keys = <API key>;
struct <API key>::ExtensionEntry {
// Extension id
std::string id;
// Whether extension is enabled in the profile.
bool enabled;
// Content settings.
<API key> settings;
// Persistent incognito content settings.
<API key> <API key>;
// Session-only incognito content settings.
<API key> <API key>;
};
<API key>::<API key>() {
DCHECK(OnCorrectThread());
}
<API key>::~<API key>() {
STLDeleteValues(&entries_);
}
RuleIterator* <API key>::GetRuleIterator(
ContentSettingsType type,
const content_settings::ResourceIdentifier& identifier,
bool incognito) const {
ScopedVector<RuleIterator> iterators;
// Iterate the extensions based on install time (last installed extensions
// first).
ExtensionEntryMap::<API key> entry;
// The individual |RuleIterators| shouldn't lock; pass |lock_| to the
// |<API key>| in a locked state.
scoped_ptr<base::AutoLock> auto_lock(new base::AutoLock(lock_));
for (entry = entries_.rbegin(); entry != entries_.rend(); ++entry) {
if (!entry->second->enabled)
continue;
if (incognito) {
iterators.push_back(
entry->second-><API key>.GetRuleIterator(
type,
identifier,
NULL));
iterators.push_back(
entry->second-><API key>.GetRuleIterator(
type,
identifier,
NULL));
} else {
iterators.push_back(
entry->second->settings.GetRuleIterator(type, identifier, NULL));
}
}
return new <API key>(&iterators, auto_lock.release());
}
void <API key>::<API key>(
const std::string& ext_id,
const <API key>& primary_pattern,
const <API key>& secondary_pattern,
ContentSettingsType type,
const content_settings::ResourceIdentifier& identifier,
ContentSetting setting,
ExtensionPrefsScope scope) {
{
base::AutoLock lock(lock_);
<API key>* map = GetValueMap(ext_id, scope);
if (setting == <API key>) {
map->DeleteValue(primary_pattern, secondary_pattern, type, identifier);
} else {
map->SetValue(primary_pattern, secondary_pattern, type, identifier,
new base::FundamentalValue(setting));
}
}
// Send notification that content settings changed.
// TODO(markusheintz): Notifications should only be sent if the set content
// setting is effective and not hidden by another setting of another
// extension installed more recently.
<API key>(ext_id,
scope != <API key>);
}
void <API key>::RegisterExtension(
const std::string& ext_id,
const base::Time& install_time,
bool is_enabled) {
base::AutoLock lock(lock_);
ExtensionEntryMap::iterator i = FindEntry(ext_id);
ExtensionEntry* entry;
if (i != entries_.end()) {
entry = i->second;
} else {
entry = new ExtensionEntry;
entries_.insert(std::make_pair(install_time, entry));
}
entry->id = ext_id;
entry->enabled = is_enabled;
}
void <API key>::UnregisterExtension(
const std::string& ext_id) {
bool notify = false;
bool notify_incognito = false;
{
base::AutoLock lock(lock_);
ExtensionEntryMap::iterator i = FindEntry(ext_id);
if (i == entries_.end())
return;
notify = !i->second->settings.empty();
notify_incognito = !i->second-><API key>.empty() ||
!i->second-><API key>.empty();
delete i->second;
entries_.erase(i);
}
if (notify)
<API key>(ext_id, false);
if (notify_incognito)
<API key>(ext_id, true);
}
void <API key>::SetExtensionState(
const std::string& ext_id, bool is_enabled) {
bool notify = false;
bool notify_incognito = false;
{
base::AutoLock lock(lock_);
ExtensionEntryMap::const_iterator i = FindEntry(ext_id);
if (i == entries_.end())
return;
notify = !i->second->settings.empty();
notify_incognito = !i->second-><API key>.empty() ||
!i->second-><API key>.empty();
i->second->enabled = is_enabled;
}
if (notify)
<API key>(ext_id, false);
if (notify_incognito)
<API key>(ext_id, true);
}
<API key>* <API key>::GetValueMap(
const std::string& ext_id,
ExtensionPrefsScope scope) {
ExtensionEntryMap::const_iterator i = FindEntry(ext_id);
if (i != entries_.end()) {
switch (scope) {
case <API key>:
return &(i->second->settings);
case <API key>:
// TODO(bauerb): Implement regular-only content settings.
NOTREACHED();
return NULL;
case <API key>:
return &(i->second-><API key>);
case <API key>:
return &(i->second-><API key>);
}
}
return NULL;
}
const <API key>* <API key>::GetValueMap(
const std::string& ext_id,
ExtensionPrefsScope scope) const {
ExtensionEntryMap::const_iterator i = FindEntry(ext_id);
if (i == entries_.end())
return NULL;
switch (scope) {
case <API key>:
return &(i->second->settings);
case <API key>:
// TODO(bauerb): Implement regular-only content settings.
NOTREACHED();
return NULL;
case <API key>:
return &(i->second-><API key>);
case <API key>:
return &(i->second-><API key>);
}
NOTREACHED();
return NULL;
}
void <API key>::<API key>(
const std::string& ext_id,
ExtensionPrefsScope scope) {
bool notify = false;
{
base::AutoLock lock(lock_);
<API key>* map = GetValueMap(ext_id, scope);
if (!map) {
// Fail gracefully in Release builds.
NOTREACHED();
return;
}
notify = !map->empty();
map->clear();
}
if (notify) {
<API key>(ext_id, scope != <API key>);
}
}
base::ListValue* <API key>::<API key>(
const std::string& extension_id,
ExtensionPrefsScope scope) const {
base::AutoLock lock(lock_);
const <API key>* map = GetValueMap(extension_id, scope);
if (!map)
return NULL;
base::ListValue* settings = new base::ListValue();
<API key>::EntryMap::const_iterator it;
for (it = map->begin(); it != map->end(); ++it) {
scoped_ptr<RuleIterator> rule_iterator(
map->GetRuleIterator(it->first.content_type,
it->first.resource_identifier,
NULL)); // We already hold the lock.
while (rule_iterator->HasNext()) {
const Rule& rule = rule_iterator->Next();
base::DictionaryValue* setting_dict = new base::DictionaryValue();
setting_dict->SetString(keys::kPrimaryPatternKey,
rule.primary_pattern.ToString());
setting_dict->SetString(keys::<API key>,
rule.secondary_pattern.ToString());
setting_dict->SetString(
keys::<API key>,
helpers::<API key>(it->first.content_type));
setting_dict->SetString(keys::<API key>,
it->first.resource_identifier);
ContentSetting content_setting = <API key>(rule.value.get());
DCHECK_NE(<API key>, content_setting);
setting_dict->SetString(
keys::kContentSettingKey,
helpers::<API key>(content_setting));
settings->Append(setting_dict);
}
}
return settings;
}
void <API key>::<API key>(
const std::string& extension_id,
const base::ListValue* list,
ExtensionPrefsScope scope) {
for (base::ListValue::const_iterator it = list->begin();
it != list->end(); ++it) {
if ((*it)->GetType() != Value::TYPE_DICTIONARY) {
NOTREACHED();
continue;
}
base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(*it);
std::string primary_pattern_str;
dict->GetString(keys::kPrimaryPatternKey, &primary_pattern_str);
<API key> primary_pattern =
<API key>::FromString(primary_pattern_str);
DCHECK(primary_pattern.IsValid());
std::string <API key>;
dict->GetString(keys::<API key>, &<API key>);
<API key> secondary_pattern =
<API key>::FromString(<API key>);
DCHECK(secondary_pattern.IsValid());
std::string <API key>;
dict->GetString(keys::<API key>, &<API key>);
ContentSettingsType <API key> =
helpers::<API key>(<API key>);
DCHECK_NE(<API key>, <API key>);
std::string resource_identifier;
dict->GetString(keys::<API key>, &resource_identifier);
std::string <API key>;
dict->GetString(keys::kContentSettingKey, &<API key>);
ContentSetting setting = <API key>;
bool result =
helpers::<API key>(<API key>, &setting);
DCHECK(result);
<API key>(extension_id,
primary_pattern,
secondary_pattern,
<API key>,
resource_identifier,
setting,
scope);
}
}
void <API key>::AddObserver(Observer* observer) {
DCHECK(OnCorrectThread());
observers_.AddObserver(observer);
}
void <API key>::RemoveObserver(Observer* observer) {
DCHECK(OnCorrectThread());
observers_.RemoveObserver(observer);
}
void <API key>::<API key>(
const std::string& extension_id,
bool incognito) {
FOR_EACH_OBSERVER(
<API key>::Observer,
observers_,
<API key>(extension_id, incognito));
}
bool <API key>::OnCorrectThread() {
// If there is no UI thread, we're most likely in a unit test.
return !BrowserThread::IsThreadInitialized(BrowserThread::UI) ||
BrowserThread::CurrentlyOn(BrowserThread::UI);
}
<API key>::ExtensionEntryMap::iterator
<API key>::FindEntry(const std::string& ext_id) {
ExtensionEntryMap::iterator i;
for (i = entries_.begin(); i != entries_.end(); ++i) {
if (i->second->id == ext_id)
return i;
}
return entries_.end();
}
<API key>::ExtensionEntryMap::const_iterator
<API key>::FindEntry(const std::string& ext_id) const {
ExtensionEntryMap::const_iterator i;
for (i = entries_.begin(); i != entries_.end(); ++i) {
if (i->second->id == ext_id)
return i;
}
return entries_.end();
}
} // namespace extensions
|
#ifndef <API key>
#define <API key>
#include <libopencm3/cm3/memorymap.h>
/* Memory map for all buses */
#define FLASH_BASE (0x08000000U)
#define PERIPH_BASE (0x40000000U)
#define INFO_BASE (0x1ffff000U)
#define PERIPH_BASE_APB1 (PERIPH_BASE + 0x00000)
#define PERIPH_BASE_APB2 (PERIPH_BASE + 0x10000)
#define PERIPH_BASE_AHB (PERIPH_BASE + 0x18000)
/* Register boundary addresses */
/* APB1 */
#define TIM2_BASE (PERIPH_BASE_APB1 + 0x0000)
#define TIM3_BASE (PERIPH_BASE_APB1 + 0x0400)
#define TIM4_BASE (PERIPH_BASE_APB1 + 0x0800)
#define TIM5_BASE (PERIPH_BASE_APB1 + 0x0c00)
#define TIM6_BASE (PERIPH_BASE_APB1 + 0x1000)
#define TIM7_BASE (PERIPH_BASE_APB1 + 0x1400)
#define TIM12_BASE (PERIPH_BASE_APB1 + 0x1800)
#define TIM13_BASE (PERIPH_BASE_APB1 + 0x1c00)
#define TIM14_BASE (PERIPH_BASE_APB1 + 0x2000)
/* PERIPH_BASE_APB1 + 0x2400 (0x4000 2400 - 0x4000 27FF): Reserved */
#define RTC_BASE (PERIPH_BASE_APB1 + 0x2800)
#define WWDG_BASE (PERIPH_BASE_APB1 + 0x2c00)
#define IWDG_BASE (PERIPH_BASE_APB1 + 0x3000)
/* PERIPH_BASE_APB1 + 0x3400 (0x4000 3400 - 0x4000 37FF): Reserved */
#define SPI2_BASE (PERIPH_BASE_APB1 + 0x3800)
#define SPI3_BASE (PERIPH_BASE_APB1 + 0x3c00)
/* PERIPH_BASE_APB1 + 0x4000 (0x4000 4000 - 0x4000 3FFF): Reserved */
#define USART2_BASE (PERIPH_BASE_APB1 + 0x4400)
#define USART3_BASE (PERIPH_BASE_APB1 + 0x4800)
#define UART4_BASE (PERIPH_BASE_APB1 + 0x4c00)
#define UART5_BASE (PERIPH_BASE_APB1 + 0x5000)
#define I2C1_BASE (PERIPH_BASE_APB1 + 0x5400)
#define I2C2_BASE (PERIPH_BASE_APB1 + 0x5800)
#define USB_DEV_FS_BASE (PERIPH_BASE_APB1 + 0x5c00)
#define USB_PMA_BASE (PERIPH_BASE_APB1 + 0x6000)
#define USB_CAN_SRAM_BASE (PERIPH_BASE_APB1 + 0x6000)
#define BX_CAN1_BASE (PERIPH_BASE_APB1 + 0x6400)
#define BX_CAN2_BASE (PERIPH_BASE_APB1 + 0x6800)
/* PERIPH_BASE_APB1 + 0x6800 (0x4000 6800 - 0x4000 6BFF): Reserved? Typo? */
#define BACKUP_REGS_BASE (PERIPH_BASE_APB1 + 0x6c00)
#define POWER_CONTROL_BASE (PERIPH_BASE_APB1 + 0x7000)
#define DAC_BASE (PERIPH_BASE_APB1 + 0x7400)
#define CEC_BASE (PERIPH_BASE_APB1 + 0x7800)
/* PERIPH_BASE_APB1 + 0x7c00 (0x4000 7c00 - 0x4000 FFFF): Reserved */
/* APB2 */
#define AFIO_BASE (PERIPH_BASE_APB2 + 0x0000)
#define EXTI_BASE (PERIPH_BASE_APB2 + 0x0400)
#define GPIO_PORT_A_BASE (PERIPH_BASE_APB2 + 0x0800)
#define GPIO_PORT_B_BASE (PERIPH_BASE_APB2 + 0x0c00)
#define GPIO_PORT_C_BASE (PERIPH_BASE_APB2 + 0x1000)
#define GPIO_PORT_D_BASE (PERIPH_BASE_APB2 + 0x1400)
#define GPIO_PORT_E_BASE (PERIPH_BASE_APB2 + 0x1800)
#define GPIO_PORT_F_BASE (PERIPH_BASE_APB2 + 0x1c00)
#define GPIO_PORT_G_BASE (PERIPH_BASE_APB2 + 0x2000)
#define ADC1_BASE (PERIPH_BASE_APB2 + 0x2400)
#define ADC2_BASE (PERIPH_BASE_APB2 + 0x2800)
#define TIM1_BASE (PERIPH_BASE_APB2 + 0x2c00)
#define SPI1_BASE (PERIPH_BASE_APB2 + 0x3000)
#define TIM8_BASE (PERIPH_BASE_APB2 + 0x3400)
#define USART1_BASE (PERIPH_BASE_APB2 + 0x3800)
#define ADC3_BASE (PERIPH_BASE_APB2 + 0x3c00)
#define TIM15_BASE (PERIPH_BASE_APB2 + 0x4000)
#define TIM16_BASE (PERIPH_BASE_APB2 + 0x4400)
#define TIM17_BASE (PERIPH_BASE_APB2 + 0x4800)
#define TIM9_BASE (PERIPH_BASE_APB2 + 0x4c00)
#define TIM10_BASE (PERIPH_BASE_APB2 + 0x5000)
#define TIM11_BASE (PERIPH_BASE_APB2 + 0x5400)
/* PERIPH_BASE_APB2 + 0x5800 (0x4001 5800 - 0x4001 7FFF): Reserved */
/* AHB */
#define SDIO_BASE (PERIPH_BASE_AHB + 0x00000)
/* PERIPH_BASE_AHB + 0x0400 (0x4001 8400 - 0x4001 7FFF): Reserved */
#define DMA1_BASE (PERIPH_BASE_AHB + 0x08000)
#define DMA2_BASE (PERIPH_BASE_AHB + 0x08400)
/* PERIPH_BASE_AHB + 0x8800 (0x4002 0800 - 0x4002 0FFF): Reserved */
#define RCC_BASE (PERIPH_BASE_AHB + 0x09000)
/* PERIPH_BASE_AHB + 0x9400 (0x4002 1400 - 0x4002 1FFF): Reserved */
#define <API key> (PERIPH_BASE_AHB + 0x0a000)
#define CRC_BASE (PERIPH_BASE_AHB + 0x0b000)
/* PERIPH_BASE_AHB + 0xb400 (0x4002 3400 - 0x4002 7FFF): Reserved */
#define ETHERNET_BASE (PERIPH_BASE_AHB + 0x10000)
/* PERIPH_BASE_AHB + 0x18000 (0x4003 0000 - 0x4FFF FFFF): Reserved */
#define USB_OTG_FS_BASE (PERIPH_BASE_AHB + 0xffe8000)
/* PPIB */
#define DBGMCU_BASE (PPBI_BASE + 0x00042000)
/* FSMC */
#define FSMC_BASE (PERIPH_BASE + 0x60000000)
/* Device Electronic Signature */
#define <API key> (INFO_BASE + 0x7e0)
#define <API key> (INFO_BASE + 0x7e8)
/* Ignore the "reserved for future use" half of the first word */
#define DESIG_UNIQUE_ID0 MMIO32(<API key>)
#define DESIG_UNIQUE_ID1 MMIO32(<API key> + 4)
#define DESIG_UNIQUE_ID2 MMIO32(<API key> + 8)
#endif
|
<?php
class <API key> extends Controller {
public function index() {
$this->load->language('report/customer_activity');
$this->document->setTitle($this->language->get('heading_title'));
if (isset($this->request->get['filter_customer'])) {
$filter_customer = $this->request->get['filter_customer'];
} else {
$filter_customer = null;
}
if (isset($this->request->get['filter_ip'])) {
$filter_ip = $this->request->get['filter_ip'];
} else {
$filter_ip = null;
}
if (isset($this->request->get['filter_date_start'])) {
$filter_date_start = $this->request->get['filter_date_start'];
} else {
$filter_date_start = '';
}
if (isset($this->request->get['filter_date_end'])) {
$filter_date_end = $this->request->get['filter_date_end'];
} else {
$filter_date_end = '';
}
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$url = '';
if (isset($this->request->get['filter_customer'])) {
$url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
}
if (isset($this->request->get['filter_ip'])) {
$url .= '&filter_ip=' . $this->request->get['filter_ip'];
}
if (isset($this->request->get['filter_date_start'])) {
$url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
}
if (isset($this->request->get['filter_date_end'])) {
$url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$data['breadcrumbs'] = array();
$data['breadcrumbs'][] = array(
'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL'),
'text' => $this->language->get('text_home')
);
$data['breadcrumbs'][] = array(
'href' => $this->url->link('report/customer_activity', 'token=' . $this->session->data['token'] . $url, 'SSL'),
'text' => $this->language->get('heading_title')
);
$this->load->model('report/customer');
$data['activities'] = array();
$filter_data = array(
'filter_customer' => $filter_customer,
'filter_ip' => $filter_ip,
'filter_date_start' => $filter_date_start,
'filter_date_end' => $filter_date_end,
'start' => ($page - 1) * 20,
'limit' => 20
);
$activity_total = $this-><API key>-><API key>($filter_data);
$results = $this-><API key>-><API key>($filter_data);
foreach ($results as $result) {
$comment = vsprintf($this->language->get('text_' . $result['key']), unserialize($result['data']));
$find = array(
'customer_id=',
'order_id='
);
$replace = array(
$this->url->link('sale/customer/edit', 'token=' . $this->session->data['token'] . '&customer_id=', 'SSL'),
$this->url->link('sale/order/info', 'token=' . $this->session->data['token'] . '&order_id=', 'SSL')
);
$data['activities'][] = array(
'comment' => str_replace($find, $replace, $comment),
'ip' => $result['ip'],
'date_added' => date($this->language->get('datetime_format'), strtotime($result['date_added']))
);
}
$data['heading_title'] = $this->language->get('heading_title');
$data['text_list'] = $this->language->get('text_list');
$data['text_no_results'] = $this->language->get('text_no_results');
$data['text_confirm'] = $this->language->get('text_confirm');
$data['column_comment'] = $this->language->get('column_comment');
$data['column_ip'] = $this->language->get('column_ip');
$data['column_date_added'] = $this->language->get('column_date_added');
$data['entry_customer'] = $this->language->get('entry_customer');
$data['entry_ip'] = $this->language->get('entry_ip');
$data['entry_date_start'] = $this->language->get('entry_date_start');
$data['entry_date_end'] = $this->language->get('entry_date_end');
$data['button_filter'] = $this->language->get('button_filter');
$data['token'] = $this->session->data['token'];
$url = '';
if (isset($this->request->get['filter_customer'])) {
$url .= '&filter_customer=' . urlencode($this->request->get['filter_customer']);
}
if (isset($this->request->get['filter_ip'])) {
$url .= '&filter_ip=' . $this->request->get['filter_ip'];
}
if (isset($this->request->get['filter_date_start'])) {
$url .= '&filter_date_start=' . $this->request->get['filter_date_start'];
}
if (isset($this->request->get['filter_date_end'])) {
$url .= '&filter_date_end=' . $this->request->get['filter_date_end'];
}
$pagination = new Pagination();
$pagination->total = $activity_total;
$pagination->page = $page;
$pagination->limit = $this->config->get('config_limit_admin');
$pagination->url = $this->url->link('report/customer_activity', 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
$data['pagination'] = $pagination->render();
$data['results'] = sprintf($this->language->get('text_pagination'), ($activity_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($activity_total - $this->config->get('config_limit_admin'))) ? $activity_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $activity_total, ceil($activity_total / $this->config->get('config_limit_admin')));
$data['filter_customer'] = $filter_customer;
$data['filter_ip'] = $filter_ip;
$data['filter_date_start'] = $filter_date_start;
$data['filter_date_end'] = $filter_date_end;
$data['header'] = $this->load->controller('common/header');
$data['column_left'] = $this->load->controller('common/column_left');
$data['footer'] = $this->load->controller('common/footer');
$this->response->setOutput($this->load->view('report/customer_activity.tpl', $data));
}
}
|
<?php
// Moodle is free software: you can redistribute it and/or modify
// (at your option) any later version.
// Moodle is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2017051500;
$plugin->requires = 2017050500; // Requires this Moodle version
$plugin->component = 'report_backups'; // Full name of the plugin (used for diagnostics)
|
<!DOCTYPE html>
<html>
<!-- Submitted from TestTWF Paris -->
<head>
<title>CSS Values and Units Test: vh-based dimension doesn't change when the element other dimension doesn't change.</title>
<style type="text/css">
* { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size: 13px; }
/* the first test box has its vertical dimension is set to some vh units */
#testBoxWithVhOnly { background: #F00; width: 60px; height: 20vh; float: left; }
/* the second test box, with fixed height */
#<API key> { background: #F0F; width: 20vh; height: 60px; float: left; }
/* third box, changed by using CSS transition */
#<API key> { background: #FF0; width: 20vh; height: 40px; float: left;
transition-property: width, height;
transition-duration: 0.3s;
transition-delay: 0;
}
/* the reference box, growing in both directions (height by js, width by vh unit */
#<API key> { background: #0F0; width: 20vh; height: 40px; float: left; }
p { clear: both; margin: 10px 0; }
</style>
</head>
<body>
<p>
All boxes should end up the same size. The green box is the reference one.
</p>
<div id="testBoxWithVhOnly"></div>
<div id="<API key>"></div>
<div id="<API key>"></div>
<div id="<API key>"></div>
<script type="text/javascript">
'use strict';
// In case this file was opened by mistake, redirects to proper test
if (window.top.location.href === document.location.href) {
window.top.location.href = "<API key>.html";
}
function setDimension(id, dimension, value) {
var element = document.getElementById(id);
element.style[dimension] = value + "px";
}
function animate() {
var viewportHeight = document.documentElement.clientHeight;
var sizeH = 20;
var referenceDimension = Math.round(sizeH * viewportHeight / 100);
setDimension('<API key>', 'height', referenceDimension);
if (referenceDimension < 60) {
setTimeout(animate, 20);
} else {
parent.postMessage('<API key>', '*');
}
}
setTimeout(animate, 20);
addEventListener('transitionend', function() {
parent.postMessage('<API key>', '*');
}, false);
var <API key> = document.getElementById('<API key>').style;
<API key>.height = "60px";
</script>
</body>
</html>
|
'use strict'
const Buffer = require('safe-buffer').Buffer
const crypto = require('crypto')
const Transform = require('stream').Transform
const SPEC_ALGORITHMS = ['sha256', 'sha384', 'sha512']
const BASE64_REGEX = /^[a-z0-9+/]+(?:=?=?)$/i
const SRI_REGEX = /^([^-]+)-([^?]+)([?\S*]*)$/
const STRICT_SRI_REGEX = /^([^-]+)-([A-Za-z0-9+/=]{44,88})(\?[\x21-\x7E]*)*$/
const VCHAR_REGEX = /^[\x21-\x7E]+$/
class Hash {
get isHash () { return true }
constructor (hash, opts) {
const strict = !!(opts && opts.strict)
this.source = hash.trim()
// 3.1. Integrity metadata (called "Hash" by ssri)
// https://w3c.github.io/<API key>/#<API key>
const match = this.source.match(
strict
? STRICT_SRI_REGEX
: SRI_REGEX
)
if (!match) { return }
if (strict && !SPEC_ALGORITHMS.some(a => a === match[1])) { return }
this.algorithm = match[1]
this.digest = match[2]
const rawOpts = match[3]
this.options = rawOpts ? rawOpts.slice(1).split('?') : []
}
hexDigest () {
return this.digest && Buffer.from(this.digest, 'base64').toString('hex')
}
toJSON () {
return this.toString()
}
toString (opts) {
if (opts && opts.strict) {
// Strict mode enforces the standard as close to the foot of the
// letter as it can.
if (!(
// The spec has very restricted productions for algorithms.
// https://www.w3.org/TR/CSP2/#source-list-syntax
SPEC_ALGORITHMS.some(x => x === this.algorithm) &&
// Usually, if someone insists on using a "different" base64, we
// leave it as-is, since there's multiple standards, and the
// specified is not a URL-safe variant.
// https://www.w3.org/TR/CSP2/#base64_value
this.digest.match(BASE64_REGEX) &&
// Option syntax is strictly visual chars.
// https://w3c.github.io/<API key>/#<API key>
// https://tools.ietf.org/html/rfc5234#appendix-B.1
(this.options || []).every(opt => opt.match(VCHAR_REGEX))
)) {
return ''
}
}
const options = this.options && this.options.length
? `?${this.options.join('?')}`
: ''
return `${this.algorithm}-${this.digest}${options}`
}
}
class Integrity {
get isIntegrity () { return true }
toJSON () {
return this.toString()
}
toString (opts) {
opts = opts || {}
let sep = opts.sep || ' '
if (opts.strict) {
// Entries must be separated by whitespace, according to spec.
sep = sep.replace(/\S+/g, ' ')
}
return Object.keys(this).map(k => {
return this[k].map(hash => {
return Hash.prototype.toString.call(hash, opts)
}).filter(x => x.length).join(sep)
}).filter(x => x.length).join(sep)
}
concat (integrity, opts) {
const other = typeof integrity === 'string'
? integrity
: stringify(integrity, opts)
return parse(`${this.toString(opts)} ${other}`, opts)
}
hexDigest () {
return parse(this, {single: true}).hexDigest()
}
match (integrity, opts) {
const other = parse(integrity, opts)
const algo = other.pickAlgorithm(opts)
return (
this[algo] &&
other[algo] &&
this[algo].find(hash =>
other[algo].find(otherhash =>
hash.digest === otherhash.digest
)
)
) || false
}
pickAlgorithm (opts) {
const pickAlgorithm = (opts && opts.pickAlgorithm) || getPrioritizedHash
const keys = Object.keys(this)
if (!keys.length) {
throw new Error(`No algorithms available for ${
JSON.stringify(this.toString())
}`)
}
return keys.reduce((acc, algo) => {
return pickAlgorithm(acc, algo) || acc
})
}
}
module.exports.parse = parse
function parse (sri, opts) {
opts = opts || {}
if (typeof sri === 'string') {
return _parse(sri, opts)
} else if (sri.algorithm && sri.digest) {
const fullSri = new Integrity()
fullSri[sri.algorithm] = [sri]
return _parse(stringify(fullSri, opts), opts)
} else {
return _parse(stringify(sri, opts), opts)
}
}
function _parse (integrity, opts) {
// 3.4.3. Parse metadata
// https://w3c.github.io/<API key>/#parse-metadata
if (opts.single) {
return new Hash(integrity, opts)
}
return integrity.trim().split(/\s+/).reduce((acc, string) => {
const hash = new Hash(string, opts)
if (hash.algorithm && hash.digest) {
const algo = hash.algorithm
if (!acc[algo]) { acc[algo] = [] }
acc[algo].push(hash)
}
return acc
}, new Integrity())
}
module.exports.stringify = stringify
function stringify (obj, opts) {
if (obj.algorithm && obj.digest) {
return Hash.prototype.toString.call(obj, opts)
} else if (typeof obj === 'string') {
return stringify(parse(obj, opts), opts)
} else {
return Integrity.prototype.toString.call(obj, opts)
}
}
module.exports.fromHex = fromHex
function fromHex (hexDigest, algorithm, opts) {
const optString = (opts && opts.options && opts.options.length)
? `?${opts.options.join('?')}`
: ''
return parse(
`${algorithm}-${
Buffer.from(hexDigest, 'hex').toString('base64')
}${optString}`, opts
)
}
module.exports.fromData = fromData
function fromData (data, opts) {
opts = opts || {}
const algorithms = opts.algorithms || ['sha512']
const optString = opts.options && opts.options.length
? `?${opts.options.join('?')}`
: ''
return algorithms.reduce((acc, algo) => {
const digest = crypto.createHash(algo).update(data).digest('base64')
const hash = new Hash(
`${algo}-${digest}${optString}`,
opts
)
if (hash.algorithm && hash.digest) {
const algo = hash.algorithm
if (!acc[algo]) { acc[algo] = [] }
acc[algo].push(hash)
}
return acc
}, new Integrity())
}
module.exports.fromStream = fromStream
function fromStream (stream, opts) {
opts = opts || {}
const P = opts.Promise || Promise
const istream = integrityStream(opts)
return new P((resolve, reject) => {
stream.pipe(istream)
stream.on('error', reject)
istream.on('error', reject)
let sri
istream.on('integrity', s => { sri = s })
istream.on('end', () => resolve(sri))
istream.on('data', () => {})
})
}
module.exports.checkData = checkData
function checkData (data, sri, opts) {
opts = opts || {}
sri = parse(sri, opts)
if (!Object.keys(sri).length) {
if (opts.error) {
throw Object.assign(
new Error('No valid integrity hashes to check against'), {
code: 'EINTEGRITY'
}
)
} else {
return false
}
}
const algorithm = sri.pickAlgorithm(opts)
const digest = crypto.createHash(algorithm).update(data).digest('base64')
const newSri = parse({algorithm, digest})
const match = newSri.match(sri, opts)
if (match || !opts.error) {
return match
} else if (typeof opts.size === 'number' && (data.length !== opts.size)) {
const err = new Error(`data size mismatch when checking ${sri}.\n Wanted: ${opts.size}\n Found: ${data.length}`)
err.code = 'EBADSIZE'
err.found = data.length
err.expected = opts.size
err.sri = sri
throw err
} else {
const err = new Error(`Integrity checksum failed when using ${algorithm}: Wanted ${sri}, but got ${newSri}. (${data.length} bytes)`)
err.code = 'EINTEGRITY'
err.found = newSri
err.expected = sri
err.algorithm = algorithm
err.sri = sri
throw err
}
}
module.exports.checkStream = checkStream
function checkStream (stream, sri, opts) {
opts = opts || {}
const P = opts.Promise || Promise
const checker = integrityStream(Object.assign({}, opts, {
integrity: sri
}))
return new P((resolve, reject) => {
stream.pipe(checker)
stream.on('error', reject)
checker.on('error', reject)
let sri
checker.on('verified', s => { sri = s })
checker.on('end', () => resolve(sri))
checker.on('data', () => {})
})
}
module.exports.integrityStream = integrityStream
function integrityStream (opts) {
opts = opts || {}
// For verification
const sri = opts.integrity && parse(opts.integrity, opts)
const goodSri = sri && Object.keys(sri).length
const algorithm = goodSri && sri.pickAlgorithm(opts)
const digests = goodSri && sri[algorithm]
// Calculating stream
const algorithms = Array.from(
new Set(
(opts.algorithms || ['sha512'])
.concat(algorithm ? [algorithm] : [])
)
)
const hashes = algorithms.map(crypto.createHash)
let streamSize = 0
const stream = new Transform({
transform (chunk, enc, cb) {
streamSize += chunk.length
hashes.forEach(h => h.update(chunk, enc))
cb(null, chunk, enc)
}
}).on('end', () => {
const optString = (opts.options && opts.options.length)
? `?${opts.options.join('?')}`
: ''
const newSri = parse(hashes.map((h, i) => {
return `${algorithms[i]}-${h.digest('base64')}${optString}`
}).join(' '), opts)
// Integrity verification mode
const match = goodSri && newSri.match(sri, opts)
if (typeof opts.size === 'number' && streamSize !== opts.size) {
const err = new Error(`stream size mismatch when checking ${sri}.\n Wanted: ${opts.size}\n Found: ${streamSize}`)
err.code = 'EBADSIZE'
err.found = streamSize
err.expected = opts.size
err.sri = sri
stream.emit('error', err)
} else if (opts.integrity && !match) {
const err = new Error(`${sri} integrity checksum failed when using ${algorithm}: wanted ${digests} but got ${newSri}. (${streamSize} bytes)`)
err.code = 'EINTEGRITY'
err.found = newSri
err.expected = digests
err.algorithm = algorithm
err.sri = sri
stream.emit('error', err)
} else {
stream.emit('size', streamSize)
stream.emit('integrity', newSri)
match && stream.emit('verified', match)
}
})
return stream
}
module.exports.create = createIntegrity
function createIntegrity (opts) {
opts = opts || {}
const algorithms = opts.algorithms || ['sha512']
const optString = opts.options && opts.options.length
? `?${opts.options.join('?')}`
: ''
const hashes = algorithms.map(crypto.createHash)
return {
update: function (chunk, enc) {
hashes.forEach(h => h.update(chunk, enc))
return this
},
digest: function (enc) {
const integrity = algorithms.reduce((acc, algo) => {
const digest = hashes.shift().digest('base64')
const hash = new Hash(
`${algo}-${digest}${optString}`,
opts
)
if (hash.algorithm && hash.digest) {
const algo = hash.algorithm
if (!acc[algo]) { acc[algo] = [] }
acc[algo].push(hash)
}
return acc
}, new Integrity())
return integrity
}
}
}
const NODE_HASHES = new Set(crypto.getHashes())
const DEFAULT_PRIORITY = [
'md5', 'whirlpool', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512',
// TODO - it's unclear _which_ of these Node will actually use as its name
// for the algorithm, so we guesswork it based on the OpenSSL names.
'sha3',
'sha3-256', 'sha3-384', 'sha3-512',
'sha3_256', 'sha3_384', 'sha3_512'
].filter(algo => NODE_HASHES.has(algo))
function getPrioritizedHash (algo1, algo2) {
return DEFAULT_PRIORITY.indexOf(algo1.toLowerCase()) >= DEFAULT_PRIORITY.indexOf(algo2.toLowerCase())
? algo1
: algo2
}
|
<reference path="fourslash.ts" />
// @<API key>: true
// @Filename: file.js
/ /**
/ * @param {number} a
/ * @param {string} b
/ */
/ exports.foo = function(a, b) {
/ a;
/ b
/ };
goTo.marker('a');
edit.insert('.');
verify.<API key>('toFixed', undefined, undefined, 'method');
goTo.marker('b');
edit.insert('.');
verify.<API key>('substr', undefined, undefined, 'method');
|
// The LLVM Compiler Infrastructure
// This file is distributed under the University of Illinois Open Source
// This file implements the ScratchBuffer interface.
#include "clang/Lex/ScratchBuffer.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/Support/MemoryBuffer.h"
#include <cstring>
using namespace clang;
// ScratchBufSize - The size of each chunk of scratch memory. Slightly less
//than a page, almost certainly enough for anything. :)
static const unsigned ScratchBufSize = 4060;
ScratchBuffer::ScratchBuffer(SourceManager &SM) : SourceMgr(SM), CurBuffer(0) {
// Set BytesUsed so that the first call to getToken will require an alloc.
BytesUsed = ScratchBufSize;
}
getToken - Splat the specified text into a temporary MemoryBuffer and
return a SourceLocation that refers to the token. This is just like the
method below, but returns a location that indicates the physloc of the
token.
SourceLocation ScratchBuffer::getToken(const char *Buf, unsigned Len,
const char *&DestPtr) {
if (BytesUsed+Len+2 > ScratchBufSize)
AllocScratchBuffer(Len+2);
// Prefix the token with a \n, so that it looks like it is the first thing on
// its own virtual line in caret diagnostics.
CurBuffer[BytesUsed++] = '\n';
// Return a pointer to the character data.
DestPtr = CurBuffer+BytesUsed;
// Copy the token data into the buffer.
memcpy(CurBuffer+BytesUsed, Buf, Len);
// Remember that we used these bytes.
BytesUsed += Len+1;
// Add a NUL terminator to the token. This keeps the tokens separated, in
// case they get relexed, and puts them on their own virtual lines in case a
// diagnostic points to one.
CurBuffer[BytesUsed-1] = '\0';
return BufferStartLoc.getLocWithOffset(BytesUsed-Len-1);
}
void ScratchBuffer::AllocScratchBuffer(unsigned RequestLen) {
// Only pay attention to the requested length if it is larger than our default
// page size. If it is, we allocate an entire chunk for it. This is to
// support gigantic tokens, which almost certainly won't happen. :)
if (RequestLen < ScratchBufSize)
RequestLen = ScratchBufSize;
llvm::MemoryBuffer *Buf =
llvm::MemoryBuffer::getNewMemBuffer(RequestLen, "<scratch space>");
FileID FID = SourceMgr.<API key>(Buf);
BufferStartLoc = SourceMgr.<API key>(FID);
CurBuffer = const_cast<char*>(Buf->getBufferStart());
BytesUsed = 1;
CurBuffer[0] = '0'; // Start out with a \0 for cleanliness.
}
|
<?php
/**
* Validates an integer representation of pixels according to the HTML spec.
*/
class <API key> extends <API key>
{
protected $max;
public function __construct($max = null) {
$this->max = $max;
}
public function validate($string, $config, $context) {
$string = trim($string);
if ($string === '0') return $string;
if ($string === '') return false;
$length = strlen($string);
if (substr($string, $length - 2) == 'px') {
$string = substr($string, 0, $length - 2);
}
if (!is_numeric($string)) return false;
$int = (int) $string;
if ($int < 0) return '0';
// upper-bound value, extremely high values can
// WARNING, above link WILL crash you if you're using Windows
if ($this->max !== null && $int > $this->max) return (string) $this->max;
return (string) $int;
}
public function make($string) {
if ($string === '') $max = null;
else $max = (int) $string;
$class = get_class($this);
return new $class($max);
}
}
|
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<link href='../fullcalendar.css' rel='stylesheet' />
<link href='../fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='../lib/moment.min.js'></script>
<script src='../lib/jquery.min.js'></script>
<script src='../lib/jquery-ui.custom.min.js'></script>
<script src='../fullcalendar.min.js'></script>
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
defaultDate: '2014-06-12',
editable: true,
events: [
{
title: 'All Day Event',
start: '2014-06-01'
},
{
title: 'Long Event',
start: '2014-06-07',
end: '2014-06-10'
},
{
id: 999,
title: 'Repeating Event',
start: '2014-06-09T16:00:00'
},
{
id: 999,
title: 'Repeating Event',
start: '2014-06-16T16:00:00'
},
{
title: 'Meeting',
start: '2014-06-12T10:30:00',
end: '2014-06-12T12:30:00'
},
{
title: 'Lunch',
start: '2014-06-12T12:00:00'
},
{
title: 'Birthday Party',
start: '2014-06-13T07:00:00'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2014-06-28'
}
]
});
});
</script>
<style>
body {
margin: 0;
padding: 0;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
font-size: 14px;
}
#calendar {
width: 900px;
margin: 40px auto;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>
|
cask '<API key>' do
version '10.1'
sha256 '<SHA256-like>'
url "http://www.d-rats.com/download/OSX_Runtime/<API key>#{version.major}.pkg"
name 'KK7DS Python Runtime'
homepage 'http:
pkg "<API key>#{version.major}.pkg"
uninstall pkgutil: 'com.danplanet.python_runtime',
delete: '/opt/kk7ds'
end
|
<!doctype html>
<title>
legend and float and position: absolute/fixed when the display type of
the fieldset is flex.
</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
body { margin: 0; }
fieldset {
border: 10px solid;
display: flex;
margin: 0;
padding: 20px;
width: 300px;
}
legend { height: 10px; }
#legend1 { float: left; }
#legend2 { float: right; }
#legend3 { position: absolute; }
#legend4 { position: fixed; }
</style>
<fieldset id=fieldset>
<div>div</div>
<legend id=legend1>legend1</legend>
<legend id=legend2>legend2</legend>
<legend id=legend3>legend3</legend>
<legend id=legend4>legend4</legend>
<legend id=legend5>legend5</legend>
</fieldset>
<script>
const fieldset = document.getElementById('fieldset');
const legends = document.<API key>('legend');
const [legend1, legend2, legend3, legend4, legend5] = legends;
const expectedTop = 0;
const expectedLeft = 10 + 20;
function <API key>(legend) {
assert_equals(legend.offsetTop, expectedTop, `${legend.id}.offsetTop`);
assert_equals(legend.offsetLeft, expectedLeft, `${legend.id}.offsetLeft`);
for (const other of legends) {
if (other === legend) {
continue;
}
if (other.offsetTop === expectedTop && other.offsetLeft === expectedLeft) {
assert_unreached(`${other.id} should not be the "rendered legend"`);
}
}
}
test(t => {
<API key>(legend5);
}, 'no dynamic changes');
test(t => {
const legend = document.createElement('legend');
t.add_cleanup(() => {
legend.remove();
});
legend.id = 'script-inserted';
legend.textContent = 'script-inserted legend';
fieldset.insertBefore(legend, legend1);
<API key>(legend);
legend.remove();
<API key>(legend5);
}, 'inserting a new legend and removing it again');
test(t => {
t.add_cleanup(() => {
legend1.id = 'legend1';
legend2.id = 'legend2';
});
legend2.id = '';
<API key>(legend2);
legend1.id = '';
<API key>(legend1);
legend1.id = 'legend1';
<API key>(legend2);
legend2.id = 'legend2';
<API key>(legend5);
}, 'dynamic changes to float');
test(t => {
t.add_cleanup(() => {
legend3.id = 'legend3';
legend4.id = 'legend4';
});
legend4.id = '';
<API key>(legend4);
legend3.id = '';
<API key>(legend3);
legend3.id = 'legend3';
<API key>(legend4);
legend4.id = 'legend4';
<API key>(legend5);
}, 'dynamic changes to position');
</script>
|
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/rtc.h>
#include <linux/mfd/abx500.h>
#include <linux/mfd/abx500/ab8500.h>
#include <linux/delay.h>
#define <API key> 0x00
#define <API key> 0x01
#define <API key> 0x02
#define <API key> 0x03
#define <API key> 0x04
#define <API key> 0x05
#define <API key> 0x06
#define <API key> 0x07
#define <API key> 0x08
#define <API key> 0x09
#define <API key> 0x0A
#define AB8500_RTC_STAT_REG 0x0B
#define <API key> 0x0C
#define <API key> 0x0D
#define <API key> 0x0E
#define <API key> 0x0F
/* RtcReadRequest bits */
#define RTC_READ_REQUEST 0x01
#define RTC_WRITE_REQUEST 0x02
/* RtcCtrl bits */
#define RTC_ALARM_ENA 0x04
#define RTC_STATUS_DATA 0x01
#define COUNTS_PER_SEC (0xF000 / 60)
#define AB8500_RTC_EPOCH 2000
static const u8 <API key>[] = {
<API key>, <API key>,
<API key>, <API key>,
<API key>
};
static const u8 <API key>[] = {
<API key>, <API key>,
<API key>
};
/* Calculate the seconds from 1970 to 01-01-2000 00:00:00 */
static unsigned long get_elapsed_seconds(int year)
{
unsigned long secs;
struct rtc_time tm = {
.tm_year = year - 1900,
.tm_mday = 1,
};
/*
* This function calculates secs from 1970 and not from
* 1900, even if we supply the offset from year 1900.
*/
rtc_tm_to_time(&tm, &secs);
return secs;
}
static int <API key>(struct device *dev, struct rtc_time *tm)
{
unsigned long timeout = jiffies + HZ;
int retval, i;
unsigned long mins, secs;
unsigned char buf[ARRAY_SIZE(<API key>)];
u8 value;
/* Request a data read */
retval = <API key>(dev,
AB8500_RTC, <API key>, RTC_READ_REQUEST);
if (retval < 0)
return retval;
/* Early AB8500 chips will not clear the rtc read request bit */
if (abx500_get_chip_id(dev) == 0) {
usleep_range(1000, 1000);
} else {
/* Wait for some cycles after enabling the rtc read in ab8500 */
while (time_before(jiffies, timeout)) {
retval = <API key>(dev,
AB8500_RTC, <API key>, &value);
if (retval < 0)
return retval;
if (!(value & RTC_READ_REQUEST))
break;
usleep_range(1000, 5000);
}
}
/* Read the Watchtime registers */
for (i = 0; i < ARRAY_SIZE(<API key>); i++) {
retval = <API key>(dev,
AB8500_RTC, <API key>[i], &value);
if (retval < 0)
return retval;
buf[i] = value;
}
mins = (buf[0] << 16) | (buf[1] << 8) | buf[2];
secs = (buf[3] << 8) | buf[4];
secs = secs / COUNTS_PER_SEC;
secs = secs + (mins * 60);
/* Add back the initially subtracted number of seconds */
secs += get_elapsed_seconds(AB8500_RTC_EPOCH);
rtc_time_to_tm(secs, tm);
return rtc_valid_tm(tm);
}
static int ab8500_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
int retval, i;
unsigned char buf[ARRAY_SIZE(<API key>)];
unsigned long no_secs, no_mins, secs = 0;
if (tm->tm_year < (AB8500_RTC_EPOCH - 1900)) {
dev_dbg(dev, "year should be equal to or greater than %d\n",
AB8500_RTC_EPOCH);
return -EINVAL;
}
/* Get the number of seconds since 1970 */
rtc_tm_to_time(tm, &secs);
/*
* Convert it to the number of seconds since 01-01-2000 00:00:00, since
* we only have a small counter in the RTC.
*/
secs -= get_elapsed_seconds(AB8500_RTC_EPOCH);
no_mins = secs / 60;
no_secs = secs % 60;
/* Make the seconds count as per the RTC resolution */
no_secs = no_secs * COUNTS_PER_SEC;
buf[4] = no_secs & 0xFF;
buf[3] = (no_secs >> 8) & 0xFF;
buf[2] = no_mins & 0xFF;
buf[1] = (no_mins >> 8) & 0xFF;
buf[0] = (no_mins >> 16) & 0xFF;
for (i = 0; i < ARRAY_SIZE(<API key>); i++) {
retval = <API key>(dev, AB8500_RTC,
<API key>[i], buf[i]);
if (retval < 0)
return retval;
}
/* Request a data write */
return <API key>(dev, AB8500_RTC,
<API key>, RTC_WRITE_REQUEST);
}
static int <API key>(struct device *dev, struct rtc_wkalrm *alarm)
{
int retval, i;
u8 rtc_ctrl, value;
unsigned char buf[ARRAY_SIZE(<API key>)];
unsigned long secs, mins;
/* Check if the alarm is enabled or not */
retval = <API key>(dev, AB8500_RTC,
AB8500_RTC_STAT_REG, &rtc_ctrl);
if (retval < 0)
return retval;
if (rtc_ctrl & RTC_ALARM_ENA)
alarm->enabled = 1;
else
alarm->enabled = 0;
alarm->pending = 0;
for (i = 0; i < ARRAY_SIZE(<API key>); i++) {
retval = <API key>(dev, AB8500_RTC,
<API key>[i], &value);
if (retval < 0)
return retval;
buf[i] = value;
}
mins = (buf[0] << 16) | (buf[1] << 8) | (buf[2]);
secs = mins * 60;
/* Add back the initially subtracted number of seconds */
secs += get_elapsed_seconds(AB8500_RTC_EPOCH);
rtc_time_to_tm(secs, &alarm->time);
return rtc_valid_tm(&alarm->time);
}
static int <API key>(struct device *dev, unsigned int enabled)
{
return <API key>(dev, AB8500_RTC,
AB8500_RTC_STAT_REG, RTC_ALARM_ENA,
enabled ? RTC_ALARM_ENA : 0);
}
static int <API key>(struct device *dev, struct rtc_wkalrm *alarm)
{
int retval, i;
unsigned char buf[ARRAY_SIZE(<API key>)];
unsigned long mins, secs = 0;
if (alarm->time.tm_year < (AB8500_RTC_EPOCH - 1900)) {
dev_dbg(dev, "year should be equal to or greater than %d\n",
AB8500_RTC_EPOCH);
return -EINVAL;
}
/* Get the number of seconds since 1970 */
rtc_tm_to_time(&alarm->time, &secs);
/*
* Convert it to the number of seconds since 01-01-2000 00:00:00, since
* we only have a small counter in the RTC.
*/
secs -= get_elapsed_seconds(AB8500_RTC_EPOCH);
mins = secs / 60;
buf[2] = mins & 0xFF;
buf[1] = (mins >> 8) & 0xFF;
buf[0] = (mins >> 16) & 0xFF;
/* Set the alarm time */
for (i = 0; i < ARRAY_SIZE(<API key>); i++) {
retval = <API key>(dev, AB8500_RTC,
<API key>[i], buf[i]);
if (retval < 0)
return retval;
}
return <API key>(dev, alarm->enabled);
}
static int <API key>(struct device *dev, int calibration)
{
int retval;
u8 rtccal = 0;
/*
* Check that the calibration value (which is in units of 0.5
* parts-per-million) is in the AB8500's range for RtcCalibration
* register. -128 (0x80) is not permitted because the AB8500 uses
* a sign-bit rather than two's complement, so 0x80 is just another
* representation of zero.
*/
if ((calibration < -127) || (calibration > 127)) {
dev_err(dev, "RtcCalibration value outside permitted range\n");
return -EINVAL;
}
/*
* The AB8500 uses sign (in bit7) and magnitude (in bits0-7)
* so need to convert to this sort of representation before writing
* into RtcCalibration register...
*/
if (calibration >= 0)
rtccal = 0x7F & calibration;
else
rtccal = ~(calibration - 1) | 0x80;
retval = <API key>(dev, AB8500_RTC,
<API key>, rtccal);
return retval;
}
static int <API key>(struct device *dev, int *calibration)
{
int retval;
u8 rtccal = 0;
retval = <API key>(dev, AB8500_RTC,
<API key>, &rtccal);
if (retval >= 0) {
/*
* The AB8500 uses sign (in bit7) and magnitude (in bits0-7)
* so need to convert value from RtcCalibration register into
* a two's complement signed value...
*/
if (rtccal & 0x80)
*calibration = 0 - (rtccal & 0x7F);
else
*calibration = 0x7F & rtccal;
}
return retval;
}
static ssize_t <API key>(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
int retval;
int calibration = 0;
if (sscanf(buf, " %i ", &calibration) != 1) {
dev_err(dev, "Failed to store RTC calibration attribute\n");
return -EINVAL;
}
retval = <API key>(dev, calibration);
return retval ? retval : count;
}
static ssize_t <API key>(struct device *dev,
struct device_attribute *attr, char *buf)
{
int retval = 0;
int calibration = 0;
retval = <API key>(dev, &calibration);
if (retval < 0) {
dev_err(dev, "Failed to read RTC calibration attribute\n");
sprintf(buf, "0\n");
return retval;
}
return sprintf(buf, "%d\n", calibration);
}
static DEVICE_ATTR(rtc_calibration, S_IRUGO | S_IWUSR,
<API key>,
<API key>);
static int <API key>(struct device *dev)
{
return device_create_file(dev, &<API key>);
}
static void <API key>(struct device *dev)
{
device_remove_file(dev, &<API key>);
}
static irqreturn_t rtc_alarm_handler(int irq, void *data)
{
struct rtc_device *rtc = data;
unsigned long events = RTC_IRQF | RTC_AF;
dev_dbg(&rtc->dev, "%s\n", __func__);
rtc_update_irq(rtc, 1, events);
return IRQ_HANDLED;
}
static const struct rtc_class_ops ab8500_rtc_ops = {
.read_time = <API key>,
.set_time = ab8500_rtc_set_time,
.read_alarm = <API key>,
.set_alarm = <API key>,
.alarm_irq_enable = <API key>,
};
static int __devinit ab8500_rtc_probe(struct platform_device *pdev)
{
int err;
struct rtc_device *rtc;
u8 rtc_ctrl;
int irq;
irq = <API key>(pdev, "ALARM");
if (irq < 0)
return irq;
/* For RTC supply test */
err = <API key>(&pdev->dev, AB8500_RTC,
AB8500_RTC_STAT_REG, RTC_STATUS_DATA, RTC_STATUS_DATA);
if (err < 0)
return err;
/* Wait for reset by the PorRtc */
usleep_range(1000, 5000);
err = <API key>(&pdev->dev, AB8500_RTC,
AB8500_RTC_STAT_REG, &rtc_ctrl);
if (err < 0)
return err;
/* Check if the RTC Supply fails */
if (!(rtc_ctrl & RTC_STATUS_DATA)) {
dev_err(&pdev->dev, "RTC supply failure\n");
return -ENODEV;
}
device_init_wakeup(&pdev->dev, true);
rtc = rtc_device_register("ab8500-rtc", &pdev->dev, &ab8500_rtc_ops,
THIS_MODULE);
if (IS_ERR(rtc)) {
dev_err(&pdev->dev, "Registration failed\n");
err = PTR_ERR(rtc);
return err;
}
err = <API key>(irq, NULL, rtc_alarm_handler,
IRQF_NO_SUSPEND, "ab8500-rtc", rtc);
if (err < 0) {
<API key>(rtc);
return err;
}
<API key>(pdev, rtc);
err = <API key>(&pdev->dev);
if (err) {
dev_err(&pdev->dev, "sysfs RTC failed to register\n");
return err;
}
return 0;
}
static int __devexit ab8500_rtc_remove(struct platform_device *pdev)
{
struct rtc_device *rtc = <API key>(pdev);
int irq = <API key>(pdev, "ALARM");
<API key>(&pdev->dev);
free_irq(irq, rtc);
<API key>(rtc);
<API key>(pdev, NULL);
return 0;
}
static struct platform_driver ab8500_rtc_driver = {
.driver = {
.name = "ab8500-rtc",
.owner = THIS_MODULE,
},
.probe = ab8500_rtc_probe,
.remove = __devexit_p(ab8500_rtc_remove),
};
<API key>(ab8500_rtc_driver);
MODULE_AUTHOR("Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com>");
MODULE_DESCRIPTION("AB8500 RTC Driver");
MODULE_LICENSE("GPL v2");
|
# == Schema Information
# Table name: runner_projects
# id :integer not null, primary key
# runner_id :integer not null
# project_id :integer not null
# created_at :datetime
# updated_at :datetime
module Ci
class RunnerProject < ActiveRecord::Base
extend Ci::Model
belongs_to :runner, class_name: 'Ci::Runner'
belongs_to :project, class_name: 'Ci::Project'
<API key> :runner_id, scope: :project_id
end
end
|
extern void simplerng_setstate(unsigned int u, unsigned int v);
extern void simplerng_getstate(unsigned int *u, unsigned int *v);
extern void simplerng_srand(unsigned int seed);
extern double <API key>(void);
extern double simplerng_getnorm(void);
extern int <API key>(double lambda);
extern double <API key>(int n);
|
// RTLabel.h
// RTLabelProject
#import <UIKit/UIKit.h>
#import <CoreText/CoreText.h>
typedef enum
{
<API key> = <API key>,
RTTextAlignmentLeft = <API key>,
<API key> = <API key>,
<API key> = <API key>
} RTTextAlignment;
typedef enum
{
<API key> = <API key>,
<API key> = <API key>,
<API key> = <API key>,
}RTTextLineBreakMode;
@protocol RTLabelDelegate <NSObject>
@optional
- (void)rtLabel:(id)rtLabel <API key>:(NSURL*)url;
@end
@interface RTLabelComponent : NSObject
@property (nonatomic, assign) int componentIndex;
@property (nonatomic, copy) NSString *text;
@property (nonatomic, copy) NSString *tagLabel;
@property (nonatomic) NSMutableDictionary *attributes;
@property (nonatomic, assign) int position;
- (id)initWithString:(NSString*)aText tag:(NSString*)aTagLabel attributes:(NSMutableDictionary*)theAttributes;
+ (id)componentWithString:(NSString*)aText tag:(NSString*)aTagLabel attributes:(NSMutableDictionary*)theAttributes;
- (id)initWithTag:(NSString*)aTagLabel position:(int)_position attributes:(NSMutableDictionary*)_attributes;
+ (id)componentWithTag:(NSString*)aTagLabel position:(int)aPosition attributes:(NSMutableDictionary*)theAttributes;
@end
@interface <API key> : NSObject
@property (nonatomic, strong) NSMutableArray *textComponents;
@property (nonatomic, copy) NSString *plainText;
+ (<API key>*)<API key>:(NSMutableArray*)textComponents plainText:(NSString*)plainText;
@end
@interface RTLabel : UIView
@property (nonatomic, copy) NSString *text, *plainText, *highlightedText;
@property (nonatomic, strong) UIColor *textColor;
@property (nonatomic, strong) UIFont *font;
@property (nonatomic, strong) NSDictionary *linkAttributes;
@property (nonatomic, strong) NSDictionary *<API key>;
@property (nonatomic, unsafe_unretained) id<RTLabelDelegate> delegate;
@property (nonatomic, copy) NSString *<API key>;
@property (nonatomic, strong) NSMutableArray *textComponents, *<API key>;
@property (nonatomic, assign) RTTextAlignment textAlignment;
@property (nonatomic, assign) CGSize optimumSize;
@property (nonatomic, assign) RTTextLineBreakMode lineBreakMode;
@property (nonatomic, assign) CGFloat lineSpacing;
@property (nonatomic, assign) int <API key>;
@property (nonatomic, assign) CFRange visibleRange;
@property (nonatomic, assign) BOOL highlighted;
// set text
- (void)setText:(NSString*)text;
+ (<API key>*)<API key>:(NSString*)data <API key>:(NSString*)<API key>;
// get the visible text
- (NSString*)visibleText;
// alternative
// The purpose of this code is to cache pre-create the textComponents, is to improve the performance when drawing the text.
// This improvement is effective if the text is long.
- (void)setText:(NSString *)text <API key>:(<API key>*)extractedComponent;
- (void)setHighlightedText:(NSString *)text <API key>:(<API key>*)extractedComponent;
- (void)setText:(NSString *)text extractedTextStyle:(NSDictionary*)extractTextStyle __attribute__((deprecated));
+ (NSDictionary*)preExtractTextStyle:(NSString*)data __attribute__((deprecated));
@end
|
<!-- Generated by Rakefile:build -->
<strong>
TeMc
</strong>
on 2012-04-06 21:31:15 <br />
@Jean Marie:
1) Maybe it should be limited to arrays, like PHP does
2) No, because the purpose of this website is to re-create php functions in javascript. Feature requests are not accepted here by design.
<hr />
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2009-08-11 19:43:20 <br />
Sorry again, but my reply is mistaken as well. And it will all really depend on whether you are trying to build a return array which returns all of the keys shared across arrays based on the first one, and those subkeys which are shared as well, or if you want to ensure that those whose keys match across all arrays must also, if they are objects, have subkeys which are also contained across all arrays (or otherwise not include them)...
<hr />
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2009-08-11 19:23:18 <br />
Sorry, I realized the long 'if' should be changed to this to account for null values:
<pre><code>if (i === arguments.length-1 && (typeof arr1[k1] !== 'object' || typeof arr1[k1] === null || ct(arr[k]) === ct( this.<API key>.apply(this, tempArr)))) {</code></pre>
<hr />
<strong>
<a href="http://brett-zamir.me" rel="nofollow">Brett Zamir</a>
</strong>
on 2009-08-11 19:04:33 <br />
@Jean Marie: Glad to hear it fit your needs... Since there is otherwise no reasonable way for us to represent associative arrays in JavaScript, the PHP.JS project generally considers objects to be as arrays. As far as your question, I am guessing you want to ensure that only those keys are returned where there is a perfect match, including any subkeys? Here is a recursive version that seems to work for this:
<pre><code>var_dump(
<API key>({a:3, b:{c:5, d:5}, q:{r:5}}, {a:'z', c:'y', b:{c:6, d:8}, q:{s:5}})
);
function <API key> () {
var arr1 = arguments[0], retArr = {};
var k1 = '', arr = {}, i = 0, k = '';
var ct = function (obj) {
var c = 0;
for (var p in obj) {
c++;
}
return c;
};
arr1keys:
for (k1 in arr1) {
var tempArr = [arr1[k1]];
arrs:
for (i=1; i < arguments.length; i++) {
arr = arguments[i];
for (k in arr) {
if (k === k1) {
tempArr.push(arr[k]);
if (i === arguments.length-1 && (typeof arr1[k1] !== 'object' || ct(arr[k]) === ct( this.<API key>.apply(this, tempArr)))) {
retArr[k1] = arr1[k1];
}
// If the innermost loop always leads at least once to an equal value, continue the loop until done
continue arrs;
}
}
// If it reaches here, it wasn't found in at least one array, so try next value
continue arr1keys;
}
}
return retArr;
}</code></pre>
<hr />
<strong>
Jean Marie
</strong>
on 2009-08-11 11:28:37 <br />
Hi,
nice function i was looking for. Thanks!
Two points to mention:
1) You're not handling arrays! It should be named <API key>().
2) Is it possible to get this working in recursive.
Best regards
Jean Marie
<hr />
|
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example92</title>
<script src="../../../angular.min.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="eventExampleApp">
<div ng-controller="EventController">
<button ng-click="clickMe($event)">Event</button>
<p><code>$event</code>: <pre> {{$event | json}}</pre></p>
<p><code>clickEvent</code>: <pre>{{clickEvent | json}}</pre></p>
</div>
</body>
</html>
|
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// with this library; see the file COPYING3. If not see
#include <random>
#include <testsuite_hooks.h>
void
test01()
{
bool test __attribute__((unused)) = true;
std::<API key><unsigned long, 24, 10, 24> x;
VERIFY( x.min() == 0 );
VERIFY( x.max() == ((1UL << 24) - 1) );
VERIFY( x() == 15039276 );
}
int main()
{
test01();
return 0;
}
|
// { dg-options "-std=gnu++0x" }
// 2010-03-23 Paolo Carlini <paolo.carlini@oracle.com>
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// with this library; see the file COPYING3. If not see
#include <type_traits>
#include <testsuite_hooks.h>
#include <testsuite_tr1.h>
void test01()
{
bool test __attribute__((unused)) = true;
using std::is_literal_type;
using namespace __gnu_test;
VERIFY( (test_category<is_literal_type, int>(true)) );
VERIFY( (test_category<is_literal_type, unsigned char>(true)) );
VERIFY( (test_category<is_literal_type, TType>(true)) );
VERIFY( (test_category<is_literal_type, PODType>(true)) );
VERIFY( (test_category<is_literal_type, NType>(false)) );
VERIFY( (test_category<is_literal_type, SLType>(false)) );
VERIFY( (test_category<is_literal_type, LType>(true)) );
VERIFY( (test_category<is_literal_type, LType[5]>(true)) );
VERIFY( (test_category<is_literal_type, NLType>(false)) );
VERIFY( (test_category<is_literal_type, NLType[5]>(false)) );
VERIFY( (test_category<is_literal_type, LTypeDerived>(true)) );
VERIFY( (test_category<is_literal_type, LTypeDerived[5]>(true)) );
}
int main()
{
test01();
return 0;
}
|
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// with this library; see the file COPYING3. If not see
// { <API key> "" }
// { dg-do run { xfail *-*-* } }
#include <map>
#include <debug/checks.h>
void test01()
{
__gnu_test::check_insert3<std::map<int, int> >();
}
int main()
{
test01();
return 0;
}
|
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// with this library; see the file COPYING3. If not see
// { dg-require-fileio "" }
// 27.6.1.3 unformatted input functions
// NB: ostream has a particular "seeks" category. Adopt this for istreams too.
// @require@ %-*.tst %-*.txt
// @diff@ %-*.tst %-*.txt
#include <istream>
#include <sstream>
#include <fstream>
#include <testsuite_hooks.h>
// fstreams
void test04(void)
{
typedef std::wistream::off_type off_type;
bool test __attribute__((unused)) = true;
std::wistream::pos_type pos01, pos02, pos03, pos04, pos05, pos06;
std::ios_base::iostate state01, state02;
const char str_lit01[] = "wistream_seeks-1.txt";
const char str_lit02[] = "wistream_seeks-2.txt";
std::wifstream if01(str_lit01, std::ios_base::in | std::ios_base::out);
std::wifstream if02(str_lit01, std::ios_base::in);
std::wifstream if03(str_lit02, std::ios_base::out | std::ios_base::trunc);
VERIFY( if01.good() );
VERIFY( if02.good() );
VERIFY( if03.good() );
std::wistream is01(if01.rdbuf());
std::wistream is02(if02.rdbuf());
std::wistream is03(if03.rdbuf());
// pos_type tellg()
// in | out
pos01 = is01.tellg();
pos02 = is01.tellg();
VERIFY( pos01 == pos02 );
pos03 = is02.tellg();
pos04 = is02.tellg();
VERIFY( pos03 == pos04 );
// out
pos05 = is03.tellg();
pos06 = is03.tellg();
VERIFY( pos05 == pos06 );
// cur
// NB: see library issues list 136. It's the v-3 interp that seekg
// only sets the input buffer, or else istreams with buffers that
// have _M_mode == ios_base::out will fail to have consistency
// between seekg and tellg.
state01 = is01.rdstate();
is01.seekg(10, std::ios_base::cur);
state02 = is01.rdstate();
pos01 = is01.tellg();
VERIFY( pos01 == pos02 + off_type(10) );
VERIFY( state01 == state02 );
pos02 = is01.tellg();
VERIFY( pos02 == pos01 );
}
int main()
{
test04();
return 0;
}
|
package ONVIF::PTZ::Types::IPv6Configuration;
use strict;
use warnings;
__PACKAGE__-><API key>(1);
sub get_xmlns { 'http:
our $XML_ATTRIBUTE_CLASS;
undef $XML_ATTRIBUTE_CLASS;
sub __get_attr_class {
return $XML_ATTRIBUTE_CLASS;
}
use Class::Std::Fast::Storable constructor => 'none';
use base qw(SOAP::WSDL::XSD::Typelib::ComplexType);
Class::Std::initialize();
{ # BLOCK to scope variables
my %<API key> :ATTR(:get<AcceptRouterAdvert>);
my %DHCP_of :ATTR(:get<DHCP>);
my %Manual_of :ATTR(:get<Manual>);
my %LinkLocal_of :ATTR(:get<LinkLocal>);
my %FromDHCP_of :ATTR(:get<FromDHCP>);
my %FromRA_of :ATTR(:get<FromRA>);
my %Extension_of :ATTR(:get<Extension>);
__PACKAGE__->_factory(
[ qw( AcceptRouterAdvert
DHCP
Manual
LinkLocal
FromDHCP
FromRA
Extension
) ],
{
'AcceptRouterAdvert' => \%<API key>,
'DHCP' => \%DHCP_of,
'Manual' => \%Manual_of,
'LinkLocal' => \%LinkLocal_of,
'FromDHCP' => \%FromDHCP_of,
'FromRA' => \%FromRA_of,
'Extension' => \%Extension_of,
},
{
'AcceptRouterAdvert' => 'SOAP::WSDL::XSD::Typelib::Builtin::boolean',
'DHCP' => 'ONVIF::PTZ::Types::<API key>',
'Manual' => 'ONVIF::PTZ::Types::PrefixedIPv6Address',
'LinkLocal' => 'ONVIF::PTZ::Types::PrefixedIPv6Address',
'FromDHCP' => 'ONVIF::PTZ::Types::PrefixedIPv6Address',
'FromRA' => 'ONVIF::PTZ::Types::PrefixedIPv6Address',
'Extension' => 'ONVIF::PTZ::Types::<API key>',
},
{
'AcceptRouterAdvert' => 'AcceptRouterAdvert',
'DHCP' => 'DHCP',
'Manual' => 'Manual',
'LinkLocal' => 'LinkLocal',
'FromDHCP' => 'FromDHCP',
'FromRA' => 'FromRA',
'Extension' => 'Extension',
}
);
} # end BLOCK
1;
=pod
=head1 NAME
ONVIF::PTZ::Types::IPv6Configuration
=head1 DESCRIPTION
Perl data type class for the XML Schema defined complexType
IPv6Configuration from the namespace http:
=head2 PROPERTIES
The following properties may be accessed using get_PROPERTY / set_PROPERTY
methods:
=over
=item * AcceptRouterAdvert
=item * DHCP
=item * Manual
=item * LinkLocal
=item * FromDHCP
=item * FromRA
=item * Extension
=back
=head1 METHODS
=head2 new
Constructor. The following data structure may be passed to new():
{ # ONVIF::PTZ::Types::IPv6Configuration
AcceptRouterAdvert => $some_value, # boolean
DHCP => $some_value, # <API key>
Manual => { # ONVIF::PTZ::Types::PrefixedIPv6Address
Address => $some_value, # IPv6Address
PrefixLength => $some_value, # int
},
LinkLocal => { # ONVIF::PTZ::Types::PrefixedIPv6Address
Address => $some_value, # IPv6Address
PrefixLength => $some_value, # int
},
FromDHCP => { # ONVIF::PTZ::Types::PrefixedIPv6Address
Address => $some_value, # IPv6Address
PrefixLength => $some_value, # int
},
FromRA => { # ONVIF::PTZ::Types::PrefixedIPv6Address
Address => $some_value, # IPv6Address
PrefixLength => $some_value, # int
},
Extension => { # ONVIF::PTZ::Types::<API key>
},
},
=head1 AUTHOR
Generated by SOAP::WSDL
=cut
|
// { dg-do compile }
// { dg-options "-std=gnu++0x" }
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// with this library; see the file COPYING3. If not see
#include <list>
// libstdc++/43813
void test01()
{
std::list<double*> l(7, 0);
l.assign(7, 0);
l.insert(l.begin(), 7, 0);
}
|
(function (_, $, Backbone, Drupal) {
Drupal.quickedit.EntityModel = Drupal.quickedit.BaseModel.extend({
defaults: {
el: null,
entityID: null,
entityInstanceID: null,
id: null,
label: null,
fields: null,
isActive: false,
inTempStore: false,
isDirty: false,
isCommitting: false,
state: 'closed',
fieldsInTempStore: [],
reload: false
},
initialize: function initialize() {
this.set('fields', new Drupal.quickedit.FieldCollection());
this.listenTo(this, 'change:state', this.stateChange);
this.listenTo(this.get('fields'), 'change:state', this.fieldStateChange);
Drupal.quickedit.BaseModel.prototype.initialize.call(this);
},
stateChange: function stateChange(entityModel, state, options) {
var to = state;
switch (to) {
case 'closed':
this.set({
isActive: false,
inTempStore: false,
isDirty: false
});
break;
case 'launching':
break;
case 'opening':
entityModel.get('fields').each(function (fieldModel) {
fieldModel.set('state', 'candidate', options);
});
break;
case 'opened':
this.set('isActive', true);
break;
case 'committing':
{
var fields = this.get('fields');
fields.chain().filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['active']).length;
}).each(function (fieldModel) {
fieldModel.set('state', 'candidate');
});
fields.chain().filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], Drupal.quickedit.app.changedFieldStates).length;
}).each(function (fieldModel) {
fieldModel.set('state', 'saving');
});
break;
}
case 'deactivating':
{
var changedFields = this.get('fields').filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['changed', 'invalid']).length;
});
if ((changedFields.length || this.get('fieldsInTempStore').length) && !options.saved && !options.confirmed) {
this.set('state', 'opened', { confirming: true });
_.defer(function () {
Drupal.quickedit.app.<API key>(entityModel);
});
} else {
var invalidFields = this.get('fields').filter(function (fieldModel) {
return _.intersection([fieldModel.get('state')], ['invalid']).length;
});
entityModel.set('reload', this.get('fieldsInTempStore').length || invalidFields.length);
entityModel.get('fields').each(function (fieldModel) {
if (_.intersection([fieldModel.get('state')], ['candidate', 'highlighted']).length) {
fieldModel.trigger('change:state', fieldModel, fieldModel.get('state'), options);
} else {
fieldModel.set('state', 'candidate', options);
}
});
}
break;
}
case 'closing':
options.reason = 'stop';
this.get('fields').each(function (fieldModel) {
fieldModel.set({
inTempStore: false,
state: 'inactive'
}, options);
});
break;
}
},
<API key>: function <API key>(entityModel, fieldModel) {
var current = fieldModel.get('state');
var previous = fieldModel.previous('state');
var fieldsInTempStore = entityModel.get('fieldsInTempStore');
if (current === 'saved') {
entityModel.set('inTempStore', true);
fieldModel.set('inTempStore', true);
fieldsInTempStore.push(fieldModel.get('fieldID'));
fieldsInTempStore = _.uniq(fieldsInTempStore);
entityModel.set('fieldsInTempStore', fieldsInTempStore);
} else if (current === 'candidate' && previous === 'inactive') {
fieldModel.set('inTempStore', _.intersection([fieldModel.get('fieldID')], fieldsInTempStore).length > 0);
}
},
fieldStateChange: function fieldStateChange(fieldModel, state) {
var entityModel = this;
var fieldState = state;
switch (this.get('state')) {
case 'closed':
case 'launching':
break;
case 'opening':
_.defer(function () {
entityModel.set('state', 'opened', {
'accept-field-states': Drupal.quickedit.app.readyFieldStates
});
});
break;
case 'opened':
if (fieldState === 'changed') {
entityModel.set('isDirty', true);
} else {
this.<API key>(entityModel, fieldModel);
}
break;
case 'committing':
{
if (fieldState === 'invalid') {
_.defer(function () {
entityModel.set('state', 'opened', { reason: 'invalid' });
});
} else {
this.<API key>(entityModel, fieldModel);
}
var options = {
'accept-field-states': Drupal.quickedit.app.readyFieldStates
};
if (entityModel.set('isCommitting', true, options)) {
entityModel.save({
success: function success() {
entityModel.set({
state: 'deactivating',
isCommitting: false
}, { saved: true });
},
error: function error() {
entityModel.set('isCommitting', false);
entityModel.set('state', 'opened', { reason: 'networkerror' });
var message = Drupal.t('Your changes to <q>@entity-title</q> could not be saved, either due to a website problem or a network connection problem.<br>Please try again.', { '@entity-title': entityModel.get('label') });
Drupal.quickedit.util.networkErrorModal(Drupal.t('Network problem!'), message);
}
});
}
break;
}
case 'deactivating':
_.defer(function () {
entityModel.set('state', 'closing', {
'accept-field-states': Drupal.quickedit.app.readyFieldStates
});
});
break;
case 'closing':
_.defer(function () {
entityModel.set('state', 'closed', {
'accept-field-states': ['inactive']
});
});
break;
}
},
save: function save(options) {
var entityModel = this;
var entitySaverAjax = Drupal.ajax({
url: Drupal.url('quickedit/entity/' + entityModel.get('entityID')),
error: function error() {
options.error.call(entityModel);
}
});
entitySaverAjax.commands.<API key> = function (ajax, response, status) {
entityModel.get('fields').each(function (fieldModel) {
fieldModel.set('inTempStore', false);
});
entityModel.set('inTempStore', false);
entityModel.set('fieldsInTempStore', []);
if (options.success) {
options.success.call(entityModel);
}
};
entitySaverAjax.execute();
},
validate: function validate(attrs, options) {
var acceptedFieldStates = options['accept-field-states'] || [];
var currentState = this.get('state');
var nextState = attrs.state;
if (currentState !== nextState) {
if (_.indexOf(this.constructor.states, nextState) === -1) {
return '"' + nextState + '" is an invalid state';
}
if (!this._acceptStateChange(currentState, nextState, options)) {
return 'state change not accepted';
} else if (!this.<API key>(acceptedFieldStates)) {
return 'state change not accepted because fields are not in acceptable state';
}
}
var currentIsCommitting = this.get('isCommitting');
var nextIsCommitting = attrs.isCommitting;
if (currentIsCommitting === false && nextIsCommitting === true) {
if (!this.<API key>(acceptedFieldStates)) {
return 'isCommitting change not accepted because fields are not in acceptable state';
}
} else if (currentIsCommitting === true && nextIsCommitting === true) {
return 'isCommitting is a mutex, hence only changes are allowed';
}
},
_acceptStateChange: function _acceptStateChange(from, to, context) {
var accept = true;
if (!this.constructor.<API key>(from, to)) {
accept = false;
if (from === 'closing' && to === 'closed') {
accept = true;
} else if (from === 'committing' && to === 'opened' && context.reason && (context.reason === 'invalid' || context.reason === 'networkerror')) {
accept = true;
} else if (from === 'deactivating' && to === 'opened' && context.confirming) {
accept = true;
} else if (from === 'opened' && to === 'deactivating' && context.confirmed) {
accept = true;
}
}
return accept;
},
<API key>: function <API key>(acceptedFieldStates) {
var accept = true;
if (acceptedFieldStates.length > 0) {
var fieldStates = this.get('fields').pluck('state') || [];
if (_.difference(fieldStates, acceptedFieldStates).length) {
accept = false;
}
}
return accept;
},
destroy: function destroy(options) {
Drupal.quickedit.BaseModel.prototype.destroy.call(this, options);
this.stopListening();
this.get('fields').reset();
},
sync: function sync() {}
}, {
states: ['closed', 'launching', 'opening', 'opened', 'committing', 'deactivating', 'closing'],
<API key>: function <API key>(from, to) {
return _.indexOf(this.states, from) < _.indexOf(this.states, to);
}
});
Drupal.quickedit.EntityCollection = Backbone.Collection.extend({
model: Drupal.quickedit.EntityModel
});
})(_, jQuery, Backbone, Drupal);
|
#include QMK_KEYBOARD_H
#include "debug.h"
#include "action_layer.h"
#define BASE 0 // default layer
#define FN1 1 // media layer
#define CAPS_CTL CTL_T(KC_CAPS) // Caps on tap, Ctrl on hold.
#define COPY LCTL(KC_V) // C-c Copy
#define PASTE LCTL(KC_V) // C-v Paste
#define ZM_NRM LCTL(KC_0) // C-0 Zoom Normal
#define ZM_OUT LCTL(KC_MINS) // C-- Zoom Out
#define ZM_IN LCTL(KC_PLUS) // C-+ Zoom In
#define EM_UNDO LCTL(KC_UNDS) // C-_ Emacs Undo
#define _MOB 1 // Mobile
#define _CUS1 2 // Custom macro 1
#define _CUS2 3 // Custom macro 2
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
// Otherwise, it needs KC_*
[BASE] = LAYOUT_ergodox( // layer 0 : default
// Left hand
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_WBAK,
CAPS_CTL, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_PGDN,
KC_LCTL, KC_ESC, KC_LGUI, KC_LALT, KC_LALT,
COPY, KC_LCBR,
KC_LPRN,
KC_SPC, KC_DEL, KC_LBRC,
// Right hand
KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_WFWD, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT,
KC_PGUP, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT,
KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, TG(FN1),
KC_RCBR, PASTE,
KC_RPRN,
KC_RBRC, KC_ENT, KC_BSPC),
// FN1 Layer
[FN1] = LAYOUT_ergodox(
// Left hand
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN3, KC_BTN2, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, ZM_NRM, ZM_OUT, ZM_IN,
KC_TRNS, KC_TRNS,
KC_TRNS,
RESET, KC_TRNS, KC_TRNS,
// Right hand
KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_BSPC,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY,
KC_TRNS, M(_MOB), KC_TRNS, M(_CUS1),M(_CUS2),KC_TRNS, KC_TRNS,
EM_UNDO, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
};
const uint16_t PROGMEM fn_actions[] = {
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case _MOB: // Your mobile# here.
return MACRODOWN(T(1), T(2), T(3), T(MINS),
T(1), T(2), T(3), T(MINS),
T(1), T(2), T(3), T(4),
END);
case _CUS1: // Your custom macro 1
return MACRODOWN(T(E), T(M), T(A), T(C), T(S), T(SPC), END);
case _CUS2: // Your custom macro 2
return MACRODOWN(T(L), T(S), T(SPC), T(MINS), T(L), T(ENT), END);
};
return MACRO_NONE;
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
<API key>();
<API key>();
<API key>();
<API key>();
switch (layer) {
// TODO: Make this relevant to the ErgoDox EZ.
case 1:
<API key>();
break;
case 2:
<API key>();
break;
default:
// none
break;
}
};
|
! { dg-do compile }
! Test the patch for PR36374 in which the different
! symbols for 'foobar' would be incorrectly flagged as
! ambiguous in foo_mod.
!
! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>
!
module s_foo_mod
type s_foo_type
real(kind(1.e0)) :: v
end type s_foo_type
interface foobar
subroutine s_foobar(x)
import
type(s_foo_type), intent (inout) :: x
end subroutine s_foobar
end interface
end module s_foo_mod
module d_foo_mod
type d_foo_type
real(kind(1.d0)) :: v
end type d_foo_type
interface foobar
subroutine d_foobar(x)
import
type(d_foo_type), intent (inout) :: x
end subroutine d_foobar
end interface
end module d_foo_mod
module foo_mod
use s_foo_mod
use d_foo_mod
end module foo_mod
subroutine s_foobar(x)
use foo_mod
end subroutine s_foobar
! { dg-final { cleanup-modules "s_foo_mod d_foo_mod foo_mod" } }
|
/** @file base_media_base.h Generic functions for replacing base data (graphics, sounds). */
#ifndef BASE_MEDIA_BASE_H
#define BASE_MEDIA_BASE_H
#include "fileio_func.h"
#include "core/smallmap_type.hpp"
#include "gfx_type.h"
#include "textfile_type.h"
#include "textfile_gui.h"
/* Forward declare these; can't do 'struct X' in functions as older GCCs barf on that */
struct IniFile;
struct ContentInfo;
/** Structure holding filename and MD5 information about a single file */
struct MD5File {
/** The result of a checksum check */
enum ChecksumResult {
CR_MATCH, ///< The file did exist and the md5 checksum did match
CR_MISMATCH, ///< The file did exist, just the md5 checksum did not match
CR_NO_FILE, ///< The file did not exist
};
const char *filename; ///< filename
uint8 hash[16]; ///< md5 sum of the file
const char *missing_warning; ///< warning when this file is missing
ChecksumResult CheckMD5(Subdirectory subdir, size_t max_size) const;
};
/**
* Information about a single base set.
* @tparam T the real class we're going to be
* @tparam Tnum_files the number of files in the set
* @tparam Tsearch_in_tars whether to search in the tars or not
*/
template <class T, size_t Tnum_files, bool Tsearch_in_tars>
struct BaseSet {
typedef SmallMap<const char *, const char *> TranslatedStrings;
/** Number of files in this set */
static const size_t NUM_FILES = Tnum_files;
/** Whether to search in the tars or not. */
static const bool SEARCH_IN_TARS = Tsearch_in_tars;
/** Internal names of the files in this set. */
static const char * const *file_names;
const char *name; ///< The name of the base set
TranslatedStrings description; ///< Description of the base set
uint32 shortname; ///< Four letter short variant of the name
uint32 version; ///< The version of this base set
bool fallback; ///< This set is a fallback set, i.e. it should be used only as last resort
MD5File files[NUM_FILES]; ///< All files part of this set
uint found_files; ///< Number of the files that could be found
uint valid_files; ///< Number of the files that could be found and are valid
T *next; ///< The next base set in this list
/** Free everything we allocated */
~BaseSet()
{
free(this->name);
for (TranslatedStrings::iterator iter = this->description.Begin(); iter != this->description.End(); iter++) {
free(iter->first);
free(iter->second);
}
for (uint i = 0; i < NUM_FILES; i++) {
free(this->files[i].filename);
free(this->files[i].missing_warning);
}
delete this->next;
}
/**
* Get the number of missing files.
* @return the number
*/
int GetNumMissing() const
{
return Tnum_files - this->found_files;
}
/**
* Get the number of invalid files.
* @note a missing file is invalid too!
* @return the number
*/
int GetNumInvalid() const
{
return Tnum_files - this->valid_files;
}
bool FillSetDetails(IniFile *ini, const char *path, const char *full_filename, bool <API key> = true);
/**
* Get the description for the given ISO code.
* It falls back to the first two characters of the ISO code in case
* no match could be made with the full ISO code. If even then the
* matching fails the default is returned.
* @param isocode the isocode to search for
* @return the description
*/
const char *GetDescription(const char *isocode = NULL) const
{
if (isocode != NULL) {
/* First the full ISO code */
for (TranslatedStrings::const_iterator iter = this->description.Begin(); iter != this->description.End(); iter++) {
if (strcmp(iter->first, isocode) == 0) return iter->second;
}
/* Then the first two characters */
for (TranslatedStrings::const_iterator iter = this->description.Begin(); iter != this->description.End(); iter++) {
if (strncmp(iter->first, isocode, 2) == 0) return iter->second;
}
}
/* Then fall back */
return this->description.Begin()->second;
}
/**
* Calculate and check the MD5 hash of the supplied file.
* @param file The file get the hash of.
* @param subdir The sub directory to get the files from.
* @return
* - #CR_MATCH if the MD5 hash matches
* - #CR_MISMATCH if the MD5 does not match
* - #CR_NO_FILE if the file misses
*/
static MD5File::ChecksumResult CheckMD5(const MD5File *file, Subdirectory subdir)
{
return file->CheckMD5(subdir, SIZE_MAX);
}
/**
* Search a textfile file next to this base media.
* @param type The type of the textfile to search for.
* @return The filename for the textfile, \c NULL otherwise.
*/
const char *GetTextfile(TextfileType type) const
{
for (uint i = 0; i < NUM_FILES; i++) {
const char *textfile = ::GetTextfile(type, BASESET_DIR, this->files[i].filename);
if (textfile != NULL) {
return textfile;
}
}
return NULL;
}
};
/**
* Base for all base media (graphics, sounds)
* @tparam Tbase_set the real set we're going to be
*/
template <class Tbase_set>
class BaseMedia : FileScanner {
protected:
static Tbase_set *available_sets; ///< All available sets
static Tbase_set *duplicate_sets; ///< All sets that aren't available, but needed for not downloading base sets when a newer version than the one on BaNaNaS is loaded.
static const Tbase_set *used_set; ///< The currently used set
/* virtual */ bool AddFile(const char *filename, size_t basepath_length, const char *tar_filename);
/**
* Get the extension that is used to identify this set.
* @return the extension
*/
static const char *GetExtension();
public:
/** The set as saved in the config file. */
static const char *ini_set;
/**
* Determine the graphics pack that has to be used.
* The one with the most correct files wins.
* @return true if a best set has been found.
*/
static bool DetermineBestSet();
/** Do the scan for files. */
static uint FindSets()
{
BaseMedia<Tbase_set> fs;
/* Searching in tars is only done in the old "data" directories basesets. */
uint num = fs.Scan(GetExtension(), Tbase_set::SEARCH_IN_TARS ? OLD_DATA_DIR : OLD_GM_DIR, Tbase_set::SEARCH_IN_TARS);
return num + fs.Scan(GetExtension(), BASESET_DIR, Tbase_set::SEARCH_IN_TARS);
}
static Tbase_set *GetAvailableSets();
static bool SetSet(const char *name);
static char *GetSetsList(char *p, const char *last);
static int GetNumSets();
static int GetIndexOfUsedSet();
static const Tbase_set *GetSet(int index);
static const Tbase_set *GetUsedSet();
/**
* Check whether we have an set with the exact characteristics as ci.
* @param ci the characteristics to search on (shortname and md5sum)
* @param md5sum whether to check the MD5 checksum
* @return true iff we have an set matching.
*/
static bool HasSet(const ContentInfo *ci, bool md5sum);
};
/**
* Check whether there's a base set matching some information.
* @param ci The content info to compare it to.
* @param md5sum Should the MD5 checksum be tested as well?
* @param s The list with sets.
* @return The filename of the first file of the base set, or \c NULL if there is no match.
*/
template <class Tbase_set>
const char *TryGetBaseSetFile(const ContentInfo *ci, bool md5sum, const Tbase_set *s);
/** Types of graphics in the base graphics set */
enum GraphicsFileType {
GFT_BASE, ///< Base sprites for all climates
GFT_LOGOS, ///< Logos, landscape icons and original terrain generator sprites
GFT_ARCTIC, ///< Landscape replacement sprites for arctic
GFT_TROPICAL, ///< Landscape replacement sprites for tropical
GFT_TOYLAND, ///< Landscape replacement sprites for toyland
GFT_EXTRA, ///< Extra sprites that were not part of the original sprites
MAX_GFT, ///< We are looking for this amount of GRFs
};
/** Blitter type for base graphics sets. */
enum BlitterType {
BLT_8BPP, ///< Base set has 8 bpp sprites only.
BLT_32BPP, ///< Base set has both 8 bpp and 32 bpp sprites.
};
/** All data of a graphics set. */
struct GraphicsSet : BaseSet<GraphicsSet, MAX_GFT, true> {
PaletteType palette; ///< Palette of this graphics set
BlitterType blitter; ///< Blitter of this graphics set
bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename);
static MD5File::ChecksumResult CheckMD5(const MD5File *file, Subdirectory subdir);
};
/** All data/functions related with replacing the base graphics. */
class BaseGraphics : public BaseMedia<GraphicsSet> {
public:
};
/** All data of a sounds set. */
struct SoundsSet : BaseSet<SoundsSet, 1, true> {
};
/** All data/functions related with replacing the base sounds */
class BaseSounds : public BaseMedia<SoundsSet> {
public:
};
/** Maximum number of songs in the 'class' playlists. */
static const uint NUM_SONGS_CLASS = 10;
/** Number of classes for songs */
static const uint NUM_SONG_CLASSES = 3;
/** Maximum number of songs in the full playlist; theme song + the classes */
static const uint NUM_SONGS_AVAILABLE = 1 + NUM_SONG_CLASSES * NUM_SONGS_CLASS;
/** Maximum number of songs in the (custom) playlist */
static const uint NUM_SONGS_PLAYLIST = 32;
/** All data of a music set. */
struct MusicSet : BaseSet<MusicSet, NUM_SONGS_AVAILABLE, false> {
/** The name of the different songs. */
char song_name[NUM_SONGS_AVAILABLE][32];
byte track_nr[NUM_SONGS_AVAILABLE];
byte num_available;
bool FillSetDetails(struct IniFile *ini, const char *path, const char *full_filename);
};
/** All data/functions related with replacing the base music */
class BaseMusic : public BaseMedia<MusicSet> {
public:
};
#endif /* BASE_MEDIA_BASE_H */
|
#ifndef _IFADDRS_H
#include <inet/ifaddrs.h>
#include <stdbool.h>
#include <stdint.h>
libc_hidden_proto (getifaddrs)
libc_hidden_proto (freeifaddrs)
struct in6addrinfo
{
enum {
in6ai_deprecated = 1,
in6ai_homeaddress = 2
} flags:8;
uint8_t prefixlen;
uint16_t :16;
uint32_t index;
uint32_t addr[4];
};
extern void __check_pf (bool *seen_ipv4, bool *seen_ipv6,
struct in6addrinfo **in6ai, size_t *in6ailen)
attribute_hidden;
extern void __free_in6ai (struct in6addrinfo *in6ai) attribute_hidden;
extern void __check_native (uint32_t a1_index, int *a1_native,
uint32_t a2_index, int *a2_native)
attribute_hidden;
#if IS_IN (nscd)
extern uint32_t __bump_nl_timestamp (void) attribute_hidden;
#endif
#endif /* ifaddrs.h */
|
#include "chrome/browser/extensions/api/file_system/<API key>.h"
#include "chrome/browser/extensions/api/file_system/<API key>.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/<API key>.h"
#include "content/public/browser/browser_context.h"
namespace extensions {
<API key>* <API key>::GetInstance() {
return Singleton<<API key>>::get();
}
<API key>::<API key>()
: <API key>(
"EntryWatcherService",
<API key>::GetInstance()) {
}
<API key>::~<API key>() {
}
KeyedService* <API key>::<API key>(
content::BrowserContext* context) const {
return new EntryWatcherService(Profile::FromBrowserContext(context));
}
bool <API key>::<API key>() const {
// Required to restore persistent watchers as soon as the profile is loaded.
return true;
}
} // namespace extensions
|
<?php
use LibreNMS\Exceptions\InvalidIpException;
use LibreNMS\Util\IP;
echo '<div class="container-fluid">';
echo "<div class='row'>
<div class='col-md-12'>
<div class='panel panel-default panel-condensed'>
<div class='panel-heading'>";
if ($config['<API key>']) {
echo '<i class="fa fa-id-card fa-lg icon-theme" aria-hidden="true"></i> <strong>'.$device['sysDescr'].'</strong>';
}
echo '</div>
<table class="table table-hover table-condensed table-striped">';
$uptime = formatUptime($device['uptime']);
$uptime_text = 'Uptime';
if ($device['status'] == 0) {
// Rewrite $uptime to be downtime if device is down
$uptime = formatUptime(time() - strtotime($device['last_polled']));
$uptime_text = 'Downtime';
}
if ($device['os'] == 'ios') {
formatCiscoHardware($device);
}
if ($device['features']) {
$device['features'] = '('.$device['features'].')';
}
$device['os_text'] = $config['os'][$device['os']]['text'];
echo '<tr>
<td>System Name</td>
<td>'.$device['sysName'].' </td>
</tr>';
if (!empty($device['ip'])) {
echo "<tr><td>Resolved IP</td><td>{$device['ip']}</td></tr>";
} elseif ($config['force_ip_to_sysname'] === true) {
try {
$ip = IP::parse($device['hostname']);
echo "<tr><td>IP Address</td><td>$ip</td></tr>";
} catch (InvalidIpException $e) {
// don't add an ip line
}
}
if ($device['purpose']) {
echo '<tr>
<td>Description</td>
<td>'.display($device['purpose']).'</td>
</tr>';
}
if ($device['hardware']) {
echo '<tr>
<td>Hardware</td>
<td>'.$device['hardware'].'</td>
</tr>';
}
echo '<tr>
<td>Operating System</td>
<td>'.$device['os_text'].' '.$device['version'].' '.$device['features'].' </td>
</tr>';
if ($device['serial']) {
echo '<tr>
<td>Serial</td>
<td>'.$device['serial'].'</td>
</tr>';
}
if ($device['sysObjectID']) {
echo '<tr>
<td>Object ID</td>
<td>'.$device['sysObjectID'].'</td>
</tr>';
}
if ($device['sysContact']) {
echo '<tr>
<td>Contact</td>';
if (get_dev_attrib($device, '<API key>')) {
echo '
<td>'.htmlspecialchars(get_dev_attrib($device, '<API key>')).'</td>
</tr>
<tr>
<td>SNMP Contact</td>';
}
echo '
<td>'.htmlspecialchars($device['sysContact']).'</td>
</tr>';
}
if ($device['location']) {
echo '<tr>
<td>Location</td>
<td>'.$device['location'].'</td>
</tr>';
if (get_dev_attrib($device, '<API key>') && !empty($device['real_location'])) {
echo '<tr>
<td>SNMP Location</td>
<td>'.$device['real_location'].'</td>
</tr>';
}
}
$loc = parse_location($device['location']);
if (!is_array($loc)) {
$loc = dbFetchRow("SELECT `lat`,`lng` FROM `locations` WHERE `location`=? LIMIT 1", array($device['location']));
}
if (is_array($loc)) {
echo '<tr>
<td>Lat / Lng</td>
<td>['.$loc['lat'].','.$loc['lng'].'] <div class="pull-right"><a href="https://maps.google.com/?q='.$loc['lat'].'+'.$loc['lng'].'" target="_blank" class="btn btn-success btn-xs" role="button"><i class="fa fa-map-marker" style="color:white" aria-hidden="true"></i> Map</button></div></a></td>
</tr>';
}
if ($uptime) {
echo "<tr>
<td>$uptime_text</td>
<td>".$uptime."</td>
</tr>";
}
echo '</table>
</div>
</div>
</div>
</div>';
|
/**
* @ingroup tests
* @{
*
* @file
* @brief Application for testing low-level SPI driver implementations
*
* This implementation covers both, master and slave configurations.
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*
* @}
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "xtimer.h"
#include "shell.h"
#include "periph/spi.h"
/**
* @brief Some parameters used for benchmarking
*/
#define BENCH_REDOS (1000)
#define BENCH_SMALL (2)
#define BENCH_LARGE (100)
#define BENCH_PAYLOAD ('b')
#define BENCH_REGADDR (0x23)
#define BUF_SIZE (512U)
/**
* @brief Benchmark buffers
*/
static uint8_t bench_wbuf[BENCH_LARGE];
static uint8_t bench_rbuf[BENCH_LARGE];
/**
* @brief Generic buffer used for receiving
*/
static uint8_t buf[BUF_SIZE];
static struct {
spi_t dev;
spi_mode_t mode;
spi_clk_t clk;
spi_cs_t cs;
} spiconf;
void print_bytes(char* title, uint8_t* data, size_t len)
{
printf("%4s\n", title);
for (size_t i = 0; i < len; i++) {
printf(" %2i ", (int)i);
}
printf("\n ");
for (size_t i = 0; i < len; i++) {
printf(" 0x%02x", (int)data[i]);
}
printf("\n ");
for (size_t i = 0; i < len; i++) {
if (data[i] < ' ' || data[i] > '~') {
printf(" ?? ");
}
else {
printf(" %c ", (char)data[i]);
}
}
printf("\n\n");
}
int cmd_init(int argc, char **argv)
{
int dev, mode, clk, port, pin, tmp;
if (argc < 5) {
printf("usage: %s <dev> <mode> <clk> <cs port> <cs pin>\n", argv[0]);
puts("\tdev:");
for (int i = 0; i < (int)SPI_NUMOF; i++) {
printf("\t\t%i: SPI_DEV(%i)\n", i, i);
}
puts("\tmode:");
puts("\t\t0: POL:0, PHASE:0 - on first rising edge");
puts("\t\t1: POL:0, PHASE:1 - on second rising edge");
puts("\t\t2: POL:1, PHASE:0 - on first falling edge");
puts("\t\t3: POL:1, PHASE:1 - on second falling edge");
puts("\tclk:");
puts("\t\t0: 100 KHz");
puts("\t\t1: 400 KHz");
puts("\t\t2: 1 MHz");
puts("\t\t3: 5 MHz");
puts("\t\t4: 10 MHz");
puts("\tcs port:");
puts("\t\tPort of the CS pin, set to -1 for hardware chip select");
puts("\tcs pin:");
puts("\t\tPin used for chip select. If hardware chip select is enabled,\n"
"\t\tthis value specifies the internal HWCS line");
return 1;
}
/* parse the given SPI device */
dev = atoi(argv[1]);
if (dev < 0 || dev >= (int)SPI_NUMOF) {
puts("error: invalid SPI device specified");
return 1;
}
spiconf.dev = SPI_DEV(dev);
/* parse the SPI mode */
mode = atoi(argv[2]);
switch (mode) {
case 0: spiconf.mode = SPI_MODE_0; break;
case 1: spiconf.mode = SPI_MODE_1; break;
case 2: spiconf.mode = SPI_MODE_2; break;
case 3: spiconf.mode = SPI_MODE_3; break;
default:
puts("error: invalid SPI mode specified");
return 1;
}
/* parse the targeted clock speed */
clk = atoi(argv[3]);
switch (clk) {
case 0: spiconf.clk = SPI_CLK_100KHZ; break;
case 1: spiconf.clk = SPI_CLK_400KHZ; break;
case 2: spiconf.clk = SPI_CLK_1MHZ; break;
case 3: spiconf.clk = SPI_CLK_5MHZ; break;
case 4: spiconf.clk = SPI_CLK_10MHZ; break;
default:
puts("error: invalid bus speed specified");
return 1;
}
/* parse chip select port and pin */
port = atoi(argv[4]);
pin = atoi(argv[5]);
if (pin < 0 || port < -1) {
puts("error: invalid CS port/pin combination specified");
}
if (port == -1) { /* hardware chip select line */
spiconf.cs = SPI_HWCS(pin);
}
else {
spiconf.cs = (spi_cs_t)GPIO_PIN(port, pin);
}
/* test setup */
tmp = spi_init_cs(spiconf.dev, spiconf.cs);
if (tmp != SPI_OK) {
puts("error: unable to initialize the given chip select line");
return 1;
}
tmp = spi_acquire(spiconf.dev, spiconf.cs, spiconf.mode, spiconf.clk);
if (tmp == SPI_NOMODE) {
puts("error: given SPI mode is not supported");
return 1;
}
else if (tmp == SPI_NOCLK) {
puts("error: targeted clock speed is not supported");
return 1;
}
else if (tmp != SPI_OK) {
puts("error: unable to acquire bus with given parameters");
return 1;
}
spi_release(spiconf.dev);
printf("SPI_DEV(%i) initialized: mode: %i, clk: %i, cs_port: %i, cs_pin: %i\n",
dev, mode, clk, port, pin);
return 0;
}
int cmd_transfer(int argc, char **argv)
{
size_t len;
if (argc < 2) {
printf("usage: %s <data>\n", argv[0]);
return 1;
}
if (spiconf.dev == SPI_UNDEF) {
puts("error: SPI is not initialized, please initialize bus first");
return 1;
}
/* get bus access */
if (spi_acquire(spiconf.dev, spiconf.cs,
spiconf.mode, spiconf.clk) != SPI_OK) {
puts("error: unable to acquire the SPI bus");
return 1;
}
/* transfer data */
len = strlen(argv[1]);
memset(buf, 0, sizeof(buf));
spi_transfer_bytes(spiconf.dev, spiconf.cs, false, argv[1], buf, len);
/* release the bus */
spi_release(spiconf.dev);
/* print results */
print_bytes("Sent bytes", (uint8_t *)argv[1], len);
print_bytes("Received bytes", buf, len);
return 0;
}
int cmd_bench(int argc, char **argv)
{
(void)argc;
(void)argv;
uint32_t start, stop;
uint32_t sum = 0;
uint8_t in;
uint8_t out = (uint8_t)BENCH_PAYLOAD;
if (spiconf.dev == SPI_UNDEF) {
puts("error: SPI is not initialized, please initialize bus first");
return 1;
}
/* prepare buffer */
memset(bench_wbuf, BENCH_PAYLOAD, BENCH_LARGE);
/* get access to the bus */
if (spi_acquire(spiconf.dev, spiconf.cs,
spiconf.mode, spiconf.clk) != SPI_OK) {
puts("error: unable to acquire the SPI bus");
return 1;
}
puts("
/* 1 - write 1000 times 1 byte */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
in = spi_transfer_byte(spiconf.dev, spiconf.cs, false, out);
(void)in;
}
stop = xtimer_now_usec();
printf(" 1 - write %i times %i byte:", BENCH_REDOS, 1);
printf("\t\t\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 2 - write 1000 times 2 byte */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_bytes(spiconf.dev, spiconf.cs, false,
bench_wbuf, NULL, BENCH_SMALL);
}
stop = xtimer_now_usec();
printf(" 2 - write %i times %i byte:", BENCH_REDOS, BENCH_SMALL);
printf("\t\t\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 3 - write 1000 times 100 byte */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_bytes(spiconf.dev, spiconf.cs, false,
bench_wbuf, NULL, BENCH_LARGE);
}
stop = xtimer_now_usec();
printf(" 3 - write %i times %i byte:", BENCH_REDOS, BENCH_LARGE);
printf("\t\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 4 - write 1000 times 1 byte to register */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
in = spi_transfer_reg(spiconf.dev, spiconf.cs, BENCH_REGADDR, out);
(void)in;
}
stop = xtimer_now_usec();
printf(" 4 - write %i times %i byte to register:", BENCH_REDOS, 1);
printf("\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 5 - write 1000 times 2 byte to register */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_regs(spiconf.dev, spiconf.cs, BENCH_REGADDR,
bench_wbuf, NULL, BENCH_SMALL);
}
stop = xtimer_now_usec();
printf(" 5 - write %i times %i byte to register:", BENCH_REDOS, BENCH_SMALL);
printf("\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 6 - write 1000 times 100 byte to register */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_regs(spiconf.dev, spiconf.cs, BENCH_REGADDR,
bench_wbuf, NULL, BENCH_LARGE);
}
stop = xtimer_now_usec();
printf(" 6 - write %i times %i byte to register:", BENCH_REDOS, BENCH_LARGE);
printf("\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 7 - read 1000 times 2 byte */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_bytes(spiconf.dev, spiconf.cs, false,
NULL, bench_rbuf, BENCH_SMALL);
}
stop = xtimer_now_usec();
printf(" 7 - read %i times %i byte:", BENCH_REDOS, BENCH_SMALL);
printf("\t\t\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 8 - read 1000 times 100 byte */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_bytes(spiconf.dev, spiconf.cs, false,
NULL, bench_rbuf, BENCH_LARGE);
}
stop = xtimer_now_usec();
printf(" 8 - read %i times %i byte:", BENCH_REDOS, BENCH_LARGE);
printf("\t\t\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 9 - read 1000 times 2 byte from register */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_regs(spiconf.dev, spiconf.cs, BENCH_REGADDR,
NULL, bench_rbuf, BENCH_SMALL);
}
stop = xtimer_now_usec();
printf(" 9 - read %i times %i byte from register:", BENCH_REDOS, BENCH_SMALL);
printf("\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 10 - read 1000 times 100 byte from register */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_regs(spiconf.dev, spiconf.cs, BENCH_REGADDR,
NULL, bench_rbuf, BENCH_LARGE);
}
stop = xtimer_now_usec();
printf("10 - read %i times %i byte from register:", BENCH_REDOS, BENCH_LARGE);
printf("\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 11 - transfer 1000 times 2 byte */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_bytes(spiconf.dev, spiconf.cs, false,
bench_wbuf, bench_rbuf, BENCH_SMALL);
}
stop = xtimer_now_usec();
printf("11 - transfer %i times %i byte:", BENCH_REDOS, BENCH_SMALL);
printf("\t\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 12 - transfer 1000 times 100 byte */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_bytes(spiconf.dev, spiconf.cs, false,
bench_wbuf, bench_rbuf, BENCH_LARGE);
}
stop = xtimer_now_usec();
printf("12 - transfer %i times %i byte:", BENCH_REDOS, BENCH_LARGE);
printf("\t\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 13 - transfer 1000 times 2 byte from/to register */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_regs(spiconf.dev, spiconf.cs, BENCH_REGADDR,
bench_wbuf, bench_rbuf, BENCH_SMALL);
}
stop = xtimer_now_usec();
printf("13 - transfer %i times %i byte to register:", BENCH_REDOS, BENCH_SMALL);
printf("\t%i\n", (int)(stop - start));
sum += (stop - start);
/* 14 - transfer 1000 times 100 byte from/to register */
start = xtimer_now_usec();
for (int i = 0; i < BENCH_REDOS; i++) {
spi_transfer_regs(spiconf.dev, spiconf.cs, BENCH_REGADDR,
bench_wbuf, bench_rbuf, BENCH_LARGE);
}
stop = xtimer_now_usec();
printf("14 - transfer %i times %i byte to register:", BENCH_REDOS, BENCH_LARGE);
printf("\t%i\n", (int)(stop - start));
sum += (stop - start);
printf("-- - SUM:\t\t\t\t\t%i\n", (int)sum);
spi_release(spiconf.dev);
puts("\n
return 0;
}
static const shell_command_t shell_commands[] = {
{ "init", "Setup a particular SPI configuration", cmd_init },
{ "send", "Transfer string to slave", cmd_transfer },
{ "bench", "Runs some benchmarks", cmd_bench },
{ NULL, NULL, NULL }
};
int main(void)
{
puts("Manual SPI peripheral driver test");
puts("Refer to the README.md file for more information.\n");
printf("There are %i SPI devices configured for your platform.\n",
(int)SPI_NUMOF);
/* reset local SPI configuration */
spiconf.dev = SPI_UNDEF;
/* run the shell */
char line_buf[<API key>];
shell_run(shell_commands, line_buf, <API key>);
return 0;
}
|
#ifndef <API key>
#define <API key>
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
#include <gst/audio/audio.h>
#include <gst/audio/gstaudiofilter.h>
#include "<API key>.h"
G_BEGIN_DECLS
#define <API key> (<API key>())
#define <API key>(obj) (<API key>((obj),<API key>,GstAudioChebLimit))
#define <API key>(obj) (<API key>((obj),<API key>))
#define <API key>(klass) (<API key>((klass) ,<API key>,<API key>))
#define <API key>(klass) (<API key>((klass) ,<API key>))
#define <API key>(obj) (<API key>((obj) ,<API key>,<API key>))
typedef struct _GstAudioChebLimit GstAudioChebLimit;
typedef struct <API key> <API key>;
struct _GstAudioChebLimit
{
<API key> parent;
gint mode;
gint type;
gint poles;
gfloat cutoff;
gfloat ripple;
/* < private > */
GMutex *lock;
};
struct <API key>
{
<API key> parent;
};
GType <API key> (void);
G_END_DECLS
#endif /* <API key> */
|
/// <reference path='fourslash.ts' />
// @Filename: foo.ts
/ export function /*Destination*/bar() { return "bar"; }
/ import('./foo').then(({ [|bar|] }) => undefined);
verify.goToDefinition("1", "Destination");
|
// file at the top-level directory of this distribution and at
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test that Cell is considered invariant with respect to its
// type.
use std::cell::Cell;
struct Foo<'a> {
x: Cell<Option<&'a int>>,
}
fn use_<'short,'long>(c: Foo<'short>,
s: &'short int,
l: &'long int,
_where:Option<&'short &'long ()>) {
let _: Foo<'long> = c; //~ ERROR mismatched types
}
fn main() {
}
|
// file at the top-level directory of this distribution and at
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(intrinsics)]
use std::ptr;
struct Point {
x: f32,
y: f32,
z: f32,
}
extern "rust-intrinsic" {
fn return_address() -> *const u8;
}
fn f(result: &mut uint) -> Point {
unsafe {
*result = return_address() as uint;
Point {
x: 1.0,
y: 2.0,
z: 3.0,
}
}
}
fn main() {
let mut <API key> = 0;
let pt = f(&mut <API key>);
let actual_address = &pt as *const Point as uint;
assert_eq!(<API key>, actual_address);
}
|
var $ = require('common:widget/ui/jquery/jquery.js');
var UT = require('common:widget/ui/ut/ut.js');
var FBClient = {};
var TPL_CONF = require('home:widget/ui/facebook/fbclient-tpl.js');
/**
* Fackbook module init function
* @return {object} [description]
*/
var WIN = window,
DOC = document,
conf = WIN.conf.FBClient,
undef;
var UI_CONF = {
// ui el
uiMod: "#fbMod"
, uiBtnLogin: ".fb-mod_login_btn"
, uiBtnLogout: ".fb-mod_logout"
, uiBtnRefresh: ".fb-mod_refresh"
, uiSide: ".fb-mod_side"
, uiBtnClose: ".fb-mod_close"
, uiWrap: ".fb-mod_wrap"
, uiList: ".fb-mod_list"
, uiUsrinfo: ".fb-mod_usrinfo"
, uiAvatar: ".fb-mod_avatar"
, uiTextareaSubmit: ".fb-mod_submit"
, uiBtnSubmit: ".fb-mod_submit_btn"
, uiBody: ".fb-mod_body"
, uiTip: ".fb-mod_tip"
, uiSideHome: ".fb-mod_side_home"
, uiSideFriend: ".fb-mod_side_friend em"
, uiSideMessages: ".<API key> em"
, uiSideNotifications: ".<API key> em"
, uiBodyLoader: ".fb-mod_body_loader"
};
FBClient.init = function() {
// DOC.body.innerHTML += '<div id="fb-root"></div>';
var that = this,
$this = $(UI_CONF.uiMod);
/*
ui controller
*/
that.ui = {
uiMod: $this
, side: $this.find(UI_CONF.uiSide)
, btnLogin: $this.find(UI_CONF.uiBtnLogin)
, btnLogout: $this.find(UI_CONF.uiBtnLogout)
, btnClose: $this.find(UI_CONF.uiBtnClose)
, btnRefresh: $this.find(UI_CONF.uiBtnRefresh)
, wrap: $this.find(UI_CONF.uiWrap)
, list: $this.find(UI_CONF.uiList)
, usrinfo: $this.find(UI_CONF.uiUsrinfo)
, avatar: $this.find(UI_CONF.uiAvatar)
, textareaSubmit: $this.find(UI_CONF.uiTextareaSubmit)
, btnSubmit: $this.find(UI_CONF.uiBtnSubmit)
, body: $this.find(UI_CONF.uiBody)
, tip: $this.find(UI_CONF.uiTip)
, sideHome: $this.find(UI_CONF.uiSideHome)
, sideFriend: $this.find(UI_CONF.uiSideFriend)
, sideNotifications: $this.find(UI_CONF.uiSideNotifications)
, sideMessages: $this.find(UI_CONF.uiSideMessages)
, bodyLoader: $this.find(UI_CONF.uiBodyLoader)
, panelHome: $this.find(".fb-mod_c")
, panelFriend: $('<div class="fb-mod_c fb-mod_c_friend" style="display:none"><div class="fb-mod_c_loading"><div class="fb-mod_loader"></div></div></div>')
, panelNotifications: $('<div class="fb-mod_c <API key>" style="display:none"><div class="fb-mod_c_loading"><div class="fb-mod_loader"></div></div></div>')
, panelMessages: $('<div class="fb-mod_c fb-mod_c_messages" style="display:none"><div class="fb-mod_c_loading"><div class="fb-mod_loader"></div></div></div>')
, bubble: $('<div class="fb-mod_bubble">' + (conf.tplBubble || "NEW") + '</div>')
, placeholder: function(first, last) {
return $(TPL_CONF.tplPlaceholder.replaceTpl({first: first,
last: last
}))
}
};
// live loader
that.ui.liveLoader = that.ui.bodyLoader.clone(!0)
.css({"width": "370px"})
.insertBefore(that.ui.list).hide();
$("body").append('<div id="fb-root" class=" fb_reset"></div>');
that.ui.wrap.append(that.ui.panelFriend).append(that.ui.panelNotifications).append(that.ui.panelMessages);
// window.ActiveXObject && !window.XMLHttpRequest &&
$("body").append(that.ui.fakeBox = $(that.ui.textareaSubmit[0].cloneNode(false)).css({
"position": "absolute"
, "top" : "0"
, "left": "0"
, "right": "-10000px"
, "visibility": "hidden"
, "padding-top": "0"
, "padding-bottom": "0"
, "height": "18" //for fixed
, "width": that.ui.textareaSubmit.width()
}));
that.supportAnimate = function(style, name) {
return 't' + name in style
|| 'webkitT' + name in style
|| 'MozT' + name in style
|| 'OT' + name in style;
}((new Image).style, "ransition");
/*
status controller
0 ==> none
1 ==> doing
2 ==> done
*/
that.status = {
login: 0
, fold: 0
, sdkLoaded: 0
, scrollLoaded: 0
, insertLoaded: 0
, fixed: 0
, eventBinded: 0
, bubble: 0
};
// bubble
!$.cookie("fb_bubble") && (that.status.bubble = 1, that.ui.uiMod.append(that.ui.bubble));
/*
post status cache
*/
that.cache = {
prePost: null
, nextPost: null
, refreshPost: null
, noOldPost: 0
, myPost: 0
, stayTip: ""
, userID: null
, userName: ""
, panel: that.ui.panelHome
, curSideType: ""
, panelRendered: 0
};
that.ui.btnClose.mousedown(function(e) {
UT && UT.send({"type": "click", "position": "fb", "sort": that.status.fold === 0 ? "pull" : "fold","modId":"fb-box"});
that.foldHandle.call(that, e);
});
$(".fb-mod_side_logo").mousedown(function(e) {
UT && UT.send({"type": "click", "position": "fb", "sort": that.status.fold === 0 ? "pull" : "fold","modId":"fb-box"});
that.foldHandle.call(that, e);
});
$(".fb-mod_side_home").mousedown(function(e) {
UT && that.status.fold === 0 && UT.send({"type": "click", "position": "fb", "sort": "pull","modId":"fb-box"});
UT && UT.send({"type": "click", "position": "fb", "sort": "icon_home","modId":"fb-box"});
that.status.fold === 0 && that.foldHandle.call(that, e);
that.clickHandle($(this), "<API key>", that.ui.panelHome);
});
$(".fb-mod_side_friend").mousedown(function(e) {
var logObj = {
"type": "click",
"position": "fb",
"sort": "icon_friend",
"modId": "fb-box"
};
if(that.status.login !== 2) {
logObj.ac = "b";
}
UT && UT.send(logObj);
if(that.status.login !== 2) return false;
that.status.fold === 0 && that.foldHandle.call(that, e);
that.clickHandle($(this), "<API key>", that.ui.panelFriend);
});
$(".<API key>").mousedown(function(e) {
var logObj = {
"type": "click",
"position": "fb",
"sort": "icon_messages",
"modId": "fb-box"
};
if(that.status.login !== 2) {
logObj.ac = "b";
}
UT && UT.send(logObj);
if(that.status.login !== 2) return false;
that.status.fold === 0 && that.foldHandle.call(that, e);
that.clickHandle($(this), "<API key>", that.ui.panelMessages);
});
$(".<API key>").mousedown(function(e) {
var logObj = {
"type": "click",
"position": "fb",
"sort": "icon_notifications",
"modId": "fb-box"
};
if(that.status.login !== 2) {
logObj.ac = "b";
}
UT && UT.send(logObj);
if(that.status.login !== 2) return false;
that.status.fold === 0 && that.foldHandle.call(that, e);
that.clickHandle($(this), "<API key>", that.ui.panelNotifications);
});
that.ui.btnRefresh.mousedown(function(e) {
UT && UT.send({"type": "click", "position": "fb", "sort": "refresh","modId":"fb-box"});
});
$(".fb-mod_side_friend").click(function(e) {
e.preventDefault();
});
$(".<API key>").click(function(e) {
e.preventDefault();
});
$(".<API key>").click(function(e) {
e.preventDefault();
});
// kill the feature
// that.ui.side.mouseover(function(e) {
that.ui.textareaSubmit.attr("placeholder", conf.tplSuggestText);
// sdk loading
that.status.sdkLoaded = 1;
/*$.ajax({
url: that.conf.modPath,
dataType: "script",
cache: true,
success: function() {
},
error: function() {
}
});*/
require.async('home:widget/ui/facebook/fbclient-core.js');
};
if(window.ActiveXObject && !window.XMLHttpRequest) {
var body = DOC.body;
if(body) {
body.style.<API key> = 'fixed';
if(body.currentStyle.backgroundImage == "none") {
body.style.backgroundImage = (DOC.domain.indexOf("https:") == 0) ? 'url(https:///)' : 'url(about:blank)';
}
}
}
FBClient.clickHandle = function($el, type, panel) {
var that = this,
fold = that.status.fold,
sideHome = that.ui.sideHome,
cache = that.cache;
// fold && sideHome.removeClass(type);
cache.curSide && cache.curSide.removeClass(cache.curSideType);
$el && $el.addClass(type);
cache.curSide = $el;
cache.curSideType = type;
cache.panel && cache.panel.hide();
panel && panel.show();
cache.panel = panel;
};
FBClient.foldHandle = function(e) {
var that = this,
fold = that.status.fold,
sdkLoaded = that.status.sdkLoaded;
// playing animation
if(fold === 1) return;
that.status.fold = 1;
that.clickHandle(fold ? null : that.ui.sideHome, fold ? "" : "<API key>", that.ui.panelHome);
that.status.bubble && ($.cookie("fb_bubble", 1), that.status.bubble = 0, that.ui.bubble.hide());
fold
? that.ui.uiMod.removeClass("fb-mod--fixed").addClass("fb-mod--fold")
: that.ui.uiMod.removeClass("fb-mod--fold");
setTimeout(function() {
// fold ? sideHome.removeClass("<API key>") : that.ui.sideHome.addClass("<API key>"), that.cache.curSideType = "<API key>";
(that.status.fold = fold ? 0 : 2) && that.status.fixed && that.ui.uiMod.addClass("fb-mod--fixed");
if (!that.status.eventBinded) {
if (sdkLoaded === 2) {
that.bindEvent.call(that);
that.status.eventBinded = 2;
} else {
var t = setInterval(function () {
if (that.status.sdkLoaded === 2) {
that.bindEvent.call(that);
that.status.eventBinded = 2;
clearInterval(t);
}
}, 1000);
}
}
if(fold || sdkLoaded) return;
!function(el) {
if($.browser.mozilla){
el.addEventListener('DOMMouseScroll',function(e){
el.scrollTop += e.detail > 0 ? 30 : -30;
e.preventDefault();
}, !1);
}
else el.onmousewheel = function(e){
e = e || WIN.event;
el.scrollTop += e.wheelDelta > 0 ? -30 : 30;
e.returnValue = false;
};
}(that.ui.body[0])
}, that.supportAnimate ? 300 : 0);
};
module.exports = FBClient;
|
"""
Contains CheesePreprocessor
"""
# Imports
from ...preprocessors.base import Preprocessor
# Classes
class CheesePreprocessor(Preprocessor):
"""
Adds a cheese tag to the resources object
"""
def __init__(self, **kw):
"""
Public constructor
"""
super(CheesePreprocessor, self).__init__(**kw)
def preprocess(self, nb, resources):
resources['cheese'] = 'real'
return nb, resources
|
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
package com.jcraft.jorbis;
// psychoacoustic setup
class PsyInfo{
int athp;
int decayp;
int smoothp;
int noisefitp;
int noisefit_subblock;
float noisefit_threshdB;
float ath_att;
int tonemaskp;
float[] toneatt_125Hz=new float[5];
float[] toneatt_250Hz=new float[5];
float[] toneatt_500Hz=new float[5];
float[] toneatt_1000Hz=new float[5];
float[] toneatt_2000Hz=new float[5];
float[] toneatt_4000Hz=new float[5];
float[] toneatt_8000Hz=new float[5];
int peakattp;
float[] peakatt_125Hz=new float[5];
float[] peakatt_250Hz=new float[5];
float[] peakatt_500Hz=new float[5];
float[] peakatt_1000Hz=new float[5];
float[] peakatt_2000Hz=new float[5];
float[] peakatt_4000Hz=new float[5];
float[] peakatt_8000Hz=new float[5];
int noisemaskp;
float[] noiseatt_125Hz=new float[5];
float[] noiseatt_250Hz=new float[5];
float[] noiseatt_500Hz=new float[5];
float[] noiseatt_1000Hz=new float[5];
float[] noiseatt_2000Hz=new float[5];
float[] noiseatt_4000Hz=new float[5];
float[] noiseatt_8000Hz=new float[5];
float max_curve_dB;
float attack_coeff;
float decay_coeff;
void free(){
}
}
|
/**
* @file
* Progress behavior.
*
* @see progress.js
*/
.progress {
position: relative;
}
.progress__track {
background-color: #fff;
border: 1px solid;
margin-top: 5px;
max-width: 100%;
min-width: 100px;
height: 16px;
}
.progress__bar {
background-color: #000;
height: 1.5em;
width: 3%;
min-width: 3%;
max-width: 100%;
}
.<API key>,
.<API key> {
color: #555;
overflow: hidden;
font-size: .875em;
margin-top: 0.2em;
}
.<API key> {
float: left; /* LTR */
}
[dir="rtl"] .<API key> {
float: right;
}
.<API key> {
float: right; /* LTR */
}
[dir="rtl"] .<API key> {
float: left;
}
.progress--small .progress__track {
height: 7px;
}
.progress--small .progress__bar {
height: 7px;
background-size: 20px 20px;
}
|
#ifndef __ASMPARISC_ELF_H
#define __ASMPARISC_ELF_H
/*
* ELF register definitions..
*/
#include <asm/ptrace.h>
#define EM_PARISC 15
/* HPPA specific definitions. */
#define EF_PARISC_TRAPNIL 0x00010000 /* Trap nil pointer dereference. */
#define EF_PARISC_EXT 0x00020000 /* Program uses arch. extensions. */
#define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */
#define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */
#define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch
prediction. */
#define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */
#define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */
/* Defined values for `e_flags & EF_PARISC_ARCH' are: */
#define EFA_PARISC_1_0 0x020b /* PA-RISC 1.0 big-endian. */
#define EFA_PARISC_1_1 0x0210 /* PA-RISC 1.1 big-endian. */
#define EFA_PARISC_2_0 0x0214 /* PA-RISC 2.0 big-endian. */
/* Additional section indices. */
#define <API key> 0xff00 /* Section for tenatively declared
symbols in ANSI C. */
#define <API key> 0xff01 /* Common blocks in huge model. */
#define SHT_PARISC_EXT 0x70000000 /* Contains product specific ext. */
#define SHT_PARISC_UNWIND 0x70000001 /* Unwind information. */
#define SHT_PARISC_DOC 0x70000002 /* Debug info for optimized code. */
#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */
#define SHF_PARISC_HUGE 0x40000000 /* Section far from gp. */
#define SHF_PARISC_SBP 0x80000000 /* Static branch prediction code. */
#define <API key> 13 /* Millicode function entry point. */
#define STT_HP_OPAQUE (STT_LOOS + 0x1)
#define STT_HP_STUB (STT_LOOS + 0x2)
/* HPPA relocs. */
#define R_PARISC_NONE 0 /* No reloc. */
#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */
#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */
#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */
#define R_PARISC_DIR17F 4 /* 17 bits of eff. address. */
#define R_PARISC_DIR14R 6 /* Right 14 bits of eff. address. */
#define R_PARISC_PCREL32 9 /* 32-bit rel. address. */
#define R_PARISC_PCREL21L 10 /* Left 21 bits of rel. address. */
#define R_PARISC_PCREL17R 11 /* Right 17 bits of rel. address. */
#define R_PARISC_PCREL17F 12 /* 17 bits of rel. address. */
#define R_PARISC_PCREL14R 14 /* Right 14 bits of rel. address. */
#define R_PARISC_DPREL21L 18 /* Left 21 bits of rel. address. */
#define R_PARISC_DPREL14R 22 /* Right 14 bits of rel. address. */
#define R_PARISC_GPREL21L 26 /* GP-relative, left 21 bits. */
#define R_PARISC_GPREL14R 30 /* GP-relative, right 14 bits. */
#define R_PARISC_LTOFF21L 34 /* LT-relative, left 21 bits. */
#define R_PARISC_LTOFF14R 38 /* LT-relative, right 14 bits. */
#define R_PARISC_SECREL32 41 /* 32 bits section rel. address. */
#define R_PARISC_SEGBASE 48 /* No relocation, set segment base. */
#define R_PARISC_SEGREL32 49 /* 32 bits segment rel. address. */
#define R_PARISC_PLTOFF21L 50 /* PLT rel. address, left 21 bits. */
#define R_PARISC_PLTOFF14R 54 /* PLT rel. address, right 14 bits. */
#define <API key> 57 /* 32 bits LT-rel. function pointer. */
#define <API key> 58 /* LT-rel. fct ptr, left 21 bits. */
#define <API key> 62 /* LT-rel. fct ptr, right 14 bits. */
#define R_PARISC_FPTR64 64 /* 64 bits function address. */
#define R_PARISC_PLABEL32 65 /* 32 bits function address. */
#define R_PARISC_PCREL64 72 /* 64 bits PC-rel. address. */
#define R_PARISC_PCREL22F 74 /* 22 bits PC-rel. address. */
#define R_PARISC_PCREL14WR 75 /* PC-rel. address, right 14 bits. */
#define R_PARISC_PCREL14DR 76 /* PC rel. address, right 14 bits. */
#define R_PARISC_PCREL16F 77 /* 16 bits PC-rel. address. */
#define R_PARISC_PCREL16WF 78 /* 16 bits PC-rel. address. */
#define R_PARISC_PCREL16DF 79 /* 16 bits PC-rel. address. */
#define R_PARISC_DIR64 80 /* 64 bits of eff. address. */
#define R_PARISC_DIR14WR 83 /* 14 bits of eff. address. */
#define R_PARISC_DIR14DR 84 /* 14 bits of eff. address. */
#define R_PARISC_DIR16F 85 /* 16 bits of eff. address. */
#define R_PARISC_DIR16WF 86 /* 16 bits of eff. address. */
#define R_PARISC_DIR16DF 87 /* 16 bits of eff. address. */
#define R_PARISC_GPREL64 88 /* 64 bits of GP-rel. address. */
#define R_PARISC_GPREL14WR 91 /* GP-rel. address, right 14 bits. */
#define R_PARISC_GPREL14DR 92 /* GP-rel. address, right 14 bits. */
#define R_PARISC_GPREL16F 93 /* 16 bits GP-rel. address. */
#define R_PARISC_GPREL16WF 94 /* 16 bits GP-rel. address. */
#define R_PARISC_GPREL16DF 95 /* 16 bits GP-rel. address. */
#define R_PARISC_LTOFF64 96 /* 64 bits LT-rel. address. */
#define R_PARISC_LTOFF14WR 99 /* LT-rel. address, right 14 bits. */
#define R_PARISC_LTOFF14DR 100 /* LT-rel. address, right 14 bits. */
#define R_PARISC_LTOFF16F 101 /* 16 bits LT-rel. address. */
#define R_PARISC_LTOFF16WF 102 /* 16 bits LT-rel. address. */
#define R_PARISC_LTOFF16DF 103 /* 16 bits LT-rel. address. */
#define R_PARISC_SECREL64 104 /* 64 bits section rel. address. */
#define R_PARISC_SEGREL64 112 /* 64 bits segment rel. address. */
#define R_PARISC_PLTOFF14WR 115 /* PLT-rel. address, right 14 bits. */
#define R_PARISC_PLTOFF14DR 116 /* PLT-rel. address, right 14 bits. */
#define R_PARISC_PLTOFF16F 117 /* 16 bits LT-rel. address. */
#define R_PARISC_PLTOFF16WF 118 /* 16 bits PLT-rel. address. */
#define R_PARISC_PLTOFF16DF 119 /* 16 bits PLT-rel. address. */
#define <API key> 120 /* 64 bits LT-rel. function ptr. */
#define <API key> 123 /* LT-rel. fct. ptr., right 14 bits. */
#define <API key> 124 /* LT-rel. fct. ptr., right 14 bits. */
#define <API key> 125 /* 16 bits LT-rel. function ptr. */
#define <API key> 126 /* 16 bits LT-rel. function ptr. */
#define <API key> 127 /* 16 bits LT-rel. function ptr. */
#define R_PARISC_LORESERVE 128
#define R_PARISC_COPY 128 /* Copy relocation. */
#define R_PARISC_IPLT 129 /* Dynamic reloc, imported PLT */
#define R_PARISC_EPLT 130 /* Dynamic reloc, exported PLT */
#define R_PARISC_TPREL32 153 /* 32 bits TP-rel. address. */
#define R_PARISC_TPREL21L 154 /* TP-rel. address, left 21 bits. */
#define R_PARISC_TPREL14R 158 /* TP-rel. address, right 14 bits. */
#define <API key> 162 /* LT-TP-rel. address, left 21 bits. */
#define <API key> 166 /* LT-TP-rel. address, right 14 bits.*/
#define <API key> 167 /* 14 bits LT-TP-rel. address. */
#define R_PARISC_TPREL64 216 /* 64 bits TP-rel. address. */
#define R_PARISC_TPREL14WR 219 /* TP-rel. address, right 14 bits. */
#define R_PARISC_TPREL14DR 220 /* TP-rel. address, right 14 bits. */
#define R_PARISC_TPREL16F 221 /* 16 bits TP-rel. address. */
#define R_PARISC_TPREL16WF 222 /* 16 bits TP-rel. address. */
#define R_PARISC_TPREL16DF 223 /* 16 bits TP-rel. address. */
#define R_PARISC_LTOFF_TP64 224 /* 64 bits LT-TP-rel. address. */
#define <API key> 227 /* LT-TP-rel. address, right 14 bits.*/
#define <API key> 228 /* LT-TP-rel. address, right 14 bits.*/
#define <API key> 229 /* 16 bits LT-TP-rel. address. */
#define <API key> 230 /* 16 bits LT-TP-rel. address. */
#define <API key> 231 /* 16 bits LT-TP-rel. address. */
#define R_PARISC_HIRESERVE 255
#define PA_PLABEL_FDESC 0x02 /* bit set if PLABEL points to
* a function descriptor, not
* an address */
/* The following are PA function descriptors
*
* addr: the absolute address of the function
* gp: either the data pointer (r27) for non-PIC code or the
* the PLT pointer (r19) for PIC code */
/* Format for the Elf32 Function descriptor */
typedef struct elf32_fdesc {
__u32 addr;
__u32 gp;
} Elf32_Fdesc;
/* Format for the Elf64 Function descriptor */
typedef struct elf64_fdesc {
__u64 dummy[2]; /* FIXME: nothing uses these, why waste
* the space */
__u64 addr;
__u64 gp;
} Elf64_Fdesc;
#ifdef __KERNEL__
#ifdef CONFIG_64BIT
#define Elf_Fdesc Elf64_Fdesc
#else
#define Elf_Fdesc Elf32_Fdesc
#endif /*CONFIG_64BIT*/
#endif /*__KERNEL__*/
#define PT_HP_TLS (PT_LOOS + 0x0)
#define PT_HP_CORE_NONE (PT_LOOS + 0x1)
#define PT_HP_CORE_VERSION (PT_LOOS + 0x2)
#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3)
#define PT_HP_CORE_COMM (PT_LOOS + 0x4)
#define PT_HP_CORE_PROC (PT_LOOS + 0x5)
#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6)
#define PT_HP_CORE_STACK (PT_LOOS + 0x7)
#define PT_HP_CORE_SHM (PT_LOOS + 0x8)
#define PT_HP_CORE_MMF (PT_LOOS + 0x9)
#define PT_HP_PARALLEL (PT_LOOS + 0x10)
#define PT_HP_FASTBIND (PT_LOOS + 0x11)
#define PT_HP_OPT_ANNOT (PT_LOOS + 0x12)
#define PT_HP_HSL_ANNOT (PT_LOOS + 0x13)
#define PT_HP_STACK (PT_LOOS + 0x14)
#define PT_PARISC_ARCHEXT 0x70000000
#define PT_PARISC_UNWIND 0x70000001
#define PF_PARISC_SBP 0x08000000
#define PF_HP_PAGE_SIZE 0x00100000
#define PF_HP_FAR_SHARED 0x00200000
#define PF_HP_NEAR_SHARED 0x00400000
#define PF_HP_CODE 0x01000000
#define PF_HP_MODIFY 0x02000000
#define PF_HP_LAZYSWAP 0x04000000
#define PF_HP_SBP 0x08000000
/*
* The following definitions are those for 32-bit ELF binaries on a 32-bit
* kernel and for 64-bit binaries on a 64-bit kernel. To run 32-bit binaries
* on a 64-bit kernel, arch/parisc/kernel/binfmt_elf32.c defines these
* macros appropriately and then #includes binfmt_elf.c, which then includes
* this file.
*/
#ifndef ELF_CLASS
/*
* This is used to ensure we don't load something for the wrong architecture.
*
* Note that this header file is used by default in fs/binfmt_elf.c. So
* the following macros are for the default case. However, for the 64
* bit kernel we also support 32 bit parisc binaries. To do that
* arch/parisc/kernel/binfmt_elf32.c defines its own set of these
* macros, and then it includes fs/binfmt_elf.c to provide an alternate
* elf binary handler for 32 bit binaries (on the 64 bit kernel).
*/
#ifdef CONFIG_64BIT
#define ELF_CLASS ELFCLASS64
#else
#define ELF_CLASS ELFCLASS32
#endif
typedef unsigned long elf_greg_t;
/*
* This yields a string that ld.so will use to load implementation
* specific libraries for optimization. This is more specific in
* intent than poking at uname or /proc/cpuinfo.
*/
#define ELF_PLATFORM ("PARISC\0")
#define SET_PERSONALITY(ex) \
current->personality = PER_LINUX; \
current->thread.map_base = DEFAULT_MAP_BASE; \
current->thread.task_size = DEFAULT_TASK_SIZE \
/*
* Fill in general registers in a core dump. This saves pretty
* much the same registers as hp-ux, although in a different order.
* Registers marked # below are not currently saved in pt_regs, so
* we use their current values here.
*
* gr0..gr31
* sr0..sr7
* iaoq0..iaoq1
* iasq0..iasq1
* cr11 (sar)
* cr19 (iir)
* cr20 (isr)
* cr21 (ior)
* # cr22 (ipsw)
* # cr0 (recovery counter)
* # cr24..cr31 (temporary registers)
* # cr8,9,12,13 (protection IDs)
* # cr10 (scr/ccr)
* # cr15 (ext int enable mask)
*
*/
#define ELF_CORE_COPY_REGS(dst, pt) \
memset(dst, 0, sizeof(dst)); /* don't leak any "random" bits */ \
memcpy(dst + 0, pt->gr, 32 * sizeof(elf_greg_t)); \
memcpy(dst + 32, pt->sr, 8 * sizeof(elf_greg_t)); \
memcpy(dst + 40, pt->iaoq, 2 * sizeof(elf_greg_t)); \
memcpy(dst + 42, pt->iasq, 2 * sizeof(elf_greg_t)); \
dst[44] = pt->sar; dst[45] = pt->iir; \
dst[46] = pt->isr; dst[47] = pt->ior; \
dst[48] = mfctl(22); dst[49] = mfctl(0); \
dst[50] = mfctl(24); dst[51] = mfctl(25); \
dst[52] = mfctl(26); dst[53] = mfctl(27); \
dst[54] = mfctl(28); dst[55] = mfctl(29); \
dst[56] = mfctl(30); dst[57] = mfctl(31); \
dst[58] = mfctl( 8); dst[59] = mfctl( 9); \
dst[60] = mfctl(12); dst[61] = mfctl(13); \
dst[62] = mfctl(10); dst[63] = mfctl(15);
#endif /* ! ELF_CLASS */
#define ELF_NGREG 80 /* We only need 64 at present, but leave space
for expansion. */
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
#define ELF_NFPREG 32
typedef double elf_fpreg_t;
typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
struct task_struct;
extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
#define <API key>(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
struct pt_regs; /* forward declaration... */
#define elf_check_arch(x) ((x)->e_machine == EM_PARISC && (x)->e_ident[EI_CLASS] == ELF_CLASS)
/*
* These are used to set parameters in the core dumps.
*/
#define ELF_DATA ELFDATA2MSB
#define ELF_ARCH EM_PARISC
#define ELF_OSABI ELFOSABI_LINUX
/* %r23 is set by ld.so to a pointer to a function which might be
registered using atexit. This provides a means for the dynamic
linker to call DT_FINI functions for shared libraries that have
been loaded before the code runs.
So that we can use the same startup file with static executables,
we start programs with a value of 0 to indicate that there is no
such function. */
#define ELF_PLAT_INIT(_r, load_addr) _r->gr[23] = 0
#define ELF_EXEC_PAGESIZE 4096
/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
use of this is to invoke "./ld.so someprog" to test out a new version of
the loader. We need to make sure that it is out of the way of the program
that it will "exec", and that there is sufficient room for the brk.
(2 * TASK_SIZE / 3) turns into something undefined when run through a
32 bit preprocessor and in some cases results in the kernel trying to map
ld.so to the kernel virtual base. Use a sane value instead. /Jes
*/
#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x01000000)
/* This yields a mask that user programs can use to figure out what
instruction set this CPU supports. This could be done in user space,
but it's not easy, and we've already done it here. */
#define ELF_HWCAP 0
#endif
|
/**
* 404 (Not Found) Handler
*
* Usage:
* return res.notFound();
* return res.notFound(err);
* return res.notFound(err, 'some/specific/notfound/view');
*
* e.g.:
* ```
* return res.notFound();
* ```
*
* NOTE:
* If a request doesn't match any explicit routes (i.e. `config/routes.js`)
* or route blueprints (i.e. "shadow routes", Sails will call `res.notFound()`
* automatically.
*/
module.exports = function notFound (data, options) {
// Get access to `req`, `res`, & `sails`
var req = this.req;
var res = this.res;
var sails = req._sails;
// Set status code
res.status(404);
// Log error to console
if (data !== undefined) {
sails.log.verbose('Sending 404 ("Not Found") response: \n',data);
}
else sails.log.verbose('Sending 404 ("Not Found") response');
// Only include errors in response if application environment
// is not set to 'production'. In production, we shouldn't
// send back any identifying information about errors.
if (sails.config.environment === 'production' && sails.config.keepResponseErrors !== true) {
data = undefined;
}
// If the user-agent wants JSON, always respond with JSON
if (req.wantsJSON) {
return res.jsonx(data);
}
// If second argument is a string, we take that to mean it refers to a view.
// If it was omitted, use an empty object (`{}`)
options = (typeof options === 'string') ? { view: options } : options || {};
// If a view was provided in options, serve it.
// Otherwise try to guess an appropriate view, or if that doesn't
// work, just send JSON.
if (options.view) {
return res.view(options.view, { data: data });
}
// If no second argument provided, try to serve the default view,
// but fall back to sending JSON(P) if any errors occur.
else return res.view('404', { data: data }, function (err, html) {
// If a view error occured, fall back to JSON(P).
if (err) {
// Additionally:
if (err.code === 'E_VIEW_FAILED') {
sails.log.verbose('res.notFound() :: Could not locate view for error page (sending JSON instead). Details: ',err);
}
// Otherwise, if this was a more serious error, log to the console with the details.
else {
sails.log.warn('res.notFound() :: When attempting to render error page view, an error occured (sending JSON instead). Details: ', err);
}
return res.jsonx(data);
}
return res.send(html);
});
};
|
package org.chromium.base;
import android.os.Looper;
import android.os.MessageQueue;
import android.os.SystemClock;
import android.util.Log;
import android.util.Printer;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
/**
* Java mirror of Chrome trace event API. See base/trace_event/trace_event.h. Unlike the native
* version, Java does not have stack objects, so a TRACE_EVENT() which does both TRACE_EVENT_BEGIN()
* and TRACE_EVENT_END() in ctor/dtor is not possible.
* It is OK to use tracing before the native library has loaded, but such traces will
* be ignored. (Perhaps we could devise to buffer them up in future?).
*/
@JNINamespace("base::android")
public class TraceEvent {
private static volatile boolean sEnabled = false;
private static volatile boolean sATraceEnabled = false; // True when taking an Android systrace.
private static class BasicLooperMonitor implements Printer {
@Override
public void println(final String line) {
if (line.startsWith(">")) {
beginHandling(line);
} else {
assert line.startsWith("<");
endHandling(line);
}
}
void beginHandling(final String line) {
if (sEnabled) nativeBeginToplevel();
}
void endHandling(final String line) {
if (sEnabled) nativeEndToplevel();
}
}
/**
* A class that records, traces and logs statistics about the UI thead's Looper.
* The output of this class can be used in a number of interesting ways:
* <p>
* <ol><li>
* When using chrometrace, there will be a near-continuous line of
* measurements showing both event dispatches as well as idles;
* </li><li>
* Logging messages are output for events that run too long on the
* event dispatcher, making it easy to identify problematic areas;
* </li><li>
* Statistics are output whenever there is an idle after a non-trivial
* amount of activity, allowing information to be gathered about task
* density and execution cadence on the Looper;
* </li></ol>
* <p>
* The class attaches itself as an idle handler to the main Looper, and
* monitors the execution of events and idle notifications. Task counters
* accumulate between idle notifications and get reset when a new idle
* notification is received.
*/
private static final class <API key> extends BasicLooperMonitor
implements MessageQueue.IdleHandler {
// Tags for dumping to logcat or TraceEvent
private static final String TAG = "TraceEvent.LooperMonitor";
private static final String IDLE_EVENT_NAME = "Looper.queueIdle";
// Calculation constants
private static final long <API key> = 1000L / 60L; // 60 FPS
// A reasonable threshold for defining a Looper event as "long running"
private static final long <API key> =
<API key>;
// A reasonable threshold for a "burst" of tasks on the Looper
private static final long <API key> =
<API key> * 3;
// Stats tracking
private long mLastIdleStartedAt = 0L;
private long mLastWorkStartedAt = 0L;
private int mNumTasksSeen = 0;
private int mNumIdlesSeen = 0;
private int <API key> = 0;
// State
private boolean <API key> = false;
// Called from within the begin/end methods only.
// This method can only execute on the looper thread, because that is
// the only thread that is permitted to call Looper.myqueue().
private final void syncIdleMonitoring() {
if (sEnabled && !<API key>) {
// approximate start time for computational purposes
mLastIdleStartedAt = SystemClock.elapsedRealtime();
Looper.myQueue().addIdleHandler(this);
<API key> = true;
Log.v(TAG, "attached idle handler");
} else if (<API key> && !sEnabled) {
Looper.myQueue().removeIdleHandler(this);
<API key> = false;
Log.v(TAG, "detached idle handler");
}
}
@Override
final void beginHandling(final String line) {
// Close-out any prior 'idle' period before starting new task.
if (<API key> == 0) {
TraceEvent.end(IDLE_EVENT_NAME);
}
mLastWorkStartedAt = SystemClock.elapsedRealtime();
syncIdleMonitoring();
super.beginHandling(line);
}
@Override
final void endHandling(final String line) {
final long elapsed = SystemClock.elapsedRealtime()
- mLastWorkStartedAt;
if (elapsed > <API key>) {
traceAndLog(Log.WARN, "observed a task that took "
+ elapsed + "ms: " + line);
}
super.endHandling(line);
syncIdleMonitoring();
mNumTasksSeen++;
<API key>++;
}
private static void traceAndLog(int level, String message) {
TraceEvent.instant("TraceEvent.LooperMonitor:IdleStats", message);
Log.println(level, TAG, message);
}
@Override
public final boolean queueIdle() {
final long now = SystemClock.elapsedRealtime();
if (mLastIdleStartedAt == 0) mLastIdleStartedAt = now;
final long elapsed = now - mLastIdleStartedAt;
mNumIdlesSeen++;
TraceEvent.begin(IDLE_EVENT_NAME, <API key> + " tasks since last idle.");
if (elapsed > <API key>) {
// Dump stats
String statsString = mNumTasksSeen + " tasks and "
+ mNumIdlesSeen + " idles processed so far, "
+ <API key> + " tasks bursted and "
+ elapsed + "ms elapsed since last idle";
traceAndLog(Log.DEBUG, statsString);
}
mLastIdleStartedAt = now;
<API key> = 0;
return true; // stay installed
}
}
// Holder for monitor avoids unnecessary construction on non-debug runs
private static final class LooperMonitorHolder {
private static final BasicLooperMonitor sInstance =
CommandLine.getInstance().hasSwitch(BaseSwitches.ENABLE_IDLE_TRACING)
? new <API key>() : new BasicLooperMonitor();
}
/**
* Register an enabled observer, such that java traces are always enabled with native.
*/
public static void <API key>() {
<API key>();
}
/**
* Notification from native that tracing is enabled/disabled.
*/
@CalledByNative
public static void setEnabled(boolean enabled) {
sEnabled = enabled;
// Android M+ systrace logs this on its own. Only log it if not writing to Android systrace.
if (sATraceEnabled) return;
ThreadUtils.getUiThreadLooper().setMessageLogging(
enabled ? LooperMonitorHolder.sInstance : null);
}
/**
* Enables or disabled Android systrace path of Chrome tracing. If enabled, all Chrome
* traces will be also output to Android systrace. Because of the overhead of Android
* systrace, this is for WebView only.
*/
public static void setATraceEnabled(boolean enabled) {
if (sATraceEnabled == enabled) return;
sATraceEnabled = enabled;
if (enabled) {
// Calls TraceEvent.setEnabled(true) via
// TraceLog::<API key>::OnTraceLogEnabled
nativeStartATrace();
} else {
// Calls TraceEvent.setEnabled(false) via
// TraceLog::<API key>::OnTraceLogDisabled
nativeStopATrace();
}
}
/**
* @return True if tracing is enabled, false otherwise.
* It is safe to call trace methods without checking if TraceEvent
* is enabled.
*/
public static boolean enabled() {
return sEnabled;
}
/**
* Triggers the 'instant' native trace event with no arguments.
* @param name The name of the event.
*/
public static void instant(String name) {
if (sEnabled) nativeInstant(name, null);
}
/**
* Triggers the 'instant' native trace event.
* @param name The name of the event.
* @param arg The arguments of the event.
*/
public static void instant(String name, String arg) {
if (sEnabled) nativeInstant(name, arg);
}
/**
* Triggers the 'start' native trace event with no arguments.
* @param name The name of the event.
* @param id The id of the asynchronous event.
*/
public static void startAsync(String name, long id) {
if (sEnabled) nativeStartAsync(name, id);
}
/**
* Triggers the 'finish' native trace event with no arguments.
* @param name The name of the event.
* @param id The id of the asynchronous event.
*/
public static void finishAsync(String name, long id) {
if (sEnabled) nativeFinishAsync(name, id);
}
/**
* Triggers the 'begin' native trace event with no arguments.
* @param name The name of the event.
*/
public static void begin(String name) {
if (sEnabled) nativeBegin(name, null);
}
/**
* Triggers the 'begin' native trace event.
* @param name The name of the event.
* @param arg The arguments of the event.
*/
public static void begin(String name, String arg) {
if (sEnabled) nativeBegin(name, arg);
}
/**
* Triggers the 'end' native trace event with no arguments.
* @param name The name of the event.
*/
public static void end(String name) {
if (sEnabled) nativeEnd(name, null);
}
/**
* Triggers the 'end' native trace event.
* @param name The name of the event.
* @param arg The arguments of the event.
*/
public static void end(String name, String arg) {
if (sEnabled) nativeEnd(name, arg);
}
private static native void <API key>();
private static native void nativeStartATrace();
private static native void nativeStopATrace();
private static native void nativeInstant(String name, String arg);
private static native void nativeBegin(String name, String arg);
private static native void nativeEnd(String name, String arg);
private static native void nativeBeginToplevel();
private static native void nativeEndToplevel();
private static native void nativeStartAsync(String name, long id);
private static native void nativeFinishAsync(String name, long id);
}
|
(function(){var e=window.AmCharts;e.AmRectangularChart=e.Class({inherits:e.AmCoordinateChart,construct:function(a){e.AmRectangularChart.base.construct.call(this,a);this.theme=a;this.createEvents("zoomed","changed");this.marginRight=this.marginBottom=this.marginTop=this.marginLeft=20;this.depth3D=this.angle=0;this.plotAreaFillColors="#FFFFFF";this.plotAreaFillAlphas=0;this.plotAreaBorderColor="#000000";this.plotAreaBorderAlpha=0;this.maxZoomFactor=20;this.<API key>=19;this.zoomOutButtonImage=
"lens";this.zoomOutText="Show all";this.zoomOutButtonColor="#e5e5e5";this.zoomOutButtonAlpha=0;this.<API key>=1;this.<API key>=8;this.trendLines=[];this.autoMargins=!0;this.marginsUpdated=!1;this.autoMarginOffset=10;e.applyTheme(this,a,"AmRectangularChart")},initChart:function(){e.AmRectangularChart.base.initChart.call(this);this.updateDxy();!this.marginsUpdated&&this.autoMargins&&(this.resetMargins(),this.drawGraphs=!1);this.processScrollbars();this.updateMargins();this.updatePlotArea();
this.updateScrollbars();this.updateTrendLines();this.updateChartCursor();this.updateValueAxes();this.scrollbarOnly||this.updateGraphs()},drawChart:function(){e.AmRectangularChart.base.drawChart.call(this);this.drawPlotArea();if(e.ifArray(this.chartData)){var a=this.chartCursor;a&&a.draw()}},resetMargins:function(){var a={},b;if("xy"==this.type){var c=this.xAxes,d=this.yAxes;for(b=0;b<c.length;b++){var g=c[b];g.ignoreAxisWidth||(g.setOrientation(!0),g.fixAxisPosition(),a[g.position]=!0)}for(b=0;b<
d.length;b++)c=d[b],c.ignoreAxisWidth||(c.setOrientation(!1),c.fixAxisPosition(),a[c.position]=!0)}else{d=this.valueAxes;for(b=0;b<d.length;b++)c=d[b],c.ignoreAxisWidth||(c.setOrientation(this.rotate),c.fixAxisPosition(),a[c.position]=!0);(b=this.categoryAxis)&&!b.ignoreAxisWidth&&(b.setOrientation(!this.rotate),b.fixAxisPosition(),b.fixAxisPosition(),a[b.position]=!0)}a.left&&(this.marginLeft=0);a.right&&(this.marginRight=0);a.top&&(this.marginTop=0);a.bottom&&(this.marginBottom=0);this.fixMargins=
a},measureMargins:function(){var a=this.valueAxes,b,c=this.autoMarginOffset,d=this.fixMargins,g=this.realWidth,e=this.realHeight,f=c,k=c,m=g;b=e;var l;for(l=0;l<a.length;l++)a[l].<API key>(),b=this.getAxisBounds(a[l],f,m,k,b),f=Math.round(b.l),m=Math.round(b.r),k=Math.round(b.t),b=Math.round(b.b);if(a=this.categoryAxis)b=this.getAxisBounds(a,f,m,k,b),f=Math.round(b.l),m=Math.round(b.r),k=Math.round(b.t),b=Math.round(b.b);d.left&&f<c&&(this.marginLeft=Math.round(-f+c),!isNaN(this.minMarginLeft)&&
this.marginLeft<this.minMarginLeft&&(this.marginLeft=this.minMarginLeft));d.right&&m>=g-c&&(this.marginRight=Math.round(m-g+c),!isNaN(this.minMarginRight)&&this.marginRight<this.minMarginRight&&(this.marginRight=this.minMarginRight));d.top&&k<c+this.titleHeight&&(this.marginTop=Math.round(this.marginTop-k+c+this.titleHeight),!isNaN(this.minMarginTop)&&this.marginTop<this.minMarginTop&&(this.marginTop=this.minMarginTop));d.bottom&&b>e-c&&(this.marginBottom=Math.round(this.marginBottom+b-e+c),!isNaN(this.minMarginBottom)&&
this.marginBottom<this.minMarginBottom&&(this.marginBottom=this.minMarginBottom));this.initChart()},getAxisBounds:function(a,b,c,d,e){if(!a.ignoreAxisWidth){var h=a.labelsSet,f=a.tickLength;a.inside&&(f=0);if(h)switch(h=a.getBBox(),a.position){case "top":a=h.y;d>a&&(d=a);break;case "bottom":a=h.y+h.height;e<a&&(e=a);break;case "right":a=h.x+h.width+f+3;c<a&&(c=a);break;case "left":a=h.x-f,b>a&&(b=a)}}return{l:b,t:d,r:c,b:e}},drawZoomOutButton:function(){var a=this;if(!a.zbSet){var b=a.container.set();
a.zoomButtonSet.push(b);var c=a.color,d=a.fontSize,g=a.<API key>,h=a.zoomOutButtonImage.replace(/\.[a-z]*$/i,""),f=a.langObj.zoomOutText||a.zoomOutText,k=a.zoomOutButtonColor,m=a.zoomOutButtonAlpha,l=a.<API key>,p=a.<API key>;isNaN(l)||(d=l);(l=a.<API key>)&&(c=l);var l=a.zoomOutButton,q;l&&(l.fontSize&&(d=l.fontSize),l.color&&(c=l.color),l.backgroundColor&&(k=l.backgroundColor),isNaN(l.backgroundAlpha)||(a.<API key>=l.backgroundAlpha));
var r=l=0,r=a.pathToImages;if(h){if(e.isAbsolute(h)||void 0===r)r="";q=a.container.image(r+h+a.extension,0,0,g,g);e.setCN(a,q,"zoom-out-image");b.push(q);q=q.getBBox();l=q.width+5}void 0!==f&&(c=e.text(a.container,f,c,a.fontFamily,d,"start"),e.setCN(a,c,"zoom-out-label"),d=c.getBBox(),r=q?q.height/2-3:d.height/2,c.translate(l,r),b.push(c));q=b.getBBox();c=1;e.isModern||(c=0);k=e.rect(a.container,q.width+2*p+5,q.height+2*p-2,k,1,1,k,c);k.setAttr("opacity",m);k.translate(-p,-p);e.setCN(a,k,"zoom-out-bg");
b.push(k);k.toBack();a.zbBG=k;q=k.getBBox();b.translate(a.marginLeftReal+a.plotAreaWidth-q.width+p,a.marginTopReal+p);b.hide();b.mouseover(function(){a.rollOverZB()}).mouseout(function(){a.rollOutZB()}).click(function(){a.clickZB()}).touchstart(function(){a.rollOverZB()}).touchend(function(){a.rollOutZB();a.clickZB()});for(m=0;m<b.length;m++)b[m].attr({cursor:"pointer"});void 0!==a.<API key>&&(b.setAttr("tabindex",a.<API key>),b.setAttr("role","menuitem"),b.keyup(function(b){13==
b.keyCode&&a.clickZB()}));a.zbSet=b}},rollOverZB:function(){this.rolledOverZB=!0;this.zbBG.setAttr("opacity",this.<API key>)},rollOutZB:function(){this.rolledOverZB=!1;this.zbBG.setAttr("opacity",this.zoomOutButtonAlpha)},clickZB:function(){this.rolledOverZB=!1;this.zoomOut()},zoomOut:function(){this.zoomOutValueAxes()},drawPlotArea:function(){var a=this.dx,b=this.dy,c=this.marginLeftReal,d=this.marginTopReal,g=this.plotAreaWidth-1,h=this.plotAreaHeight-1,f=this.plotAreaFillColors,
k=this.plotAreaFillAlphas,m=this.plotAreaBorderColor,l=this.plotAreaBorderAlpha;"object"==typeof k&&(k=k[0]);f=e.polygon(this.container,[0,g,g,0,0],[0,0,h,h,0],f,k,1,m,l,this.<API key>);e.setCN(this,f,"plot-area");f.translate(c+a,d+b);this.set.push(f);0!==a&&0!==b&&(f=this.plotAreaFillColors,"object"==typeof f&&(f=f[0]),f=e.adjustLuminosity(f,-.15),g=e.polygon(this.container,[0,a,g+a,g,0],[0,b,b,0,0],f,k,1,m,l),e.setCN(this,g,"plot-area-bottom"),g.translate(c,d+h),this.set.push(g),a=e.polygon(this.container,
[0,0,a,a,0],[0,h,h+b,b,0],f,k,1,m,l),e.setCN(this,a,"plot-area-left"),a.translate(c,d),this.set.push(a));(c=this.bbset)&&this.scrollbarOnly&&c.remove()},updatePlotArea:function(){var a=this.updateWidth(),b=this.updateHeight(),c=this.container;this.realWidth=a;this.realWidth=b;c&&this.container.setSize(a,b);var c=this.marginLeftReal,d=this.marginTopReal,a=a-c-this.<API key>.dx,b=b-d-this.marginBottomReal;1>a&&(a=1);1>b&&(b=1);this.plotAreaWidth=Math.round(a);this.plotAreaHeight=Math.round(b);
this.plotBalloonsSet.translate(c,d)},updateDxy:function(){this.dx=Math.round(this.depth3D*Math.cos(this.angle*Math.PI/180));this.dy=Math.round(-this.depth3D*Math.sin(this.angle*Math.PI/180));this.d3x=Math.round(this.columnSpacing3D*Math.cos(this.angle*Math.PI/180));this.d3y=Math.round(-this.columnSpacing3D*Math.sin(this.angle*Math.PI/180))},updateMargins:function(){var a=this.getTitleHeight();this.titleHeight=a;this.marginTopReal=this.marginTop-this.dy;this.fixMargins&&!this.fixMargins.top&&(this.marginTopReal+=
a);this.marginBottomReal=this.marginBottom;this.marginLeftReal=this.marginLeft;this.marginRightReal=this.marginRight},updateValueAxes:function(){var a=this.valueAxes,b;for(b=0;b<a.length;b++){var c=a[b];this.setAxisRenderers(c);this.updateObjectSize(c)}},setAxisRenderers:function(a){a.axisRenderer=e.RecAxis;a.guideFillRenderer=e.RecFill;a.axisItemRenderer=e.RecItem;a.marginsChanged=!0},updateGraphs:function(){var a=this.graphs,b;for(b=0;b<a.length;b++){var c=a[b];c.index=b;c.rotate=this.rotate;this.updateObjectSize(c)}},
updateObjectSize:function(a){a.width=this.plotAreaWidth-1;a.height=this.plotAreaHeight-1;a.x=this.marginLeftReal;a.y=this.marginTopReal;a.dx=this.dx;a.dy=this.dy},updateChartCursor:function(){var a=this.chartCursor;a&&(a=e.processObject(a,e.ChartCursor,this.theme),this.updateObjectSize(a),this.addChartCursor(a),a.chart=this)},processScrollbars:function(){var a=this.chartScrollbar;a&&(a=e.processObject(a,e.ChartScrollbar,this.theme),this.addChartScrollbar(a))},updateScrollbars:function(){},removeChartCursor:function(){e.callMethod("destroy",
[this.chartCursor]);this.chartCursor=null},zoomTrendLines:function(){var a=this.trendLines,b;for(b=0;b<a.length;b++){var c=a[b];c.valueAxis.<API key>?c.set&&c.set.hide():(c.x=this.marginLeftReal,c.y=this.marginTopReal,c.draw())}},<API key>:function(){},addTrendLine:function(a){this.trendLines.push(a)},zoomOutValueAxes:function(){for(var a=this.valueAxes,b=0;b<a.length;b++)a[b].zoomOut()},removeTrendLine:function(a){var b=this.trendLines,c;for(c=b.length-1;0<=c;c--)b[c]==a&&
b.splice(c,1)},adjustMargins:function(a,b){var c=a.position,d=a.scrollbarHeight+a.offset;a.enabled&&("top"==c?b?this.marginLeftReal+=d:this.marginTopReal+=d:b?this.marginRightReal+=d:this.marginBottomReal+=d)},<API key>:function(a,b,c){var d="bottom",e="top";a.oppositeAxis||(e=d,d="top");a.position=b?"bottom"==c||"left"==c?d:e:"top"==c||"right"==c?d:e},<API key>:function(a,b){if(a){a.rotate=b;var c=this.marginTopReal,d=this.marginLeftReal,e=a.scrollbarHeight,h=this.dx,f=this.dy,
k=a.offset;"top"==a.position?b?(a.y=c,a.x=d-e-k):(a.y=c-e+f-k,a.x=d+h):b?(a.y=c+f,a.x=d+this.plotAreaWidth+h+k):(a.y=c+this.plotAreaHeight+k,a.x=this.marginLeftReal)}},showZB:function(a){var b=this.zbSet;a&&(b=this.zoomOutText,""!==b&&b&&this.drawZoomOutButton());if(b=this.zbSet)this.zoomButtonSet.push(b),a?b.show():b.hide(),this.rollOutZB()},<API key>:function(a){e.AmRectangularChart.base.<API key>.call(this,a);(a=this.chartCursor)&&a.<API key>&&a.<API key>()},
handleMouseDown:function(a){e.AmRectangularChart.base.handleMouseDown.call(this,a);var b=this.chartCursor;b&&b.handleMouseDown&&!this.rolledOverZB&&b.handleMouseDown(a)},update:function(){e.AmRectangularChart.base.update.call(this);this.chartCursor&&this.chartCursor.update&&this.chartCursor.update()},<API key>:function(a){this.<API key>(a.target.valueAxes,a.relativeStart,a.relativeEnd);this.zoomAxesAndGraphs()},zoomValueScrollbar:function(a){if(a&&a.enabled){var b=a.valueAxes[0],
c=b.relativeStart,d=b.relativeEnd;b.reversed&&(d=1-c,c=1-b.relativeEnd);a.percentZoom(c,d)}},zoomAxesAndGraphs:function(){if(!this.scrollbarOnly){var a=this.valueAxes,b;for(b=0;b<a.length;b++)a[b].zoom(this.start,this.end);a=this.graphs;for(b=0;b<a.length;b++)a[b].zoom(this.start,this.end);(b=this.chartCursor)&&b.clearSelection();this.zoomTrendLines()}},<API key>:function(a,b){var c=a.relativeStart,d=a.relativeEnd;if(c>d)var e=c,c=d,d=e;this.<API key>(b,c,d);this.<API key>()},
<API key>:function(){this.zoomAxesAndGraphs();this.zoomScrollbar()},<API key>:function(a,b,c){b=e.fitToBounds(b,0,1);c=e.fitToBounds(c,0,1);if(b>c){var d=b;b=c;c=d}var d=1/this.maxZoomFactor,g=e.getDecimals(d)+4;c-b<d&&(c=b+(c-b)/2,b=c-d/2,c+=d/2,1<c&&(b-=c-1,c=1));b=e.roundTo(b,g);c=e.roundTo(c,g);d=!1;if(a){for(g=0;g<a.length;g++){var h=a[g].<API key>(b,c,!0);h&&(d=h)}this.showZB()}return d},addChartCursor:function(a){e.callMethod("destroy",[this.chartCursor]);
a&&(this.listenTo(a,"moved",this.handleCursorMove),this.listenTo(a,"zoomed",this.handleCursorZoom),this.listenTo(a,"zoomStarted",this.<API key>),this.listenTo(a,"panning",this.handleCursorPanning),this.listenTo(a,"onHideCursor",this.handleCursorHide));this.chartCursor=a},handleCursorChange:function(){},handleCursorMove:function(a){var b,c=this.valueAxes;for(b=0;b<c.length;b++)if(!a.panning){var d=c[b];d&&d.showBalloon&&d.showBalloon(a.x,a.y)}},handleCursorZoom:function(a){if(this.skipZoomed)this.skipZoomed=
!1;else{var b=this.startX0,c=this.endX0,d=this.endY0,e=this.startY0,h=a.startX,f=a.endX,k=a.startY,m=a.endY;this.startX0=this.endX0=this.startY0=this.endY0=NaN;this.<API key>(b+h*(c-b),b+f*(c-b),e+k*(d-e),e+m*(d-e),a)}},handleCursorHide:function(){var a,b=this.valueAxes;for(a=0;a<b.length;a++)b[a].hideBalloon();b=this.graphs;for(a=0;a<b.length;a++)b[a].hideBalloonReal()}})})();(function(){var e=window.AmCharts;e.AmXYChart=e.Class({inherits:e.AmRectangularChart,construct:function(a){this.type="xy";e.AmXYChart.base.construct.call(this,a);this.cname="AmXYChart";this.theme=a;this.createEvents("zoomed");e.applyTheme(this,a,this.cname)},initChart:function(){e.AmXYChart.base.initChart.call(this);this.dataChanged&&this.updateData();this.drawChart();!this.marginsUpdated&&this.autoMargins&&(this.marginsUpdated=!0,this.measureMargins());var a=this.marginLeftReal,b=this.marginTopReal,
c=this.plotAreaWidth,d=this.plotAreaHeight;this.graphsSet.clipRect(a,b,c,d);this.bulletSet.clipRect(a,b,c,d);this.trendLinesSet.clipRect(a,b,c,d);this.drawGraphs=!0;this.showZB()},prepareForExport:function(){var a=this.bulletSet;a.clipPath&&this.container.remove(a.clipPath)},createValueAxes:function(){var a=[],b=[];this.xAxes=a;this.yAxes=b;var c=this.valueAxes,d,g;for(g=0;g<c.length;g++){d=c[g];var h=d.position;if("top"==h||"bottom"==h)d.rotate=!0;d.setOrientation(d.rotate);h=d.orientation;"V"==
h&&b.push(d);"H"==h&&a.push(d)}0===b.length&&(d=new e.ValueAxis(this.theme),d.rotate=!1,d.setOrientation(!1),c.push(d),b.push(d));0===a.length&&(d=new e.ValueAxis(this.theme),d.rotate=!0,d.setOrientation(!0),c.push(d),a.push(d));for(g=0;g<c.length;g++)this.processValueAxis(c[g],g);a=this.graphs;for(g=0;g<a.length;g++)this.processGraph(a[g],g)},drawChart:function(){e.AmXYChart.base.drawChart.call(this);var a=this.chartData;this.legend&&(this.legend.valueText=void 0);if(0<this.realWidth&&0<this.realHeight){e.ifArray(a)?
(this.chartScrollbar&&this.updateScrollbars(),this.zoomChart()):this.cleanChart();if(a=this.scrollbarH)this.hideXScrollbar?(a&&a.destroy(),this.scrollbarH=null):a.draw();if(a=this.scrollbarV)this.hideYScrollbar?(a.destroy(),this.scrollbarV=null):a.draw();this.zoomScrollbar()}this.autoMargins&&!this.marginsUpdated||this.dispDUpd()},cleanChart:function(){e.callMethod("destroy",[this.valueAxes,this.graphs,this.scrollbarV,this.scrollbarH,this.chartCursor])},zoomChart:function(){this.zoomObjects(this.valueAxes);
this.zoomObjects(this.graphs);this.zoomTrendLines();this.prevPlotAreaWidth=this.plotAreaWidth;this.prevPlotAreaHeight=this.plotAreaHeight},validateData:function(){if(this.zoomOutOnDataUpdate)for(var a=this.valueAxes,b=0;b<a.length;b++)a[b].minZoom=NaN,a[b].maxZoom=NaN;e.AmXYChart.base.validateData.call(this)},zoomObjects:function(a){var b=a.length,c,d;for(c=0;c<b;c++)d=a[c],d.zoom(0,this.chartData.length-1)},updateData:function(){this.parseData();var a=this.chartData,b=a.length-1,c=this.graphs,d=
this.dataProvider,e=-Infinity,h=Infinity,f,k;if(d){for(f=0;f<c.length;f++)if(k=c[f],k.data=a,k.zoom(0,b),k=k.valueField){var m;for(m=0;m<d.length;m++){var l=Number(d[m][k]);null!==l&&(l>e&&(e=l),l<h&&(h=l))}}isNaN(this.minValue)||(h=this.minValue);isNaN(this.maxValue)||(e=this.maxValue);for(f=0;f<c.length;f++)k=c[f],k.maxValue=e,k.minValue=h;if(a=this.chartCursor)a.type="crosshair",a.<API key>=!1;this.dataChanged=!1;this.dispatchDataUpdated=!0}},processValueAxis:function(a){a.chart=this;
a.minMaxField="H"==a.orientation?"x":"y";a.min=NaN;a.max=NaN},processGraph:function(a){e.isString(a.xAxis)&&(a.xAxis=this.getValueAxisById(a.xAxis));e.isString(a.yAxis)&&(a.yAxis=this.getValueAxisById(a.yAxis));a.xAxis||(a.xAxis=this.xAxes[0]);a.yAxis||(a.yAxis=this.yAxes[0]);a.valueAxis=a.yAxis},parseData:function(){e.AmXYChart.base.parseData.call(this);this.chartData=[];var a=this.dataProvider,b=this.valueAxes,c=this.graphs,d;if(a)for(d=0;d<a.length;d++){var g={axes:{},x:{},y:{}},h=this.dataDateFormat,
f=a[d],k;for(k=0;k<b.length;k++){var m=b[k].id;g.axes[m]={};g.axes[m].graphs={};var l;for(l=0;l<c.length;l++){var p=c[l],q=p.id;if(p.xAxis.id==m||p.yAxis.id==m){var r={};r.serialDataItem=g;r.index=d;var t={},n=f[p.valueField];null!==n&&(n=Number(n),isNaN(n)||(t.value=n));n=f[p.xField];null!==n&&("date"==p.xAxis.type&&(n=e.getDate(f[p.xField],h).getTime()),n=Number(n),isNaN(n)||(t.x=n));n=f[p.yField];null!==n&&("date"==p.yAxis.type&&(n=e.getDate(f[p.yField],h).getTime()),n=Number(n),isNaN(n)||(t.y=
n));n=f[p.errorField];null!==n&&(n=Number(n),isNaN(n)||(t.error=n));r.values=t;this.processFields(p,r,f);r.serialDataItem=g;r.graph=p;g.axes[m].graphs[q]=r}}}this.chartData[d]=g}this.start=0;this.end=this.chartData.length-1},formatString:function(a,b,c){var d=b.graph,g=d.numberFormatter;g||(g=this.nf);var h,f;"date"==b.graph.xAxis.type&&(h=e.formatDate(new Date(b.values.x),d.dateFormat,this),f=RegExp("\\[\\[x\\]\\]","g"),a=a.replace(f,h));"date"==b.graph.yAxis.type&&(h=e.formatDate(new Date(b.values.y),
d.dateFormat,this),f=RegExp("\\[\\[y\\]\\]","g"),a=a.replace(f,h));a=e.formatValue(a,b.values,["value","x","y"],g);-1!=a.indexOf("[[")&&(a=e.<API key>(a,b.dataContext));return a=e.AmXYChart.base.formatString.call(this,a,b,c)},addChartScrollbar:function(a){e.callMethod("destroy",[this.chartScrollbar,this.scrollbarH,this.scrollbarV]);if(a){this.chartScrollbar=a;this.scrollbarHeight=a.scrollbarHeight;var b="backgroundColor backgroundAlpha <API key> <API key> scrollDuration resizeEnabled hideResizeGrips scrollbarHeight updateOnReleaseOnly".split(" ");
if(!this.hideYScrollbar){var c=new e.ChartScrollbar(this.theme);c.skipEvent=!0;c.chart=this;this.listenTo(c,"zoomed",this.<API key>);e.copyProperties(a,c,b);c.rotate=!0;this.scrollbarV=c}this.hideXScrollbar||(c=new e.ChartScrollbar(this.theme),c.skipEvent=!0,c.chart=this,this.listenTo(c,"zoomed",this.<API key>),e.copyProperties(a,c,b),c.rotate=!1,this.scrollbarH=c)}},updateTrendLines:function(){var a=this.trendLines,b;for(b=0;b<a.length;b++){var c=a[b],c=e.processObject(c,
e.TrendLine,this.theme);a[b]=c;c.chart=this;var d=c.valueAxis;e.isString(d)&&(c.valueAxis=this.getValueAxisById(d));d=c.valueAxisX;e.isString(d)&&(c.valueAxisX=this.getValueAxisById(d));c.id||(c.id="trendLineAuto"+b+"_"+(new Date).getTime());c.valueAxis||(c.valueAxis=this.yAxes[0]);c.valueAxisX||(c.valueAxisX=this.xAxes[0])}},updateMargins:function(){e.AmXYChart.base.updateMargins.call(this);var a=this.scrollbarV;a&&(this.<API key>(a,!0,this.yAxes[0].position),this.adjustMargins(a,!0));
if(a=this.scrollbarH)this.<API key>(a,!1,this.xAxes[0].position),this.adjustMargins(a,!1)},updateScrollbars:function(){e.AmXYChart.base.updateScrollbars.call(this);var a=this.scrollbarV;a&&(this.<API key>(a,!0),a.valueAxes=this.yAxes,a.gridAxis||(a.gridAxis=this.yAxes[0]));if(a=this.scrollbarH)this.<API key>(a,!1),a.valueAxes=this.xAxes,a.gridAxis||(a.gridAxis=this.xAxes[0])},<API key>:function(){e.callMethod("destroy",[this.scrollbarH,this.scrollbarV]);
this.scrollbarV=this.scrollbarH=null},<API key>:function(a){e.AmXYChart.base.<API key>.call(this,a);e.callMethod("<API key>",[this.scrollbarH,this.scrollbarV])},update:function(){e.AmXYChart.base.update.call(this);this.scrollbarH&&this.scrollbarH.update&&this.scrollbarH.update();this.scrollbarV&&this.scrollbarV.update&&this.scrollbarV.update()},zoomScrollbar:function(){this.zoomValueScrollbar(this.scrollbarV);this.zoomValueScrollbar(this.scrollbarH)},<API key>:function(a,
b,c,d){isNaN(a)||isNaN(b)||this.<API key>(this.xAxes,a,b);isNaN(c)||isNaN(d)||this.<API key>(this.yAxes,c,d);this.<API key>()},<API key>:function(){if(this.xAxes){var a=this.xAxes[0];this.startX0=a.relativeStart;this.endX0=a.relativeEnd;a.reversed&&(this.startX0=1-a.relativeEnd,this.endX0=1-a.relativeStart)}this.yAxes&&(a=this.yAxes[0],this.startY0=a.relativeStart,this.endY0=a.relativeEnd,a.reversed&&(this.startY0=1-a.relativeEnd,this.endY0=1-a.relativeStart))},
updateChartCursor:function(){e.AmXYChart.base.updateChartCursor.call(this);var a=this.chartCursor;if(a){a.valueLineEnabled=!0;a.categoryLineAxis||(a.categoryLineAxis=this.xAxes[0]);var b=this.valueAxis;if(a.<API key>){var c=a.<API key>,d=a.<API key>,g=a.color;void 0===d&&(d=a.cursorColor);for(var h=0;h<this.valueAxes.length;h++){var b=this.valueAxes[h],f=b.balloon;f||(f={});f=e.extend(f,this.balloon,!0);f.fillColor=d;f.balloonColor=d;f.fillAlpha=c;f.borderColor=
d;f.color=g;b.balloon=f}}else for(c=0;c<this.valueAxes.length;c++)b=this.valueAxes[c],b.balloon&&(b.balloon=null);a.zoomable&&(this.hideYScrollbar||(a.vZoomEnabled=!0),this.hideXScrollbar||(a.hZoomEnabled=!0))}},handleCursorPanning:function(a){var b=a.deltaX,c=a.delta2X,d;isNaN(c)&&(c=b,d=!0);var g=this.endX0,h=this.startX0,f=g-h,c=g-f*c,g=f;d||(g=0);b=e.fitToBounds(h-f*b,0,1-g);c=e.fitToBounds(c,g,1);this.<API key>(this.xAxes,b,c);f=a.deltaY;a=a.delta2Y;isNaN(a)&&(a=f,d=!0);c=this.endY0;
b=this.startY0;h=c-b;f=c+h*f;c=h;d||(c=0);d=e.fitToBounds(b+h*a,0,1-c);f=e.fitToBounds(f,c,1);this.<API key>(this.yAxes,d,f);this.<API key>()},handleValueAxisZoom:function(a){this.<API key>(a,"V"==a.valueAxis.orientation?this.yAxes:this.xAxes)},showZB:function(){var a,b=this.valueAxes;if(b)for(var c=0;c<b.length;c++){var d=b[c];0!==d.relativeStart&&(a=!0);1!=d.relativeEnd&&(a=!0)}e.AmXYChart.base.showZB.call(this,a)}})})();
|
#pragma once
#include "../dxgi/Enums.h"
#include "Enums11.h"
namespace SlimDX
{
namespace Direct3D11
{
<summary>
Contains the description of the contents of an image file.
</summary>
<unmanaged><API key></unmanaged>
[System::Runtime::InteropServices::StructLayout( System::Runtime::InteropServices::LayoutKind::Sequential )]
public value class <API key> : System::IEquatable<<API key>>
{
private:
int m_Width;
int m_Height;
int m_Depth;
int m_FirstMipLevel;
int m_MipLevels;
ResourceUsage m_Usage;
BindFlags m_BindFlags;
CpuAccessFlags m_CPUAccessFlags;
ResourceOptionFlags m_MiscFlags;
DXGI::Format m_Format;
FilterFlags m_Filter;
FilterFlags m_MipFilter;
internal:
<API key>( const <API key>& native );
<API key> CreateNativeVersion();
public:
<summary>
Initializes a new instance of the <see cref="<API key>"/> struct using default values.
</summary>
<returns>The default image load information.</returns>
static <API key> FromDefaults();
<summary>
The default value for load options.
</summary>
property static int FileDefaultValue
{
int get();
}
<summary>
Width of the original image, in pixels.
</summary>
property int Width
{
int get();
void set( int value );
}
<summary>
Height of the original image, in pixels.
</summary>
property int Height
{
int get();
void set( int value );
}
<summary>
Depth of the original image, in pixels.
</summary>
property int Depth
{
int get();
void set( int value );
}
<summary>
The highest resolution mipmap level of the texture; if greater than zero,
this mipmap level will be mapped to level 0 in the loaded texture.
</summary>
property int FirstMipLevel
{
int get();
void set( int value );
}
<summary>
Number of mipmap levels in the original image.
</summary>
property int MipLevels
{
int get();
void set( int value );
}
<summary>
Gets or sets the intended usage pattern of the loaded texture.
</summary>
property ResourceUsage Usage
{
ResourceUsage get();
void set( ResourceUsage value );
}
<summary>
Gets or sets the flags specifying how the loaded texture is bound to the pipeline.
</summary>
property Direct3D11::BindFlags BindFlags
{
Direct3D11::BindFlags get();
void set( Direct3D11::BindFlags value );
}
<summary>
Gets or sets the flags specifying how the CPU will be allowed to access the loaded texture.
</summary>
property Direct3D11::CpuAccessFlags CpuAccessFlags
{
Direct3D11::CpuAccessFlags get();
void set( Direct3D11::CpuAccessFlags value );
}
<summary>
Gets or sets the flags specifying miscellaneous resource options.
</summary>
property ResourceOptionFlags OptionFlags
{
ResourceOptionFlags get();
void set( ResourceOptionFlags value );
}
<summary>
The format of the loaded texture.
</summary>
property DXGI::Format Format
{
DXGI::Format get();
void set( DXGI::Format value );
}
<summary>
The filter used when resampling the texture.
</summary>
property Direct3D11::FilterFlags FilterFlags
{
Direct3D11::FilterFlags get();
void set( Direct3D11::FilterFlags value );
}
<summary>
The filter used when resampling mipmap levels of the texture.
</summary>
property Direct3D11::FilterFlags MipFilterFlags
{
Direct3D11::FilterFlags get();
void set( Direct3D11::FilterFlags value );
}
<summary>
Tests for equality between two objects.
</summary>
<param name="left">The first value to compare.</param>
<param name="right">The second value to compare.</param>
<returns><c>true</c> if <paramref name="left"/> has the same value as <paramref name="right"/>; otherwise, <c>false</c>.</returns>
static bool operator == ( <API key> left, <API key> right );
<summary>
Tests for inequality between two objects.
</summary>
<param name="left">The first value to compare.</param>
<param name="right">The second value to compare.</param>
<returns><c>true</c> if <paramref name="left"/> has a different value than <paramref name="right"/>; otherwise, <c>false</c>.</returns>
static bool operator != ( <API key> left, <API key> right );
<summary>
Returns the hash code for this instance.
</summary>
<returns>A 32-bit signed integer hash code.</returns>
virtual int GetHashCode() override;
<summary>
Returns a value that indicates whether the current instance is equal to a specified object.
</summary>
<param name="obj">Object to make the comparison with.</param>
<returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>
virtual bool Equals( System::Object^ obj ) override;
<summary>
Returns a value that indicates whether the current instance is equal to the specified object.
</summary>
<param name="other">Object to make the comparison with.</param>
<returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>
virtual bool Equals( <API key> other );
<summary>
Determines whether the specified object instances are considered equal.
</summary>
<param name="value1">The first value to compare.</param>
<param name="value2">The second value to compare.</param>
<returns><c>true</c> if <paramref name="value1"/> is the same instance as <paramref name="value2"/> or
if both are <c>null</c> references or if <c>value1.Equals(value2)</c> returns <c>true</c>; otherwise, <c>false</c>.</returns>
static bool Equals( <API key>% value1, <API key>% value2 );
};
}
}
|
package build.tools.jdwpgen;
import java.util.*;
import java.io.*;
class AltNode extends AbstractGroupNode implements TypeNode {
SelectNode select = null;
void constrain(Context ctx) {
super.constrain(ctx);
if (!(nameNode instanceof NameValueNode)) {
error("Alt name must have value: " + nameNode);
}
if (parent instanceof SelectNode) {
select = (SelectNode)parent;
} else {
error("Alt must be in Select");
}
}
void document(PrintWriter writer) {
docRowStart(writer);
writer.println("<td colspan=" +
(maxStructIndent - structIndent + 1) + ">");
writer.println("Case " + nameNode.name + " - if <i>" +
((SelectNode)parent).typeNode.name +
"</i> is " + nameNode.value() + ":");
writer.println("<td>" + comment() + " ");
++structIndent;
super.document(writer);
--structIndent;
}
String javaClassImplements() {
return " extends " + select.commonBaseClass();
}
void <API key>(PrintWriter writer, int depth) {
indent(writer, depth);
writer.print("static final " + select.typeNode.javaType());
writer.println(" ALT_ID = " + nameNode.value() + ";");
if (context.isWritingCommand()) {
genJavaCreateMethod(writer, depth);
} else {
indent(writer, depth);
writer.println(select.typeNode.javaParam() + "() {");
indent(writer, depth+1);
writer.println("return ALT_ID;");
indent(writer, depth);
writer.println("}");
}
super.<API key>(writer, depth);
}
void genJavaWriteMethod(PrintWriter writer, int depth) {
genJavaWriteMethod(writer, depth, "");
}
void <API key>(PrintWriter writer, int depth, String common) {
indent(writer, depth);
writer.println("case " + nameNode.value() + ":");
indent(writer, depth+1);
writer.println(common + " = new " + name + "(vm, ps);");
indent(writer, depth+1);
writer.println("break;");
}
void genJavaCreateMethod(PrintWriter writer, int depth) {
indent(writer, depth);
writer.print("static " + select.name() + " create(");
writer.print(javaParams());
writer.println(") {");
indent(writer, depth+1);
writer.print("return new " + select.name() + "(");
writer.print("ALT_ID, new " + javaClassName() + "(");
for (Iterator it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next();
writer.print(tn.name());
if (it.hasNext()) {
writer.print(", ");
}
}
writer.println("));");
indent(writer, depth);
writer.println("}");
}
}
|
#include "DRMEncoder.h"
#include <cstring>
#include <errno.h>
#include <stdexcept>
#include <string>
using namespace KODI::WINDOWING::GBM;
CDRMEncoder::CDRMEncoder(int fd, uint32_t encoder)
: CDRMObject(fd), m_encoder(drmModeGetEncoder(m_fd, encoder))
{
if (!m_encoder)
throw std::runtime_error("drmModeGetEncoder failed: " + std::string{strerror(errno)});
}
|
#pragma once
#include "IDirectory.h"
#include "addons/AddonManager.h"
class CURL;
typedef std::shared_ptr<CFileItem> CFileItemPtr;
namespace XFILE
{
/*!
\ingroup windows
\brief Get access to shares and it's directories.
*/
class CAddonsDirectory : public IDirectory
{
public:
CAddonsDirectory(void);
~CAddonsDirectory(void) override;
bool GetDirectory(const CURL& url, CFileItemList &items) override;
bool Create(const CURL& url) override { return true; }
bool Exists(const CURL& url) override { return true; }
bool AllowAll() const override { return true; }
/*! \brief Fetch script and plugin addons of a given content type
\param content the content type to fetch
\param addons the list of addons to fill with scripts and plugin content
\return true if content is valid, false if it's invalid.
*/
static bool <API key>(const std::string &content, ADDON::VECADDONS &addons);
/*! \brief Fetch scripts and plugins of a given content type
\param content the content type to fetch
\param items the list to fill with scripts and content
\return true if more than one item is found, false otherwise.
*/
static bool <API key>(const std::string &content, CFileItemList &items);
static void <API key>(const CURL &path, const ADDON::VECADDONS& addons, CFileItemList &items, const std::string label);
static CFileItemPtr FileItemFromAddon(const ADDON::AddonPtr &addon, const std::string& path, bool folder = false);
/*! \brief Returns true if `path` is a path or subpath of the repository directory, otherwise false */
static bool IsRepoDirectory(const CURL& path);
private:
bool GetSearchResults(const CURL& path, CFileItemList &items);
};
}
|
# This file is part of Canvas.
# Canvas is free software: you can redistribute it and/or modify it under
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# details.
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
require 'db/migrate/<API key>'
describe '<API key>' do
before do
@migration = <API key>.new
@migration.down
end
it "should find duplicates" do
c1 = course_model
feeds = 3.times.map { external_feed_model({}, false) }
feeds.each{ |f| f.save(validate: false) }
feeds[2].update_attribute(:url, "http://<API key>.com")
c2 = course_model
feeds << external_feed_model
expect(ExternalFeed.where(id: feeds).count).to eq 4
@migration.up
expect(ExternalFeed.where(id: [feeds[0], feeds[2], feeds[3]]).count).to eq 3
expect(ExternalFeed.where(id: feeds[1]).count).to eq 0
end
it "should cleanup associated entries and announcements of duplicates" do
course_with_teacher
@context = @course
feeds = 2.times.map { external_feed_model({}, false) }
feeds.each{ |f| f.save(validate: false) }
entries = feeds.map do |feed|
feed.<API key>.create!(
:user => @teacher,
:title => 'blah',
:message => 'blah',
:workflow_state => :active
)
end
announcements = feeds.map do |feed|
a = announcement_model
a.update_attribute(:external_feed_id, feed.id)
a
end
@migration.up
expect(ExternalFeed.where(id: feeds[0]).count).to eq 1
expect(ExternalFeedEntry.where(id: entries[0]).count).to eq 1
expect(announcements[0].reload.external_feed_id).to eq feeds[0].id
expect(ExternalFeed.where(id: feeds[1]).count).to eq 0
expect(ExternalFeedEntry.where(id: entries[1]).count).to eq 0
expect(announcements[1].reload.external_feed_id).to eq feeds[0].id
end
it "sets a default for any NULL verbosity field" do
course = course_model
feed = external_feed_model
ExternalFeed.where(id: feed).update_all(verbosity: nil)
@migration.up
expect(feed.reload.verbosity).to eq 'full'
end
end
|
#include "test_db_base.h"
#include <cppcms/json.h>
test_db_base::test_db_base(cppcms::service &srv) : cppcms::application(srv) {
db_connection_str = settings().get<std::string>("app.<API key>");
}
void test_db_base::init() {
sql.open(db_connection_str);
}
void test_db_base::clear() {
sql.close();
}
|
<?php
/*
* Autoloader and dependency injection initialization for Swift Mailer.
*/
//Load Swift utility class
require_once dirname(__FILE__) . '/Swift.php';
//Start the autoloader
Swift::registerAutoload();
//Load the init script to set up dependency injection
require_once dirname(__FILE__) . '/swift_init.php';
|
using System;
namespace fizz_buzz
{
class Program
{
static void Main(string[] args)
{
for (int i = 1; i < 101; i++)
{
if (i % 3 < 1)
Console.Write("fizz");
if (i % 5 < 1)
Console.Write("buzz");
if (i % 3 > 0 && i % 5 > 0)
Console.Write("{0}", i);
Console.WriteLine("");
}
}
}
}
|
# config.rb
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
# included in all copies or substantial portions of the Software.
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# LIABLE FOR 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.
module TMail
class Config
def initialize( strict )
@strict_parse = strict
@strict_base64decode = strict
end
def strict_parse?
@strict_parse
end
attr_writer :strict_parse
def strict_base64decode?
@strict_base64decode
end
attr_writer :strict_base64decode
def new_body_port( mail )
StringPort.new
end
alias new_preamble_port new_body_port
alias new_part_port new_body_port
end
DEFAULT_CONFIG = Config.new(false)
<API key> = Config.new(true)
def Config.to_config( arg )
return <API key> if arg == true
return DEFAULT_CONFIG if arg == false
arg or DEFAULT_CONFIG
end
end
|
require "rack/chunked"
module ActionController #:nodoc:
# Allows views to be streamed back to the client as they are rendered.
# By default, Rails renders views by first rendering the template
# and then the layout. The response is sent to the client after the whole
# template is rendered, all queries are made, and the layout is processed.
# Streaming inverts the rendering flow by rendering the layout first and
# streaming each part of the layout as they are processed. This allows the
# header of the HTML (which is usually in the layout) to be streamed back
# to client very quickly, allowing JavaScripts and stylesheets to be loaded
# earlier than usual.
# This approach was introduced in Rails 3.1 and is still improving. Several
# Rack middlewares may not work and you need to be careful when streaming.
# Those points are going to be addressed soon.
# In order to use streaming, you will need to use a Ruby version that
# supports fibers (fibers are supported since version 1.9.2 of the main
# Ruby implementation).
# Streaming can be added to a given template easily, all you need to do is
# to pass the :stream option.
# class PostsController
# def index
# @posts = Post.all
# render stream: true
# end
# end
# == When to use streaming
# Streaming may be considered to be overkill for lightweight actions like
# +new+ or +edit+. The real benefit of streaming is on expensive actions
# that, for example, do a lot of queries on the database.
# In such actions, you want to delay queries execution as much as you can.
# For example, imagine the following +dashboard+ action:
# def dashboard
# @posts = Post.all
# @pages = Page.all
# @articles = Article.all
# end
# Most of the queries here are happening in the controller. In order to benefit
# from streaming you would want to rewrite it as:
# def dashboard
# # Allow lazy execution of the queries
# @posts = Post.all
# @pages = Page.all
# @articles = Article.all
# render stream: true
# end
# Notice that :stream only works with templates. Rendering :json
# or :xml with :stream won't work.
# == Communication between layout and template
# When streaming, rendering happens top-down instead of inside-out.
# Rails starts with the layout, and the template is rendered later,
# when its +yield+ is reached.
# This means that, if your application currently relies on instance
# variables set in the template to be used in the layout, they won't
# work once you move to streaming. The proper way to communicate
# between layout and template, regardless of whether you use streaming
# or not, is by using +content_for+, +provide+ and +yield+.
# Take a simple example where the layout expects the template to tell
# which title to use:
# <html>
# <head><title><%= yield :title %></title></head>
# <body><%= yield %></body>
# </html>
# You would use +content_for+ in your template to specify the title:
# <%= content_for :title, "Main" %>
# Hello
# And the final result would be:
# <html>
# <head><title>Main</title></head>
# <body>Hello</body>
# </html>
# However, if +content_for+ is called several times, the final result
# would have all calls concatenated. For instance, if we have the following
# template:
# <%= content_for :title, "Main" %>
# Hello
# <%= content_for :title, " page" %>
# The final result would be:
# <html>
# <head><title>Main page</title></head>
# <body>Hello</body>
# </html>
# This means that, if you have <code>yield :title</code> in your layout
# and you want to use streaming, you would have to render the whole template
# (and eventually trigger all queries) before streaming the title and all
# assets, which kills the purpose of streaming. For this purpose, you can use
# a helper called +provide+ that does the same as +content_for+ but tells the
# layout to stop searching for other entries and continue rendering.
# For instance, the template above using +provide+ would be:
# <%= provide :title, "Main" %>
# Hello
# <%= content_for :title, " page" %>
# Giving:
# <html>
# <head><title>Main</title></head>
# <body>Hello</body>
# </html>
# That said, when streaming, you need to properly check your templates
# and choose when to use +provide+ and +content_for+.
# == Headers, cookies, session and flash
# When streaming, the HTTP headers are sent to the client right before
# it renders the first line. This means that, modifying headers, cookies,
# session or flash after the template starts rendering will not propagate
# to the client.
# == Middlewares
# Middlewares that need to manipulate the body won't work with streaming.
# You should disable those middlewares whenever streaming in development
# or production. For instance, <tt>Rack::Bug</tt> won't work when streaming as it
# needs to inject contents in the HTML body.
# Also <tt>Rack::Cache</tt> won't work with streaming as it does not support
# streaming bodies yet. Whenever streaming Cache-Control is automatically
# set to "no-cache".
# == Errors
# When it comes to streaming, exceptions get a bit more complicated. This
# happens because part of the template was already rendered and streamed to
# the client, making it impossible to render a whole exception page.
# Currently, when an exception happens in development or production, Rails
# will automatically stream to the client:
# "><script>window.location = "/500.html"</script></html>
# The first two characters (">) are required in case the exception happens
# while rendering attributes for a given tag. You can check the real cause
# for the exception in your logger.
# == Web server support
# Not all web servers support streaming out-of-the-box. You need to check
# the instructions for each of them.
# Unicorn supports streaming but it needs to be configured. For this, you
# need to create a config file as follow:
# # unicorn.config.rb
# listen 3000, tcp_nopush: false
# And use it on initialization:
# unicorn_rails --config-file unicorn.config.rb
# You may also want to configure other parameters like <tt>:tcp_nodelay</tt>.
# If you are using Unicorn with NGINX, you may need to tweak NGINX.
# Streaming should work out of the box on Rainbows.
# To be described.
module Streaming
extend ActiveSupport::Concern
private
# Set proper cache control and transfer encoding when streaming
def _process_options(options)
super
if options[:stream]
if request.version == "HTTP/1.0"
options.delete(:stream)
else
headers["Cache-Control"] ||= "no-cache"
headers["Transfer-Encoding"] = "chunked"
headers.delete("Content-Length")
end
end
end
# Call render_body if we are streaming instead of usual +render+.
def _render_template(options)
if options.delete(:stream)
Rack::Chunked::Body.new view_renderer.render_body(view_context, options)
else
super
end
end
end
end
|
using System.Buffers;
using System.Collections;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace System
{
public static partial class Environment
{
private static string? <API key>(string variable)
{
Span<char> buffer = stackalloc char[128]; // a somewhat reasonable default size
int requiredSize = Interop.Kernel32.<API key>(variable, buffer);
if (requiredSize == 0 && Marshal.GetLastWin32Error() == Interop.Errors.<API key>)
{
return null;
}
if (requiredSize <= buffer.Length)
{
return new string(buffer.Slice(0, requiredSize));
}
char[] chars = ArrayPool<char>.Shared.Rent(requiredSize);
try
{
buffer = chars;
requiredSize = Interop.Kernel32.<API key>(variable, buffer);
if ((requiredSize == 0 && Marshal.GetLastWin32Error() == Interop.Errors.<API key>) ||
requiredSize > buffer.Length)
{
return null;
}
return new string(buffer.Slice(0, requiredSize));
}
finally
{
ArrayPool<char>.Shared.Return(chars);
}
}
private static void <API key>(string variable, string? value)
{
if (!Interop.Kernel32.<API key>(variable, value))
{
int errorCode = Marshal.GetLastWin32Error();
switch (errorCode)
{
case Interop.Errors.<API key>:
// Allow user to try to clear a environment variable
return;
case Interop.Errors.<API key>:
// The error message from Win32 is "The filename or extension is too long",
// which is not accurate.
throw new ArgumentException(SR.<API key>);
case Interop.Errors.<API key>:
case Interop.Errors.<API key>:
throw new <API key>(Interop.Kernel32.GetMessage(errorCode));
default:
throw new ArgumentException(Interop.Kernel32.GetMessage(errorCode));
}
}
}
public static unsafe IDictionary <API key>()
{
char* pStrings = Interop.Kernel32.<API key>();
if (pStrings == null)
{
throw new <API key>();
}
try
{
// Format for <API key> is:
// [=HiddenVar=value\0]* [Variable=value\0]* \0
// See the description of Environment Blocks in MSDN's
// CreateProcess page (null-terminated array of null-terminated strings).
// Search for terminating \0\0 (two unicode \0's).
char* p = pStrings;
while (!(*p == '\0' && *(p + 1) == '\0'))
{
p++;
}
Span<char> block = new Span<char>(pStrings, (int)(p - pStrings + 1));
// Format for <API key> is:
// (=HiddenVar=value\0 | Variable=value\0)* \0
// See the description of Environment Blocks in MSDN's
// CreateProcess page (null-terminated array of null-terminated strings).
// Note the =HiddenVar's aren't always at the beginning.
// Copy strings out, parsing into pairs and inserting into the table.
// The first few environment variable entries start with an '='.
// The current working directory of every drive (except for those drives
// you haven't cd'ed into in your DOS window) are stored in the
// environment block (as =C:=pwd) and the program's exit code is
// as well (=ExitCode=00000000).
var results = new Hashtable();
for (int i = 0; i < block.Length; i++)
{
int startKey = i;
// Skip to key. On some old OS, the environment block can be corrupted.
// Some will not have '=', so we need to check for '\0'.
while (block[i] != '=' && block[i] != '\0')
{
i++;
}
if (block[i] == '\0')
{
continue;
}
// Skip over environment variables starting with '='
if (i - startKey == 0)
{
while (block[i] != 0)
{
i++;
}
continue;
}
string key = new string(block.Slice(startKey, i - startKey));
i++; // skip over '='
int startValue = i;
while (block[i] != 0)
{
i++; // Read to end of this entry
}
string value = new string(block.Slice(startValue, i - startValue)); // skip over 0 handled by for loop's i++
try
{
results.Add(key, value);
}
catch (ArgumentException)
{
// Throw and catch intentionally to provide non-fatal notification about corrupted environment block
}
}
return results;
}
finally
{
bool success = Interop.Kernel32.<API key>(pStrings);
Debug.Assert(success);
}
}
}
}
|
export { Moon16 as default } from "../../";
|
/* area_2d.h */
/* This file is part of: */
/* GODOT ENGINE */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* included in all copies or substantial portions of the Software. */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* 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. */
#ifndef AREA_2D_H
#define AREA_2D_H
#include "scene/2d/collision_object_2d.h"
#include "vset.h"
class Area2D : public CollisionObject2D {
OBJ_TYPE( Area2D, CollisionObject2D );
public:
enum SpaceOverride {
<API key>,
<API key>,
<API key>,
<API key>,
<API key>
};
private:
SpaceOverride space_override;
Vector2 gravity_vec;
real_t gravity;
bool gravity_is_point;
real_t <API key>;
real_t linear_damp;
real_t angular_damp;
uint32_t collision_mask;
uint32_t layer_mask;
int priority;
bool monitoring;
bool monitorable;
bool locked;
void _body_inout(int p_status,const RID& p_body, int p_instance, int p_body_shape,int p_area_shape);
void _body_enter_tree(ObjectID p_id);
void _body_exit_tree(ObjectID p_id);
struct ShapePair {
int body_shape;
int area_shape;
bool operator<(const ShapePair& p_sp) const {
if (body_shape==p_sp.body_shape)
return area_shape < p_sp.area_shape;
else
return body_shape < p_sp.body_shape;
}
ShapePair() {}
ShapePair(int p_bs, int p_as) { body_shape=p_bs; area_shape=p_as; }
};
struct BodyState {
int rc;
bool in_tree;
VSet<ShapePair> shapes;
};
Map<ObjectID,BodyState> body_map;
void _area_inout(int p_status,const RID& p_area, int p_instance, int p_area_shape,int p_self_shape);
void _area_enter_tree(ObjectID p_id);
void _area_exit_tree(ObjectID p_id);
struct AreaShapePair {
int area_shape;
int self_shape;
bool operator<(const AreaShapePair& p_sp) const {
if (area_shape==p_sp.area_shape)
return self_shape < p_sp.self_shape;
else
return area_shape < p_sp.area_shape;
}
AreaShapePair() {}
AreaShapePair(int p_bs, int p_as) { area_shape=p_bs; self_shape=p_as; }
};
struct AreaState {
int rc;
bool in_tree;
VSet<AreaShapePair> shapes;
};
Map<ObjectID,AreaState> area_map;
void _clear_monitoring();
protected:
void _notification(int p_what);
static void _bind_methods();
public:
void <API key>(SpaceOverride p_mode);
SpaceOverride <API key>() const;
void <API key>(bool p_enabled);
bool is_gravity_a_point() const;
void <API key>(real_t p_scale);
real_t <API key>() const;
void set_gravity_vector(const Vector2& p_vec);
Vector2 get_gravity_vector() const;
void set_gravity(real_t p_gravity);
real_t get_gravity() const;
void set_linear_damp(real_t p_linear_damp);
real_t get_linear_damp() const;
void set_angular_damp(real_t p_angular_damp);
real_t get_angular_damp() const;
void set_priority(real_t p_priority);
real_t get_priority() const;
void <API key>(bool p_enable);
bool <API key>() const;
void set_monitorable(bool p_enable);
bool is_monitorable() const;
void set_collision_mask(uint32_t p_mask);
uint32_t get_collision_mask() const;
void set_layer_mask(uint32_t p_mask);
uint32_t get_layer_mask() const;
void <API key>(int p_bit, bool p_value);
bool <API key>(int p_bit) const;
void set_layer_mask_bit(int p_bit, bool p_value);
bool get_layer_mask_bit(int p_bit) const;
Array <API key>() const; //function for script
Array <API key>() const; //function for script
bool overlaps_area(Node* p_area) const;
bool overlaps_body(Node* p_body) const;
Area2D();
~Area2D();
};
VARIANT_ENUM_CAST(Area2D::SpaceOverride);
#endif // AREA_2D_H
|
export { Mpeg16 as default } from "../../";
|
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>RakNet: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">RakNet
 <span id="projectnumber">4.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.2 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespaceRakNet.html">RakNet</a></li><li class="navelem"><a class="el" href="<API key>.html">Clans_GrantLeader</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">RakNet::Clans_GrantLeader Member List</div> </div>
</div><!--header
<div class="contents">
<p>This is the complete list of members for <a class="el" href="<API key>.html">RakNet::Clans_GrantLeader</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">callbackId</a></td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">CallCallback</a>(Lobby2Callbacks *cb)=0</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">CancelOnDisconnect</a>(void) const </td><td class="entry"><a class="el" href="<API key>.html">RakNet::Clans_GrantLeader</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">ClientImpl</a>(RakNet::Lobby2Plugin *client)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">DebugMsg</a>(RakNet::RakString &out) const =0</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">DebugPrintf</a>(void) const </td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">extendedResultCode</a></td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">GetID</a>(void) const =0</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">GetName</a>(void) const =0</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">PrevalidateInput</a>(void)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Clans_GrantLeader</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">requestId</a></td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">RequiresAdmin</a>(void) const </td><td class="entry"><a class="el" href="<API key>.html">RakNet::Clans_GrantLeader</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">RequiresLogin</a>(void) const </td><td class="entry"><a class="el" href="<API key>.html">RakNet::Clans_GrantLeader</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>"><API key></a>(void) const </td><td class="entry"><a class="el" href="<API key>.html">RakNet::Clans_GrantLeader</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">resultCode</a></td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">Serialize</a>(bool writeToBitstream, bool serializeOutput, RakNet::BitStream *bitStream)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Clans_GrantLeader</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">ServerDBImpl</a>(Lobby2ServerCommand *command, void *databaseInterface)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>"><API key></a>(Lobby2Server *server, RakString userHandle)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>"><API key></a>(Lobby2Server *server, RakString userHandle)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">ValidateBinary</a>(RakNetSmartPtr< BinaryDataBlock >binaryDataBlock)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>"><API key></a>(RakNet::RakString *text)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>">ValidateHandle</a>(RakNet::RakString *handle)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="<API key>.html#<API key>">ValidatePassword</a>(RakNet::RakString *text)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="<API key>.html#<API key>"><API key></a>(RakNet::RakString *text)</td><td class="entry"><a class="el" href="<API key>.html">RakNet::Lobby2Message</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon Jun 2 2014 20:10:30 for RakNet by &
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.2
</small></address>
</body>
</html>
|
<?php
namespace Illuminate\Mail\Transport;
use Swift_Mime_Message;
use Illuminate\Support\Collection;
class ArrayTransport extends Transport
{
/**
* The collection of Swift Messages.
*
* @var \Illuminate\Support\Collection
*/
protected $messages;
/**
* Create a new array transport instance.
*
* @return void
*/
public function __construct()
{
$this->messages = new Collection;
}
/**
* {@inheritdoc}
*/
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{
$this->beforeSendPerformed($message);
$this->messages[] = $message;
return $this->numberOfRecipients($message);
}
/**
* Retrieve the collection of messages.
*
* @return \Illuminate\Support\Collection
*/
public function messages()
{
return $this->messages;
}
/**
* Clear all of the messages from the local collection.
*
* @return void
*/
public function flush()
{
return $this->messages = new Collection;
}
}
|
/*
* Authors: Dave Airlie <airlied@redhat.com>
* Michael Thayer <michael.thayer@oracle.com,
* Hans de Goede <hdegoede@redhat.com>
*/
#include <linux/export.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_plane_helper.h>
#include "vbox_drv.h"
#include "vboxvideo.h"
#include "hgsmi_channels.h"
static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
u32 handle, u32 width, u32 height,
s32 hot_x, s32 hot_y);
static int vbox_cursor_move(struct drm_crtc *crtc, int x, int y);
/**
* Set a graphics mode. Poke any required values into registers, do an HGSMI
* mode set and tell the host we support advanced graphics functions.
*/
static void vbox_do_modeset(struct drm_crtc *crtc,
const struct drm_display_mode *mode)
{
struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
struct vbox_private *vbox;
int width, height, bpp, pitch;
u16 flags;
s32 x_offset, y_offset;
vbox = crtc->dev->dev_private;
width = mode->hdisplay ? mode->hdisplay : 640;
height = mode->vdisplay ? mode->vdisplay : 480;
bpp = crtc->enabled ? CRTC_FB(crtc)->format->cpp[0] * 8 : 32;
pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * bpp / 8;
x_offset = vbox->single_framebuffer ? crtc->x : vbox_crtc->x_hint;
y_offset = vbox->single_framebuffer ? crtc->y : vbox_crtc->y_hint;
/*
* This is the old way of setting graphics modes. It assumed one screen
* and a frame-buffer at the start of video RAM. On older versions of
* VirtualBox, certain parts of the code still assume that the first
* screen is programmed this way, so try to fake it.
*/
if (vbox_crtc->crtc_id == 0 && crtc->enabled &&
vbox_crtc->fb_offset / pitch < 0xffff - crtc->y &&
vbox_crtc->fb_offset % (bpp / 8) == 0) {
vbox_write_ioport(<API key>, width);
vbox_write_ioport(<API key>, height);
vbox_write_ioport(<API key>, pitch * 8 / bpp);
vbox_write_ioport(VBE_DISPI_INDEX_BPP,
CRTC_FB(crtc)->format->cpp[0] * 8);
vbox_write_ioport(<API key>, VBE_DISPI_ENABLED);
vbox_write_ioport(
<API key>,
vbox_crtc->fb_offset % pitch / bpp * 8 + crtc->x);
vbox_write_ioport(<API key>,
vbox_crtc->fb_offset / pitch + crtc->y);
}
flags = <API key>;
flags |= (crtc->enabled && !vbox_crtc->blanked) ?
0 : VBVA_SCREEN_F_BLANK;
flags |= vbox_crtc->disconnected ? <API key> : 0;
<API key>(vbox->guest_pool, vbox_crtc->crtc_id,
x_offset, y_offset,
crtc->x * bpp / 8 + crtc->y * pitch,
pitch, width, height,
vbox_crtc->blanked ? 0 : bpp, flags);
}
static int vbox_set_view(struct drm_crtc *crtc)
{
struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
struct vbox_private *vbox = crtc->dev->dev_private;
struct vbva_infoview *p;
/*
* Tell the host about the view. This design originally targeted the
* Windows XP driver architecture and assumed that each screen would
* have a dedicated frame buffer with the command buffer following it,
* the whole being a "view". The host works out which screen a command
* buffer belongs to by checking whether it is in the first view, then
* whether it is in the second and so on. The first match wins. We
* cheat around this by making the first view be the managed memory
* plus the first command buffer, the second the same plus the second
* buffer and so on.
*/
p = hgsmi_buffer_alloc(vbox->guest_pool, sizeof(*p),
HGSMI_CH_VBVA, VBVA_INFO_VIEW);
if (!p)
return -ENOMEM;
p->view_index = vbox_crtc->crtc_id;
p->view_offset = vbox_crtc->fb_offset;
p->view_size = vbox->available_vram_size - vbox_crtc->fb_offset +
vbox_crtc->crtc_id * <API key>;
p->max_screen_size = vbox->available_vram_size - vbox_crtc->fb_offset;
hgsmi_buffer_submit(vbox->guest_pool, p);
hgsmi_buffer_free(vbox->guest_pool, p);
return 0;
}
static void vbox_crtc_dpms(struct drm_crtc *crtc, int mode)
{
struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
struct vbox_private *vbox = crtc->dev->dev_private;
switch (mode) {
case DRM_MODE_DPMS_ON:
vbox_crtc->blanked = false;
break;
case <API key>:
case <API key>:
case DRM_MODE_DPMS_OFF:
vbox_crtc->blanked = true;
break;
}
mutex_lock(&vbox->hw_mutex);
vbox_do_modeset(crtc, &crtc->hwmode);
mutex_unlock(&vbox->hw_mutex);
}
static bool <API key>(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
/*
* Try to map the layout of virtual screens to the range of the input device.
* Return true if we need to re-set the crtc modes due to screen offset
* changes.
*/
static bool <API key>(struct vbox_private *vbox)
{
struct drm_crtc *crtci;
struct drm_connector *connectori;
struct drm_framebuffer *fb1 = NULL;
bool single_framebuffer = true;
bool <API key> = vbox->single_framebuffer;
u16 width = 0, height = 0;
/*
* Are we using an X.Org-style single large frame-buffer for all crtcs?
* If so then screen layout can be deduced from the crtc offsets.
* Same fall-back if this is the fbdev frame-buffer.
*/
list_for_each_entry(crtci, &vbox->dev->mode_config.crtc_list, head) {
if (!fb1) {
fb1 = CRTC_FB(crtci);
if (to_vbox_framebuffer(fb1) == &vbox->fbdev->afb)
break;
} else if (CRTC_FB(crtci) && fb1 != CRTC_FB(crtci)) {
single_framebuffer = false;
}
}
if (single_framebuffer) {
list_for_each_entry(crtci, &vbox->dev->mode_config.crtc_list,
head) {
if (to_vbox_crtc(crtci)->crtc_id != 0)
continue;
vbox->single_framebuffer = true;
vbox->input_mapping_width = CRTC_FB(crtci)->width;
vbox-><API key> = CRTC_FB(crtci)->height;
return <API key> !=
vbox->single_framebuffer;
}
}
/* Otherwise calculate the total span of all screens. */
list_for_each_entry(connectori, &vbox->dev->mode_config.connector_list,
head) {
struct vbox_connector *vbox_connector =
to_vbox_connector(connectori);
struct vbox_crtc *vbox_crtc = vbox_connector->vbox_crtc;
width = max_t(u16, width, vbox_crtc->x_hint +
vbox_connector->mode_hint.width);
height = max_t(u16, height, vbox_crtc->y_hint +
vbox_connector->mode_hint.height);
}
vbox->single_framebuffer = false;
vbox->input_mapping_width = width;
vbox-><API key> = height;
return <API key> != vbox->single_framebuffer;
}
static int <API key>(struct drm_crtc *crtc,
struct drm_framebuffer *old_fb, int x, int y)
{
struct vbox_private *vbox = crtc->dev->dev_private;
struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
struct drm_gem_object *obj;
struct vbox_framebuffer *vbox_fb;
struct vbox_bo *bo;
int ret;
u64 gpu_addr;
/* Unpin the previous fb. */
if (old_fb) {
vbox_fb = to_vbox_framebuffer(old_fb);
obj = vbox_fb->obj;
bo = gem_to_vbox_bo(obj);
ret = vbox_bo_reserve(bo, false);
if (ret)
return ret;
vbox_bo_unpin(bo);
vbox_bo_unreserve(bo);
}
vbox_fb = to_vbox_framebuffer(CRTC_FB(crtc));
obj = vbox_fb->obj;
bo = gem_to_vbox_bo(obj);
ret = vbox_bo_reserve(bo, false);
if (ret)
return ret;
ret = vbox_bo_pin(bo, TTM_PL_FLAG_VRAM, &gpu_addr);
if (ret) {
vbox_bo_unreserve(bo);
return ret;
}
if (&vbox->fbdev->afb == vbox_fb)
vbox_fbdev_set_base(vbox, gpu_addr);
vbox_bo_unreserve(bo);
/* <API key>(crtc, (u32)gpu_addr); */
vbox_crtc->fb_offset = gpu_addr;
if (<API key>(vbox)) {
struct drm_crtc *crtci;
list_for_each_entry(crtci, &vbox->dev->mode_config.crtc_list,
head) {
vbox_set_view(crtc);
vbox_do_modeset(crtci, &crtci->mode);
}
}
return 0;
}
static int <API key>(struct drm_crtc *crtc, int x, int y,
struct drm_framebuffer *old_fb)
{
return <API key>(crtc, old_fb, x, y);
}
static int vbox_crtc_mode_set(struct drm_crtc *crtc,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode,
int x, int y, struct drm_framebuffer *old_fb)
{
struct vbox_private *vbox = crtc->dev->dev_private;
int ret;
<API key>(crtc, x, y, old_fb);
mutex_lock(&vbox->hw_mutex);
ret = vbox_set_view(crtc);
if (!ret)
vbox_do_modeset(crtc, mode);
<API key>(vbox->guest_pool, 0, 0,
vbox->input_mapping_width,
vbox-><API key>);
mutex_unlock(&vbox->hw_mutex);
return ret;
}
static void vbox_crtc_disable(struct drm_crtc *crtc)
{
}
static void vbox_crtc_prepare(struct drm_crtc *crtc)
{
}
static void vbox_crtc_commit(struct drm_crtc *crtc)
{
}
static const struct <API key> <API key> = {
.dpms = vbox_crtc_dpms,
.mode_fixup = <API key>,
.mode_set = vbox_crtc_mode_set,
/* .mode_set_base = <API key>, */
.disable = vbox_crtc_disable,
.prepare = vbox_crtc_prepare,
.commit = vbox_crtc_commit,
};
static void vbox_crtc_reset(struct drm_crtc *crtc)
{
}
static void vbox_crtc_destroy(struct drm_crtc *crtc)
{
drm_crtc_cleanup(crtc);
kfree(crtc);
}
static const struct drm_crtc_funcs vbox_crtc_funcs = {
.cursor_move = vbox_cursor_move,
.cursor_set2 = vbox_cursor_set2,
.reset = vbox_crtc_reset,
.set_config = <API key>,
/* .gamma_set = vbox_crtc_gamma_set, */
.destroy = vbox_crtc_destroy,
};
static struct vbox_crtc *vbox_crtc_init(struct drm_device *dev, unsigned int i)
{
struct vbox_crtc *vbox_crtc;
vbox_crtc = kzalloc(sizeof(*vbox_crtc), GFP_KERNEL);
if (!vbox_crtc)
return NULL;
vbox_crtc->crtc_id = i;
drm_crtc_init(dev, &vbox_crtc->base, &vbox_crtc_funcs);
<API key>(&vbox_crtc->base, 256);
drm_crtc_helper_add(&vbox_crtc->base, &<API key>);
return vbox_crtc;
}
static void <API key>(struct drm_encoder *encoder)
{
drm_encoder_cleanup(encoder);
kfree(encoder);
}
static struct drm_encoder *<API key>(struct drm_connector
*connector)
{
int enc_id = connector->encoder_ids[0];
/* pick the encoder ids */
if (enc_id)
return drm_encoder_find(connector->dev, enc_id);
return NULL;
}
static const struct drm_encoder_funcs vbox_enc_funcs = {
.destroy = <API key>,
};
static void vbox_encoder_dpms(struct drm_encoder *encoder, int mode)
{
}
static bool vbox_mode_fixup(struct drm_encoder *encoder,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
static void <API key>(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
}
static void <API key>(struct drm_encoder *encoder)
{
}
static void vbox_encoder_commit(struct drm_encoder *encoder)
{
}
static const struct <API key> <API key> = {
.dpms = vbox_encoder_dpms,
.mode_fixup = vbox_mode_fixup,
.prepare = <API key>,
.commit = vbox_encoder_commit,
.mode_set = <API key>,
};
static struct drm_encoder *vbox_encoder_init(struct drm_device *dev,
unsigned int i)
{
struct vbox_encoder *vbox_encoder;
vbox_encoder = kzalloc(sizeof(*vbox_encoder), GFP_KERNEL);
if (!vbox_encoder)
return NULL;
drm_encoder_init(dev, &vbox_encoder->base, &vbox_enc_funcs,
<API key>, NULL);
<API key>(&vbox_encoder->base, &<API key>);
vbox_encoder->base.possible_crtcs = 1 << i;
return &vbox_encoder->base;
}
/**
* Generate EDID data with a mode-unique serial number for the virtual
* monitor to try to persuade Unity that different modes correspond to
* different monitors and it should not try to force the same resolution on
* them.
*/
static void vbox_set_edid(struct drm_connector *connector, int width,
int height)
{
enum { EDID_SIZE = 128 };
unsigned char edid[EDID_SIZE] = {
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, /* header */
0x58, 0x58, /* manufacturer (VBX) */
0x00, 0x00, /* product code */
0x00, 0x00, 0x00, 0x00, /* serial number goes here */
0x01, /* week of manufacture */
0x00, /* year of manufacture */
0x01, 0x03, /* EDID version */
0x80, /* capabilities - digital */
0x00, /* horiz. res in cm, zero for projectors */
0x00, /* vert. res in cm */
0x78, /* display gamma (120 == 2.2). */
0xEE, /* features (standby, suspend, off, RGB, std */
/* colour space, preferred timing mode) */
0xEE, 0x91, 0xA3, 0x54, 0x4C, 0x99, 0x26, 0x0F, 0x50, 0x54,
/* chromaticity for standard colour space. */
0x00, 0x00, 0x00, /* no default timings */
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01,
0x01, 0x01, 0x01, 0x01, /* no standard timings */
0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x06, 0x00, 0x02, 0x02,
0x02, 0x02,
/* descriptor block 1 goes below */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* descriptor block 2, monitor ranges */
0x00, 0x00, 0x00, 0xFD, 0x00,
0x00, 0xC8, 0x00, 0xC8, 0x64, 0x00, 0x0A, 0x20, 0x20, 0x20,
0x20, 0x20,
/* 0-200Hz vertical, 0-200KHz horizontal, 1000MHz pixel clock */
0x20,
/* descriptor block 3, monitor name */
0x00, 0x00, 0x00, 0xFC, 0x00,
'V', 'B', 'O', 'X', ' ', 'm', 'o', 'n', 'i', 't', 'o', 'r',
'\n',
/* descriptor block 4: dummy data */
0x00, 0x00, 0x00, 0x10, 0x00,
0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20,
0x00, /* number of extensions */
0x00 /* checksum goes here */
};
int clock = (width + 6) * (height + 6) * 60 / 10000;
unsigned int i, sum = 0;
edid[12] = width & 0xff;
edid[13] = width >> 8;
edid[14] = height & 0xff;
edid[15] = height >> 8;
edid[54] = clock & 0xff;
edid[55] = clock >> 8;
edid[56] = width & 0xff;
edid[58] = (width >> 4) & 0xf0;
edid[59] = height & 0xff;
edid[61] = (height >> 4) & 0xf0;
for (i = 0; i < EDID_SIZE - 1; ++i)
sum += edid[i];
edid[EDID_SIZE - 1] = (0x100 - (sum & 0xFF)) & 0xFF;
<API key>(connector, (struct edid *)edid);
}
static int vbox_get_modes(struct drm_connector *connector)
{
struct vbox_connector *vbox_connector = NULL;
struct drm_display_mode *mode = NULL;
struct vbox_private *vbox = NULL;
unsigned int num_modes = 0;
int preferred_width, preferred_height;
vbox_connector = to_vbox_connector(connector);
vbox = connector->dev->dev_private;
/*
* Heuristic: we do not want to tell the host that we support dynamic
* resizing unless we feel confident that the user space client using
* the video driver can handle hot-plug events. So the first time modes
* are queried after a "master" switch we tell the host that we do not,
* and immediately after we send the client a hot-plug notification as
* a test to see if they will respond and query again.
* That is also the reason why capabilities are reported to the host at
* this place in the code rather than elsewhere.
* We need to report the flags location before reporting the IRQ
* capability.
*/
<API key>(vbox->guest_pool, GUEST_HEAP_OFFSET(vbox) +
HOST_FLAGS_OFFSET);
if (vbox_connector->vbox_crtc->crtc_id == 0)
vbox_report_caps(vbox);
if (!vbox-><API key>) {
if (vbox_connector->vbox_crtc->crtc_id == 0) {
vbox-><API key> = true;
vbox_report_hotplug(vbox);
}
return <API key>(connector, 800, 600);
}
num_modes = <API key>(connector, 2560, 1600);
preferred_width = vbox_connector->mode_hint.width ?
vbox_connector->mode_hint.width : 1024;
preferred_height = vbox_connector->mode_hint.height ?
vbox_connector->mode_hint.height : 768;
mode = drm_cvt_mode(connector->dev, preferred_width, preferred_height,
60, false, false, false);
if (mode) {
mode->type |= <API key>;
drm_mode_probed_add(connector, mode);
++num_modes;
}
vbox_set_edid(connector, preferred_width, preferred_height);
<API key>(
&connector->base, vbox->dev->mode_config.<API key>,
vbox_connector->vbox_crtc->x_hint);
<API key>(
&connector->base, vbox->dev->mode_config.<API key>,
vbox_connector->vbox_crtc->y_hint);
return num_modes;
}
static int vbox_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
return MODE_OK;
}
static void <API key>(struct drm_connector *connector)
{
<API key>(connector);
<API key>(connector);
kfree(connector);
}
static enum <API key>
<API key>(struct drm_connector *connector, bool force)
{
struct vbox_connector *vbox_connector;
vbox_connector = to_vbox_connector(connector);
return vbox_connector->mode_hint.disconnected ?
<API key> : <API key>;
}
static int vbox_fill_modes(struct drm_connector *connector, u32 max_x,
u32 max_y)
{
struct vbox_connector *vbox_connector;
struct drm_device *dev;
struct drm_display_mode *mode, *iterator;
vbox_connector = to_vbox_connector(connector);
dev = vbox_connector->base.dev;
<API key>(mode, iterator, &connector->modes, head) {
list_del(&mode->head);
drm_mode_destroy(dev, mode);
}
return <API key>(connector, max_x, max_y);
}
static const struct <API key> <API key> = {
.mode_valid = vbox_mode_valid,
.get_modes = vbox_get_modes,
.best_encoder = <API key>,
};
static const struct drm_connector_funcs <API key> = {
.dpms = <API key>,
.detect = <API key>,
.fill_modes = vbox_fill_modes,
.destroy = <API key>,
};
static int vbox_connector_init(struct drm_device *dev,
struct vbox_crtc *vbox_crtc,
struct drm_encoder *encoder)
{
struct vbox_connector *vbox_connector;
struct drm_connector *connector;
vbox_connector = kzalloc(sizeof(*vbox_connector), GFP_KERNEL);
if (!vbox_connector)
return -ENOMEM;
connector = &vbox_connector->base;
vbox_connector->vbox_crtc = vbox_crtc;
drm_connector_init(dev, connector, &<API key>,
<API key>);
<API key>(connector, &<API key>);
connector->interlace_allowed = 0;
connector->doublescan_allowed = 0;
<API key>(dev);
<API key>(&connector->base,
dev->mode_config.<API key>, -1);
<API key>(&connector->base,
dev->mode_config.<API key>, -1);
<API key>(connector);
<API key>(connector, encoder);
return 0;
}
int vbox_mode_init(struct drm_device *dev)
{
struct vbox_private *vbox = dev->dev_private;
struct drm_encoder *encoder;
struct vbox_crtc *vbox_crtc;
unsigned int i;
int ret;
/* vbox_cursor_init(dev); */
for (i = 0; i < vbox->num_crtcs; ++i) {
vbox_crtc = vbox_crtc_init(dev, i);
if (!vbox_crtc)
return -ENOMEM;
encoder = vbox_encoder_init(dev, i);
if (!encoder)
return -ENOMEM;
ret = vbox_connector_init(dev, vbox_crtc, encoder);
if (ret)
return ret;
}
return 0;
}
void vbox_mode_fini(struct drm_device *dev)
{
/* vbox_cursor_fini(dev); */
}
/**
* Copy the ARGB image and generate the mask, which is needed in case the host
* does not support ARGB cursors. The mask is a 1BPP bitmap with the bit set
* if the corresponding alpha value in the ARGB image is greater than 0xF0.
*/
static void copy_cursor_image(u8 *src, u8 *dst, u32 width, u32 height,
size_t mask_size)
{
size_t line_size = (width + 7) / 8;
u32 i, j;
memcpy(dst + mask_size, src, width * height * 4);
for (i = 0; i < height; ++i)
for (j = 0; j < width; ++j)
if (((u32 *)src)[i * width + j] > 0xf0000000)
dst[i * line_size + j / 8] |= (0x80 >> (j % 8));
}
static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
u32 handle, u32 width, u32 height,
s32 hot_x, s32 hot_y)
{
struct vbox_private *vbox = crtc->dev->dev_private;
struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
struct ttm_bo_kmap_obj uobj_map;
size_t data_size, mask_size;
struct drm_gem_object *obj;
u32 flags, caps = 0;
struct vbox_bo *bo;
bool src_isiomem;
u8 *dst = NULL;
u8 *src;
int ret;
/*
* Re-set this regularly as in 5.0.20 and earlier the information was
* lost on save and restore.
*/
<API key>(vbox->guest_pool, 0, 0,
vbox->input_mapping_width,
vbox-><API key>);
if (!handle) {
bool cursor_enabled = false;
struct drm_crtc *crtci;
/* Hide cursor. */
vbox_crtc->cursor_enabled = false;
list_for_each_entry(crtci, &vbox->dev->mode_config.crtc_list,
head) {
if (to_vbox_crtc(crtci)->cursor_enabled)
cursor_enabled = true;
}
if (!cursor_enabled)
<API key>(vbox->guest_pool, 0, 0, 0,
0, 0, NULL, 0);
return 0;
}
vbox_crtc->cursor_enabled = true;
if (width > <API key> || height > <API key> ||
width == 0 || height == 0)
return -EINVAL;
ret = hgsmi_query_conf(vbox->guest_pool,
<API key>, &caps);
if (ret)
return ret;
if (!(caps & <API key>)) {
/*
* -EINVAL means cursor_set2() not supported, -EAGAIN means
* retry at once.
*/
return -EBUSY;
}
obj = <API key>(file_priv, handle);
if (!obj) {
DRM_ERROR("Cannot find cursor object %x for crtc\n", handle);
return -ENOENT;
}
bo = gem_to_vbox_bo(obj);
ret = vbox_bo_reserve(bo, false);
if (ret)
goto out_unref_obj;
/*
* The mask must be calculated based on the alpha
* channel, one bit per ARGB word, and must be 32-bit
* padded.
*/
mask_size = ((width + 7) / 8 * height + 3) & ~3;
data_size = width * height * 4 + mask_size;
vbox->cursor_hot_x = min_t(u32, max(hot_x, 0), width);
vbox->cursor_hot_y = min_t(u32, max(hot_y, 0), height);
vbox->cursor_width = width;
vbox->cursor_height = height;
vbox->cursor_data_size = data_size;
dst = vbox->cursor_data;
ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &uobj_map);
if (ret) {
vbox->cursor_data_size = 0;
goto out_unreserve_bo;
}
src = <API key>(&uobj_map, &src_isiomem);
if (src_isiomem) {
DRM_ERROR("src cursor bo not in main memory\n");
ret = -EIO;
goto out_unmap_bo;
}
copy_cursor_image(src, dst, width, height, mask_size);
flags = <API key> | <API key> |
<API key>;
ret = <API key>(vbox->guest_pool, flags,
vbox->cursor_hot_x, vbox->cursor_hot_y,
width, height, dst, data_size);
out_unmap_bo:
ttm_bo_kunmap(&uobj_map);
out_unreserve_bo:
vbox_bo_unreserve(bo);
out_unref_obj:
<API key>(obj);
return ret;
}
static int vbox_cursor_move(struct drm_crtc *crtc, int x, int y)
{
struct vbox_private *vbox = crtc->dev->dev_private;
u32 flags = <API key> |
<API key> | <API key>;
s32 crtc_x =
vbox->single_framebuffer ? crtc->x : to_vbox_crtc(crtc)->x_hint;
s32 crtc_y =
vbox->single_framebuffer ? crtc->y : to_vbox_crtc(crtc)->y_hint;
u32 host_x, host_y;
u32 hot_x = 0;
u32 hot_y = 0;
int ret;
/*
* We compare these to unsigned later and don't
* need to handle negative.
*/
if (x + crtc_x < 0 || y + crtc_y < 0 || vbox->cursor_data_size == 0)
return 0;
ret = <API key>(vbox->guest_pool, true, x + crtc_x,
y + crtc_y, &host_x, &host_y);
/*
* The only reason we have vbox_cursor_move() is that some older clients
* might use <API key> instead of <API key> and
* use <API key> to set the hot-spot.
*
* However VirtualBox 5.0.20 and earlier has a bug causing it to return
* 0,0 as host cursor location after a save and restore.
*
* To work around this we ignore a 0, 0 return, since missing the odd
* time when it legitimately happens is not going to hurt much.
*/
if (ret || (host_x == 0 && host_y == 0))
return ret;
if (x + crtc_x < host_x)
hot_x = min(host_x - x - crtc_x, vbox->cursor_width);
if (y + crtc_y < host_y)
hot_y = min(host_y - y - crtc_y, vbox->cursor_height);
if (hot_x == vbox->cursor_hot_x && hot_y == vbox->cursor_hot_y)
return 0;
vbox->cursor_hot_x = hot_x;
vbox->cursor_hot_y = hot_y;
return <API key>(vbox->guest_pool, flags,
hot_x, hot_y, vbox->cursor_width, vbox->cursor_height,
vbox->cursor_data, vbox->cursor_data_size);
}
|
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http:
<head>
<title>lxml.html</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="lxml-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a class="navbar" target="_top" href="http://codespeak.net/lxml/">lxml API</a></th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
<a href="lxml-module.html">Package lxml</a> ::
Package html
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
onclick="toggle_private();">hide private</a>]</span></td></tr>
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="lxml.html-module.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<h1 class="epydoc">Package html</h1><p class="nomargin-top"><span class="codelink"><a href="lxml.html-pysrc.html">source code</a></span></p>
The <tt class="<API key> literal rst-rst-docutils literal rst-docutils literal"><span class="pre">lxml.html</span></tt> tool set for HTML handling.
<a name="section-Submodules"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Submodules</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Submodules"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr><td class="summary">
<ul class="nomargin">
<li> <strong class="uidlink"><a href="lxml.html.ElementSoup-module.html">lxml.html.ElementSoup</a></strong>: <em class="summary">Legacy interface to the BeautifulSoup HTML parser.</em> </li>
<li class="private"> <strong class="uidlink">lxml.html._dictmixin</strong> </li>
<li class="private"> <strong class="uidlink">lxml.html._setmixin</strong> </li>
<li> <strong class="uidlink"><a href="lxml.html.builder-module.html">lxml.html.builder</a></strong>: <em class="summary">A set of HTML generator tags for building HTML documents.</em> </li>
<li> <strong class="uidlink"><a href="lxml.html.clean-module.html">lxml.html.clean</a></strong>: <em class="summary">A cleanup tool for HTML.</em> </li>
<li> <strong class="uidlink"><a href="lxml.html.defs-module.html">lxml.html.defs</a></strong> </li>
<li> <strong class="uidlink"><a href="lxml.html.diff-module.html">lxml.html.diff</a></strong> </li>
<li> <strong class="uidlink"><a href="lxml.html.formfill-module.html">lxml.html.formfill</a></strong> </li>
<li> <strong class="uidlink"><a href="lxml.html.html5parser-module.html">lxml.html.html5parser</a></strong>: <em class="summary">An interface to html5lib.</em> </li>
<li> <strong class="uidlink"><a href="lxml.html.soupparser-module.html">lxml.html.soupparser</a></strong>: <em class="summary">External interface to the BeautifulSoup HTML parser.</em> </li>
<li> <strong class="uidlink"><a href="lxml.html.usedoctest-module.html">lxml.html.usedoctest</a></strong>: <em class="summary">Doctest module for HTML comparison.</em> </li>
</ul></td></tr>
</table>
<br />
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Classes</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Classes"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.HtmlMixin-class.html" class="summary-name" onclick="show_private();">HtmlMixin</a>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html._MethodFunc-class.html" class="summary-name" onclick="show_private();">_MethodFunc</a><br />
An object that represents a method on an element as a function;
the function takes either an element or an HTML string.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.HtmlComment-class.html" class="summary-name" onclick="show_private();">HtmlComment</a>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.HtmlElement-class.html" class="summary-name" onclick="show_private();">HtmlElement</a>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.<API key>.html" class="summary-name" onclick="show_private();"><API key></a>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.HtmlEntity-class.html" class="summary-name" onclick="show_private();">HtmlEntity</a>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.<API key>.html" class="summary-name" onclick="show_private();"><API key></a><br />
A lookup scheme for HTML Element classes.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.FormElement-class.html" class="summary-name" onclick="show_private();">FormElement</a><br />
Represents a <form> element.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.FieldsDict-class.html" class="summary-name" onclick="show_private();">FieldsDict</a>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.InputGetter-class.html" class="summary-name" onclick="show_private();">InputGetter</a><br />
An accessor that represents all the input fields in a form.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.InputMixin-class.html" class="summary-name" onclick="show_private();">InputMixin</a><br />
Mix-in for all input elements (input, select, and textarea)
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.<API key>.html" class="summary-name" onclick="show_private();">TextareaElement</a><br />
<tt class="<API key> literal <API key> literal rst-rst-docutils literal rst-docutils literal"><span class="pre"><textarea></span></tt> element.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.SelectElement-class.html" class="summary-name" onclick="show_private();">SelectElement</a><br />
<tt class="<API key> literal <API key> literal rst-rst-docutils literal rst-docutils literal"><span class="pre"><select></span></tt> element.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.<API key>.html" class="summary-name" onclick="show_private();"><API key></a><br />
Represents all the selected options in a <tt class="rst-rst-docutils literal rst-docutils literal"><span class="pre"><select</span> <span class="pre">multiple></span></tt> element.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.RadioGroup-class.html" class="summary-name" onclick="show_private();">RadioGroup</a><br />
This object represents several <tt class="rst-rst-docutils literal rst-docutils literal"><span class="pre"><input</span> <span class="pre">type=radio></span></tt> elements
that have the same name.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.CheckboxGroup-class.html" class="summary-name" onclick="show_private();">CheckboxGroup</a><br />
Represents a group of checkboxes (<tt class="rst-rst-docutils literal rst-docutils literal"><span class="pre"><input</span> <span class="pre">type=checkbox></span></tt>) that
have the same name.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.<API key>.html" class="summary-name" onclick="show_private();">CheckboxValues</a><br />
Represents the values of the checked checkboxes in a group of
checkboxes with the same name.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.InputElement-class.html" class="summary-name" onclick="show_private();">InputElement</a><br />
Represents an <tt class="<API key> literal <API key> literal rst-rst-docutils literal rst-docutils literal"><span class="pre"><input></span></tt> element.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.LabelElement-class.html" class="summary-name" onclick="show_private();">LabelElement</a><br />
Represents a <tt class="<API key> literal rst-rst-docutils literal rst-docutils literal"><span class="pre"><label></span></tt> element.
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.HTMLParser-class.html" class="summary-name" onclick="show_private();">HTMLParser</a>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html.XHTMLParser-class.html" class="summary-name" onclick="show_private();">XHTMLParser</a>
</td>
</tr>
</table>
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Functions</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Functions"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="__fix_docstring"></a><span class="summary-sig-name">__fix_docstring</span>(<span class="summary-sig-arg">s</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#__fix_docstring">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="_unquote_match"></a><span class="summary-sig-name">_unquote_match</span>(<span class="summary-sig-arg">s</span>,
<span class="summary-sig-arg">pos</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#_unquote_match">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="_transform_result"></a><span class="summary-sig-name">_transform_result</span>(<span class="summary-sig-arg">typ</span>,
<span class="summary-sig-arg">result</span>)</span><br />
Convert the result back into the input type.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#_transform_result">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="_nons"></a><span class="summary-sig-name">_nons</span>(<span class="summary-sig-arg">tag</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#_nons">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="document_fromstring"></a><span class="summary-sig-name">document_fromstring</span>(<span class="summary-sig-arg">html</span>,
<span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">**kw</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#document_fromstring">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="lxml.html-module.html#<API key>" class="summary-sig-name"><API key></a>(<span class="summary-sig-arg">html</span>,
<span class="summary-sig-arg">no_leading_text</span>=<span class="summary-sig-default">False</span>,
<span class="summary-sig-arg">base_url</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">**kw</span>)</span><br />
Parses several HTML elements, returning a list of elements.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#<API key>">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="lxml.html-module.html#fragment_fromstring" class="summary-sig-name">fragment_fromstring</a>(<span class="summary-sig-arg">html</span>,
<span class="summary-sig-arg">create_parent</span>=<span class="summary-sig-default">False</span>,
<span class="summary-sig-arg">base_url</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">**kw</span>)</span><br />
Parses a single HTML element; it is an error if there is more than
one element, or if anything but whitespace precedes or follows the
element.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#fragment_fromstring">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="lxml.html-module.html#fromstring" class="summary-sig-name">fromstring</a>(<span class="summary-sig-arg">html</span>,
<span class="summary-sig-arg">base_url</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">**kw</span>)</span><br />
Parse the html, returning a single element/document.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#fromstring">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="lxml.html-module.html#parse" class="summary-sig-name">parse</a>(<span class="summary-sig-arg">filename_or_url</span>,
<span class="summary-sig-arg">parser</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">base_url</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">**kw</span>)</span><br />
Parse a filename, URL, or file-like object into an HTML document
tree.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#parse">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="<API key>"></a><span class="summary-sig-name"><API key></span>(<span class="summary-sig-arg">el</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#<API key>">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="_element_name"></a><span class="summary-sig-name">_element_name</span>(<span class="summary-sig-arg">el</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#_element_name">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="lxml.html-module.html#submit_form" class="summary-sig-name">submit_form</a>(<span class="summary-sig-arg">form</span>,
<span class="summary-sig-arg">extra_values</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">open_http</span>=<span class="summary-sig-default">None</span>)</span><br />
Helper function to submit a form.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#submit_form">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="open_http_urllib"></a><span class="summary-sig-name">open_http_urllib</span>(<span class="summary-sig-arg">method</span>,
<span class="summary-sig-arg">url</span>,
<span class="summary-sig-arg">values</span>)</span></td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#open_http_urllib">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="html_to_xhtml"></a><span class="summary-sig-name">html_to_xhtml</span>(<span class="summary-sig-arg">html</span>)</span><br />
Convert all tags in an HTML tree to XHTML by moving them to the
XHTML namespace.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#html_to_xhtml">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="xhtml_to_html"></a><span class="summary-sig-name">xhtml_to_html</span>(<span class="summary-sig-arg">xhtml</span>)</span><br />
Convert all tags in an XHTML tree to HTML by removing their
XHTML namespace.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#xhtml_to_html">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="<API key>"></a><span class="summary-sig-name"><API key></span>(<span class="summary-sig-arg">...</span>)</span><br />
sub(repl, string[, count = 0]) --> newstring
Return the string obtained by replacing the leftmost non-overlapping
occurrences of pattern in string by the replacement repl.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#<API key>">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="<API key>"></a><span class="summary-sig-name"><API key></span>(<span class="summary-sig-arg">...</span>)</span><br />
sub(repl, string[, count = 0]) --> newstring
Return the string obtained by replacing the leftmost non-overlapping
occurrences of pattern in string by the replacement repl.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#<API key>">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="lxml.html-module.html#tostring" class="summary-sig-name">tostring</a>(<span class="summary-sig-arg">doc</span>,
<span class="summary-sig-arg">pretty_print</span>=<span class="summary-sig-default">False</span>,
<span class="summary-sig-arg"><API key></span>=<span class="summary-sig-default">False</span>,
<span class="summary-sig-arg">encoding</span>=<span class="summary-sig-default">None</span>,
<span class="summary-sig-arg">method</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">html</code><code class="variable-quote">'</code></span>)</span><br />
Return an HTML string representation of the document.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#tostring">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a name="open_in_browser"></a><span class="summary-sig-name">open_in_browser</span>(<span class="summary-sig-arg">doc</span>)</span><br />
Open the HTML document in a web browser (saving it to a temporary
file to open it).</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#open_in_browser">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="lxml.html-module.html#Element" class="summary-sig-name">Element</a>(<span class="summary-sig-arg">*args</span>,
<span class="summary-sig-arg">**kw</span>)</span><br />
Create a new HTML Element.</td>
<td align="right" valign="top">
<span class="codelink"><a href="lxml.html-pysrc.html#Element">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
</table>
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Variables</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#section-Variables"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="XHTML_NAMESPACE"></a><span class="summary-name">XHTML_NAMESPACE</span> = <code title="'http:
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html-module.html#_rel_links_xpath" class="summary-name" onclick="show_private();">_rel_links_xpath</a> = <code title="descendant-or-self::a[@rel]|descendant-or-self::x:a[@rel]">descendant-or-self::a[@rel]|descendant-or-s<code class="variable-ellipsis">...</code></code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html-module.html#_options_xpath" class="summary-name" onclick="show_private();">_options_xpath</a> = <code title="descendant-or-self::option|descendant-or-self::x:option">descendant-or-self::option|descendant-or-self<code class="variable-ellipsis">...</code></code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html-module.html#_forms_xpath" class="summary-name" onclick="show_private();">_forms_xpath</a> = <code title="descendant-or-self::form|descendant-or-self::x:form">descendant-or-self::form|descendant-or-self::x:<code class="variable-ellipsis">...</code></code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html-module.html#_class_xpath" class="summary-name" onclick="show_private();">_class_xpath</a> = <code title="descendant-or-self::*[@class and contains(concat(' ', normalize-space(\
@class), ' '), concat(' ', $class_name, ' '))]">descendant-or-self::*[@class and contains(conca<code class="variable-ellipsis">...</code></code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="_id_xpath"></a><span class="summary-name">_id_xpath</span> = <code title="descendant-or-self::*[@id=$id]">descendant-or-self::*[@id=$id]</code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="<API key>"></a><span class="summary-name"><API key></span> = <code title="string()">string()</code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html-module.html#_css_url_re" class="summary-name" onclick="show_private();">_css_url_re</a> = <code title="re.compile(r'(?i)url\(("[^"]*"|\'[^\']*\'|[^\)]*)\)')">re.compile(r'<code class="re-flags">(?i)</code>url\(<code class="re-group">(</code>"<code class="re-group">[^</code>"<code class="re-group">]</code><code class="re-op">*</code>"<code class="re-op">|</code>\'<code class="re-group">[^</code>\'<code class="re-group">]</code><code class="re-op">*</code>\'<code class="re-op">|</code><code class="re-group">[^</code>\)<code class="re-group">]</code><code class="re-op">*</code><code class="variable-ellipsis">...</code></code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="_css_import_re"></a><span class="summary-name">_css_import_re</span> = <code title="re.compile(r'@import "(.*?)"')">re.compile(r'@import "<code class="re-group">(</code>.<code class="re-op">*?</code><code class="re-group">)</code>"')</code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="_label_xpath"></a><span class="summary-name">_label_xpath</span> = <code title="//label[@for=$id]|//x:label[@for=$id]">//label[@for=$id]|//x:label[@for=$id]</code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="_archive_re"></a><span class="summary-name">_archive_re</span> = <code title="re.compile(r'[^ ]+')">re.compile(r'<code class="re-group">[^</code> <code class="re-group">]</code><code class="re-op">+</code>')</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="find_rel_links"></a><span class="summary-name">find_rel_links</span> = <code title="_MethodFunc('find_rel_links', copy= False)">_MethodFunc('find_rel_links', copy= False)</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="find_class"></a><span class="summary-name">find_class</span> = <code title="_MethodFunc('find_class', copy= False)">_MethodFunc('find_class', copy= False)</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="lxml.html-module.html#make_links_absolute" class="summary-name">make_links_absolute</a> = <code title="_MethodFunc('make_links_absolute', copy= True)">_MethodFunc('make_links_absolute', copy=<code class="variable-ellipsis">...</code></code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="resolve_base_href"></a><span class="summary-name">resolve_base_href</span> = <code title="_MethodFunc('resolve_base_href', copy= True)">_MethodFunc('resolve_base_href', copy= True)</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="iterlinks"></a><span class="summary-name">iterlinks</span> = <code title="_MethodFunc('iterlinks', copy= False)">_MethodFunc('iterlinks', copy= False)</code>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="rewrite_links"></a><span class="summary-name">rewrite_links</span> = <code title="_MethodFunc('rewrite_links', copy= True)">_MethodFunc('rewrite_links', copy= True)</code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="html_parser"></a><span class="summary-name">html_parser</span> = <code title="HTMLParser()">HTMLParser()</code>
</td>
</tr>
<tr class="private">
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a name="xhtml_parser"></a><span class="summary-name">xhtml_parser</span> = <code title="XHTMLParser()">XHTMLParser()</code>
</td>
</tr>
</table>
<a name="<API key>"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Function Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#<API key>"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="<API key>"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name"><API key></span>(<span class="sig-arg">html</span>,
<span class="sig-arg">no_leading_text</span>=<span class="sig-default">False</span>,
<span class="sig-arg">base_url</span>=<span class="sig-default">None</span>,
<span class="sig-arg">parser</span>=<span class="sig-default">None</span>,
<span class="sig-arg">**kw</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="lxml.html-pysrc.html#<API key>">source code</a></span>
</td>
</tr></table>
<p>Parses several HTML elements, returning a list of elements.</p>
<p>The first item in the list may be a string (though leading
whitespace is removed). If no_leading_text is true, then it will
be an error if there is leading text, and it will always be a list
of only elements.</p>
<p>base_url will set the document's base_url attribute (and the tree's docinfo.URL)</p>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="fragment_fromstring"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">fragment_fromstring</span>(<span class="sig-arg">html</span>,
<span class="sig-arg">create_parent</span>=<span class="sig-default">False</span>,
<span class="sig-arg">base_url</span>=<span class="sig-default">None</span>,
<span class="sig-arg">parser</span>=<span class="sig-default">None</span>,
<span class="sig-arg">**kw</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="lxml.html-pysrc.html#fragment_fromstring">source code</a></span>
</td>
</tr></table>
<p>Parses a single HTML element; it is an error if there is more than
one element, or if anything but whitespace precedes or follows the
element.</p>
<p>If create_parent is true (or is a tag name) then a parent node
will be created to encapsulate the HTML in a single element.</p>
<p>base_url will set the document's base_url attribute (and the tree's docinfo.URL)</p>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="fromstring"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">fromstring</span>(<span class="sig-arg">html</span>,
<span class="sig-arg">base_url</span>=<span class="sig-default">None</span>,
<span class="sig-arg">parser</span>=<span class="sig-default">None</span>,
<span class="sig-arg">**kw</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="lxml.html-pysrc.html#fromstring">source code</a></span>
</td>
</tr></table>
<p>Parse the html, returning a single element/document.</p>
<p>This tries to minimally parse the chunk of text, without knowing if it
is a fragment or a document.</p>
<p>base_url will set the document's base_url attribute (and the tree's docinfo.URL)</p>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="parse"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">parse</span>(<span class="sig-arg">filename_or_url</span>,
<span class="sig-arg">parser</span>=<span class="sig-default">None</span>,
<span class="sig-arg">base_url</span>=<span class="sig-default">None</span>,
<span class="sig-arg">**kw</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="lxml.html-pysrc.html#parse">source code</a></span>
</td>
</tr></table>
<p>Parse a filename, URL, or file-like object into an HTML document
tree. Note: this returns a tree, not an element. Use
<tt class="rst-docutils literal"><span class="pre">parse(...).getroot()</span></tt> to get the document root.</p>
<p>You can override the base URL with the <tt class="rst-docutils literal"><span class="pre">base_url</span></tt> keyword. This
is most useful when parsing from a file-like object.</p>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="submit_form"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">submit_form</span>(<span class="sig-arg">form</span>,
<span class="sig-arg">extra_values</span>=<span class="sig-default">None</span>,
<span class="sig-arg">open_http</span>=<span class="sig-default">None</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="lxml.html-pysrc.html#submit_form">source code</a></span>
</td>
</tr></table>
<p>Helper function to submit a form. Returns a file-like object, as from
<tt class="rst-docutils literal"><span class="pre">urllib.urlopen()</span></tt>. This object also has a <tt class="rst-docutils literal"><span class="pre">.geturl()</span></tt> function,
which shows the URL if there were any redirects.</p>
<p>You can use this like:</p>
<pre class="rst-literal-block">
form = doc.forms[0]
form.inputs['foo'].value = 'bar' # etc
response = form.submit()
doc = parse(response)
doc.make_links_absolute(response.geturl())
</pre>
<p>To change the HTTP requester, pass a function as <tt class="rst-docutils literal"><span class="pre">open_http</span></tt> keyword
argument that opens the URL for you. The function must have the following
signature:</p>
<pre class="rst-literal-block">
open_http(method, URL, values)
</pre>
<p>The action is one of 'GET' or 'POST', the URL is the target URL as a
string, and the values are a sequence of <tt class="rst-docutils literal"><span class="pre">(name,</span> <span class="pre">value)</span></tt> tuples with the
form data.</p>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="tostring"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">tostring</span>(<span class="sig-arg">doc</span>,
<span class="sig-arg">pretty_print</span>=<span class="sig-default">False</span>,
<span class="sig-arg"><API key></span>=<span class="sig-default">False</span>,
<span class="sig-arg">encoding</span>=<span class="sig-default">None</span>,
<span class="sig-arg">method</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">html</code><code class="variable-quote">'</code></span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="lxml.html-pysrc.html#tostring">source code</a></span>
</td>
</tr></table>
<p>Return an HTML string representation of the document.</p>
<p>Note: if <API key> is true this will create a
<tt class="rst-docutils literal"><span class="pre"><meta</span> <span class="pre">http-equiv="Content-Type"</span> <span class="pre">...></span></tt> tag in the head;
regardless of the value of <API key> any existing
<tt class="rst-docutils literal"><span class="pre"><meta</span> <span class="pre">http-equiv="Content-Type"</span> <span class="pre">...></span></tt> tag will be removed</p>
<p>The <tt class="rst-docutils literal"><span class="pre">encoding</span></tt> argument controls the output encoding (defauts to
ASCII, with &#...; character references for any characters outside
of ASCII).</p>
<p>The <tt class="rst-docutils literal"><span class="pre">method</span></tt> argument defines the output method. It defaults to
'html', but can also be 'xml' for xhtml output, or 'text' to
serialise to plain text without markup. Note that you can pass
the builtin <tt class="rst-docutils literal"><span class="pre">unicode</span></tt> type as <tt class="rst-docutils literal"><span class="pre">encoding</span></tt> argument to serialise
to a unicode string.</p>
<p>Example:</p>
<pre class="rst-literal-block">
>>> from lxml import html
>>> root = html.fragment_fromstring('<p>Hello<br>world!</p>')
>>> html.tostring(root)
'<p>Hello<br>world!</p>'
>>> html.tostring(root, method='html')
'<p>Hello<br>world!</p>'
>>> html.tostring(root, method='xml')
'<p>Hello<br/>world!</p>'
>>> html.tostring(root, method='text')
'Helloworld!'
>>> html.tostring(root, method='text', encoding=unicode)
u'Helloworld!'
</pre>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<a name="Element"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">Element</span>(<span class="sig-arg">*args</span>,
<span class="sig-arg">**kw</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="lxml.html-pysrc.html#Element">source code</a></span>
</td>
</tr></table>
<p>Create a new HTML Element.</p>
<p>This can also be used for XHTML documents.</p>
<dl class="fields">
</dl>
</td></tr></table>
</div>
<br />
<a name="<API key>"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td colspan="2" class="table-header">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td align="left"><span class="table-header">Variables Details</span></td>
<td align="right" valign="top"
><span class="options">[<a href="#<API key>"
class="privatelink" onclick="toggle_private();"
>hide private</a>]</span></td>
</tr>
</table>
</td>
</tr>
</table>
<a name="_rel_links_xpath"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<h3 class="epydoc">_rel_links_xpath</h3>
<dl class="fields">
</dl>
<dl class="fields">
<dt>Value:</dt>
<dd><table><tr><td><pre class="variable">
descendant-or-self::a[@rel]|descendant-or-self::x:a[@rel]
</pre></td></tr></table>
</dd>
</dl>
</td></tr></table>
</div>
<a name="_options_xpath"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<h3 class="epydoc">_options_xpath</h3>
<dl class="fields">
</dl>
<dl class="fields">
<dt>Value:</dt>
<dd><table><tr><td><pre class="variable">
descendant-or-self::option|descendant-or-self::x:option
</pre></td></tr></table>
</dd>
</dl>
</td></tr></table>
</div>
<a name="_forms_xpath"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<h3 class="epydoc">_forms_xpath</h3>
<dl class="fields">
</dl>
<dl class="fields">
<dt>Value:</dt>
<dd><table><tr><td><pre class="variable">
descendant-or-self::form|descendant-or-self::x:form
</pre></td></tr></table>
</dd>
</dl>
</td></tr></table>
</div>
<a name="_class_xpath"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<h3 class="epydoc">_class_xpath</h3>
<dl class="fields">
</dl>
<dl class="fields">
<dt>Value:</dt>
<dd><table><tr><td><pre class="variable">
descendant-or-self::*[@class and contains(concat(' ', normalize-space(<span class="variable-linewrap"><img src="crarr.png" alt="\" /></span>
@class), ' '), concat(' ', $class_name, ' '))]
</pre></td></tr></table>
</dd>
</dl>
</td></tr></table>
</div>
<a name="_css_url_re"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<h3 class="epydoc">_css_url_re</h3>
<dl class="fields">
</dl>
<dl class="fields">
<dt>Value:</dt>
<dd><table><tr><td><pre class="variable">
re.compile(r'<code class="re-flags">(?i)</code>url\(<code class="re-group">(</code>"<code class="re-group">[^</code>"<code class="re-group">]</code><code class="re-op">*</code>"<code class="re-op">|</code>\'<code class="re-group">[^</code>\'<code class="re-group">]</code><code class="re-op">*</code>\'<code class="re-op">|</code><code class="re-group">[^</code>\)<code class="re-group">]</code><code class="re-op">*</code><code class="re-group">)</code>\)')
</pre></td></tr></table>
</dd>
</dl>
</td></tr></table>
</div>
<a name="make_links_absolute"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<h3 class="epydoc">make_links_absolute</h3>
<dl class="fields">
</dl>
<dl class="fields">
<dt>Value:</dt>
<dd><table><tr><td><pre class="variable">
_MethodFunc('make_links_absolute', copy= True)
</pre></td></tr></table>
</dd>
</dl>
</td></tr></table>
</div>
<br />
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="lxml-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a class="navbar" target="_top" href="http://codespeak.net/lxml/">lxml API</a></th>
</tr></table></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0 on Sun Jun 21 09:44:36 2009
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
>http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie();
</script>
</body>
</html>
|
#ifndef <API key>
#define <API key> 1
#include <sys/types.h>
#include <arpa/inet.h>
#include <pthread.h>
/* useful stuff for child processes. most of this is hidden in
* server_child.c to ease changes in implementation */
#define CHILD_HASHSIZE 32
/* One AFP session child process */
typedef struct afp_child {
pid_t afpch_pid; /* afpd worker process pid (from the worker afpd process )*/
uid_t afpch_uid; /* user id of connected client (from the worker afpd process) */
int afpch_valid; /* 1 if we have a clientid */
int afpch_killed; /* 1 if we already tried to kill the client */
uint32_t afpch_boottime; /* client boot time (from the mac client) */
time_t afpch_logintime; /* time the child was added */
uint32_t afpch_idlen; /* clientid len (from the Mac client) */
char *afpch_clientid; /* clientid (from the Mac client) */
int afpch_ipc_fd; /* socket for IPC bw afpd parent and childs */
int16_t afpch_state; /* state of AFP session (eg active, sleeping, disconnected) */
char *afpch_volumes; /* mounted volumes */
struct afp_child **afpch_prevp;
struct afp_child *afpch_next;
} afp_child_t;
/* Info and table with all AFP session child processes */
typedef struct {
pthread_mutex_t servch_lock; /* Lock */
int servch_count; /* Current count of active AFP sessions */
int servch_nsessions; /* Number of allowed AFP sessions */
afp_child_t *servch_table[CHILD_HASHSIZE]; /* Hashtable with data of AFP sesssions */
} server_child_t;
/* server_child.c */
extern server_child_t *server_child_alloc(int);
extern afp_child_t *server_child_add(server_child_t *, pid_t, int ipc_fd);
extern int server_child_remove(server_child_t *, pid_t);
extern void server_child_free(server_child_t *);
extern afp_child_t *<API key>(server_child_t *childs, id_t pid);
extern void server_child_kill(server_child_t *, int);
extern void <API key>(server_child_t *children, pid_t pid, uid_t,
uint32_t len, char *id, uint32_t boottime);
extern int <API key>(server_child_t *children, pid_t, uid_t, int, uint16_t);
extern void <API key>(server_child_t *);
extern void server_reset_signal(void);
#endif
|
#ifndef __GST_DMABUF_H__
#define __GST_DMABUF_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define <API key> "dmabuf"
GstAllocator * <API key> (void);
GstMemory * <API key> (GstAllocator * allocator, gint fd, gsize size);
gint <API key> (GstMemory * mem);
gboolean <API key> (GstMemory * mem);
G_END_DECLS
#endif /* __GST_DMABUF_H__ */
|
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include "posixtest.h"
void handler(int signo)
{
}
int main(void)
{
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, SIGSTOP);
if (sigaction(SIGTTIN, &act, 0) == -1) {
printf("Test FAILED\n");
return PTS_FAIL;
}
printf("Test PASSED\n");
return PTS_PASS;
}
|
#include <common.h>
#include <command.h>
#include <hwconfig.h>
#include <pci.h>
#include <i2c.h>
#include <asm/processor.h>
#include <asm/mmu.h>
#include <asm/cache.h>
#include <asm/immap_85xx.h>
#include <asm/fsl_pci.h>
#include <asm/fsl_ddr_sdram.h>
#include <asm/io.h>
#include <asm/fsl_law.h>
#include <asm/fsl_lbc.h>
#include <asm/mp.h>
#include <miiphy.h>
#include <libfdt.h>
#include <fdt_support.h>
#include <fsl_mdio.h>
#include <tsec.h>
#include <vsc7385.h>
#include <ioports.h>
#include <asm/fsl_serdes.h>
#include <netdev.h>
#ifdef CONFIG_QE
#define GPIO_GETH_SW_PORT 1
#define GPIO_GETH_SW_PIN 29
#define GPIO_GETH_SW_DATA (1 << (31 - GPIO_GETH_SW_PIN))
#define GPIO_SLIC_PORT 1
#define GPIO_SLIC_PIN 30
#define GPIO_SLIC_DATA (1 << (31 - GPIO_SLIC_PIN))
#if defined(CONFIG_P1025RDB) || defined(CONFIG_P1021RDB)
#define PCA_IOPORT_I2C_ADDR 0x23
#define <API key> 0x2
#define PCA_IOPORT_CFG_CMD 0x6
#define <API key> 0xf8
#define <API key> 0xf6
#endif
const qe_iop_conf_t qe_iop_conf_tab[] = {
/* GPIO */
{1, 1, 2, 0, 0}, /* GPIO7/PB1 - LOAD_DEFAULT_N */
#if 0
{1, 8, 1, 1, 0}, /* GPIO10/PB8 - DDR_RST */
#endif
{0, 15, 1, 0, 0}, /* GPIO11/A15 - WDI */
{GPIO_GETH_SW_PORT, GPIO_GETH_SW_PIN, 1, 0, 0}, /* RST_GETH_SW_N */
{GPIO_SLIC_PORT, GPIO_SLIC_PIN, 1, 0, 0}, /* RST_SLIC_N */
#ifdef CONFIG_P1025RDB
/* QE_MUX_MDC */
{1, 19, 1, 0, 1}, /* QE_MUX_MDC */
/* QE_MUX_MDIO */
{1, 20, 3, 0, 1}, /* QE_MUX_MDIO */
/* UCC_1_MII */
{0, 23, 2, 0, 2}, /* CLK12 */
{0, 24, 2, 0, 1}, /* CLK9 */
{0, 7, 1, 0, 2}, /* <API key> */
{0, 9, 1, 0, 2}, /* <API key> */
{0, 11, 1, 0, 2}, /* <API key> */
{0, 12, 1, 0, 2}, /* <API key> */
{0, 6, 2, 0, 2}, /* <API key> */
{0, 10, 2, 0, 2}, /* <API key> */
{0, 14, 2, 0, 2}, /* <API key> */
{0, 15, 2, 0, 2}, /* <API key> */
{0, 5, 1, 0, 2}, /* <API key> */
{0, 13, 1, 0, 2}, /* ENET1_TX_ER */
{0, 4, 2, 0, 2}, /* <API key> */
{0, 8, 2, 0, 2}, /* <API key> */
{0, 17, 2, 0, 2}, /* ENET1_CRS */
{0, 16, 2, 0, 2}, /* ENET1_COL */
/* UCC_5_RMII */
{1, 11, 2, 0, 1}, /* CLK13 */
{1, 7, 1, 0, 2}, /* <API key> */
{1, 10, 1, 0, 2}, /* <API key> */
{1, 6, 2, 0, 2}, /* <API key> */
{1, 9, 2, 0, 2}, /* <API key> */
{1, 5, 1, 0, 2}, /* <API key> */
{1, 4, 2, 0, 2}, /* <API key> */
{1, 8, 2, 0, 2}, /* <API key> */
#endif
{0, 0, 0, 0, QE_IOP_TAB_END} /* END of table */
};
#endif
struct cpld_data {
u8 cpld_rev_major;
u8 pcba_rev;
u8 wd_cfg;
u8 rst_bps_sw;
u8 load_default_n;
u8 rst_bps_wd;
u8 bypass_enable;
u8 bps_led;
u8 status_led; /* offset: 0x8 */
u8 fxo_led; /* offset: 0x9 */
u8 fxs_led; /* offset: 0xa */
u8 rev4[2];
u8 system_rst; /* offset: 0xd */
u8 bps_out;
u8 rev5[3];
u8 cpld_rev_minor;
};
#define CPLD_WD_CFG 0x03
#define CPLD_RST_BSW 0x00
#define CPLD_RST_BWD 0x00
#define CPLD_BYPASS_EN 0x03
#define CPLD_STATUS_LED 0x01
#define CPLD_FXO_LED 0x01
#define CPLD_FXS_LED 0x0F
#define CPLD_SYS_RST 0x00
void board_cpld_init(void)
{
struct cpld_data *cpld_data = (void *)(<API key>);
out_8(&cpld_data->wd_cfg, CPLD_WD_CFG);
out_8(&cpld_data->status_led, CPLD_STATUS_LED);
out_8(&cpld_data->fxo_led, CPLD_FXO_LED);
out_8(&cpld_data->fxs_led, CPLD_FXS_LED);
out_8(&cpld_data->system_rst, CPLD_SYS_RST);
}
void board_gpio_init(void)
{
#ifdef CONFIG_QE
ccsr_gur_t *gur = (void *)(<API key>);
par_io_t *par_io = (par_io_t *) &(gur->qe_par_io);
/* Enable VSC7385 switch */
setbits_be32(&par_io[GPIO_GETH_SW_PORT].cpdat, GPIO_GETH_SW_DATA);
/* Enable SLIC */
setbits_be32(&par_io[GPIO_SLIC_PORT].cpdat, GPIO_SLIC_DATA);
#else
ccsr_gpio_t *pgpio = (void *)(<API key>);
/*
* GPIO10 DDR Reset, open drain
* GPIO7 LOAD_DEFAULT_N Input
* GPIO11 WDI (watchdog input)
* GPIO12 Ethernet Switch Reset
* GPIO13 SLIC Reset
*/
setbits_be32(&pgpio->gpdir, 0x02130000);
#if !defined(CONFIG_SYS_RAMBOOT) && !defined(CONFIG_SPL)
/* init DDR3 reset signal */
setbits_be32(&pgpio->gpdir, 0x00200000);
setbits_be32(&pgpio->gpodr, 0x00200000);
clrbits_be32(&pgpio->gpdat, 0x00200000);
udelay(1000);
setbits_be32(&pgpio->gpdat, 0x00200000);
udelay(1000);
clrbits_be32(&pgpio->gpdir, 0x00200000);
#endif
#ifdef CONFIG_VSC7385_ENET
/* reset VSC7385 Switch */
setbits_be32(&pgpio->gpdir, 0x00080000);
setbits_be32(&pgpio->gpdat, 0x00080000);
#endif
#ifdef CONFIG_SLIC
/* reset SLIC */
setbits_be32(&pgpio->gpdir, 0x00040000);
setbits_be32(&pgpio->gpdat, 0x00040000);
#endif
#endif
}
int board_early_init_f(void)
{
ccsr_gur_t *gur = (void *)(<API key>);
setbits_be32(&gur->pmuxcr,
(<API key> | <API key>));
clrbits_be32(&gur->sdhcdcr, SDHCDCR_CD_INV);
clrbits_be32(&gur->pmuxcr, <API key>);
setbits_be32(&gur->pmuxcr, <API key>);
board_gpio_init();
board_cpld_init();
return 0;
}
int checkboard(void)
{
struct cpld_data *cpld_data = (void *)(<API key>);
ccsr_gur_t *gur = (void *)(<API key>);
u8 in, out, io_config, val;
printf("Board: %s CPLD: V%d.%d PCBA: V%d.0\n", CONFIG_BOARDNAME,
in_8(&cpld_data->cpld_rev_major) & 0x0F,
in_8(&cpld_data->cpld_rev_minor) & 0x0F,
in_8(&cpld_data->pcba_rev) & 0x0F);
/* Initialize i2c early for rom_loc and flash bank information */
i2c_init(<API key>, <API key>);
if (i2c_read(<API key>, 0, 1, &in, 1) < 0 ||
i2c_read(<API key>, 1, 1, &out, 1) < 0 ||
i2c_read(<API key>, 3, 1, &io_config, 1) < 0) {
printf("Error reading i2c boot information!\n");
return 0; /* Don't want to hang() on this error */
}
val = (in & io_config) | (out & (~io_config));
puts("rom_loc: ");
if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_SD) {
puts("sd");
#ifdef __SW_BOOT_SPI
} else if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_SPI) {
puts("spi");
#endif
#ifdef __SW_BOOT_NAND
} else if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_NAND) {
puts("nand");
#endif
#ifdef __SW_BOOT_PCIE
} else if ((val & (~__SW_BOOT_MASK)) == __SW_BOOT_PCIE) {
puts("pcie");
#endif
} else {
if (val & 0x2)
puts("nor lower bank");
else
puts("nor upper bank");
}
puts("\n");
if (val & 0x1) {
setbits_be32(&gur->pmuxcr, <API key>);
puts("SD/MMC : 8-bit Mode\n");
puts("eSPI : Disabled\n");
} else {
puts("SD/MMC : 4-bit Mode\n");
puts("eSPI : Enabled\n");
}
return 0;
}
#ifdef CONFIG_PCI
void pci_init_board(void)
{
fsl_pcie_init_board(0);
}
#endif
int board_early_init_r(void)
{
const unsigned int flashbase = <API key>;
const u8 flash_esel = find_tlb_idx((void *)flashbase, 1);
/*
* Remap Boot flash region to caching-inhibited
* so that flash can be erased properly.
*/
/* Flush d-cache and invalidate i-cache of any FLASH data */
flush_dcache();
invalidate_icache();
/* invalidate existing TLB entry for flash */
disable_tlb(flash_esel);
set_tlb(1, flashbase, <API key>, /* tlb, epn, rpn */
MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,/* perms, wimge */
0, flash_esel, BOOKE_PAGESZ_64M, 1);/* ts, esel, tsize, iprot */
return 0;
}
int board_eth_init(bd_t *bis)
{
struct fsl_pq_mdio_info mdio_info;
struct tsec_info_struct tsec_info[4];
ccsr_gur_t *gur __attribute__((unused)) =
(void *)(<API key>);
int num = 0;
#ifdef CONFIG_VSC7385_ENET
char *tmp;
unsigned int vscfw_addr;
#endif
#ifdef CONFIG_TSEC1
SET_STD_TSEC_INFO(tsec_info[num], 1);
num++;
#endif
#ifdef CONFIG_TSEC2
SET_STD_TSEC_INFO(tsec_info[num], 2);
if (<API key>(SGMII_TSEC2)) {
printf("eTSEC2 is in sgmii mode.\n");
tsec_info[num].flags |= TSEC_SGMII;
}
num++;
#endif
#ifdef CONFIG_TSEC3
SET_STD_TSEC_INFO(tsec_info[num], 3);
num++;
#endif
if (!num) {
printf("No TSECs initialized\n");
return 0;
}
#ifdef CONFIG_VSC7385_ENET
/* If a VSC7385 microcode image is present, then upload it. */
if ((tmp = getenv("vscfw_addr")) != NULL) {
vscfw_addr = simple_strtoul(tmp, NULL, 16);
printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
if (<API key>((void *) vscfw_addr,
<API key>))
puts("Failure uploading VSC7385 microcode.\n");
} else
puts("No address specified for VSC7385 microcode.\n");
#endif
mdio_info.regs = (struct tsec_mii_mng *)<API key>;
mdio_info.name = DEFAULT_MII_NAME;
fsl_pq_mdio_init(bis, &mdio_info);
tsec_eth_init(bis, tsec_info, num);
#if defined(CONFIG_UEC_ETH)
/* QE0 and QE3 need to be exposed for UCC1 and UCC5 Eth mode */
setbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_QE0);
setbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_QE3);
uec_standard_init(bis);
#endif
return pci_eth_init(bis);
}
#if defined(CONFIG_QE) && \
(defined(CONFIG_P1025RDB) || defined(CONFIG_P1021RDB))
static void <API key>(void *blob)
{
unsigned int oldbus;
u8 val8;
int node;
fsl_lbc_t *lbc = LBC_BASE_ADDR;
if (hwconfig("qe")) {
/* For QE and eLBC pins multiplexing,
* there is a PCA9555 device on P1025RDB.
* It control the multiplex pins' functions,
* and setting the PCA9555 can switch the
* function between QE and eLBC.
*/
oldbus = i2c_get_bus_num();
i2c_set_bus_num(0);
if (hwconfig("tdm"))
val8 = <API key>;
else
val8 = <API key>;
i2c_write(PCA_IOPORT_I2C_ADDR, PCA_IOPORT_CFG_CMD,
1, &val8, 1);
i2c_write(PCA_IOPORT_I2C_ADDR, <API key>,
1, &val8, 1);
i2c_set_bus_num(oldbus);
/* if run QE TDM, Set ABSWP to implement
* conversion of addresses in the eLBC.
*/
if (hwconfig("tdm")) {
set_lbc_or(2, <API key>);
set_lbc_br(2, <API key>);
setbits_be32(&lbc->lbcr, CONFIG_SYS_LBC_LBCR);
}
} else {
node = fdt_path_offset(blob, "/qe");
if (node >= 0)
fdt_del_node(blob, node);
}
return;
}
#endif
#ifdef <API key>
void ft_board_setup(void *blob, bd_t *bd)
{
phys_addr_t base;
phys_size_t size;
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);
FT_FSL_PCI_SETUP;
#ifdef CONFIG_QE
do_fixup_by_compat(blob, "fsl,qe", "status", "okay",
sizeof("okay"), 0);
#if defined(CONFIG_P1025RDB) || defined(CONFIG_P1021RDB)
<API key>(blob);
#endif
#endif
#if defined(<API key>)
fdt_fixup_dr_usb(blob, bd);
#endif
}
#endif
|
#ifndef _GST_CMS_H_
#define _GST_CMS_H_
#include <gst/gst.h>
G_BEGIN_DECLS
typedef struct _Color Color;
typedef struct _ColorMatrix ColorMatrix;
struct _Color
{
double v[3];
};
struct _ColorMatrix
{
double m[4][4];
};
void color_xyY_to_XYZ (Color * c);
void color_XYZ_to_xyY (Color * c);
void color_set (Color * c, double x, double y, double z);
void <API key> (ColorMatrix * m);
void color_matrix_dump (ColorMatrix * m);
void <API key> (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b);
void color_matrix_apply (ColorMatrix * m, Color * dest, Color * src);
void <API key> (ColorMatrix * m, double a1, double a2,
double a3);
void <API key> (ColorMatrix * m, double a1, double a2, double a3);
void <API key> (ColorMatrix * m, double Kr, double Kb);
void <API key> (ColorMatrix * m, double Kr, double Kb);
void <API key> (ColorMatrix * dst);
void <API key> (ColorMatrix * dst);
void <API key> (ColorMatrix * dst);
void color_matrix_invert (ColorMatrix * m);
void color_matrix_copy (ColorMatrix * dest, ColorMatrix * src);
void <API key> (ColorMatrix * m);
void <API key> (ColorMatrix * dst,
double rx, double ry,
double gx, double gy, double bx, double by, double wx, double wy);
void <API key> (ColorMatrix * dst);
void <API key> (ColorMatrix * dst);
void <API key> (ColorMatrix * dst);
void <API key> (Color * dest, Color * src);
void <API key> (Color * dest, Color * src);
void color_gamut_clamp (Color * dest, Color * src);
G_END_DECLS
#endif
|
<?php
/**
* @see <API key>
*/
#require_once 'Zend/Gdata/Extension.php';
class <API key> extends <API key>
{
protected $_rootNamespace = 'yt';
protected $_rootElement = 'statistics';
/**
* The videoWatchCount attribute specifies the number of videos
* that a user has watched on YouTube. The videoWatchCount attribute
* is only specified when the <yt:statistics> tag appears within a
* user profile entry.
*
* @var integer
*/
protected $_videoWatchCount = null;
/**
* When the viewCount attribute refers to a video entry, the attribute
* specifies the number of times that the video has been viewed.
* When the viewCount attribute refers to a user profile, the attribute
* specifies the number of times that the user's profile has been
* viewed.
*
* @var integer
*/
protected $_viewCount = null;
/**
* The subscriberCount attribute specifies the number of YouTube users
* who have subscribed to a particular user's YouTube channel.
* The subscriberCount attribute is only specified when the
* <yt:statistics> tag appears within a user profile entry.
*
* @var integer
*/
protected $_subscriberCount = null;
/**
* The lastWebAccess attribute indicates the most recent time that
* a particular user used YouTube.
*
* @var string
*/
protected $_lastWebAccess = null;
/**
* The favoriteCount attribute specifies the number of YouTube users
* who have added a video to their list of favorite videos. The
* favoriteCount attribute is only specified when the
* <yt:statistics> tag appears within a video entry.
*
* @var integer
*/
protected $_favoriteCount = null;
/**
* Constructs a new <API key> object.
* @param string $viewCount(optional) The viewCount value
* @param string $videoWatchCount(optional) The videoWatchCount value
* @param string $subscriberCount(optional) The subscriberCount value
* @param string $lastWebAccess(optional) The lastWebAccess value
* @param string $favoriteCount(optional) The favoriteCount value
*/
public function __construct($viewCount = null, $videoWatchCount = null,
$subscriberCount = null, $lastWebAccess = null,
$favoriteCount = null)
{
$this-><API key>(Zend_Gdata_YouTube::$namespaces);
parent::__construct();
$this->_viewCount = $viewCount;
$this->_videoWatchCount = $videoWatchCount;
$this->_subscriberCount = $subscriberCount;
$this->_lastWebAccess = $lastWebAccess;
$this->_favoriteCount = $favoriteCount;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_videoWatchCount !== null) {
$element->setAttribute('watchCount', $this->_videoWatchCount);
}
if ($this->_viewCount !== null) {
$element->setAttribute('viewCount', $this->_viewCount);
}
if ($this->_subscriberCount !== null) {
$element->setAttribute('subscriberCount',
$this->_subscriberCount);
}
if ($this->_lastWebAccess !== null) {
$element->setAttribute('lastWebAccess',
$this->_lastWebAccess);
}
if ($this->_favoriteCount !== null) {
$element->setAttribute('favoriteCount',
$this->_favoriteCount);
}
return $element;
}
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and valueare
* stored in an array.
* TODO: Convert attributes to proper types
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
*/
protected function <API key>($attribute)
{
switch ($attribute->localName) {
case 'videoWatchCount':
$this->_videoWatchCount = $attribute->nodeValue;
break;
case 'viewCount':
$this->_viewCount = $attribute->nodeValue;
break;
case 'subscriberCount':
$this->_subscriberCount = $attribute->nodeValue;
break;
case 'lastWebAccess':
$this->_lastWebAccess = $attribute->nodeValue;
break;
case 'favoriteCount':
$this->_favoriteCount = $attribute->nodeValue;
break;
default:
parent::<API key>($attribute);
}
}
/**
* Get the value for this element's viewCount attribute.
*
* @return int The value associated with this attribute.
*/
public function getViewCount()
{
return $this->_viewCount;
}
/**
* Set the value for this element's viewCount attribute.
*
* @param int $value The desired value for this attribute.
* @return <API key> The element being
* modified.
*/
public function setViewCount($value)
{
$this->_viewCount = $value;
return $this;
}
/**
* Get the value for this element's videoWatchCount attribute.
*
* @return int The value associated with this attribute.
*/
public function getVideoWatchCount()
{
return $this->_videoWatchCount;
}
/**
* Set the value for this element's videoWatchCount attribute.
*
* @param int $value The desired value for this attribute.
* @return <API key> The element being
* modified.
*/
public function setVideoWatchCount($value)
{
$this->_videoWatchCount = $value;
return $this;
}
/**
* Get the value for this element's subscriberCount attribute.
*
* @return int The value associated with this attribute.
*/
public function getSubscriberCount()
{
return $this->_subscriberCount;
}
/**
* Set the value for this element's subscriberCount attribute.
*
* @param int $value The desired value for this attribute.
* @return <API key> The element being
* modified.
*/
public function setSubscriberCount($value)
{
$this->_subscriberCount = $value;
return $this;
}
/**
* Get the value for this element's lastWebAccess attribute.
*
* @return int The value associated with this attribute.
*/
public function getLastWebAccess()
{
return $this->_lastWebAccess;
}
/**
* Set the value for this element's lastWebAccess attribute.
*
* @param int $value The desired value for this attribute.
* @return <API key> The element being
* modified.
*/
public function setLastWebAccess($value)
{
$this->_lastWebAccess = $value;
return $this;
}
/**
* Get the value for this element's favoriteCount attribute.
*
* @return int The value associated with this attribute.
*/
public function getFavoriteCount()
{
return $this->_favoriteCount;
}
/**
* Set the value for this element's favoriteCount attribute.
*
* @param int $value The desired value for this attribute.
* @return <API key> The element being
* modified.
*/
public function setFavoriteCount($value)
{
$this->_favoriteCount = $value;
return $this;
}
/**
* Magic toString method allows using this directly via echo
* Works best in PHP >= 4.2.0
*
* @return string
*/
public function __toString()
{
return 'View Count=' . $this->_viewCount .
' VideoWatchCount=' . $this->_videoWatchCount .
' SubscriberCount=' . $this->_subscriberCount .
' LastWebAccess=' . $this->_lastWebAccess .
' FavoriteCount=' . $this->_favoriteCount;
}
}
|
#ifndef __TASKPARA_H
#define __TASKPARA_H
#include "<API key>.h"
#include "vtkRTAnalyticSource.h"
#include "<API key>.h"
#include "<API key>.h"
#include "vtkImageShrink3D.h"
#include "vtkGlyph3D.h"
#include "vtkGlyphSource2D.h"
#include "vtkImageGradient.h"
#include "<API key>.h"
#include "<API key>.h"
#include "vtkProbeFilter.h"
#include "vtkDataSetMapper.h"
#include "vtkContourFilter.h"
#include "vtkActor.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkAssignAttribute.h"
typedef void (*taskFunction)(double data);
void task3(double data);
void task4(double data);
static const double EXTENT = 20;
static const int WINDOW_WIDTH = 400;
static const int WINDOW_HEIGHT = 300;
#endif
|
.mblTextArea {overflow: auto;}.dj_ff3 .mblTextArea {-moz-border-radius: 0;}
|
<?php
final class <API key>
extends <API key> {
public function testLinter() {
$this-><API key>(dirname(__FILE__).'/puppet-lint/');
}
}
|
`tf.sigmoid(x, name=None)` {#sigmoid}
Computes sigmoid of `x` element-wise.
Specifically, `y = 1 / (1 + exp(-x))`.
## Args:
* <b>`x`</b>: A Tensor with type `float32`, `float64`, `int32`, `complex64`, `int64`,
or `qint32`.
* <b>`name`</b>: A name for the operation (optional).
## Returns:
A Tensor with the same type as `x` if `x.dtype != qint32`
otherwise the return type is `quint8`.
@compatibility(numpy)
Equivalent to np.scipy.special.expit
@end_compatibility
|
// Random number generator - requires a PRNG backend, e.g. prng4.js
// For best results, put code like
// <body onClick='rng_seed_time();' onKeyPress='rng_seed_time();'>
// in your main HTML document.
var rng_state;
var rng_pool;
var rng_pptr;
// Mix in a 32-bit integer into the pool
function rng_seed_int(x) {
rng_pool[rng_pptr++] ^= x & 255;
rng_pool[rng_pptr++] ^= (x >> 8) & 255;
rng_pool[rng_pptr++] ^= (x >> 16) & 255;
rng_pool[rng_pptr++] ^= (x >> 24) & 255;
if(rng_pptr >= rng_psize) rng_pptr -= rng_psize;
}
// Mix in the current time (w/milliseconds) into the pool
function rng_seed_time() {
rng_seed_int(new Date().getTime());
}
// Initialize the pool with junk if needed.
if(rng_pool == null) {
rng_pool = new Array();
rng_pptr = 0;
var t;
if(window.crypto && window.crypto.getRandomValues) {
// Use webcrypto if available
var ua = new Uint8Array(32);
window.crypto.getRandomValues(ua);
for(t = 0; t < 32; ++t)
rng_pool[rng_pptr++] = ua[t];
}
if(navigator.appName == "Netscape" && navigator.appVersion < "5" && window.crypto) {
// Extract entropy (256 bits) from NS4 RNG if available
var z = window.crypto.random(32);
for(t = 0; t < z.length; ++t)
rng_pool[rng_pptr++] = z.charCodeAt(t) & 255;
}
while(rng_pptr < rng_psize) { // extract some randomness from Math.random()
t = Math.floor(65536 * Math.random());
rng_pool[rng_pptr++] = t >>> 8;
rng_pool[rng_pptr++] = t & 255;
}
rng_pptr = 0;
rng_seed_time();
//rng_seed_int(window.screenX);
//rng_seed_int(window.screenY);
}
function rng_get_byte() {
if(rng_state == null) {
rng_seed_time();
rng_state = prng_newstate();
rng_state.init(rng_pool);
for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr)
rng_pool[rng_pptr] = 0;
rng_pptr = 0;
//rng_pool = null;
}
// TODO: allow reseeding after first request
return rng_state.next();
}
function rng_get_bytes(ba) {
var i;
for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte();
}
function SecureRandom() {}
SecureRandom.prototype.nextBytes = rng_get_bytes;
|
#include "uint.hpp"
int
main()
{
using spirit_test::test;
using spirit_test::test_attr;
// unsigned tests
{
using boost::spirit::qi::uint_;
unsigned u;
BOOST_TEST(test("123456", uint_));
BOOST_TEST(test_attr("123456", uint_, u));
BOOST_TEST(u == 123456);
BOOST_TEST(test(max_unsigned, uint_));
BOOST_TEST(test_attr(max_unsigned, uint_, u));
BOOST_TEST(u == UINT_MAX);
BOOST_TEST(!test(unsigned_overflow, uint_));
BOOST_TEST(!test_attr(unsigned_overflow, uint_, u));
}
// binary tests
{
using boost::spirit::qi::bin;
unsigned u;
BOOST_TEST(test("11111110", bin));
BOOST_TEST(test_attr("11111110", bin, u));
BOOST_TEST(u == 0xFE);
BOOST_TEST(test(max_binary, bin));
BOOST_TEST(test_attr(max_binary, bin, u));
BOOST_TEST(u == UINT_MAX);
BOOST_TEST(!test(binary_overflow, bin));
BOOST_TEST(!test_attr(binary_overflow, bin, u));
}
// octal tests
{
using boost::spirit::qi::oct;
unsigned u;
BOOST_TEST(test("12545674515", oct));
BOOST_TEST(test_attr("12545674515", oct, u));
BOOST_TEST(u == 012545674515);
BOOST_TEST(test(max_octal, oct));
BOOST_TEST(test_attr(max_octal, oct, u));
BOOST_TEST(u == UINT_MAX);
BOOST_TEST(!test(octal_overflow, oct));
BOOST_TEST(!test_attr(octal_overflow, oct, u));
}
// hex tests
{
using boost::spirit::qi::hex;
unsigned u;
BOOST_TEST(test("95BC8DF", hex));
BOOST_TEST(test_attr("95BC8DF", hex, u));
BOOST_TEST(u == 0x95BC8DF);
BOOST_TEST(test("abcdef12", hex));
BOOST_TEST(test_attr("abcdef12", hex, u));
BOOST_TEST(u == 0xabcdef12);
BOOST_TEST(test(max_hex, hex));
BOOST_TEST(test_attr(max_hex, hex, u));
BOOST_TEST(u == UINT_MAX);
BOOST_TEST(!test(hex_overflow, hex));
BOOST_TEST(!test_attr(hex_overflow, hex, u));
}
// limited fieldwidth
{
unsigned u;
using boost::spirit::qi::uint_parser;
uint_parser<unsigned, 10, 1, 3> uint3;
BOOST_TEST(test("123456", uint3, false));
BOOST_TEST(test_attr("123456", uint3, u, false));
BOOST_TEST(u == 123);
uint_parser<unsigned, 10, 2, 4> uint4;
BOOST_TEST(test("123456", uint4, false));
BOOST_TEST(test_attr("123456", uint4, u, false));
BOOST_TEST(u == 1234);
char const * first = "0000000";
char const * last = first + std::strlen(first);
uint_parser<unsigned, 10, 4, 4> uint_exact4;
BOOST_TEST(boost::spirit::qi::parse(first, last, uint_exact4, u)
&& first != last && (last-first == 3) && u == 0);
first = "0001400";
last = first + std::strlen(first);
BOOST_TEST(boost::spirit::qi::parse(first, last, uint_exact4, u)
&& first != last && (last-first == 3) && u == 1);
BOOST_TEST(!test("1", uint4));
BOOST_TEST(!test_attr("1", uint4, u));
BOOST_TEST(test_attr("014567", uint4, u, false) && u == 145);
}
// action tests
{
using boost::phoenix::ref;
using boost::spirit::qi::_1;
using boost::spirit::qi::uint_;
using boost::spirit::ascii::space;
int n;
BOOST_TEST(test("123", uint_[ref(n) = _1]));
BOOST_TEST(n == 123);
BOOST_TEST(test(" 456", uint_[ref(n) = _1], space));
BOOST_TEST(n == 456);
}
// Check overflow is parse error
{
boost::spirit::qi::uint_parser<boost::uint8_t> uint8_;
boost::uint8_t u8;
BOOST_TEST(!test_attr("999", uint8_, u8));
BOOST_TEST(!test_attr("256", uint8_, u8));
BOOST_TEST(test_attr("255", uint8_, u8));
boost::spirit::qi::uint_parser<boost::uint16_t> uint16_;
boost::uint16_t u16;
BOOST_TEST(!test_attr("99999", uint16_, u16));
BOOST_TEST(!test_attr("65536", uint16_, u16));
BOOST_TEST(test_attr("65535", uint16_, u16));
boost::spirit::qi::uint_parser<boost::uint32_t> uint32_;
boost::uint32_t u32;
BOOST_TEST(!test_attr("9999999999", uint32_, u32));
BOOST_TEST(!test_attr("4294967296", uint32_, u32));
BOOST_TEST(test_attr("4294967295", uint32_, u32));
}
// custom uint tests
{
using boost::spirit::qi::uint_;
using boost::spirit::qi::uint_parser;
custom_uint u;
BOOST_TEST(test_attr("123456", uint_, u));
uint_parser<custom_uint, 10, 1, 2> uint2;
BOOST_TEST(test_attr("12", uint2, u));
}
return boost::report_errors();
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<!-- head -->
<meta charset="utf-8">
<meta name="<API key>" content="no" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Owl Carousel Documentation">
<meta name="author" content="David Deutsch">
<title>
Contact | Owl Carousel | 2.2.1
</title>
<!-- Stylesheets -->
<link href='https://fonts.googleapis.com/css?family=Lato:300,400,700,400italic,300italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../assets/css/docs.theme.min.css">
<!-- Owl Stylesheets -->
<link rel="stylesheet" href="../assets/owlcarousel/assets/owl.carousel.min.css">
<link rel="stylesheet" href="../assets/owlcarousel/assets/owl.theme.default.min.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]
<!-- Favicons -->
<link rel="<API key>" sizes="144x144" href="../assets/ico/<API key>.png">
<link rel="shortcut icon" href="../assets/ico/favicon.png">
<link rel="shortcut icon" href="favicon.ico">
<!-- Yeah i know js should not be in header. Its required for demos.-->
<!-- javascript -->
<script src="../assets/vendors/jquery.min.js"></script>
<script src="../assets/owlcarousel/owl.carousel.js"></script>
</head>
<body>
<!-- header -->
<header class="header">
<div class="row">
<div class="large-12 columns">
<div class="brand left">
<h3>
<a href="/OwlCarousel2/">owl.carousel.js</a>
</h3>
</div>
<a id="toggle-nav" class="right">
<span></span> <span></span> <span></span>
</a>
<div class="nav-bar">
<ul class="clearfix">
<li> <a href="/OwlCarousel2/index.html">Home</a> </li>
<li> <a href="/OwlCarousel2/demos/demos.html">Demos</a> </li>
<li class="active">
<a href="/OwlCarousel2/docs/started-welcome.html">Docs</a>
</li>
<li>
<a href="https://github.com/OwlCarousel2/OwlCarousel2/archive/2.2.1.zip">Download</a>
<span class="download"></span>
</li>
</ul>
</div>
</div>
</div>
</header>
<!-- title -->
<section class="title">
<div class="row">
<div class="large-12 columns">
<h1>Support</h1>
</div>
</div>
</section>
<div id="docs">
<div class="row">
<div class="small-12 medium-3 large-3 columns">
<ul class="side-nav">
<li class="side-nav-head">Getting Started</li>
<li> <a href="started-welcome.html">Welcome</a> </li>
<li> <a href="<API key>.html">Installation</a> </li>
<li> <a href="started-faq.html">FAQ</a> </li>
</ul>
<ul class="side-nav">
<li class="side-nav-head">API</li>
<li> <a href="api-options.html">Options</a> </li>
<li> <a href="api-classes.html">Classes</a> </li>
<li> <a href="api-events.html">Events</a> </li>
</ul>
<ul class="side-nav">
<li class="side-nav-head">Development</li>
<li> <a href="dev-buildin-plugins.html">Built-in Plugins</a> </li>
<li> <a href="dev-plugin-api.html">Plugin API</a> </li>
<li> <a href="dev-styles.html">Sass Styles</a> </li>
<li> <a href="dev-external.html">External Libs</a> </li>
</ul>
<ul class="side-nav">
<li class="side-nav-head">Support</li>
<li> <a href="<API key>.html">Contributing</a> </li>
<li> <a href="support-changelog.html">Changelog</a> </li>
<li> <a href="support-contact.html">Contact</a> </li>
</ul>
</div>
<div class="small-12 medium-9 large-9 columns">
<article class="docs-content">
<h2 id="contact">Contact</h2>
<hr>
<p>If you are looking for help then the best place to ask a question is
<a href="https://github.com/OwlCarousel2/OwlCarousel2/issues">Github</a> . Also don't forget to add a
<a href="https://jsfiddle.net/">jsfiddle</a> or a link to your demo/example website!</p>
<h3 id="report-a-bug">Report a bug</h3>
<p>Please use
<a href="https://github.com/OwlCarousel2/OwlCarousel2/issues">Github</a> to report bugs.</p>
</article>
</div>
</div>
</div>
<!-- footer -->
<footer class="footer">
<div class="row">
<div class="large-12 columns">
<h5>
<a href="/OwlCarousel2/docs/support-contact.html">David Deutsch</a>
<a id="custom-tweet-button" href="https:
</h5>
</div>
</div>
</footer>
<!-- vendors -->
<script src="../assets/vendors/highlight.js"></script>
<script src="../assets/js/app.js"></script>
</body>
</html>
|
/*before*/"use strict";
/*after*/foo();
|
package com.sun.xml.internal.xsom.impl.parser;
import com.sun.xml.internal.xsom.XSSchemaSet;
import com.sun.xml.internal.xsom.impl.ElementDecl;
import com.sun.xml.internal.xsom.impl.SchemaImpl;
import com.sun.xml.internal.xsom.impl.SchemaSetImpl;
import com.sun.xml.internal.xsom.parser.<API key>;
import com.sun.xml.internal.xsom.parser.XMLParser;
import com.sun.xml.internal.xsom.parser.XSOMParser;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
/**
* Provides context information to be used by {@link NGCCRuntimeEx}s.
*
* <p>
* This class does the actual processing for {@link XSOMParser},
* but to hide the details from the public API, this class in
* a different package.
*
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/
public class ParserContext {
/** SchemaSet to which a newly parsed schema is put in. */
public final SchemaSetImpl schemaSet = new SchemaSetImpl();
private final XSOMParser owner;
final XMLParser parser;
private final Vector<Patch> patchers = new Vector<Patch>();
private final Vector<Patch> errorCheckers = new Vector<Patch>();
/**
* Documents that are parsed already. Used to avoid cyclic inclusion/double
* inclusion of schemas. Set of {@link SchemaDocumentImpl}s.
*
* The actual data structure is map from {@link SchemaDocumentImpl} to itself,
* so that we can access the {@link SchemaDocumentImpl} itself.
*/
public final Map<SchemaDocumentImpl, SchemaDocumentImpl> parsedDocuments = new HashMap<SchemaDocumentImpl, SchemaDocumentImpl>();
public ParserContext( XSOMParser owner, XMLParser parser ) {
this.owner = owner;
this.parser = parser;
try {
parse(new InputSource(ParserContext.class.getResource("datatypes.xsd").toExternalForm()));
SchemaImpl xs = (SchemaImpl)
schemaSet.getSchema("http:
xs.addSimpleType(schemaSet.anySimpleType,true);
xs.addComplexType(schemaSet.anyType,true);
} catch( SAXException e ) {
// this must be a bug of XSOM
if(e.getException()!=null)
e.getException().printStackTrace();
else
e.printStackTrace();
throw new InternalError();
}
}
public EntityResolver getEntityResolver() {
return owner.getEntityResolver();
}
public <API key> <API key>() {
return owner.<API key>();
}
/**
* Parses a new XML Schema document.
*/
public void parse( InputSource source ) throws SAXException {
newNGCCRuntime().parseEntity(source,false,null,null);
}
public XSSchemaSet getResult() throws SAXException {
// run all the patchers
for (Patch patcher : patchers)
patcher.run();
patchers.clear();
// build the element substitutability map
Iterator itr = schemaSet.iterateElementDecls();
while(itr.hasNext())
((ElementDecl)itr.next()).<API key>();
// run all the error checkers
for (Patch patcher : errorCheckers)
patcher.run();
errorCheckers.clear();
if(hadError) return null;
else return schemaSet;
}
public NGCCRuntimeEx newNGCCRuntime() {
return new NGCCRuntimeEx(this);
}
/** Once an error is detected, this flag is set to true. */
private boolean hadError = false;
/** Turns on the error flag. */
void setErrorFlag() { hadError=true; }
/**
* PatchManager implementation, which is accessible only from
* NGCCRuntimEx.
*/
final PatcherManager patcherManager = new PatcherManager() {
public void addPatcher( Patch patch ) {
patchers.add(patch);
}
public void addErrorChecker( Patch patch ) {
errorCheckers.add(patch);
}
public void reportError( String msg, Locator src ) throws SAXException {
// set a flag to true to avoid returning a corrupted object.
setErrorFlag();
SAXParseException e = new SAXParseException(msg,src);
if(errorHandler==null)
throw e;
else
errorHandler.error(e);
}
};
/**
* ErrorHandler proxy to turn on the hadError flag when an error
* is found.
*/
final ErrorHandler errorHandler = new ErrorHandler() {
private ErrorHandler getErrorHandler() {
if( owner.getErrorHandler()==null )
return noopHandler;
else
return owner.getErrorHandler();
}
public void warning(SAXParseException e) throws SAXException {
getErrorHandler().warning(e);
}
public void error(SAXParseException e) throws SAXException {
setErrorFlag();
getErrorHandler().error(e);
}
public void fatalError(SAXParseException e) throws SAXException {
setErrorFlag();
getErrorHandler().fatalError(e);
}
};
/**
* {@link ErrorHandler} that does nothing.
*/
final ErrorHandler noopHandler = new ErrorHandler() {
public void warning(SAXParseException e) {
}
public void error(SAXParseException e) {
}
public void fatalError(SAXParseException e) {
setErrorFlag();
}
};
}
|
using System.Collections.Generic;
using System.Reflection;
using Xunit;
namespace System.Globalization.Tests
{
public class <API key>
{
public static IEnumerable<object[]> <API key>()
{
yield return new object[] { "ar" , DigitShapes.Context };
yield return new object[] { "ar-001" , DigitShapes.Context };
yield return new object[] { "ar-AE" , DigitShapes.Context };
yield return new object[] { "ar-BH" , DigitShapes.Context };
yield return new object[] { "ar-DJ" , DigitShapes.Context };
yield return new object[] { "ar-EG" , DigitShapes.Context };
yield return new object[] { "ar-ER" , DigitShapes.Context };
yield return new object[] { "ar-IL" , DigitShapes.Context };
yield return new object[] { "ar-IQ" , DigitShapes.Context };
yield return new object[] { "ar-JO" , DigitShapes.Context };
yield return new object[] { "ar-KM" , DigitShapes.Context };
yield return new object[] { "ar-KW" , DigitShapes.Context };
yield return new object[] { "ar-LB" , DigitShapes.Context };
yield return new object[] { "ar-MR" , DigitShapes.Context };
yield return new object[] { "ar-OM" , DigitShapes.Context };
yield return new object[] { "ar-PS" , DigitShapes.Context };
yield return new object[] { "ar-QA" , DigitShapes.Context };
yield return new object[] { "ar-SA" , DigitShapes.Context };
yield return new object[] { "ar-SD" , DigitShapes.Context };
yield return new object[] { "ar-SO" , DigitShapes.Context };
yield return new object[] { "ar-SS" , DigitShapes.Context };
yield return new object[] { "ar-SY" , DigitShapes.Context };
yield return new object[] { "ar-TD" , DigitShapes.Context };
yield return new object[] { "ar-YE" , DigitShapes.Context };
yield return new object[] { "dz" , DigitShapes.NativeNational };
yield return new object[] { "dz-BT" , DigitShapes.NativeNational };
yield return new object[] { "fa" , DigitShapes.Context };
yield return new object[] { "fa-IR" , DigitShapes.Context };
yield return new object[] { "km" , DigitShapes.NativeNational };
yield return new object[] { "km-KH" , DigitShapes.NativeNational };
yield return new object[] { "ks" , DigitShapes.NativeNational };
yield return new object[] { "ks-Arab" , DigitShapes.NativeNational };
yield return new object[] { "ks-Arab-IN", DigitShapes.NativeNational };
yield return new object[] { "ku" , DigitShapes.Context };
yield return new object[] { "ku-Arab" , DigitShapes.Context };
yield return new object[] { "ku-Arab-IQ", DigitShapes.Context };
yield return new object[] { "my" , DigitShapes.NativeNational };
yield return new object[] { "my-MM" , DigitShapes.NativeNational };
yield return new object[] { "ne-IN" , DigitShapes.NativeNational };
yield return new object[] { "nqo" , DigitShapes.NativeNational };
yield return new object[] { "nqo-GN" , DigitShapes.NativeNational };
yield return new object[] { "pa-Arab" , DigitShapes.NativeNational };
yield return new object[] { "pa-Arab-PK", DigitShapes.NativeNational };
yield return new object[] { "prs" , DigitShapes.NativeNational };
yield return new object[] { "prs-AF" , DigitShapes.NativeNational };
yield return new object[] { "ps" , DigitShapes.NativeNational };
yield return new object[] { "ps-AF" , DigitShapes.NativeNational };
yield return new object[] { "sd" , DigitShapes.NativeNational };
yield return new object[] { "sd-Arab" , DigitShapes.NativeNational };
yield return new object[] { "sd-Arab-PK", DigitShapes.NativeNational };
yield return new object[] { "ur-IN" , DigitShapes.NativeNational };
yield return new object[] { "uz-Arab" , DigitShapes.NativeNational };
yield return new object[] { "uz-Arab-AF", DigitShapes.NativeNational };
}
[Fact]
public void <API key>()
{
// DigitSubstitution is not used in number formatting.
Assert.Equal(DigitShapes.None, CultureInfo.InvariantCulture.NumberFormat.DigitSubstitution);
}
[Fact]
public void NativeDigitsTest()
{
string [] nativeDigits = CultureInfo.InvariantCulture.NumberFormat.NativeDigits;
Assert.Equal(new string [] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }, nativeDigits);
NumberFormatInfo nfi = (NumberFormatInfo) CultureInfo.InvariantCulture.NumberFormat.Clone();
string [] newDigits = new string [] { "\u0660", "\u0661", "\u0662", "\u0663", "\u0664", "\u0665", "\u0666", "\u0667", "\u0668", "\u0669" };
nfi.NativeDigits = newDigits;
Assert.Equal(newDigits, nfi.NativeDigits);
}
[Theory]
[MemberData(nameof(<API key>))]
public void <API key>(string cultureName, DigitShapes shape)
{
try
{
CultureInfo ci = CultureInfo.GetCultureInfo(cultureName);
Assert.Equal(ci.NumberFormat.DigitSubstitution, shape);
}
catch (<API key>)
{
// ignore the cultures that we cannot create as it is not supported on the platforms
}
}
}
}
|
/* <API key> includes */
@-ms-viewport {
width: device-width; }
@-o-viewport {
width: device-width; }
@font-face {
font-family: GDS-Logo;
src: local("HelveticaNeue"), local("Helvetica Neue"), local("Arial"), local("Helvetica"); }
@-ms-viewport {
width: device-width; }
@-o-viewport {
width: device-width; }
@-ms-viewport {
width: device-width; }
@-o-viewport {
width: device-width; }
@-ms-viewport {
width: device-width; }
@-o-viewport {
width: device-width; }
#global-header .header-wrapper, #global-header .header-wrapper .header-global, #global-header .header-wrapper .header-global .header-logo, #global-header .header-proposition #proposition-link,
#global-header .header-proposition #proposition-links, #global-header-bar, #<API key> .outer-block, #footer .footer-wrapper, #footer .footer-meta {
zoom: 1; }
#global-header .header-wrapper:after, #global-header .header-wrapper .header-global:after, #global-header .header-wrapper .header-global .header-logo:after, #global-header .header-proposition #proposition-link:after,
#global-header .header-proposition #proposition-links:after, #global-header-bar:after, #<API key> .outer-block:after, #footer .footer-wrapper:after, #footer .footer-meta:after {
content: "";
display: block;
clear: both; }
@-ms-viewport {
width: device-width; }
@-o-viewport {
width: device-width; }
#global-header .header-wrapper, #global-header .header-wrapper .header-global, #global-header .header-wrapper .header-global .header-logo, #global-header .header-proposition #proposition-link,
#global-header .header-proposition #proposition-links, #global-header-bar, #<API key> .outer-block, #footer .footer-wrapper, #footer .footer-meta {
zoom: 1; }
#global-header .header-wrapper:after, #global-header .header-wrapper .header-global:after, #global-header .header-wrapper .header-global .header-logo:after, #global-header .header-proposition #proposition-link:after,
#global-header .header-proposition #proposition-links:after, #global-header-bar:after, #<API key> .outer-block:after, #footer .footer-wrapper:after, #footer .footer-meta:after {
content: "";
display: block;
clear: both; }
@-ms-viewport {
width: device-width; }
@-o-viewport {
width: device-width; }
/* local styleguide includes */
/* Old depricated greys, new things should use the toolkit greys */
html, body, button, input, table, td, th {
font-family: "nta", Arial, sans-serif; }
html, body, div, h1, h2, h3, h4, h5, h6, article, aside, footer, header, hgroup, nav, section {
margin: 0;
padding: 0;
vertical-align: baseline; }
main {
display: block; }
.group:before,
.group:after {
content: "\0020";
display: block;
height: 0;
overflow: hidden; }
.group:after {
clear: both; }
.group {
zoom: 1; }
.content-fixed {
top: 0;
position: fixed; }
.shim {
display: block; }
/*
* 1. Prevents iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
-<API key>: 100%;
-ms-text-size-adjust: 100%;
background-color: #dee0e2; }
/*
Force the scrollbar to always display in IE10/11
*/
html {
-ms-overflow-style: scrollbar; }
body {
background: white;
color: #0b0c0c;
line-height: 1.5;
font-weight: 400;
-<API key>: antialiased;
-<API key>: grayscale; }
ol, ul, nav ol, nav ul {
list-style: inherit; }
fieldset {
border: none;
padding: 0; }
a:link {
color: #005ea5; }
a:visited {
color: #4c2c92; }
a:hover {
color: #2e8aca; }
a:active {
color: #2e8aca; }
a[rel="external"]:after {
background-image: url(external-links/external-link.png?0.12.0);
background-repeat: no-repeat; }
@media only screen and (-<API key>: 2), only screen and (<API key>: 2), only screen and (-<API key>: 20 / 10), only screen and (<API key>: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) {
a[rel="external"]:after {
background-image: url(external-links/external-link-24x24.png?0.12.0);
background-size: 12px 400px; } }
a[rel="external"]:after {
content: "\A0\A0\A0\A0";
background-position: right 6px; }
a[rel="external"]:hover:after {
background-position: right -382px; }
.external-link:after {
content: "\A0\A0\A0\A0\A0\A0\A0\A0";
background-position: right 0px; }
.external-link:hover:after {
background-position: right 0px; }
.external-link:after {
background-image: url(external-links/<API key>.png?0.12.0);
background-repeat: no-repeat; }
@media only screen and (-<API key>: 2), only screen and (<API key>: 2), only screen and (-<API key>: 20 / 10), only screen and (<API key>: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) {
.external-link:after {
background-image: url(external-links/<API key>.png?0.12.0);
background-size: 12px 400px; } }
html {
font-size: 62.5%;
overflow-y: scroll;
-<API key>: rgba(0, 0, 0, 0);
}
/*
* 1. Font-size increased to compensate for change to html element font-size in
* order to support beta typography which was set in ems
* (62.5% * 160% = 100%)
* 2. Addresses margins handled incorrectly in IE6/7
*/
body {
font-size: 160%;
margin: 0;
}
b,
strong {
font-weight: 600; }
img {
border: 0; }
button {
overflow: visible; }
abbr[title] {
cursor: help; }
/*
* 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
* 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box; }
input[type="search"]::-<API key> {
-webkit-appearance: <API key>;
margin-right: 2px; }
input[type="search"]::-<API key> {
-webkit-appearance: none; }
/* For image replacement */
.ir {
display: block;
text-indent: -999em;
overflow: hidden;
background-repeat: no-repeat;
text-align: left;
direction: ltr; }
.ir br {
display: none; }
/* Hide for both screenreaders and browsers */
.hidden {
display: none;
visibility: hidden; }
/* Hide only visually, but have it available for screenreaders */
.visuallyhidden {
position: absolute;
left: -9999em;
/*
* Extends the .visuallyhidden class to allow the element to be
* focusable when navigated to via the keyboard
*/ }
.visuallyhidden.focusable:active, .visuallyhidden.focusable:focus {
clip: auto;
height: auto;
margin: 0;
overflow: visible;
position: static;
width: auto; }
/* Hide visually and from screenreaders, but maintain layout */
.invisible {
visibility: hidden; }
/* Give a strong clear visual idea as to what is currently in focus */
a {
-<API key>: rgba(0, 0, 0, 0.3); }
a:focus {
background-color: #ffbf47;
outline: 3px solid #ffbf47; }
/* Make skiplinks visible when they are tabbed to */
.skiplink {
position: absolute;
left: -9999em; }
.skiplink:focus {
position: static; }
#skiplink-container {
text-align: center;
background: #0b0c0c; }
#skiplink-container div {
text-align: left;
margin: 0 auto;
max-width: 1020px; }
#skiplink-container .skiplink {
display: -moz-inline-stack;
display: inline-block;
zoom: 1;
display: inline;
margin: 0.75em 0 0 30px; }
input:focus,
textarea:focus,
select:focus,
button:focus,
#global-header input:focus {
outline: 3px solid #ffbf47; }
#global-header h1 a:focus {
background-color: transparent;
outline: none; }
#global-header a:focus {
color: #0b0c0c; }
@-ms-viewport {
width: device-width; }
@-o-viewport {
width: device-width; }
#global-header .header-wrapper, #global-header .header-wrapper .header-global, #global-header .header-wrapper .header-global .header-logo, #global-header .header-proposition #proposition-link,
#global-header .header-proposition #proposition-links, #global-header-bar, #<API key> .outer-block, #footer .footer-wrapper, #footer .footer-meta {
zoom: 1; }
#global-header .header-wrapper:after, #global-header .header-wrapper .header-global:after, #global-header .header-wrapper .header-global .header-logo:after, #global-header .header-proposition #proposition-link:after,
#global-header .header-proposition #proposition-links:after, #global-header-bar:after, #<API key> .outer-block:after, #footer .footer-wrapper:after, #footer .footer-meta:after {
content: "";
display: block;
clear: both; }
@-ms-viewport {
width: device-width; }
@-o-viewport {
width: device-width; }
#global-header {
background-color: #0b0c0c;
width: 100%; }
#global-header .header-wrapper {
background-color: #0b0c0c;
max-width: 990px;
margin: 0 auto;
padding-top: 8px;
padding-bottom: 8px;
padding-left: 15px;
padding-right: 15px;
width: 990px; }
#global-header .header-wrapper .header-global .header-logo {
float: left;
width: 33.33%; }
@media screen and (max-width: 379px) {
#global-header .header-wrapper .header-global .header-logo {
width: auto;
float: none; } }
#global-header .header-wrapper .header-global .header-logo .content {
margin: 0 15px; }
#global-header .header-wrapper .header-global .header-logo {
margin: 5px 0 2px; }
#global-header.with-proposition .header-wrapper .header-global {
float: left;
width: 33.33%; }
#global-header.with-proposition .header-wrapper .header-global .header-logo,
#global-header.with-proposition .header-wrapper .header-global .site-search {
width: 100%; }
#global-header.with-proposition .header-wrapper .header-proposition {
width: 66.66%;
float: left; }
#global-header.with-proposition .header-wrapper .header-proposition .content {
margin: 0 15px; }
#global-header #logo {
float: left;
position: relative;
top: 1px;
height: 30px;
overflow: visible;
vertical-align: baseline;
color: white;
font-weight: bold;
font-size: 30px;
line-height: 1em;
text-decoration: none;
text-rendering: optimizeLegibility;
margin-bottom: -1px;
padding-bottom: 1px; }
#global-header #logo img {
position: relative;
top: -2px;
width: 35px;
height: 31px;
padding-right: 6px;
float: left;
display: inline;
line-height: inherit;
border: none; }
#global-header #logo:hover, #global-header #logo:focus {
text-decoration: none;
border-bottom: 1px solid;
padding-bottom: 0; }
#global-header #logo:active {
color: #2b8cc4; }
#global-header .header-proposition {
padding-top: 10px;
padding-top: 0; }
#global-header .header-proposition #proposition-name {
font-family: "nta", Arial, sans-serif;
font-size: 24px;
line-height: 1.25;
font-weight: 400;
text-transform: none;
font-weight: bold;
color: white;
text-decoration: none; }
@media (max-width: 640px) {
#global-header .header-proposition #proposition-name {
font-size: 18px;
line-height: 1.2; } }
#global-header .header-proposition a#proposition-name:hover {
text-decoration: underline; }
#global-header .header-proposition a.menu {
font-family: "nta", Arial, sans-serif;
font-size: 16px;
line-height: 1.25;
font-weight: 400;
text-transform: none;
color: white;
display: block;
float: right;
text-decoration: none;
padding-top: 6px;
display: none; }
@media (max-width: 640px) {
#global-header .header-proposition a.menu {
font-size: 14px;
line-height: 1.14286; } }
#global-header .header-proposition a.menu:hover {
text-decoration: underline; }
#global-header .header-proposition a.menu:after {
display: inline-block;
font-size: 8px;
height: 8px;
padding-left: 5px;
vertical-align: middle;
content: " \25BC"; }
#global-header .header-proposition a.menu.js-hidden:after {
content: " \25B2"; }
#global-header .header-proposition #proposition-menu {
margin-top: 5px; }
#global-header .header-proposition #proposition-menu.no-proposition-name {
margin-top: 37px; }
#global-header .header-proposition #proposition-link,
#global-header .header-proposition #proposition-links {
clear: both;
margin: 2px 0 0 0;
padding: 0; }
.js-enabled #global-header .header-proposition #proposition-link, .js-enabled
#global-header .header-proposition #proposition-links {
display: none;
display: block; }
.js-enabled #global-header .header-proposition #proposition-link.js-visible, .js-enabled
#global-header .header-proposition #proposition-links.js-visible {
display: block; }
#global-header .header-proposition #proposition-link li,
#global-header .header-proposition #proposition-links li {
float: left;
width: 50%;
padding: 3px 0;
border-bottom: 1px solid #2e3133;
display: block;
width: auto;
padding: 0 15px 0 0;
border-bottom: 0; }
#global-header .header-proposition #proposition-link li.clear-child,
#global-header .header-proposition #proposition-links li.clear-child {
clear: left; }
#global-header .header-proposition #proposition-link a,
#global-header .header-proposition #proposition-links a {
color: white;
text-decoration: none;
font-family: "nta", Arial, sans-serif;
font-size: 14px;
line-height: 1.42857;
font-weight: 700;
text-transform: none;
font-family: "nta", Arial, sans-serif;
font-size: 16px;
line-height: 1.25;
font-weight: 700;
text-transform: none;
line-height: 23px; }
@media (max-width: 640px) {
#global-header .header-proposition #proposition-link a,
#global-header .header-proposition #proposition-links a {
font-size: 12px;
line-height: 1.25; } }
@media (max-width: 640px) {
#global-header .header-proposition #proposition-link a,
#global-header .header-proposition #proposition-links a {
font-size: 14px;
line-height: 1.14286; } }
#global-header .header-proposition #proposition-link a:hover,
#global-header .header-proposition #proposition-links a:hover {
text-decoration: underline; }
#global-header .header-proposition #proposition-link a.active,
#global-header .header-proposition #proposition-links a.active {
color: #1d8feb; }
#global-header .header-proposition #proposition-link a:focus,
#global-header .header-proposition #proposition-links a:focus {
color: #0b0c0c; }
#global-header .header-proposition #proposition-link {
float: right;
line-height: 22px;
float: none; }
.js-enabled #global-header .header-proposition #proposition-link {
display: block; }
/* Global header bar */
#global-header-bar {
margin: 0 auto;
width: auto;
max-width: 1020px;
width: 1020px; }
#global-header-bar .inner-block {
padding-left: 15px;
padding-right: 15px;
padding-left: 30px;
padding-right: 30px; }
#global-header-bar .header-bar {
height: 10px;
background-color: #005ea5;
font-size: 0; }
/* Global cookie message */
.js-enabled #<API key> {
display: none;
/* shown with JS, always on for non-JS */ }
#<API key> {
background-color: #d5e8f3;
padding-top: 10px;
padding-bottom: 10px; }
#<API key> .outer-block {
margin: 0 auto;
width: auto;
max-width: 1020px;
width: 1020px; }
#<API key> .inner-block {
padding-left: 15px;
padding-right: 15px;
padding-left: 30px;
padding-right: 30px; }
#<API key> p {
font-family: "nta", Arial, sans-serif;
font-size: 16px;
line-height: 1.25;
font-weight: 400;
text-transform: none;
margin: 0; }
@media (max-width: 640px) {
#<API key> p {
font-size: 14px;
line-height: 1.14286; } }
/* Global footer */
#footer {
background-color: #dee0e2;
border-top: 1px solid #a1acb2; }
#footer .footer-wrapper {
margin: 0 auto;
width: auto;
max-width: 1020px;
width: 1020px;
padding-top: 20px;
padding-top: 60px;
background-color: #dee0e2;
margin: 0 auto; }
#footer a {
color: #454a4c; }
#footer a:hover {
color: #171819; }
#footer h2 {
font-family: "nta", Arial, sans-serif;
font-size: 24px;
line-height: 1.25;
font-weight: 400;
text-transform: none;
font-weight: bold;
color: #171819;
margin: 0; }
@media (max-width: 640px) {
#footer h2 {
font-size: 18px;
line-height: 1.2; } }
#footer h2 a {
color: inherit; }
#footer .footer-meta {
padding-left: 15px;
padding-right: 15px;
padding-left: 30px;
padding-right: 30px;
padding-bottom: 60px;
clear: both;
font-size: 0;
color: #454a4c; }
#footer .footer-meta .footer-meta-inner {
display: inline-block;
vertical-align: bottom;
width: 100%;
width: 75%;
float: left;
display: block; }
#footer .footer-meta .footer-meta-inner ul {
font-family: "nta", Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
font-weight: 400;
text-transform: none;
display: inline-block;
list-style: none;
margin: 0 0 1.5em 0;
padding: 0;
margin: 0 0 1em 0; }
@media (max-width: 640px) {
#footer .footer-meta .footer-meta-inner ul {
font-size: 14px;
line-height: 1.5; } }
#footer .footer-meta .footer-meta-inner ul li {
display: inline-block;
margin: 0 15px 0 0;
display: inline;
margin-right: 0;
padding-right: 15px; }
#footer .footer-meta .footer-meta-inner .<API key> {
clear: left;
position: relative;
padding-left: 53px; }
#footer .footer-meta .footer-meta-inner .<API key> .logo {
margin-bottom: 1em;
padding-top: 0;
position: absolute;
left: 0;
top: 0;
width: 41px;
height: 100%; }
#footer .footer-meta .footer-meta-inner .<API key> .logo a {
display: block;
width: 41px;
height: 17px;
overflow: hidden;
text-indent: -999em;
background: url(images/<API key>.png?0.12.0) 0 0 no-repeat; }
@media only screen and (-<API key>: 2), only screen and (<API key>: 2), only screen and (-<API key>: 20 / 10), only screen and (<API key>: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) {
#footer .footer-meta .footer-meta-inner .<API key> .logo a {
background-image: url(images/<API key>.png?0.12.0);
background-size: 41px 17px; } }
#footer .footer-meta .footer-meta-inner .<API key> p {
font-family: "nta", Arial, sans-serif;
font-size: 16px;
line-height: 1.25;
font-weight: 400;
text-transform: none;
margin: 0;
padding-top: 0.1em; }
@media (max-width: 640px) {
#footer .footer-meta .footer-meta-inner .<API key> p {
font-size: 14px;
line-height: 1.14286; } }
font-family: "nta", Arial, sans-serif;
font-size: 16px;
line-height: 1.25;
font-weight: 400;
text-transform: none;
margin: 30px 0 0 0;
width: 100%;
display: block;
display: inline-block;
text-align: inherit;
width: 25%;
padding-top: 15px;
margin-top: 0;
float: right;
height: 150px;
width: 24%; }
@media (max-width: 640px) {
font-size: 14px;
line-height: 1.14286; } }
display: block;
background-image: url(images/govuk-crest.png?0.12.0);
background-repeat: no-repeat;
background-position: 50% 0%;
background-position: 100% 0%;
text-align: center;
text-decoration: none;
text-align: right;
padding: 115px 0 0 0; }
@media only screen and (-<API key>: 2), only screen and (<API key>: 2), only screen and (-<API key>: 20 / 10), only screen and (<API key>: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) {
background-image: url(images/govuk-crest-2x.png?0.12.0);
background-size: 125px 102px; } }
|
using System.Collections.Generic;
using Xunit;
namespace System.Globalization.Tests
{
public class <API key>
{
public static IEnumerable<object[]> <API key>()
{
yield return new object[] { "", 0, new string[0] }; // Empty string
yield return new object[] { "Hello", 5, new string[0] }; // Index = string.Length
// Surrogate pair
yield return new object[] { "s\uDBFF\uDFFF$", 0, new string[] { "s", "\uDBFF\uDFFF", "$" } };
yield return new object[] { "s\uDBFF\uDFFF$", 1, new string[] { "\uDBFF\uDFFF", "$" } };
// Combining characters
yield return new object[] { "13229^a\u20D1a", 6, new string[] { "a\u20D1", "a" } };
yield return new object[] { "13229^a\u20D1a", 0, new string[] { "1", "3", "2", "2", "9", "^", "a\u20D1", "a" } };
// Single base and combining character
yield return new object[] { "a\u0300", 0, new string[] { "a\u0300" } };
yield return new object[] { "a\u0300", 1, new string[] { "\u0300" } };
// Lone combining character
yield return new object[] { "\u0300\u0300", 0, new string[] { "\u0300", "\u0300" } };
}
[Theory]
[MemberData(nameof(<API key>))]
public void <API key>(string str, int index, string[] expected)
{
if (index == 0)
{
<API key> basicEnumerator = StringInfo.<API key>(str);
int basicCounter = 0;
while (basicEnumerator.MoveNext())
{
Assert.Equal(expected[basicCounter], basicEnumerator.Current.ToString());
basicCounter++;
}
Assert.Equal(expected.Length, basicCounter);
}
<API key> indexedEnumerator = StringInfo.<API key>(str, index);
int indexedCounter = 0;
while (indexedEnumerator.MoveNext())
{
Assert.Equal(expected[indexedCounter], indexedEnumerator.Current.ToString());
indexedCounter++;
}
Assert.Equal(expected.Length, indexedCounter);
}
[Fact]
public void <API key>()
{
Assert.Throws<<API key>>("str", () => StringInfo.<API key>(null)); // Str is null
Assert.Throws<<API key>>("str", () => StringInfo.<API key>(null, 0)); // Str is null
Assert.Throws<<API key>>("index", () => StringInfo.<API key>("abc", -1)); // Index < 0
Assert.Throws<<API key>>("index", () => StringInfo.<API key>("abc", 4)); // Index > str.Length
}
}
}
|
#include "graphics/surface.h"
#include "graphics/thumbnail.h"
#include "dm/inventory.h"
#include "dm/dungeonman.h"
#include "dm/eventman.h"
#include "dm/group.h"
#include "dm/menus.h"
#include "dm/gfx.h"
#include "dm/text.h"
#include "dm/objectman.h"
#include "dm/timeline.h"
#include "dm/projexpl.h"
#include "dm/sounds.h"
namespace DM {
void InventoryMan::initConstants() {
static const char* skillLevelNamesEN[15] = {"NEOPHYTE", "NOVICE", "APPRENTICE", "JOURNEYMAN", "CRAFTSMAN",
"ARTISAN", "ADEPT", "EXPERT", "` MASTER", "a MASTER","b MASTER", "c MASTER", "d MASTER", "e MASTER", "ARCHMASTER"};
static const char* skillLevelNamesDE[15] = {"ANFAENGER", "NEULING", "LEHRLING", "ARBEITER", "GESELLE", "HANDWERKR", "FACHMANN",
"EXPERTE", "` MEISTER", "a MEISTER", "b MEISTER", "c MEISTER", "d MEISTER", "e MEISTER", "ERZMEISTR"};
static const char* skillLevelNamesFR[15] = {"NEOPHYTE", "NOVICE", "APPRENTI", "COMPAGNON", "ARTISAN", "PATRON",
"ADEPTE", "EXPERT", "MAITRE '", "MAITRE a", "MAITRE b", "MAITRE c", "MAITRE d", "MAITRE e", "SUR-MAITRE"};
const char **<API key>;
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY:
<API key> = skillLevelNamesEN;
break;
case Common::DE_DEU:
<API key> = skillLevelNamesDE;
break;
case Common::FR_FRA:
<API key> = skillLevelNamesFR;
break;
}
for (int i = 0; i < 15; ++i)
_skillLevelNames[i] = <API key>[i];
_boxPanel = Box(80, 223, 52, 124); // @ <API key>
}
InventoryMan::InventoryMan(DMEngine *vm) : _vm(vm) {
<API key> = 0;
_panelContent = <API key>;
for (uint16 i = 0; i < 8; ++i)
_chestSlots[i] = Thing(0);
_openChest = _vm->_thingNone;
_objDescTextXpos = 0;
_objDescTextYpos = 0;
for (int i = 0; i < 15; i++)
_skillLevelNames[i] = nullptr;
initConstants();
}
void InventoryMan::toggleInventory(ChampionIndex championIndex) {
static Box boxFloppyZzzCross(174, 218, 2, 12); // @ <API key>
DisplayMan &display = *_vm->_displayMan;
ChampionMan &championMan = *_vm->_championMan;
if ((championIndex != <API key>) && !championMan._champions[championIndex]._currHealth)
return;
if (_vm->_pressingMouth || _vm->_pressingEye)
return;
_vm-><API key> = true;
uint16 <API key> = <API key>;
if (_vm->indexToOrdinal(championIndex) == <API key>)
championIndex = <API key>;
_vm->_eventMan->showMouse();
if (<API key>) {
<API key> = _vm->indexToOrdinal(kDMChampionNone);
closeChest();
Champion *champion = &championMan._champions[_vm->ordinalToIndex(<API key>)];
if (champion->_currHealth && !championMan.<API key>) {
setFlag(champion->_attributes, <API key>);
championMan.drawChampionState((ChampionIndex)_vm->ordinalToIndex(<API key>));
}
if (championMan._partyIsSleeping) {
_vm->_eventMan->hideMouse();
return;
}
if (championIndex == <API key>) {
_vm->_eventMan-><API key> = true;
_vm->_menuMan->drawMovementArrows();
_vm->_eventMan->hideMouse();
_vm->_eventMan-><API key> = _vm->_eventMan-><API key>;
_vm->_eventMan-><API key> = _vm->_eventMan-><API key>;
_vm->_eventMan->discardAllInput();
display.drawFloorAndCeiling();
return;
}
}
display.<API key> = false;
<API key> = _vm->indexToOrdinal(championIndex);
if (!<API key>)
display.shadeScreenBox(&display._boxMovementArrows, kDMColorBlack);
Champion *champion = &championMan._champions[championIndex];
display.loadIntoBitmap(<API key>, display._bitmapViewport);
if (championMan.<API key>)
display.fillBoxBitmap(display._bitmapViewport, boxFloppyZzzCross, kDMColorDarkestGray, <API key>, k136_heightViewport);
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY:
_vm->_textMan->printToViewport(5, 116, <API key>, "HEALTH");
_vm->_textMan->printToViewport(5, 124, <API key>, "STAMINA");
break;
case Common::DE_DEU:
_vm->_textMan->printToViewport(5, 116, <API key>, "GESUND");
_vm->_textMan->printToViewport(5, 124, <API key>, "KRAFT");
break;
case Common::FR_FRA:
_vm->_textMan->printToViewport(5, 116, <API key>, "SANTE");
_vm->_textMan->printToViewport(5, 124, <API key>, "VIGUEUR");
break;
}
_vm->_textMan->printToViewport(5, 132, <API key>, "MANA");
for (uint16 i = kDMSlotReadyHand; i < kDMSlotChest1; i++)
championMan.drawSlot(championIndex, i);
setFlag(champion->_attributes, <API key> | <API key> | kDMAttributePanel | kDMAttributeLoad | <API key> | <API key>);
championMan.drawChampionState(championIndex);
_vm->_eventMan-><API key> = true;
_vm->_eventMan->hideMouse();
_vm->_eventMan-><API key> = _vm->_eventMan-><API key>;
_vm->_eventMan-><API key> = nullptr;
_vm->_eventMan->discardAllInput();
}
void InventoryMan::<API key>(ChampionIndex championIndex) {
DisplayMan &dispMan = *_vm->_displayMan;
dispMan.<API key> = false;
Box box;
box._rect.top = 0;
box._rect.bottom = 28;
box._rect.left = championIndex * <API key> + 7;
box._rect.right = box._rect.left + 31;
dispMan.blitToScreen(_vm->_championMan->_champions[championIndex]._portrait, &box, k16_byteWidth, <API key>, 29);
}
void InventoryMan::<API key>(int16 x, int16 y, int16 pixelWidth, Color color) {
DisplayMan &display = *_vm->_displayMan;
Box box;
box._rect.left = x;
box._rect.right = box._rect.left + pixelWidth;
box._rect.top = y;
box._rect.bottom = box._rect.top + 6;
display.<API key> = false;
display.fillBoxBitmap(display._bitmapViewport, box, color, <API key>, k136_heightViewport);
}
void InventoryMan::<API key>(int16 amount, int16 y, Color color) {
if (amount < -512)
color = kDMColorRed;
else if (amount < 0)
color = kDMColorYellow;
int16 pixelWidth = amount + 1024;
if (pixelWidth == 3072)
pixelWidth = 3071;
pixelWidth /= 32;
<API key>(115, y + 2, pixelWidth, kDMColorBlack);
<API key>(113, y, pixelWidth, color);
}
void InventoryMan::<API key>() {
static Box boxFood(112, 159, 60, 68); // @ <API key>
static Box boxWater(112, 159, 83, 91); // @ <API key>
static Box boxPoisoned(112, 207, 105, 119); // @ <API key>
Champion &champ = _vm->_championMan->_champions[<API key>];
closeChest();
DisplayMan &dispMan = *_vm->_displayMan;
dispMan.blitToViewport(dispMan.<API key>(<API key>), _boxPanel, k72_byteWidth, kDMColorRed, 73);
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY:
dispMan.blitToViewport(dispMan.<API key>(<API key>), boxFood, k24_byteWidth, kDMColorDarkestGray, 9);
dispMan.blitToViewport(dispMan.<API key>(<API key>), boxWater, k24_byteWidth, kDMColorDarkestGray, 9);
break;
case Common::DE_DEU:
dispMan.blitToViewport(dispMan.<API key>(<API key>), boxFood, k32_byteWidth, kDMColorDarkestGray, 9);
dispMan.blitToViewport(dispMan.<API key>(<API key>), boxWater, k32_byteWidth, kDMColorDarkestGray, 9);
break;
case Common::FR_FRA:
dispMan.blitToViewport(dispMan.<API key>(<API key>), boxFood, k48_byteWidth, kDMColorDarkestGray, 9);
dispMan.blitToViewport(dispMan.<API key>(<API key>), boxWater, k24_byteWidth, kDMColorDarkestGray, 9);
break;
}
if (champ._poisonEventCount)
dispMan.blitToViewport(dispMan.<API key>(<API key>),
boxPoisoned, k48_byteWidth, kDMColorDarkestGray, 15);
<API key>(champ._food, 69, kDMColorLightBrown);
<API key>(champ._water, 92, kDMColorBlue);
}
void InventoryMan::<API key>() {
DisplayMan &display = *_vm->_displayMan;
_panelContent = <API key>;
display.blitToViewport(display.<API key>(<API key>),
_boxPanel, k72_byteWidth, kDMColorDarkGreen, 73);
}
void InventoryMan::drawPanel() {
closeChest();
ChampionMan &cm = *_vm->_championMan;
if (cm.<API key>) {
<API key>();
return;
}
Thing thing = cm._champions[_vm->ordinalToIndex(<API key>)].getSlot(kDMSlotActionHand);
_panelContent = <API key>;
switch (thing.getType()) {
case <API key>:
_panelContent = <API key>;
break;
case kDMThingTypeScroll:
_panelContent = <API key>;
break;
default:
thing = _vm->_thingNone;
break;
}
if (thing == _vm->_thingNone)
<API key>();
else
drawPanelObject(thing, false);
}
void InventoryMan::closeChest() {
DungeonMan &dunMan = *_vm->_dungeonMan;
bool <API key> = true;
if (_openChest == _vm->_thingNone)
return;
Container *container = (Container *)dunMan.getThingData(_openChest);
_openChest = _vm->_thingNone;
container->getSlot() = _vm->_thingEndOfList;
Thing prevThing;
for (int16 chestSlotIndex = 0; chestSlotIndex < 8; ++chestSlotIndex) {
Thing thing = _chestSlots[chestSlotIndex];
if (thing != _vm->_thingNone) {
_chestSlots[chestSlotIndex] = _vm->_thingNone; // CHANGE8_09_FIX
if (<API key>) {
<API key> = false;
*dunMan.getThingData(thing) = _vm->_thingEndOfList.toUint16();
container->getSlot() = prevThing = thing;
} else {
dunMan.linkThingToList(thing, prevThing, kDMMapXNotOnASquare, 0);
prevThing = thing;
}
}
}
}
void InventoryMan::<API key>(int16 yPos, char *text) {
for (char *iter = text; *iter != '\0'; ++iter) {
if ((*iter >= 'A') && (*iter <= 'Z'))
*iter -= 64;
else if (*iter >= '{') // this branch is <API key>
*iter -= 96;
}
_vm->_textMan->printToViewport(162 - (6 * strlen(text) / 2), yPos, kDMColorBlack, text, kDMColorWhite);
}
void InventoryMan::drawPanelScroll(Scroll *scroll) {
DisplayMan &dispMan = *_vm->_displayMan;
char stringFirstLine[300];
_vm->_dungeonMan->decodeText(stringFirstLine, Thing(scroll-><API key>()), (TextType)(kDMTextTypeScroll | <API key>));
char *charRed = stringFirstLine;
while (*charRed && (*charRed != '\n'))
charRed++;
*charRed = '\0';
dispMan.blitToViewport(dispMan.<API key>(<API key>),
_boxPanel, k72_byteWidth, kDMColorRed, 73);
int16 lineCount = 1;
charRed++;
char *charGreen = charRed; // first char of the second line
while (*charGreen) {
/* BUG0_47 Graphical glitch when you open a scroll. If there is a single line of text in a scroll
(with no carriage return) then charGreen points to undefined data. This may result in a graphical
glitch and also corrupt other memory. This is not an issue in the original dungeons where all
scrolls contain at least one carriage return character */
if (*charGreen == '\n')
lineCount++;
charGreen++;
}
if (*(charGreen - 1) != '\n')
lineCount++;
else if (*(charGreen - 2) == '\n')
lineCount
int16 yPos = 92 - (7 * lineCount) / 2; // center the text vertically
<API key>(yPos, stringFirstLine);
charGreen = charRed;
while (*charGreen) {
yPos += 7;
while (*charRed && (*charRed != '\n'))
charRed++;
if (!(*charRed))
charRed[1] = '\0';
*charRed++ = '\0';
<API key>(yPos, charGreen);
charGreen = charRed;
}
}
void InventoryMan::openAndDrawChest(Thing thingToOpen, Container *chest, bool isPressingEye) {
DisplayMan &dispMan = *_vm->_displayMan;
ObjectMan &objMan = *_vm->_objectMan;
if (_openChest == thingToOpen)
return;
if (_openChest != _vm->_thingNone)
closeChest(); // CHANGE8_09_FIX
_openChest = thingToOpen;
if (!isPressingEye) {
objMan.drawIconInSlotBox(<API key>, <API key>);
}
dispMan.blitToViewport(dispMan.<API key>(<API key>),
_boxPanel, k72_byteWidth, kDMColorRed, 73);
int16 chestSlotIndex = 0;
Thing thing = chest->getSlot();
int16 thingCount = 0;
while (thing != _vm->_thingEndOfList) {
if (++thingCount > 8)
break; // CHANGE8_08_FIX, make sure that no more than the first 8 objects in a chest are drawn
objMan.drawIconInSlotBox(chestSlotIndex + <API key>, objMan.getIconIndex(thing));
_chestSlots[chestSlotIndex++] = thing;
thing = _vm->_dungeonMan->getNextThing(thing);
}
while (chestSlotIndex < 8) {
objMan.drawIconInSlotBox(chestSlotIndex + <API key>, kDMIconIndiceNone);
_chestSlots[chestSlotIndex++] = _vm->_thingNone;
}
}
void InventoryMan::drawIconToViewport(IconIndice iconIndex, int16 xPos, int16 yPos) {
static byte iconBitmap[16 * 16];
Box boxIcon(xPos, xPos + 15, yPos, yPos + 15);
_vm->_objectMan-><API key>(iconIndex, iconBitmap);
_vm->_displayMan->blitToViewport(iconBitmap, boxIcon, k8_byteWidth, <API key>, 16);
}
void InventoryMan::<API key>(int16 potentialAttribMask, int16 actualAttribMask, const char **attribStrings, char *destString, const char *prefixString, const char *suffixString) {
uint16 identicalBitCount = 0;
int16 attribMask = 1;
for (uint16 stringIndex = 0; stringIndex < 16; stringIndex++, attribMask <<= 1) {
if (attribMask & potentialAttribMask & actualAttribMask)
identicalBitCount++;
}
if (identicalBitCount == 0) {
*destString = '\0';
return;
}
strcpy(destString, prefixString);
attribMask = 1;
for (uint16 stringIndex = 0; stringIndex < 16; stringIndex++, attribMask <<= 1) {
if (attribMask & potentialAttribMask & actualAttribMask) {
strcat(destString, attribStrings[stringIndex]);
if (identicalBitCount
strcat(destString, ", ");
} else if (identicalBitCount == 1) {
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY: strcat(destString, " AND "); break;
case Common::DE_DEU: strcat(destString, " UND "); break;
case Common::FR_FRA: strcat(destString, " ET "); break;
}
}
}
}
strcat(destString, suffixString);
}
void InventoryMan::<API key>(const char *descString) {
if (descString[0] == '\f') { // form feed
descString++;
_objDescTextXpos = 108;
_objDescTextYpos = 59;
}
if (descString[0]) {
char stringTmpBuff[128];
strcpy(stringTmpBuff, descString);
char *stringLine = stringTmpBuff;
bool severalLines = false;
char *string = nullptr;
while (*stringLine) {
if (strlen(stringLine) > 18) { // if string is too long to fit on one line
string = &stringLine[17];
while (*string != ' ') // go back to the last space character
string
*string = '\0'; // and split the string there
severalLines = true;
}
_vm->_textMan->printToViewport(_objDescTextXpos, _objDescTextYpos, <API key>, stringLine);
_objDescTextYpos += 7;
if (severalLines) {
severalLines = false;
stringLine = ++string;
} else {
*stringLine = '\0';
}
}
}
}
void InventoryMan::drawPanelArrowOrEye(bool pressingEye) {
static Box boxArrowOrEye(83, 98, 57, 65); // @ <API key>
DisplayMan &dispMan = *_vm->_displayMan;
dispMan.blitToViewport(dispMan.<API key>(pressingEye ? <API key> : <API key>),
boxArrowOrEye, k8_byteWidth, kDMColorRed, 9);
}
void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
static Box boxObjectDescCircle(105, 136, 53, 79); // @ <API key>
DungeonMan &dungeon = *_vm->_dungeonMan;
ObjectMan &objMan = *_vm->_objectMan;
DisplayMan &dispMan = *_vm->_displayMan;
ChampionMan &champMan = *_vm->_championMan;
TextMan &textMan = *_vm->_textMan;
if (_vm->_pressingEye || _vm->_pressingMouth)
closeChest();
uint16 *rawThingPtr = dungeon.getThingData(thingToDraw);
<API key>("\f"); // form feed
ThingType thingType = thingToDraw.getType();
if (thingType == kDMThingTypeScroll)
drawPanelScroll((Scroll *)rawThingPtr);
else if (thingType == <API key>)
openAndDrawChest(thingToDraw, (Container *)rawThingPtr, pressingEye);
else {
IconIndice iconIndex = objMan.getIconIndex(thingToDraw);
dispMan.blitToViewport(dispMan.<API key>(<API key>),
_boxPanel, k72_byteWidth, kDMColorRed, 73);
dispMan.blitToViewport(dispMan.<API key>(<API key>),
boxObjectDescCircle, k16_byteWidth, kDMColorDarkestGray, 27);
Common::String descString;
Common::String str;
if (iconIndex == <API key>) {
switch (_vm->getGameLanguage()) { // localized
case Common::FR_FRA:
// Fix original bug dur to a cut&paste error: string was concatenated then overwritten by the name
str = Common::String::format("%s %s", objMan._objectNames[iconIndex], champMan._champions[((Junk *)rawThingPtr)->getChargeCount()]._name);
break;
default: // German and English versions are the same
str = Common::String::format("%s %s", champMan._champions[((Junk *)rawThingPtr)->getChargeCount()]._name, objMan._objectNames[iconIndex]);
break;
}
descString = str;
} else if ((thingType == kDMThingTypePotion)
&& (iconIndex != <API key>)
&& (champMan.getSkillLevel((ChampionIndex)_vm->ordinalToIndex(<API key>), kDMSkillPriest) > 1)) {
str = ('_' + ((Potion *)rawThingPtr)->getPower() / 40);
str += " ";
str += objMan._objectNames[iconIndex];
descString = str;
} else {
descString = objMan._objectNames[iconIndex];
}
textMan.printToViewport(134, 68, <API key>, descString.c_str());
drawIconToViewport(iconIndex, 111, 59);
_objDescTextYpos = 87;
uint16 potentialAttribMask = 0;
uint16 actualAttribMask = 0;
switch (thingType) {
case kDMThingTypeWeapon: {
potentialAttribMask = <API key> | <API key> | <API key>;
Weapon *weapon = (Weapon *)rawThingPtr;
actualAttribMask = (weapon->getCursed() << 3) | (weapon->getPoisoned() << 1) | (weapon->getBroken() << 2);
if ((iconIndex >= <API key>)
&& (iconIndex <= <API key>)
&& (weapon->getChargeCount() == 0)) {
switch (_vm->getGameLanguage()) { // localized
default:
case Common::EN_ANY:
<API key>("(BURNT OUT)");
break;
case Common::DE_DEU:
<API key>("(AUSGEBRANNT)");
break;
case Common::FR_FRA:
<API key>("(CONSUME)");
break;
}
}
break;
}
case kDMThingTypeArmour: {
potentialAttribMask = <API key> | <API key>;
Armour *armour = (Armour *)rawThingPtr;
actualAttribMask = (armour->getCursed() << 3) | (armour->getBroken() << 2);
break;
}
case kDMThingTypePotion: {
potentialAttribMask = <API key>;
Potion *potion = (Potion *)rawThingPtr;
actualAttribMask = dungeon._objectInfos[<API key> + potion->getType()].getAllowedSlots();
break;
}
case kDMThingTypeJunk: {
if ((iconIndex >= <API key>) && (iconIndex <= <API key>)) {
potentialAttribMask = 0;
const char *descStringEN[4] = {"(EMPTY)", "(ALMOST EMPTY)", "(ALMOST FULL)", "(FULL)"};
const char *descStringDE[4] = {"(LEER)", "(FAST LEER)", "(FAST VOLL)", "(VOLL)"};
const char *descStringFR[4] = {"(VIDE)", "(PRESQUE VIDE)", "(PRESQUE PLEINE)", "(PLEINE)"};
Junk *junk = (Junk *)rawThingPtr;
switch (_vm->getGameLanguage()) { // localized
case Common::DE_DEU:
descString = descStringDE[junk->getChargeCount()];
break;
case Common::FR_FRA:
descString = descStringFR[junk->getChargeCount()];
break;
default:
descString = descStringEN[junk->getChargeCount()];
break;
}
<API key>(descString.c_str());
} else if ((iconIndex >= <API key>) && (iconIndex <= <API key>)) {
const static char *directionNameEN[4] = {"NORTH", "EAST", "SOUTH", "WEST"};
const static char *directionNameDE[4] = {"NORDEN", "OSTEN", "SUEDEN", "WESTEN"};
const static char *directionNameFR[4] = {"AU NORD", "A L'EST", "AU SUD", "A L'OUEST"};
potentialAttribMask = 0;
switch (_vm->getGameLanguage()) { // localized
case Common::DE_DEU:
str = "GRUPPE BLICKT NACH ";
str += directionNameDE[iconIndex];
break;
case Common::FR_FRA:
str = "GROUPE FACE ";
str += directionNameFR[iconIndex];
break;
default:
str = "PARTY FACING ";
str += directionNameEN[iconIndex];
break;
}
<API key>(str.c_str());
} else {
Junk *junk = (Junk *)rawThingPtr;
potentialAttribMask = <API key>;
actualAttribMask = dungeon._objectInfos[<API key> + junk->getType()].getAllowedSlots();
}
break;
}
default:
break;
} // end of switch
if (potentialAttribMask) {
static const char *attribStringEN[4] = {"CONSUMABLE", "POISONED", "BROKEN", "CURSED"};
static const char *attribStringDE[4] = {"ESSBAR", "VERGIFTET", "DEFEKT", "VERFLUCHT"};
static const char *attribStringFR[4] = {"COMESTIBLE", "EMPOISONNE", "BRISE", "MAUDIT"};
const char **attribString = nullptr;
switch (_vm->getGameLanguage()) { // localized
case Common::DE_DEU:
attribString = attribStringDE;
break;
case Common::FR_FRA:
attribString = attribStringFR;
break;
default:
attribString = attribStringEN;
break;
}
char destString[40];
<API key>(potentialAttribMask, actualAttribMask, attribString, destString, "(", ")");
<API key>(destString);
}
uint16 weight = dungeon.getObjectWeight(thingToDraw);
switch (_vm->getGameLanguage()) { // localized
case Common::DE_DEU:
str = "WIEGT " + champMan.<API key>(weight / 10, false, 3) + ",";
break;
case Common::FR_FRA:
str = "PESE " + champMan.<API key>(weight / 10, false, 3) + "KG,";
break;
default:
str = "WEIGHS " + champMan.<API key>(weight / 10, false, 3) + ".";
break;
}
weight -= (weight / 10) * 10;
str += champMan.<API key>(weight, false, 1);
switch (_vm->getGameLanguage()) { // localized
case Common::FR_FRA:
str += ".";
break;
default:
str += " KG.";
break;
}
<API key>(str.c_str());
}
drawPanelArrowOrEye(pressingEye);
}
void InventoryMan::<API key>() {
static const int16 <API key>[6] = {99, 75, 50, 25, 1, 0}; // @ <API key>
DisplayMan &display = *_vm->_displayMan;
ChampionMan &championMan = *_vm->_championMan;
DungeonMan &dungeon = *_vm->_dungeonMan;
if (dungeon._currMap->_difficulty == 0) {
display.<API key> = 0; /* Brightest color palette index */
} else {
/* Get torch light power from both hands of each champion in the party */
int16 counter = 4; /* BUG0_01 Coding error without consequence. The hands of four champions are inspected even if there are less champions in the party. No consequence as the data in unused champions is set to 0 and _vm->_objectMan->f32_getObjectType then returns -1 */
Champion *curChampion = championMan._champions;
int16 torchesLightPower[8];
int16 *curTorchLightPower = torchesLightPower;
while (counter
uint16 slotIndex = kDMSlotActionHand + 1;
while (slotIndex
Thing slotThing = curChampion->_slots[slotIndex];
if ((_vm->_objectMan->getObjectType(slotThing) >= <API key>) &&
(_vm->_objectMan->getObjectType(slotThing) <= <API key>)) {
Weapon *curWeapon = (Weapon *)dungeon.getThingData(slotThing);
*curTorchLightPower = curWeapon->getChargeCount();
} else {
*curTorchLightPower = 0;
}
curTorchLightPower++;
}
curChampion++;
}
/* Sort torch light power values so that the four highest values are in the first four entries in the array <API key> in decreasing order. The last four entries contain the smallest values but they are not sorted */
curTorchLightPower = torchesLightPower;
int16 torchIndex = 0;
while (torchIndex != 4) {
counter = 7 - torchIndex;
int16 *<API key> = &torchesLightPower[torchIndex + 1];
while (counter
if (*<API key> > *curTorchLightPower) {
int16 <API key> = *<API key>;
*<API key> = *curTorchLightPower;
*curTorchLightPower = <API key>;
}
<API key>++;
}
curTorchLightPower++;
torchIndex++;
}
/* Get total light amount provided by the four torches with the highest light power values and by the fifth torch in the array which may be any one of the four torches with the smallest ligh power values */
uint16 <API key> = 6;
torchIndex = 5;
int16 totalLightAmount = 0;
curTorchLightPower = torchesLightPower;
while (torchIndex
if (*curTorchLightPower) {
totalLightAmount += (championMan.<API key>[*curTorchLightPower] << <API key>) >> 6;
<API key> = MAX(0, <API key> - 1);
}
curTorchLightPower++;
}
totalLightAmount += championMan._party._magicalLightAmount;
/* Select palette corresponding to the total light amount */
const int16 *curLightAmount = <API key>;
int16 paletteIndex;
if (totalLightAmount > 0) {
paletteIndex = 0; /* Brightest color palette index */
while (*curLightAmount++ > totalLightAmount)
paletteIndex++;
} else {
paletteIndex = 5; /* Darkest color palette index */
}
display.<API key> = paletteIndex;
}
display.<API key> = true;
}
void InventoryMan::<API key>() {
ChampionMan &championMan = *_vm->_championMan;
DungeonMan &dungeon = *_vm->_dungeonMan;
bool <API key> = false;
int16 championCount = championMan._partyChampionCount;
if (championMan.<API key>)
championCount
Champion *curChampion = championMan._champions;
while (championCount
int16 slotIndex = kDMSlotActionHand + 1;
while (slotIndex
int16 iconIndex = _vm->_objectMan->getIconIndex(curChampion->_slots[slotIndex]);
if ((iconIndex >= <API key>) && (iconIndex <= <API key>)) {
Weapon *curWeapon = (Weapon *)dungeon.getThingData(curChampion->_slots[slotIndex]);
if (curWeapon->getChargeCount()) {
if (curWeapon->setChargeCount(curWeapon->getChargeCount() - 1) == 0) {
curWeapon->setDoNotDiscard(false);
}
<API key> = true;
}
}
}
curChampion++;
}
if (<API key>) {
<API key>();
championMan.<API key>();
}
}
void InventoryMan::<API key>() {
static const char *statisticNamesEN[7] = {"L", "STRENGTH", "DEXTERITY", "WISDOM", "VITALITY", "ANTI-MAGIC", "ANTI-FIRE"};
static const char *statisticNamesDE[7] = {"L", "STAERKE", "FLINKHEIT", "WEISHEIT", "VITALITAET", "ANTI-MAGIE", "ANTI-FEUER"};
static const char *statisticNamesFR[7] = {"L", "FORCE", "DEXTERITE", "SAGESSE", "VITALITE", "ANTI-MAGIE", "ANTI-FEU"};
DisplayMan &display = *_vm->_displayMan;
ChampionMan &championMan = *_vm->_championMan;
const char **statisticNames;
switch (_vm->getGameLanguage()) { // localized
case Common::DE_DEU:
statisticNames = statisticNamesDE;
break;
case Common::FR_FRA:
statisticNames = statisticNamesFR;
break;
default:
statisticNames = statisticNamesEN;
break;
}
closeChest();
uint16 championIndex = _vm->ordinalToIndex(<API key>);
Champion *curChampion = &championMan._champions[championIndex];
display.blitToViewport(display.<API key>(<API key>), _boxPanel, k72_byteWidth, kDMColorRed, 73);
int16 textPosY = 58;
for (uint16 idx = kDMSkillFighter; idx <= kDMSkillWizard; idx++) {
int16 skillLevel = MIN((uint16)16, championMan.getSkillLevel(championIndex, idx | <API key>));
if (skillLevel == 1)
continue;
Common::String displayString;
switch (_vm->getGameLanguage()) { // localized
case Common::FR_FRA:
// Fix original bug: Due to a copy&paste error, the string was concatenate then overwritten be the last part
displayString = Common::String::format("%s %s", championMan._baseSkillName[idx], _skillLevelNames[skillLevel - 2]);
break;
default: // English and German versions are built the same way
displayString = Common::String::format("%s %s", _skillLevelNames[skillLevel - 2], championMan._baseSkillName[idx]);
break;
}
_vm->_textMan->printToViewport(108, textPosY, <API key>, displayString.c_str());
textPosY += 7;
}
textPosY = 86;
for (uint16 idx = kDMStatStrength; idx <= kDMStatAntifire; idx++) {
_vm->_textMan->printToViewport(108, textPosY, <API key>, statisticNames[idx]);
int16 <API key> = curChampion->_statistics[idx][kDMStatCurrent];
uint16 <API key> = curChampion->_statistics[idx][kDMStatMaximum];
int16 statisticColor;
if (<API key> < <API key>)
statisticColor = kDMColorRed;
else if (<API key> > <API key>)
statisticColor = kDMColorLightGreen;
else
statisticColor = <API key>;
_vm->_textMan->printToViewport(174, textPosY, (Color)statisticColor, championMan.<API key>(<API key>, true, 3).c_str());
Common::String displayString = "/" + championMan.<API key>(<API key>, true, 3);
_vm->_textMan->printToViewport(192, textPosY, <API key>, displayString.c_str());
textPosY += 7;
}
}
void InventoryMan::<API key>() {
drawPanel();
_vm->_displayMan->drawViewport(<API key>);
_vm->_eventMan-><API key> = 1;
_vm->_eventMan->showMouse();
_vm->_eventMan->showMouse();
_vm->_eventMan->showMouse();
}
void InventoryMan::drawStopPressingEye() {
drawIconToViewport(<API key>, 12, 13);
drawPanel();
_vm->_displayMan->drawViewport(<API key>);
Thing leaderHandObject = _vm->_championMan->_leaderHandObject;
if (leaderHandObject != _vm->_thingNone)
_vm->_objectMan-><API key>(leaderHandObject);
_vm->_eventMan->showMouse();
_vm->_eventMan->showMouse();
_vm->_eventMan->showMouse();
}
void InventoryMan::clickOnMouth() {
static int16 foodAmounts[8] = {
500, /* Apple */
600, /* Corn */
650, /* Bread */
820, /* Cheese */
550, /* Screamer Slice */
350, /* Worm round */
990, /* Drumstick / Shank */
1400 /* Dragon steak */
};
DisplayMan &display = *_vm->_displayMan;
ChampionMan &championMan = *_vm->_championMan;
DungeonMan &dungeon = *_vm->_dungeonMan;
if (championMan._leaderEmptyHanded) {
if (_panelContent == <API key>)
return;
_vm->_eventMan-><API key> = true;
_vm->_pressingMouth = true;
if (!_vm->_eventMan->isMouseButtonDown(kDMMouseButtonLeft)) {
_vm->_eventMan-><API key> = false;
_vm->_pressingMouth = false;
_vm->_stopPressingMouth = false;
} else {
_vm->_eventMan->showMouse();
_vm->_eventMan-><API key> = 1;
<API key>();
display.drawViewport(<API key>);
}
return;
}
if (championMan.<API key>)
return;
Thing handThing = championMan._leaderHandObject;
if (!getFlag(dungeon._objectInfos[dungeon.getObjectInfoIndex(handThing)]._allowedSlots, kDMMaskMouth))
return;
uint16 iconIndex = _vm->_objectMan->getIconIndex(handThing);
uint16 handThingType = handThing.getType();
uint16 handThingWeight = dungeon.getObjectWeight(handThing);
uint16 championIndex = _vm->ordinalToIndex(<API key>);
Champion *curChampion = &championMan._champions[championIndex];
Junk *junkData = (Junk *)dungeon.getThingData(handThing);
bool <API key>;
if ((iconIndex >= <API key>) && (iconIndex <= <API key>)) {
if (!(junkData->getChargeCount()))
return;
curChampion->_water = MIN(curChampion->_water + 800, 2048);
junkData->setChargeCount(junkData->getChargeCount() - 1);
<API key> = false;
} else if (handThingType == kDMThingTypePotion)
<API key> = false;
else {
junkData->setNextThing(_vm->_thingNone);
<API key> = true;
}
_vm->_eventMan->showMouse();
if (<API key>)
championMan.<API key>();
if (handThingType == kDMThingTypePotion) {
uint16 potionPower = ((Potion *)junkData)->getPower();
uint16 counter = ((511 - potionPower) / (32 + (potionPower + 1) / 8)) >> 1;
uint16 adjustedPotionPower = (potionPower / 25) + 8; /* Value between 8 and 18 */
switch (((Potion *)junkData)->getType()) {
case kDMPotionTypeRos:
<API key>(curChampion, kDMStatDexterity, adjustedPotionPower);
break;
case kDMPotionTypeKu:
<API key>(curChampion, kDMStatStrength, (((Potion *)junkData)->getPower() / 35) + 5); /* Value between 5 and 12 */
break;
case kDMPotionTypeDane:
<API key>(curChampion, kDMStatWisdom, adjustedPotionPower);
break;
case kDMPotionTypeNeta:
<API key>(curChampion, kDMStatVitality, adjustedPotionPower);
break;
case <API key>:
championMan.unpoison(championIndex);
break;
case kDMPotionTypeMon:
curChampion->_currStamina += MIN(curChampion->_maxStamina - curChampion->_currStamina, curChampion->_maxStamina / counter);
break;
case kDMPotionTypeYa: {
adjustedPotionPower += adjustedPotionPower >> 1;
if (curChampion->_shieldDefense > 50)
adjustedPotionPower >>= 2;
curChampion->_shieldDefense += adjustedPotionPower;
TimelineEvent newEvent;
newEvent._type = <API key>;
newEvent._mapTime = _vm->setMapAndTime(dungeon._partyMapIndex, _vm->_gameTime + (adjustedPotionPower * adjustedPotionPower));
newEvent._priority = championIndex;
newEvent._Bu._defense = adjustedPotionPower;
_vm->_timeline-><API key>(&newEvent);
setFlag(curChampion->_attributes, <API key>);
}
break;
case kDMPotionTypeEe: {
uint16 mana = MIN(900, (curChampion->_currMana + adjustedPotionPower) + (adjustedPotionPower - 8));
if (mana > curChampion->_maxMana)
mana -= (mana - MAX(curChampion->_currMana, curChampion->_maxMana)) >> 1;
curChampion->_currMana = mana;
}
break;
case kDMPotionTypeVi: {
uint16 <API key> = MAX(1, (((Potion *)junkData)->getPower() / 42));
curChampion->_currHealth += curChampion->_maxHealth / counter;
int16 wounds = curChampion->_wounds;
if (wounds) { /* If the champion is wounded */
counter = 10;
do {
for (uint16 i = 0; i < <API key>; i++)
curChampion->_wounds &= _vm->getRandomNumber(65536);
<API key> = 1;
} while ((wounds == curChampion->_wounds) && --counter); /* Loop until at least one wound is healed or there are no more heal iterations */
}
setFlag(curChampion->_attributes, kDMAttributeLoad | kDMAttributeWounds);
}
break;
case <API key>:
curChampion->_water = MIN(curChampion->_water + 1600, 2048);
break;
default:
break;
}
((Potion *)junkData)->setType(<API key>);
} else if ((iconIndex >= <API key>) && (iconIndex < <API key>))
curChampion->_food = MIN(curChampion->_food + foodAmounts[iconIndex - <API key>], 2048);
if (curChampion->_currStamina > curChampion->_maxStamina)
curChampion->_currStamina = curChampion->_maxStamina;
if (curChampion->_currHealth > curChampion->_maxHealth)
curChampion->_currHealth = curChampion->_maxHealth;
if (<API key>) {
for (uint16 i = 5; --i; _vm->delay(8)) { /* Animate mouth icon */
_vm->_objectMan->drawIconToScreen(<API key> + !(i & 0x0001), 56, 46);
_vm->_eventMan->discardAllInput();
if (_vm->_engineShouldQuit)
return;
display.updateScreen();
}
} else {
championMan.<API key>();
championMan._champions[championMan._leaderIndex]._load += dungeon.getObjectWeight(handThing) - handThingWeight;
setFlag(championMan._champions[championMan._leaderIndex]._attributes, kDMAttributeLoad);
}
_vm->_sound->requestPlay(<API key>, dungeon._partyMapX, dungeon._partyMapY, <API key>);
setFlag(curChampion->_attributes, <API key>);
if (_panelContent == <API key>)
setFlag(curChampion->_attributes, kDMAttributePanel);
championMan.drawChampionState((ChampionIndex)championIndex);
_vm->_eventMan->hideMouse();
}
void InventoryMan::<API key>(Champion *champ, uint16 statIndex, int16 valueDelta) {
int16 delta;
if (valueDelta >= 0) {
int16 currentValue = champ->_statistics[statIndex][kDMStatCurrent];
if (currentValue > 120) {
valueDelta >>= 1;
if (currentValue > 150) {
valueDelta >>= 1;
}
valueDelta++;
}
delta = MIN(valueDelta, (int16)(170 - currentValue));
} else { /* BUG0_00 Useless code. The function is always called with valueDelta having a positive value */
delta = MAX(valueDelta, int16(champ->_statistics[statIndex][kDMStatMinimum] - champ->_statistics[statIndex][kDMStatCurrent]));
}
champ->_statistics[statIndex][kDMStatCurrent] += delta;
}
void InventoryMan::clickOnEye() {
ChampionMan &championMan = *_vm->_championMan;
_vm->_eventMan-><API key> = true;
_vm->_pressingEye = true;
if (!_vm->_eventMan->isMouseButtonDown(kDMMouseButtonLeft)) {
_vm->_eventMan-><API key> = false;
_vm->_pressingEye = false;
_vm->_stopPressingEye = false;
return;
}
_vm->_eventMan->discardAllInput();
_vm->_eventMan->hideMouse();
_vm->_eventMan->hideMouse();
_vm->_eventMan->hideMouse();
_vm->delay(8);
drawIconToViewport(<API key>, 12, 13);
if (championMan._leaderEmptyHanded)
<API key>();
else {
_vm->_objectMan-><API key>();
drawPanelObject(championMan._leaderHandObject, true);
}
_vm->_displayMan->drawViewport(<API key>);
}
}
|
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <assert.h>
#include <gelf.h>
#include <stdlib.h>
#include "libelfP.h"
int
gelf_update_syminfo (data, ndx, src)
Elf_Data *data;
int ndx;
GElf_Syminfo *src;
{
Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data;
Elf_Scn *scn;
int result = 0;
if (data == NULL)
return 0;
if (unlikely (ndx < 0))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
return 0;
}
if (unlikely (data_scn->d.d_type != ELF_T_SYMINFO))
{
/* The type of the data better should match. */
__libelf_seterrno (ELF_E_DATA_MISMATCH);
return 0;
}
/* The types for 32 and 64 bit are the same. Lucky us. */
assert (sizeof (GElf_Syminfo) == sizeof (Elf32_Syminfo));
assert (sizeof (GElf_Syminfo) == sizeof (Elf64_Syminfo));
scn = data_scn->s;
rwlock_wrlock (scn->elf->lock);
/* Check whether we have to resize the data buffer. */
if (unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data_scn->d.d_size))
{
__libelf_seterrno (ELF_E_INVALID_INDEX);
goto out;
}
((GElf_Syminfo *) data_scn->d.d_buf)[ndx] = *src;
result = 1;
/* Mark the section as modified. */
scn->flags |= ELF_F_DIRTY;
out:
rwlock_unlock (scn->elf->lock);
return result;
}
|
// The LLVM Compiler Infrastructure
// This file is distributed under the University of Illinois Open Source
#ifndef <API key>
#define <API key>
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
namespace llvm {
class DWARFCompileUnit : public DWARFUnit {
public:
DWARFCompileUnit(DWARFContext &Context, const DWARFSection &Section,
const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
StringRef SOS, StringRef AOS, bool LE,
const <API key> &UnitSection)
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LE, UnitSection) {}
void dump(raw_ostream &OS);
// VTable anchor.
~DWARFCompileUnit() override;
};
}
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.